ref: 412547ad4b759e139b626f523b313c87debc6639
parent: df0ec9f0b6e58d5d80a1a1b93593f35d4336ba0c
author: angiebird <angiebird@google.com>
date: Wed Oct 9 13:59:56 EDT 2019
Refactor calc_frame_boost() Replace detect_flash() by detect_flash_from_frame_stats() Change-Id: I31862820926b5167ff70cebe2009c04aa745a019
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1839,7 +1839,7 @@
// The recovery after a flash is indicated by a high pcnt_second_ref
// useage or a second ref coded error notabley lower than the last
// frame coded error.
- if (frame_stats == 0) {
+ if (frame_stats == NULL) {
return 0;
}
return (frame_stats->sr_coded_error < frame_stats->coded_error) ||
@@ -1972,6 +1972,7 @@
// Search forward from the proposed arf/next gf position.
for (i = 0; i < f_frames; ++i) {
const FIRSTPASS_STATS *this_frame = read_frame_stats(twopass, i);
+ const FIRSTPASS_STATS *next_frame = read_frame_stats(twopass, i + 1);
if (this_frame == NULL) break;
// Update the motion related elements to the boost calculation.
@@ -1981,7 +1982,8 @@
// We want to discount the flash frame itself and the recovery
// frame that follows as both will have poor scores.
- flash_detected = detect_flash(twopass, i) || detect_flash(twopass, i + 1);
+ flash_detected = detect_flash_from_frame_stats(this_frame) ||
+ detect_flash_from_frame_stats(next_frame);
// Accumulate the effect of prediction quality decay.
if (!flash_detected) {
@@ -2008,6 +2010,7 @@
// Search backward towards last gf position.
for (i = -1; i >= -b_frames; --i) {
const FIRSTPASS_STATS *this_frame = read_frame_stats(twopass, i);
+ const FIRSTPASS_STATS *next_frame = read_frame_stats(twopass, i + 1);
if (this_frame == NULL) break;
// Update the motion related elements to the boost calculation.
@@ -2017,7 +2020,8 @@
// We want to discount the the flash frame itself and the recovery
// frame that follows as both will have poor scores.
- flash_detected = detect_flash(twopass, i) || detect_flash(twopass, i + 1);
+ flash_detected = detect_flash_from_frame_stats(this_frame) ||
+ detect_flash_from_frame_stats(next_frame);
// Cumulative effect of prediction quality decay.
if (!flash_detected) {