From 02258f38c5bbd2840aff5458b6defb995aa7aea5 Mon Sep 17 00:00:00 2001 From: homm Date: Tue, 11 Oct 2016 18:51:09 +0300 Subject: [PATCH] more readable --- libImaging/Resample.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libImaging/Resample.c b/libImaging/Resample.c index e4d4e195f..770f5f611 100644 --- a/libImaging/Resample.c +++ b/libImaging/Resample.c @@ -176,6 +176,9 @@ precompute_coeffs(int inSize, int outSize, struct filter *filterp, k = &kk[xx * kmax]; for (x = 0; x < xmax; x++) { double w = filterp->filter((x + xmin - center + 0.5) * ss); + k[x] = w; + ww += w; + // We can skip extreme coefficients if they are zeroes. if (w == 0) { // Skip from the start. @@ -185,15 +188,11 @@ precompute_coeffs(int inSize, int outSize, struct filter *filterp, // But `w` will not be 0, because it based on `xmin`. xmin += 1; xmax -= 1; - // Prevent setting the `k[-1]` item. - continue; } else if (x == xmax - 1) { // Truncate the last coefficient for current `xx`. xmax -= 1; } } - k[x] = w; - ww += w; } for (x = 0; x < xmax; x++) { if (ww != 0.0)