ref: aa49cd4ad4ff74f8c35578689b64ce6d4a1dce05
parent: 47481291519e8469398c8a5afd7c2688f575061e
author: angiebird <angiebird@google.com>
date: Wed Oct 9 11:24:11 EDT 2019
Refactor get_prediction_decay_rate() Replace cpi by frame_info Rename next_frame by frame_stats Change-Id: I909f01ce724aac13030931970fba8b7b3f4d0080
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1786,11 +1786,11 @@
#define ZM_POWER_FACTOR 0.75
-static double get_prediction_decay_rate(const VP9_COMP *cpi,
- const FIRSTPASS_STATS *next_frame) {
- const double sr_decay_rate = get_sr_decay_rate(&cpi->frame_info, next_frame);
+static double get_prediction_decay_rate(const FRAME_INFO *frame_info,
+ const FIRSTPASS_STATS *frame_stats) {
+ const double sr_decay_rate = get_sr_decay_rate(frame_info, frame_stats);
const double zero_motion_factor =
- (0.95 * pow((next_frame->pcnt_inter - next_frame->pcnt_motion),
+ (0.95 * pow((frame_stats->pcnt_inter - frame_stats->pcnt_motion),
ZM_POWER_FACTOR));
return VPXMAX(zero_motion_factor,
@@ -1985,7 +1985,7 @@
// Accumulate the effect of prediction quality decay.
if (!flash_detected) {
- decay_accumulator *= get_prediction_decay_rate(cpi, this_frame);
+ decay_accumulator *= get_prediction_decay_rate(frame_info, this_frame);
decay_accumulator = decay_accumulator < MIN_DECAY_FACTOR
? MIN_DECAY_FACTOR
: decay_accumulator;
@@ -2021,7 +2021,7 @@
// Cumulative effect of prediction quality decay.
if (!flash_detected) {
- decay_accumulator *= get_prediction_decay_rate(cpi, this_frame);
+ decay_accumulator *= get_prediction_decay_rate(frame_info, this_frame);
decay_accumulator = decay_accumulator < MIN_DECAY_FACTOR
? MIN_DECAY_FACTOR
: decay_accumulator;
@@ -2607,7 +2607,8 @@
// Accumulate the effect of prediction quality decay.
if (!flash_detected) {
last_loop_decay_rate = loop_decay_rate;
- loop_decay_rate = get_prediction_decay_rate(cpi, &next_frame);
+ loop_decay_rate =
+ get_prediction_decay_rate(&cpi->frame_info, &next_frame);
// Break clause to detect very still sections after motion. For example,
// a static image after a fade or other transition.
@@ -3058,7 +3059,8 @@
break;
// How fast is the prediction quality decaying?
- loop_decay_rate = get_prediction_decay_rate(cpi, twopass->stats_in);
+ loop_decay_rate =
+ get_prediction_decay_rate(&cpi->frame_info, twopass->stats_in);
// We want to know something about the recent past... rather than
// as used elsewhere where we are concerned with decay in prediction