[FFmpeg-devel] [PATCH 1/7] avcodec/indeo2: Remove #ifdef BITSTREAM_READER_LE cruft
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Mon Oct 12 11:12:11 EEST 2020
Before the LE bitstream reader was used in the Indeo 2 decoder,
a standard BE bitstream reader with swapped bits was used; when the LE
bitstream reader was added, the old code was only #ifdef'ed away and not
removed. Said code has several problems: It modifies the input packet
without ensuring that the packet is indeed writable; and it doesn't work
since 09c4e5c5988c0037d108c5fc2a137d9ad488f7f4 because said commit
removed the BE table used to initialize the VLC table. So just remove
this cruft from the actual decoder, too.
Also use INIT_LE_VLC_STATIC while at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavcodec/indeo2.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index ccf6cd84cb..7a568bfbc4 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -174,10 +174,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
s->decode_delta = buf[18];
/* decide whether frame uses deltas or not */
-#ifndef BITSTREAM_READER_LE
- for (i = 0; i < buf_size; i++)
- buf[i] = ff_reverse[buf[i]];
-#endif
if ((ret = init_get_bits8(&s->gb, buf + start, buf_size - start)) < 0)
return ret;
@@ -232,7 +228,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
static av_cold int ir2_decode_init(AVCodecContext *avctx)
{
Ir2Context * const ic = avctx->priv_data;
- static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2];
ic->avctx = avctx;
@@ -242,17 +237,9 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx)
if (!ic->picture)
return AVERROR(ENOMEM);
- ir2_vlc.table = vlc_tables;
- ir2_vlc.table_allocated = 1 << CODE_VLC_BITS;
-#ifdef BITSTREAM_READER_LE
- init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
- &ir2_codes[0][1], 4, 2,
- &ir2_codes[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE);
-#else
- init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
- &ir2_codes[0][1], 4, 2,
- &ir2_codes[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
-#endif
+ 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);
return 0;
}
--
2.25.1
More information about the ffmpeg-devel
mailing list