From patchwork Thu Mar 7 00:32:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46863 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d90e:b0:19e:cdac:8cce with SMTP id jd14csp732939pzb; Wed, 6 Mar 2024 16:33:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUCF18IRUN6xT4kPE7uQWeO99wjEg2n/RbJgmLlHBUH5Ru/cVMSuTm6rNyNbDobMM9WKP/dAM4KufSkQhnUwwGHKUwAMoa6G5TBYA== X-Google-Smtp-Source: AGHT+IEWAvuui6rXgZ5Iv5ROFqwmvN+x+YfjnjQ0uvcXB4rL2O+CvdGMaslOMXh6WwkBNi98YCkE X-Received: by 2002:a17:906:f18e:b0:a45:cedb:5564 with SMTP id gs14-20020a170906f18e00b00a45cedb5564mr115939ejb.37.1709771587116; Wed, 06 Mar 2024 16:33:07 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qw30-20020a1709066a1e00b00a3e3776fd57si6255159ejc.28.2024.03.06.16.33.06; Wed, 06 Mar 2024 16:33:07 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=nJge2QsY; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B2BE368CD8D; Thu, 7 Mar 2024 02:32:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2037.outbound.protection.outlook.com [40.92.66.37]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B136168CD66 for ; Thu, 7 Mar 2024 02:32:50 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BB2fOAoWVrI3RBzJWK+Uk2F0Opr+JltzEAmE4N/wyvlx0Kr/Tf1m8YVRJXtUuLo7f4TgPN31PCrU6QqnoKC3vMK6FBcAsHlIOyy2I3v8oivj3y8Vc+5JxDe/3oV4XY0tIDZEWH5l14PhWWtRX42HgHcpZ4jsCEIbRdZR4X6TH18AbXKqUcfDutWyesFqtoL8+cPcLnrB39V6bm3WEMAJ4XJOElhpMzP6W3qEFm4Ow5Pu2HuJdGUW3cpgqKPTZDdBo0eaOkfi3pZb7KqMB6yDjvGXruR9iQ/2Pforh85Bzz2Eox6hOIJ/O98+ZNWJAUZL7XuoHFhoLvHLIxIFaMhsJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i/o6A7mloHErHp/dpFGeKfXPK6zMEaPRP8y+oxq3hX0=; b=TQZTMv4W8rEjG63xMHRloNSOIjU75b/upKs95r+u7zZmwNKnLNKqoyKmVWtYiQ7tUucd923RuNGtuHsysdFYuJup8HLFePcspm51QTGbXuH43ouWi+q3wI7rviOBct8HkLQC1MUab6O8HsKgcOnoeDZyUUuNsWH+fIiWvljf8wJ420wWvK+W8Suta/pMsC2tNCTB+d2HQk9UOl//43MW2FAk/vBuKK8XrDwKiTbePAy9JoZpHW/HzOek1ILxt5Z3i2elMHOonCYHQwugVlMSKFmAnaWZeGMKiHq528awMgeBhSw/5X++4A1sWqCIJOKFx/RJo0YerdBq0qX43bC5jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i/o6A7mloHErHp/dpFGeKfXPK6zMEaPRP8y+oxq3hX0=; b=nJge2QsYrOtiyAj1lrCgRz8+3iZ+v8FAzHBj3OLN2qV77/zWPbBbVLISzz9PZ8sgHekuRbOThOlX2uDIpdZCVIY1JoWOaiWR+9vs/Hk6Ix1yjDPqpjCb85d3tzrrNKkEGyjV0owOibFYG1DMZx6C7RNd6Hrl7uC+G7tkBO5ARMW0NEtPfiT4TZAmeLmGJo2mcGGIIy1KxrYUPvDJzqylxSOIyMq9ZqBi04s89eXS0tKfKeeywqpd1GRclLnROzEPQYAM3HI0v2Yc0BOhn+bSWKbEpYPJtU25n7ldQn5SPgzpwKPwoW0YBdqDDXNdh/WWCGGqqGu+xlYKyAOGXTwocg== Received: from GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:109::15) by AS8P250MB0038.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:359::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Thu, 7 Mar 2024 00:32:44 +0000 Received: from GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM ([fe80::a8f2:5082:22e4:8d1b]) by GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM ([fe80::a8f2:5082:22e4:8d1b%5]) with mapi id 15.20.7339.035; Thu, 7 Mar 2024 00:32:44 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 7 Mar 2024 01:32:33 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [iSXJndYZp8t59TawCXULzVOOcFk/S7Dr58sos6We9FM=] X-ClientProxiedBy: FR4P281CA0243.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:f5::11) To GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:109::15) X-Microsoft-Original-Message-ID: <20240307003234.3396724-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1SPRMB0052:EE_|AS8P250MB0038:EE_ X-MS-Office365-Filtering-Correlation-Id: 41f742e8-5186-4adf-c8ce-08dc3e3e1b3b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MNUZCTCO8K91mh3q+Vrqr0eBr56k2O2Yv1EvS5MHshpXPpqC5qbYiKiYlgORJG53YZCvIfEk53xeHF/YVaHARp9mVKV9pzyaxCgOybHqfmzkUV6kCdlj20ZWbtwQRxGYsprpcQypL8CqlNG44pOrO+PyLaAjd8mCC5oq1+qtSk301kMECXAf8HrRuzHp1BQ/dkY7XVkAFywFSt46FZ0aaVLIG5f4DbRT+qglbawkjHQa0bFBKeo/bHm94pymLBf5NnKPD7gXx1Sj550pf7221j9L448wUso1V144wZ/BKHtjW8mQG6M+WIJHCqu7ofRYEr0fS+g6UiLhu4HbpamwvfJP+LIk89nGvhv61aC88Ya0fAA95H71ywV348d9lzDJc0PGZPOzSsUJ6mym/0bVC5CPINNG5Zdts7IJ3Dday2a03xbrjf8Z5YYlTslk6TYoE74g8OtNnp+qR2RBq3yWSesDnPDBrPxBXXQwgsvm96cwWvlz+Ea8IH+Frrr/npDaBsqar9Xz/ocK57CUDN1SYu8Y8sbJ+igjROpdWn+7Lzz4Wu889BB31wAHgwxhVEZOGHZrT9rg1HkZnYhXl6DjutA9pSTTsrYcyiFuvD2xJuNE63kFKobkysQTnN8BGITk X-MS-Exchange-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nCiJuwryAsDTZkndLj89ACQXh4hnXYTYtytkojnsbxCXVz8jeioic7dtP+nY/L5O0etvUjkC9bsl12k4dehIqETA7CncUleH92y1ZFiXtTNKiIyd4ay0IliZS5j63WEcfzCJ0Lk6eVisyL6J3gdlrnrYrwFMqV4gbSxndr1JsVOpQf1Rx1NCR8/Zav1YR8UqR5FstPIDphVCgHtg7Hx8n1cFG/vVjlDuIIm1+Yrhy5TFkgRN2nR2iey0jpocOD/FAnNY0LfZd5yTkFw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41f742e8-5186-4adf-c8ce-08dc3e3e1b3b X-MS-Exchange-CrossTenant-AuthSource: GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 00:32:44.6986 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P250MB0038 Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/vulkan_decode: Un-sparse extensions table 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: BMcgrdjeXcjX Only three of the 226 (== AV_CODEC_ID_AV1) entries have been used. Unsparsing this table is especially important given that this array lives in .data.rel.ro. Signed-off-by: Andreas Rheinhardt --- libavcodec/vulkan_av1.c | 1 + libavcodec/vulkan_decode.c | 13 +++++++++---- libavcodec/vulkan_decode.h | 2 ++ libavcodec/vulkan_h264.c | 1 + libavcodec/vulkan_hevc.c | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c index 03ae553ff8..5afd5353cc 100644 --- a/libavcodec/vulkan_av1.c +++ b/libavcodec/vulkan_av1.c @@ -24,6 +24,7 @@ #define MAX_TILES 256 const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = { + .codec_id = AV_CODEC_ID_AV1, .decode_extension = FF_VK_EXT_VIDEO_DECODE_AV1, .decode_op = 0x01000000, /* TODO fix this */ .ext_props = { diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 6777aa5887..233b5792d8 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -20,6 +20,7 @@ #include "vulkan_video.h" #include "vulkan_decode.h" #include "config_components.h" +#include "libavutil/avassert.h" #include "libavutil/vulkan_loader.h" #if CONFIG_H264_VULKAN_HWACCEL @@ -34,19 +35,23 @@ extern const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc; static const FFVulkanDecodeDescriptor *dec_descs[] = { #if CONFIG_H264_VULKAN_HWACCEL - [AV_CODEC_ID_H264] = &ff_vk_dec_h264_desc, + &ff_vk_dec_h264_desc, #endif #if CONFIG_HEVC_VULKAN_HWACCEL - [AV_CODEC_ID_HEVC] = &ff_vk_dec_hevc_desc, + &ff_vk_dec_hevc_desc, #endif #if CONFIG_AV1_VULKAN_HWACCEL - [AV_CODEC_ID_AV1] = &ff_vk_dec_av1_desc, + &ff_vk_dec_av1_desc, #endif }; static const FFVulkanDecodeDescriptor *get_codecdesc(enum AVCodecID codec_id) { - return dec_descs[codec_id]; + for (size_t i = 0; i < FF_ARRAY_ELEMS(dec_descs); i++) + if (dec_descs[i]->codec_id == codec_id) + return dec_descs[i]; + av_assert1(!"no codec descriptor"); + return NULL; } static const VkVideoProfileInfoKHR *get_video_profile(FFVulkanDecodeShared *ctx, enum AVCodecID codec_id) diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h index 3e7cd38774..a43e328d73 100644 --- a/libavcodec/vulkan_decode.h +++ b/libavcodec/vulkan_decode.h @@ -19,6 +19,7 @@ #ifndef AVCODEC_VULKAN_DECODE_H #define AVCODEC_VULKAN_DECODE_H +#include "codec_id.h" #include "decode.h" #include "hwaccel_internal.h" #include "internal.h" @@ -26,6 +27,7 @@ #include "vulkan_video.h" typedef struct FFVulkanDecodeDescriptor { + enum AVCodecID codec_id; FFVulkanExtensions decode_extension; VkVideoCodecOperationFlagBitsKHR decode_op; diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c index 695b986a7c..0b296b3cc3 100644 --- a/libavcodec/vulkan_h264.c +++ b/libavcodec/vulkan_h264.c @@ -22,6 +22,7 @@ #include "vulkan_decode.h" const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc = { + .codec_id = AV_CODEC_ID_H264, .decode_extension = FF_VK_EXT_VIDEO_DECODE_H264, .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR, .ext_props = { diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c index e3a1319958..e2acc35612 100644 --- a/libavcodec/vulkan_hevc.c +++ b/libavcodec/vulkan_hevc.c @@ -23,6 +23,7 @@ #include "vulkan_decode.h" const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc = { + .codec_id = AV_CODEC_ID_HEVC, .decode_extension = FF_VK_EXT_VIDEO_DECODE_H265, .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR, .ext_props = {