From patchwork Tue Jan 11 09:58:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 33224 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:cd86:0:0:0:0:0 with SMTP id d128csp3547282iog; Tue, 11 Jan 2022 02:02:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJydXe6Kk740nrV7nNCHm8wn0q96a5kqbVEBaVh6Sde2ZNCRMSf+u+UV2x7iN0C/HgqmEfP5 X-Received: by 2002:aa7:d988:: with SMTP id u8mr3569679eds.287.1641895368389; Tue, 11 Jan 2022 02:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1641895368; cv=none; d=google.com; s=arc-20160816; b=lC+gof7fKhWgNV7nEPgIeZfZnIfMjHyE/eMiTY9iardVX8ngSvQfLYikyikb3pq/GL /6+jwUIjl+sBg2d1kds3fp+g9kuIfcHnoydJ4avMG4SBlqv7wW1+2M9EmMClhECGUUdM 0wqrg+HDRyhD053FcDk7P/HLwziJVc3doN6xx/fVO8vFdbh9YURgE/L5ues1Nf5fUYgB WHQoACra5PtZ/IP7deEmy/3OO51n+xvjvDbxu+KqzAXaKX1m7SK+Tq75tKPXMq2IshPC ew0HV7n+GGtpHDW9y2kWgFfPXbIQFTPF2m8XE/5GuEVoyeb3+xho5Z+5nKO4n35Q2viY vyag== 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=FF/wPh4AWN72TE3Ax47GLegqXULWKPrDNenFzEpOARE=; b=bdw/5ftww/WaQNmuDXkmqoqyV4yilEl0cPG/sEc8HgqhFSwt1nZhGxRbJWZpLmZpnN A8S+p8dBHxRkGfI4CIkesK2wRJqBzBMH+YXZuIJpxk+cFYBZWA9K4L42TRykjNAGC5uP 4TVFZ9NrZXfiZRQCm9s3gNz2vpkn9BeXBTEYfsQSgv+CuMC7WzziYtmZLUxujbOe6imA OuNRFZ4vB0k9PJZlTATblyuykg/z8+IJGos+EgLBkp9/J2qXyoUQGvBeAv4b1hLVZzNO 7w76aTdOg8pRsunVxA+IJ06A1/rxTzShspREZ6XodYB2wxh3dN7e4leBmMSme2dl+Tnh bwIg== 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 l26si4195085edr.30.2022.01.11.02.02.48; Tue, 11 Jan 2022 02:02:48 -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 9870468AFFB; Tue, 11 Jan 2022 11:59:30 +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 2ACC268AF5C for ; Tue, 11 Jan 2022 11:59:15 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id D1A0E240179 for ; Tue, 11 Jan 2022 10:59:14 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id hcn_AbhfF5Ue for ; Tue, 11 Jan 2022 10:59:14 +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 F0BFB240691 for ; Tue, 11 Jan 2022 10:59:02 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 43E763A0D4A; Tue, 11 Jan 2022 10:59:02 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 10:58:28 +0100 Message-Id: <20220111095830.31542-26-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220111095830.31542-1-anton@khirnov.net> References: <20220111095830.31542-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 26/28] ffmpeg_mux: stop using av_stream_get_end_pts() in do_video_stats() 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: EoRBRwyueu0O It retrieves libavformat's internal dts value (contrary to the function's name), which is not necessary here because we can access the packet directly. --- fftools/ffmpeg_mux.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index ef6b7ddd97..54020880eb 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -56,7 +56,7 @@ struct Muxer { static int want_sdp = 1; -static void do_video_stats(OutputStream *ost, int frame_size) +static void do_video_stats(OutputStream *ost, const AVPacket *pkt) { AVCodecContext *enc; int frame_number; @@ -84,13 +84,13 @@ static void do_video_stats(OutputStream *ost, int frame_size) if (ost->error[0]>=0 && (enc->flags & AV_CODEC_FLAG_PSNR)) fprintf(vstats_file, "PSNR= %6.2f ", psnr(ost->error[0] / (enc->width * enc->height * 255.0 * 255.0))); - fprintf(vstats_file,"f_size= %6d ", frame_size); + fprintf(vstats_file,"f_size= %6d ", pkt->size); /* compute pts value */ - ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base); + ti1 = pkt->dts * av_q2d(ost->st->time_base); if (ti1 < 0.01) ti1 = 0.01; - bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; + bitrate = (pkt->size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate); @@ -223,7 +223,7 @@ static void write_packet(OutputFile *of, OutputStream *ost, AVPacket *pkt) if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && ost->encoding_needed && vstats_filename) - do_video_stats(ost, pkt->size); + do_video_stats(ost, pkt); pkt->stream_index = ost->index;