From patchwork Mon Jun 5 10:55:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Mark X-Patchwork-Id: 3839 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp1299664vsk; Mon, 5 Jun 2017 03:55:54 -0700 (PDT) X-Received: by 10.28.7.1 with SMTP id 1mr6829541wmh.22.1496660154354; Mon, 05 Jun 2017 03:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496660154; cv=none; d=google.com; s=arc-20160816; b=sIeWQhETOE1ee/GrW+9CDCK5U7mwghH23fupqCor9eRcNBXXy4iqziw9UfMoj9bP3I FRsctSp+nUcb90UHU6l22UGji+9VAuOhtjLhDN8ba4U4DPGY+SsFiCTvzEj5bXetMsQb BMVR4cQz+xylup5akTJbZnVeoBeSq0x4c4NR1iqfGj7xKZ8yEoc9ym2Ng7CezLiJKcgH CbJJSXvnIvcCZVHBq61fiLuincO+ZCcauZ3pJLzPUebqRwthlkSInJ4l3LgGLBdQG5RJ aM0wGWh8tGju9q3YuDu0OhINh9OfGtuRpfWy129Xgtq60EIt9cUuOIpI9NKYYRkCVjsy Ha5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=m3aSgNChPlzZ+Paup2fAdExs5G6TZDiTVTB9Jx/51Sc=; b=B4+HLETI6F0IuH/Y0Ury1Pg5aqDOwT5JUaK3CzRh8JUBcf1UuCIi+LPrnVTP7p2qFq giadxspP57sZwgCZBaGnjFq2TV4fr9VBK6uKTGxECt9gnFwrk8EjRiF+eUD1FqLvaipM d7SXpKAwsdbVaZT59yZdYGJ0a7ekVPnU3RZiw32/mwH/6/yyCsAyF/W5BKRNiUOB/3pq yTaGo27oEB1pCSGLZNq24xVR0mT1LKiLMagbmNhM9wsmdeSQqtExhM7NgqgUzPhEauow GqBDpH3PRkskQpP3cO2NQToid1BRLUyTHmd0BTeiIxzWsemkyxCu0NPbOsagvkQEEAPt 3ZoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 65si12088615wmp.150.2017.06.05.03.55.53; Mon, 05 Jun 2017 03:55:54 -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; dkim=neutral (body hash did not verify) header.i=@gmail.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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 89699689214; Mon, 5 Jun 2017 13:55:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 984266808FC for ; Mon, 5 Jun 2017 13:55:28 +0300 (EEST) Received: by mail-qt0-f195.google.com with SMTP id w1so14762838qtg.0 for ; Mon, 05 Jun 2017 03:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0dOPPXimXxo1m+UdAghUr8dE6n2iRg5CfMTAlATosIs=; b=i4LlW0kh3WmLh6BnciQdRpBJFNXVJVPWxJJ+5Ig/iEU8en6KEGt+YxDUPOkwbEIEqW NcSHyK7vkZGZHwboPkxo5rhnt+9jY3QikVTsBNLHse1pOIrxMWBppbNC7S7Z2ywqZ7ga WHBtYfrH2CN79SJ6xP20ELzYTvjgjpNKODI9T1HKRyFHpHQ+0vznhNHS5hOI55FlcowB a8zM0h9gDcarpMmi49chSQatIcTFLETxp1n5Ai8SRySGgA7iKM1u7vcSYlzsJ1LBT5yO YTmlf8iLT+QYxru0/Mkis+YDKnVwQMmQqct/YX3UMGDwBwYjNZRSPDegAjjAKs2/V6c7 jKaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0dOPPXimXxo1m+UdAghUr8dE6n2iRg5CfMTAlATosIs=; b=CKQ8MDHs0ZdHgYx9hjHCBLurSVv4q9dkJxAlE6AhLufo02OT/3MurDd9UNTazi43nx 77pLqJpe94sn12/M5sOqGtB9zjgP1/nU7GQfVAu0VrkEGb8MMiJ/MENJnO3cbFxK9y4a CJPF9F4GS1r32A7JbiVmEnMHpXzNait6bmX4nucWNiGMHpjy0AgDb7Cqs/1IaYKdAl/5 pXnb2r0uLILP21I9Fow3AwVoQMrnjGt1kGVQYyQSz854YywPi3TDU5+Mhsy4PHGuYXQ4 r5oC2jM5tvf7XGPi0uTLef1AOgwUt6WeGMGDdN4BIg7xax8RC4VOfAUlsMd+LtuLdcYk UFsQ== X-Gm-Message-State: AKS2vOy3uLk66KNaRHcvWqkOlWvgSI2ekmGsEZu3VPkT+oZQF8D+hnDn ZYMXRODRsIq6T7eXoFQ= X-Received: by 10.55.67.82 with SMTP id q79mr23807215qka.18.1496660134198; Mon, 05 Jun 2017 03:55:34 -0700 (PDT) Received: from Klingon.fios-router.home (pool-173-69-140-247.bltmmd.fios.verizon.net. [173.69.140.247]) by smtp.gmail.com with ESMTPSA id p52sm21514795qta.49.2017.06.05.03.55.33 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 05 Jun 2017 03:55:33 -0700 (PDT) From: Kevin Mark To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Jun 2017 06:55:21 -0400 Message-Id: <20170605105521.45420-2-kmark937@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170605105521.45420-1-kmark937@gmail.com> References: <20170605105521.45420-1-kmark937@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] libavfilter/scale2ref: Maintain main input's DAR X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Kevin Mark MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The scale2ref filter will now maintain the DAR of the main input and not the DAR of the reference input. This previous behavior was deemed counterintuitive for most (all?) use-cases. Before: scale2ref=iw/4:ow/mdar in w:320 h:240 fmt:rgb24 sar:1/1 ref w:640 h:360 fmt:rgb24 sar:1/1 out w:160 h:120 fmt:rgb24 sar:4/3 flags:0x2 SAR: ((120 * 640) / (160 * 360)) * (1 / 1) = 4 / 3 DAR: (160 / 120) * (4 / 3) = 16 / 9 (main out now same DAR as ref) Now: scale2ref=iw/4:ow/mdar in w:320 h:240 fmt:rgb24 sar:1/1 ref w:640 h:360 fmt:rgb24 sar:1/1 out w:160 h:120 fmt:rgb24 sar:1/1 flags:0x2 SAR: ((120 * 320) / (160 * 240)) * (1 / 1) = 1 / 1 DAR: (160 / 120) * (1 / 1) = 4 / 3 (main out same DAR as main in) The scale2ref FATE test has also been updated. Signed-off-by: Kevin Mark --- libavfilter/vf_scale.c | 6 +++--- tests/ref/fate/filter-scale2ref_keep_aspect | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 9232bc4439..5e55f9344b 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -337,10 +337,10 @@ static int config_props(AVFilterLink *outlink) } } - if (inlink->sample_aspect_ratio.num){ - outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio); + if (inlink0->sample_aspect_ratio.num){ + outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink0->w, outlink->w * inlink0->h}, inlink0->sample_aspect_ratio); } else - outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; + outlink->sample_aspect_ratio = inlink0->sample_aspect_ratio; if (ctx->filter == &ff_vf_scale2ref) { av_log(ctx, AV_LOG_VERBOSE, "in w:%d h:%d fmt:%s sar:%d/%d\n", diff --git a/tests/ref/fate/filter-scale2ref_keep_aspect b/tests/ref/fate/filter-scale2ref_keep_aspect index ca03277446..8dd0dbb13b 100644 --- a/tests/ref/fate/filter-scale2ref_keep_aspect +++ b/tests/ref/fate/filter-scale2ref_keep_aspect @@ -5,7 +5,7 @@ #media_type 0: video #codec_id 0: rawvideo #dimensions 0: 160x120 -#sar 0: 4/3 +#sar 0: 1/1 #stream#, dts, pts, duration, size, hash 0, 0, 0, 1, 57600, 9a19c23dc3a557786840d0098606d5f1 0, 1, 1, 1, 57600, e6fbdabaf1bb0d28afc648ed4d27e9f0