Commit Graph

430 Commits

Author SHA1 Message Date
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Luca Barbato 26b5ad2543 swscale: support gray to 9bit and 10bit formats
With the input of Kostya and Ronald.
2012-10-30 12:02:41 +01:00
Anton Khirnov 0a7068fa5d sws: do not use av_pix_fmt_descriptors directly. 2012-10-12 12:45:38 +02:00
Anton Khirnov 716d413c13 Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat 2012-10-08 07:13:26 +02:00
Diego Biurrun b9141aa346 swscale: Remove two bogus asserts 2012-09-13 12:13:28 +02:00
Diego Biurrun 1169f0d0af x86: more specific checks for availability of required assembly capabilities 2012-09-07 18:16:04 +02:00
Diego Biurrun 17337f54c0 x86: Split inline and external assembly #ifdefs 2012-08-31 01:53:25 +02:00
Diego Biurrun 239fdf1b4a x86: build: replace mmx2 by mmxext
Refactoring mmx2/mmxext YASM code with cpuflags will force renames.
So switching to a consistent naming scheme beforehand is sensible.
The name "mmxext" is more official and widespread and also the name
of the CPU flag, as reported e.g. by the Linux kernel.
2012-08-03 22:51:05 +02:00
Ronald S. Bultje 8e5d71d110 swscale: bury one more piece of inline asm under HAVE_INLINE_ASM. 2012-07-29 17:14:48 -07:00
Ronald S. Bultje 3b175384bb swscale: add missing HAVE_INLINE_ASM check.
The function called in this block is under HAVE_INLINE_ASM itself also.
2012-07-22 19:46:47 -07:00
Diego Biurrun ef0ee7f657 swscale: K&R formatting cosmetics (part II)
Also adjust some comments including wording and typo fixes.
2012-04-13 19:22:00 +02:00
Ronald S. Bultje 2254b559cb swscale: make filterPos 32bit.
Fixes overflows for large image sizes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-06 10:47:41 -08:00
Ronald S. Bultje 491865b57d swscale: fix underflows in firstline calculations for extreme resizes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-23 10:30:07 -08:00
Diego Biurrun 92fed11352 swscale: Remove unused variable alpMmxFilter. 2012-02-13 19:20:53 +01:00
Ronald S. Bultje c0b87359b2 swscale: handle gray16 as a "planar" YUV format (Y-only, of course).
This allows removing any gray16-specific code, which is essentially
identical to the per-plane code in yuv2plane*().
2012-02-13 07:14:05 -08:00
Ronald S. Bultje 9d9c846491 swscale: use yuv2packed1() functions for unscaled chroma also. 2012-02-13 07:14:04 -08:00
Ronald S. Bultje 2144941069 swscale: split C output functions into separate file.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-02-07 12:03:51 +01:00
Ronald S. Bultje 2dd7a1c030 swscale: Split C input functions into separate file.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-02-07 12:03:50 +01:00
Ronald S. Bultje f5490fbe3b swscale: remove obsolete comment. 2012-02-01 07:17:01 -08:00
Paul B Mahol 08d8029ea8 swscale: more generic check for planar destination formats with alpha
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-30 07:37:13 -08:00
Paul B Mahol 5cad970971 swscale: RGB4444 and BGR444 input
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-08 20:19:41 -08:00
Ronald S. Bultje 2ba65879b5 swscale: remove unused U/V arguments from yuv2rgb_write().
Also document the function somewhat.
2012-01-05 07:17:01 -08:00
Ronald S. Bultje 6b3995ccd1 swscale: remove obsolete comment. 2012-01-03 20:02:17 -08:00
Ronald S. Bultje 9ea3501d87 swscale: don't show full-chroma-int warning for non-RGB output.
Non-RGB output always uses full chroma interpolation.
2012-01-03 20:01:21 -08:00
Ronald S. Bultje d49352c7cc swscale: fix overflows in vertical scaling at top/bottom edges.
This fixes integer multiplication overflows in RGB48 output
(vertical) scaling as detected by IOC. What happens is that for
certain types of filters (lanczos, spline, bicubic), the
intermediate sum of coefficients in the middle of a filter can
be larger than the fixed-point equivalent of 1.0, even if the
final sum is 1.0. This is fine and we support that.

However, at frame edges, initFilter() will merge the coefficients
for the off-screen pixels into the top or bottom pixel, such as
to emulate edge extension. This means that suddenly, a single
coefficient can be larger than the fixed-point equivalent of
1.0, which the vertical scaling routines do not support.

Therefore, remove the merging of coefficients for edges for
the vertical scaling filter, and instead add edge detection
to the scaler itself so that it copies the pointers (not data)
for the edges (i.e. it uses line[0] for line[-1] as well), so
that a single coefficient is never larger than the fixed-point
equivalent of 1.0.
2011-12-18 08:27:43 -08:00
Ronald S. Bultje 72dafea0fc swscale: fix overflow in gray16 vertical scaling.
This fixes the same overflow as in the RGB48/16-bit YUV scaling;
some filters can overflow both negatively and positively (e.g.
spline/lanczos), so we bias a signed integer so it's "half signed"
and "half unsigned", and can cover overflows in both directions
while maintaining full 31-bit depth.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 22:41:53 +00:00
Mans Rullgard 77d88b872d swscale: fix integer overflows in RGB pixel writing.
We're shifting individual components (8-bit, unsigned) left by 24,
so making them unsigned should give the same results without the
overflow.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-12-17 18:59:24 +00:00
Ronald S. Bultje be1bafc303 swscale: fix overflows in output of RGB48 pixels.
For certain types of filters where the intermediate sum of coefficients
can go above the fixed-point equivalent of 1.0 in the middle of a filter,
the sum of a 31-bit calculation can overflow in both directions and can
thus not be represented in a 32-bit signed or unsigned integer. To work
around this, we subtract 0x40000000 from a signed integer base, so that
we're halfway signed/unsigned, which makes it fit even if it overflows.
After the filter finishes, we add the scaled bias back after a shift.

We use the same trick for 16-bit bpc YUV output routines.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 18:36:20 +00:00
Ronald S. Bultje 4391805916 swscale: fix overflows in RGB rounding constants.
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 14:36:09 +00:00
Mans Rullgard 373211d828 Remove extraneous semicolons
These semicolons cause invalid empty top-level declarations.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-11 17:23:24 +00:00
Mans Rullgard 7c5ce99bd9 swscale: fix signed overflow in yuv2mono_X_c_template
As old bits are shifted out of the accumulator, they cause signed
overflows when they reach the end.  Making the variable unsigned fixes
this.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-11-26 22:53:47 +00:00
Ronald S. Bultje 185655c601 swscale: add support for planar RGB input. 2011-11-24 10:40:05 -08:00
Ronald S. Bultje 109f62e8f8 swscale: decide whether to use yuv2plane1/X on a per-plane basis. 2011-10-22 10:35:14 -07:00
Ronald S. Bultje f99654d470 swscale: reintroduce full precision in 16-bit output. 2011-10-22 10:35:14 -07:00
Kieran Kunhya ff7913aef1 Split up yuv2yuvX functions
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-10-22 10:35:13 -07:00
Kieran Kunhya 34e8d147b3 Split out yuv2yuv1 luma and chroma in order to make them generic DSP functions
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-10-22 10:35:13 -07:00
Ronald S. Bultje dc49bf1270 sws/pixfmt/pixdesc: add support for yuv420p9le/be. 2011-10-21 00:58:01 -07:00
Kieran Kunhya 4d4d0e8176 Fix unnecessary shift with 9/10bit vertical scaling
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-09-23 02:13:30 +02:00
Ronald S. Bultje 3f04ab4fcd swscale: split hScale() function pointer into h[cy]Scale().
This allows using more specific implementations for chroma/luma, e.g.
we can make assumptions on filterSize being constant, thus avoiding
that test at runtime.
2011-08-17 20:56:06 -07:00
Ronald S. Bultje 28c1115a91 swscale: use 15-bit intermediates for 9/10-bit scaling. 2011-08-12 11:54:25 -07:00
Ronald S. Bultje 62ee0e6a97 Revert "swscale: use 15-bit intermediates for 9/10-bit scaling."
This reverts commit ac0fb59348. It
causes valgrind errors which I'll want to investigate before
resubmitting this.
2011-08-02 12:27:43 -07:00
Ronald S. Bultje ac0fb59348 swscale: use 15-bit intermediates for 9/10-bit scaling. 2011-08-02 10:34:02 -07:00
Ronald S. Bultje 4e3e333a79 swscale: error dithering for 16/9/10-bit to 8-bit.
Based on a somewhat similar idea in FFmpeg's swscale copy.
2011-07-08 15:15:30 -07:00
Ronald S. Bultje 7d7bacf0f1 swscale: fix overflow in 16-bit vertical scaling.
We operated on 31-bits, but with e.g. lanczos scaling, values can
add up to beyond 0x80000000, thus leading to output of zeroes. Drop
one bit of precision fixes this.
2011-07-08 15:15:30 -07:00
Ronald S. Bultje bf2cba4532 swscale: fix crash in 8-bpc bilinear output without alpha.
We accessed the alpha array even it wasn't used and didn't
exist, hence leading to a NULL pointer segfault.
2011-07-08 15:15:30 -07:00
Ronald S. Bultje f44d50a94c swscale: fix 16-bit horizontal scaling underflow.
When using e.g. lanczos scaling, values can drop below 0, so they
should never be unsigned.
2011-07-08 15:15:30 -07:00
Diego Biurrun e589e4b82d Remove unused static tables and static inline functions. 2011-07-04 14:59:35 +02:00
Ronald S. Bultje 8a8d0ce208 swscale: for >8bit scaling, read in native bit-depth.
For 9/10bit, it means we don't have to upscale to 16bit before
actual scaling or pixel format conversion, and thus a performance
gain.
2011-07-01 09:08:26 -07:00
Ronald S. Bultje 81cc7d0bd1 swscale: fix another yuv range conversion overflow in 16bit scaling. 2011-06-30 07:05:52 -07:00
Mohamed Naufal 705b21a06e swscale: Unbreak build with --enable-small
This fixes building with --enable-small, by using the correct
variable name.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-06-30 11:58:38 +03:00