Mercurial > libavcodec.hg
changeset 1436:b57e910e4235 libavcodec
some fixes (still buggy though)
author | michaelni |
---|---|
date | Mon, 01 Sep 2003 16:40:25 +0000 |
parents | 62c797a19bdf |
children | ba444d478ffe |
files | mdec.c |
diffstat | 1 files changed, 4 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/mdec.c Mon Sep 01 15:53:01 2003 +0000 +++ b/mdec.c Mon Sep 01 16:40:25 2003 +0000 @@ -65,7 +65,7 @@ /* 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 @@ /* 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 @@ 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 @@ 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 @@ } } -#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);