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 0F0FB43EB1 for ; Fri, 16 Sep 2022 07:00:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2EDC668BBD3; Fri, 16 Sep 2022 10:00:39 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 00A8D68B9B7 for ; Fri, 16 Sep 2022 10:00:32 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 57ED6240D03 for ; Fri, 16 Sep 2022 09:00:32 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Kj-8VsSCWUa4 for ; Fri, 16 Sep 2022 09:00:27 +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 CCD65240175 for ; Fri, 16 Sep 2022 09:00:27 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 099CF1601B2; Fri, 16 Sep 2022 09:00:24 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: =?utf-8?q?=3CAS8P250MB074461184845002090B2E5678F439=40AS8P250MB?= =?utf-8?q?0744=2EEURP250=2EPROD=2EOUTLOOK=2ECOM=3E?= References: =?utf-8?q?=3CGV1P250MB07370A2874066BF522C7670A8F409=40GV1P250MB0?= =?utf-8?q?737=2EEURP250=2EPROD=2EOUTLOOK=2ECOM=3E_=3CGV1P250MB0737CDE238A6D?= =?utf-8?q?1F2FB8A9F4E8F409=40GV1P250MB0737=2EEURP250=2EPROD=2EOUTLOOK=2ECOM?= =?utf-8?q?=3E_=3C20220908173911=2EGA2088045=40pb2=3E_=3CGV1P250MB073757036A?= =?utf-8?q?A8EB093431B0858F409=40GV1P250MB0737=2EEURP250=2EPROD=2EOUTLOOK=2E?= =?utf-8?q?COM=3E_=3C20220908202528=2EGB2088045=40pb2=3E_=3CGV1P250MB073756C?= =?utf-8?q?C11B4A80A29AB7BA48F409=40GV1P250MB0737=2EEURP250=2EPROD=2EOUTLOOK?= =?utf-8?q?=2ECOM=3E_=3C20220909145558=2EGE2088045=40pb2=3E_=3CAS8P250MB0744?= =?utf-8?q?61184845002090B2E5678F439=40AS8P250MB0744=2EEURP250=2EPROD=2EOUTL?= =?utf-8?q?OOK=2ECOM=3E?= Mail-Followup-To: FFmpeg development discussions and patches Date: Fri, 16 Sep 2022 09:00:24 +0200 Message-ID: <166331162401.3205.5905647206678559059@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 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: 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-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); > >> } > > > > yes thats what i was thinking of too. > > > > 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.) 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. The other proposals seem significantly more complex and fragile than this one. -- 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".