mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-21 04:34:47 +03:00
SIMD Resample. Correct max coefficient calculation
Minimal test case: Image.new('RGB', (341, 60), 'pink').resize((170, 60), Image.LANCZOS).save('_out.png')
This commit is contained in:
parent
b3c28911c0
commit
a71b748bde
|
@ -297,11 +297,12 @@ normalize_coeffs_8bpc(int outSize, int ksize, double *prekk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
coefs_precision = 0;
|
for (coefs_precision = 0; coefs_precision < PRECISION_BITS; coefs_precision += 1) {
|
||||||
while (maxkk < (1 << (MAX_COEFS_PRECISION-1)) && (coefs_precision < PRECISION_BITS)) {
|
int next_value = (int) (0.5 + maxkk * (1 << (coefs_precision + 1)));
|
||||||
maxkk *= 2;
|
// The next value will be outside of the range, so just stop
|
||||||
coefs_precision += 1;
|
if (next_value >= (1 << MAX_COEFS_PRECISION))
|
||||||
};
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (x = 0; x < outSize * ksize; x++) {
|
for (x = 0; x < outSize * ksize; x++) {
|
||||||
if (prekk[x] < 0) {
|
if (prekk[x] < 0) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user