History

Use frame_info in calculate_active_area

angiebird committed 7 years ago

Commit 4a014df1 parent 6b7d2211 file · +10 −8Browse files

Unified · Split

vp9/encoder/vp9_firstpass.c+10−8
@@ -220,14 +220,14 @@ static void subtract_stats(FIRSTPASS_STATS *section, · 219 unmodified lines
220// bars and partially discounts other 0 energy areas.220// bars and partially discounts other 0 energy areas.
221#define MIN_ACTIVE_AREA 0.5221#define MIN_ACTIVE_AREA 0.5
222#define MAX_ACTIVE_AREA 1.0222#define MAX_ACTIVE_AREA 1.0
223static double calculate_active_area(const VP9_COMP *cpi,223static double calculate_active_area(const FRAME_INFO *frame_info,
224 const FIRSTPASS_STATS *this_frame) {224 const FIRSTPASS_STATS *this_frame) {
225 double active_pct;225 double active_pct;
226 226
227 active_pct =227 active_pct =
228 1.0 -228 1.0 -
229 ((this_frame->intra_skip_pct / 2) +229 ((this_frame->intra_skip_pct / 2) +
230 ((this_frame->inactive_zone_rows * 2) / (double)cpi->common.mb_rows));230 ((this_frame->inactive_zone_rows * 2) / (double)frame_info->mb_rows));
231 return fclamp(active_pct, MIN_ACTIVE_AREA, MAX_ACTIVE_AREA);231 return fclamp(active_pct, MIN_ACTIVE_AREA, MAX_ACTIVE_AREA);
232}232}
233 233
@@ -260,8 +260,8 @@ static double calculate_mod_frame_score(const VP9_COMP *cpi, · 26 unmodified lines
260 // remaining active MBs. The correction here assumes that coding260 // remaining active MBs. The correction here assumes that coding
261 // 0.5N blocks of complexity 2X is a little easier than coding N261 // 0.5N blocks of complexity 2X is a little easier than coding N
262 // blocks of complexity X.262 // blocks of complexity X.
263 modified_score *=263 modified_score *= pow(calculate_active_area(&cpi->frame_info, this_frame),
264 pow(calculate_active_area(cpi, this_frame), ACT_AREA_CORRECTION);264 ACT_AREA_CORRECTION);
265 265
266 return modified_score;266 return modified_score;
267}267}
@@ -284,8 +284,8 @@ static double calculate_norm_frame_score(const VP9_COMP *cpi, · 16 unmodified lines
284 // remaining active MBs. The correction here assumes that coding284 // remaining active MBs. The correction here assumes that coding
285 // 0.5N blocks of complexity 2X is a little easier than coding N285 // 0.5N blocks of complexity 2X is a little easier than coding N
286 // blocks of complexity X.286 // blocks of complexity X.
287 modified_score *=287 modified_score *= pow(calculate_active_area(&cpi->frame_info, this_frame),
288 pow(calculate_active_area(cpi, this_frame), ACT_AREA_CORRECTION);288 ACT_AREA_CORRECTION);
289 289
290 // Normalize to a midpoint score.290 // Normalize to a midpoint score.
291 modified_score /= DOUBLE_DIVIDE_CHECK(twopass->mean_mod_score);291 modified_score /= DOUBLE_DIVIDE_CHECK(twopass->mean_mod_score);
@@ -1887,7 +1887,8 @@ static double calc_frame_boost(VP9_COMP *cpi, const FIRSTPASS_STATS *this_frame, · 1595 unmodified lines
1887 const double lq = vp9_convert_qindex_to_q(1887 const double lq = vp9_convert_qindex_to_q(
1888 cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);1888 cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);
1889 const double boost_q_correction = VPXMIN((0.5 + (lq * 0.015)), 1.5);1889 const double boost_q_correction = VPXMIN((0.5 + (lq * 0.015)), 1.5);
1890 const double active_area = calculate_active_area(cpi, this_frame);1890 const double active_area =
1891 calculate_active_area(&cpi->frame_info, this_frame);
1891 1892
1892 // Underlying boost factor is based on inter error ratio.1893 // Underlying boost factor is based on inter error ratio.
1893 frame_boost = (BASELINE_ERR_PER_MB * active_area) /1894 frame_boost = (BASELINE_ERR_PER_MB * active_area) /
@@ -1926,7 +1927,8 @@ static double calc_kf_frame_boost(VP9_COMP *cpi, · 32 unmodified lines
1926 const double lq = vp9_convert_qindex_to_q(1927 const double lq = vp9_convert_qindex_to_q(
1927 cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);1928 cpi->rc.avg_frame_qindex[INTER_FRAME], cpi->common.bit_depth);
1928 const double boost_q_correction = VPXMIN((0.50 + (lq * 0.015)), 2.00);1929 const double boost_q_correction = VPXMIN((0.50 + (lq * 0.015)), 2.00);
1929 const double active_area = calculate_active_area(cpi, this_frame);1930 const double active_area =
1931 calculate_active_area(&cpi->frame_info, this_frame);
1930 1932
1931 // Underlying boost factor is based on inter error ratio.1933 // Underlying boost factor is based on inter error ratio.
1932 frame_boost = (kf_err_per_mb(cpi) * active_area) /1934 frame_boost = (kf_err_per_mb(cpi) * active_area) /

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t