diff mbox series

[FFmpeg-devel,09/10] avfilter/scale_vulkan: call av_vkfmt_from_pixfmt only one time

Message ID 20211118042449.8038-9-jianhua.wu@intel.com
State New
Headers show
Series [FFmpeg-devel,01/10] avfilter/avgblur_vulkan: check if shader is created with success
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Wu Jianhua Nov. 18, 2021, 4:24 a.m. UTC
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
---
 libavfilter/vf_scale_vulkan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 413c2cb294..77c970473e 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -302,6 +302,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(avctx, s->exec);
@@ -310,12 +312,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(avctx, 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(avctx, 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;