[FFmpeg-cvslog] avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

Wu Jianhua git at videolan.org
Fri Nov 19 17:48:25 EET 2021


ffmpeg | branch: master | Wu Jianhua <jianhua.wu at intel.com> | Fri Nov 19 21:52:43 2021 +0800| [9f2b204461015fed54ff114666679dcbee8a2b5e] | committer: Lynne

avfilter/avgblur_vulkan: call av_vkfmt_from_pixfmt only one time

Signed-off-by: Wu Jianhua <jianhua.wu at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f2b204461015fed54ff114666679dcbee8a2b5e
---

 libavfilter/vf_avgblur_vulkan.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index 92c3a9aa7c..d118ce802c 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -212,6 +212,10 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_f
     AVVkFrame *in = (AVVkFrame *)in_f->data[0];
     AVVkFrame *tmp = (AVVkFrame *)tmp_f->data[0];
     AVVkFrame *out = (AVVkFrame *)out_f->data[0];
+
+    const VkFormat *input_formats = av_vkfmt_from_pixfmt(s->vkctx.input_format);
+    const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format);
+
     int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
 
     /* Update descriptors and init the exec context */
@@ -221,17 +225,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_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->tmp_images[i].imageView, tmp->img[i],
-                                   av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
+                                   output_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;



More information about the ffmpeg-cvslog mailing list