aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/output.c
Commit message (Collapse)AuthorAgeFilesLines
* swscale/output: Fix all bilinear integer overflowsMichael Niedermayer10 days1-22/+27
| | | | | | | | | Ticket11686 hinted at one of these overflows this fixes them all Issue in line 1325/1326 found by HAORAN FANG <xfanghaoran@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/output: Fix integer overflow with lum/chr/alpha filterMichael Niedermayer10 days1-47/+47
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale: add support for new 10/12 bit MSB formatsTimo Rothenpieler2025-07-111-0/+117
|
* swscale/output: Fix integer overflows in yuv2rgba64_1_c_template()Michael Niedermayer2025-07-061-4/+4
| | | | | | | | Fixes: signed integer overflow: -132524 * 16525 cannot be represented in type 'int' Fixes: 414862270/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4869083202125824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/output: fix integer overflow in yuv2rgba64_full_1_c_template()Michael Niedermayer2025-05-151-4/+4
| | | | | | | | Fixes: signed integer overflow: -293650 * 16525 cannot be represented in type 'int' Fixes: 408304111/clusterfuzz-testcase-minimized-ffmpeg_SWS_fuzzer-4762210299871232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/output: Fix integer overflow in yuv2gbrp_full_X_c()Michael Niedermayer2025-04-101-3/+3
| | | | | | | | 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>
* avutil/libm: Only include intfloat.h when neededAndreas Rheinhardt2025-03-221-1/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/output: add support for NV20James Almer2025-03-191-21/+28
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: Fix undefined overflow in yuv2rgba64_full_X_c_template()Michael Niedermayer2025-01-081-3/+3
| | | | | | | | 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>
* swscale/output: fix bilinear yuv2rgb chroma interpolationNiklas Haas2024-12-211-12/+24
| | | | | | | | | | | | | | | | | | | These functions were divided into two special cases; one assuming that uvalpha == 0, and the other assuming that uvalpha == 2048. This worked fine for simple 2x chroma upscaling but broke for e.g. yuv410p, non-centered chroma, or other special cases that involved non-aligned chroma filters. Fix it by instead dividing this check into two cases, a uvalpha==0 fast path and a uvalpha>0 general path. Instead of (A+B)/2 the general path now multiplies in the true uvalpha weight. I tried preserving the old fast path for the case of uvalpha == 2048, but this was significantly slower in practise versus having just one general path. However, we still need a uvalpha == 0 path for the unscaled case. Fixes: ticket #5083 Signed-off-by: Niklas Haas <git@haasn.dev> Sponsored-by: Sovereign Tech Fund
* swscale/internal: group user-facing options togetherNiklas Haas2024-11-211-12/+12
| | | | | | | | This is a preliminary step to separating these into a new struct. This commit contains no functional changes, it is a pure search-and-replace. Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <git@haasn.dev>
* swscale/output: add full chroma interpolation support for x2rgb10James Almer2024-11-021-0/+25
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add XV48 output supportJames Almer2024-10-261-13/+24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: used unsigned for bit accumulationMichael Niedermayer2024-10-251-4/+5
| | | | | | | | 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>
* swscale: rename SwsContext to SwsInternalNiklas Haas2024-10-241-55/+55
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* swscale/output: add Y216LE output supportJames Almer2024-10-231-0/+44
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: fix alpha endianness in XV36James Almer2024-10-171-1/+1
| | | | | | Mistakenly written in native endianness in 42098f92662c47659df85173d8076b62a23269aa. Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: fill the xv30le alpha bitsJames Almer2024-10-171-2/+3
| | | | | | As with other pixel formats, set the undefined alpha bits to opaque. Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add AYUV64BE output supportJames Almer2024-10-171-10/+37
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add X36VBE output supportJames Almer2024-10-171-9/+37
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: fill all the xv36le alpha bitsJames Almer2024-10-171-2/+2
| | | | | | The format is 10 bit per component, not 8. Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add V30X output supportJames Almer2024-10-121-7/+30
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add VYU444 output supportJames Almer2024-10-121-0/+124
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add UYVA output supportJames Almer2024-10-121-0/+11
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add AYUV output supportJames Almer2024-10-121-32/+77
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add missing yuv2packed1 and yuv2packed2 support for VUY{X,A}James Almer2024-10-121-0/+108
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: Fix undefined integer overflow in yuv2rgba64_2_c_template()Michael Niedermayer2024-09-191-11/+11
| | | | | | | | 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>
* swscale/output: don't leave the alpha channel undefined in vuyx and xv36leJames Almer2024-08-131-32/+6
| | | | | | It's non-determistic, as shown by poisoning avfilter buffers instead of zeroing them. Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: Fix integer overflows in yuv2rgba64_X_c_templateMichael Niedermayer2024-07-211-13/+13
| | | | | | | | 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>
* swscale/output: Avoid undefined overflow in yuv2rgb_write_full()Michael Niedermayer2024-06-261-3/+3
| | | | | | | | 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>
* swscale/output: alpha can become negative after scaling, use multiplyMichael Niedermayer2024-06-261-6/+6
| | | | | | | | 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>
* swscale/output: Fix integer overflow in yuv2rgba64_full_1_c_template()Michael Niedermayer2024-05-061-8/+8
| | | | | | | | | | 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>
* swscale/output: Fix integer overflow in yuv2rgba64_1_c_templateMichael Niedermayer2024-05-061-22/+22
| | | | | | | | | | | 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>
* swscale: add GBRAP14 format supportPaul B Mahol2023-09-281-0/+2
|
* swscale/output: Bias 16bps output calculations to improve non overflowing ↵Michael Niedermayer2022-11-041-14/+11
| | | | | | | range for GBRP16/GBRPF32 Fixes: integer overflow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/output: Bias 16bps output calculations to improve non overflowing rangeMichael Niedermayer2022-11-041-60/+60
| | | | | | | | | 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>
* swscale/output: Don't call av_pix_fmt_desc_get() in a loopAndreas Rheinhardt2022-09-191-42/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, libswscale/output.c used a macro to write an output pixel which involved a call to av_pix_fmt_desc_get() to find out whether the input pixel format is BE or LE despite this being known at compile-time (there are templates per pixfmt). Even worse, these calls are made in a loop, so that e.g. there are eight calls to av_pix_fmt_desc_get() for every pixel processed in yuv2rgba64_X_c_template() for 64bit RGB formats. This commit modifies these macros to ensure that isBE() is evaluated at compile-time. This saved 41184B of .text for me (GCC 11.2, -O3). Of course, it also improved performance. E.g. ffmpeg_g -f lavfi -i testsrc2,format=yuva420p -pix_fmt rgba64le \ -threads 1 -t 1:00 -f null - (which uses yuv2rgba64le_X_c, which is an invocation of yuv2rgba64_X_c_template() mentioned above), performance improved from 95589 to 41387 decicycles for one call to yuv2packedX; for the be variant the numbers went down from 76087 to 43024 decicycles. Reviewed-by: Anton Khirnov <anton@khirnov.net> Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/output: add support for Y210LE and Y212LEPhilip Langdale2022-09-101-0/+48
|
* swscale/output: add support for XV30LEPhilip Langdale2022-09-101-0/+31
|
* swscale/output: add support for XV36LEPhilip Langdale2022-09-101-0/+29
|
* swscale/output: add support for P012Philip Langdale2022-09-101-59/+81
| | | | This generalises the existing P010 support.
* libswscale: add support for VUYX formatPhilip Langdale2022-08-251-4/+31
| | | | | | As we already have support for VUYA, I figured I should do the small amount of work to support VUYX as well. That means a little refactoring to share code.
* swscale/output: fix reading chroma values when generating vuya outputJames Almer2022-08-081-2/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: add VUYA output supportJames Almer2022-08-071-0/+57
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/output: use isSwappedChromarcombs2022-01-041-2/+1
|
* swscale/output: use isSemiPlanarYUV for NV12/21/24/42 casercombs2022-01-041-2/+1
|
* swscale/output: use isDataInHighBits for 10-bit casercombs2022-01-041-3/+2
| | | | | This code will need fleshing-out (probably templating) if we ever add e.g. a P012 format.
* swscale/output: use isSemiPlanarYUV for 16-bit casercombs2022-01-041-3/+1
|
* swscale/output: template-ize yuv2nv12cX 10-bit and 16-bit casesrcombs2022-01-041-7/+41
| | | | | | Fixes incorrect big-endian output introduced in 88d804b7ffa20caab2e8e2809da974c41f7fd8fc Avoids making the filter-time BE check more expensive
* swscale: add P210/P410/P216/P416 outputrcombs2021-12-221-2/+6
|