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

Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Sat Nov 12 04:11:52 PST 2005


Hi Bernhard,

It seems like I messed up somewhere in the lpc code. However, it seems
like your patch is also removing some code, which is probably why you
see small differences between your asm version and the fixed point.

I don't have my setup working at the moment, but could you test the
following patch:

Index: lpc_bfin.h
===================================================================
--- lpc_bfin.h  (révision 10333)
+++ lpc_bfin.h  (copie de travail)
@@ -47,7 +47,7 @@
    spx_word32_t ac0=1;
    spx_word32_t ac32[11], *ac32top;
    int shift, ac_shift;
-   ac32top = ac32+10;
+   ac32top = ac32+lag-1;
    int lag_1, N_lag;
    int nshift;
    lag_1 = lag-1;

Let me know if it works.

	Jean-Marc

Le mercredi 09 novembre 2005 à 14:02 +0100, Bernhard Gerlach a écrit :
> 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,
> 
> Bernhard
> 
> 
> 
> 
> 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);
> +   }
> +
> +
>      d=0;
>      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);
> }
> 
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
> 


More information about the Speex-dev mailing list