mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
swscale: Update bitdepth range check
Make sure the scaling functions for the 9-15bits are used for 9-15bits bit depths correctly.
This commit is contained in:
parent
de8e096c7e
commit
e87a501e7d
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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: \
|
||||
|
Loading…
Reference in New Issue
Block a user