summaryrefslogtreecommitdiff
path: root/libavcodec/mdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-09-01 16:40:25 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-09-01 16:40:25 +0000
commitbf5d0505c685abaff036fd66f4eda5c8cc40ad72 (patch)
tree31dcde2b508c4a768182dacd66d1b6653abdc52e /libavcodec/mdec.c
parent3f16d933a98dfd0095fbdfbea7d2282261d6db2b (diff)
some fixes (still buggy though)
Originally committed as revision 2191 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mdec.c')
-rw-r--r--libavcodec/mdec.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 01e544cf9e..ea6fe92e9b 100644
--- a/libavcodec/mdec.c
+++ b/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);