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 BD6AA431EE for ; Tue, 18 Jan 2022 10:25:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 594FA68B00D; Tue, 18 Jan 2022 12:25:20 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA18968A8DB for ; Tue, 18 Jan 2022 12:25:13 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 46AF724017C for ; Tue, 18 Jan 2022 11:25:13 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id tteXMgyPUeH2 for ; Tue, 18 Jan 2022 11:25:12 +0100 (CET) Received: from lain.red.khirnov.net (lain.red.khirnov.net [IPv6:2001:67c:1138:4306::3]) (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 "lain.red.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 92663240179 for ; Tue, 18 Jan 2022 11:25:12 +0100 (CET) Received: by lain.red.khirnov.net (Postfix, from userid 1000) id 701E516008E; Tue, 18 Jan 2022 11:25:12 +0100 (CET) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CPR3PR03MB66650A61EB6F4B354F43C07C8F589=40PR3PR03MB?= =?utf-8?q?6665=2Eeurprd03=2Eprod=2Eoutlook=2Ecom=3E?= References: <20220111095830.31542-1-anton@khirnov.net> <20220111095830.31542-24-anton@khirnov.net> =?utf-8?q?=3CAM7PR03MB666035380?= =?utf-8?q?325BF0AF158A2828F539=40AM7PR03MB6660=2Eeurprd03=2Eprod=2Eoutlook?= =?utf-8?q?=2Ecom=3E?= <164250101626.23111.15871136514402468182@lain.red.khirnov.net> =?utf-8?q??= =?utf-8?q?=3CPR3PR03MB66650A61EB6F4B354F43C07C8F589=40PR3PR03MB6665=2Eeurpr?= =?utf-8?q?d03=2Eprod=2Eoutlook=2Ecom=3E?= Mail-Followup-To: FFmpeg development discussions and patches Date: Tue, 18 Jan 2022 11:25:12 +0100 Message-ID: <164250151234.23111.15082993172705566767@lain.red.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 24/28] ffmpeg_mux: drop a useless check and reduce indentation 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: Quoting Andreas Rheinhardt (2022-01-18 11:18:24) > Anton Khirnov: > > Quoting Andreas Rheinhardt (2022-01-13 11:54:59) > >> Anton Khirnov: > >>> do_video_stats() is only ever called for video. > >>> --- > >>> fftools/ffmpeg_mux.c | 42 ++++++++++++++++++++---------------------- > >>> 1 file changed, 20 insertions(+), 22 deletions(-) > >>> > >>> diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c > >>> index 76d9d4b9c4..8a64661c9c 100644 > >>> --- a/fftools/ffmpeg_mux.c > >>> +++ b/fftools/ffmpeg_mux.c > >>> @@ -72,31 +72,29 @@ static void do_video_stats(OutputStream *ost, int frame_size) > >>> } > >>> > >>> enc = ost->enc_ctx; > >>> - if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { > >>> - frame_number = ost->st->nb_frames; > >>> - if (vstats_version <= 1) { > >>> - fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, > >>> - ost->quality / (float)FF_QP2LAMBDA); > >>> - } else { > >>> - fprintf(vstats_file, "out= %2d st= %2d frame= %5d q= %2.1f ", ost->file_index, ost->index, frame_number, > >>> - ost->quality / (float)FF_QP2LAMBDA); > >>> - } > >>> + frame_number = ost->st->nb_frames; > >>> + if (vstats_version <= 1) { > >>> + fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, > >>> + ost->quality / (float)FF_QP2LAMBDA); > >>> + } else { > >>> + fprintf(vstats_file, "out= %2d st= %2d frame= %5d q= %2.1f ", ost->file_index, ost->index, frame_number, > >>> + ost->quality / (float)FF_QP2LAMBDA); > >>> + } > >>> > >>> - 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))); > >>> + 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); > >>> - /* compute pts value */ > >>> - ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base); > >>> - if (ti1 < 0.01) > >>> - ti1 = 0.01; > >>> + fprintf(vstats_file,"f_size= %6d ", frame_size); > >>> + /* compute pts value */ > >>> + ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base); > >>> + if (ti1 < 0.01) > >>> + ti1 = 0.01; > >>> > >>> - bitrate = (frame_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); > >>> - fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(ost->pict_type)); > >>> - } > >>> + bitrate = (frame_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); > >>> + fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(ost->pict_type)); > >>> } > >>> > >>> static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream, OSTFinished others) > >>> > >> > >> LGTM to removing the check, but it would be better if you removed the > >> check before moving the code to ffmpeg_mux.c and then fixed the > >> indentation while moving the code to ffmpeg_mux.c. > > > > Better why? What's the point of essentially re-doing these commits and > > dealing with rebase conflicts, just to get the same result in the end? > > > > A smaller diff. Doesn't seem worth the trouble. git show -w is already just two lines. -- Anton Khirnov _______________________________________________ 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".