From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5139F491A3 for ; Wed, 6 Mar 2024 11:06:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 211DF68CCE7; Wed, 6 Mar 2024 13:05:34 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 76EF568BE7C for ; Wed, 6 Mar 2024 13:05:30 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=dSpEQDGo; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id E92584D48 for ; Wed, 6 Mar 2024 12:05:25 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id EECuZOC2G8Ey for ; Wed, 6 Mar 2024 12:05:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1709723123; bh=tiqBXmuPxXRuF0dNM20HTUqfTagojYHtn+rlxEpfHM8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dSpEQDGo6NPB64KqX1C75EJSufME8EaGJ2gXQyXeKHOwTeVAryRdAQPDFWNiYcHJS WWyYannz0a714RYvuVUKuZedEZemvnp5ISBXwo1vPdl4fBKM75FxDJv27o6O4OnZAi 406n3opuffrzYS3SYG0Avs7hH6Fruvdk+gStrmz7lgQmlFNoYy0JOKij1xR90Pi61q VKHr/mCR8u9IZjbybWTu5vtYBjn0Eqwxrke2pj6f70qSlZCShnu5G6YNCYPveybTfF /YOcMpjr1PzzO1P7ARaIVvpeMa43qXufHgglJWXJ3k5/rVNUS+CEErvr8rvzZu+5Aq V+4LZGVlAvnvw== 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 mail1.khirnov.net (Postfix) with ESMTPS id 0C1014D59 for ; Wed, 6 Mar 2024 12:05:23 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 004CA3A0357 for ; Wed, 6 Mar 2024 12:05:23 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 6 Mar 2024 12:03:12 +0100 Message-ID: <20240306110319.17339-11-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240306110319.17339-1-anton@khirnov.net> References: <20240306110319.17339-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/18] fftools/ffmpeg_enc: drop unnecessary parameter from forced_kf_apply() 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Encoder timebase is equal to the frame timebase, so does not need to be passed separately. Also, rename in_picture to frame, which is shorter and more accurate - it always contains a frame, never a field. --- fftools/ffmpeg_enc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c index 1ddef46d03..f0a17228fe 100644 --- a/fftools/ffmpeg_enc.c +++ b/fftools/ffmpeg_enc.c @@ -746,16 +746,16 @@ static int do_audio_out(OutputFile *of, OutputStream *ost, } static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf, - AVRational tb, const AVFrame *in_picture) + const AVFrame *frame) { double pts_time; if (kf->ref_pts == AV_NOPTS_VALUE) - kf->ref_pts = in_picture->pts; + kf->ref_pts = frame->pts; - pts_time = (in_picture->pts - kf->ref_pts) * av_q2d(tb); + pts_time = (frame->pts - kf->ref_pts) * av_q2d(frame->time_base); if (kf->index < kf->nb_pts && - av_compare_ts(in_picture->pts, tb, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) { + av_compare_ts(frame->pts, frame->time_base, kf->pts[kf->index], AV_TIME_BASE_Q) >= 0) { kf->index++; goto force_keyframe; } else if (kf->pexpr) { @@ -780,7 +780,7 @@ static enum AVPictureType forced_kf_apply(void *logctx, KeyframeForceCtx *kf, kf->expr_const_values[FKF_N_FORCED] += 1; goto force_keyframe; } - } else if (kf->type == KF_FORCE_SOURCE && (in_picture->flags & AV_FRAME_FLAG_KEY)) { + } else if (kf->type == KF_FORCE_SOURCE && (frame->flags & AV_FRAME_FLAG_KEY)) { goto force_keyframe; } @@ -801,7 +801,7 @@ static int do_video_out(OutputFile *of, OutputStream *ost, return AVERROR_EOF; in_picture->quality = enc->global_quality; - in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture); + in_picture->pict_type = forced_kf_apply(ost, &ost->kf, in_picture); #if FFMPEG_OPT_TOP if (ost->top_field_first >= 0) { -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".