From 18fe6e6dc8784348cf4f55b3a07c191a0ed8943d Mon Sep 17 00:00:00 2001 From: Bin Jin Date: Sat, 5 Dec 2015 17:32:36 +0000 Subject: filter_kernels: add warnings for potential LUT sampling error --- video/out/filter_kernels.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit v1.2.3