From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 649D042DCF for ; Fri, 8 Jul 2022 21:51:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ACAF068B8B3; Sat, 9 Jul 2022 00:51:22 +0300 (EEST) Received: from mx0a-0060ff01.pphosted.com (mx0a-0060ff01.pphosted.com [205.220.162.71]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F0A4468B7DC for ; Sat, 9 Jul 2022 00:51:16 +0300 (EEST) Received: from pps.filterd (m0240442.ppops.net [127.0.0.1]) by mx0b-0060ff01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 268LleNS007350 for ; Fri, 8 Jul 2022 16:51:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mru.medical.canon; h=from : to : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=mru.medical.canon.01.04.2021; bh=C8WRtKdohkCrT15FW2OaHrXbmRc/bcdEvA4Vh1H800s=; b=QvCTi8/jHngrQqrdWKlGHTwqwV7AzoPkquve0wAQUBXrzBLuxRud0+PUgTAbXdnojKHE BagmakXGuh+e3or2tyjhKlJPLOzu0QkY7FcDxKj8VczcKHPh1o2MJNFpzFBhnCF/v8lg LHwV8z9ZmezPoq9L3gz0a1IEX5Y73M5yqCjd5yboV8zNmwzYvJGq+rVUIl4MY424TMXW diFLIAqcXwQXlZTW1yGeD79WC+l5AYoPKrj05vgiGMKi7n3cl/AeyNmAUUaTPbGWHBkF 62OzeiGwKahe5oUWALqZKCLDUFAqx8pPA1dxo+NAZTHBdZqambHBGL2DRGziog4v9pdx ow== Received: from chiexc3.tmriusa.com (dns1.vancepublishing.com [199.48.74.5] (may be forged)) by mx0b-0060ff01.pphosted.com (PPS) with ESMTPS id 3h4ubn8w9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 08 Jul 2022 16:51:12 -0500 Received: from CHIEXC3.TMRIUSA.COM (172.16.2.234) by CHIEXC3.TMRIUSA.COM (172.16.2.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Fri, 8 Jul 2022 16:51:08 -0500 Received: from CHIEXC3.TMRIUSA.COM ([172.16.2.234]) by CHIEXC3.TMRIUSA.COM ([172.16.2.234]) with mapi id 15.02.1118.009; Fri, 8 Jul 2022 16:51:08 -0500 From: To: Thread-Topic: [PATCH] Allow exporting of RGB and BGR images to CUDA. Thread-Index: AdiTDPLP8QxaiQmES6622Aqz0u0eDA== Date: Fri, 8 Jul 2022 21:51:08 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.30.32.109] MIME-Version: 1.0 X-CrossPremisesHeadersFilteredBySendConnector: CHIEXC3.TMRIUSA.COM X-OrganizationHeadersPreserved: CHIEXC3.TMRIUSA.COM X-Proofpoint-ORIG-GUID: azgkPXY1paRgUOe97VjMEfEJY1xv8YgI X-Proofpoint-GUID: azgkPXY1paRgUOe97VjMEfEJY1xv8YgI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-08_18,2022-07-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 impostorscore=0 adultscore=0 suspectscore=0 clxscore=1011 phishscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 mlxlogscore=829 mlxscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207080086 Subject: [FFmpeg-devel] [PATCH] Allow exporting of RGB and BGR images to CUDA. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 --- 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://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".