]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/indeo2: Remove #ifdef BITSTREAM_READER_LE cruft
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 12 Oct 2020 01:49:05 +0000 (03:49 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 12 Oct 2020 20:06:28 +0000 (22:06 +0200)
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.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/indeo2.c

index ccf6cd84cb62a3aa998db39f6a001dfd2693e293..7a568bfbc41dec730dacd915d28b96f1495f5e71 100644 (file)
@@ -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;
 }