diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2014-08-31 22:30:04 +0400 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2014-09-01 21:41:20 +0400 |
commit | 2a00812d82c5f8a76328597c8b5ee1d4cd9c49dc (patch) | |
tree | 1a22cf6431c9c5d07463bfe50578e13033ec1c55 /libavcodec/h261dec.c | |
parent | 8d6ec6118698efaa662044a538e3dbc790d2f46b (diff) |
h261dec, ituh263dec: Avoid unnecessary -1 inside inner loop.
3646 -> 3597 decicycles in inner loop when decoding
vsynth1-flv.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/h261dec.c')
-rw-r--r-- | libavcodec/h261dec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index f286d23635..c9470b1296 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -305,6 +305,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded) } { OPEN_READER(re, &s->gb); + i--; // offset by -1 to allow direct indexing of scan_table for (;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0); @@ -330,17 +331,17 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded) SKIP_COUNTER(re, &s->gb, 1); } i += run; - if (i > 64) { + if (i >= 64) { av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n", s->mb_x, s->mb_y); return -1; } - j = scan_table[i-1]; + j = scan_table[i]; block[j] = level; } CLOSE_READER(re, &s->gb); } - s->block_last_index[n] = i - 1; + s->block_last_index[n] = i; return 0; } |