Merge "Renaming COMPPREDMODE_TYPE enum and its members."

This commit is contained in:
Dmitry Kovalev
2013-11-25 10:59:08 -08:00
committed by Gerrit Code Review
8 changed files with 81 additions and 81 deletions

View File

@@ -202,7 +202,7 @@ void vp9_create_common(VP9_COMMON *cm) {
vp9_machine_specific_config(cm); vp9_machine_specific_config(cm);
cm->tx_mode = ONLY_4X4; cm->tx_mode = ONLY_4X4;
cm->comp_pred_mode = HYBRID_PREDICTION; cm->comp_pred_mode = REFERENCE_MODE_SELECT;
} }
void vp9_remove_common(VP9_COMMON *cm) { void vp9_remove_common(VP9_COMMON *cm) {

View File

@@ -81,11 +81,11 @@ typedef struct {
typedef enum { typedef enum {
SINGLE_PREDICTION_ONLY = 0, SINGLE_REFERENCE = 0,
COMP_PREDICTION_ONLY = 1, COMPOUND_REFERENCE = 1,
HYBRID_PREDICTION = 2, REFERENCE_MODE_SELECT = 2,
NB_PREDICTION_TYPES = 3, REFERENCE_MODES = 3,
} COMPPREDMODE_TYPE; } REFERENCE_MODE;
typedef struct VP9Common { typedef struct VP9Common {
struct vpx_internal_error_info error; struct vpx_internal_error_info error;
@@ -195,7 +195,7 @@ typedef struct VP9Common {
int allow_comp_inter_inter; int allow_comp_inter_inter;
MV_REFERENCE_FRAME comp_fixed_ref; MV_REFERENCE_FRAME comp_fixed_ref;
MV_REFERENCE_FRAME comp_var_ref[2]; MV_REFERENCE_FRAME comp_var_ref[2];
COMPPREDMODE_TYPE comp_pred_mode; REFERENCE_MODE comp_pred_mode;
FRAME_CONTEXT fc; /* this frame entropy */ FRAME_CONTEXT fc; /* this frame entropy */
FRAME_CONTEXT frame_contexts[NUM_FRAME_CONTEXTS]; FRAME_CONTEXT frame_contexts[NUM_FRAME_CONTEXTS];

View File

@@ -126,8 +126,8 @@ static void read_inter_mode_probs(FRAME_CONTEXT *fc, vp9_reader *r) {
vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]); vp9_diff_update_prob(r, &fc->inter_mode_probs[i][j]);
} }
static INLINE COMPPREDMODE_TYPE read_comp_pred_mode(vp9_reader *r) { static INLINE REFERENCE_MODE read_comp_pred_mode(vp9_reader *r) {
COMPPREDMODE_TYPE mode = vp9_read_bit(r); REFERENCE_MODE mode = vp9_read_bit(r);
if (mode) if (mode)
mode += vp9_read_bit(r); mode += vp9_read_bit(r);
return mode; return mode;
@@ -138,21 +138,21 @@ static void read_comp_pred(VP9_COMMON *cm, vp9_reader *r) {
const int compound_allowed = is_compound_prediction_allowed(cm); const int compound_allowed = is_compound_prediction_allowed(cm);
cm->comp_pred_mode = compound_allowed ? read_comp_pred_mode(r) cm->comp_pred_mode = compound_allowed ? read_comp_pred_mode(r)
: SINGLE_PREDICTION_ONLY; : SINGLE_REFERENCE;
if (compound_allowed) if (compound_allowed)
setup_compound_prediction(cm); setup_compound_prediction(cm);
if (cm->comp_pred_mode == HYBRID_PREDICTION) if (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
for (i = 0; i < COMP_INTER_CONTEXTS; i++) for (i = 0; i < COMP_INTER_CONTEXTS; i++)
vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]); vp9_diff_update_prob(r, &cm->fc.comp_inter_prob[i]);
if (cm->comp_pred_mode != COMP_PREDICTION_ONLY) if (cm->comp_pred_mode != COMPOUND_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++) { 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][0]);
vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]); vp9_diff_update_prob(r, &cm->fc.single_ref_prob[i][1]);
} }
if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY) if (cm->comp_pred_mode != SINGLE_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++) for (i = 0; i < REF_CONTEXTS; i++)
vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]); vp9_diff_update_prob(r, &cm->fc.comp_ref_prob[i]);
} }

