Make Musepack decoders use LFG pseudorandom generator
Originally committed as revision 17880 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
							parent
							
								
									d2f532c8a0
								
							
						
					
					
						commit
						74e2a0784e
					
				@ -25,7 +25,6 @@
 | 
			
		||||
 * divided into 32 subbands.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "libavutil/random.h"
 | 
			
		||||
#include "avcodec.h"
 | 
			
		||||
#include "bitstream.h"
 | 
			
		||||
#include "dsputil.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]);
 | 
			
		||||
 | 
			
		||||
@ -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:
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user