diff options
author | Bin Jin <bjin1990@gmail.com> | 2015-12-08 22:22:08 +0000 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-12-09 00:36:48 +0100 |
commit | 6d36c432ab926cd0333b4a1fb61b77cab57c522f (patch) | |
tree | 81fa984c3ba34030ef87110d7fa9024e172e72c2 /video/out | |
parent | 45ae0716be3319bac4585b8fedac529a0809a44c (diff) | |
download | mpv-6d36c432ab926cd0333b4a1fb61b77cab57c522f.tar.bz2 mpv-6d36c432ab926cd0333b4a1fb61b77cab57c522f.tar.xz |
vo_opengl: fix precision loss of fruit dithering matrix
With default setting, the matrix for fruit dithering requires 12 bits
precision (values from 0/4096 to 4095/4096). But 16-bit float
provides only 10 bits. In addition, when `dither-size-fruit=8` is
set, 16 bits are required from the texture format.
Fix this by attempting to use 16 bit integer texture first. This is
still not precise, but should be better than using a half float.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/opengl/video.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 8b7ec35478..30147235c2 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -1736,9 +1736,16 @@ static void pass_dither(struct gl_video *p) p->last_dither_matrix_size = size; } + const struct fmt_entry *fmt = find_tex_format(gl, 2, 1); tex_size = size; - tex_iformat = gl_float16_formats[0].internal_format; - tex_format = gl_float16_formats[0].format; + // Prefer R16 texture since they provide higher precision. + if (fmt->internal_format) { + tex_iformat = fmt->internal_format; + tex_format = fmt->format; + } else { + tex_iformat = gl_float16_formats[0].internal_format; + tex_format = gl_float16_formats[0].format; + } tex_type = GL_FLOAT; tex_data = p->last_dither_matrix; } else { |