Commit 919eeef5 authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review
Browse files

Merge "Calculating transform block offsets (x and y) only once."

parents 73a5cbeb ed5a993a
...@@ -243,31 +243,30 @@ static void alloc_tile_storage(VP9D_COMP *pbi, int tile_rows, int tile_cols) { ...@@ -243,31 +243,30 @@ static void alloc_tile_storage(VP9D_COMP *pbi, int tile_rows, int tile_cols) {
} }
static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block, static void inverse_transform_block(MACROBLOCKD* xd, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) { TX_SIZE tx_size, int x, int y) {
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
int16_t* const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
const int stride = pd->dst.stride;
const int eob = pd->eobs[block]; const int eob = pd->eobs[block];
if (eob > 0) { if (eob > 0) {
TX_TYPE tx_type; TX_TYPE tx_type;
const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size, const int plane_type = pd->plane_type;
block); const int stride = pd->dst.stride;
uint8_t* const dst = raster_block_offset_uint8(plane_bsize, raster_block, int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
pd->dst.buf, stride); uint8_t *const dst = &pd->dst.buf[4 * y * stride + 4 * x];
switch (tx_size) { switch (tx_size) {
case TX_4X4: case TX_4X4:
tx_type = get_tx_type_4x4(pd->plane_type, xd, raster_block); tx_type = get_tx_type_4x4(plane_type, xd, block);
if (tx_type == DCT_DCT) if (tx_type == DCT_DCT)
xd->itxm_add(dqcoeff, dst, stride, eob); xd->itxm_add(dqcoeff, dst, stride, eob);
else else
vp9_iht4x4_16_add(dqcoeff, dst, stride, tx_type); vp9_iht4x4_16_add(dqcoeff, dst, stride, tx_type);
break; break;
case TX_8X8: case TX_8X8:
tx_type = get_tx_type_8x8(pd->plane_type, xd); tx_type = get_tx_type_8x8(plane_type, xd);
vp9_iht8x8_add(tx_type, dqcoeff, dst, stride, eob); vp9_iht8x8_add(tx_type, dqcoeff, dst, stride, eob);
break; break;
case TX_16X16: case TX_16X16:
tx_type = get_tx_type_16x16(pd->plane_type, xd); tx_type = get_tx_type_16x16(plane_type, xd);
vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob); vp9_iht16x16_add(tx_type, dqcoeff, dst, stride, eob);
break; break;
case TX_32X32: case TX_32X32:
...@@ -308,17 +307,16 @@ static void predict_and_reconstruct_intra_block(int plane, int block, ...@@ -308,17 +307,16 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
const uint8_t *band_translate[2] = { const uint8_t *band_translate[2] = {
args->band_translate[0], args->band_translate[1] args->band_translate[0], args->band_translate[1]
}; };
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
MODE_INFO *const mi = xd->mi_8x8[0]; MODE_INFO *const mi = xd->mi_8x8[0];
const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size,
block);
uint8_t* const dst = raster_block_offset_uint8(plane_bsize, raster_block,
pd->dst.buf, pd->dst.stride);
const MB_PREDICTION_MODE mode = (plane == 0) const MB_PREDICTION_MODE mode = (plane == 0)
? ((mi->mbmi.sb_type < BLOCK_8X8) ? mi->bmi[raster_block].as_mode ? ((mi->mbmi.sb_type < BLOCK_8X8) ? mi->bmi[block].as_mode
: mi->mbmi.mode) : mi->mbmi.mode)
: mi->mbmi.uv_mode; : mi->mbmi.uv_mode;
int x, y;
uint8_t *dst;
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
dst = &pd->dst.buf[4 * y * pd->dst.stride + 4 * x];
if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0)
extend_for_intra(xd, plane_bsize, plane, block, tx_size); extend_for_intra(xd, plane_bsize, plane, block, tx_size);
...@@ -328,9 +326,9 @@ static void predict_and_reconstruct_intra_block(int plane, int block, ...@@ -328,9 +326,9 @@ static void predict_and_reconstruct_intra_block(int plane, int block,
dst, pd->dst.stride, dst, pd->dst.stride); dst, pd->dst.stride, dst, pd->dst.stride);
if (!mi->mbmi.skip_coeff) { if (!mi->mbmi.skip_coeff) {
vp9_decode_block_tokens(cm, xd, plane, block, plane_bsize, tx_size, vp9_decode_block_tokens(cm, xd, plane, block, plane_bsize, x, y, tx_size,
args->r, args->token_cache, band_translate); args->r, args->token_cache, band_translate);
inverse_transform_block(xd, plane, block, plane_bsize, tx_size); inverse_transform_block(xd, plane, block, tx_size, x, y);
} }
} }
...@@ -352,12 +350,14 @@ static void reconstruct_inter_block(int plane, int block, ...@@ -352,12 +350,14 @@ static void reconstruct_inter_block(int plane, int block,
const uint8_t *band_translate[2] = { const uint8_t *band_translate[2] = {
args->band_translate[0], args->band_translate[1] args->band_translate[0], args->band_translate[1]
}; };
int x, y;
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &x, &y);
*args->eobtotal += vp9_decode_block_tokens(cm, xd, plane, block, *args->eobtotal += vp9_decode_block_tokens(cm, xd, plane, block,
plane_bsize, tx_size, plane_bsize, x, y, tx_size,
args->r, args->token_cache, args->r, args->token_cache,
band_translate); band_translate);
inverse_transform_block(xd, plane, block, plane_bsize, tx_size); inverse_transform_block(xd, plane, block, tx_size, x, y);
} }
static void set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd, static void set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
......
...@@ -218,24 +218,19 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, ...@@ -218,24 +218,19 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
int plane, int block, BLOCK_SIZE plane_bsize, int plane, int block, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, vp9_reader *r, int x, int y, TX_SIZE tx_size, vp9_reader *r,
uint8_t *token_cache, uint8_t *token_cache,
const uint8_t *band_translate[2]) { const uint8_t *band_translate[2]) {
struct macroblockd_plane *const pd = &xd->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane];
const int seg_eob = get_tx_eob(&cm->seg, xd->mi_8x8[0]->mbmi.segment_id, const int seg_eob = get_tx_eob(&cm->seg, xd->mi_8x8[0]->mbmi.segment_id,
tx_size); tx_size);
int aoff, loff, eob, pt; const int pt = get_entropy_context(tx_size, pd->above_context + x,
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff); pd->left_context + y);
pt = get_entropy_context(tx_size, pd->above_context + aoff, const int eob = decode_coefs(cm, xd, r, block, pd->plane_type, seg_eob,
pd->left_context + loff); BLOCK_OFFSET(pd->dqcoeff, block), tx_size,
pd->dequant, pt, token_cache,
eob = decode_coefs(cm, xd, r, block, band_translate[tx_size != TX_4X4]);
pd->plane_type, seg_eob, BLOCK_OFFSET(pd->dqcoeff, block), set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, x, y);
tx_size, pd->dequant, pt, token_cache,
band_translate[tx_size != TX_4X4]);
set_contexts(xd, pd, plane_bsize, tx_size, eob > 0, aoff, loff);
pd->eobs[block] = eob; pd->eobs[block] = eob;
return eob; return eob;
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd, int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
int plane, int block, BLOCK_SIZE plane_bsize, int plane, int block, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, vp9_reader *r, int x, int y, TX_SIZE tx_size, vp9_reader *r,
uint8_t *token_cache, uint8_t *token_cache,
const uint8_t *band_translate[2]); const uint8_t *band_translate[2]);
......
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