Commit Graph

376 Commits

Author SHA1 Message Date
Michael Niedermayer cc538e9dbd swscale/utils: Detect and skip unneeded sws_setColorspaceDetails() calls
This avoids running various table inits unnecessarily

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-14 15:46:55 +01:00
Michael Niedermayer 1edf129cbc swscale/utils: Use normal bilinear scaler if fast cannot be used due to tiny dimensions
Fixes Ticket4960

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-04 23:54:11 +01:00
Michael Niedermayer b83d8be6bf swscale/utils: Fix intermediate format for cascaded alpha downscaling
Fixes Ticket4926

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-24 21:46:15 +01:00
Ganesh Ajjanagadde c8905e0d67 swscale/utils: replace pow by exp2
exp2 is a faster function.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-08 22:00:05 -05:00
Michael Niedermayer 325b59368d swscale/utils: Fix for runtime error: left shift of negative value -1
Fixes: c106b36fa36db8ff8f3ed0c82be7bea2/asan_heap-oob_32699f0_6321_467b9a1d7e03d7cfd310b7e65dc53bcc.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-04 21:44:53 +01:00
Andreas Cadhalpun e8c3716064 swscale: rename sws_rgb2rgb_init to ff_sws_rgb2rgb_init
It is an internal swscale function and thus should not be exported.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-29 23:49:46 +01:00
Andreas Cadhalpun 8bfbc8c5e5 swscale: rename sws_context_class to ff_sws_context_class
It is an internal swscale symbol and thus should not be exported.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-29 23:49:10 +01:00
Ganesh Ajjanagadde 26e8895b73 all: add _DEFAULT_SOURCE locally wherever needed
Glibc 2.20 onwards generates a deprecation warning for usage of _BSD_SOURCE and _SVID_SOURCE.
The solution from man feature_test_macros is to define both _DEFAULT_SOURCE and the old macros.
This solution is on the lines of the one in commit af1818276e.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2015-10-04 12:15:16 -04:00
Michael Niedermayer d730dd8c53 swscale: Forward colorspace updates to the 2nd cascaded context in case of alphablend
The first just does the blending and wouldnt do anything with the colorspace values

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-10 17:05:20 +02:00
Michael Niedermayer 21c7272859 swscale/utils: Forward luma range to the cascaded context for alphablending
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-10 17:05:20 +02:00
Michael Niedermayer 319898bba2 swscale/utils: handle gray+alpha formats like gray for luma ranges
Its illogic to handle gray differently depending on the existence of an alpha channel

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-10 15:00:19 +02:00
Michael Niedermayer 816cf5181e swscale/utils: If the source has no alpha then disable alpha blendaway
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-10 15:00:19 +02:00
Hendrik Leppkes 5d8e836d0e Replace all remaining occurances of step/depth_minus1 and offset_plus1 2015-09-08 17:10:48 +02:00
Hendrik Leppkes 151aa2ebff Merge commit '2268db2cd052674fde55c7d48b7a5098ce89b4ba'
* commit '2268db2cd052674fde55c7d48b7a5098ce89b4ba':
  lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fields

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-08 16:35:28 +02:00
Vittorio Giovara 2268db2cd0 lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fields
The new fields can be accessed directly and are more intelligible.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-07 12:37:47 +02:00
Pedro Arthur 3059562aa1 swscale: re-enable gamma
+added gamma conversion to refactored code
2015-09-04 19:00:20 -03:00
Michael Niedermayer 1acd6311a1 swscale/utils: If cascaded contexts are used forward sws_setColorspaceDetails() to the first context
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 02:00:55 +02:00
Michael Niedermayer 8e05f9217a swscale/utils: Split scaling if possible and yuv->yuv with different matrixes is requested
This uses a RGB intermediate, a more optimal solution would be to perform the rematrixing
directly in subsampled YUV, this is quite a bit more complicated though

Fixes Ticket4805

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 02:00:19 +02:00
Pedro Arthur e0a3173a94 swscale: refactor horizontal scaling
+ split color conversion from scaling
- disabled gamma correction, until it's refactored too

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-18 01:33:32 +02:00
Michael Niedermayer 0f9d46b70d swscale/alphablend: Support chroma subsampling
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-09 18:04:46 +02:00
Michael Niedermayer b7faa9d314 swscale/alphablend: support packed pixel formats
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-09 15:58:43 +02:00
Michael Niedermayer d0e0757e9a swscale: Implement alphablendaway for planar 4:4:4 formats
Fixes Ticket4746

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-08 13:24:52 +02:00
Michael Niedermayer c382d9e8cb swscale: Add sws_alloc_set_opts()
This simplifies allocating and initializing swscale contexts with custom options.
The function is internal currently but could be moved into the public header

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-08 13:08:16 +02:00
Paul B Mahol 3cb8eee6f7 swscale: ayuv64le output support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-24 03:45:48 +00:00
Paul B Mahol 052f64ecb2 swscale: ayuv64le input support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-24 03:44:58 +00:00
Michael Niedermayer a5d44d5c22 swscale/utils: Clear pix buffers
Fixes use of uninitialized memory
Fixes: a96874b9466b6edc660a519c7ad47977_signal_sigsegv_7ffff713351a_744_nc_sample.avi with memlimit 2147483648

