MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_vk_decode_frame

Function ff_vk_decode_frame

libavcodec/vulkan_decode.c:470–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470int ff_vk_decode_frame(AVCodecContext *avctx,
471 AVFrame *pic, FFVulkanDecodePicture *vp,
472 AVFrame *rpic[], FFVulkanDecodePicture *rvkp[])
473{
474 int err;
475 VkResult ret;
476 VkCommandBuffer cmd_buf;
477 FFVkBuffer *sd_buf;
478
479 FFVulkanDecodeContext *dec = avctx->internal->hwaccel_priv_data;
480 FFVulkanDecodeShared *ctx = dec->shared_ctx;
481 FFVulkanFunctions *vk = &ctx->s.vkfn;
482
483 /* Output */
484 AVVkFrame *vkf = (AVVkFrame *)pic->buf[0]->data;
485
486 /* Quirks */
487 const int layered_dpb = ctx->common.layered_dpb;
488
489 VkVideoBeginCodingInfoKHR decode_start = {
490 .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
491 .videoSession = ctx->common.session,
492 .videoSessionParameters = dec->session_params ?
493 *((VkVideoSessionParametersKHR *)dec->session_params->data) :
494 VK_NULL_HANDLE,
495 .referenceSlotCount = vp->decode_info.referenceSlotCount,
496 .pReferenceSlots = vp->decode_info.pReferenceSlots,
497 };
498 VkVideoEndCodingInfoKHR decode_end = {
499 .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR,
500 };
501
502 VkImageMemoryBarrier2 img_bar[37];
503 int nb_img_bar = 0;
504 size_t data_size = FFALIGN(vp->slices_size,
505 ctx->caps.minBitstreamBufferSizeAlignment);
506
507 FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &ctx->exec_pool);
508
509 /* The current decoding reference has to be bound as an inactive reference */
510 VkVideoReferenceSlotInfoKHR *cur_vk_ref;
511 cur_vk_ref = (void *)&decode_start.pReferenceSlots[decode_start.referenceSlotCount];
512 cur_vk_ref[0] = vp->ref_slot;
513 cur_vk_ref[0].slotIndex = -1;
514 decode_start.referenceSlotCount++;
515
516 sd_buf = (FFVkBuffer *)vp->slices_buf->data;
517
518 /* Flush if needed */
519 if (!(sd_buf->flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
520 VkMappedMemoryRange flush_buf = {
521 .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
522 .memory = sd_buf->mem,
523 .offset = 0,
524 .size = FFALIGN(vp->slices_size,
525 ctx->s.props.properties.limits.nonCoherentAtomSize),
526 };
527

Callers 4

vk_av1_end_frameFunction · 0.85
vk_hevc_end_frameFunction · 0.85
vk_vp9_end_frameFunction · 0.85
vk_h264_end_frameFunction · 0.85

Calls 8

ff_vk_exec_getFunction · 0.85
av_logFunction · 0.85
ff_vk_ret2strFunction · 0.85
ff_vk_exec_startFunction · 0.85
ff_vk_exec_add_dep_bufFunction · 0.85
ff_vk_exec_add_dep_frameFunction · 0.85
ff_vk_exec_update_frameFunction · 0.85

Tested by

no test coverage detected