From 91fce67691088fca6311fa38f7a56900f028775b Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 4 May 2024 00:30:22 +0200 Subject: [PATCH] avcodec/vc1: Combine identical checks Signed-off-by: Andreas Rheinhardt --- 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);