++cm->counts.switchable_interp[ctx][mbmi->interp_filter];
}
- cpi->rd_comp_pred_diff[SINGLE_PREDICTION_ONLY] += ctx->single_pred_diff;
- cpi->rd_comp_pred_diff[COMP_PREDICTION_ONLY] += ctx->comp_pred_diff;
- cpi->rd_comp_pred_diff[HYBRID_PREDICTION] += ctx->hybrid_pred_diff;
+ cpi->rd_comp_pred_diff[SINGLE_REFERENCE] += ctx->single_pred_diff;
+ cpi->rd_comp_pred_diff[COMPOUND_REFERENCE] += ctx->comp_pred_diff;
+ cpi->rd_comp_pred_diff[REFERENCE_MODE_SELECT] += ctx->hybrid_pred_diff;
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
cpi->rd_filter_diff[i] += ctx->best_filter_diff[i];
// reference frame allowed for the segment so exclude it from
// the reference frame counts used to work out probabilities.
if (is_inter_block(mbmi) && !seg_ref_active) {
- if (cm->comp_pred_mode == HYBRID_PREDICTION)
+ if (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
cpi->comp_inter_count[vp9_get_pred_context_comp_inter_inter(cm, xd)]
[has_second_ref(mbmi)]++;
/* prediction (compound, single or hybrid) mode selection */
if (frame_type == 3 || !cm->allow_comp_inter_inter)
- pred_type = SINGLE_PREDICTION_ONLY;
+ pred_type = SINGLE_REFERENCE;
else if (cpi->rd_prediction_type_threshes[frame_type][1]
> cpi->rd_prediction_type_threshes[frame_type][0]
&& cpi->rd_prediction_type_threshes[frame_type][1]
> cpi->rd_prediction_type_threshes[frame_type][2]
&& check_dual_ref_flags(cpi) && cpi->static_mb_pct == 100)
- pred_type = COMP_PREDICTION_ONLY;
+ pred_type = COMPOUND_REFERENCE;
else if (cpi->rd_prediction_type_threshes[frame_type][0]
> cpi->rd_prediction_type_threshes[frame_type][2])
- pred_type = SINGLE_PREDICTION_ONLY;
+ pred_type = SINGLE_REFERENCE;
else
- pred_type = HYBRID_PREDICTION;
+ pred_type = REFERENCE_MODE_SELECT;
/* filter type selection */
// FIXME(rbultje) for some odd reason, we often select smooth_filter
cpi->common.mcomp_filter_type = filter_type;
encode_frame_internal(cpi);
- for (i = 0; i < NB_PREDICTION_TYPES; ++i) {
+ for (i = 0; i < REFERENCE_MODES; ++i) {
const int diff = (int) (cpi->rd_comp_pred_diff[i] / cpi->common.MBs);
cpi->rd_prediction_type_threshes[frame_type][i] += diff;
cpi->rd_prediction_type_threshes[frame_type][i] >>= 1;
cpi->rd_tx_select_threshes[frame_type][i] /= 2;
}
- if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) {
+ if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
int single_count_zero = 0;
int comp_count_zero = 0;
}
if (comp_count_zero == 0) {
- cpi->common.comp_pred_mode = SINGLE_PREDICTION_ONLY;
+ cpi->common.comp_pred_mode = SINGLE_REFERENCE;
vp9_zero(cpi->comp_inter_count);
} else if (single_count_zero == 0) {
- cpi->common.comp_pred_mode = COMP_PREDICTION_ONLY;
+ cpi->common.comp_pred_mode = COMPOUND_REFERENCE;
vp9_zero(cpi->comp_inter_count);
}
}
vp9_prob intra_inter_p = vp9_get_pred_prob_intra_inter(cm, xd);
vp9_prob comp_inter_p = 128;
- if (cm->comp_pred_mode == HYBRID_PREDICTION) {
+ if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
comp_inter_p = vp9_get_pred_prob_comp_inter_inter(cm, xd);
*comp_mode_p = comp_inter_p;
} else {
ref_costs_single[INTRA_FRAME] = vp9_cost_bit(intra_inter_p, 0);
- if (cm->comp_pred_mode != COMP_PREDICTION_ONLY) {
+ if (cm->comp_pred_mode != COMPOUND_REFERENCE) {
vp9_prob ref_single_p1 = vp9_get_pred_prob_single_ref_p1(cm, xd);
vp9_prob ref_single_p2 = vp9_get_pred_prob_single_ref_p2(cm, xd);
unsigned int base_cost = vp9_cost_bit(intra_inter_p, 1);
- if (cm->comp_pred_mode == HYBRID_PREDICTION)
+ if (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
base_cost += vp9_cost_bit(comp_inter_p, 0);
ref_costs_single[LAST_FRAME] = ref_costs_single[GOLDEN_FRAME] =
ref_costs_single[GOLDEN_FRAME] = 512;
ref_costs_single[ALTREF_FRAME] = 512;
}
- if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY) {
+ if (cm->comp_pred_mode != SINGLE_REFERENCE) {
vp9_prob ref_comp_p = vp9_get_pred_prob_comp_ref_p(cm, xd);
unsigned int base_cost = vp9_cost_bit(intra_inter_p, 1);
- if (cm->comp_pred_mode == HYBRID_PREDICTION)
+ if (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
base_cost += vp9_cost_bit(comp_inter_p, 1);
ref_costs_comp[LAST_FRAME] = base_cost + vp9_cost_bit(ref_comp_p, 0);
int mode_index,
int_mv *ref_mv,
int_mv *second_ref_mv,
- int64_t comp_pred_diff[NB_PREDICTION_TYPES],
+ int64_t comp_pred_diff[REFERENCE_MODES],
int64_t tx_size_diff[TX_MODES],
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]) {
MACROBLOCKD *const xd = &x->e_mbd;
ctx->best_ref_mv.as_int = ref_mv->as_int;
ctx->second_best_ref_mv.as_int = second_ref_mv->as_int;
- ctx->single_pred_diff = (int)comp_pred_diff[SINGLE_PREDICTION_ONLY];
- ctx->comp_pred_diff = (int)comp_pred_diff[COMP_PREDICTION_ONLY];
- ctx->hybrid_pred_diff = (int)comp_pred_diff[HYBRID_PREDICTION];
+ ctx->single_pred_diff = (int)comp_pred_diff[SINGLE_REFERENCE];
+ ctx->comp_pred_diff = (int)comp_pred_diff[COMPOUND_REFERENCE];
+ ctx->hybrid_pred_diff = (int)comp_pred_diff[REFERENCE_MODE_SELECT];
vpx_memcpy(ctx->tx_rd_diff, tx_size_diff, sizeof(ctx->tx_rd_diff));
vpx_memcpy(ctx->best_filter_diff, best_filter_diff,
if (!(*mode_excluded)) {
if (is_comp_pred) {
- *mode_excluded = (cpi->common.comp_pred_mode == SINGLE_PREDICTION_ONLY);
+ *mode_excluded = (cpi->common.comp_pred_mode == SINGLE_REFERENCE);
} else {
- *mode_excluded = (cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY);
+ *mode_excluded = (cpi->common.comp_pred_mode == COMPOUND_REFERENCE);
}
}
int64_t best_rd = best_rd_so_far;
int64_t best_tx_rd[TX_MODES];
int64_t best_tx_diff[TX_MODES];
- int64_t best_pred_diff[NB_PREDICTION_TYPES];
- int64_t best_pred_rd[NB_PREDICTION_TYPES];
+ int64_t best_pred_diff[REFERENCE_MODES];
+ int64_t best_pred_rd[REFERENCE_MODES];
int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
MB_MODE_INFO best_mbmode = { 0 };
estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
&comp_mode_p);
- for (i = 0; i < NB_PREDICTION_TYPES; ++i)
+ for (i = 0; i < REFERENCE_MODES; ++i)
best_pred_rd[i] = INT64_MAX;
for (i = 0; i < TX_MODES; i++)
best_tx_rd[i] = INT64_MAX;
mode_excluded = mode_excluded
? mode_excluded
- : cm->comp_pred_mode == SINGLE_PREDICTION_ONLY;
+ : cm->comp_pred_mode == SINGLE_REFERENCE;
} else {
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
mode_excluded =
mode_excluded ?
- mode_excluded : cm->comp_pred_mode == COMP_PREDICTION_ONLY;
+ mode_excluded : cm->comp_pred_mode == COMPOUND_REFERENCE;
}
}
continue;
}
- if (cm->comp_pred_mode == HYBRID_PREDICTION) {
+ if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
rate2 += compmode_cost;
}
}
if (!disable_skip && ref_frame == INTRA_FRAME) {
- for (i = 0; i < NB_PREDICTION_TYPES; ++i)
+ for (i = 0; i < REFERENCE_MODES; ++i)
best_pred_rd[i] = MIN(best_pred_rd[i], this_rd);
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
best_filter_rd[i] = MIN(best_filter_rd[i], this_rd);
if (!disable_skip && ref_frame != INTRA_FRAME) {
int single_rd, hybrid_rd, single_rate, hybrid_rate;
- if (cm->comp_pred_mode == HYBRID_PREDICTION) {
+ if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
single_rate = rate2 - compmode_cost;
hybrid_rate = rate2;
} else {
hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2);
if (second_ref_frame <= INTRA_FRAME &&
- single_rd < best_pred_rd[SINGLE_PREDICTION_ONLY]) {
- best_pred_rd[SINGLE_PREDICTION_ONLY] = single_rd;
+ single_rd < best_pred_rd[SINGLE_REFERENCE]) {
+ best_pred_rd[SINGLE_REFERENCE] = single_rd;
} else if (second_ref_frame > INTRA_FRAME &&
- single_rd < best_pred_rd[COMP_PREDICTION_ONLY]) {
- best_pred_rd[COMP_PREDICTION_ONLY] = single_rd;
+ single_rd < best_pred_rd[COMPOUND_REFERENCE]) {
+ best_pred_rd[COMPOUND_REFERENCE] = single_rd;
}
- if (hybrid_rd < best_pred_rd[HYBRID_PREDICTION])
- best_pred_rd[HYBRID_PREDICTION] = hybrid_rd;
+ if (hybrid_rd < best_pred_rd[REFERENCE_MODE_SELECT])
+ best_pred_rd[REFERENCE_MODE_SELECT] = hybrid_rd;
}
/* keep record of best filter type */
*mbmi = best_mbmode;
x->skip |= best_skip2;
- for (i = 0; i < NB_PREDICTION_TYPES; ++i) {
+ for (i = 0; i < REFERENCE_MODES; ++i) {
if (best_pred_rd[i] == INT64_MAX)
best_pred_diff[i] = INT_MIN;
else
int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise
int64_t best_tx_rd[TX_MODES];
int64_t best_tx_diff[TX_MODES];
- int64_t best_pred_diff[NB_PREDICTION_TYPES];
- int64_t best_pred_rd[NB_PREDICTION_TYPES];
+ int64_t best_pred_diff[REFERENCE_MODES];
+ int64_t best_pred_rd[REFERENCE_MODES];
int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
MB_MODE_INFO best_mbmode = { 0 };
estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
&comp_mode_p);
- for (i = 0; i < NB_PREDICTION_TYPES; ++i)
+ for (i = 0; i < REFERENCE_MODES; ++i)
best_pred_rd[i] = INT64_MAX;
for (i = 0; i < TX_MODES; i++)
best_tx_rd[i] = INT64_MAX;
mode_excluded = mode_excluded
? mode_excluded
- : cm->comp_pred_mode == SINGLE_PREDICTION_ONLY;
+ : cm->comp_pred_mode == SINGLE_REFERENCE;
} else {
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
mode_excluded =
mode_excluded ?
- mode_excluded : cm->comp_pred_mode == COMP_PREDICTION_ONLY;
+ mode_excluded : cm->comp_pred_mode == COMPOUND_REFERENCE;
}
}
if (!mode_excluded) {
if (comp_pred)
- mode_excluded = cpi->common.comp_pred_mode == SINGLE_PREDICTION_ONLY;
+ mode_excluded = cpi->common.comp_pred_mode == SINGLE_REFERENCE;
else
- mode_excluded = cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY;
+ mode_excluded = cpi->common.comp_pred_mode == COMPOUND_REFERENCE;
}
compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred);
}
}
- if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) {
+ if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
rate2 += compmode_cost;
}
}
if (!disable_skip && ref_frame == INTRA_FRAME) {
- for (i = 0; i < NB_PREDICTION_TYPES; ++i)
+ for (i = 0; i < REFERENCE_MODES; ++i)
best_pred_rd[i] = MIN(best_pred_rd[i], this_rd);
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
best_filter_rd[i] = MIN(best_filter_rd[i], this_rd);
if (!disable_skip && ref_frame != INTRA_FRAME) {
int single_rd, hybrid_rd, single_rate, hybrid_rate;
- if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) {
+ if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
single_rate = rate2 - compmode_cost;
hybrid_rate = rate2;
} else {
hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2);
if (second_ref_frame <= INTRA_FRAME &&
- single_rd < best_pred_rd[SINGLE_PREDICTION_ONLY]) {
- best_pred_rd[SINGLE_PREDICTION_ONLY] = single_rd;
+ single_rd < best_pred_rd[SINGLE_REFERENCE]) {
+ best_pred_rd[SINGLE_REFERENCE] = single_rd;
} else if (second_ref_frame > INTRA_FRAME &&
- single_rd < best_pred_rd[COMP_PREDICTION_ONLY]) {
- best_pred_rd[COMP_PREDICTION_ONLY] = single_rd;
+ single_rd < best_pred_rd[COMPOUND_REFERENCE]) {
+ best_pred_rd[COMPOUND_REFERENCE] = single_rd;
}
- if (hybrid_rd < best_pred_rd[HYBRID_PREDICTION])
- best_pred_rd[HYBRID_PREDICTION] = hybrid_rd;
+ if (hybrid_rd < best_pred_rd[REFERENCE_MODE_SELECT])
+ best_pred_rd[REFERENCE_MODE_SELECT] = hybrid_rd;
}
/* keep record of best filter type */
mbmi->mv[1].as_int = xd->mi_8x8[0]->bmi[3].as_mv[1].as_int;
}
- for (i = 0; i < NB_PREDICTION_TYPES; ++i) {
+ for (i = 0; i < REFERENCE_MODES; ++i) {
if (best_pred_rd[i] == INT64_MAX)
best_pred_diff[i] = INT_MIN;
else