From 74e2a0784e7702d2a3e0d88c7ea4f900ea223edd Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sun, 8 Mar 2009 16:37:57 +0000 Subject: [PATCH] Make Musepack decoders use LFG pseudorandom generator Originally committed as revision 17880 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpc.c | 1 - libavcodec/mpc.h | 4 ++-- libavcodec/mpc7.c | 6 +++--- libavcodec/mpc8.c | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libavcodec/mpc.c b/libavcodec/mpc.c index ff010eb633..441adeea57 100644 --- a/libavcodec/mpc.c +++ b/libavcodec/mpc.c @@ -25,7 +25,6 @@ * divided into 32 subbands. */ -#include "libavutil/random.h" #include "avcodec.h" #include "bitstream.h" #include "dsputil.h" diff --git a/libavcodec/mpc.h b/libavcodec/mpc.h index df7915ee48..2720afefaf 100644 --- a/libavcodec/mpc.h +++ b/libavcodec/mpc.h @@ -28,7 +28,7 @@ #ifndef AVCODEC_MPC_H #define AVCODEC_MPC_H -#include "libavutil/random.h" +#include "libavutil/lfg.h" #include "avcodec.h" #include "bitstream.h" #include "dsputil.h" @@ -62,7 +62,7 @@ typedef struct { int cur_frame, frames; uint8_t *bits; int buf_size; - AVRandomState rnd; + AVLFG rnd; int frames_to_skip; /* for synthesis */ DECLARE_ALIGNED_16(MPA_INT, synth_buf[MPA_MAX_CHANNELS][512*2]); diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 7077c96fc2..7362a19192 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -25,7 +25,7 @@ * divided into 32 subbands. */ -#include "libavutil/random.h" +#include "libavutil/lfg.h" #include "avcodec.h" #include "bitstream.h" #include "dsputil.h" @@ -53,7 +53,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); - av_random_init(&c->rnd, 0xDEADBEEF); + av_lfg_init(&c->rnd, 0xDEADBEEF); dsputil_init(&c->dsp, avctx); c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4); ff_mpc_init(); @@ -118,7 +118,7 @@ static inline void idx_to_quant(MPCContext *c, GetBitContext *gb, int idx, int * switch(idx){ case -1: for(i = 0; i < SAMPLES_PER_BAND; i++){ - *dst++ = (av_random(&c->rnd) & 0x3FC) - 510; + *dst++ = (av_lfg_get(&c->rnd) & 0x3FC) - 510; } break; case 1: diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index d235edd861..ff7d5e5805 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -25,7 +25,7 @@ * divided into 32 subbands. */ -#include "libavutil/random.h" +#include "libavutil/lfg.h" #include "avcodec.h" #include "bitstream.h" #include "dsputil.h" @@ -100,7 +100,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); - av_random_init(&c->rnd, 0xDEADBEEF); + av_lfg_init(&c->rnd, 0xDEADBEEF); dsputil_init(&c->dsp, avctx); ff_mpc_init(); @@ -284,7 +284,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, switch(res){ case -1: for(j = 0; j < SAMPLES_PER_BAND; j++) - c->Q[ch][off + j] = (av_random(&c->rnd) & 0x3FC) - 510; + c->Q[ch][off + j] = (av_lfg_get(&c->rnd) & 0x3FC) - 510; break; case 0: break;