Partition the ans experiment into 'ans' and 'rans'
The (new) ans experiment replaces the bool coder with uABS bools. The 'rans' experiment adds multisymbol coding. This matches the setup in aom/master. Change-Id: Ida8372ccabf1e1e9afc45fe66362cda35a491222
This commit is contained in:
@@ -206,7 +206,7 @@ static INLINE int aom_read_tree_(aom_reader *r, const aom_tree_index *tree,
|
|||||||
static INLINE int aom_read_symbol_(aom_reader *r, const aom_cdf_prob *cdf,
|
static INLINE int aom_read_symbol_(aom_reader *r, const aom_cdf_prob *cdf,
|
||||||
int nsymbs ACCT_STR_PARAM) {
|
int nsymbs ACCT_STR_PARAM) {
|
||||||
int ret;
|
int ret;
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
(void)nsymbs;
|
(void)nsymbs;
|
||||||
ret = rans_read(r, cdf);
|
ret = rans_read(r, cdf);
|
||||||
#elif CONFIG_DAALA_EC
|
#elif CONFIG_DAALA_EC
|
||||||
|
@@ -100,7 +100,7 @@ static INLINE void aom_write_tree(aom_writer *w, const aom_tree_index *tree,
|
|||||||
|
|
||||||
static INLINE void aom_write_symbol(aom_writer *w, int symb,
|
static INLINE void aom_write_symbol(aom_writer *w, int symb,
|
||||||
const aom_cdf_prob *cdf, int nsymbs) {
|
const aom_cdf_prob *cdf, int nsymbs) {
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
struct rans_sym s;
|
struct rans_sym s;
|
||||||
(void)nsymbs;
|
(void)nsymbs;
|
||||||
assert(cdf);
|
assert(cdf);
|
||||||
|
@@ -406,16 +406,18 @@ const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES] = {
|
|||||||
{ 255, 246, 247, 255, 239, 255, 253, 255 },
|
{ 255, 246, 247, 255, 239, 255, 253, 255 },
|
||||||
};
|
};
|
||||||
|
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
// Model obtained from a 2-sided zero-centerd distribuition derived
|
// Model obtained from a 2-sided zero-centered distribution derived
|
||||||
// from a Pareto distribution. The cdf of the distribution is:
|
// from a Pareto distribution. The cdf of the distribution is:
|
||||||
// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
|
// cdf(x) = 0.5 + 0.5 * sgn(x) * [1 - {alpha/(alpha + |x|)} ^ beta]
|
||||||
//
|
//
|
||||||
// For a given beta and a given probablity of the 1-node, the alpha
|
// For a given beta and a given probability of the 1-node, the alpha
|
||||||
// is first solved, and then the {alpha, beta} pair is used to generate
|
// is first solved, and then the {alpha, beta} pair is used to generate
|
||||||
// the probabilities for the rest of the nodes.
|
// the probabilities for the rest of the nodes.
|
||||||
//
|
//
|
||||||
// beta = 8
|
// The full source code of the generating program is available in:
|
||||||
|
// tools/gen_constrained_tokenset.py
|
||||||
|
//
|
||||||
// Values for tokens ONE_TOKEN through CATEGORY6_TOKEN included here.
|
// Values for tokens ONE_TOKEN through CATEGORY6_TOKEN included here.
|
||||||
// ZERO_TOKEN and EOB_TOKEN are coded as flags outside this coder.
|
// ZERO_TOKEN and EOB_TOKEN are coded as flags outside this coder.
|
||||||
const aom_cdf_prob
|
const aom_cdf_prob
|
||||||
@@ -676,7 +678,7 @@ const aom_cdf_prob
|
|||||||
{ 32512, 238, 11, 1, 1, 1, 1, 1, 1, 1 },
|
{ 32512, 238, 11, 1, 1, 1, 1, 1, 1, 1 },
|
||||||
{ 32640, 117, 4, 1, 1, 1, 1, 1, 1, 1 },
|
{ 32640, 117, 4, 1, 1, 1, 1, 1, 1, 1 },
|
||||||
};
|
};
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
#if CONFIG_ENTROPY
|
#if CONFIG_ENTROPY
|
||||||
@@ -2801,7 +2803,7 @@ void av1_model_to_full_probs(const aom_prob *model, aom_prob *full) {
|
|||||||
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
|
extend_to_full_distribution(&full[UNCONSTRAINED_NODES], model[PIVOT_NODE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
static void build_token_cdfs(const aom_prob *pdf_model,
|
static void build_token_cdfs(const aom_prob *pdf_model,
|
||||||
aom_cdf_prob cdf[ENTROPY_TOKENS]) {
|
aom_cdf_prob cdf[ENTROPY_TOKENS]) {
|
||||||
int i, sum = 0;
|
int i, sum = 0;
|
||||||
@@ -2818,12 +2820,11 @@ void av1_coef_pareto_cdfs(FRAME_CONTEXT *fc) {
|
|||||||
for (i = 0; i < PLANE_TYPES; ++i)
|
for (i = 0; i < PLANE_TYPES; ++i)
|
||||||
for (j = 0; j < REF_TYPES; ++j)
|
for (j = 0; j < REF_TYPES; ++j)
|
||||||
for (k = 0; k < COEF_BANDS; ++k)
|
for (k = 0; k < COEF_BANDS; ++k)
|
||||||
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l) {
|
for (l = 0; l < BAND_COEFF_CONTEXTS(k); ++l)
|
||||||
build_token_cdfs(fc->coef_probs[t][i][j][k][l],
|
build_token_cdfs(fc->coef_probs[t][i][j][k][l],
|
||||||
fc->coef_cdfs[t][i][j][k][l]);
|
fc->coef_cdfs[t][i][j][k][l]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
|
|
||||||
void av1_default_coef_probs(AV1_COMMON *cm) {
|
void av1_default_coef_probs(AV1_COMMON *cm) {
|
||||||
#if CONFIG_ENTROPY
|
#if CONFIG_ENTROPY
|
||||||
@@ -2836,9 +2837,9 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
|
|||||||
av1_copy(cm->fc->coef_probs[TX_16X16], default_coef_probs_16x16);
|
av1_copy(cm->fc->coef_probs[TX_16X16], default_coef_probs_16x16);
|
||||||
av1_copy(cm->fc->coef_probs[TX_32X32], default_coef_probs_32x32);
|
av1_copy(cm->fc->coef_probs[TX_32X32], default_coef_probs_32x32);
|
||||||
#endif // CONFIG_ENTROPY
|
#endif // CONFIG_ENTROPY
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
av1_coef_pareto_cdfs(cm->fc);
|
av1_coef_pareto_cdfs(cm->fc);
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
|
static void adapt_coef_probs(AV1_COMMON *cm, TX_SIZE tx_size,
|
||||||
@@ -2905,9 +2906,9 @@ void av1_adapt_coef_probs(AV1_COMMON *cm) {
|
|||||||
#endif // CONFIG_ENTROPY
|
#endif // CONFIG_ENTROPY
|
||||||
for (t = TX_4X4; t <= TX_32X32; t++)
|
for (t = TX_4X4; t <= TX_32X32; t++)
|
||||||
adapt_coef_probs(cm, t, count_sat, update_factor);
|
adapt_coef_probs(cm, t, count_sat, update_factor);
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
av1_coef_pareto_cdfs(cm->fc);
|
av1_coef_pareto_cdfs(cm->fc);
|
||||||
#endif
|
#endif // CONFIG_RANS
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ENTROPY
|
#if CONFIG_ENTROPY
|
||||||
|
@@ -12,12 +12,13 @@
|
|||||||
#ifndef AV1_COMMON_ENTROPY_H_
|
#ifndef AV1_COMMON_ENTROPY_H_
|
||||||
#define AV1_COMMON_ENTROPY_H_
|
#define AV1_COMMON_ENTROPY_H_
|
||||||
|
|
||||||
|
#include "./aom_config.h"
|
||||||
#include "aom/aom_integer.h"
|
#include "aom/aom_integer.h"
|
||||||
|
#if CONFIG_RANS
|
||||||
|
#include "aom_dsp/ans.h"
|
||||||
|
#endif // CONFIG_RANS
|
||||||
#include "aom_dsp/prob.h"
|
#include "aom_dsp/prob.h"
|
||||||
|
|
||||||
#if CONFIG_ANS
|
|
||||||
#include "aom_dsp/ans.h"
|
|
||||||
#endif // CONFIG_ANS
|
|
||||||
#include "av1/common/common.h"
|
#include "av1/common/common.h"
|
||||||
#include "av1/common/enums.h"
|
#include "av1/common/enums.h"
|
||||||
|
|
||||||
@@ -190,12 +191,12 @@ static INLINE const uint8_t *get_band_translate(TX_SIZE tx_size) {
|
|||||||
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
|
#define MODEL_NODES (ENTROPY_NODES - UNCONSTRAINED_NODES)
|
||||||
extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)];
|
extern const aom_tree_index av1_coef_con_tree[TREE_SIZE(ENTROPY_TOKENS)];
|
||||||
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
|
extern const aom_prob av1_pareto8_full[COEFF_PROB_MODELS][MODEL_NODES];
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
typedef aom_cdf_prob coeff_cdf_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||||
[ENTROPY_TOKENS];
|
[ENTROPY_TOKENS];
|
||||||
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
|
extern const aom_cdf_prob av1_pareto8_token_probs[COEFF_PROB_MODELS]
|
||||||
[ENTROPY_TOKENS - 2];
|
[ENTROPY_TOKENS - 2];
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
|
|
||||||
typedef aom_prob av1_coeff_probs_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
typedef aom_prob av1_coeff_probs_model[REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
|
||||||
[UNCONSTRAINED_NODES];
|
[UNCONSTRAINED_NODES];
|
||||||
@@ -265,10 +266,10 @@ static INLINE int get_entropy_context(TX_SIZE tx_size, const ENTROPY_CONTEXT *a,
|
|||||||
return combine_entropy_contexts(above_ec, left_ec);
|
return combine_entropy_contexts(above_ec, left_ec);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
struct frame_contexts;
|
struct frame_contexts;
|
||||||
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
|
void av1_coef_pareto_cdfs(struct frame_contexts *fc);
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
|
|
||||||
#if CONFIG_ENTROPY
|
#if CONFIG_ENTROPY
|
||||||
#define COEF_COUNT_SAT_BITS 5
|
#define COEF_COUNT_SAT_BITS 5
|
||||||
|
@@ -56,9 +56,9 @@ typedef struct frame_contexts {
|
|||||||
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
|
aom_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
|
||||||
#endif
|
#endif
|
||||||
av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
|
av1_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
|
coeff_cdf_model coef_cdfs[TX_SIZES][PLANE_TYPES];
|
||||||
#endif
|
#endif // CONFIG_RANS
|
||||||
aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
|
aom_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
|
||||||
[SWITCHABLE_FILTERS - 1];
|
[SWITCHABLE_FILTERS - 1];
|
||||||
|
|
||||||
|
@@ -1719,8 +1719,7 @@ static void decode_partition(AV1Decoder *const pbi, MACROBLOCKD *const xd,
|
|||||||
#else
|
#else
|
||||||
if (supertx_size < TX_32X32) {
|
if (supertx_size < TX_32X32) {
|
||||||
txfm = aom_read_tree(r, av1_ext_tx_tree,
|
txfm = aom_read_tree(r, av1_ext_tx_tree,
|
||||||
cm->fc->inter_ext_tx_prob[supertx_size],
|
cm->fc->inter_ext_tx_prob[supertx_size], ACCT_STR);
|
||||||
ACCT_STR);
|
|
||||||
if (xd->counts) ++xd->counts->inter_ext_tx[supertx_size][txfm];
|
if (xd->counts) ++xd->counts->inter_ext_tx[supertx_size][txfm];
|
||||||
}
|
}
|
||||||
#endif // CONFIG_EXT_TX
|
#endif // CONFIG_EXT_TX
|
||||||
@@ -1911,9 +1910,9 @@ static void read_coef_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r) {
|
|||||||
TX_SIZE tx_size;
|
TX_SIZE tx_size;
|
||||||
for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
|
for (tx_size = TX_4X4; tx_size <= max_tx_size; ++tx_size)
|
||||||
read_coef_probs_common(fc->coef_probs[tx_size], r);
|
read_coef_probs_common(fc->coef_probs[tx_size], r);
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
av1_coef_pareto_cdfs(fc);
|
av1_coef_pareto_cdfs(fc);
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_segmentation(AV1_COMMON *const cm,
|
static void setup_segmentation(AV1_COMMON *const cm,
|
||||||
|
@@ -76,11 +76,11 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
|||||||
const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
const aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
||||||
fc->coef_probs[tx_size_ctx][type][ref];
|
fc->coef_probs[tx_size_ctx][type][ref];
|
||||||
const aom_prob *prob;
|
const aom_prob *prob;
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
const aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
|
const aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
|
||||||
fc->coef_cdfs[tx_size_ctx][type][ref];
|
fc->coef_cdfs[tx_size_ctx][type][ref];
|
||||||
const aom_cdf_prob(*cdf)[ENTROPY_TOKENS];
|
const aom_cdf_prob(*cdf)[ENTROPY_TOKENS];
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
|
unsigned int(*coef_counts)[COEFF_CONTEXTS][UNCONSTRAINED_NODES + 1];
|
||||||
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
|
unsigned int(*eob_branch_count)[COEFF_CONTEXTS];
|
||||||
uint8_t token_cache[MAX_TX_SQUARE];
|
uint8_t token_cache[MAX_TX_SQUARE];
|
||||||
@@ -166,7 +166,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
|||||||
dqv_val = &dq_val[band][0];
|
dqv_val = &dq_val[band][0];
|
||||||
#endif // CONFIG_NEW_QUANT
|
#endif // CONFIG_NEW_QUANT
|
||||||
}
|
}
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
cdf = &coef_cdfs[band][ctx];
|
cdf = &coef_cdfs[band][ctx];
|
||||||
token = ONE_TOKEN +
|
token = ONE_TOKEN +
|
||||||
aom_read_symbol(r, *cdf, CATEGORY6_TOKEN - ONE_TOKEN + 1, ACCT_STR);
|
aom_read_symbol(r, *cdf, CATEGORY6_TOKEN - ONE_TOKEN + 1, ACCT_STR);
|
||||||
@@ -263,7 +263,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
#if CONFIG_NEW_QUANT
|
#if CONFIG_NEW_QUANT
|
||||||
v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
|
v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val);
|
||||||
v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v;
|
v = dq_shift ? ROUND_POWER_OF_TWO(v, dq_shift) : v;
|
||||||
@@ -368,13 +368,7 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
|
|||||||
|
|
||||||
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
|
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
|
||||||
const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size,
|
const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size,
|
||||||
TX_TYPE tx_type,
|
TX_TYPE tx_type, aom_reader *r, int seg_id) {
|
||||||
#if CONFIG_ANS
|
|
||||||
struct AnsDecoder *const r,
|
|
||||||
#else
|
|
||||||
aom_reader *r,
|
|
||||||
#endif // CONFIG_ANS
|
|
||||||
int seg_id) {
|
|
||||||
struct macroblockd_plane *const pd = &xd->plane[plane];
|
struct macroblockd_plane *const pd = &xd->plane[plane];
|
||||||
const int16_t *const dequant = pd->seg_dequant[seg_id];
|
const int16_t *const dequant = pd->seg_dequant[seg_id];
|
||||||
const int ctx =
|
const int ctx =
|
||||||
|
@@ -666,11 +666,11 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
|
|||||||
while (p < stop && p->token != EOSB_TOKEN) {
|
while (p < stop && p->token != EOSB_TOKEN) {
|
||||||
const int token = p->token;
|
const int token = p->token;
|
||||||
aom_tree_index index = 0;
|
aom_tree_index index = 0;
|
||||||
#if !CONFIG_ANS
|
#if !CONFIG_RANS
|
||||||
const struct av1_token *const coef_encoding = &av1_coef_encodings[token];
|
const struct av1_token *const coef_encoding = &av1_coef_encodings[token];
|
||||||
int coef_value = coef_encoding->value;
|
int coef_value = coef_encoding->value;
|
||||||
int coef_length = coef_encoding->len;
|
int coef_length = coef_encoding->len;
|
||||||
#endif // !CONFIG_ANS
|
#endif // !CONFIG_RANS
|
||||||
#if CONFIG_AOM_HIGHBITDEPTH
|
#if CONFIG_AOM_HIGHBITDEPTH
|
||||||
const av1_extra_bit *const extra_bits_av1 =
|
const av1_extra_bit *const extra_bits_av1 =
|
||||||
(bit_depth == AOM_BITS_12)
|
(bit_depth == AOM_BITS_12)
|
||||||
@@ -682,7 +682,7 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
|
|||||||
(void)bit_depth;
|
(void)bit_depth;
|
||||||
#endif // CONFIG_AOM_HIGHBITDEPTH
|
#endif // CONFIG_AOM_HIGHBITDEPTH
|
||||||
|
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
/* skip one or two nodes */
|
/* skip one or two nodes */
|
||||||
if (!p->skip_eob_node) aom_write(w, token != EOB_TOKEN, p->context_tree[0]);
|
if (!p->skip_eob_node) aom_write(w, token != EOB_TOKEN, p->context_tree[0]);
|
||||||
|
|
||||||
@@ -715,7 +715,7 @@ static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
|
|
||||||
if (extra_bits_av1->base_val) {
|
if (extra_bits_av1->base_val) {
|
||||||
const int extra_bits = p->extra;
|
const int extra_bits = p->extra;
|
||||||
@@ -1584,7 +1584,7 @@ static void write_mb_modes_kf(const AV1_COMMON *cm, const MACROBLOCKD *xd,
|
|||||||
#define write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, \
|
#define write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, \
|
||||||
mi_row, mi_col) \
|
mi_row, mi_col) \
|
||||||
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col)
|
write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col)
|
||||||
#endif // CONFIG_ANS && CONFIG_SUPERTX
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
|
static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
|
||||||
aom_writer *w, const TOKENEXTRA **tok,
|
aom_writer *w, const TOKENEXTRA **tok,
|
||||||
@@ -1598,11 +1598,11 @@ static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
|
|||||||
MODE_INFO *m;
|
MODE_INFO *m;
|
||||||
int plane;
|
int plane;
|
||||||
int bh, bw;
|
int bh, bw;
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
(void)tok;
|
(void)tok;
|
||||||
(void)tok_end;
|
(void)tok_end;
|
||||||
(void)plane;
|
(void)plane;
|
||||||
#endif // !CONFIG_ANS
|
#endif // !CONFIG_RANS
|
||||||
|
|
||||||
xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
|
xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
|
||||||
m = xd->mi[0];
|
m = xd->mi[0];
|
||||||
@@ -1777,7 +1777,7 @@ static void write_partition(const AV1_COMMON *const cm,
|
|||||||
#define write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, \
|
#define write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, \
|
||||||
mi_row, mi_col, bsize) \
|
mi_row, mi_col, bsize) \
|
||||||
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, bsize)
|
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, bsize)
|
||||||
#endif // CONFIG_ANS && CONFIG_SUPERTX
|
#endif // CONFIG_SUPERTX
|
||||||
|
|
||||||
static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
|
static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
|
||||||
aom_writer *const w, const TOKENEXTRA **tok,
|
aom_writer *const w, const TOKENEXTRA **tok,
|
||||||
@@ -2390,9 +2390,9 @@ static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
|
|||||||
const TX_MODE tx_mode = cpi->common.tx_mode;
|
const TX_MODE tx_mode = cpi->common.tx_mode;
|
||||||
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
|
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
|
||||||
TX_SIZE tx_size;
|
TX_SIZE tx_size;
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
int update = 0;
|
int update = 0;
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
#if CONFIG_ENTROPY
|
#if CONFIG_ENTROPY
|
||||||
AV1_COMMON *cm = &cpi->common;
|
AV1_COMMON *cm = &cpi->common;
|
||||||
SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
|
SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
|
||||||
@@ -2440,18 +2440,18 @@ static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
|
|||||||
|
|
||||||
update_coef_probs_subframe(w, cpi, tx_size, cpi->branch_ct_buf,
|
update_coef_probs_subframe(w, cpi, tx_size, cpi->branch_ct_buf,
|
||||||
frame_coef_probs);
|
frame_coef_probs);
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
update = 1;
|
update = 1;
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
} else {
|
} else {
|
||||||
#endif // CONFIG_ENTROPY
|
#endif // CONFIG_ENTROPY
|
||||||
build_tree_distribution(cpi, tx_size, frame_branch_ct,
|
build_tree_distribution(cpi, tx_size, frame_branch_ct,
|
||||||
frame_coef_probs);
|
frame_coef_probs);
|
||||||
update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
|
update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
|
||||||
frame_coef_probs);
|
frame_coef_probs);
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
update = 1;
|
update = 1;
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
#if CONFIG_ENTROPY
|
#if CONFIG_ENTROPY
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ENTROPY
|
#endif // CONFIG_ENTROPY
|
||||||
@@ -2476,9 +2476,9 @@ static void update_coef_probs(AV1_COMP *cpi, aom_writer *w) {
|
|||||||
av1_copy(cm->counts.eob_branch, eob_counts_copy);
|
av1_copy(cm->counts.eob_branch, eob_counts_copy);
|
||||||
}
|
}
|
||||||
#endif // CONFIG_ENTROPY
|
#endif // CONFIG_ENTROPY
|
||||||
#if CONFIG_ANS
|
#if CONFIG_RANS
|
||||||
if (update) av1_coef_pareto_cdfs(cpi->common.fc);
|
if (update) av1_coef_pareto_cdfs(cpi->common.fc);
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_LOOP_RESTORATION
|
#if CONFIG_LOOP_RESTORATION
|
||||||
|
@@ -336,12 +336,12 @@ const av1_extra_bit av1_extra_bits_high12[ENTROPY_TOKENS] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !CONFIG_ANS
|
#if !CONFIG_RANS
|
||||||
const struct av1_token av1_coef_encodings[ENTROPY_TOKENS] = {
|
const struct av1_token av1_coef_encodings[ENTROPY_TOKENS] = {
|
||||||
{ 2, 2 }, { 6, 3 }, { 28, 5 }, { 58, 6 }, { 59, 6 }, { 60, 6 },
|
{ 2, 2 }, { 6, 3 }, { 28, 5 }, { 58, 6 }, { 59, 6 }, { 60, 6 },
|
||||||
{ 61, 6 }, { 124, 7 }, { 125, 7 }, { 126, 7 }, { 127, 7 }, { 0, 1 }
|
{ 61, 6 }, { 124, 7 }, { 125, 7 }, { 126, 7 }, { 127, 7 }, { 0, 1 }
|
||||||
};
|
};
|
||||||
#endif // !CONFIG_ANS
|
#endif // !CONFIG_RANS
|
||||||
|
|
||||||
struct tokenize_b_args {
|
struct tokenize_b_args {
|
||||||
const AV1_COMP *cpi;
|
const AV1_COMP *cpi;
|
||||||
@@ -386,17 +386,17 @@ static void set_entropy_context_b(int plane, int block, int blk_row,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
|
static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS],
|
const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS],
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
int32_t extra, uint8_t token,
|
int32_t extra, uint8_t token,
|
||||||
uint8_t skip_eob_node, unsigned int *counts) {
|
uint8_t skip_eob_node, unsigned int *counts) {
|
||||||
(*t)->token = token;
|
(*t)->token = token;
|
||||||
(*t)->extra = extra;
|
(*t)->extra = extra;
|
||||||
(*t)->context_tree = context_tree;
|
(*t)->context_tree = context_tree;
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
(*t)->token_cdf = token_cdf;
|
(*t)->token_cdf = token_cdf;
|
||||||
#endif // CONFIG_ANS
|
#endif // CONFIG_RANS
|
||||||
(*t)->skip_eob_node = skip_eob_node;
|
(*t)->skip_eob_node = skip_eob_node;
|
||||||
(*t)++;
|
(*t)++;
|
||||||
++counts[token];
|
++counts[token];
|
||||||
@@ -489,10 +489,10 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
|
|||||||
aom_prob(*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
aom_prob(*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
|
||||||
cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
|
cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
|
||||||
#endif // CONFIG_ENTROPY
|
#endif // CONFIG_ENTROPY
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
|
aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
|
||||||
cpi->common.fc->coef_cdfs[tx_size][type][ref];
|
cpi->common.fc->coef_cdfs[tx_size][type][ref];
|
||||||
#endif // CONFIG_ANS
|
#endif
|
||||||
unsigned int(*const eob_branch)[COEFF_CONTEXTS] =
|
unsigned int(*const eob_branch)[COEFF_CONTEXTS] =
|
||||||
td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref];
|
td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref];
|
||||||
const uint8_t *const band = get_band_translate(tx_size);
|
const uint8_t *const band = get_band_translate(tx_size);
|
||||||
@@ -513,9 +513,9 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
|
|||||||
av1_get_token_extra(v, &token, &extra);
|
av1_get_token_extra(v, &token, &extra);
|
||||||
|
|
||||||
add_token(&t, coef_probs[band[c]][pt],
|
add_token(&t, coef_probs[band[c]][pt],
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
(const aom_cdf_prob(*)[ENTROPY_TOKENS]) & coef_cdfs[band[c]][pt],
|
(const aom_cdf_prob(*)[ENTROPY_TOKENS]) & coef_cdfs[band[c]][pt],
|
||||||
#endif // CONFIG_ANS
|
#endif
|
||||||
extra, (uint8_t)token, (uint8_t)skip_eob, counts[band[c]][pt]);
|
extra, (uint8_t)token, (uint8_t)skip_eob, counts[band[c]][pt]);
|
||||||
|
|
||||||
token_cache[scan[c]] = av1_pt_energy_class[token];
|
token_cache[scan[c]] = av1_pt_energy_class[token];
|
||||||
@@ -525,7 +525,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
|
|||||||
}
|
}
|
||||||
if (c < seg_eob) {
|
if (c < seg_eob) {
|
||||||
add_token(&t, coef_probs[band[c]][pt],
|
add_token(&t, coef_probs[band[c]][pt],
|
||||||
#if CONFIG_ANS || CONFIG_DAALA_EC
|
#if CONFIG_RANS || CONFIG_DAALA_EC
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
0, EOB_TOKEN, 0, counts[band[c]][pt]);
|
0, EOB_TOKEN, 0, counts[band[c]][pt]);
|
||||||
|
@@ -46,9 +46,9 @@ typedef struct {
|
|||||||
|
|
||||||
extern const aom_tree_index av1_coef_tree[];
|
extern const aom_tree_index av1_coef_tree[];
|
||||||
extern const aom_tree_index av1_coef_con_tree[];
|
extern const aom_tree_index av1_coef_con_tree[];
|
||||||
#if !CONFIG_ANS
|
#if !CONFIG_RANS
|
||||||
extern const struct av1_token av1_coef_encodings[];
|
extern const struct av1_token av1_coef_encodings[];
|
||||||
#endif // !CONFIG_ANS
|
#endif // !CONFIG_RANS
|
||||||
|
|
||||||
int av1_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
|
int av1_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
|
||||||
int av1_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
|
int av1_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
|
||||||
|
Reference in New Issue
Block a user