git: 25b37a7bcdcf - main - multimedia/ffmpeg: update to 6.1.2

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Tue, 13 Aug 2024 13:53:25 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=25b37a7bcdcf3e403bdaa4a90049b12b6bf7b9bf

commit 25b37a7bcdcf3e403bdaa4a90049b12b6bf7b9bf
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2024-08-01 23:22:54 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2024-08-13 13:53:16 +0000

    multimedia/ffmpeg: update to 6.1.2
    
    Changes:        https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/n6.1.2:/Changelog
    Reported by:    Repology, portscout
---
 multimedia/ffmpeg/Makefile                       |    3 +-
 multimedia/ffmpeg/distinfo                       |    6 +-
 multimedia/ffmpeg/files/patch-configure          |   15 +-
 multimedia/ffmpeg/files/patch-libavdevice_v4l2.c |   18 -
 multimedia/ffmpeg/files/patch-libavutil-common.h |    8 +-
 multimedia/ffmpeg/files/patch-libavutil_thread.h |   14 -
 multimedia/ffmpeg/files/patch-vk277              | 1324 ----------------------
 7 files changed, 11 insertions(+), 1377 deletions(-)

diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile
index 8acca3244f6d..84a365ca9454 100644
--- a/multimedia/ffmpeg/Makefile
+++ b/multimedia/ffmpeg/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	ffmpeg
-PORTVERSION=	6.1.1
-PORTREVISION=	6
+PORTVERSION=	6.1.2
 PORTEPOCH=	1
 CATEGORIES=	multimedia audio net
 MASTER_SITES=	https://ffmpeg.org/releases/
diff --git a/multimedia/ffmpeg/distinfo b/multimedia/ffmpeg/distinfo
index a6cd7337cac8..811067130802 100644
--- a/multimedia/ffmpeg/distinfo
+++ b/multimedia/ffmpeg/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1703981246
-SHA256 (ffmpeg-6.1.1.tar.xz) = 8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968
-SIZE (ffmpeg-6.1.1.tar.xz) = 10458600
+TIMESTAMP = 1722554574
+SHA256 (ffmpeg-6.1.2.tar.xz) = 3b624649725ecdc565c903ca6643d41f33bd49239922e45c9b1442c63dca4e38
+SIZE (ffmpeg-6.1.2.tar.xz) = 10466152
 SHA256 (master-0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch) = e8fdc940474f3819b9a8d30cab8164774584c051322acb6194bcb03d56e8175a
 SIZE (master-0001-lavc-svt_hevc-add-libsvt-hevc-encoder-wrapper.patch) = 25395
 SHA256 (0002-doc-Add-libsvt_hevc-encoder-docs.patch) = a164ebdc4d281352bf7ad1b179aae4aeb33f1191c444bed96cb8ab333c046f81
diff --git a/multimedia/ffmpeg/files/patch-configure b/multimedia/ffmpeg/files/patch-configure
index fbdb10a698ee..9654237228cc 100644
--- a/multimedia/ffmpeg/files/patch-configure
+++ b/multimedia/ffmpeg/files/patch-configure
@@ -1,6 +1,6 @@
---- configure.orig	2023-02-27 20:43:45 UTC
+--- configure.orig	2024-08-01 23:22:54 UTC
 +++ configure
-@@ -3888,13 +3888,7 @@ target_os_default=$(tolower $(uname -s))
+@@ -3956,13 +3956,7 @@ host_os=$target_os_default
  host_os=$target_os_default
  
  # machine
@@ -15,7 +15,7 @@
  cpu="generic"
  intrinsics="none"
  
