diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2008-08-17 17:41:48 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2008-08-17 17:41:48 +0000 |
commit | ec0350c983c34d008fd10f07366abd80c19d06e0 (patch) | |
tree | 2a88493c98e2b5caba6c1ce90d5362043d31b6ac | |
parent | defa0cd6f53c5696a999198009b8e0fc662ff2ae (diff) | |
download | ffmpeg-ec0350c983c34d008fd10f07366abd80c19d06e0.tar.gz |
use LFG instead of Mersenne Twister for AC-3 PRNG
Originally committed as revision 14815 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/ac3dec.c | 5 | ||||
-rw-r--r-- | libavcodec/ac3dec.h | 4 | ||||
-rw-r--r-- | libavutil/Makefile | 1 |
3 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 96296f2922..e8477d7ad3 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -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 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) 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 @@ static void get_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_grou 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: diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h index de43609f58..4e0eb1d463 100644 --- a/libavcodec/ac3dec.h +++ b/libavcodec/ac3dec.h @@ -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 @@ typedef struct { ///@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 diff --git a/libavutil/Makefile b/libavutil/Makefile index f21bcda29a..bd95156760 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -9,6 +9,7 @@ OBJS = adler32.o \ des.o \ fifo.o \ intfloat_readwrite.o \ + lfg.o \ lls.o \ log.o \ lzo.o \ |