[FFmpeg-devel] [PATCH 2/6] vulkan_decode: only create sequence params in end_frame

Lynne dev at lynne.ee
Mon Mar 31 05:37:38 EEST 2025


We tried to create sequence params in both start_frame and end_frame.
This was redundant.

Just always create them in end_frame.
---
 libavcodec/vulkan_av1.c  | 8 --------
 libavcodec/vulkan_h264.c | 9 ---------
 libavcodec/vulkan_hevc.c | 9 ---------
 3 files changed, 26 deletions(-)

diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c
index 13df24a44b..115db8badb 100644
--- a/libavcodec/vulkan_av1.c
+++ b/libavcodec/vulkan_av1.c
@@ -254,7 +254,6 @@ static int vk_av1_start_frame(AVCodecContext          *avctx,
     AV1DecContext *s = avctx->priv_data;
     const AV1Frame *pic = &s->cur_frame;
     FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
-    FFVulkanDecodeShared *ctx = dec->shared_ctx;
 
     AV1VulkanDecodePicture *ap = pic->hwaccel_picture_private;
     FFVulkanDecodePicture *vp = &ap->vp;
@@ -269,13 +268,6 @@ static int vk_av1_start_frame(AVCodecContext          *avctx,
                                                          STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_WIENER,
                                                          STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SGRPROJ };
 
-    if (!dec->session_params &&
-        !(ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_2)) {
-        err = vk_av1_create_params(avctx, &dec->session_params, ap);
-        if (err < 0)
-            return err;
-    }
-
     if (!ap->frame_id_set) {
         unsigned slot_idx = 0;
         for (unsigned i = 0; i < 32; i++) {
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index af37e0800b..d950c6948f 100644
--- a/libavcodec/vulkan_h264.c
+++ b/libavcodec/vulkan_h264.c
@@ -366,20 +366,11 @@ static int vk_h264_start_frame(AVCodecContext          *avctx,
     int err;
     int dpb_slot_index = 0;
     H264Context *h = avctx->priv_data;
-    FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
-    FFVulkanDecodeShared *ctx = dec->shared_ctx;
 
     H264Picture *pic = h->cur_pic_ptr;
     H264VulkanDecodePicture *hp = pic->hwaccel_picture_private;
     FFVulkanDecodePicture *vp = &hp->vp;
 
-    if (!dec->session_params &&
-        !(ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_2)) {
-        err = vk_h264_create_params(avctx, &dec->session_params);
-        if (err < 0)
-            return err;
-    }
-
     /* Fill in main slot */
     dpb_slot_index = 0;
     for (unsigned slot = 0; slot < H264_MAX_PICTURE_COUNT; slot++) {
diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c
index e95f554756..bc43591e19 100644
--- a/libavcodec/vulkan_hevc.c
+++ b/libavcodec/vulkan_hevc.c
@@ -716,8 +716,6 @@ static int vk_hevc_start_frame(AVCodecContext          *avctx,
     int err;
     HEVCContext *h = avctx->priv_data;
     HEVCLayerContext *l = &h->layers[h->cur_layer];
-    FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
-    FFVulkanDecodeShared *ctx = dec->shared_ctx;
 
     HEVCFrame *pic = h->cur_frame;
     HEVCVulkanDecodePicture *hp = pic->hwaccel_picture_private;
@@ -726,13 +724,6 @@ static int vk_hevc_start_frame(AVCodecContext          *avctx,
     const HEVCSPS *sps = pps->sps;
     int nb_refs = 0;
 
-    if (!dec->session_params &&
-        !(ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_2)) {
-        err = vk_hevc_create_params(avctx, &dec->session_params);
-        if (err < 0)
-            return err;
-    }
-
     hp->h265pic = (StdVideoDecodeH265PictureInfo) {
         .flags = (StdVideoDecodeH265PictureInfoFlags) {
             .IrapPicFlag = IS_IRAP(h),
-- 
2.49.0


More information about the ffmpeg-devel mailing list