-@@ -6705,10 +6699,10 @@ enabled libglslang && { check_lib spirv_compiler glsla
+@@ -6715,10 +6709,10 @@ enabled libglslang && { check_lib spirv_compiler glsla
  enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
  enabled libharfbuzz       && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
  enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
@@ -28,12 +28,3 @@
                              -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
  enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
                                 require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
-@@ -7018,7 +7013,7 @@ fi
- 
- if enabled x86; then
-     case $target_os in
--        mingw32*|mingw64*|win32|win64|linux|cygwin*)
-+        freebsd|mingw32*|mingw64*|win32|win64|linux|cygwin*)
-             ;;
-         *)
-             disable ffnvcodec cuvid nvdec nvenc
diff --git a/multimedia/ffmpeg/files/patch-libavdevice_v4l2.c b/multimedia/ffmpeg/files/patch-libavdevice_v4l2.c
deleted file mode 100644
index 8518fadce3af..000000000000
--- a/multimedia/ffmpeg/files/patch-libavdevice_v4l2.c
+++ /dev/null
@@ -1,18 +0,0 @@
-- ioctl() prototype on BSDs follows Version 7 AT&T UNIX
-
---- libavdevice/v4l2.c.orig	2019-04-21 04:37:17 UTC
-+++ libavdevice/v4l2.c
-@@ -95,10 +95,10 @@ struct video_data {
-     int (*open_f)(const char *file, int oflag, ...);
-     int (*close_f)(int fd);
-     int (*dup_f)(int fd);
--#ifdef __GLIBC__
--    int (*ioctl_f)(int fd, unsigned long int request, ...);
--#else
-+#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-like */
-     int (*ioctl_f)(int fd, int request, ...);
-+#else
-+    int (*ioctl_f)(int fd, unsigned long int request, ...);
- #endif
-     ssize_t (*read_f)(int fd, void *buffer, size_t n);
-     void *(*mmap_f)(void *start, size_t length, int prot, int flags, int fd, int64_t offset);
diff --git a/multimedia/ffmpeg/files/patch-libavutil-common.h b/multimedia/ffmpeg/files/patch-libavutil-common.h
index 2c8c84e6d372..b54ea87455fb 100644
--- a/multimedia/ffmpeg/files/patch-libavutil-common.h
+++ b/multimedia/ffmpeg/files/patch-libavutil-common.h
@@ -1,8 +1,8 @@
---- libavutil/common.h.orig	2015-06-19 20:44:53 UTC
+--- libavutil/common.h.orig	2024-08-01 23:22:48 UTC
 +++ libavutil/common.h
-@@ -49,6 +49,10 @@
- #   define AV_NE(be, le) (le)
- #endif
+@@ -43,6 +43,10 @@
+ #include "error.h"
+ #include "macros.h"
  
 +#ifndef	UINT64_C
 +#define	UINT64_C(c)	(c ## UL)
diff --git a/multimedia/ffmpeg/files/patch-libavutil_thread.h b/multimedia/ffmpeg/files/patch-libavutil_thread.h
deleted file mode 100644
index 29ba6aa40761..000000000000
--- a/multimedia/ffmpeg/files/patch-libavutil_thread.h
+++ /dev/null
@@ -1,14 +0,0 @@
-pthread_setname_np is implemented on top of PR_SET_NAME on Linux
-and is also available on DragonFly, FreeBSD and Solaris
-
---- libavutil/thread.h.orig	2023-02-27 20:43:45 UTC
-+++ libavutil/thread.h
-@@ -196,6 +196,8 @@ static inline int ff_thread_setname(const char *name)
- {
- #if HAVE_PRCTL
-     return AVERROR(prctl(PR_SET_NAME, name));
-+#elif HAVE_PTHREADS
-+    return AVERROR(pthread_setname_np(pthread_self(), name));
- #endif
- 
-     return AVERROR(ENOSYS);
diff --git a/multimedia/ffmpeg/files/patch-vk277 b/multimedia/ffmpeg/files/patch-vk277
deleted file mode 100644
index 4712aaeab1d0..000000000000
--- a/multimedia/ffmpeg/files/patch-vk277
+++ /dev/null
@@ -1,1324 +0,0 @@
-https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10647
-
---- libavcodec/Makefile.orig	2023-12-31 00:07:26 UTC
-+++ libavcodec/Makefile
-@@ -1284,7 +1284,6 @@ SKIPHEADERS                            += %_tablegen.h
-                                           aacenc_quantization.h         \
-                                           aacenc_quantization_misc.h    \
-                                           bitstream_template.h          \
--                                          vulkan_video_codec_av1std.h   \
-                                           $(ARCH)/vpx_arith.h          \
- 
- SKIPHEADERS-$(CONFIG_AMF)              += amfenc.h
-@@ -1306,7 +1305,7 @@ SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX)     += videotoolbox
- SKIPHEADERS-$(CONFIG_VAAPI)            += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
- SKIPHEADERS-$(CONFIG_VDPAU)            += vdpau.h vdpau_internal.h
- SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX)     += videotoolbox.h vt_internal.h
--SKIPHEADERS-$(CONFIG_VULKAN)           += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h
-+SKIPHEADERS-$(CONFIG_VULKAN)           += vulkan.h vulkan_video.h vulkan_decode.h
- SKIPHEADERS-$(CONFIG_V4L2_M2M)         += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
- SKIPHEADERS-$(CONFIG_ZLIB)             += zlib_wrapper.h
- 
---- libavcodec/cbs_av1.h.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/cbs_av1.h
-@@ -198,6 +198,7 @@ typedef struct AV1RawFrameHeader {
-     uint8_t refresh_frame_flags;
-     uint8_t allow_intrabc;
-     uint8_t ref_order_hint[AV1_NUM_REF_FRAMES];
-+    uint8_t ref_frame_sign_bias[AV1_NUM_REF_FRAMES];
-     uint8_t frame_refs_short_signaling;
-     uint8_t last_frame_idx;
-     uint8_t golden_frame_idx;
---- libavcodec/cbs_av1_syntax_template.c.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/cbs_av1_syntax_template.c
-@@ -1572,6 +1572,16 @@ static int FUNC(uncompressed_header)(CodedBitstreamCon
-     }
- 
-     if (!frame_is_intra) {
-+        for (i = 0; i < AV1_REFS_PER_FRAME; i++) {
-+            if (seq->enable_order_hint) {
-+                int idx = current->ref_frame_idx[i];
-+                int hint = current->ref_order_hint[idx];
-+                current->ref_frame_sign_bias[i] = cbs_av1_get_relative_dist(seq, hint,
-+                                                                            priv->order_hint) > 0;
-+            } else {
-+                infer(ref_frame_sign_bias[i], 0);
-+            }
-+        }
-         // Derive reference frame sign biases.
-     }
- 
---- libavcodec/vulkan_av1.c.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/vulkan_av1.c
-@@ -35,18 +35,33 @@ typedef struct AV1VulkanDecodePicture {
-      *Can be removed once no longer needed, and threading can be enabled. */
-     FFVulkanDecodeContext          *dec;
- 
--    StdVideoAV1MESATile            tiles[MAX_TILES];
--    StdVideoAV1MESATileList        tile_list;
--    const uint32_t                *tile_offsets;
-+    uint32_t tile_count;
-+    uint32_t tile_offsets_s[MAX_TILES];
-+    uint32_t tile_sizes[MAX_TILES];
-+    const uint32_t *tile_offsets;
- 
-     /* Current picture */
--    VkVideoDecodeAV1DpbSlotInfoMESA    vkav1_ref;
--    StdVideoAV1MESAFrameHeader         av1_frame_header;
--    VkVideoDecodeAV1PictureInfoMESA    av1_pic_info;
-+    StdVideoDecodeAV1ReferenceInfo     std_ref;
-+    VkVideoDecodeAV1DpbSlotInfoKHR     vkav1_ref;
-+    uint16_t width_in_sbs_minus1[64];
-+    uint16_t height_in_sbs_minus1[64];
-+    uint16_t mi_col_starts[64];
-+    uint16_t mi_row_starts[64];
-+    StdVideoAV1TileInfo tile_info;
-+    StdVideoAV1Quantization quantization;
-+    StdVideoAV1Segmentation segmentation;
-+    StdVideoAV1LoopFilter loop_filter;
-+    StdVideoAV1CDEF cdef;
-+    StdVideoAV1LoopRestoration loop_restoration;
-+    StdVideoAV1GlobalMotion global_motion;
-+    StdVideoAV1FilmGrain film_grain;
-+    StdVideoDecodeAV1PictureInfo    std_pic_info;
-+    VkVideoDecodeAV1PictureInfoKHR     av1_pic_info;
- 
-     /* Picture refs */
-     const AV1Frame                     *ref_src   [AV1_NUM_REF_FRAMES];
--    VkVideoDecodeAV1DpbSlotInfoMESA     vkav1_refs[AV1_NUM_REF_FRAMES];
-+    StdVideoDecodeAV1ReferenceInfo     std_ref_info[AV1_NUM_REF_FRAMES];
-+    VkVideoDecodeAV1DpbSlotInfoKHR     vkav1_refs[AV1_NUM_REF_FRAMES];
- 
-     uint8_t frame_id_set;
-     uint8_t frame_id;
-@@ -55,9 +70,9 @@ static int vk_av1_fill_pict(AVCodecContext *avctx, con
- static int vk_av1_fill_pict(AVCodecContext *avctx, const AV1Frame **ref_src,
-                             VkVideoReferenceSlotInfoKHR *ref_slot,      /* Main structure */
-                             VkVideoPictureResourceInfoKHR *ref,         /* Goes in ^ */
--                            VkVideoDecodeAV1DpbSlotInfoMESA *vkav1_ref, /* Goes in ^ */
--                            const AV1Frame *pic, int is_current, int has_grain,
--                            int dpb_slot_index)
-+                            StdVideoDecodeAV1ReferenceInfo *vkav1_std_ref,
-+                            VkVideoDecodeAV1DpbSlotInfoKHR *vkav1_ref, /* Goes in ^ */
-+                            const AV1Frame *pic, int is_current, int has_grain)
- {
-     FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
-     AV1VulkanDecodePicture *hp = pic->hwaccel_picture_private;
-@@ -68,31 +83,48 @@ static int vk_av1_fill_pict(AVCodecContext *avctx, con
-     if (err < 0)
-         return err;
- 
--    *vkav1_ref = (VkVideoDecodeAV1DpbSlotInfoMESA) {
--        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_DPB_SLOT_INFO_MESA,
--        .frameIdx = hp->frame_id,
-+    *vkav1_std_ref = (StdVideoDecodeAV1ReferenceInfo) {
-+        .flags = (StdVideoDecodeAV1ReferenceInfoFlags) {
-+            .disable_frame_end_update_cdf = pic->raw_frame_header->disable_frame_end_update_cdf,
-+            .segmentation_enabled = pic->raw_frame_header->segmentation_enabled,
-+        },
-+        .frame_type = pic->raw_frame_header->frame_type,
-+        .OrderHint = pic->raw_frame_header->order_hint,
-     };
- 
-+    for (int i = 0; i < (STD_VIDEO_AV1_NUM_REF_FRAMES - 1); i++) {
-+        int hint_idx = pic->raw_frame_header->ref_frame_idx[i];
-+        int hint = pic->raw_frame_header->ref_order_hint[hint_idx];
-+        vkav1_std_ref->SavedOrderHints[AV1_REF_FRAME_LAST + i] = hint; // not sure
-+    }
-+
-+    *vkav1_ref = (VkVideoDecodeAV1DpbSlotInfoKHR) {
-+        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_DPB_SLOT_INFO_KHR,
-+        .pStdReferenceInfo = vkav1_std_ref,
-+    };
-+
-     for (unsigned i = 0; i < 7; i++) {
-         const int idx = pic->raw_frame_header->ref_frame_idx[i];
--        vkav1_ref->ref_order_hint[i] = pic->raw_frame_header->ref_order_hint[idx];
-+        vkav1_std_ref->SavedOrderHints[i] = pic->raw_frame_header->ref_order_hint[idx];
-     }
- 
--    vkav1_ref->disable_frame_end_update_cdf = pic->raw_frame_header->disable_frame_end_update_cdf;
-+    vkav1_std_ref->flags.disable_frame_end_update_cdf = pic->raw_frame_header->disable_frame_end_update_cdf;
-+    vkav1_std_ref->flags.segmentation_enabled = pic->raw_frame_header->segmentation_enabled;
-+    vkav1_std_ref->frame_type = pic->raw_frame_header->frame_type;
- 
-     *ref = (VkVideoPictureResourceInfoKHR) {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
-         .codedOffset = (VkOffset2D){ 0, 0 },
-         .codedExtent = (VkExtent2D){ pic->f->width, pic->f->height },
-         .baseArrayLayer = ((has_grain || dec->dedicated_dpb) && dec->layered_dpb) ?
--                          dpb_slot_index : 0,
-+                          hp->frame_id : 0,
-         .imageViewBinding = vkpic->img_view_ref,
-     };
- 
-     *ref_slot = (VkVideoReferenceSlotInfoKHR) {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR,
-         .pNext = vkav1_ref,
--        .slotIndex = dpb_slot_index,
-+        .slotIndex = hp->frame_id,
-         .pPictureResource = ref,
-     };
- 
-@@ -110,15 +142,37 @@ static int vk_av1_create_params(AVCodecContext *avctx,
- 
-     const AV1RawSequenceHeader *seq = s->raw_seq;
- 
--    StdVideoAV1MESASequenceHeader av1_sequence_header;
--    VkVideoDecodeAV1SessionParametersAddInfoMESA av1_params_info;
--    VkVideoDecodeAV1SessionParametersCreateInfoMESA av1_params;
-+    StdVideoAV1SequenceHeader av1_sequence_header;
-+    StdVideoAV1TimingInfo av1_timing_info;
-+    StdVideoAV1ColorConfig av1_color_config;
-+    VkVideoDecodeAV1SessionParametersCreateInfoKHR av1_params;
-     VkVideoSessionParametersCreateInfoKHR session_params_create;
- 
-     int err;
- 
--    av1_sequence_header = (StdVideoAV1MESASequenceHeader) {
--        .flags = (StdVideoAV1MESASequenceHeaderFlags) {
-+    av1_timing_info = (StdVideoAV1TimingInfo) {
-+        .flags = (StdVideoAV1TimingInfoFlags) {
-+            .equal_picture_interval = seq->timing_info.equal_picture_interval,
-+        },
-+        .num_units_in_display_tick = seq->timing_info.num_units_in_display_tick,
-+        .time_scale = seq->timing_info.time_scale,
-+        .num_ticks_per_picture_minus_1 = seq->timing_info.num_ticks_per_picture_minus_1,
-+    };
-+
-+    av1_color_config = (StdVideoAV1ColorConfig) {
-+        .flags = (StdVideoAV1ColorConfigFlags) {
-+            .mono_chrome = seq->color_config.mono_chrome,
-+            .color_range = seq->color_config.color_range,
-+            .separate_uv_delta_q = seq->color_config.separate_uv_delta_q,
-+        },
-+        .BitDepth = seq->color_config.twelve_bit ? 12 :
-+        seq->color_config.high_bitdepth ? 10 : 8,
-+        .subsampling_x = seq->color_config.subsampling_x,
-+        .subsampling_y = seq->color_config.subsampling_y,
-+    };
-+
-+    av1_sequence_header = (StdVideoAV1SequenceHeader) {
-+        .flags = (StdVideoAV1SequenceHeaderFlags) {
-             .still_picture = seq->still_picture,
-             .reduced_still_picture_header = seq->reduced_still_picture_header,
-             .use_128x128_superblock = seq->use_128x128_superblock,
-@@ -147,35 +201,14 @@ static int vk_av1_create_params(AVCodecContext *avctx,
-         .delta_frame_id_length_minus_2 = seq->delta_frame_id_length_minus_2,
-         .additional_frame_id_length_minus_1 = seq->additional_frame_id_length_minus_1,
-         .order_hint_bits_minus_1 = seq->order_hint_bits_minus_1,
--        .timing_info = (StdVideoAV1MESATimingInfo) {
--            .flags = (StdVideoAV1MESATimingInfoFlags) {
--                .equal_picture_interval = seq->timing_info.equal_picture_interval,
--            },
--            .num_units_in_display_tick = seq->timing_info.num_units_in_display_tick,
--            .time_scale = seq->timing_info.time_scale,
--            .num_ticks_per_picture_minus_1 = seq->timing_info.num_ticks_per_picture_minus_1,
--        },
--        .color_config = (StdVideoAV1MESAColorConfig) {
--            .flags = (StdVideoAV1MESAColorConfigFlags) {
--                .mono_chrome = seq->color_config.mono_chrome,
--                .color_range = seq->color_config.color_range,
--                .separate_uv_delta_q = seq->color_config.separate_uv_delta_q,
--            },
--            .bit_depth = seq->color_config.twelve_bit ? 12 :
--                         seq->color_config.high_bitdepth ? 10 : 8,
--            .subsampling_x = seq->color_config.subsampling_x,
--            .subsampling_y = seq->color_config.subsampling_y,
--        },
-+        .pTimingInfo = &av1_timing_info,
-+        .pColorConfig = &av1_color_config,
-     };
- 
--    av1_params_info = (VkVideoDecodeAV1SessionParametersAddInfoMESA) {
--        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_ADD_INFO_MESA,
--        .sequence_header = &av1_sequence_header,
-+    av1_params = (VkVideoDecodeAV1SessionParametersCreateInfoKHR) {
-+        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_KHR,
-+        .pStdSequenceHeader = &av1_sequence_header,
-     };
--    av1_params = (VkVideoDecodeAV1SessionParametersCreateInfoMESA) {
--        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_MESA,
--        .pParametersAddInfo = &av1_params_info,
--    };
-     session_params_create = (VkVideoSessionParametersCreateInfoKHR) {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
-         .pNext = &av1_params,
-@@ -208,6 +241,11 @@ static int vk_av1_start_frame(AVCodecContext          
-     const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain;
-     const int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) &&
-                             film_grain->apply_grain;
-+    StdVideoAV1FrameRestorationType remap_lr_type[4] = { STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_NONE,
-+                                                         STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SWITCHABLE,
-+                                                         STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_WIENER,
-+                                                         STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SGRPROJ };
-+    int uses_lr;
- 
-     if (!dec->session_params) {
-         err = vk_av1_create_params(avctx, &dec->session_params);
-@@ -235,29 +273,37 @@ static int vk_av1_start_frame(AVCodecContext          
-             continue;
- 
-         err = vk_av1_fill_pict(avctx, &ap->ref_src[i], &vp->ref_slots[i],
--                               &vp->refs[i], &ap->vkav1_refs[i],
--                               ref_frame, 0, 0, i);
-+                               &vp->refs[i], &ap->std_ref_info[i], &ap->vkav1_refs[i],
-+                               ref_frame, 0, 0);
-         if (err < 0)
-             return err;
- 
-+        // Really not sure
-+        ap->std_ref_info[i].RefFrameSignBias = pic->raw_frame_header->ref_frame_sign_bias[i];
-+
-         ref_count++;
-     }
- 
-     err = vk_av1_fill_pict(avctx, NULL, &vp->ref_slot, &vp->ref,
-+                           &ap->std_ref,
-                            &ap->vkav1_ref,
--                           pic, 1, apply_grain, 8);
-+                           pic, 1, apply_grain);
-     if (err < 0)
-         return err;
- 
--    ap->tile_list.nb_tiles = 0;
--    ap->tile_list.tile_list = ap->tiles;
-+    ap->tile_count = 0;
- 
--    ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoMESA) {
--        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_MESA,
--        .frame_header = &ap->av1_frame_header,
--        .tile_list = &ap->tile_list,
-+    ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoKHR) {
-+        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_KHR,
-+        .pStdPictureInfo = &ap->std_pic_info,
-+        .tileCount = ap->tile_count,
-+        .pTileOffsets = ap->tile_offsets_s,
-+        .pTileSizes = ap->tile_sizes,
-     };
- 
-+    for (int i = 0; i < STD_VIDEO_AV1_REFS_PER_FRAME; i++)
-+        ap->av1_pic_info.referenceNameSlotIndices[i] = vp->ref_slots[frame_header->ref_frame_idx[i]].slotIndex;
-+
-     vp->decode_info = (VkVideoDecodeInfoKHR) {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR,
-         .pNext = &ap->av1_pic_info,
-@@ -274,9 +320,94 @@ static int vk_av1_start_frame(AVCodecContext          
-         },
-     };
- 
-+    ap->tile_info = (StdVideoAV1TileInfo) {
-+        .flags = (StdVideoAV1TileInfoFlags) {
-+            .uniform_tile_spacing_flag = frame_header->uniform_tile_spacing_flag,
-+        },
-+        .TileCols = frame_header->tile_cols,
-+        .TileRows = frame_header->tile_rows,
-+        .context_update_tile_id = frame_header->context_update_tile_id,
-+        .tile_size_bytes_minus_1 = frame_header->tile_size_bytes_minus1,
-+        .pWidthInSbsMinus1 = ap->width_in_sbs_minus1,
-+        .pHeightInSbsMinus1 = ap->height_in_sbs_minus1,
-+        .pMiColStarts = ap->mi_col_starts,
-+        .pMiRowStarts = ap->mi_row_starts,
-+    };
-+
-+    ap->quantization = (StdVideoAV1Quantization) {
-+        .flags.using_qmatrix = frame_header->using_qmatrix,
-+        .flags.diff_uv_delta = frame_header->diff_uv_delta,
-+        .base_q_idx = frame_header->base_q_idx,
-+        .DeltaQYDc = frame_header->delta_q_y_dc,
-+        .DeltaQUDc = frame_header->delta_q_u_dc,
-+        .DeltaQUAc = frame_header->delta_q_u_ac,
-+        .DeltaQVDc = frame_header->delta_q_v_dc,
-+        .DeltaQVAc = frame_header->delta_q_v_ac,
-+        .qm_y = frame_header->qm_y,
-+        .qm_u = frame_header->qm_u,
-+        .qm_v = frame_header->qm_v,
-+    };
-+
-+    for (int i = 0; i < STD_VIDEO_AV1_MAX_SEGMENTS; i++) {
-+        for (int j = 0; j < STD_VIDEO_AV1_SEG_LVL_MAX; j++) {
-+            ap->segmentation.FeatureEnabled[i] |= frame_header->feature_enabled[i][j] << j;
-+            ap->segmentation.FeatureData[i][j] = frame_header->feature_value[i][j];
-+        }
-+    }
-+
-+    ap->loop_filter = (StdVideoAV1LoopFilter) {
-+        .flags = (StdVideoAV1LoopFilterFlags) {
-+            .loop_filter_delta_enabled = frame_header->loop_filter_delta_enabled,
-+            .loop_filter_delta_update = frame_header->loop_filter_delta_update,
-+        },
-+        .loop_filter_sharpness = frame_header->loop_filter_sharpness,
-+    };
-+
-+    for (int i = 0; i < STD_VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS; i++)
-+        ap->loop_filter.loop_filter_level[i] = frame_header->loop_filter_level[i];
-+    for (int i = 0; i < STD_VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS; i++)
-+        ap->loop_filter.loop_filter_mode_deltas[i] = frame_header->loop_filter_mode_deltas[i];
-+
-+    ap->cdef = (StdVideoAV1CDEF) {
-+        .cdef_damping_minus_3 = frame_header->cdef_damping_minus_3,
-+        .cdef_bits = frame_header->cdef_bits,
-+    };
-+
-+    uses_lr = frame_header->lr_type[0] || frame_header->lr_type[1] || frame_header->lr_type[2],
-+    ap->loop_restoration = (StdVideoAV1LoopRestoration) {
-+        .FrameRestorationType[0] = remap_lr_type[frame_header->lr_type[0]],
-+        .FrameRestorationType[1] = remap_lr_type[frame_header->lr_type[1]],
-+        .FrameRestorationType[2] = remap_lr_type[frame_header->lr_type[2]],
-+        .LoopRestorationSize[0] = 1 + frame_header->lr_unit_shift,
-+        .LoopRestorationSize[1] = 1 + frame_header->lr_unit_shift - frame_header->lr_uv_shift,
-+        .LoopRestorationSize[2] = 1 + frame_header->lr_unit_shift - frame_header->lr_uv_shift,
-+    };
-+
-+    ap->film_grain = (StdVideoAV1FilmGrain) {
-+        .flags = (StdVideoAV1FilmGrainFlags) {
-+            .chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma,
-+            .overlap_flag = film_grain->overlap_flag,
-+            .clip_to_restricted_range = film_grain->clip_to_restricted_range,
-+        },
-+        .grain_scaling_minus_8 = film_grain->grain_scaling_minus_8,
-+        .ar_coeff_lag = film_grain->ar_coeff_lag,
-+        .ar_coeff_shift_minus_6 = film_grain->ar_coeff_shift_minus_6,
-+        .grain_scale_shift = film_grain->grain_scale_shift,
-+        .grain_seed = film_grain->grain_seed,
-+        .num_y_points = film_grain->num_y_points,
-+        .num_cb_points = film_grain->num_cb_points,
-+        .num_cr_points = film_grain->num_cr_points,
-+        .cb_mult = film_grain->cb_mult,
-+        .cb_luma_mult = film_grain->cb_luma_mult,
-+        .cb_offset = film_grain->cb_offset,
-+        .cr_mult = film_grain->cr_mult,
-+        .cr_luma_mult = film_grain->cr_luma_mult,
-+        .cr_offset = film_grain->cr_offset,
-+    };
-+
-     /* Setup frame header */
--    ap->av1_frame_header = (StdVideoAV1MESAFrameHeader) {
--        .flags = (StdVideoAV1MESAFrameHeaderFlags) {
-+    ap->std_pic_info = (StdVideoDecodeAV1PictureInfo) {
-+        .flags = (StdVideoDecodeAV1PictureInfoFlags) {
-             .error_resilient_mode = frame_header->error_resilient_mode,
-             .disable_cdf_update = frame_header->disable_cdf_update,
-             .use_superres = frame_header->use_superres,
-@@ -297,171 +428,87 @@ static int vk_av1_start_frame(AVCodecContext          
-             .reference_select = frame_header->reference_select,
-             .skip_mode_present = frame_header->skip_mode_present,
-             .delta_q_present = frame_header->delta_q_present,
-+            .delta_lf_present = frame_header->delta_lf_present,
-+            .delta_lf_multi = frame_header->delta_lf_multi,
-+            .segmentation_enabled = frame_header->segmentation_enabled,
-+            .segmentation_update_map = frame_header->segmentation_update_map,
-+            .segmentation_temporal_update = frame_header->segmentation_temporal_update,
-+            .segmentation_update_data = frame_header->segmentation_update_data,
-+            .UsesLr = uses_lr,
-+            .apply_grain = apply_grain,
-         },
--        .frame_to_show_map_idx = frame_header->frame_to_show_map_idx,
--        .frame_presentation_time = frame_header->frame_presentation_time,
--        .display_frame_id = frame_header->display_frame_id,
-         .frame_type = frame_header->frame_type,
-         .current_frame_id = frame_header->current_frame_id,
--        .order_hint = frame_header->order_hint,
-+        .OrderHint = frame_header->order_hint,
-         .primary_ref_frame = frame_header->primary_ref_frame,
--        .frame_width_minus_1 = frame_header->frame_width_minus_1,
--        .frame_height_minus_1 = frame_header->frame_height_minus_1,
--        .coded_denom = frame_header->coded_denom,
--        .render_width_minus_1 = frame_header->render_width_minus_1,
--        .render_height_minus_1 = frame_header->render_height_minus_1,
-         .refresh_frame_flags = frame_header->refresh_frame_flags,
-         .interpolation_filter = frame_header->interpolation_filter,
--        .tx_mode = frame_header->tx_mode,
--        .tiling = (StdVideoAV1MESATileInfo) {
--            .flags = (StdVideoAV1MESATileInfoFlags) {
--                .uniform_tile_spacing_flag = frame_header->uniform_tile_spacing_flag,
--            },
--            .tile_cols = frame_header->tile_cols,
--            .tile_rows = frame_header->tile_rows,
--            .context_update_tile_id = frame_header->context_update_tile_id,
--            .tile_size_bytes_minus1 = frame_header->tile_size_bytes_minus1,
--        },
--        .quantization = (StdVideoAV1MESAQuantization) {
--            .flags.using_qmatrix = frame_header->using_qmatrix,
--            .base_q_idx = frame_header->base_q_idx,
--            .delta_q_y_dc = frame_header->delta_q_y_dc,
--            .diff_uv_delta = frame_header->diff_uv_delta,
--            .delta_q_u_dc = frame_header->delta_q_u_dc,
--            .delta_q_u_ac = frame_header->delta_q_u_ac,
--            .delta_q_v_dc = frame_header->delta_q_v_dc,
--            .delta_q_v_ac = frame_header->delta_q_v_ac,
--            .qm_y = frame_header->qm_y,
--            .qm_u = frame_header->qm_u,
--            .qm_v = frame_header->qm_v,
--        },
--        .delta_q = (StdVideoAV1MESADeltaQ) {
--            .flags = (StdVideoAV1MESADeltaQFlags) {
--                .delta_lf_present = frame_header->delta_lf_present,
--                .delta_lf_multi = frame_header->delta_lf_multi,
--            },
--            .delta_q_res = frame_header->delta_q_res,
--            .delta_lf_res = frame_header->delta_lf_res,
--        },
--        .loop_filter = (StdVideoAV1MESALoopFilter) {
--            .flags = (StdVideoAV1MESALoopFilterFlags) {
--                .delta_enabled = frame_header->loop_filter_delta_enabled,
--                .delta_update = frame_header->loop_filter_delta_update,
--            },
--            .level = {
--                frame_header->loop_filter_level[0], frame_header->loop_filter_level[1],
--                frame_header->loop_filter_level[2], frame_header->loop_filter_level[3],
--            },
--            .sharpness = frame_header->loop_filter_sharpness,
--            .mode_deltas = {
--                frame_header->loop_filter_mode_deltas[0], frame_header->loop_filter_mode_deltas[1],
--            },
--        },
--        .cdef = (StdVideoAV1MESACDEF) {
--            .damping_minus_3 = frame_header->cdef_damping_minus_3,
--            .bits = frame_header->cdef_bits,
--        },
--        .lr = (StdVideoAV1MESALoopRestoration) {
--            .lr_unit_shift = frame_header->lr_unit_shift,
--            .lr_uv_shift = frame_header->lr_uv_shift,
--            .lr_type = { frame_header->lr_type[0], frame_header->lr_type[1], frame_header->lr_type[2] },
--        },
--        .segmentation = (StdVideoAV1MESASegmentation) {
--            .flags = (StdVideoAV1MESASegmentationFlags) {
--                .enabled = frame_header->segmentation_enabled,
--                .update_map = frame_header->segmentation_update_map,
--                .temporal_update = frame_header->segmentation_temporal_update,
--                .update_data = frame_header->segmentation_update_data,
--            },
--        },
--        .film_grain = (StdVideoAV1MESAFilmGrainParameters) {
--            .flags = (StdVideoAV1MESAFilmGrainFlags) {
--                .apply_grain = apply_grain,
--                .chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma,
--                .overlap_flag = film_grain->overlap_flag,
--                .clip_to_restricted_range = film_grain->clip_to_restricted_range,
--            },
--            .grain_scaling_minus_8 = film_grain->grain_scaling_minus_8,
--            .ar_coeff_lag = film_grain->ar_coeff_lag,
--            .ar_coeff_shift_minus_6 = film_grain->ar_coeff_shift_minus_6,
--            .grain_scale_shift = film_grain->grain_scale_shift,
--            .grain_seed = film_grain->grain_seed,
--            .num_y_points = film_grain->num_y_points,
--            .num_cb_points = film_grain->num_cb_points,
--            .num_cr_points = film_grain->num_cr_points,
--            .cb_mult = film_grain->cb_mult,
--            .cb_luma_mult = film_grain->cb_luma_mult,
--            .cb_offset = film_grain->cb_offset,
--            .cr_mult = film_grain->cr_mult,
--            .cr_luma_mult = film_grain->cr_luma_mult,
--            .cr_offset = film_grain->cr_offset,
--        },
-+        .TxMode = frame_header->tx_mode,
-+        .delta_q_res = frame_header->delta_q_res,
-+        .delta_lf_res = frame_header->delta_lf_res,
-+        .SkipModeFrame[0] = s->cur_frame.skip_mode_frame_idx[0],
-+        .SkipModeFrame[1] = s->cur_frame.skip_mode_frame_idx[1],
-+        .coded_denom = frame_header->coded_denom,
-+        .pTileInfo = &ap->tile_info,
-+        .pQuantization = &ap->quantization,
-+        .pSegmentation = &ap->segmentation,
-+        .pLoopFilter = &ap->loop_filter,
-+        .pCDEF = &ap->cdef,
-+        .pLoopRestoration = &ap->loop_restoration,
-+        .pGlobalMotion = &ap->global_motion,
-+        .pFilmGrain = apply_grain ? &ap->film_grain : NULL,
-     };
- 
-     for (int i = 0; i < 64; i++) {
--        ap->av1_frame_header.tiling.width_in_sbs_minus_1[i] = frame_header->width_in_sbs_minus_1[i];
--        ap->av1_frame_header.tiling.height_in_sbs_minus_1[i] = frame_header->height_in_sbs_minus_1[i];
--        ap->av1_frame_header.tiling.tile_start_col_sb[i] = frame_header->tile_start_col_sb[i];
--        ap->av1_frame_header.tiling.tile_start_row_sb[i] = frame_header->tile_start_row_sb[i];
-+        ap->width_in_sbs_minus1[i] = frame_header->width_in_sbs_minus_1[i];
-+        ap->height_in_sbs_minus1[i] = frame_header->height_in_sbs_minus_1[i];
-+        ap->mi_col_starts[i] = frame_header->tile_start_col_sb[i];
-+        ap->mi_row_starts[i] = frame_header->tile_start_row_sb[i];
-     }
- 
-     for (int i = 0; i < 8; i++) {
--        ap->av1_frame_header.segmentation.feature_enabled_bits[i] = 0;
--        for (int j = 0; j < 8; j++) {
--            ap->av1_frame_header.segmentation.feature_enabled_bits[i] |= (frame_header->feature_enabled[i][j] << j);
--            ap->av1_frame_header.segmentation.feature_data[i][j] = frame_header->feature_value[i][j];
-+        ap->segmentation.FeatureEnabled[i] = 0x0;
-+        for (int j = 0; j < STD_VIDEO_AV1_SEG_LVL_MAX; j++) {
-+            ap->segmentation.FeatureEnabled[i] |= (frame_header->feature_enabled[i][j] << j);
-+            ap->segmentation.FeatureData[i][j] = frame_header->feature_value[i][j];
-         }
- 
--        ap->av1_frame_header.loop_filter.ref_deltas[i] = frame_header->loop_filter_ref_deltas[i];
-+        ap->loop_filter.loop_filter_ref_deltas[i] = frame_header->loop_filter_ref_deltas[i];
- 
--        ap->av1_frame_header.cdef.y_pri_strength[i] = frame_header->cdef_y_pri_strength[i];
--        ap->av1_frame_header.cdef.y_sec_strength[i] = frame_header->cdef_y_sec_strength[i];
--        ap->av1_frame_header.cdef.uv_pri_strength[i] = frame_header->cdef_uv_pri_strength[i];
--        ap->av1_frame_header.cdef.uv_sec_strength[i] = frame_header->cdef_uv_sec_strength[i];
-+        ap->cdef.cdef_y_pri_strength[i] = frame_header->cdef_y_pri_strength[i];
-+        ap->cdef.cdef_y_sec_strength[i] = frame_header->cdef_y_sec_strength[i];
-+        ap->cdef.cdef_uv_pri_strength[i] = frame_header->cdef_uv_pri_strength[i];
-+        ap->cdef.cdef_uv_sec_strength[i] = frame_header->cdef_uv_sec_strength[i];
- 
--        ap->av1_frame_header.ref_order_hint[i] = frame_header->ref_order_hint[i];
--        ap->av1_frame_header.global_motion[i] = (StdVideoAV1MESAGlobalMotion) {
--            .flags = (StdVideoAV1MESAGlobalMotionFlags) {
--                .gm_invalid = s->cur_frame.gm_invalid[i],
--            },
--            .gm_type = s->cur_frame.gm_type[i],
--            .gm_params = {
--                s->cur_frame.gm_params[i][0], s->cur_frame.gm_params[i][1],
--                s->cur_frame.gm_params[i][2], s->cur_frame.gm_params[i][3],
--                s->cur_frame.gm_params[i][4], s->cur_frame.gm_params[i][5],
--            },
--        };
-+        /* Reference frames */
-+        ap->std_pic_info.OrderHints[i] = frame_header->ref_order_hint[i];
-+        ap->global_motion.GmType[i] = s->cur_frame.gm_type[i];
-+        for (int j = 0; j < STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS; j++) {
-+            ap->global_motion.gm_params[i][j] = s->cur_frame.gm_params[i][j];
-+        }
-     }
- 
--    for (int i = 0; i < 7; i++) {
--        ap->av1_frame_header.ref_frame_idx[i] = frame_header->ref_frame_idx[i];
--        ap->av1_frame_header.delta_frame_id_minus1[i] = frame_header->delta_frame_id_minus1[i];
--    }
--
--    ap->av1_pic_info.skip_mode_frame_idx[0] = s->cur_frame.skip_mode_frame_idx[0];
--    ap->av1_pic_info.skip_mode_frame_idx[1] = s->cur_frame.skip_mode_frame_idx[1];
--
-     if (apply_grain) {
-         for (int i = 0; i < 14; i++) {
--            ap->av1_frame_header.film_grain.point_y_value[i] = film_grain->point_y_value[i];
--            ap->av1_frame_header.film_grain.point_y_scaling[i] = film_grain->point_y_scaling[i];
-+            ap->film_grain.point_y_value[i] = film_grain->point_y_value[i];
-+            ap->film_grain.point_y_scaling[i] = film_grain->point_y_scaling[i];
-         }
- 
-         for (int i = 0; i < 10; i++) {
--            ap->av1_frame_header.film_grain.point_cb_value[i] = film_grain->point_cb_value[i];
--            ap->av1_frame_header.film_grain.point_cb_scaling[i] = film_grain->point_cb_scaling[i];
--            ap->av1_frame_header.film_grain.point_cr_value[i] = film_grain->point_cr_value[i];
--            ap->av1_frame_header.film_grain.point_cr_scaling[i] = film_grain->point_cr_scaling[i];
-+            ap->film_grain.point_cb_value[i] = film_grain->point_cb_value[i];
-+            ap->film_grain.point_cb_scaling[i] = film_grain->point_cb_scaling[i];
-+            ap->film_grain.point_cr_value[i] = film_grain->point_cr_value[i];
-+            ap->film_grain.point_cr_scaling[i] = film_grain->point_cr_scaling[i];
-         }
- 
-         for (int i = 0; i < 24; i++) {
--            ap->av1_frame_header.film_grain.ar_coeffs_y_plus_128[i] = film_grain->ar_coeffs_y_plus_128[i];
--            ap->av1_frame_header.film_grain.ar_coeffs_cb_plus_128[i] = film_grain->ar_coeffs_cb_plus_128[i];
--            ap->av1_frame_header.film_grain.ar_coeffs_cr_plus_128[i] = film_grain->ar_coeffs_cr_plus_128[i];
-+            ap->film_grain.ar_coeffs_y_plus_128[i] = film_grain->ar_coeffs_y_plus_128[i];
-+            ap->film_grain.ar_coeffs_cb_plus_128[i] = film_grain->ar_coeffs_cb_plus_128[i];
-+            ap->film_grain.ar_coeffs_cr_plus_128[i] = film_grain->ar_coeffs_cr_plus_128[i];
-         }
- 
--        ap->av1_frame_header.film_grain.ar_coeffs_cb_plus_128[24] = film_grain->ar_coeffs_cb_plus_128[24];
--        ap->av1_frame_header.film_grain.ar_coeffs_cr_plus_128[24] = film_grain->ar_coeffs_cr_plus_128[24];
-+        ap->film_grain.ar_coeffs_cb_plus_128[24] = film_grain->ar_coeffs_cb_plus_128[24];
-+        ap->film_grain.ar_coeffs_cr_plus_128[24] = film_grain->ar_coeffs_cr_plus_128[24];
-     }
- 
-     /* Workaround for a spec issue. */
-@@ -480,26 +527,22 @@ static int vk_av1_decode_slice(AVCodecContext *avctx,
-     FFVulkanDecodePicture *vp = &ap->vp;
- 
-     for (int i = s->tg_start; i <= s->tg_end; i++) {
--        ap->tiles[ap->tile_list.nb_tiles] = (StdVideoAV1MESATile) {
--            .size     = s->tile_group_info[i].tile_size,
--            .offset   = s->tile_group_info[i].tile_offset,
--            .row      = s->tile_group_info[i].tile_row,
--            .column   = s->tile_group_info[i].tile_column,
--            .tg_start = s->tg_start,
--            .tg_end   = s->tg_end,
--        };
- 
-+        ap->tile_offsets_s[ap->tile_count] = s->tile_group_info[i].tile_offset;
-+        ap->tile_sizes[ap->tile_count] = s->tile_group_info[i].tile_size;
-+
-         err = ff_vk_decode_add_slice(avctx, vp,
-                                      data + s->tile_group_info[i].tile_offset,
-                                      s->tile_group_info[i].tile_size, 0,
--                                     &ap->tile_list.nb_tiles,
-+                                     &ap->tile_count,
-                                      &ap->tile_offsets);
-         if (err < 0)
-             return err;
- 
--        ap->tiles[ap->tile_list.nb_tiles - 1].offset = ap->tile_offsets[ap->tile_list.nb_tiles - 1];
-+        ap->tile_offsets_s[ap->tile_count - 1] = ap->tile_offsets[ap->tile_count - 1];
-     }
- 
-+    ap->av1_pic_info.tileCount = ap->tile_count;
-     return 0;
- }
- 
-@@ -513,7 +556,7 @@ static int vk_av1_end_frame(AVCodecContext *avctx)
-     FFVulkanDecodePicture *rvp[AV1_NUM_REF_FRAMES] = { 0 };
-     AVFrame *rav[AV1_NUM_REF_FRAMES] = { 0 };
- 
--    if (!ap->tile_list.nb_tiles)
-+    if (!ap->tile_count)
-         return 0;
- 
-     if (!dec->session_params) {
-@@ -531,7 +574,7 @@ static int vk_av1_end_frame(AVCodecContext *avctx)
-     }
- 
-     av_log(avctx, AV_LOG_VERBOSE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i tiles\n",
--           vp->slices_size, ap->tile_list.nb_tiles);
-+           vp->slices_size, ap->tile_count);
- 
-     return ff_vk_decode_frame(avctx, pic->f, vp, rav, rvp);
- }
---- libavcodec/vulkan_decode.c.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/vulkan_decode.c
-@@ -50,7 +50,7 @@ static const VkVideoProfileInfoKHR *get_video_profile(
-     VkStructureType profile_struct_type =
-         codec_id == AV_CODEC_ID_H264 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR :
-         codec_id == AV_CODEC_ID_HEVC ? VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR :
--        codec_id == AV_CODEC_ID_AV1  ? VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_MESA :
-+        codec_id == AV_CODEC_ID_AV1  ? VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR :
-         0;
- 
-     profile_list = ff_vk_find_struct(ctx->s.hwfc->create_pnext,
-@@ -663,7 +663,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *a
-                                      const struct FFVkCodecMap *vk_codec,
-                                      VkVideoDecodeH264CapabilitiesKHR *h264_caps,
-                                      VkVideoDecodeH265CapabilitiesKHR *h265_caps,
--                                     VkVideoDecodeAV1CapabilitiesMESA *av1_caps,
-+                                     VkVideoDecodeAV1CapabilitiesKHR *av1_caps,
-                                      VkVideoCapabilitiesKHR *caps,
-                                      VkVideoDecodeCapabilitiesKHR *dec_caps,
-                                      int cur_profile)
-@@ -674,7 +674,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *a
- 
-     VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->h264_profile;
-     VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->h265_profile;
--    VkVideoDecodeAV1ProfileInfoMESA *av1_profile  = &prof->av1_profile;
-+    VkVideoDecodeAV1ProfileInfoKHR *av1_profile  = &prof->av1_profile;
- 
-     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt);
-     if (!desc)
-@@ -702,8 +702,8 @@ static VkResult vulkan_setup_profile(AVCodecContext *a
-     } else if (avctx->codec_id == AV_CODEC_ID_AV1) {
-         dec_caps->pNext = av1_caps;
-         usage->pNext = av1_profile;
--        av1_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_MESA;
--        av1_profile->stdProfileIdc = cur_profile;
-+        av1_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR;
-+        av1_profile->stdProfile = cur_profile;
-     }
- 
-     usage->sType           = VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR;
-@@ -758,8 +758,8 @@ static int vulkan_decode_get_profile(AVCodecContext *a
-     VkVideoDecodeH265CapabilitiesKHR h265_caps = {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR,
-     };
--    VkVideoDecodeAV1CapabilitiesMESA av1_caps = {
--        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_MESA,
-+    VkVideoDecodeAV1CapabilitiesKHR av1_caps = {
-+        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR,
-     };
- 
-     VkPhysicalDeviceVideoFormatInfoKHR fmt_info = {
-@@ -782,7 +782,7 @@ static int vulkan_decode_get_profile(AVCodecContext *a
-     cur_profile = avctx->profile;
-     base_profile = avctx->codec_id == AV_CODEC_ID_H264 ? AV_PROFILE_H264_CONSTRAINED_BASELINE :
-                    avctx->codec_id == AV_CODEC_ID_H265 ? AV_PROFILE_HEVC_MAIN :
--                   avctx->codec_id == AV_CODEC_ID_AV1  ? STD_VIDEO_AV1_MESA_PROFILE_MAIN :
-+                   avctx->codec_id == AV_CODEC_ID_AV1  ? STD_VIDEO_AV1_PROFILE_MAIN :
-                    0;
- 
-     ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_codec,
-@@ -830,7 +830,7 @@ static int vulkan_decode_get_profile(AVCodecContext *a
- 
-     max_level = avctx->codec_id == AV_CODEC_ID_H264 ? ff_vk_h264_level_to_av(h264_caps.maxLevelIdc) :
-                 avctx->codec_id == AV_CODEC_ID_H265 ? ff_vk_h265_level_to_av(h265_caps.maxLevelIdc) :
--                avctx->codec_id == AV_CODEC_ID_AV1  ? av1_caps.maxLevelIdc  :
-+                avctx->codec_id == AV_CODEC_ID_AV1  ? ff_vk_av1_level_to_av(av1_caps.maxLevel) :
-                 0;
- 
-     av_log(avctx, AV_LOG_VERBOSE, "Decoder capabilities for %s profile \"%s\":\n",
-@@ -911,7 +911,7 @@ static int vulkan_decode_get_profile(AVCodecContext *a
-     /* TODO: make dedicated_dpb tunable */
-     dec->dedicated_dpb = !(dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR);
-     dec->layered_dpb = !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR);
--    dec->external_fg = av1_caps.flags & VK_VIDEO_DECODE_AV1_CAPABILITY_EXTERNAL_FILM_GRAIN_MESA;
-+    //    dec->external_fg = av1_caps.flags & VK_VIDEO_DECODE_AV1_CAPABILITY_EXTERNAL_FILM_GRAIN_KHR;
- 
-     if (dec->dedicated_dpb) {
-         fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
-@@ -1118,8 +1118,8 @@ int ff_vk_decode_init(AVCodecContext *avctx)
-     VkVideoDecodeH265SessionParametersCreateInfoKHR h265_params = {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR,
-     };
--    VkVideoDecodeAV1SessionParametersCreateInfoMESA av1_params = {
--        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_MESA,
-+    VkVideoDecodeAV1SessionParametersCreateInfoKHR av1_params = {
-+        .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_KHR,
-     };
-     VkVideoSessionParametersCreateInfoKHR session_params_create = {
-         .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
---- libavcodec/vulkan_decode.h.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/vulkan_decode.h
-@@ -28,7 +28,7 @@ typedef struct FFVulkanDecodeProfileData {
- typedef struct FFVulkanDecodeProfileData {
-     VkVideoDecodeH264ProfileInfoKHR h264_profile;
-     VkVideoDecodeH265ProfileInfoKHR h265_profile;
--    VkVideoDecodeAV1ProfileInfoMESA av1_profile;
-+    VkVideoDecodeAV1ProfileInfoKHR av1_profile;
-     VkVideoDecodeUsageInfoKHR usage;
-     VkVideoProfileInfoKHR profile;
-     VkVideoProfileListInfoKHR profile_list;
---- libavcodec/vulkan_video.c.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/vulkan_video.c
-@@ -37,7 +37,7 @@ const FFVkCodecMap ff_vk_codec_map[AV_CODEC_ID_FIRST_A
-                            0,
-                            0,
-                            FF_VK_EXT_VIDEO_DECODE_AV1,
--                           0x01000000 /* TODO fix this */
-+                           VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR
-     },
- };
- 
-@@ -196,6 +196,37 @@ int ff_vk_h265_level_to_av(StdVideoH265LevelIdc level)
-     case STD_VIDEO_H265_LEVEL_IDC_6_1: return 61;
-     default:
-     case STD_VIDEO_H265_LEVEL_IDC_6_2: return 62;
-+    }
-+}
-+
-+int ff_vk_av1_level_to_av(StdVideoAV1Level level)
-+{
-+    switch (level) {
-+    case STD_VIDEO_AV1_LEVEL_2_0: return 20;
-+    case STD_VIDEO_AV1_LEVEL_2_1: return 21;
-+    case STD_VIDEO_AV1_LEVEL_2_2: return 22;
-+    case STD_VIDEO_AV1_LEVEL_2_3: return 23;
-+    case STD_VIDEO_AV1_LEVEL_3_0: return 30;
-+    case STD_VIDEO_AV1_LEVEL_3_1: return 31;
-+    case STD_VIDEO_AV1_LEVEL_3_2: return 32;
-+    case STD_VIDEO_AV1_LEVEL_3_3: return 33;
-+    case STD_VIDEO_AV1_LEVEL_4_0: return 40;
-+    case STD_VIDEO_AV1_LEVEL_4_1: return 41;
-+    case STD_VIDEO_AV1_LEVEL_4_2: return 42;
-+    case STD_VIDEO_AV1_LEVEL_4_3: return 43;
-+    case STD_VIDEO_AV1_LEVEL_5_0: return 50;
-+    case STD_VIDEO_AV1_LEVEL_5_1: return 51;
-+    case STD_VIDEO_AV1_LEVEL_5_2: return 52;
-+    case STD_VIDEO_AV1_LEVEL_5_3: return 53;
-+    case STD_VIDEO_AV1_LEVEL_6_0: return 60;
-+    case STD_VIDEO_AV1_LEVEL_6_1: return 61;
-+    case STD_VIDEO_AV1_LEVEL_6_2: return 62;
-+    case STD_VIDEO_AV1_LEVEL_6_3: return 63;
-+    case STD_VIDEO_AV1_LEVEL_7_0: return 70;
-+    case STD_VIDEO_AV1_LEVEL_7_1: return 71;
-+    case STD_VIDEO_AV1_LEVEL_7_2: return 72;
-+    default:
-+    case STD_VIDEO_AV1_LEVEL_7_3: return 73;
-     }
- }
- 
---- libavcodec/vulkan_video.h.orig	2023-11-11 00:25:17 UTC
-+++ libavcodec/vulkan_video.h
-@@ -23,8 +23,6 @@
- #include "vulkan.h"
- 
- #include <vk_video/vulkan_video_codecs_common.h>
--#include "vulkan_video_codec_av1std.h"
*** 490 LINES SKIPPED ***