mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
45ae0716be
commit
6d36c432ab
|
@ -1736,9 +1736,16 @@ static void pass_dither(struct gl_video *p)
|
||||||
p->last_dither_matrix_size = size;
|
p->last_dither_matrix_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const struct fmt_entry *fmt = find_tex_format(gl, 2, 1);
|
||||||
tex_size = size;
|
tex_size = size;
|
||||||
tex_iformat = gl_float16_formats[0].internal_format;
|
// Prefer R16 texture since they provide higher precision.
|
||||||
tex_format = gl_float16_formats[0].format;
|
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_type = GL_FLOAT;
|
||||||
tex_data = p->last_dither_matrix;
|
tex_data = p->last_dither_matrix;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue