History

avfilter/scale_vulkan: call av_pix_fmt_count_planes only one time

Wu Jianhua committed 4 years ago

Commit 404a58d1 parent 6e4efe41 file · +4 −6Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_scale_vulkan.c+4−6
@@ -303,32 +303,30 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f) · 302 unmodified lines
303 AVVkFrame *out = (AVVkFrame *)out_f->data[0];303 AVVkFrame *out = (AVVkFrame *)out_f->data[0];
304 VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2];304 VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2];
305 int barrier_count = 0;305 int barrier_count = 0;
306 const int planes = av_pix_fmt_count_planes(s->vkctx.input_format);
306 307
307 /* Update descriptors and init the exec context */308 /* Update descriptors and init the exec context */
308 ff_vk_start_exec_recording(vkctx, s->exec);309 ff_vk_start_exec_recording(vkctx, s->exec);
309 cmd_buf = ff_vk_get_exec_buf(s->exec);310 cmd_buf = ff_vk_get_exec_buf(s->exec);
310 311
311 for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) {312 for (int i = 0; i < planes; i++) {
312 RET(ff_vk_create_imageview(vkctx, s->exec,313 RET(ff_vk_create_imageview(vkctx, s->exec,
313 &s->input_images[i].imageView, in->img[i],314 &s->input_images[i].imageView, in->img[i],
314 av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],315 av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
315 ff_comp_identity_map));316 ff_comp_identity_map));
316 317
317 s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
318 }
319
320 for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.output_format); i++) {
321 RET(ff_vk_create_imageview(vkctx, s->exec,318 RET(ff_vk_create_imageview(vkctx, s->exec,
322 &s->output_images[i].imageView, out->img[i],319 &s->output_images[i].imageView, out->img[i],
323 av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],320 av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
324 ff_comp_identity_map));321 ff_comp_identity_map));
325 322
323 s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
326 s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;324 s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
327 }325 }
328 326
329 ff_vk_update_descriptor_set(vkctx, s->pl, 0);327 ff_vk_update_descriptor_set(vkctx, s->pl, 0);
330 328
331 for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) {329 for (int i = 0; i < planes; i++) {
332 VkImageMemoryBarrier bar = {330 VkImageMemoryBarrier bar = {
333 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,331 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
334 .srcAccessMask = 0,332 .srcAccessMask = 0,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t