diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-07-09 06:03:59 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-07-09 06:03:59 +0000 |
commit | 7445f9cc675c946f355f53100a44996241c9eb88 (patch) | |
tree | daf6282cd3e5eedeb72833500df4fa6e3fa06dbe | |
parent | 8dbee6538d44570aa7c2415250b9abe00612624d (diff) | |
download | ffmpeg-7445f9cc675c946f355f53100a44996241c9eb88.tar.gz |
fix IPCM_decode_error.h264
Originally committed as revision 14135 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index c77d9ba69d..f8a8b9454a 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4352,12 +4352,11 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in level_code= (prefix<<suffix_length) + get_bits(gb, suffix_length); //part else level_code= prefix + get_bits(gb, 4); //part - }else if(prefix==15){ - level_code= (prefix<<suffix_length) + get_bits(gb, 12); //part - if(suffix_length==0) level_code+=15; //FIXME doesn't make (much)sense }else{ - av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y); - return -1; + level_code= (15<<suffix_length) + get_bits(gb, prefix-3); //part + if(suffix_length==0) level_code+=15; //FIXME doesn't make (much)sense + if(prefix>=16) + level_code += (1<<(prefix-3))-4096; } if(trailing_ones < 3) level_code += 2; @@ -4375,11 +4374,10 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in prefix = get_level_prefix(gb); if(prefix<15){ level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length); - }else if(prefix==15){ - level_code = (prefix<<suffix_length) + get_bits(gb, 12); }else{ - av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y); - return -1; + level_code = (15<<suffix_length) + get_bits(gb, prefix-3); + if(prefix>=16) + level_code += (1<<(prefix-3))-4096; } mask= -(level_code&1); level[i]= (((2+level_code)>>1) ^ mask) - mask; |