[FFmpeg-devel] [PATCH] lavu/frame: Optimize frame_copy_video
Michael Niedermayer
michaelni at gmx.at
Mon Dec 14 23:18:39 CET 2015
On Mon, Dec 14, 2015 at 07:36:51PM +0100, Jean Delvare wrote:
> 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,
I think this may be a aliasing violation and thus undefined
not that i like that or consider that sane
so if someone says iam wrong, i would certainly not be unhappy
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151214/1ce5da18/attachment.sig>
More information about the ffmpeg-devel
mailing list