Commit 78d33cad authored by Daniel Kang's avatar Daniel Kang
Browse files

Combine vp8_block_error_c and vp8_submb_error_c.

Change-Id: I58792bac6c7e5a524a6dcdb5241ef18bcc0c3a45
parent 0b17ea6f
......@@ -19,7 +19,7 @@
int (sym)(MACROBLOCK *mb, int dc)
#define prototype_berr(sym) \
int (sym)(short *coeff, short *dqcoeff)
int (sym)(short *coeff, short *dqcoeff, int block_size)
#define prototype_mbuverr(sym) \
int (sym)(MACROBLOCK *mb)
......
......@@ -279,8 +279,7 @@ void vp8cx_initialize_me_consts(VP8_COMP *cpi, int QIndex) {
void vp8_initialize_rd_consts(VP8_COMP *cpi, int QIndex) {
int q;
int i;
int q, i;
vp8_clear_system_state(); // __asm emms;
......@@ -438,11 +437,10 @@ void vp8_auto_select_speed(VP8_COMP *cpi) {
}
}
int vp8_block_error_c(short *coeff, short *dqcoeff) {
int i;
int error = 0;
int vp8_block_error_c(short *coeff, short *dqcoeff, int block_size) {
int i, error = 0;
for (i = 0; i < 16; i++) {
for (i = 0; i < block_size; i++) {
int this_diff = coeff[i] - dqcoeff[i];
error += this_diff * this_diff;
}
......@@ -450,20 +448,6 @@ int vp8_block_error_c(short *coeff, short *dqcoeff) {
return error;
}
#if CONFIG_HYBRIDTRANSFORM8X8
int vp8_submb_error_c(short *coeff, short *dqcoeff) {
int i;
int error = 0;
for (i = 0; i < 64; i++) {
int this_diff = coeff[i] - dqcoeff[i];
error += this_diff * this_diff;
}
return error;
}
#endif
int vp8_mbblock_error_c(MACROBLOCK *mb, int dc) {
BLOCK *be;
BLOCKD *bd;
......@@ -500,7 +484,7 @@ int vp8_mbuverror_c(MACROBLOCK *mb) {
be = &mb->block[i];
bd = &mb->e_mbd.block[i];
error += vp8_block_error_c(be->coeff, bd->dqcoeff);
error += vp8_block_error_c(be->coeff, bd->dqcoeff, 16);
}
return error;
......@@ -729,7 +713,7 @@ static void macro_block_yrd(MACROBLOCK *mb,
// Distortion
d = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(mb, 1);
d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff);
d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff, 16);
*Distortion = (d >> 2);
// rate
......@@ -789,7 +773,7 @@ static void macro_block_yrd_8x8(MACROBLOCK *mb,
mb->e_mbd.dqcoeff[192] = 0;
d = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(mb, 0);
d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff);
d += ENCODEMB_INVOKE(&rtcd->encodemb, berr)(mb_y2->coeff, x_y2->dqcoeff, 16);
*Distortion = (d >> 2);
// rate
......@@ -954,7 +938,7 @@ static int64_t rd_pick_intra4x4block(
ratey = cost_coeffs(x, b, PLANE_TYPE_Y_WITH_DC, &tempa, &templ, TX_4X4);
rate += ratey;
distortion = ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)(
be->coeff, b->dqcoeff) >> 2;
be->coeff, b->dqcoeff, 16) >> 2;
this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
......@@ -1234,8 +1218,8 @@ static int64_t rd_pick_intra8x8block(
x->quantize_b_8x8(x->block + idx, xd->block + idx);
// compute quantization mse of 8x8 block
distortion = vp8_submb_error_c((x->block + idx)->coeff,
(xd->block + idx)->dqcoeff)>>2;
distortion = vp8_block_error_c((x->block + idx)->coeff,
(xd->block + idx)->dqcoeff, 64)>>2;
ta0 = *(a + vp8_block2above_8x8[idx]);
tl0 = *(l + vp8_block2left_8x8 [idx]);
......@@ -1255,13 +1239,13 @@ static int64_t rd_pick_intra8x8block(
xd->block + ib + 4, xd->block + ib + 5);
distortion = ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)
((x->block + ib)->coeff, (xd->block + ib)->dqcoeff) >> 2;
((x->block + ib)->coeff, (xd->block + ib)->dqcoeff, 16) >> 2;
distortion += ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)
((x->block + ib + 1)->coeff, (xd->block + ib + 1)->dqcoeff) >> 2;
((x->block + ib + 1)->coeff, (xd->block + ib + 1)->dqcoeff, 16) >> 2;
distortion += ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)
((x->block + ib + 4)->coeff, (xd->block + ib + 4)->dqcoeff) >> 2;
((x->block + ib + 4)->coeff, (xd->block + ib + 4)->dqcoeff, 16) >> 2;
distortion += ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), berr)
((x->block + ib + 5)->coeff, (xd->block + ib + 5)->dqcoeff) >> 2;
((x->block + ib + 5)->coeff, (xd->block + ib + 5)->dqcoeff, 16) >> 2;
ta0 = *(a + vp8_block2above[ib]);
ta1 = *(a + vp8_block2above[ib + 1]);
......@@ -1760,8 +1744,7 @@ static unsigned int vp8_encode_inter_mb_segment(
// be->coeff[0] = 0;
x->quantize_b(be, bd);
thisdistortion = ENCODEMB_INVOKE(&rtcd->encodemb, berr)(
be->coeff,
bd->dqcoeff) / 4;
be->coeff, bd->dqcoeff, 16) / 4;
distortion += thisdistortion;
}
}
......
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