summaryrefslogtreecommitdiffstats
path: root/libswscale/swscale.c
Commit message (Collapse)AuthorAgeFilesLines
* swscale: don't show full-chroma-int warning for non-RGB output.Ronald S. Bultje2012-01-031-30/+32
| | | | Non-RGB output always uses full chroma interpolation.
* swscale: fix overflows in vertical scaling at top/bottom edges.Ronald S. Bultje2011-12-181-3/+48
| | | | | | | | | | | | | | | | | | | | | | 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.
* swscale: fix overflow in gray16 vertical scaling.Ronald S. Bultje2011-12-171-8/+6
| | | | | | | | | | 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>
* swscale: fix integer overflows in RGB pixel writing.Mans Rullgard2011-12-171-2/+2
| | | | | | | | 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>
* swscale: fix overflows in output of RGB48 pixels.Ronald S. Bultje2011-12-171-2/+4
| | | | | | | | | | | | | | 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>
* swscale: fix overflows in RGB rounding constants.Ronald S. Bultje2011-12-171-5/+6
| | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* Remove extraneous semicolonsMans Rullgard2011-12-111-60/+60
| | | | | | These semicolons cause invalid empty top-level declarations. Signed-off-by: Mans Rullgard <mans@mansr.com>
* swscale: fix signed overflow in yuv2mono_X_c_templateMans Rullgard2011-11-261-1/+1
| | | | | | | | 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>
* swscale: add support for planar RGB input.Ronald S. Bultje2011-11-241-8/+125
|
* swscale: decide whether to use yuv2plane1/X on a per-plane basis.Ronald S. Bultje2011-10-221-75/+109
|
* swscale: reintroduce full precision in 16-bit output.Ronald S. Bultje2011-10-221-5/+11
|
* Split up yuv2yuvX functionsKieran Kunhya2011-10-221-182/+74
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* Split out yuv2yuv1 luma and chroma in order to make them generic DSP functionsKieran Kunhya2011-10-221-27/+15
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* sws/pixfmt/pixdesc: add support for yuv420p9le/be.Ronald S. Bultje2011-10-211-0/+4
|
* Fix unnecessary shift with 9/10bit vertical scalingKieran Kunhya2011-09-231-9/+9
| | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* swscale: split hScale() function pointer into h[cy]Scale().Ronald S. Bultje2011-08-171-6/+6
| | | | | | 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.
* swscale: use 15-bit intermediates for 9/10-bit scaling.Ronald S. Bultje2011-08-121-91/+146
|
* Revert "swscale: use 15-bit intermediates for 9/10-bit scaling."Ronald S. Bultje2011-08-021-118/+45
| | | | | | This reverts commit ac0fb5934893be554a44d2a1eb7a3bc7bf39da4a. It causes valgrind errors which I'll want to investigate before resubmitting this.
* swscale: use 15-bit intermediates for 9/10-bit scaling.Ronald S. Bultje2011-08-021-45/+118
|
* swscale: error dithering for 16/9/10-bit to 8-bit.Ronald S. Bultje2011-07-081-13/+36
| | | | Based on a somewhat similar idea in FFmpeg's swscale copy.
* swscale: fix overflow in 16-bit vertical scaling.Ronald S. Bultje2011-07-081-9/+9
| | | | | | 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.
* swscale: fix crash in 8-bpc bilinear output without alpha.Ronald S. Bultje2011-07-081-1/+2
| | | | | We accessed the alpha array even it wasn't used and didn't exist, hence leading to a NULL pointer segfault.
* swscale: fix 16-bit horizontal scaling underflow.Ronald S. Bultje2011-07-081-1/+1
| | | | | When using e.g. lanczos scaling, values can drop below 0, so they should never be unsigned.
* Remove unused static tables and static inline functions.Diego Biurrun2011-07-041-11/+0
|
* swscale: for >8bit scaling, read in native bit-depth.Ronald S. Bultje2011-07-011-75/+24
| | | | | | 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.
* swscale: fix another yuv range conversion overflow in 16bit scaling.Ronald S. Bultje2011-06-301-1/+1
|
* swscale: Unbreak build with --enable-smallMohamed Naufal2011-06-301-1/+1
| | | | | | | This fixes building with --enable-small, by using the correct variable name. Signed-off-by: Martin Storsjö <martin@martin.st>
* swscale: fix yuv range correction when using 16-bit scaling.Ronald S. Bultje2011-06-291-6/+6
|
* swscale: implement >8bit scaling support.Ronald S. Bultje2011-06-291-237/+457
| | | | | | This means that precision is retained when scaling between sample formats with >8 bits per component (48bit RGB, 16bit grayscale, 9/10/16bit YUV).
* swscale: change prototypes of scaled YUV output functions.Ronald S. Bultje2011-06-271-141/+127
| | | | | | | | 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.
* swscale: re-add support for non-native endianness.Ronald S. Bultje2011-06-271-6/+12
| | | | This works through some non-obvious hacks in utils.c.
* swscale: disentangle yuv2rgbX_c_full() into small functions.Ronald S. Bultje2011-06-271-121/+171
| | | | This is part of the Great Evil Plan to simplify swscale.
* swscale: split yuv2packed[12X]_c() remainders into small functions.Ronald Bultje2011-06-271-296/+402
| | | | This is part of the Great Evil Plan to simplify swscale.
* swscale: remove unused xInc/srcW arguments from hScale().Ronald S. Bultje2011-06-261-5/+3
|
* swscale: remove misplaced comment.Ronald S. Bultje2011-06-141-1/+0
| | | | | The comment should have been placed only in yuv2rgb48_X_c_template, not yuv2rgb48_1_c_template.
* swscale: split out RGB48 output functions from yuv2packed[12X]_c().Ronald S. Bultje2011-06-141-88/+235
| | | | | | | 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.
* swscale: fix JPEG-range YUV scaling artifacts.Michael Niedermayer2011-06-141-5/+5
| | | | | | | 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>
* libavutil/swscale: YUV444P10/YUV444P9 support.Ronald S. Bultje2011-06-101-1/+13
| | | | | | | Also add missing glue code for recently added YUV422P10 formats to swscale. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* swscale: split YUYV output out of yuv2packed[12X]_c().Ronald S. Bultje2011-06-091-44/+137
| | | | This is part of the Great Evil Plan to simplify swscale.
* swscale: extract monowhite/black output from yuv2packed[12X]_c().Ronald S. Bultje2011-06-091-59/+113
| | | | This is part of the Great Evil Plan to simplify swscale.
* swscale: de-macro'ify RGB15/16/32 input functions.Ronald S. Bultje2011-06-091-109/+169
| | | | | | | | 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.
* swscale: rearrange code.Ronald S. Bultje2011-06-091-83/+83
| | | | | This way the code in the file is less cluttered all-over-the- place.
* swscale: change 48bit RGB input macros to inline functions.Ronald S. Bultje2011-06-091-44/+71
| | | | | | Inline functions are slightly larger in source code, but are easier to handle in source code editors. The binary code generated is the same.
* swscale: change 9/10bit YUV input macros to inline functions.Ronald S. Bultje2011-06-091-23/+41
| | | | | | Inline functions are slightly larger in source code, but are easier to handle in source code editors. The binary code generated is the same.
* swscale: extract gray16 output functions from yuv2packed[12X]().Ronald S. Bultje2011-06-091-55/+142
| | | | This is part of the Great Evil Plan to simplify swscale.
* swscale: use standard clipping functions.Ronald S. Bultje2011-06-091-33/+20
| | | | This generates better code on some non-x86 architectures.
* swscale: merge macros that are used only once.Ronald S. Bultje2011-06-091-10/+4
| | | | This reduces source code size without affecting the binary.
* swscale: fix function declarations in swscale.c.Ronald S. Bultje2011-06-091-33/+34
| | | | | | 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.
* swscale: remove unused function.Ronald S. Bultje2011-06-081-29/+0
| | | | | Use of this wrapper was removed in a previous patch, but I forgot to actually remove the function itself.
* swscale: remove duplicate conversion routine in swScale().Ronald S. Bultje2011-06-071-73/+53
|
OpenPOWER on IntegriCloud