Commit c0d32686 authored by Reimar Döffinger's avatar Reimar Döffinger

h261dec: Optimize new RL_VLC based decoding.

Together with the switch to RL_VLC this results in about
10% speedup for this inner loop.
Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent da0a670b
...@@ -318,27 +318,25 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded) ...@@ -318,27 +318,25 @@ static int h261_decode_block(H261Context *h, int16_t *block, int n, int coded)
/* The remaining combinations of (run, level) are encoded with a /* The remaining combinations of (run, level) are encoded with a
* 20-bit word consisting of 6 bits escape, 6 bits run and 8 bits * 20-bit word consisting of 6 bits escape, 6 bits run and 8 bits
* level. */ * level. */
run = SHOW_UBITS(re, &s->gb, 6); run = SHOW_UBITS(re, &s->gb, 6) + 1;
SKIP_CACHE(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6);
level = SHOW_SBITS(re, &s->gb, 8); level = SHOW_SBITS(re, &s->gb, 8);
SKIP_COUNTER(re, &s->gb, 6 + 8); SKIP_COUNTER(re, &s->gb, 6 + 8);
} else if (level == 0) { } else if (level == 0) {
break; break;
} else { } else {
run--;
if (SHOW_UBITS(re, &s->gb, 1)) if (SHOW_UBITS(re, &s->gb, 1))
level = -level; level = -level;
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]; j = scan_table[i-1];
block[j] = level; block[j] = level;
i++;
} }
CLOSE_READER(re, &s->gb); CLOSE_READER(re, &s->gb);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment