diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-02-17 16:14:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-02-17 17:47:17 +0300 |
commit | 852cdd476b5572b56418d377e379c07253363eff (patch) | |
tree | 14467e0c649819e95f4de6913dfc0ac7edf4d8b8 /source/blender/imbuf | |
parent | 5231d06d4cd4a613b0493965893ae17df43c0f22 (diff) |
ColorManagement: Dithering Improvement
- Unlock property range.
- Use triangular noise to keep perceptual noise error more uniform.
Remap range to preserve perceptual intensity.
- Center noise distribution around 0 for GPU implementation because of
rounding.
- Do dithering after merging overlays.
Effect of using triangular noise is not really noticeable if you don't use
really low bitdepth. But doing a test in the shader were we artificially
reduce the bitdepth (`col = (col * 16) / 16;`) reveals the real difference.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6850
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index aa49453d68c..07bbec9e15c 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -75,7 +75,7 @@ MINLINE void ushort_to_byte_dither_v4( uchar b[4], const unsigned short us[4], DitherContext *di, float s, float t) { #define USHORTTOFLOAT(val) ((float)val / 65535.0f) - float dither_value = dither_random_value(s, t) * 0.005f * di->dither; + float dither_value = dither_random_value(s, t) * 0.0033f * di->dither; b[0] = ftochar(dither_value + USHORTTOFLOAT(us[0])); b[1] = ftochar(dither_value + USHORTTOFLOAT(us[1])); @@ -88,7 +88,7 @@ MINLINE void ushort_to_byte_dither_v4( MINLINE void float_to_byte_dither_v4( uchar b[4], const float f[4], DitherContext *di, float s, float t) { - float dither_value = dither_random_value(s, t) * 0.005f * di->dither; + float dither_value = dither_random_value(s, t) * 0.0033f * di->dither; b[0] = ftochar(dither_value + f[0]); b[1] = ftochar(dither_value + f[1]); |