Commit 4b0683a6 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Re-add imax(v, 0) in SGR calculation

Apparently this can happen for bitdepth > 8. I haven't seen it
happen for bitdepth==8. Fixes #161.
parent a977ede2
......@@ -441,7 +441,7 @@ static void selfguided_filter(int16_t *dst, const pixel *src,
const int b =
(BB[i] + (1 << (BITDEPTH - 8) >> 1)) >> (BITDEPTH - 8);
const unsigned p = a * n - b * b;
const unsigned p = imax(a * n - b * b, 0);
const unsigned z = (p * s + (1 << 19)) >> 20;
const int x = dav1d_sgr_x_by_xplus1[imin(z, 255)];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment