summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/utils.c
diff options
context:
space:
mode:
authorBin Jin <bjin1990@gmail.com>2015-10-26 22:43:48 +0000
committerwm4 <wm4@nowhere>2015-11-05 17:38:20 +0100
commit4c43c30421b1d713b7a17b437e381fe1efd01902 (patch)
tree073551ba56ccc34be9c093eabab62cb09b1ca496 /video/out/opengl/utils.c
parent7438f208c37deb1a30df54278a6d81227038f33e (diff)
downloadmpv-4c43c30421b1d713b7a17b437e381fe1efd01902.tar.bz2
mpv-4c43c30421b1d713b7a17b437e381fe1efd01902.tar.xz
vo_opengl: add Super-xBR filter for upscaling
Add the Super-xBR filter for image doubling, and the prescaling framework to support it. The shader code was ported from MPDN extensions project, with modification to process luma only. This commit is largely inspired by code from #2266, with `gl_transform_trans()` authored by @haasn taken directly.
Diffstat (limited to 'video/out/opengl/utils.c')
-rw-r--r--video/out/opengl/utils.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c
index ac36bdffc4..0026090df9 100644
--- a/video/out/opengl/utils.c
+++ b/video/out/opengl/utils.c
@@ -435,6 +435,18 @@ void gl_transform_ortho(struct gl_transform *t, float x0, float x1,
t->t[1] = -(y1 + y0) / (y1 - y0);
}
+// Apply the effects of one transformation to another, transforming it in the
+// process. In other words: post-composes t onto x
+void gl_transform_trans(struct gl_transform t, struct gl_transform *x)
+{
+ float x00 = x->m[0][0], x01 = x->m[0][1], x10 = x->m[1][0], x11 = x->m[1][1];
+ x->m[0][0] = t.m[0][0] * x00 + t.m[0][1] * x10;
+ x->m[1][0] = t.m[0][0] * x01 + t.m[0][1] * x11;
+ x->m[0][1] = t.m[1][0] * x00 + t.m[1][1] * x10;
+ x->m[1][1] = t.m[1][0] * x01 + t.m[1][1] * x11;
+ gl_transform_vec(t, &x->t[0], &x->t[1]);
+}
+
static void GLAPIENTRY gl_debug_cb(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const GLchar *message, const void *userParam)
@@ -462,7 +474,7 @@ void gl_set_debug_logger(GL *gl, struct mp_log *log)
}
}
-#define SC_ENTRIES 16
+#define SC_ENTRIES 32
#define SC_UNIFORM_ENTRIES 20
enum uniform_type {