diff options
author | Bin Jin <bjin1990@gmail.com> | 2014-08-25 22:36:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-26 22:19:27 +0200 |
commit | f14722a40f46366e4333881ec5d540bca1400280 (patch) | |
tree | 05872c144c973ba14ef29ba881954123c7228df6 /video/out/gl_video_shaders.glsl | |
parent | a8b67c66f24700205923959b005b2547490e6c8e (diff) | |
download | mpv-f14722a40f46366e4333881ec5d540bca1400280.tar.bz2 mpv-f14722a40f46366e4333881ec5d540bca1400280.tar.xz |
vo_opengl: add cparam1 and cparam2 options
Although cscale is rarely used, it's possible that params of cscale
are accidentally set to lparam1 and lparam2, which might cause
unexpected results.
Diffstat (limited to 'video/out/gl_video_shaders.glsl')
-rw-r--r-- | video/out/gl_video_shaders.glsl | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index 6019b78243..3d9d9bf07a 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -158,7 +158,8 @@ uniform float input_gamma; uniform float conv_gamma; uniform float dither_quantization; uniform float dither_center; -uniform float filter_param1; +uniform float filter_param1_l; +uniform float filter_param1_c; uniform vec2 dither_size; in vec2 texcoord; @@ -167,7 +168,7 @@ DECLARE_FRAGPARMS #define CONV_NV12 1 #define CONV_PLANAR 2 -vec4 sample_bilinear(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { +vec4 sample_bilinear(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord, float param1) { return texture(tex, texcoord); } @@ -188,7 +189,7 @@ vec4 calcweights(float s) { return t; } -vec4 sample_bicubic_fast(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { +vec4 sample_bicubic_fast(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord, float param1) { vec2 pt = 1 / texsize; vec2 fcoord = fract(texcoord * texsize + vec2(0.5, 0.5)); vec4 parmx = calcweights(fcoord.x); @@ -323,7 +324,7 @@ SAMPLE_CONVOLUTION_N(sample_convolution16, 16, sampler2D, convolution16, weights // Unsharp masking -vec4 sample_sharpen3(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { +vec4 sample_sharpen3(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord, float param1) { vec2 pt = 1 / texsize; vec2 st = pt * 0.5; vec4 p = texture(tex, texcoord); @@ -331,10 +332,10 @@ vec4 sample_sharpen3(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { + texture(tex, texcoord + st * vec2(+1, -1)) + texture(tex, texcoord + st * vec2(-1, +1)) + texture(tex, texcoord + st * vec2(-1, -1)); - return p + (p - 0.25 * sum) * filter_param1; + return p + (p - 0.25 * sum) * param1; } -vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { +vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord, float param1) { vec2 pt = 1 / texsize; vec2 st1 = pt * 1.2; vec4 p = texture(tex, texcoord); @@ -348,9 +349,23 @@ vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { + texture(tex, texcoord + st2 * vec2(-1, 0)) + texture(tex, texcoord + st2 * vec2( 0, -1)); vec4 t = p * 0.859375 + sum2 * -0.1171875 + sum1 * -0.09765625; - return p + t * filter_param1; + return p + t * param1; } +#define SAMPLE_FILTER_LC(NAME) \ + vec4 NAME##_l(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { \ + return NAME(tex, texsize, texcoord, filter_param1_l); \ + } \ + \ + vec4 NAME##_c(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { \ + return NAME(tex, texsize, texcoord, filter_param1_c); \ + } + +SAMPLE_FILTER_LC(sample_bilinear) +SAMPLE_FILTER_LC(sample_bicubic_fast) +SAMPLE_FILTER_LC(sample_sharpen3) +SAMPLE_FILTER_LC(sample_sharpen5) + void main() { vec2 chr_texcoord = texcoord; #ifdef USE_RECTANGLE |