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: > >>> Hi > >>> > >>> On Thu, Sep 08, 2022 at 04:38:11AM +0200, Andreas Rheinhardt wrote: > >>>> Up until now, libswscale/input.c used a macro to read > >>>> an input pixel which involved a call to av_pix_fmt_desc_get() > >>>> to find out whether the input pixel format is BE or LE > >>>> despite this being known at compile-time (there are templates > >>>> per pixfmt). Even worse, these calls are made in a loop, > >>>> so that e.g. there are six calls to av_pix_fmt_desc_get() > >>>> for every pair of UV pixel processed in > >>>> rgb64ToUV_half_c_template(). > >>>> > >>>> This commit modifies these macros to ensure that isBE() > >>>> is evaluated at compile-time. This saved 9743B of .text > >>>> for me (GCC 11.2, -O3). > >>> > >>> hmm, all these functions where supposed to be optimized out > >>> why where they not ? > >>> > >>> iam asking as the code is simpler before your patch if that > >>> "optimization out" thing would work > >>> > >> > >> Why should these functions be optimized out? What would enable the > >> compiler to optimize them out? > > > > Going back into the past, there was > > 6b0768e2021b90215a2ab55ed427bce91d148148 > > > > before this the code certainly did get optimized out, it was just > > #define isBE(x) ((x)&1) > > > > thats simple and clean code btw > > I don't really consider such magic numbers to be clean. no, but that wasnt what i meant what i meant was more that if you can structure an identifer so that it itself can provide alot of the used information from within its structure, that has advanatges over requiring a descriptor table lookup. I didnt mean to suggest that this should use hardcoded litteral numbers and be undocumented and untested. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes