Commit 133733cb authored by Angie Chiang's avatar Angie Chiang

Add av1_read_coeffs_txb_facade

Change-Id: I3f059dc16124bbce2210296de5b884b5906ec182
parent 85901563
......@@ -51,6 +51,9 @@
#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"
#include "av1/decoder/dsubexp.h"
......@@ -518,11 +521,17 @@ static void predict_and_reconstruct_intra_block(
if (!mbmi->skip) {
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
#if !CONFIG_PVQ
#if CONFIG_LV_MAP
int16_t max_scan_line = 0;
const int eob = av1_read_coeffs_txb_facade(
cm, xd, r, row, col, block_idx, plane, pd->dqcoeff, &max_scan_line);
#else // CONFIG_LV_MAP
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
int16_t max_scan_line = 0;
const int eob =
av1_decode_block_tokens(xd, plane, scan_order, col, row, tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
#if CONFIG_ADAPT_SCAN
if (xd->counts)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type,
......@@ -560,11 +569,18 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
PLANE_TYPE plane_type = get_plane_type(plane);
int block_idx = (blk_row << 1) + blk_col;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, plane_tx_size);
#if CONFIG_LV_MAP
(void)segment_id;
int16_t max_scan_line = 0;
const int eob = av1_read_coeffs_txb_facade(
cm, xd, r, row, col, block_idx, plane, pd->dqcoeff, &max_scan_line);
#else // CONFIG_LV_MAP
const SCAN_ORDER *sc = get_scan(cm, plane_tx_size, tx_type, 1);
int16_t max_scan_line = 0;
const int eob =
av1_decode_block_tokens(xd, plane, sc, blk_col, blk_row, plane_tx_size,
tx_type, &max_scan_line, r, mbmi->segment_id);
#endif // CONFIG_LV_MAP
#if CONFIG_ADAPT_SCAN
if (xd->counts)
av1_update_scan_count_facade(cm, xd->counts, tx_size, tx_type,
......@@ -613,11 +629,18 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
#endif
#if !CONFIG_PVQ
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 1);
#if CONFIG_LV_MAP
(void)segment_id;
int16_t max_scan_line = 0;
const int eob = av1_read_coeffs_txb_facade(
cm, xd, r, row, col, block_idx, plane, pd->dqcoeff, &max_scan_line);
#else // CONFIG_LV_MAP
int16_t max_scan_line = 0;
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 1);
const int eob =
av1_decode_block_tokens(xd, plane, scan_order, col, row, tx_size, tx_type,
&max_scan_line, r, segment_id);
#endif // CONFIG_LV_MAP
uint8_t *dst =
&pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
#if CONFIG_ADAPT_SCAN
......@@ -1647,7 +1670,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
}
}
}
#else
#else // CONFIG_COEF_INTERLEAVE
if (!is_inter_block(mbmi)) {
int plane;
#if CONFIG_PALETTE
......@@ -1795,7 +1818,7 @@ static void decode_token_and_recon_block(AV1Decoder *const pbi,
}
}
}
#endif
#endif // CONFIG_COEF_INTERLEAVE
int reader_corrupted_flag = aom_reader_has_error(r);
aom_merge_corrupted_flag(&xd->corrupted, reader_corrupted_flag);
......
......@@ -10,6 +10,7 @@
*/
#include "av1/common/scan.h"
#include "av1/common/idct.h"
#include "av1/common/txb_common.h"
#include "av1/decoder/decodetxb.h"
......@@ -35,7 +36,8 @@ static int read_golomb(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) {
tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
int16_t *max_scan_line) {
FRAME_COUNTS *counts = xd->counts;
TX_SIZE tx_size = get_tx_size(plane, xd);
PLANE_TYPE plane_type = get_plane_type(plane);
......@@ -50,7 +52,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
int c = 0;
int eob = 0, update_eob = -1;
const int16_t *const dequant = xd->plane[plane].seg_dequant[mbmi->segment_id];
const int shift = (tx_size == TX_32X32);
const int shift = get_tx_scale(tx_size);
const int bwl = b_width_log2_lookup[txsize_to_bsize[tx_size]] + 2;
int cul_level = 0;
unsigned int(*nz_map_count)[SIG_COEF_CONTEXTS][2];
......@@ -60,6 +62,18 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
memset(tcoeffs, 0, sizeof(*tcoeffs) * seg_eob);
int all_zero =
aom_read(r, cm->fc->txb_skip[tx_size][txb_ctx->txb_skip_ctx], ACCT_STR);
if (xd->counts)
++xd->counts->txb_skip[tx_size][txb_ctx->txb_skip_ctx][all_zero];
if (all_zero) {
*max_scan_line = 0;
return 0;
}
// av1_decode_tx_type(cm, xd, mbmi, r, plane, block);
for (c = 0; c < seg_eob; ++c) {
int is_nz;
int coeff_ctx = get_nz_map_ctx(tcoeffs, txb_mask, scan[c], bwl);
......@@ -89,6 +103,7 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
}
eob = AOMMIN(seg_eob, c + 1);
*max_scan_line = eob;
int i;
for (i = 0; i < NUM_BASE_LEVELS; ++i) {
......@@ -182,3 +197,31 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
return cul_level;
}
uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int row, int col, int block,
int plane, tran_low_t *tcoeffs,
int16_t *max_scan_line) {
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
const struct macroblockd_plane *pd = &xd->plane[plane];
const BLOCK_SIZE bsize = mbmi->sb_type;
#if CONFIG_CB4X4
#if CONFIG_CHROMA_2X2
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
#else
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
#endif // CONFIG_CHROMA_2X2
#else // CONFIG_CB4X4
const BLOCK_SIZE plane_bsize =
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);
return av1_read_coeffs_txb(cm, xd, r, block, plane, tcoeffs, &txb_ctx,
max_scan_line);
}
......@@ -20,6 +20,11 @@
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);
tran_low_t *tcoeffs, TXB_CTX *txb_ctx,
int16_t *max_scan_line);
uint8_t av1_read_coeffs_txb_facade(const AV1_COMMON *const cm, MACROBLOCKD *xd,
aom_reader *r, int row, int col, int block,
int plane, tran_low_t *tcoeffs,
int16_t *max_scan_line);
#endif // DECODETXB_H_
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