Bssed on patch by Øyvind Kolås <pippin@gimp.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -1180,7 +1180,7 @@ void ff_get_unscaled_swscale(SwsContext *c) |
1180 | 1180 |
/* yuv2bgr */ |
1181 | 1181 |
if ((srcFormat == AV_PIX_FMT_YUV420P || srcFormat == AV_PIX_FMT_YUV422P || |
1182 | 1182 |
srcFormat == AV_PIX_FMT_YUVA420P) && isAnyRGB(dstFormat) && |
1183 |
- !(flags & SWS_ACCURATE_RND) && c->dither != SWS_DITHER_ED && !(dstH & 1)) { |
|
1183 |
+ !(flags & SWS_ACCURATE_RND) && (c->dither == SWS_DITHER_BAYER || c->dither == SWS_DITHER_AUTO) && !(dstH & 1)) { |
|
1184 | 1184 |
c->swScale = ff_yuv2rgb_get_func_ptr(c); |
1185 | 1185 |
} |
1186 | 1186 |
|
... | ... |
@@ -1205,18 +1205,22 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, |
1205 | 1205 |
dstFormat == AV_PIX_FMT_RGB8) { |
1206 | 1206 |
if (c->dither == SWS_DITHER_AUTO) |
1207 | 1207 |
c->dither = (flags & SWS_FULL_CHR_H_INT) ? SWS_DITHER_ED : SWS_DITHER_BAYER; |
1208 |
- if (c->dither == SWS_DITHER_ED && !(flags & SWS_FULL_CHR_H_INT)) { |
|
1209 |
- av_log(c, AV_LOG_DEBUG, |
|
1210 |
- "Error diffusion dither is only supported in full chroma interpolation for destination format '%s'\n", |
|
1211 |
- av_get_pix_fmt_name(dstFormat)); |
|
1212 |
- flags |= SWS_FULL_CHR_H_INT; |
|
1213 |
- c->flags = flags; |
|
1208 |
+ if (!(flags & SWS_FULL_CHR_H_INT)) { |
|
1209 |
+ if (c->dither == SWS_DITHER_ED) { |
|
1210 |
+ av_log(c, AV_LOG_DEBUG, |
|
1211 |
+ "Desired dithering only supported in full chroma interpolation for destination format '%s'\n", |
|
1212 |
+ av_get_pix_fmt_name(dstFormat)); |
|
1213 |
+ flags |= SWS_FULL_CHR_H_INT; |
|
1214 |
+ c->flags = flags; |
|
1215 |
+ } |
|
1214 | 1216 |
} |
1215 |
- if (c->dither != SWS_DITHER_ED && (flags & SWS_FULL_CHR_H_INT)) { |
|
1216 |
- av_log(c, AV_LOG_DEBUG, |
|
1217 |
- "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n", |
|
1218 |
- av_get_pix_fmt_name(dstFormat)); |
|
1219 |
- c->dither = SWS_DITHER_ED; |
|
1217 |
+ if (flags & SWS_FULL_CHR_H_INT) { |
|
1218 |
+ if (c->dither == SWS_DITHER_BAYER) { |
|
1219 |
+ av_log(c, AV_LOG_DEBUG, |
|
1220 |
+ "Ordered dither is not supported in full chroma interpolation for destination format '%s'\n", |
|
1221 |
+ av_get_pix_fmt_name(dstFormat)); |
|
1222 |
+ c->dither = SWS_DITHER_ED; |
|
1223 |
+ } |
|
1220 | 1224 |
} |
1221 | 1225 |
} |
1222 | 1226 |
if (isPlanarRGB(dstFormat)) { |