Adapt ARNR filter length and strength.

Adjust the filter length and strength for each
ARF group based on a measure of difficulty (the boost)
and the active q range.

Remove lower limit on RDMULT value.

Average gains on the different sets in range 0.4%-0.9%.
However the ARNR changes give a very big boost on a
few clips.

Eg. Soccer ~5%, in derf set and Cyclist ~ 10% in the std-hd set

Change-Id: I2078d78798e27ad2bcc2b32d703ea37b67412ec4
This commit is contained in:
Paul Wilkins 2013-03-18 16:17:04 +00:00
Родитель 117514b30f
Коммит cdb322dd72
5 изменённых файлов: 26 добавлений и 12 удалений

Просмотреть файл

@ -1428,11 +1428,14 @@ static int calc_arf_boost(
return arf_boost; 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 half_gf_int;
int frames_after_arf; int frames_after_arf;
int frames_bwd = cpi->oxcf.arnr_max_frames - 1; int frames_bwd = cpi->oxcf.arnr_max_frames - 1;
int frames_fwd = 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: // Define the arnr filter width for this group of frames:
// We only filter frames that lie within a distance of half // We only filter frames that lie within a distance of half
@ -1477,6 +1480,25 @@ static void configure_arnr_filter(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
} }
cpi->active_arnr_frames = frames_bwd + 1 + frames_fwd; 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 . // Analyse and define a gf/arf group .
@ -1655,7 +1677,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
cpi->gfu_boost = calc_arf_boost(cpi, 0, (i - 1), (i - 1), &f_boost, &b_boost); cpi->gfu_boost = calc_arf_boost(cpi, 0, (i - 1), (i - 1), &f_boost, &b_boost);
cpi->source_alt_ref_pending = TRUE; cpi->source_alt_ref_pending = TRUE;
configure_arnr_filter(cpi, this_frame); configure_arnr_filter(cpi, this_frame, cpi->gfu_boost);
} else { } else {
cpi->gfu_boost = (int)boost_score; cpi->gfu_boost = (int)boost_score;
cpi->source_alt_ref_pending = FALSE; cpi->source_alt_ref_pending = FALSE;

Просмотреть файл

@ -2727,10 +2727,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
else else
cpi->zbin_mode_boost_enabled = TRUE; 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 // Current default encoder behaviour for the altref sign bias
if (cpi->source_alt_ref_active) if (cpi->source_alt_ref_active)
cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 1; cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = 1;

Просмотреть файл

@ -416,6 +416,7 @@ typedef struct VP9_COMP {
int max_gf_interval; int max_gf_interval;
int baseline_gf_interval; int baseline_gf_interval;
int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames
int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength
int64_t key_frame_count; int64_t key_frame_count;
int prior_key_frame_distance[KEY_FRAME_CONTEXT]; int prior_key_frame_distance[KEY_FRAME_CONTEXT];

Просмотреть файл

@ -284,9 +284,6 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi, int qindex) {
(cpi->RDMULT * rd_iifactor[cpi->twopass.next_iiratio]) >> 4; (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->RDMULT / 110);
cpi->mb.errorperbit += (cpi->mb.errorperbit == 0); cpi->mb.errorperbit += (cpi->mb.errorperbit == 0);

Просмотреть файл

@ -381,10 +381,8 @@ void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance) {
int frames_to_blur = 0; int frames_to_blur = 0;
int start_frame = 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 blur_type = cpi->oxcf.arnr_type;
int max_frames = cpi->active_arnr_frames; int max_frames = cpi->active_arnr_frames;
num_frames_backward = distance; num_frames_backward = distance;