mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
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>
This commit is contained in:
parent
8d6ec61186
commit
2a00812d82
@ -305,6 +305,7 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
OPEN_READER(re, &s->gb);
|
OPEN_READER(re, &s->gb);
|
||||||
|
i--; // offset by -1 to allow direct indexing of scan_table
|
||||||
for (;;) {
|
for (;;) {
|
||||||
UPDATE_CACHE(re, &s->gb);
|
UPDATE_CACHE(re, &s->gb);
|
||||||
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TCOEFF_VLC_BITS, 2, 0);
|
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);
|
SKIP_COUNTER(re, &s->gb, 1);
|
||||||
}
|
}
|
||||||
i += run;
|
i += run;
|
||||||
if (i > 64) {
|
if (i >= 64) {
|
||||||
av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n",
|
av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d\n",
|
||||||
s->mb_x, s->mb_y);
|
s->mb_x, s->mb_y);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
j = scan_table[i-1];
|
j = scan_table[i];
|
||||||
block[j] = level;
|
block[j] = level;
|
||||||
}
|
}
|
||||||
CLOSE_READER(re, &s->gb);
|
CLOSE_READER(re, &s->gb);
|
||||||
}
|
}
|
||||||
s->block_last_index[n] = i - 1;
|
s->block_last_index[n] = i;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,6 +481,7 @@ static int h263_decode_block(MpegEncContext * s, int16_t * block,
|
|||||||
retry:
|
retry:
|
||||||
{
|
{
|
||||||
OPEN_READER(re, &s->gb);
|
OPEN_READER(re, &s->gb);
|
||||||
|
i--; // offset by -1 to allow direct indexing of scan_table
|
||||||
for(;;) {
|
for(;;) {
|
||||||
UPDATE_CACHE(re, &s->gb);
|
UPDATE_CACHE(re, &s->gb);
|
||||||
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
|
GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);
|
||||||
@ -529,9 +530,9 @@ retry:
|
|||||||
SKIP_COUNTER(re, &s->gb, 1);
|
SKIP_COUNTER(re, &s->gb, 1);
|
||||||
}
|
}
|
||||||
i += run;
|
i += run;
|
||||||
if (i > 64){
|
if (i >= 64){
|
||||||
// redo update without last flag
|
// redo update without last flag, revert -1 offset
|
||||||
i = i - run + ((run-1)&63);
|
i = i - run + ((run-1)&63) + 1;
|
||||||
if (i < 64) {
|
if (i < 64) {
|
||||||
// only last marker, no overrun
|
// only last marker, no overrun
|
||||||
block[scan_table[i]] = level;
|
block[scan_table[i]] = level;
|
||||||
@ -549,7 +550,7 @@ retry:
|
|||||||
av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra);
|
av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
j = scan_table[i-1];
|
j = scan_table[i];
|
||||||
block[j] = level;
|
block[j] = level;
|
||||||
}
|
}
|
||||||
CLOSE_READER(re, &s->gb);
|
CLOSE_READER(re, &s->gb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user