1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
FFmpeg/libswscale
Andreas Rheinhardt 4d7a1a4619 swscale/input: Avoid calls to av_pix_fmt_desc_get()
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). For a simple RGB64LE->YUV420P
transformation like
ffmpeg -f lavfi -i haldclutsrc,format=rgba64le -pix_fmt yuv420p \
-threads 1  -t 1:00  -f null -
the amount of decicycles spent in rgb64LEToUV_half_c
(which is created via the template mentioned above)
decreases from 19751 to 5341; for RGBA64BE the number
went down from 11945 to 5393. For shared builds (where
the call to av_pix_fmt_desc_get() is indirect) the old numbers
are 15230 for RGBA64BE and 27502 for RGBA64LE, whereas
the numbers with this patch are indistinguishable from
the numbers from a static build.

Also make the macros that are touched conform to the
usual convention of using uppercase names while just at it.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-09-19 23:40:41 +02:00
..
aarch64 swscale/aarch64: add vscale specializations 2022-08-16 13:40:42 +03:00
arm sws: rename SwsContext.swscale to convert_unscaled 2021-07-03 15:57:53 +02:00
loongarch swscale/la: Add output_lasx.c file. 2022-09-10 22:56:39 +02:00
ppc sws: rename SwsContext.swscale to convert_unscaled 2021-07-03 15:57:53 +02:00
tests swscale: introduce isSwappedChroma 2022-01-04 19:39:22 -06:00
x86 swscale/x86/rgb_2_rgb: Empty MMX state in ff_shuffle_bytes_2103_mmxext 2022-08-23 12:21:00 +02:00
alphablend.c swscale/alphablend: Fix slice handling 2021-10-03 20:38:29 +02:00
bayer_template.c swscale: do not drop half of bits from 16bit bayer formats 2020-08-08 12:03:42 +02:00
gamma.c
half2float.c swscale/input: add rgbaf16 input support 2022-08-19 22:09:36 +02:00
hscale_fast_bilinear.c
hscale.c swscale: add opaque parameter to input functions 2022-08-19 22:09:36 +02:00
input.c swscale/input: Avoid calls to av_pix_fmt_desc_get() 2022-09-19 23:40:41 +02:00
libswscale.v build: Change structure of the linker version script templates 2016-05-29 16:43:11 +02:00
log2_tab.c
Makefile swscale/input: add rgbaf16 input support 2022-08-19 22:09:36 +02:00
options.c Remove unnecessary libavutil/(avutil|common|internal).h inclusions 2022-02-24 12:56:49 +01:00
output.c swscale/output: add support for Y210LE and Y212LE 2022-09-10 12:29:12 -07:00
rgb2rgb_template.c swscale/rgb2rgb_template: use shuffle macro on big-endian arches 2020-12-12 23:07:22 -05:00
rgb2rgb.c swscale/la: Add yuv2rgb_lasx.c and rgb2rgb_lasx.c files 2022-09-10 22:56:38 +02:00
rgb2rgb.h swscale/la: Add yuv2rgb_lasx.c and rgb2rgb_lasx.c files 2022-09-10 22:56:38 +02:00
slice.c swscale/input: add rgbaf16 input support 2022-08-19 22:09:36 +02:00
swscale_internal.h swscale/la: Optimize hscale functions with lasx. 2022-09-10 22:56:38 +02:00
swscale_unscaled.c all: Replace if (ARCH_FOO) checks by #if ARCH_FOO 2022-06-15 04:56:37 +02:00
swscale.c swscale/la: Optimize hscale functions with lasx. 2022-09-10 22:56:38 +02:00
swscale.h Keep including the full version.h when headers are included externally 2022-03-19 00:01:57 +02:00
swscaleres.rc
utils.c swscale/la: Optimize hscale functions with lasx. 2022-09-10 22:56:38 +02:00
version_major.h libswscale: Split version.h 2022-03-16 14:05:26 +02:00
version.c lib*/version: Move library version functions into files of their own 2022-05-10 06:49:32 +02:00
version.h swscale/output: add support for Y210LE and Y212LE 2022-09-10 12:29:12 -07:00
vscale.c Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
yuv2rgb.c swscale/la: Add yuv2rgb_lasx.c and rgb2rgb_lasx.c files 2022-09-10 22:56:38 +02:00