aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWu Jianhua <jianhua.wu@intel.com>2021-11-19 21:52:46 +0800
committerLynne <dev@lynne.ee>2021-11-19 16:47:47 +0100
commit067da5c87e73338da0944eaa6b4e1b0ff8ce3fd2 (patch)
treebcc607b8538334dccc5a26006e8cb67da65b7f7a
parent404a58d5bee908a6340defccd99bb174106f854a (diff)
downloadffmpeg-067da5c87e73338da0944eaa6b4e1b0ff8ce3fd2.tar.gz
avfilter/scale_vulkan: call av_vkfmt_from_pixfmt only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
-rw-r--r--libavfilter/vf_scale_vulkan.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 414523418d..cfce5ab1f8 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -304,6 +304,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f)
VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2];
int barrier_count = 0;
const int planes = av_pix_fmt_count_planes(s->vkctx.input_format);
+ const VkFormat *input_formats = av_vkfmt_from_pixfmt(s->vkctx.input_format);
+ const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format);
/* Update descriptors and init the exec context */
ff_vk_start_exec_recording(vkctx, s->exec);
@@ -312,12 +314,12 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f)
for (int i = 0; i < planes; i++) {
RET(ff_vk_create_imageview(vkctx, s->exec,
&s->input_images[i].imageView, in->img[i],
- av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
+ input_formats[i],
ff_comp_identity_map));
RET(ff_vk_create_imageview(vkctx, s->exec,
&s->output_images[i].imageView, out->img[i],
- av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+ output_formats[i],
ff_comp_identity_map));
s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;