Commit cd9b03fb authored by Angie Chiang's avatar Angie Chiang

Add txk_sel exp

This will separate the transform kernel selection from lv_map
experiment such that we can evaluate each feature's performance
separately

Note that txk_sel is build on top of lv_map

Change-Id: I5bd1ea99be30000efcdc2bcd42de002b78b1c3c8
parent f6c807c5
......@@ -324,7 +324,7 @@ typedef struct {
#endif
MV_REFERENCE_FRAME ref_frame[2];
TX_TYPE tx_type;
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
TX_TYPE txk_type[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
#endif
......@@ -906,7 +906,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
int block, TX_SIZE tx_size) {
const MODE_INFO *const mi = xd->mi[0];
const MB_MODE_INFO *const mbmi = &mi->mbmi;
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
const int block_raster_idx = av1_block_index_to_raster_order(tx_size, block);
if (FIXED_TX_TYPE)
return get_default_tx_type(plane_type, xd, block_raster_idx, tx_size);
......@@ -955,7 +955,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
return DCT_DCT;
return mbmi->tx_type;
#endif // CONFIG_EXT_TX
#else // !CONFIG_LV_MAP
#else // !CONFIG_TXK_SEL
(void)tx_size;
TX_TYPE tx_type;
if (plane_type != PLANE_TYPE_Y || xd->lossless[mbmi->segment_id] ||
......@@ -966,7 +966,7 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type, const MACROBLOCKD *xd,
}
assert(tx_type >= DCT_DCT && tx_type < TX_TYPES);
return tx_type;
#endif // !CONFIG_LV_MAP
#endif // !CONFIG_TXK_SEL
}
void av1_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y);
......
......@@ -743,7 +743,7 @@ void av1_read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if CONFIG_SUPERTX
int supertx_enabled,
#endif
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
int block, int plane,
#endif
aom_reader *r) {
......@@ -760,7 +760,7 @@ void av1_read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
TX_TYPE *tx_type = &mbmi->tx_type;
#else
// only y plane's tx_type is transmitted
......@@ -980,13 +980,13 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
read_filter_intra_mode_info(cm, xd, r);
#endif // CONFIG_FILTER_INTRA
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
av1_read_tx_type(cm, xd,
#if CONFIG_SUPERTX
0,
#endif
r);
#endif // !CONFIG_LV_MAP
#endif // !CONFIG_TXK_SEL
}
static int read_mv_component(aom_reader *r, nmv_component *mvcomp, int usehp) {
......@@ -2183,13 +2183,13 @@ static void read_inter_frame_mode_info(AV1Decoder *const pbi,
else
read_intra_block_mode_info(cm, mi_row, mi_col, xd, mi, r);
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
av1_read_tx_type(cm, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
r);
#endif // !CONFIG_LV_MAP
#endif // !CONFIG_TXK_SEL
}
void av1_read_mode_info(AV1Decoder *const pbi, MACROBLOCKD *xd,
......
......@@ -36,7 +36,7 @@ void av1_read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#if CONFIG_SUPERTX
int supertx_enabled,
#endif
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
int block, int plane,
#endif
aom_reader *r);
......
......@@ -76,7 +76,9 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
return 0;
}
#if CONFIG_TXK_SEL
av1_read_tx_type(cm, xd, block, plane, r);
#endif
TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const SCAN_ORDER *const scan_order =
get_scan(cm, tx_size, tx_type, is_inter_block(mbmi));
......
......@@ -1423,7 +1423,7 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
#if CONFIG_SUPERTX
const int supertx_enabled,
#endif
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
int block, int plane,
#endif
aom_writer *w) {
......@@ -1440,7 +1440,7 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
TX_TYPE tx_type = mbmi->tx_type;
#else
// Only y plane's tx_type is transmitted
......@@ -1939,13 +1939,13 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
#endif // CONFIG_DUAL_FILTE || CONFIG_WARPED_MOTION
}
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
av1_write_tx_type(cm, xd,
#if CONFIG_SUPERTX
supertx_enabled,
#endif
w);
#endif // !CONFIG_LV_MAP
#endif // !CONFIG_TXK_SEL
}
#if CONFIG_DELTA_Q
......@@ -2046,13 +2046,13 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
write_filter_intra_mode_info(cm, mbmi, w);
#endif // CONFIG_FILTER_INTRA
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
av1_write_tx_type(cm, xd,
#if CONFIG_SUPERTX
0,
#endif
w);
#endif // !CONFIG_LV_MAP
#endif // !CONFIG_TXK_SEL
}
#if CONFIG_SUPERTX
......
......@@ -41,7 +41,7 @@ void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
#if CONFIG_SUPERTX
const int supertx_enabled,
#endif
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
int block, int plane,
#endif
aom_writer *w);
......
......@@ -5759,14 +5759,14 @@ static void tx_partition_set_contexts(const AV1_COMMON *const cm,
#endif
void av1_update_tx_type_count(const AV1_COMMON *cm, MACROBLOCKD *xd,
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
int block, int plane,
#endif
BLOCK_SIZE bsize, TX_SIZE tx_size,
FRAME_COUNTS *counts) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
int is_inter = is_inter_block(mbmi);
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
TX_TYPE tx_type = mbmi->tx_type;
#else
// Only y plane's tx_type is updated
......@@ -6017,7 +6017,7 @@ static void encode_superblock(const AV1_COMP *const cpi, ThreadData *td,
++td->counts->tx_size_totals[txsize_sqr_map[tx_size]];
++td->counts
->tx_size_totals[txsize_sqr_map[get_uv_tx_size(mbmi, &xd->plane[1])]];
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
av1_update_tx_type_count(cm, xd, bsize, tx_size, td->counts);
#endif
}
......
......@@ -45,7 +45,7 @@ void av1_encode_tile(struct AV1_COMP *cpi, struct ThreadData *td, int tile_row,
void av1_set_variance_partition_thresholds(struct AV1_COMP *cpi, int q);
void av1_update_tx_type_count(const struct AV1Common *cm, MACROBLOCKD *xd,
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
int block, int plane,
#endif
BLOCK_SIZE bsize, TX_SIZE tx_size,
......
......@@ -90,7 +90,9 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_write(w, eob == 0, cm->fc->txb_skip[tx_size][txb_ctx->txb_skip_ctx]);
if (eob == 0) return;
#if CONFIG_TXK_SEL
av1_write_tx_type(cm, xd, block, plane, w);
#endif
nz_map = cm->fc->nz_map[tx_size][plane_type];
eob_flag = cm->fc->eob_flag[tx_size][plane_type];
......@@ -285,7 +287,9 @@ int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
cost = av1_cost_bit(xd->fc->txb_skip[tx_size][txb_skip_ctx], 0);
#if CONFIG_TXK_SEL
cost += av1_tx_type_cost(cpi, xd, mbmi->sb_type, plane, tx_size, tx_type);
#endif
for (c = 0; c < eob; ++c) {
tran_low_t v = qcoeff[scan[c]];
......@@ -459,8 +463,10 @@ static void update_and_record_txb_context(int plane, int block, int blk_row,
return;
}
#if CONFIG_TXK_SEL
av1_update_tx_type_count(cm, xd, block, plane, mbmi->sb_type, tx_size,
td->counts);
#endif
for (c = 0; c < eob; ++c) {
tran_low_t v = qcoeff[scan[c]];
......@@ -715,6 +721,7 @@ void av1_write_txb_probs(AV1_COMP *cpi, aom_writer *w) {
write_txb_probs(w, cpi, tx_size);
}
#if CONFIG_TXK_SEL
int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
......@@ -766,3 +773,4 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
best_eob);
return best_rd;
}
#endif // CONFIG_TXK_SEL
......@@ -39,11 +39,13 @@ void av1_update_txb_context(const AV1_COMP *cpi, ThreadData *td,
const int mi_row, const int mi_col);
void av1_write_txb_probs(AV1_COMP *cpi, aom_writer *w);
#if CONFIG_TXK_SEL
int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l,
int use_fast_coef_costing, RD_STATS *rd_stats);
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -1547,7 +1547,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
const AV1_COMP *cpi = args->cpi;
ENTROPY_CONTEXT *a = args->t_above + blk_col;
ENTROPY_CONTEXT *l = args->t_left + blk_row;
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
const AV1_COMMON *cm = &cpi->common;
#endif
int64_t rd1, rd2, rd;
......@@ -1564,7 +1564,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
}
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
// full forward transform and quantization
int coeff_ctx = combine_entropy_contexts(*a, *l);
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
......@@ -1600,11 +1600,11 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
#else // !CONFIG_PVQ
this_rd_stats.rate = x->rate;
#endif // !CONFIG_PVQ
#else // !CONFIG_LV_MAP
#else // !CONFIG_TXK_SEL
av1_search_txk_type(cpi, x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, a, l, args->use_fast_coef_costing,
&this_rd_stats);
#endif // !CONFIG_LV_MAP
#endif // !CONFIG_TXK_SEL
#if !CONFIG_PVQ
#if CONFIG_RD_DEBUG
......@@ -1897,7 +1897,7 @@ static int64_t txfm_yrd(const AV1_COMP *const cpi, MACROBLOCK *x,
txfm_rd_in_plane(x, cpi, rd_stats, ref_best_rd, 0, bs, tx_size,
cpi->sf.use_fast_coef_costing);
if (rd_stats->rate == INT_MAX) return INT64_MAX;
#if !CONFIG_LV_MAP
#if !CONFIG_TXK_SEL
int plane = 0;
rd_stats->rate += av1_tx_type_cost(cpi, xd, bs, plane, tx_size, tx_type);
#endif
......@@ -2168,12 +2168,12 @@ static void choose_smallest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
cpi->sf.use_fast_coef_costing);
}
#if CONFIG_LV_MAP || CONFIG_VAR_TX
#if CONFIG_TXK_SEL || CONFIG_VAR_TX
static INLINE int bsize_to_num_blk(BLOCK_SIZE bsize) {
int num_blk = 1 << (num_pels_log2_lookup[bsize] - 2 * tx_size_wide_log2[0]);
return num_blk;
}
#endif // CONFIG_LV_MAP || CONFIG_VAR_TX
#endif // CONFIG_TXK_SEL || CONFIG_VAR_TX
static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
MACROBLOCK *x, RD_STATS *rd_stats,
......@@ -2188,10 +2188,10 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
const TX_SIZE max_tx_size = max_txsize_lookup[bs];
TX_SIZE best_tx_size = max_tx_size;
TX_TYPE best_tx_type = DCT_DCT;
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
TX_TYPE best_txk_type[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
const int num_blk = bsize_to_num_blk(bs);
#endif // !CONFIG_LV_MAP
#endif // CONFIG_TXK_SEL
const int tx_select = cm->tx_mode == TX_MODE_SELECT;
const int is_inter = is_inter_block(mbmi);
#if CONFIG_PVQ
......@@ -2214,7 +2214,7 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
if (evaluate_rect_tx) {
TX_TYPE tx_start = DCT_DCT;
TX_TYPE tx_end = TX_TYPES;
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
// The tx_type becomes dummy when lv_map is on. The tx_type search will be
// performed in av1_search_txk_type()
tx_end = DCT_DCT + 1;
......@@ -2233,7 +2233,7 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
rd = txfm_yrd(cpi, x, &this_rd_stats, ref_best_rd, bs, tx_type,
rect_tx_size);
if (rd < best_rd) {
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
memcpy(best_txk_type, mbmi->txk_type,
sizeof(best_txk_type[0]) * num_blk);
#endif
......@@ -2268,7 +2268,7 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
#endif // CONFIG_EXT_TX && CONFIG_RECT_TX
TX_TYPE tx_start = DCT_DCT;
TX_TYPE tx_end = TX_TYPES;
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
// The tx_type becomes dummy when lv_map is on. The tx_type search will be
// performed in av1_search_txk_type()
tx_end = DCT_DCT + 1;
......@@ -2290,7 +2290,7 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
last_rd = rd;
if (rd < best_rd) {
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
memcpy(best_txk_type, mbmi->txk_type,
sizeof(best_txk_type[0]) * num_blk);
#endif
......@@ -2307,7 +2307,7 @@ static void choose_tx_size_type_from_rd(const AV1_COMP *const cpi,
}
mbmi->tx_size = best_tx_size;
mbmi->tx_type = best_tx_type;
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
memcpy(mbmi->txk_type, best_txk_type, sizeof(best_txk_type[0]) * num_blk);
#endif
......
......@@ -312,6 +312,7 @@ EXPERIMENT_LIST="
palette_throughput
ref_adapt
lv_map
txk_sel
mv_compress
frame_superres
new_multisymbol
......@@ -505,6 +506,7 @@ post_process_cmdline() {
enabled ec_multisymbol && ! enabled ans && soft_enable daala_ec
enabled ec_multisymbol && ! enabled daala_ec && soft_enable ans
enabled palette_throughput && soft_enable palette
enabled txk_sel && soft_enable lv_map
if enabled rawbits && ! enabled daala_ec; then
log_echo "rawbits requires daala_ec, so disabling rawbits"
disable_feature rawbits
......
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