Commit 78f7bb98 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan Committed by Fred BARBIER

Remove experimental flag of LV_MAP_MULTI

This experiment has been adopted, we can simplify the code
by dropping the associated preprocessor conditionals.

Change-Id: I3e08eec385c40360e3934fa4f66f7c671e860517
parent 5ebd8704
......@@ -49,11 +49,9 @@
#if CONFIG_LV_MAP
#define aom_read_bin(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_bin_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#if CONFIG_LV_MAP_MULTI
#define aom_read_symbol4(r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol4_(r, cdf, nsymbs ACCT_STR_ARG(ACCT_STR_NAME))
#endif
#endif
#ifdef __cplusplus
extern "C" {
......@@ -156,13 +154,7 @@ static INLINE int aom_read_symbol_(aom_reader *r, aom_cdf_prob *cdf,
static INLINE int aom_read_bin_(aom_reader *r, aom_cdf_prob *cdf,
int nsymbs ACCT_STR_PARAM) {
int ret;
#if CONFIG_LV_MAP_MULTI
ret = aom_read_cdf(r, cdf, nsymbs, ACCT_STR_NAME);
#else
aom_cdf_prob this_cdf[3] = { (aom_cdf_prob)((cdf[0] >> 8) << 8), 0, 0 };
this_cdf[0] = clamp(this_cdf[0], (1 << 8), (127 << 8));
ret = aom_read_cdf(r, this_cdf, nsymbs, ACCT_STR_NAME);
#endif
if (r->allow_update_cdf) update_bin(cdf, ret, nsymbs);
// printf("bin: %d\n", this_cdf[0]);
return ret;
......
......@@ -104,13 +104,7 @@ static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
#if CONFIG_LV_MAP
static INLINE void aom_write_bin(aom_writer *w, int symb, aom_cdf_prob *cdf,
int nsymbs) {
#if CONFIG_LV_MAP_MULTI
aom_write_cdf(w, symb, cdf, nsymbs);
#else
aom_cdf_prob this_cdf[3] = { (aom_cdf_prob)((cdf[0] >> 8) << 8), 0, 0 };
this_cdf[0] = clamp(this_cdf[0], (1 << 8), (127 << 8));
aom_write_cdf(w, symb, this_cdf, nsymbs);
#endif
if (w->allow_update_cdf) update_bin(cdf, symb, nsymbs);
// printf("bin: %d\n", this_cdf[0]);
}
......
......@@ -15,13 +15,8 @@
#include <stddef.h>
#include "av1/common/odintrin.h"
#if CONFIG_LV_MAP_MULTI
#define EC_PROB_SHIFT 6
#define EC_MIN_PROB 4 // must be <= (1<<EC_PROB_SHIFT)/16
#else
#define EC_PROB_SHIFT 0
#define EC_MIN_PROB 0
#endif
/*OPT: od_ec_window must be at least 32 bits, but if you have fast arithmetic
on a larger type, you can speed up the decoder by using it here.*/
......
......@@ -156,11 +156,7 @@ static void od_ec_encode_q15(od_ec_enc *enc, unsigned fl, unsigned fh, int s,
l = enc->low;
r = enc->rng;
OD_ASSERT(32768U <= r);
#if CONFIG_LV_MAP_MULTI
OD_ASSERT(fh <= fl);
#else
OD_ASSERT(fh < fl);
#endif
OD_ASSERT(fl <= 32768U);
const int N = nsyms - 1;
if (fl < 32768U) {
......
......@@ -137,7 +137,6 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
int diff;
#if 1
#if CONFIG_LV_MAP_MULTI
// static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
// 3, 3, 3, 3, 4 };
// static const int nsymbs2speed[17] = { 0, 0, 1, 1, 2, 2, 2, 2, 2,
......@@ -165,32 +164,6 @@ static INLINE void update_cdf(aom_cdf_prob *cdf, int val, int nsymbs) {
#endif
}
#else
rate = 4 + (cdf[nsymbs] > 31) + get_msb(nsymbs);
#if CONFIG_LV_MAP
if (nsymbs == 2)
rate = 4 + (cdf[nsymbs] > 7) + (cdf[nsymbs] > 15) + get_msb(nsymbs);
#endif
const int tmp0 = 1 << rate2;
tmp = AOM_ICDF(tmp0);
diff = ((CDF_PROB_TOP - (nsymbs << rate2)) >> rate) << rate;
// Single loop (faster)
for (i = 0; i < nsymbs - 1; ++i, tmp -= tmp0) {
tmp -= (i == val ? diff : 0);
#if CONFIG_LV_MAP_MULTI
if (tmp < cdf[i]) {
cdf[i] -= ((cdf[i] - tmp) >> rate);
} else {
cdf[i] += ((tmp - cdf[i]) >> rate);
}
#else
cdf[i] += ((tmp - cdf[i]) >> rate);
#endif
}
#endif
#else
for (i = 0; i < nsymbs; ++i) {
tmp = (i + 1) << rate2;
......
......@@ -944,7 +944,6 @@ static const TX_SIZE txsize_sqr_up_map[TX_SIZES_ALL] = {
#endif // CONFIG_TX64X64
};
#if CONFIG_LV_MAP_MULTI
static const int8_t txsize_log2_minus4[TX_SIZES_ALL] = {
0, // TX_4X4
2, // TX_8X8
......@@ -972,7 +971,6 @@ static const int8_t txsize_log2_minus4[TX_SIZES_ALL] = {
5, // TX_64X16
#endif // CONFIG_TX64X64
};
#endif
/* clang-format off */
#if CONFIG_SIMPLIFY_TX_MODE
......
......@@ -644,14 +644,9 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
#if CONFIG_LV_MAP
AVERAGE_TILE_CDFS(txb_skip_cdf)
#if !CONFIG_LV_MAP_MULTI
AVERAGE_TILE_CDFS(nz_map_cdf)
AVERAGE_TILE_CDFS(eob_flag_cdf)
#endif
AVERAGE_TILE_CDFS(eob_extra_cdf)
AVERAGE_TILE_CDFS(dc_sign_cdf)
AVERAGE_TILE_CDFS(coeff_base_cdf)
#if CONFIG_LV_MAP_MULTI
AVERAGE_TILE_CDFS(eob_flag_cdf16)
AVERAGE_TILE_CDFS(eob_flag_cdf32)
AVERAGE_TILE_CDFS(eob_flag_cdf64)
......@@ -660,9 +655,6 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS(eob_flag_cdf512)
AVERAGE_TILE_CDFS(eob_flag_cdf1024)
AVERAGE_TILE_CDFS(coeff_base_eob_cdf)
#else // CONFIG_LV_MAP_MULTI
AVERAGE_TILE_CDFS(coeff_lps_cdf)
#endif
AVERAGE_TILE_CDFS(coeff_br_cdf)
#else // CONFI_LV_MAP
AVERAGE_TILE_CDFS(coef_head_cdfs)
......
......@@ -63,20 +63,16 @@ extern "C" {
#define SIG_COEF_CONTEXTS_2D 26
#define SIG_COEF_CONTEXTS_1D 16
#if CONFIG_LV_MAP_MULTI
#define USE_CAUSAL_BR_CTX 1
#define SIG_COEF_CONTEXTS_EOB 4
#define SIG_COEF_CONTEXTS (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D)
#else
#define SIG_COEF_CONTEXTS (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D)
#endif
#define COEFF_BASE_CONTEXTS (SIG_COEF_CONTEXTS)
#define DC_SIGN_CONTEXTS 3
#define BR_TMP_OFFSET 12
#define BR_REF_CAT 4
#if CONFIG_LV_MAP_MULTI && USE_CAUSAL_BR_CTX
#if USE_CAUSAL_BR_CTX
#define LEVEL_CONTEXTS 21
#else
#define LEVEL_CONTEXTS (BR_TMP_OFFSET * BR_REF_CAT)
......@@ -84,13 +80,8 @@ extern "C" {
#define NUM_BASE_LEVELS 2
#if CONFIG_LV_MAP_MULTI
#define BR_CDF_SIZE (4)
#define COEFF_BASE_RANGE (4 * (BR_CDF_SIZE - 1))
#else
#define COEFF_BASE_RANGE (16 - NUM_BASE_LEVELS)
#define BASE_RANGE_SETS 3
#endif
#define COEFF_CONTEXT_BITS 6
#define COEFF_CONTEXT_MASK ((1 << COEFF_CONTEXT_BITS) - 1)
......
This diff is collapsed.
......@@ -83,29 +83,12 @@ typedef struct frame_contexts {
aom_prob eob_extra[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS];
aom_prob dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS];
#if !CONFIG_LV_MAP_MULTI
aom_prob eob_flag[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS];
aom_prob nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS];
aom_prob coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
[COEFF_BASE_CONTEXTS];
aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS];
aom_prob coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS];
#else
aom_prob coeff_lps[TX_SIZES][PLANE_TYPES][BR_CDF_SIZE - 1][LEVEL_CONTEXTS];
#endif
aom_cdf_prob txb_skip_cdf[TX_SIZES][TXB_SKIP_CONTEXTS][CDF_SIZE(2)];
#if !CONFIG_LV_MAP_MULTI
aom_cdf_prob nz_map_cdf[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS]
[CDF_SIZE(2)];
aom_cdf_prob eob_flag_cdf[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS]
[CDF_SIZE(2)];
#endif
aom_cdf_prob eob_extra_cdf[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS]
[CDF_SIZE(2)];
aom_cdf_prob dc_sign_cdf[PLANE_TYPES][DC_SIGN_CONTEXTS][CDF_SIZE(2)];
#if CONFIG_LV_MAP_MULTI
aom_cdf_prob eob_flag_cdf16[PLANE_TYPES][2][CDF_SIZE(5)];
aom_cdf_prob eob_flag_cdf32[PLANE_TYPES][2][CDF_SIZE(6)];
aom_cdf_prob eob_flag_cdf64[PLANE_TYPES][2][CDF_SIZE(7)];
......@@ -119,14 +102,6 @@ typedef struct frame_contexts {
[CDF_SIZE(4)];
aom_cdf_prob coeff_br_cdf[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS]
[CDF_SIZE(BR_CDF_SIZE)];
#else
aom_cdf_prob coeff_base_cdf[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
[COEFF_BASE_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob coeff_lps_cdf[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS]
[CDF_SIZE(2)];
aom_cdf_prob coeff_br_cdf[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS]
[LEVEL_CONTEXTS][CDF_SIZE(2)];
#endif
#endif
aom_cdf_prob newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)];
......@@ -265,14 +240,6 @@ typedef struct FRAME_COUNTS {
unsigned int eob_extra[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS][2];
unsigned int dc_sign[PLANE_TYPES][DC_SIGN_CONTEXTS][2];
#if !CONFIG_LV_MAP_MULTI
unsigned int nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS][2];
unsigned int coeff_base[TX_SIZES][PLANE_TYPES][NUM_BASE_LEVELS]
[COEFF_BASE_CONTEXTS][2];
unsigned int coeff_br[TX_SIZES][PLANE_TYPES][BASE_RANGE_SETS][LEVEL_CONTEXTS]
[2];
unsigned int coeff_lps[TX_SIZES][PLANE_TYPES][LEVEL_CONTEXTS][2];
#else
unsigned int eob_multi16[PLANE_TYPES][2][5];
unsigned int eob_multi32[PLANE_TYPES][2][6];
unsigned int eob_multi64[PLANE_TYPES][2][7];
......@@ -289,7 +256,6 @@ typedef struct FRAME_COUNTS {
[NUM_BASE_LEVELS + 2];
unsigned int coeff_base_eob_multi[TX_SIZES][PLANE_TYPES]
[SIG_COEF_CONTEXTS_EOB][NUM_BASE_LEVELS + 1];
#endif
#endif // CONFIG_LV_MAP
#if CONFIG_SYMBOLRATE
......
......@@ -244,7 +244,6 @@ void av1_init_txb_probs(FRAME_CONTEXT *fc) {
}
}
#if CONFIG_LV_MAP_MULTI
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
#if 0
......@@ -276,40 +275,9 @@ void av1_init_txb_probs(FRAME_CONTEXT *fc) {
#endif
}
}
#else
// Update probability models for non-zero coefficient map and eob flag.
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
for (int level = 0; level < NUM_BASE_LEVELS; ++level) {
for (ctx = 0; ctx < COEFF_BASE_CONTEXTS; ++ctx) {
fc->coeff_base_cdf[tx_size][plane][level][ctx][0] = AOM_ICDF(
128 * (aom_cdf_prob)fc->coeff_base[tx_size][plane][level][ctx]);
fc->coeff_base_cdf[tx_size][plane][level][ctx][1] = AOM_ICDF(32768);
fc->coeff_base_cdf[tx_size][plane][level][ctx][2] = 0;
}
}
}
}
#endif
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
#if !CONFIG_LV_MAP_MULTI
for (ctx = 0; ctx < SIG_COEF_CONTEXTS; ++ctx) {
fc->nz_map_cdf[tx_size][plane][ctx][0] =
AOM_ICDF(128 * (aom_cdf_prob)fc->nz_map[tx_size][plane][ctx]);
fc->nz_map_cdf[tx_size][plane][ctx][1] = AOM_ICDF(32768);
fc->nz_map_cdf[tx_size][plane][ctx][2] = 0;
}
for (ctx = 0; ctx < EOB_COEF_CONTEXTS; ++ctx) {
fc->eob_flag_cdf[tx_size][plane][ctx][0] =
AOM_ICDF(128 * (aom_cdf_prob)fc->eob_flag[tx_size][plane][ctx]);
fc->eob_flag_cdf[tx_size][plane][ctx][1] = AOM_ICDF(32768);
fc->eob_flag_cdf[tx_size][plane][ctx][2] = 0;
}
#endif
for (ctx = 0; ctx < EOB_COEF_CONTEXTS; ++ctx) {
fc->eob_extra_cdf[tx_size][plane][ctx][0] =
AOM_ICDF(128 * (aom_cdf_prob)fc->eob_extra[tx_size][plane][ctx]);
......@@ -321,7 +289,6 @@ void av1_init_txb_probs(FRAME_CONTEXT *fc) {
for (tx_size = 0; tx_size < TX_SIZES; ++tx_size) {
for (plane = 0; plane < PLANE_TYPES; ++plane) {
#if CONFIG_LV_MAP_MULTI
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) {
#if 0
int p = 32768 - fc->coeff_lps[tx_size][plane][0][ctx] * 128;
......@@ -343,23 +310,6 @@ void av1_init_txb_probs(FRAME_CONTEXT *fc) {
(void)ctx; // coeff_br_cdf is initialized in init_mode_probs
#endif
}
#else
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) {
fc->coeff_lps_cdf[tx_size][plane][ctx][0] =
AOM_ICDF(128 * (aom_cdf_prob)fc->coeff_lps[tx_size][plane][ctx]);
fc->coeff_lps_cdf[tx_size][plane][ctx][1] = AOM_ICDF(32768);
fc->coeff_lps_cdf[tx_size][plane][ctx][2] = 0;
}
for (int br = 0; br < BASE_RANGE_SETS; ++br) {
for (ctx = 0; ctx < LEVEL_CONTEXTS; ++ctx) {
fc->coeff_br_cdf[tx_size][plane][br][ctx][0] = AOM_ICDF(
128 * (aom_cdf_prob)fc->coeff_br[tx_size][plane][br][ctx]);
fc->coeff_br_cdf[tx_size][plane][br][ctx][1] = AOM_ICDF(32768);
fc->coeff_br_cdf[tx_size][plane][br][ctx][2] = 0;
}
}
#endif
}
}
}
......
......@@ -43,7 +43,7 @@ static const int base_ref_offset[BASE_CONTEXT_POSITION_NUM][2] = {
};
#define CONTEXT_MAG_POSITION_NUM 3
#if CONFIG_LV_MAP_MULTI && USE_CAUSAL_BR_CTX
#if USE_CAUSAL_BR_CTX
static const int mag_ref_offset_with_txclass[3][CONTEXT_MAG_POSITION_NUM][2] = {
{ { 0, 1 }, { 1, 0 }, { 1, 1 } },
{ { 0, 1 }, { 1, 0 }, { 0, 2 } },
......@@ -195,7 +195,7 @@ static INLINE int get_level_count(const uint8_t *const levels, const int stride,
return count;
}
#if CONFIG_LV_MAP_MULTI && USE_CAUSAL_BR_CTX
#if USE_CAUSAL_BR_CTX
static INLINE void get_level_mag_with_txclass(const uint8_t *const levels,
const int stride, const int row,
const int col, int *const mag,
......@@ -315,20 +315,6 @@ static const int br_level_map[9] = {
0, 0, 1, 1, 2, 2, 3, 3, 3,
};
#if !CONFIG_LV_MAP_MULTI
static const int coeff_to_br_index[COEFF_BASE_RANGE] = {
0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
};
static const int br_index_to_coeff[BASE_RANGE_SETS] = {
0, 2, 6,
};
static const int br_extra_bits[BASE_RANGE_SETS] = {
1, 2, 3,
};
#endif
// Note: If BR_MAG_OFFSET changes, the calculation of offset in
// get_br_ctx_from_count_mag() must be updated.
#define BR_MAG_OFFSET 1
......@@ -378,7 +364,7 @@ static INLINE int get_br_ctx_from_count_mag(const int row, const int col,
static INLINE int get_br_ctx(const uint8_t *const levels,
const int c, // raster order
const int bwl, const int count
#if CONFIG_LV_MAP_MULTI && USE_CAUSAL_BR_CTX
#if USE_CAUSAL_BR_CTX
,
const TX_TYPE tx_type
#endif
......@@ -388,7 +374,7 @@ static INLINE int get_br_ctx(const uint8_t *const levels,
const int stride = (1 << bwl) + TX_PAD_HOR;
int mag = 0;
int nb_mag[3] = { 0 };
#if CONFIG_LV_MAP_MULTI && USE_CAUSAL_BR_CTX
#if USE_CAUSAL_BR_CTX
(void)count;
const TX_CLASS tx_class = tx_type_to_class[tx_type];
get_level_mag_with_txclass(levels, stride, row, col, nb_mag, tx_class);
......@@ -541,19 +527,15 @@ static INLINE int get_nz_map_ctx_from_stats(
static INLINE int get_nz_map_ctx(const uint8_t *const levels,
const int coeff_idx, const int bwl,
#if CONFIG_LV_MAP_MULTI
const int height, const int scan_idx,
const int is_eob,
#endif
const TX_SIZE tx_size, const TX_TYPE tx_type) {
#if CONFIG_LV_MAP_MULTI
const int is_eob, const TX_SIZE tx_size,
const TX_TYPE tx_type) {
if (is_eob) {
if (scan_idx == 0) return 0;
if (scan_idx <= (height << bwl) / 8) return 1;
if (scan_idx <= (height << bwl) / 4) return 2;
return 3;
}
#endif
const TX_CLASS tx_class = tx_type_to_class[tx_type];
const int stats =
get_nz_mag(levels + get_padded_idx(coeff_idx, bwl), bwl, tx_class);
......
......@@ -126,7 +126,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
int eob_extra = 0;
int eob_pt = 1;
#if CONFIG_LV_MAP_MULTI
(void)max_eob_pt;
const int eob_multi_size = txsize_log2_minus4[tx_size];
const int eob_multi_ctx = (tx_type_to_class[tx_type] == TX_CLASS_2D) ? 0 : 1;
......@@ -205,23 +204,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
break;
}
}
#else
for (eob_pt = 1; eob_pt < max_eob_pt; eob_pt++) {
const int eob_pos_ctx = av1_get_eob_pos_ctx(tx_type, eob_pt);
const int is_equal = av1_read_record_bin(
counts, r, ec_ctx->eob_flag_cdf[txs_ctx][plane_type][eob_pos_ctx], 2,
ACCT_STR);
// printf("eob_flag_cdf: %d %d %2d\n", txs_ctx, plane_type, eob_pos_ctx);
// aom_read_symbol(r,
// ec_ctx->eob_flag_cdf[AOMMIN(txs_ctx,3)][plane_type][eob_pos_ctx], 2,
// ACCT_STR);
if (counts) ++counts->eob_flag[txs_ctx][plane_type][eob_pos_ctx][is_equal];
if (is_equal) {
break;
}
}
#endif
// printf("Dec: ");
if (k_eob_offset_bits[eob_pt] > 0) {
......@@ -249,7 +231,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
for (int i = 0; i < *eob; ++i) {
c = *eob - 1 - i;
const int pos = scan[c];
#if CONFIG_LV_MAP_MULTI
const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, c,
c == *eob - 1, tx_size, tx_type);
aom_cdf_prob *cdf;
......@@ -301,54 +282,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
update_pos[num_updates++] = pos;
}
}
#else
int is_nz;
const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
if (c < *eob - 1) {
is_nz = av1_read_record_bin(
counts, r, ec_ctx->nz_map_cdf[txs_ctx][plane_type][coeff_ctx], 2,
ACCT_STR);
} else {
is_nz = 1;
}
if (is_nz) {
int k;
for (k = 0; k < NUM_BASE_LEVELS; ++k) {
const int ctx = coeff_ctx;
const int is_k = av1_read_record_bin(
counts, r, ec_ctx->coeff_base_cdf[txs_ctx][plane_type][k][ctx], 2,
ACCT_STR);
if (counts) ++counts->coeff_base[txs_ctx][plane_type][k][ctx][is_k];
// semantic: is_k = 1 if level > (k+1)
if (is_k == 0) {
cul_level += k + 1;
#if CONFIG_NEW_QUANT
dqv_val = &dq_val[pos != 0][0];
#if !CONFIG_DAALA_TX
v = av1_dequant_abscoeff_nuq(k + 1, dequant[!!c], dqv_val, shift);
#else
v = av1_dequant_abscoeff_nuq(k + 1, dequant[!!c], dqv_val, 0);
#endif // !CONFIG_DAALA_TX
#else
v = (k + 1) * dequant[!!c];
#if !CONFIG_DAALA_TX
v = v >> shift;
#endif // !CONFIG_DAALA_TX
#endif // CONFIG_NEW_QUANT
tcoeffs[pos] = v;
break;
}
}
levels[get_padded_idx(pos, bwl)] = k + 1;
*max_scan_line = AOMMAX(*max_scan_line, pos);
if (k == NUM_BASE_LEVELS) {
update_pos[num_updates++] = pos;
}
}
#endif
}
// Loop to decode all signs in the transform block,
......@@ -369,9 +302,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
}
if (num_updates) {
#if !CONFIG_LV_MAP_MULTI
av1_get_br_level_counts(levels, width, height, level_counts);
#endif
for (c = 0; c < num_updates; ++c) {
const int pos = update_pos[c];
uint8_t *const level = &levels[get_padded_idx(pos, bwl)];
......@@ -380,11 +310,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
assert(*level > NUM_BASE_LEVELS);
#if !CONFIG_LV_MAP_MULTI
ctx = get_br_ctx(levels, pos, bwl, level_counts[pos]);
#endif
#if CONFIG_LV_MAP_MULTI
#if USE_CAUSAL_BR_CTX
ctx = get_br_ctx(levels, pos, bwl, level_counts[pos], tx_type);
#else
......@@ -427,56 +352,6 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
tcoeffs[pos] = t;
continue;
}
#else
for (idx = 0; idx < BASE_RANGE_SETS; ++idx) {
// printf("br: %d %d %d %d\n", txs_ctx, plane_type, idx, ctx);
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_br_cdf[txs_ctx][plane_type][idx][ctx],
2, ACCT_STR)) {
const int extra_bits = (1 << br_extra_bits[idx]) - 1;
// int br_offset = aom_read_literal(r, extra_bits, ACCT_STR);
int br_offset = 0;
int tok;
if (counts) ++counts->coeff_br[txs_ctx][plane_type][idx][ctx][1];
for (tok = 0; tok < extra_bits; ++tok) {
if (av1_read_record_bin(
counts, r, ec_ctx->coeff_lps_cdf[txs_ctx][plane_type][ctx],
2, ACCT_STR)) {
br_offset = tok;
if (counts) ++counts->coeff_lps[txs_ctx][plane_type][ctx][1];
break;
}
if (counts) ++counts->coeff_lps[txs_ctx][plane_type][ctx][0];
}
if (tok == extra_bits) br_offset = extra_bits;
const int br_base = br_index_to_coeff[idx];
*level = NUM_BASE_LEVELS + 1 + br_base + br_offset;
cul_level += *level;
tran_high_t t;
#if CONFIG_NEW_QUANT
dqv_val = &dq_val[pos != 0][0];
#if !CONFIG_DAALA_TX
t = av1_dequant_abscoeff_nuq(*level, dequant[!!pos], dqv_val, shift);
#else
t = av1_dequant_abscoeff_nuq(*level, dequant[!!pos], dqv_val, 0);
#endif // !CONFIG_DAALA_TX
#else
t = *level * dequant[!!pos];
#if !CONFIG_DAALA_TX
t = t >> shift;
#endif // !CONFIG_DAALA_TX
#endif // CONFIG_NEW_QUANT
if (signs[pos]) t = -t;
tcoeffs[pos] = (tran_low_t)t;
break;
}
if (counts) ++counts->coeff_br[txs_ctx][plane_type][idx][ctx][0];
}
if (idx < BASE_RANGE_SETS) continue;
#endif
// decode 0-th order Golomb code
*level = COEFF_BASE_RANGE + 1 + NUM_BASE_LEVELS;
// Save golomb in tcoeffs because adding it to level may incur overflow
......
......@@ -83,11 +83,9 @@ static INLINE void av1_record_superblock(FRAME_COUNTS *counts) {
#if CONFIG_LV_MAP
#define av1_read_record_bin(counts, r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_bin(r, cdf, nsymbs, ACCT_STR_NAME)
#if CONFIG_LV_MAP_MULTI
#define av1_read_record_symbol4(counts, r, cdf, nsymbs, ACCT_STR_NAME) \
aom_read_symbol4(r, cdf, nsymbs, ACCT_STR_NAME)
#endif
#endif
#define av1_read_record(counts, r, prob, ACCT_STR_NAME) \
aom_read(r, prob, ACCT_STR_NAME)
......
......@@ -63,27 +63,14 @@ typedef int av1_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
#if CONFIG_LV_MAP
typedef struct {
int txb_skip_cost[TXB_SKIP_CONTEXTS][2];
#if CONFIG_LV_MAP_MULTI
int base_eob_cost[SIG_COEF_CONTEXTS_EOB][3];
int base_cost[SIG_COEF_CONTEXTS][4];
#else
int eob_cost[EOB_COEF_CONTEXTS][2];
int nz_map_cost[SIG_COEF_CONTEXTS][2];
#endif
int eob_extra_cost[EOB_COEF_CONTEXTS][2];
int dc_sign_cost[DC_SIGN_CONTEXTS][2];
#if !CONFIG_LV_MAP_MULTI
int base_cost[NUM_BASE_LEVELS][COEFF_BASE_CONTEXTS][2];
#endif
int lps_cost[LEVEL_CONTEXTS][COEFF_BASE_RANGE + 1];
#if !CONFIG_LV_MAP_MULTI
int br_cost[BASE_RANGE_SETS][LEVEL_CONTEXTS][2];
#endif
} LV_MAP_COEFF_COST;
#if CONFIG_LV_MAP_MULTI
typedef struct { int eob_cost[2][11]; } LV_MAP_EOB_COST;
#endif
typedef struct {
tran_low_t tcoeff[MAX_MB_PLANE][MAX_SB_SQUARE];
......@@ -265,9 +252,7 @@ struct macroblock {
#if CONFIG_LV_MAP
LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES];
#if CONFIG_LV_MAP_MULTI
LV_MAP_EOB_COST eob_costs[7][2];
#endif
uint16_t cb_offset;
#endif
......
......@@ -43,14 +43,11 @@ void av1_cost_tokens_from_cdf(int *costs, const aom_cdf_prob *cdf,
int i;
aom_cdf_prob prev_cdf = 0;