mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-05 14:30:00 +01:00
vulkan/prores: use cached bitstream reader
Speedup is around 75% on NVIDIA 3050, 20% on AMD 6700XT, 5% on Intel TigerLake.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "hwaccel_internal.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/vulkan.h"
|
||||
#include "libavutil/vulkan_loader.h"
|
||||
#include "libavutil/vulkan_spirv.h"
|
||||
|
||||
extern const char *ff_source_common_comp;
|
||||
@@ -207,14 +206,12 @@ static int vk_prores_end_frame(AVCodecContext *avctx)
|
||||
RET(ff_vk_exec_mirror_sem_value(&ctx->s, exec, &vp->sem, &vp->sem_value,
|
||||
pr->frame));
|
||||
|
||||
/* Transfer ownership to the exec context */
|
||||
RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &vp->slices_buf, 1, 0));
|
||||
vp->slices_buf = NULL;
|
||||
RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &pp->metadata_buf, 1, 0));
|
||||
pp->metadata_buf = NULL;
|
||||
|
||||
/* Transfer ownership to the exec context */
|
||||
vp->slices_buf = pp->metadata_buf = NULL;
|
||||
|
||||
/* Input barrier */
|
||||
ff_vk_frame_barrier(&ctx->s, exec, pr->frame, img_bar, &nb_img_bar,
|
||||
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
|
||||
@@ -404,6 +401,11 @@ static int init_shader(AVCodecContext *avctx, FFVulkanContext *s,
|
||||
local_size >> 16 & 0xff, local_size >> 8 & 0xff, local_size >> 0 & 0xff,
|
||||
0));
|
||||
|
||||
av_bprintf(&shd->src, "#define GET_BITS_SMEM\n");
|
||||
|
||||
if (interlaced)
|
||||
av_bprintf(&shd->src, "#define INTERLACED\n");
|
||||
|
||||
/* Common code */
|
||||
GLSLD(ff_source_common_comp);
|
||||
|
||||
@@ -412,9 +414,6 @@ static int init_shader(AVCodecContext *avctx, FFVulkanContext *s,
|
||||
|
||||
RET(ff_vk_shader_add_descriptor_set(s, shd, descs, num_descs, 0, 0));
|
||||
|
||||
if (interlaced)
|
||||
av_bprintf(&shd->src, "#define INTERLACED\n");
|
||||
|
||||
/* Main code */
|
||||
GLSLD(source);
|
||||
|
||||
@@ -494,6 +493,7 @@ static int vk_decode_prores_init(AVCodecContext *avctx)
|
||||
RET(init_shader(avctx, &ctx->s, &ctx->exec_pool, spv, &pv->reset,
|
||||
"prores_dec_reset", "main", desc_set, 1,
|
||||
ff_source_prores_reset_comp, 0x080801, pr->frame_type != 0));
|
||||
|
||||
desc_set = (FFVulkanDescriptorSetBinding []) {
|
||||
{
|
||||
.name = "slice_offsets_buf",
|
||||
|
||||
Reference in New Issue
Block a user