* [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: Use av_image_copy() wrapper
@ 2023-12-22 9:02 Andreas Rheinhardt
2023-12-24 9:40 ` Andreas Rheinhardt
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Rheinhardt @ 2023-12-22 9:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
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@outlook.com>
---
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);
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: Use av_image_copy() wrapper
2023-12-22 9:02 [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: Use av_image_copy() wrapper Andreas Rheinhardt
@ 2023-12-24 9:40 ` Andreas Rheinhardt
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Rheinhardt @ 2023-12-24 9:40 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> 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@outlook.com>
> ---
> 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);
>
Will apply this patch tomorrow unless there are objections.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-24 9:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-22 9:02 [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d12va: Use av_image_copy() wrapper Andreas Rheinhardt
2023-12-24 9:40 ` Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git