Merge "Refactor decoder side qcoeff reset" into nextgenv2

This commit is contained in:
Jingning Han 2016-10-22 01:07:32 +00:00 коммит произвёл Gerrit Code Review
Родитель a1a753c765 1be1878572
Коммит bd161f9f6d
3 изменённых файлов: 43 добавлений и 41 удалений

Просмотреть файл

@ -251,9 +251,8 @@ static void read_mv_probs(nmv_context *ctx, int allow_hp, aom_reader *r) {
static void inverse_transform_block(MACROBLOCKD *xd, int plane,
const TX_TYPE tx_type,
const TX_SIZE tx_size, uint8_t *dst,
int stride, int eob) {
int stride, int16_t scan_line, int eob) {
struct macroblockd_plane *const pd = &xd->plane[plane];
if (eob > 0) {
tran_low_t *const dqcoeff = pd->dqcoeff;
INV_TXFM_PARAM inv_txfm_param;
inv_txfm_param.tx_type = tx_type;
@ -271,14 +270,7 @@ static void inverse_transform_block(MACROBLOCKD *xd, int plane,
#if CONFIG_AOM_HIGHBITDEPTH
}
#endif // CONFIG_AOM_HIGHBITDEPTH
// TODO(jingning): This cleans up different reset requests from various
// experiments, but incurs unnecessary memset size.
if (eob == 1)
dqcoeff[0] = 0;
else
memset(dqcoeff, 0, tx_size_2d[tx_size] * sizeof(dqcoeff[0]));
}
memset(dqcoeff, 0, (scan_line + 1) * sizeof(dqcoeff[0]));
}
static void predict_and_reconstruct_intra_block(AV1_COMMON *cm,
@ -307,10 +299,13 @@ static void predict_and_reconstruct_intra_block(AV1_COMMON *cm,
if (!mbmi->skip) {
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
const SCAN_ORDER *scan_order = get_scan(cm, tx_size, tx_type, 0);
const int eob = av1_decode_block_tokens(
xd, plane, scan_order, col, row, tx_size, tx_type, r, mbmi->segment_id);
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);
if (eob)
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
eob);
max_scan_line, eob);
}
}
@ -341,13 +336,14 @@ static void decode_reconstruct_tx(AV1_COMMON *cm, MACROBLOCKD *const xd,
PLANE_TYPE plane_type = (plane == 0) ? PLANE_TYPE_Y : PLANE_TYPE_UV;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block, plane_tx_size);
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, r, mbmi->segment_id);
tx_type, &max_scan_line, r, mbmi->segment_id);
inverse_transform_block(
xd, plane, tx_type, plane_tx_size,
&pd->dst.buf[4 * blk_row * pd->dst.stride + 4 * blk_col],
pd->dst.stride, eob);
pd->dst.stride, max_scan_line, eob);
*eob_total += eob;
} else {
int bsl = b_width_log2_lookup[bsize];
@ -385,12 +381,14 @@ static int reconstruct_inter_block(AV1_COMMON *cm, MACROBLOCKD *const xd,
int block_idx = (row << 1) + col;
TX_TYPE tx_type = get_tx_type(plane_type, xd, block_idx, tx_size);
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, r, segment_id);
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, segment_id);
if (eob)
inverse_transform_block(xd, plane, tx_type, tx_size,
&pd->dst.buf[4 * row * pd->dst.stride + 4 * col],
pd->dst.stride, eob);
pd->dst.stride, max_scan_line, eob);
return eob;
}
#endif // !CONFIG_VAR_TX || CONFIG_SUPER_TX

Просмотреть файл

@ -61,7 +61,7 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
dequant_val_type_nuq *dq_val,
#endif // CONFIG_NEW_QUANT
int ctx, const int16_t *scan, const int16_t *nb,
aom_reader *r)
int16_t *max_scan_line, aom_reader *r)
#endif
{
FRAME_COUNTS *counts = xd->counts;
@ -166,6 +166,9 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
dqv_val = &dq_val[band][0];
#endif // CONFIG_NEW_QUANT
}
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
#if CONFIG_RANS
cdf = &coef_cdfs[band][ctx];
token = ONE_TOKEN +
@ -327,7 +330,8 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane,
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size,
TX_TYPE tx_type, aom_reader *r, int seg_id) {
TX_TYPE tx_type, int16_t *max_scan_line,
aom_reader *r, int seg_id) {
struct macroblockd_plane *const pd = &xd->plane[plane];
const int16_t *const dequant = pd->seg_dequant[seg_id];
const int ctx =
@ -339,16 +343,16 @@ int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
const int eob =
decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size, tx_type, dequant,
ctx, sc->scan, sc->neighbors, r, pd->seg_iqmatrix[seg_id]);
const int eob = decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size,
tx_type, dequant, ctx, sc->scan, sc->neighbors,
&sc->max_scan_line, r, pd->seg_iqmatrix[seg_id]);
#else
const int eob =
decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size, tx_type, dequant,
#if CONFIG_NEW_QUANT
pd->seg_dequant_nuq[seg_id][dq],
#endif // CONFIG_NEW_QUANT
ctx, sc->scan, sc->neighbors, r);
ctx, sc->scan, sc->neighbors, max_scan_line, r);
#endif // CONFIG_AOM_QM
av1_set_contexts(xd, pd, tx_size, eob > 0, x, y);
return eob;

Просмотреть файл

@ -28,7 +28,7 @@ void av1_decode_palette_tokens(MACROBLOCKD *const xd, int plane, aom_reader *r);
int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
const SCAN_ORDER *sc, int x, int y, TX_SIZE tx_size,
TX_TYPE tx_type,
TX_TYPE tx_type, int16_t *max_scan_line,
#if CONFIG_ANS
struct AnsDecoder *const r,
#else