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

Function decode_reset

libavcodec/vulkan_decode.c:418–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418static int decode_reset(AVCodecContext *avctx, FFVulkanDecodeShared *ctx)
419{
420 int err;
421 FFVulkanContext *s = &ctx->s;
422 FFVulkanFunctions *vk = &s->vkfn;
423
424 VkVideoBeginCodingInfoKHR decode_start = {
425 .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR,
426 .videoSession = ctx->common.session,
427 };
428
429 if (!(ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_2)) {
430 err = create_empty_session_parameters(avctx, ctx,
431 &decode_start.videoSessionParameters);
432 if (err < 0)
433 return err;
434 }
435
436 VkVideoCodingControlInfoKHR decode_ctrl = {
437 .sType = VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR,
438 .flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR,
439 };
440 VkVideoEndCodingInfoKHR decode_end = {
441 .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR,
442 };
443
444 FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &ctx->exec_pool);
445 ff_vk_exec_start(&ctx->s, exec);
446
447 vk->CmdBeginVideoCodingKHR(exec->buf, &decode_start);
448 vk->CmdControlVideoCodingKHR(exec->buf, &decode_ctrl);
449 vk->CmdEndVideoCodingKHR(exec->buf, &decode_end);
450
451 err = ff_vk_exec_submit(&ctx->s, exec);
452
453 if (decode_start.videoSessionParameters) {
454 /* Wait to complete to delete the temporary session parameters */
455 if (err >= 0)
456 ff_vk_exec_wait(&ctx->s, exec);
457
458 vk->DestroyVideoSessionParametersKHR(s->hwctx->act_dev,
459 decode_start.videoSessionParameters,
460 s->hwctx->alloc);
461 }
462
463 if (err < 0)
464 av_log(avctx, AV_LOG_ERROR, "Unable to reset decoder: %s",
465 ff_vk_ret2str(err));
466
467 return err;
468}
469
470int ff_vk_decode_frame(AVCodecContext *avctx,
471 AVFrame *pic, FFVulkanDecodePicture *vp,

Callers 1

ff_vk_decode_initFunction · 0.85

Calls 6

ff_vk_exec_getFunction · 0.85
ff_vk_exec_startFunction · 0.85
ff_vk_exec_waitFunction · 0.85
av_logFunction · 0.85
ff_vk_ret2strFunction · 0.85

Tested by

no test coverage detected