[xiph-commits] r14048 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Thu Oct 25 07:23:40 PDT 2007
Author: jm
Date: 2007-10-25 07:23:40 -0700 (Thu, 25 Oct 2007)
New Revision: 14048
Modified:
trunk/speex/libspeex/math_approx.h
trunk/speex/libspeex/os_support.h
Log:
Had the random functions swapped (fixed vs float). Fixed now.
Modified: trunk/speex/libspeex/math_approx.h
===================================================================
--- trunk/speex/libspeex/math_approx.h 2007-10-25 13:54:21 UTC (rev 14047)
+++ trunk/speex/libspeex/math_approx.h 2007-10-25 14:23:40 UTC (rev 14048)
@@ -48,12 +48,16 @@
/** Generate a pseudo-random number */
static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
{
- spx_word32_t res;
+ const unsigned int jflone = 0x3f800000;
+ const unsigned int jflmsk = 0x007fffff;
+ union {int i; float f;} ran;
*seed = 1664525 * *seed + 1013904223;
- res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
- return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
+ ran.i = jflone | (jflmsk & *seed);
+ ran.f -= 1.5;
+ return 3.4642*std*ran.f;
}
+
#endif
@@ -117,16 +121,12 @@
/** Generate a pseudo-random number */
static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
{
- const unsigned int jflone = 0x3f800000;
- const unsigned int jflmsk = 0x007fffff;
- union {int i; float f;} ran;
+ spx_word32_t res;
*seed = 1664525 * *seed + 1013904223;
- ran.i = jflone | (jflmsk & *seed);
- ran.f -= 1.5;
- return 3.4642*std*ran.f;
+ res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
+ return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
}
-
/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */
/*#define C0 3634
#define C1 21173
Modified: trunk/speex/libspeex/os_support.h
===================================================================
--- trunk/speex/libspeex/os_support.h 2007-10-25 13:54:21 UTC (rev 14047)
+++ trunk/speex/libspeex/os_support.h 2007-10-25 14:23:40 UTC (rev 14048)
@@ -31,6 +31,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef OS_SUPPORT_H
+#define OS_SUPPORT_H
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
@@ -149,3 +152,6 @@
printf ("\n");
}
#endif
+
+#endif
+
More information about the commits
mailing list