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 EC05745EC8 for ; Mon, 17 Apr 2023 11:06:34 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 10F7A68BE02; Mon, 17 Apr 2023 14:06:31 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4E3AF689C13 for ; Mon, 17 Apr 2023 14:06:25 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E59E72404EE for ; Mon, 17 Apr 2023 13:06:24 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id m20XWtqK4wz4 for ; Mon, 17 Apr 2023 13:06:20 +0200 (CEST) Received: from lain.khirnov.net (lain.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.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 059312404EC for ; Mon, 17 Apr 2023 13:06:20 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id DC55F1601B2; Mon, 17 Apr 2023 13:06:19 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20230416111246.GB275136@pb2> References: <20210722065241.EDF5A4116B4@natalya.videolan.org> <20230416111246.GB275136@pb2> Mail-Followup-To: FFmpeg development discussions and patches Date: Mon, 17 Apr 2023 13:06:19 +0200 Message-ID: <168172957987.3843.3613514529454952820@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/adpcm: Disable dead 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: Quoting Michael Niedermayer (2023-04-16 13:12:46) > On Thu, Jul 22, 2021 at 06:52:40AM +0000, Andreas Rheinhardt wrote: > > ffmpeg | branch: master | Andreas Rheinhardt | Tue Jun 8 18:26:52 2021 +0200| [0f168344f1034c84fe85c4a8c3b5638bd4ba9931] | committer: Andreas Rheinhardt > > > > avcodec/adpcm: Disable dead code > > > > This change ensures that the linker can drop adpcm_data.o if no decoder > > that actually uses anything from there is enabled. > > > > Signed-off-by: Andreas Rheinhardt > > > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f168344f1034c84fe85c4a8c3b5638bd4ba9931 > > --- > > > > libavcodec/adpcm.c | 212 +++++++++++++++++++++++++++-------------------------- > > 1 file changed, 108 insertions(+), 104 deletions(-) > > > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > > index 79581c863c..886fce9209 100644 > > --- a/libavcodec/adpcm.c > > +++ b/libavcodec/adpcm.c > > @@ -61,6 +61,18 @@ > > * readstr http://www.geocities.co.jp/Playtown/2004/ > > */ > > > > +#define CASE_0(codec_id, ...) > > +#define CASE_1(codec_id, ...) \ > > + case codec_id: \ > > + { __VA_ARGS__ } \ > > + break; > > +#define CASE_2(enabled, codec_id, ...) \ > > + CASE_ ## enabled(codec_id, __VA_ARGS__) > > +#define CASE_3(config, codec_id, ...) \ > > + CASE_2(config, codec_id, __VA_ARGS__) > > +#define CASE(codec, ...) \ > > + CASE_3(CONFIG_ ## codec ## _DECODER, AV_CODEC_ID_ ## codec, __VA_ARGS__) > > + > > /* These are for CD-ROM XA ADPCM */ > > static const int8_t xa_adpcm_table[5][2] = { > > { 0, 0 }, > > @@ -821,8 +833,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, > > buf_size = FFMIN(buf_size, avctx->block_align); > > nb_samples = (buf_size - 4 * ch) * 2 / ch; > > break; > > - case AV_CODEC_ID_ADPCM_IMA_WAV: > > - { > > + CASE(ADPCM_IMA_WAV, > > int bsize = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2]; > > int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2]; > > if (avctx->block_align > 0) > > This makes the code much harder to debug because the line number shown > by an error or warning is now the line of the macro and not the line number > of the argument of the macro. > The argument is just a multiline blob it from the point of view of a compiler > seems not to be assigned to a problem occuring later after macro expasion. > > I think use of super smart macros is a bad idea. Other big projects have gone > this direction long ago and i cant name one where that made them better, can you? I agree, complex macros make the code much harder to read AND debug and should be avoided whenever possible. -- 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".