1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/indeo2: Remove #ifdef BITSTREAM_READER_LE cruft

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 09c4e5c598 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.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-10-12 03:49:05 +02:00
parent b9727870ae
commit 57eee75c3f

View File

@ -174,10 +174,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
s->decode_delta = buf[18]; s->decode_delta = buf[18];
/* decide whether frame uses deltas or not */ /* 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) if ((ret = init_get_bits8(&s->gb, buf + start, buf_size - start)) < 0)
return ret; return ret;
@ -232,7 +228,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
static av_cold int ir2_decode_init(AVCodecContext *avctx) static av_cold int ir2_decode_init(AVCodecContext *avctx)
{ {
Ir2Context * const ic = avctx->priv_data; Ir2Context * const ic = avctx->priv_data;
static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2];
ic->avctx = avctx; ic->avctx = avctx;
@ -242,17 +237,9 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx)
if (!ic->picture) if (!ic->picture)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ir2_vlc.table = vlc_tables; INIT_LE_VLC_STATIC(&ir2_vlc, CODE_VLC_BITS, IR2_CODES,
ir2_vlc.table_allocated = 1 << CODE_VLC_BITS; &ir2_codes[0][1], 4, 2,
#ifdef BITSTREAM_READER_LE &ir2_codes[0][0], 4, 2, 1 << CODE_VLC_BITS);
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
return 0; return 0;
} }