Commit aba246dc authored by Jingning Han's avatar Jingning Han

Integrate level-map with var-tx

Make the level-map and var-tx work together.

Change-Id: I5ff80a3cbc43af64b504934209720f387b89dbd8
parent e65436b1
......@@ -681,7 +681,7 @@ static void predict_and_reconstruct_intra_block(
int16_t max_scan_line = 0;
int eob;
av1_read_coeffs_txb_facade(cm, xd, r, row, col, block_idx, plane,
pd->dqcoeff, &max_scan_line, &eob);
pd->dqcoeff, tx_size, &max_scan_line, &eob);
// tx_type will be read out in av1_read_coeffs_txb_facade
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
#else // CONFIG_LV_MAP
......@@ -753,7 +753,7 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
int16_t max_scan_line = 0;
int eob;
av1_read_coeffs_txb_facade(cm, xd, r, blk_row, blk_col, block_idx, plane,
pd->dqcoeff, &max_scan_line, &eob);
pd->dqcoeff, tx_size, &max_scan_line, &eob);
// tx_type will be read out in av1_read_coeffs_txb_facade
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, plane_tx_size);
#else // CONFIG_LV_MAP
......
......@@ -44,9 +44,8 @@ static int read_golomb(MACROBLOCKD *xd, aom_reader *r) {
uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int block, int plane,
tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
int16_t *max_scan_line, int *eob) {
TX_SIZE tx_size, int16_t *max_scan_line, int *eob) {
FRAME_COUNTS *counts = xd->counts;
TX_SIZE tx_size = get_tx_size(plane, xd);
TX_SIZE txs_ctx = get_txsize_context(tx_size);
PLANE_TYPE plane_type = get_plane_type(plane);
aom_prob *nz_map = cm->fc->nz_map[txs_ctx][plane_type];
......@@ -213,7 +212,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r, int row, int col, int block,
int plane, tran_low_t *tcoeffs,
int16_t *max_scan_line, int *eob) {
TX_SIZE tx_size, int16_t *max_scan_line,
int *eob) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
struct macroblockd_plane *pd = &xd->plane[plane];
......@@ -230,12 +230,11 @@ uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
get_plane_block_size(AOMMAX(BLOCK_8X8, bsize), pd);
#endif // CONFIG_CB4X4
TX_SIZE tx_size = get_tx_size(plane, xd);
TXB_CTX txb_ctx;
get_txb_ctx(plane_bsize, tx_size, plane, pd->above_context + col,
pd->left_context + row, &txb_ctx);
uint8_t cul_level = av1_read_coeffs_txb(cm, xd, r, block, plane, tcoeffs,
&txb_ctx, max_scan_line, eob);
uint8_t cul_level = av1_read_coeffs_txb(
cm, xd, r, block, plane, tcoeffs, &txb_ctx, tx_size, max_scan_line, eob);
#if CONFIG_ADAPT_SCAN
PLANE_TYPE plane_type = get_plane_type(plane);
TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
......
......@@ -21,11 +21,12 @@
uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int block, int plane,
tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
int16_t *max_scan_line, int *eob);
TX_SIZE tx_size, int16_t *max_scan_line, int *eob);
uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r, int row, int col, int block,
int plane, tran_low_t *tcoeffs,
int16_t *max_scan_line, int *eob);
TX_SIZE tx_size, int16_t *max_scan_line,
int *eob);
void av1_read_txb_probs(FRAME_CONTEXT *fc, TX_MODE tx_mode, aom_reader *r);
#endif // DECODETXB_H_
......@@ -1078,7 +1078,8 @@ static void pack_txb_tokens(aom_writer *w,
uint16_t eob = x->mbmi_ext->eobs[plane][block];
TXB_CTX txb_ctx = { x->mbmi_ext->txb_skip_ctx[plane][block],
x->mbmi_ext->dc_sign_ctx[plane][block] };
av1_write_coeffs_txb(cm, xd, w, block, plane, tcoeff, eob, &txb_ctx);
av1_write_coeffs_txb(cm, xd, w, block, plane, tx_size, tcoeff, eob,
&txb_ctx);
#else
pack_pvq_tokens(w, x, xd, plane, bsize, tx_size);
#endif
......
......@@ -467,6 +467,7 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
if (eob == 0) return eob;
if (xd->lossless[xd->mi[0]->mbmi.segment_id]) return eob;
#if CONFIG_PVQ
(void)cm;
(void)tx_size;
......
......@@ -70,14 +70,13 @@ static void write_golomb(aom_writer *w, int level) {
}
void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_writer *w, int block, int plane,
aom_writer *w, int block, int plane, TX_SIZE tx_size,
const tran_low_t *tcoeff, uint16_t eob,
TXB_CTX *txb_ctx) {
aom_prob *nz_map;
aom_prob *eob_flag;
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const PLANE_TYPE plane_type = get_plane_type(plane);
const TX_SIZE tx_size = get_tx_size(plane, xd);
const TX_SIZE txs_ctx = get_txsize_context(tx_size);
const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
const SCAN_ORDER *const scan_order =
......@@ -210,7 +209,8 @@ void av1_write_coeffs_mb(const AV1_COMMON *const cm, MACROBLOCK *x,
uint16_t eob = x->mbmi_ext->eobs[plane][block];
TXB_CTX txb_ctx = { x->mbmi_ext->txb_skip_ctx[plane][block],
x->mbmi_ext->dc_sign_ctx[plane][block] };
av1_write_coeffs_txb(cm, xd, w, block, plane, tcoeff, eob, &txb_ctx);
av1_write_coeffs_txb(cm, xd, w, block, plane, tx_size, tcoeff, eob,
&txb_ctx);
block += step;
}
}
......@@ -287,10 +287,9 @@ static INLINE int get_base_cost(tran_low_t abs_qc, int ctx,
}
int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int block, TXB_CTX *txb_ctx) {
int block, TX_SIZE tx_size, TXB_CTX *txb_ctx) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
const TX_SIZE tx_size = get_tx_size(plane, xd);
TX_SIZE txs_ctx = get_txsize_context(tx_size);
const PLANE_TYPE plane_type = get_plane_type(plane);
const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size);
......
......@@ -68,9 +68,9 @@ typedef struct TxbProbs {
void av1_alloc_txb_buf(AV1_COMP *cpi);
void av1_free_txb_buf(AV1_COMP *cpi);
int av1_cost_coeffs_txb(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int block, TXB_CTX *txb_ctx);
int block, TX_SIZE tx_size, TXB_CTX *txb_ctx);
void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_writer *w, int block, int plane,
aom_writer *w, int block, int plane, TX_SIZE tx_size,
const tran_low_t *tcoeff, uint16_t eob,
TXB_CTX *txb_ctx);
void av1_write_coeffs_mb(const AV1_COMMON *const cm, MACROBLOCK *x,
......
......@@ -1222,7 +1222,7 @@ int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
TXB_CTX txb_ctx;
get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx);
return av1_cost_coeffs_txb(cpi, x, plane, block, &txb_ctx);
return av1_cost_coeffs_txb(cpi, x, plane, block, tx_size, &txb_ctx);
#endif // !CONFIG_LV_MAP
}
#endif // !CONFIG_PVQ || CONFIG_VAR_TX
......
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