From patchwork Sun Aug 1 13:22:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linjie Fu X-Patchwork-Id: 29161 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp802444ioh; Sun, 1 Aug 2021 06:22:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuOIslvHPQE2TfcnO6JWLYomyynpjUKHqI1wNi6f/f9mrTgzhVA2d7sPSGiDfJdo41UBGF X-Received: by 2002:aa7:cd4c:: with SMTP id v12mr13770370edw.155.1627824148977; Sun, 01 Aug 2021 06:22:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627824148; cv=none; d=google.com; s=arc-20160816; b=SrqL2dof24hV0aq/2kNCbsQj0PigMEny6wLfNf2UhcCAD+qO+tnTOO+Extpi8FvdyD djEutxMHPAZQ8G8GCXDIm8YMigKx8GspVvADLAUtR+josHbmf8RspAIZFkfNUPYF+oDf 86fLp3mF3GwKU4rqm6kAjKZ1IEL1ylRHoTI7WfYBq9F5skFypifaJg5FHQzx09Qfgn9p RYJIE3YbwBOBHMD0WqXAO/IvVTTLh9yA8pFuGk+hTGpBNGTAZVlrfaThVNeHqE2JWLLs V92o4hWfna10Pgrt3Ca/RitbP9BzzKXXKM71xnJZZQS8vIr2yjHCTDV98XO/b+g/7BJ7 ypBg== 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=AcASdqfKlmofqI/Wi+gHI4A55D3FEB138+xMxE7bBmI=; b=XcLTcfljM79TTRTOHNhWr4crN8jQUmCD0dQMyX/2c+jmaN96Ryleiw+mQkf2s/7bRf XXJmBsDDvo2Vpx2HGrCnqi11WqroOdJfh8kMCWZrZg63L90pcI1ZPDfPvO5eAS1FG9yy 6U4BxEJWBFv1XqBSKEST2SavTOPDpA2P3t/Z9BZVMyAz8E0lV4EhL6c8daNFpW9JDoxt rmjzr85S2lRVfAIADD+g6x7HCaKrU1OoZMPurTJiwp9I9yikdhNWQxLI0wIkrS1kRbDi aj3b9S9VYbOq29TbE6DfK7+2kKU6fEoPpqL4VUFi0AqxGLTVUEj08V1Qc6kQp5O0PYZV 27JQ== 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x25si7481151edr.71.2021.08.01.06.22.28; Sun, 01 Aug 2021 06:22:28 -0700 (PDT) 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F0A3F689CCC; Sun, 1 Aug 2021 16:22:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from zg8tmty1ljiyny4xntqumjca.icoremail.net (zg8tmty1ljiyny4xntqumjca.icoremail.net [165.227.154.27]) by ffbox0-bg.mplayerhq.hu (Postfix) with SMTP id 3A7B26805B8 for ; Sun, 1 Aug 2021 16:22:16 +0300 (EEST) Received: from localhost.localdomain (unknown [58.247.209.118]) by mail-app2 (Coremail) with SMTP id by_KCgDHzjL7nwZhQgPxAg--.1893S2; Sun, 01 Aug 2021 21:22:03 +0800 (CST) From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Sun, 1 Aug 2021 21:22:01 +0800 Message-Id: <20210801132202.74239-1-fulinjie@zju.edu.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: by_KCgDHzjL7nwZhQgPxAg--.1893S2 X-Coremail-Antispam: 1UD129KBjvJXoWrtFWrWF1fWF47tw4xXF17trb_yoW8Jryrpr yrG3WUAFWfJr98AF4Du347WFW5GFWkX39I9FWrGFyjqw1rGr48tayfKFWrurn8Ka1xZr4I v3W5Kw1rG342vaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkYb7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwV C2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC 0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr 1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkIecxEwVAFwVW5GwCF04k2 0xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI 8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41l IxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIx AIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2 jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8pOJ5UUUUU== X-CM-SenderInfo: ysrvjiarsuq6lmxovvfxof0/ Subject: [FFmpeg-devel] [PATCH 1/2] fftools/cmdutils: make the default swscale flags identical for simple and complex filter graph 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: Linjie Fu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: VuBUYGRifT4U From: Linjie Fu Currently the default swscale flags for simple filter graph is bicubic, however for complex filter graph it uses bilinear as decleared in scale filter. $ffmpeg -v verbose -i input.mp4 -vf format=yuv420p,scale=800x600 -an -f null - [Parsed_scale_1 @ 0x7f86d2c160c0] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x4 $ffmpeg -v verbose -i input.mp4 -filter_complex format=yuv420p,scale=800x600 -an -f null - [Parsed_scale_1 @ 0x7f8779e046c0] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x2 Set the default swscale flags for simple filter graph to bilinear to match the description in scale filter. Signed-off-by: Linjie Fu --- fftools/cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 0b1ef03a25..56b8ada5b1 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -83,7 +83,7 @@ enum show_muxdemuxers { void init_opts(void) { - av_dict_set(&sws_dict, "flags", "bicubic", 0); + av_dict_set(&sws_dict, "flags", "bilinear", 0); } void uninit_opts(void) From patchwork Sun Aug 1 13:22:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linjie Fu X-Patchwork-Id: 29160 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp802562ioh; Sun, 1 Aug 2021 06:22:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW4owntmFjZeSDe7JLV/2pXbA/SMU7S//Yt22/MGEj4pf3ppW9fLYg5SKvyNk3fbShhxqW X-Received: by 2002:a17:906:5fc7:: with SMTP id k7mr10988001ejv.377.1627824160944; Sun, 01 Aug 2021 06:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627824160; cv=none; d=google.com; s=arc-20160816; b=MhNNmtzG6HJ15wd74I0hAJA7D+q7jnXdNbk5mvB7n0Zq2CyV6/YMxThfTRT9tbfteh bW3uA9vrgVL/+YeVUJpf+WuVM0eaezXEXIUh5JSeNsDOw7sPGNGQMphIeKGP4zuKi9Q/ f1MN6LM0OLZL1mMbe/mJy5WSH4t0GIA5OFbnIwcFT1hjlTWLRMflIIRy9kSNoUHaKnLh zYW1ZvLm4+oF4oLBtFgelDYqcsTZThvEiI+Xqv7E99xp0zenw6gOu4fsCDJlGBlyP1lM kbmJMJ06xWK+XlnW9A5Uxt3DS/ZDrwzpCFLE4kdblxi3ZIZXFdtPRYyC6oN+bvMQLrNk hKNg== 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=3OVrvypx32fiDzHCmQTs5T+Q8N61vc1zwuyULb8Ki28=; b=vbcPe4M6aeOp8+NLfg90WvqDOTm6s0EeyxYz+7JDqvyfvdtgKcK+gaLrQ15y05B1mp t9cszm3er6ADa9CkqiVEFYjqnCUj7EWF5OiCeibuZs1Sqwl2hB0qXiWb69ZlsIBHYekq jc10LslcDutENB7DzeMXx8TI+lbw7BQ/44OQNMKz8XoNbEuLsmMDjkgzdSBC5Rc+nwKh tOTA+Xh9cHFaCPWD59w4QE8rYXwIH0IT+FBkMIahEUMacjAAetcd8upSyT2J7F7fLTG7 H7MFmB2BQ4RlRYecHee9vDAGnPH0fmoqsVqbhXrN9llZy+MH5x4Re5gMDXljeavJL9Ir TKAg== 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i17si7526643edr.164.2021.08.01.06.22.40; Sun, 01 Aug 2021 06:22:40 -0700 (PDT) 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0964A68A501; Sun, 1 Aug 2021 16:22:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from zg8tmty1ljiyny4xntqumjca.icoremail.net (zg8tmty1ljiyny4xntqumjca.icoremail.net [165.227.154.27]) by ffbox0-bg.mplayerhq.hu (Postfix) with SMTP id 957B66805B8 for ; Sun, 1 Aug 2021 16:22:17 +0300 (EEST) Received: from localhost.localdomain (unknown [58.247.209.118]) by mail-app2 (Coremail) with SMTP id by_KCgDHzjL7nwZhQgPxAg--.1893S3; Sun, 01 Aug 2021 21:22:06 +0800 (CST) From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Sun, 1 Aug 2021 21:22:02 +0800 Message-Id: <20210801132202.74239-2-fulinjie@zju.edu.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210801132202.74239-1-fulinjie@zju.edu.cn> References: <20210801132202.74239-1-fulinjie@zju.edu.cn> MIME-Version: 1.0 X-CM-TRANSID: by_KCgDHzjL7nwZhQgPxAg--.1893S3 X-Coremail-Antispam: 1UD129KBjvJXoW7trW8KrykGr4fCr17JF48Xrb_yoW8tr15pr yrK3W7JFyfZr98AFWDXF1jga1rG3ykXrZF9FWrA3s8XF9xJr1xta4xKFW5Wr98Wa17uFs7 Zan0ga4DW34jqF7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Kb7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI 8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Jr4l8cAvFVAK0II2c7xJM28CjxkF64kE wVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x 0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF 7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F4 0Ex7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC 6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lc2xSY4AK67AK6ry8MxAIw28IcxkI7VAKI4 8JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xv wVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0EwIxGrwCI42IY6xIIjx v20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20E Y4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267 AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjxU4oUDDUUUU X-CM-SenderInfo: ysrvjiarsuq6lmxovvfxof0/ Subject: [FFmpeg-devel] [PATCH 2/2] fftools/cmdutils: pass sws_flags to scale filter in simple filter graph 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: Linjie Fu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: hPd/U6jxZvrY From: Linjie Fu Pass sws_flags to scale filter through scale_sws_opts and correct the dumped flags information. CMD: $ffmpeg -v verbose -i input.mp4 -sws_flags lanczos+bitexact+accurate_rnd \ -vf format=yuv420p,scale=800x600 -an -vframes 10 -f md5 - Before: [auto_scaler_0 @ 0x7f899a418780] w:iw h:ih flags:'bilinear' interl:0 [auto_scaler_0 @ 0x7f899a418780] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x2 [Parsed_scale_1 @ 0x7f899a417100] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0x2 MD5=ff1d6091690c6fcd36d458d2a9f648ce After: [auto_scaler_0 @ 0x7fc7a3a06080] w:iw h:ih flags:'lanczos+bitexact+accurate_rnd' interl:0 [auto_scaler_0 @ 0x7fc7a3a06080] w:1920 h:1080 fmt:yuvj420p sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0xc0200 [Parsed_scale_1 @ 0x7fc7a3a04780] w:1920 h:1080 fmt:yuv420p sar:0/1 -> w:800 h:600 fmt:yuv420p sar:0/1 flags:0xc0200 MD5=ff1d6091690c6fcd36d458d2a9f648ce Signed-off-by: Linjie Fu --- fftools/cmdutils.c | 1 - fftools/ffmpeg_filter.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 56b8ada5b1..f4d9f5eafb 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -670,7 +670,6 @@ static void finish_group(OptionParseContext *octx, int group_idx, resample_opts = NULL; sws_dict = NULL; swr_opts = NULL; - init_opts(); memset(&octx->cur_group, 0, sizeof(octx->cur_group)); } diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 958d74f008..94838adc56 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -977,7 +977,11 @@ int configure_filtergraph(FilterGraph *fg) } if (strlen(args)) args[strlen(args)-1] = 0; - fg->graph->scale_sws_opts = av_strdup(args); + + if (!strncmp(args, "sws_flags=", 10)) { + // keep the 'flags=' part + fg->graph->scale_sws_opts = av_strdup(args+4); + } args[0] = 0; while ((e = av_dict_get(ost->swr_opts, "", e,