summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorBin Jin <bjin1990@gmail.com>2015-12-05 16:37:22 +0000
committerwm4 <wm4@nowhere>2015-12-05 23:53:17 +0100
commit19b0b1df51c1b0d898880dce1d5f48485e4acc2d (patch)
tree4ff45d8ce0a4a19a8d774574e90b6a49aaa087f5 /video
parent30bbcd6452daa4ccc0df90de6a005a7ab0f620a8 (diff)
downloadmpv-19b0b1df51c1b0d898880dce1d5f48485e4acc2d.tar.bz2
mpv-19b0b1df51c1b0d898880dce1d5f48485e4acc2d.tar.xz
vo_opengl: improve boundary check for polar filters
If the sampling point is placed diagonally, the radius difference could be as large as sqrt(2.0). And a loosened check with (radius - 1) would potentially include pixels out of the range. Fix the check to handle those corner case properly to avoid unnecessary texture lookup and improve the performance a bit.
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/video_shaders.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/opengl/video_shaders.c b/video/out/opengl/video_shaders.c
index 3af200b87c..34948f4fe8 100644
--- a/video/out/opengl/video_shaders.c
+++ b/video/out/opengl/video_shaders.c
@@ -139,7 +139,7 @@ void pass_sample_polar(struct gl_shader_cache *sc, struct scaler *scaler)
continue;
GLSLF("d = length(vec2(%d.0, %d.0) - fcoord)/%f;\n", x, y, radius);
// Check for samples that might be skippable
- if (dmax >= radius - 1)
+ if (dmax >= radius - M_SQRT2)
GLSLF("if (d < 1.0) {\n");
if (scaler->gl_target == GL_TEXTURE_1D) {
GLSL(w = texture1D(lut, d).r;)
@@ -153,7 +153,7 @@ void pass_sample_polar(struct gl_shader_cache *sc, struct scaler *scaler)
GLSL(lo = min(lo, c);)
GLSL(hi = max(hi, c);)
}
- if (dmax >= radius -1)
+ if (dmax >= radius - M_SQRT2)
GLSLF("}\n");
}
}