Commit cad5ebce authored by Sebastien Alaiwan's avatar Sebastien Alaiwan

Remove experimental flag of LV_MAP

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

Change-Id: Ic3438799335c6cd05f170302f49bd47e1f705c24
parent 248b9563
......@@ -352,30 +352,28 @@ if (CONFIG_INTERNAL_STATS)
"${AOM_ROOT}/av1/encoder/blockiness.c")
endif ()
if (CONFIG_LV_MAP)
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/txb_common.c"
"${AOM_ROOT}/av1/common/txb_common.h")
set(AOM_AV1_COMMON_SOURCES
${AOM_AV1_COMMON_SOURCES}
"${AOM_ROOT}/av1/common/txb_common.c"
"${AOM_ROOT}/av1/common/txb_common.h")
set(AOM_AV1_COMMON_INTRIN_SSE2
${AOM_AV1_COMMON_INTRIN_SSE2}
"${AOM_ROOT}/av1/common/x86/txb_sse2.c")
set(AOM_AV1_COMMON_INTRIN_SSE2
${AOM_AV1_COMMON_INTRIN_SSE2}
"${AOM_ROOT}/av1/common/x86/txb_sse2.c")
set(AOM_AV1_DECODER_SOURCES
${AOM_AV1_DECODER_SOURCES}
"${AOM_ROOT}/av1/decoder/decodetxb.c"
"${AOM_ROOT}/av1/decoder/decodetxb.h")
set(AOM_AV1_DECODER_SOURCES
${AOM_AV1_DECODER_SOURCES}
"${AOM_ROOT}/av1/decoder/decodetxb.c"
"${AOM_ROOT}/av1/decoder/decodetxb.h")
set(AOM_AV1_ENCODER_SOURCES
${AOM_AV1_ENCODER_SOURCES}
"${AOM_ROOT}/av1/encoder/encodetxb.c"
"${AOM_ROOT}/av1/encoder/encodetxb.h")
set(AOM_AV1_ENCODER_SOURCES
${AOM_AV1_ENCODER_SOURCES}
"${AOM_ROOT}/av1/encoder/encodetxb.c"
"${AOM_ROOT}/av1/encoder/encodetxb.h")
set(AOM_AV1_ENCODER_INTRIN_SSE2
${AOM_AV1_ENCODER_INTRIN_SSE2}
"${AOM_ROOT}/av1/encoder/x86/encodetxb_sse2.c")
endif ()
set(AOM_AV1_ENCODER_INTRIN_SSE2
${AOM_AV1_ENCODER_INTRIN_SSE2}
"${AOM_ROOT}/av1/encoder/x86/encodetxb_sse2.c")
if (CONFIG_CFL)
set(AOM_AV1_COMMON_SOURCES
......
......@@ -81,7 +81,7 @@ specialize qw/av1_highbd_convolve_vert sse4_1/;
#
# txb
#
if (aom_config("CONFIG_LV_MAP") eq "yes") {
{
add_proto qw/void av1_get_br_level_counts/, "const uint8_t *const levels, const int width, const int height, uint8_t *const level_counts";
specialize qw/av1_get_br_level_counts sse2/;
}
......@@ -414,7 +414,7 @@ if (aom_config("CONFIG_AV1_ENCODER") eq "yes") {
# End av1_high encoder functions
# txb
if (aom_config("CONFIG_LV_MAP") eq "yes") {
{
add_proto qw/void av1_get_nz_map_contexts/, "const uint8_t *const levels, const int16_t *const scan, const uint16_t eob, const TX_SIZE tx_size, const TX_TYPE tx_type, int8_t *const coeff_contexts";
specialize qw/av1_get_nz_map_contexts sse2/;
}
......
......@@ -81,7 +81,6 @@ void av1_foreach_transformed_block_in_plane(
}
}
#if CONFIG_LV_MAP
void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
foreach_transformed_block_visitor visit,
......@@ -94,7 +93,6 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
av1_foreach_transformed_block_in_plane(xd, bsize, plane, visit, arg);
}
}
#endif
void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
int plane, TX_SIZE tx_size, int has_eob, int aoff,
......
......@@ -1025,12 +1025,10 @@ void av1_foreach_transformed_block_in_plane(
const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane,
foreach_transformed_block_visitor visit, void *arg);
#if CONFIG_LV_MAP
void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
BLOCK_SIZE bsize, int mi_row, int mi_col,
foreach_transformed_block_visitor visit,
void *arg, const int num_planes);
#endif
void av1_set_contexts(const MACROBLOCKD *xd, struct macroblockd_plane *pd,
int plane, TX_SIZE tx_size, int has_eob, int aoff,
......
......@@ -18,9 +18,7 @@
#include "av1/common/onyxc_int.h"
#include "av1/common/scan.h"
#include "av1/common/token_cdfs.h"
#if CONFIG_LV_MAP
#include "av1/common/txb_common.h"
#endif
/* Extra bits coded from LSB to MSB */
const aom_cdf_prob av1_cat1_cdf0[CDF_SIZE(2)] = { AOM_CDF2(20352) };
......@@ -563,7 +561,6 @@ static int get_q_ctx(int q) {
#endif // CONFIG_Q_ADAPT_PROBS
void av1_default_coef_probs(AV1_COMMON *cm) {
#if CONFIG_LV_MAP
#if CONFIG_Q_ADAPT_PROBS
const int index = get_q_ctx(cm->base_qindex);
av1_copy(cm->fc->txb_skip_cdf, av1_default_txb_skip_cdfs[index]);
......@@ -595,20 +592,6 @@ void av1_default_coef_probs(AV1_COMMON *cm) {
av1_copy(cm->fc->eob_flag_cdf512, av1_default_eob_multi512);
av1_copy(cm->fc->eob_flag_cdf1024, av1_default_eob_multi1024);
#endif // CONFIG_Q_ADAPT_PROBS
#else
const int index = AOMMIN(TOKEN_CDF_Q_CTXS - 1, cm->base_qindex / 64);
av1_copy(cm->fc->coef_head_cdfs[TX_4X4],
(*av1_default_qctx_coef_cdfs[index])[TX_4X4]);
av1_copy(cm->fc->coef_head_cdfs[TX_8X8],
(*av1_default_qctx_coef_cdfs[index])[TX_8X8]);
av1_copy(cm->fc->coef_head_cdfs[TX_16X16],
(*av1_default_qctx_coef_cdfs[index])[TX_16X16]);
av1_copy(cm->fc->coef_head_cdfs[TX_32X32],
(*av1_default_qctx_coef_cdfs[index])[TX_32X32]);
av1_copy(cm->fc->coef_head_cdfs[TX_64X64],
(*av1_default_qctx_coef_cdfs[index])[TX_32X32]);
av1_coef_pareto_cdfs(cm->fc);
#endif // CONFIG_LV_MAP
}
static void av1_average_cdf(aom_cdf_prob *cdf_ptr[], aom_cdf_prob *fc_cdf_ptr,
......@@ -646,7 +629,6 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
aom_cdf_prob *fc_cdf_ptr;
assert(num_tiles == 1);
#if CONFIG_LV_MAP
AVERAGE_TILE_CDFS(txb_skip_cdf)
AVERAGE_TILE_CDFS(eob_extra_cdf)
AVERAGE_TILE_CDFS(dc_sign_cdf)
......@@ -660,10 +642,6 @@ void av1_average_tile_coef_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
AVERAGE_TILE_CDFS(eob_flag_cdf1024)
AVERAGE_TILE_CDFS(coeff_base_eob_cdf)
AVERAGE_TILE_CDFS(coeff_br_cdf)
#else // CONFI_LV_MAP
AVERAGE_TILE_CDFS(coef_head_cdfs)
AVERAGE_TILE_CDFS(coef_tail_cdfs)
#endif
}
void av1_average_tile_mv_cdfs(FRAME_CONTEXT *fc, FRAME_CONTEXT *ec_ctxs[],
......
......@@ -56,7 +56,6 @@ extern "C" {
#define ENTROPY_NODES 11
#if CONFIG_LV_MAP
#define TXB_SKIP_CONTEXTS 13
#define EOB_COEF_CONTEXTS 22
......@@ -90,8 +89,6 @@ typedef enum TX_CLASS {
TX_CLASSES = 3,
} TX_CLASS;
#endif
DECLARE_ALIGNED(16, extern const uint8_t, av1_pt_energy_class[ENTROPY_TOKENS]);
#define CAT1_MIN_VAL 5
......@@ -171,9 +168,7 @@ static INLINE int av1_get_cat6_extrabits_size(TX_SIZE tx_size,
struct AV1Common;
struct frame_contexts;
void av1_default_coef_probs(struct AV1Common *cm);
#if CONFIG_LV_MAP
void av1_adapt_coef_probs(struct AV1Common *cm);
#endif // CONFIG_LV_MAP
// This is the index in the scan order beyond which all coefficients for
// 8x8 transform and above are in the top band.
......
......@@ -15,9 +15,7 @@
#include "av1/common/scan.h"
#include "av1/common/onyxc_int.h"
#include "av1/common/seg_common.h"
#if CONFIG_LV_MAP
#include "av1/common/txb_common.h"
#endif
static const aom_cdf_prob default_newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)] =
{ { AOM_CDF2(128 * 155) }, { AOM_CDF2(128 * 116) }, { AOM_CDF2(128 * 94) },
......@@ -1380,9 +1378,7 @@ void av1_setup_past_independence(AV1_COMMON *cm) {
av1_default_coef_probs(cm);
init_mode_probs(cm->fc);
av1_init_mv_probs(cm);
#if CONFIG_LV_MAP
av1_init_lv_map(cm);
#endif
cm->fc->initialized = 1;
av1_setup_frame_contexts(cm);
......
......@@ -76,7 +76,6 @@ typedef struct frame_contexts {
coeff_cdf_model coef_tail_cdfs[TX_SIZES][PLANE_TYPES];
coeff_cdf_model coef_head_cdfs[TX_SIZES][PLANE_TYPES];
#if CONFIG_LV_MAP
aom_cdf_prob txb_skip_cdf[TX_SIZES][TXB_SKIP_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob eob_extra_cdf[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS]
[CDF_SIZE(2)];
......@@ -94,7 +93,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)];
#endif
aom_cdf_prob newmv_cdf[NEWMV_MODE_CONTEXTS][CDF_SIZE(2)];
aom_cdf_prob zeromv_cdf[GLOBALMV_MODE_CONTEXTS][CDF_SIZE(2)];
......@@ -226,7 +224,6 @@ typedef struct FRAME_COUNTS {
unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
[SWITCHABLE_FILTERS];
#if CONFIG_LV_MAP
#if CONFIG_ENTROPY_STATS
unsigned int txb_skip[TX_SIZES][TXB_SKIP_CONTEXTS][2];
unsigned int eob_extra[TX_SIZES][PLANE_TYPES][EOB_COEF_CONTEXTS][2];
......@@ -248,7 +245,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 // CONFIG_LV_MAP
unsigned int newmv_mode[NEWMV_MODE_CONTEXTS][2];
unsigned int zeromv_mode[GLOBALMV_MODE_CONTEXTS][2];
......
......@@ -199,14 +199,12 @@ typedef struct BufferPool {
InternalFrameBufferList int_frame_buffers;
} BufferPool;
#if CONFIG_LV_MAP
typedef struct {
int base_ctx_table[2 /*row*/][2 /*col*/][3 /*sig_map*/]
[BASE_CONTEXT_POSITION_NUM + 1];
} LV_MAP_CTX_TABLE;
typedef int BASE_CTX_TABLE[2 /*col*/][3 /*sig_map*/]
[BASE_CONTEXT_POSITION_NUM + 1];
#endif
#if CONFIG_REFERENCE_BUFFER
/* Initial version of sequence header structure */
......@@ -600,9 +598,7 @@ typedef struct AV1Common {
int refresh_mask;
int invalid_delta_frame_id_minus1;
#endif // CONFIG_REFERENCE_BUFFER
#if CONFIG_LV_MAP
LV_MAP_CTX_TABLE coeff_ctx_table;
#endif
#if CONFIG_MFMV
TPL_MV_REF *tpl_mvs;
int tpl_mvs_mem_size;
......
This diff is collapsed.
......@@ -50,13 +50,8 @@ static INLINE int get_coef_context(const int16_t *neighbors,
static INLINE const SCAN_ORDER *get_default_scan(TX_SIZE tx_size,
TX_TYPE tx_type,
int is_inter) {
#if CONFIG_LV_MAP
(void)is_inter;
return &av1_inter_scan_orders[tx_size][tx_type];
#else
return is_inter ? &av1_inter_scan_orders[tx_size][tx_type]
: &av1_intra_scan_orders[tx_size][tx_type];
#endif
}
static INLINE const SCAN_ORDER *get_scan(const AV1_COMMON *cm, TX_SIZE tx_size,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -57,9 +57,7 @@
#include "av1/decoder/decodeframe.h"
#include "av1/decoder/decodemv.h"
#include "av1/decoder/decoder.h"
#if CONFIG_LV_MAP
#include "av1/decoder/decodetxb.h"
#endif
#include "av1/decoder/detokenize.h"
#define MAX_AV1_HEADER_SIZE 80
......@@ -129,7 +127,6 @@ static void predict_and_reconstruct_intra_block(
struct aom_usec_timer timer;
aom_usec_timer_start(&timer);
#endif
#if CONFIG_LV_MAP
int16_t max_scan_line = 0;
int eob;
av1_read_coeffs_txb_facade(cm, xd, r, row, col, plane, tx_size,
......@@ -137,15 +134,6 @@ static void predict_and_reconstruct_intra_block(
// tx_type will be read out in av1_read_coeffs_txb_facade
const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, row, col, tx_size,
cm->reduced_tx_set_used);
#else // CONFIG_LV_MAP
const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, row, col, tx_size,
cm->reduced_tx_set_used);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, mbmi);
int16_t max_scan_line = 0;
const int eob =
av1_decode_block_tokens(cm, xd, plane, scan_order, col, row, tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
#if TXCOEFF_TIMER
aom_usec_timer_mark(&timer);
......@@ -192,7 +180,6 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
struct aom_usec_timer timer;
aom_usec_timer_start(&timer);
#endif
#if CONFIG_LV_MAP
int16_t max_scan_line = 0;
int eob;
av1_read_coeffs_txb_facade(cm, xd, r, blk_row, blk_col, plane, tx_size,
......@@ -200,15 +187,6 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
// tx_type will be read out in av1_read_coeffs_txb_facade
const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, blk_row, blk_col,
tx_size, cm->reduced_tx_set_used);
#else // CONFIG_LV_MAP
const TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, blk_row, blk_col,
tx_size, cm->reduced_tx_set_used);
const SCAN_ORDER *sc = get_scan(cm, tx_size, tx_type, mbmi);
int16_t max_scan_line = 0;
const int eob =
av1_decode_block_tokens(cm, xd, plane, sc, blk_col, blk_row, tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
#if TXCOEFF_TIMER
aom_usec_timer_mark(&timer);
......
......@@ -42,9 +42,7 @@
#include "av1/encoder/bitstream.h"
#include "av1/encoder/cost.h"
#include "av1/encoder/encodemv.h"
#if CONFIG_LV_MAP
#include "av1/encoder/encodetxb.h"
#endif // CONFIG_LV_MAP
#include "av1/encoder/mcomp.h"
#include "av1/encoder/palette.h"
#include "av1/encoder/segmentation.h"
......@@ -385,79 +383,6 @@ static void pack_map_tokens(aom_writer *w, const TOKENEXTRA **tp, int n,
*tp = p;
}
#if !CONFIG_LV_MAP
static INLINE void write_coeff_extra(const aom_cdf_prob *const *cdf, int val,
int n, aom_writer *w) {
// Code the extra bits from LSB to MSB in groups of 4
int i = 0;
int count = 0;
while (count < n) {
const int size = AOMMIN(n - count, 4);
const int mask = (1 << size) - 1;
aom_write_cdf(w, val & mask, cdf[i++], 1 << size);
val >>= size;
count += size;
}
}
static void pack_mb_tokens(aom_writer *w, const TOKENEXTRA **tp,
const TOKENEXTRA *const stop,
aom_bit_depth_t bit_depth, const TX_SIZE tx_size,
TOKEN_STATS *token_stats) {
const TOKENEXTRA *p = *tp;
int count = 0;
const int seg_eob = av1_get_max_eob(tx_size);
while (p < stop && p->token != EOSB_TOKEN) {
const int token = p->token;
const int8_t eob_val = p->eob_val;
if (token == BLOCK_Z_TOKEN) {
aom_write_symbol(w, 0, *p->head_cdf, HEAD_TOKENS + 1);
p++;
break;
continue;
}
const av1_extra_bit *const extra_bits = &av1_extra_bits[token];
if (eob_val == LAST_EOB) {
// Just code a flag indicating whether the value is >1 or 1.
aom_write_bit(w, token != ONE_TOKEN);
} else {
int comb_symb = 2 * AOMMIN(token, TWO_TOKEN) - eob_val + p->first_val;
aom_write_symbol(w, comb_symb, *p->head_cdf, HEAD_TOKENS + p->first_val);
}
if (token > ONE_TOKEN) {
aom_write_symbol(w, token - TWO_TOKEN, *p->tail_cdf, TAIL_TOKENS);
}
if (extra_bits->base_val) {
const int bit_string = p->extra;
const int bit_string_length = extra_bits->len; // Length of extra bits to
const int is_cat6 = (extra_bits->base_val == CAT6_MIN_VAL);
// be written excluding
// the sign bit.
int skip_bits = is_cat6 ? CAT6_BIT_SIZE - av1_get_cat6_extrabits_size(
tx_size, bit_depth)
: 0;
assert(!(bit_string >> (bit_string_length - skip_bits + 1)));
if (bit_string_length > 0)
write_coeff_extra(extra_bits->cdf, bit_string >> 1,
bit_string_length - skip_bits, w);
aom_write_bit_record(w, bit_string & 1, token_stats);
}
++p;
++count;
if (eob_val == EARLY_EOB || count == seg_eob) break;
}
*tp = p;
}
#endif // !CONFIG_LV_MAP
#if CONFIG_LV_MAP
static void pack_txb_tokens(aom_writer *w, AV1_COMMON *cm, MACROBLOCK *const x,
const TOKENEXTRA **tp,
const TOKENEXTRA *const tok_end, MACROBLOCKD *xd,
......@@ -513,56 +438,6 @@ static void pack_txb_tokens(aom_writer *w, AV1_COMMON *cm, MACROBLOCK *const x,
}
}
}
#else // CONFIG_LV_MAP
static void pack_txb_tokens(aom_writer *w, const TOKENEXTRA **tp,
const TOKENEXTRA *const tok_end, MACROBLOCKD *xd,
MB_MODE_INFO *mbmi, int plane,
BLOCK_SIZE plane_bsize, aom_bit_depth_t bit_depth,
int block, int blk_row, int blk_col,
TX_SIZE tx_size, TOKEN_STATS *token_stats) {
const struct macroblockd_plane *const pd = &xd->plane[plane];
const int tx_row = blk_row >> (1 - pd->subsampling_y);
const int tx_col = blk_col >> (1 - pd->subsampling_x);
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane);
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
const TX_SIZE plane_tx_size =
plane ? av1_get_uv_tx_size(mbmi, pd->subsampling_x, pd->subsampling_y)
: mbmi->inter_tx_size[tx_row][tx_col];
if (tx_size == plane_tx_size || plane) {
TOKEN_STATS tmp_token_stats;
init_token_stats(&tmp_token_stats);
pack_mb_tokens(w, tp, tok_end, bit_depth, tx_size, &tmp_token_stats);
#if CONFIG_RD_DEBUG
token_stats->txb_coeff_cost_map[blk_row][blk_col] = tmp_token_stats.cost;
token_stats->cost += tmp_token_stats.cost;
#endif
} else {
const TX_SIZE sub_txs = sub_tx_size_map[1][tx_size];
const int bsw = tx_size_wide_unit[sub_txs];
const int bsh = tx_size_high_unit[sub_txs];
assert(bsw > 0 && bsh > 0);
for (int r = 0; r < tx_size_high_unit[tx_size]; r += bsh) {
for (int c = 0; c < tx_size_wide_unit[tx_size]; c += bsw) {
const int offsetr = blk_row + r;
const int offsetc = blk_col + c;
const int step = bsh * bsw;
if (offsetr >= max_blocks_high || offsetc >= max_blocks_wide) continue;
pack_txb_tokens(w, tp, tok_end, xd, mbmi, plane, plane_bsize, bit_depth,
block, offsetr, offsetc, sub_txs, token_stats);
block += step;
}
}
}
}
#endif // CONFIG_LV_MAP
#if CONFIG_SPATIAL_SEGMENTATION
static int neg_interleave(int x, int ref, int max) {
......@@ -1875,12 +1750,9 @@ static void write_inter_txb_coeff(AV1_COMMON *const cm, MACROBLOCK *const x,
blk_row += bkh) {
for (blk_col = col >> pd->subsampling_x; blk_col < unit_width;
blk_col += bkw) {
pack_txb_tokens(w,
#if CONFIG_LV_MAP
cm, x,
#endif
tok, tok_end, xd, mbmi, plane, plane_bsize, cm->bit_depth,
*block, blk_row, blk_col, max_tx_size, token_stats);
pack_txb_tokens(w, cm, x, tok, tok_end, xd, mbmi, plane, plane_bsize,
cm->bit_depth, *block, blk_row, blk_col, max_tx_size,
token_stats);
*block += step;
}
}
......@@ -1899,10 +1771,8 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
int plane;
int bh, bw;
MACROBLOCK *const x = &cpi->td.mb;
#if CONFIG_LV_MAP
(void)tok;
(void)tok_end;
#endif
xd->mi = cm->mi_grid_visible + mi_offset;
assert(mbmi->sb_type <= cm->seq_params.sb_size ||
......@@ -1934,17 +1804,10 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
&cols);
assert(*tok < tok_end);
pack_map_tokens(w, tok, palette_size_plane, rows * cols);
#if !CONFIG_LV_MAP
assert(*tok < tok_end + mbmi->skip);
#endif // !CONFIG_LV_MAP
}
}
if (!mbmi->skip) {
#if !CONFIG_LV_MAP
assert(*tok < tok_end);
#endif
if (!is_inter_block(mbmi))
av1_write_coeffs_mb(cm, x, mi_row, mi_col, w, mbmi->sb_type);
......@@ -1975,9 +1838,6 @@ static void write_tokens_b(AV1_COMP *cpi, const TileInfo *const tile,
const struct macroblockd_plane *const pd = &xd->plane[plane];
if (!is_chroma_reference(mi_row, mi_col, mbmi->sb_type,
pd->subsampling_x, pd->subsampling_y)) {
#if !CONFIG_LV_MAP
(*tok)++;
#endif // !CONFIG_LV_MAP
continue;
}
write_inter_txb_coeff(cm, x, mbmi, w, tok, tok_end, &token_stats,
......@@ -3071,9 +2931,6 @@ static uint32_t write_tiles(AV1_COMP *const cpi, uint8_t *const dst,
aom_start_encode(&mode_bc, dst + total_size);
write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end);
#if !CONFIG_LV_MAP
assert(tok == tok_end);
#endif // !CONFIG_LV_MAP
aom_stop_encode(&mode_bc);
tile_size = mode_bc.pos;
assert(tile_size > 0);
......@@ -4878,9 +4735,6 @@ static uint32_t write_tiles_in_tg_obus(AV1_COMP *const cpi, uint8_t *const dst,
aom_start_encode(&mode_bc, dst + total_size);
write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end);
#if !CONFIG_LV_MAP
assert(tok == tok_end);
#endif // !CONFIG_LV_MAP
aom_stop_encode(&mode_bc);
tile_size = mode_bc.pos;
assert(tile_size > 0);
......
......@@ -35,9 +35,7 @@ typedef struct macroblock_plane {
tran_low_t *qcoeff;
tran_low_t *coeff;
uint16_t *eobs;
#if CONFIG_LV_MAP
uint8_t *txb_entropy_ctx;
#endif
struct buf_2d src;
// Quantizer setings
......@@ -56,7 +54,6 @@ typedef struct macroblock_plane {
typedef int av1_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
[TAIL_TOKENS];
#if CONFIG_LV_MAP
typedef struct {
int txb_skip_cost[TXB_SKIP_CONTEXTS][2];
int base_eob_cost[SIG_COEF_CONTEXTS_EOB][3];
......@@ -78,18 +75,15 @@ typedef struct {
int dc_sign_ctx[MAX_MB_PLANE]
[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)];
} CB_COEFF_BUFFER;
#endif
typedef struct {
int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES];
int16_t mode_context[MODE_CTX_REF_FRAMES];
#if CONFIG_LV_MAP
// TODO(angiebird): Reduce the buffer size according to sb_type
tran_low_t *tcoeff[MAX_MB_PLANE];
uint16_t *eobs[MAX_MB_PLANE];
uint8_t *txb_skip_ctx[MAX_MB_PLANE];
int *dc_sign_ctx[MAX_MB_PLANE];
#endif
uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE];
int16_t compound_mode_context[MODE_CTX_REF_FRAMES];
......@@ -133,15 +127,11 @@ typedef struct {
int64_t sse;
int rate;
uint16_t eob;
#if CONFIG_LV_MAP
#if CONFIG_TXK_SEL
TX_TYPE tx_type;
#endif
uint16_t entropy_context;
uint8_t txb_entropy_ctx;
#else
uint8_t entropy_context;
#endif
uint8_t valid;
uint8_t fast; // This is not being used now.
} TX_SIZE_RD_INFO;
......@@ -267,11 +257,9 @@ struct macroblock {
int skip_mode_index;
#endif // CONFIG_EXT_SKIP
#if CONFIG_LV_MAP
LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES];
LV_MAP_EOB_COST eob_costs[7][2];
uint16_t cb_offset;
#endif
av1_coeff_cost token_head_costs[TX_SIZES];
av1_coeff_cost token_tail_costs[TX_SIZES];
......
......@@ -36,11 +36,9 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_pix,
aom_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i])));
CHECK_MEM_ERROR(cm, ctx->eobs[i],
aom_memalign(32, num_blk * sizeof(*ctx->eobs[i])));
#if CONFIG_LV_MAP
CHECK_MEM_ERROR(
cm, ctx->txb_entropy_ctx[i],
aom_memalign(32, num_blk * sizeof(*ctx->txb_entropy_ctx[i])));
#endif
}
if (num_pix <= MAX_PALETTE_SQUARE) {
......@@ -65,10 +63,8 @@ static void free_mode_context(PICK_MODE_CONTEXT *ctx, const int num_planes) {
ctx->dqcoeff[i] = 0;
aom_free(ctx->eobs[i]);
ctx->eobs[i] = 0;
#if CONFIG_LV_MAP
aom_free(ctx->txb_entropy_ctx[i]);
ctx->txb_entropy_ctx[i] = 0;
#endif
}
for (i = 0; i < 2; ++i) {
......
......@@ -45,9 +45,7 @@ typedef struct {
tran_low_t *qcoeff[MAX_MB_PLANE];
tran_low_t *dqcoeff[MAX_MB_PLANE];
uint16_t *eobs[MAX_MB_PLANE];
#if CONFIG_LV_MAP
uint8_t *txb_entropy_ctx[MAX_MB_PLANE];
#endif
int num_4x4_blk;
int skip;
......
......@@ -51,9 +51,7 @@
#include "av1/encoder/encodeframe.h"
#include "av1/encoder/encodemb.h"
#include "av1/encoder/encodemv.h"
#if CONFIG_LV_MAP
#include "av1/encoder/encodetxb.h"
#endif
#include "av1/encoder/ethread.h"
#include "av1/encoder/extend.h"
#include "av1/encoder/rd.h"
......@@ -505,9 +503,7 @@ static void update_state(const AV1_COMP *const cpi, TileDataEnc *tile_data,
p[i].qcoeff = ctx->qcoeff[i];
pd[i].dqcoeff = ctx->dqcoeff[i];
p[i].eobs = ctx->eobs[i];
#if CONFIG_LV_MAP
p[i].txb_entropy_ctx = ctx->txb_entropy_ctx[i];
#endif // CONFIG_LV_MAP
}
for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
// Restore the coding context of the MB to that that was in place
......@@ -669,9 +665,7 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data,
p[i].qcoeff = ctx->qcoeff[i];
pd[i].dqcoeff = ctx->dqcoeff[i];
p[i].eobs = ctx->eobs[i];
#if CONFIG_LV_MAP
p[i].txb_entropy_ctx = ctx->txb_entropy_ctx[i];
#endif
}
for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i];
......@@ -1501,17 +1495,13 @@ static void encode_b(const AV1_COMP *const cpi, TileDataEnc *tile_data,
#endif
update_state(cpi, tile_data, td, ctx, mi_row, mi_col, bsize, dry_run);
#if CONFIG_LV_MAP
av1_set_coeff_buffer(cpi, x, mi_row, mi_col);
#endif
encode_superblock(cpi, tile_data, td, tp, dry_run, mi_row, mi_col, bsize,
rate);
#if CONFIG_LV_MAP
if (dry_run == 0)
x->cb_offset += block_size_wide[bsize] * block_size_high[bsize];
#endif
if (!dry_run) {
#if CONFIG_EXT_DELTA_Q
......@@ -2716,9 +2706,6 @@ static void rd_pick_sqr_partition(const AV1_COMP *const cpi, ThreadData *td,
#endif // CONFIG_DIST_8X8
if (bsize == cm->seq_params.sb_size) {
#if !CONFIG_LV_MAP
assert(tp_orig < *tp || (tp_orig == *tp && xd->mi[0]->mbmi.skip));
#endif
assert(best_rdc.rate < INT_MAX);
assert(best_rdc.dist < INT64_MAX);
} else {
......@@ -3565,9 +3552,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
if (best_rdc.rate < INT_MAX && best_rdc.dist < INT64_MAX &&
pc_tree->index != 3) {
if (bsize == cm->seq_params.sb_size) {
#if CONFIG_LV_MAP
x->cb_offset = 0;
#endif
encode_sb(cpi, td, tile_data, tp, mi_row, mi_col, OUTPUT_ENABLED, bsize,
pc_tree, NULL);
......@@ -3586,9 +3571,6 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
#endif // CONFIG_DIST_8X8
if (bsize == cm->seq_params.sb_size) {
#if !CONFIG_LV_MAP
assert(tp_orig < *tp || (tp_orig == *tp && xd->mi[0]->mbmi.skip));
#endif
assert(best_rdc.rate < INT_MAX);
assert(best_rdc.dist < INT64_MAX);
} else {
......@@ -3644,14 +3626,7 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
PC_TREE *const pc_root =
td->pc_root[cm->seq_params.mib_size_log2 - MIN_MIB_SIZE_LOG2];