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

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Sep 25 23:53:29 EEST 2017

2017-09-23 19:18 GMT+02:00 Mateusz <mateuszb at poczta.onet.pl>:
> W dniu 2017-09-23 o 17:01, Michael Niedermayer pisze:
>> On Fri, Sep 22, 2017 at 02:10:01AM +0200, Mateusz wrote:
>>> To reduce bit depth in planar YUV or gray pixel formats
>>> ffmpeg uses DITHER_COPY macro.
>>> Now it makes images greener and with visible dither pattern.
>>> In my opinion there is no point to use dither tables for
>>> destination bit depth >= 9, we can use simple down-shift
>>> which is neutral in full and limited range -- result images
>>> are with the same brightness and with the same colors.
>> Theres no reason why dither should mess up the average color tone.
> In theory -- yes, I agree.
> In reality -- current version of DITHER_COPY mess up the
> average color tone.
> It's one of the reasons why I sending these patches.
>> And if the user asks for >= 9 bit depth and has >= 10 bit
>> input the user likely wants to get the best quality.
>> Thats more so in a world where computers get faster
>> every few years, this isnt 1995 where shaving off a add
>> or a multiply per pixel was actually making a difference
>> in being able to play something in realtime
>> More so coverting between bit depths might be memory
>> speed limited and not limited by arithmetic computations
>> once its done in SIMD
> Yes, I agree. Now I can't write patches in NASM syntax, but
> I started reading and learning.
> I hope I'll back in a few months...

I strongly suspect there should be agreement over the C code
first, asm optimizations can be done once C code is agreed

Thank you for the samples, Carl Eugen

More information about the ffmpeg-devel mailing list