avfilter/vf_hqdn3d: fix left shift of negative numbers

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Valerii Zapodovnikov 2021-05-24 06:42:32 +03:00 committed by Michael Niedermayer
parent 3ac7d99428
commit ff0d70c8a9

View File

@ -179,7 +179,7 @@ static void precalc_coefs(double dist25, int depth, int16_t *ct)
gamma = log(0.25) / log(1.0 - FFMIN(dist25,252.0)/255.0 - 0.00001);
for (i = -256<<LUT_BITS; i < 256<<LUT_BITS; i++) {
for (i = -(256<<LUT_BITS); i < 256<<LUT_BITS; i++) {
double f = ((i<<(9-LUT_BITS)) + (1<<(8-LUT_BITS)) - 1) / 512.0; // midpoint of the bin
simil = FFMAX(0, 1.0 - fabs(f) / 255.0);
C = pow(simil, gamma) * 256.0 * f;