summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorBin Jin <bjin1990@gmail.com>2015-12-05 17:32:36 +0000
committerwm4 <wm4@nowhere>2015-12-07 23:48:12 +0100
commit18fe6e6dc8784348cf4f55b3a07c191a0ed8943d (patch)
treeac41f8b0e90c48174dfd95523d33f133b9b2858f /video
parentaaa64b879e3e54ece97e9babdd7e13127974a449 (diff)
downloadmpv-18fe6e6dc8784348cf4f55b3a07c191a0ed8943d.tar.bz2
mpv-18fe6e6dc8784348cf4f55b3a07c191a0ed8943d.tar.xz
filter_kernels: add warnings for potential LUT sampling error
Diffstat (limited to 'video')
-rw-r--r--video/out/filter_kernels.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/filter_kernels.c b/video/out/filter_kernels.c
index b826da5b45..d39e5ba4c5 100644
--- a/video/out/filter_kernels.c
+++ b/video/out/filter_kernels.c
@@ -139,6 +139,12 @@ static void mp_compute_weights(struct filter_kernel *filter,
// 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.
+//
+// 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)
{
struct filter_window *window = &filter->w;