Commit c31ea682 authored by Angie Chiang's avatar Angie Chiang

Modify av1_write_tx_type for lv_map experiment

Change-Id: If129748d918995efcc58169d153a0950eeec5efb
parent 550a1175
...@@ -1419,12 +1419,15 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -1419,12 +1419,15 @@ static void write_palette_mode_info(const AV1_COMMON *cm, const MACROBLOCKD *xd,
} }
#endif // CONFIG_PALETTE #endif // CONFIG_PALETTE
static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd, void av1_write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
const MB_MODE_INFO *const mbmi,
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
const int supertx_enabled, const int supertx_enabled,
#endif #endif
aom_writer *w) { #if CONFIG_LV_MAP
int block,
#endif
aom_writer *w) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const int is_inter = is_inter_block(mbmi); const int is_inter = is_inter_block(mbmi);
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
const TX_SIZE tx_size = is_inter ? mbmi->min_tx_size : mbmi->tx_size; const TX_SIZE tx_size = is_inter ? mbmi->min_tx_size : mbmi->tx_size;
...@@ -1437,6 +1440,13 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd, ...@@ -1437,6 +1440,13 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
FRAME_CONTEXT *ec_ctx = cm->fc; FRAME_CONTEXT *ec_ctx = cm->fc;
#endif #endif
#if !CONFIG_LV_MAP
TX_TYPE tx_type = mbmi->tx_type;
#else
// Only y plane's tx_type is transmitted
TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, tx_size);
#endif
if (!FIXED_TX_TYPE) { if (!FIXED_TX_TYPE) {
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
const TX_SIZE square_tx_size = txsize_sqr_map[tx_size]; const TX_SIZE square_tx_size = txsize_sqr_map[tx_size];
...@@ -1453,31 +1463,31 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd, ...@@ -1453,31 +1463,31 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
const int eset = const int eset =
get_ext_tx_set(tx_size, bsize, is_inter, cm->reduced_tx_set_used); get_ext_tx_set(tx_size, bsize, is_inter, cm->reduced_tx_set_used);
if (is_inter) { if (is_inter) {
assert(ext_tx_used_inter[eset][mbmi->tx_type]); assert(ext_tx_used_inter[eset][tx_type]);
if (eset > 0) { if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_ext_tx_inter_ind[eset][mbmi->tx_type], aom_write_symbol(w, av1_ext_tx_inter_ind[eset][tx_type],
ec_ctx->inter_ext_tx_cdf[eset][square_tx_size], ec_ctx->inter_ext_tx_cdf[eset][square_tx_size],
ext_tx_cnt_inter[eset]); ext_tx_cnt_inter[eset]);
#else #else
av1_write_token(w, av1_ext_tx_inter_tree[eset], av1_write_token(w, av1_ext_tx_inter_tree[eset],
ec_ctx->inter_ext_tx_prob[eset][square_tx_size], ec_ctx->inter_ext_tx_prob[eset][square_tx_size],
&ext_tx_inter_encodings[eset][mbmi->tx_type]); &ext_tx_inter_encodings[eset][tx_type]);
#endif #endif
} }
} else if (ALLOW_INTRA_EXT_TX) { } else if (ALLOW_INTRA_EXT_TX) {
assert(ext_tx_used_intra[eset][mbmi->tx_type]); assert(ext_tx_used_intra[eset][tx_type]);
if (eset > 0) { if (eset > 0) {
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
aom_write_symbol( aom_write_symbol(
w, av1_ext_tx_intra_ind[eset][mbmi->tx_type], w, av1_ext_tx_intra_ind[eset][tx_type],
ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode], ec_ctx->intra_ext_tx_cdf[eset][square_tx_size][mbmi->mode],
ext_tx_cnt_intra[eset]); ext_tx_cnt_intra[eset]);
#else #else
av1_write_token( av1_write_token(
w, av1_ext_tx_intra_tree[eset], w, av1_ext_tx_intra_tree[eset],
ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode], ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
&ext_tx_intra_encodings[eset][mbmi->tx_type]); &ext_tx_intra_encodings[eset][tx_type]);
#endif #endif
} }
} }
...@@ -1493,16 +1503,16 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd, ...@@ -1493,16 +1503,16 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
!segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
if (is_inter) { if (is_inter) {
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
aom_write_symbol(w, av1_ext_tx_ind[mbmi->tx_type], aom_write_symbol(w, av1_ext_tx_ind[tx_type],
ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES); ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES);
#else #else
av1_write_token(w, av1_ext_tx_tree, ec_ctx->inter_ext_tx_prob[tx_size], av1_write_token(w, av1_ext_tx_tree, ec_ctx->inter_ext_tx_prob[tx_size],
&ext_tx_encodings[mbmi->tx_type]); &ext_tx_encodings[tx_type]);
#endif #endif
} else { } else {
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
aom_write_symbol( aom_write_symbol(
w, av1_ext_tx_ind[mbmi->tx_type], w, av1_ext_tx_ind[tx_type],
ec_ctx->intra_ext_tx_cdf[tx_size] ec_ctx->intra_ext_tx_cdf[tx_size]
[intra_mode_to_tx_type_context[mbmi->mode]], [intra_mode_to_tx_type_context[mbmi->mode]],
TX_TYPES); TX_TYPES);
...@@ -1512,7 +1522,7 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd, ...@@ -1512,7 +1522,7 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
ec_ctx ec_ctx
->intra_ext_tx_prob[tx_size] ->intra_ext_tx_prob[tx_size]
[intra_mode_to_tx_type_context[mbmi->mode]], [intra_mode_to_tx_type_context[mbmi->mode]],
&ext_tx_encodings[mbmi->tx_type]); &ext_tx_encodings[tx_type]);
#endif #endif
} }
} }
...@@ -1545,8 +1555,8 @@ static void write_intra_uv_mode(FRAME_CONTEXT *frame_ctx, ...@@ -1545,8 +1555,8 @@ static void write_intra_uv_mode(FRAME_CONTEXT *frame_ctx,
#endif #endif
} }
static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, static void pack_inter_mode_mvs(AV1_COMP *cpi, const int mi_row,
const int mi_row, const int mi_col, const int mi_col,
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
int supertx_enabled, int supertx_enabled,
#endif #endif
...@@ -1567,6 +1577,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, ...@@ -1567,6 +1577,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
#if !CONFIG_REF_MV #if !CONFIG_REF_MV
nmv_context *nmvc = &ec_ctx->nmvc; nmv_context *nmvc = &ec_ctx->nmvc;
#endif #endif
const MODE_INFO *mi = xd->mi[0];
const struct segmentation *const seg = &cm->seg; const struct segmentation *const seg = &cm->seg;
struct segmentation_probs *const segp = &cm->fc->seg; struct segmentation_probs *const segp = &cm->fc->seg;
...@@ -1926,26 +1937,27 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi, ...@@ -1926,26 +1937,27 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
#endif // CONFIG_DUAL_FILTE || CONFIG_WARPED_MOTION #endif // CONFIG_DUAL_FILTE || CONFIG_WARPED_MOTION
} }
write_tx_type(cm, xd, mbmi, #if !CONFIG_LV_MAP
av1_write_tx_type(cm, xd,
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
supertx_enabled, supertx_enabled,
#endif #endif
w); w);
#endif // !CONFIG_LV_MAP
} }
#if CONFIG_DELTA_Q #if CONFIG_DELTA_Q
static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd, const int mi_row, static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd, const int mi_row,
const int mi_col, MODE_INFO **mi_8x8, const int mi_col, aom_writer *w) {
aom_writer *w) {
int skip; int skip;
#else #else
static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd, static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
const int mi_row, const int mi_col, const int mi_row, const int mi_col,
MODE_INFO **mi_8x8, aom_writer *w) { aom_writer *w) {
#endif #endif
const struct segmentation *const seg = &cm->seg; const struct segmentation *const seg = &cm->seg;
struct segmentation_probs *const segp = &cm->fc->seg; struct segmentation_probs *const segp = &cm->fc->seg;
const MODE_INFO *const mi = mi_8x8[0]; const MODE_INFO *const mi = xd->mi[0];
const MODE_INFO *const above_mi = xd->above_mi; const MODE_INFO *const above_mi = xd->above_mi;
const MODE_INFO *const left_mi = xd->left_mi; const MODE_INFO *const left_mi = xd->left_mi;
const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO *const mbmi = &mi->mbmi;
...@@ -2032,11 +2044,13 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd, ...@@ -2032,11 +2044,13 @@ static void write_mb_modes_kf(AV1_COMMON *cm, const MACROBLOCKD *xd,
write_filter_intra_mode_info(cm, mbmi, w); write_filter_intra_mode_info(cm, mbmi, w);
#endif // CONFIG_FILTER_INTRA #endif // CONFIG_FILTER_INTRA
write_tx_type(cm, xd, mbmi, #if !CONFIG_LV_MAP
av1_write_tx_type(cm, xd,
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
0, 0,
#endif #endif
w); w);
#endif // !CONFIG_LV_MAP
} }
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
...@@ -2120,7 +2134,7 @@ static void write_mbmi_b(AV1_COMP *cpi, const TileInfo *const tile, ...@@ -2120,7 +2134,7 @@ static void write_mbmi_b(AV1_COMP *cpi, const TileInfo *const tile,
#endif #endif
if (frame_is_intra_only(cm)) { if (frame_is_intra_only(cm)) {
write_mb_modes_kf(cm, xd, mi_row, mi_col, xd->mi, w); write_mb_modes_kf(cm, xd, mi_row, mi_col, w);
} else { } else {
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
xd->above_txfm_context = cm->above_txfm_context + mi_col; xd->above_txfm_context = cm->above_txfm_context + mi_col;
...@@ -2157,7 +2171,7 @@ static void write_mbmi_b(AV1_COMP *cpi, const TileInfo *const tile, ...@@ -2157,7 +2171,7 @@ static void write_mbmi_b(AV1_COMP *cpi, const TileInfo *const tile,
m->mbmi.ref_frame[0], m->mbmi.ref_frame[1]); m->mbmi.ref_frame[0], m->mbmi.ref_frame[1]);
} }
#endif // 0 #endif // 0
pack_inter_mode_mvs(cpi, m, mi_row, mi_col, pack_inter_mode_mvs(cpi, mi_row, mi_col,
#if CONFIG_SUPERTX #if CONFIG_SUPERTX
supertx_enabled, supertx_enabled,
#endif #endif
......
...@@ -37,6 +37,15 @@ static INLINE int av1_preserve_existing_gf(AV1_COMP *cpi) { ...@@ -37,6 +37,15 @@ static INLINE int av1_preserve_existing_gf(AV1_COMP *cpi) {
#endif // CONFIG_EXT_REFS #endif // CONFIG_EXT_REFS
} }
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
int block,
#endif
aom_writer *w);
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
......
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