From 845f4dbfe152a53f9562bc912869a1b892f95cfb Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 26 Mar 2018 17:34:56 +0300 Subject: [PATCH] update comment --- src/libImaging/ColorLUT.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/libImaging/ColorLUT.c b/src/libImaging/ColorLUT.c index 4a5c6bced..2af348586 100644 --- a/src/libImaging/ColorLUT.c +++ b/src/libImaging/ColorLUT.c @@ -144,13 +144,16 @@ ImagingColorLUT3D_linear(Imaging imOut, Imaging imIn, int table_channels, int size1D, int size2D, int size3D, INT16* table) { - /* The fractions are a way to avoid overflow. - For every pixel, we interpolate 8 elements from the table: - current and +1 for every dimension and they combinations. - If we hit the upper cells from the table, - +1 cells will be outside of the table. - With this compensation we never hit the upper cells - but this also doesn't introduce any noticable difference. */ + /* This float to int conversion doesn't have rounding + error compensation (+ 0.5) for two reasons: + 1. As we don't hit the highest value, + we can use one extra bit for precision. + 2. For every pixel, we interpolate 8 elements from the table: + current and +1 for every dimension and they combinations. + If we hit the upper cells from the table, + +1 cells will be outside of the table. + With this compensation we never hit the upper cells + but this also doesn't introduce any noticable difference. */ UINT32 scale1D = (size1D - 1) / 255.0 * (1<