From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v2 2/2] swscale/output: Don't call av_pix_fmt_desc_get() in a loop
Date: Mon, 19 Sep 2022 16:36:34 +0200
Message-ID: <AS8P250MB0744ACEE913D224D6BA47ED28F4D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20220919143435.GI2088045@pb2>
Michael Niedermayer:
> On Fri, Sep 16, 2022 at 04:55:39PM +0200, Andreas Rheinhardt wrote:
>> Up until now, libswscale/output.c used a macro to write
>> an output 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 eight calls to av_pix_fmt_desc_get()
>> for every pixel processed in yuv2rgba64_X_c_template()
>> for 64bit RGB formats.
>>
>> This commit modifies these macros to ensure that isBE()
>> is evaluated at compile-time. This saved 41184B of .text
>> for me (GCC 11.2, -O3). Of course, it also improved performance.
>> E.g. ffmpeg_g -f lavfi -i testsrc2,format=yuva420p -pix_fmt rgba64le \
>> -threads 1 -t 1:00 -f null - (which uses yuv2rgba64le_X_c,
>> which is an invocation of yuv2rgba64_X_c_template() mentioned above),
>> performance improved from 95589 to 41387 decicycles for one call
>> to yuv2packedX; for the be variant the numbers went down from
>> 76087 to 43024 decicycles.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> libswscale/output.c | 100 +++++++++++++++++++++++++-------------------
>> 1 file changed, 58 insertions(+), 42 deletions(-)
>
> This looks alot better than before
>
> thx
>
> PS: i still think that broader support for compile time evaluation of
> "pure" functions would be usefull. Ideally with minimal mess on the source
> side, more on the build tool side
>
I agree with that. Hopefully we find a solution.
- Andreas
_______________________________________________
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".
next prev parent reply other threads:[~2022-09-19 14:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-16 14:52 [FFmpeg-devel] [PATCH v2 1/2] swscale/input: Avoid calls to av_pix_fmt_desc_get() Andreas Rheinhardt
2022-09-16 14:55 ` [FFmpeg-devel] [PATCH v2 2/2] swscale/output: Don't call av_pix_fmt_desc_get() in a loop Andreas Rheinhardt
2022-09-19 14:34 ` Michael Niedermayer
2022-09-19 14:36 ` Andreas Rheinhardt [this message]
2022-09-19 14:32 ` [FFmpeg-devel] [PATCH v2 1/2] swscale/input: Avoid calls to av_pix_fmt_desc_get() 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=AS8P250MB0744ACEE913D224D6BA47ED28F4D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--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