mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-28 17:51:05 +00:00
avfilter/overlay_vulkan: call av_vkfmt_from_pixfmt only one time
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
This commit is contained in:
parent
067da5c87e
commit
999048b6b1
@ -242,9 +242,13 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f,
|
|||||||
AVVkFrame *main = (AVVkFrame *)main_f->data[0];
|
AVVkFrame *main = (AVVkFrame *)main_f->data[0];
|
||||||
AVVkFrame *overlay = (AVVkFrame *)overlay_f->data[0];
|
AVVkFrame *overlay = (AVVkFrame *)overlay_f->data[0];
|
||||||
|
|
||||||
AVHWFramesContext *main_fc = (AVHWFramesContext*)main_f->hw_frames_ctx->data;
|
AVHWFramesContext *main_fc = (AVHWFramesContext*)main_f->hw_frames_ctx->data;
|
||||||
AVHWFramesContext *overlay_fc = (AVHWFramesContext*)overlay_f->hw_frames_ctx->data;
|
AVHWFramesContext *overlay_fc = (AVHWFramesContext*)overlay_f->hw_frames_ctx->data;
|
||||||
|
|
||||||
|
const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format);
|
||||||
|
const VkFormat *main_sw_formats = av_vkfmt_from_pixfmt(main_fc->sw_format);
|
||||||
|
const VkFormat *overlay_sw_formats = av_vkfmt_from_pixfmt(overlay_fc->sw_format);
|
||||||
|
|
||||||
/* Update descriptors and init the exec context */
|
/* Update descriptors and init the exec context */
|
||||||
ff_vk_start_exec_recording(vkctx, s->exec);
|
ff_vk_start_exec_recording(vkctx, s->exec);
|
||||||
cmd_buf = ff_vk_get_exec_buf(s->exec);
|
cmd_buf = ff_vk_get_exec_buf(s->exec);
|
||||||
@ -252,17 +256,17 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f,
|
|||||||
for (int i = 0; i < planes; i++) {
|
for (int i = 0; i < planes; i++) {
|
||||||
RET(ff_vk_create_imageview(vkctx, s->exec,
|
RET(ff_vk_create_imageview(vkctx, s->exec,
|
||||||
&s->main_images[i].imageView, main->img[i],
|
&s->main_images[i].imageView, main->img[i],
|
||||||
av_vkfmt_from_pixfmt(main_fc->sw_format)[i],
|
main_sw_formats[i],
|
||||||
ff_comp_identity_map));
|
ff_comp_identity_map));
|
||||||
|
|
||||||
RET(ff_vk_create_imageview(vkctx, s->exec,
|
RET(ff_vk_create_imageview(vkctx, s->exec,
|
||||||
&s->overlay_images[i].imageView, overlay->img[i],
|
&s->overlay_images[i].imageView, overlay->img[i],
|
||||||
av_vkfmt_from_pixfmt(overlay_fc->sw_format)[i],
|
overlay_sw_formats[i],
|
||||||
ff_comp_identity_map));
|
ff_comp_identity_map));
|
||||||
|
|
||||||
RET(ff_vk_create_imageview(vkctx, s->exec,
|
RET(ff_vk_create_imageview(vkctx, s->exec,
|
||||||
&s->output_images[i].imageView, out->img[i],
|
&s->output_images[i].imageView, out->img[i],
|
||||||
av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
|
output_formats[i],
|
||||||
ff_comp_identity_map));
|
ff_comp_identity_map));
|
||||||
|
|
||||||
s->main_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
s->main_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user