changeset 10074:c4a83f3a5c9f libavcodec

bring back some randomness in fft-test. (regression in r18070)
author lorenm
date Sat, 22 Aug 2009 15:56:06 +0000
parents 57d76996ccb8
children e944ff8f487a
files fft-test.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/fft-test.c	Fri Aug 21 16:54:42 2009 +0000
+++ b/fft-test.c	Sat Aug 22 15:56:06 2009 +0000
@@ -129,11 +129,9 @@
 }
 
 
-static float frandom(void)
+static float frandom(AVLFG *prng)
 {
-    AVLFG prng;
-    av_lfg_init(&prng, 1);
-    return (float)((av_lfg_get(&prng) & 0xffff) - 32768) / 32768.0;
+    return (int16_t)av_lfg_get(prng) / 32768.0;
 }
 
 static int64_t gettime(void)
@@ -189,6 +187,8 @@
     MDCTContext m1, *m = &m1;
     int fft_nbits, fft_size;
     double scale = 1.0;
+    AVLFG prng;
+    av_lfg_init(&prng, 1);
 
     fft_nbits = 9;
     for(;;) {
@@ -243,8 +243,8 @@
     /* generate random data */
 
     for(i=0;i<fft_size;i++) {
-        tab1[i].re = frandom();
-        tab1[i].im = frandom();
+        tab1[i].re = frandom(&prng);
+        tab1[i].im = frandom(&prng);
     }
 
     /* checking result */