[xiph-commits] r12001 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Fri Nov 3 02:26:24 PST 2006


Author: jm
Date: 2006-11-03 02:26:22 -0800 (Fri, 03 Nov 2006)
New Revision: 12001

Modified:
   trunk/speex/libspeex/fixed_debug.h
Log:
Fixed the PSHR* functions for a shift of zero and fixed error messages
in some operators.


Modified: trunk/speex/libspeex/fixed_debug.h
===================================================================
--- trunk/speex/libspeex/fixed_debug.h	2006-11-03 10:15:27 UTC (rev 12000)
+++ trunk/speex/libspeex/fixed_debug.h	2006-11-03 10:26:22 UTC (rev 12001)
@@ -91,7 +91,7 @@
    int res;
    if (!VERIFY_SHORT(x))
    {
-      fprintf (stderr, "EXTRACT16: input is not short: %d\n", x);
+      fprintf (stderr, "EXTEND32: input is not short: %d\n", x);
    }
    res = x;
    spx_mips++;
@@ -134,7 +134,9 @@
    }
    res = a>>shift;
    if (!VERIFY_INT(res))
+   {
       fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
+   }
    spx_mips++;
    return res;
 }
@@ -143,18 +145,19 @@
    long long  res;
    if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
    {
-      fprintf (stderr, "SHR32: inputs are not int: %d %d\n", (int)a, shift);
+      fprintf (stderr, "SHL32: inputs are not int: %d %d\n", (int)a, shift);
    }
    res = a<<shift;
    if (!VERIFY_INT(res))
-      fprintf (stderr, "SHR32: output is not int: %d\n", (int)res);
+   {
+      fprintf (stderr, "SHL32: output is not int: %d\n", (int)res);
+   }
    spx_mips++;
    return res;
 }
 
-
-#define PSHR16(a,shift) (SHR16(ADD16(a,(1<<((shift)-1))),shift))
-#define PSHR32(a,shift) (SHR32(ADD32(a,(1<<((shift)-1))),shift))
+#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
+#define PSHR32(a,shift) (SHR32((a)+((1<<((shift))>>1)),shift))
 #define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 #define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
 
@@ -170,7 +173,9 @@
    }
    res = a+b;
    if (!VERIFY_SHORT(res))
-      fprintf (stderr, "ADD16: output is not short: %d+%d=%d\n", a,b,res);
+   {
+     fprintf (stderr, "ADD16: output is not short: %d+%d=%d\n", a,b,res);
+   }
    spx_mips++;
    return res;
 }
@@ -220,8 +225,7 @@
 
 #define ADD64(a,b) (MIPS_INC(a)+(b))
 
-#define PSHR(a,shift) (SHR((a)+(1<<((shift)-1)),shift))
-
+#define PSHR(a,shift) (SHR((a)+((1<<((shift))>>1)),shift))
 /* result fits in 16 bits */
 static inline short MULT16_16_16(int a, int b) 
 {
@@ -356,7 +360,9 @@
    res = ((long long)a)*b;
    res >>= 15;
    if (!VERIFY_SHORT(res))
+   {
       fprintf (stderr, "MULT16_16_Q15: output is not short: %d\n", (int)res);
+   }
    spx_mips+=3;
    return res;
 }



More information about the commits mailing list