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
303303 AVVkFrame *out = (AVVkFrame *)out_f->data[0];
304304 VkImageMemoryBarrier barriers[AV_NUM_DATA_POINTERS*2];
305305 int barrier_count = 0;
306+ const int planes = av_pix_fmt_count_planes(s->vkctx.input_format);
306307
307308 /* Update descriptors and init the exec context */
308309 ff_vk_start_exec_recording(vkctx, s->exec);
309310 cmd_buf = ff_vk_get_exec_buf(s->exec);
310311
311− for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) {
312+ for (int i = 0; i < planes; i++) {
312313 RET(ff_vk_create_imageview(vkctx, s->exec,
313314 &s->input_images[i].imageView, in->img[i],
314315 av_vkfmt_from_pixfmt(s->vkctx.input_format)[i],
315316 ff_comp_identity_map));
316317
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++) {
321318 RET(ff_vk_create_imageview(vkctx, s->exec,
322319 &s->output_images[i].imageView, out->img[i],
323320 av_vkfmt_from_pixfmt(s->vkctx.output_format)[i],
324321 ff_comp_identity_map));
325322
323+ s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
326324 s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
327325 }
328326
329327 ff_vk_update_descriptor_set(vkctx, s->pl, 0);
330328
331− for (int i = 0; i < av_pix_fmt_count_planes(s->vkctx.input_format); i++) {
329+ for (int i = 0; i < planes; i++) {
332330 VkImageMemoryBarrier bar = {
333331 .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
334332 .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