Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 2/2] swscale/input: Avoid calls to av_pix_fmt_desc_get()
Date: Fri, 9 Sep 2022 17:52:02 +0200
Message-ID: <20220909155202.GG2088045@pb2> (raw)
In-Reply-To: <GV1P250MB073756CC11B4A80A29AB7BA48F409@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 2179 bytes --]

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

  parent reply	other threads:[~2022-09-09 15:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  2:31 [FFmpeg-devel] [PATCH 1/2] swscale/input: Remove spec-incompliant '; ' Andreas Rheinhardt
2022-09-08  2:38 ` [FFmpeg-devel] [PATCH 2/2] swscale/input: Avoid calls to av_pix_fmt_desc_get() Andreas Rheinhardt
2022-09-08 17:39   ` Michael Niedermayer
2022-09-08 19:38     ` Andreas Rheinhardt
2022-09-08 20:25       ` Michael Niedermayer
2022-09-08 21:44         ` Andreas Rheinhardt
2022-09-09 14:55           ` Michael Niedermayer
2022-09-09 18:15             ` Andreas Rheinhardt
2022-09-10 15:29               ` Michael Niedermayer
2022-09-10 16:34                 ` Andreas Rheinhardt
2022-09-10 17:06                   ` Michael Niedermayer
2022-09-09 15:52           ` Michael Niedermayer [this message]
2022-09-08  3:31 ` [FFmpeg-devel] [PATCH 3/3] swscale/output: Don't call av_pix_fmt_desc_get() in a loop Andreas Rheinhardt
2022-09-16  8:39   ` Paul B Mahol
2022-09-08  3:44 ` [FFmpeg-devel] [PATCH 1/2] swscale/input: Remove spec-incompliant '; ' Philip Langdale
2022-09-16  7:00 [FFmpeg-devel] [PATCH 2/2] swscale/input: Avoid calls to av_pix_fmt_desc_get() Anton Khirnov
2022-09-16 10:57 ` Michael Niedermayer
2022-09-18 20:58   ` Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220909155202.GG2088045@pb2 \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git