Found-by: Samuel Groß, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-15 20:06:34 +02:00
Paul B Mahol 2778fdbe54 swscale: implement YA8 output
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-07-02 17:36:05 +00:00
Michael Niedermayer e29d996149 swscale/output: Add rgba64/rgb48/bgra64/bgr48 output functions with full chroma interpolation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 00:45:46 +02:00
Michael Niedermayer 80b5a1e2ee Mark vectors as NAN instead of dereferencing NULL pointers on malloc failure
Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-12 15:06:32 +02:00
Michael Niedermayer ae0148ff60 swscale: Assert that pixel format descriptor is not NULL
This may help static analyzers, the pixel format is checked
during initialization

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-12 14:47:37 +02:00
Ronald S. Bultje 711d8812ad swscale: add yuv440p10/12 pixfmts. 2015-05-06 12:04:31 -04:00
Michael Niedermayer b57f9f5724 swscale/swscale: Get rid of the SWS_GAMMA_CORRECT flag
This avoids using up a bit of the public flags

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-23 20:34:51 +02:00
Pedro Arthur 2a7128f4ed Add gamma encodign/decoding before/after scaling in libswscale
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-23 20:34:51 +02:00
Michael Niedermayer 324067d18b Merge commit '7ebb3022297aa00afda6800105684b8303f2608e'
* commit '7ebb3022297aa00afda6800105684b8303f2608e':
  swscale: Check memory allocation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-22 03:40:37 +01:00
Federico Tomassetti 7ebb302229 swscale: Check memory allocation
Bug-Id: CID 1267890
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-03-21 23:18:11 +01:00
Michael Niedermayer fa74058dd3 swscale/utils: Fix undefined shift in initFilter()
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 15:40:28 +01:00
Michael Niedermayer 007498fc1a swscale/utils: clear formatConvBuffer on allocation
Fixes use of uninitialized memory
Fixes: asan_heap-oob_35ca682_1474_cov_3230122439_aletrek_tga_16bit.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-27 03:13:14 +01:00
Michael Niedermayer fb8e5044b4 swscale/utils: add asserts to check filterpos
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-24 01:00:24 +01:00
Michael Niedermayer 1895d414aa swscale/utils: More carefully merge and clear coefficients outside the input
Fixes out of array read
Fixes: asan_heap-oob_35ca682_1474_cov_3230122439_aletrek_tga_16bit.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-24 01:00:24 +01:00
Michael Niedermayer 2a1b79d7e6 Merge commit 'e51f22122d23589e93ac4f0b3e570bb925755915'
* commit 'e51f22122d23589e93ac4f0b3e570bb925755915':
  swscale: Check memory allocations

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 22:22:17 +01:00
Federico Tomassetti e51f22122d swscale: Check memory allocations
CC: libav-stable@libav.org
Bug-Id: CID 1267888 / CID 1267890
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-02-17 12:16:43 -05:00
Michael Niedermayer 692b22626e swscale/utils: Limit filter shifting so as not to read from prior the array
Fixes out of array read
Fixes: asan_heap-oob_1fb2f9b_3780_cov_3984375136_usf.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-05 00:33:50 +01:00
Michael Niedermayer 27513846f6 Merge commit '928061670e873e816daa14827853b7e11221ff5f'
* commit '928061670e873e816daa14827853b7e11221ff5f':
  libswscale: GBRAP input & output and GBRAP16 input support

Conflicts:
	libswscale/input.c
	libswscale/swscale_internal.h
	libswscale/swscale_unscaled.c
	libswscale/utils.c
	tests/ref/fate/filter-pixdesc-gbrap
	tests/ref/fate/filter-pixfmts-copy
	tests/ref/fate/filter-pixfmts-null
	tests/ref/fate/filter-pixfmts-scale
	tests/ref/fate/filter-pixfmts-vflip

See: 5c057433cc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 05:47:25 +01:00
Paul B Mahol 928061670e libswscale: GBRAP input & output and GBRAP16 input support
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-01-14 17:17:24 +01:00
Kieran Kunhya 18982f084c swscale: Pass through chroma positions in sws_getCachedContext
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-26 17:55:12 +01:00
Michael Niedermayer 2f6bb86f85 swscale/utils: support bayer input + scaling, and bayer input + any supported output
Fixes Ticket4053

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-12 23:59:37 +01:00
Michael Niedermayer fba894615d swscale: support internal scaler cascades
Fixes Ticket3170

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-11 05:05:17 +02:00
James Almer fb7d8d50bc swscale: remove obsolete FF_API_SWS_FORMAT_NAME cruft
Signed-off-by: James Almer <jamrial@gmail.com>
2014-10-05 17:10:29 -03:00
Michael Niedermayer 61af6bebb4 swscale: Allow chroma samples to be above and to the left of luma samples
Found-by: Kierank
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 12:23:24 +02:00
Michael Niedermayer 4917fecf4a Merge commit 'bb789016d423d2cfacd2904ac66257bdf7f0964e'
* commit 'bb789016d423d2cfacd2904ac66257bdf7f0964e':
  swscale: Undeprecate sws_getContext()

Conflicts:
	libswscale/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-07 20:52:40 +02:00