From 7eab9ff19dde07a76d20abcf6d4fb793874ebad1 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Thu, 6 Jul 2017 10:12:54 -0700 Subject: [PATCH] Refactor get_tx_type indexing Use row and column indexes to fetch the txk_type value. Change-Id: I881d500c030e322d8aca9dccb6ff2870c9e1e392 --- av1/decoder/decodetxb.c | 11 ++++++---- av1/decoder/decodetxb.h | 4 ++-- av1/encoder/bitstream.c | 4 ++-- av1/encoder/encodeframe.c | 4 +++- av1/encoder/encodeframe.h | 2 +- av1/encoder/encodemb.c | 18 ++++++++++------ av1/encoder/encodemb.h | 7 +++--- av1/encoder/encodetxb.c | 40 ++++++++++++++++++++++------------ av1/encoder/encodetxb.h | 14 ++++++------ av1/encoder/rdopt.c | 45 ++++++++++++++++++++++----------------- av1/encoder/rdopt.h | 6 +++--- av1/encoder/tokenize.c | 6 +++--- 12 files changed, 96 insertions(+), 65 deletions(-) diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c index cae88fb76..d0d79f656 100644 --- a/av1/decoder/decodetxb.c +++ b/av1/decoder/decodetxb.c @@ -42,8 +42,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, + aom_reader *r, int blk_row, int blk_col, int block, + int plane, tran_low_t *tcoeffs, TXB_CTX *txb_ctx, TX_SIZE tx_size, int16_t *max_scan_line, int *eob) { FRAME_COUNTS *counts = xd->counts; TX_SIZE txs_ctx = get_txsize_context(tx_size); @@ -77,6 +77,8 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, return 0; } + (void)blk_row; + (void)blk_col; #if CONFIG_TXK_SEL av1_read_tx_type(cm, xd, block, plane, get_min_tx_size(tx_size), r); #endif @@ -231,8 +233,9 @@ uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *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, tx_size, max_scan_line, eob); + uint8_t cul_level = + av1_read_coeffs_txb(cm, xd, r, row, col, 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); diff --git a/av1/decoder/decodetxb.h b/av1/decoder/decodetxb.h index 0fc97cd07..313476139 100644 --- a/av1/decoder/decodetxb.h +++ b/av1/decoder/decodetxb.h @@ -19,8 +19,8 @@ #include "aom_dsp/bitreader.h" 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, + aom_reader *r, int blk_row, int blk_col, int block, + int plane, tran_low_t *tcoeffs, TXB_CTX *txb_ctx, TX_SIZE tx_size, int16_t *max_scan_line, int *eob); uint8_t av1_read_coeffs_txb_facade(AV1_COMMON *cm, MACROBLOCKD *xd, diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index 439d99a11..dec33f376 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -914,8 +914,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, tx_size, tcoeff, eob, - &txb_ctx); + av1_write_coeffs_txb(cm, xd, w, blk_row, blk_col, block, plane, tx_size, + tcoeff, eob, &txb_ctx); #else pack_pvq_tokens(w, x, xd, plane, bsize, tx_size); #endif diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index c8b6f75b7..a20667355 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c @@ -5871,7 +5871,7 @@ static void tx_partition_set_contexts(const AV1_COMMON *const cm, void av1_update_tx_type_count(const AV1_COMMON *cm, MACROBLOCKD *xd, #if CONFIG_TXK_SEL - int block, int plane, + int blk_row, int blk_col, int block, int plane, #endif BLOCK_SIZE bsize, TX_SIZE tx_size, FRAME_COUNTS *counts) { @@ -5881,6 +5881,8 @@ void av1_update_tx_type_count(const AV1_COMMON *cm, MACROBLOCKD *xd, #if !CONFIG_TXK_SEL TX_TYPE tx_type = mbmi->tx_type; #else + (void)blk_row; + (void)blk_col; // Only y plane's tx_type is updated if (plane > 0) return; TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, tx_size); diff --git a/av1/encoder/encodeframe.h b/av1/encoder/encodeframe.h index 46a99e1cf..569ec9f72 100644 --- a/av1/encoder/encodeframe.h +++ b/av1/encoder/encodeframe.h @@ -37,7 +37,7 @@ void av1_encode_tile(struct AV1_COMP *cpi, struct ThreadData *td, int tile_row, void av1_update_tx_type_count(const struct AV1Common *cm, MACROBLOCKD *xd, #if CONFIG_TXK_SEL - int block, int plane, + int blk_row, int blk_col, int block, int plane, #endif BLOCK_SIZE bsize, TX_SIZE tx_size, FRAME_COUNTS *counts); diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index b6301aac2..f335ec03c 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c @@ -430,9 +430,10 @@ static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, } #endif // !CONFIG_LV_MAP -int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block, - BLOCK_SIZE plane_bsize, TX_SIZE tx_size, - const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l) { +int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int blk_row, + int blk_col, int block, BLOCK_SIZE plane_bsize, + TX_SIZE tx_size, const ENTROPY_CONTEXT *a, + const ENTROPY_CONTEXT *l) { MACROBLOCKD *const xd = &mb->e_mbd; struct macroblock_plane *const p = &mb->plane[plane]; const int eob = p->eobs[block]; @@ -450,6 +451,8 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block, #if !CONFIG_LV_MAP (void)plane_bsize; + (void)blk_row; + (void)blk_col; #if CONFIG_VAR_TX int ctx = get_entropy_context(tx_size, a, l); #else @@ -459,7 +462,8 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block, #else // !CONFIG_LV_MAP TXB_CTX txb_ctx; get_txb_ctx(plane_bsize, tx_size, plane, a, l, &txb_ctx); - return av1_optimize_txb(cm, mb, plane, block, tx_size, &txb_ctx); + return av1_optimize_txb(cm, mb, plane, blk_row, blk_col, block, tx_size, + &txb_ctx); #endif // !CONFIG_LV_MAP } @@ -735,7 +739,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, #endif #if !CONFIG_PVQ - av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l); + av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size, a, + l); av1_set_txb_context(x, plane, block, tx_size, a, l); @@ -1392,7 +1397,8 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col, if (args->enable_optimize_b) { av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, ctx, AV1_XFORM_QUANT_FP); - av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l); + av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size, + a, l); } else { av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, ctx, AV1_XFORM_QUANT_B); diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h index 7292ce070..a40728993 100644 --- a/av1/encoder/encodemb.h +++ b/av1/encoder/encodemb.h @@ -53,9 +53,10 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, int blk_row, int blk_col, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int ctx, AV1_XFORM_QUANT xform_quant_idx); -int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block, - BLOCK_SIZE plane_bsize, TX_SIZE tx_size, - const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l); +int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int blk_row, + int blk_col, int block, BLOCK_SIZE plane_bsize, + TX_SIZE tx_size, const ENTROPY_CONTEXT *a, + const ENTROPY_CONTEXT *l); void av1_subtract_txb(MACROBLOCK *x, int plane, BLOCK_SIZE plane_bsize, int blk_col, int blk_row, TX_SIZE tx_size); diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c index 6875e214f..037687162 100644 --- a/av1/encoder/encodetxb.c +++ b/av1/encoder/encodetxb.c @@ -70,9 +70,9 @@ 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, TX_SIZE tx_size, - const tran_low_t *tcoeff, uint16_t eob, - TXB_CTX *txb_ctx) { + aom_writer *w, int blk_row, int blk_col, 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; @@ -89,6 +89,9 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, uint8_t txb_mask[32 * 32] = { 0 }; uint16_t update_eob = 0; + (void)blk_row; + (void)blk_col; + aom_write(w, eob == 0, cm->fc->txb_skip[txs_ctx][txb_ctx->txb_skip_ctx]); if (eob == 0) return; @@ -206,8 +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, tx_size, tcoeff, eob, - &txb_ctx); + av1_write_coeffs_txb(cm, xd, w, row, col, block, plane, tx_size, tcoeff, + eob, &txb_ctx); block += step; } } @@ -284,11 +287,14 @@ 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, TX_SIZE tx_size, TXB_CTX *txb_ctx) { + int blk_row, int blk_col, int block, TX_SIZE tx_size, + TXB_CTX *txb_ctx) { const AV1_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; TX_SIZE txs_ctx = get_txsize_context(tx_size); const PLANE_TYPE plane_type = get_plane_type(plane); + (void)blk_row; + (void)blk_col; const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; const struct macroblock_plane *p = &x->plane[plane]; @@ -1459,11 +1465,14 @@ static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = { { 17, 13 }, { 16, 10 }, }; -int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, - TX_SIZE tx_size, TXB_CTX *txb_ctx) { +int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane, + int blk_row, int blk_col, int block, TX_SIZE tx_size, + TXB_CTX *txb_ctx) { MACROBLOCKD *const xd = &x->e_mbd; const PLANE_TYPE plane_type = get_plane_type(plane); const TX_SIZE txs_ctx = get_txsize_context(tx_size); + (void)blk_row; + (void)blk_col; const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; const struct macroblock_plane *p = &x->plane[plane]; @@ -1595,8 +1604,8 @@ void av1_update_and_record_txb_context(int plane, int block, int blk_row, } #if CONFIG_TXK_SEL - av1_update_tx_type_count(cm, xd, block, plane, mbmi->sb_type, - get_min_tx_size(tx_size), td->counts); + av1_update_tx_type_count(cm, xd, blk_row, blk_col, block, plane, + mbmi->sb_type, get_min_tx_size(tx_size), td->counts); #endif for (c = 0; c < eob; ++c) { @@ -1895,13 +1904,15 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane, av1_invalid_rd_stats(&this_rd_stats); av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); - av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l); + av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size, + a, l); av1_dist_block(cpi, x, plane, plane_bsize, block, blk_row, blk_col, tx_size, &this_rd_stats.dist, &this_rd_stats.sse, OUTPUT_HAS_PREDICTED_PIXELS); const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, mbmi); - this_rd_stats.rate = av1_cost_coeffs( - cpi, x, plane, block, tx_size, scan_order, a, l, use_fast_coef_costing); + this_rd_stats.rate = + av1_cost_coeffs(cpi, x, plane, blk_row, blk_col, block, tx_size, + scan_order, a, l, use_fast_coef_costing); int rd = RDCOST(x->rdmult, this_rd_stats.rate, this_rd_stats.dist); if (rd < best_rd) { best_rd = rd; @@ -1921,7 +1932,8 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane, // can use it for prediction. av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); - av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l); + av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size, + a, l); av1_inverse_transform_block_facade(xd, plane, block, blk_row, blk_col, x->plane[plane].eobs[block]); diff --git a/av1/encoder/encodetxb.h b/av1/encoder/encodetxb.h index 89a6e4069..cbafe59c9 100644 --- a/av1/encoder/encodetxb.h +++ b/av1/encoder/encodetxb.h @@ -67,11 +67,12 @@ 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, TX_SIZE tx_size, TXB_CTX *txb_ctx); + int blk_row, int blk_col, 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, TX_SIZE tx_size, - const tran_low_t *tcoeff, uint16_t eob, - TXB_CTX *txb_ctx); + aom_writer *w, int blk_row, int blk_col, 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, aom_writer *w, int plane); int av1_get_txb_entropy_context(const tran_low_t *qcoeff, @@ -96,8 +97,9 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane, const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l, int use_fast_coef_costing, RD_STATS *rd_stats); #endif -int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, - TX_SIZE tx_size, TXB_CTX *txb_ctx); +int av1_optimize_txb(const AV1_COMMON *cm, MACROBLOCK *x, int plane, + int blk_row, int blk_col, int block, TX_SIZE tx_size, + TXB_CTX *txb_ctx); #ifdef __cplusplus } #endif diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 002be736f..7c1826172 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c @@ -1441,10 +1441,12 @@ static int cost_coeffs(const AV1_COMMON *const cm, MACROBLOCK *x, int plane, #endif // !CONFIG_LV_MAP int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane, - int block, TX_SIZE tx_size, const SCAN_ORDER *scan_order, - const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l, - int use_fast_coef_costing) { + int blk_row, int blk_col, int block, TX_SIZE tx_size, + const SCAN_ORDER *scan_order, const ENTROPY_CONTEXT *a, + const ENTROPY_CONTEXT *l, int use_fast_coef_costing) { #if !CONFIG_LV_MAP + (void)blk_row; + (void)blk_col; const AV1_COMMON *const cm = &cpi->common; return cost_coeffs(cm, x, plane, block, tx_size, scan_order, a, l, use_fast_coef_costing); @@ -1467,7 +1469,8 @@ 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, tx_size, &txb_ctx); + return av1_cost_coeffs_txb(cpi, x, plane, blk_row, blk_col, block, tx_size, + &txb_ctx); #endif // !CONFIG_LV_MAP } #endif // !CONFIG_PVQ || CONFIG_VAR_TX @@ -1862,7 +1865,8 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, #else av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); - av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l); + av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size, a, + l); #endif // DISABLE_TRELLISQ_SEARCH if (!is_inter_block(mbmi)) { @@ -1901,8 +1905,8 @@ CALCULATE_RD : {} const TX_TYPE tx_type = get_tx_type(plane_type, xd, block, tx_size); const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, mbmi); this_rd_stats.rate = - av1_cost_coeffs(cpi, x, plane, block, tx_size, scan_order, a, l, - args->use_fast_coef_costing); + av1_cost_coeffs(cpi, x, plane, blk_row, blk_col, block, tx_size, + scan_order, a, l, args->use_fast_coef_costing); #else // !CONFIG_PVQ this_rd_stats.rate = x->rate; #endif // !CONFIG_PVQ @@ -3124,8 +3128,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( #if !CONFIG_PVQ av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); - ratey += av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order, - tempa + idx, templ + idy, + ratey += av1_cost_coeffs(cpi, x, 0, 0, 0, block, tx_size, + scan_order, tempa + idx, templ + idy, cpi->sf.use_fast_coef_costing); skip = (p->eobs[block] == 0); can_skip &= skip; @@ -3176,11 +3180,11 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( #else av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); - av1_optimize_b(cm, x, 0, block, BLOCK_8X8, tx_size, tempa + idx, - templ + idy); + av1_optimize_b(cm, x, 0, 0, 0, block, BLOCK_8X8, tx_size, + tempa + idx, templ + idy); #endif // DISABLE_TRELLISQ_SEARCH - ratey += av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order, - tempa + idx, templ + idy, + ratey += av1_cost_coeffs(cpi, x, 0, 0, 0, block, tx_size, + scan_order, tempa + idx, templ + idy, cpi->sf.use_fast_coef_costing); skip = (p->eobs[block] == 0); can_skip &= skip; @@ -3350,12 +3354,12 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( #endif // CONFIG_CB4X4 BLOCK_8X8, tx_size, coeff_ctx, xform_quant); - av1_optimize_b(cm, x, 0, block, BLOCK_8X8, tx_size, tempa + idx, + av1_optimize_b(cm, x, 0, 0, 0, block, BLOCK_8X8, tx_size, tempa + idx, templ + idy); #endif // DISABLE_TRELLISQ_SEARCH - ratey += - av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order, tempa + idx, - templ + idy, cpi->sf.use_fast_coef_costing); + ratey += av1_cost_coeffs(cpi, x, 0, 0, 0, block, tx_size, scan_order, + tempa + idx, templ + idy, + cpi->sf.use_fast_coef_costing); skip = (p->eobs[block] == 0); can_skip &= skip; tempa[idx] = !skip; @@ -4291,7 +4295,8 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); - av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l); + av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size, a, + l); #endif // DISABLE_TRELLISQ_SEARCH // TODO(any): Use av1_dist_block to compute distortion @@ -4360,8 +4365,8 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size, blk_row, blk_col, plane_bsize, txm_bsize); } rd_stats->dist += tmp * 16; - txb_coeff_cost = - av1_cost_coeffs(cpi, x, plane, block, tx_size, scan_order, a, l, 0); + txb_coeff_cost = av1_cost_coeffs(cpi, x, plane, blk_row, blk_col, block, + tx_size, scan_order, a, l, 0); rd_stats->rate += txb_coeff_cost; rd_stats->skip &= (eob == 0); diff --git a/av1/encoder/rdopt.h b/av1/encoder/rdopt.h index e5614c7dd..c7294cdf0 100644 --- a/av1/encoder/rdopt.h +++ b/av1/encoder/rdopt.h @@ -81,9 +81,9 @@ int64_t av1_daala_dist(const MACROBLOCKD *xd, const uint8_t *src, #if !CONFIG_PVQ || CONFIG_VAR_TX int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane, - int block, TX_SIZE tx_size, const SCAN_ORDER *scan_order, - const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l, - int use_fast_coef_costing); + int blk_row, int blk_col, int block, TX_SIZE tx_size, + const SCAN_ORDER *scan_order, const ENTROPY_CONTEXT *a, + const ENTROPY_CONTEXT *l, int use_fast_coef_costing); #endif void av1_rd_pick_intra_mode_sb(const struct AV1_COMP *cpi, struct macroblock *x, struct RD_STATS *rd_cost, BLOCK_SIZE bsize, diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c index 555ac0676..5301a95eb 100644 --- a/av1/encoder/tokenize.c +++ b/av1/encoder/tokenize.c @@ -279,9 +279,9 @@ static void cost_coeffs_b(int plane, int block, int blk_row, int blk_col, const PLANE_TYPE type = pd->plane_type; const TX_TYPE tx_type = get_tx_type(type, xd, block, tx_size); const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi); - const int rate = av1_cost_coeffs(cpi, x, plane, block, tx_size, scan_order, - pd->above_context + blk_col, - pd->left_context + blk_row, 0); + const int rate = av1_cost_coeffs( + cpi, x, plane, blk_row, blk_col, block, tx_size, scan_order, + pd->above_context + blk_col, pd->left_context + blk_row, 0); args->this_rate += rate; (void)plane_bsize; av1_set_contexts(xd, pd, plane, tx_size, p->eobs[block] > 0, blk_col, -- GitLab