• Andreas Rheinhardt's avatar
    swscale/output: Don't call av_pix_fmt_desc_get() in a loop · 888a02a1
    Andreas Rheinhardt authored
    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.
    Reviewed-by: 's avatarAnton Khirnov <anton@khirnov.net>
    Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
    Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
    888a02a1
Name
Last commit
Last update
..
aarch64 Loading commit data...
arm Loading commit data...
loongarch Loading commit data...
ppc Loading commit data...
tests Loading commit data...
x86 Loading commit data...
Makefile Loading commit data...
alphablend.c Loading commit data...
bayer_template.c Loading commit data...
gamma.c Loading commit data...
half2float.c Loading commit data...
hscale.c Loading commit data...
hscale_fast_bilinear.c Loading commit data...
input.c Loading commit data...
libswscale.v Loading commit data...
log2_tab.c Loading commit data...
options.c Loading commit data...
output.c Loading commit data...
rgb2rgb.c Loading commit data...
rgb2rgb.h Loading commit data...
rgb2rgb_template.c Loading commit data...
slice.c Loading commit data...
swscale.c Loading commit data...
swscale.h Loading commit data...
swscale_internal.h Loading commit data...
swscale_unscaled.c Loading commit data...
swscaleres.rc Loading commit data...
utils.c Loading commit data...
version.c Loading commit data...
version.h Loading commit data...
version_major.h Loading commit data...
vscale.c Loading commit data...
yuv2rgb.c Loading commit data...