vp9_init_mbmode_probs(oci);
- oci->txfm_mode = ONLY_4X4;
+ oci->tx_mode = ONLY_4X4;
oci->comp_pred_mode = HYBRID_PREDICTION;
// Initialize reference frame sign bias structure to defaults
fc->switchable_interp_prob[i], 0);
}
- if (cm->txfm_mode == TX_MODE_SELECT) {
+ if (cm->tx_mode == TX_MODE_SELECT) {
int j;
unsigned int branch_ct_8x8p[TX_SIZE_MAX_SB - 3][2];
unsigned int branch_ct_16x16p[TX_SIZE_MAX_SB - 2][2];
TX_SIZE_MAX_SB, // Number of transforms available to SBs
} TX_SIZE;
+typedef enum {
+ ONLY_4X4 = 0,
+ ALLOW_8X8 = 1,
+ ALLOW_16X16 = 2,
+ ALLOW_32X32 = 3,
+ TX_MODE_SELECT = 4,
+ NB_TXFM_MODES = 5,
+} TX_MODE;
+
typedef enum {
DCT_DCT = 0, // DCT in both horizontal and vertical
ADST_DCT = 1, // ADST in vertical, DCT in horizontal
NB_PREDICTION_TYPES = 3,
} COMPPREDMODE_TYPE;
-typedef enum {
- ONLY_4X4 = 0,
- ALLOW_8X8 = 1,
- ALLOW_16X16 = 2,
- ALLOW_32X32 = 3,
- TX_MODE_SELECT = 4,
- NB_TXFM_MODES = 5,
-} TXFM_MODE;
-
typedef struct VP9Common {
struct vpx_internal_error_info error;
int mode_info_stride;
/* profile settings */
- TXFM_MODE txfm_mode;
+ TX_MODE tx_mode;
int base_qindex;
int last_kf_gf_q; /* Q used on the last GF or KF */
return txfm_size;
}
-static TX_SIZE read_txfm_size(VP9D_COMP *pbi, TXFM_MODE txfm_mode,
+static TX_SIZE read_txfm_size(VP9D_COMP *pbi, TX_MODE tx_mode,
BLOCK_SIZE_TYPE bsize, int select_cond,
vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
- if (txfm_mode == TX_MODE_SELECT && bsize >= BLOCK_SIZE_SB8X8 && select_cond)
+ if (tx_mode == TX_MODE_SELECT && bsize >= BLOCK_SIZE_SB8X8 && select_cond)
return read_selected_txfm_size(cm, xd, bsize, r);
- else if (txfm_mode >= ALLOW_32X32 && bsize >= BLOCK_SIZE_SB32X32)
+ else if (tx_mode >= ALLOW_32X32 && bsize >= BLOCK_SIZE_SB32X32)
return TX_32X32;
- else if (txfm_mode >= ALLOW_16X16 && bsize >= BLOCK_SIZE_MB16X16)
+ else if (tx_mode >= ALLOW_16X16 && bsize >= BLOCK_SIZE_MB16X16)
return TX_16X16;
- else if (txfm_mode >= ALLOW_8X8 && bsize >= BLOCK_SIZE_SB8X8)
+ else if (tx_mode >= ALLOW_8X8 && bsize >= BLOCK_SIZE_SB8X8)
return TX_8X8;
else
return TX_4X4;
mbmi->segment_id = read_intra_segment_id(pbi, mi_row, mi_col, r);
mbmi->mb_skip_coeff = read_skip_coeff(pbi, mbmi->segment_id, r);
- mbmi->txfm_size = read_txfm_size(pbi, cm->txfm_mode, bsize, 1, r);
+ mbmi->txfm_size = read_txfm_size(pbi, cm->tx_mode, bsize, 1, r);
mbmi->ref_frame[0] = INTRA_FRAME;
if (bsize >= BLOCK_SIZE_SB8X8) {
mbmi->mb_skip_coeff = read_skip_coeff(pbi, mbmi->segment_id, r);
mbmi->ref_frame[0] = read_reference_frame(pbi, mbmi->segment_id, r);
mbmi->ref_frame[1] = NONE;
- mbmi->txfm_size = read_txfm_size(pbi, cm->txfm_mode, bsize,
+ mbmi->txfm_size = read_txfm_size(pbi, cm->tx_mode, bsize,
(!mbmi->mb_skip_coeff || mbmi->ref_frame[0] == INTRA_FRAME), r);
if (mbmi->ref_frame[0] != INTRA_FRAME) {
return data > max ? max : data;
}
-static TXFM_MODE read_tx_mode(vp9_reader *r) {
- TXFM_MODE txfm_mode = vp9_read_literal(r, 2);
- if (txfm_mode == ALLOW_32X32)
- txfm_mode += vp9_read_bit(r);
- return txfm_mode;
+static TX_MODE read_tx_mode(vp9_reader *r) {
+ TX_MODE tx_mode = vp9_read_literal(r, 2);
+ if (tx_mode == ALLOW_32X32)
+ tx_mode += vp9_read_bit(r);
+ return tx_mode;
}
static void read_tx_probs(struct tx_probs *tx_probs, vp9_reader *r) {
vp9_diff_update_prob(r, &coef_probs[i][j][k][l][m]);
}
-static void read_coef_probs(FRAME_CONTEXT *fc, TXFM_MODE txfm_mode,
+static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode,
vp9_reader *r) {
read_coef_probs_common(fc->coef_probs[TX_4X4], r);
- if (txfm_mode > ONLY_4X4)
+ if (tx_mode > ONLY_4X4)
read_coef_probs_common(fc->coef_probs[TX_8X8], r);
- if (txfm_mode > ALLOW_8X8)
+ if (tx_mode > ALLOW_8X8)
read_coef_probs_common(fc->coef_probs[TX_16X16], r);
- if (txfm_mode > ALLOW_16X16)
+ if (tx_mode > ALLOW_16X16)
read_coef_probs_common(fc->coef_probs[TX_32X32], r);
}
vpx_internal_error(&cm->error, VPX_CODEC_MEM_ERROR,
"Failed to allocate bool decoder 0");
- cm->txfm_mode = xd->lossless ? ONLY_4X4 : read_tx_mode(&r);
- if (cm->txfm_mode == TX_MODE_SELECT)
+ cm->tx_mode = xd->lossless ? ONLY_4X4 : read_tx_mode(&r);
+ if (cm->tx_mode == TX_MODE_SELECT)
read_tx_probs(&cm->fc.tx_probs, &r);
- read_coef_probs(&cm->fc, cm->txfm_mode, &r);
+ read_coef_probs(&cm->fc, cm->tx_mode, &r);
vp9_prepare_read_mode_info(pbi, &r);
vp9_write(bc, rf != INTRA_FRAME,
vp9_get_pred_prob_intra_inter(pc, xd));
- if (mi->sb_type >= BLOCK_SIZE_SB8X8 && pc->txfm_mode == TX_MODE_SELECT &&
+ if (mi->sb_type >= BLOCK_SIZE_SB8X8 && pc->tx_mode == TX_MODE_SELECT &&
!(rf != INTRA_FRAME &&
(skip_coeff || vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP)))) {
write_selected_txfm_size(cpi, mi->txfm_size, mi->sb_type, bc);
write_skip_coeff(cpi, segment_id, m, bc);
- if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8 && c->txfm_mode == TX_MODE_SELECT)
+ if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8 && c->tx_mode == TX_MODE_SELECT)
write_selected_txfm_size(cpi, m->mbmi.txfm_size, m->mbmi.sb_type, bc);
if (m->mbmi.sb_type >= BLOCK_SIZE_SB8X8) {
}
static void update_coef_probs(VP9_COMP* const cpi, vp9_writer* const bc) {
- const TXFM_MODE txfm_mode = cpi->common.txfm_mode;
+ const TX_MODE tx_mode = cpi->common.tx_mode;
vp9_clear_system_state();
update_coef_probs_common(bc, cpi, TX_4X4);
// do not do this if not even allowed
- if (txfm_mode > ONLY_4X4)
+ if (tx_mode > ONLY_4X4)
update_coef_probs_common(bc, cpi, TX_8X8);
- if (txfm_mode > ALLOW_8X8)
+ if (tx_mode > ALLOW_8X8)
update_coef_probs_common(bc, cpi, TX_16X16);
- if (txfm_mode > ALLOW_16X16)
+ if (tx_mode > ALLOW_16X16)
update_coef_probs_common(bc, cpi, TX_32X32);
}
VP9_COMMON *const cm = &cpi->common;
// Mode
- vp9_write_literal(w, MIN(cm->txfm_mode, ALLOW_32X32), 2);
- if (cm->txfm_mode >= ALLOW_32X32)
- vp9_write_bit(w, cm->txfm_mode == TX_MODE_SELECT);
+ vp9_write_literal(w, MIN(cm->tx_mode, ALLOW_32X32), 2);
+ if (cm->tx_mode >= ALLOW_32X32)
+ vp9_write_bit(w, cm->tx_mode == TX_MODE_SELECT);
// Probabilities
- if (cm->txfm_mode == TX_MODE_SELECT) {
+ if (cm->tx_mode == TX_MODE_SELECT) {
int i, j;
unsigned int ct_8x8p[TX_SIZE_MAX_SB - 3][2];
unsigned int ct_16x16p[TX_SIZE_MAX_SB - 2][2];
vp9_start_encode(&header_bc, data);
if (xd->lossless)
- cm->txfm_mode = ONLY_4X4;
+ cm->tx_mode = ONLY_4X4;
else
encode_txfm_probs(cpi, &header_bc);
cpi->mb.optimize = 0;
cpi->common.filter_level = 0;
cpi->zbin_mode_boost_enabled = 0;
- cpi->common.txfm_mode = ONLY_4X4;
+ cpi->common.tx_mode = ONLY_4X4;
} else {
// printf("Not lossless\n");
cpi->mb.fwd_txm8x4 = vp9_short_fdct8x4;
}
}
-static void switch_txfm_mode(VP9_COMP *cpi) {
+static void switch_tx_mode(VP9_COMP *cpi) {
if (cpi->sf.tx_size_search_method == USE_LARGESTALL &&
- cpi->common.txfm_mode >= ALLOW_32X32)
- cpi->common.txfm_mode = ALLOW_32X32;
+ cpi->common.tx_mode >= ALLOW_32X32)
+ cpi->common.tx_mode = ALLOW_32X32;
}
static void encode_frame_internal(VP9_COMP *cpi) {
vp9_initialize_rd_consts(cpi, cm->base_qindex + cm->y_dc_delta_q);
vp9_initialize_me_consts(cpi, cm->base_qindex);
- switch_txfm_mode(cpi);
+ switch_tx_mode(cpi);
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) {
// Initialize encode frame context.
return frame_type;
}
-static void select_txfm_mode(VP9_COMP *cpi) {
+static void select_tx_mode(VP9_COMP *cpi) {
if (cpi->oxcf.lossless) {
- cpi->common.txfm_mode = ONLY_4X4;
+ cpi->common.tx_mode = ONLY_4X4;
} else if (cpi->common.current_video_frame == 0) {
- cpi->common.txfm_mode = TX_MODE_SELECT;
+ cpi->common.tx_mode = TX_MODE_SELECT;
} else {
if (cpi->sf.tx_size_search_method == USE_LARGESTALL) {
- cpi->common.txfm_mode = ALLOW_32X32;
+ cpi->common.tx_mode = ALLOW_32X32;
} else if (cpi->sf.tx_size_search_method == USE_FULL_RD) {
int frame_type = get_frame_type(cpi);
- cpi->common.txfm_mode =
+ cpi->common.tx_mode =
cpi->rd_tx_select_threshes[frame_type][ALLOW_32X32]
> cpi->rd_tx_select_threshes[frame_type][TX_MODE_SELECT] ?
ALLOW_32X32 : TX_MODE_SELECT;
total += cpi->txfm_stepdown_count[i];
if (total) {
double fraction = (double)cpi->txfm_stepdown_count[0] / total;
- cpi->common.txfm_mode = fraction > 0.90 ? ALLOW_32X32 : TX_MODE_SELECT;
+ cpi->common.tx_mode = fraction > 0.90 ? ALLOW_32X32 : TX_MODE_SELECT;
// printf("fraction = %f\n", fraction);
} // else keep unchanged
}
cpi->mb.e_mbd.lossless = 1;
}
- select_txfm_mode(cpi);
+ select_tx_mode(cpi);
cpi->common.comp_pred_mode = pred_type;
cpi->common.mcomp_filter_type = filter_type;
encode_frame_internal(cpi);
}
}
- if (cpi->common.txfm_mode == TX_MODE_SELECT) {
+ if (cpi->common.tx_mode == TX_MODE_SELECT) {
int count4x4 = 0;
int count8x8_lp = 0, count8x8_8x8p = 0;
int count16x16_16x16p = 0, count16x16_lp = 0;
if (count4x4 == 0 && count16x16_lp == 0 && count16x16_16x16p == 0
&& count32x32 == 0) {
- cpi->common.txfm_mode = ALLOW_8X8;
+ cpi->common.tx_mode = ALLOW_8X8;
reset_skip_txfm_size(cpi, TX_8X8);
} else if (count8x8_8x8p == 0 && count16x16_16x16p == 0
&& count8x8_lp == 0 && count16x16_lp == 0 && count32x32 == 0) {
- cpi->common.txfm_mode = ONLY_4X4;
+ cpi->common.tx_mode = ONLY_4X4;
reset_skip_txfm_size(cpi, TX_4X4);
} else if (count8x8_lp == 0 && count16x16_lp == 0 && count4x4 == 0) {
- cpi->common.txfm_mode = ALLOW_32X32;
+ cpi->common.tx_mode = ALLOW_32X32;
} else if (count32x32 == 0 && count8x8_lp == 0 && count4x4 == 0) {
- cpi->common.txfm_mode = ALLOW_16X16;
+ cpi->common.tx_mode = ALLOW_16X16;
reset_skip_txfm_size(cpi, TX_16X16);
}
}
vp9_set_pred_flag_mbskip(cm, bsize, mi_row, mi_col, mi->mbmi.mb_skip_coeff);
if (output_enabled) {
- if (cm->txfm_mode == TX_MODE_SELECT &&
+ if (cm->tx_mode == TX_MODE_SELECT &&
mbmi->sb_type >= BLOCK_SIZE_SB8X8 &&
!(mbmi->ref_frame[0] != INTRA_FRAME &&
(mbmi->mb_skip_coeff ||
}
} else {
int x, y;
- TX_SIZE sz = (cm->txfm_mode == TX_MODE_SELECT) ? TX_32X32 : cm->txfm_mode;
+ TX_SIZE sz = (cm->tx_mode == TX_MODE_SELECT) ? TX_32X32 : cm->tx_mode;
// The new intra coding scheme requires no change of transform size
if (mi->mbmi.ref_frame[0] != INTRA_FRAME) {
if (sz == TX_32X32 && bsize < BLOCK_SIZE_SB32X32)
Bias = Bias * cpi->twopass.section_intra_rating / 20;
// yx, bias less for large block size
- if (cpi->common.txfm_mode != ONLY_4X4)
+ if (cpi->common.tx_mode != ONLY_4X4)
Bias >>= 1;
filt_high = ((filt_mid + filter_step) > max_filter_level) ? max_filter_level : (filt_mid + filter_step);
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
if (max_txfm_size == TX_32X32 &&
- (cm->txfm_mode == ALLOW_32X32 ||
- cm->txfm_mode == TX_MODE_SELECT)) {
+ (cm->tx_mode == ALLOW_32X32 ||
+ cm->tx_mode == TX_MODE_SELECT)) {
mbmi->txfm_size = TX_32X32;
} else if (max_txfm_size >= TX_16X16 &&
- (cm->txfm_mode == ALLOW_16X16 ||
- cm->txfm_mode == ALLOW_32X32 ||
- cm->txfm_mode == TX_MODE_SELECT)) {
+ (cm->tx_mode == ALLOW_16X16 ||
+ cm->tx_mode == ALLOW_32X32 ||
+ cm->tx_mode == TX_MODE_SELECT)) {
mbmi->txfm_size = TX_16X16;
- } else if (cm->txfm_mode != ONLY_4X4) {
+ } else if (cm->tx_mode != ONLY_4X4) {
mbmi->txfm_size = TX_8X8;
} else {
mbmi->txfm_size = TX_4X4;
}
if (max_txfm_size == TX_32X32 &&
- (cm->txfm_mode == ALLOW_32X32 ||
- (cm->txfm_mode == TX_MODE_SELECT &&
+ (cm->tx_mode == ALLOW_32X32 ||
+ (cm->tx_mode == TX_MODE_SELECT &&
rd[TX_32X32][1] < rd[TX_16X16][1] && rd[TX_32X32][1] < rd[TX_8X8][1] &&
rd[TX_32X32][1] < rd[TX_4X4][1]))) {
mbmi->txfm_size = TX_32X32;
} else if (max_txfm_size >= TX_16X16 &&
- (cm->txfm_mode == ALLOW_16X16 ||
- cm->txfm_mode == ALLOW_32X32 ||
- (cm->txfm_mode == TX_MODE_SELECT &&
+ (cm->tx_mode == ALLOW_16X16 ||
+ cm->tx_mode == ALLOW_32X32 ||
+ (cm->tx_mode == TX_MODE_SELECT &&
rd[TX_16X16][1] < rd[TX_8X8][1] &&
rd[TX_16X16][1] < rd[TX_4X4][1]))) {
mbmi->txfm_size = TX_16X16;
- } else if (cm->txfm_mode == ALLOW_8X8 ||
- cm->txfm_mode == ALLOW_16X16 ||
- cm->txfm_mode == ALLOW_32X32 ||
- (cm->txfm_mode == TX_MODE_SELECT && rd[TX_8X8][1] < rd[TX_4X4][1])) {
+ } else if (cm->tx_mode == ALLOW_8X8 ||
+ cm->tx_mode == ALLOW_16X16 ||
+ cm->tx_mode == ALLOW_32X32 ||
+ (cm->tx_mode == TX_MODE_SELECT && rd[TX_8X8][1] < rd[TX_4X4][1])) {
mbmi->txfm_size = TX_8X8;
} else {
mbmi->txfm_size = TX_4X4;
}
*distortion = d[mbmi->txfm_size];
- *rate = r[mbmi->txfm_size][cm->txfm_mode == TX_MODE_SELECT];
+ *rate = r[mbmi->txfm_size][cm->tx_mode == TX_MODE_SELECT];
*skip = s[mbmi->txfm_size];
txfm_cache[ONLY_4X4] = rd[TX_4X4][0];
}
if (max_txfm_size == TX_32X32 &&
- (cm->txfm_mode == ALLOW_32X32 ||
- (cm->txfm_mode == TX_MODE_SELECT &&
+ (cm->tx_mode == ALLOW_32X32 ||
+ (cm->tx_mode == TX_MODE_SELECT &&
rd[TX_32X32][1] <= rd[TX_16X16][1] &&
rd[TX_32X32][1] <= rd[TX_8X8][1] &&
rd[TX_32X32][1] <= rd[TX_4X4][1]))) {
mbmi->txfm_size = TX_32X32;
} else if (max_txfm_size >= TX_16X16 &&
- (cm->txfm_mode == ALLOW_16X16 ||
- cm->txfm_mode == ALLOW_32X32 ||
- (cm->txfm_mode == TX_MODE_SELECT &&
+ (cm->tx_mode == ALLOW_16X16 ||
+ cm->tx_mode == ALLOW_32X32 ||
+ (cm->tx_mode == TX_MODE_SELECT &&
rd[TX_16X16][1] <= rd[TX_8X8][1] &&
rd[TX_16X16][1] <= rd[TX_4X4][1]))) {
mbmi->txfm_size = TX_16X16;
- } else if (cm->txfm_mode == ALLOW_8X8 ||
- cm->txfm_mode == ALLOW_16X16 ||
- cm->txfm_mode == ALLOW_32X32 ||
- (cm->txfm_mode == TX_MODE_SELECT &&
+ } else if (cm->tx_mode == ALLOW_8X8 ||
+ cm->tx_mode == ALLOW_16X16 ||
+ cm->tx_mode == ALLOW_32X32 ||
+ (cm->tx_mode == TX_MODE_SELECT &&
rd[TX_8X8][1] <= rd[TX_4X4][1])) {
mbmi->txfm_size = TX_8X8;
} else {
bs, mbmi->txfm_size);
} else {
*distortion = d[mbmi->txfm_size];
- *rate = r[mbmi->txfm_size][cm->txfm_mode == TX_MODE_SELECT];
+ *rate = r[mbmi->txfm_size][cm->tx_mode == TX_MODE_SELECT];
*skip = s[mbmi->txfm_size];
}
if (cpi->sf.tx_size_search_method == USE_FULL_RD && this_rd < INT64_MAX) {
for (i = 0; i < NB_TXFM_MODES; i++) {
int64_t adj_rd = this_rd + local_txfm_cache[i] -
- local_txfm_cache[cpi->common.txfm_mode];
+ local_txfm_cache[cpi->common.tx_mode];
if (adj_rd < txfm_cache[i]) {
txfm_cache[i] = adj_rd;
}
*returndist = dist_y + (dist_uv >> 2);
if (cpi->sf.tx_size_search_method == USE_FULL_RD) {
for (i = 0; i < NB_TXFM_MODES; i++) {
- ctx->txfm_rd_diff[i] = txfm_cache[i] - txfm_cache[cm->txfm_mode];
+ ctx->txfm_rd_diff[i] = txfm_cache[i] - txfm_cache[cm->tx_mode];
}
}
}
for (i = 0; i < NB_TXFM_MODES; i++) {
int64_t adj_rd = INT64_MAX;
if (this_mode != I4X4_PRED) {
- adj_rd = this_rd + txfm_cache[i] - txfm_cache[cm->txfm_mode];
+ adj_rd = this_rd + txfm_cache[i] - txfm_cache[cm->tx_mode];
} else {
adj_rd = this_rd;
}