From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3150E40FB6 for ; Sun, 2 Jan 2022 14:52:20 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 96F9068B14C; Sun, 2 Jan 2022 16:52:13 +0200 (EET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 37BB568B13F for ; Sun, 2 Jan 2022 16:52:05 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641135130; x=1672671130; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DM7w7eydk3ghh6QK8YoDYHquJA8UOTYzO0IQmds6hSw=; b=XPlqRs+I5UODT+zV51sstD8EtE3jR+EUyIjc9zYqWPwe2P6V7b6Hod1a tfY8I05Ht/usjqaCIx4V9q0TMWxNm0vlnkNmg3EVOmh/TjDNtCGADjkuT J0N5sYUs9tj4BGOrvjv+3euZyS3DTNH/k6AAnqy1qbybtMLek8X35r6qC bJi0q0Rl1L/qlRZlIJMwtnlXPWw53hx4BxL4rYh3Wl99dKmErLvCkY8gF 2dy13ZjD2NyLudpahgXu92K0zF28vHpI15qg9e1b8SCUfMqRGdpauSJb+ WjCW1/vT6EeZDLfQSFZa+pZy29XOMyIY40PI0Wyp4mYXc/wAMDwXG2+Qr Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10214"; a="221965999" X-IronPort-AV: E=Sophos;i="5.88,256,1635231600"; d="scan'208";a="221965999" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2022 06:52:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,256,1635231600"; d="scan'208";a="667176299" Received: from chenwenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.110]) by fmsmga001.fm.intel.com with ESMTP; 02 Jan 2022 06:52:01 -0800 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Sun, 2 Jan 2022 22:51:39 +0800 Message-Id: <20220102145142.4083918-2-jianhua.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220102145142.4083918-1-jianhua.wu@intel.com> References: <20220102145142.4083918-1-jianhua.wu@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] transpose_vulkan: add passthrough option 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: The following command is on how to apply passthrough option: ffmpeg -init_hw_device vulkan -i input.264 -vf hwupload=extra_hw_frames=16,transpose_vulkan=passthrough=landscape,hwdownload,format=yuv420p output.264 Signed-off-by: Wu Jianhua --- libavfilter/vf_transpose_vulkan.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libavfilter/vf_transpose_vulkan.c b/libavfilter/vf_transpose_vulkan.c index ce83cf0fd7..30d052e08c 100644 --- a/libavfilter/vf_transpose_vulkan.c +++ b/libavfilter/vf_transpose_vulkan.c @@ -35,6 +35,7 @@ typedef struct TransposeVulkanContext { VkDescriptorImageInfo output_images[3]; int dir; + int passthrough; int initialized; } TransposeVulkanContext; @@ -222,6 +223,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) TransposeVulkanContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; + if (s->passthrough) + return ff_filter_frame(outlink, in); + out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { err = AVERROR(ENOMEM); @@ -267,6 +271,17 @@ static int config_props_output(AVFilterLink *outlink) FFVulkanContext *vkctx = &s->vkctx; AVFilterLink *inlink = avctx->inputs[0]; + if ((inlink->w >= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_LANDSCAPE) || + (inlink->w <= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_PORTRAIT)) { + av_log(avctx, AV_LOG_VERBOSE, + "w:%d h:%d -> w:%d h:%d (passthrough mode)\n", + inlink->w, inlink->h, inlink->w, inlink->h); + outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx); + return outlink->hw_frames_ctx ? 0 : AVERROR(ENOMEM); + } else { + s->passthrough = TRANSPOSE_PT_TYPE_NONE; + } + vkctx->output_width = inlink->h; vkctx->output_height = inlink->w; @@ -288,6 +303,13 @@ static const AVOption transpose_vulkan_options[] = { { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "dir" }, { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "dir" }, { "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "dir" }, + + { "passthrough", "do not apply transposition if the input matches the specified geometry", + OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, "passthrough" }, + { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, + { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, + { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" }, + { NULL } }; -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".