summaryrefslogtreecommitdiffstats
path: root/video/out/filter_kernels.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-08-27 09:15:50 +0200
committerNiklas Haas <git@haasn.xyz>2017-09-04 13:53:14 +0200
commit8cf5799ab1e1cb2de22636eadf3119a319161aec (patch)
tree891a1917891078c003a788597662fe1c9ae3e318 /video/out/filter_kernels.c
parentf589a3bd78efbc16e8025bff0809ac3c16b8ea2b (diff)
downloadmpv-8cf5799ab1e1cb2de22636eadf3119a319161aec.tar.bz2
mpv-8cf5799ab1e1cb2de22636eadf3119a319161aec.tar.xz
vo_opengl: refactor scaler LUT weight packing/loading
This is mostly done so we can support using textures with more components than the scaler LUTs have entries. But while we're at it, also change the way the weights are packed so that they're always sequential with no gaps. This allows us to simplify pass_sample_separated_get_weights as well.
Diffstat (limited to 'video/out/filter_kernels.c')
-rw-r--r--video/out/filter_kernels.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c
index 87fd129714..bfbd4e9465 100644
--- a/video/out/filter_kernels.c
+++ b/video/out/filter_kernels.c
@@ -142,14 +142,17 @@ static void mp_compute_weights(struct filter_kernel *filter, double f,
}
// Fill the given array with weights for the range [0.0, 1.0]. The array is
-// interpreted as rectangular array of count * filter->size items.
+// interpreted as rectangular array of count * filter->size items, with a
+// stride of `stride` floats in between each array element. (For polar filters,
+// the `count` indicates the row size and filter->size/stride are ignored)
//
// There will be slight sampling error if these weights are used in a OpenGL
// texture as LUT directly. The sampling point of a texel is located at its
// center, so out_array[0] will end up at 0.5 / count instead of 0.0.
// Correct lookup requires a linear coordinate mapping from [0.0, 1.0] to
// [0.5 / count, 1.0 - 0.5 / count].
-void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array)
+void mp_compute_lut(struct filter_kernel *filter, int count, int stride,
+ float *out_array)
{
if (filter->polar) {
filter->radius_cutoff = 0.0;
@@ -165,7 +168,7 @@ void mp_compute_lut(struct filter_kernel *filter, int count, float *out_array)
// Compute a 2D array indexed by subpixel position
for (int n = 0; n < count; n++) {
mp_compute_weights(filter, n / (double)(count - 1),
- out_array + filter->size * n);
+ out_array + stride * n);
}
}
}