summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2016-09-25 16:23:20 +0200
committerLuca Barbato <lu_zero@gentoo.org>2016-09-27 17:17:54 +0200
commite87a501e7d03ac68b58520108fe24ad9d0b36765 (patch)
treec3ac47c76015203beedb4b63f660dbf8fa8a7166 /libswscale
parentde8e096c7eda2bce76efd0a1c1c89d37348c2414 (diff)
swscale: Update bitdepth range check
Make sure the scaling functions for the 9-15bits are used for 9-15bits bit depths correctly.
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale.c6
-rw-r--r--libswscale/swscale_internal.h2
-rw-r--r--libswscale/x86/swscale.c14
3 files changed, 11 insertions, 11 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 131980855c..142c79c14a 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -731,7 +731,7 @@ static av_cold void sws_init_swscale(SwsContext *c)
ff_sws_init_input_funcs(c);
if (c->srcBpc == 8) {
- if (c->dstBpc <= 10) {
+ if (c->dstBpc <= 15) {
c->hyScale = c->hcScale = hScale8To15_c;
if (c->flags & SWS_FAST_BILINEAR) {
c->hyscale_fast = hyscale_fast_c;
@@ -741,12 +741,12 @@ static av_cold void sws_init_swscale(SwsContext *c)
c->hyScale = c->hcScale = hScale8To19_c;
}
} else {
- c->hyScale = c->hcScale = c->dstBpc > 10 ? hScale16To19_c
+ c->hyScale = c->hcScale = c->dstBpc > 15 ? hScale16To19_c
: hScale16To15_c;
}
if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
- if (c->dstBpc <= 10) {
+ if (c->dstBpc <= 15) {
if (c->srcRange) {
c->lumConvertRange = lumRangeFromJpeg_c;
c->chrConvertRange = chrRangeFromJpeg_c;
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 84f8dd339f..625bd864a4 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -569,7 +569,7 @@ static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
av_assert0(desc);
- return desc->comp[0].depth == 9 || desc->comp[0].depth == 10;
+ return desc->comp[0].depth >= 9 && desc->comp[0].depth <= 15;
}
static av_always_inline int isBE(enum AVPixelFormat pix_fmt)
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index ec774678d5..48b5b49ce8 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -316,16 +316,16 @@ av_cold void ff_sws_init_swscale_x86(SwsContext *c)
#define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
if (c->srcBpc == 8) { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
+ hscalefn = c->dstBpc <= 15 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
ff_hscale8to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 9) { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
+ hscalefn = c->dstBpc <= 15 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
ff_hscale9to19_ ## filtersize ## _ ## opt1; \
} else if (c->srcBpc == 10) { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
+ hscalefn = c->dstBpc <= 15 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
ff_hscale10to19_ ## filtersize ## _ ## opt1; \
- } else /* c->srcBpc == 16 */ { \
- hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
+ } else if (c->srcBpc == 16) { \
+ hscalefn = c->dstBpc <= 15 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
ff_hscale16to19_ ## filtersize ## _ ## opt1; \
} \
} while (0)
@@ -340,14 +340,14 @@ switch(c->dstBpc){ \
case 16: do_16_case; break; \
case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
- default: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
+ case 8: if (condition_8bit) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
}
#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
switch(c->dstBpc){ \
case 16: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
case 9: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_ ## opt2; break; \
- default: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
+ case 8: vscalefn = ff_yuv2plane1_8_ ## opt1; break; \
}
#define case_rgb(x, X, opt) \
case AV_PIX_FMT_ ## X: \