Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/videolan/dav1d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2018-11-12 17:40:32 +0300
committerRonald S. Bultje <rsbultje@gmail.com>2018-11-12 18:26:51 +0300
commit4b0683a615a353757ad75c4eb4ee67e12a0aa8ce (patch)
tree506da2c53e03ae057ec4a62f5553475387956817 /src/looprestoration_tmpl.c
parenta977ede2e4890e9a24486dbd8aba37a23f56b04d (diff)
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.
Diffstat (limited to 'src/looprestoration_tmpl.c')
-rw-r--r--src/looprestoration_tmpl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/looprestoration_tmpl.c b/src/looprestoration_tmpl.c
index 8370a7d..c88e425 100644
--- a/src/looprestoration_tmpl.c
+++ b/src/looprestoration_tmpl.c
@@ -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)];