comparison 4xm.c @ 5532:f0bee2532ecf libavcodec

replace vlc_type by version and set that from codec_tag which contains the 4xm video version from the demuxer
author michael
date Mon, 13 Aug 2007 00:53:55 +0000
parents 80ee0d3dd53e
children 8708867078ba
comparison
equal deleted inserted replaced
5531:80ee0d3dd53e 5532:f0bee2532ecf
136 VLC pre_vlc; 136 VLC pre_vlc;
137 int last_dc; 137 int last_dc;
138 DECLARE_ALIGNED_8(DCTELEM, block[6][64]); 138 DECLARE_ALIGNED_8(DCTELEM, block[6][64]);
139 uint8_t *bitstream_buffer; 139 uint8_t *bitstream_buffer;
140 unsigned int bitstream_buffer_size; 140 unsigned int bitstream_buffer_size;
141 int vlc_type; 141 int version;
142 CFrameBuffer cfrm[CFRAME_BUFFER_COUNT]; 142 CFrameBuffer cfrm[CFRAME_BUFFER_COUNT];
143 } FourXContext; 143 } FourXContext;
144 144
145 145
146 #define FIX_1_082392200 70936 146 #define FIX_1_082392200 70936
294 } 294 }
295 295
296 static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride){ 296 static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride){
297 const int index= size2index[log2h][log2w]; 297 const int index= size2index[log2h][log2w];
298 const int h= 1<<log2h; 298 const int h= 1<<log2h;
299 int code= get_vlc2(&f->gb, block_type_vlc[f->vlc_type][index].table, BLOCK_TYPE_VLC_BITS, 1); 299 int code= get_vlc2(&f->gb, block_type_vlc[1-f->version][index].table, BLOCK_TYPE_VLC_BITS, 1);
300 300
301 assert(code>=0 && code<=6); 301 assert(code>=0 && code<=6);
302 302
303 if(code == 0){ 303 if(code == 0){
304 src += f->mv[ *f->bytestream++ ]; 304 src += f->mv[ *f->bytestream++ ];
343 if(!get32(buf-4)){ 343 if(!get32(buf-4)){
344 extra=20; 344 extra=20;
345 bitstream_size= get32(buf+8); 345 bitstream_size= get32(buf+8);
346 wordstream_size= get32(buf+12); 346 wordstream_size= get32(buf+12);
347 bytestream_size= get32(buf+16); 347 bytestream_size= get32(buf+16);
348 f->vlc_type= 0;
349 }else{ 348 }else{
350 extra=0; 349 extra=0;
351 bitstream_size = AV_RL16(buf-4); 350 bitstream_size = AV_RL16(buf-4);
352 wordstream_size= AV_RL16(buf-2); 351 wordstream_size= AV_RL16(buf-2);
353 bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0); 352 bytestream_size= FFMAX(length - bitstream_size - wordstream_size, 0);
354 f->vlc_type= 1;
355 } 353 }
356 354
357 if(bitstream_size+ bytestream_size+ wordstream_size + extra != length 355 if(bitstream_size+ bytestream_size+ wordstream_size + extra != length
358 || bitstream_size > (1<<26) 356 || bitstream_size > (1<<26)
359 || bytestream_size > (1<<26) 357 || bytestream_size > (1<<26)
783 } 781 }
784 782
785 static int decode_init(AVCodecContext *avctx){ 783 static int decode_init(AVCodecContext *avctx){
786 FourXContext * const f = avctx->priv_data; 784 FourXContext * const f = avctx->priv_data;
787 785
786 f->version= avctx->codec_tag == 0x40000;
788 common_init(avctx); 787 common_init(avctx);
789 init_vlcs(f); 788 init_vlcs(f);
790 789
791 avctx->pix_fmt= PIX_FMT_RGB565; 790 avctx->pix_fmt= PIX_FMT_RGB565;
792 791