video-format: reduce the number of memcpy if possible

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7694>
This commit is contained in:
Diego Nieto 2024-10-19 12:15:00 +02:00 committed by GStreamer Marge Bot
parent b3245eb7bd
commit fe61bc3cee

View file

@ -383,12 +383,17 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
GST_CAT_DEBUG (CAT_PERFORMANCE, "copy plane %d, w:%d h:%d ", plane, w, h);
if (GST_VIDEO_INFO_PLANE_STRIDE (dinfo,
plane) == GST_VIDEO_INFO_PLANE_STRIDE (sinfo, plane)) {
memcpy (dp, sp, GST_VIDEO_INFO_PLANE_STRIDE (dinfo, plane) * h);
} else {
for (j = 0; j < h; j++) {
memcpy (dp, sp, w);
dp += ds;
sp += ss;
}
}
}
return TRUE;
}