mirror of
https://github.com/librempeg/librempeg
synced 2024-11-22 18:49:58 +00:00
3312c631bb
Due to hysterical raisins, most RISC-V Linux distributions target a RV64GC baseline excluding the Bit-manipulation ISA extensions, most notably: - Zba: address generation extension and - Zbb: basic bit manipulation extension. Most CPUs that would make sense to run FFmpeg on support Zba and Zbb (including the current FATE runner), so it makes sense to optimise for them. In fact a large chunk of existing assembler optimisations relies on Zba and/or Zbb. Since we cannot patch shared library code, the next best thing is to carry a flag initialised at load-time and check it on need basis. This results in 3 instructions overhead on isolated use, e.g.: 1: AUIPC rd, %pcrel_hi(ff_rv_zbb_supported) LBU rd, %pcrel_lo(1b)(rd) BEQZ rd, non_Zbb_fallback_code // Zbb code here The C compiler will typically load the flag ahead of time to reducing latency, and can also keep it around if Zbb is used multiple times in a single optimisation scope. For this to work, the flag symbol must be hidden; otherwise the optimisation degrades with a GOT look-up to support interposition: 1: AUIPC rd, GOT_OFFSET_HI LD rd, GOT_OFFSET_LO(rd) LBU rd, (rd) BEQZ rd, non_Zbb_fallback_code // Zbb code here This patch adds code to provision the flag in libraries using bit manipulation functions from libavutil: byte-swap, bit-weight and counting leading or trailing zeroes. Signed-off-by: Paul B Mahol <onemda@gmail.com> |
||
---|---|---|
.. | ||
aarch64 | ||
arm | ||
loongarch | ||
ppc | ||
riscv | ||
tests | ||
x86 | ||
alphablend.c | ||
bayer_template.c | ||
gamma.c | ||
half2float.c | ||
hscale_fast_bilinear.c | ||
hscale.c | ||
input.c | ||
libswscale.v | ||
log2_tab.c | ||
Makefile | ||
options.c | ||
output.c | ||
rgb2rgb_template.c | ||
rgb2rgb.c | ||
rgb2rgb.h | ||
slice.c | ||
swscale_internal.h | ||
swscale_unscaled.c | ||
swscale.c | ||
swscale.h | ||
swscaleres.rc | ||
utils.c | ||
version_major.h | ||
version.c | ||
version.h | ||
vscale.c | ||
yuv2rgb.c |