summaryrefslogtreecommitdiff
path: root/libavfilter/vf_hqdn3d.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-27 02:46:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-27 05:18:55 +0200
commit4240e6a92117811509be3e5f360a44dde8618040 (patch)
tree8e78a51a77d105bf003ac7f9274819f1e9ff458e /libavfilter/vf_hqdn3d.c
parent7ae805db709712a8953e84b8b59a717ff3ed9452 (diff)
avfilter/vf_hqdn3d: Initialize the whole LUT
With bps > 8 more than 255..255 are used The initialized table content is left unchanged, But it could also be adjusted for the slight difference of the maximum Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_hqdn3d.c')
-rw-r--r--libavfilter/vf_hqdn3d.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index f862014a7d..ffc1b255f5 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -180,9 +180,9 @@ static int16_t *precalc_coefs(double dist25, int depth)
gamma = log(0.25) / log(1.0 - FFMIN(dist25,252.0)/255.0 - 0.00001);
- for (i = -255<<LUT_BITS; i <= 255<<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 = 1.0 - FFABS(f) / 255.0;
+ simil = FFMAX(0, 1.0 - FFABS(f) / 255.0);
C = pow(simil, gamma) * 256.0 * f;
ct[(256<<LUT_BITS)+i] = lrint(C);
}