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 B855A43EC9 for ; Fri, 16 Sep 2022 10:58:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2297468BB72; Fri, 16 Sep 2022 13:58:03 +0300 (EEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2CA8B68BB0F for ; Fri, 16 Sep 2022 13:57:56 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 1613B240003 for ; Fri, 16 Sep 2022 10:57:54 +0000 (UTC) Date: Fri, 16 Sep 2022 12:57:54 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220916105754.GT2088045@pb2> References: <166331162401.3205.5905647206678559059@lain.khirnov.net> MIME-Version: 1.0 In-Reply-To: <166331162401.3205.5905647206678559059@lain.khirnov.net> Subject: Re: [FFmpeg-devel] [PATCH 2/2] swscale/input: Avoid calls to av_pix_fmt_desc_get() 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="===============8044005729755465726==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8044005729755465726== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="l/rOZ+Iy8Lnw8x9T" Content-Disposition: inline --l/rOZ+Iy8Lnw8x9T Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 16, 2022 at 09:00:24AM +0200, Anton Khirnov wrote: > Quoting Andreas Rheinhardt (2022-09-09 20:15:22) > > Michael Niedermayer: > > > On Thu, Sep 08, 2022 at 11:44:51PM +0200, Andreas Rheinhardt wrote: > > >> Michael Niedermayer: > > >>> On Thu, Sep 08, 2022 at 09:38:51PM +0200, Andreas Rheinhardt wrote: > > >>>> Michael Niedermayer: > > > [...] > > >>> To me if i look at the evolution > > >>> of isBE() / code checking BE-ness it become more messy over time > > >>> > > >>> I think it would be interresting to think about if we can make > > >>> av_pix_fmt_desc_get(compile time constant) work at compile time. > > >>> or if we maybe can return to a simpler implementation > > >>> > > >> > > >> We could put the av_pix_fmt_descriptors array into an internal header > > >> and use something like > > >> > > >> static av_always_inline const AVPixFmtDescriptor > > >> *ff_pix_fmt_descriptor_get(enum AVPixelFormat fmt) > > >> { > > >> if (av_builtin_constant_p(fmt)) > > >> return &av_pix_fmt_descriptors[fmt]; > > >> return av_pix_fmt_desc_get(fmt); > > >> } > > >=20 > > > yes thats what i was thinking of too. > > >=20 > >=20 > > Seems like Anton is away for a week or so. I am sure he has an opinion > > on the above approach. I think we will wait for him or shall I apply the > > patches as they are given that they do not block any later alternative > > solution? > > (There is one thing I already don't like about the alternative solution: > > It relies on av_builtin_constant_p, which not every compiler supports.) >=20 > For what my opinion is worth, the patch as is with some extra > explanatory comments for the new IS_BE* macros seems like the best > solution to me. They are indeed slightly confusing at first glance, but > quite obvious if you look at the code for two minutes (less for people > smarter than me). And I think few people will need to understand how > precisely they work anyway. i agree, maybe we can solve this by changing the IS_BE* names instead of adding comments. IS_BE, ENDIAN_IDENTIFER,=20 (0,1) , (LE, BE) or something like that, may reduce the need for comments >=20 > The other proposals seem significantly more complex and fragile than > this one. i agree too, though allowing av_pix_fmt_desc_get() to be done at compile time would allow its use in inlined functions and macros much broader so these are not 1:1 comparable as they serve only overlapping goals thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides --l/rOZ+Iy8Lnw8x9T Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYyRWrgAKCRBhHseHBAsP q7sCAJ49EKZCZ53rpMap+LnhlcHZUFoqqgCdGsfAkYh03Y2Bwcp+cYekwA+2kVs= =b18U -----END PGP SIGNATURE----- --l/rOZ+Iy8Lnw8x9T-- --===============8044005729755465726== 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". --===============8044005729755465726==--