Michael Niedermayer
ac4caa33ba
swscale/output: Fix integer overflow in yuv2ya16_X_c_template()
...
Found-by: colod colod <colodcolod7@gmail.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 0c6b7f9483 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2025-11-23 04:32:17 +01:00
Michael Niedermayer
289848bd16
swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()
...
Fixes: signed integer overflow: 1966895953 + 210305024 cannot be represented in type 'int'
Fixes: 391921975/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5916798905548800
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit ce538ef97a )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2025-08-04 16:36:01 +02:00
Michael Niedermayer
a8485dca2b
swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()
...
Fixes: signed integer overflow: -1082982400 + -1195645138 cannot be represented in type 'int'
Fixes: 376136843/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4791844321427456
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 56faee21c1 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2025-08-04 16:35:49 +02:00
Michael Niedermayer
6f6faa2ad5
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 >
(cherry picked from commit 3fe3014405 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2025-08-04 16:35:39 +02:00
Michael Niedermayer
2e7a948214
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 >
(cherry picked from commit bd80c97391 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2025-08-04 16:35:33 +02:00
Michael Niedermayer
bb40556df4
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 >
(cherry picked from commit bcab9789ef )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2024-07-22 10:42:21 +02:00
Michael Niedermayer
1e1a0182f7
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 >
(cherry picked from commit c221c7422f )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2024-07-21 17:36:36 +02:00
Michael Niedermayer
076ecf6cb1
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 >
(cherry picked from commit 9e6c5b6e86 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2024-07-21 17:36:04 +02:00
Michael Niedermayer
3ca9febc6e
swscale/output: Fix integer overflow in yuv2rgba64_full_1_c_template()
...
Fixes: signed integer overflow: -1082982400 + -1079364728 cannot be represented in type 'int'
Fixes: 67910/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5329011971522560
The input is 9bit in 16bit, the fuzzer fills all 16bit thus generating "invalid" input
No overflow should happen with valid input.
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 1330a73cca )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2024-06-13 11:22:07 +02:00
Michael Niedermayer
91df1b66c7
swscale/output: Fix integer overflow in yuv2rgba64_1_c_template
...
Fixes: signed integer overflow: -831176 * 9539 cannot be represented in type 'int'
Fixes: 67869/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-5117342091640832
The input is 9bit in 16bit, the fuzzer fills all 16bit thus generating "invalid" input
No overflow should happen with valid input.
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit a56559e688 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2024-06-13 11:22:06 +02:00
Michael Niedermayer
8b09afb86e
swscale/output: Bias 16bps output calculations to improve non overflowing range for GBRP16/GBRPF32
...
Fixes: integer overflow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit b74f89caae )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2023-02-21 00:29:01 +01:00
Michael Niedermayer
e17632834d
swscale/output: Bias 16bps output calculations to improve non overflowing range
...
Fixes: integer overflow
Fixes: ./ffmpeg -f rawvideo -video_size 66x64 -pixel_format yuva420p10le -i ~/videos/overflow_input_w66h64.yuva420p10le -filter_complex "scale=flags=bicubic+full_chroma_int+full_chroma_inp+bitexact+accurate_rnd:in_color_matrix=bt2020:out_color_matrix=bt2020:in_range=full:out_range=full,format=rgba64[out]" -pixel_format rgba64 -map '[out]' -y overflow_w66h64.png
Found-by: Drew Dunne <asdunne@google.com >
Tested-by: Drew Dunne <asdunne@google.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
(cherry picked from commit 0f0afc7fb5 )
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2023-02-21 00:28:24 +01:00
rcombs
df9180d8a0
swscale/output: use isSwappedChroma
2022-01-04 19:39:22 -06:00
rcombs
cb3a6cc082
swscale/output: use isSemiPlanarYUV for NV12/21/24/42 case
2022-01-04 19:39:22 -06:00
rcombs
bb4f19f2a2
swscale/output: use isDataInHighBits for 10-bit case
...
This code will need fleshing-out (probably templating) if we ever add
e.g. a P012 format.
2022-01-04 19:39:22 -06:00
rcombs
cf9e8cb52f
swscale/output: use isSemiPlanarYUV for 16-bit case
2022-01-04 19:39:22 -06:00
rcombs
cb87a3b137
swscale/output: template-ize yuv2nv12cX 10-bit and 16-bit cases
...
Fixes incorrect big-endian output introduced in 88d804b7ff
Avoids making the filter-time BE check more expensive
2022-01-04 19:39:22 -06:00
rcombs
88d804b7ff
swscale: add P210/P410/P216/P416 output
2021-12-22 18:38:40 -06:00
Manuel Stoeckl
32329397e2
swscale: add input/output support for X2BGR10LE
...
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2021-09-26 16:26:10 +02:00
Andreas Rheinhardt
2c05ee092b
avutil/internal, swresample/audioconvert: Remove cpu.h inclusions
...
These inclusions are not necessary, as cpu.h is already included
wherever it is needed (via direct inclusion or via the arch-specific
headers).
Also remove other unnecessary cpu.h inclusions from ordinary
non-headers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com >
2021-07-22 14:33:45 +02:00
Michael Niedermayer
7528532550
swscale/output: Implement dither none for yuv2rgb_write_full()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2021-07-09 12:29:03 +02:00
Anton Khirnov
e15371061d
lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bump
...
They are not properly namespaced and not intended for public use.
2021-01-01 14:14:57 +01:00
Nelson Gomez
360be03b8a
swscale: cosmetic fixes
...
Signed-off-by: Nelson Gomez <nelson.gomez@microsoft.com >
2020-06-14 16:34:07 +01:00
Nelson Gomez
7c39c3c1a6
swscale: make yuv2interleavedX more asm-friendly
...
Extracting information from SwsContext in assembly is difficult, and
rearranging SwsContext just for asm access didn't look good. These
functions only need a couple of fields from it anyway, so just make
them parameters in their own right.
Signed-off-by: Nelson Gomez <nelson.gomez@microsoft.com >
2020-06-14 16:34:07 +01:00
Fei Wang
c721b45014
swscale: Add swscale input/output support for X2RGB10LE
...
Signed-off-by: Fei Wang <fei.w.wang@intel.com >
2020-06-12 17:56:15 +01:00
Mark Reid
b4967fc71c
libswscale: add output support for AV_PIX_FMT_GBRAPF32
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2020-05-05 20:06:58 +02:00
Michael Niedermayer
e057e83a4f
swscale/output: Fix integer overflow in yuv2rgb_write_full() with out of range input
...
Fixes: signed integer overflow: 1169365504 + 981452800 cannot be represented in type 'int'
Fixes: ticket8293
Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2020-04-04 22:09:46 +02:00
Michael Niedermayer
49ba1879ad
swscale/output: Fix integer overflow in alpha computation in yuv2gbrp16_full_X_c()
...
Fixes: signed integer overflow: 524280 * 4432 cannot be represented in type 'int'
Fixes: ticket8322
Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2020-04-04 22:09:46 +02:00
Michael Niedermayer
7b7f97532b
swscale/output: Fix several invalid shifts in yuv2rgb_full_1_c_template()
...
Fixes: Invalid shifts
Fixes : #8320
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2020-01-22 18:41:46 +01:00
Michael Niedermayer
d260621089
swscale/output: Avoid 64bit in Alpha in yuv2ya16_X_c_template()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2019-10-16 19:17:57 +02:00
Michael Niedermayer
3e6682931b
swscale/output: Correct Alpha in yuv2ya16_X_c_template()
...
Untested, no testcase
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2019-10-16 19:17:57 +02:00
Michael Niedermayer
4f4ca675e5
swscale/output: Implement Luma computation from yuv2ya16_X_c_template() without 64bit
...
This also reverts 21838cad2f
The revert is in this commit to avoid 2 fate updates
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2019-10-16 19:17:57 +02:00
Paul B Mahol
21838cad2f
swscale/output: fix signed integer overflow for ya16
...
Fixes #7666 .
2019-09-26 15:56:47 +02:00
Linjie Fu
ef1342650f
swscale/output: fix some code indentations
...
Signed-off-by: Linjie Fu <linjie.fu@intel.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2019-09-06 22:06:12 +02:00
Philip Langdale
cd48318035
swscale: Add support for NV24 and NV42
...
The implementation is pretty straight-forward. Most of the existing
NV12 codepaths work regardless of subsampling and are re-used as is.
Where necessary I wrote the slightly different NV24 versions.
Finally, the one thing that confused me for a long time was the
asm specific x86 path that did an explicit exclusion check for NV12.
I replaced that with a semi-planar check and also updated the
equivalent PPC code, which Lauri kindly checked.
2019-05-12 07:51:02 -07:00
Lauri Kasanen
81a4719d8e
swscale: Remove duplicated code
...
In this function, the exact same clamping happens both in the if and unconditionally.
2019-03-27 09:00:06 +02:00
Martin Vignali
db4771af81
swscale : add YA16 LE/BE output
2018-10-18 21:43:24 +02:00
Sergey Lavrushkin
582bc5a348
libswscale: Adds conversions from/to float gray format.
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2018-08-14 18:22:39 +02:00
Philip Langdale
9d5aff09a7
swscale: Add p016 output support and generalise yuv420p1x to p010
...
To make the best use of existing code, I generalised the wrapper
that currently does yuv420p10 to p010 to support any mixture of
input and output sizes between 10 and 16 bits. This had the side
effect of yielding a working code path for all yuv420p1x formats
to p01x.
2018-03-02 14:52:48 -08:00
James Cowgill
013ec23cbe
swscale: fix gbrap16 alpha channel issues
...
Fixes filter-pixfmts-scale test failing on big-endian systems due to
alpSrc not being cast to (const int32_t**).
Also fixes distortions in the output alpha channel values by copying the
alpha channel code from the rgba64 case found elsewhere in output.c.
Fixes ticket 6555.
Signed-off-by: James Cowgill <James.Cowgill@imgtec.com >
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2017-08-05 23:24:02 +02:00
Paul B Mahol
6427c9ffee
swscale: add gbr(a)p16 output support
2016-12-01 21:37:25 +01:00
Michael Niedermayer
b828788d58
swscale: Add GBRAP10 output
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-11-10 00:33:12 +01:00
Luca Barbato
2c7d8cbd66
swscale: Add the GBRAP12 output
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-11-10 00:33:12 +01:00
Michael Niedermayer
873d06c76e
swscale/output: Fix alpha shift in yuv2gbrp_full_X_c()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-11-10 00:33:12 +01:00
Michael Niedermayer
d736b52a04
swscale: Drop is9_OR_10BPS() use, its name is not correct
...
Found-by: Luca Barbato
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-11-10 00:33:12 +01:00
Timo Rothenpieler
99882d05a6
swscale: add support for P010LE/BE output
2016-08-31 13:19:46 +02:00
Michael Niedermayer
76d377d0a0
swscale/output: Fix rounding offset in yuv2gbrp_full_X_c()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc >
2016-08-23 02:46:02 +02:00
Clément Bœsch
8ef57a0d61
Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
...
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
cosmetics: Fix spelling mistakes
Merged-by: Clément Bœsch <u@pkh.me >
2016-06-21 21:55:34 +02:00
Vittorio Giovara
41ed7ab45f
cosmetics: Fix spelling mistakes
...
Signed-off-by: Diego Biurrun <diego@biurrun.de >
2016-05-04 18:16:21 +02:00
Diego Biurrun
0f40c90984
Drop pointless assert.h #includes
2016-05-03 15:45:10 +02:00