[Speex-dev] Noisy sound quality with Blackfin in WB-mode

Bernhard Gerlach bernhard.gerlach at stud.tu-ilmenau.de
Wed Nov 9 05:02:29 PST 2005

Hello Jean-Marc,

I disabled the Blackfin optimization functions one by one and found  
the error in libspeex/lpc_bfin.h in the autocorrelation computation.  
Compared to the fixed-point-variant of that function (from lpc.c),  
the blackfin-code produces correct values except for the zero offset  
value. Additionally, the loop after the ASM-code assigned values  
(ac32) wrong to the functions output structure (ac). I added a loop  
to compute ac0-value correctly and another loop, that moves ac32- 
values to ac. I checked my code with debug printf's comparing  
Blackfin-ASM-computed values against fixed-point-variant values and  
found the values to be generally the equal. Some  Blackfin-ASM-values  
differ slightly from fixed-point-values what may be the result of  
rounding errors. I can hear no difference any more between fixed- 
point-only- and fixed-point+blackfin-encoded files. I tested for some  
quality and complexity values in wideband and ultra-wideband mode.

Find attached the diff against current svn with my changes.

Best regards,


Index: lpc_bfin.h
--- lpc_bfin.h
+++ lpc_bfin.h
@@ -109,23 +110,19 @@
     : : "m" (xs), "m" (x), "m" (ac32top), "m" (N_lag), "m" (lag_1),  
"m" (nshift)
     : "A0", "A1", "P0", "P1", "P2", "P3", "P4", "R0", "R1", "R2",  
"R3", "R4", "I0", "I1", "L0", "L1", "B0", "B1", "memory"
+   for ( i=1; i<lag; i++ )
+   {
+        ac[i]=SHR32(ac32[i+(10-(lag-1))], ac_shift);
+   }
     for (j=0;j<n;j++)
        d = ADD32(d,SHR32(MULT16_16(x[j],x[j]), shift));
-   ac32[0] = d;
-   for (i=0;i<lag;i++)
-   {
-      d=0;
-      for (j=i;j<lag_1;j++)
-      {
-         d = ADD32(d,SHR32(MULT16_16(x[j],x[j-i]), shift));
-      }
-      if (i)
-         ac32[i] += d;
-      ac[i] = SHR32(ac32[i], ac_shift);
-   }
+   ac[0] = SHR32(d, ac_shift);

More information about the Speex-dev mailing list