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:
Alexander 2019-04-03 01:31:30 +03:00 committed by Alexander Karpinsky
parent b3c28911c0
commit a71b748bde

View File

@ -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) {