huffyuvdec: clean up macro
authorChristophe Gisquet <christophe.gisquet@gmail.com>
Wed, 4 Jun 2014 20:48:56 +0000 (20:48 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 4 Jun 2014 21:55:48 +0000 (23:55 +0200)
It's no longer used inside another specific macro, so rename it.
Also remove duplicated definition and realign code.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/huffyuvdec.c

index 428f9e1..4c0d297 100644 (file)
@@ -559,7 +559,8 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
     return 0;
 }
 
-#define DUAL_INTERN(dst, table, gb, name, bits, max_depth)            \
+/** Subset of GET_VLC for use in hand-roller VLC code */
+#define VLC_INTERN(dst, table, gb, name, bits, max_depth)   \
     code = table[index][0];                                 \
     n    = table[index][1];                                 \
     if (max_depth > 1 && n < 0) {                           \
@@ -597,11 +598,11 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
             LAST_SKIP_BITS(name, gb, n);                            \
         } else {                                                    \
             int nb_bits;                                            \
-            DUAL_INTERN(dst0, table1, gb, name, bits, max_depth);   \
+            VLC_INTERN(dst0, table1, gb, name, bits, max_depth);    \
                                                                     \
             UPDATE_CACHE(re, gb);                                   \
             index = SHOW_UBITS(name, gb, bits);                     \
-            DUAL_INTERN(dst1, table2, gb, name, bits, max_depth);   \
+            VLC_INTERN(dst1, table2, gb, name, bits, max_depth);    \
         }                                                           \
     } while (0)
 
@@ -720,33 +721,6 @@ static void decode_gray_bitstream(HYuvContext *s, int count)
     CLOSE_READER(re, &s->gb);
 }
 
-#define GET_VLC_DUAL(dst0, dst1, name, gb, dtable, table1, table2,  \
-                     bits, max_depth, rsvd )                        \
-    do {                                                            \
-        unsigned int index = SHOW_UBITS(name, gb, bits);            \
-        int          code  = dtable[index][0];                      \
-        int          n     = dtable[index][1];                      \
-                                                                    \
-        if (code != rsvd && n>0) {                                  \
-            dst0 = code>>8;                                         \
-            dst1 = code;                                            \
-            LAST_SKIP_BITS(name, gb, n);                            \
-        } else {                                                    \
-            int nb_bits;                                            \
-            DUAL_INTERN(dst0, table1, gb, name, bits, max_depth);   \
-                                                                    \
-            UPDATE_CACHE(re, gb);                                   \
-            index = SHOW_UBITS(name, gb, bits);                     \
-            DUAL_INTERN(dst1, table2, gb, name, bits, max_depth);   \
-        }                                                           \
-    } while (0)
-
-#define READ_2PIX(dst0, dst1, plane1)\
-    UPDATE_CACHE(re, &s->gb); \
-    GET_VLC_DUAL(dst0, dst1, re, &s->gb, s->vlc[4+plane1].table, \
-                 s->vlc[0].table, s->vlc[plane1].table, \
-                 VLC_BITS, 3, 0xffff)
-
 static av_always_inline void decode_bgr_1(HYuvContext *s, int count,
                                           int decorrelate, int alpha)
 {
@@ -768,37 +742,37 @@ static av_always_inline void decode_bgr_1(HYuvContext *s, int count,
         } else {
             int nb_bits;
             if(decorrelate) {
-                DUAL_INTERN(s->temp[0][4 * i + G], s->vlc[1].table,
-                            &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table,
+                           &s->gb, re, VLC_BITS, 3);
 
                 UPDATE_CACHE(re, &s->gb);
                 index = SHOW_UBITS(re, &s->gb, VLC_BITS);
-                DUAL_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3);
                 s->temp[0][4 * i + B] = code + s->temp[0][4 * i + G];
 
                 UPDATE_CACHE(re, &s->gb);
                 index = SHOW_UBITS(re, &s->gb, VLC_BITS);
-                DUAL_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3);
                 s->temp[0][4 * i + R] = code + s->temp[0][4 * i + G];
             } else {
-                DUAL_INTERN(s->temp[0][4 * i + B], s->vlc[0].table,
-                            &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(s->temp[0][4 * i + B], s->vlc[0].table,
+                           &s->gb, re, VLC_BITS, 3);
 
                 UPDATE_CACHE(re, &s->gb);
                 index = SHOW_UBITS(re, &s->gb, VLC_BITS);
-                DUAL_INTERN(s->temp[0][4 * i + G], s->vlc[1].table,
-                            &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table,
+                           &s->gb, re, VLC_BITS, 3);
 
                 UPDATE_CACHE(re, &s->gb);
                 index = SHOW_UBITS(re, &s->gb, VLC_BITS);
-                DUAL_INTERN(s->temp[0][4 * i + R], s->vlc[2].table,
-                            &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(s->temp[0][4 * i + R], s->vlc[2].table,
+                           &s->gb, re, VLC_BITS, 3);
             }
             if (alpha) {
                 UPDATE_CACHE(re, &s->gb);
                 index = SHOW_UBITS(re, &s->gb, VLC_BITS);
-                DUAL_INTERN(s->temp[0][4 * i + A], s->vlc[2].table,
-                            &s->gb, re, VLC_BITS, 3);
+                VLC_INTERN(s->temp[0][4 * i + A], s->vlc[2].table,
+                           &s->gb, re, VLC_BITS, 3);
             }
         }
     }