diff options
3 files changed, 1478 insertions, 1 deletions
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/av1_ordering_info.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/av1_ordering_info.patch new file mode 100644 index 0000000000..bfc894563c --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/av1_ordering_info.patch | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | From cafb4c554845332eeb33284cf6498049997dc67e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mark Thompson <sw@jkqxz.net> | ||
| 3 | Date: Wed, 20 Mar 2024 20:35:28 +0000 | ||
| 4 | Subject: [PATCH] lavc/cbs_av1: Save more frame ordering information | ||
| 5 | |||
| 6 | This is wanted by the Vulkan decoder. | ||
| 7 | |||
| 8 | Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | ||
| 9 | Upstream-Status: Backport [https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/ecdc94b97f809d5f2b88640842fd0541951ad295] | ||
| 10 | --- | ||
| 11 | libavcodec/cbs_av1.h | 5 +++++ | ||
| 12 | libavcodec/cbs_av1_syntax_template.c | 25 +++++++++++++++++++++---- | ||
| 13 | 2 files changed, 26 insertions(+), 4 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/libavcodec/cbs_av1.h b/libavcodec/cbs_av1.h | ||
| 16 | index a5402f069d..a027013bc7 100644 | ||
| 17 | --- a/libavcodec/cbs_av1.h | ||
| 18 | +++ b/libavcodec/cbs_av1.h | ||
| 19 | @@ -427,6 +427,8 @@ typedef struct AV1ReferenceFrameState { | ||
| 20 | int bit_depth; // RefBitDepth | ||
| 21 | int order_hint; // RefOrderHint | ||
| 22 | |||
| 23 | + int saved_order_hints[AV1_TOTAL_REFS_PER_FRAME]; // SavedOrderHints[ref] | ||
| 24 | + | ||
| 25 | int8_t loop_filter_ref_deltas[AV1_TOTAL_REFS_PER_FRAME]; | ||
| 26 | int8_t loop_filter_mode_deltas[2]; | ||
| 27 | uint8_t feature_enabled[AV1_MAX_SEGMENTS][AV1_SEG_LVL_MAX]; | ||
| 28 | @@ -464,6 +466,9 @@ typedef struct CodedBitstreamAV1Context { | ||
| 29 | int tile_rows; | ||
| 30 | int tile_num; | ||
| 31 | |||
| 32 | + int order_hints[AV1_TOTAL_REFS_PER_FRAME]; // OrderHints | ||
| 33 | + int ref_frame_sign_bias[AV1_TOTAL_REFS_PER_FRAME]; // RefFrameSignBias | ||
| 34 | + | ||
| 35 | AV1ReferenceFrameState ref[AV1_NUM_REF_FRAMES]; | ||
| 36 | |||
| 37 | // AVOptions | ||
| 38 | diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c | ||
| 39 | index 3be1f2d30f..2979c5d98f 100644 | ||
| 40 | --- a/libavcodec/cbs_av1_syntax_template.c | ||
| 41 | +++ b/libavcodec/cbs_av1_syntax_template.c | ||
| 42 | @@ -1414,6 +1414,8 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, | ||
| 43 | priv->ref[i].valid = 0; | ||
| 44 | priv->ref[i].order_hint = 0; | ||
| 45 | } | ||
| 46 | + for (i = 0; i < AV1_REFS_PER_FRAME; i++) | ||
| 47 | + priv->order_hints[i + AV1_REF_FRAME_LAST] = 0; | ||
| 48 | } | ||
| 49 | |||
| 50 | flag(disable_cdf_update); | ||
| 51 | @@ -1568,11 +1570,20 @@ static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, | ||
| 52 | else | ||
| 53 | flag(use_ref_frame_mvs); | ||
| 54 | |||
| 55 | - infer(allow_intrabc, 0); | ||
| 56 | - } | ||
| 57 | + for (i = 0; i < AV1_REFS_PER_FRAME; i++) { | ||
| 58 | + int ref_frame = AV1_REF_FRAME_LAST + i; | ||
| 59 | + int hint = priv->ref[current->ref_frame_idx[i]].order_hint; | ||
| 60 | + priv->order_hints[ref_frame] = hint; | ||
| 61 | + if (!seq->enable_order_hint) { | ||
| 62 | + priv->ref_frame_sign_bias[ref_frame] = 0; | ||
| 63 | + } else { | ||
| 64 | + priv->ref_frame_sign_bias[ref_frame] = | ||
| 65 | + cbs_av1_get_relative_dist(seq, hint, | ||
| 66 | + current->order_hint) > 0; | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | |||
| 70 | - if (!frame_is_intra) { | ||
| 71 | - // Derive reference frame sign biases. | ||
| 72 | + infer(allow_intrabc, 0); | ||
| 73 | } | ||
| 74 | |||
| 75 | if (seq->reduced_still_picture_header || current->disable_cdf_update) | ||
| 76 | @@ -1674,6 +1685,12 @@ update_refs: | ||
| 77 | .bit_depth = priv->bit_depth, | ||
| 78 | .order_hint = priv->order_hint, | ||
| 79 | }; | ||
| 80 | + | ||
| 81 | + for (int j = 0; j < AV1_REFS_PER_FRAME; j++) { | ||
| 82 | + priv->ref[i].saved_order_hints[j + AV1_REF_FRAME_LAST] = | ||
| 83 | + priv->order_hints[j + AV1_REF_FRAME_LAST]; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | memcpy(priv->ref[i].loop_filter_ref_deltas, current->loop_filter_ref_deltas, | ||
| 87 | sizeof(current->loop_filter_ref_deltas)); | ||
| 88 | memcpy(priv->ref[i].loop_filter_mode_deltas, current->loop_filter_mode_deltas, | ||
| 89 | -- | ||
| 90 | 2.25.1 | ||
| 91 | |||
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/vulkan_av1_stable_API.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/vulkan_av1_stable_API.patch new file mode 100644 index 0000000000..74db148b3b --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/vulkan_av1_stable_API.patch | |||
| @@ -0,0 +1,1382 @@ | |||
| 1 | From ecdc94b97f809d5f2b88640842fd0541951ad295 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Lynne <dev@lynne.ee> | ||
| 3 | Date: Fri, 19 Jan 2024 10:49:02 +1000 | ||
| 4 | Subject: [PATCH] vulkan_av1: port to the new stable API | ||
| 5 | |||
| 6 | Co-Authored-by: Dave Airlie <airlied@redhat.com> | ||
| 7 | Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | ||
| 8 | Upstream-Status: Backport [https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/ecdc94b97f809d5f2b88640842fd0541951ad295] | ||
| 9 | --- | ||
| 10 | configure | 4 +- | ||
| 11 | libavcodec/Makefile | 5 +- | ||
| 12 | libavcodec/vulkan_av1.c | 514 ++++++++++-------- | ||
| 13 | libavcodec/vulkan_decode.c | 31 +- | ||
| 14 | libavcodec/vulkan_decode.h | 2 +- | ||
| 15 | libavcodec/vulkan_video.h | 2 - | ||
| 16 | .../vulkan_video_codec_av1std_decode_mesa.h | 36 -- | ||
| 17 | libavcodec/vulkan_video_codec_av1std_mesa.h | 403 -------------- | ||
| 18 | libavutil/hwcontext_vulkan.c | 2 +- | ||
| 19 | libavutil/vulkan_functions.h | 2 +- | ||
| 20 | libavutil/vulkan_loader.h | 2 +- | ||
| 21 | 11 files changed, 306 insertions(+), 697 deletions(-) | ||
| 22 | delete mode 100644 libavcodec/vulkan_video_codec_av1std_decode_mesa.h | ||
| 23 | delete mode 100644 libavcodec/vulkan_video_codec_av1std_mesa.h | ||
| 24 | |||
| 25 | diff --git a/configure b/configure | ||
| 26 | index e853deb51d..9fa639fca6 100755 | ||
| 27 | --- a/configure | ||
| 28 | +++ b/configure | ||
| 29 | @@ -7300,8 +7300,8 @@ enabled vdpau && | ||
| 30 | "in maintaining it." | ||
| 31 | |||
| 32 | if enabled vulkan; then | ||
| 33 | - check_pkg_config_header_only vulkan "vulkan >= 1.3.255" "vulkan/vulkan.h" "defined VK_VERSION_1_3" || | ||
| 34 | - check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 255)" | ||
| 35 | + check_pkg_config_header_only vulkan "vulkan >= 1.3.277" "vulkan/vulkan.h" "defined VK_VERSION_1_3" || | ||
| 36 | + check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 277)" | ||
| 37 | fi | ||
| 38 | |||
| 39 | if disabled vulkan; then | ||
| 40 | diff --git a/libavcodec/Makefile b/libavcodec/Makefile | ||
| 41 | index 7ef2e03ca6..9ce6d445c1 100644 | ||
| 42 | --- a/libavcodec/Makefile | ||
| 43 | +++ b/libavcodec/Makefile | ||
| 44 | @@ -1258,8 +1258,7 @@ SKIPHEADERS += %_tablegen.h \ | ||
| 45 | aacenc_quantization.h \ | ||
| 46 | aacenc_quantization_misc.h \ | ||
| 47 | bitstream_template.h \ | ||
| 48 | - vulkan_video_codec_av1std.h \ | ||
| 49 | - $(ARCH)/vpx_arith.h \ | ||
| 50 | + $(ARCH)/vpx_arith.h \ | ||
| 51 | |||
| 52 | SKIPHEADERS-$(CONFIG_AMF) += amfenc.h | ||
| 53 | SKIPHEADERS-$(CONFIG_D3D11VA) += d3d11va.h dxva2_internal.h | ||
| 54 | @@ -1280,7 +1279,7 @@ SKIPHEADERS-$(CONFIG_QSVENC) += qsvenc.h | ||
| 55 | SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h | ||
| 56 | SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h | ||
| 57 | SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h | ||
| 58 | -SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h | ||
| 59 | +SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h | ||
| 60 | SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h | ||
| 61 | SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h | ||
| 62 | |||
| 63 | diff --git a/libavcodec/vulkan_av1.c b/libavcodec/vulkan_av1.c | ||
| 64 | index 5afd5353cc..c9e398eaec 100644 | ||
| 65 | --- a/libavcodec/vulkan_av1.c | ||
| 66 | +++ b/libavcodec/vulkan_av1.c | ||
| 67 | @@ -36,33 +36,47 @@ const FFVulkanDecodeDescriptor ff_vk_dec_av1_desc = { | ||
| 68 | typedef struct AV1VulkanDecodePicture { | ||
| 69 | FFVulkanDecodePicture vp; | ||
| 70 | |||
| 71 | - /* Workaround for a spec issue. | ||
| 72 | - *Can be removed once no longer needed, and threading can be enabled. */ | ||
| 73 | + /* TODO: investigate if this can be removed to make decoding completely | ||
| 74 | + * independent. */ | ||
| 75 | FFVulkanDecodeContext *dec; | ||
| 76 | |||
| 77 | - StdVideoAV1MESATile tiles[MAX_TILES]; | ||
| 78 | - StdVideoAV1MESATileList tile_list; | ||
| 79 | - const uint32_t *tile_offsets; | ||
| 80 | + uint32_t tile_sizes[MAX_TILES]; | ||
| 81 | |||
| 82 | /* Current picture */ | ||
| 83 | - VkVideoDecodeAV1DpbSlotInfoMESA vkav1_ref; | ||
| 84 | - StdVideoAV1MESAFrameHeader av1_frame_header; | ||
| 85 | - VkVideoDecodeAV1PictureInfoMESA av1_pic_info; | ||
| 86 | + StdVideoDecodeAV1ReferenceInfo std_ref; | ||
| 87 | + VkVideoDecodeAV1DpbSlotInfoKHR vkav1_ref; | ||
| 88 | + uint16_t width_in_sbs_minus1[64]; | ||
| 89 | + uint16_t height_in_sbs_minus1[64]; | ||
| 90 | + uint16_t mi_col_starts[64]; | ||
| 91 | + uint16_t mi_row_starts[64]; | ||
| 92 | + StdVideoAV1TileInfo tile_info; | ||
| 93 | + StdVideoAV1Quantization quantization; | ||
| 94 | + StdVideoAV1Segmentation segmentation; | ||
| 95 | + StdVideoAV1LoopFilter loop_filter; | ||
| 96 | + StdVideoAV1CDEF cdef; | ||
| 97 | + StdVideoAV1LoopRestoration loop_restoration; | ||
| 98 | + StdVideoAV1GlobalMotion global_motion; | ||
| 99 | + StdVideoAV1FilmGrain film_grain; | ||
| 100 | + StdVideoDecodeAV1PictureInfo std_pic_info; | ||
| 101 | + VkVideoDecodeAV1PictureInfoKHR av1_pic_info; | ||
| 102 | |||
| 103 | /* Picture refs */ | ||
| 104 | const AV1Frame *ref_src [AV1_NUM_REF_FRAMES]; | ||
| 105 | - VkVideoDecodeAV1DpbSlotInfoMESA vkav1_refs[AV1_NUM_REF_FRAMES]; | ||
| 106 | + StdVideoDecodeAV1ReferenceInfo std_refs [AV1_NUM_REF_FRAMES]; | ||
| 107 | + VkVideoDecodeAV1DpbSlotInfoKHR vkav1_refs[AV1_NUM_REF_FRAMES]; | ||
| 108 | |||
| 109 | uint8_t frame_id_set; | ||
| 110 | uint8_t frame_id; | ||
| 111 | + uint8_t ref_frame_sign_bias_mask; | ||
| 112 | } AV1VulkanDecodePicture; | ||
| 113 | |||
| 114 | static int vk_av1_fill_pict(AVCodecContext *avctx, const AV1Frame **ref_src, | ||
| 115 | VkVideoReferenceSlotInfoKHR *ref_slot, /* Main structure */ | ||
| 116 | VkVideoPictureResourceInfoKHR *ref, /* Goes in ^ */ | ||
| 117 | - VkVideoDecodeAV1DpbSlotInfoMESA *vkav1_ref, /* Goes in ^ */ | ||
| 118 | + StdVideoDecodeAV1ReferenceInfo *vkav1_std_ref, | ||
| 119 | + VkVideoDecodeAV1DpbSlotInfoKHR *vkav1_ref, /* Goes in ^ */ | ||
| 120 | const AV1Frame *pic, int is_current, int has_grain, | ||
| 121 | - int dpb_slot_index) | ||
| 122 | + int *saved_order_hints) | ||
| 123 | { | ||
| 124 | FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data; | ||
| 125 | AV1VulkanDecodePicture *hp = pic->hwaccel_picture_private; | ||
| 126 | @@ -73,31 +87,42 @@ static int vk_av1_fill_pict(AVCodecContext *avctx, const AV1Frame **ref_src, | ||
| 127 | if (err < 0) | ||
| 128 | return err; | ||
| 129 | |||
| 130 | - *vkav1_ref = (VkVideoDecodeAV1DpbSlotInfoMESA) { | ||
| 131 | - .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_DPB_SLOT_INFO_MESA, | ||
| 132 | - .frameIdx = hp->frame_id, | ||
| 133 | + *vkav1_std_ref = (StdVideoDecodeAV1ReferenceInfo) { | ||
| 134 | + .flags = (StdVideoDecodeAV1ReferenceInfoFlags) { | ||
| 135 | + .disable_frame_end_update_cdf = pic->raw_frame_header->disable_frame_end_update_cdf, | ||
| 136 | + .segmentation_enabled = pic->raw_frame_header->segmentation_enabled, | ||
| 137 | + }, | ||
| 138 | + .frame_type = pic->raw_frame_header->frame_type, | ||
| 139 | + .OrderHint = pic->raw_frame_header->order_hint, | ||
| 140 | + .RefFrameSignBias = hp->ref_frame_sign_bias_mask, | ||
| 141 | }; | ||
| 142 | |||
| 143 | - for (unsigned i = 0; i < 7; i++) { | ||
| 144 | - const int idx = pic->raw_frame_header->ref_frame_idx[i]; | ||
| 145 | - vkav1_ref->ref_order_hint[i] = pic->raw_frame_header->ref_order_hint[idx]; | ||
| 146 | - } | ||
| 147 | + if (saved_order_hints) | ||
| 148 | + for (int i = 0; i < AV1_TOTAL_REFS_PER_FRAME; i++) | ||
| 149 | + vkav1_std_ref->SavedOrderHints[i] = saved_order_hints[i]; | ||
| 150 | + | ||
| 151 | + *vkav1_ref = (VkVideoDecodeAV1DpbSlotInfoKHR) { | ||
| 152 | + .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_DPB_SLOT_INFO_KHR, | ||
| 153 | + .pStdReferenceInfo = vkav1_std_ref, | ||
| 154 | + }; | ||
| 155 | |||
| 156 | - vkav1_ref->disable_frame_end_update_cdf = pic->raw_frame_header->disable_frame_end_update_cdf; | ||
| 157 | + vkav1_std_ref->flags.disable_frame_end_update_cdf = pic->raw_frame_header->disable_frame_end_update_cdf; | ||
| 158 | + vkav1_std_ref->flags.segmentation_enabled = pic->raw_frame_header->segmentation_enabled; | ||
| 159 | + vkav1_std_ref->frame_type = pic->raw_frame_header->frame_type; | ||
| 160 | |||
| 161 | *ref = (VkVideoPictureResourceInfoKHR) { | ||
| 162 | .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR, | ||
| 163 | .codedOffset = (VkOffset2D){ 0, 0 }, | ||
| 164 | .codedExtent = (VkExtent2D){ pic->f->width, pic->f->height }, | ||
| 165 | .baseArrayLayer = ((has_grain || dec->dedicated_dpb) && dec->layered_dpb) ? | ||
| 166 | - dpb_slot_index : 0, | ||
| 167 | + hp->frame_id : 0, | ||
| 168 | .imageViewBinding = vkpic->img_view_ref, | ||
| 169 | }; | ||
| 170 | |||
| 171 | *ref_slot = (VkVideoReferenceSlotInfoKHR) { | ||
| 172 | .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR, | ||
| 173 | .pNext = vkav1_ref, | ||
| 174 | - .slotIndex = dpb_slot_index, | ||
| 175 | + .slotIndex = hp->frame_id, | ||
| 176 | .pPictureResource = ref, | ||
| 177 | }; | ||
| 178 | |||
| 179 | @@ -115,15 +140,40 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) | ||
| 180 | |||
| 181 | const AV1RawSequenceHeader *seq = s->raw_seq; | ||
| 182 | |||
| 183 | - StdVideoAV1MESASequenceHeader av1_sequence_header; | ||
| 184 | - VkVideoDecodeAV1SessionParametersAddInfoMESA av1_params_info; | ||
| 185 | - VkVideoDecodeAV1SessionParametersCreateInfoMESA av1_params; | ||
| 186 | + StdVideoAV1SequenceHeader av1_sequence_header; | ||
| 187 | + StdVideoAV1TimingInfo av1_timing_info; | ||
| 188 | + StdVideoAV1ColorConfig av1_color_config; | ||
| 189 | + VkVideoDecodeAV1SessionParametersCreateInfoKHR av1_params; | ||
| 190 | VkVideoSessionParametersCreateInfoKHR session_params_create; | ||
| 191 | |||
| 192 | int err; | ||
| 193 | |||
| 194 | - av1_sequence_header = (StdVideoAV1MESASequenceHeader) { | ||
| 195 | - .flags = (StdVideoAV1MESASequenceHeaderFlags) { | ||
| 196 | + av1_timing_info = (StdVideoAV1TimingInfo) { | ||
| 197 | + .flags = (StdVideoAV1TimingInfoFlags) { | ||
| 198 | + .equal_picture_interval = seq->timing_info.equal_picture_interval, | ||
| 199 | + }, | ||
| 200 | + .num_units_in_display_tick = seq->timing_info.num_units_in_display_tick, | ||
| 201 | + .time_scale = seq->timing_info.time_scale, | ||
| 202 | + .num_ticks_per_picture_minus_1 = seq->timing_info.num_ticks_per_picture_minus_1, | ||
| 203 | + }; | ||
| 204 | + | ||
| 205 | + av1_color_config = (StdVideoAV1ColorConfig) { | ||
| 206 | + .flags = (StdVideoAV1ColorConfigFlags) { | ||
| 207 | + .mono_chrome = seq->color_config.mono_chrome, | ||
| 208 | + .color_range = seq->color_config.color_range, | ||
| 209 | + .separate_uv_delta_q = seq->color_config.separate_uv_delta_q, | ||
| 210 | + }, | ||
| 211 | + .BitDepth = seq->color_config.twelve_bit ? 12 : | ||
| 212 | + seq->color_config.high_bitdepth ? 10 : 8, | ||
| 213 | + .subsampling_x = seq->color_config.subsampling_x, | ||
| 214 | + .subsampling_y = seq->color_config.subsampling_y, | ||
| 215 | + .color_primaries = seq->color_config.color_primaries, | ||
| 216 | + .transfer_characteristics = seq->color_config.transfer_characteristics, | ||
| 217 | + .matrix_coefficients = seq->color_config.matrix_coefficients, | ||
| 218 | + }; | ||
| 219 | + | ||
| 220 | + av1_sequence_header = (StdVideoAV1SequenceHeader) { | ||
| 221 | + .flags = (StdVideoAV1SequenceHeaderFlags) { | ||
| 222 | .still_picture = seq->still_picture, | ||
| 223 | .reduced_still_picture_header = seq->reduced_still_picture_header, | ||
| 224 | .use_128x128_superblock = seq->use_128x128_superblock, | ||
| 225 | @@ -152,34 +202,15 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf) | ||
| 226 | .delta_frame_id_length_minus_2 = seq->delta_frame_id_length_minus_2, | ||
| 227 | .additional_frame_id_length_minus_1 = seq->additional_frame_id_length_minus_1, | ||
| 228 | .order_hint_bits_minus_1 = seq->order_hint_bits_minus_1, | ||
| 229 | - .timing_info = (StdVideoAV1MESATimingInfo) { | ||
| 230 | - .flags = (StdVideoAV1MESATimingInfoFlags) { | ||
| 231 | - .equal_picture_interval = seq->timing_info.equal_picture_interval, | ||
| 232 | - }, | ||
| 233 | - .num_units_in_display_tick = seq->timing_info.num_units_in_display_tick, | ||
| 234 | - .time_scale = seq->timing_info.time_scale, | ||
| 235 | - .num_ticks_per_picture_minus_1 = seq->timing_info.num_ticks_per_picture_minus_1, | ||
| 236 | - }, | ||
| 237 | - .color_config = (StdVideoAV1MESAColorConfig) { | ||
| 238 | - .flags = (StdVideoAV1MESAColorConfigFlags) { | ||
| 239 | - .mono_chrome = seq->color_config.mono_chrome, | ||
| 240 | - .color_range = seq->color_config.color_range, | ||
| 241 | - .separate_uv_delta_q = seq->color_config.separate_uv_delta_q, | ||
| 242 | - }, | ||
| 243 | - .bit_depth = seq->color_config.twelve_bit ? 12 : | ||
| 244 | - seq->color_config.high_bitdepth ? 10 : 8, | ||
| 245 | - .subsampling_x = seq->color_config.subsampling_x, | ||
| 246 | - .subsampling_y = seq->color_config.subsampling_y, | ||
| 247 | - }, | ||
| 248 | + .seq_force_integer_mv = seq->seq_force_integer_mv, | ||
| 249 | + .seq_force_screen_content_tools = seq->seq_force_screen_content_tools, | ||
| 250 | + .pTimingInfo = &av1_timing_info, | ||
| 251 | + .pColorConfig = &av1_color_config, | ||
| 252 | }; | ||
| 253 | |||
| 254 | - av1_params_info = (VkVideoDecodeAV1SessionParametersAddInfoMESA) { | ||
| 255 | - .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_ADD_INFO_MESA, | ||
| 256 | - .sequence_header = &av1_sequence_header, | ||
| 257 | - }; | ||
| 258 | - av1_params = (VkVideoDecodeAV1SessionParametersCreateInfoMESA) { | ||
| 259 | - .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_MESA, | ||
| 260 | - .pParametersAddInfo = &av1_params_info, | ||
| 261 | + av1_params = (VkVideoDecodeAV1SessionParametersCreateInfoKHR) { | ||
| 262 | + .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_KHR, | ||
| 263 | + .pStdSequenceHeader = &av1_sequence_header, | ||
| 264 | }; | ||
| 265 | session_params_create = (VkVideoSessionParametersCreateInfoKHR) { | ||
| 266 | .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR, | ||
| 267 | @@ -211,8 +242,14 @@ static int vk_av1_start_frame(AVCodecContext *avctx, | ||
| 268 | |||
| 269 | const AV1RawFrameHeader *frame_header = s->raw_frame_header; | ||
| 270 | const AV1RawFilmGrainParams *film_grain = &s->cur_frame.film_grain; | ||
| 271 | + CodedBitstreamAV1Context *cbs_ctx = (CodedBitstreamAV1Context *)(s->cbc->priv_data); | ||
| 272 | + | ||
| 273 | const int apply_grain = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN) && | ||
| 274 | film_grain->apply_grain; | ||
| 275 | + StdVideoAV1FrameRestorationType remap_lr_type[4] = { STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_NONE, | ||
| 276 | + STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SWITCHABLE, | ||
| 277 | + STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_WIENER, | ||
| 278 | + STD_VIDEO_AV1_FRAME_RESTORATION_TYPE_SGRPROJ }; | ||
| 279 | |||
| 280 | if (!dec->session_params) { | ||
| 281 | err = vk_av1_create_params(avctx, &dec->session_params); | ||
| 282 | @@ -233,15 +270,31 @@ static int vk_av1_start_frame(AVCodecContext *avctx, | ||
| 283 | dec->frame_id_alloc_mask |= (1 << slot_idx); | ||
| 284 | } | ||
| 285 | |||
| 286 | - /* Fill in references */ | ||
| 287 | - for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) { | ||
| 288 | - const AV1Frame *ref_frame = &s->ref[i]; | ||
| 289 | - if (s->ref[i].f->pict_type == AV_PICTURE_TYPE_NONE) | ||
| 290 | + ap->ref_frame_sign_bias_mask = 0x0; | ||
| 291 | + for (int i = 0; i < STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME; i++) | ||
| 292 | + ap->ref_frame_sign_bias_mask |= cbs_ctx->ref_frame_sign_bias[i] << i; | ||
| 293 | + | ||
| 294 | + for (int i = 0; i < STD_VIDEO_AV1_REFS_PER_FRAME; i++) { | ||
| 295 | + const int idx = pic->raw_frame_header->ref_frame_idx[i]; | ||
| 296 | + const AV1Frame *ref_frame = &s->ref[idx]; | ||
| 297 | + AV1VulkanDecodePicture *hp = ref_frame->hwaccel_picture_private; | ||
| 298 | + int found = 0; | ||
| 299 | + | ||
| 300 | + if (ref_frame->f->pict_type == AV_PICTURE_TYPE_NONE) | ||
| 301 | + continue; | ||
| 302 | + | ||
| 303 | + for (int j = 0; j < ref_count; j++) { | ||
| 304 | + if (vp->ref_slots[j].slotIndex == hp->frame_id) { | ||
| 305 | + found = 1; | ||
| 306 | + break; | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + if (found) | ||
| 310 | continue; | ||
| 311 | |||
| 312 | - err = vk_av1_fill_pict(avctx, &ap->ref_src[i], &vp->ref_slots[i], | ||
| 313 | - &vp->refs[i], &ap->vkav1_refs[i], | ||
| 314 | - ref_frame, 0, 0, i); | ||
| 315 | + err = vk_av1_fill_pict(avctx, &ap->ref_src[ref_count], &vp->ref_slots[ref_count], | ||
| 316 | + &vp->refs[ref_count], &ap->std_refs[ref_count], &ap->vkav1_refs[ref_count], | ||
| 317 | + ref_frame, 0, 0, cbs_ctx->ref[idx].saved_order_hints); | ||
| 318 | if (err < 0) | ||
| 319 | return err; | ||
| 320 | |||
| 321 | @@ -249,20 +302,32 @@ static int vk_av1_start_frame(AVCodecContext *avctx, | ||
| 322 | } | ||
| 323 | |||
| 324 | err = vk_av1_fill_pict(avctx, NULL, &vp->ref_slot, &vp->ref, | ||
| 325 | + &ap->std_ref, | ||
| 326 | &ap->vkav1_ref, | ||
| 327 | - pic, 1, apply_grain, 8); | ||
| 328 | + pic, 1, apply_grain, NULL); | ||
| 329 | if (err < 0) | ||
| 330 | return err; | ||
| 331 | |||
| 332 | - ap->tile_list.nb_tiles = 0; | ||
| 333 | - ap->tile_list.tile_list = ap->tiles; | ||
| 334 | - | ||
| 335 | - ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoMESA) { | ||
| 336 | - .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_MESA, | ||
| 337 | - .frame_header = &ap->av1_frame_header, | ||
| 338 | - .tile_list = &ap->tile_list, | ||
| 339 | + ap->av1_pic_info = (VkVideoDecodeAV1PictureInfoKHR) { | ||
| 340 | + .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_KHR, | ||
| 341 | + .pStdPictureInfo = &ap->std_pic_info, | ||
| 342 | + .frameHeaderOffset = 0, | ||
| 343 | + .tileCount = 0, | ||
| 344 | + .pTileOffsets = NULL, | ||
| 345 | + .pTileSizes = ap->tile_sizes, | ||
| 346 | }; | ||
| 347 | |||
| 348 | + for (int i = 0; i < STD_VIDEO_AV1_REFS_PER_FRAME; i++) { | ||
| 349 | + const int idx = pic->raw_frame_header->ref_frame_idx[i]; | ||
| 350 | + const AV1Frame *ref_frame = &s->ref[idx]; | ||
| 351 | + AV1VulkanDecodePicture *hp = ref_frame->hwaccel_picture_private; | ||
| 352 | + | ||
| 353 | + if (ref_frame->f->pict_type == AV_PICTURE_TYPE_NONE) | ||
| 354 | + ap->av1_pic_info.referenceNameSlotIndices[i] = -1; | ||
| 355 | + else | ||
| 356 | + ap->av1_pic_info.referenceNameSlotIndices[i] = hp->frame_id; | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | vp->decode_info = (VkVideoDecodeInfoKHR) { | ||
| 360 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR, | ||
| 361 | .pNext = &ap->av1_pic_info, | ||
| 362 | @@ -279,9 +344,87 @@ static int vk_av1_start_frame(AVCodecContext *avctx, | ||
| 363 | }, | ||
| 364 | }; | ||
| 365 | |||
| 366 | + ap->tile_info = (StdVideoAV1TileInfo) { | ||
| 367 | + .flags = (StdVideoAV1TileInfoFlags) { | ||
| 368 | + .uniform_tile_spacing_flag = frame_header->uniform_tile_spacing_flag, | ||
| 369 | + }, | ||
| 370 | + .TileCols = frame_header->tile_cols, | ||
| 371 | + .TileRows = frame_header->tile_rows, | ||
| 372 | + .context_update_tile_id = frame_header->context_update_tile_id, | ||
| 373 | + .tile_size_bytes_minus_1 = frame_header->tile_size_bytes_minus1, | ||
| 374 | + .pWidthInSbsMinus1 = ap->width_in_sbs_minus1, | ||
| 375 | + .pHeightInSbsMinus1 = ap->height_in_sbs_minus1, | ||
| 376 | + .pMiColStarts = ap->mi_col_starts, | ||
| 377 | + .pMiRowStarts = ap->mi_row_starts, | ||
| 378 | + }; | ||
| 379 | + | ||
| 380 | + ap->quantization = (StdVideoAV1Quantization) { | ||
| 381 | + .flags.using_qmatrix = frame_header->using_qmatrix, | ||
| 382 | + .flags.diff_uv_delta = frame_header->diff_uv_delta, | ||
| 383 | + .base_q_idx = frame_header->base_q_idx, | ||
| 384 | + .DeltaQYDc = frame_header->delta_q_y_dc, | ||
| 385 | + .DeltaQUDc = frame_header->delta_q_u_dc, | ||
| 386 | + .DeltaQUAc = frame_header->delta_q_u_ac, | ||
| 387 | + .DeltaQVDc = frame_header->delta_q_v_dc, | ||
| 388 | + .DeltaQVAc = frame_header->delta_q_v_ac, | ||
| 389 | + .qm_y = frame_header->qm_y, | ||
| 390 | + .qm_u = frame_header->qm_u, | ||
| 391 | + .qm_v = frame_header->qm_v, | ||
| 392 | + }; | ||
| 393 | + | ||
| 394 | + ap->loop_filter = (StdVideoAV1LoopFilter) { | ||
| 395 | + .flags = (StdVideoAV1LoopFilterFlags) { | ||
| 396 | + .loop_filter_delta_enabled = frame_header->loop_filter_delta_enabled, | ||
| 397 | + .loop_filter_delta_update = frame_header->loop_filter_delta_update, | ||
| 398 | + }, | ||
| 399 | + .loop_filter_sharpness = frame_header->loop_filter_sharpness, | ||
| 400 | + }; | ||
| 401 | + | ||
| 402 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_LOOP_FILTER_STRENGTHS; i++) | ||
| 403 | + ap->loop_filter.loop_filter_level[i] = frame_header->loop_filter_level[i]; | ||
| 404 | + for (int i = 0; i < STD_VIDEO_AV1_LOOP_FILTER_ADJUSTMENTS; i++) | ||
| 405 | + ap->loop_filter.loop_filter_mode_deltas[i] = frame_header->loop_filter_mode_deltas[i]; | ||
| 406 | + | ||
| 407 | + ap->cdef = (StdVideoAV1CDEF) { | ||
| 408 | + .cdef_damping_minus_3 = frame_header->cdef_damping_minus_3, | ||
| 409 | + .cdef_bits = frame_header->cdef_bits, | ||
| 410 | + }; | ||
| 411 | + | ||
| 412 | + ap->loop_restoration = (StdVideoAV1LoopRestoration) { | ||
| 413 | + .FrameRestorationType[0] = remap_lr_type[frame_header->lr_type[0]], | ||
| 414 | + .FrameRestorationType[1] = remap_lr_type[frame_header->lr_type[1]], | ||
| 415 | + .FrameRestorationType[2] = remap_lr_type[frame_header->lr_type[2]], | ||
| 416 | + .LoopRestorationSize[0] = 1 + frame_header->lr_unit_shift, | ||
| 417 | + .LoopRestorationSize[1] = 1 + frame_header->lr_unit_shift - frame_header->lr_uv_shift, | ||
| 418 | + .LoopRestorationSize[2] = 1 + frame_header->lr_unit_shift - frame_header->lr_uv_shift, | ||
| 419 | + }; | ||
| 420 | + | ||
| 421 | + ap->film_grain = (StdVideoAV1FilmGrain) { | ||
| 422 | + .flags = (StdVideoAV1FilmGrainFlags) { | ||
| 423 | + .chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma, | ||
| 424 | + .overlap_flag = film_grain->overlap_flag, | ||
| 425 | + .clip_to_restricted_range = film_grain->clip_to_restricted_range, | ||
| 426 | + }, | ||
| 427 | + .grain_scaling_minus_8 = film_grain->grain_scaling_minus_8, | ||
| 428 | + .ar_coeff_lag = film_grain->ar_coeff_lag, | ||
| 429 | + .ar_coeff_shift_minus_6 = film_grain->ar_coeff_shift_minus_6, | ||
| 430 | + .grain_scale_shift = film_grain->grain_scale_shift, | ||
| 431 | + .grain_seed = film_grain->grain_seed, | ||
| 432 | + .film_grain_params_ref_idx = film_grain->film_grain_params_ref_idx, | ||
| 433 | + .num_y_points = film_grain->num_y_points, | ||
| 434 | + .num_cb_points = film_grain->num_cb_points, | ||
| 435 | + .num_cr_points = film_grain->num_cr_points, | ||
| 436 | + .cb_mult = film_grain->cb_mult, | ||
| 437 | + .cb_luma_mult = film_grain->cb_luma_mult, | ||
| 438 | + .cb_offset = film_grain->cb_offset, | ||
| 439 | + .cr_mult = film_grain->cr_mult, | ||
| 440 | + .cr_luma_mult = film_grain->cr_luma_mult, | ||
| 441 | + .cr_offset = film_grain->cr_offset, | ||
| 442 | + }; | ||
| 443 | + | ||
| 444 | /* Setup frame header */ | ||
| 445 | - ap->av1_frame_header = (StdVideoAV1MESAFrameHeader) { | ||
| 446 | - .flags = (StdVideoAV1MESAFrameHeaderFlags) { | ||
| 447 | + ap->std_pic_info = (StdVideoDecodeAV1PictureInfo) { | ||
| 448 | + .flags = (StdVideoDecodeAV1PictureInfoFlags) { | ||
| 449 | .error_resilient_mode = frame_header->error_resilient_mode, | ||
| 450 | .disable_cdf_update = frame_header->disable_cdf_update, | ||
| 451 | .use_superres = frame_header->use_superres, | ||
| 452 | @@ -302,174 +445,92 @@ static int vk_av1_start_frame(AVCodecContext *avctx, | ||
| 453 | .reference_select = frame_header->reference_select, | ||
| 454 | .skip_mode_present = frame_header->skip_mode_present, | ||
| 455 | .delta_q_present = frame_header->delta_q_present, | ||
| 456 | + .delta_lf_present = frame_header->delta_lf_present, | ||
| 457 | + .delta_lf_multi = frame_header->delta_lf_multi, | ||
| 458 | + .segmentation_enabled = frame_header->segmentation_enabled, | ||
| 459 | + .segmentation_update_map = frame_header->segmentation_update_map, | ||
| 460 | + .segmentation_temporal_update = frame_header->segmentation_temporal_update, | ||
| 461 | + .segmentation_update_data = frame_header->segmentation_update_data, | ||
| 462 | + .UsesLr = frame_header->lr_type[0] || frame_header->lr_type[1] || frame_header->lr_type[2], | ||
| 463 | + .apply_grain = apply_grain, | ||
| 464 | }, | ||
| 465 | - .frame_to_show_map_idx = frame_header->frame_to_show_map_idx, | ||
| 466 | - .frame_presentation_time = frame_header->frame_presentation_time, | ||
| 467 | - .display_frame_id = frame_header->display_frame_id, | ||
| 468 | .frame_type = frame_header->frame_type, | ||
| 469 | .current_frame_id = frame_header->current_frame_id, | ||
| 470 | - .order_hint = frame_header->order_hint, | ||
| 471 | + .OrderHint = frame_header->order_hint, | ||
| 472 | .primary_ref_frame = frame_header->primary_ref_frame, | ||
| 473 | - .frame_width_minus_1 = frame_header->frame_width_minus_1, | ||
| 474 | - .frame_height_minus_1 = frame_header->frame_height_minus_1, | ||
| 475 | - .coded_denom = frame_header->coded_denom, | ||
| 476 | - .render_width_minus_1 = frame_header->render_width_minus_1, | ||
| 477 | - .render_height_minus_1 = frame_header->render_height_minus_1, | ||
| 478 | .refresh_frame_flags = frame_header->refresh_frame_flags, | ||
| 479 | .interpolation_filter = frame_header->interpolation_filter, | ||
| 480 | - .tx_mode = frame_header->tx_mode, | ||
| 481 | - .tiling = (StdVideoAV1MESATileInfo) { | ||
| 482 | - .flags = (StdVideoAV1MESATileInfoFlags) { | ||
| 483 | - .uniform_tile_spacing_flag = frame_header->uniform_tile_spacing_flag, | ||
| 484 | - }, | ||
| 485 | - .tile_cols = frame_header->tile_cols, | ||
| 486 | - .tile_rows = frame_header->tile_rows, | ||
| 487 | - .context_update_tile_id = frame_header->context_update_tile_id, | ||
| 488 | - .tile_size_bytes_minus1 = frame_header->tile_size_bytes_minus1, | ||
| 489 | - }, | ||
| 490 | - .quantization = (StdVideoAV1MESAQuantization) { | ||
| 491 | - .flags.using_qmatrix = frame_header->using_qmatrix, | ||
| 492 | - .base_q_idx = frame_header->base_q_idx, | ||
| 493 | - .delta_q_y_dc = frame_header->delta_q_y_dc, | ||
| 494 | - .diff_uv_delta = frame_header->diff_uv_delta, | ||
| 495 | - .delta_q_u_dc = frame_header->delta_q_u_dc, | ||
| 496 | - .delta_q_u_ac = frame_header->delta_q_u_ac, | ||
| 497 | - .delta_q_v_dc = frame_header->delta_q_v_dc, | ||
| 498 | - .delta_q_v_ac = frame_header->delta_q_v_ac, | ||
| 499 | - .qm_y = frame_header->qm_y, | ||
| 500 | - .qm_u = frame_header->qm_u, | ||
| 501 | - .qm_v = frame_header->qm_v, | ||
| 502 | - }, | ||
| 503 | - .delta_q = (StdVideoAV1MESADeltaQ) { | ||
| 504 | - .flags = (StdVideoAV1MESADeltaQFlags) { | ||
| 505 | - .delta_lf_present = frame_header->delta_lf_present, | ||
| 506 | - .delta_lf_multi = frame_header->delta_lf_multi, | ||
| 507 | - }, | ||
| 508 | - .delta_q_res = frame_header->delta_q_res, | ||
| 509 | - .delta_lf_res = frame_header->delta_lf_res, | ||
| 510 | - }, | ||
| 511 | - .loop_filter = (StdVideoAV1MESALoopFilter) { | ||
| 512 | - .flags = (StdVideoAV1MESALoopFilterFlags) { | ||
| 513 | - .delta_enabled = frame_header->loop_filter_delta_enabled, | ||
| 514 | - .delta_update = frame_header->loop_filter_delta_update, | ||
| 515 | - }, | ||
| 516 | - .level = { | ||
| 517 | - frame_header->loop_filter_level[0], frame_header->loop_filter_level[1], | ||
| 518 | - frame_header->loop_filter_level[2], frame_header->loop_filter_level[3], | ||
| 519 | - }, | ||
| 520 | - .sharpness = frame_header->loop_filter_sharpness, | ||
| 521 | - .mode_deltas = { | ||
| 522 | - frame_header->loop_filter_mode_deltas[0], frame_header->loop_filter_mode_deltas[1], | ||
| 523 | - }, | ||
| 524 | - }, | ||
| 525 | - .cdef = (StdVideoAV1MESACDEF) { | ||
| 526 | - .damping_minus_3 = frame_header->cdef_damping_minus_3, | ||
| 527 | - .bits = frame_header->cdef_bits, | ||
| 528 | - }, | ||
| 529 | - .lr = (StdVideoAV1MESALoopRestoration) { | ||
| 530 | - .lr_unit_shift = frame_header->lr_unit_shift, | ||
| 531 | - .lr_uv_shift = frame_header->lr_uv_shift, | ||
| 532 | - .lr_type = { frame_header->lr_type[0], frame_header->lr_type[1], frame_header->lr_type[2] }, | ||
| 533 | - }, | ||
| 534 | - .segmentation = (StdVideoAV1MESASegmentation) { | ||
| 535 | - .flags = (StdVideoAV1MESASegmentationFlags) { | ||
| 536 | - .enabled = frame_header->segmentation_enabled, | ||
| 537 | - .update_map = frame_header->segmentation_update_map, | ||
| 538 | - .temporal_update = frame_header->segmentation_temporal_update, | ||
| 539 | - .update_data = frame_header->segmentation_update_data, | ||
| 540 | - }, | ||
| 541 | - }, | ||
| 542 | - .film_grain = (StdVideoAV1MESAFilmGrainParameters) { | ||
| 543 | - .flags = (StdVideoAV1MESAFilmGrainFlags) { | ||
| 544 | - .apply_grain = apply_grain, | ||
| 545 | - .chroma_scaling_from_luma = film_grain->chroma_scaling_from_luma, | ||
| 546 | - .overlap_flag = film_grain->overlap_flag, | ||
| 547 | - .clip_to_restricted_range = film_grain->clip_to_restricted_range, | ||
| 548 | - }, | ||
| 549 | - .grain_scaling_minus_8 = film_grain->grain_scaling_minus_8, | ||
| 550 | - .ar_coeff_lag = film_grain->ar_coeff_lag, | ||
| 551 | - .ar_coeff_shift_minus_6 = film_grain->ar_coeff_shift_minus_6, | ||
| 552 | - .grain_scale_shift = film_grain->grain_scale_shift, | ||
| 553 | - .grain_seed = film_grain->grain_seed, | ||
| 554 | - .num_y_points = film_grain->num_y_points, | ||
| 555 | - .num_cb_points = film_grain->num_cb_points, | ||
| 556 | - .num_cr_points = film_grain->num_cr_points, | ||
| 557 | - .cb_mult = film_grain->cb_mult, | ||
| 558 | - .cb_luma_mult = film_grain->cb_luma_mult, | ||
| 559 | - .cb_offset = film_grain->cb_offset, | ||
| 560 | - .cr_mult = film_grain->cr_mult, | ||
| 561 | - .cr_luma_mult = film_grain->cr_luma_mult, | ||
| 562 | - .cr_offset = film_grain->cr_offset, | ||
| 563 | - }, | ||
| 564 | + .TxMode = frame_header->tx_mode, | ||
| 565 | + .delta_q_res = frame_header->delta_q_res, | ||
| 566 | + .delta_lf_res = frame_header->delta_lf_res, | ||
| 567 | + .SkipModeFrame[0] = s->cur_frame.skip_mode_frame_idx[0], | ||
| 568 | + .SkipModeFrame[1] = s->cur_frame.skip_mode_frame_idx[1], | ||
| 569 | + .coded_denom = frame_header->coded_denom, | ||
| 570 | + .pTileInfo = &ap->tile_info, | ||
| 571 | + .pQuantization = &ap->quantization, | ||
| 572 | + .pSegmentation = &ap->segmentation, | ||
| 573 | + .pLoopFilter = &ap->loop_filter, | ||
| 574 | + .pCDEF = &ap->cdef, | ||
| 575 | + .pLoopRestoration = &ap->loop_restoration, | ||
| 576 | + .pGlobalMotion = &ap->global_motion, | ||
| 577 | + .pFilmGrain = apply_grain ? &ap->film_grain : NULL, | ||
| 578 | }; | ||
| 579 | |||
| 580 | for (int i = 0; i < 64; i++) { | ||
| 581 | - ap->av1_frame_header.tiling.width_in_sbs_minus_1[i] = frame_header->width_in_sbs_minus_1[i]; | ||
| 582 | - ap->av1_frame_header.tiling.height_in_sbs_minus_1[i] = frame_header->height_in_sbs_minus_1[i]; | ||
| 583 | - ap->av1_frame_header.tiling.tile_start_col_sb[i] = frame_header->tile_start_col_sb[i]; | ||
| 584 | - ap->av1_frame_header.tiling.tile_start_row_sb[i] = frame_header->tile_start_row_sb[i]; | ||
| 585 | + ap->width_in_sbs_minus1[i] = frame_header->width_in_sbs_minus_1[i]; | ||
| 586 | + ap->height_in_sbs_minus1[i] = frame_header->height_in_sbs_minus_1[i]; | ||
| 587 | + ap->mi_col_starts[i] = frame_header->tile_start_col_sb[i]; | ||
| 588 | + ap->mi_row_starts[i] = frame_header->tile_start_row_sb[i]; | ||
| 589 | } | ||
| 590 | |||
| 591 | - for (int i = 0; i < 8; i++) { | ||
| 592 | - ap->av1_frame_header.segmentation.feature_enabled_bits[i] = 0; | ||
| 593 | - for (int j = 0; j < 8; j++) { | ||
| 594 | - ap->av1_frame_header.segmentation.feature_enabled_bits[i] |= (frame_header->feature_enabled[i][j] << j); | ||
| 595 | - ap->av1_frame_header.segmentation.feature_data[i][j] = frame_header->feature_value[i][j]; | ||
| 596 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_SEGMENTS; i++) { | ||
| 597 | + ap->segmentation.FeatureEnabled[i] = 0x0; | ||
| 598 | + for (int j = 0; j < STD_VIDEO_AV1_SEG_LVL_MAX; j++) { | ||
| 599 | + ap->segmentation.FeatureEnabled[i] |= (frame_header->feature_enabled[i][j] << j); | ||
| 600 | + ap->segmentation.FeatureData[i][j] = frame_header->feature_value[i][j]; | ||
| 601 | } | ||
| 602 | - | ||
| 603 | - ap->av1_frame_header.loop_filter.ref_deltas[i] = frame_header->loop_filter_ref_deltas[i]; | ||
| 604 | - | ||
| 605 | - ap->av1_frame_header.cdef.y_pri_strength[i] = frame_header->cdef_y_pri_strength[i]; | ||
| 606 | - ap->av1_frame_header.cdef.y_sec_strength[i] = frame_header->cdef_y_sec_strength[i]; | ||
| 607 | - ap->av1_frame_header.cdef.uv_pri_strength[i] = frame_header->cdef_uv_pri_strength[i]; | ||
| 608 | - ap->av1_frame_header.cdef.uv_sec_strength[i] = frame_header->cdef_uv_sec_strength[i]; | ||
| 609 | - | ||
| 610 | - ap->av1_frame_header.ref_order_hint[i] = frame_header->ref_order_hint[i]; | ||
| 611 | - ap->av1_frame_header.global_motion[i] = (StdVideoAV1MESAGlobalMotion) { | ||
| 612 | - .flags = (StdVideoAV1MESAGlobalMotionFlags) { | ||
| 613 | - .gm_invalid = s->cur_frame.gm_invalid[i], | ||
| 614 | - }, | ||
| 615 | - .gm_type = s->cur_frame.gm_type[i], | ||
| 616 | - .gm_params = { | ||
| 617 | - s->cur_frame.gm_params[i][0], s->cur_frame.gm_params[i][1], | ||
| 618 | - s->cur_frame.gm_params[i][2], s->cur_frame.gm_params[i][3], | ||
| 619 | - s->cur_frame.gm_params[i][4], s->cur_frame.gm_params[i][5], | ||
| 620 | - }, | ||
| 621 | - }; | ||
| 622 | } | ||
| 623 | |||
| 624 | - for (int i = 0; i < 7; i++) { | ||
| 625 | - ap->av1_frame_header.ref_frame_idx[i] = frame_header->ref_frame_idx[i]; | ||
| 626 | - ap->av1_frame_header.delta_frame_id_minus1[i] = frame_header->delta_frame_id_minus1[i]; | ||
| 627 | + for (int i = 0; i < STD_VIDEO_AV1_TOTAL_REFS_PER_FRAME; i++) | ||
| 628 | + ap->loop_filter.loop_filter_ref_deltas[i] = frame_header->loop_filter_ref_deltas[i]; | ||
| 629 | + | ||
| 630 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_CDEF_FILTER_STRENGTHS; i++) { | ||
| 631 | + ap->cdef.cdef_y_pri_strength[i] = frame_header->cdef_y_pri_strength[i]; | ||
| 632 | + ap->cdef.cdef_y_sec_strength[i] = frame_header->cdef_y_sec_strength[i]; | ||
| 633 | + ap->cdef.cdef_uv_pri_strength[i] = frame_header->cdef_uv_pri_strength[i]; | ||
| 634 | + ap->cdef.cdef_uv_sec_strength[i] = frame_header->cdef_uv_sec_strength[i]; | ||
| 635 | } | ||
| 636 | |||
| 637 | - ap->av1_pic_info.skip_mode_frame_idx[0] = s->cur_frame.skip_mode_frame_idx[0]; | ||
| 638 | - ap->av1_pic_info.skip_mode_frame_idx[1] = s->cur_frame.skip_mode_frame_idx[1]; | ||
| 639 | + for (int i = 0; i < STD_VIDEO_AV1_NUM_REF_FRAMES; i++) { | ||
| 640 | + ap->std_pic_info.OrderHints[i] = frame_header->ref_order_hint[i]; | ||
| 641 | + ap->global_motion.GmType[i] = s->cur_frame.gm_type[i]; | ||
| 642 | + for (int j = 0; j < STD_VIDEO_AV1_GLOBAL_MOTION_PARAMS; j++) { | ||
| 643 | + ap->global_motion.gm_params[i][j] = s->cur_frame.gm_params[i][j]; | ||
| 644 | + } | ||
| 645 | + } | ||
| 646 | |||
| 647 | if (apply_grain) { | ||
| 648 | - for (int i = 0; i < 14; i++) { | ||
| 649 | - ap->av1_frame_header.film_grain.point_y_value[i] = film_grain->point_y_value[i]; | ||
| 650 | - ap->av1_frame_header.film_grain.point_y_scaling[i] = film_grain->point_y_scaling[i]; | ||
| 651 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_NUM_Y_POINTS; i++) { | ||
| 652 | + ap->film_grain.point_y_value[i] = film_grain->point_y_value[i]; | ||
| 653 | + ap->film_grain.point_y_scaling[i] = film_grain->point_y_scaling[i]; | ||
| 654 | } | ||
| 655 | |||
| 656 | - for (int i = 0; i < 10; i++) { | ||
| 657 | - ap->av1_frame_header.film_grain.point_cb_value[i] = film_grain->point_cb_value[i]; | ||
| 658 | - ap->av1_frame_header.film_grain.point_cb_scaling[i] = film_grain->point_cb_scaling[i]; | ||
| 659 | - ap->av1_frame_header.film_grain.point_cr_value[i] = film_grain->point_cr_value[i]; | ||
| 660 | - ap->av1_frame_header.film_grain.point_cr_scaling[i] = film_grain->point_cr_scaling[i]; | ||
| 661 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_NUM_CB_POINTS; i++) { | ||
| 662 | + ap->film_grain.point_cb_value[i] = film_grain->point_cb_value[i]; | ||
| 663 | + ap->film_grain.point_cb_scaling[i] = film_grain->point_cb_scaling[i]; | ||
| 664 | + ap->film_grain.point_cr_value[i] = film_grain->point_cr_value[i]; | ||
| 665 | + ap->film_grain.point_cr_scaling[i] = film_grain->point_cr_scaling[i]; | ||
| 666 | } | ||
| 667 | |||
| 668 | - for (int i = 0; i < 24; i++) { | ||
| 669 | - ap->av1_frame_header.film_grain.ar_coeffs_y_plus_128[i] = film_grain->ar_coeffs_y_plus_128[i]; | ||
| 670 | - ap->av1_frame_header.film_grain.ar_coeffs_cb_plus_128[i] = film_grain->ar_coeffs_cb_plus_128[i]; | ||
| 671 | - ap->av1_frame_header.film_grain.ar_coeffs_cr_plus_128[i] = film_grain->ar_coeffs_cr_plus_128[i]; | ||
| 672 | - } | ||
| 673 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_NUM_POS_LUMA; i++) | ||
| 674 | + ap->film_grain.ar_coeffs_y_plus_128[i] = film_grain->ar_coeffs_y_plus_128[i]; | ||
| 675 | |||
| 676 | - ap->av1_frame_header.film_grain.ar_coeffs_cb_plus_128[24] = film_grain->ar_coeffs_cb_plus_128[24]; | ||
| 677 | - ap->av1_frame_header.film_grain.ar_coeffs_cr_plus_128[24] = film_grain->ar_coeffs_cr_plus_128[24]; | ||
| 678 | + for (int i = 0; i < STD_VIDEO_AV1_MAX_NUM_POS_CHROMA; i++) { | ||
| 679 | + ap->film_grain.ar_coeffs_cb_plus_128[i] = film_grain->ar_coeffs_cb_plus_128[i]; | ||
| 680 | + ap->film_grain.ar_coeffs_cr_plus_128[i] = film_grain->ar_coeffs_cr_plus_128[i]; | ||
| 681 | + } | ||
| 682 | } | ||
| 683 | |||
| 684 | - /* Workaround for a spec issue. */ | ||
| 685 | ap->dec = dec; | ||
| 686 | |||
| 687 | return 0; | ||
| 688 | @@ -484,25 +545,20 @@ static int vk_av1_decode_slice(AVCodecContext *avctx, | ||
| 689 | AV1VulkanDecodePicture *ap = s->cur_frame.hwaccel_picture_private; | ||
| 690 | FFVulkanDecodePicture *vp = &ap->vp; | ||
| 691 | |||
| 692 | + /* Too many tiles, exceeding all defined levels in the AV1 spec */ | ||
| 693 | + if (ap->av1_pic_info.tileCount > MAX_TILES) | ||
| 694 | + return AVERROR(ENOSYS); | ||
| 695 | + | ||
| 696 | for (int i = s->tg_start; i <= s->tg_end; i++) { | ||
| 697 | - ap->tiles[ap->tile_list.nb_tiles] = (StdVideoAV1MESATile) { | ||
| 698 | - .size = s->tile_group_info[i].tile_size, | ||
| 699 | - .offset = s->tile_group_info[i].tile_offset, | ||
| 700 | - .row = s->tile_group_info[i].tile_row, | ||
| 701 | - .column = s->tile_group_info[i].tile_column, | ||
| 702 | - .tg_start = s->tg_start, | ||
| 703 | - .tg_end = s->tg_end, | ||
| 704 | - }; | ||
| 705 | + ap->tile_sizes[ap->av1_pic_info.tileCount] = s->tile_group_info[i].tile_size; | ||
| 706 | |||
| 707 | err = ff_vk_decode_add_slice(avctx, vp, | ||
| 708 | data + s->tile_group_info[i].tile_offset, | ||
| 709 | s->tile_group_info[i].tile_size, 0, | ||
| 710 | - &ap->tile_list.nb_tiles, | ||
| 711 | - &ap->tile_offsets); | ||
| 712 | + &ap->av1_pic_info.tileCount, | ||
| 713 | + &ap->av1_pic_info.pTileOffsets); | ||
| 714 | if (err < 0) | ||
| 715 | return err; | ||
| 716 | - | ||
| 717 | - ap->tiles[ap->tile_list.nb_tiles - 1].offset = ap->tile_offsets[ap->tile_list.nb_tiles - 1]; | ||
| 718 | } | ||
| 719 | |||
| 720 | return 0; | ||
| 721 | @@ -518,7 +574,7 @@ static int vk_av1_end_frame(AVCodecContext *avctx) | ||
| 722 | FFVulkanDecodePicture *rvp[AV1_NUM_REF_FRAMES] = { 0 }; | ||
| 723 | AVFrame *rav[AV1_NUM_REF_FRAMES] = { 0 }; | ||
| 724 | |||
| 725 | - if (!ap->tile_list.nb_tiles) | ||
| 726 | + if (!ap->av1_pic_info.tileCount) | ||
| 727 | return 0; | ||
| 728 | |||
| 729 | if (!dec->session_params) { | ||
| 730 | @@ -536,7 +592,7 @@ static int vk_av1_end_frame(AVCodecContext *avctx) | ||
| 731 | } | ||
| 732 | |||
| 733 | av_log(avctx, AV_LOG_VERBOSE, "Decoding frame, %"SIZE_SPECIFIER" bytes, %i tiles\n", | ||
| 734 | - vp->slices_size, ap->tile_list.nb_tiles); | ||
| 735 | + vp->slices_size, ap->av1_pic_info.tileCount); | ||
| 736 | |||
| 737 | return ff_vk_decode_frame(avctx, pic->f, vp, rav, rvp); | ||
| 738 | } | ||
| 739 | @@ -580,8 +636,6 @@ const FFHWAccel ff_av1_vulkan_hwaccel = { | ||
| 740 | * flexibility, this index cannot be present anywhere. | ||
| 741 | * The current implementation tracks the index for the driver and submits it | ||
| 742 | * as necessary information. Due to needing to modify the decoding context, | ||
| 743 | - * which is not thread-safe, on frame free, threading is disabled. | ||
| 744 | - * In the future, once this is fixed in the spec, the workarounds may be removed | ||
| 745 | - * and threading enabled. */ | ||
| 746 | + * which is not thread-safe, on frame free, threading is disabled. */ | ||
| 747 | .caps_internal = HWACCEL_CAP_ASYNC_SAFE, | ||
| 748 | }; | ||
| 749 | diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c | ||
| 750 | index 91929d165f..4561f26b62 100644 | ||
| 751 | --- a/libavcodec/vulkan_decode.c | ||
| 752 | +++ b/libavcodec/vulkan_decode.c | ||
| 753 | @@ -61,7 +61,7 @@ static const VkVideoProfileInfoKHR *get_video_profile(FFVulkanDecodeShared *ctx, | ||
| 754 | VkStructureType profile_struct_type = | ||
| 755 | codec_id == AV_CODEC_ID_H264 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR : | ||
| 756 | codec_id == AV_CODEC_ID_HEVC ? VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR : | ||
| 757 | - codec_id == AV_CODEC_ID_AV1 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_MESA : | ||
| 758 | + codec_id == AV_CODEC_ID_AV1 ? VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR : | ||
| 759 | 0; | ||
| 760 | |||
| 761 | profile_list = ff_vk_find_struct(ctx->s.hwfc->create_pnext, | ||
| 762 | @@ -674,7 +674,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, | ||
| 763 | const struct FFVkCodecMap *vk_codec, | ||
| 764 | VkVideoDecodeH264CapabilitiesKHR *h264_caps, | ||
| 765 | VkVideoDecodeH265CapabilitiesKHR *h265_caps, | ||
| 766 | - VkVideoDecodeAV1CapabilitiesMESA *av1_caps, | ||
| 767 | + VkVideoDecodeAV1CapabilitiesKHR *av1_caps, | ||
| 768 | VkVideoCapabilitiesKHR *caps, | ||
| 769 | VkVideoDecodeCapabilitiesKHR *dec_caps, | ||
| 770 | int cur_profile) | ||
| 771 | @@ -685,7 +685,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, | ||
| 772 | |||
| 773 | VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->h264_profile; | ||
| 774 | VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->h265_profile; | ||
| 775 | - VkVideoDecodeAV1ProfileInfoMESA *av1_profile = &prof->av1_profile; | ||
| 776 | + VkVideoDecodeAV1ProfileInfoKHR *av1_profile = &prof->av1_profile; | ||
| 777 | |||
| 778 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); | ||
| 779 | if (!desc) | ||
| 780 | @@ -713,8 +713,9 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, | ||
| 781 | } else if (avctx->codec_id == AV_CODEC_ID_AV1) { | ||
| 782 | dec_caps->pNext = av1_caps; | ||
| 783 | usage->pNext = av1_profile; | ||
| 784 | - av1_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_MESA; | ||
| 785 | - av1_profile->stdProfileIdc = cur_profile; | ||
| 786 | + av1_profile->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_KHR; | ||
| 787 | + av1_profile->stdProfile = cur_profile; | ||
| 788 | + av1_profile->filmGrainSupport = !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN); | ||
| 789 | } | ||
| 790 | |||
| 791 | usage->sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR; | ||
| 792 | @@ -769,8 +770,8 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ | ||
| 793 | VkVideoDecodeH265CapabilitiesKHR h265_caps = { | ||
| 794 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR, | ||
| 795 | }; | ||
| 796 | - VkVideoDecodeAV1CapabilitiesMESA av1_caps = { | ||
| 797 | - .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_MESA, | ||
| 798 | + VkVideoDecodeAV1CapabilitiesKHR av1_caps = { | ||
| 799 | + .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_KHR, | ||
| 800 | }; | ||
| 801 | |||
| 802 | VkPhysicalDeviceVideoFormatInfoKHR fmt_info = { | ||
| 803 | @@ -789,7 +790,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ | ||
| 804 | cur_profile = avctx->profile; | ||
| 805 | base_profile = avctx->codec_id == AV_CODEC_ID_H264 ? AV_PROFILE_H264_CONSTRAINED_BASELINE : | ||
| 806 | avctx->codec_id == AV_CODEC_ID_H265 ? AV_PROFILE_HEVC_MAIN : | ||
| 807 | - avctx->codec_id == AV_CODEC_ID_AV1 ? STD_VIDEO_AV1_MESA_PROFILE_MAIN : | ||
| 808 | + avctx->codec_id == AV_CODEC_ID_AV1 ? STD_VIDEO_AV1_PROFILE_MAIN : | ||
| 809 | 0; | ||
| 810 | |||
| 811 | ret = vulkan_setup_profile(avctx, prof, hwctx, vk, vk_codec, | ||
| 812 | @@ -837,7 +838,7 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ | ||
| 813 | |||
| 814 | max_level = avctx->codec_id == AV_CODEC_ID_H264 ? ff_vk_h264_level_to_av(h264_caps.maxLevelIdc) : | ||
| 815 | avctx->codec_id == AV_CODEC_ID_H265 ? ff_vk_h265_level_to_av(h265_caps.maxLevelIdc) : | ||
| 816 | - avctx->codec_id == AV_CODEC_ID_AV1 ? av1_caps.maxLevelIdc : | ||
| 817 | + avctx->codec_id == AV_CODEC_ID_AV1 ? av1_caps.maxLevel : | ||
| 818 | 0; | ||
| 819 | |||
| 820 | av_log(avctx, AV_LOG_VERBOSE, "Decoder capabilities for %s profile \"%s\":\n", | ||
| 821 | @@ -908,17 +909,11 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ | ||
| 822 | "VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR set " | ||
| 823 | "but VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR is unset!\n"); | ||
| 824 | return AVERROR_EXTERNAL; | ||
| 825 | - } else if (!(dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR) && | ||
| 826 | - avctx->codec_id == AV_CODEC_ID_AV1) { | ||
| 827 | - av_log(avctx, AV_LOG_ERROR, "Cannot initialize Vulkan decoding session, buggy driver: " | ||
| 828 | - "codec is AV1, but VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR isn't set!\n"); | ||
| 829 | - return AVERROR_EXTERNAL; | ||
| 830 | } | ||
| 831 | |||
| 832 | /* TODO: make dedicated_dpb tunable */ | ||
| 833 | dec->dedicated_dpb = !(dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR); | ||
| 834 | dec->layered_dpb = !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR); | ||
| 835 | - dec->external_fg = av1_caps.flags & VK_VIDEO_DECODE_AV1_CAPABILITY_EXTERNAL_FILM_GRAIN_MESA; | ||
| 836 | |||
| 837 | if (dec->dedicated_dpb) { | ||
| 838 | fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR; | ||
| 839 | @@ -1126,8 +1121,10 @@ int ff_vk_decode_init(AVCodecContext *avctx) | ||
| 840 | VkVideoDecodeH265SessionParametersCreateInfoKHR h265_params = { | ||
| 841 | .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR, | ||
| 842 | }; | ||
| 843 | - VkVideoDecodeAV1SessionParametersCreateInfoMESA av1_params = { | ||
| 844 | - .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_MESA, | ||
| 845 | + StdVideoAV1SequenceHeader av1_empty_seq = { 0 }; | ||
| 846 | + VkVideoDecodeAV1SessionParametersCreateInfoKHR av1_params = { | ||
| 847 | + .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_KHR, | ||
| 848 | + .pStdSequenceHeader = &av1_empty_seq, | ||
| 849 | }; | ||
| 850 | VkVideoSessionParametersCreateInfoKHR session_params_create = { | ||
| 851 | .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR, | ||
| 852 | diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h | ||
| 853 | index a43e328d73..7ba8b239cb 100644 | ||
| 854 | --- a/libavcodec/vulkan_decode.h | ||
| 855 | +++ b/libavcodec/vulkan_decode.h | ||
| 856 | @@ -37,7 +37,7 @@ typedef struct FFVulkanDecodeDescriptor { | ||
| 857 | typedef struct FFVulkanDecodeProfileData { | ||
| 858 | VkVideoDecodeH264ProfileInfoKHR h264_profile; | ||
| 859 | VkVideoDecodeH265ProfileInfoKHR h265_profile; | ||
| 860 | - VkVideoDecodeAV1ProfileInfoMESA av1_profile; | ||
| 861 | + VkVideoDecodeAV1ProfileInfoKHR av1_profile; | ||
| 862 | VkVideoDecodeUsageInfoKHR usage; | ||
| 863 | VkVideoProfileInfoKHR profile; | ||
| 864 | VkVideoProfileListInfoKHR profile_list; | ||
| 865 | diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h | ||
| 866 | index bb69e920bb..01a1de7d9d 100644 | ||
| 867 | --- a/libavcodec/vulkan_video.h | ||
| 868 | +++ b/libavcodec/vulkan_video.h | ||
| 869 | @@ -22,8 +22,6 @@ | ||
| 870 | #include "vulkan.h" | ||
| 871 | |||
| 872 | #include <vk_video/vulkan_video_codecs_common.h> | ||
| 873 | -#include "vulkan_video_codec_av1std.h" | ||
| 874 | -#include "vulkan_video_codec_av1std_decode.h" | ||
| 875 | |||
| 876 | #define CODEC_VER_MAJ(ver) (ver >> 22) | ||
| 877 | #define CODEC_VER_MIN(ver) ((ver >> 12) & ((1 << 10) - 1)) | ||
| 878 | diff --git a/libavcodec/vulkan_video_codec_av1std_decode.h b/libavcodec/vulkan_video_codec_av1std_decode.h | ||
| 879 | deleted file mode 100644 | ||
| 880 | index e2f37b4e6e..0000000000 | ||
| 881 | --- a/libavcodec/vulkan_video_codec_av1std_decode.h | ||
| 882 | +++ /dev/null | ||
| 883 | @@ -1,36 +0,0 @@ | ||
| 884 | -/* Copyright 2023 Lynne | ||
| 885 | - * Copyright 2023 Dave Airlie | ||
| 886 | - * | ||
| 887 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 888 | - * you may not use this file except in compliance with the License. | ||
| 889 | - * You may obtain a copy of the License at | ||
| 890 | - * | ||
| 891 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 892 | - * | ||
| 893 | - * Unless required by applicable law or agreed to in writing, software | ||
| 894 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 895 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 896 | - * See the License for the specific language governing permissions and | ||
| 897 | - * limitations under the License. | ||
| 898 | - */ | ||
| 899 | - | ||
| 900 | -#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ | ||
| 901 | -#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1 | ||
| 902 | - | ||
| 903 | -/* | ||
| 904 | -** This header is NOT YET generated from the Khronos Vulkan XML API Registry. | ||
| 905 | -** | ||
| 906 | -*/ | ||
| 907 | - | ||
| 908 | -#ifdef __cplusplus | ||
| 909 | -extern "C" { | ||
| 910 | -#endif | ||
| 911 | -#define vulkan_video_codec_av1std_decode 1 | ||
| 912 | - | ||
| 913 | - | ||
| 914 | - | ||
| 915 | -#ifdef __cplusplus | ||
| 916 | -} | ||
| 917 | -#endif | ||
| 918 | - | ||
| 919 | -#endif | ||
| 920 | diff --git a/libavcodec/vulkan_video_codec_av1std.h b/libavcodec/vulkan_video_codec_av1std.h | ||
| 921 | deleted file mode 100644 | ||
| 922 | index c91589eee2..0000000000 | ||
| 923 | --- a/libavcodec/vulkan_video_codec_av1std.h | ||
| 924 | +++ /dev/null | ||
| 925 | @@ -1,403 +0,0 @@ | ||
| 926 | -/* Copyright 2023 Lynne | ||
| 927 | - * Copyright 2023 Dave Airlie | ||
| 928 | - * | ||
| 929 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 930 | - * you may not use this file except in compliance with the License. | ||
| 931 | - * You may obtain a copy of the License at | ||
| 932 | - * | ||
| 933 | - * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 934 | - * | ||
| 935 | - * Unless required by applicable law or agreed to in writing, software | ||
| 936 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 937 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 938 | - * See the License for the specific language governing permissions and | ||
| 939 | - * limitations under the License. | ||
| 940 | - */ | ||
| 941 | - | ||
| 942 | -#ifndef VULKAN_VIDEO_CODEC_AV1STD_H_ | ||
| 943 | -#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1 | ||
| 944 | - | ||
| 945 | -/* | ||
| 946 | -** This header is NOT YET generated from the Khronos Vulkan XML API Registry. | ||
| 947 | -** | ||
| 948 | -*/ | ||
| 949 | - | ||
| 950 | -#ifdef __cplusplus | ||
| 951 | -extern "C" { | ||
| 952 | -#endif | ||
| 953 | -#define vulkan_video_codec_av1std 1 | ||
| 954 | - | ||
| 955 | -#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ | ||
| 956 | - ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) | ||
| 957 | -#define VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_API_VERSION_0_1_0 VK_MAKE_VIDEO_STD_VERSION(0, 1, 0) | ||
| 958 | -#define VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_API_VERSION_0_1_0 | ||
| 959 | -#define VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_av1_decode" | ||
| 960 | - | ||
| 961 | -typedef enum StdVideoAV1MESAProfile { | ||
| 962 | - STD_VIDEO_AV1_MESA_PROFILE_MAIN = 0, | ||
| 963 | - STD_VIDEO_AV1_MESA_PROFILE_HIGH = 1, | ||
| 964 | - STD_VIDEO_AV1_MESA_PROFILE_PROFESSIONAL = 2, | ||
| 965 | -} StdVideoAV1MESAProfile; | ||
| 966 | - | ||
| 967 | -typedef enum StdVideoAV1MESALevel { | ||
| 968 | - STD_VIDEO_AV1_MESA_LEVEL_2_0 = 0, | ||
| 969 | - STD_VIDEO_AV1_MESA_LEVEL_2_1 = 1, | ||
| 970 | - STD_VIDEO_AV1_MESA_LEVEL_2_2 = 2, | ||
| 971 | - STD_VIDEO_AV1_MESA_LEVEL_2_3 = 3, | ||
| 972 | - STD_VIDEO_AV1_MESA_LEVEL_3_0 = 4, | ||
| 973 | - STD_VIDEO_AV1_MESA_LEVEL_3_1 = 5, | ||
| 974 | - STD_VIDEO_AV1_MESA_LEVEL_3_2 = 6, | ||
| 975 | - STD_VIDEO_AV1_MESA_LEVEL_3_3 = 7, | ||
| 976 | - STD_VIDEO_AV1_MESA_LEVEL_4_0 = 8, | ||
| 977 | - STD_VIDEO_AV1_MESA_LEVEL_4_1 = 9, | ||
| 978 | - STD_VIDEO_AV1_MESA_LEVEL_4_2 = 10, | ||
| 979 | - STD_VIDEO_AV1_MESA_LEVEL_4_3 = 11, | ||
| 980 | - STD_VIDEO_AV1_MESA_LEVEL_5_0 = 12, | ||
| 981 | - STD_VIDEO_AV1_MESA_LEVEL_5_1 = 13, | ||
| 982 | - STD_VIDEO_AV1_MESA_LEVEL_5_2 = 14, | ||
| 983 | - STD_VIDEO_AV1_MESA_LEVEL_5_3 = 15, | ||
| 984 | - STD_VIDEO_AV1_MESA_LEVEL_6_0 = 16, | ||
| 985 | - STD_VIDEO_AV1_MESA_LEVEL_6_1 = 17, | ||
| 986 | - STD_VIDEO_AV1_MESA_LEVEL_6_2 = 18, | ||
| 987 | - STD_VIDEO_AV1_MESA_LEVEL_6_3 = 19, | ||
| 988 | - STD_VIDEO_AV1_MESA_LEVEL_7_0 = 20, | ||
| 989 | - STD_VIDEO_AV1_MESA_LEVEL_7_1 = 21, | ||
| 990 | - STD_VIDEO_AV1_MESA_LEVEL_7_2 = 22, | ||
| 991 | - STD_VIDEO_AV1_MESA_LEVEL_7_3 = 23, | ||
| 992 | - STD_VIDEO_AV1_MESA_LEVEL_MAX = 31, | ||
| 993 | -} StdVideoAV1MESALevel; | ||
| 994 | - | ||
| 995 | -typedef struct StdVideoAV1MESAFilmGrainFlags { | ||
| 996 | - uint8_t apply_grain; | ||
| 997 | - uint8_t chroma_scaling_from_luma; | ||
| 998 | - uint8_t overlap_flag; | ||
| 999 | - uint8_t clip_to_restricted_range; | ||
| 1000 | -} StdVideoAV1MESAFilmGrainFlags; | ||
| 1001 | - | ||
| 1002 | -typedef struct StdVideoAV1MESAFilmGrainParameters { | ||
| 1003 | - StdVideoAV1MESAFilmGrainFlags flags; | ||
| 1004 | - uint32_t grain_scaling_minus_8; | ||
| 1005 | - uint32_t ar_coeff_lag; | ||
| 1006 | - uint32_t ar_coeff_shift_minus_6; | ||
| 1007 | - uint32_t grain_scale_shift; | ||
| 1008 | - | ||
| 1009 | - uint16_t grain_seed; | ||
| 1010 | - uint8_t num_y_points; | ||
| 1011 | - uint8_t point_y_value[14]; | ||
| 1012 | - uint8_t point_y_scaling[14]; | ||
| 1013 | - | ||
| 1014 | - uint8_t num_cb_points; | ||
| 1015 | - uint8_t point_cb_value[10]; | ||
| 1016 | - uint8_t point_cb_scaling[10]; | ||
| 1017 | - | ||
| 1018 | - uint8_t num_cr_points; | ||
| 1019 | - uint8_t point_cr_value[10]; | ||
| 1020 | - uint8_t point_cr_scaling[10]; | ||
| 1021 | - | ||
| 1022 | - int8_t ar_coeffs_y_plus_128[24]; | ||
| 1023 | - int8_t ar_coeffs_cb_plus_128[25]; | ||
| 1024 | - int8_t ar_coeffs_cr_plus_128[25]; | ||
| 1025 | - uint8_t cb_mult; | ||
| 1026 | - uint8_t cb_luma_mult; | ||
| 1027 | - uint16_t cb_offset; | ||
| 1028 | - uint8_t cr_mult; | ||
| 1029 | - uint8_t cr_luma_mult; | ||
| 1030 | - uint16_t cr_offset; | ||
| 1031 | -} StdVideoAV1MESAFilmGrainParameters; | ||
| 1032 | - | ||
| 1033 | -typedef struct StdVideoAV1MESAGlobalMotionFlags { | ||
| 1034 | - uint8_t gm_invalid; | ||
| 1035 | -} StdVideoAV1MESAGlobalMotionFlags; | ||
| 1036 | - | ||
| 1037 | -typedef struct StdVideoAV1MESAGlobalMotion { | ||
| 1038 | - StdVideoAV1MESAGlobalMotionFlags flags; | ||
| 1039 | - uint8_t gm_type; | ||
| 1040 | - uint32_t gm_params[6]; | ||
| 1041 | -} StdVideoAV1MESAGlobalMotion; | ||
| 1042 | - | ||
| 1043 | -typedef struct StdVideoAV1MESALoopRestoration { | ||
| 1044 | - uint8_t lr_type[3]; | ||
| 1045 | - uint8_t lr_unit_shift; | ||
| 1046 | - uint8_t lr_uv_shift; | ||
| 1047 | -} StdVideoAV1MESALoopRestoration; | ||
| 1048 | - | ||
| 1049 | -typedef struct StdVideoAV1MESATileInfoFlags { | ||
| 1050 | - uint8_t uniform_tile_spacing_flag; | ||
| 1051 | -} StdVideoAV1MESATileInfoFlags; | ||
| 1052 | - | ||
| 1053 | -typedef struct StdVideoAV1MESATileInfo { | ||
| 1054 | - StdVideoAV1MESATileInfoFlags flags; | ||
| 1055 | - uint8_t tile_cols; | ||
| 1056 | - uint8_t tile_rows; | ||
| 1057 | - uint8_t tile_start_col_sb[64]; | ||
| 1058 | - uint8_t tile_start_row_sb[64]; | ||
| 1059 | - uint8_t width_in_sbs_minus_1[64]; | ||
| 1060 | - uint8_t height_in_sbs_minus_1[64]; | ||
| 1061 | - uint16_t context_update_tile_id; | ||
| 1062 | - uint8_t tile_size_bytes_minus1; | ||
| 1063 | -} StdVideoAV1MESATileInfo; | ||
| 1064 | - | ||
| 1065 | -typedef struct StdVideoAV1MESAQuantizationFlags { | ||
| 1066 | - uint8_t using_qmatrix; | ||
| 1067 | -} StdVideoAV1MESAQuantizationFlags; | ||
| 1068 | - | ||
| 1069 | -typedef struct StdVideoAV1MESAQuantization { | ||
| 1070 | - StdVideoAV1MESAQuantizationFlags flags; | ||
| 1071 | - uint8_t base_q_idx; | ||
| 1072 | - int8_t delta_q_y_dc; | ||
| 1073 | - uint8_t diff_uv_delta; | ||
| 1074 | - int8_t delta_q_u_dc; | ||
| 1075 | - int8_t delta_q_u_ac; | ||
| 1076 | - int8_t delta_q_v_dc; | ||
| 1077 | - int8_t delta_q_v_ac; | ||
| 1078 | - uint8_t qm_y; | ||
| 1079 | - uint8_t qm_u; | ||
| 1080 | - uint8_t qm_v; | ||
| 1081 | -} StdVideoAV1MESAQuantization; | ||
| 1082 | - | ||
| 1083 | -typedef struct StdVideoAV1MESACDEF { | ||
| 1084 | - uint8_t damping_minus_3; | ||
| 1085 | - uint8_t bits; | ||
| 1086 | - uint8_t y_pri_strength[8]; | ||
| 1087 | - uint8_t y_sec_strength[8]; | ||
| 1088 | - uint8_t uv_pri_strength[8]; | ||
| 1089 | - uint8_t uv_sec_strength[8]; | ||
| 1090 | -} StdVideoAV1MESACDEF; | ||
| 1091 | - | ||
| 1092 | -typedef struct StdVideoAV1MESADeltaQFlags { | ||
| 1093 | - uint8_t delta_lf_present; | ||
| 1094 | - uint8_t delta_lf_multi; | ||
| 1095 | -} StdVideoAV1MESADeltaQFlags; | ||
| 1096 | - | ||
| 1097 | -typedef struct StdVideoAV1MESADeltaQ { | ||
| 1098 | - StdVideoAV1MESADeltaQFlags flags; | ||
| 1099 | - uint8_t delta_q_res; | ||
| 1100 | - uint8_t delta_lf_res; | ||
| 1101 | -} StdVideoAV1MESADeltaQ; | ||
| 1102 | - | ||
| 1103 | -typedef struct StdVideoAV1MESASegmentationFlags { | ||
| 1104 | - uint8_t enabled; | ||
| 1105 | - uint8_t update_map; | ||
| 1106 | - uint8_t temporal_update; | ||
| 1107 | - uint8_t update_data; | ||
| 1108 | -} StdVideoAV1MESASegmentationFlags; | ||
| 1109 | - | ||
| 1110 | -typedef struct StdVideoAV1MESASegmentation { | ||
| 1111 | - StdVideoAV1MESASegmentationFlags flags; | ||
| 1112 | - uint8_t feature_enabled_bits[8]; | ||
| 1113 | - int16_t feature_data[8][8]; | ||
| 1114 | -} StdVideoAV1MESASegmentation; | ||
| 1115 | - | ||
| 1116 | -typedef struct StdVideoAV1MESALoopFilterFlags { | ||
| 1117 | - uint8_t delta_enabled; | ||
| 1118 | - uint8_t delta_update; | ||
| 1119 | -} StdVideoAV1MESALoopFilterFlags; | ||
| 1120 | - | ||
| 1121 | -typedef struct StdVideoAV1MESALoopFilter { | ||
| 1122 | - StdVideoAV1MESALoopFilterFlags flags; | ||
| 1123 | - uint8_t level[4]; | ||
| 1124 | - uint8_t sharpness; | ||
| 1125 | - int8_t ref_deltas[8]; | ||
| 1126 | - int8_t mode_deltas[2]; | ||
| 1127 | -} StdVideoAV1MESALoopFilter; | ||
| 1128 | - | ||
| 1129 | -typedef struct StdVideoAV1MESAFrameHeaderFlags { | ||
| 1130 | - uint8_t error_resilient_mode; | ||
| 1131 | - uint8_t disable_cdf_update; | ||
| 1132 | - uint8_t use_superres; | ||
| 1133 | - uint8_t render_and_frame_size_different; | ||
| 1134 | - uint8_t allow_screen_content_tools; | ||
| 1135 | - uint8_t is_filter_switchable; | ||
| 1136 | - uint8_t force_integer_mv; | ||
| 1137 | - uint8_t frame_size_override_flag; | ||
| 1138 | - uint8_t buffer_removal_time_present_flag; | ||
| 1139 | - uint8_t allow_intrabc; | ||
| 1140 | - uint8_t frame_refs_short_signaling; | ||
| 1141 | - uint8_t allow_high_precision_mv; | ||
| 1142 | - uint8_t is_motion_mode_switchable; | ||
| 1143 | - uint8_t use_ref_frame_mvs; | ||
| 1144 | - uint8_t disable_frame_end_update_cdf; | ||
| 1145 | - uint8_t allow_warped_motion; | ||
| 1146 | - uint8_t reduced_tx_set; | ||
| 1147 | - uint8_t reference_select; | ||
| 1148 | - uint8_t skip_mode_present; | ||
| 1149 | - uint8_t delta_q_present; | ||
| 1150 | - uint8_t UsesLr; | ||
| 1151 | -} StdVideoAV1MESAFrameHeaderFlags; | ||
| 1152 | - | ||
| 1153 | -typedef struct StdVideoAV1MESAFrameHeader { | ||
| 1154 | - StdVideoAV1MESAFrameHeaderFlags flags; | ||
| 1155 | - | ||
| 1156 | - uint32_t frame_presentation_time; | ||
| 1157 | - uint32_t display_frame_id; | ||
| 1158 | - uint32_t current_frame_id; | ||
| 1159 | - uint8_t frame_to_show_map_idx; | ||
| 1160 | - uint8_t frame_type; | ||
| 1161 | - uint8_t order_hint; | ||
| 1162 | - uint8_t primary_ref_frame; | ||
| 1163 | - uint16_t frame_width_minus_1; | ||
| 1164 | - uint16_t frame_height_minus_1; | ||
| 1165 | - uint16_t render_width_minus_1; | ||
| 1166 | - uint16_t render_height_minus_1; | ||
| 1167 | - uint8_t coded_denom; | ||
| 1168 | - | ||
| 1169 | - uint8_t refresh_frame_flags; | ||
| 1170 | - uint8_t ref_order_hint[8]; | ||
| 1171 | - int8_t ref_frame_idx[7]; | ||
| 1172 | - uint32_t delta_frame_id_minus1[7]; | ||
| 1173 | - | ||
| 1174 | - uint8_t interpolation_filter; | ||
| 1175 | - uint8_t tx_mode; | ||
| 1176 | - | ||
| 1177 | - StdVideoAV1MESATileInfo tiling; | ||
| 1178 | - StdVideoAV1MESAQuantization quantization; | ||
| 1179 | - StdVideoAV1MESASegmentation segmentation; | ||
| 1180 | - StdVideoAV1MESADeltaQ delta_q; | ||
| 1181 | - StdVideoAV1MESALoopFilter loop_filter; | ||
| 1182 | - StdVideoAV1MESACDEF cdef; | ||
| 1183 | - StdVideoAV1MESALoopRestoration lr; | ||
| 1184 | - StdVideoAV1MESAGlobalMotion global_motion[8]; // One per ref frame | ||
| 1185 | - StdVideoAV1MESAFilmGrainParameters film_grain; | ||
| 1186 | -} StdVideoAV1MESAFrameHeader; | ||
| 1187 | - | ||
| 1188 | -typedef struct StdVideoAV1MESAScreenCoding { | ||
| 1189 | - uint8_t seq_force_screen_content_tools; | ||
| 1190 | -} StdVideoAV1MESAScreenCoding; | ||
| 1191 | - | ||
| 1192 | -typedef struct StdVideoAV1MESATimingInfoFlags { | ||
| 1193 | - uint8_t equal_picture_interval; | ||
| 1194 | -} StdVideoAV1MESATimingInfoFlags; | ||
| 1195 | - | ||
| 1196 | -typedef struct StdVideoAV1MESATimingInfo { | ||
| 1197 | - StdVideoAV1MESATimingInfoFlags flags; | ||
| 1198 | - uint32_t num_units_in_display_tick; | ||
| 1199 | - uint32_t time_scale; | ||
| 1200 | - uint32_t num_ticks_per_picture_minus_1; | ||
| 1201 | -} StdVideoAV1MESATimingInfo; | ||
| 1202 | - | ||
| 1203 | -typedef struct StdVideoAV1MESAColorConfigFlags { | ||
| 1204 | - uint8_t mono_chrome; | ||
| 1205 | - uint8_t color_range; | ||
| 1206 | - uint8_t separate_uv_delta_q; | ||
| 1207 | -} StdVideoAV1MESAColorConfigFlags; | ||
| 1208 | - | ||
| 1209 | -typedef struct StdVideoAV1MESAColorConfig { | ||
| 1210 | - StdVideoAV1MESAColorConfigFlags flags; | ||
| 1211 | - uint8_t bit_depth; | ||
| 1212 | - uint8_t subsampling_x; | ||
| 1213 | - uint8_t subsampling_y; | ||
| 1214 | -} StdVideoAV1MESAColorConfig; | ||
| 1215 | - | ||
| 1216 | -typedef struct StdVideoAV1MESASequenceHeaderFlags { | ||
| 1217 | - uint8_t still_picture; | ||
| 1218 | - uint8_t reduced_still_picture_header; | ||
| 1219 | - uint8_t use_128x128_superblock; | ||
| 1220 | - uint8_t enable_filter_intra; | ||
| 1221 | - uint8_t enable_intra_edge_filter; | ||
| 1222 | - uint8_t enable_interintra_compound; | ||
| 1223 | - uint8_t enable_masked_compound; | ||
| 1224 | - uint8_t enable_warped_motion; | ||
| 1225 | - uint8_t enable_dual_filter; | ||
| 1226 | - uint8_t enable_order_hint; | ||
| 1227 | - uint8_t enable_jnt_comp; | ||
| 1228 | - uint8_t enable_ref_frame_mvs; | ||
| 1229 | - uint8_t frame_id_numbers_present_flag; | ||
| 1230 | - uint8_t enable_superres; | ||
| 1231 | - uint8_t enable_cdef; | ||
| 1232 | - uint8_t enable_restoration; | ||
| 1233 | - uint8_t film_grain_params_present; | ||
| 1234 | - uint8_t timing_info_present_flag; | ||
| 1235 | - uint8_t initial_display_delay_present_flag; | ||
| 1236 | -} StdVideoAV1MESASequenceHeaderFlags; | ||
| 1237 | - | ||
| 1238 | -typedef struct StdVideoAV1MESASequenceHeader { | ||
| 1239 | - StdVideoAV1MESASequenceHeaderFlags flags; | ||
| 1240 | - | ||
| 1241 | - StdVideoAV1MESAProfile seq_profile; | ||
| 1242 | - uint8_t frame_width_bits_minus_1; | ||
| 1243 | - uint8_t frame_height_bits_minus_1; | ||
| 1244 | - uint16_t max_frame_width_minus_1; | ||
| 1245 | - uint16_t max_frame_height_minus_1; | ||
| 1246 | - uint8_t delta_frame_id_length_minus_2; | ||
| 1247 | - uint8_t additional_frame_id_length_minus_1; | ||
| 1248 | - uint8_t order_hint_bits_minus_1; | ||
| 1249 | - uint8_t seq_choose_integer_mv; | ||
| 1250 | - uint8_t seq_force_integer_mv; | ||
| 1251 | - | ||
| 1252 | - StdVideoAV1MESATimingInfo timing_info; | ||
| 1253 | - StdVideoAV1MESAColorConfig color_config; | ||
| 1254 | -} StdVideoAV1MESASequenceHeader; | ||
| 1255 | - | ||
| 1256 | -typedef struct StdVideoAV1MESATile { | ||
| 1257 | - uint16_t tg_start; | ||
| 1258 | - uint16_t tg_end; | ||
| 1259 | - uint16_t row; | ||
| 1260 | - uint16_t column; | ||
| 1261 | - uint32_t size; | ||
| 1262 | - uint32_t offset; | ||
| 1263 | -} StdVideoAV1MESATile; | ||
| 1264 | - | ||
| 1265 | -typedef struct StdVideoAV1MESATileList { | ||
| 1266 | - StdVideoAV1MESATile *tile_list; | ||
| 1267 | - uint32_t nb_tiles; | ||
| 1268 | -} StdVideoAV1MESATileList; | ||
| 1269 | - | ||
| 1270 | -typedef struct VkVideoDecodeAV1PictureInfoMESA { | ||
| 1271 | - VkStructureType sType; | ||
| 1272 | - const void *pNext; | ||
| 1273 | - StdVideoAV1MESAFrameHeader *frame_header; | ||
| 1274 | - StdVideoAV1MESATileList *tile_list; | ||
| 1275 | - uint8_t skip_mode_frame_idx[2]; | ||
| 1276 | -} VkVideoDecodeAV1PictureInfoMESA; | ||
| 1277 | - | ||
| 1278 | -typedef struct VkVideoDecodeAV1DpbSlotInfoMESA { | ||
| 1279 | - VkStructureType sType; | ||
| 1280 | - const void *pNext; | ||
| 1281 | - uint8_t frameIdx; | ||
| 1282 | - uint8_t ref_order_hint[7]; | ||
| 1283 | - uint8_t disable_frame_end_update_cdf; | ||
| 1284 | -} VkVideoDecodeAV1DpbSlotInfoMESA; | ||
| 1285 | - | ||
| 1286 | -typedef struct VkVideoDecodeAV1SessionParametersAddInfoMESA { | ||
| 1287 | - VkStructureType sType; | ||
| 1288 | - const void *pNext; | ||
| 1289 | - StdVideoAV1MESASequenceHeader *sequence_header; | ||
| 1290 | -} VkVideoDecodeAV1SessionParametersAddInfoMESA; | ||
| 1291 | - | ||
| 1292 | -typedef struct VkVideoDecodeAV1SessionParametersCreateInfoMESA { | ||
| 1293 | - VkStructureType sType; | ||
| 1294 | - const void *pNext; | ||
| 1295 | - const VkVideoDecodeAV1SessionParametersAddInfoMESA *pParametersAddInfo; | ||
| 1296 | -} VkVideoDecodeAV1SessionParametersCreateInfoMESA; | ||
| 1297 | - | ||
| 1298 | -typedef struct VkVideoDecodeAV1ProfileInfoMESA { | ||
| 1299 | - VkStructureType sType; | ||
| 1300 | - const void *pNext; | ||
| 1301 | - StdVideoAV1MESAProfile stdProfileIdc; | ||
| 1302 | -} VkVideoDecodeAV1ProfileInfoMESA; | ||
| 1303 | - | ||
| 1304 | -typedef enum VkVideoDecodeAV1CapabilityFlagBitsMESA { | ||
| 1305 | - VK_VIDEO_DECODE_AV1_CAPABILITY_EXTERNAL_FILM_GRAIN_MESA = 0x00000001, | ||
| 1306 | - VK_VIDEO_DECODE_AV1_CAPABILITY_FLAG_BITS_MAX_ENUM_MESA = 0x7FFFFFFF | ||
| 1307 | -} VkVideoDecodeAV1CapabilityFlagBitsMESA; | ||
| 1308 | -typedef VkFlags VkVideoDecodeAV1CapabilityFlagsMESA; | ||
| 1309 | - | ||
| 1310 | -typedef struct VkVideoDecodeAV1CapabilitiesMESA { | ||
| 1311 | - VkStructureType sType; | ||
| 1312 | - const void *pNext; | ||
| 1313 | - VkVideoDecodeAV1CapabilityFlagsMESA flags; | ||
| 1314 | - StdVideoAV1MESALevel maxLevelIdc; | ||
| 1315 | -} VkVideoDecodeAV1CapabilitiesMESA; | ||
| 1316 | - | ||
| 1317 | -#define VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PICTURE_INFO_MESA 1000509000 | ||
| 1318 | -#define VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_CREATE_INFO_MESA 1000509001 | ||
| 1319 | -#define VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_SESSION_PARAMETERS_ADD_INFO_MESA 1000509002 | ||
| 1320 | -#define VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_DPB_SLOT_INFO_MESA 1000509003 | ||
| 1321 | -#define VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_CAPABILITIES_MESA 1000509004 | ||
| 1322 | -#define VK_STRUCTURE_TYPE_VIDEO_DECODE_AV1_PROFILE_INFO_MESA 1000509005 | ||
| 1323 | - | ||
| 1324 | -#ifdef __cplusplus | ||
| 1325 | -} | ||
| 1326 | -#endif | ||
| 1327 | - | ||
| 1328 | -#endif | ||
| 1329 | diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c | ||
| 1330 | index 91b9f96ccf..6e3b96b73a 100644 | ||
| 1331 | --- a/libavutil/hwcontext_vulkan.c | ||
| 1332 | +++ b/libavutil/hwcontext_vulkan.c | ||
| 1333 | @@ -446,7 +446,7 @@ static const VulkanOptExtension optional_device_exts[] = { | ||
| 1334 | { VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_QUEUE }, | ||
| 1335 | { VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_H264 }, | ||
| 1336 | { VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_H265 }, | ||
| 1337 | - { "VK_MESA_video_decode_av1", FF_VK_EXT_VIDEO_DECODE_AV1 }, | ||
| 1338 | + { VK_KHR_VIDEO_DECODE_AV1_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_AV1 }, | ||
| 1339 | }; | ||
| 1340 | |||
| 1341 | static VkBool32 VKAPI_CALL vk_dbg_callback(VkDebugUtilsMessageSeverityFlagBitsEXT severity, | ||
| 1342 | diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h | ||
| 1343 | index 65021b04b1..6b379acf93 100644 | ||
| 1344 | --- a/libavutil/vulkan_functions.h | ||
| 1345 | +++ b/libavutil/vulkan_functions.h | ||
| 1346 | @@ -43,7 +43,7 @@ typedef enum FFVulkanExtensions { | ||
| 1347 | FF_VK_EXT_VIDEO_DECODE_QUEUE = 1ULL << 11, /* VK_KHR_video_decode_queue */ | ||
| 1348 | FF_VK_EXT_VIDEO_DECODE_H264 = 1ULL << 12, /* VK_EXT_video_decode_h264 */ | ||
| 1349 | FF_VK_EXT_VIDEO_DECODE_H265 = 1ULL << 13, /* VK_EXT_video_decode_h265 */ | ||
| 1350 | - FF_VK_EXT_VIDEO_DECODE_AV1 = 1ULL << 14, /* VK_MESA_video_decode_av1 */ | ||
| 1351 | + FF_VK_EXT_VIDEO_DECODE_AV1 = 1ULL << 14, /* VK_KHR_video_decode_av1 */ | ||
| 1352 | FF_VK_EXT_ATOMIC_FLOAT = 1ULL << 15, /* VK_EXT_shader_atomic_float */ | ||
| 1353 | FF_VK_EXT_COOP_MATRIX = 1ULL << 16, /* VK_KHR_cooperative_matrix */ | ||
| 1354 | |||
| 1355 | diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h | ||
| 1356 | index f9e739e1e3..73cf03935d 100644 | ||
| 1357 | --- a/libavutil/vulkan_loader.h | ||
| 1358 | +++ b/libavutil/vulkan_loader.h | ||
| 1359 | @@ -58,7 +58,7 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions, | ||
| 1360 | { VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_QUEUE }, | ||
| 1361 | { VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_H264 }, | ||
| 1362 | { VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_H265 }, | ||
| 1363 | - { "VK_MESA_video_decode_av1", FF_VK_EXT_VIDEO_DECODE_AV1 }, | ||
| 1364 | + { VK_KHR_VIDEO_DECODE_AV1_EXTENSION_NAME, FF_VK_EXT_VIDEO_DECODE_AV1 }, | ||
| 1365 | }; | ||
| 1366 | |||
| 1367 | FFVulkanExtensions mask = 0x0; | ||
| 1368 | diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c | ||
| 1369 | --- ffmpeg-6.1.1.orig/libavcodec/vulkan_video.c | ||
| 1370 | +++ ffmpeg-6.1.1/libavcodec/vulkan_video.c | ||
| 1371 | @@ -37,7 +37,7 @@ const FFVkCodecMap ff_vk_codec_map[AV_CO | ||
| 1372 | 0, | ||
| 1373 | 0, | ||
| 1374 | FF_VK_EXT_VIDEO_DECODE_AV1, | ||
| 1375 | - 0x01000000 /* TODO fix this */ | ||
| 1376 | + VK_VIDEO_CODEC_OPERATION_DECODE_AV1_BIT_KHR | ||
| 1377 | }, | ||
| 1378 | }; | ||
| 1379 | |||
| 1380 | -- | ||
| 1381 | 2.25.1 | ||
| 1382 | |||
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb index aa59755034..c0bce2db7a 100644 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb | |||
| @@ -22,7 +22,11 @@ LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | |||
| 22 | file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ | 22 | file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ |
| 23 | file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" | 23 | file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" |
| 24 | 24 | ||
| 25 | SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz" | 25 | SRC_URI = " \ |
| 26 | https://www.ffmpeg.org/releases/${BP}.tar.xz \ | ||
| 27 | file://av1_ordering_info.patch \ | ||
| 28 | file://vulkan_av1_stable_API.patch \ | ||
| 29 | " | ||
| 26 | 30 | ||
| 27 | SRC_URI[sha256sum] = "8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968" | 31 | SRC_URI[sha256sum] = "8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968" |
| 28 | 32 | ||
