Commit Graph

1216 Commits

Author SHA1 Message Date
Ronald S. Bultje
b64a72e1b2 yuv2rgb: handle line widths that are not a multiple of 4.
This introduces support for width%4==2 in addition to width%4==0. For
odd widths, some more checks are needed, since the current code always
handles two luma items in a row, thus there is a possibility of an
overread by one.
2012-08-28 14:58:52 -07:00
Martin Storsjö
3ad9eac5a0 testprogs: Remove unused includes
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-29 00:23:51 +03:00
Giorgio Vazzana
1e6072139b swscale: x86: fix #endif comments in rgb2rgb template file
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-08-19 21:50:09 +02:00
Martin Storsjö
1d9c2dc89a Don't include common.h from avutil.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 22:32:06 +03:00
Mans Rullgard
90540c2d5a x86: swscale: fix fragile memory accesses
To access data at multiple fixed offsets from a base address, this
code uses a single "m" operand and code of the form "32%0", relying on
the memory operand instantiation having no displacement, giving a final
result of the form "32(%rax)".  If the compiler uses a register and
displacement, e.g. "64(%rax)", the end result becomes "3264(%rax)",
which obviously does not work.

Replacing the "m" operands with "r" operands allows safe addition of a
displacement.  In theory, multiple memory operands could use a shared
base register with different index registers, "(%rax,%rbx)", potentially
making more efficient use of registers.  In the cases at hand, no such
sharing is possible since the addresses involved are entirely unrelated.

After this change, the code somewhat rudely accesses memory without
using a corresponding memory operand, which in some cases can lead to
unwanted "optimisations" of surrounding code.  However, the original
code also accesses memory not covered by a memory operand, so this is
not adding any defect not already present.  It is also hightly unlikely
that any such optimisations could be performed here since the memory
locations in questions are not accessed elsewhere in the same functions.

This fixes crashes with suncc.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 14:51:52 +01:00
Mans Rullgard
10b83cb653 x86: swscale: remove disabled code
This code has been disabled since 2003.  Nobody will ever look at
it again.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 14:51:52 +01:00
Mans Rullgard
c318626ce2 x86: rename libavutil/x86_cpu.h to libavutil/x86/asm.h
This puts x86-specific things in the x86/ subdirectory where they
belong.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 00:58:20 +01: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
5a6e3c039c swscale: Mark all init functions as av_cold 2012-07-23 01:30:05 +02:00
Diego Biurrun
16d2a1a51c swscale: x86: Drop pointless _mmx suffix from filenames
The files do not contain only MMX code.
2012-07-23 01:30:04 +02:00
Ronald S. Bultje
a6e922ffa2 swscale: place inline assembly bilinear scaler under HAVE_INLINE_ASM. 2012-07-22 16:08:13 -07:00
Ronald S. Bultje
b2668c85e9 x86: swscale: Place inline assembly code under appropriate #ifdefs
Fixes compilation for compilers that do not support gcc inline assembly.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-07-21 22:22:58 +02:00
Martin Storsjö
557519189f swscale: yuv2planeX 8bit >=sse2 functions need aligned stack on x86-32.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-07-04 08:25:57 -07:00
Diego Biurrun
2047e40e6e Clarify Doxygen comment for FF_API_* #defines. 2012-07-04 15:10:10 +02:00
Diego Biurrun
86ab7b0f2f Create version.h headers for libraries that lack them 2012-07-04 15:10:06 +02:00
Mans Rullgard
4996e8f510 bfin: libswscale: add const where appropriate to fix warnings
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 02:15:33 +01:00
Mans Rullgard
6bac8971cc bfin: libswscale: remove unnecessary #includes
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 02:15:33 +01:00
Ronald S. Bultje
404410a53a sws: fix planar RGB input conversions for 9/10/16 bpp.
Fixes bug 282.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-06-12 19:52:00 +02:00
Diego Biurrun
9eb83a56aa build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. 2012-05-07 14:01:32 +02:00
Diego Biurrun
9b75ae05cf swscale: K&R formatting cosmetics (part III) 2012-04-22 17:37:07 +02:00
Ronald S. Bultje
7f77e9041a swscale: clip before assigning tables in RGB output functions. 2012-04-14 16:29:24 -07:00
Ronald S. Bultje
4860625236 swscale: fix off-by-one in second coefficient in bilinear filters.
If coefficient A is 12-bits xixed-point number "X", then the other
coefficient is (1 << 12) - X, not (1 << 12) - X - 1.
2012-04-14 16:29:10 -07:00
Ronald S. Bultje
9206ac80a5 swscale: handle last pixel if lines have an odd width.
Fixes bug 270.
2012-04-13 14:21:58 -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
Diego Biurrun
baaab6069a build: Move all arch OBJS declarations into arch subdirectory Makefiles. 2012-04-12 21:30:13 +02:00
Diego Biurrun
7bb3a302fe build: Consistently handle conditional compilation for all optimization OBJS. 2012-04-12 09:00:49 +02:00
Henrik Gramner
729f90e268 x86inc improvements for 64-bit
Add support for all x86-64 registers
Prefer caller-saved register over callee-saved on WIN64
Support up to 15 function arguments

