mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-17 02:34:44 +03:00
detailed comments what is going on
prevent setting the `k[-1]` item
This commit is contained in:
parent
22e3ae3ee4
commit
f0c74d32a7
|
@ -176,12 +176,19 @@ 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);
|
||||
// We can skip extreme coefficients if they are zeroes.
|
||||
if (w == 0) {
|
||||
// Skip from the start.
|
||||
if (x == 0) {
|
||||
// At next loop `x` will be 0.
|
||||
x -= 1;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user