Niklas Haas
3bf12beae9
swscale: slightly reorder header
...
I want to start grouping "legacy" functions which I tend to deprecate
together, away from the new ones.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:01:09 +02:00
Niklas Haas
fbfea1c644
swscale: publicly typedef struct SwsContext
...
Slightly more convenient, especially for the upcoming refactor which will
turn SwsContext into a public struct.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:00:54 +02:00
James Almer
b520d95467
swscale/output: add Y216LE output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-23 14:11:35 -03:00
James Almer
7756cd98ac
swscale/input: add Y216LE input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-23 14:11:23 -03:00
James Almer
0bb53948ac
swscale/swscale_unscaled: clear the low bits in planar8ToP01xleWrapper
...
This makes the unscaled output of p010le and p016le match the generic path.
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-21 09:52:58 -03:00
James Almer
f0e6296dde
swscale/output: fix alpha endianness in XV36
...
Mistakenly written in native endianness in 42098f9266
.
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 12:18:35 -03:00
James Almer
601a347946
swscale/output: fill the xv30le alpha bits
...
As with other pixel formats, set the undefined alpha bits to opaque.
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 11:59:24 -03:00
James Almer
08c632ec0f
swscale/output: add AYUV64BE output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 11:57:36 -03:00
James Almer
5a699c8db9
swscale/input: add AYUV64BE input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 11:57:36 -03:00
James Almer
42098f9266
swscale/output: add X36VBE output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 11:57:36 -03:00
James Almer
e012a7a24a
swscale/input: add X36VBE input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 11:57:36 -03:00
James Almer
2137346324
swscale/output: fill all the xv36le alpha bits
...
The format is 10 bit per component, not 8.
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-17 11:57:36 -03:00
Martin Schitter
d73b73af5e
swscale/input: add input support for RGBF16
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-14 20:46:24 +02:00
Martin Schitter
c72a5c486a
swscale/input: add input support for RGBF32
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-14 20:46:23 +02:00
James Almer
cd04ebe033
swscale/output: add V30X output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-12 10:08:29 -03:00
James Almer
57db8e0571
swscale/output: add VYU444 output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-12 10:08:29 -03:00
James Almer
eac9af382a
swscale/output: add UYVA output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-12 10:08:29 -03:00
James Almer
6cd52c1080
swscale/output: add AYUV output support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-12 10:06:09 -03:00
James Almer
5f1bf3cd65
swscale/output: add missing yuv2packed1 and yuv2packed2 support for VUY{X,A}
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-12 09:56:23 -03:00
Martin Storsjö
77e6293735
arm: Consistently use proper interworking function returns
...
Use "bx lr", or "pop {lr}", which do proper mode switching
between thumb and arm modes. A plain "mov pc, lr" does not switch
from thumb mode to arm mode (while in arm mode, it does switch
mode for a thumb caller).
This is normally not an issue, as CONFIG_THUMB only is enabled if
the C compiler defaults to thumb; but stick to patterns that can
do mode switching if needed, for consistency.
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-09 15:52:51 +03:00
Niklas Haas
ec9985b54f
swscale/internal: constify and expose ff_swscale()
...
Used as an intermediate entry point for the new swscale context. The extra
constification is a consistency measure, as I want to move the memcpy of
stride and plane pointers to the functions that actually need to mutate them.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 13:18:08 +02:00
Niklas Haas
403a20b2e6
swscale/rgb2xyz: expose these functions internally
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 13:17:17 +02:00
Niklas Haas
775de8c19d
swscale/rgb2xyz: follow convention on image pointers and strides
...
Instead of taking an int16_t pointer and a stride in halfwords, follow the
usual convention of treating all planes and strides as byte-addressed.
This does not have any immediate effect but makes these functions more
reusable without unintended "gotchas".
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 13:14:57 +02:00
Niklas Haas
9d8f5141cf
swscale/rgb2xyz: add explicit width parameter
...
This fixes an 11-year-old bug in the rgb2xyz functions, when used with a
negative stride. The current loop bounds turned it into a no-op.
Additionally, this increases performance on highly cropped images, whose
stride may be substantially higher than the effective width.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 13:14:57 +02:00
Niklas Haas
ea228fc415
swscale/rgb2xyz: minor style fixes
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-09 13:14:57 +02:00
James Almer
04612351ab
swscale/input: add V30X input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-08 22:26:07 -03:00
James Almer
ea05edc9e0
swscale/input: add VYU444 input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-08 22:24:47 -03:00
James Almer
ec7f5e314d
swscale/input: add UYVA input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-08 22:24:47 -03:00
James Almer
bb37d3c33e
swscale/input: add AYUV input support
...
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-08 22:24:47 -03:00
jinbo
e6ecc1e757
swscale: Fix conflicting types for loongarch
...
Build breaks after c1a0e65763
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-09 01:55:50 +02:00
Niklas Haas
477445722c
swscale/ppc: fix altivec build failure
...
Fixes: c1a0e65763
2024-10-08 16:45:36 +02:00
Martin Storsjö
b9145fcab2
swscale: Fix aarch64 and i386 compilation failures
...
This unbreaks builds after c1a0e65763
,
which broke with errors like
src/libswscale/aarch64/rgb2rgb.c:66:25: error: incompatible function pointer types assigning to 'void (*)(const uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int, const int32_t *)' (aka 'void (*)(const unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, int, int, int, int, const int *)') from 'void (const uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int, int32_t *)' (aka 'void (const unsigned char *, unsigned char *, unsigned char *, unsigned char *, int, int, int, int, int, int *)') [-Wincompatible-function-pointer-types]
66 | ff_rgb24toyv12 = rgb24toyv12;
| ^ ~~~~~~~~~~~
and
src/libswscale/aarch64/swscale_unscaled.c:213:29: error: incompatible function pointer types assigning to 'SwsFunc' (aka 'int (*)(struct SwsContext *, const unsigned char *const *, const int *, int, int, unsigned char *const *, const int *)') from 'int (SwsContext *, const uint8_t *const *, const int *, int, int, const uint8_t **, const int *)' (aka 'int (struct SwsContext *, const unsigned char *const *, const int *, int, int, const unsigned char **, const int *)') [-Wincompatible-function-pointer-types]
213 | c->convert_unscaled = nv24_to_yuv420p_neon_wrapper;
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Martin Storsjö <martin@martin.st>
2024-10-08 09:29:07 +03:00
Niklas Haas
73b3344edd
swscale/input: parametrize ff_sws_init_input_funcs() pointers
...
Following the precedent set by ff_sws_init_output_funcs().
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
20b350b284
swscale/internal: add typedefs for input reading functions
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
b90d522d2c
swscale/internal: forward typedef SwsContext
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
c1a0e65763
swscale/internal: constify SwsFunc
...
I want to move away from having random leaf processing functions mutate
plane pointers, and while we're at it, we might as well make the strides
and tables const as well.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
286bdc9cdc
swscale/internal: turn cascaded_tmp into an array
...
Slightly more convenient to access from the new wrapping code.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
61369484f6
swscale/internal: expose ff_update_palette() internally
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
aee19ee431
swscale/internal: rename NB_SWS_DITHER for consistency
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Niklas Haas
41ce370b65
tests/swscale: fix minor typos
...
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-07 19:51:34 +02:00
Michael Niedermayer
38e224c2ba
*/version.h: bump after release/7.1 branch
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-09-24 17:10:35 +02:00
Michael Niedermayer
e1094ac45d
*/version.h: bump minor versions for release/7.1
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-09-24 17:07:30 +02:00
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>
2024-09-24 10:24:14 +08:00
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>
2024-09-19 00:24:26 +02:00
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>
2024-09-19 00:10:38 +02:00
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)
2024-09-06 23:11:13 +02:00
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)
2024-09-06 23:06:38 +02:00
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.
2024-09-06 23:06:32 +02:00
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)
2024-09-06 23:05:09 +02:00
Ramiro Polla
4c824ad391
swscale/x86/rgb2rgb: fix deinterleaveBytes writing past the end of the buffers
2024-09-06 23:05:04 +02:00