ref: 1d3f6364feadbc4694da2c3107eb9e8fe5c5443e
parent: c3ee7290e12e4f1993c462d9569e13f9c5374b8d
author: Janne Grunau <janne-vlc@jannau.net>
date: Wed Dec 12 16:49:42 EST 2018
inv_identity: avoid signed int overflow for 12-bit files Fixes #220.
--- a/src/itx_1d.c
+++ b/src/itx_1d.c
@@ -824,7 +824,7 @@
coef *const out, const ptrdiff_t out_s, const int range)
{
for (int i = 0; i < 4; i++)
- out[out_s * i] = (in[in_s * i] * 5793 + 2048) >> 12;
+ out[out_s * i] = in[in_s * i] + ((in[in_s * i] * 1697 + 2048) >> 12);
}
static void NOINLINE
@@ -840,7 +840,7 @@
coef *const out, const ptrdiff_t out_s, const int range)
{
for (int i = 0; i < 16; i++)
- out[out_s * i] = (in[in_s * i] * 2 * 5793 + 2048) >> 12;
+ out[out_s * i] = 2 * in[in_s * i] + ((in[in_s * i] * 1697 + 1024) >> 11);
}
static void NOINLINE