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

jm at svn.xiph.org jm at svn.xiph.org
Sat Oct 1 01:07:50 PDT 2005


Author: jm
Date: 2005-10-01 01:07:48 -0700 (Sat, 01 Oct 2005)
New Revision: 10105

Modified:
   trunk/speex/libspeex/misc.c
Log:
fixed gain in ramdom generator (hopefully for fixed and float)


Modified: trunk/speex/libspeex/misc.c
===================================================================
--- trunk/speex/libspeex/misc.c	2005-10-01 07:08:12 UTC (rev 10104)
+++ trunk/speex/libspeex/misc.c	2005-10-01 08:07:48 UTC (rev 10105)
@@ -176,8 +176,10 @@
 #ifdef FIXED_POINT
 spx_word32_t speex_rand(spx_word16_t std, spx_int32_t *seed)
 {
+   spx_word32_t res;
    *seed = 1664525 * *seed + 1013904223;
-   return MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
+   res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
+   return SUB32(res, SHR(res, 3));
 }
 #else
 spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
@@ -187,8 +189,8 @@
    union {int i; float f;} ran;
    *seed = 1664525 * *seed + 1013904223;
    ran.i = jflone | (jflmsk & *seed);
-   ran.f -= 1;
-   return 1.7321*std*ran.f;
+   ran.f -= 1.5;
+   return 3.4642*std*ran.f;
 }
 #endif
 



More information about the commits mailing list