Commit 05d55026 authored by Dmitry Kovalev's avatar Dmitry Kovalev Committed by Gerrit Code Review
Browse files

Merge "Reusing swap_block_ptr() function."

parents a822a2a5 073fbdf7
...@@ -242,6 +242,31 @@ void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) { ...@@ -242,6 +242,31 @@ void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) {
cpi->mb.sadperbit4 = sad_per_bit4lut[qindex]; cpi->mb.sadperbit4 = sad_per_bit4lut[qindex];
} }
static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
int m, int n, int min_plane, int max_plane) {
int i;
for (i = min_plane; i < max_plane; ++i) {
struct macroblock_plane *const p = &x->plane[i];
struct macroblockd_plane *const pd = &x->e_mbd.plane[i];
p->coeff = ctx->coeff_pbuf[i][m];
p->qcoeff = ctx->qcoeff_pbuf[i][m];
pd->dqcoeff = ctx->dqcoeff_pbuf[i][m];
p->eobs = ctx->eobs_pbuf[i][m];
ctx->coeff_pbuf[i][m] = ctx->coeff_pbuf[i][n];
ctx->qcoeff_pbuf[i][m] = ctx->qcoeff_pbuf[i][n];
ctx->dqcoeff_pbuf[i][m] = ctx->dqcoeff_pbuf[i][n];
ctx->eobs_pbuf[i][m] = ctx->eobs_pbuf[i][n];
ctx->coeff_pbuf[i][n] = p->coeff;
ctx->qcoeff_pbuf[i][n] = p->qcoeff;
ctx->dqcoeff_pbuf[i][n] = pd->dqcoeff;
ctx->eobs_pbuf[i][n] = p->eobs;
}
}
static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) { static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) {
int i, bsize, segment_id; int i, bsize, segment_id;
...@@ -1388,27 +1413,8 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -1388,27 +1413,8 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
*rate_tokenonly = this_rate_tokenonly; *rate_tokenonly = this_rate_tokenonly;
*distortion = this_distortion; *distortion = this_distortion;
*skippable = s; *skippable = s;
if (!x->select_txfm_size) { if (!x->select_txfm_size)
int i; swap_block_ptr(x, ctx, 2, 0, 1, MAX_MB_PLANE);
struct macroblock_plane *const p = x->plane;
struct macroblockd_plane *const pd = xd->plane;
for (i = 1; i < MAX_MB_PLANE; ++i) {
p[i].coeff = ctx->coeff_pbuf[i][2];
p[i].qcoeff = ctx->qcoeff_pbuf[i][2];
pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2];
p[i].eobs = ctx->eobs_pbuf[i][2];
ctx->coeff_pbuf[i][2] = ctx->coeff_pbuf[i][0];
ctx->qcoeff_pbuf[i][2] = ctx->qcoeff_pbuf[i][0];
ctx->dqcoeff_pbuf[i][2] = ctx->dqcoeff_pbuf[i][0];
ctx->eobs_pbuf[i][2] = ctx->eobs_pbuf[i][0];
ctx->coeff_pbuf[i][0] = p[i].coeff;
ctx->qcoeff_pbuf[i][0] = p[i].qcoeff;
ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff;
ctx->eobs_pbuf[i][0] = p[i].eobs;
}
}
} }
} }
...@@ -2931,30 +2937,6 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -2931,30 +2937,6 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
return this_rd; // if 0, this will be re-calculated by caller return this_rd; // if 0, this will be re-calculated by caller
} }
static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
int max_plane) {
struct macroblock_plane *const p = x->plane;
struct macroblockd_plane *const pd = x->e_mbd.plane;
int i;
for (i = 0; i < max_plane; ++i) {
p[i].coeff = ctx->coeff_pbuf[i][1];
p[i].qcoeff = ctx->qcoeff_pbuf[i][1];
pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1];
p[i].eobs = ctx->eobs_pbuf[i][1];
ctx->coeff_pbuf[i][1] = ctx->coeff_pbuf[i][0];
ctx->qcoeff_pbuf[i][1] = ctx->qcoeff_pbuf[i][0];
ctx->dqcoeff_pbuf[i][1] = ctx->dqcoeff_pbuf[i][0];
ctx->eobs_pbuf[i][1] = ctx->eobs_pbuf[i][0];
ctx->coeff_pbuf[i][0] = p[i].coeff;
ctx->qcoeff_pbuf[i][0] = p[i].qcoeff;
ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff;
ctx->eobs_pbuf[i][0] = p[i].eobs;
}
}
void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int *returnrate, int64_t *returndist, int *returnrate, int64_t *returndist,
BLOCK_SIZE bsize, BLOCK_SIZE bsize,
...@@ -3476,7 +3458,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -3476,7 +3458,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
best_mbmode = *mbmi; best_mbmode = *mbmi;
best_skip2 = this_skip2; best_skip2 = this_skip2;
if (!x->select_txfm_size) if (!x->select_txfm_size)
swap_block_ptr(x, ctx, max_plane); swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
vpx_memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size], vpx_memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size],
sizeof(uint8_t) * ctx->num_4x4_blk); sizeof(uint8_t) * ctx->num_4x4_blk);
...@@ -4131,7 +4113,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -4131,7 +4113,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
best_mbmode = *mbmi; best_mbmode = *mbmi;
best_skip2 = this_skip2; best_skip2 = this_skip2;
if (!x->select_txfm_size) if (!x->select_txfm_size)
swap_block_ptr(x, ctx, max_plane); swap_block_ptr(x, ctx, 1, 0, 0, max_plane);
vpx_memcpy(ctx->zcoeff_blk, x->zcoeff_blk[TX_4X4], vpx_memcpy(ctx->zcoeff_blk, x->zcoeff_blk[TX_4X4],
sizeof(uint8_t) * ctx->num_4x4_blk); sizeof(uint8_t) * ctx->num_4x4_blk);
......
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