[FFmpeg-devel] [PATCH] lavu/frame: Optimize frame_copy_video

Jean Delvare jdelvare at suse.de
Mon Dec 14 19:36:51 CET 2015


As I understand it, the temporary stack buffer "src_data" was
introduced solely to avoid a compiler warning. I believe that a better
way to solve this warning it to explicitly cast src->data. This
should be somewhat faster, and just as safe.

Signed-off-by: Jean Delvare <jdelvare at suse.de>
Cc: Anton Khirnov <anton at khirnov.net>
---
 libavutil/frame.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- ffmpeg.orig/libavutil/frame.c	2015-12-14 18:42:06.272234579 +0100
+++ ffmpeg/libavutil/frame.c	2015-12-14 19:05:18.501745387 +0100
@@ -647,7 +647,6 @@ AVFrameSideData *av_frame_get_side_data(
 
 static int frame_copy_video(AVFrame *dst, const AVFrame *src)
 {
-    const uint8_t *src_data[4];
     int i, planes;
 
     if (dst->width  < src->width ||
@@ -659,9 +658,8 @@ static int frame_copy_video(AVFrame *dst
         if (!dst->data[i] || !src->data[i])
             return AVERROR(EINVAL);
 
-    memcpy(src_data, src->data, sizeof(src_data));
     av_image_copy(dst->data, dst->linesize,
-                  src_data, src->linesize,
+                  (const uint8_t **)src->data, src->linesize,
                   dst->format, src->width, src->height);
 
     return 0;


-- 
Jean Delvare
SUSE L3 Support


More information about the ffmpeg-devel mailing list