[FFmpeg-devel] [PATCH] swscale_unscaled: fix DITHER_COPY macro, use it only for dst_depth == 8

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Sep 26 14:31:54 EEST 2017

2017-09-26 1:33 GMT+02:00 Mateusz <mateuszb at poczta.onet.pl>:

> I've sent C code patch 2017-09-06 (and nothing) so I thought that the
> problem is with speed. For simplicity I've attached this patch.

You could (wait a day or two and) either add an option to
select your dithering code or put it under #ifdef so more
people can test it.


> In theory it is enough to make only dst = (src + dither)>>shift;
> -- white in limited range has 0 on bits to remove (235*4 for example)
> so overflow is impossible. For files with full range not marked as
> full range overflow is possible (for dither > 0) and white goes
> to black. tmp - (tmp>>dst_depth) undoing this overflow.

(Not necessarily related, sorry if I misunderstand:)
Valid limited-range frames can contain some pixels with peak
values outside of the defined range.

Carl Eugen

More information about the ffmpeg-devel mailing list