From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/vulkan_decode: Un-sparse extensions table
Date: Thu, 7 Mar 2024 01:32:33 +0100
Message-ID: <GV1SPRMB0052EA5B962FE831742B6C358F202@GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1SPRMB00529149ED84D49D8D2C0B718F212@GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM>
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 <andreas.rheinhardt@outlook.com>
---
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 = {
--
2.40.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".
next prev parent reply other threads:[~2024-03-07 0:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 23:35 [FFmpeg-devel] [PATCH] avcodec/vulkan_video: Remove unused array Andreas Rheinhardt
2024-03-07 0:32 ` [FFmpeg-devel] [PATCH 2/4] avcodec/vulkan_video: Merge dec part of FFVkCodecMap and extension props Andreas Rheinhardt
2024-03-07 0:32 ` Andreas Rheinhardt [this message]
2024-03-07 0:32 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vulkan_decode: Remove always-false check Andreas Rheinhardt
2024-03-07 4:03 ` Lynne
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=GV1SPRMB0052EA5B962FE831742B6C358F202@GV1SPRMB0052.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--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