You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/vf_hqdn3d: Fix left-shift of negative numbers
Affected filter-hqdn3d and filter-hqdn3d-sample FATE-tests. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -180,7 +180,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);
|
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
|
double f = (i * (1 << (9-LUT_BITS)) + (1<<(8-LUT_BITS)) - 1) / 512.0; // midpoint of the bin
|
||||||
simil = FFMAX(0, 1.0 - fabs(f) / 255.0);
|
simil = FFMAX(0, 1.0 - fabs(f) / 255.0);
|
||||||
C = pow(simil, gamma) * 256.0 * f;
|
C = pow(simil, gamma) * 256.0 * f;
|
||||||
ct[(256<<LUT_BITS)+i] = lrint(C);
|
ct[(256<<LUT_BITS)+i] = lrint(C);
|
||||||
|
Reference in New Issue
Block a user