EC_ADAPT: use tile context for TX size.

Change-Id: Idd7926f0539a0bd039828e5882392fbfb024e531
This commit is contained in:
Thomas Davies 2017-01-11 17:27:12 +00:00
Родитель 472f63f4a6
Коммит cef09627cf
2 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -714,6 +714,12 @@ static void read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#else #else
const TX_SIZE tx_size = mbmi->tx_size; const TX_SIZE tx_size = mbmi->tx_size;
#endif #endif
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#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];
@ -732,7 +738,7 @@ static void read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (eset > 0) { if (eset > 0) {
mbmi->tx_type = aom_read_tree( mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_inter_tree[eset], r, av1_ext_tx_inter_tree[eset],
cm->fc->inter_ext_tx_prob[eset][square_tx_size], ACCT_STR); ec_ctx->inter_ext_tx_prob[eset][square_tx_size], ACCT_STR);
if (counts) if (counts)
++counts->inter_ext_tx[eset][square_tx_size][mbmi->tx_type]; ++counts->inter_ext_tx[eset][square_tx_size][mbmi->tx_type];
} }
@ -740,7 +746,7 @@ static void read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (eset > 0) { if (eset > 0) {
mbmi->tx_type = aom_read_tree( mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_intra_tree[eset], r, av1_ext_tx_intra_tree[eset],
cm->fc->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode], ec_ctx->intra_ext_tx_prob[eset][square_tx_size][mbmi->mode],
ACCT_STR); ACCT_STR);
if (counts) if (counts)
++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode] ++counts->intra_ext_tx[eset][square_tx_size][mbmi->mode]
@ -765,21 +771,21 @@ static void read_tx_type(const AV1_COMMON *const cm, MACROBLOCKD *xd,
if (inter_block) { if (inter_block) {
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
mbmi->tx_type = av1_ext_tx_inv[aom_read_symbol( mbmi->tx_type = av1_ext_tx_inv[aom_read_symbol(
r, cm->fc->inter_ext_tx_cdf[tx_size], TX_TYPES, ACCT_STR)]; r, ec_ctx->inter_ext_tx_cdf[tx_size], TX_TYPES, ACCT_STR)];
#else #else
mbmi->tx_type = aom_read_tree( mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_tree, cm->fc->inter_ext_tx_prob[tx_size], ACCT_STR); r, av1_ext_tx_tree, ec_ctx->inter_ext_tx_prob[tx_size], ACCT_STR);
#endif #endif
if (counts) ++counts->inter_ext_tx[tx_size][mbmi->tx_type]; if (counts) ++counts->inter_ext_tx[tx_size][mbmi->tx_type];
} else { } else {
const TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode]; const TX_TYPE tx_type_nom = intra_mode_to_tx_type_context[mbmi->mode];
#if CONFIG_EC_MULTISYMBOL #if CONFIG_EC_MULTISYMBOL
mbmi->tx_type = av1_ext_tx_inv[aom_read_symbol( mbmi->tx_type = av1_ext_tx_inv[aom_read_symbol(
r, cm->fc->intra_ext_tx_cdf[tx_size][tx_type_nom], TX_TYPES, r, ec_ctx->intra_ext_tx_cdf[tx_size][tx_type_nom], TX_TYPES,
ACCT_STR)]; ACCT_STR)];
#else #else
mbmi->tx_type = aom_read_tree( mbmi->tx_type = aom_read_tree(
r, av1_ext_tx_tree, cm->fc->intra_ext_tx_prob[tx_size][tx_type_nom], r, av1_ext_tx_tree, ec_ctx->intra_ext_tx_prob[tx_size][tx_type_nom],
ACCT_STR); ACCT_STR);
#endif #endif
if (counts) ++counts->intra_ext_tx[tx_size][tx_type_nom][mbmi->tx_type]; if (counts) ++counts->intra_ext_tx[tx_size][tx_type_nom][mbmi->tx_type];

Просмотреть файл

@ -1170,6 +1170,12 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
#else #else
const TX_SIZE tx_size = mbmi->tx_size; const TX_SIZE tx_size = mbmi->tx_size;
#endif // CONFIG_VAR_TX #endif // CONFIG_VAR_TX
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#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];
@ -1187,7 +1193,7 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
assert(ext_tx_used_inter[eset][mbmi->tx_type]); assert(ext_tx_used_inter[eset][mbmi->tx_type]);
if (eset > 0) { if (eset > 0) {
av1_write_token(w, av1_ext_tx_inter_tree[eset], av1_write_token(w, av1_ext_tx_inter_tree[eset],
cm->fc->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][mbmi->tx_type]);
} }
} else if (ALLOW_INTRA_EXT_TX) { } else if (ALLOW_INTRA_EXT_TX) {
@ -1195,7 +1201,7 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
if (eset > 0) { if (eset > 0) {
av1_write_token( av1_write_token(
w, av1_ext_tx_intra_tree[eset], w, av1_ext_tx_intra_tree[eset],
cm->fc->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][mbmi->tx_type]);
} }
} }
@ -1212,22 +1218,22 @@ static void write_tx_type(const AV1_COMMON *const cm, const MACROBLOCKD *xd,
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[mbmi->tx_type],
cm->fc->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, cm->fc->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[mbmi->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[mbmi->tx_type],
cm->fc->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);
#else #else
av1_write_token( av1_write_token(
w, av1_ext_tx_tree, w, av1_ext_tx_tree,
cm->fc 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[mbmi->tx_type]);