Also (by Ronald S. Bultje)
Fix up our asm to work with new x86inc.asm.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-04-11 15:47:00 -04:00
Diego Biurrun
02c39f056a ppc: Add/remove a number of const qualifiers to fix related warnings. 2012-04-09 20:39:33 +02:00
Ronald S. Bultje
bc0bdda77b swscale: handle complete dimensions for monoblack/white.
Fixes bug 269.
2012-04-04 10:55:50 -07:00
Hans-Kristian Arntzen
b991b300f2 Unscaled Planar RGB -> RGB support in swscale.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-04-03 13:06:42 -04:00
Diego Biurrun
e7e19b15c7 build: Only clean the architecture subdirectory we build for.
This allows simplifying the Makefiles; it is no longer necessary to register
arch subdirectory Makefiles, just putting them in place is enough.
2012-03-26 13:29:03 +02:00
Diego Biurrun
ad0e31f134 build: prettyprinting cosmetics 2012-03-26 13:00:10 +02:00
Ronald S. Bultje
45fdcc8e2d swscale: convert hscale() to use named arguments. 2012-03-14 20:09:53 -07:00
Ronald S. Bultje
aba7a827aa swscale: convert hscale to cpuflags(). 2012-03-14 20:09:53 -07:00
Ronald S. Bultje
9487fb4dea swscale: clip unscaled output intermediates.
Fixes bug 240, as well as several integer overflows (visible as glitches)
in other scaling output routines, e.g. YUV422.
2012-03-07 09:35:46 -08: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
1c97b5c4a3 swscale: remove "cpu flags" from -sws_flags description. 2012-03-04 06:52:06 -08:00
Ronald S. Bultje
dccb2cd3f9 swscale: make %rep unconditional.
Fixes pre-processing with latest versions of nasm.
2012-03-03 20:40:00 -08:00
Ronald S. Bultje
8249a23fc1 swscale: remove now unnecessary hack. 2012-03-03 20:39:59 -08:00
Diego Biurrun
36697be187 swscale: K&R formatting cosmetics for PowerPC code (part II/II) 2012-03-02 02:16:40 +01:00
Ronald S. Bultje
791de61bbb swscale: fix another integer overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-29 11:19:03 -08:00
Ronald S. Bultje
2bb628f870 swscale: fix another integer overflow at large dimensions/rescales. 2012-02-24 15:39:55 -08:00
Ronald S. Bultje
1d8c4af396 swscale: take first/lastline over/underflows into account for MMX.
Fixes crashes for extremely large resizes (several 100-fold).

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-23 10:30:08 -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
Ronald S. Bultje
19a65b5be4 swscale: fix overflows in filterPos[] calculation for large sizes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-23 10:30:07 -08:00
Ronald S. Bultje
1254022ea7 swscale: fix filtersize clipping.
if srcW<=2, clip(x, 1, srcW-2) still allows srcW to be < 1.
2012-02-22 16:54:20 -08:00
Diego Biurrun
89d94b2182 swscale: K&R formatting cosmetics (part I) 2012-02-21 22:53:40 +01:00
Diego Biurrun
72b95764d0 swscale: variable declaration and placement cosmetics 2012-02-21 22:53:37 +01:00
Diego Biurrun
04217de4d6 swscale: K&R formatting cosmetics for PowerPC code (part I/II) 2012-02-21 20:17:57 +01:00
Ronald S. Bultje
b18f8cbf3d Revert two swscale commits.
Revert "swscale: update context offsets after removal of AlpMmxFilter."
(commit a95e3fa90b)
and
Revert "swscale: Remove some write-only variables related to alpha handling."
(commit 9d03cb9fc5).

