summaryrefslogtreecommitdiff
path: root/libswscale/utils.c
Commit message (Collapse)AuthorAge
* sws/utils.c: Do not uselessly call initFilter() when unscalingTomas Härdin2023-02-08
|
* swscale/utils: Fix indentationAndreas Rheinhardt2022-11-24
| | | | | | Forgotten after c1eb3e7fecdc270e03a700d61ef941600a6af491. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/utils: Derive range from YUVJ-pix-fmt only onceAndreas Rheinhardt2022-11-24
| | | | | | | | | | | | | | Currently, it is done once per slice-thread, leading to one warning per slice-thread in case a YUVJ pixel format has been originally used. This also fixes the anomaly that said parameter are only updated for the user-facing context (whose values are retrievable via av_opt_get()) if slice-threading is not in use. Fixes ticket #9860. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/utils: Move functions to avoid forward declarationsAndreas Rheinhardt2022-11-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/utils: Avoid calling ff_thread_once() unnecessarilyAndreas Rheinhardt2022-11-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/utils: Don't allocate AVFrames for slice contextsAndreas Rheinhardt2022-11-24
| | | | | | Only the parent context's AVFrames are ever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/utils: Factor initializing single slice context outAndreas Rheinhardt2022-11-24
| | | | | | | | | | | | | | | | | | Initializing slice threads currently uses the function (sws_init_context()) that is also used for initializing user-facing contexts with the only difference being that nb_threads is set to one before initializing the slice contexts. Yet sws_init_context() also initializes lots of stuff that is not slice-dependent, i.e. (src|dst)Range. This currently only works because the code sets these fields to the same values for all slice contexts. This is not nice; even worse, it entails that log messages are printed once per slice context (and therefore fill the screen). This commit lays the groundwork to fix this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* swscale/utils: Remove obsolete 3DNow referenceAndreas Rheinhardt2022-11-09
| | | | | | | swscale does not use 3DNow any more since commit 608319a311a31f7d85333a7b08286c00be38eab6. 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>
* swscale/output: add support for Y210LE and Y212LEPhilip Langdale2022-09-10
|
* swscale/output: add support for XV30LEPhilip Langdale2022-09-10
|
* swscale/output: add support for XV36LEPhilip Langdale2022-09-10
|
* swscale/output: add support for P012Philip Langdale2022-09-10
| | | | This generalises the existing P010 support.
* swscale/input: add support for Y212LEPhilip Langdale2022-09-06
|
* swscale/input: add support for XV30LEPhilip Langdale2022-09-06
|
* swscale/input: add support for P012Philip Langdale2022-09-06
| | | | | As we now have three of these formats, I added macros to generate the conversion functions.
* swscale/input: add support for XV36LEPhilip Langdale2022-09-06
|
* libswscale: add support for VUYX formatPhilip Langdale2022-08-25
| | | | | | 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/input: add rgbaf16 input supportTimo Rothenpieler2022-08-19
| | | | | | This is by no means perfect, since at least ddagrab will return scRGB data with values outside of 0.0f to 1.0f for HDR values. Its primary purpose is to be able to work with the format at all.
* libswscale: Enable hscale_avx2 for all input sizes.Alan Kelly2022-08-18
| | | | | | ff_shuffle_filter_coefficients shuffles the tail as required. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* swscale/output: add VUYA output supportJames Almer2022-08-07
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/input: add VUYA input supportJames Almer2022-08-05
| | | | | Reviewed-by: Philip Langdale <philipl@overt.org> Signed-off-by: James Almer <jamrial@gmail.com>
* swscale: add NV16 input/outputMatthieu Bouron2022-07-19
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* 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>
* swscale/aarch64: add hscale specializationsSwinney, Jonathan2022-05-28
| | | | | | | | | | | | | | | | | | | | | | | This patch adds code to support specializations of the hscale function and adds a specialization for filterSize == 4. ff_hscale8to15_4_neon is a complete rewrite. Since the main bottleneck here is loading the data from src, this data is loaded a whole block ahead and stored back to the stack to be loaded again with ld4. This arranges the data for most efficient use of the vector instructions and removes the need for completion adds at the end. The number of iterations of the C per iteration of the assembly is increased from 4 to 8, but because of the prefetching, there must be a special section without prefetching when dstW < 16. This improves speed on Graviton 2 (Neoverse N1) dramatically in the case where previously fs=8 would have been required. before: hscale_8_to_15__fs_8_dstW_512_neon: 1962.8 after : hscale_8_to_15__fs_4_dstW_512_neon: 1220.9 Signed-off-by: Jonathan Swinney <jswinney@amazon.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* lib*/version: Move library version functions into files of their ownAndreas Rheinhardt2022-05-10
| | | | | | | This avoids having to rebuild big files every time FFMPEG_VERSION changes (which it does with every commit). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libswscale: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* swscale: Take the destination range into account for yuv->rgb->yuv conversionsMartin Storsjö2022-02-25
| | | | | | | | | | | | The range parameters need to be set up before calling sws_init_context (which selects which fastpaths can be used; this gets called by sws_getContext); solely passing them via sws_setColorspaceDetails isn't enough. This fixes producing full range YUV range output when doing YUV->YUV conversions between different YUV color spaces. Signed-off-by: Martin Storsjö <martin@martin.st>
* libswscale: Re-factor ff_shuffle_filter_coefficients.Alan Kelly2022-02-17
| | | | | | Make the code more readable and follow the style guide. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libswscale: Check and propagate memory allocation errors from ↵Alan Kelly2022-02-17
| | | | | | ff_shuffle_filter_coefficients. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale: add P210/P410/P216/P416 outputrcombs2021-12-22
|
* libswscale: Test AV_CPU_FLAG_SLOW_GATHER for hscale functions.Alan Kelly2021-12-21
| | | | | This is instead of EXTERNAL_AVX2_FAST so that the avx2 hscale functions are only used where they are faster.
* libswscale: Adds ff_hscale8to15_4_avx2 and ff_hscale8to15_X4_avx2 for all ↵Alan Kelly2021-12-15
| | | | | | | | | | filter sizes. Fixes so that fate under 64 bit Windows passes. These functions replace all ff_hscale8to15_*_ssse3 when avx2 is available. Signed-off-by: James Almer <jamrial@gmail.com>
* swscale: add P210/P410/P216/P416 inputrcombs2021-11-28
|
* swscale/utils: Improve return codes of sws_setColorspaceDetails()Michael Niedermayer2021-10-24
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/utils: Set all threads to the same colorspace even on failureMichael Niedermayer2021-10-24
| | | | | | Fixes: ./ffplay dav.y4m -vf "scale=hd1080:threads=4" Found-by: Paul Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale: add input/output support for X2BGR10LEManuel Stoeckl2021-09-26
| | | | | Signed-off-by: Manuel Stoeckl <code@mstoeckl.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> 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/options: Add parent_log_context_offset to AVClassAndreas Rheinhardt2021-09-19
| | | | | | | | This allows to associate log messages from slice contexts to the user-visible SwsContext. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* sws: implement slice threadingAnton Khirnov2021-09-06
|
* sws: add a new scaling APIAnton Khirnov2021-09-06
|
* swscale/utils: Use full chroma interpolation for rgb4/8 and dither noneMichael Niedermayer2021-07-09
| | | | | | | | Dither none is only implemented in full chroma interpolation for these rgb formats Its also a obscure choice (producing less nice images) that implementing it in the other code-paths makes no sense Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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
|
* libswscale: Make sws_init_context thread safe.Peter Lundblad2021-07-01
| | | | | | | Call ff_sws_rgb2rgb_init via ff_thread_once instead of checking one of the variables it updates. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libswscale: Remove unused deprecated functions, make used ones staticAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 3b905b9fe611efb3282aa4c5c659e1870d91a83b. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* swscale/utils: override forced-zero formats back to full rangeJan Ekström2020-10-11
| | | | | | | | Fixes vf_scale outputting RGB AVFrames with limited range flagged in case either input or output specifically sets the range. This is the reverse of the logic utilized for RGB and PAL8 content in sws_setColorspaceDetails.
* swscale/utils: split range override check into its own functionJan Ekström2020-10-11
|