* [FFmpeg-devel] [PATCH] avcodec/vulkan_video: Remove unused array
@ 2024-03-06 23:35 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
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2024-03-06 23:35 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/vulkan_video.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c
index a87df52871..dc6652709f 100644
--- a/libavcodec/vulkan_video.c
+++ b/libavcodec/vulkan_video.c
@@ -309,7 +309,6 @@ av_cold int ff_vk_video_common_init(void *log, FFVulkanContext *s,
int err;
VkResult ret;
FFVulkanFunctions *vk = &s->vkfn;
- VkMemoryRequirements2 *mem_req = NULL;
VkVideoSessionMemoryRequirementsKHR *mem = NULL;
VkBindVideoSessionMemoryInfoKHR *bind_mem = NULL;
@@ -340,11 +339,6 @@ av_cold int ff_vk_video_common_init(void *log, FFVulkanContext *s,
err = AVERROR(ENOMEM);
goto fail;
}
- mem_req = av_mallocz(sizeof(*mem_req)*common->nb_mem);
- if (!mem_req) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
bind_mem = av_mallocz(sizeof(*bind_mem)*common->nb_mem);
if (!bind_mem) {
err = AVERROR(ENOMEM);
@@ -353,12 +347,8 @@ av_cold int ff_vk_video_common_init(void *log, FFVulkanContext *s,
/* Set the needed fields to get the memory requirements */
for (int i = 0; i < common->nb_mem; i++) {
- mem_req[i] = (VkMemoryRequirements2) {
- .sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2,
- };
mem[i] = (VkVideoSessionMemoryRequirementsKHR) {
.sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR,
- .memoryRequirements = mem_req[i].memoryRequirements,
};
}
@@ -400,14 +390,12 @@ av_cold int ff_vk_video_common_init(void *log, FFVulkanContext *s,
}
av_freep(&mem);
- av_freep(&mem_req);
av_freep(&bind_mem);
return 0;
fail:
av_freep(&mem);
- av_freep(&mem_req);
av_freep(&bind_mem);
ff_vk_video_common_uninit(s, common);
--
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] avcodec/vulkan_video: Merge dec part of FFVkCodecMap and extension props
2024-03-06 23:35 [FFmpeg-devel] [PATCH] avcodec/vulkan_video: Remove unused array Andreas Rheinhardt
@ 2024-03-07 0:32 ` Andreas Rheinhardt
2024-03-07 0:32 ` [FFmpeg-devel] [PATCH 3/4] avcodec/vulkan_decode: Un-sparse extensions table Andreas Rheinhardt
2024-03-07 0:32 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vulkan_decode: Remove always-false check Andreas Rheinhardt
2 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2024-03-07 0:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
All the fields of FFVkCodecMap are either decoder-only
or encoder-only (with the latter being unused and unset for now).
Yet there is already a per-decoder struct containing
static information about these decoders, namely
VkExtensionProperties.
This commit merges the decoder-parts of FFVkCodecMap
with the VkExtensionProperties into a common structure.
Given that FFVkCodecMap is now unused, it is removed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
Given that these descriptors are decoding-specific,
one could drop the decode_ prefix from decode_(op|extension).
libavcodec/vulkan_av1.c | 10 +++++---
libavcodec/vulkan_decode.c | 49 +++++++++++++++++---------------------
libavcodec/vulkan_decode.h | 7 ++++++
libavcodec/vulkan_h264.c | 10 +++++---
libavcodec/vulkan_hevc.c | 10 +++++---
libavcodec/vulkan_video.c | 26 --------------------
libavcodec/vulkan_video.h | 11 ---------
7 files changed, 50 insertions(+), 73 deletions(-)
diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
index 9730e4b08d..03ae553ff8 100644
--- a/libavcodec/vulkan_av1.c
+++ b/libavcodec/vulkan_av1.c
@@ -23,9 +23,13 @@
/* Maximum number of tiles specified by any defined level */
#define MAX_TILES 256
-const VkExtensionProperties ff_vk_dec_av1_ext = {
- .extensionName = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME,
- .specVersion = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION,
+const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = {
+ .decode_extension = FF_VK_EXT_VIDEO_DECODE_AV1,
+ .decode_op = 0x01000000, /* TODO fix this */
+ .ext_props = {
+ .extensionName = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME,
+ .specVersion = VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION,
+ },
};
typedef struct AV1VulkanDecodePicture {
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 2448ee99ec..6777aa5887 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -20,38 +20,33 @@
#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
-extern const VkExtensionProperties ff_vk_dec_h264_ext;
+extern const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc;
#endif
#if CONFIG_HEVC_VULKAN_HWACCEL
-extern const VkExtensionProperties ff_vk_dec_hevc_ext;
+extern const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc;
#endif
#if CONFIG_AV1_VULKAN_HWACCEL
-extern const VkExtensionProperties ff_vk_dec_av1_ext;
+extern const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc;
#endif
-static const VkExtensionProperties *dec_ext[] = {
+static const FFVulkanDecodeDescriptor *dec_descs[] = {
#if CONFIG_H264_VULKAN_HWACCEL
- [AV_CODEC_ID_H264] = &ff_vk_dec_h264_ext,
+ [AV_CODEC_ID_H264] = &ff_vk_dec_h264_desc,
#endif
#if CONFIG_HEVC_VULKAN_HWACCEL
- [AV_CODEC_ID_HEVC] = &ff_vk_dec_hevc_ext,
+ [AV_CODEC_ID_HEVC] = &ff_vk_dec_hevc_desc,
#endif
#if CONFIG_AV1_VULKAN_HWACCEL
- [AV_CODEC_ID_AV1] = &ff_vk_dec_av1_ext,
+ [AV_CODEC_ID_AV1] = &ff_vk_dec_av1_desc,
#endif
};
-static const FFVkCodecMap *get_codecmap(enum AVCodecID codec_id)
+static const FFVulkanDecodeDescriptor *get_codecdesc(enum AVCodecID codec_id)
{
- for (size_t i = 0; i < FF_ARRAY_ELEMS(ff_vk_codec_map); i++)
- if (ff_vk_codec_map[i].codec_id == codec_id)
- return &ff_vk_codec_map[i];
- av_assert1(!"unreachable");
- return NULL;
+ return dec_descs[codec_id];
}
static const VkVideoProfileInfoKHR *get_video_profile(FFVulkanDecodeShared *ctx, enum AVCodecID codec_id)
@@ -671,7 +666,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx,
FFVulkanDecodeProfileData *prof,
AVVulkanDeviceContext *hwctx,
FFVulkanFunctions *vk,
- const struct FFVkCodecMap *vk_codec,
+ const FFVulkanDecodeDescriptor *vk_desc,
VkVideoDecodeH264CapabilitiesKHR *h264_caps,
VkVideoDecodeH265CapabilitiesKHR *h265_caps,
VkVideoDecodeAV1CapabilitiesMESA *av1_caps,
@@ -722,7 +717,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx,
profile->sType = VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR;
profile->pNext = usage;
- profile->videoCodecOperation = vk_codec->decode_op;
+ profile->videoCodecOperation = vk_desc->decode_op;
profile->chromaSubsampling = ff_vk_subsampling_from_av_desc(desc);
profile->lumaBitDepth = ff_vk_depth_from_av_depth(desc->comp[0].depth);
profile->chromaBitDepth = profile->lumaBitDepth;
@@ -748,7 +743,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
{
VkResult ret;
int max_level, base_profile, cur_profile;
- const FFVkCodecMap *vk_codec = get_codecmap(avctx->codec_id);
+ const FFVulkanDecodeDescriptor *vk_desc = get_codecdesc(avctx->codec_id);
AVHWFramesContext *frames = (AVHWFramesContext *)frames_ref->data;
AVHWDeviceContext *device = (AVHWDeviceContext *)frames->device_ref->data;
AVVulkanDeviceContext *hwctx = device->hwctx;
@@ -780,11 +775,11 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
VkVideoFormatPropertiesKHR *ret_info;
uint32_t nb_out_fmts = 0;
- if (!vk_codec->decode_op || !vk_codec->decode_extension) {
+ if (!vk_desc->decode_op || !vk_desc->decode_extension) {
av_log(avctx, AV_LOG_ERROR, "Unsupported codec for Vulkan decoding: %s!\n",
avcodec_get_name(avctx->codec_id));
return AVERROR(ENOSYS);
- } else if (!(vk_codec->decode_extension & ctx->s.extensions)) {
+ } else if (!(vk_desc->decode_extension & ctx->s.extensions)) {
av_log(avctx, AV_LOG_ERROR, "Device does not support decoding %s!\n",
avcodec_get_name(avctx->codec_id));
return AVERROR(ENOSYS);
@@ -796,7 +791,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
avctx->codec_id == AV_CODEC_ID_AV1 ? STD_VIDEO_AV1_MESA_PROFILE_MAIN :
0;
- ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_codec,
+ ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_desc,
&h264_caps,
&h265_caps,
&av1_caps,
@@ -812,7 +807,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
avcodec_profile_name(avctx->codec_id, cur_profile),
avcodec_profile_name(avctx->codec_id, base_profile));
cur_profile = base_profile;
- ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_codec,
+ ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_desc,
&h264_caps,
&h265_caps,
&av1_caps,
@@ -867,10 +862,10 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
caps->maxActiveReferencePictures);
av_log(avctx, AV_LOG_VERBOSE, " Codec header name: '%s' (driver), '%s' (compiled)\n",
caps->stdHeaderVersion.extensionName,
- dec_ext[avctx->codec_id]->extensionName);
+ vk_desc->ext_props.extensionName);
av_log(avctx, AV_LOG_VERBOSE, " Codec header version: %i.%i.%i (driver), %i.%i.%i (compiled)\n",
CODEC_VER(caps->stdHeaderVersion.specVersion),
- CODEC_VER(dec_ext[avctx->codec_id]->specVersion));
+ CODEC_VER(vk_desc->ext_props.specVersion));
av_log(avctx, AV_LOG_VERBOSE, " Decode modes:%s%s%s\n",
dec_caps->flags ? "" :
" invalid",
@@ -1122,7 +1117,7 @@ int ff_vk_decode_init(AVCodecContext *avctx)
FFVulkanContext *s;
FFVulkanFunctions *vk;
const VkVideoProfileInfoKHR *profile;
- const FFVkCodecMap *vk_codec;
+ const FFVulkanDecodeDescriptor *vk_desc;
VkVideoDecodeH264SessionParametersCreateInfoKHR h264_params = {
.sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR,
@@ -1179,9 +1174,9 @@ int ff_vk_decode_init(AVCodecContext *avctx)
/* Create queue context */
qf = ff_vk_qf_init(s, &ctx->qf, VK_QUEUE_VIDEO_DECODE_BIT_KHR);
- vk_codec = get_codecmap(avctx->codec_id);
+ vk_desc = get_codecdesc(avctx->codec_id);
/* Check for support */
- if (!(s->video_props[qf].videoCodecOperations & vk_codec->decode_op)) {
+ if (!(s->video_props[qf].videoCodecOperations & vk_desc->decode_op)) {
av_log(avctx, AV_LOG_ERROR, "Decoding %s not supported on the given "
"queue family %i!\n", avcodec_get_name(avctx->codec_id), qf);
return AVERROR(EINVAL);
@@ -1198,7 +1193,7 @@ int ff_vk_decode_init(AVCodecContext *avctx)
session_create.maxActiveReferencePictures = ctx->caps.maxActiveReferencePictures;
session_create.pictureFormat = s->hwfc->format[0];
session_create.referencePictureFormat = session_create.pictureFormat;
- session_create.pStdHeaderVersion = dec_ext[avctx->codec_id];
+ session_create.pStdHeaderVersion = &vk_desc->ext_props;
session_create.pVideoProfile = profile;
/* Create decode exec context for this specific main thread.
diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h
index b0b1ff5614..3e7cd38774 100644
--- a/libavcodec/vulkan_decode.h
+++ b/libavcodec/vulkan_decode.h
@@ -25,6 +25,13 @@
#include "vulkan_video.h"
+typedef struct FFVulkanDecodeDescriptor {
+ FFVulkanExtensions decode_extension;
+ VkVideoCodecOperationFlagBitsKHR decode_op;
+
+ VkExtensionProperties ext_props;
+} FFVulkanDecodeDescriptor;
+
typedef struct FFVulkanDecodeProfileData {
VkVideoDecodeH264ProfileInfoKHR h264_profile;
VkVideoDecodeH265ProfileInfoKHR h265_profile;
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index 39c123ddca..695b986a7c 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -21,9 +21,13 @@
#include "vulkan_decode.h"
-const VkExtensionProperties ff_vk_dec_h264_ext = {
- .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
- .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION,
+const FFVulkanDecodeDescriptor ff_vk_dec_h264_desc = {
+ .decode_extension = FF_VK_EXT_VIDEO_DECODE_H264,
+ .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR,
+ .ext_props = {
+ .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME,
+ .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION,
+ },
};
typedef struct H264VulkanDecodePicture {
diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
index 033172cbd6..e3a1319958 100644
--- a/libavcodec/vulkan_hevc.c
+++ b/libavcodec/vulkan_hevc.c
@@ -22,9 +22,13 @@
#include "vulkan_decode.h"
-const VkExtensionProperties ff_vk_dec_hevc_ext = {
- .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
- .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION,
+const FFVulkanDecodeDescriptor ff_vk_dec_hevc_desc = {
+ .decode_extension = FF_VK_EXT_VIDEO_DECODE_H265,
+ .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR,
+ .ext_props = {
+ .extensionName = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME,
+ .specVersion = VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION,
+ },
};
typedef struct HEVCHeaderSPS {
diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c
index dc6652709f..4be13ecc55 100644
--- a/libavcodec/vulkan_video.c
+++ b/libavcodec/vulkan_video.c
@@ -16,34 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "codec_id.h"
-
#include "vulkan_video.h"
-const FFVkCodecMap ff_vk_codec_map[3] = {
- {
- .codec_id = AV_CODEC_ID_H264,
- 0,
- 0,
- FF_VK_EXT_VIDEO_DECODE_H264,
- VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR,
- },
- {
- .codec_id = AV_CODEC_ID_HEVC,
- 0,
- 0,
- FF_VK_EXT_VIDEO_DECODE_H265,
- VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR
- },
- {
- .codec_id = AV_CODEC_ID_AV1,
- 0,
- 0,
- FF_VK_EXT_VIDEO_DECODE_AV1,
- 0x01000000 /* TODO fix this */
- },
-};
-
#define ASPECT_2PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT)
#define ASPECT_3PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT)
diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h
index b06e369abd..bb69e920bb 100644
--- a/libavcodec/vulkan_video.h
+++ b/libavcodec/vulkan_video.h
@@ -19,7 +19,6 @@
#ifndef AVCODEC_VULKAN_VIDEO_H
#define AVCODEC_VULKAN_VIDEO_H
-#include "codec_id.h"
#include "vulkan.h"
#include <vk_video/vulkan_video_codecs_common.h>
@@ -31,14 +30,6 @@
#define CODEC_VER_PAT(ver) (ver & ((1 << 12) - 1))
#define CODEC_VER(ver) CODEC_VER_MAJ(ver), CODEC_VER_MIN(ver), CODEC_VER_PAT(ver)
-typedef struct FFVkCodecMap {
- enum AVCodecID codec_id;
- FFVulkanExtensions encode_extension;
- VkVideoCodecOperationFlagBitsKHR encode_op;
- FFVulkanExtensions decode_extension;
- VkVideoCodecOperationFlagBitsKHR decode_op;
-} FFVkCodecMap;
-
typedef struct FFVkVideoSession {
VkVideoSessionKHR session;
VkDeviceMemory *mem;
@@ -47,8 +38,6 @@ typedef struct FFVkVideoSession {
AVBufferPool *buf_pool;
} FFVkVideoCommon;
-extern const FFVkCodecMap ff_vk_codec_map[3];
-
/**
* Get pixfmt from a Vulkan format.
*/
--
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] avcodec/vulkan_decode: Un-sparse extensions table
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
2024-03-07 0:32 ` [FFmpeg-devel] [PATCH 4/4] avcodec/vulkan_decode: Remove always-false check Andreas Rheinhardt
2 siblings, 0 replies; 5+ messages in thread
From: Andreas Rheinhardt @ 2024-03-07 0:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] avcodec/vulkan_decode: Remove always-false check
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 ` [FFmpeg-devel] [PATCH 3/4] avcodec/vulkan_decode: Un-sparse extensions table Andreas Rheinhardt
@ 2024-03-07 0:32 ` Andreas Rheinhardt
2024-03-07 4:03 ` Lynne
2 siblings, 1 reply; 5+ messages in thread
From: Andreas Rheinhardt @ 2024-03-07 0:32 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
These fields are set for all Vulkan decoding hwaccels;
they would be useless if it were different.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/vulkan_decode.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 233b5792d8..91929d165f 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -780,11 +780,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
VkVideoFormatPropertiesKHR *ret_info;
uint32_t nb_out_fmts = 0;
- if (!vk_desc->decode_op || !vk_desc->decode_extension) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported codec for Vulkan decoding: %s!\n",
- avcodec_get_name(avctx->codec_id));
- return AVERROR(ENOSYS);
- } else if (!(vk_desc->decode_extension & ctx->s.extensions)) {
+ if (!(vk_desc->decode_extension & ctx->s.extensions)) {
av_log(avctx, AV_LOG_ERROR, "Device does not support decoding %s!\n",
avcodec_get_name(avctx->codec_id));
return AVERROR(ENOSYS);
--
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 4/4] avcodec/vulkan_decode: Remove always-false check
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
0 siblings, 0 replies; 5+ messages in thread
From: Lynne @ 2024-03-07 4:03 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Mar 7, 2024, 01:33 by andreas.rheinhardt@outlook.com:
> These fields are set for all Vulkan decoding hwaccels;
> they would be useless if it were different.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/vulkan_decode.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
> index 233b5792d8..91929d165f 100644
> --- a/libavcodec/vulkan_decode.c
> +++ b/libavcodec/vulkan_decode.c
> @@ -780,11 +780,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
> VkVideoFormatPropertiesKHR *ret_info;
> uint32_t nb_out_fmts = 0;
>
> - if (!vk_desc->decode_op || !vk_desc->decode_extension) {
> - av_log(avctx, AV_LOG_ERROR, "Unsupported codec for Vulkan decoding: %s!\n",
> - avcodec_get_name(avctx->codec_id));
> - return AVERROR(ENOSYS);
> - } else if (!(vk_desc->decode_extension & ctx->s.extensions)) {
> + if (!(vk_desc->decode_extension & ctx->s.extensions)) {
> av_log(avctx, AV_LOG_ERROR, "Device does not support decoding %s!\n",
> avcodec_get_name(avctx->codec_id));
> return AVERROR(ENOSYS);
>
Patchset LGTM
Thanks for the cleanups
_______________________________________________
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] 5+ messages in thread
end of thread, other threads:[~2024-03-07 4:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [FFmpeg-devel] [PATCH 3/4] avcodec/vulkan_decode: Un-sparse extensions table Andreas Rheinhardt
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
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