From a82c58c40fe20532ef0bdadb6f8c1a397ea1c10a Mon Sep 17 00:00:00 2001 From: Johann Date: Tue, 31 Jul 2012 14:21:55 -0700 Subject: [PATCH] Change vp8_intra4x4_predict call sites Use the _d variant from the decoder. It moves the pointer calculations to the caller. Change-Id: Iae2a793433ef082980a3ffa0a1cabf0264a6a24d --- vp8/common/arm/armv6/intra4x4_predict_v6.asm | 4 ++-- vp8/encoder/encodeintra.c | 16 ++++++++-------- vp8/encoder/pickinter.c | 12 ++++++++---- vp8/encoder/rdopt.c | 13 ++++++++----- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/vp8/common/arm/armv6/intra4x4_predict_v6.asm b/vp8/common/arm/armv6/intra4x4_predict_v6.asm index a974cd12b..75d52dbeb 100644 --- a/vp8/common/arm/armv6/intra4x4_predict_v6.asm +++ b/vp8/common/arm/armv6/intra4x4_predict_v6.asm @@ -18,8 +18,8 @@ AREA ||.text||, CODE, READONLY, ALIGN=2 -;void vp8_intra4x4_predict(unsigned char *src, int src_stride, int b_mode, -; unsigned char *dst, int dst_stride) +;void vp8_intra4x4_predict_armv6(unsigned char *src, int src_stride, int b_mode, +; unsigned char *dst, int dst_stride) |vp8_intra4x4_predict_armv6| PROC push {r4-r12, lr} diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c index 1f445b7ec..a38036753 100644 --- a/vp8/encoder/encodeintra.c +++ b/vp8/encoder/encodeintra.c @@ -54,10 +54,13 @@ void vp8_encode_intra4x4block(MACROBLOCK *x, int ib) BLOCKD *b = &x->e_mbd.block[ib]; BLOCK *be = &x->block[ib]; int dst_stride = x->e_mbd.dst.y_stride; - unsigned char *base_dst = x->e_mbd.dst.y_buffer; + unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset; + unsigned char *Above = dst - dst_stride; + unsigned char *yleft = dst - 1; + unsigned char top_left = Above[-1]; - vp8_intra4x4_predict(base_dst + b->offset, dst_stride, - b->bmi.as_mode, b->predictor, 16); + vp8_intra4x4_predict_d(Above, yleft, dst_stride, b->bmi.as_mode, + b->predictor, 16, top_left); vp8_subtract_b(be, b, 16); @@ -67,14 +70,11 @@ void vp8_encode_intra4x4block(MACROBLOCK *x, int ib) if (*b->eob > 1) { - vp8_short_idct4x4llm(b->dqcoeff, - b->predictor, 16, base_dst + b->offset, dst_stride); + vp8_short_idct4x4llm(b->dqcoeff, b->predictor, 16, dst, dst_stride); } else { - vp8_dc_only_idct_add - (b->dqcoeff[0], b->predictor, 16, base_dst + b->offset, - dst_stride); + vp8_dc_only_idct_add(b->dqcoeff[0], b->predictor, 16, dst, dst_stride); } } diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 75e262eab..171e5a969 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -141,20 +141,24 @@ static int pick_intra4x4block( BLOCKD *b = &x->e_mbd.block[ib]; BLOCK *be = &x->block[ib]; int dst_stride = x->e_mbd.dst.y_stride; - unsigned char *base_dst = x->e_mbd.dst.y_buffer; + unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset; B_PREDICTION_MODE mode; int best_rd = INT_MAX; int rate; int distortion; + unsigned char *Above = dst - dst_stride; + unsigned char *yleft = dst - 1; + unsigned char top_left = Above[-1]; + for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++) { int this_rd; rate = mode_costs[mode]; - vp8_intra4x4_predict - (base_dst + b->offset, dst_stride, - mode, b->predictor, 16); + + vp8_intra4x4_predict_d(Above, yleft, dst_stride, mode, + b->predictor,16, top_left); distortion = get_prediction_error(be, b); this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion); diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index a534a0ba8..8179c9f84 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -653,7 +653,11 @@ static int rd_pick_intra4x4block( DECLARE_ALIGNED_ARRAY(16, unsigned char, best_predictor, 16*4); DECLARE_ALIGNED_ARRAY(16, short, best_dqcoeff, 16); int dst_stride = x->e_mbd.dst.y_stride; - unsigned char *base_dst = x->e_mbd.dst.y_buffer; + unsigned char *dst = x->e_mbd.dst.y_buffer + b->offset; + + unsigned char *Above = dst - dst_stride; + unsigned char *yleft = dst - 1; + unsigned char top_left = Above[-1]; for (mode = B_DC_PRED; mode <= B_HU_PRED; mode++) { @@ -662,8 +666,8 @@ static int rd_pick_intra4x4block( rate = bmode_costs[mode]; - vp8_intra4x4_predict(base_dst + b->offset, dst_stride, mode, - b->predictor, 16); + vp8_intra4x4_predict_d(Above, yleft, dst_stride, mode, + b->predictor, 16, top_left); vp8_subtract_b(be, b, 16); x->short_fdct4x4(be->src_diff, be->coeff, 32); x->quantize_b(be, b); @@ -692,8 +696,7 @@ static int rd_pick_intra4x4block( } b->bmi.as_mode = (B_PREDICTION_MODE)(*best_mode); - vp8_short_idct4x4llm(best_dqcoeff, best_predictor, 16, base_dst + b->offset, - dst_stride); + vp8_short_idct4x4llm(best_dqcoeff, best_predictor, 16, dst, dst_stride); return best_rd; }