summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2015-02-23 23:52:01 +0100
committerNiklas Haas <git@nand.wakku.to>2015-02-24 00:29:27 +0100
commiteb70e31cc73093025e091eaebfcc218841d8588c (patch)
tree2b7695f556a76583c0251dd1e2c3d04d4aa8eeac
parent71a20f7c981ed66e1ba2e4c90c258c7506a9fb6b (diff)
downloadmpv-eb70e31cc73093025e091eaebfcc218841d8588c.tar.bz2
mpv-eb70e31cc73093025e091eaebfcc218841d8588c.tar.xz
vo_opengl: support polar filters of any radius
We can now truly pass a radius of 3.2383154841662362 or another real zero of the jinc function to get a better result.
-rw-r--r--video/out/gl_video.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c
index 6cff529843..f72ca6a8ab 100644
--- a/video/out/gl_video.c
+++ b/video/out/gl_video.c
@@ -814,15 +814,16 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
APPENDF(shader, "#define DEF_SCALER%d \\\n ", unit);
char lut_fn[40];
if (scaler->kernel->polar) {
- int radius = (int)scaler->kernel->radius;
+ double radius = scaler->kernel->radius;
+ int bound = (int)ceil(radius);
// SAMPLE_CONVOLUTION_POLAR_R(NAME, R, LUT, WEIGHTS_FN, ANTIRING)
- APPENDF(shader, "SAMPLE_CONVOLUTION_POLAR_R(%s, %d, %s, WEIGHTS%d, %f)\n",
+ APPENDF(shader, "SAMPLE_CONVOLUTION_POLAR_R(%s, %f, %s, WEIGHTS%d, %f)\n",
name, radius, lut_tex, unit, scaler->antiring);
// Pre-compute unrolled weights matrix
APPENDF(shader, "#define WEIGHTS%d(LUT) \\\n ", unit);
- for (int y = 1-radius; y <= radius; y++) {
- for (int x = 1-radius; x <= radius; x++) {
+ for (int y = 1-bound; y <= bound; y++) {
+ for (int x = 1-bound; x <= bound; x++) {
// Since we can't know the subpixel position in advance,
// assume a worst case scenario.
int yy = y > 0 ? y-1 : y;
@@ -837,11 +838,11 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
// anti-ringing
(x >= 0 && y >= 0 && x <= 1 && y <= 1)
? "PRIMARY" : "HELPER",
- (double)radius, x, y);
+ 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);
+ radius, x, y);
}
}
}