some fixes (still buggy though)

Originally committed as revision 2191 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 22 years ago
parent 3f16d933a9
commit bf5d0505c6
  1. 27
      libavcodec/mdec.c

@ -65,7 +65,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
/* DC coef */
if(a->version==2){
block[0]= get_sbits(&a->gb, 11);
block[0]= get_sbits(&a->gb, 10);
}else{
component = (n <= 3 ? 0 : n - 4 + 1);
diff = decode_dc(&a->gb, component);
@ -96,12 +96,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
/* escape */
run = SHOW_UBITS(re, &a->gb, 6)+1; LAST_SKIP_BITS(re, &a->gb, 6);
UPDATE_CACHE(re, &a->gb);
level = SHOW_SBITS(re, &a->gb, 8); SKIP_BITS(re, &a->gb, 8);
if (level == -128) {
level = SHOW_UBITS(re, &a->gb, 8) - 256; LAST_SKIP_BITS(re, &a->gb, 8);
} else if (level == 0) {
level = SHOW_UBITS(re, &a->gb, 8) ; LAST_SKIP_BITS(re, &a->gb, 8);
}
level = SHOW_SBITS(re, &a->gb, 10); SKIP_BITS(re, &a->gb, 10);
i += run;
j = scantable[i];
/* if(level<0){
@ -193,7 +188,6 @@ static int decode_frame(AVCodecContext *avctx,
a->bitstream_buffer[i] = buf[i+1];
a->bitstream_buffer[i+1]= buf[i ];
}
// a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (uint32_t*)buf, buf_size/4);
init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8);
/* skip over 4 preamble bytes in stream (typically 0xXX 0xXX 0x00 0x38) */
@ -201,12 +195,11 @@ static int decode_frame(AVCodecContext *avctx,
a->qscale= get_bits(&a->gb, 16);
a->version= get_bits(&a->gb, 16);
skip_bits(&a->gb, 8*8);
printf("qscale:%d (0x%X), version:%d (0x%X)\n", a->qscale, a->qscale, a->version, a->version);
for(a->mb_y=0; a->mb_y<a->mb_height; a->mb_y++){
for(a->mb_x=0; a->mb_x<a->mb_width; a->mb_x++){
for(a->mb_x=0; a->mb_x<a->mb_width; a->mb_x++){
for(a->mb_y=0; a->mb_y<a->mb_height; a->mb_y++){
if( decode_mb(a, a->block) <0)
return -1;
@ -214,18 +207,6 @@ static int decode_frame(AVCodecContext *avctx,
}
}
#if 0
int i;
printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb));
for(i=get_bits_count(&a->gb); i<8*buf_size; i++){
printf("%d", get_bits1(&a->gb));
}
for(i=0; i<s->avctx->extradata_size; i++){
printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]);
}
#endif
// p->quality= (32 + a->inv_qscale/2)/a->inv_qscale;
// memset(p->qscale_table, p->quality, p->qstride*a->mb_height);

Loading…
Cancel
Save