[FFmpeg-cvslog] avcodec/intrax8: Replace always-false check by assert

Andreas Rheinhardt git at videolan.org
Tue Nov 24 12:49:17 EET 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Fri Nov  6 13:15:24 2020 +0100| [802baf212d2ab1b9844696589fc6c18ba748194c] | committer: Andreas Rheinhardt

avcodec/intrax8: Replace always-false check by assert

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=802baf212d2ab1b9844696589fc6c18ba748194c
---

 libavcodec/intrax8.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/libavcodec/intrax8.c b/libavcodec/intrax8.c
index f385423dc1..390c10272e 100644
--- a/libavcodec/intrax8.c
+++ b/libavcodec/intrax8.c
@@ -46,7 +46,7 @@ static VLC j_ac_vlc[2][2][8];  // [quant < 13], [intra / inter], [select]
 static VLC j_dc_vlc[2][8];     // [quant], [select]
 static VLC j_orient_vlc[2][4]; // [quant], [select]
 
-static av_cold int x8_vlc_init(void)
+static av_cold void x8_vlc_init(void)
 {
     int i;
     int offset = 0;
@@ -115,13 +115,7 @@ static av_cold int x8_vlc_init(void)
         init_or_vlc(j_orient_vlc[1][i], x8_orient_lowquant_table[i][0]);
 #undef init_or_vlc
 
-    if (offset != sizeof(table) / sizeof(VLC_TYPE) / 2) {
-        av_log(NULL, AV_LOG_ERROR, "table size %"SIZE_SPECIFIER" does not match needed %i\n",
-               sizeof(table) / sizeof(VLC_TYPE) / 2, offset);
-        return AVERROR_INVALIDDATA;
-    }
-
-    return 0;
+    av_assert2(offset == FF_ARRAY_ELEMS(table));
 }
 
 static void x8_reset_vlc_tables(IntraX8Context *w)
@@ -731,10 +725,6 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
                                    int block_last_index[12],
                                    int mb_width, int mb_height)
 {
-    int ret = x8_vlc_init();
-    if (ret < 0)
-        return ret;
-
     w->avctx = avctx;
     w->idsp = *idsp;
     w->mb_width  = mb_width;
@@ -762,6 +752,8 @@ av_cold int ff_intrax8_common_init(AVCodecContext *avctx,
     ff_intrax8dsp_init(&w->dsp);
     ff_blockdsp_init(&w->bdsp, avctx);
 
+    x8_vlc_init();
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list