When the first try of denoising turns out to be too much,
we will use a softer filter by adopting an adjustment to
make the result closer to original pixel (as in VP8 denoiser).
The old code made the adjustment in the wrong direction.
Change-Id: I84e28fa9e01eef47c5a37d5a2e6d3d378a06786b
adj = delta;
}
if (diff > 0) {
+ // Diff positive means we made positive adjustment above
+ // (in first try/attempt), so now make negative adjustment to bring
+ // denoised signal down.
avg[c] = MAX(0, avg[c] - adj);
- total_adj += adj;
+ total_adj -= adj;
} else {
+ // Diff negative means we made negative adjustment above
+ // (in first try/attempt), so now make positive adjustment to bring
+ // denoised signal up.
avg[c] = MIN(UINT8_MAX, avg[c] + adj);
- total_adj -= adj;
+ total_adj += adj;
}
}
sig += sig_stride;