Commit Graph

1025 Commits

Author SHA1 Message Date
Diego Biurrun e44c11e9fa cosmetics: Move static and inline attributes to more standard places.
Fixes several "‘static’ is not at beginning of declaration" warnings.
2012-01-14 17:32:36 +01:00
Ronald S. Bultje 3c172a4106 swscale: change yuv2yuvX code to use cpuflag(). 2012-01-13 16:57:01 -08:00
Paul B Mahol 0cc1a86dc3 rgb2rgb: rgb12to15()
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-12 16:43:17 -08:00
Ronald S. Bultje 06b0246da0 swscale-test: fix stack overread.
Fixes problems in swscale-test where it gives a 3-member array to a
function expecting a 4-member array.
2012-01-12 16:38:29 -08:00
Ronald S. Bultje e7843db3df swscale: fix invalid conversions and memory problems.
Fixes problems where rgbToRgbWrapper() is called even though it doesn't
support this particular conversion (e.g. converting from RGB444 to
anything). Thirdly, fixes issues where rgbToRgbWrapper() is called for
non-native endiannness conversions (e.g. RGB555BE on a LE system).
Fourthly, fixes crashes when converting from e.g. monowhite to
monowhite, which calls planarCopyWrapper() and overwrites/reads because
n_bytes != n_pixels.
2012-01-12 16:38:29 -08:00
Paul B Mahol f7f3563214 rgb2rgb: rgb12tobgr12()
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-11 15:52:53 -08:00
Ronald S. Bultje b14fa5572c swscale: fix crash in fast_bilinear code when compiled with -mred-zone.
Additional comments from Måns Rullgard have been integrated
by Reinhard Tartler.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-01-10 18:20:37 +01:00
Oka Motofumi cd44521625 swscale: specify register type.
Fixes a compilation failure on win64.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-10 09:17:37 -08:00
Paul B Mahol 0b8b3387a9 rgb2rgb: allow conversion for <15 bpp
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-09 20:09:41 -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 2170a0e6ad swscale: convert yuy2/uyvy/nv12/nv21ToY/UV from inline asm to yasm.
Also implement SSE2/AVX variants.
2012-01-08 16:37:43 -08:00
Diego Biurrun 999484c9fb swscale: K&R formatting cosmetics for code examples 2012-01-08 23:32:57 +01:00
Diego Biurrun 83890c66c4 swscale: K&R reformatting cosmetics for header files 2012-01-08 23:32:56 +01: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
Diego Biurrun 3d72a6f19e swscale: Use standard multiple inclusion guards in ppc/ header files. 2012-01-04 16:39:37 +01:00
Ronald S. Bultje 6b3995ccd1 swscale: remove obsolete comment. 2012-01-03 20:02:17 -08:00
Ronald S. Bultje 6ea64339c5 swscale: split scale.asm.
scale.asm keeps horizontal scaling functions, whereas output.asm gets
the vertical scaling/output functions.
2012-01-03 20:02:07 -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 f910dbcdb0 swscale: add MMX files to MMX-OBJS instead of OBJS. 2012-01-03 20:01:15 -08:00
Diego Biurrun 44b0edda3f Drop some pointless void* return value casts from av_malloc() invocations. 2012-01-02 16:41:24 +01:00
Janne Grunau 6e9bb5aa3e swscale: prevent invalid writes in packed_16bpc_bswap
Writes past the end of the destination buffer were occuring when its
stride was smaller than the stride of the source. Fixes Bug #183.
2011-12-26 15:50:17 +01:00
Anton Khirnov 131609dc2a sws: readd PAL8 to isPacked()
Fixes PAL8 to YUV conversion.
2011-12-22 11:01:28 +01:00
Nathan Adil Maxson 7b3894bee9 swscale: fix formatting and indentation of unscaled conversion routines.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-12-18 15:32:08 -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
Janne Grunau b4dc68803b swscale: add endian conversion for RGB555 and RGB444 pixel formats
Add a macro to shorten the if condition.
2011-12-17 19:52:19 +01: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
Janne Grunau ed46a3d842 swscale: add rgb565 endianess conversion 2011-12-17 19:35:16 +01: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
Janne Grunau 72cb904453 swscale: add unscaled packed 16 bit per component endianess conversion 2011-12-16 01:41:33 +01:00
Diego Biurrun 3c62a71486 swscale_mmx: drop no longer required parameters from VSCALEX macros 2011-12-14 12:00:44 +01:00
Diego Biurrun 52de07e1f1 swscale: Mark yuv2planeX_8_mmx as MMX2; it contains MMX2 instructions. 2011-12-14 11:58:46 +01:00
Mans Rullgard 878dda5db1 build: move inclusion of subdir.mak to main subdir loop
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-13 14:26:49 +00:00
Diego Biurrun 58c42af722 doxygen: misc consistency, spelling and wording fixes 2011-12-12 23:06:23 +01: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
Reinhard Tartler 5089ce1b5a swscale: #include "libavutil/mathematics.h"
this file uses the M_PI macro since
4e74187db2, so include the correct header
directly.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2011-12-01 19:12:26 +01: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
Martin Storsjö f32dfad9dc swscale: Readd #define _SVID_SOURCE
This was removed erroneously in
046f081b46. This define still is
necessary for getting MAP_ANONYMOUS defined on linux/glibc,
despite the define reshuffling done in that commit.

