vo_opengl: explicitly check potential candidates for polar filters

This adds a small check for candidates that could potentially be inside
the radius, but aren't necessarily. This speeds up performance by a
negligible amount on my hardware, but it's mainly a prerequisite for a
further change (using a larger true radius).
This commit is contained in:
Niklas Haas 2015-02-23 22:41:13 +01:00
parent c52833bf16
commit 71a20f7c98
2 changed files with 11 additions and 2 deletions

View File

@ -829,8 +829,8 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
int xx = x > 0 ? x-1 : x;
double d = sqrt(xx*xx + yy*yy);
// Samples outside the radius are unnecessary
if (d < radius) {
if (d < radius - 1) {
// Samples definitely inside the main ring
APPENDF(shader, "SAMPLE_POLAR_%s(LUT, %f, %d, %d) \\\n ",
// The center 4 coefficients are the primary
// contributors, used to clamp the result for
@ -838,6 +838,10 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
(x >= 0 && y >= 0 && x <= 1 && y <= 1)
? "PRIMARY" : "HELPER",
(double)radius, x, y);
} else if (d < radius) {
// Samples on the edge, these are potential values
APPENDF(shader, "SAMPLE_POLAR_POTENTIAL(LUT, %f, %d, %d) \\\n ",
(double)radius, x, y);
}
}
}

View File

@ -312,6 +312,11 @@ float[6] weights6(sampler2D lookup, float f) {
lo = min(lo, c); \
hi = max(hi, c);
#define SAMPLE_POLAR_POTENTIAL(LUT, R, X, Y) \
if (length(vec2(X, Y) - fcoord)/R < 1.0) { \
SAMPLE_POLAR_HELPER(LUT, R, X, Y) \
}
#define SAMPLE_CONVOLUTION_POLAR_R(NAME, R, LUT, WEIGHTS_FN, ANTIRING) \
vec4 NAME(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { \
vec2 pt = vec2(1.0) / texsize; \