[FFmpeg-cvslog] avcodec/mpeg12dec: Revert Change to mpeg2_fast_decode_block_non_intra
Michael Niedermayer
git at videolan.org
Sun Jan 26 03:18:11 CET 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 26 02:53:17 2014 +0100| [7667afffb8dd54595ef2a959c385babd4c9c94cf] | committer: Michael Niedermayer
avcodec/mpeg12dec: Revert Change to mpeg2_fast_decode_block_non_intra
This fixes the speed regression from 20626f53e9f41cb3db82329ed3db7d773cfa3a8f
and still checks sufficiently to prevent out of allocated memory accesses
due to the index
Before:
1823 decicycles in mpeg2_fast_decode_block_non_intra, 8388493 runs, 115 skips
After:
1808 decicycles in mpeg2_fast_decode_block_non_intra, 8388494 runs, 114 skips
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7667afffb8dd54595ef2a959c385babd4c9c94cf
---
libavcodec/mpeg12dec.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index f1899e0..79fc65c 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -474,7 +474,6 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
if (level != 0) {
i += run;
- check_scantable_index(s, i);
j = scantable[i];
level = ((level * 2 + 1) * qscale) >> 1;
level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
@@ -486,7 +485,6 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
level = SHOW_SBITS(re, &s->gb, 12); SKIP_BITS(re, &s->gb, 12);
i += run;
- check_scantable_index(s, i);
j = scantable[i];
if (level < 0) {
level = ((-level * 2 + 1) * qscale) >> 1;
@@ -497,7 +495,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
}
block[j] = level;
- if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF)
+ if (((int32_t)GET_CACHE(re, &s->gb)) <= (int32_t)0xBFFFFFFF || i > 63)
break;
UPDATE_CACHE(re, &s->gb);
More information about the ffmpeg-cvslog
mailing list