Commit Graph

388 Commits

Author SHA1 Message Date
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
Ronald S. Bultje e0b8fff6c7 swscale: fix yuv range correction when using 16-bit scaling. 2011-06-29 21:04:45 -07:00
Ronald S. Bultje ef1ee362b3 swscale: implement >8bit scaling support.
This means that precision is retained when scaling between sample
formats with >8 bits per component (48bit RGB, 16bit grayscale,
9/10/16bit YUV).
2011-06-29 09:45:52 -07:00
Ronald S. Bultje 13a099799e swscale: change prototypes of scaled YUV output functions.
Remove unused variables "flags" and "dstFormat" in yuv2packed1,
merge source rows per plane for yuv2packed[12], and make every
source argument int16_t (some where invalidly set to uint16_t).
This prevents stack pollution and is part of the Great Evil Plan
to simplify swscale.
2011-06-27 21:24:44 -07:00
Ronald S. Bultje dff5a83532 swscale: re-add support for non-native endianness.
This works through some non-obvious hacks in utils.c.
2011-06-27 18:10:41 -07:00
Ronald S. Bultje 3d3c814937 swscale: disentangle yuv2rgbX_c_full() into small functions.
This is part of the Great Evil Plan to simplify swscale.
2011-06-27 18:10:24 -07:00
Ronald Bultje 6fba14eecb swscale: split yuv2packed[12X]_c() remainders into small functions.
This is part of the Great Evil Plan to simplify swscale.
2011-06-27 18:10:03 -07:00
Ronald S. Bultje 97535ffb97 swscale: remove unused xInc/srcW arguments from hScale(). 2011-06-26 14:41:44 -07:00
Ronald S. Bultje 4e05830205 swscale: remove misplaced comment.
The comment should have been placed only in
yuv2rgb48_X_c_template, not yuv2rgb48_1_c_template.
2011-06-14 16:55:24 -04:00
Ronald S. Bultje 9f63211175 swscale: split out RGB48 output functions from yuv2packed[12X]_c().
This is part of the Great Evil Plan to simplify swscale. Note that
you'll see some code duplication between the output functions for
different RGB variants, and even between packed-YUV and RGB
variants. This is intentional because it improves readability.
2011-06-14 15:59:14 -04:00
Michael Niedermayer 0af8a71d66 swscale: fix JPEG-range YUV scaling artifacts.
YUV planes were marked as uint16_t, but they contained signed data.
Fixes issue 1108 and 675.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-06-14 09:46:49 -04:00
Ronald S. Bultje 103278f7b0 libavutil/swscale: YUV444P10/YUV444P9 support.
Also add missing glue code for recently added YUV422P10 formats
to swscale.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-06-10 15:12:24 -04:00
Ronald S. Bultje af2faf2076 swscale: split YUYV output out of yuv2packed[12X]_c().
This is part of the Great Evil Plan to simplify swscale.
2011-06-09 20:52:38 -04:00
Ronald S. Bultje 6b105e3ee6 swscale: extract monowhite/black output from yuv2packed[12X]_c().
This is part of the Great Evil Plan to simplify swscale.
2011-06-09 16:47:45 -04:00
Ronald S. Bultje 6d4d483eee swscale: de-macro'ify RGB15/16/32 input functions.
Inline functions are easier to read, maintain, modify and test,
which justifies the slightly increased source size. This patch
also adds support for non-native endianness RGB15/16 and fixes
isSupportedOutput() to no longer claim that we support writing
non-native RGB565/555/444.
2011-06-09 16:47:45 -04:00
Ronald S. Bultje e2babb9b47 swscale: rearrange code.
This way the code in the file is less cluttered all-over-the-
place.
2011-06-09 16:47:45 -04:00
Ronald S. Bultje dbd3183935 swscale: change 48bit RGB input macros to inline functions.
Inline functions are slightly larger in source code, but
are easier to handle in source code editors. The binary code
generated is the same.
2011-06-09 09:29:20 -04:00
Ronald S. Bultje f30ee65700 swscale: change 9/10bit YUV input macros to inline functions.
Inline functions are slightly larger in source code, but
are easier to handle in source code editors. The binary code
generated is the same.
2011-06-09 09:29:03 -04:00
Ronald S. Bultje aa39f5f6d6 swscale: extract gray16 output functions from yuv2packed[12X]().
This is part of the Great Evil Plan to simplify swscale.
2011-06-09 09:29:02 -04:00
Ronald S. Bultje f1e0b90c64 swscale: use standard clipping functions.
This generates better code on some non-x86 architectures.
2011-06-09 09:27:51 -04:00
Ronald S. Bultje e458b53605 swscale: merge macros that are used only once.
This reduces source code size without affecting the binary.
2011-06-09 09:26:00 -04:00
Ronald S. Bultje 6e5a8d3c9a swscale: fix function declarations in swscale.c.
Remove inline keyword from functions that are never inlined.
Use av_always_inline for functions that should be force-inlined
for performance reasons. Use av_cold for init functions.
2011-06-09 09:25:59 -04:00
Ronald S. Bultje 9d84dfce93 swscale: remove unused function.
Use of this wrapper was removed in a previous patch, but I
forgot to actually remove the function itself.
2011-06-08 11:08:20 -04:00
Ronald S. Bultje edeb56fa31 swscale: remove duplicate conversion routine in swScale(). 2011-06-07 10:05:55 -04:00
Ronald S. Bultje df91d09174 swscale: integrate yuv2nv12X_C into yuv2yuvX() function pointers. 2011-06-07 10:05:54 -04:00
Ronald S. Bultje ca364a5b43 swscale: extract SWS_FULL_CHR_H_INT conditional into init code. 2011-06-07 10:03:47 -04:00
Ronald S. Bultje b3b28b080f swscale: cosmetics. 2011-06-07 10:03:46 -04:00
Ronald S. Bultje ea28175312 swscale: remove alp/chr/lumSrcOffset.
They are hacks added to reuse the same scaling function for
different formats and they may cause problems when SIMD
implementation of the same functions are used along with pure
C functions.
2011-06-07 10:03:18 -04:00
Ronald S. Bultje bda9b20fa4 swscale: un-special-case yuv2yuvX16_c().
Make yuv2yuvX16_c a function pointer for yuv2yuvX(), so that the
function pointer becomes bitdepth-independent.
2011-06-07 10:03:12 -04:00
Ronald S. Bultje 6af2801088 swscale: split swscale.c in unscaled and generic conversion routines.
This duplicates the function fillPlane().
2011-06-03 09:52:09 -07:00
Ronald S. Bultje 2762ee3034 swscale: cosmetics.
Remove duplicate "inC" and "_c" functions that do the same thing;
give each function that handles data and acts as a function pointer
a "_c" suffix; remove "_c" suffix from functions that are inherently
not optimizable. Remove inline keyword from functions that are only
used through function pointers.
2011-06-03 09:52:09 -07:00
Ronald S. Bultje 1674bd2abe swscale: integrate (literally) swscale_template.c in swscale.c. 2011-06-03 09:52:09 -07:00
Ronald S. Bultje 983260b0a4 swscale: split out x86/swscale_template.c from swscale.c. 2011-06-03 09:52:09 -07:00
Ronald S. Bultje 67d80a5421 swscale: split out ppc _template.c files from main swscale.c. 2011-06-03 09:52:09 -07:00
Ronald S. Bultje a3e9bb5dee swscale: remove indirections in ppc/swscale_template.c. 2011-06-03 09:52:09 -07:00
Ronald S. Bultje 0e5d31b16b swscale: split out unscaled altivec YUV converters in their own file. 2011-06-03 09:52:09 -07:00
Ronald S. Bultje 0d793db1b0 swscale: remove unused COMPILE_TEMPLATE_ALTIVEC. 2011-06-02 21:29:59 -07:00
Anton Khirnov b8e893399f sws: replace all long with int.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-28 10:03:37 -04:00
Ronald S. Bultje b4a224c5e4 swscale: split chroma buffers into separate U/V planes.
Preparatory step to implement support for sizes > VOFW.
2011-05-26 09:31:27 -04:00
Ronald S. Bultje aaca69c130 swscale: remove swScale_{c,MMX,MMX2} duplication. 2011-05-24 14:50:15 -04:00
Ronald S. Bultje 1dd4f4be5a swscale: remove AMD3DNOW "optimizations".
The functions are identical to their MMX counterparts. Thus,
pretending that swscale is highly optimized for AMD3DNOW
extensions is a poorly executed practical joke at best.
2011-05-24 10:19:41 -04:00
Ronald S. Bultje fe43d5d71e swscale: remove duplicate code in ppc/ subdirectory. 2011-05-24 10:16:32 -04:00
Ronald S. Bultje e66149e714 swscale: force --enable-runtime-cpudetect and remove SWS_CPU_CAPS_*. 2011-05-24 10:03:26 -04:00