[xiph-commits] r10621 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Sat Dec 17 04:54:36 PST 2005


Author: jm
Date: 2005-12-17 04:54:33 -0800 (Sat, 17 Dec 2005)
New Revision: 10621

Modified:
   trunk/speex/libspeex/mdf.c
   trunk/speex/libspeex/pseudofloat.h
Log:
FLOAT_DIVU for computing leak estimate


Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c	2005-12-17 12:41:34 UTC (rev 10620)
+++ trunk/speex/libspeex/mdf.c	2005-12-17 12:54:33 UTC (rev 10621)
@@ -437,7 +437,7 @@
       st->Pey = FLOAT_MULT(MIN_LEAK,st->Pyy);
    if (FLOAT_GT(st->Pey, st->Pyy))
       st->Pey = st->Pyy;
-   leak_estimate = REALFLOAT(st->Pey) / (1+REALFLOAT(st->Pyy));
+   leak_estimate = REALFLOAT(FLOAT_DIVU(st->Pey, st->Pyy));
 #else
    alpha = .05*Syy / (SHR(10000,6)+See);
    if (alpha > .008)

Modified: trunk/speex/libspeex/pseudofloat.h
===================================================================
--- trunk/speex/libspeex/pseudofloat.h	2005-12-17 12:41:34 UTC (rev 10620)
+++ trunk/speex/libspeex/pseudofloat.h	2005-12-17 12:54:33 UTC (rev 10621)
@@ -139,9 +139,7 @@
    if (a.m==0)
       return b.m<0;
    else if (b.m==0)
-      return a.m>0;
-   spx_float_t r = (a).e > (b).e ? (spx_float_t) {((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1)),(a).e+1} : (spx_float_t) {((b).m>>1) - ((a).m>>MIN(15,(b).e-(a).e+1)),(b).e+1};
-   
+      return a.m>0;   
    if ((a).e > (b).e)
       return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1));
    else 
@@ -282,6 +280,20 @@
    return (spx_float_t) {DIV32_16(a,b),e};
 }
 
+static inline spx_float_t FLOAT_DIVU(spx_float_t a, spx_float_t b)
+{
+   int e=0;
+   spx_int32_t num;
+   num = a.m;
+   while (a.m >= b.m)
+   {
+      e++;
+      a.m >>= 1;
+   }
+   num = num << (15-e);
+   return (spx_float_t) {DIV32_16(num,b.m),a.e-b.e-15+e};
+}
+
 #else
 
 #define spx_float_t float



More information about the commits mailing list