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 BE09244169 for ; Fri, 27 Jan 2023 14:39:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5981668BE16; Fri, 27 Jan 2023 16:39:40 +0200 (EET) Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3659C68BCCE for ; Fri, 27 Jan 2023 16:39:33 +0200 (EET) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 30REdVaq028266 for ; Fri, 27 Jan 2023 15:39:31 +0100 Received: by phare.normalesup.org (Postfix, from userid 1001) id 1D86FEB5BC; Fri, 27 Jan 2023 15:39:31 +0100 (CET) Date: Fri, 27 Jan 2023 15:39:31 +0100 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: References: <20230127131639.4928-1-anton@khirnov.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230127131639.4928-1-anton@khirnov.net> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Fri, 27 Jan 2023 15:39:31 +0100 (CET) Subject: Re: [FFmpeg-devel] [PATCH 1/4] lavfi/framesync: use a local variable to shorten code 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: Anton Khirnov (12023-01-27): > --- > libavfilter/framesync.c | 33 ++++++++++++++++----------------- > 1 file changed, 16 insertions(+), 17 deletions(-) > > diff --git a/libavfilter/framesync.c b/libavfilter/framesync.c > index ee91e4cf68..153db4fa21 100644 > --- a/libavfilter/framesync.c > +++ b/libavfilter/framesync.c > @@ -201,24 +201,23 @@ static int framesync_advance(FFFrameSync *fs) > break; > } > for (i = 0; i < fs->nb_in; i++) { > - if (fs->in[i].pts_next == pts || > - (fs->in[i].ts_mode == TS_NEAREST && > - fs->in[i].have_next && > - fs->in[i].pts_next != INT64_MAX && fs->in[i].pts != AV_NOPTS_VALUE && > - fs->in[i].pts_next - pts < pts - fs->in[i].pts) || > - (fs->in[i].before == EXT_INFINITY && > - fs->in[i].state == STATE_BOF)) { > - av_frame_free(&fs->in[i].frame); > - fs->in[i].frame = fs->in[i].frame_next; > - fs->in[i].pts = fs->in[i].pts_next; > - fs->in[i].frame_next = NULL; > - fs->in[i].pts_next = AV_NOPTS_VALUE; > - fs->in[i].have_next = 0; > - fs->in[i].state = fs->in[i].frame ? STATE_RUN : STATE_EOF; > - if (fs->in[i].sync == fs->sync_level && fs->in[i].frame) > + FFFrameSyncIn * const in = &fs->in[i]; Get rid of the const, since the rest of this code does not use anything similar and the benefit is dubious. > + > + if (in->pts_next == pts || > + (in->ts_mode == TS_NEAREST && in->have_next && > + in->pts_next != INT64_MAX && in->pts != AV_NOPTS_VALUE && > + in->pts_next - pts < pts - in->pts) || > + (in->before == EXT_INFINITY && in->state == STATE_BOF)) { > + av_frame_free(&in->frame); > + in->frame = in->frame_next; > + in->pts = in->pts_next; > + in->frame_next = NULL; > + in->pts_next = AV_NOPTS_VALUE; > + in->have_next = 0; > + in->state = in->frame ? STATE_RUN : STATE_EOF; > + if (in->sync == fs->sync_level && in->frame) > fs->frame_ready = 1; > - if (fs->in[i].state == STATE_EOF && > - fs->in[i].after == EXT_STOP) > + if (in->state == STATE_EOF && in->after == EXT_STOP) > framesync_eof(fs); > } > } I do not like this change. In fact, the more I think about it the more I remember that I specifically considered using intermediate pointers for inputs and deciding against: too much extra noise if done everywhere, too little benefit for the inconsistency if done only where there are many. So: thanks but no. -- Nicolas George _______________________________________________ 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".