ref: 7a50129f65fb824448efb4b2c4302e1fc189b961
parent: 5cbfa48fe624be6acc56326b87df882a8dc4dd2d
parent: 0c84f1e4587b0ad1f3f7b4835c4d4bdf76029b5b
author: Jingning Han <jingning@google.com>
date: Fri Sep 28 13:18:46 EDT 2018
Merge "Refactor gf_overlay frame type update"
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2172,6 +2172,20 @@
find_arf_order(cpi, gf_group, index_counter, depth + 1, mid + 1, end);
}
+static INLINE void set_gf_overlay_frame_type(GF_GROUP *gf_group,
+ int frame_index,
+ int source_alt_ref_active) {
+ if (source_alt_ref_active) {
+ gf_group->update_type[frame_index] = OVERLAY_UPDATE;
+ gf_group->rf_level[frame_index] = INTER_NORMAL;
+ gf_group->layer_depth[frame_index] = MAX_ARF_LAYERS - 1;
+ } else {
+ gf_group->update_type[frame_index] = GF_UPDATE;
+ gf_group->rf_level[frame_index] = GF_ARF_STD;
+ gf_group->layer_depth[frame_index] = 0;
+ }
+}
+
static int define_gf_group_structure(VP9_COMP *cpi) {
RATE_CONTROL *const rc = &cpi->rc;
TWO_PASS *const twopass = &cpi->twopass;
@@ -2193,15 +2207,7 @@
// is also the golden frame.
// === [frame_index == 0] ===
if (!key_frame) {
- if (rc->source_alt_ref_active) {
- gf_group->update_type[frame_index] = OVERLAY_UPDATE;
- gf_group->rf_level[frame_index] = INTER_NORMAL;
- gf_group->layer_depth[frame_index] = MAX_ARF_LAYERS - 1;
- } else {
- gf_group->update_type[frame_index] = GF_UPDATE;
- gf_group->rf_level[frame_index] = GF_ARF_STD;
- gf_group->layer_depth[frame_index] = 0;
- }
+ set_gf_overlay_frame_type(gf_group, frame_index, rc->source_alt_ref_active);
gf_group->arf_update_idx[frame_index] = arf_buffer_indices[0];
gf_group->arf_ref_idx[frame_index] = arf_buffer_indices[0];
}
@@ -2226,13 +2232,9 @@
find_arf_order(cpi, gf_group, &frame_index, 2, 0,
rc->baseline_gf_interval - 1);
- if (rc->source_alt_ref_pending) {
- gf_group->update_type[frame_index] = OVERLAY_UPDATE;
- gf_group->rf_level[frame_index] = INTER_NORMAL;
- } else {
- gf_group->update_type[frame_index] = GF_UPDATE;
- gf_group->rf_level[frame_index] = GF_ARF_STD;
- }
+ set_gf_overlay_frame_type(gf_group, frame_index,
+ rc->source_alt_ref_pending);
+
gf_group->arf_src_offset[frame_index] = 0;
return frame_index;
@@ -2262,6 +2264,8 @@
// vp9_rc_get_second_pass_params() the data will be undefined.
gf_group->arf_update_idx[frame_index] = arf_buffer_indices[0];
gf_group->arf_ref_idx[frame_index] = arf_buffer_indices[0];
+
+ set_gf_overlay_frame_type(gf_group, frame_index, rc->source_alt_ref_pending);
if (rc->source_alt_ref_pending) {
gf_group->update_type[frame_index] = OVERLAY_UPDATE;