1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

2676 Commits

Author SHA1 Message Date
James Almer
2eb9c35010 x86/swscale: disable AVX2 yuv2nv12cX functions if accurate_rnd is requested
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-07 11:16:42 -03:00
James Almer
4047b887fc swscale/swscale_unscaled: add more unscaled planar RGB to planar RGB coverage
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-06 17:45:47 -03:00
James Almer
c5ebd56500 swscale/swscale_unscaled: add unscaled XV{36,48}LE <-> XV{36,48}BE
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-06 17:45:47 -03:00
James Almer
271aea60a4 fate/pixfmts: extend the high bit depth test
Also test 8bit formats, and try bitdepth conversion paths.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-06 17:44:25 -03:00
James Almer
e7382b4d01 swscale/swscale_unscaled: add unscaled x2rgb10le to packed RGB
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-06 17:34:32 -03:00
James Almer
ae8ef645ec swscale/swscale_unscaled: add unscaled x2rgb10le to planar RGB
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-06 17:34:31 -03:00
James Almer
5f5421ec66 swscale/swscale: prevent integer overflow in chrRangeToJpeg16_c
Same as it's done in lumRangeToJpeg16_c(). Plenty of allowed input values can
overflow here.

Fixes: src/libswscale/swscale.c:198:47: runtime error: signed integer overflow: 475328 * 4663 cannot be represented in type 'int'
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-02 15:01:31 -03:00
James Almer
c029a2f7dd swscale/swscale_unscaled: add unscaled rgb to planar rgba
The fate test reference changes are due to the conversion being a simple
lossless deinterleave, instead of going through a RGB -> YUV -> RGB roundtrip.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-02 15:01:31 -03:00
James Almer
5ccc3f0fca swscale/swscale_unscaled: add unscaled hbd planar RGB to x2rgb10le
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-02 15:01:31 -03:00
James Almer
febc9e8162 swscale/output: add full chroma interpolation support for x2rgb10
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-02 15:01:31 -03:00
James Almer
78ba06928a swscale/x86/rgb2rgb: add optimized versions of the remaining shuffle_bytes functions
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-02 15:01:31 -03:00
James Almer
a686d34fea swscale/swscale_unscaled: add unscaled conversion for AYUV/VUYA/UYVA
Signed-off-by: James Almer <jamrial@gmail.com>
2024-11-02 15:01:31 -03:00
Ramiro Polla
8b30daedf7 swscale/range_convert: indent after previous commit 2024-10-27 13:20:56 +01:00
Ramiro Polla
f7ee0195df swscale/range_convert: drop redundant conditionals from arch-specific init functions
These conditions are already checked for in the main init function.
2024-10-27 13:20:56 +01:00
Ramiro Polla
7728b3357d swscale/range_convert: call arch-specific init functions from main init function
This commit also fixes the issue that the call to ff_sws_init_range_convert()
from sws_init_swscale() was not setting up the arch-specific optimizations.
2024-10-27 13:20:56 +01:00
James Almer
a67ba3c132 swscale/output: add XV48 output support
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-26 00:04:50 -03:00
James Almer
2f13f74791 swscale/input: add XV48 input support
Signed-off-by: James Almer <jamrial@gmail.com>
2024-10-26 00:04:29 -03:00
Michael Niedermayer
3fe3014405
swscale/output: used unsigned for bit accumulation
Fixes: Integer overflow
Fixes: 368725672/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5009093023563776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-25 22:46:39 +02:00
Michael Niedermayer
14f5d67be3
swscale/rgb2rgb_template: Fix ff_rgb24toyv12_c() with odd height
Fixes: out of array access
Fixes: 368143798/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-6475823425585152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-10-25 22:46:39 +02:00
Niklas Haas
67adb30322 swscale: rename SwsContext to SwsInternal
And preserve the public SwsContext as separate name. The motivation here
is that I want to turn SwsContext into a public struct, while keeping the
internal implementation hidden. Additionally, I also want to be able to
use multiple internal implementations, e.g. for GPU devices.

This commit does not include any functional changes. For the most part, it is
a simple rename. The only complications arise from the public facing API
functions, which preserve their current type (and hence require an additional
unwrapping step internally), and the checkasm test framework, which directly
accesses SwsInternal.

For consistency, the affected functions that need to maintain a distionction
have generally been changed to refer to the SwsContext as *sws, and the
SwsInternal as *c.

In an upcoming commit, I will provide a backing definition for the public
SwsContext, and update `sws_internal()` to dereference the internal struct
instead of merely casting it.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-24 22:50:00 +02:00
Niklas Haas
f1f54d2f82 swscale/x86: use dedicated int for self-modifying MMX dstW
I want to pull options out of SwsInternal, so we need to make this field
a dedicated int that gets updated as appropriate in ff_swscale().

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:12:23 +02:00
Niklas Haas
b03c758600 swscale: add sws_is_noop()
Exactly what it says on the tin.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:06:55 +02:00
Niklas Haas
5e50a56b9c swscale: add new frame testing API
Replacing the old sws_isSupported* API with a more consistent family
of functions that follows the same signature and naming convention,
including a placeholder for testing the color space parameters that
we don't currently implement conversions for.

These functions also perform some extra basic sanity checking.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:06:16 +02:00
Niklas Haas
e2637a083a swscale/utils: add SwsFormat abstraction and helpers
Groups together all relevant color metadata from an AVFrame. While we could
use AVFrame directly, keeping it a separate struct has three advantages:

1. Functions accepting an SwsFormat will definitely not care about the
   data pointers.
2. It clearly separates sanitized and raw metadata, since the function to
   construct an SwsFormat from an AVFrame will also sanitize.
3. It's slightly more lightweight to pass around.

Move these into a new header file "utils.h" to avoid crowding
swscale_internal.h even more, and also to solve a circular dependency issue
down the line.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:04:06 +02:00
Niklas Haas
87baf9ab2c swscale: add sws_free_context()
Merely a convenience wrapper around sws_freeContext(). The name change is for
parity with the other sws_* functions.

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
2024-10-23 23:04:04 +02:00
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