Commit 0353e8d6 authored by Jingning Han's avatar Jingning Han Committed by Gerrit Code Review

Merge "Refactor sub8x8 block transform and quantization process" into nextgenv2

parents 45c9add2 bbe1b221
......@@ -23,8 +23,8 @@ static INLINE void fdct32x32(int rd_transform, const int16_t *src,
vpx_fdct32x32(src, dst, src_stride);
}
void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless) {
static void fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless) {
if (lossless) {
assert(tx_type == DCT_DCT);
vp10_fwht4x4(src_diff, coeff, diff_stride);
......@@ -173,9 +173,9 @@ static void fwd_txfm_32x32(int rd_transform, const int16_t *src_diff,
}
#if CONFIG_VP9_HIGHBITDEPTH
void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless,
const int bd) {
static void highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless,
const int bd) {
if (lossless) {
assert(tx_type == DCT_DCT);
vp10_highbd_fwht4x4(src_diff, coeff, diff_stride);
......@@ -345,7 +345,7 @@ void fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, int diff_stride,
fwd_txfm_8x8(src_diff, coeff, diff_stride, tx_type, fwd_txfm_opt);
break;
case TX_4X4:
vp10_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, lossless);
fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type, lossless);
break;
default:
assert(0);
......@@ -376,7 +376,7 @@ void highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff,
fwd_txfm_opt, bd);
break;
case TX_4X4:
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
highbd_fwd_txfm_4x4(src_diff, coeff, diff_stride, tx_type,
lossless, bd);
break;
default:
......
......@@ -32,15 +32,10 @@ extern "C" {
void fwd_txfm(const int16_t *src_diff, tran_low_t *coeff, int diff_stride,
FWD_TXFM_PARAM *fwd_txfm_param);
void vp10_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless);
#if CONFIG_VP9_HIGHBITDEPTH
void highbd_fwd_txfm(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, FWD_TXFM_PARAM *fwd_txfm_param);
void vp10_highbd_fwd_txfm_4x4(const int16_t *src_diff, tran_low_t *coeff,
int diff_stride, TX_TYPE tx_type, int lossless,
const int bd);
#endif // CONFIG_VP9_HIGHBITDEPTH
static INLINE int get_tx1d_size(TX_SIZE tx_size) {
......
......@@ -1156,32 +1156,6 @@ void vp10_highbd_quantize_dc(const tran_low_t *coeff_ptr,
}
#endif
void vp10_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
const int16_t *scan, const int16_t *iscan) {
MACROBLOCKD *const xd = &x->e_mbd;
struct macroblock_plane *p = &x->plane[plane];
struct macroblockd_plane *pd = &xd->plane[plane];
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vpx_highbd_quantize_b(BLOCK_OFFSET(p->coeff, block),
16, x->skip_block,
p->zbin, p->round, p->quant, p->quant_shift,
BLOCK_OFFSET(p->qcoeff, block),
BLOCK_OFFSET(pd->dqcoeff, block),
pd->dequant, &p->eobs[block],
scan, iscan);
return;
}
#endif
vpx_quantize_b(BLOCK_OFFSET(p->coeff, block),
16, x->skip_block,
p->zbin, p->round, p->quant, p->quant_shift,
BLOCK_OFFSET(p->qcoeff, block),
BLOCK_OFFSET(pd->dqcoeff, block),
pd->dequant, &p->eobs[block], scan, iscan);
}
static void invert_quant(int16_t *quant, int16_t *shift, int d) {
unsigned t;
int l;
......
......@@ -59,8 +59,6 @@ typedef struct {
DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]);
} QUANTS;
void vp10_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
const int16_t *scan, const int16_t *iscan);
struct VP10_COMP;
struct VP10Common;
......
......@@ -2132,7 +2132,6 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
int16_t *const src_diff = vp10_raster_block_offset_int16(BLOCK_8X8,
block,
p->src_diff);
tran_low_t *const coeff = BLOCK_OFFSET(x->plane[0].coeff, block);
xd->mi[0]->bmi[block].as_mode = mode;
vp10_predict_intra_block(xd, 1, 1, TX_4X4, mode, dst, dst_stride,
dst, dst_stride,
......@@ -2146,8 +2145,8 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
const int coeff_ctx = combine_entropy_contexts(*(tempa + idx),
*(templ + idy));
#endif // CONFIG_VAR_TX
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1, xd->bd);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, VP10_XFORM_QUANT_B);
#if CONFIG_VAR_TX
ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan,
so->neighbors, cpi->sf.use_fast_coef_costing);
......@@ -2173,8 +2172,8 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x,
const int coeff_ctx = combine_entropy_contexts(*(tempa + idx),
*(templ + idy));
#endif // CONFIG_VAR_TX
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0, xd->bd);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, VP10_XFORM_QUANT_B);
#if CONFIG_VAR_TX
ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan,
so->neighbors, cpi->sf.use_fast_coef_costing);
......@@ -2257,7 +2256,6 @@ next_highbd:
uint8_t *const dst = &dst_init[idx * 4 + idy * 4 * dst_stride];
int16_t *const src_diff =
vp10_raster_block_offset_int16(BLOCK_8X8, block, p->src_diff);
tran_low_t *const coeff = BLOCK_OFFSET(x->plane[0].coeff, block);
xd->mi[0]->bmi[block].as_mode = mode;
vp10_predict_intra_block(xd, 1, 1, TX_4X4, mode, dst, dst_stride,
dst, dst_stride, col + idx, row + idy, 0);
......@@ -2270,8 +2268,8 @@ next_highbd:
const int coeff_ctx = combine_entropy_contexts(*(tempa + idx),
*(templ + idy));
#endif
vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT, 1);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, VP10_XFORM_QUANT_B);
#if CONFIG_VAR_TX
ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan,
so->neighbors, cpi->sf.use_fast_coef_costing);
......@@ -2296,8 +2294,8 @@ next_highbd:
const int coeff_ctx = combine_entropy_contexts(*(tempa + idx),
*(templ + idy));
#endif
vp10_fwd_txfm_4x4(src_diff, coeff, 8, tx_type, 0);
vp10_regular_quantize_b_4x4(x, 0, block, so->scan, so->iscan);
vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, VP10_XFORM_QUANT_B);
#if CONFIG_VAR_TX
ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan,
so->neighbors, cpi->sf.use_fast_coef_costing);
......@@ -4525,8 +4523,6 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
for (idy = 0; idy < height / 4; ++idy) {
for (idx = 0; idx < width / 4; ++idx) {
int64_t dist, ssz, rd, rd1, rd2;
const int16_t *src_diff;
tran_low_t* coeff;
#if CONFIG_VAR_TX
int coeff_ctx;
#endif
......@@ -4535,23 +4531,8 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi,
coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)),
*(tl + (k >> 1)));
#endif
coeff = BLOCK_OFFSET(p->coeff, k);
src_diff = vp10_raster_block_offset_int16(BLOCK_8X8, k, p->src_diff);
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
vp10_highbd_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
xd->lossless[mi->mbmi.segment_id], xd->bd);
} else {
vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
xd->lossless[mi->mbmi.segment_id]);
}
#else
vp10_fwd_txfm_4x4(src_diff, coeff, 8, DCT_DCT,
xd->lossless[mi->mbmi.segment_id]);
#endif // CONFIG_VP9_HIGHBITDEPTH
vp10_regular_quantize_b_4x4(x, 0, k, so->scan, so->iscan);
vp10_xform_quant(x, 0, k, idy + (i >> 1), idx + (i & 0x01), BLOCK_8X8,
TX_4X4, VP10_XFORM_QUANT_B);
dist_block(cpi, x, 0, k, idy + (i >> 1), idx + (i & 0x1), TX_4X4,
&dist, &ssz);
thisdistortion += dist;
......
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