changeset 924:f931c9d744a5 trunk

[svn] -adjust size of variable in dither code.
author yaz
date Mon, 09 Apr 2007 03:21:02 -0700
parents 053baea2cbef
children 3673bbab7372
files ChangeLog src/madplug/decoder.c src/madplug/dither.c
diffstat 3 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 09 02:26:28 2007 -0700
+++ b/ChangeLog	Mon Apr 09 03:21:02 2007 -0700
@@ -1,3 +1,11 @@
+2007-04-09 09:26:28 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [1974]
+  - replace SSE2 detection macro.
+  
+  trunk/configure.ac |   33 ++++++++++++++++++---------------
+  1 file changed, 18 insertions(+), 15 deletions(-)
+
+
 2007-04-09 04:30:22 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1972]
   - replace random number generator in dithering code with SIMD-oriented Fast Mersenne Twister (SFMT). it reduces CPU load on SSE2 or AltiVec capable platform.
--- a/src/madplug/decoder.c	Mon Apr 09 02:26:28 2007 -0700
+++ b/src/madplug/decoder.c	Mon Apr 09 03:21:02 2007 -0700
@@ -34,7 +34,7 @@
 #define BUFFER_SIZE 16*1024
 #define N_AVERAGE_FRAMES 10
 
-extern long triangular_dither_noise(int nbits);
+extern int triangular_dither_noise(int nbits);
 
 /**
  * Scale PCM data
--- a/src/madplug/dither.c	Mon Apr 09 02:26:28 2007 -0700
+++ b/src/madplug/dither.c	Mon Apr 09 03:21:02 2007 -0700
@@ -14,7 +14,7 @@
 #include "SFMT.h"
 #include "SFMT.c"
 
-long triangular_dither_noise(int nbits)
+int triangular_dither_noise(int nbits)
 {
     // parameter nbits : the peak-to-peak amplitude desired (in bits)
     //  use with nbits set to    2 + nber of bits to be trimmed.
@@ -23,9 +23,9 @@
     // see The Theory of Dithered Quantization by Robert Alexander Wannamaker
     // for complete proof of why that's optimal
 
-    long v = (gen_rand32() / 2 - gen_rand32() / 2);   // in ]-2^31, 2^31[
+    int v = (gen_rand32() / 2 - gen_rand32() / 2);   // in ]-2^31, 2^31[
     //int signe = (v>0) ? 1 : -1;
-    long P = 1 << (32 - nbits); // the power of 2
+    int P = 1 << (32 - nbits); // the power of 2
     v /= P;
     // now v in ]-2^(nbits-1), 2^(nbits-1) [