Commit f3eb840a authored by Thomas Davies's avatar Thomas Davies

EC_MULTISYMBOL: make all CDFs have a extra element.

This will make it easier to add native CDFs for all the
dependent experiments without excessive macros.

Change-Id: Iee4710f0fe1c1b4300f686cdf2c5b879a36de987
parent 005feb6b
......@@ -27,6 +27,10 @@ typedef uint8_t aom_prob;
// TODO(negge): Rename this aom_prob once we remove vpxbool.
typedef uint16_t aom_cdf_prob;
#if CONFIG_EC_MULTISYMBOL
#define CDF_SIZE(x) ((x) + 1)
#endif
#define CDF_PROB_BITS 15
#define CDF_PROB_TOP (1 << CDF_PROB_BITS)
......
......@@ -207,7 +207,7 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full);
#if CONFIG_EC_MULTISYMBOL
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
[CDF_SIZE(ENTROPY_TOKENS)];
typedef aom_prob av1_blockz_probs_model[REF_TYPES][BLOCKZ_CONTEXTS];
typedef unsigned int av1_blockz_count_model[REF_TYPES][BLOCKZ_CONTEXTS][2];
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
......
......@@ -17,8 +17,7 @@
#include "av1/common/seg_common.h"
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
[INTRA_MODES + CONFIG_EC_ADAPT];
aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)];
#endif
#if CONFIG_ALT_INTRA
......
......@@ -233,24 +233,20 @@ typedef struct frame_contexts {
aom_prob switchable_restore_prob[RESTORE_SWITCHABLE_TYPES - 1];
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][INTRA_MODES + CONFIG_EC_ADAPT];
aom_cdf_prob uv_mode_cdf[INTRA_MODES][INTRA_MODES + CONFIG_EC_ADAPT];
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS]
[PARTITION_TYPES + CONFIG_EC_ADAPT];
aom_cdf_prob y_mode_cdf[BLOCK_SIZE_GROUPS][CDF_SIZE(INTRA_MODES)];
aom_cdf_prob uv_mode_cdf[INTRA_MODES][CDF_SIZE(INTRA_MODES)];
aom_cdf_prob partition_cdf[PARTITION_CONTEXTS][CDF_SIZE(PARTITION_TYPES)];
aom_cdf_prob switchable_interp_cdf[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS + CONFIG_EC_ADAPT];
aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS]
[INTER_MODES + CONFIG_EC_ADAPT];
[CDF_SIZE(SWITCHABLE_FILTERS)];
aom_cdf_prob inter_mode_cdf[INTER_MODE_CONTEXTS][CDF_SIZE(INTER_MODES)];
/* Keep track of kf_y_cdf here, as this makes handling
multiple copies for adaptation in tiles easier */
aom_cdf_prob kf_y_cdf[INTRA_MODES][INTRA_MODES]
[INTRA_MODES + CONFIG_EC_ADAPT];
aom_cdf_prob kf_y_cdf[INTRA_MODES][INTRA_MODES][CDF_SIZE(INTRA_MODES)];
aom_cdf_prob tx_size_cdf[MAX_TX_DEPTH][TX_SIZE_CONTEXTS]
[MAX_TX_DEPTH + 1 + CONFIG_EC_ADAPT];
[CDF_SIZE(MAX_TX_DEPTH + 1)];
#if !CONFIG_EXT_TX
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES]
[TX_TYPES + CONFIG_EC_ADAPT];
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES + CONFIG_EC_ADAPT];
aom_cdf_prob intra_ext_tx_cdf[EXT_TX_SIZES][TX_TYPES][CDF_SIZE(TX_TYPES)];
aom_cdf_prob inter_ext_tx_cdf[EXT_TX_SIZES][CDF_SIZE(TX_TYPES)];
#endif
#endif
#if CONFIG_DELTA_Q
......@@ -380,7 +376,7 @@ extern const aom_prob av1_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
#if CONFIG_EC_MULTISYMBOL
// CDF version of 'av1_kf_y_mode_prob'.
extern aom_cdf_prob av1_kf_y_mode_cdf[INTRA_MODES][INTRA_MODES]
[INTRA_MODES + CONFIG_EC_ADAPT];
[CDF_SIZE(INTRA_MODES)];
#endif
#if CONFIG_PALETTE
extern const aom_prob av1_default_palette_y_mode_prob[PALETTE_BLOCK_SIZES]
......
......@@ -85,15 +85,15 @@ typedef struct {
aom_prob sign;
aom_prob classes[MV_CLASSES - 1];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob class_cdf[MV_CLASSES + CONFIG_EC_ADAPT];
aom_cdf_prob class_cdf[CDF_SIZE(MV_CLASSES)];
#endif
aom_prob class0[CLASS0_SIZE - 1];
aom_prob bits[MV_OFFSET_BITS];
aom_prob class0_fp[CLASS0_SIZE][MV_FP_SIZE - 1];
aom_prob fp[MV_FP_SIZE - 1];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][MV_FP_SIZE + CONFIG_EC_ADAPT];
aom_cdf_prob fp_cdf[MV_FP_SIZE + CONFIG_EC_ADAPT];
aom_cdf_prob class0_fp_cdf[CLASS0_SIZE][CDF_SIZE(MV_FP_SIZE)];
aom_cdf_prob fp_cdf[CDF_SIZE(MV_FP_SIZE)];
#endif
aom_prob class0_hp;
aom_prob hp;
......@@ -102,7 +102,7 @@ typedef struct {
typedef struct {
aom_prob joints[MV_JOINTS - 1];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob joint_cdf[MV_JOINTS + CONFIG_EC_ADAPT];
aom_cdf_prob joint_cdf[CDF_SIZE(MV_JOINTS)];
#endif
nmv_component comps[2];
} nmv_context;
......
......@@ -49,7 +49,7 @@ struct segmentation {
struct segmentation_probs {
aom_prob tree_probs[SEG_TREE_PROBS];
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob tree_cdf[MAX_SEGMENTS];
aom_cdf_prob tree_cdf[CDF_SIZE(MAX_SEGMENTS)];
#endif
aom_prob pred_probs[PREDICTION_PROBS];
};
......
......@@ -83,14 +83,12 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
int band, c = 0;
const int tx_size_ctx = txsize_sqr_map[tx_size];
#if CONFIG_NEW_TOKENSET
aom_cdf_prob(
*coef_head_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
aom_cdf_prob(*coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_head_cdfs[tx_size_ctx][type][ref];
aom_cdf_prob(
*coef_tail_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
aom_cdf_prob(*coef_tail_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_tail_cdfs[tx_size_ctx][type][ref];
aom_cdf_prob(*cdf_head)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob(*cdf_tail)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob(*cdf_head)[CDF_SIZE(ENTROPY_TOKENS)];
aom_cdf_prob(*cdf_tail)[CDF_SIZE(ENTROPY_TOKENS)];
int val = 0;
unsigned int *blockz_count;
#else
......@@ -98,13 +96,13 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
ec_ctx->coef_probs[tx_size_ctx][type][ref];
const aom_prob *prob;
#if CONFIG_EC_ADAPT
aom_cdf_prob(*coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
aom_cdf_prob(*coef_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_cdfs[tx_size][type][ref];
aom_cdf_prob(*cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob(*cdf)[CDF_SIZE(ENTROPY_TOKENS)];
#elif CONFIG_EC_MULTISYMBOL
aom_cdf_prob(*coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
aom_cdf_prob(*coef_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_cdfs[tx_size_ctx][type][ref];
aom_cdf_prob(*cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob(*cdf)[CDF_SIZE(ENTROPY_TOKENS)];
#endif // CONFIG_EC_ADAPT
#endif // CONFIG_NEW_TOKENSET
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1] = NULL;
......
......@@ -361,10 +361,10 @@ static void set_entropy_context_b(int plane, int block, int blk_row,
}
#if CONFIG_NEW_TOKENSET
static INLINE void add_token(
TOKENEXTRA **t, aom_cdf_prob (*tail_cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT],
aom_cdf_prob (*head_cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT], int is_eob,
int32_t extra, uint8_t token) {
static INLINE void add_token(TOKENEXTRA **t,
aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)],
aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)],
int is_eob, int32_t extra, uint8_t token) {
(*t)->token = token;
(*t)->extra = extra;
(*t)->tail_cdf = tail_cdf;
......@@ -377,7 +377,7 @@ static INLINE void add_token(
static INLINE void add_token(
TOKENEXTRA **t, const aom_prob *context_tree,
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT],
aom_cdf_prob (*token_cdf)[CDF_SIZE(ENTROPY_TOKENS)],
#endif // CONFIG_EC_MULTISYMBOL
int32_t extra, uint8_t token, uint8_t skip_eob_node, unsigned int *counts) {
(*t)->token = token;
......@@ -493,18 +493,17 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
#endif
#if CONFIG_NEW_TOKENSET
aom_cdf_prob(
*const coef_head_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
*const coef_head_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_head_cdfs[tx_size][type][ref];
aom_cdf_prob(
*const coef_tail_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
*const coef_tail_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_tail_cdfs[tx_size][type][ref];
unsigned int(*const blockz_count)[2] =
td->counts->blockz_count[txsize_sqr_map[tx_size]][type][ref];
int is_eob;
#else
#if CONFIG_EC_MULTISYMBOL
aom_cdf_prob(
*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS + CONFIG_EC_ADAPT] =
aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][CDF_SIZE(ENTROPY_TOKENS)] =
ec_ctx->coef_cdfs[tx_size][type][ref];
#endif
int skip_eob = 0;
......
......@@ -36,11 +36,11 @@ typedef struct {
typedef struct {
#if CONFIG_NEW_TOKENSET
aom_cdf_prob (*tail_cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob (*head_cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob (*tail_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
aom_cdf_prob (*head_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
int is_eob;
#elif CONFIG_EC_MULTISYMBOL
aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS + CONFIG_EC_ADAPT];
aom_cdf_prob (*token_cdf)[CDF_SIZE(ENTROPY_TOKENS)];
#endif
const aom_prob *context_tree;
EXTRABIT extra;
......
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