summaryrefslogtreecommitdiff
path: root/libswscale/swscale.c
Commit message (Collapse)AuthorAge
* swscale/swscale: Check srcSliceH for bayerMichael Niedermayer2024-02-21
| | | | | Fixes: Assertion srcSliceH > 1 failed at libswscale/swscale_unscaled.c:1359 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale: fix sws_setColorspaceDetails after sws_init_contextNiklas Haas2023-11-09
| | | | | | | | | | | | | | | | | | | | | | | | | More commonly, this fixes the case of sws_setColorspaceDetails after sws_getContext, since the latter implies sws_init_context. The problem here is that sws_init_context sets up the range conversion and fast path tables based on the values of srcRange/dstRange at init time. This may result in locking in a "wrong" path (either using unscaled fast path when range conversion later required, or using scaled slow path when range conversion becomes no longer required). There are two way outs: 1. Always initialize range conversion and unscaled converters, even if they will be unused, and extend the runtime check. 2. Re-do initialization if the values change after sws_setColorspaceDetails. I opted for approach 1 because it was simpler and easier to reason about. Reword the av_log message to make it clear that this special converter is not necessarily used, depending on whether or not there is range conversion or YUV matrix conversion going on.
* avutil/internal: Don't auto-include emms.hAndreas Rheinhardt2023-09-04
| | | | | | Instead include emms.h wherever it is needed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/la: Optimize hscale functions with lasx.Hao Chen2022-09-10
| | | | | | | | | | ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -s 640x480 -y /dev/null -an before: 101fps after: 138fps Signed-off-by: Hao Chen <chenhao@loongson.cn> Reviewed-by: yinshiyou-hf@loongson.cn Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* all: Replace if (ARCH_FOO) checks by #if ARCH_FOOAndreas Rheinhardt2022-06-15
| | | | | | | | | | | | | | | | | | This is more spec-compliant because it does not rely on dead-code elimination by the compiler. Especially MSVC has problems with this, as can be seen in https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html or https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html This commit does not eliminate every instance where we rely on dead code elimination: It only tackles branching to the initialization of arch-specific dsp code, not e.g. all uses of CONFIG_ and HAVE_ checks. But maybe it is already enough to compile FFmpeg with MSVC with whole-programm-optimizations enabled (if one does not disable too many components). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-24
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/swscale: check SWS_PRINT_INFO flag for printing alignment warningsSoft Works2021-11-13
| | | | | | | | This makes output consistent with a similar warning just few lines above where this flag is checked in the same way. Signed-off-by: softworkz <softworkz@hotmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* swscale/swscale: Pass slice location into unscaled code also for dst scalingMichael Niedermayer2021-10-03
| | | | | | | Fixes: alphablend=checkerboard Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: Disable x86-specific code for other archesAndreas Rheinhardt2021-09-19
| | | | | | | | SSE2 is x86 specific, yet due to the call to av_get_cpu_flags() compilers were unable to optimize the checks (and the call) away on other arches. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/swscale: Fix races when using unaligned strides/dataAndreas Rheinhardt2021-09-19
| | | | | | | | | | | | | | | | | | | | | | | | In this case the current code tries to warn once; to do so, it uses ordinary static ints to store whether the warning has already been emitted. This is both a data race (and therefore undefined behaviour) as well as a race condition, because it is really possible for multiple threads to be the one thread to emit the warning. This is actually common since the introduction of the new multithreaded scaling API. This commit fixes this by using atomic integers for the state; furthermore, these are not static anymore, but rather contained in the user-facing SwsContext (i.e. the parent SwsContext in case of slice-threading). Given that these atomic variables are not intended for synchronization at all (but only for atomicity, i.e. only to output the warning once), the atomic operations use memory_order_relaxed. This affected the nv12, nv21, yuv420, yuv420p10, yuv422, yuv422p10 and yuv444 filter-overlay FATE-tests. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libswscale/swscale: initialize all dst plane pointers in sws_receive_slice()James Almer2021-09-07
| | | | | | Fixes valgrind warnings about use of uninitialised values. Signed-off-by: James Almer <jamrial@gmail.com>
* sws: implement slice threadingAnton Khirnov2021-09-06
|
* sws: add a new scaling APIAnton Khirnov2021-09-06
|
* sws: move updating the palette higher upAnton Khirnov2021-07-03
| | | | | It does not interact in any way with the code setting up the image pointers/strides, so it should not be intermixed with it.
* sws: move initializing dither_error higher upAnton Khirnov2021-07-03
| | | | | It does not interact in any way with the code setting up the image pointers/strides, so it should not be intermixed with it.
* sws: move the early return for zero-sized slices higher upAnton Khirnov2021-07-03
| | | | | Place it right after the input parameter validation. There is no point in performing any setup if the sws_scale() call won't do anything.
* sws: simplify setting sliceDirAnton Khirnov2021-07-03
|
* sws: merge handling frame start into a single blockAnton Khirnov2021-07-03
| | | | Also, return an error code on failure rather than 0.
* sws: make checking for the start of a new frame more explicitAnton Khirnov2021-07-03
|
* sws: reset sliceDir at the end of sws_scale()Anton Khirnov2021-07-03
| | | | | Makes it more clear that resetting it does not interact with the scaling code that it is currently intermixed with.
* sws: rename SwsContext.swscale to convert_unscaledAnton Khirnov2021-07-03
| | | | That function pointer is now used only for unscaled conversion.
* sws: separate the calls to scaled vs unscaled conversionAnton Khirnov2021-07-03
| | | | | | | | | | Call the scaler function directly rather than through a function pointer. Drop the now-unused return value from ff_getSwsFunc() and rename the function to reflect its new role. This will be useful in the following commits, where it will become important that the amount of output is different for scaled vs unscaled case.
* sws: do not reallocate scratch buffers for each sliceAnton Khirnov2021-07-03
|
* sws: group the parameters validity checks togetherAnton Khirnov2021-07-03
| | | | Also, fail with an error code rather than 0.
* sws: initialize {src,dst}Stride2 consistently with {src,dst}2Anton Khirnov2021-07-03
|
* sws: cosmeticsAnton Khirnov2021-07-03
| | | | Reindent after previous commit, rewrap long lines.
* sws: factor out cascaded scalingAnton Khirnov2021-07-03
|
* sws: cosmeticsAnton Khirnov2021-07-03
| | | | Reindent after previous commit, split long lines.
* sws: factor out gamma-correct scalingAnton Khirnov2021-07-03
|
* sws: return an error code on invalid parameters to sws_scale()Anton Khirnov2021-07-03
|
* sws: reindent after previous commitAnton Khirnov2021-07-03
|
* sws: factor out updating the paletteAnton Khirnov2021-07-03
|
* sws: remove unnecessary bracesAnton Khirnov2021-07-03
| | | | | There used to be more code inside them, but it was removed in 6de58b49032a206985602effec91e5e46c886ea2.
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-01
| | | | They are not properly namespaced and not intended for public use.
* libswscale: add output support for AV_PIX_FMT_GBRAPF32Mark Reid2020-05-05
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: remove useless codeRuiling Song2020-04-03
| | | | | Signed-off-by: Ruiling Song <ruiling.song@intel.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: Fix several invalid shifts related to vChrDropMichael Niedermayer2020-01-22
| | | | | | | | | Fixes: Invalid shifts Fixes: #8166 Fixes: filter-crop_scale_vflip FATE-test Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: cosmeticsLimin Wang2019-09-27
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: delete unwanted assignmentsLimin Wang2019-09-09
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale : small cosmeticMartin Vignali2018-08-22
|
* swscale : treat float input data as uint 16bpcMartin Vignali2018-08-22
| | | | | | | | | Currently float are converted to 16b uint in input part using src depth (32 bits) in hScale16To19 and hScale16to15, make an invalid shift for the data So shift the value when using float input like 16 bpc uint.
* Fix several typosLou Logan2017-09-21
| | | | | | | "apix_fmts" found by Marc Péchaud. "speedloss" found by Mikhail V. Signed-off-by: Lou Logan <lou@lrcd.com>
* swscale/swscale: Fix dereference of stride array before null checkMichael Niedermayer2016-12-23
| | | | | | | Fixes: CID1396263 Fixes: CID1396271 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale: Drop is9_OR_10BPS() use, its name is not correctMichael Niedermayer2016-11-10
| | | | | Found-by: Luca Barbato Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale: fix for sliced scaling artifactsPedro Arthur2016-09-16
| | | | Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
* swscale: Fix "warning: ISO C90 forbids mixed declarations and code"Michael Niedermayer2016-09-07
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: Try to fix rgb48Toxyz12() with slicesMichael Niedermayer2016-09-02
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale: Factor bottom to top handlingMichael Niedermayer2016-09-02
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Revert "PPC64: Add versions of functions in libswscale/input.c optimized for ↵Ronald S. Bultje2016-07-11
| | | | | | | POWER8 VSX SIMD." This reverts commit 1df908f33f658979b32599489ca6f1a39821013c. The expected performance improvements are essentially non-existent.
* PPC64: Add versions of functions in libswscale/input.c optimized for POWER8 ↵Dan Parrot2016-06-30
| | | | | | | | | | VSX SIMD. This patch addresses Trac ticket #5570. The optimized functions are in file libswscale/ppc/input_vsx.c. Each optimized function name is a concatenation of the corresponding name in libswscale/input.c with suffix _vsx. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>