[FFmpeg-devel] [PATCH 01/57] avcodec/vc1: Combine identical checks

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Jun 12 16:16:20 EEST 2024


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/vc1.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 987e77fcc7..d263c70be7 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -583,21 +583,23 @@ int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContex
 
 static void rotate_luts(VC1Context *v)
 {
-#define ROTATE(DEF, L, N, C, A) do {                          \
-        if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) { \
-            C = A;                                            \
-        } else {                                              \
+    if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) {
+        v->curr_use_ic = &v->aux_use_ic;
+        v->curr_luty   = v->aux_luty;
+        v->curr_lutuv  = v->aux_lutuv;
+    } else {
+#define ROTATE(DEF, L, N, C) do {                             \
             DEF;                                              \
             memcpy(&tmp, L   , sizeof(tmp));                  \
             memcpy(L   , N   , sizeof(tmp));                  \
             memcpy(N   , &tmp, sizeof(tmp));                  \
             C = N;                                            \
-        }                                                     \
     } while(0)
 
-    ROTATE(int tmp,             &v->last_use_ic, &v->next_use_ic, v->curr_use_ic, &v->aux_use_ic);
-    ROTATE(uint8_t tmp[2][256], v->last_luty,   v->next_luty,   v->curr_luty,   v->aux_luty);
-    ROTATE(uint8_t tmp[2][256], v->last_lutuv,  v->next_lutuv,  v->curr_lutuv,  v->aux_lutuv);
+        ROTATE(int tmp,             &v->last_use_ic, &v->next_use_ic, v->curr_use_ic);
+        ROTATE(uint8_t tmp[2][256],  v->last_luty,    v->next_luty,   v->curr_luty);
+        ROTATE(uint8_t tmp[2][256],  v->last_lutuv,   v->next_lutuv,  v->curr_lutuv);
+    }
 
     INIT_LUT(32, 0, v->curr_luty[0], v->curr_lutuv[0], 0);
     INIT_LUT(32, 0, v->curr_luty[1], v->curr_lutuv[1], 0);
-- 
2.40.1



More information about the ffmpeg-devel mailing list