Commit 08c48ddc authored by Dmitry Kovalev's avatar Dmitry Kovalev

Renaming comp_pred_mode to reference_mode.

Change-Id: I83ffed2b1878a35ac35f07f9ee74309adc9c7b11
parent a19d694f
......@@ -195,7 +195,7 @@ typedef struct VP9Common {
int allow_comp_inter_inter;
MV_REFERENCE_FRAME comp_fixed_ref;
MV_REFERENCE_FRAME comp_var_ref[2];
REFERENCE_MODE comp_pred_mode;
REFERENCE_MODE reference_mode;
FRAME_CONTEXT fc; /* this frame entropy */
FRAME_CONTEXT frame_contexts[FRAME_CONTEXTS];
......
......@@ -136,17 +136,17 @@ static REFERENCE_MODE read_reference_mode(VP9_COMMON *cm, vp9_reader *r) {
static void read_reference_mode_probs(VP9_COMMON *cm, vp9_reader *r) {
int i;
if (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
if (cm->reference_mode == REFERENCE_MODE_SELECT)
for (i = 0; i < COMP_INTER_CONTEXTS; i++)
vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]);
if (cm->comp_pred_mode != COMPOUND_REFERENCE)
if (cm->reference_mode != COMPOUND_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++) {
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][0]);
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]);
}
if (cm->comp_pred_mode != SINGLE_REFERENCE)
if (cm->reference_mode != SINGLE_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++)
vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]);
}
......@@ -1197,7 +1197,7 @@ static int read_compressed_header(VP9D_COMP *pbi, const uint8_t *data,
for (i = 0; i < INTRA_INTER_CONTEXTS; i++)
vp9_diff_update_prob(&r, &fc->intra_inter_prob[i]);
cm->comp_pred_mode = read_reference_mode(cm, &r);
cm->reference_mode = read_reference_mode(cm, &r);
read_reference_mode_probs(cm, &r);
for (j = 0; j < BLOCK_SIZE_GROUPS; j++)
......
......@@ -278,9 +278,9 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
ref_frame[0] = vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME);
ref_frame[1] = NONE;
} else {
const REFERENCE_MODE mode = (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
const REFERENCE_MODE mode = (cm->reference_mode == REFERENCE_MODE_SELECT)
? read_reference_mode(cm, xd, r)
: cm->comp_pred_mode;
: cm->reference_mode;
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
if (mode == COMPOUND_REFERENCE) {
......
......@@ -231,12 +231,12 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
if (!seg_ref_active) {
// does the feature use compound prediction or not
// (if not specified at the frame/segment level)
if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
vp9_write(bc, mi->ref_frame[1] > INTRA_FRAME,
vp9_get_reference_mode_prob(cm, xd));
} else {
assert((mi->ref_frame[1] <= INTRA_FRAME) ==
(cm->comp_pred_mode == SINGLE_REFERENCE));
(cm->reference_mode == SINGLE_REFERENCE));
}
if (mi->ref_frame[1] > INTRA_FRAME) {
......@@ -1258,9 +1258,9 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
cpi->intra_inter_count[i]);
if (cm->allow_comp_inter_inter) {
const int comp_pred_mode = cpi->common.comp_pred_mode;
const int use_compound_pred = comp_pred_mode != SINGLE_REFERENCE;
const int use_hybrid_pred = comp_pred_mode == REFERENCE_MODE_SELECT;
const int reference_mode = cpi->common.reference_mode;
const int use_compound_pred = reference_mode != SINGLE_REFERENCE;
const int use_hybrid_pred = reference_mode == REFERENCE_MODE_SELECT;
vp9_write_bit(&header_bc, use_compound_pred);
if (use_compound_pred) {
......@@ -1272,7 +1272,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
}
}
if (cm->comp_pred_mode != COMPOUND_REFERENCE) {
if (cm->reference_mode != COMPOUND_REFERENCE) {
for (i = 0; i < REF_CONTEXTS; i++) {
vp9_cond_prob_diff_update(&header_bc, &fc->single_ref_prob[i][0],
cpi->single_ref_count[i][0]);
......@@ -1281,7 +1281,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
}
}
if (cm->comp_pred_mode != SINGLE_REFERENCE)
if (cm->reference_mode != SINGLE_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++)
vp9_cond_prob_diff_update(&header_bc, &fc->comp_ref_prob[i],
cpi->comp_ref_count[i]);
......
......@@ -758,7 +758,7 @@ static void update_stats(VP9_COMP *cpi) {
// 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 == REFERENCE_MODE_SELECT)
if (cm->reference_mode == REFERENCE_MODE_SELECT)
cpi->comp_inter_count[vp9_get_reference_mode_context(cm, xd)]
[has_second_ref(mbmi)]++;
......@@ -2361,7 +2361,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
/* transform size selection (4x4, 8x8, 16x16 or select-per-mb) */
select_tx_mode(cpi);
cpi->common.comp_pred_mode = pred_type;
cpi->common.reference_mode = pred_type;
cpi->common.mcomp_filter_type = filter_type;
encode_frame_internal(cpi);
......@@ -2388,7 +2388,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
cpi->rd_tx_select_threshes[frame_type][i] /= 2;
}
if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cpi->common.reference_mode == REFERENCE_MODE_SELECT) {
int single_count_zero = 0;
int comp_count_zero = 0;
......@@ -2398,10 +2398,10 @@ void vp9_encode_frame(VP9_COMP *cpi) {
}
if (comp_count_zero == 0) {
cpi->common.comp_pred_mode = SINGLE_REFERENCE;
cpi->common.reference_mode = SINGLE_REFERENCE;
vp9_zero(cpi->comp_inter_count);
} else if (single_count_zero == 0) {
cpi->common.comp_pred_mode = COMPOUND_REFERENCE;
cpi->common.reference_mode = COMPOUND_REFERENCE;
vp9_zero(cpi->comp_inter_count);
}
}
......
......@@ -2148,7 +2148,7 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
vp9_prob intra_inter_p = vp9_get_intra_inter_prob(cm, xd);
vp9_prob comp_inter_p = 128;
if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
comp_inter_p = vp9_get_reference_mode_prob(cm, xd);
*comp_mode_p = comp_inter_p;
} else {
......@@ -2157,12 +2157,12 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
ref_costs_single[INTRA_FRAME] = vp9_cost_bit(intra_inter_p, 0);
if (cm->comp_pred_mode != COMPOUND_REFERENCE) {
if (cm->reference_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 == REFERENCE_MODE_SELECT)
if (cm->reference_mode == REFERENCE_MODE_SELECT)
base_cost += vp9_cost_bit(comp_inter_p, 0);
ref_costs_single[LAST_FRAME] = ref_costs_single[GOLDEN_FRAME] =
......@@ -2177,11 +2177,11 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
ref_costs_single[GOLDEN_FRAME] = 512;
ref_costs_single[ALTREF_FRAME] = 512;
}
if (cm->comp_pred_mode != SINGLE_REFERENCE) {
if (cm->reference_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 == REFERENCE_MODE_SELECT)
if (cm->reference_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);
......@@ -2733,13 +2733,10 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
*rate2 += cost_mv_ref(cpi, this_mode,
mbmi->mode_context[mbmi->ref_frame[0]]);
if (!(*mode_excluded)) {
if (is_comp_pred) {
*mode_excluded = (cpi->common.comp_pred_mode == SINGLE_REFERENCE);
} else {
*mode_excluded = (cpi->common.comp_pred_mode == COMPOUND_REFERENCE);
}
}
if (!(*mode_excluded))
*mode_excluded = is_comp_pred
? cpi->common.reference_mode == SINGLE_REFERENCE
: cpi->common.reference_mode == COMPOUND_REFERENCE;
pred_exists = 0;
// Are all MVs integer pel for Y and UV
......@@ -3312,17 +3309,14 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (comp_pred) {
if (!(cpi->ref_frame_flags & flag_list[second_ref_frame]))
continue;
set_scale_factors(xd, ref_frame, second_ref_frame, scale_factor);
mode_excluded = mode_excluded
? mode_excluded
: cm->comp_pred_mode == SINGLE_REFERENCE;
set_scale_factors(xd, ref_frame, second_ref_frame, scale_factor);
mode_excluded = mode_excluded ? mode_excluded
: cm->reference_mode == SINGLE_REFERENCE;
} else {
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
mode_excluded =
mode_excluded ?
mode_excluded : cm->comp_pred_mode == COMPOUND_REFERENCE;
}
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME)
mode_excluded = mode_excluded ?
mode_excluded : cm->reference_mode == COMPOUND_REFERENCE;
}
// Select prediction reference frames.
......@@ -3444,9 +3438,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
continue;
}
if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cm->reference_mode == REFERENCE_MODE_SELECT)
rate2 += compmode_cost;
}
// Estimate the reference frame signaling cost and add it
// to the rolling cost variable.
......@@ -3591,7 +3584,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (!disable_skip && ref_frame != INTRA_FRAME) {
int64_t single_rd, hybrid_rd, single_rate, hybrid_rate;
if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cm->reference_mode == REFERENCE_MODE_SELECT) {
single_rate = rate2 - compmode_cost;
hybrid_rate = rate2;
} else {
......@@ -3983,14 +3976,12 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
continue;
set_scale_factors(xd, ref_frame, second_ref_frame, scale_factor);
mode_excluded = mode_excluded
? mode_excluded
: cm->comp_pred_mode == SINGLE_REFERENCE;
mode_excluded = mode_excluded ? mode_excluded
: cm->reference_mode == SINGLE_REFERENCE;
} else {
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
mode_excluded =
mode_excluded ?
mode_excluded : cm->comp_pred_mode == COMPOUND_REFERENCE;
mode_excluded = mode_excluded ?
mode_excluded : cm->reference_mode == COMPOUND_REFERENCE;
}
}
......@@ -4194,12 +4185,11 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
if (cpi->common.mcomp_filter_type == SWITCHABLE)
rate2 += get_switchable_rate(x);
if (!mode_excluded) {
if (comp_pred)
mode_excluded = cpi->common.comp_pred_mode == SINGLE_REFERENCE;
else
mode_excluded = cpi->common.comp_pred_mode == COMPOUND_REFERENCE;
}
if (!mode_excluded)
mode_excluded = comp_pred
? cpi->common.reference_mode == SINGLE_REFERENCE
: cpi->common.reference_mode == COMPOUND_REFERENCE;
compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred);
tmp_best_rdu = best_rd -
......@@ -4226,9 +4216,8 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
}
}
if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cpi->common.reference_mode == REFERENCE_MODE_SELECT)
rate2 += compmode_cost;
}
// Estimate the reference frame signaling cost and add it
// to the rolling cost variable.
......@@ -4344,7 +4333,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
if (!disable_skip && ref_frame != INTRA_FRAME) {
int64_t single_rd, hybrid_rd, single_rate, hybrid_rate;
if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
if (cpi->common.reference_mode == REFERENCE_MODE_SELECT) {
single_rate = rate2 - compmode_cost;
hybrid_rate = rate2;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment