summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-07-20 19:09:22 +0200
committerwm4 <wm4@nowhere>2015-07-20 19:32:58 +0200
commit6f7d04be21de7bdfce3c7c38a4d5fae17451b409 (patch)
treef1ef5042ab21bc055e5b4248cd3d90aa83c28c34
parentb11fd7fd2d18bd94004a40a1865df12babc4537f (diff)
downloadmpv-6f7d04be21de7bdfce3c7c38a4d5fae17451b409.tar.bz2
mpv-6f7d04be21de7bdfce3c7c38a4d5fae17451b409.tar.xz
vo_opengl: add temporal-dither-period option
This was requested multiple times by users, and it's not hard to implement and/or maintain.
-rw-r--r--DOCS/man/vo.rst5
-rw-r--r--video/out/gl_video.c5
-rw-r--r--video/out/gl_video.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index 18a56fe79c..d6d1db60e8 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -455,6 +455,11 @@ Available video output drivers are:
Unfortunately, this can lead to flicker on LCD displays, since these
have a high reaction time.
+ ``temporal-dither-period=<1-128>``
+ Determines how often the dithering pattern is updated when
+ ``temporal-dither`` is in use. 1 (the default) will update on every
+ video frame, 2 on every other frame, etc.
+
``debug``
Check for OpenGL errors, i.e. call ``glGetError()``. Also request a
debug OpenGL context (which does nothing with current graphics drivers
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 6aa5d94a75..8f46daa8d6 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -333,6 +333,7 @@ static const struct packed_fmt_entry mp_packed_formats[] = {
const struct gl_video_opts gl_video_opts_def = {
.dither_depth = -1,
.dither_size = 6,
+ .temporal_dither_period = 1,
.fbo_format = GL_RGBA16,
.sigmoid_center = 0.75,
.sigmoid_slope = 6.5,
@@ -350,6 +351,7 @@ const struct gl_video_opts gl_video_opts_def = {
const struct gl_video_opts gl_video_opts_hq_def = {
.dither_depth = 0,
.dither_size = 6,
+ .temporal_dither_period = 1,
.fbo_format = GL_RGBA16,
.fancy_downscaling = 1,
.sigmoid_center = 0.75,
@@ -438,6 +440,7 @@ const struct m_sub_options gl_video_conf = {
({"fruit", 0}, {"ordered", 1}, {"no", -1})),
OPT_INTRANGE("dither-size-fruit", dither_size, 0, 2, 8),
OPT_FLAG("temporal-dither", temporal_dither, 0),
+ OPT_INTRANGE("temporal-dither-period", temporal_dither_period, 0, 1, 128),
OPT_CHOICE("alpha", alpha_mode, 0,
({"no", 0},
{"yes", 1},
@@ -1923,7 +1926,7 @@ static void pass_dither(struct gl_video *p)
GLSLF("vec2 dither_pos = gl_FragCoord.xy / %d;\n", p->dither_size);
if (p->opts.temporal_dither) {
- int phase = p->frames_rendered % 8u;
+ int phase = (p->frames_rendered / p->opts.temporal_dither_period) % 8u;
float r = phase * (M_PI / 2); // rotate
float m = phase < 4 ? 1 : -1; // mirror
diff --git a/video/out/gl_video.h b/video/out/gl_video.h
index 840fab211c..0881025a14 100644
--- a/video/out/gl_video.h
+++ b/video/out/gl_video.h
@@ -59,6 +59,7 @@ struct gl_video_opts {
int dither_algo;
int dither_size;
int temporal_dither;
+ int temporal_dither_period;
int fbo_format;
int alpha_mode;
int chroma_location;