[FFmpeg-devel] [PATCH 3/3] avcodec/kmvc: Avoid branch when swapping pointers

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Mar 22 04:06:34 EET 2021


Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavcodec/kmvc.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c
index dd1ae05f2d..56c1977254 100644
--- a/libavcodec/kmvc.c
+++ b/libavcodec/kmvc.c
@@ -345,13 +345,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame,
     }
 
     /* flip buffers */
-    if (ctx->cur == ctx->frm0) {
-        ctx->cur = ctx->frm1;
-        ctx->prev = ctx->frm0;
-    } else {
-        ctx->cur = ctx->frm0;
-        ctx->prev = ctx->frm1;
-    }
+    FFSWAP(uint8_t *, ctx->cur, ctx->prev);
 
     *got_frame = 1;
 
-- 
2.27.0



More information about the ffmpeg-devel mailing list