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 2AB0B45228 for ; Sun, 16 Apr 2023 11:12:58 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C458368BC3C; Sun, 16 Apr 2023 14:12:55 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 59E7C680105 for ; Sun, 16 Apr 2023 14:12:48 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 703BF1BF206 for ; Sun, 16 Apr 2023 11:12:47 +0000 (UTC) Date: Sun, 16 Apr 2023 13:12:46 +0200 From: Michael Niedermayer To: ffmpeg-devel@ffmpeg.org Message-ID: <20230416111246.GB275136@pb2> References: <20210722065241.EDF5A4116B4@natalya.videolan.org> MIME-Version: 1.0 In-Reply-To: <20210722065241.EDF5A4116B4@natalya.videolan.org> 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: multipart/mixed; boundary="===============6070832861752276583==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6070832861752276583== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1LKvkjL3sHcu1TtY" Content-Disposition: inline --1LKvkjL3sHcu1TtY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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| [0f168344f1034c84fe85c4a8c3b5638bd4b= a9931] | committer: Andreas Rheinhardt >=20 > avcodec/adpcm: Disable dead code >=20 > This change ensures that the linker can drop adpcm_data.o if no decoder > that actually uses anything from there is enabled. >=20 > Signed-off-by: Andreas Rheinhardt >=20 > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=3Dcommit;h=3D0f168344f= 1034c84fe85c4a8c3b5638bd4ba9931 > --- >=20 > libavcodec/adpcm.c | 212 +++++++++++++++++++++++++++--------------------= ------ > 1 file changed, 108 insertions(+), 104 deletions(-) >=20 > 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/ > */ > =20 > +#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] =3D { > { 0, 0 }, > @@ -821,8 +833,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetB= yteContext *gb, > buf_size =3D FFMIN(buf_size, avctx->block_align); > nb_samples =3D (buf_size - 4 * ch) * 2 / ch; > break; > - case AV_CODEC_ID_ADPCM_IMA_WAV: > - { > + CASE(ADPCM_IMA_WAV, > int bsize =3D ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sam= ple - 2]; > int bsamples =3D ff_adpcm_ima_block_samples[avctx->bits_per_code= d_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 compil= er 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 go= ne this direction long ago and i cant name one where that made them better, ca= n you? thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras --1LKvkjL3sHcu1TtY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZDvYKQAKCRBhHseHBAsP q/kAAJ95U32CJ/Pk/dEoVHobF7UFxhmxjQCdE7WYd/qSme44JaWcFzOK+R+ZiQk= =akP/ -----END PGP SIGNATURE----- --1LKvkjL3sHcu1TtY-- --===============6070832861752276583== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============6070832861752276583==--