ref: 4a014dfdce2a9f2df611164c4c08c0216f625875
parent: 6b7d221ca6be5eb27dccafec1f77b5d15d3d7aa6
author: angiebird <angiebird@google.com>
date: Wed Oct 9 10:50:54 EDT 2019
Use frame_info in calculate_active_area Change-Id: I16049bef4aee54c915dc5cf181111c5a334b5eaf
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -220,7 +220,7 @@
// bars and partially discounts other 0 energy areas.
#define MIN_ACTIVE_AREA 0.5
#define MAX_ACTIVE_AREA 1.0
-static double calculate_active_area(const VP9_COMP *cpi,
+static double calculate_active_area(const FRAME_INFO *frame_info,
const FIRSTPASS_STATS *this_frame) {
double active_pct;
@@ -227,7 +227,7 @@
active_pct =
1.0 -
((this_frame->intra_skip_pct / 2) +
- ((this_frame->inactive_zone_rows * 2) / (double)cpi->common.mb_rows));
+ ((this_frame->inactive_zone_rows * 2) / (double)frame_info->mb_rows));
return fclamp(active_pct, MIN_ACTIVE_AREA, MAX_ACTIVE_AREA);
}
@@ -260,8 +260,8 @@
// remaining active MBs. The correction here assumes that coding
// 0.5N blocks of complexity 2X is a little easier than coding N
// blocks of complexity X.
- modified_score *=
- pow(calculate_active_area(cpi, this_frame), ACT_AREA_CORRECTION);
+ modified_score *= pow(calculate_active_area(&cpi->frame_info, this_frame),
+ ACT_AREA_CORRECTION);
return modified_score;
}
@@ -284,8 +284,8 @@
// remaining active MBs. The correction here assumes that coding
// 0.5N blocks of complexity 2X is a little easier than coding N
// blocks of complexity X.
- modified_score *=
- pow(calculate_active_area(cpi, this_frame), ACT_AREA_CORRECTION);
+ modified_score *= pow(calculate_active_area(&cpi->frame_info, this_frame),
+ ACT_AREA_CORRECTION);
// Normalize to a midpoint score.
modified_score /= DOUBLE_DIVIDE_CHECK(twopass->mean_mod_score);
@@ -1887,7 +1887,8 @@
const double lq = vp9_convert_qindex_to_q(
cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);
const double boost_q_correction = VPXMIN((0.5 + (lq * 0.015)), 1.5);
- const double active_area = calculate_active_area(cpi, this_frame);
+ const double active_area =
+ calculate_active_area(&cpi->frame_info, this_frame);
// Underlying boost factor is based on inter error ratio.
frame_boost = (BASELINE_ERR_PER_MB * active_area) /
@@ -1926,7 +1927,8 @@
const double lq = vp9_convert_qindex_to_q(
cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);
const double boost_q_correction = VPXMIN((0.50 + (lq * 0.015)), 2.00);
- const double active_area = calculate_active_area(cpi, this_frame);
+ const double active_area =
+ calculate_active_area(&cpi->frame_info, this_frame);
// Underlying boost factor is based on inter error ratio.
frame_boost = (kf_err_per_mb(cpi) * active_area) /