summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_encodemb.c
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/encoder/vp9_encodemb.c')
-rw-r--r--vp9/encoder/vp9_encodemb.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 169943c10..fec86a788 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -335,7 +335,7 @@ static INLINE void highbd_fdct32x32(int rd_transform, const int16_t *src,
}
#endif // CONFIG_VP9_HIGHBITDEPTH
-void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
+void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block, int row, int col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
@@ -346,10 +346,8 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- int i, j;
const int16_t *src_diff;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+ src_diff = &p->src_diff[4 * (row * diff_stride + col)];
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -425,7 +423,7 @@ void vp9_xform_quant_fp(MACROBLOCK *x, int plane, int block,
}
}
-void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
+void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block, int row, int col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
@@ -435,12 +433,8 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- int i, j;
const int16_t *src_diff;
-
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- src_diff = &p->src_diff[4 * (j * diff_stride + i)];
-
+ src_diff = &p->src_diff[4 * (row * diff_stride + col)];
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
switch (tx_size) {
@@ -506,7 +500,7 @@ void vp9_xform_quant_dc(MACROBLOCK *x, int plane, int block,
}
}
-void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
+void vp9_xform_quant(MACROBLOCK *x, int plane, int block, int row, int col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size) {
MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblock_plane *const p = &x->plane[plane];
@@ -517,10 +511,8 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
uint16_t *const eob = &p->eobs[block];
const int diff_stride = 4 * num_4x4_blocks_wide_lookup[plane_bsize];
- int i, j;
const int16_t *src_diff;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+ src_diff = &p->src_diff[4 * (row * diff_stride + col)];
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
@@ -595,7 +587,8 @@ void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
}
}
-static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
+static void encode_block(int plane, int block, int row, int col,
+ BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct encode_b_args *const args = arg;
MACROBLOCK *const x = args->x;
@@ -604,13 +597,11 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- int i, j;
uint8_t *dst;
ENTROPY_CONTEXT *a, *l;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
- a = &ctx->ta[plane][i];
- l = &ctx->tl[plane][j];
+ dst = &pd->dst.buf[4 * row * pd->dst.stride + 4 * col];
+ a = &ctx->ta[plane][col];
+ l = &ctx->tl[plane][row];
// TODO(jingning): per transformed block zero forcing only enabled for
// luma component. will integrate chroma components as well.
@@ -629,17 +620,17 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
*a = *l = 0;
return;
} else {
- vp9_xform_quant_fp(x, plane, block, plane_bsize, tx_size);
+ vp9_xform_quant_fp(x, plane, block, row, col, plane_bsize, tx_size);
}
} else {
if (max_txsize_lookup[plane_bsize] == tx_size) {
int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
// full forward transform and quantization
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+ vp9_xform_quant(x, plane, block, row, col, plane_bsize, tx_size);
} else if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_AC_ONLY) {
// fast path forward transform and quantization
- vp9_xform_quant_dc(x, plane, block, plane_bsize, tx_size);
+ vp9_xform_quant_dc(x, plane, block, row, col, plane_bsize, tx_size);
} else {
// skip forward transform
p->eobs[block] = 0;
@@ -647,7 +638,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
return;
}
} else {
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+ vp9_xform_quant(x, plane, block, row, col, plane_bsize, tx_size);
}
}
}
@@ -715,19 +706,18 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize,
}
}
-static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize,
+static void encode_block_pass1(int plane, int block, int row, int col,
+ BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
MACROBLOCK *const x = (MACROBLOCK *)arg;
MACROBLOCKD *const xd = &x->e_mbd;
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
- int i, j;
uint8_t *dst;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * j * pd->dst.stride + 4 * i];
+ dst = &pd->dst.buf[4 * row * pd->dst.stride + 4 * col];
- vp9_xform_quant(x, plane, block, plane_bsize, tx_size);
+ vp9_xform_quant(x, plane, block, row, col, plane_bsize, tx_size);
if (p->eobs[block] > 0) {
#if CONFIG_VP9_HIGHBITDEPTH
@@ -774,7 +764,8 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
}
}
-void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
+void vp9_encode_block_intra(int plane, int block, int row, int col,
+ BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
struct encode_b_args* const args = arg;
MACROBLOCK *const x = args->x;
@@ -795,18 +786,16 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
uint16_t *eob = &p->eobs[block];
const int src_stride = p->src.stride;
const int dst_stride = pd->dst.stride;
- int i, j;
struct optimize_ctx *const ctx = args->ctx;
ENTROPY_CONTEXT *a = NULL;
ENTROPY_CONTEXT *l = NULL;
int entropy_ctx = 0;
- txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &i, &j);
- dst = &pd->dst.buf[4 * (j * dst_stride + i)];
- src = &p->src.buf[4 * (j * src_stride + i)];
- src_diff = &p->src_diff[4 * (j * diff_stride + i)];
+ dst = &pd->dst.buf[4 * (row * dst_stride + col)];
+ src = &p->src.buf[4 * (row * src_stride + col)];
+ src_diff = &p->src_diff[4 * (row * diff_stride + col)];
if (args->ctx != NULL) {
- a = &ctx->ta[plane][i];
- l = &ctx->tl[plane][j];
+ a = &ctx->ta[plane][col];
+ l = &ctx->tl[plane][row];
entropy_ctx = combine_entropy_contexts(*a, *l);
}
@@ -826,7 +815,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
vp9_predict_intra_block(xd, bwl, tx_size, mode, x->skip_encode ? src : dst,
x->skip_encode ? src_stride : dst_stride,
- dst, dst_stride, i, j, plane);
+ dst, dst_stride, col, row, plane);
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {