]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/4xm.c
x86: ff_get_cpu_flags_x86(): Avoid a pointless variable indirection
[ffmpeg] / libavcodec / 4xm.c
index 8d7db98653ab8f336d145b8a70c6783458727202..2b59c6b19de72b7eb1a3a59b514c49698f575bce 100644 (file)
@@ -240,15 +240,18 @@ static void idct(DCTELEM block[64])
 
 static av_cold void init_vlcs(FourXContext *f)
 {
-    static VLC_TYPE table[8][32][2];
-    int i;
-
-    for (i = 0; i < 8; i++) {
-        block_type_vlc[0][i].table           = table[i];
-        block_type_vlc[0][i].table_allocated = 32;
-        init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,
-                 &block_type_tab[0][i][0][1], 2, 1,
-                 &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
+    static VLC_TYPE table[2][4][32][2];
+    int i, j;
+
+    for (i = 0; i < 2; i++) {
+        for (j = 0; j < 4; j++) {
+            block_type_vlc[i][j].table           = table[i][j];
+            block_type_vlc[i][j].table_allocated = 32;
+            init_vlc(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7,
+                     &block_type_tab[i][j][0][1], 2, 1,
+                     &block_type_tab[i][j][0][0], 2, 1,
+                     INIT_VLC_USE_NEW_STATIC);
+        }
     }
 }
 
@@ -552,7 +555,7 @@ static int decode_i_mb(FourXContext *f)
 static const uint8_t *read_huffman_tables(FourXContext *f,
                                           const uint8_t * const buf)
 {
-    int frequency[512];
+    int frequency[512] = { 0 };
     uint8_t flag[512];
     int up[512];
     uint8_t len_tab[257];
@@ -561,7 +564,6 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
     const uint8_t *ptr = buf;
     int j;
 
-    memset(frequency, 0, sizeof(frequency));
     memset(up, -1, sizeof(up));
 
     start = *ptr++;
@@ -661,8 +663,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
 
     for (y = 0; y < height; y += 16) {
         for (x = 0; x < width; x += 16) {
-            unsigned int color[4], bits;
-            memset(color, 0, sizeof(color));
+            unsigned int color[4] = { 0 }, bits;
             // warning following is purely guessed ...
             color[0] = bytestream2_get_le16u(&g3);
             color[1] = bytestream2_get_le16u(&g3);
@@ -880,7 +881,7 @@ static av_cold void common_init(AVCodecContext *avctx)
 {
     FourXContext * const f = avctx->priv_data;
 
-    dsputil_init(&f->dsp, avctx);
+    ff_dsputil_init(&f->dsp, avctx);
 
     f->avctx = avctx;
 }
@@ -918,7 +919,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
         av_freep(&f->cfrm[i].data);
         f->cfrm[i].allocated_size = 0;
     }
-    free_vlc(&f->pre_vlc);
+    ff_free_vlc(&f->pre_vlc);
     if (f->current_picture.data[0])
         avctx->release_buffer(avctx, &f->current_picture);
     if (f->last_picture.data[0])
@@ -930,7 +931,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
 AVCodec ff_fourxm_decoder = {
     .name           = "4xm",
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_4XM,
+    .id             = AV_CODEC_ID_4XM,
     .priv_data_size = sizeof(FourXContext),
     .init           = decode_init,
     .close          = decode_end,