diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-04-11 21:15:17 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-04-11 21:15:17 +0000 |
commit | 9c00c3af90c120742461d5217d7b276f7f512e70 (patch) | |
tree | 2dd9a1ae5138728984c5469e146d26c92c53f6b9 | |
parent | 6afd3b92b43818443a193528bd4e909b96068c22 (diff) | |
download | ffmpeg-9c00c3af90c120742461d5217d7b276f7f512e70.tar.gz |
100l (mpeg2 decoding fixed)
Originally committed as revision 1756 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/mpeg12.c | 16 | ||||
-rw-r--r-- | libavcodec/mpeg12data.h | 3 |
2 files changed, 11 insertions, 8 deletions
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index c77e19aeda..c5b39e1c92 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -821,7 +821,7 @@ static void init_vlcs(MpegEncContext *s) init_vlc(&mv_vlc, MV_VLC_BITS, 17, &mbMotionVectorTable[0][1], 2, 1, &mbMotionVectorTable[0][0], 2, 1); - init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 35, + init_vlc(&mbincr_vlc, MBINCR_VLC_BITS, 36, &mbAddrIncrTable[0][1], 2, 1, &mbAddrIncrTable[0][0], 2, 1); init_vlc(&mb_pat_vlc, MB_PAT_VLC_BITS, 63, @@ -1959,16 +1959,18 @@ static int mpeg_decode_slice(AVCodecContext *avctx, for(;;) { int code = get_vlc2(&s->gb, mbincr_vlc.table, MBINCR_VLC_BITS, 2); if (code < 0){ - align_get_bits(&s->gb); - if(s->mb_skip_run != 0 || show_bits(&s->gb, 24) != 1){ - fprintf(stderr, "slice end missmatch\n"); - return -1; - } - goto eos; /* error = end of slice */ + fprintf(stderr, "mb incr damaged\n"); + return -1; } if (code >= 33) { if (code == 33) { s->mb_skip_run += 33; + }else if(code == 35){ + if(s->mb_skip_run != 0 || show_bits(&s->gb, 15) != 0){ + fprintf(stderr, "slice missmatch\n"); + return -1; + } + goto eos; /* end of slice */ } /* otherwise, stuffing, nothing to do */ } else { diff --git a/libavcodec/mpeg12data.h b/libavcodec/mpeg12data.h index 2e7e58de5a..ba52ef22e7 100644 --- a/libavcodec/mpeg12data.h +++ b/libavcodec/mpeg12data.h @@ -185,7 +185,7 @@ static RLTable rl_mpeg2 = { mpeg1_level, }; -static const uint8_t mbAddrIncrTable[35][2] = { +static const uint8_t mbAddrIncrTable[36][2] = { {0x1, 1}, {0x3, 3}, {0x2, 3}, @@ -221,6 +221,7 @@ static const uint8_t mbAddrIncrTable[35][2] = { {0x18, 11}, {0x8, 11}, /* escape */ {0xf, 11}, /* stuffing */ + {0x0, 8}, /* end (and 15 more 0 bits should follow) */ }; static const uint8_t mbPatTable[63][2] = { |