From: <dpeeters@MRU.MEDICAL.CANON>
To: <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] Allow exporting of RGB and BGR images to CUDA.
Date: Thu, 28 Jul 2022 16:23:42 +0000
Message-ID: <52a392ec033c4aecb6387ae59aa6f16f@MRU.MEDICAL.CANON> (raw)
In-Reply-To: <d46faf00c6214a6592d6c8b3c4951247@MRU.MEDICAL.CANON>
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> dpeeters@MRU.MEDICAL.CANON
> Sent: Friday, July 8, 2022 4:51 PM
> To: ffmpeg-devel@ffmpeg.org
> Subject: [EXTERNAL] [FFmpeg-devel] [PATCH] Allow exporting of RGB and
> BGR images to CUDA.
>
> Use the step size when calculating the number of channels to allow for more
> than two channels per plane. This allows the use of AV_PIX_FMT_0BGR32
> when using av_hwframe_transfer_data to transfer data from a Vulkan frame
> to a CUDA frame.
>
> Signed-off-by: David Peeters <dpeeters@MRU.MEDICAL.CANON>
> ---
> libavutil/hwcontext_vulkan.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index 237caa4bc0..05e8fc5268 100644
> --- a/libavutil/hwcontext_vulkan.c
> +++ b/libavutil/hwcontext_vulkan.c
> @@ -2992,6 +2992,8 @@ static int
> vulkan_export_to_cuda(AVHWFramesContext *hwfc,
> const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(hwfc-
> >sw_format);
> VulkanDevicePriv *p = ctx->internal->priv;
> FFVulkanFunctions *vk = &p->vkfn;
> + int max_pixsteps[4];
> + int max_pixstep_comps[4];
>
> AVHWFramesContext *cuda_fc = (AVHWFramesContext*)cuda_hwfc-
> >data;
> AVHWDeviceContext *cuda_cu = cuda_fc->device_ctx; @@ -3001,6
> +3003,8 @@ static int vulkan_export_to_cuda(AVHWFramesContext *hwfc,
> CUarray_format cufmt = desc->comp[0].depth > 8 ?
> CU_AD_FORMAT_UNSIGNED_INT16 :
> CU_AD_FORMAT_UNSIGNED_INT8;
>
> + av_image_fill_max_pixsteps(max_pixsteps, max_pixstep_comps, desc);
> +
> dst_f = (AVVkFrame *)frame->data[0];
>
> dst_int = dst_f->internal;
> @@ -3023,7 +3027,9 @@ static int
> vulkan_export_to_cuda(AVHWFramesContext *hwfc,
> .arrayDesc = {
> .Depth = 0,
> .Format = cufmt,
> - .NumChannels = 1 + ((planes == 2) && i),
> + .NumChannels = desc->comp[max_pixstep_comps[i]].depth > 8
> + ? max_pixsteps[i] / 2
> + : max_pixsteps[i],
> .Flags = 0,
> },
> .numLevels = 1,
> --
> 2.36.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://urldefense.com/v3/__https://ffmpeg.org/mailman/listinfo/ffmpeg-
> devel__;!!Ai2CFrZnFhI!6NGwn-
> Nv1AZn7qfPlMbwKHeDqU79spui_ApfLibprH2k3cVnA6ayxejFpL_xrg-
> 8adz1jY9btFkZrg33AWLLDsXfE_uWCpvx$
>
> To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org
> with subject "unsubscribe".
Ping.
Are there any changes needed for this?
_______________________________________________
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".
next prev parent reply other threads:[~2022-07-28 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 21:51 dpeeters
2022-07-28 16:23 ` dpeeters [this message]
2022-08-23 20:40 ` dpeeters
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52a392ec033c4aecb6387ae59aa6f16f@MRU.MEDICAL.CANON \
--to=dpeeters@mru.medical.canon \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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