They broke alpha handling - it's the evil inline asm that still uses that
variable, so it's not truely write-only.
2012-02-19 13:31:12 -08:00
Ronald S. Bultje
1bab6f852c swscale: make access to filter data conditional on filter type.
Prevents crashes on 1-tap filter (unscaled). Also rename "bguf" argument
to "vbuf", seems that was a typo.
2012-02-17 10:31:15 -08:00
Ronald S. Bultje
a95e3fa90b swscale: update context offsets after removal of AlpMmxFilter. 2012-02-17 10:31:15 -08:00
Ronald S. Bultje
25c42234a9 swscale: make monowhite/black RGB-independent.
Disadvantage is that it no longer allows modifying brightness through
adjustment of the RGB lookup table. Advantage is that now monowhite/black
no longer need to be identified as a RGB format.
2012-02-16 21:43:20 -08:00
Diego Biurrun
9d03cb9fc5 swscale: Remove some write-only variables related to alpha handling. 2012-02-14 10:12:43 +01:00
Ronald S. Bultje
771bab7f57 swscale: fix crashes in yuv2yuvX on x86-32.
They were introduced in an earlier commit that introduced use of named
arguments. One cause was a typo, a second cause appears to be a bug in
x264asm that I work around by not using named arguments.
2012-02-13 13:41:13 -08:00
Diego Biurrun
7331b6e718 Drop some completely unnecessary av_unused attributes. 2012-02-13 19:20:53 +01:00
Diego Biurrun
92fed11352 swscale: Remove unused variable alpMmxFilter. 2012-02-13 19:20:53 +01:00
Ronald S. Bultje
3cac475655 swscale: move YUV2PACKED16WRAPPER() macro down to where it is used. 2012-02-13 07:14:05 -08: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
d63b7d8c37 swscale: fix incorrect chroma bias in yuv2rgb48_1_c(). 2012-02-13 07:14:04 -08:00
Ronald S. Bultje
1ca7dc60d2 swscale: fix invalid memory accesses in yuvpacked1() functions. 2012-02-13 07:14:04 -08:00
Ronald S. Bultje
3e23badd83 swscale: convert yuv2yuvX() to using named arguments. 2012-02-12 08:27:51 -08:00
Ronald S. Bultje
8c433d8a03 swscale: rename "dstw" to "w" to prevent name collisions.
"dstw" can collide with the word-version of the "dst" argument, causing
all kind of weird stuff down the pipe.
2012-02-12 08:27:50 -08:00
Ronald S. Bultje
ef66a0ed2e swscale: use named registers in yuv2yuv1_plane() place.
Most of the function had been converted before, but I forgot this
particular location.
2012-02-12 08:27:50 -08:00
Ronald S. Bultje
dae2ce361a swscale: enforce a minimum filtersize.
At very small dimensions, this calculation could lead to zero-sized
filters, which leads to uninitialized output, zero-sized allocations,
loop overflows in SIMD that uses do{..}while(i++<filtersize); instead
of for(i=0;i<filtersize;i++){..} and several other similar failures.
Therefore, require a minimum filtersize of 1.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-11 10:06:50 -08:00
Diego Biurrun
a2e40cd3e2 swscale: ppc: Add missing header #includes to pass 'make checkheaders'. 2012-02-09 12:26:46 +01:00
Anton Khirnov
38d5533228 pixdesc: mark pseudopaletted formats with a special flag.
This makes it possible to dintinguish them from PAL8.

