summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorangiebird <angiebird@google.com>2019-10-09 17:59:56 -0700
committerangiebird <angiebird@google.com>2019-10-10 15:45:58 -0700
commit412547ad4b759e139b626f523b313c87debc6639 (patch)
treec6a6b8eac6e77de000109ebea31d9937430c0a3d
parentdf0ec9f0b6e58d5d80a1a1b93593f35d4336ba0c (diff)
downloadlibvpx-412547ad4b759e139b626f523b313c87debc6639.tar
libvpx-412547ad4b759e139b626f523b313c87debc6639.tar.gz
libvpx-412547ad4b759e139b626f523b313c87debc6639.tar.bz2
libvpx-412547ad4b759e139b626f523b313c87debc6639.zip
Refactor calc_frame_boost()
Replace detect_flash() by detect_flash_from_frame_stats() Change-Id: I31862820926b5167ff70cebe2009c04aa745a019
-rw-r--r--vp9/encoder/vp9_firstpass.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index b8777cd12..6f91836e7 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1839,7 +1839,7 @@ static int detect_flash_from_frame_stats(const FIRSTPASS_STATS *frame_stats) {
// 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 @@ static int calc_arf_boost(VP9_COMP *cpi, int f_frames, int b_frames) {
// 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 @@ static int calc_arf_boost(VP9_COMP *cpi, int f_frames, int b_frames) {
// 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 @@ static int calc_arf_boost(VP9_COMP *cpi, int f_frames, int b_frames) {
// 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 @@ static int calc_arf_boost(VP9_COMP *cpi, int f_frames, int b_frames) {
// 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) {