This should speed it up significantly on systems where it matters.

Patch attached.

>From b904c881ba23230dc86d0d34d6de0649c8d9c0cc Mon Sep 17 00:00:00 2001
From: Lynne <d...@lynne.ee>
Date: Tue, 10 Aug 2021 12:47:06 +0200
Subject: [PATCH 2/2] hwcontext_vulkan: use GPU memcpy when copying to system
 RAM

This should speed it up significantly on systems where it matters.
---
 libavutil/hwcontext_vulkan.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index b7da6a7e32..92b2c236c8 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -3424,7 +3424,7 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf,
     }
 
     if (!from) {
-        /* Map, copy image to buffer, unmap */
+        /* Map, copy image from buffer, unmap */
         if ((err = map_buffers(dev_ctx, bufs, tmp.data, planes, 0)))
             goto end;
 
@@ -3434,10 +3434,10 @@ static int vulkan_transfer_data(AVHWFramesContext *hwfc, const AVFrame *vkf,
 
             get_plane_wh(&p_w, &p_h, swf->format, swf->width, swf->height, i);
 
-            av_image_copy_plane(tmp.data[i], tmp.linesize[i],
-                                (const uint8_t *)swf->data[i], swf->linesize[i],
-                                FFMIN(tmp.linesize[i], FFABS(swf->linesize[i])),
-                                p_h);
+            av_image_copy_plane_uc_from(tmp.data[i], tmp.linesize[i],
+                                        (const uint8_t *)swf->data[i], swf->linesize[i],
+                                        FFMIN(tmp.linesize[i], FFABS(swf->linesize[i])),
+                                        p_h);
         }
 
         if ((err = unmap_buffers(dev_ctx, bufs, planes, 1)))
-- 
2.32.0.272.g935e593368

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to