From patchwork Wed Jan 4 16:42:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39869 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp8942324pzb; Wed, 4 Jan 2023 08:46:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuBsRE1nVvzTwxn1FmAmD8XIkBkiaKAyGCQnH577o5j72g5228fWRVhWfA3oX6cQWdLidhw X-Received: by 2002:a50:d5d7:0:b0:46f:860d:3ff1 with SMTP id g23-20020a50d5d7000000b0046f860d3ff1mr42644142edj.7.1672850776806; Wed, 04 Jan 2023 08:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672850776; cv=none; d=google.com; s=arc-20160816; b=IulYyNKQ4KJbqcCGxOsqDvjnyapYjrLBwYpaAh3InzJFvak3OJXxZLcnGb33CH/nFv GBYzDNUvcL6Qo0QVXDHBv9x8yVmw60vTRAD1EL8YfAvL1XSeiuLWnQfssTikUUFyCjUX qYTmjF51BYKuomh4HL6+crHdfc77J68v0oy48kHTaTqTbQnQNi7sPf29F4YG8mpuXWKY fnPLPbTJ7pK1VHwA5otHtyzN6TOnDPgKdXHLkNwzUinjLVbDxfy+zqPXBWerTz29JGm9 +DvCuTkSRhr1pVtiexPwvHLMK7rwLQp6HH1bOhT5GJT9jdo6LG01Po2d9vLupcHlWMe2 3PNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=B7tTgCNsWlBEoe4Yb/juuvNxXo9Zd9XsdoJybMCJwbU=; b=SRDKMY+CBRtRxn2H+fNkF73wmHT/u3HH3WK2Kafg4mNOJCoVMLZZI8I8t+7AH4W6q8 wnyCVAgIcOLRSHWbO6RqFyAhpWk2whAYkxZchZZ9qJ4/Qsq/RH0kfNqEMtdxlZx2hWNR IQA6QGoyzForHa36+TZUKQ2zuxVTEgJTrJubIfPML8GeG0kh5yZk24deW+v0ujcNN7hj aidngapFxImOXaukQXdMLJdgAf4jxMY+X7Wif4tCM3vKnWSH6XJ6gEdYuSFegLdCCCH3 UEWm8l1e1a8mV/Yt4uYpNqa2pGsTy5kgx8uA4UFbNdWFO+p8C8jI1I3VtQHHD7ObF2jP 5GVA== 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 z2-20020a50eb42000000b0047338d1bfabsi28117072edp.164.2023.01.04.08.46.16; Wed, 04 Jan 2023 08:46:16 -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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4707768BCAF; Wed, 4 Jan 2023 18:45:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CD52C68BCFA for ; Wed, 4 Jan 2023 18:45:24 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 303002405F9 for ; Wed, 4 Jan 2023 17:45:22 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id pWWwpvAdEIAI for ; Wed, 4 Jan 2023 17:45:20 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 9A27F2405EC for ; Wed, 4 Jan 2023 17:45:18 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id B5AF53A035B for ; Wed, 4 Jan 2023 17:45:10 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Jan 2023 17:42:44 +0100 Message-Id: <20230104164246.6133-6-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230104164246.6133-1-anton@khirnov.net> References: <20230104164246.6133-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/8] fftools/ffmpeg: reindent after previous commit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gSXUCJ2Yn6gM --- fftools/ffmpeg.c | 116 +++++++++++++++++++++++------------------------ 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 04de57e41e..f722ae7632 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1040,67 +1040,67 @@ static void video_sync_process(OutputFile *of, OutputStream *ost, { double delta0, delta; - double sync_ipts = adjust_frame_pts_to_encoder_tb(of, ost, next_picture); - /* delta0 is the "drift" between the input frame (next_picture) and - * where it would fall in the output. */ - delta0 = sync_ipts - ost->next_pts; - delta = delta0 + duration; - - // tracks the number of times the PREVIOUS frame should be duplicated, - // mostly for variable framerate (VFR) - *nb_frames_prev = 0; - /* by default, we output a single frame */ - *nb_frames = 1; - - if (delta0 < 0 && - delta > 0 && - ost->vsync_method != VSYNC_PASSTHROUGH && - ost->vsync_method != VSYNC_DROP) { - if (delta0 < -0.6) { - av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0); - } else - av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion by %f\n", -delta0); - sync_ipts = ost->next_pts; - duration += delta0; - delta0 = 0; - } + double sync_ipts = adjust_frame_pts_to_encoder_tb(of, ost, next_picture); + /* delta0 is the "drift" between the input frame (next_picture) and + * where it would fall in the output. */ + delta0 = sync_ipts - ost->next_pts; + delta = delta0 + duration; + + // tracks the number of times the PREVIOUS frame should be duplicated, + // mostly for variable framerate (VFR) + *nb_frames_prev = 0; + /* by default, we output a single frame */ + *nb_frames = 1; + + if (delta0 < 0 && + delta > 0 && + ost->vsync_method != VSYNC_PASSTHROUGH && + ost->vsync_method != VSYNC_DROP) { + if (delta0 < -0.6) { + av_log(NULL, AV_LOG_VERBOSE, "Past duration %f too large\n", -delta0); + } else + av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion by %f\n", -delta0); + sync_ipts = ost->next_pts; + duration += delta0; + delta0 = 0; + } - switch (ost->vsync_method) { - case VSYNC_VSCFR: - if (ost->vsync_frame_number == 0 && delta0 >= 0.5) { - av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0)); - delta = duration; - delta0 = 0; - ost->next_pts = llrint(sync_ipts); - } - case VSYNC_CFR: - // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c - if (frame_drop_threshold && delta < frame_drop_threshold && ost->vsync_frame_number) { - *nb_frames = 0; - } else if (delta < -1.1) - *nb_frames = 0; - else if (delta > 1.1) { - *nb_frames = llrintf(delta); - if (delta0 > 1.1) - *nb_frames_prev = llrintf(delta0 - 0.6); - } - next_picture->duration = 1; - break; - case VSYNC_VFR: - if (delta <= -0.6) - *nb_frames = 0; - else if (delta > 0.6) - ost->next_pts = llrint(sync_ipts); - next_picture->duration = duration; - break; - case VSYNC_DROP: - case VSYNC_PASSTHROUGH: - next_picture->duration = duration; + switch (ost->vsync_method) { + case VSYNC_VSCFR: + if (ost->vsync_frame_number == 0 && delta0 >= 0.5) { + av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta0)); + delta = duration; + delta0 = 0; ost->next_pts = llrint(sync_ipts); - break; - default: - av_assert0(0); } + case VSYNC_CFR: + // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c + if (frame_drop_threshold && delta < frame_drop_threshold && ost->vsync_frame_number) { + *nb_frames = 0; + } else if (delta < -1.1) + *nb_frames = 0; + else if (delta > 1.1) { + *nb_frames = llrintf(delta); + if (delta0 > 1.1) + *nb_frames_prev = llrintf(delta0 - 0.6); + } + next_picture->duration = 1; + break; + case VSYNC_VFR: + if (delta <= -0.6) + *nb_frames = 0; + else if (delta > 0.6) + ost->next_pts = llrint(sync_ipts); + next_picture->duration = duration; + break; + case VSYNC_DROP: + case VSYNC_PASSTHROUGH: + next_picture->duration = duration; + ost->next_pts = llrint(sync_ipts); + break; + default: + av_assert0(0); + } } static enum AVPictureType forced_kf_apply(KeyframeForceCtx *kf, AVRational tb,