changeset 9153:4e91d96dd045 libavcodec

Make Musepack decoders use LFG pseudorandom generator
author kostya
date Sun, 08 Mar 2009 16:37:57 +0000
parents 788aa0c09382
children aa459306ee59
files mpc.c mpc.h mpc7.c mpc8.c
diffstat 4 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mpc.c	Sat Mar 07 22:42:09 2009 +0000
+++ b/mpc.c	Sun Mar 08 16:37:57 2009 +0000
@@ -25,7 +25,6 @@
  * divided into 32 subbands.
  */
 
-#include "libavutil/random.h"
 #include "avcodec.h"
 #include "bitstream.h"
 #include "dsputil.h"
--- a/mpc.h	Sat Mar 07 22:42:09 2009 +0000
+++ b/mpc.h	Sun Mar 08 16:37:57 2009 +0000
@@ -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 @@
     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]);
--- a/mpc7.c	Sat Mar 07 22:42:09 2009 +0000
+++ b/mpc7.c	Sun Mar 08 16:37:57 2009 +0000
@@ -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 @@
         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 @@
     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:
--- a/mpc8.c	Sat Mar 07 22:42:09 2009 +0000
+++ b/mpc8.c	Sun Mar 08 16:37:57 2009 +0000
@@ -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 @@
         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 @@
             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;