diff --git a/libswscale/output.c b/libswscale/output.c index 62cbe2ffaa..ea1ee54f3c 100644 --- a/libswscale/output.c +++ b/libswscale/output.c @@ -2184,7 +2184,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c, } else if (is16BPS(dstFormat)) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_16BE_c : yuv2planeX_16LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_16BE_c : yuv2plane1_16LE_c; - } else if (is9_OR_10BPS(dstFormat)) { + } else if (isNBPS(dstFormat)) { if (desc->comp[0].depth == 9) { *yuv2planeX = isBE(dstFormat) ? yuv2planeX_9BE_c : yuv2planeX_9LE_c; *yuv2plane1 = isBE(dstFormat) ? yuv2plane1_9BE_c : yuv2plane1_9LE_c; diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index 35a08c4793..9438a63ff2 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -337,7 +337,7 @@ av_cold void ff_sws_init_swscale_ppc(SwsContext *c) if (c->srcBpc == 8 && c->dstBpc <= 14) { c->hyScale = c->hcScale = hScale_altivec_real; } - if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) && + if (!is16BPS(dstFormat) && !isNBPS(dstFormat) && dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && !c->needAlpha) { c->yuv2planeX = yuv2planeX_altivec; diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c3a8d0efd4..eb2f182ce6 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -254,7 +254,7 @@ static int swscale(SwsContext *c, const uint8_t *src[], yuv2anyX_fn yuv2anyX = c->yuv2anyX; const int chrSrcSliceY = srcSliceY >> c->chrSrcVSubSample; const int chrSrcSliceH = AV_CEIL_RSHIFT(srcSliceH, c->chrSrcVSubSample); - int should_dither = is9_OR_10BPS(c->srcFormat) || + int should_dither = isNBPS(c->srcFormat) || is16BPS(c->srcFormat); int lastDstY; diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 54cd85cce3..a892a4f97c 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -652,15 +652,13 @@ static av_always_inline int is16BPS(enum AVPixelFormat pix_fmt) return desc->comp[0].depth == 16; } -static av_always_inline int is9_OR_10BPS(enum AVPixelFormat pix_fmt) +static av_always_inline int isNBPS(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 <= 14; } -#define isNBPS(x) is9_OR_10BPS(x) - static av_always_inline int isBE(enum AVPixelFormat pix_fmt) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 1a102271c1..b8bdcd4d03 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -1499,7 +1499,7 @@ static av_cold void RENAME(sws_init_swscale)(SwsContext *c) enum AVPixelFormat dstFormat = c->dstFormat; c->use_mmx_vfilter= 0; - if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) && dstFormat != AV_PIX_FMT_NV12 + if (!is16BPS(dstFormat) && !isNBPS(dstFormat) && dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 && !(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { if (!(c->flags & SWS_FULL_CHR_H_INT)) {