summaryrefslogtreecommitdiff
path: root/libavcodec/bitstream.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-10-12 05:24:42 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-10-12 22:20:37 +0200
commit9eb7d8b45d0497d75e5655b79d9eea63bedc833c (patch)
tree69f95eb73cc15a457a840c3f915c85edd3ba25ad /libavcodec/bitstream.c
parente78bbbc2b1e413d11e9edf818e1dc07f16aecf91 (diff)
avcodec/vlc, bitstream: Allow to use BE codes to initialize LE VLC
This is easily possible because ff_init_vlc_sparse() already transforms both LE as well as BE codes to a normal form internally before processing them further. This will be used in subsequent commits. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/bitstream.c')
-rw-r--r--libavcodec/bitstream.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 95e5092b44..77c2b9ce05 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -182,7 +182,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
j = code >> (32 - table_nb_bits);
nb = 1 << (table_nb_bits - n);
inc = 1;
- if (flags & INIT_VLC_LE) {
+ if (flags & INIT_VLC_OUTPUT_LE) {
j = bitswap_32(code);
inc = 1 << n;
}
@@ -217,7 +217,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
subtable_bits = FFMAX(subtable_bits, n);
}
subtable_bits = FFMIN(subtable_bits, table_nb_bits);
- j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
+ j = (flags & INIT_VLC_OUTPUT_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
table[j][1] = -subtable_bits;
ff_dlog(NULL, "%4x: n=%d (subtable)\n",
j, codes[i].bits + table_nb_bits);
@@ -319,7 +319,7 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
av_free(buf); \
return AVERROR(EINVAL); \
} \
- if (flags & INIT_VLC_LE) \
+ if (flags & INIT_VLC_INPUT_LE) \
buf[j].code = bitswap_32(buf[j].code); \
else \
buf[j].code <<= 32 - buf[j].bits; \