[Speex-dev] ARM4 filter code

Fritz Koenig fkoenig at on2.com
Tue Dec 6 08:18:58 PST 2005


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
-------------- next part --------------
--- 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),


More information about the Speex-dev mailing list