[xiph-commits] r11823 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Thu Aug 31 07:19:50 PDT 2006
Author: jm
Date: 2006-08-31 07:19:47 -0700 (Thu, 31 Aug 2006)
New Revision: 11823
Modified:
trunk/speex/libspeex/mdf.c
trunk/speex/libspeex/pseudofloat.h
Log:
Increase learning rate for some mis-adaptated conditions (lower bound on RER).
Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c 2006-08-31 07:31:04 UTC (rev 11822)
+++ trunk/speex/libspeex/mdf.c 2006-08-31 14:19:47 UTC (rev 11823)
@@ -468,7 +468,7 @@
int i,j;
int N,M;
spx_word32_t Syy,See,Sxx;
- /*spx_word32_t Sey;*/
+ spx_word32_t Sey;
spx_word16_t leak_estimate;
spx_word16_t ss, ss_1;
spx_float_t Pey = FLOAT_ONE, Pyy=FLOAT_ONE;
@@ -633,7 +633,7 @@
}
/* Compute a bunch of correlations */
- /*Sey = mdf_inner_prod(st->e+st->frame_size, st->y+st->frame_size, st->frame_size);*/
+ Sey = mdf_inner_prod(st->e+st->frame_size, st->y+st->frame_size, st->frame_size);
See = mdf_inner_prod(st->e+st->frame_size, st->e+st->frame_size, st->frame_size);
See = ADD32(See, SHR32(EXTEND32(10000),6));
Syy = mdf_inner_prod(st->y+st->frame_size, st->y+st->frame_size, st->frame_size);
@@ -718,14 +718,23 @@
#ifdef FIXED_POINT
tmp32 = MULT16_32_Q15(leak_estimate,Syy);
tmp32 = ADD32(SHR32(Sxx,13), ADD32(tmp32, SHL32(tmp32,1)));
+ /* Check for y in e (lower bound on RER) */
+ {
+ spx_float_t bound = PSEUDOFLOAT(Sey);
+ bound = FLOAT_DIVU(FLOAT_MULT(bound, bound), PSEUDOFLOAT(ADD32(1,Syy)));
+ if (FLOAT_GT(bound, PSEUDOFLOAT(See)))
+ tmp32 = See;
+ else if (tmp32 < FLOAT_EXTRACT32(bound))
+ tmp32 = FLOAT_EXTRACT32(bound);
+ }
if (tmp32 > SHR32(See,1))
tmp32 = SHR32(See,1);
RER = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32,See),15));
#else
RER = (.0001*Sxx + 3.*MULT16_32_Q15(leak_estimate,Syy)) / See;
- /*FIXME: Enable that when I'm a bit more confident */
- /*if (RER < Sey*Sey/(1+See*Syy))
- RER = Sey*Sey/(1+See*Syy);*/
+ /* Check for y in e (lower bound on RER) */
+ if (RER < Sey*Sey/(1+See*Syy))
+ RER = Sey*Sey/(1+See*Syy);
if (RER > .5)
RER = .5;
#endif
Modified: trunk/speex/libspeex/pseudofloat.h
===================================================================
--- trunk/speex/libspeex/pseudofloat.h 2006-08-31 07:31:04 UTC (rev 11822)
+++ trunk/speex/libspeex/pseudofloat.h 2006-08-31 14:19:47 UTC (rev 11823)
@@ -167,9 +167,9 @@
static inline int FLOAT_LT(spx_float_t a, spx_float_t b)
{
if (a.m==0)
- return b.m<0;
+ return b.m>0;
else if (b.m==0)
- return a.m>0;
+ return a.m<0;
if ((a).e > (b).e)
return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1));
else
@@ -217,11 +217,19 @@
static inline spx_int16_t FLOAT_EXTRACT16(spx_float_t a)
{
if (a.e<0)
- return EXTRACT16((EXTEND32(a.m)+(1<<(-a.e-1)))>>-a.e);
+ return EXTRACT16((EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e);
else
return a.m<<a.e;
}
+static inline spx_int32_t FLOAT_EXTRACT32(spx_float_t a)
+{
+ if (a.e<0)
+ return (EXTEND32(a.m)+(EXTEND32(1)<<(-a.e-1)))>>-a.e;
+ else
+ return EXTEND32(a.m)<<a.e;
+}
+
static inline spx_int32_t FLOAT_MUL32(spx_float_t a, spx_word32_t b)
{
if (a.e<-15)
@@ -362,6 +370,7 @@
#define FLOAT_MUL32(a,b) ((a)*(b))
#define FLOAT_DIV32(a,b) ((a)/(b))
#define FLOAT_EXTRACT16(a) (a)
+#define FLOAT_EXTRACT32(a) (a)
#define FLOAT_ADD(a,b) ((a)+(b))
#define FLOAT_SUB(a,b) ((a)-(b))
#define REALFLOAT(x) (x)
More information about the commits
mailing list