aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mss4.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-09-24 17:47:47 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-10-31 20:47:00 +0100
commit8c39b2bca75c8615080709cf209ce58c5c595dc4 (patch)
treef53025e7eeff8698d94e0ea8d14398205d27eb68 /libavcodec/mss4.c
parent05577d2c7694f2879a23f72617cbbc7a0b75db33 (diff)
downloadffmpeg-8c39b2bca75c8615080709cf209ce58c5c595dc4.tar.gz
avcodec/mss4: Partially inline max_depth and nb_bits of VLC
It is known at compile-time for the vec_entry_vlcs. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mss4.c')
-rw-r--r--libavcodec/mss4.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index 0e7cc3e124..8ae4f152c6 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -156,9 +156,10 @@ static av_always_inline int get_coeff_bits(GetBitContext *gb, int nbits)
return val;
}
-static inline int get_coeff(GetBitContext *gb, VLC *vlc)
+static inline int get_coeff(GetBitContext *gb, const VLC *vlc,
+ int nb_bits, int max_depth)
{
- int val = get_vlc2(gb, vlc->table, vlc->bits, 2);
+ int val = get_vlc2(gb, vlc->table, nb_bits, max_depth);
return get_coeff_bits(gb, val);
}
@@ -171,7 +172,7 @@ static int mss4_decode_dct(GetBitContext *gb, VLC *dc_vlc, VLC *ac_vlc,
memset(block, 0, sizeof(*block) * 64);
- dc = get_coeff(gb, dc_vlc);
+ dc = get_coeff(gb, dc_vlc, dc_vlc->bits, 2);
// DC prediction is the same as in MSS3
if (by) {
if (bx) {
@@ -337,7 +338,7 @@ static int mss4_decode_image_block(MSS4Context *ctx, GetBitContext *gb,
for (i = 0; i < 3; i++) {
vec_len[i] = vec_len_syms[!!i][get_unary(gb, 0, 3)];
for (j = 0; j < vec_len[i]; j++) {
- vec[i][j] = get_coeff(gb, &vec_entry_vlc[!!i]);
+ vec[i][j] = get_coeff(gb, &vec_entry_vlc[!!i], 5, 1);
vec[i][j] += ctx->prev_vec[i][j];
ctx->prev_vec[i][j] = vec[i][j];
}