From patchwork Sat Nov 26 08:19:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 39460 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp6013548pzb; Sat, 26 Nov 2022 00:21:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf4RG9dSGKui9hynOmmgwvkSRZYK2e73lh76TZ6S0s9LoXlbyczhn3Y9uTWL77VDzAWspnxd X-Received: by 2002:a05:6402:520a:b0:459:4c7b:e852 with SMTP id s10-20020a056402520a00b004594c7be852mr26782151edd.347.1669450864987; Sat, 26 Nov 2022 00:21:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669450864; cv=none; d=google.com; s=arc-20160816; b=dQ8e5ZSIeLlelqaOTvlFTTHsod1Gy5L46RScAcTj+2hEoh0SancRxcPflIGVZXxrh1 eNLP71Oi7tSXGSTabK/YnXVRSvZ3OXdguzOVmecmdP1eagR34yB6YtYMis7flX8/Vylr 7qswVQbretkZpDu5OxoAsE7/5padPrIwl4vg3wxs8mYZSeD9JJZrLbnVQbNA8ARNpC34 W9FoArkE9Wzw/ZFUnsEXVLud85L9L1A6H6Jh2CoHxOGkH0ljjGz2PFnFrcybCmMUAMA5 5fVG58EcFjiY7gCdVT41lZibz/cXCSOcyC7Fff55xE4ovcaoT6+jFG/PDBK+QwDTaxjg fdAw== 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=RW/8+RW5pi74BJ7L/dF5yh1dPxsMXZzp+uyI6kBDIjQ=; b=CliCI0nChHyMoxbfb8v7qFqK4BTzIfj1AD0Ss8oDE9WQV4pyLThSTjFFyDaJ/5F4Za Y5RYVpmBqLwr4apWd7L5ZPaKuUBq66Hz7YaCbw0fshPbl+rKVsT2YhSkdNCKZMuVyHLV 0nLCSGoLaIYHNzx06DX6mv7CSSlm6YAhGczuXahMk0HYBJwM+6PVyV3/0DcbK7GDYDsM j9wIJcOa6F+WU7q6ou7ucw+XsYYKU4jaAAW3OUVsJKrJ1EoRT+PAGQamAe4w5XpGA9us 0niVUeO5g7yTPxrfnFaTd8EFka7rUsM4qYwBrkFg2cxFV273fnkn7gpFXrXCNYwCKYTT JFig== 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 z63-20020a509e45000000b004643d19e32esi5749284ede.618.2022.11.26.00.21.04; Sat, 26 Nov 2022 00:21:04 -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 3F07068BA98; Sat, 26 Nov 2022 10:19:41 +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 7663768B914 for ; Sat, 26 Nov 2022 10:19:30 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 010582406CB for ; Sat, 26 Nov 2022 09:19:28 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id f0DD5kE0LTvh for ; Sat, 26 Nov 2022 09:19:27 +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 D6A252406CD for ; Sat, 26 Nov 2022 09:19:23 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C91A53A0102 for ; Sat, 26 Nov 2022 09:19:23 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Nov 2022 09:19:10 +0100 Message-Id: <20221126081911.31275-12-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221126081911.31275-1-anton@khirnov.net> References: <20221126081911.31275-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/13] fftools/ffmpeg: remove a useless inner block 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: vkHZgebtKHO0 adjust_frame_pts_to_encoder_tb() is so small that this serves no useful purpose. --- fftools/ffmpeg.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0128476f57..045cc609b9 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -676,17 +676,18 @@ static double adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost, AVFrame *frame) { double float_pts = AV_NOPTS_VALUE; // this is identical to frame.pts but with higher precision - AVCodecContext *enc = ost->enc_ctx; - AVRational filter_tb = (AVRational){ -1, -1 }; + const int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? + 0 : of->start_time; + + AVCodecContext *const enc = ost->enc_ctx; + + AVRational tb = enc->time_base; + AVRational filter_tb = frame->time_base; + const int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16); + if (frame->pts == AV_NOPTS_VALUE) goto early_exit; - { - int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; - AVRational tb = enc->time_base; - int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16); - filter_tb = frame->time_base; - tb.den <<= extra_bits; float_pts = av_rescale_q(frame->pts, filter_tb, tb) - @@ -699,7 +700,6 @@ static double adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost, av_rescale_q(frame->pts, filter_tb, enc->time_base) - av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base); frame->time_base = enc->time_base; - } early_exit: