From e364c2d9d937b490a4650ec88f24b549a3a9de16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 19 Aug 2013 11:50:16 +0200 Subject: [PATCH 1/2] swscale: make bayer not error diffusion be the special case This prepares for adding futher dithering methods along with the error diffusion code path. --- libswscale/swscale_unscaled.c | 2 +- libswscale/utils.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 8818721..1034452 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -1180,7 +1180,7 @@ void ff_get_unscaled_swscale(SwsContext *c) /* yuv2bgr */ if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P || srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && - !(flags & SWS_ACCURATE_RND) && c->dither != SWS_DITHER_ED && !(dstH & 1)) { + !(flags & SWS_ACCURATE_RND) && c->dither == SWS_DITHER_BAYER && !(dstH & 1)) { c->swScale = ff_yuv2rgb_get_func_ptr(c); } diff --git a/libswscale/utils.c b/libswscale/utils.c index 3303dcb..a3ca00c 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1203,14 +1203,14 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, dstFormat == AV_PIX_FMT_RGB4_BYTE || dstFormat == AV_PIX_FMT_BGR8 || dstFormat == AV_PIX_FMT_RGB8) { - if (c->dither == SWS_DITHER_ED && !(flags & SWS_FULL_CHR_H_INT)) { + if (c->dither != SWS_DITHER_BAYER && !(flags & SWS_FULL_CHR_H_INT)) { av_log(c, AV_LOG_DEBUG, - "Error diffusion dither is only supported in full chroma interpolation for destination format '%s'\n", + "Desired dithering only supported in full chroma interpolation for destination format '%s'\n", av_get_pix_fmt_name(dstFormat)); flags |= SWS_FULL_CHR_H_INT; c->flags = flags; } - if (c->dither != SWS_DITHER_ED && (flags & SWS_FULL_CHR_H_INT)) { + if (c->dither == SWS_DITHER_BAYER && (flags & SWS_FULL_CHR_H_INT)) { av_log(c, AV_LOG_DEBUG, "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n", av_get_pix_fmt_name(dstFormat)); -- 1.7.10.4