[Speex-dev] ARM4 filter code

Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Wed Dec 7 05:00:22 PST 2005


If I understand you correctly, this is just a matter of the rounding
happening in a different way on the C version and the ARM version. If
that's the case, then I don't think it's a problem, since there is
absolutely no notion of bit-exact encoding with Speex.

	Jean-Marc

Le mardi 06 décembre 2005 à 11:18 -0500, Fritz Koenig a écrit :
> I have found that filter_mem2 fixed point does not match the inlined 
> assembly version for arm4.  Looking closer there appears to be an off by 
> one error.  It occurs when setting the value of mem at the end of the 
> inner loop.  In the C fixed point version this is done with a subtract.  
> In the arm4 version instead of multiplying den by yi, it is multipled by 
> nyi and then an add is done.  This will result in a rounding error with 
> negative numbers.  If a small negative fixed point number is shifted 
> down it will always result in -1, while shifting a small positive number 
> down will result in 0.
> 
> Don't know if it is an issue that the fixed point arm code is not bit 
> exact.  I have included a patch against the 1.1.11.1 that will make the 
> filter_mem2 bit exact with the C.
> 
> -Fritz
> pièce jointe document plein texte (filters_arm4_patch.diff)
> --- filters_arm4.h	2005-11-16 06:08:28.000000000 -0500
> +++ filters_arm4_new.h	2005-12-06 11:06:51.012221200 -0500
> @@ -240,9 +240,11 @@
>              "\tmov %8, %8, lsr #15\n"
>              "\tadd %10, %8, %9, lsl #17\n"
>              "\tldrsh %6, [%2], #2\n"
> -            "\tsmull %8, %9, %5, %6\n"
> -            "\tadd %10, %10, %8, lsr #15\n"
> -            "\tadd %10, %10, %9, lsl #17\n"
> +            "\trsb %11, %5, #0\n"
> +            "\tsmull %8, %9, %11, %6\n"
> +            "\tmov %8, %8, lsr #15\n"
> +            "\tadd %8, %8, %9, lsl #17\n"
> +            "\tsub %10, %10, %8\n"
>              "\tstr %10, [%0], #4 \n"
>  
>           : "=r" (deadm), "=r" (deadn), "=r" (deadd), "=r" (deadidx),
> _______________________________________________
> 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