|
|
@ -65,7 +65,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n) |
|
|
|
|
|
|
|
|
|
|
|
/* DC coef */ |
|
|
|
/* DC coef */ |
|
|
|
if(a->version==2){ |
|
|
|
if(a->version==2){ |
|
|
|
block[0]= get_sbits(&a->gb, 11); |
|
|
|
block[0]= get_sbits(&a->gb, 10); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
component = (n <= 3 ? 0 : n - 4 + 1); |
|
|
|
component = (n <= 3 ? 0 : n - 4 + 1); |
|
|
|
diff = decode_dc(&a->gb, component); |
|
|
|
diff = decode_dc(&a->gb, component); |
|
|
@ -96,12 +96,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n) |
|
|
|
/* escape */ |
|
|
|
/* escape */ |
|
|
|
run = SHOW_UBITS(re, &a->gb, 6)+1; LAST_SKIP_BITS(re, &a->gb, 6); |
|
|
|
run = SHOW_UBITS(re, &a->gb, 6)+1; LAST_SKIP_BITS(re, &a->gb, 6); |
|
|
|
UPDATE_CACHE(re, &a->gb); |
|
|
|
UPDATE_CACHE(re, &a->gb); |
|
|
|
level = SHOW_SBITS(re, &a->gb, 8); SKIP_BITS(re, &a->gb, 8); |
|
|
|
level = SHOW_SBITS(re, &a->gb, 10); SKIP_BITS(re, &a->gb, 10); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
i += run; |
|
|
|
i += run; |
|
|
|
j = scantable[i]; |
|
|
|
j = scantable[i]; |
|
|
|
/* if(level<0){
|
|
|
|
/* if(level<0){
|
|
|
@ -193,7 +188,6 @@ static int decode_frame(AVCodecContext *avctx, |
|
|
|
a->bitstream_buffer[i] = buf[i+1]; |
|
|
|
a->bitstream_buffer[i] = buf[i+1]; |
|
|
|
a->bitstream_buffer[i+1]= buf[i ]; |
|
|
|
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); |
|
|
|
init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8); |
|
|
|
|
|
|
|
|
|
|
|
/* skip over 4 preamble bytes in stream (typically 0xXX 0xXX 0x00 0x38) */ |
|
|
|
/* 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->qscale= get_bits(&a->gb, 16); |
|
|
|
a->version= 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); |
|
|
|
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) |
|
|
|
if( decode_mb(a, a->block) <0) |
|
|
|
return -1; |
|
|
|
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;
|
|
|
|
// p->quality= (32 + a->inv_qscale/2)/a->inv_qscale;
|
|
|
|
// memset(p->qscale_table, p->quality, p->qstride*a->mb_height);
|
|
|
|
// memset(p->qscale_table, p->quality, p->qstride*a->mb_height);
|
|
|
|
|
|
|
|
|
|
|
|