summaryrefslogtreecommitdiff
path: root/libavcodec/indeo2.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-11-01 04:16:25 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-08 17:51:46 +0100
commitf25dde0e278b0f70cfbcdb281a80de1b1e75f611 (patch)
tree95afacd09a9578f1ff84d12f09cd74f7837c741e /libavcodec/indeo2.c
parentcd7c3ac84d9e1ec8cfaa1af6b6b3447f40c4b860 (diff)
avcodec/indeo2: Make tables used to initialize VLCs smaller
Switching from ff_init_vlc_sparse() to ff_init_vlc_from_lengths() allows to replace codes which are so long that they need to be stored in an uint16_t by symbols which fit into an uint8_t; furthermore, it is also easily possible to already incorporate the offset (the real range of Indeo 2 symbols starts at one, not zero) into the symbols. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/indeo2.c')
-rw-r--r--libavcodec/indeo2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index 7a568bfbc4..5a9c0e77be 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -46,7 +46,7 @@ static VLC ir2_vlc;
/* Indeo 2 codes are in range 0x01..0x7F and 0x81..0x90 */
static inline int ir2_get_code(GetBitContext *gb)
{
- return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1) + 1;
+ return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1);
}
static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
@@ -237,9 +237,9 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx)
if (!ic->picture)
return AVERROR(ENOMEM);
- INIT_LE_VLC_STATIC(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
- &ir2_codes[0][1], 4, 2,
- &ir2_codes[0][0], 4, 2, 1 << CODE_VLC_BITS);
+ INIT_VLC_STATIC_FROM_LENGTHS(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
+ &ir2_tab[0][1], 2, &ir2_tab[0][0], 2, 1,
+ 0, INIT_VLC_OUTPUT_LE, 1 << CODE_VLC_BITS);
return 0;
}