changeset 9206:bb35ea566fe5 libavcodec

Get rid of av_random in cook.c
author banan
date Fri, 20 Mar 2009 21:32:30 +0000
parents c8ecf9b612b2
children 058ade8fcc89
files cook.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/cook.c	Fri Mar 20 21:15:02 2009 +0000
+++ b/cook.c	Fri Mar 20 21:32:30 2009 +0000
@@ -46,7 +46,8 @@
 #include <stddef.h>
 #include <stdio.h>
 
-#include "libavutil/random.h"
+#include "libavutil/lfg.h"
+#include "libavutil/random_seed.h"
 #include "avcodec.h"
 #include "bitstream.h"
 #include "dsputil.h"
@@ -110,7 +111,7 @@
     int                 bits_per_subpacket;
     int                 cookversion;
     /* states */
-    AVRandomState       random_state;
+    AVLFG               random_state;
 
     /* transform data */
     MDCTContext         mdct_ctx;
@@ -541,7 +542,7 @@
         } else {
             /* noise coding if subband_coef_index[i] == 0 */
             f1 = dither_tab[index];
-            if (av_random(&q->random_state) < 0x80000000) f1 = -f1;
+            if (av_lfg_get(&q->random_state) < 0x80000000) f1 = -f1;
         }
         mlt_p[i] = f1 * rootpow2tab[quant_index+63];
     }
@@ -1066,7 +1067,7 @@
     q->bit_rate = avctx->bit_rate;
 
     /* Initialize RNG. */
-    av_random_init(&q->random_state, 1);
+    av_lfg_init(&q->random_state, ff_random_get_seed());
 
     /* Initialize extradata related variables. */
     q->samples_per_channel = q->samples_per_frame / q->nb_channels;