From patchwork Tue Dec 7 09:41:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 32102 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp6014635iog; Tue, 7 Dec 2021 01:46:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyctSwfehYmXWGitE6E3fFP8PHkovjtbo9DakVR3GXD1RbzRpAC9naQa1SNTeQvlh7H6ZNw X-Received: by 2002:a17:907:3f96:: with SMTP id hr22mr51326362ejc.492.1638870368434; Tue, 07 Dec 2021 01:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638870368; cv=none; d=google.com; s=arc-20160816; b=F+mJhi3JP3ggsF52IPiliqJYS/O2WgToiwxY0DG1vZ2NnHk6TjZT2AaLWfAx+Hmdbx i/Gp3TQVrVdRMFh/CuC6CDLhmPVlbhxPiqa97AwlCRWidwsJGb6mLy0EiiMTAb3n7JdF VPB4YBwosQeu4qMQc57gtIo3HHf7bvgKGPOH9IaoyaIQZOZHeE5mBKOqy4xySUblTUkL bCKrltsQ4aL8Vx1GhsZJ8itL5b11TgLt/3cyindTyk2oeW0LjEuHdmrb1FRbGp4B2dIa neV4pcwp7XPep4epkkvnRlizytXwn569twECzdDW8Nx5xMnZQxyEKEtggTA47xjlyGBO zjxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=uN2/dBwDVB/TELT1jz/ig7UK7BRi/pt+JoJB3h3Qtmk=; b=c8LmW7A8qkJcXFMt2y9j+lmYiOVah5GE0CZMtdeTblVwsgMlR/DxpNN6n3Z91CauFb EVpD5UPGvcaADI006KC+hzu8jpVmMyBHkVFL8AYMJxTTlveNhfEAZAa8YzqiFbTa/NEd u1jEGvutCBeAk7ex+pDwfjjOTs+QuyDAYvXTvARrRsVj9W/N/sWfXT6MaOX6xa7zhUmQ HDcWeQSJyv6PL0y0tpLQlz1SuLLc+KJlCHMF1AlYg1zSZn1wIlvWENj/gpC61UjZRods 8ZqUQTgohqvEsOft+I5dzRVzp0Md28wN1XWjsKzDJ3bkRsfhQjOlhKTVQ1VBgChHjJIg 8r2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hg5si23896060ejc.744.2021.12.07.01.46.05; Tue, 07 Dec 2021 01:46:08 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9068368AE0F; Tue, 7 Dec 2021 11:46:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A809168A43D for ; Tue, 7 Dec 2021 11:45:53 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="236279415" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="236279415" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 01:45:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="657630443" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2021 01:45:50 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Dec 2021 17:41:37 +0800 Message-Id: <20211207094140.2151055-1-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] avfilter: add a transpose_vulkan filter X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NNeuuu3HttcM The following command is on how to apply transpose_vulkan filter: ffmpeg -init_hw_device vulkan -i input.264 -vf \ hwupload=extra_hw_frames=16,transpose_vulkan,hwdownload,format=yuv420p output.264 Signed-off-by: Wu Jianhua --- configure | 1 + libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/vf_transpose_vulkan.c | 316 ++++++++++++++++++++++++++++++ 4 files changed, 319 insertions(+) create mode 100644 libavfilter/vf_transpose_vulkan.c diff --git a/configure b/configure index a98a18abaa..12cb49e877 100755 --- a/configure +++ b/configure @@ -3718,6 +3718,7 @@ tonemap_vaapi_filter_deps="vaapi VAProcFilterParameterBufferHDRToneMapping" tonemap_opencl_filter_deps="opencl const_nan" transpose_opencl_filter_deps="opencl" transpose_vaapi_filter_deps="vaapi VAProcPipelineCaps_rotation_flags" +transpose_vulkan_filter_deps="vulkan spirv_compiler" unsharp_opencl_filter_deps="opencl" uspp_filter_deps="gpl avcodec" vaguedenoiser_filter_deps="gpl" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index c8082c4a2f..8744cc3c63 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -483,6 +483,7 @@ OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o OBJS-$(CONFIG_TRANSPOSE_OPENCL_FILTER) += vf_transpose_opencl.o opencl.o opencl/transpose.o OBJS-$(CONFIG_TRANSPOSE_VAAPI_FILTER) += vf_transpose_vaapi.o vaapi_vpp.o +OBJS-$(CONFIG_TRANSPOSE_VULKAN_FILTER) += vf_transpose_vulkan.o vulkan.o vulkan_filter.o OBJS-$(CONFIG_TRIM_FILTER) += trim.o OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o framesync.o OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index b1af2cbcc8..9e16b4e71e 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -462,6 +462,7 @@ extern const AVFilter ff_vf_transpose; extern const AVFilter ff_vf_transpose_npp; extern const AVFilter ff_vf_transpose_opencl; extern const AVFilter ff_vf_transpose_vaapi; +extern const AVFilter ff_vf_transpose_vulkan; extern const AVFilter ff_vf_trim; extern const AVFilter ff_vf_unpremultiply; extern const AVFilter ff_vf_unsharp; diff --git a/libavfilter/vf_transpose_vulkan.c b/libavfilter/vf_transpose_vulkan.c new file mode 100644 index 0000000000..c9bae413c3 --- /dev/null +++ b/libavfilter/vf_transpose_vulkan.c @@ -0,0 +1,316 @@ +/* + * copyright (c) 2021 Wu Jianhua + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/random_seed.h" +#include "libavutil/opt.h" +#include "vulkan_filter.h" +#include "internal.h" + +#define CGS 32 + +typedef struct TransposeVulkanContext { + FFVulkanContext vkctx; + FFVkQueueFamilyCtx qf; + FFVkExecContext *exec; + FFVulkanPipeline *pl; + + VkDescriptorImageInfo input_images[3]; + VkDescriptorImageInfo output_images[3]; + + int initialized; +} TransposeVulkanContext; + +static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) +{ + int err = 0; + FFVkSPIRVShader *shd; + TransposeVulkanContext *s = ctx->priv; + FFVulkanContext *vkctx = &s->vkctx; + const int planes = av_pix_fmt_count_planes(s->vkctx.output_format); + + FFVulkanDescriptorSetBinding image_descs[] = { + { + .name = "input_images", + .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, + .dimensions = 2, + .elems = planes, + .stages = VK_SHADER_STAGE_COMPUTE_BIT, + .updater = s->input_images, + }, + { + .name = "output_images", + .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format), + .mem_quali = "writeonly", + .dimensions = 2, + .elems = planes, + .stages = VK_SHADER_STAGE_COMPUTE_BIT, + .updater = s->output_images, + }, + }; + + image_descs[0].sampler = ff_vk_init_sampler(vkctx, 1, VK_FILTER_LINEAR); + if (!image_descs[0].sampler) + return AVERROR_EXTERNAL; + + ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0); + + { + s->pl = ff_vk_create_pipeline(vkctx, &s->qf); + if (!s->pl) + return AVERROR(ENOMEM); + + shd = ff_vk_init_shader(s->pl, "transpose_compute", image_descs[0].stages); + if (!shd) + return AVERROR(ENOMEM); + + ff_vk_set_compute_shader_sizes(shd, (int [3]){ CGS, 1, 1 }); + RET(ff_vk_add_descriptor_set(vkctx, s->pl, shd, image_descs, FF_ARRAY_ELEMS(image_descs), 0)); + + GLSLC(0, void main() ); + GLSLC(0, { ); + GLSLC(1, ivec2 size; ); + GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); ); + for (int i = 0; i < planes; i++) { + GLSLC(0, ); + GLSLF(1, size = imageSize(output_images[%i]); ,i); + GLSLC(1, if (IS_WITHIN(pos, size)) { ); + GLSLF(2, vec4 res = texture(input_images[%i], pos.yx); ,i); + GLSLF(2, imageStore(output_images[%i], pos, res); ,i); + GLSLC(1, } ); + } + GLSLC(0, } ); + + RET(ff_vk_compile_shader(vkctx, shd, "main")); + RET(ff_vk_init_pipeline_layout(vkctx, s->pl)); + RET(ff_vk_init_compute_pipeline(vkctx, s->pl)); + } + + RET(ff_vk_create_exec_ctx(vkctx, &s->exec, &s->qf)); + s->initialized = 1; + +fail: + return err; +} + +static int process_frames(AVFilterContext *avctx, AVFrame *outframe, AVFrame *inframe) +{ + int err = 0; + VkCommandBuffer cmd_buf; + TransposeVulkanContext *s = avctx->priv; + FFVulkanContext *vkctx = &s->vkctx; + FFVulkanFunctions *vk = &s->vkctx.vkfn; + const int planes = av_pix_fmt_count_planes(s->vkctx.output_format); + + AVVkFrame *in = (AVVkFrame *)inframe->data[0]; + AVVkFrame *out = (AVVkFrame *)outframe->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); + + ff_vk_start_exec_recording(vkctx, s->exec); + cmd_buf = ff_vk_get_exec_buf(s->exec); + + for (int i = 0; i < planes; i++) { + RET(ff_vk_create_imageview(vkctx, s->exec, + &s->input_images[i].imageView, in->img[i], + input_formats[i], + ff_comp_identity_map)); + + RET(ff_vk_create_imageview(vkctx, s->exec, + &s->output_images[i].imageView, out->img[i], + output_formats[i], + ff_comp_identity_map)); + + s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL; + } + + ff_vk_update_descriptor_set(vkctx, s->pl, 0); + + for (int i = 0; i < planes; i++) { + VkImageMemoryBarrier barriers[] = { + { + .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, + .srcAccessMask = 0, + .dstAccessMask = VK_ACCESS_SHADER_READ_BIT, + .oldLayout = in->layout[i], + .newLayout = s->input_images[i].imageLayout, + .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, + .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, + .image = in->img[i], + .subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, + .subresourceRange.levelCount = 1, + .subresourceRange.layerCount = 1, + }, + { + .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, + .srcAccessMask = 0, + .dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT, + .oldLayout = out->layout[i], + .newLayout = s->output_images[i].imageLayout, + .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, + .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, + .image = out->img[i], + .subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, + .subresourceRange.levelCount = 1, + .subresourceRange.layerCount = 1, + }, + }; + + vk->CmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, + 0, NULL, 0, NULL, FF_ARRAY_ELEMS(barriers), barriers); + + in->layout[i] = barriers[0].newLayout; + in->access[i] = barriers[0].dstAccessMask; + + out->layout[i] = barriers[1].newLayout; + out->access[i] = barriers[1].dstAccessMask; + } + + ff_vk_bind_pipeline_exec(vkctx, s->exec, s->pl); + vk->CmdDispatch(cmd_buf, FFALIGN(s->vkctx.output_width, CGS)/CGS, + s->vkctx.output_height, 1); + + ff_vk_add_exec_dep(vkctx, s->exec, inframe, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT); + ff_vk_add_exec_dep(vkctx, s->exec, outframe, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT); + + err = ff_vk_submit_exec_queue(vkctx, s->exec); + if (err) + return err; + + ff_vk_qf_rotate(&s->qf); + + return 0; + +fail: + ff_vk_discard_exec_deps(s->exec); + return err; +} + +static int filter_frame(AVFilterLink *inlink, AVFrame *in) +{ + int err; + AVFrame *out = NULL; + AVFilterContext *ctx = inlink->dst; + TransposeVulkanContext *s = ctx->priv; + AVFilterLink *outlink = ctx->outputs[0]; + + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); + if (!out) { + err = AVERROR(ENOMEM); + goto fail; + } + + if (!s->initialized) + RET(init_filter(ctx, in)); + + RET(process_frames(ctx, out, in)); + + RET(av_frame_copy_props(out, in)); + + if (in->sample_aspect_ratio.num) + out->sample_aspect_ratio = in->sample_aspect_ratio; + else { + out->sample_aspect_ratio.num = in->sample_aspect_ratio.den; + out->sample_aspect_ratio.den = in->sample_aspect_ratio.num; + } + + av_frame_free(&in); + + return ff_filter_frame(outlink, out); + +fail: + av_frame_free(&in); + av_frame_free(&out); + return err; +} + +static av_cold void transpose_vulkan_uninit(AVFilterContext *avctx) +{ + TransposeVulkanContext *s = avctx->priv; + ff_vk_uninit(&s->vkctx); + + s->initialized = 0; +} + +static int config_props_output(AVFilterLink *outlink) +{ + int err = 0; + AVFilterContext *avctx = outlink->src; + TransposeVulkanContext *s = avctx->priv; + FFVulkanContext *vkctx = &s->vkctx; + AVFilterLink *inlink = avctx->inputs[0]; + + vkctx->output_width = inlink->h; + vkctx->output_height = inlink->w; + + RET(ff_vk_filter_config_output(outlink)); + + outlink->w = inlink->h; + outlink->h = inlink->w; + + if (inlink->sample_aspect_ratio.num) + outlink->sample_aspect_ratio = av_div_q((AVRational) { 1, 1 }, + inlink->sample_aspect_ratio); + else + outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; + + err = 0; + +fail: + return err; +} + +static const AVOption transpose_vulkan_options[] = { + { NULL } +}; + +AVFILTER_DEFINE_CLASS(transpose_vulkan); + +static const AVFilterPad transpose_vulkan_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .filter_frame = &filter_frame, + .config_props = &ff_vk_filter_config_input, + } +}; + +static const AVFilterPad transpose_vulkan_outputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, + .config_props = &config_props_output, + } +}; + +const AVFilter ff_vf_transpose_vulkan = { + .name = "transpose_vulkan", + .description = NULL_IF_CONFIG_SMALL("Transpose Vulkan Filter"), + .priv_size = sizeof(TransposeVulkanContext), + .init = &ff_vk_filter_init, + .uninit = &transpose_vulkan_uninit, + FILTER_INPUTS(transpose_vulkan_inputs), + FILTER_OUTPUTS(transpose_vulkan_outputs), + FILTER_SINGLE_PIXFMT(AV_PIX_FMT_VULKAN), + .priv_class = &transpose_vulkan_class, + .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE, +}; From patchwork Tue Dec 7 09:41:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 32103 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp6014873iog; Tue, 7 Dec 2021 01:46:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9WP6O6TzYBbQJwp65U8Hh2OO0Yt8KeAa/Pmjyv9FwVxn+ilvm6juH5fV0SC+vbwIMrpqq X-Received: by 2002:aa7:db47:: with SMTP id n7mr7361360edt.303.1638870379443; Tue, 07 Dec 2021 01:46:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638870379; cv=none; d=google.com; s=arc-20160816; b=N90g8JgbT7yCYDe47rpmeL00/YtZ6fU5EoA90FdsDXWHvfbeu4G2XFGtfSyhNV9P1R 1vphPo0GRMzbELG7sf2ch+wQfbsZjv/g/qb9FZ02UQB6hdDShxATO/C9jbxqZ7BbtDSW n8uRd2LDtL+r3DeWbZAhzjcFzfbZNkRz6vYq7nMw7J81+YJUtF6J8AG2mkHSEAbyjxq7 Cd8W4zoszk7ColE/DAkeUEs5/7GQajCKzuDBsHGx7UR+1iBoT8ncfwmEmHoH/RzhFeZe 2LqSiRT58FDrMpXCAdg4dxx5XWfzcqdJYX9Z8SjpSBaLGao1sAtESZCOTGNci2Y/rnEM 6JJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=hF/sGQ6IDJ0Jpqx0d57nLqMcUZB7lwU3BEF9vXqUyFE=; b=Xgvin2oDEMLZ5J8/1/b7gm4BtIx/jnftDJjkizWV9VONXfLba0yd4DAbw1vzfcAGYO 7CfcTd5qQiupFAkuUDK4uVSzEzimN+zIeDgl2C5ooFSPpRQF0prz8YA0wWsILtYJYXA+ FDWGdMLgeu9KZwmHYjmluc+dxy75cqyfNIxQRDEuy5yU+zJGaW5mXvIT1h/e4fd+sybm MIgU6gQAzLsuPfq695yRvWjlZ7mKgFzc5c6HdJlxg1NNQcfIdsQauFilKRzaJwrgqZwz PoAaTFeNYwAiByHmQsuS5grt3NaJz27XRCWcndHHnWw6joYUSumFzSDIdBMYEGGEd6Qr rR5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r13si21244106edv.421.2021.12.07.01.46.15; Tue, 07 Dec 2021 01:46:19 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B057268AE59; Tue, 7 Dec 2021 11:46:02 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 027A468A43D for ; Tue, 7 Dec 2021 11:45:54 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="236279422" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="236279422" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 01:45:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="657630449" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2021 01:45:51 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Dec 2021 17:41:38 +0800 Message-Id: <20211207094140.2151055-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211207094140.2151055-1-jianhua.wu@intel.com> References: <20211207094140.2151055-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] avfilter/vf_transpose: fix un-checked potential memory allocation failure X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rqL6I5AGFe1v Signed-off-by: Wu Jianhua --- libavfilter/vf_transpose.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index f9f0d70cd5..b964daeee3 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -328,6 +328,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, static int filter_frame(AVFilterLink *inlink, AVFrame *in) { + int err = 0; AVFilterContext *ctx = inlink->dst; TransContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; @@ -339,10 +340,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); + err = AVERROR(ENOMEM); + goto fail; } - av_frame_copy_props(out, in); + + err = av_frame_copy_props(out, in); + if (err < 0) + goto fail; if (in->sample_aspect_ratio.num == 0) { out->sample_aspect_ratio = in->sample_aspect_ratio; @@ -356,6 +360,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); av_frame_free(&in); return ff_filter_frame(outlink, out); + +fail: + av_frame_free(&in); + av_frame_free(&out); + return err; } #define OFFSET(x) offsetof(TransContext, x) From patchwork Tue Dec 7 09:41:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 32104 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp6014977iog; Tue, 7 Dec 2021 01:46:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzyAFNBFK9m1kZFC+VJyy/GGWiKIywgdwRZFimbOMj89WIJ6uTEbYuh7yWxJvPKAkAygfnG X-Received: by 2002:a05:6402:2079:: with SMTP id bd25mr7723347edb.116.1638870385188; Tue, 07 Dec 2021 01:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638870385; cv=none; d=google.com; s=arc-20160816; b=IctUsazPkioTjsnFYHg4fT5qhdC/Afvyxo7JwXDyiLv807jmUaB++woF8/wZExAu0J Hq013i9qkLT9244Z9srN0/EK8u/kTbTA7AhzF7mG3abuoOzbs1lAuHf1YvZf5ylGjnFX IxfcylNFjLj40EqCQLTBYfMgYc1ZhVQge+5IahNjrGedmbsEPrt3MM8vgPk24q99Z9Rk vkFp5Bq7W52wWmayuEXPRnwznBuQT1A44p2DxKKASmVfmb3a8lfeR3udDv+FT5X1oSGq 42K917z8OtJ8EffNsZdpn8rGYA4iq/nSgpwfJsrvxfTkGA2MWcc1J4DUUJDEYuUztOTa 8NJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=oBSh9i4vc2H1BMruL/0WY0BG/txLYbf3DhQNy7pmp+I=; b=fZdP5wMFEPSUhnEzYse0fCsJM10igzLjZ4gtoEsbzVWSHMy9wXyf7CQyJ/f0KR0zwm Y1NQFQqMQrEJjZ/PKULWhhy4N7UJxFzZdItrv8JT4iP+UM8mw6a25+9rybi7e3CQmxIK voczhGKfrz3iPsQEckQbC91B55XtoS5lv9J35QXXZU923icZgf1JLktr7YkXQSPRp6Qs OYqAdNVM7jkzaOBbWudLyDO9DG26ywttkr+eSE7c09WH4FX6IaGDSFSPMOGN5V1DDdr2 CLo8fYo3YZ1ZpNMR68wIe80dC98T0lL+WhlLLG/kgtizgxfiS28I3Z2fxVH5StOi8KEN HUTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c11si24871808edw.601.2021.12.07.01.46.24; Tue, 07 Dec 2021 01:46:25 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8E2468AE71; Tue, 7 Dec 2021 11:46:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5120168AD8B for ; Tue, 7 Dec 2021 11:45:56 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="236279429" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="236279429" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 01:45:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="657630459" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2021 01:45:52 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Dec 2021 17:41:39 +0800 Message-Id: <20211207094140.2151055-3-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211207094140.2151055-1-jianhua.wu@intel.com> References: <20211207094140.2151055-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] avfilter/gblur_vulkan: fix incorrect sematic X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: YFDBnvX9hmZ5 The input and output are arrays of images, so it's better to use the plural to align them to the variable name of VkDescriptorImageInfo. Signed-off-by: Wu Jianhua --- libavfilter/vf_gblur_vulkan.c | 60 +++++++++++++++++------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c index a2e33d1c90..2dbbbd0965 100644 --- a/libavfilter/vf_gblur_vulkan.c +++ b/libavfilter/vf_gblur_vulkan.c @@ -50,31 +50,31 @@ typedef struct GBlurVulkanContext { } GBlurVulkanContext; static const char gblur_horizontal[] = { - C(0, void gblur(const ivec2 pos, const int index) ) - C(0, { ) - C(1, vec4 sum = texture(input_image[index], pos) * kernel[0]; ) - C(0, ) - C(1, for(int i = 1; i < kernel.length(); i++) { ) - C(2, sum += texture(input_image[index], pos + vec2(i, 0.0)) * kernel[i]; ) - C(2, sum += texture(input_image[index], pos - vec2(i, 0.0)) * kernel[i]; ) - C(1, } ) - C(0, ) - C(1, imageStore(output_image[index], pos, sum); ) - C(0, } ) + C(0, void gblur(const ivec2 pos, const int index) ) + C(0, { ) + C(1, vec4 sum = texture(input_images[index], pos) * kernel[0]; ) + C(0, ) + C(1, for (int i = 1; i < kernel.length(); i++) { ) + C(2, sum += texture(input_images[index], pos + vec2(i, 0.0)) * kernel[i]; ) + C(2, sum += texture(input_images[index], pos - vec2(i, 0.0)) * kernel[i]; ) + C(1, } ) + C(0, ) + C(1, imageStore(output_images[index], pos, sum); ) + C(0, } ) }; static const char gblur_vertical[] = { - C(0, void gblur(const ivec2 pos, const int index) ) - C(0, { ) - C(1, vec4 sum = texture(input_image[index], pos) * kernel[0]; ) - C(0, ) - C(1, for(int i = 1; i < kernel.length(); i++) { ) - C(2, sum += texture(input_image[index], pos + vec2(0.0, i)) * kernel[i]; ) - C(2, sum += texture(input_image[index], pos - vec2(0.0, i)) * kernel[i]; ) - C(1, } ) - C(0, ) - C(1, imageStore(output_image[index], pos, sum); ) - C(0, } ) + C(0, void gblur(const ivec2 pos, const int index) ) + C(0, { ) + C(1, vec4 sum = texture(input_images[index], pos) * kernel[0]; ) + C(0, ) + C(1, for (int i = 1; i < kernel.length(); i++) { ) + C(2, sum += texture(input_images[index], pos + vec2(0.0, i)) * kernel[i]; ) + C(2, sum += texture(input_images[index], pos - vec2(0.0, i)) * kernel[i]; ) + C(1, } ) + C(0, ) + C(1, imageStore(output_images[index], pos, sum); ) + C(0, } ) }; static inline float gaussian(float sigma, float x) @@ -133,14 +133,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) FFVulkanDescriptorSetBinding image_descs[] = { { - .name = "input_image", + .name = "input_images", .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .dimensions = 2, .elems = planes, .stages = VK_SHADER_STAGE_COMPUTE_BIT, }, { - .name = "output_image", + .name = "output_images", .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format), .mem_quali = "writeonly", @@ -202,13 +202,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); ); for (int i = 0; i < planes; i++) { GLSLC(0, ); - GLSLF(1, size = imageSize(output_image[%i]); ,i); + GLSLF(1, size = imageSize(output_images[%i]); ,i); GLSLC(1, if (IS_WITHIN(pos, size)) { ); if (s->planes & (1 << i)) { GLSLF(2, gblur(pos, %i); ,i); } else { - GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i); - GLSLF(2, imageStore(output_image[%i], pos, res); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], pos); ,i); + GLSLF(2, imageStore(output_images[%i], pos, res); ,i); } GLSLC(1, } ); } @@ -261,13 +261,13 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); ); for (int i = 0; i < planes; i++) { GLSLC(0, ); - GLSLF(1, size = imageSize(output_image[%i]); ,i); + GLSLF(1, size = imageSize(output_images[%i]); ,i); GLSLC(1, if (IS_WITHIN(pos, size)) { ); if (s->planes & (1 << i)) { GLSLF(2, gblur(pos, %i); ,i); } else { - GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i); - GLSLF(2, imageStore(output_image[%i], pos, res); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], pos); ,i); + GLSLF(2, imageStore(output_images[%i], pos, res); ,i); } GLSLC(1, } ); } From patchwork Tue Dec 7 09:41:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 32101 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp6015209iog; Tue, 7 Dec 2021 01:46:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyv9VCRKtovfc3aA8oiADiOLkEBIG9BW3lVFhuFPxu/umzqijSbg85kqft7LhfWcUP8GEus X-Received: by 2002:a17:907:3d94:: with SMTP id he20mr54235305ejc.75.1638870398043; Tue, 07 Dec 2021 01:46:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638870398; cv=none; d=google.com; s=arc-20160816; b=fmG82gaa/fxYN+g6keWMpUxS7Pn6lpve4qYaDGBTiy4wi+fXQgl0RPNNKj1NX+EnwY BcX3W6eRkkV0W2Jsqqy+w6xYwsFESoaDKM+4k7OchCGJa14HdnGjUnLERg0NlBkVr/Mi HpQ0k1GqzMC7EEMXyXPUrHsbYWONnSD2AH/wPja67T+mBMX7NaBsC/MVmkbgtWizu4j5 019gQh9y9a928zDZF4BJUNeVEau47POCUUd6UGBpmgpx7kzf/VQOxEHoEV38qyKnF2jo vBAwlBsOmgfvQKKfcSHcbegWFUGxhBf+ldoCuOJuRC4XpUvfb9BITFdQ3b0XvNg5lF+O +Cgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=vJxA5xCJpyH4X5rHAoeSF7+lfmZnEh7NStELpDBzV/w=; b=P/Bt0qpj1BTXO9dz4Cv5cJ6F1i13x+AdN962fdWHhnlErqSnc8spRamiHzC4QmLVIt a9Hs+4MMWt8Bq4Ufiynnpw0Ap+ktCOFy07+6ydkuVW6jALpyntWMyM7LJXQMQ+zFlxSk FCKNNgYE1hFQk6/BpirypJ1Cnjpyz0kgFsH663sWIKpQf0WfY0bw72iQF9rW5Tkwncfo DQ5v3sWLq7bdO5ldFKHkjhdpuzGfs1nSFUCx6wv0LlNlN70WTb/4puJB2XKs7T1GnJEv h2ORLtFWKFTHcsLBDYFWCgfFLmrxgePX1QrPp61nhkH9aYypeSOezgnlTu83zQTmK0Ti Mrcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fz1si28504805ejc.175.2021.12.07.01.46.35; Tue, 07 Dec 2021 01:46:38 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D357268A43D; Tue, 7 Dec 2021 11:46:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B85A168AE46 for ; Tue, 7 Dec 2021 11:45:59 +0200 (EET) X-IronPort-AV: E=McAfee;i="6200,9189,10190"; a="236279443" X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="236279443" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2021 01:45:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,293,1631602800"; d="scan'208";a="657630474" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 07 Dec 2021 01:45:53 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Dec 2021 17:41:40 +0800 Message-Id: <20211207094140.2151055-4-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211207094140.2151055-1-jianhua.wu@intel.com> References: <20211207094140.2151055-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] avfilter/flip_vulkan: fix incorrect sematic X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Wu Jianhua Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: x6KFEJYF4kUz The input and output are arrays of images, so it's better to use the plural to align them to the variable name of VkDescriptorImageInfo. Signed-off-by: Wu Jianhua --- libavfilter/vf_flip_vulkan.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/libavfilter/vf_flip_vulkan.c b/libavfilter/vf_flip_vulkan.c index 0223786ef1..6a6709e79b 100644 --- a/libavfilter/vf_flip_vulkan.c +++ b/libavfilter/vf_flip_vulkan.c @@ -52,7 +52,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType FFVulkanDescriptorSetBinding image_descs[] = { { - .name = "input_image", + .name = "input_images", .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .dimensions = 2, .elems = planes, @@ -60,7 +60,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType .updater = s->input_images, }, { - .name = "output_image", + .name = "output_images", .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format), .mem_quali = "writeonly", @@ -89,33 +89,33 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType ff_vk_set_compute_shader_sizes(shd, (int [3]){ CGS, 1, 1 }); RET(ff_vk_add_descriptor_set(vkctx, s->pl, shd, image_descs, FF_ARRAY_ELEMS(image_descs), 0)); - GLSLC(0, void main() ); - GLSLC(0, { ); - GLSLC(1, ivec2 size; ); - GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); ); + GLSLC(0, void main() ); + GLSLC(0, { ); + GLSLC(1, ivec2 size; ); + GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); ); for (int i = 0; i < planes; i++) { - GLSLC(0, ); - GLSLF(1, size = imageSize(output_image[%i]); ,i); - GLSLC(1, if (IS_WITHIN(pos, size)) { ); + GLSLC(0, ); + GLSLF(1, size = imageSize(output_images[%i]); ,i); + GLSLC(1, if (IS_WITHIN(pos, size)) { ); switch (type) { case FLIP_HORIZONTAL: - GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.x - pos.x, pos.y)); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.x - pos.x, pos.y)); ,i); break; case FLIP_VERTICAL: - GLSLF(2, vec4 res = texture(input_image[%i], ivec2(pos.x, size.y - pos.y)); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], ivec2(pos.x, size.y - pos.y)); ,i); break; case FLIP_BOTH: - GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.xy - pos.xy));, i); + GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.xy - pos.xy));, i); break; default: - GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i); + GLSLF(2, vec4 res = texture(input_images[%i], pos); ,i); break; } - GLSLF(2, imageStore(output_image[%i], pos, res); ,i); - GLSLC(1, } ); + GLSLF(2, imageStore(output_images[%i], pos, res); ,i); + GLSLC(1, } ); } - GLSLC(0, } ); + GLSLC(0, } ); RET(ff_vk_compile_shader(vkctx, shd, "main")); RET(ff_vk_init_pipeline_layout(vkctx, s->pl));