Michael Niedermayer
38e224c2ba
*/version.h: bump after release/7.1 branch
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months ago
Michael Niedermayer
e1094ac45d
*/version.h: bump minor versions for release/7.1
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months ago
Zhao Zhili
e18b46d95f
swscale/aarch64: Fix rgb24toyv12 only works with aligned width
...
Since c0666d8b
, rgb24toyv12 is broken for width non-aligned to 16.
Add a simple wrapper to handle the non-aligned part.
Co-authored-by: johzzy <hellojinqiang@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2 months ago
Michael Niedermayer
bd80c97391
swscale/output: Fix undefined integer overflow in yuv2rgba64_2_c_template()
...
Fixes: signed integer overflow: -1082982400 + -1083218484 cannot be represented in type 'int'
Fixes: 70657/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6707819712675840
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months ago
Michael Niedermayer
44c5641ae8
swscale/swscale: Use unsigned operation to avoid undefined behavior
...
I have not checked that the constant is correct, this just fixes the undefined behavior
Fixes: signed integer overflow: -646656 * 3517 cannot be represented in type 'int
Fixes: 70559/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5209368631508992
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2 months ago
Ramiro Polla
c0666d8bed
swscale/aarch64/rgb2rgb: add neon implementation for rgb24toyv12
...
A55 A76
rgb24toyv12_16_200_c: 36890.6 17275.5
rgb24toyv12_16_200_neon: 12460.1 ( 2.96x) 5360.8 ( 3.22x)
rgb24toyv12_128_60_c: 83205.1 39884.8
rgb24toyv12_128_60_neon: 27468.4 ( 3.03x) 13552.5 ( 2.94x)
rgb24toyv12_512_16_c: 88111.6 42346.8
rgb24toyv12_512_16_neon: 29126.6 ( 3.03x) 14411.2 ( 2.94x)
rgb24toyv12_1920_4_c: 82068.1 39620.0
rgb24toyv12_1920_4_neon: 27011.6 ( 3.04x) 13492.2 ( 2.94x)
2 months ago
Ramiro Polla
caaec2ea95
swscale/x86/rgb2rgb: disable rgb24toyv12_mmxext for x86_64
...
The mmxext implementation is slower than the C version in x86_64.
m32 m64
rgb24toyv12_16_200_c: 24942.7 14812.6
rgb24toyv12_16_200_mmxext: 17857.2 ( 1.40x) 17400.4 ( 0.85x)
rgb24toyv12_128_60_c: 56892.9 35616.9
rgb24toyv12_128_60_mmxext: 40730.9 ( 1.40x) 39610.4 ( 0.90x)
rgb24toyv12_512_16_c: 58402.7 37209.4
rgb24toyv12_512_16_mmxext: 44842.4 ( 1.30x) 41136.2 ( 0.90x)
rgb24toyv12_1920_4_c: 54827.4 34737.4
rgb24toyv12_1920_4_mmxext: 51169.9 ( 1.07x) 34818.9 ( 1.00x)
2 months ago
Ramiro Polla
3604b2403c
swscale/rgb2rgb: improve chroma conversion in ff_rgb24toyv12_c
...
The current code subsamples by dropping 3/4 pixels to calculate the
chroma components. This commit calculates the average of 4 rgb pixels
before calculating the chroma components, putting it in line with the
mmxext implementation.
2 months ago
Ramiro Polla
d8848325a6
swscale/aarch64/rgb2rgb: add deinterleaveBytes neon implementation
...
A55 A76
deinterleave_bytes_c: 70342.0 34497.5
deinterleave_bytes_neon: 21594.5 ( 3.26x) 5535.2 ( 6.23x)
deinterleave_bytes_aligned_c: 71340.8 34651.2
deinterleave_bytes_aligned_neon: 8616.8 ( 8.28x) 3996.2 ( 8.67x)
2 months ago
Ramiro Polla
4c824ad391
swscale/x86/rgb2rgb: fix deinterleaveBytes writing past the end of the buffers
2 months ago
Ramiro Polla
f17a6bd200
swscale/x86/rgb2rgb: fix deinterleaveBytes for unaligned dst pointers
2 months ago
Rémi Denis-Courmont
27d28b68da
swscale/rgb2rgb: enable R-V V deinterleaveBytes
...
T-Head C908:
deinterleave_bytes_c: 100328.3 ( 1.00x)
deinterleave_bytes_rvv_i32: 19331.3 ( 5.19x)
deinterleave_bytes_aligned_c: 100337.5 ( 1.00x)
deinterleave_bytes_aligned_rvv_i32: 15748.0 ( 6.37x)
SpacemiT X60:
deinterleave_bytes_c: 95230.6 ( 1.00x)
deinterleave_bytes_rvv_i32: 9790.3 ( 9.73x)
deinterleave_bytes_aligned_c: 96564.1 ( 1.00x)
deinterleave_bytes_aligned_rvv_i32: 7780.1 (12.41x)
2 months ago
Ramiro Polla
420d443600
swscale/aarch64: cosmetics fix (spaces inside curly braces)
3 months ago
Ramiro Polla
52887683e9
swscale/aarch64: add nv24/nv42 to yuv420p unscaled converter
...
A55 A76
nv24_yuv420p_128_c: 4956.1 1267.0
nv24_yuv420p_128_neon: 3109.1 ( 1.59x) 640.0 ( 1.98x)
nv24_yuv420p_1920_c: 35728.4 11736.2
nv24_yuv420p_1920_neon: 8011.1 ( 4.46x) 2436.0 ( 4.82x)
nv42_yuv420p_128_c: 4956.4 1270.5
nv42_yuv420p_128_neon: 3074.6 ( 1.61x) 639.5 ( 1.99x)
nv42_yuv420p_1920_c: 35685.9 11732.5
nv42_yuv420p_1920_neon: 7995.1 ( 4.46x) 2437.2 ( 4.81x)
3 months ago
Ramiro Polla
88a563ad18
swscale: export ff_copyPlane so it may be used by simd code
3 months ago
Ramiro Polla
4eb5594295
swscale: add nv24/nv42 to yuv420p unscaled converter
3 months ago
Martin Storsjö
cfe0a36352
libswscale: aarch64: Fix the indentation of some macro invocations
...
Signed-off-by: Martin Storsjö <martin@martin.st>
3 months ago
Martin Storsjö
507c2a5774
libswscale: arm: Don't assume aligned output in yuv2rgb functions
...
This fixes failures in recently added checkasm tests.
While the buffers in most cases are aligned, libswscale in general
can't assume the output to be aligned.
Signed-off-by: Martin Storsjö <martin@martin.st>
3 months ago
Ramiro Polla
181cd260db
swscale/aarch64/yuv2rgb: add neon yuv42{0,2}p -> gbrp unscaled colorspace converters
...
checkasm --bench on a Raspberry Pi 5 Model B Rev 1.0:
yuv420p_gbrp_128_c: 1243.0
yuv420p_gbrp_128_neon: 453.5
yuv420p_gbrp_1920_c: 18165.5
yuv420p_gbrp_1920_neon: 6700.0
yuv422p_gbrp_128_c: 1463.5
yuv422p_gbrp_128_neon: 471.5
yuv422p_gbrp_1920_c: 21343.7
yuv422p_gbrp_1920_neon: 6743.5
3 months ago
Ramiro Polla
8744764a4c
swscale/x86/yuv2rgb: add ssse3 yuv42{0,2}p -> gbrp unscaled colorspace converters
...
Note: this implementation is limited to x86_64 due to general purpose
register pressure.
checkasm --bench on an Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz:
yuv420p_gbrp_8_c: 118.5
yuv420p_gbrp_8_ssse3: 93.3
yuv420p_gbrp_128_c: 1068.3
yuv420p_gbrp_128_ssse3: 319.3
yuv420p_gbrp_1080_c: 8841.8
yuv420p_gbrp_1080_ssse3: 2211.8
yuv420p_gbrp_1920_c: 15903.8
yuv420p_gbrp_1920_ssse3: 3814.3
yuv422p_gbrp_8_c: 144.8
yuv422p_gbrp_8_ssse3: 93.8
yuv422p_gbrp_128_c: 1395.8
yuv422p_gbrp_128_ssse3: 313.0
yuv422p_gbrp_1080_c: 11551.5
yuv422p_gbrp_1080_ssse3: 2240.8
yuv422p_gbrp_1920_c: 20585.3
yuv422p_gbrp_1920_ssse3: 5249.5
yuva420p_gbrp_8_c: 117.5
yuva420p_gbrp_8_ssse3: 92.0
yuva420p_gbrp_128_c: 1593.0
yuva420p_gbrp_128_ssse3: 319.3
yuva420p_gbrp_1080_c: 8694.5
yuva420p_gbrp_1080_ssse3: 2186.0
yuva420p_gbrp_1920_c: 15946.5
yuva420p_gbrp_1920_ssse3: 3805.3
3 months ago
Ramiro Polla
4545205a26
swscale/yuv2rgb: add yuv42{0,2}p -> gbrp unscaled colorspace converters
3 months ago
Ramiro Polla
af5adf57e3
swscale/yuv2rgb: prepare YUV2RGBFUNC macro for multi-planar rgb
...
This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled
colorspace converters.
There is no difference in performance.
3 months ago
Ramiro Polla
24063e7827
swscale/yuv2rgb: prepare LOADCHROMA/PUTFUNC macros for multi-planar rgb
...
This will be used in the upcoming yuv42{0,2}p -> gbrp unscaled
colorspace converters.
There is no difference in performance.
3 months ago
Niklas Haas
6b40be941a
swscale/options: relax src/dst_h/v_chr_pos value range
...
When dealing with 4x subsampling ratios (log2 == 2), such as can arise
with 4:1:1 or 4:1:0, a value range of 512 is not enough to cover the
range of possible scenarios.
For example, bottom-sited chroma in 4:1:0 would require an offset of 768
(three luma rows). Simply double the limit to 1024. I don't see any
place in initFilter() that would experience overflow as a result of this
change, especially since get_local_pos() right-shifts it by the
subsampling ratio again.
3 months ago
Niklas Haas
3e064f52eb
swscale: document SWS_FULL_CHR_H_* flags
...
Based on my best understanding of what they do, given the source code.
3 months ago
James Almer
66592e8b10
swscale/output: don't leave the alpha channel undefined in vuyx and xv36le
...
It's non-determistic, as shown by poisoning avfilter buffers instead of zeroing them.
Signed-off-by: James Almer <jamrial@gmail.com>
3 months ago
Rémi Denis-Courmont
210877c5fd
sws/riscv: depend on RVB and simplify accordingly
3 months ago
Rémi Denis-Courmont
bd0c3edb13
lavu/riscv: count bytes rather than words for bswap32
...
This removes the dependency on Zba at essentially zero cost.
4 months ago
Shiyou Yin
4713a5cc24
swscale: [loongarch] Fix checkasm-sw_yuv2rgb failure.
...
Reviewed-by: 陈昊 <chenhao@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months ago
Rémi Denis-Courmont
4f2472909e
sws/riscv: add forward-edge CFI landing pads
4 months ago
Rémi Denis-Courmont
e91a8cc4de
sws/riscv: require B or zba explicitly
4 months ago
Michael Niedermayer
bcab9789ef
swscale/output: Fix integer overflows in yuv2rgba64_X_c_template
...
Fixes: signed integer overflow: -1082982400 + -1068681048 cannot be represented in type 'int'
Fixes: 69995/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6285740271534080
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months ago
Niklas Haas
4ec45aca36
swscale/utils: fix leak on threaded ctx init failure
...
This count gets incremented after init succeeds, when it should be
incremented after *alloc* succeeds. Otherwise, we leak the context on
failure.
There are no negative consequences of incrementing for
allocated-but-not-initialized contexts, as the only functions that
reference it will, in the worst case, simply behave as if called on
allocated-but-not-initialized contexts, which is in line with expected
behavior when sws_init_context() fails.
4 months ago
Sean McGovern
34b4ca8696
swscale: prevent undefined behaviour in the PUTRGBA macro
...
For even small values of 'asrc[x]', shifting them by 24 bits or more
will cause arithmetic overflow and be caught by
GCC's undefined behaviour sanitizer.
Ensure the values do not overflow by up-casting the bracketed
expressions involving 'asrc' to uint32_t.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months ago
Ramiro Polla
ac6263945a
swscale/x86/yuv2rgb: Detemplatize
...
Every function in yuv2rgb_template.c is only compiled exactly
once, so detemplatize it.
4 months ago
Ramiro Polla
4f7f9b1026
swscale: remove unconditional #define DITHER1XBPP
...
This seems to have had an use in the past, but it is now defined
unconditionally.
4 months ago
Michael Niedermayer
66b60bae68
swscale/swscale: Use ptrdiff_t for linesize computations
...
This is unlikely to make a difference
Fixes: CID1591896 Unintentional integer overflow
Fixes: CID1591901 Unintentional integer overflow
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 months ago
Zhao Zhili
4d90a76986
swscale/aarch64: Add argb/abgr to yuv
...
Test on Apple M1 with kperf:
: -O3 : -O3 -fno-vectorize
abgr_to_uv_8_c : 19.4 : 26.1
abgr_to_uv_8_neon : 29.9 : 51.1
abgr_to_uv_128_c : 146.4 : 558.9
abgr_to_uv_128_neon : 85.1 : 83.4
abgr_to_uv_1080_c : 1162.6 : 4786.4
abgr_to_uv_1080_neon : 819.6 : 826.6
abgr_to_uv_1920_c : 2063.6 : 8492.1
abgr_to_uv_1920_neon : 1435.1 : 1447.1
abgr_to_uv_half_8_c : 16.4 : 11.4
abgr_to_uv_half_8_neon : 35.6 : 20.4
abgr_to_uv_half_128_c : 108.6 : 359.4
abgr_to_uv_half_128_neon : 75.4 : 42.6
abgr_to_uv_half_1080_c : 883.4 : 2885.6
abgr_to_uv_half_1080_neon : 460.6 : 481.1
abgr_to_uv_half_1920_c : 1553.6 : 5106.9
abgr_to_uv_half_1920_neon : 817.6 : 820.4
abgr_to_y_8_c : 6.1 : 26.4
abgr_to_y_8_neon : 40.6 : 6.4
abgr_to_y_128_c : 99.9 : 390.1
abgr_to_y_128_neon : 67.4 : 55.9
abgr_to_y_1080_c : 735.9 : 3170.4
abgr_to_y_1080_neon : 534.6 : 536.6
abgr_to_y_1920_c : 1279.4 : 6016.4
abgr_to_y_1920_neon : 932.6 : 927.6
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
4 months ago
Zhao Zhili
52422133ae
swscale/aarch64: Add bgra/rgba to yuv
...
Test on Apple M1 with kperf
: -O3 : -O3 -fno-vectorize
bgra_to_uv_8_c : 13.4 : 27.5
bgra_to_uv_8_neon : 37.4 : 41.7
bgra_to_uv_128_c : 155.9 : 550.2
bgra_to_uv_128_neon : 91.7 : 92.7
bgra_to_uv_1080_c : 1173.2 : 4558.2
bgra_to_uv_1080_neon : 822.7 : 809.5
bgra_to_uv_1920_c : 2078.2 : 8115.2
bgra_to_uv_1920_neon : 1437.7 : 1438.7
bgra_to_uv_half_8_c : 17.9 : 14.2
bgra_to_uv_half_8_neon : 37.4 : 10.5
bgra_to_uv_half_128_c : 103.9 : 326.0
bgra_to_uv_half_128_neon : 73.9 : 68.7
bgra_to_uv_half_1080_c : 850.2 : 3732.0
bgra_to_uv_half_1080_neon : 484.2 : 490.0
bgra_to_uv_half_1920_c : 1479.2 : 4942.7
bgra_to_uv_half_1920_neon : 824.2 : 824.7
bgra_to_y_8_c : 8.2 : 29.5
bgra_to_y_8_neon : 18.2 : 32.7
bgra_to_y_128_c : 101.4 : 361.5
bgra_to_y_128_neon : 74.9 : 73.7
bgra_to_y_1080_c : 739.4 : 3018.0
bgra_to_y_1080_neon : 613.4 : 544.2
bgra_to_y_1920_c : 1298.7 : 5326.0
bgra_to_y_1920_neon : 918.7 : 934.2
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
4 months ago
Zhao Zhili
b8b71be07a
swscale/aarch64: Add bgr24 to yuv
...
Test on Apple M1 with kperf
: -O3 : -O3 -fno-vectorize
bgr24_to_uv_8_c : 28.5 : 52.5
bgr24_to_uv_8_neon : 54.5 : 59.7
bgr24_to_uv_128_c : 294.0 : 830.7
bgr24_to_uv_128_neon : 99.7 : 112.0
bgr24_to_uv_1080_c : 965.0 : 6624.0
bgr24_to_uv_1080_neon : 751.5 : 754.7
bgr24_to_uv_1920_c : 1693.2 : 11554.5
bgr24_to_uv_1920_neon : 1292.5 : 1307.5
bgr24_to_uv_half_8_c : 54.2 : 37.0
bgr24_to_uv_half_8_neon : 27.2 : 22.5
bgr24_to_uv_half_128_c : 127.2 : 392.5
bgr24_to_uv_half_128_neon : 63.0 : 52.0
bgr24_to_uv_half_1080_c : 880.2 : 3329.0
bgr24_to_uv_half_1080_neon : 401.5 : 390.7
bgr24_to_uv_half_1920_c : 1585.7 : 6390.7
bgr24_to_uv_half_1920_neon : 694.7 : 698.7
bgr24_to_y_8_c : 21.7 : 22.5
bgr24_to_y_8_neon : 797.2 : 25.5
bgr24_to_y_128_c : 88.0 : 280.5
bgr24_to_y_128_neon : 63.7 : 55.0
bgr24_to_y_1080_c : 616.7 : 2208.7
bgr24_to_y_1080_neon : 900.0 : 452.0
bgr24_to_y_1920_c : 1093.2 : 3894.7
bgr24_to_y_1920_neon : 777.2 : 767.5
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
4 months ago
Ramiro Polla
61e851381f
swscale/yuv2rgb/x86: remove mmx/mmxext yuv2rgb functions
...
These functions are either slower or barely faster than the C LUT
yuv2rgb code.
4 months ago
Michael Niedermayer
c221c7422f
swscale/output: Avoid undefined overflow in yuv2rgb_write_full()
...
Fixes: signed integer overflow: -140140 * 16525 cannot be represented in type 'int'
Fixes: 68859/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4516387130245120
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months ago
Michael Niedermayer
9e6c5b6e86
swscale/output: alpha can become negative after scaling, use multiply
...
Fixes: left shift of negative value -3245
Fixes: 69047/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6571511551950848
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 months ago
Ramiro Polla
e37a93031e
swscale/yuv2rgb: reindent after previous commit
5 months ago
Ramiro Polla
0a08c64588
swscale/yuv2rgb: fix yuv422p input in C code
...
The C code was silently ignoring the second chroma line on yuv422p
input.
5 months ago
Ramiro Polla
fb8fae864f
swscale/yuv2rgb: add macros to simplify code generation
5 months ago
Ramiro Polla
88a402df74
swscale/yuv2rgb: fix conversion for widths not aligned to 8
...
The C code for some pixel formats (rgb555, rgb565, rgb444, and monob)
was not converting the last pixels on widths not aligned to 8.
NOTE: the last pixel for odd widths is still not converted for any of
the pixel formats in the C code for yuv2rgb except for monob.
5 months ago
Ramiro Polla
75f1a8e071
swscale/aarch64: add neon {lum,chr}ConvertRange
...
chrRangeFromJpeg_8_c: 29.2
chrRangeFromJpeg_8_neon: 19.5
chrRangeFromJpeg_24_c: 80.5
chrRangeFromJpeg_24_neon: 34.0
chrRangeFromJpeg_128_c: 413.7
chrRangeFromJpeg_128_neon: 156.0
chrRangeFromJpeg_144_c: 471.0
chrRangeFromJpeg_144_neon: 174.2
chrRangeFromJpeg_256_c: 842.0
chrRangeFromJpeg_256_neon: 305.5
chrRangeFromJpeg_512_c: 1699.0
chrRangeFromJpeg_512_neon: 608.0
chrRangeToJpeg_8_c: 51.7
chrRangeToJpeg_8_neon: 22.7
chrRangeToJpeg_24_c: 149.7
chrRangeToJpeg_24_neon: 38.0
chrRangeToJpeg_128_c: 761.7
chrRangeToJpeg_128_neon: 176.7
chrRangeToJpeg_144_c: 866.2
chrRangeToJpeg_144_neon: 198.7
chrRangeToJpeg_256_c: 1516.5
chrRangeToJpeg_256_neon: 348.7
chrRangeToJpeg_512_c: 3067.2
chrRangeToJpeg_512_neon: 692.7
lumRangeFromJpeg_8_c: 24.0
lumRangeFromJpeg_8_neon: 17.0
lumRangeFromJpeg_24_c: 56.7
lumRangeFromJpeg_24_neon: 21.0
lumRangeFromJpeg_128_c: 294.5
lumRangeFromJpeg_128_neon: 76.7
lumRangeFromJpeg_144_c: 332.5
lumRangeFromJpeg_144_neon: 86.7
lumRangeFromJpeg_256_c: 586.0
lumRangeFromJpeg_256_neon: 152.2
lumRangeFromJpeg_512_c: 1190.0
lumRangeFromJpeg_512_neon: 298.0
lumRangeToJpeg_8_c: 31.7
lumRangeToJpeg_8_neon: 19.5
lumRangeToJpeg_24_c: 83.5
lumRangeToJpeg_24_neon: 24.2
lumRangeToJpeg_128_c: 440.5
lumRangeToJpeg_128_neon: 91.0
lumRangeToJpeg_144_c: 504.2
lumRangeToJpeg_144_neon: 101.0
lumRangeToJpeg_256_c: 879.7
lumRangeToJpeg_256_neon: 177.2
lumRangeToJpeg_512_c: 1794.2
lumRangeToJpeg_512_neon: 354.0
5 months ago
James Almer
fcf72966a5
swscale/x86/range_convert: add missing AVX2 preprocessor wrapper
...
Fixes compilation with old yasm.
Signed-off-by: James Almer <jamrial@gmail.com>
5 months ago
James Almer
8a4c9d6bd3
swscale/x86/range_convert: reduce amount of xmm regs clobbered in luma functions
...
Signed-off-by: James Almer <jamrial@gmail.com>
5 months ago