static INLINE int vp10_preserve_existing_gf(VP10_COMP *cpi) {
#if CONFIG_EXT_REFS
// Do not swap gf and arf indices for internal overlay frames
- return !cpi->multi_arf_allowed &&
- cpi->rc.is_src_frame_alt_ref && !cpi->rc.is_src_frame_ext_arf;
+ return !cpi->multi_arf_allowed && cpi->rc.is_src_frame_alt_ref &&
+ !cpi->rc.is_src_frame_ext_arf;
#else
return !cpi->multi_arf_allowed && cpi->refresh_golden_frame &&
cpi->rc.is_src_frame_alt_ref;
#endif
static MV_REFERENCE_FRAME get_frame_type(const VP10_COMP *cpi) {
- if (frame_is_intra_only(&cpi->common))
- return INTRA_FRAME;
+ if (frame_is_intra_only(&cpi->common)) return INTRA_FRAME;
#if CONFIG_EXT_REFS
// We will not update the golden frame with an internal overlay frame
else if ((cpi->rc.is_src_frame_alt_ref && cpi->refresh_golden_frame) ||
- cpi->rc.is_src_frame_ext_arf)
+ cpi->rc.is_src_frame_ext_arf)
#else
else if (cpi->rc.is_src_frame_alt_ref && cpi->refresh_golden_frame)
#endif
// We need to modify the mapping accordingly
cpi->arf_map[0] = cpi->alt_fb_idx;
#endif
- // TODO(zoeliu): Do we need to copy cpi->interp_filter_selected[0] over to
- // cpi->interp_filter_selected[GOLDEN_FRAME]?
+// TODO(zoeliu): Do we need to copy cpi->interp_filter_selected[0] over to
+// cpi->interp_filter_selected[GOLDEN_FRAME]?
#if CONFIG_EXT_REFS
} else if (cpi->rc.is_last_bipred_frame) {
// Refresh the LAST_FRAME with the BWDREF_FRAME and retire the LAST3_FRAME
// by updating the virtual indices. Note that the frame BWDREF_FRAME points
// to now should be retired, and it should not be used before refreshed.
- int tmp = cpi->lst_fb_idxes[LAST_REF_FRAMES-1];
+ int tmp = cpi->lst_fb_idxes[LAST_REF_FRAMES - 1];
shift_last_ref_frames(cpi);
sizeof(cpi->interp_filter_selected[BWDREF_FRAME]));
}
cpi->bwd_fb_idx = tmp;
-#endif // CONFIG_EXT_REFS
+#endif // CONFIG_EXT_REFS
#if CONFIG_EXT_REFS
} else if (cpi->rc.is_src_frame_ext_arf && cm->show_existing_frame) {
// Deal with the special case for showing existing internal ALTREF_FRAME
// by updating the virtual indices.
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
int which_arf = gf_group->arf_ref_idx[gf_group->index];
- int tmp = cpi->lst_fb_idxes[LAST_REF_FRAMES-1];
+ int tmp = cpi->lst_fb_idxes[LAST_REF_FRAMES - 1];
shift_last_ref_frames(cpi);
cpi->alt_fb_idx = tmp;
// We need to modify the mapping accordingly
cpi->arf_map[which_arf] = cpi->alt_fb_idx;
-#endif // CONFIG_EXT_REFS
+#endif // CONFIG_EXT_REFS
} else { /* For non key/golden frames */
if (cpi->refresh_alt_ref_frame) {
int arf_idx = cpi->alt_fb_idx;
&cpi->upsampled_ref_idx[cpi->lst_fb_idxes[LAST_REF_FRAMES - 1]],
new_uidx);
- tmp = cpi->lst_fb_idxes[LAST_REF_FRAMES-1];
+ tmp = cpi->lst_fb_idxes[LAST_REF_FRAMES - 1];
shift_last_ref_frames(cpi);
#if CONFIG_EXT_REFS
// Disable the use of BWDREF_FRAME for non-bipredictive frames.
if (!(cpi->rc.is_bipred_frame || cpi->rc.is_last_bipred_frame ||
- (cpi->rc.is_bwd_ref_frame && cpi->num_extra_arfs)))
+ (cpi->rc.is_bwd_ref_frame && cpi->num_extra_arfs)))
flags &= ~VPX_BWD_FLAG;
#endif // CONFIG_EXT_REFS
// The arf_sign_bias will be one for internal ARFs'
arf_sign_bias = cpi->rc.source_alt_ref_active &&
(!cpi->refresh_alt_ref_frame ||
- (gf_group->rf_level[gf_group->index] == GF_ARF_LOW));
+ (gf_group->rf_level[gf_group->index] == GF_ARF_LOW));
#else
if ((cpi->oxcf.pass == 2) && cpi->multi_arf_allowed) {
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
ref_total[ref] += cpi->interp_filter_selected[arf_idx][ifilter];
#else
for (ref = LAST_FRAME; ref <= ALTREF_FRAME; ++ref)
- for (ifilter = EIGHTTAP_REGULAR; ifilter < SWITCHABLE_FILTERS; ++ifilter)
- ref_total[ref] += cpi->interp_filter_selected[ref][ifilter];
+ for (ifilter = EIGHTTAP_REGULAR; ifilter < SWITCHABLE_FILTERS; ++ifilter)
+ ref_total[ref] += cpi->interp_filter_selected[ref][ifilter];
#endif
for (ifilter = EIGHTTAP_REGULAR; ifilter < SWITCHABLE_FILTERS; ++ifilter) {
#endif // CONFIG_EXT_REFS
(ref_total[ALTREF_FRAME] == 0 ||
cpi->interp_filter_selected[arf_idx][ifilter] * 50 <
- ref_total[ALTREF_FRAME]))
+ ref_total[ALTREF_FRAME]))
mask |= 1 << ifilter;
}
return mask;
const GF_GROUP *const gf_group = &cpi->twopass.gf_group;
rc->is_src_frame_alt_ref =
#if CONFIG_EXT_REFS
- (gf_group->update_type[gf_group->index] == INTNL_OVERLAY_UPDATE) ||
+ (gf_group->update_type[gf_group->index] == INTNL_OVERLAY_UPDATE) ||
#endif
- (gf_group->update_type[gf_group->index] == OVERLAY_UPDATE);
+ (gf_group->update_type[gf_group->index] == OVERLAY_UPDATE);
} else {
rc->is_src_frame_alt_ref =
cpi->alt_ref_source && (source == cpi->alt_ref_source);
(rc->baseline_gf_interval - rc->source_alt_ref_pending);
int bipred_group_end = 0;
int bipred_frame_index = 0;
- int arf_pos[MAX_EXT_ARFS+1];
- const unsigned char ext_arf_interval = (unsigned char)
- (rc->baseline_gf_interval / (cpi->num_extra_arfs + 1) - 1);
+ int arf_pos[MAX_EXT_ARFS + 1];
+ const unsigned char ext_arf_interval =
+ (unsigned char)(rc->baseline_gf_interval / (cpi->num_extra_arfs + 1) - 1);
int which_arf = cpi->num_extra_arfs;
- int subgroup_interval[MAX_EXT_ARFS+1];
+ int subgroup_interval[MAX_EXT_ARFS + 1];
int ext_arf_boost[MAX_EXT_ARFS];
int is_sg_bipred_enabled = is_bipred_enabled;
int accumulative_subgroup_interval = 0;
// We index ALTREF's as: KEY ----- ALT2 ----- ALT1 ----- ALT0
// but code them in the following order:
// KEY-ALT0-ALT2 ----- OVERLAY2-ALT1 ----- OVERLAY1 ----- OVERLAY0
- arf_pos[0] = frame_index + cpi->num_extra_arfs +
- gf_group->arf_src_offset[1] + 1;
+ arf_pos[0] =
+ frame_index + cpi->num_extra_arfs + gf_group->arf_src_offset[1] + 1;
for (i = 0; i < cpi->num_extra_arfs; ++i) {
- arf_pos[i + 1] = frame_index +
- (cpi->num_extra_arfs - i)*(ext_arf_interval + 2);
+ arf_pos[i + 1] =
+ frame_index + (cpi->num_extra_arfs - i) * (ext_arf_interval + 2);
subgroup_interval[i] = arf_pos[i] - arf_pos[i + 1] - (i == 0 ? 1 : 2);
}
subgroup_interval[cpi->num_extra_arfs] = arf_pos[cpi->num_extra_arfs] -
- frame_index - (cpi->num_extra_arfs == 0 ? 1 : 2);
+ frame_index -
+ (cpi->num_extra_arfs == 0 ? 1 : 2);
#endif // CONFIG_EXT_REFS
++frame_index;
// If we are going to have ARFs, check if we can have BWDREF in this
// subgroup.
if (rc->source_alt_ref_pending) {
- is_sg_bipred_enabled = is_bipred_enabled &&
+ is_sg_bipred_enabled =
+ is_bipred_enabled &&
(subgroup_interval[which_arf] > rc->bipred_group_interval);
}
// NOTE: BIDIR_PRED is only enabled when the length of the bi-predictive
// In addition, we need to avoid coding a BRF right before an ARF.
if (bipred_frame_index == 1 &&
(i + 2 + cur_brf_src_offset) >= accumulative_subgroup_interval) {
- bipred_group_end = 1;
+ bipred_group_end = 1;
}
} else {
#endif // CONFIG_EXT_REFS
#endif
}
- // Note:
- // We need to configure the frame at the end of the sequence + 1 that will be
- // the start frame for the next group. Otherwise prior to the call to
- // vp10_rc_get_second_pass_params() the data will be undefined.
+// Note:
+// We need to configure the frame at the end of the sequence + 1 that will be
+// the start frame for the next group. Otherwise prior to the call to
+// vp10_rc_get_second_pass_params() the data will be undefined.
#if CONFIG_EXT_REFS
gf_group->arf_update_idx[frame_index] = 0;
gf_group->arf_ref_idx[frame_index] = 0;
#if CONFIG_EXT_REFS
// Compute how many extra alt_refs we can have
- cpi->num_extra_arfs =
- get_number_of_extra_arfs(rc->baseline_gf_interval,
- rc->source_alt_ref_pending);
+ cpi->num_extra_arfs = get_number_of_extra_arfs(rc->baseline_gf_interval,
+ rc->source_alt_ref_pending);
// Currently at maximum two extra ARFs' are allowed
assert(cpi->num_extra_arfs <= 2);
#endif
switch (twopass->gf_group.update_type[twopass->gf_group.index]) {
case KF_UPDATE:
- cpi->refresh_last_frame = 1;
- cpi->refresh_golden_frame = 1;
#if CONFIG_EXT_REFS
cpi->refresh_bwd_ref_frame = 1;
#endif // CONFIG_EXT_REFS
+ cpi->refresh_last_frame = 1;
+ cpi->refresh_golden_frame = 1;
cpi->refresh_alt_ref_frame = 1;
break;
case LF_UPDATE:
- cpi->refresh_last_frame = 1;
- cpi->refresh_golden_frame = 0;
#if CONFIG_EXT_REFS
cpi->refresh_bwd_ref_frame = 0;
#endif // CONFIG_EXT_REFS
+ cpi->refresh_last_frame = 1;
+ cpi->refresh_golden_frame = 0;
cpi->refresh_alt_ref_frame = 0;
break;
case GF_UPDATE:
- cpi->refresh_last_frame = 1;
- cpi->refresh_golden_frame = 1;
#if CONFIG_EXT_REFS
cpi->refresh_bwd_ref_frame = 0;
#endif // CONFIG_EXT_REFS
+ cpi->refresh_last_frame = 1;
+ cpi->refresh_golden_frame = 1;
cpi->refresh_alt_ref_frame = 0;
break;
break;
case ARF_UPDATE:
- cpi->refresh_last_frame = 0;
- cpi->refresh_golden_frame = 0;
#if CONFIG_EXT_REFS
cpi->refresh_bwd_ref_frame = 1;
#endif // CONFIG_EXT_REFS
+ cpi->refresh_last_frame = 0;
+ cpi->refresh_golden_frame = 0;
cpi->refresh_alt_ref_frame = 1;
break;
// Length of the bi-predictive frame group (BFG)
// NOTE: Currently each BFG contains one backward ref (BWF) frame plus a certain
// number of bi-predictive frames.
-#define BFG_INTERVAL 2
+#define BFG_INTERVAL 2
// The maximum number of extra ALT_REF's
// NOTE: This number cannot be greater than 2 or the reference frame buffer will
// overflow.
-#define MAX_EXT_ARFS 2
-#define MIN_EXT_ARF_INTERVAL 4
+#define MAX_EXT_ARFS 2
+#define MIN_EXT_ARF_INTERVAL 4
#endif // CONFIG_EXT_REFS
#define VLOW_MOTION_THRESHOLD 950
#if CONFIG_EXT_REFS
static inline int get_number_of_extra_arfs(int interval, int arf_pending) {
if (arf_pending && MAX_EXT_ARFS > 0)
- return interval >= MIN_EXT_ARF_INTERVAL*(MAX_EXT_ARFS+1) ? MAX_EXT_ARFS :
- interval >= MIN_EXT_ARF_INTERVAL*MAX_EXT_ARFS ? MAX_EXT_ARFS - 1 : 0;
+ return interval >= MIN_EXT_ARF_INTERVAL * (MAX_EXT_ARFS + 1)
+ ? MAX_EXT_ARFS
+ : interval >= MIN_EXT_ARF_INTERVAL * MAX_EXT_ARFS
+ ? MAX_EXT_ARFS - 1
+ : 0;
else
return 0;
}
#else
1.00, // INTER_HIGH
1.50, // GF_ARF_LOW
-#endif // CONFIG_EXT_REFS
+#endif // CONFIG_EXT_REFS
2.00, // GF_ARF_STD
2.00, // KF_STD
};
128, 128, 128
// TODO(weitinglin): We should investigate if the values should be the same
// as the value used by OVERLAY frame
- , 144
+ ,
+ 144
#endif // CONFIG_EXT_REFS
};
// Apply context specific adjustments to the arnr filter parameters.
adjust_arnr_filter(cpi, distance, rc->gfu_boost, &frames_to_blur, &strength);
- // TODO(weitinglin): Currently, we enforce the filtering strength on
- // extra ARFs' to be zeros. We should investigate in which
- // case it is more beneficial to use non-zero strength
- // filtering.
+// TODO(weitinglin): Currently, we enforce the filtering strength on
+// extra ARFs' to be zeros. We should investigate in which
+// case it is more beneficial to use non-zero strength
+// filtering.
#if CONFIG_EXT_REFS
if (gf_group->rf_level[gf_group->index] == GF_ARF_LOW) {
strength = 0;