changeset 7601:69d5f318275f libavcodec

use LFG instead of Mersenne Twister for AC-3 PRNG
author jbr
date Sun, 17 Aug 2008 17:41:48 +0000
parents 3e0103ac9d76
children a8a999207b1a
files ac3dec.c ac3dec.h
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.c	Sun Aug 17 17:08:25 2008 +0000
+++ b/ac3dec.c	Sun Aug 17 17:41:48 2008 +0000
@@ -33,7 +33,6 @@
 #include <string.h>
 
 #include "libavutil/crc.h"
-#include "libavutil/random.h"
 #include "avcodec.h"
 #include "ac3_parser.h"
 #include "bitstream.h"
@@ -198,7 +197,7 @@
     ff_mdct_init(&s->imdct_512, 9, 1);
     ff_kbd_window_init(s->window, 5.0, 256);
     dsputil_init(&s->dsp, avctx);
-    av_init_random(0, &s->dith_state);
+    av_lfg_init(&s->dith_state, 0);
 
     /* set bias values for float to int16 conversion */
     if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
@@ -450,7 +449,7 @@
         tbap = bap[i];
         switch (tbap) {
             case 0:
-                coeffs[i] = (av_random(&s->dith_state) & 0x7FFFFF) - 0x400000;
+                coeffs[i] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
                 break;
 
             case 1:
--- a/ac3dec.h	Sun Aug 17 17:08:25 2008 +0000
+++ b/ac3dec.h	Sun Aug 17 17:41:48 2008 +0000
@@ -27,7 +27,7 @@
 #ifndef FFMPEG_AC3DEC_H
 #define FFMPEG_AC3DEC_H
 
-#include "libavutil/random.h"
+#include "libavutil/lfg.h"
 #include "ac3tab.h"
 #include "ac3.h"
 #include "bitstream.h"
@@ -143,7 +143,7 @@
 ///@defgroup dithering zero-mantissa dithering
     int dither_all;                         ///< true if all channels are dithered
     int dither_flag[AC3_MAX_CHANNELS];      ///< dither flags                           (dithflg)
-    AVRandomState dith_state;               ///< for dither generation
+    AVLFG dith_state;                       ///< for dither generation
 ///@}
 
 ///@defgroup imdct IMDCT