1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

bring back some randomness in fft-test. (regression in r18070)

Originally committed as revision 19679 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Loren Merritt 2009-08-22 15:56:06 +00:00
parent 31c57185c5
commit 50b1785a57

View File

@ -129,11 +129,9 @@ static void mdct_ref(float *output, float *input, int nbits)
} }
static float frandom(void) static float frandom(AVLFG *prng)
{ {
AVLFG prng; return (int16_t)av_lfg_get(prng) / 32768.0;
av_lfg_init(&prng, 1);
return (float)((av_lfg_get(&prng) & 0xffff) - 32768) / 32768.0;
} }
static int64_t gettime(void) static int64_t gettime(void)
@ -189,6 +187,8 @@ int main(int argc, char **argv)
MDCTContext m1, *m = &m1; MDCTContext m1, *m = &m1;
int fft_nbits, fft_size; int fft_nbits, fft_size;
double scale = 1.0; double scale = 1.0;
AVLFG prng;
av_lfg_init(&prng, 1);
fft_nbits = 9; fft_nbits = 9;
for(;;) { for(;;) {
@ -243,8 +243,8 @@ int main(int argc, char **argv)
/* generate random data */ /* generate random data */
for(i=0;i<fft_size;i++) { for(i=0;i<fft_size;i++) {
tab1[i].re = frandom(); tab1[i].re = frandom(&prng);
tab1[i].im = frandom(); tab1[i].im = frandom(&prng);
} }
/* checking result */ /* checking result */