You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avcodec/utvideodec: hardcode vlc bits
2.5% faster vlc decoding Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -73,8 +73,8 @@ static int build_huff10(const uint8_t *src, VLC *vlc, int *fsym)
|
|||||||
syms[i] = he[i].sym;
|
syms[i] = he[i].sym;
|
||||||
code += 0x80000000u >> (he[i].len - 1);
|
code += 0x80000000u >> (he[i].len - 1);
|
||||||
}
|
}
|
||||||
|
#define VLC_BITS 11
|
||||||
return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 11), last + 1,
|
return ff_init_vlc_sparse(vlc, VLC_BITS, last + 1,
|
||||||
bits, sizeof(*bits), sizeof(*bits),
|
bits, sizeof(*bits), sizeof(*bits),
|
||||||
codes, sizeof(*codes), sizeof(*codes),
|
codes, sizeof(*codes), sizeof(*codes),
|
||||||
syms, sizeof(*syms), sizeof(*syms), 0);
|
syms, sizeof(*syms), sizeof(*syms), 0);
|
||||||
@@ -117,7 +117,7 @@ static int build_huff(const uint8_t *src, VLC *vlc, int *fsym)
|
|||||||
code += 0x80000000u >> (he[i].len - 1);
|
code += 0x80000000u >> (he[i].len - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ff_init_vlc_sparse(vlc, FFMIN(he[last].len, 11), last + 1,
|
return ff_init_vlc_sparse(vlc, VLC_BITS, last + 1,
|
||||||
bits, sizeof(*bits), sizeof(*bits),
|
bits, sizeof(*bits), sizeof(*bits),
|
||||||
codes, sizeof(*codes), sizeof(*codes),
|
codes, sizeof(*codes), sizeof(*codes),
|
||||||
syms, sizeof(*syms), sizeof(*syms), 0);
|
syms, sizeof(*syms), sizeof(*syms), 0);
|
||||||
@@ -196,7 +196,7 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
|
|||||||
prev = 0x200;
|
prev = 0x200;
|
||||||
for (j = sstart; j < send; j++) {
|
for (j = sstart; j < send; j++) {
|
||||||
for (i = 0; i < width * step; i += step) {
|
for (i = 0; i < width * step; i += step) {
|
||||||
pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
|
pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
|
||||||
if (pix < 0) {
|
if (pix < 0) {
|
||||||
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -302,7 +302,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
|
|||||||
prev = 0x80;
|
prev = 0x80;
|
||||||
for (j = sstart; j < send; j++) {
|
for (j = sstart; j < send; j++) {
|
||||||
for (i = 0; i < width * step; i += step) {
|
for (i = 0; i < width * step; i += step) {
|
||||||
pix = get_vlc2(&gb, vlc.table, vlc.bits, 3);
|
pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
|
||||||
if (pix < 0) {
|
if (pix < 0) {
|
||||||
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Reference in New Issue
Block a user