Minor code refactoring
Prepare for following fix patch.
Change-Id: Ie21fac4e29b55d2a6a1225b3b778c7a8aae73a21
diff --git a/av1/encoder/temporal_filter.c b/av1/encoder/temporal_filter.c
index 5ce3793..2926cb3 100644
--- a/av1/encoder/temporal_filter.c
+++ b/av1/encoder/temporal_filter.c
@@ -1528,25 +1528,23 @@
strength = estimate_strength(cpi, distance, rc->gfu_boost, &sigma);
// Number of frames for temporal filtering, could be tuned.
frames_to_blur = NUM_KEY_FRAME_DENOISING;
+ frames_to_blur_backward = 0;
+ frames_to_blur_forward = frames_to_blur - 1;
+ start_frame = distance + frames_to_blur_forward;
} else {
adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength,
&sigma);
+ // TODO(yunqing): frames_to_blur_backward calculation below isn't
+ // consistent with the calculation in adjust_arnr_filter(). Will fix it.
+ frames_to_blur_backward = (frames_to_blur / 2);
+ frames_to_blur_forward = ((frames_to_blur - 1) / 2);
+ start_frame = distance + frames_to_blur_forward;
}
cpi->common.showable_frame =
(strength == 0 && frames_to_blur == 1) ||
(cpi->oxcf.enable_overlay == 0 || cpi->sf.disable_overlay_frames);
- if (distance == -1) {
- frames_to_blur_backward = 0;
- frames_to_blur_forward = frames_to_blur - 1;
- start_frame = distance + frames_to_blur_forward;
- } else {
- frames_to_blur_backward = (frames_to_blur / 2);
- frames_to_blur_forward = ((frames_to_blur - 1) / 2);
- start_frame = distance + frames_to_blur_forward;
- }
-
// Setup frame pointers, NULL indicates frame not included in filter.
for (frame = 0; frame < frames_to_blur; ++frame) {
const int which_buffer = start_frame - frame;