ffmpeg/libswscale
Rémi Denis-Courmont 378d1b06c3 riscv: probe for Zbb extension at load time
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.
2024-06-11 20:12:37 +03:00
..
aarch64 swscale/aarch64: Add rgb24 to yuv implementation 2024-06-11 01:12:09 +08:00
arm
loongarch swscale: [loongarch] Fix undeclared functions prob. 2024-05-31 02:20:23 +02:00
ppc swscale/ppc/swscale_ppc_template: Reindent after the previous commit 2024-04-04 16:47:21 +02:00
riscv riscv: probe for Zbb extension at load time 2024-06-11 20:12:37 +03:00
tests swscale/tests/swscale: Add help text 2024-02-15 23:07:44 +01:00
x86 swscale/x86/rgb_2_rgb: add missing wrap to ff_uyvytoyuv422_avx2 2024-06-09 16:04:36 -03:00
alphablend.c
bayer_template.c
gamma.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
half2float.c
hscale_fast_bilinear.c
hscale.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
input.c swscale: add GBRAP14 format support 2023-09-28 19:37:58 +02:00
libswscale.v
log2_tab.c
Makefile
options.c all: use designated initializers for AVOption.unit 2024-02-14 14:53:41 +01:00
output.c swscale/output: Fix integer overflow in yuv2rgba64_full_1_c_template() 2024-05-06 03:00:40 +02:00
rgb2rgb_template.c
rgb2rgb.c sws/rgb2rgb: RISC-V V shuffle_bytes_xxxx functions 2022-09-30 07:24:09 +02:00
rgb2rgb.h sws/rgb2rgb: RISC-V V shuffle_bytes_xxxx functions 2022-09-30 07:24:09 +02:00
slice.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
swscale_internal.h sws/input: R-V V rgb24ToY & bgr24ToY 2024-06-08 18:30:43 +03:00
swscale_unscaled.c swscale: add GBRAP14 format support 2023-09-28 19:37:58 +02:00
swscale.c sws/input: R-V V rgb24ToY & bgr24ToY 2024-06-08 18:30:43 +03:00
swscale.h swscale: document some missing arguments 2022-10-17 09:56:47 +02:00
swscaleres.rc
utils.c swscale: [LA] Optimize range convert for yuvj420p. 2024-04-11 23:53:41 +02:00
version_major.h libs: bump major version for all libraries 2024-03-07 11:29:43 -03:00
version.c lib*/version: Use static_assert for static asserts 2024-03-31 00:08:42 +01:00
version.h Bump after 7.0 branch point 2024-03-27 01:04:54 +01:00
vscale.c avutil/common: Don't auto-include mem.h 2024-03-31 00:08:43 +01:00
yuv2rgb.c swscale/yuv2rgb: Use 64bit for brightness computation 2024-05-28 03:48:06 +02:00