ref: ef179bce61a5c02fb8fc10b73258cf0b68ec86c2
parent: c5b317057b292718afc07a842b69f5f06caadb4e
parent: cdb322dd72fe47e8a2f63f15d8b188281ff7d508
author: Paul Wilkins <paulwilkins@google.com>
date: Mon Mar 18 08:00:39 EDT 2013
Merge "Adapt ARNR filter length and strength." into experimental
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1442,11 +1442,14 @@
return arf_boost;
}
-static void configure_arnr_filter(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
+static void configure_arnr_filter(VP9_COMP *cpi,
+ FIRSTPASS_STATS *this_frame,
+ int group_boost) {
int half_gf_int;
int frames_after_arf;
int frames_bwd = cpi->oxcf.arnr_max_frames - 1;
int frames_fwd = cpi->oxcf.arnr_max_frames - 1;
+ int q;
// Define the arnr filter width for this group of frames:
// We only filter frames that lie within a distance of half
@@ -1491,6 +1494,25 @@
}
cpi->active_arnr_frames = frames_bwd + 1 + frames_fwd;
+
+ // Adjust the strength based on active max q
+ q = ((int)vp9_convert_qindex_to_q(cpi->active_worst_quality) >> 1);
+ if (q > 8) {
+ cpi->active_arnr_strength = cpi->oxcf.arnr_strength;
+ } else {
+ cpi->active_arnr_strength = cpi->oxcf.arnr_strength - (8 - q);
+ if (cpi->active_arnr_strength < 0)
+ cpi->active_arnr_strength = 0;
+ }
+
+ // Adjust number of frames in filter and strength based on gf boost level.
+ if (cpi->active_arnr_frames > (group_boost / 150)) {
+ cpi->active_arnr_frames = (group_boost / 150);
+ cpi->active_arnr_frames += !(cpi->active_arnr_frames & 1);
+ }
+ if (cpi->active_arnr_strength > (group_boost / 300)) {
+ cpi->active_arnr_strength = (group_boost / 300);
+ }
}
// Analyse and define a gf/arf group .
@@ -1669,7 +1691,7 @@
cpi->gfu_boost = calc_arf_boost(cpi, 0, (i - 1), (i - 1), &f_boost, &b_boost);
cpi->source_alt_ref_pending = TRUE;
- configure_arnr_filter(cpi, this_frame);
+ configure_arnr_filter(cpi, this_frame, cpi->gfu_boost);
} else {
cpi->gfu_boost = (int)boost_score;
cpi->source_alt_ref_pending = FALSE;
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2722,10 +2722,6 @@
else
cpi->zbin_mode_boost_enabled = TRUE;
- if (cpi->gfu_boost <= 400) {
- cpi->zbin_mode_boost_enabled = FALSE;
- }
-
// Current default encoder behaviour for the altref sign bias
if (cpi->source_alt_ref_active)
cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 1;
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -411,6 +411,7 @@
int max_gf_interval;
int baseline_gf_interval;
int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
+ int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength
int64_t key_frame_count;
int prior_key_frame_distance[KEY_FRAME_CONTEXT];
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -284,9 +284,6 @@
(cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4;
}
- if (cpi->RDMULT < 7)
- cpi->RDMULT = 7;
-
cpi->mb.errorperbit = (cpi->RDMULT / 110);
cpi->mb.errorperbit += (cpi->mb.errorperbit == 0);
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -381,10 +381,8 @@
int frames_to_blur = 0;
int start_frame = 0;
- int strength = cpi->oxcf.arnr_strength;
-
+ int strength = cpi->active_arnr_strength;
int blur_type = cpi->oxcf.arnr_type;
-
int max_frames = cpi->active_arnr_frames;
num_frames_backward = distance;
--
⑨