From patchwork Wed Jul 11 00:17:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9673 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp4245010jad; Tue, 10 Jul 2018 17:18:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcweC8WQ5NW+Gi3zilbahWudDwhrlIr5Z9SLYgSlvR7vFs3/sRUTYw4ypkcs1OoW/cpNxMT X-Received: by 2002:a1c:6b90:: with SMTP id a16-v6mr15343156wmi.74.1531268311144; Tue, 10 Jul 2018 17:18:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531268311; cv=none; d=google.com; s=arc-20160816; b=WCmvgO+dhzqMdKRL2SNqqqPxIPWhrZCy3AQdzwQAFxjLuh7CxX6NJFmTXH12THL1Gw L54Ui9HqMCJH8MzIFO2SVVWy+xBLfGx2nv0gcKHaJ2oxhpD9lXC4pPcsrP80xu2ZbF01 5S9t9I+hUsXpp3uBUEXkw26oC3Wi8mcIDL+9Y7sQ2ghKPstr8trOMiU5z9QlHkvmVRWE L26CAuRkAbWDxEGaOQvR6/7aSUq6eEDfb4oYvXMgH0UHm8XoVIt7D/s+y4ElrLcUtwAB gnNF7MT1GsvUdHIS8smGaXquTmOsuqnqPRwO4MgwmHs/1+p4WQI4Xvq/zwR57CGRQF4y ZKlA== 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: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:delivered-to:arc-authentication-results; bh=XfZ+g3ez0lumvtqiNqNSTAaA8kqGRCCKXJfKbKZXDQg=; b=HRn2BcvhHgiwnLMCLnqxwqLGd0nEtzdiC6LmKqTzhgbTGJVUHFA/TtLr5HA+546VH+ O/9W4VtN5sO76zT4eDzUAqh6NdFfhwkq7Wl65bmF82RhtQygCrmUWujozBgAa4ewY+qN nCbaN8KU/BeSMAWL/17bzR30CELWKi+jG4hnjmLiKnO17GT5ozbCrSzowwEZSQ/UmArT G6q5Yaj6rCkxWgc9atpn9O6x+eHehiFj762d8EeWVGYppiodilXqT6dDtdL593ESgL49 //Z0ujwNYI/BLTGWu27H9+qIbIiGdkcxu/xEq7VtaKNn0jBYGMDxc3/1i6MkOnT8C6Vv n73g== 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 g8-v6si17723265wrw.125.2018.07.10.17.18.30; Tue, 10 Jul 2018 17:18:31 -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 ED2D068A56C; Wed, 11 Jul 2018 03:18:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2209E68A4B6 for ; Wed, 11 Jul 2018 03:18:02 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fd2pd-0002kw-Hd for ffmpeg-devel@ffmpeg.org; Wed, 11 Jul 2018 02:18:09 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 9CJ41y00S0S5wYM01CJ53H; Wed, 11 Jul 2018 02:18:05 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 11 Jul 2018 02:17:58 +0200 Message-Id: <20180711001758.27132-4-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180711001758.27132-1-michael@niedermayer.cc> References: <20180711001758.27132-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 4/4] avformat/mov: Break out of inner loop early in mov_estimate_video_delay() 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things) Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i /dev/zero -t 24:00:00.00 out.mp4 Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 951a337cca..b0b9fd99cc 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3331,7 +3331,8 @@ static void mov_estimate_video_delay(MOVContext *c, AVStream* st) { if (pts_buf[j] < pts_buf[r]) { FFSWAP(int64_t, pts_buf[j], pts_buf[r]); ++num_swaps; - } + } else + break; j = r; } st->codecpar->video_delay = FFMAX(st->codecpar->video_delay, num_swaps);