Commit 923b73d8 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Simplify tx_mode frame level bit

Adds a new experiment to simplify the tx_mode symbol.

The existing frame level tx_mode information is converted to a single bit
to select between largest tx_size for a prediction unit or specified
at the block level. The less useful modes: ALLOW_8X8, ALLOW_16X16,
etc. are removed.

Change-Id: Ib9358e17b0158a167eb4edef79f36ff113aa56e1
parent 0e141b56
......@@ -1064,6 +1064,18 @@ static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
};
/* clang-format off */
#if CONFIG_SIMPLIFY_TX_MODE
static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
TX_4X4, // ONLY_4X4
#if CONFIG_TX64X64
TX_64X64, // TX_MODE_LARGEST
TX_64X64, // TX_MODE_SELECT
#else
TX_32X32, // TX_MODE_LARGEST
TX_32X32, // TX_MODE_SELECT
#endif // CONFIG_TX64X64
};
#else
static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
TX_4X4, // ONLY_4X4
TX_8X8, // ALLOW_8X8
......@@ -1071,11 +1083,12 @@ static const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = {
TX_32X32, // ALLOW_32X32
#if CONFIG_TX64X64
TX_64X64, // ALLOW_64X64
TX_64X64, // TX_MODE_SELECT
TX_64X64, // TX_MODE_LARGEST
#else
TX_32X32, // TX_MODE_SELECT
#endif // CONFIG_TX64X64
};
#endif // CONFIG_SIMPLIFY_TX_MODE
/* clang-format on */
static const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES_ALL][2][2] = {
......
......@@ -281,17 +281,28 @@ typedef enum ATTRIBUTE_PACKED {
#endif // CONFIG_NCOBMC_ADAPT_WEIGHT
// frame transform mode
#if CONFIG_SIMPLIFY_TX_MODE
typedef enum ATTRIBUTE_PACKED {
ONLY_4X4, // only 4x4 transform used
ALLOW_8X8, // allow block transform size up to 8x8
ALLOW_16X16, // allow block transform size up to 16x16
ALLOW_32X32, // allow block transform size up to 32x32
ONLY_4X4, // use only 4x4 transform
TX_MODE_LARGEST, // transform size is the largest possible for pu size
TX_MODE_SELECT, // transform specified for each block
TX_MODES,
} TX_MODE;
#else
typedef enum ATTRIBUTE_PACKED {
ONLY_4X4, // only 4x4 transform used
ALLOW_8X8, // allow block transform size up to 8x8
ALLOW_16X16, // allow block transform size up to 16x16
ALLOW_32X32, // allow block transform size up to 32x32
#if CONFIG_TX64X64
ALLOW_64X64, // allow block transform size up to 64x64
ALLOW_64X64, // allow block transform size up to 64x64
#endif
TX_MODE_SELECT, // transform specified for each block
TX_MODES,
} TX_MODE;
#endif // CONFIG_SIMPLIFY_TX_MODE
// 1D tx types
typedef enum ATTRIBUTE_PACKED {
......
......@@ -127,6 +127,17 @@ static int decode_unsigned_max(struct aom_read_bit_buffer *rb, int max) {
return data > max ? max : data;
}
#if CONFIG_SIMPLIFY_TX_MODE
static TX_MODE read_tx_mode(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
if (cm->all_lossless) return ONLY_4X4;
#if CONFIG_VAR_TX_NO_TX_MODE
(void)rb;
return TX_MODE_SELECT;
#else
return aom_rb_read_bit(rb) ? TX_MODE_SELECT : TX_MODE_LARGEST;
#endif // CONFIG_VAR_TX_NO_TX_MODE
}
#else
static TX_MODE read_tx_mode(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
#if CONFIG_TX64X64
TX_MODE tx_mode;
......@@ -145,6 +156,7 @@ static TX_MODE read_tx_mode(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
#endif // CONFIG_TX64X64
#endif // CONFIG_VAR_TX_NO_TX_MODE
}
#endif // CONFIG_SIMPLIFY_TX_MODE
#if !CONFIG_NEW_MULTISYMBOL
static void read_inter_mode_probs(FRAME_CONTEXT *fc, aom_reader *r) {
......
......@@ -2822,6 +2822,9 @@ static void write_tx_mode(AV1_COMMON *cm, TX_MODE *mode,
*mode = TX_MODE_SELECT;
return;
#else
#if CONFIG_SIMPLIFY_TX_MODE
aom_wb_write_bit(wb, *mode == TX_MODE_SELECT);
#else
#if CONFIG_TX64X64
aom_wb_write_bit(wb, *mode == TX_MODE_SELECT);
if (*mode != TX_MODE_SELECT) {
......@@ -2832,6 +2835,7 @@ static void write_tx_mode(AV1_COMMON *cm, TX_MODE *mode,
aom_wb_write_bit(wb, *mode == TX_MODE_SELECT);
if (*mode != TX_MODE_SELECT) aom_wb_write_literal(wb, *mode, 2);
#endif // CONFIG_TX64X64
#endif // CONFIG_SIMPLIFY_TX_MODE
#endif // CONFIG_VAR_TX_NO_TX_MODE
}
......
......@@ -3422,6 +3422,22 @@ static MV_REFERENCE_FRAME get_frame_type(const AV1_COMP *cpi) {
return LAST_FRAME;
}
#if CONFIG_SIMPLIFY_TX_MODE
static TX_MODE select_tx_mode(const AV1_COMP *cpi) {
if (cpi->common.all_lossless) return ONLY_4X4;
#if CONFIG_VAR_TX_NO_TX_MODE
return TX_MODE_SELECT;
#else
if (cpi->sf.tx_size_search_method == USE_LARGESTALL)
return TX_MODE_LARGEST;
else if (cpi->sf.tx_size_search_method == USE_FULL_RD ||
cpi->sf.tx_size_search_method == USE_FAST_RD)
return TX_MODE_SELECT;
else
return cpi->common.tx_mode;
#endif // CONFIG_VAR_TX_NO_TX_MODE
}
#else
static TX_MODE select_tx_mode(const AV1_COMP *cpi) {
if (cpi->common.all_lossless) return ONLY_4X4;
#if CONFIG_VAR_TX_NO_TX_MODE
......@@ -3436,6 +3452,7 @@ static TX_MODE select_tx_mode(const AV1_COMP *cpi) {
return cpi->common.tx_mode;
#endif // CONFIG_VAR_TX_NO_TX_MODE
}
#endif // CONFIG_SIMPLIFY_TX_MODE
void av1_init_tile_data(AV1_COMP *cpi) {
AV1_COMMON *const cm = &cpi->common;
......@@ -4156,7 +4173,11 @@ void av1_encode_frame(AV1_COMP *cpi) {
#else
if (cm->tx_mode == TX_MODE_SELECT && cpi->td.mb.txb_split_count == 0)
#endif
#if CONFIG_SIMPLIFY_TX_MODE
cm->tx_mode = TX_MODE_LARGEST;
#else
cm->tx_mode = ALLOW_32X32 + CONFIG_TX64X64;
#endif // CONFIG_SIMPLIFY_TX_MODE
} else {
make_consistent_compound_tools(cm);
encode_frame_internal(cpi);
......
......@@ -189,6 +189,7 @@ set(CONFIG_REF_ADAPT 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SEGMENT_GLOBALMV 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SHORT_FILTER 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SIMPLE_BWD_ADAPT 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SIMPLIFY_TX_MODE 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_SMOOTH_HV 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_STRIPED_LOOP_RESTORATION 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_TEMPMV_SIGNALING 1 CACHE NUMBER "AV1 experiment flag.")
......
......@@ -317,6 +317,7 @@ EXPERIMENT_LIST="
ncobmc_adapt_weight
bgsprite
var_tx_no_tx_mode
simplify_tx_mode
mrc_tx
lpf_direct
loopfilter_level
......
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