Commit 9cea993b authored by Luc Trudeau's avatar Luc Trudeau

[CleanUp] Wrap intra_mode_to_tx_type_context

To avoid using a UV_PREDICTION_MODE with intra_mode_to_tx_type_context,
a wrapper function is added. Using a UV_PREDICTION_MODE with
intra_mode_to_tx_type_context is problematic with UV_CFL_PRED which
needs to be converted to DC_PRED.

Change-Id: I68320e34dd5e616d0f15ca2c1c951440243968cf
parent 7197411d
......@@ -719,21 +719,27 @@ static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
return subsize_lookup[partition][bsize];
}
static const TX_TYPE intra_mode_to_tx_type_context[INTRA_MODES] = {
DCT_DCT, // DC
ADST_DCT, // V
DCT_ADST, // H
DCT_DCT, // D45
ADST_ADST, // D135
ADST_DCT, // D117
DCT_ADST, // D153
DCT_ADST, // D207
ADST_DCT, // D63
ADST_ADST, // SMOOTH
ADST_DCT, // SMOOTH_V
DCT_ADST, // SMOOTH_H
ADST_ADST, // PAETH
};
static TX_TYPE intra_mode_to_tx_type_context(const MB_MODE_INFO *mbmi,
PLANE_TYPE plane_type) {
static const TX_TYPE _intra_mode_to_tx_type_context[INTRA_MODES] = {
DCT_DCT, // DC
ADST_DCT, // V
DCT_ADST, // H
DCT_DCT, // D45
ADST_ADST, // D135
ADST_DCT, // D117
DCT_ADST, // D153
DCT_ADST, // D207
ADST_DCT, // D63
ADST_ADST, // SMOOTH
ADST_DCT, // SMOOTH_V
DCT_ADST, // SMOOTH_H
ADST_ADST, // PAETH
};
return plane_type == PLANE_TYPE_Y
? _intra_mode_to_tx_type_context[mbmi->mode]
: _intra_mode_to_tx_type_context[get_uv_mode(mbmi->uv_mode)];
}
#define USE_TXTYPE_SEARCH_FOR_SUB8X8_IN_CB4X4 1
......@@ -1031,9 +1037,7 @@ static INLINE TX_TYPE get_default_tx_type(PLANE_TYPE plane_type,
xd->lossless[mbmi->segment_id] || tx_size >= TX_32X32)
return DCT_DCT;
return intra_mode_to_tx_type_context[plane_type == PLANE_TYPE_Y
? mbmi->mode
: get_uv_mode(mbmi->uv_mode)];
return intra_mode_to_tx_type_context(mbmi, plane_type);
}
static INLINE BLOCK_SIZE
......@@ -1078,7 +1082,7 @@ static INLINE TX_TYPE av1_get_tx_type(PLANE_TYPE plane_type,
} else {
// In intra mode, uv planes don't share the same prediction mode as y
// plane, so the tx_type should not be shared
tx_type = intra_mode_to_tx_type_context[get_uv_mode(mbmi->uv_mode)];
tx_type = intra_mode_to_tx_type_context(mbmi, PLANE_TYPE_UV);
}
}
assert(tx_type < TX_TYPES);
......@@ -1112,8 +1116,7 @@ static INLINE TX_TYPE av1_get_tx_type(PLANE_TYPE plane_type,
}
// UV Intra only
TX_TYPE intra_type =
intra_mode_to_tx_type_context[get_uv_mode(mbmi->uv_mode)];
const TX_TYPE intra_type = intra_mode_to_tx_type_context(mbmi, PLANE_TYPE_UV);
if (!av1_ext_tx_used[tx_set_type][intra_type]) return DCT_DCT;
return intra_type;
}
......
......@@ -2465,7 +2465,8 @@ static int skip_txfm_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs,
}
} else {
if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
if (tx_type != intra_mode_to_tx_type_context[mbmi->mode]) return 1;
if (tx_type != intra_mode_to_tx_type_context(mbmi, PLANE_TYPE_Y))
return 1;
}
}
return 0;
......@@ -2497,7 +2498,6 @@ static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
int s1 = x->skip_cost[skip_ctx][1];
const int is_inter = is_inter_block(mbmi);
int prune = 0;
const int plane = 0;
av1_invalid_rd_stats(rd_stats);
mbmi->tx_size = tx_size_from_tx_mode(bs, cm->tx_mode, is_inter);
......@@ -2529,17 +2529,18 @@ static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
tx_type != get_default_tx_type(0, xd, mbmi->tx_size))
continue;
if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
if (tx_type != intra_mode_to_tx_type_context[mbmi->mode]) continue;
if (tx_type != intra_mode_to_tx_type_context(mbmi, PLANE_TYPE_Y))
continue;
}
}
mbmi->tx_type = tx_type;
txfm_rd_in_plane(x, cpi, &this_rd_stats, ref_best_rd, 0, bs,
txfm_rd_in_plane(x, cpi, &this_rd_stats, ref_best_rd, AOM_PLANE_Y, bs,
mbmi->tx_size, cpi->sf.use_fast_coef_costing);
if (this_rd_stats.rate == INT_MAX) continue;
av1_tx_type_cost(cm, x, xd, bs, plane, mbmi->tx_size, tx_type);
av1_tx_type_cost(cm, x, xd, bs, AOM_PLANE_Y, mbmi->tx_size, tx_type);
if (this_rd_stats.skip)
this_rd = RDCOST(x->rdmult, s1, this_rd_stats.sse);
......@@ -2559,8 +2560,8 @@ static void choose_largest_tx_size(const AV1_COMP *const cpi, MACROBLOCK *x,
} else {
mbmi->tx_type = DCT_DCT;
txfm_rd_in_plane(x, cpi, rd_stats, ref_best_rd, 0, bs, mbmi->tx_size,
cpi->sf.use_fast_coef_costing);
txfm_rd_in_plane(x, cpi, rd_stats, ref_best_rd, AOM_PLANE_Y, bs,
mbmi->tx_size, cpi->sf.use_fast_coef_costing);
}
mbmi->tx_type = best_tx_type;
}
......@@ -4930,7 +4931,8 @@ static void select_tx_type_yrd(const AV1_COMP *cpi, MACROBLOCK *x,
}
} else {
if (!ALLOW_INTRA_EXT_TX && bsize >= BLOCK_8X8) {
if (tx_type != intra_mode_to_tx_type_context[mbmi->mode]) continue;
if (tx_type != intra_mode_to_tx_type_context(mbmi, PLANE_TYPE_Y)
continue;
}
}
*/
......
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