Commit 5b65a71c authored by Dmitry Kovalev's avatar Dmitry Kovalev

Changing signature of vp9_get_pred_probs_tx_size.

Removing VP9_COMMON* argument and adding struct tx_probs* instead of
MACROBLOCKD*.

Change-Id: Idf61074631a90ec51eac22c8dcd977f44ac0757c
parent f53d007b
......@@ -367,10 +367,9 @@ unsigned char vp9_get_pred_context_single_ref_p2(const VP9_COMMON *cm,
return pred_context;
}
// Returns a context number for the given MB prediction signal
unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD *xd) {
unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) {
const MODE_INFO *const mi = xd->mode_info_context;
const MODE_INFO *const above_mi = mi - cm->mode_info_stride;
const MODE_INFO *const above_mi = mi - xd->mode_info_stride;
const MODE_INFO *const left_mi = mi - 1;
const int left_in_image = xd->left_available && left_mi->mbmi.mb_in_image;
const int above_in_image = xd->up_available && above_mi->mbmi.mb_in_image;
......
......@@ -110,19 +110,18 @@ static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
return cm->fc.single_ref_prob[pred_context][1];
}
unsigned char vp9_get_pred_context_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD *xd);
unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd);
static INLINE const vp9_prob *vp9_get_pred_probs_tx_size(const VP9_COMMON *cm,
const MACROBLOCKD * xd) {
static const vp9_prob *vp9_get_pred_probs_tx_size(const MACROBLOCKD *xd,
const struct tx_probs *tx_probs) {
const MODE_INFO *const mi = xd->mode_info_context;
const int pred_context = vp9_get_pred_context_tx_size(cm, xd);
const int pred_context = vp9_get_pred_context_tx_size(xd);
if (mi->mbmi.sb_type < BLOCK_SIZE_MB16X16)
return cm->fc.tx_probs.p8x8[pred_context];
return tx_probs->p8x8[pred_context];
else if (mi->mbmi.sb_type < BLOCK_SIZE_SB32X32)
return cm->fc.tx_probs.p16x16[pred_context];
return tx_probs->p16x16[pred_context];
else
return cm->fc.tx_probs.p32x32[pred_context];
return tx_probs->p32x32[pred_context];
}
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
......@@ -50,8 +50,8 @@ static int read_segment_id(vp9_reader *r, const struct segmentation *seg) {
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_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
const int context = vp9_get_pred_context_tx_size(xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
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]);
......
......@@ -202,9 +202,9 @@ static void update_mbintra_mode_probs(VP9_COMP* const cpi,
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 VP9_COMMON *const cm = &cpi->common;
const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(c, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
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]);
......
......@@ -2386,7 +2386,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
!(mbmi->ref_frame[0] != INTRA_FRAME &&
(mbmi->mb_skip_coeff ||
vp9_segfeature_active(&xd->seg, segment_id, SEG_LVL_SKIP)))) {
const int context = vp9_get_pred_context_tx_size(cm, xd);
const int context = vp9_get_pred_context_tx_size(xd);
if (bsize >= BLOCK_SIZE_SB32X32) {
cm->fc.tx_counts.p32x32[context][mbmi->txfm_size]++;
} else if (bsize >= BLOCK_SIZE_MB16X16) {
......
......@@ -865,7 +865,7 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
int n, m;
int s0, s1;
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
for (n = TX_4X4; n <= max_txfm_size; n++) {
r[n][1] = r[n][0];
......@@ -972,7 +972,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
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_tx_size(cm, xd);
const vp9_prob *tx_probs = vp9_get_pred_probs_tx_size(xd, &cm->fc.tx_probs);
// for (n = TX_4X4; n <= max_txfm_size; n++)
// r[n][0] = (r[n][0] * scale_r[n]);
......
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