Without MAP_ANONYMOUS defined, the mprotect calls for setting the
generated mmx2 scaler code pages executable are left out, causing
crashes if that codepath is chosen.

This patch fixes scaling from 192x144 to 320x240 with
-sws_flags fast_bilinear, which crashes on linux at the
moment.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-25 19:59:15 +02:00
Ronald S. Bultje f7f1835258 swscale: fix failing fate tests.
isGray() is left as a FIXME for later.
2011-11-24 12:21:03 -08:00
Ronald S. Bultje 185655c601 swscale: add support for planar RGB input. 2011-11-24 10:40:05 -08:00
Ronald S. Bultje 6b0768e202 Clean up swscale pixfmt macros using av_pix_fmt_descriptors[]. 2011-11-24 08:24:55 -08:00
John Stebbins 09d243ddd0 swscale: Fix stack alignment for SSE
Although gcc guarantees 16 byte stack alignment, threads under WinXP
don't appear to be guaranteed to start stack aligned.  So fix the
alignment.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-11-19 09:55:07 -08:00
Ronald S. Bultje 8283f90a52 swscale: handle unaligned buffers in yuv2plane1
The issue had been introduced in
c435653627

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-11-13 08:27:20 +01:00
Sean McGovern 124e56454d swscale: add padding to conversion buffer.
Altivec does unaligned reads from this buffer in
hscale_altivec_real(), and can thus read up to 16 bytes beyond
the end of the buffer. Therefore, add an extra 16 bytes of
padding at the end of the conversion buffer.

This fixes fate-lavfi-pixfmts_scale on AltiVec-enabled builds
under valgrind.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-11-11 07:44:35 -08:00
Ronald S. Bultje c435653627 swscale: write yuv2plane1 MMX/SSE2/SSE4/AVX functions. 2011-11-05 20:48:14 -07:00
Ronald S. Bultje 1deb08fcb6 swscale: align vertical filtersize by 2 on x86.
The vertical scaler handles 2 rows at a time and thus requires
alignment by 2, or else it'll read invalid memory and result in
corrupt output.
2011-11-05 07:06:38 -07:00
Ronald S. Bultje 9e66b892e8 swscale: add missing colons to x86 assembly yuv2planeX.
This fixes assembling using "nasm".
2011-10-23 09:44:03 -07:00
Ronald S. Bultje f48b12e0a6 swscale: update altivec yuv2planeX asm to new per-plane API. 2011-10-22 10:35:14 -07:00
Ronald S. Bultje 6cacecdca3 swscale: make yuv2yuvX_10_sse2/avx 8/9/16-bits aware.
Also implement MMX/MMX2 versions and SSE4 versions.
2011-10-22 10:35:14 -07:00