summaryrefslogtreecommitdiff
path: root/libswscale
Commit message (Collapse)AuthorAge
* 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/alphablend: Fix slice handlingMichael Niedermayer2021-10-03
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/swscale_internal: Avoid unsigned for slice parametersMichael Niedermayer2021-09-30
| | | | | | | | Mixing unsigned and signed often leads to unexpected arithmetic results. Fixes: out of array write Found-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> 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>
* swscale/yuv2rgb: fix conversion to X2RGB10Manuel Stoeckl2021-09-26
| | | | | | | | | This resolves a problem where conversions from YUV to X2RGB10LE would produce color values a factor 4 too small, because an 8-bit value was placed in a 10-bit channel. 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: 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/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>
* 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
|
* avutil/internal, swresample/audioconvert: Remove cpu.h inclusionsAndreas Rheinhardt2021-07-22
| | | | | | | | | | 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>
* swscale/slice: Fix wrong return on errorMichael Niedermayer2021-07-09
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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>
* swscale/output: Implement dither none for yuv2rgb_write_full()Michael Niedermayer2021-07-09
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/slice: Check slice for allocation failureMichael Niedermayer2021-07-09
| | | | | | | | Fixes: null pointer dereference Fixes: alloc_slice.mp4 Found-by: Rafael Dutra <rafael.dutra@cispa.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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.
* 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>
* swscale/swscale_unscaled: don't use the optimized bgr24toYV12 unscaled ↵Limin Wang2021-06-06
| | | | | | | conversion when width%2 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* Bump major versions of all libraries.Anton Khirnov2021-04-27
| | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* 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>
* Include attributes.h directlyAndreas Rheinhardt2021-04-19
| | | | | | | | Some files currently rely on libavutil/cpu.h to include it for them; yet said file won't use include it any more after the currently deprecated functions are removed, so include attributes.h directly. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libswscale/x86/yuv2yuvX: Removes unrolling for mmx and mmxextAlan Kelly2021-04-01
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libswscale/x86/swscale: Only call ff_yuv2yuvX functions if the input size is > 0Alan Kelly2021-04-01
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump minor versions after release branchMichael Niedermayer2021-03-20
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Bump Versions before release/4.4 branchMichael Niedermayer2021-03-20
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swscale/x86/swscale: Remove unused ASM constantsAndreas Rheinhardt2021-02-24
| | | | | | | | | | | | | The last user of g15Mask, r15Mask, g16Mask and r16Mask was disabled in 77a416e8aab77058b542030870fd7178b62d2a62 and finally removed in 36e8de07ed62609df45d064b56501e3084d25723; b15Mask and b16Mask were apparently always unused (except for in_asm_used_var_warning_killer, a function that only existed to make the compiler not optimize ASM constants away). w10 is unused since d604bab901f6dfaaad672ef2164e42b1f350474c, w02 since ef423a661818f3c0d8206a2abbc65ff555cc0c67. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* swscale/x86/rgb2rgb: Remove unused ASM constantsAndreas Rheinhardt2021-02-24
| | | | | | | | | mask24hh etc. are unused since f099fbf5f3ac1d6b3753fc8dfda6558572111fbd, mask32b and mask32r since 296609f859a587575b91fe9e9691f2707d6e8136, mask32g since b38d487466e68bd6baf2889017d2a751831560f0 and mask32 since f8a138be5257f751ef7d3c6b7ab534c0434e90e7. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* swscale/x86/yuv2rgb: Remove unused ASM constantsAndreas Rheinhardt2021-02-24
| | | | | | | mmx_grnmask is unused since 531f97b0c32d1d421f3ac614e002c53951658115, the other constants since e934194b6a4159b7960cabefb0dd8b998c1961e8. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environmentsChip Kerchner2021-02-22
| | | | | | | | | Add inline function for vec_xl if VSX is not supported. vec_xl intrinsic is only available on POWER 7 or higher. Fixes ticket #8750. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>