[FFmpeg-cvslog] avutil/hwcontext_d3d12va: Use av_image_copy() wrapper

Andreas Rheinhardt git at videolan.org
Wed Jan 24 17:25:48 EET 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Dec 22 09:56:09 2023 +0100| [280df9d0eb0ded54709d8afa8b5a9da09a1b09f5] | committer: Andreas Rheinhardt

avutil/hwcontext_d3d12va: Use av_image_copy() wrapper

Avoids casts all over the place; in this case, it also
replaces the unsafe cast uint8_t**->const uint8_t **
by the safe cast uint8_t**->const uint8_t * const*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavutil/hwcontext_d3d12va.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext_d3d12va.c b/libavutil/hwcontext_d3d12va.c
index 414dd44290..3acd5ac43a 100644
--- a/libavutil/hwcontext_d3d12va.c
+++ b/libavutil/hwcontext_d3d12va.c
@@ -469,8 +469,8 @@ static int d3d12va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst,
         DX_CHECK(ID3D12Resource_Map(s->staging_download_buffer, 0, NULL, (void **)&mapped_data));
         av_image_fill_pointers(data, ctx->sw_format, ctx->height, mapped_data, linesizes);
 
-        av_image_copy(dst->data, dst->linesize,  (const uint8_t **)data, linesizes,
-                      ctx->sw_format, ctx->width, ctx->height);
+        av_image_copy2(dst->data, dst->linesize, data, linesizes,
+                       ctx->sw_format, ctx->width, ctx->height);
 
         ID3D12Resource_Unmap(s->staging_download_buffer, 0, NULL);
     } else {
@@ -487,8 +487,8 @@ static int d3d12va_transfer_data(AVHWFramesContext *ctx, AVFrame *dst,
         DX_CHECK(ID3D12Resource_Map(s->staging_upload_buffer, 0, NULL, (void **)&mapped_data));
         av_image_fill_pointers(data, ctx->sw_format, ctx->height, mapped_data, linesizes);
 
-        av_image_copy(data, linesizes,  (const uint8_t **)src->data, src->linesize,
-                      ctx->sw_format, ctx->width, ctx->height);
+        av_image_copy2(data, linesizes, src->data, src->linesize,
+                       ctx->sw_format, ctx->width, ctx->height);
 
         ID3D12Resource_Unmap(s->staging_upload_buffer, 0, NULL);
 



More information about the ffmpeg-cvslog mailing list