From 26baf5b9da4faaec6f5e39a8efba7e58dd6317ed Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sun, 4 Jan 2015 23:11:27 +0100 Subject: vo_opengl: add ewa_lanczos upscaler (aka jinc) This is the polar (elliptic weighted average) version of lanczos. This introduces a general new form of polar filters. --- video/out/gl_video_shaders.glsl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'video/out/gl_video_shaders.glsl') diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index 4037e42449..dac19cb673 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -168,6 +168,8 @@ uniform vec2 chroma_center_offset; uniform vec2 chroma_div; uniform sampler2D lut_c; uniform sampler2D lut_l; +uniform sampler1D lut_polar_c; +uniform sampler1D lut_polar_l; #if HAVE_3DTEX uniform sampler3D lut_3d; #endif @@ -297,6 +299,25 @@ float[6] weights6(sampler2D lookup, float f) { return res; \ } + +#define SAMPLE_CONVOLUTION_POLAR_R(NAME, R, LUT) \ + vec4 NAME(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { \ + vec2 pt = vec2(1.0) / texsize; \ + vec2 fcoord = fract(texcoord * texsize - vec2(0.5)); \ + vec2 base = texcoord - fcoord * pt; \ + vec4 res = vec4(0); \ + float wsum = 0; \ + for (int y = 1-R; y <= R; y++) { \ + for (int x = 1-R; x <= R; x++) { \ + vec2 d = vec2(x,y) - fcoord; \ + float w = texture1D(LUT, sqrt(d.x*d.x + d.y*d.y)/R).r; \ + wsum += w; \ + res += w * texture(tex, base + pt * vec2(x, y)); \ + } \ + } \ + return res / wsum; \ + } + #ifdef DEF_SCALER0 DEF_SCALER0 #endif -- cgit v1.2.3