26 .queue_flags = VK_QUEUE_VIDEO_DECODE_BIT_KHR,
27 .decode_op = VK_VIDEO_CODEC_OPERATION_DECODE_VP9_BIT_KHR,
29 .extensionName = VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_EXTENSION_NAME,
30 .specVersion = VK_STD_VULKAN_VIDEO_CODEC_VP9_DECODE_SPEC_VERSION,
56 VkVideoReferenceSlotInfoKHR *ref_slot,
57 VkVideoPictureResourceInfoKHR *
ref,
70 *
ref = (VkVideoPictureResourceInfoKHR) {
71 .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
72 .codedOffset = (VkOffset2D){ 0, 0 },
76 .imageViewBinding = vkpic->
view.
ref,
79 *ref_slot = (VkVideoReferenceSlotInfoKHR) {
80 .sType = VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR,
82 .pPictureResource =
ref,
91static enum StdVideoVP9InterpolationFilter
remap_interp(uint8_t is_filter_switchable,
92 uint8_t raw_interpolation_filter_type)
94 static const enum StdVideoVP9InterpolationFilter
remap[] = {
95 STD_VIDEO_VP9_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH,
96 STD_VIDEO_VP9_INTERPOLATION_FILTER_EIGHTTAP,
97 STD_VIDEO_VP9_INTERPOLATION_FILTER_EIGHTTAP_SHARP,
98 STD_VIDEO_VP9_INTERPOLATION_FILTER_BILINEAR,
100 if (is_filter_switchable)
101 return STD_VIDEO_VP9_INTERPOLATION_FILTER_SWITCHABLE;
102 return remap[raw_interpolation_filter_type];
115 uint32_t frame_id_alloc_mask = 0;
126 for (
int i = 0;
i < STD_VIDEO_VP9_NUM_REF_FRAMES;
i++) {
129 frame_id_alloc_mask |= 1 << rp->
frame_id;
133 unsigned slot_idx = 0;
134 for (
unsigned i = 0;
i < 32;
i++) {
135 if (!(frame_id_alloc_mask & (1 <<
i))) {
142 frame_id_alloc_mask |= (1 << slot_idx);
145 for (
int i = 0;
i < STD_VIDEO_VP9_REFS_PER_FRAME;
i++) {
154 for (
int j = 0; j < ref_count; j++) {
178 .flags = (StdVideoVP9LoopFilterFlags) {
184 .update_ref_delta = 0x0,
185 .update_mode_delta = 0x0,
188 for (
int i = 0;
i < STD_VIDEO_VP9_MAX_REF_FRAMES;
i++) {
192 for (
int i = 0;
i < STD_VIDEO_VP9_LOOP_FILTER_ADJUSTMENTS;
i++) {
198 .flags = (StdVideoVP9SegmentationFlags) {
206 for (
int i = 0;
i < STD_VIDEO_VP9_MAX_SEGMENTATION_TREE_PROBS;
i++)
208 for (
int i = 0;
i < STD_VIDEO_VP9_MAX_SEGMENTATION_PRED_PROB;
i++)
210 for (
int i = 0;
i < STD_VIDEO_VP9_MAX_SEGMENTS;
i++) {
212 for (
int j = 0; j < STD_VIDEO_VP9_SEG_LVL_MAX; j++) {
221 .flags = (StdVideoVP9ColorConfigFlags) {
233 .flags = (StdVideoDecodeVP9PictureInfoFlags) {
240 .show_frame = !
s->h.invisible,
241 .UsePrevFrameMvs =
s->h.use_last_frame_mvs,
248 .ref_frame_sign_bias_mask = 0x0,
267 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_VP9_PICTURE_INFO_KHR,
269 .uncompressedHeaderOffset = 0,
270 .compressedHeaderOffset =
s->h.uncompressed_header_size,
271 .tilesOffset =
s->h.uncompressed_header_size +
272 s->h.compressed_header_size,
275 for (
int i = 0;
i < STD_VIDEO_VP9_REFS_PER_FRAME;
i++) {
287 .sType = VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR,
290 .pSetupReferenceSlot = &vp->
ref_slot,
291 .referenceSlotCount = ref_count,
293 .dstPictureResource = (VkVideoPictureResourceInfoKHR) {
294 .sType = VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR,
295 .codedOffset = (VkOffset2D){ 0, 0 },
298 .imageViewBinding = vp->
view.
out,
331 AVFrame *rav[STD_VIDEO_VP9_REFS_PER_FRAME] = { 0 };
357 .p.name =
"vp9_vulkan",
static AVFormatContext * ctx
#define i(width, name, range_min, range_max)
int(* init)(AVBSFContext *ctx)
#define AV_LOG_VERBOSE
Detailed information.
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
const struct FFHWAccel ff_vp9_vulkan_hwaccel
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static const int remap[16]
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
A reference to a data buffer.
main external API structure.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
struct AVCodecInternal * internal
Private context used for internal data.
void * hwaccel_priv_data
hwaccel-specific private data
This structure describes decoded (raw) audio or video data.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void * priv_data
Internal codec-specific data.
uint8_t feature_enabled[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]
uint8_t feature_value[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]
int8_t loop_filter_ref_deltas[VP9_MAX_REF_FRAMES]
uint8_t segmentation_pred_prob[3]
int8_t loop_filter_mode_deltas[2]
uint8_t segmentation_tree_probs[7]
uint8_t feature_sign[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]
FFVulkanDecodeShared * shared_ctx
struct FFVulkanDecodePicture::@321376256110110067000314232201030232256240036361 view
VkVideoReferenceSlotInfoKHR ref_slot
VkVideoPictureResourceInfoKHR refs[36]
VkVideoReferenceSlotInfoKHR ref_slots[36]
VkVideoDecodeInfoKHR decode_info
CodedBitstreamContext * cbc
void * hwaccel_picture_private
RefStruct reference.
VP9RawFrameHeader * frame_header
StdVideoVP9LoopFilter loop_filter
StdVideoDecodeVP9PictureInfo std_pic_info
StdVideoVP9ColorConfig color_config
VkVideoDecodeVP9PictureInfoKHR vp9_pic_info
StdVideoVP9Segmentation segmentation
const VP9Frame * ref_src[8]
uint8_t ref_frame_sign_bias_mask
FFVulkanDecodeContext * dec
static int ref[MAX_W *MAX_W]
RefStruct is an API for creating reference-counted objects with minimal overhead.
int ff_vk_decode_frame(AVCodecContext *avctx, AVFrame *pic, FFVulkanDecodePicture *vp, AVFrame *rpic[], FFVulkanDecodePicture *rvkp[])
Decode a frame.
int ff_vk_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Synchronize the contexts between 2 threads.
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Initialize hw_frames_ctx with the parameters needed to decode the stream using the parameters from av...
int ff_vk_decode_add_slice(AVCodecContext *avctx, FFVulkanDecodePicture *vp, const uint8_t *data, size_t size, int add_startcode, uint32_t *nb_slices, const uint32_t **offsets)
Add slice data to frame.
void ff_vk_decode_free_frame(AVHWDeviceContext *dev_ctx, FFVulkanDecodePicture *vp)
Free a frame and its state.
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic, FFVulkanDecodePicture *vkpic, int is_current, int alloc_dpb)
Prepare a frame, creates the image view, and sets up the dpb fields.
#define FF_VK_EXT_VIDEO_DECODE_VP9
static int vk_vp9_fill_pict(AVCodecContext *avctx, const VP9Frame **ref_src, VkVideoReferenceSlotInfoKHR *ref_slot, VkVideoPictureResourceInfoKHR *ref, const VP9Frame *pic, int is_current)
static void vk_vp9_free_frame_priv(AVRefStructOpaque _hwctx, void *data)
static enum StdVideoVP9InterpolationFilter remap_interp(uint8_t is_filter_switchable, uint8_t raw_interpolation_filter_type)
static int vk_vp9_start_frame(AVCodecContext *avctx, av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
static int vk_vp9_end_frame(AVCodecContext *avctx)
const FFVulkanDecodeDescriptor ff_vk_dec_vp9_desc
static int vk_vp9_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
static int ref_frame(VVCFrame *dst, const VVCFrame *src)