[FFmpeg-cvslog] avcodec/kmvc: Avoid branch when swapping pointers

Andreas Rheinhardt git at videolan.org
Thu Mar 25 01:42:05 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Mar 22 02:40:20 2021 +0100| [7439267eebed3a2616ccf448476d1c8c66caeaed] | committer: Andreas Rheinhardt

avcodec/kmvc: Avoid branch when swapping pointers

Reviewed-by: Tomas Härdin <tjoppen at acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7439267eebed3a2616ccf448476d1c8c66caeaed
---

 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;
 



More information about the ffmpeg-cvslog mailing list