Fixes an invalid write in avpicture_layout().
2012-02-08 21:01:31 +01:00
Ronald S. Bultje
783487ae44 swscale: sign-extend integer function argument to qword on x86-64. 2012-02-08 10:31:14 -08:00
Diego Biurrun
0144fe6995 Remove Sun medialib glue code.
It is obscure, most likely unused and not bit-exact compared to
libavcodec due to a different IDCT transform algorithm.
2012-02-08 08:52:30 +01:00
Ronald S. Bultje
ef1c785f11 swscale: make yuv2yuv1 use named registers. 2012-02-07 11:38:13 -08:00
Ronald S. Bultje
b7542dd3d7 swscale: fix V plane memory location in bilinear/unscaled RGB/YUYV case.
Fixes bug 221.

CC: libav-stable@libav.org
2012-02-07 11:33:20 -08:00
Diego Biurrun
06b320ad78 swscale: K&R formatting cosmetics for SPARC code 2012-02-07 19:49:49 +01: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
7e4d9d5d45 win64: add a XMM clobber test configure option.
This will be useful to test more aggressively for failures to mark XMM
registers as clobbered in Win64 builds, and prevent regressions thereof.

Based on a patch by Ramiro Polla <ramiro.polla@gmail.com>
2012-02-02 12:00:48 -08:00
Diego Biurrun
148bc235b0 swscale: K&R formatting cosmetics for Blackfin code
Also prettyprint some comments in Assembly code.
2012-02-02 18:50:12 +01:00
Ronald S. Bultje
de53b9068a swscale: implement MMX, SSE2 and AVX functions for RGB32 input. 2012-02-01 21:55:32 -08:00
Ronald S. Bultje
378c5ef9ae swscale: enable dithering in MMX functions.
This was accidently disabled.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-02-01 09:33:29 -08:00
Ronald S. Bultje
212f161caa swscale: make rgb24 function macros slightly smaller. 2012-02-01 09:33:13 -08:00
Ronald S. Bultje
f5490fbe3b swscale: remove obsolete comment. 2012-02-01 07:17:01 -08:00
Diego Biurrun
2e3fb9e372 swscale-test: Drop unused argc and argv arguments from main(). 2012-02-01 14:24:25 +01: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
Alex Converse
7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Ronald S. Bultje
b5d08c27c3 swscale: convert rgb/bgr24ToY/UV_mmx functions from inline asm to yasm.
Also implement sse2/ssse3/avx versions.
2012-01-27 11:00:30 +08:00
Ronald S. Bultje
3b15a6d742 config.asm: change %ifdef directives to %if directives.
This allows combining multiple conditionals in a single statement.
2012-01-27 10:19:57 +08:00
Alex Converse
08628b6afb Revert "sws/pixfmt/pixdesc: add support for yuva444p"
This reverts commit fc115c80b7.

Tests are broken.
2012-01-26 18:06:57 -08:00
Paul B Mahol
fc115c80b7 sws/pixfmt/pixdesc: add support for yuva444p
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-01-27 09:24:08 +08:00
Diego Biurrun
33ad8c3cab cosmetics: Remove some unnecessary block braces. 2012-01-25 13:14:49 +01:00
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
Kieran Kunhya
7fbbf95293 yuv2planeX10 SIMD
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-10-22 10:35:14 -07: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
Mans Rullgard
41ac093f7e swscale: fix signed shift overflows in ff_yuv2rgb_c_init_tables()
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-21 20:56:59 +01:00
Ronald S. Bultje
dc49bf1270 sws/pixfmt/pixdesc: add support for yuv420p9le/be. 2011-10-21 00:58:01 -07:00
Ronald S. Bultje
8305041e13 swscale: prevent overflow in coefficient calculation. 2011-10-21 00:14:11 -07:00
Ronald Bultje
d1d421cbc0 swscale: prevent overflow during initialization
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-18 10:29:49 +02:00