[FFmpeg-devel] [PATCH] libswscale/swscale_unscaled: fix DITHER_COPY macro

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Mar 20 11:00:42 EET 2017

2017-03-15 22:52 GMT+01:00 Mateusz Brzostek <mateusz at msystem.waw.pl>:
> Hello!
> There are 3 problems with DITHER_COPY macro in libswscale/swscale_unscaled.c:
> 1) there is overflow in dithering from 12-bit to 10-bit (output value > 1023);
> 2) for limit range the lower limit is not respected, for example from 10-bit to 8-bit value 64 is converted to 15;
> 3) for many iteration of downscale/upscale of the same image the 200th iteration is significantly darker.
> The first bug is due to wrong dithers table (now it is OK only for 8-bit destination), fix is:
> -        const uint8_t *dither= dithers[src_depth-9][i&7];\
> +        const uint8_t *dither= dithers[src_depth-dst_depth-1][i&7];\

I believe this implies that you could split your patch.

Carl Eugen

More information about the ffmpeg-devel mailing list