diff options
author | wm4 <wm4@nowhere> | 2013-05-30 13:36:11 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-30 15:38:07 +0200 |
commit | e08bf272ee100911001530aa605b8cf6b381c47e (patch) | |
tree | 77efcd9f67f63d82f098082d639921ab38cf7232 /video/out/gl_video_shaders.glsl | |
parent | 6bfbca9912c2d86d6b28dc5000bb878fb5fbe849 (diff) | |
download | mpv-e08bf272ee100911001530aa605b8cf6b381c47e.tar.bz2 mpv-e08bf272ee100911001530aa605b8cf6b381c47e.tar.xz |
gl_video: fix some dithering bugs
The internal texture format GL_RED is typically 8 bit, which is clearly
not good enough for the new dither matrix. The idea was to use a float
texture format, but this was somehow "forgotten". Use GL_R16, since
16 bit textures are more robust, and provide more precision for the
same memory usage.
Change how the offset for centering the dither matrix is applied. This
is needed for making it possible to round up values to the target depth.
Before this commit, this changed the output even if the input was exact
and input and output depth were the same, which is not really what you
want. Now it doesn't do that anymore.
Diffstat (limited to 'video/out/gl_video_shaders.glsl')
-rw-r--r-- | video/out/gl_video_shaders.glsl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index c19a19fbee..5d77d0c38f 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -126,7 +126,7 @@ uniform vec3 inv_gamma; uniform float input_gamma; uniform float conv_gamma; uniform float dither_quantization; -uniform float dither_multiply; +uniform float dither_center; uniform float filter_param1; uniform vec2 dither_size; @@ -382,7 +382,8 @@ void main() { dither_pos = dither_trafo * dither_pos; #endif float dither_value = texture(dither, dither_pos).r; - color = floor(color * dither_multiply + dither_value ) / dither_quantization; + color = floor(color * dither_quantization + dither_value + dither_center) / + dither_quantization; #endif #ifdef USE_ALPHA out_color = vec4(color, alpha); |