View File

@@ -258,14 +258,14 @@ static INLINE void read_mv(vp9_reader *r, MV *mv, const MV *ref,
mv->col = ref->col + diff.col; mv->col = ref->col + diff.col;
} }
static COMPPREDMODE_TYPE read_reference_mode(VP9_COMMON *cm, static REFERENCE_MODE read_reference_mode(VP9_COMMON *cm,
const MACROBLOCKD *xd, const MACROBLOCKD *xd,
vp9_reader *r) { vp9_reader *r) {
const int ctx = vp9_get_pred_context_comp_inter_inter(cm, xd); const int ctx = vp9_get_pred_context_comp_inter_inter(cm, xd);
const int mode = vp9_read(r, cm->fc.comp_inter_prob[ctx]); const int mode = vp9_read(r, cm->fc.comp_inter_prob[ctx]);
if (!cm->frame_parallel_decoding_mode) if (!cm->frame_parallel_decoding_mode)
++cm->counts.comp_inter[ctx][mode]; ++cm->counts.comp_inter[ctx][mode];
return mode; // SINGLE_PREDICTION_ONLY or COMP_PREDICTION_ONLY return mode; // SINGLE_REFERENCE or COMPOUND_REFERENCE
} }
// Read the referncence frame // Read the referncence frame
@@ -279,12 +279,12 @@ 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[0] = vp9_get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME);
ref_frame[1] = NONE; ref_frame[1] = NONE;
} else { } else {
const COMPPREDMODE_TYPE mode = (cm->comp_pred_mode == HYBRID_PREDICTION) const REFERENCE_MODE mode = (cm->comp_pred_mode == REFERENCE_MODE_SELECT)
? read_reference_mode(cm, xd, r) ? read_reference_mode(cm, xd, r)
: cm->comp_pred_mode; : cm->comp_pred_mode;
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding // FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
if (mode == COMP_PREDICTION_ONLY) { if (mode == COMPOUND_REFERENCE) {
const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref]; const int idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
const int ctx = vp9_get_pred_context_comp_ref_p(cm, xd); const int ctx = vp9_get_pred_context_comp_ref_p(cm, xd);
const int bit = vp9_read(r, fc->comp_ref_prob[ctx]); const int bit = vp9_read(r, fc->comp_ref_prob[ctx]);
@@ -292,7 +292,7 @@ static void read_ref_frames(VP9_COMMON *const cm, MACROBLOCKD *const xd,
++counts->comp_ref[ctx][bit]; ++counts->comp_ref[ctx][bit];
ref_frame[idx] = cm->comp_fixed_ref; ref_frame[idx] = cm->comp_fixed_ref;
ref_frame[!idx] = cm->comp_var_ref[bit]; ref_frame[!idx] = cm->comp_var_ref[bit];
} else if (mode == SINGLE_PREDICTION_ONLY) { } else if (mode == SINGLE_REFERENCE) {
const int ctx0 = vp9_get_pred_context_single_ref_p1(xd); const int ctx0 = vp9_get_pred_context_single_ref_p1(xd);
const int bit0 = vp9_read(r, fc->single_ref_prob[ctx0][0]); const int bit0 = vp9_read(r, fc->single_ref_prob[ctx0][0]);
if (!cm->frame_parallel_decoding_mode) if (!cm->frame_parallel_decoding_mode)

View File

@@ -319,12 +319,12 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
if (!seg_ref_active) { if (!seg_ref_active) {
// does the feature use compound prediction or not // does the feature use compound prediction or not
// (if not specified at the frame/segment level) // (if not specified at the frame/segment level)
if (cm->comp_pred_mode == HYBRID_PREDICTION) { if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
vp9_write(bc, mi->ref_frame[1] > INTRA_FRAME, vp9_write(bc, mi->ref_frame[1] > INTRA_FRAME,
vp9_get_pred_prob_comp_inter_inter(cm, xd)); vp9_get_pred_prob_comp_inter_inter(cm, xd));
} else { } else {
assert((mi->ref_frame[1] <= INTRA_FRAME) == assert((mi->ref_frame[1] <= INTRA_FRAME) ==
(cm->comp_pred_mode == SINGLE_PREDICTION_ONLY)); (cm->comp_pred_mode == SINGLE_REFERENCE));
} }
if (mi->ref_frame[1] > INTRA_FRAME) { if (mi->ref_frame[1] > INTRA_FRAME) {
@@ -1357,8 +1357,8 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
if (cm->allow_comp_inter_inter) { if (cm->allow_comp_inter_inter) {
const int comp_pred_mode = cpi->common.comp_pred_mode; const int comp_pred_mode = cpi->common.comp_pred_mode;
const int use_compound_pred = comp_pred_mode != SINGLE_PREDICTION_ONLY; const int use_compound_pred = comp_pred_mode != SINGLE_REFERENCE;
const int use_hybrid_pred = comp_pred_mode == HYBRID_PREDICTION; const int use_hybrid_pred = comp_pred_mode == REFERENCE_MODE_SELECT;
vp9_write_bit(&header_bc, use_compound_pred); vp9_write_bit(&header_bc, use_compound_pred);
if (use_compound_pred) { if (use_compound_pred) {
@@ -1370,7 +1370,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
} }
} }
if (cm->comp_pred_mode != COMP_PREDICTION_ONLY) { if (cm->comp_pred_mode != COMPOUND_REFERENCE) {
for (i = 0; i < REF_CONTEXTS; i++) { for (i = 0; i < REF_CONTEXTS; i++) {
vp9_cond_prob_diff_update(&header_bc, &fc->single_ref_prob[i][0], vp9_cond_prob_diff_update(&header_bc, &fc->single_ref_prob[i][0],
cpi->single_ref_count[i][0]); cpi->single_ref_count[i][0]);
@@ -1379,7 +1379,7 @@ static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
} }
} }
if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY) if (cm->comp_pred_mode != SINGLE_REFERENCE)
for (i = 0; i < REF_CONTEXTS; i++) for (i = 0; i < REF_CONTEXTS; i++)
vp9_cond_prob_diff_update(&header_bc, &fc->comp_ref_prob[i], vp9_cond_prob_diff_update(&header_bc, &fc->comp_ref_prob[i],
cpi->comp_ref_count[i]); cpi->comp_ref_count[i]);

View File

@@ -531,9 +531,9 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
++cm->counts.switchable_interp[ctx][mbmi->interp_filter]; ++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[SINGLE_REFERENCE] += ctx->single_pred_diff;
cpi->rd_comp_pred_diff[COMP_PREDICTION_ONLY] += ctx->comp_pred_diff; cpi->rd_comp_pred_diff[COMPOUND_REFERENCE] += ctx->comp_pred_diff;
cpi->rd_comp_pred_diff[HYBRID_PREDICTION] += ctx->hybrid_pred_diff; cpi->rd_comp_pred_diff[REFERENCE_MODE_SELECT] += ctx->hybrid_pred_diff;
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
cpi->rd_filter_diff[i] += ctx->best_filter_diff[i]; cpi->rd_filter_diff[i] += ctx->best_filter_diff[i];
@@ -758,7 +758,7 @@ static void update_stats(VP9_COMP *cpi) {
// reference frame allowed for the segment so exclude it from // reference frame allowed for the segment so exclude it from
// the reference frame counts used to work out probabilities. // the reference frame counts used to work out probabilities.
if (is_inter_block(mbmi) && !seg_ref_active) { 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)] cpi->comp_inter_count[vp9_get_pred_context_comp_inter_inter(cm, xd)]
[has_second_ref(mbmi)]++; [has_second_ref(mbmi)]++;
@@ -2315,18 +2315,18 @@ void vp9_encode_frame(VP9_COMP *cpi) {
/* prediction (compound, single or hybrid) mode selection */ /* prediction (compound, single or hybrid) mode selection */
if (frame_type == 3 || !cm->allow_comp_inter_inter) 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] 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][0]
&& cpi->rd_prediction_type_threshes[frame_type][1] && cpi->rd_prediction_type_threshes[frame_type][1]
> cpi->rd_prediction_type_threshes[frame_type][2] > cpi->rd_prediction_type_threshes[frame_type][2]
&& check_dual_ref_flags(cpi) && cpi->static_mb_pct == 100) && 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] else if (cpi->rd_prediction_type_threshes[frame_type][0]
> cpi->rd_prediction_type_threshes[frame_type][2]) > cpi->rd_prediction_type_threshes[frame_type][2])
pred_type = SINGLE_PREDICTION_ONLY; pred_type = SINGLE_REFERENCE;
else else
pred_type = HYBRID_PREDICTION; pred_type = REFERENCE_MODE_SELECT;
/* filter type selection */ /* filter type selection */
// FIXME(rbultje) for some odd reason, we often select smooth_filter // FIXME(rbultje) for some odd reason, we often select smooth_filter
@@ -2363,7 +2363,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
cpi->common.mcomp_filter_type = filter_type; cpi->common.mcomp_filter_type = filter_type;
encode_frame_internal(cpi); 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); 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] += diff;
cpi->rd_prediction_type_threshes[frame_type][i] >>= 1; cpi->rd_prediction_type_threshes[frame_type][i] >>= 1;
@@ -2386,7 +2386,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
cpi->rd_tx_select_threshes[frame_type][i] /= 2; 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 single_count_zero = 0;
int comp_count_zero = 0; int comp_count_zero = 0;
@@ -2396,10 +2396,10 @@ void vp9_encode_frame(VP9_COMP *cpi) {
} }
if (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); vp9_zero(cpi->comp_inter_count);
} else if (single_count_zero == 0) { } 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_zero(cpi->comp_inter_count);
} }
} }

View File

@@ -432,8 +432,8 @@ typedef struct VP9_COMP {
int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS]; int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS];
int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS]; int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS];
int64_t rd_comp_pred_diff[NB_PREDICTION_TYPES]; int64_t rd_comp_pred_diff[REFERENCE_MODES];
int64_t rd_prediction_type_threshes[4][NB_PREDICTION_TYPES]; int64_t rd_prediction_type_threshes[4][REFERENCE_MODES];
unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2]; unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2];
unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2]; unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2];
unsigned int single_ref_count[REF_CONTEXTS][2][2]; unsigned int single_ref_count[REF_CONTEXTS][2][2];

View File

@@ -2194,7 +2194,7 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
vp9_prob intra_inter_p = vp9_get_pred_prob_intra_inter(cm, xd); vp9_prob intra_inter_p = vp9_get_pred_prob_intra_inter(cm, xd);
vp9_prob comp_inter_p = 128; 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_inter_p = vp9_get_pred_prob_comp_inter_inter(cm, xd);
*comp_mode_p = comp_inter_p; *comp_mode_p = comp_inter_p;
} else { } else {
@@ -2203,12 +2203,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); 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_p1 = vp9_get_pred_prob_single_ref_p1(cm, xd);
vp9_prob ref_single_p2 = vp9_get_pred_prob_single_ref_p2(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); 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); base_cost += vp9_cost_bit(comp_inter_p, 0);
ref_costs_single[LAST_FRAME] = ref_costs_single[GOLDEN_FRAME] = ref_costs_single[LAST_FRAME] = ref_costs_single[GOLDEN_FRAME] =
@@ -2223,11 +2223,11 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
ref_costs_single[GOLDEN_FRAME] = 512; ref_costs_single[GOLDEN_FRAME] = 512;
ref_costs_single[ALTREF_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); 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); 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); base_cost += vp9_cost_bit(comp_inter_p, 1);
ref_costs_comp[LAST_FRAME] = base_cost + vp9_cost_bit(ref_comp_p, 0); ref_costs_comp[LAST_FRAME] = base_cost + vp9_cost_bit(ref_comp_p, 0);
@@ -2243,7 +2243,7 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
int mode_index, int mode_index,
int_mv *ref_mv, int_mv *ref_mv,
int_mv *second_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 tx_size_diff[TX_MODES],
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]) { int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]) {
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
@@ -2257,9 +2257,9 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
ctx->best_ref_mv.as_int = ref_mv->as_int; ctx->best_ref_mv.as_int = ref_mv->as_int;
ctx->second_best_ref_mv.as_int = second_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->single_pred_diff = (int)comp_pred_diff[SINGLE_REFERENCE];
ctx->comp_pred_diff = (int)comp_pred_diff[COMP_PREDICTION_ONLY]; ctx->comp_pred_diff = (int)comp_pred_diff[COMPOUND_REFERENCE];
ctx->hybrid_pred_diff = (int)comp_pred_diff[HYBRID_PREDICTION]; 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->tx_rd_diff, tx_size_diff, sizeof(ctx->tx_rd_diff));
vpx_memcpy(ctx->best_filter_diff, best_filter_diff, vpx_memcpy(ctx->best_filter_diff, best_filter_diff,
@@ -2782,9 +2782,9 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (!(*mode_excluded)) { if (!(*mode_excluded)) {
if (is_comp_pred) { if (is_comp_pred) {
*mode_excluded = (cpi->common.comp_pred_mode == SINGLE_PREDICTION_ONLY); *mode_excluded = (cpi->common.comp_pred_mode == SINGLE_REFERENCE);
} else { } else {
*mode_excluded = (cpi->common.comp_pred_mode == COMP_PREDICTION_ONLY); *mode_excluded = (cpi->common.comp_pred_mode == COMPOUND_REFERENCE);
} }
} }
@@ -3149,8 +3149,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_rd = best_rd_so_far; int64_t best_rd = best_rd_so_far;
int64_t best_tx_rd[TX_MODES]; int64_t best_tx_rd[TX_MODES];
int64_t best_tx_diff[TX_MODES]; int64_t best_tx_diff[TX_MODES];
int64_t best_pred_diff[NB_PREDICTION_TYPES]; int64_t best_pred_diff[REFERENCE_MODES];
int64_t best_pred_rd[NB_PREDICTION_TYPES]; int64_t best_pred_rd[REFERENCE_MODES];
int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
MB_MODE_INFO best_mbmode = { 0 }; MB_MODE_INFO best_mbmode = { 0 };
@@ -3186,7 +3186,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp, estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
&comp_mode_p); &comp_mode_p);
for (i = 0; i < NB_PREDICTION_TYPES; ++i) for (i = 0; i < REFERENCE_MODES; ++i)
best_pred_rd[i] = INT64_MAX; best_pred_rd[i] = INT64_MAX;
for (i = 0; i < TX_MODES; i++) for (i = 0; i < TX_MODES; i++)
best_tx_rd[i] = INT64_MAX; best_tx_rd[i] = INT64_MAX;
@@ -3363,12 +3363,12 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
mode_excluded = mode_excluded mode_excluded = mode_excluded
? mode_excluded ? mode_excluded
: cm->comp_pred_mode == SINGLE_PREDICTION_ONLY; : cm->comp_pred_mode == SINGLE_REFERENCE;
} else { } else {
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) { if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
mode_excluded = mode_excluded =
mode_excluded ? mode_excluded ?
mode_excluded : cm->comp_pred_mode == COMP_PREDICTION_ONLY; mode_excluded : cm->comp_pred_mode == COMPOUND_REFERENCE;
} }
} }
@@ -3491,7 +3491,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
continue; continue;
} }
if (cm->comp_pred_mode == HYBRID_PREDICTION) { if (cm->comp_pred_mode == REFERENCE_MODE_SELECT) {
rate2 += compmode_cost; rate2 += compmode_cost;
} }
@@ -3576,7 +3576,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
} }
if (!disable_skip && ref_frame == INTRA_FRAME) { 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); best_pred_rd[i] = MIN(best_pred_rd[i], this_rd);
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
best_filter_rd[i] = MIN(best_filter_rd[i], this_rd); best_filter_rd[i] = MIN(best_filter_rd[i], this_rd);
@@ -3638,7 +3638,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (!disable_skip && ref_frame != INTRA_FRAME) { if (!disable_skip && ref_frame != INTRA_FRAME) {
int single_rd, hybrid_rd, single_rate, hybrid_rate; 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; single_rate = rate2 - compmode_cost;
hybrid_rate = rate2; hybrid_rate = rate2;
} else { } else {
@@ -3650,14 +3650,14 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2); hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2);
if (second_ref_frame <= INTRA_FRAME && if (second_ref_frame <= INTRA_FRAME &&
single_rd < best_pred_rd[SINGLE_PREDICTION_ONLY]) { single_rd < best_pred_rd[SINGLE_REFERENCE]) {
best_pred_rd[SINGLE_PREDICTION_ONLY] = single_rd; best_pred_rd[SINGLE_REFERENCE] = single_rd;
} else if (second_ref_frame > INTRA_FRAME && } else if (second_ref_frame > INTRA_FRAME &&
single_rd < best_pred_rd[COMP_PREDICTION_ONLY]) { single_rd < best_pred_rd[COMPOUND_REFERENCE]) {
best_pred_rd[COMP_PREDICTION_ONLY] = single_rd; best_pred_rd[COMPOUND_REFERENCE] = single_rd;
} }
if (hybrid_rd < best_pred_rd[HYBRID_PREDICTION]) if (hybrid_rd < best_pred_rd[REFERENCE_MODE_SELECT])
best_pred_rd[HYBRID_PREDICTION] = hybrid_rd; best_pred_rd[REFERENCE_MODE_SELECT] = hybrid_rd;
} }
/* keep record of best filter type */ /* keep record of best filter type */
@@ -3779,7 +3779,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
*mbmi = best_mbmode; *mbmi = best_mbmode;
x->skip |= best_skip2; 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) if (best_pred_rd[i] == INT64_MAX)
best_pred_diff[i] = INT_MIN; best_pred_diff[i] = INT_MIN;
else else
@@ -3850,8 +3850,8 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise int64_t best_yrd = best_rd_so_far; // FIXME(rbultje) more precise
int64_t best_tx_rd[TX_MODES]; int64_t best_tx_rd[TX_MODES];
int64_t best_tx_diff[TX_MODES]; int64_t best_tx_diff[TX_MODES];
int64_t best_pred_diff[NB_PREDICTION_TYPES]; int64_t best_pred_diff[REFERENCE_MODES];
int64_t best_pred_rd[NB_PREDICTION_TYPES]; int64_t best_pred_rd[REFERENCE_MODES];
int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS];
int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS];
MB_MODE_INFO best_mbmode = { 0 }; MB_MODE_INFO best_mbmode = { 0 };
@@ -3886,7 +3886,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp, estimate_ref_frame_costs(cpi, segment_id, ref_costs_single, ref_costs_comp,
&comp_mode_p); &comp_mode_p);
for (i = 0; i < NB_PREDICTION_TYPES; ++i) for (i = 0; i < REFERENCE_MODES; ++i)
best_pred_rd[i] = INT64_MAX; best_pred_rd[i] = INT64_MAX;
for (i = 0; i < TX_MODES; i++) for (i = 0; i < TX_MODES; i++)
best_tx_rd[i] = INT64_MAX; best_tx_rd[i] = INT64_MAX;
@@ -4030,12 +4030,12 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
mode_excluded = mode_excluded mode_excluded = mode_excluded
? mode_excluded ? mode_excluded
: cm->comp_pred_mode == SINGLE_PREDICTION_ONLY; : cm->comp_pred_mode == SINGLE_REFERENCE;
} else { } else {
if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) { if (ref_frame != INTRA_FRAME && second_ref_frame != INTRA_FRAME) {
mode_excluded = mode_excluded =
mode_excluded ? mode_excluded ?
mode_excluded : cm->comp_pred_mode == COMP_PREDICTION_ONLY; mode_excluded : cm->comp_pred_mode == COMPOUND_REFERENCE;
} }
} }
@@ -4241,9 +4241,9 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
if (!mode_excluded) { if (!mode_excluded) {
if (comp_pred) if (comp_pred)
mode_excluded = cpi->common.comp_pred_mode == SINGLE_PREDICTION_ONLY; mode_excluded = cpi->common.comp_pred_mode == SINGLE_REFERENCE;
else 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); compmode_cost = vp9_cost_bit(comp_mode_p, comp_pred);
@@ -4271,7 +4271,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
} }
} }
if (cpi->common.comp_pred_mode == HYBRID_PREDICTION) { if (cpi->common.comp_pred_mode == REFERENCE_MODE_SELECT) {
rate2 += compmode_cost; rate2 += compmode_cost;
} }
@@ -4332,7 +4332,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
} }
if (!disable_skip && ref_frame == INTRA_FRAME) { 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); best_pred_rd[i] = MIN(best_pred_rd[i], this_rd);
for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++)
best_filter_rd[i] = MIN(best_filter_rd[i], this_rd); best_filter_rd[i] = MIN(best_filter_rd[i], this_rd);
@@ -4389,7 +4389,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
if (!disable_skip && ref_frame != INTRA_FRAME) { if (!disable_skip && ref_frame != INTRA_FRAME) {
int single_rd, hybrid_rd, single_rate, hybrid_rate; 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; single_rate = rate2 - compmode_cost;
hybrid_rate = rate2; hybrid_rate = rate2;
} else { } else {
@@ -4401,14 +4401,14 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2); hybrid_rd = RDCOST(x->rdmult, x->rddiv, hybrid_rate, distortion2);
if (second_ref_frame <= INTRA_FRAME && if (second_ref_frame <= INTRA_FRAME &&
single_rd < best_pred_rd[SINGLE_PREDICTION_ONLY]) { single_rd < best_pred_rd[SINGLE_REFERENCE]) {
best_pred_rd[SINGLE_PREDICTION_ONLY] = single_rd; best_pred_rd[SINGLE_REFERENCE] = single_rd;
} else if (second_ref_frame > INTRA_FRAME && } else if (second_ref_frame > INTRA_FRAME &&
single_rd < best_pred_rd[COMP_PREDICTION_ONLY]) { single_rd < best_pred_rd[COMPOUND_REFERENCE]) {
best_pred_rd[COMP_PREDICTION_ONLY] = single_rd; best_pred_rd[COMPOUND_REFERENCE] = single_rd;
} }
if (hybrid_rd < best_pred_rd[HYBRID_PREDICTION]) if (hybrid_rd < best_pred_rd[REFERENCE_MODE_SELECT])
best_pred_rd[HYBRID_PREDICTION] = hybrid_rd; best_pred_rd[REFERENCE_MODE_SELECT] = hybrid_rd;
} }
/* keep record of best filter type */ /* keep record of best filter type */
@@ -4524,7 +4524,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->mv[1].as_int = xd->mi_8x8[0]->bmi[3].as_mv[1].as_int; 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) if (best_pred_rd[i] == INT64_MAX)
best_pred_diff[i] = INT_MIN; best_pred_diff[i] = INT_MIN;
else else