Commit fb027a76 authored by Jim Bankoski's avatar Jim Bankoski Committed by Gerrit Code Review

removing case statements around prediction entropy coding

Removes SEG_ID
Removes MBSKIP
Removes SWITCHABLE_INTERP
Removes INTRA_INTER
Removes COMP_INTER_INTER
Removes COMP_REF_P
Removes SINGLE_REF_P1
Removes SINGLE_REF_P2
Removes TX_SIZE

Change-Id: Ie4520ae1f65c8cac312432c0616cc80dea5bf34b
parent 059f2929
This diff is collapsed.
......@@ -14,34 +14,125 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_onyxc_int.h"
// Predicted items
typedef enum {
PRED_SEG_ID = 0, // Segment identifier
PRED_MBSKIP = 1,
PRED_SWITCHABLE_INTERP = 2,
PRED_INTRA_INTER = 3,
PRED_COMP_INTER_INTER = 4,
PRED_SINGLE_REF_P1 = 5,
PRED_SINGLE_REF_P2 = 6,
PRED_COMP_REF_P = 7,
PRED_TX_SIZE = 8
} PRED_ID;
unsigned char vp9_get_pred_context(const VP9_COMMON *cm, const MACROBLOCKD *xd,
PRED_ID pred_id);
vp9_prob vp9_get_pred_prob(const VP9_COMMON *cm, const MACROBLOCKD *xd,
PRED_ID pred_id);
const vp9_prob *vp9_get_pred_probs(const VP9_COMMON *cm, const MACROBLOCKD *xd,
PRED_ID pred_id);
unsigned char vp9_get_pred_flag(const MACROBLOCKD *xd, PRED_ID pred_id);
void vp9_set_pred_flag(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, PRED_ID pred_id,
unsigned char pred_flag);
int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids,
BLOCK_SIZE_TYPE bsize, int mi_row, int mi_col);
static INLINE unsigned char vp9_get_pred_context_seg_id(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
const MODE_INFO * const mi = xd->mode_info_context;
const MODE_INFO * const above_mi = mi - cm->mode_info_stride;
const MODE_INFO * const left_mi = mi - 1;
pred_context = above_mi->mbmi.seg_id_predicted;
if (xd->left_available)
pred_context += left_mi->mbmi.seg_id_predicted;
return pred_context;
}
static INLINE vp9_prob vp9_get_pred_prob_seg_id(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_seg_id(cm, xd);
return cm->segment_pred_probs[pred_context];
}
static INLINE unsigned char vp9_get_pred_flag_seg_id(
const MACROBLOCKD * const xd) {
return xd->mode_info_context->mbmi.seg_id_predicted;
}
void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
unsigned char pred_flag);
static INLINE unsigned char vp9_get_pred_context_mbskip(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
int pred_context;
const MODE_INFO * const mi = xd->mode_info_context;
const MODE_INFO * const above_mi = mi - cm->mode_info_stride;
const MODE_INFO * const left_mi = mi - 1;
pred_context = above_mi->mbmi.mb_skip_coeff;
if (xd->left_available)
pred_context += left_mi->mbmi.mb_skip_coeff;
return pred_context;
}
static INLINE vp9_prob vp9_get_pred_prob_mbskip(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_mbskip(cm, xd);
return cm->fc.mbskip_probs[pred_context];
}
static INLINE unsigned char vp9_get_pred_flag_mbskip(
const MACROBLOCKD * const xd) {
return xd->mode_info_context->mbmi.mb_skip_coeff;
}
void vp9_set_pred_flag_mbskip(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
unsigned char pred_flag);
unsigned char vp9_get_pred_context_switchable_interp(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE const vp9_prob *vp9_get_pred_probs_switchable_interp(
const VP9_COMMON *cm, const MACROBLOCKD * xd) {
const int pred_context = vp9_get_pred_context_switchable_interp(cm, xd);
return &cm->fc.switchable_interp_prob[pred_context][0];
}
unsigned char vp9_get_pred_context_intra_inter(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_intra_inter(cm, xd);
return cm->fc.intra_inter_prob[pred_context];
}
unsigned char vp9_get_pred_context_comp_inter_inter(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_comp_inter_inter(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_comp_inter_inter(cm, xd);
return cm->fc.comp_inter_prob[pred_context];
}
unsigned char vp9_get_pred_context_comp_ref_p(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_comp_ref_p(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_comp_ref_p(cm, xd);
return cm->fc.comp_ref_prob[pred_context];
}
unsigned char vp9_get_pred_context_single_ref_p1(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_single_ref_p1(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_single_ref_p1(cm, xd);
return cm->fc.single_ref_prob[pred_context][0];
}
unsigned char vp9_get_pred_context_single_ref_p2(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_single_ref_p2(cm, xd);
return cm->fc.single_ref_prob[pred_context][1];
}
unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
static INLINE const vp9_prob *vp9_get_pred_probs_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD * xd) {
const MODE_INFO *const mi = xd->mode_info_context;
const int pred_context = vp9_get_pred_context_tx_size(cm, xd);
if (mi->mbmi.sb_type < BLOCK_SIZE_MB16X16)
return cm->fc.tx_probs_8x8p[pred_context];
else if (mi->mbmi.sb_type < BLOCK_SIZE_SB32X32)
return cm->fc.tx_probs_16x16p[pred_context];
else
return cm->fc.tx_probs_32x32p[pred_context];
}
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
......@@ -50,8 +50,8 @@ static int read_segment_id(vp9_reader *r, MACROBLOCKD *xd) {
static TX_SIZE read_selected_txfm_size(VP9_COMMON *cm, MACROBLOCKD *xd,
BLOCK_SIZE_TYPE bsize, vp9_reader *r) {
const int context = vp9_get_pred_context(cm, xd, PRED_TX_SIZE);
const vp9_prob *tx_probs = vp9_get_pred_probs(cm, xd, PRED_TX_SIZE);
const int context = vp9_get_pred_context_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
TX_SIZE txfm_size = vp9_read(r, tx_probs[0]);
if (txfm_size != TX_4X4 && bsize >= BLOCK_SIZE_MB16X16) {
txfm_size += vp9_read(r, tx_probs[1]);
......@@ -123,8 +123,8 @@ static uint8_t read_skip_coeff(VP9D_COMP *pbi, int segment_id, vp9_reader *r) {
MACROBLOCKD *const xd = &pbi->mb;
int skip_coeff = vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
if (!skip_coeff) {
const uint8_t ctx = vp9_get_pred_context(cm, xd, PRED_MBSKIP);
skip_coeff = vp9_read(r, vp9_get_pred_prob(cm, xd, PRED_MBSKIP));
const uint8_t ctx = vp9_get_pred_context_mbskip(cm, xd);
skip_coeff = vp9_read(r, vp9_get_pred_prob_mbskip(cm, xd));
cm->fc.mbskip_count[ctx][skip_coeff]++;
}
return skip_coeff;
......@@ -294,7 +294,7 @@ static void read_ref_frame(VP9D_COMP *pbi, vp9_reader *r,
ref_frame[0] = vp9_get_segdata(xd, segment_id, SEG_LVL_REF_FRAME);
ref_frame[1] = NONE;
} else {
const int comp_ctx = vp9_get_pred_context(cm, xd, PRED_COMP_INTER_INTER);
const int comp_ctx = vp9_get_pred_context_comp_inter_inter(cm, xd);
int is_comp;
if (cm->comp_pred_mode == HYBRID_PREDICTION) {
......@@ -307,16 +307,16 @@ static void read_ref_frame(VP9D_COMP *pbi, vp9_reader *r,
// FIXME(rbultje) I'm pretty sure this breaks segmentation ref frame coding
if (is_comp) {
const int fix_ref_idx = cm->ref_frame_sign_bias[cm->comp_fixed_ref];
const int ref_ctx = vp9_get_pred_context(cm, xd, PRED_COMP_REF_P);
const int ref_ctx = vp9_get_pred_context_comp_ref_p(cm, xd);
const int b = vp9_read(r, fc->comp_ref_prob[ref_ctx]);
fc->comp_ref_count[ref_ctx][b]++;
ref_frame[fix_ref_idx] = cm->comp_fixed_ref;
ref_frame[!fix_ref_idx] = cm->comp_var_ref[b];
} else {
const int ref1_ctx = vp9_get_pred_context(cm, xd, PRED_SINGLE_REF_P1);
const int ref1_ctx = vp9_get_pred_context_single_ref_p1(cm, xd);
ref_frame[1] = NONE;
if (vp9_read(r, fc->single_ref_prob[ref1_ctx][0])) {
const int ref2_ctx = vp9_get_pred_context(cm, xd, PRED_SINGLE_REF_P2);
const int ref2_ctx = vp9_get_pred_context_single_ref_p2(cm, xd);
const int b = vp9_read(r, fc->single_ref_prob[ref2_ctx][1]);
ref_frame[0] = b ? ALTREF_FRAME : GOLDEN_FRAME;
fc->single_ref_count[ref1_ctx][0][1]++;
......@@ -379,9 +379,9 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
return pred_segment_id;
if (cm->temporal_update) {
const vp9_prob pred_prob = vp9_get_pred_prob(cm, xd, PRED_SEG_ID);
const vp9_prob pred_prob = vp9_get_pred_prob_seg_id(cm, xd);
const int pred_flag = vp9_read(r, pred_prob);
vp9_set_pred_flag(xd, bsize, PRED_SEG_ID, pred_flag);
vp9_set_pred_flag_seg_id(xd, bsize, pred_flag);
segment_id = pred_flag ? pred_segment_id
: read_segment_id(r, xd);
} else {
......@@ -406,9 +406,9 @@ static INLINE INTERPOLATIONFILTERTYPE read_switchable_filter_type(
VP9D_COMP *pbi, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
const vp9_prob *probs = vp9_get_pred_probs(cm, xd, PRED_SWITCHABLE_INTERP);
const vp9_prob *probs = vp9_get_pred_probs_switchable_interp(cm, xd);
const int index = treed_read(r, vp9_switchable_interp_tree, probs);
const int ctx = vp9_get_pred_context(cm, xd, PRED_SWITCHABLE_INTERP);
const int ctx = vp9_get_pred_context_switchable_interp(cm, xd);
++cm->fc.switchable_interp_count[ctx][index];
return vp9_switchable_interp[index];
}
......@@ -456,9 +456,9 @@ static MV_REFERENCE_FRAME read_reference_frame(VP9D_COMP *pbi, int segment_id,
MV_REFERENCE_FRAME ref;
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME)) {
const int ctx = vp9_get_pred_context(cm, xd, PRED_INTRA_INTER);
const int ctx = vp9_get_pred_context_intra_inter(cm, xd);
ref = (MV_REFERENCE_FRAME)
vp9_read(r, vp9_get_pred_prob(cm, xd, PRED_INTRA_INTER));
vp9_read(r, vp9_get_pred_prob_intra_inter(cm, xd));
cm->fc.intra_inter_count[ctx][ref != INTRA_FRAME]++;
} else {
ref = (MV_REFERENCE_FRAME)
......
......@@ -271,7 +271,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
} else {
assert(mbmi->sb_type == bsize);
if (eobtotal == 0)
vp9_set_pred_flag(xd, bsize, PRED_MBSKIP, 1); // skip loopfilter
vp9_set_pred_flag_mbskip(xd, bsize, 1); // skip loopfilter
else if (eobtotal > 0)
foreach_transformed_block(xd, bsize, decode_block, xd);
}
......
......@@ -204,7 +204,7 @@ static void write_selected_txfm_size(const VP9_COMP *cpi, TX_SIZE tx_size,
BLOCK_SIZE_TYPE bsize, vp9_writer *w) {
const VP9_COMMON *const c = &cpi->common;
const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
const vp9_prob *tx_probs = vp9_get_pred_probs(c, xd, PRED_TX_SIZE);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(c, xd);
vp9_write(w, tx_size != TX_4X4, tx_probs[0]);
if (bsize >= BLOCK_SIZE_MB16X16 && tx_size != TX_4X4) {
vp9_write(w, tx_size != TX_8X8, tx_probs[1]);
......@@ -220,7 +220,7 @@ static int write_skip_coeff(const VP9_COMP *cpi, int segment_id, MODE_INFO *m,
return 1;
} else {
const int skip_coeff = m->mbmi.mb_skip_coeff;
vp9_write(w, skip_coeff, vp9_get_pred_prob(&cpi->common, xd, PRED_MBSKIP));
vp9_write(w, skip_coeff, vp9_get_pred_prob_mbskip(&cpi->common, xd));
return skip_coeff;
}
}
......@@ -378,7 +378,7 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
// (if not specified at the frame/segment level)
if (pc->comp_pred_mode == HYBRID_PREDICTION) {
vp9_write(bc, mi->ref_frame[1] > INTRA_FRAME,
vp9_get_pred_prob(pc, xd, PRED_COMP_INTER_INTER));
vp9_get_pred_prob_comp_inter_inter(pc, xd));
} else {
assert((mi->ref_frame[1] <= INTRA_FRAME) ==
(pc->comp_pred_mode == SINGLE_PREDICTION_ONLY));
......@@ -386,13 +386,13 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) {
if (mi->ref_frame[1] > INTRA_FRAME) {
vp9_write(bc, mi->ref_frame[0] == GOLDEN_FRAME,
vp9_get_pred_prob(pc, xd, PRED_COMP_REF_P));
vp9_get_pred_prob_comp_ref_p(pc, xd));
} else {
vp9_write(bc, mi->ref_frame[0] != LAST_FRAME,
vp9_get_pred_prob(pc, xd, PRED_SINGLE_REF_P1));
vp9_get_pred_prob_single_ref_p1(pc, xd));
if (mi->ref_frame[0] != LAST_FRAME)
vp9_write(bc, mi->ref_frame[0] != GOLDEN_FRAME,
vp9_get_pred_prob(pc, xd, PRED_SINGLE_REF_P2));
vp9_get_pred_prob_single_ref_p2(pc, xd));
}
} else {
assert(mi->ref_frame[1] <= INTRA_FRAME);
......@@ -426,8 +426,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
if (cpi->mb.e_mbd.update_mb_segmentation_map) {
// Is temporal coding of the segment map enabled
if (pc->temporal_update) {
unsigned char prediction_flag = vp9_get_pred_flag(xd, PRED_SEG_ID);
vp9_prob pred_prob = vp9_get_pred_prob(pc, xd, PRED_SEG_ID);
unsigned char prediction_flag = vp9_get_pred_flag_seg_id(xd);
vp9_prob pred_prob = vp9_get_pred_prob_seg_id(pc, xd);
// Code the segment id prediction flag for this mb
vp9_write(bc, prediction_flag, pred_prob);
......@@ -445,7 +445,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
if (!vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME))
vp9_write(bc, rf != INTRA_FRAME,
vp9_get_pred_prob(pc, xd, PRED_INTRA_INTER));
vp9_get_pred_prob_intra_inter(pc, xd));
if (mi->sb_type >= BLOCK_SIZE_SB8X8 && pc->txfm_mode == TX_MODE_SELECT &&
!(rf != INTRA_FRAME &&
......@@ -493,7 +493,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
if (cpi->common.mcomp_filter_type == SWITCHABLE) {
write_token(bc, vp9_switchable_interp_tree,
vp9_get_pred_probs(&cpi->common, xd, PRED_SWITCHABLE_INTERP),
vp9_get_pred_probs_switchable_interp(&cpi->common, xd),
vp9_switchable_interp_encodings +
vp9_switchable_interp_map[mi->interp_filter]);
} else {
......
......@@ -422,9 +422,9 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
if (cpi->common.mcomp_filter_type == SWITCHABLE
&& is_inter_mode(mbmi->mode)) {
++cpi->common.fc.switchable_interp_count[vp9_get_pred_context(
&cpi->common, xd, PRED_SWITCHABLE_INTERP)][vp9_switchable_interp_map[mbmi
->interp_filter]];
++cpi->common.fc.switchable_interp_count[
vp9_get_pred_context_switchable_interp(&cpi->common, xd)]
[vp9_switchable_interp_map[mbmi->interp_filter]];
}
cpi->rd_comp_pred_diff[SINGLE_PREDICTION_ONLY] += ctx->single_pred_diff;
......@@ -583,7 +583,7 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
seg_ref_active = vp9_segfeature_active(xd, segment_id, SEG_LVL_REF_FRAME);
if (!seg_ref_active)
cpi->intra_inter_count[vp9_get_pred_context(cm, xd, PRED_INTRA_INTER)][mbmi
cpi->intra_inter_count[vp9_get_pred_context_intra_inter(cm, xd)][mbmi
->ref_frame[0] > INTRA_FRAME]++;
// If the segment reference feature is enabled we have only a single
......@@ -591,19 +591,18 @@ static void update_stats(VP9_COMP *cpi, int mi_row, int mi_col) {
// the reference frame counts used to work out probabilities.
if ((mbmi->ref_frame[0] > INTRA_FRAME) && !seg_ref_active) {
if (cm->comp_pred_mode == HYBRID_PREDICTION)
cpi->comp_inter_count[vp9_get_pred_context(cm, xd,
PRED_COMP_INTER_INTER)][mbmi
->ref_frame[1] > INTRA_FRAME]++;
cpi->comp_inter_count[vp9_get_pred_context_comp_inter_inter(cm, xd)]
[mbmi->ref_frame[1] > INTRA_FRAME]++;
if (mbmi->ref_frame[1] > INTRA_FRAME) {
cpi->comp_ref_count[vp9_get_pred_context(cm, xd, PRED_COMP_REF_P)][mbmi
cpi->comp_ref_count[vp9_get_pred_context_comp_ref_p(cm, xd)][mbmi
->ref_frame[0] == GOLDEN_FRAME]++;
} else {
cpi->single_ref_count[vp9_get_pred_context(cm, xd, PRED_SINGLE_REF_P1)][0][mbmi
->ref_frame[0] != LAST_FRAME]++;
cpi->single_ref_count[vp9_get_pred_context_single_ref_p1(cm, xd)]
[0][mbmi->ref_frame[0] != LAST_FRAME]++;
if (mbmi->ref_frame[0] != LAST_FRAME)
cpi->single_ref_count[vp9_get_pred_context(cm, xd, PRED_SINGLE_REF_P2)][1][mbmi
->ref_frame[0] != GOLDEN_FRAME]++;
cpi->single_ref_count[vp9_get_pred_context_single_ref_p2(cm, xd)][1]
[mbmi->ref_frame[0] != GOLDEN_FRAME]++;
}
}
// Count of last ref frame 0,0 usage
......@@ -2368,14 +2367,14 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
// copy skip flag on all mb_mode_info contexts in this SB
// if this was a skip at this txfm size
vp9_set_pred_flag(xd, bsize, PRED_MBSKIP, mi->mbmi.mb_skip_coeff);
vp9_set_pred_flag_mbskip(xd, bsize, mi->mbmi.mb_skip_coeff);
if (output_enabled) {
if (cm->txfm_mode == TX_MODE_SELECT && mbmi->sb_type >= BLOCK_SIZE_SB8X8
&& !(mbmi->ref_frame[0] != INTRA_FRAME
&& (mbmi->mb_skip_coeff
|| vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP)))) {
const int context = vp9_get_pred_context(cm, xd, PRED_TX_SIZE);
const int context = vp9_get_pred_context_tx_size(cm, xd);
if (bsize >= BLOCK_SIZE_SB32X32) {
cm->fc.tx_count_32x32p[context][mbmi->txfm_size]++;
} else if (bsize >= BLOCK_SIZE_MB16X16) {
......
......@@ -877,12 +877,12 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
vp9_prob skip_prob = vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
vp9_prob skip_prob = vp9_get_pred_prob_mbskip(cm, xd);
int64_t rd[TX_SIZE_MAX_SB][2];
int n, m;
int s0, s1;
const vp9_prob *tx_probs = vp9_get_pred_probs(cm, xd, PRED_TX_SIZE);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
for (n = TX_4X4; n <= max_txfm_size; n++) {
r[n][1] = r[n][0];
......@@ -981,14 +981,14 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
vp9_prob skip_prob = vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
vp9_prob skip_prob = vp9_get_pred_prob_mbskip(cm, xd);
int64_t rd[TX_SIZE_MAX_SB][2];
int n, m;
int s0, s1;
double scale_rd[TX_SIZE_MAX_SB] = {1.73, 1.44, 1.20, 1.00};
// double scale_r[TX_SIZE_MAX_SB] = {2.82, 2.00, 1.41, 1.00};
const vp9_prob *tx_probs = vp9_get_pred_probs(cm, xd, PRED_TX_SIZE);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
// for (n = TX_4X4; n <= max_txfm_size; n++)
// r[n][0] = (r[n][0] * scale_r[n]);
......@@ -2136,11 +2136,11 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
vpx_memset(ref_costs_comp, 0, MAX_REF_FRAMES * sizeof(*ref_costs_comp));
*comp_mode_p = 128;
} else {
vp9_prob intra_inter_p = vp9_get_pred_prob(cm, xd, PRED_INTRA_INTER);
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) {
comp_inter_p = vp9_get_pred_prob(cm, xd, PRED_COMP_INTER_INTER);
comp_inter_p = vp9_get_pred_prob_comp_inter_inter(cm, xd);
*comp_mode_p = comp_inter_p;
} else {
*comp_mode_p = 128;
......@@ -2149,8 +2149,8 @@ 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 != COMP_PREDICTION_ONLY) {
vp9_prob ref_single_p1 = vp9_get_pred_prob(cm, xd, PRED_SINGLE_REF_P1);
vp9_prob ref_single_p2 = vp9_get_pred_prob(cm, xd, PRED_SINGLE_REF_P2);
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)
......@@ -2169,7 +2169,7 @@ static void estimate_ref_frame_costs(VP9_COMP *cpi, int segment_id,
ref_costs_single[ALTREF_FRAME] = 512;
}
if (cm->comp_pred_mode != SINGLE_PREDICTION_ONLY) {
vp9_prob ref_comp_p = vp9_get_pred_prob(cm, xd, PRED_COMP_REF_P);
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)
......@@ -2305,7 +2305,7 @@ static INLINE int get_switchable_rate(VP9_COMMON *cm, MACROBLOCK *x) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
const int c = vp9_get_pred_context(cm, xd, PRED_SWITCHABLE_INTERP);
const int c = vp9_get_pred_context_switchable_interp(cm, xd);
const int m = vp9_switchable_interp_map[mbmi->interp_filter];
return SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs[c][m];
}
......@@ -2879,21 +2879,21 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (y_skip && uv_skip) {
*returnrate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly +
vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 1);
vp9_cost_bit(vp9_get_pred_prob_mbskip(cm, xd), 1);
*returndist = dist_y + (dist_uv >> 2);
memset(ctx->txfm_rd_diff, 0, sizeof(ctx->txfm_rd_diff));
xd->mode_info_context->mbmi.mode = mode;
xd->mode_info_context->mbmi.txfm_size = txfm_size;
} else if (bsize < BLOCK_SIZE_SB8X8 && err4x4 < err) {
*returnrate = rate4x4_y + rate_uv +
vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
vp9_cost_bit(vp9_get_pred_prob_mbskip(cm, xd), 0);
*returndist = dist4x4_y + (dist_uv >> 2);
vpx_memset(ctx->txfm_rd_diff, 0, sizeof(ctx->txfm_rd_diff));
xd->mode_info_context->mbmi.txfm_size = TX_4X4;
} else {
int i;
*returnrate = rate_y + rate_uv +
vp9_cost_bit(vp9_get_pred_prob(cm, xd, PRED_MBSKIP), 0);
vp9_cost_bit(vp9_get_pred_prob_mbskip(cm, xd), 0);
*returndist = dist_y + (dist_uv >> 2);
if (cpi->sf.tx_size_search_method == USE_FULL_RD) {
for (i = 0; i < NB_TXFM_MODES; i++) {
......@@ -3471,7 +3471,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// Cost the skip mb case
vp9_prob skip_prob =
vp9_get_pred_prob(cm, xd, PRED_MBSKIP);
vp9_get_pred_prob_mbskip(cm, xd);
if (skip_prob) {
prob_skip_cost = vp9_cost_bit(skip_prob, 1);
......@@ -3483,13 +3483,13 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
if (RDCOST(x->rdmult, x->rddiv, rate_y + rate_uv, distortion2) <
RDCOST(x->rdmult, x->rddiv, 0, total_sse)) {
// Add in the cost of the no skip flag.
int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob(cm, xd,
PRED_MBSKIP), 0);
int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob_mbskip(cm, xd),
0);
rate2 += prob_skip_cost;
} else {
// FIXME(rbultje) make this work for splitmv also
int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob(cm, xd,
PRED_MBSKIP), 1);
int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob_mbskip(cm, xd),
1);
rate2 += prob_skip_cost;
distortion2 = total_sse;
assert(total_sse >= 0);
......@@ -3500,8 +3500,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
} else if (mb_skip_allowed) {
// Add in the cost of the no skip flag.
int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob(cm, xd,
PRED_MBSKIP), 0);
int prob_skip_cost = vp9_cost_bit(vp9_get_pred_prob_mbskip(cm, xd),
0);
rate2 += prob_skip_cost;
}
......
......@@ -141,11 +141,11 @@ static void count_segs(VP9_COMP *cpi, MODE_INFO *mi,
const int pred_segment_id = vp9_get_segment_id(cm, cm->last_frame_seg_map,
bsize, mi_row, mi_col);
const int pred_flag = pred_segment_id == segment_id;
const int pred_context = vp9_get_pred_context(cm, xd, PRED_SEG_ID);
const int pred_context = vp9_get_pred_context_seg_id(cm, xd);
// Store the prediction status for this mb and update counts
// as appropriate
vp9_set_pred_flag(xd, bsize, PRED_SEG_ID, pred_flag);
vp9_set_pred_flag_seg_id(xd, bsize, pred_flag);
temporal_predictor_count[pred_context][pred_flag]++;
if (!pred_flag)
......
......@@ -273,7 +273,7 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
VP9_COMMON * const cm = &cpi->common;
MB_MODE_INFO * const mbmi = &xd->mode_info_context->mbmi;
TOKENEXTRA *t_backup = *t;
const int mb_skip_context = vp9_get_pred_context(cm, xd, PRED_MBSKIP);
const int mb_skip_context = vp9_get_pred_context_mbskip(cm, xd);
const int segment_id = mbmi->segment_id;
const int skip_inc = !vp9_segfeature_active(xd, segment_id, SEG_LVL_SKIP);
const TX_SIZE txfm_size = mbmi->txfm_size;
......
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