static void set_param_topblock(VP10_COMMON *const cm, MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
-#if CONFIG_EXT_TX
int txfm,
-#endif
int skip) {
const int bw = num_8x8_blocks_wide_lookup[bsize];
const int bh = num_8x8_blocks_high_lookup[bsize];
for (y = 0; y < y_mis; ++y)
for (x = 0; x < x_mis; ++x) {
xd->mi[y * cm->mi_stride + x]->mbmi.skip = skip;
-#if CONFIG_EXT_TX
xd->mi[y * cm->mi_stride + x]->mbmi.tx_type = txfm;
-#endif
}
#if CONFIG_VAR_TX
xd->above_txfm_context = cm->above_txfm_context + mi_col;
int skip = 0;
TX_SIZE supertx_size = b_width_log2_lookup[bsize];
const TileInfo *const tile = &xd->tile;
-#if CONFIG_EXT_TX
int txfm = DCT_DCT;
-#endif // CONFIG_EXT_TX
#endif // CONFIG_SUPERTX
if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols)
set_skip_context(xd, mi_row, mi_col);
// Here skip is read without using any segment level feature
skip = read_skip_without_seg(cm, xd, r);
- if (skip)
+ if (skip) {
reset_skip_context(xd, bsize);
+ } else {
#if CONFIG_EXT_TX
- if (!skip) {
if (get_ext_tx_types(supertx_size, bsize, 1) > 1) {
int eset = get_ext_tx_set(supertx_size, bsize, 1);
if (eset > 0) {
++xd->counts->inter_ext_tx[eset][supertx_size][txfm];
}
}
- }
+#else
+ if (supertx_size < TX_32X32) {
+ txfm = vpx_read_tree(r, vp10_ext_tx_tree,
+ cm->fc->inter_ext_tx_prob[supertx_size]);
+ if (xd->counts)
+ ++xd->counts->inter_ext_tx[supertx_size][txfm];
+ }
#endif // CONFIG_EXT_TX
+ }
}
#endif // CONFIG_SUPERTX
if (!hbs) {
int eobtotal = 0;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
set_offsets_topblock(cm, xd, tile, bsize, mi_row, mi_col);
-#if CONFIG_EXT_TX
xd->mi[0]->mbmi.tx_type = txfm;
-#endif
for (i = 0; i < MAX_MB_PLANE; ++i) {
const struct macroblockd_plane *const pd = &xd->plane[i];
const int num_4x4_w = pd->n4_w;
if (!(subsize < BLOCK_8X8) && eobtotal == 0)
skip = 1;
}
- set_param_topblock(cm, xd, bsize, mi_row, mi_col,
-#if CONFIG_EXT_TX
- txfm,
-#endif
- skip);
+ set_param_topblock(cm, xd, bsize, mi_row, mi_col, txfm, skip);
}
#endif // CONFIG_SUPERTX
}
}
}
+
#else
+
static void read_ext_tx_probs(FRAME_CONTEXT *fc, vpx_reader *r) {
int i, j, k;
if (vpx_read(r, GROUP_DIFF_UPDATE_PROB)) {
}
}
}
-
#endif // CONFIG_EXT_TX
#if CONFIG_SUPERTX
const TileInfo *const tile,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int *tmp_rate, int64_t *tmp_dist,
-#if CONFIG_EXT_TX
TX_TYPE *best_tx,
-#endif
PC_TREE *pc_tree);
#endif // CONFIG_SUPERTX
static void update_supertx_param(ThreadData *td,
PICK_MODE_CONTEXT *ctx,
-#if CONFIG_EXT_TX
int best_tx,
-#endif
TX_SIZE supertx_size) {
MACROBLOCK *const x = &td->mb;
memcpy(ctx->zcoeff_blk, x->zcoeff_blk[supertx_size],
sizeof(uint8_t) * ctx->num_4x4_blk);
ctx->skip = x->skip;
-#if CONFIG_EXT_TX
ctx->mic.mbmi.tx_type = best_tx;
-#endif // CONFIG_EXT_TX
}
static void update_supertx_param_sb(VP10_COMP *cpi, ThreadData *td,
int mi_row, int mi_col,
BLOCK_SIZE bsize,
-#if CONFIG_EXT_TX
int best_tx,
-#endif
TX_SIZE supertx_size, PC_TREE *pc_tree) {
VP10_COMMON *const cm = &cpi->common;
int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
switch (partition) {
case PARTITION_NONE:
update_supertx_param(td, &pc_tree->none,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size);
break;
case PARTITION_VERT:
update_supertx_param(td, &pc_tree->vertical[0],
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size);
if (mi_col + hbs < cm->mi_cols && bsize > BLOCK_8X8)
update_supertx_param(td, &pc_tree->vertical[1],
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size);
break;
case PARTITION_HORZ:
update_supertx_param(td, &pc_tree->horizontal[0],
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size);
if (mi_row + hbs < cm->mi_rows && bsize > BLOCK_8X8)
update_supertx_param(td, &pc_tree->horizontal[1],
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size);
break;
case PARTITION_SPLIT:
if (bsize == BLOCK_8X8) {
update_supertx_param(td, pc_tree->leaf_split[0],
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size);
} else {
update_supertx_param_sb(cpi, td, mi_row, mi_col, subsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree->split[0]);
update_supertx_param_sb(cpi, td, mi_row, mi_col + hbs, subsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree->split[1]);
update_supertx_param_sb(cpi, td, mi_row + hbs, mi_col, subsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree->split[2]);
update_supertx_param_sb(cpi, td, mi_row + hbs, mi_col + hbs, subsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree->split[3]);
}
break;
[xd->mi[0]->mbmi.tx_type];
}
}
+#else
+ if (supertx_size < TX_32X32 &&
+ !xd->mi[0]->mbmi.skip) {
+ ++td->counts->inter_ext_tx[supertx_size][xd->mi[0]->mbmi.tx_type];
+ }
#endif // CONFIG_EXT_TX
}
if (partition != PARTITION_SPLIT || bsize == BLOCK_8X8)
sum_rdc.rdcost =
RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (is_inter_mode(pc_tree->leaf_split[0]->mic.mbmi.mode)) {
-#if CONFIG_EXT_TX
TX_TYPE best_tx = DCT_DCT;
-#endif
-
tmp_rate = sum_rate_nocoef;
tmp_dist = 0;
#if CONFIG_VAR_TX
#endif // CONFIG_VAR_TX
rd_supertx_sb(cpi, td, tile_info, mi_row, mi_col, bsize,
&tmp_rate, &tmp_dist,
-#if CONFIG_EXT_TX
&best_tx,
-#endif
pc_tree);
tmp_rate += vp10_cost_bit(
sum_rdc.rate = tmp_rate;
sum_rdc.dist = tmp_dist;
update_supertx_param_sb(cpi, td, mi_row, mi_col, bsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree);
}
}
RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
-#if CONFIG_EXT_TX
TX_TYPE best_tx = DCT_DCT;
-#endif
tmp_rate = sum_rate_nocoef;
tmp_dist = 0;
#endif // CONFIG_VAR_TX
rd_supertx_sb(cpi, td, tile_info, mi_row, mi_col, bsize,
&tmp_rate, &tmp_dist,
-#if CONFIG_EXT_TX
&best_tx,
-#endif
pc_tree);
tmp_rate += vp10_cost_bit(
sum_rdc.rate = tmp_rate;
sum_rdc.dist = tmp_dist;
update_supertx_param_sb(cpi, td, mi_row, mi_col, bsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree);
}
}
sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
-#if CONFIG_EXT_TX
TX_TYPE best_tx = DCT_DCT;
-#endif
-
tmp_rate = sum_rate_nocoef;
tmp_dist = 0;
#if CONFIG_VAR_TX
#endif // CONFIG_VAR_TX
rd_supertx_sb(cpi, td, tile_info, mi_row, mi_col, bsize,
&tmp_rate, &tmp_dist,
-#if CONFIG_EXT_TX
&best_tx,
-#endif
pc_tree);
tmp_rate += vp10_cost_bit(
sum_rdc.rate = tmp_rate;
sum_rdc.dist = tmp_dist;
update_supertx_param_sb(cpi, td, mi_row, mi_col, bsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree);
}
}
sum_rdc.rdcost = RDCOST(x->rdmult, x->rddiv, sum_rdc.rate, sum_rdc.dist);
if (!check_intra_sb(cpi, tile_info, mi_row, mi_col, bsize, pc_tree)) {
-#if CONFIG_EXT_TX
TX_TYPE best_tx = DCT_DCT;
-#endif
tmp_rate = sum_rate_nocoef;
tmp_dist = 0;
#endif // CONFIG_VAR_TX
rd_supertx_sb(cpi, td, tile_info, mi_row, mi_col, bsize,
&tmp_rate, &tmp_dist,
-#if CONFIG_EXT_TX
&best_tx,
-#endif
pc_tree);
tmp_rate += vp10_cost_bit(
sum_rdc.rate = tmp_rate;
sum_rdc.dist = tmp_dist;
update_supertx_param_sb(cpi, td, mi_row, mi_col, bsize,
-#if CONFIG_EXT_TX
best_tx,
-#endif
supertx_size, pc_tree);
}
}
const TileInfo *const tile,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int *tmp_rate, int64_t *tmp_dist,
-#if CONFIG_EXT_TX
TX_TYPE *best_tx,
-#endif // CONFIG_EXT_TX
PC_TREE *pc_tree) {
VP10_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &td->mb;
uint8_t *dst_buf[3];
int dst_stride[3];
TX_SIZE tx_size;
-#if CONFIG_EXT_TX
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
TX_TYPE tx_type, best_tx_nostx = xd->mi[0]->mbmi.tx_type;
+#if CONFIG_EXT_TX
int ext_tx_set;
+#endif // CONFIG_EXT_TX
int tmp_rate_tx = 0, skip_tx = 0;
int64_t tmp_dist_tx = 0, rd_tx, bestrd_tx = INT64_MAX;
uint8_t tmp_zcoeff_blk = 0;
-#endif // CONFIG_EXT_TX
update_state_sb_supertx(cpi, td, tile, mi_row, mi_col, bsize, 0, pc_tree);
vp10_setup_dst_planes(xd->plane, get_frame_new_buffer(cm),
0, bsize, bsize, dst_buf, dst_stride, pc_tree);
set_offsets(cpi, tile, x, mi_row, mi_col, bsize);
-#if CONFIG_EXT_TX
*best_tx = DCT_DCT;
-#endif
// chroma
skippable_uv = 1;
vp10_subtract_plane(x, bsize, 0);
#if CONFIG_EXT_TX
ext_tx_set = get_ext_tx_set(tx_size, bsize, 1);
+#endif // CONFIG_EXT_TX
for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) {
+#if CONFIG_EXT_TX
if (!ext_tx_used_inter[ext_tx_set][tx_type])
continue;
- mbmi->tx_type = tx_type;
if (ext_tx_set == 1 &&
- mbmi->tx_type >= DST_ADST && mbmi->tx_type < IDTX &&
- *best_tx == DCT_DCT) {
+ tx_type >= DST_ADST && tx_type < IDTX && *best_tx == DCT_DCT) {
tx_type = IDTX - 1;
- break;
+ continue;
}
+#else
+ if (tx_size >= TX_32X32 && tx_type != DCT_DCT)
+ continue;
+#endif // CONFIG_EXT_TX
+ mbmi->tx_type = tx_type;
vp10_txfm_rd_in_plane_supertx(x,
#if CONFIG_VAR_TX
cpi,
#endif
&this_rate, &this_dist, &pnskip,
&pnsse, INT64_MAX, 0, bsize, tx_size, 0);
+
+#if CONFIG_EXT_TX
if (get_ext_tx_types(tx_size, bsize, 1) > 1 &&
!xd->lossless[xd->mi[0]->mbmi.segment_id] &&
this_rate != INT_MAX) {
this_rate += cpi->inter_tx_type_costs[ext_tx_set]
[mbmi->tx_size][mbmi->tx_type];
}
+#else
+ if (tx_size < TX_32X32 &&
+ !xd->lossless[xd->mi[0]->mbmi.segment_id] &&
+ this_rate != INT_MAX) {
+ this_rate += cpi->inter_tx_type_costs[mbmi->tx_size][mbmi->tx_type];
+ }
+#endif // CONFIG_EXT_TX
*tmp_rate = rate_uv + this_rate;
*tmp_dist = dist_uv + this_dist;
sse = sse_uv + pnsse;
*tmp_dist = tmp_dist_tx;
x->skip = skip_tx;
xd->mi[0]->mbmi.tx_type = best_tx_nostx;
-
-#else // CONFIG_EXT_TX
-
- vp10_txfm_rd_in_plane_supertx(x,
-#if CONFIG_VAR_TX
- cpi,
-#endif
- &this_rate, &this_dist, &pnskip, &pnsse,
- INT64_MAX, 0, bsize, tx_size, 0);
- *tmp_rate = rate_uv + this_rate;
- *tmp_dist = dist_uv + this_dist;
- sse = sse_uv + pnsse;
- skippable = skippable_uv && pnskip;
- if (skippable) {
- *tmp_rate = vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
- x->skip = 1;
- } else {
- if (RDCOST(x->rdmult, x->rddiv, *tmp_rate, *tmp_dist)
- < RDCOST(x->rdmult, x->rddiv, 0, sse)) {
- *tmp_rate += vp10_cost_bit(vp10_get_skip_prob(cm, xd), 0);
- x->skip = 0;
- } else {
- *tmp_dist = sse;
- *tmp_rate = vp10_cost_bit(vp10_get_skip_prob(cm, xd), 1);
- x->skip = 1;
- }
- }
- *tmp_rate += base_rate;
-#endif // CONFIG_EXT_TX
}
#endif // CONFIG_SUPERTX
EXT_INTRA_MODE mode;
TX_SIZE best_tx_size = TX_4X4;
EXT_INTRA_MODE_INFO ext_intra_mode_info;
-#if CONFIG_EXT_TX
TX_TYPE best_tx_type;
-#endif // CONFIG_EXT_TX
vp10_zero(ext_intra_mode_info);
mbmi->ext_intra_mode_info.use_ext_intra_mode[0] = 1;
*best_rd = this_rd;
best_tx_size = mic->mbmi.tx_size;
ext_intra_mode_info = mbmi->ext_intra_mode_info;
-#if CONFIG_EXT_TX
best_tx_type = mic->mbmi.tx_type;
-#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
ext_intra_mode_info.use_ext_intra_mode[0];
mbmi->ext_intra_mode_info.ext_intra_mode[0] =
ext_intra_mode_info.ext_intra_mode[0];
-#if CONFIG_EXT_TX
mbmi->tx_type = best_tx_type;
-#endif // CONFIG_EXT_TX
return 1;
} else {
return 0;
const double rd_adjust = 1.2;
int64_t this_distortion, this_rd, sse_dummy;
TX_SIZE best_tx_size = mic->mbmi.tx_size;
-#if CONFIG_EXT_TX
TX_TYPE best_tx_type = mbmi->tx_type;
-#endif // CONFIG_EXT_TX
if (ANGLE_FAST_SEARCH) {
int deltas_level1[3] = {0, -2, 2};
best_rd = this_rd;
best_angle_delta = mbmi->angle_delta[0];
best_tx_size = mbmi->tx_size;
-#if CONFIG_EXT_TX
best_tx_type = mbmi->tx_type;
-#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
best_rd = this_rd;
best_angle_delta = mbmi->angle_delta[0];
best_tx_size = mbmi->tx_size;
-#if CONFIG_EXT_TX
best_tx_type = mbmi->tx_type;
-#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
best_rd = this_rd;
best_angle_delta = mbmi->angle_delta[0];
best_tx_size = mbmi->tx_size;
-#if CONFIG_EXT_TX
best_tx_type = mbmi->tx_type;
-#endif // CONFIG_EXT_TX
*rate = this_rate;
*rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion;
mbmi->tx_size = best_tx_size;
mbmi->angle_delta[0] = best_angle_delta;
-#if CONFIG_EXT_TX
mbmi->tx_type = best_tx_type;
-#endif // CONFIG_EXT_TX
if (*rate_tokenonly < INT_MAX) {
txfm_rd_in_plane(x,
vp10_subtract_plane(x, bsize, 0);
#if CONFIG_VAR_TX
if (cm->tx_mode == TX_MODE_SELECT || xd->lossless[mbmi->segment_id]) {
+#if CONFIG_EXT_TX
select_tx_type_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
+#else
+ inter_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
+ bsize, ref_best_rd);
+#endif // CONFIG_EXT_TX
} else {
int idx, idy;
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
#else
super_block_yrd(cpi, x, rate_y, &distortion_y, &skippable_y, psse,
bsize, ref_best_rd);
-#endif
+#endif // CONFIG_VAR_TX
if (*rate_y == INT_MAX) {
*rate2 = INT_MAX;
#else
if (!super_block_uvrd(cpi, x, rate_uv, &distortion_uv, &skippable_uv,
&sseuv, bsize, ref_best_rd - rdcosty)) {
-#endif
+#endif // CONFIG_VAR_TX
*rate2 = INT_MAX;
*distortion = INT64_MAX;
restore_dst_buf(xd, orig_dst, orig_dst_stride);