From: Nick Kurshev Date: Tue, 17 Jun 2003 07:22:31 +0000 (+0000) Subject: finally works now X-Git-Tag: v0.5~16255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=860208a4003ee1c526b33648aa1d12de46b8bd69;p=platform%2Fupstream%2Flibav.git finally works now Originally committed as revision 1966 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 4780915..7a63869 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -24,7 +24,7 @@ typedef struct { float output[40]; float pr1[36]; float pr2[10]; - int phase, phasep; + int phase, phasep; float st1a[111],st1b[37],st1[37]; float st2a[38],st2b[11],st2[11]; @@ -231,12 +231,12 @@ static void unpack(unsigned short *tgt, unsigned char *src, int len) { int x,y,z; int n,temp; - int buffer[38]; + int buffer[len]; for (x=0;x>(8-n); @@ -386,69 +386,69 @@ static void prodsum(float *tgt, float *src, int len, int n) } } -#ifndef max -#define max(a,b) ((a)>(b)?(a):(b)) -#endif +void * decode_block(AVCodecContext * avctx, unsigned char *in, signed short int *out) +{ + int x,y; + Real288_internal *glob=avctx->priv_data; + int cfs=((short*)(avctx->extradata))[3]; /* coded frame size 38 */ + unsigned short int buffer[cfs]; + + unpack(buffer,in,cfs); + for (x=0;x<32;x++) + { + glob->phasep=(glob->phase=x&7)*5; + decode(glob,buffer[x]); + for (y=0;y<5;*(out++)=8*glob->output[glob->phasep+(y++)]); + if (glob->phase==3) update(glob); + } + return out; +} /* Decode a block (celp) */ static int ra288_decode_frame(AVCodecContext * avctx, void *data, int *data_size, uint8_t * buf, int buf_size) { - int x,y,z,bret; - unsigned short int buffer[buf_size]; - unsigned char b[buf_size],*bp; - void *datao; - Real288_internal *glob=avctx->priv_data; - if(avctx->extradata_size>=6) + if(avctx->extradata_size>=6) { - int w=avctx->block_align; - int h=((short*)(avctx->extradata))[1]; - int cfs=((short*)(avctx->extradata))[3]; /* coded frame size */ +//((short*)(avctx->extradata))[0]; /* subpacket size */ +//((short*)(avctx->extradata))[1]; /* subpacket height */ +//((short*)(avctx->extradata))[2]; /* subpacket flavour */ +//((short*)(avctx->extradata))[3]; /* coded frame size */ +//((short*)(avctx->extradata))[4]; /* codec's data length */ +//((short*)(avctx->extradata))[5...] /* codec's data */ + int z,bret; + void *datao; + int w=avctx->block_align; /* 228 */ + int h=((short*)(avctx->extradata))[1]; /* 12 */ + int cfs=((short*)(avctx->extradata))[3]; /* coded frame size 38 */ int i,j; + unsigned char tb[h*w], *ptb; if(buf_sizebuf_size) - { - fprintf(stderr,"ffra288: warning! Context was partly interleaved [%d<%d]\n",buf_size,w*h); - break; - } - } - bret=bp-buf; - bp = b; + { + memcpy(&tb[i*2*w+j*cfs],ptb,cfs); + ptb += cfs; + } + /* Phase 1: decode */ + bret = ptb-buf; + for(z=0;zextradata_size,6); - no_interleave: - bret=buf_size; - bp = buf; - } - datao = data; - z=0; - while(zphasep=(glob->phase=x&7)*5; - decode(glob,buffer[x]); - for (y=0;y<5;*(((int16_t *)data)++)=8*glob->output[glob->phasep+(y++)]); - if (glob->phase==3) update(glob); - } - z+=32; + fprintf(stderr,"ffra288: Error: need extra data!!!\n"); + return 0; } - *data_size = data - datao; - return bret; } AVCodec ra_288_decoder =