ref: e30f7698f5c500f3a1db992126a03d23cbccc533
parent: f61e00c79df38129e33397d9391eb084ad3b6c26
author: JackyChen <[email protected]>
date: Thu Sep 4 07:16:56 EDT 2014
Fix a bug in VP9 denoiser. 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
--- a/vp9/encoder/vp9_denoiser.c
+++ b/vp9/encoder/vp9_denoiser.c
@@ -145,11 +145,17 @@
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;