rc->source_alt_ref_pending = 0;
}
+#define LAST_ALR_ACTIVE_BEST_QUALITY_ADJUSTMENT_FACTOR 0.2
+ rc->arf_active_best_quality_adjustment_factor = 1.0;
+ if (rc->source_alt_ref_pending && !is_lossless_requested(&cpi->oxcf) &&
+ rc->frames_to_key <= rc->arf_active_best_quality_adjustment_window) {
+ rc->arf_active_best_quality_adjustment_factor =
+ LAST_ALR_ACTIVE_BEST_QUALITY_ADJUSTMENT_FACTOR +
+ (1.0 - LAST_ALR_ACTIVE_BEST_QUALITY_ADJUSTMENT_FACTOR) *
+ (rc->frames_to_key - i) /
+ VPXMAX(1, (rc->arf_active_best_quality_adjustment_window - i));
+ }
+
#ifdef AGGRESSIVE_VBR
// Limit maximum boost based on interval length.
rc->gfu_boost = VPXMIN((int)rc->gfu_boost, i * 140);
// Default to normal-sized frame on keyframes.
cpi->rc.next_frame_size_selector = UNSCALED;
}
+#define ARF_ACTIVE_BEST_QUALITY_ADJUSTMENT_WINDOW_SIZE 64
+ // TODO(ravi.chaudhary@ittiam.com): Experiment without the below min
+ // condition. This might be helpful for small key frame intervals.
+ rc->arf_active_best_quality_adjustment_window =
+ VPXMIN(ARF_ACTIVE_BEST_QUALITY_ADJUSTMENT_WINDOW_SIZE, rc->frames_to_key);
}
static int is_skippable_frame(const VP9_COMP *cpi) {
if (gf_group->update_type[gf_group->index] == ARF_UPDATE) {
int target_rate;
+ vp9_zero(this_frame);
+ this_frame =
+ cpi->twopass.stats_in_start[cm->current_video_frame +
+ gf_group->arf_src_offset[gf_group->index]];
+
vp9_configure_buffer_updates(cpi, gf_group->index);
target_rate = gf_group->bit_allocation[gf_group->index];
cpi->partition_search_skippable_frame = is_skippable_frame(cpi);
}
+ // The multiplication by 256 reverses a scaling factor of (>> 8)
+ // applied when combining MB error values for the frame.
+ twopass->mb_av_energy = log((this_frame.intra_error * 256.0) + 1.0);
+ twopass->mb_smooth_pct = this_frame.intra_smooth_pct;
+
return;
}