aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-07-01 05:28:13 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-07-11 03:49:33 +0200
commitf2db5602ba8e51436a0b491c85f8b309fccb59c8 (patch)
treeec6ef608c296c451674d4b35c67f315c8c414147 /libswscale/utils.c
parent9251942ca728e7807a2a95306415b27b36a8b8e7 (diff)
parentafb9d4e8f10a78d52750e59bfd06d6fbd88e98f3 (diff)
downloadffmpeg-f2db5602ba8e51436a0b491c85f8b309fccb59c8.tar.gz
Merge branch 'ronalds_buggy_gt8bit_sws'
* ronalds_buggy_gt8bit_sws: swscale: fix another yuv range conversion overflow in 16bit scaling. (cherry picked from commit 81cc7d0bd1eab0aa782ff8dd49e087025a42cdee) swscale: fix yuv range correction when using 16-bit scaling. (cherry picked from commit e0b8fff6c7a293e35079ba1931bd19372686b3f6) swscale: implement >8bit scaling support. Conflicts: libswscale/swscale.c libswscale/utils.c libswscale/x86/swscale_template.c tests/ref/lavfi/pixdesc tests/ref/lavfi/pixfmts_copy tests/ref/lavfi/pixfmts_null tests/ref/lavfi/pixfmts_scale tests/ref/lavfi/pixfmts_vflip Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r--libswscale/utils.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index bff9f4d3c6..18793198fa 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -46,6 +46,7 @@
#include "libavutil/bswap.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/avassert.h"
unsigned swscale_version(void)
{
@@ -882,8 +883,15 @@ int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
}
}
+ // FIXME it's even nicer if bpp isn't 16, but max({src,dst}formatbpp)
+ c->scalingBpp = FFMAX(av_pix_fmt_descriptors[srcFormat].comp[0].depth_minus1,
+ av_pix_fmt_descriptors[dstFormat].comp[0].depth_minus1) >= 15 ? 16 : 8;
+
+ if (c->scalingBpp == 16)
+ dst_stride <<= 1;
+ av_assert0(c->scalingBpp<=16);
FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
- if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) {
+ if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2 && c->scalingBpp == 8) {
c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
if (flags&SWS_PRINT_INFO)