ref: b870947d42d3b391d799b0e48630871844b0a37d
parent: 1de5da80c941b24fe3147ff86b88e65467bd1a92
author: Scott LaVarnway <slavarnway@google.com>
date: Wed Aug 24 10:42:26 EDT 2011
Removed bmi copy to/from BLOCKD for SPLITMV and B_PRED modes. Modified code to use the bmi found in mode_info_context instead of BLOCKD. On the decode side, the uvmvs are calculated only when required, instead of every macroblock. This is WIP. (bmi should eventually be removed from BLOCKD) Small performance gains noticed for RT encodes and decodes.(VGA) Change-Id: I2ed7f0fd5ca733655df684aa82da575c77a973e7
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -202,6 +202,7 @@
/* 16 Y blocks, 4 U, 4 V, 1 DC 2nd order block, each with 16 entries. */
BLOCKD block[25];
+ int fullpixel_mask;
YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
YV12_BUFFER_CONFIG dst;
@@ -282,21 +283,5 @@
extern void vp8_build_block_doffsets(MACROBLOCKD *x);
extern void vp8_setup_block_dptrs(MACROBLOCKD *x);
-
-static void update_blockd_bmi(MACROBLOCKD *xd)
-{
- int i;
- int is_4x4;
- is_4x4 = (xd->mode_info_context->mbmi.mode == SPLITMV) ||
- (xd->mode_info_context->mbmi.mode == B_PRED);
-
- if (is_4x4)
- {
- for (i = 0; i < 16; i++)
- {
- xd->block[i].bmi = xd->mode_info_context->bmi[i];
- }
- }
-}
#endif /* __INC_BLOCKD_H */
--- a/vp8/common/reconinter.c
+++ b/vp8/common/reconinter.c
@@ -19,10 +19,6 @@
#include "onyxc_int.h"
#endif
-static const int bbb[4] = {0, 2, 8, 10};
-
-
-
void vp8_copy_mem16x16_c(
unsigned char *src,
int src_stride,
@@ -203,54 +199,109 @@
/*encoder only*/
-void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x)
+void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x)
{
- int i;
+ unsigned char *uptr, *vptr;
+ unsigned char *upred_ptr = &x->predictor[256];
+ unsigned char *vpred_ptr = &x->predictor[320];
- if (x->mode_info_context->mbmi.mode != SPLITMV)
- {
- unsigned char *uptr, *vptr;
- unsigned char *upred_ptr = &x->predictor[256];
- unsigned char *vpred_ptr = &x->predictor[320];
+ int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
+ int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
+ int offset;
+ int pre_stride = x->block[16].pre_stride;
- int mv_row = x->block[16].bmi.mv.as_mv.row;
- int mv_col = x->block[16].bmi.mv.as_mv.col;
- int offset;
- int pre_stride = x->block[16].pre_stride;
+ /* calc uv motion vectors */
+ if (mv_row < 0)
+ mv_row -= 1;
+ else
+ mv_row += 1;
- offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
- uptr = x->pre.u_buffer + offset;
- vptr = x->pre.v_buffer + offset;
+ if (mv_col < 0)
+ mv_col -= 1;
+ else
+ mv_col += 1;
- if ((mv_row | mv_col) & 7)
- {
- x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr, 8);
- x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr, 8);
- }
- else
- {
- RECON_INVOKE(&x->rtcd->recon, copy8x8)(uptr, pre_stride, upred_ptr, 8);
- RECON_INVOKE(&x->rtcd->recon, copy8x8)(vptr, pre_stride, vpred_ptr, 8);
- }
+ mv_row /= 2;
+ mv_col /= 2;
+
+ mv_row &= x->fullpixel_mask;
+ mv_col &= x->fullpixel_mask;
+
+ offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
+ uptr = x->pre.u_buffer + offset;
+ vptr = x->pre.v_buffer + offset;
+
+ if ((mv_row | mv_col) & 7)
+ {
+ x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr, 8);
+ x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr, 8);
}
else
{
- for (i = 16; i < 24; i += 2)
+ RECON_INVOKE(&x->rtcd->recon, copy8x8)(uptr, pre_stride, upred_ptr, 8);
+ RECON_INVOKE(&x->rtcd->recon, copy8x8)(vptr, pre_stride, vpred_ptr, 8);
+ }
+}
+
+/*encoder only*/
+void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x)
+{
+ int i, j;
+
+ /* build uv mvs */
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
{
- BLOCKD *d0 = &x->block[i];
- BLOCKD *d1 = &x->block[i+1];
+ int yoffset = i * 8 + j * 2;
+ int uoffset = 16 + i * 2 + j;
+ int voffset = 20 + i * 2 + j;
- if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
- build_inter_predictors2b(x, d0, 8);
- else
- {
- vp8_build_inter_predictors_b(d0, 8, x->subpixel_predict);
- vp8_build_inter_predictors_b(d1, 8, x->subpixel_predict);
- }
+ int temp;
+
+ temp = x->block[yoffset ].bmi.mv.as_mv.row
+ + x->block[yoffset+1].bmi.mv.as_mv.row
+ + x->block[yoffset+4].bmi.mv.as_mv.row
+ + x->block[yoffset+5].bmi.mv.as_mv.row;
+
+ if (temp < 0) temp -= 4;
+ else temp += 4;
+
+ x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
+
+ temp = x->block[yoffset ].bmi.mv.as_mv.col
+ + x->block[yoffset+1].bmi.mv.as_mv.col
+ + x->block[yoffset+4].bmi.mv.as_mv.col
+ + x->block[yoffset+5].bmi.mv.as_mv.col;
+
+ if (temp < 0) temp -= 4;
+ else temp += 4;
+
+ x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
+
+ x->block[voffset].bmi.mv.as_mv.row =
+ x->block[uoffset].bmi.mv.as_mv.row ;
+ x->block[voffset].bmi.mv.as_mv.col =
+ x->block[uoffset].bmi.mv.as_mv.col ;
}
}
+
+ for (i = 16; i < 24; i += 2)
+ {
+ BLOCKD *d0 = &x->block[i];
+ BLOCKD *d1 = &x->block[i+1];
+
+ if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
+ build_inter_predictors2b(x, d0, 8);
+ else
+ {
+ vp8_build_inter_predictors_b(d0, 8, x->subpixel_predict);
+ vp8_build_inter_predictors_b(d1, 8, x->subpixel_predict);
+ }
+ }
}
+
/*encoder only*/
void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x)
{
@@ -302,8 +353,23 @@
RECON_INVOKE(&x->rtcd->recon, copy16x16)(ptr, pre_stride, dst_y, dst_ystride);
}
- mv_row = x->block[16].bmi.mv.as_mv.row;
- mv_col = x->block[16].bmi.mv.as_mv.col;
+ /* calc uv motion vectors */
+ if (mv_row < 0)
+ mv_row -= 1;
+ else
+ mv_row += 1;
+
+ if (mv_col < 0)
+ mv_col -= 1;
+ else
+ mv_col += 1;
+
+ mv_row /= 2;
+ mv_col /= 2;
+
+ mv_row &= x->fullpixel_mask;
+ mv_col &= x->fullpixel_mask;
+
pre_stride >>= 1;
offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
uptr = x->pre.u_buffer + offset;
@@ -322,17 +388,21 @@
}
-void vp8_build_inter4x4_predictors_mb(MACROBLOCKD *x)
+static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
{
int i;
if (x->mode_info_context->mbmi.partitioning < 3)
{
- for (i = 0; i < 4; i++)
- {
- BLOCKD *d = &x->block[bbb[i]];
- build_inter_predictors4b(x, d, 16);
- }
+ x->block[ 0].bmi = x->mode_info_context->bmi[ 0];
+ x->block[ 2].bmi = x->mode_info_context->bmi[ 2];
+ x->block[ 8].bmi = x->mode_info_context->bmi[ 8];
+ x->block[10].bmi = x->mode_info_context->bmi[10];
+
+ build_inter_predictors4b(x, &x->block[ 0], 16);
+ build_inter_predictors4b(x, &x->block[ 2], 16);
+ build_inter_predictors4b(x, &x->block[ 8], 16);
+ build_inter_predictors4b(x, &x->block[10], 16);
}
else
{
@@ -341,6 +411,9 @@
BLOCKD *d0 = &x->block[i];
BLOCKD *d1 = &x->block[i+1];
+ x->block[i+0].bmi = x->mode_info_context->bmi[i+0];
+ x->block[i+1].bmi = x->mode_info_context->bmi[i+1];
+
if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
build_inter_predictors2b(x, d0, 16);
else
@@ -368,98 +441,60 @@
}
}
-void vp8_build_inter_predictors_mb(MACROBLOCKD *x)
+static
+void build_4x4uvmvs(MACROBLOCKD *x)
{
- if (x->mode_info_context->mbmi.mode != SPLITMV)
- {
- vp8_build_inter16x16_predictors_mb(x, x->predictor, &x->predictor[256],
- &x->predictor[320], 16, 8);
- }
- else
- {
- vp8_build_inter4x4_predictors_mb(x);
- }
-}
-
-void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel)
-{
int i, j;
- if (x->mode_info_context->mbmi.mode == SPLITMV)
+ for (i = 0; i < 2; i++)
{
- for (i = 0; i < 2; i++)
+ for (j = 0; j < 2; j++)
{
- for (j = 0; j < 2; j++)
- {
- int yoffset = i * 8 + j * 2;
- int uoffset = 16 + i * 2 + j;
- int voffset = 20 + i * 2 + j;
+ int yoffset = i * 8 + j * 2;
+ int uoffset = 16 + i * 2 + j;
+ int voffset = 20 + i * 2 + j;
- int temp;
+ int temp;
- temp = x->block[yoffset ].bmi.mv.as_mv.row
- + x->block[yoffset+1].bmi.mv.as_mv.row
- + x->block[yoffset+4].bmi.mv.as_mv.row
- + x->block[yoffset+5].bmi.mv.as_mv.row;
+ temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.row
+ + x->mode_info_context->bmi[yoffset + 1].mv.as_mv.row
+ + x->mode_info_context->bmi[yoffset + 4].mv.as_mv.row
+ + x->mode_info_context->bmi[yoffset + 5].mv.as_mv.row;
- if (temp < 0) temp -= 4;
- else temp += 4;
+ if (temp < 0) temp -= 4;
+ else temp += 4;
- x->block[uoffset].bmi.mv.as_mv.row = temp / 8;
+ x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
- if (fullpixel)
- x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & 0xfffffff8;
+ temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.col
+ + x->mode_info_context->bmi[yoffset + 1].mv.as_mv.col
+ + x->mode_info_context->bmi[yoffset + 4].mv.as_mv.col
+ + x->mode_info_context->bmi[yoffset + 5].mv.as_mv.col;
- temp = x->block[yoffset ].bmi.mv.as_mv.col
- + x->block[yoffset+1].bmi.mv.as_mv.col
- + x->block[yoffset+4].bmi.mv.as_mv.col
- + x->block[yoffset+5].bmi.mv.as_mv.col;
+ if (temp < 0) temp -= 4;
+ else temp += 4;
- if (temp < 0) temp -= 4;
- else temp += 4;
+ x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
- x->block[uoffset].bmi.mv.as_mv.col = temp / 8;
-
- if (fullpixel)
- x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & 0xfffffff8;
-
- x->block[voffset].bmi.mv.as_mv.row = x->block[uoffset].bmi.mv.as_mv.row ;
- x->block[voffset].bmi.mv.as_mv.col = x->block[uoffset].bmi.mv.as_mv.col ;
- }
+ x->block[voffset].bmi.mv.as_mv.row =
+ x->block[uoffset].bmi.mv.as_mv.row ;
+ x->block[voffset].bmi.mv.as_mv.col =
+ x->block[uoffset].bmi.mv.as_mv.col ;
}
}
+}
+
+void vp8_build_inter_predictors_mb(MACROBLOCKD *x)
+{
+ if (x->mode_info_context->mbmi.mode != SPLITMV)
+ {
+ vp8_build_inter16x16_predictors_mb(x, x->predictor, &x->predictor[256],
+ &x->predictor[320], 16, 8);
+ }
else
{
- int mvrow = x->mode_info_context->mbmi.mv.as_mv.row;
- int mvcol = x->mode_info_context->mbmi.mv.as_mv.col;
-
- if (mvrow < 0)
- mvrow -= 1;
- else
- mvrow += 1;
-
- if (mvcol < 0)
- mvcol -= 1;
- else
- mvcol += 1;
-
- mvrow /= 2;
- mvcol /= 2;
-
- for (i = 0; i < 8; i++)
- {
- x->block[ 16 + i].bmi.mv.as_mv.row = mvrow;
- x->block[ 16 + i].bmi.mv.as_mv.col = mvcol;
-
- if (fullpixel)
- {
- x->block[ 16 + i].bmi.mv.as_mv.row = mvrow & 0xfffffff8;
- x->block[ 16 + i].bmi.mv.as_mv.col = mvcol & 0xfffffff8;
- }
- }
+ build_4x4uvmvs(x);
+ build_inter4x4_predictors_mb(x);
}
}
-
-
-
--- a/vp8/common/reconinter.h
+++ b/vp8/common/reconinter.h
@@ -22,8 +22,9 @@
extern void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x);
-extern void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel);
extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf);
-extern void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x);
+
+extern void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x);
+extern void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x);
#endif
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -264,8 +264,10 @@
for (i = 0; i < 16; i++)
{
BLOCKD *b = &xd->block[i];
+ int b_mode = xd->mode_info_context->bmi[i].as_mode;
+
RECON_INVOKE(RTCD_VTABLE(recon), intra4x4_predict)
- (b, b->bmi.as_mode, b->predictor);
+ (b, b_mode, b->predictor);
if (xd->eobs[i] > 1)
{
@@ -410,8 +412,6 @@
}
#endif
- update_blockd_bmi(xd);
-
xd->dst.y_buffer = pc->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset;
xd->dst.u_buffer = pc->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset;
xd->dst.v_buffer = pc->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset;
@@ -436,14 +436,6 @@
xd->corrupted |= pc->yv12_fb[ref_fb_idx].corrupted;
}
- vp8_build_uvmvs(xd, pc->full_pixel);
-
- /*
- if(pc->current_video_frame==0 &&mb_col==1 && mb_row==0)
- pbi->debugoutput =1;
- else
- pbi->debugoutput =0;
- */
decode_macroblock(pbi, xd, mb_row * pc->mb_cols + mb_col);
/* check if the boolean decoder has suffered an error */
@@ -685,6 +677,11 @@
xd->mode_info_context->mbmi.mode = DC_PRED;
xd->mode_info_stride = pc->mode_info_stride;
xd->corrupted = 0; /* init without corruption */
+
+ xd->fullpixel_mask = 0xffffffff;
+ if(pc->full_pixel)
+ xd->fullpixel_mask = 0xfffffff8;
+
}
int vp8_decode_frame(VP8D_COMP *pbi)
--- a/vp8/decoder/threading.c
+++ b/vp8/decoder/threading.c
@@ -28,7 +28,6 @@
extern void mb_init_dequantizer(VP8D_COMP *pbi, MACROBLOCKD *xd);
extern void clamp_mvs(MACROBLOCKD *xd);
-extern void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel);
#if CONFIG_RUNTIME_CPU_DETECT
#define RTCD_VTABLE(x) (&(pbi)->common.rtcd.x)
@@ -83,6 +82,11 @@
{
mbd->block[j].dequant = xd->block[j].dequant;
}
+
+ mbd->fullpixel_mask = 0xffffffff;
+ if(pc->full_pixel)
+ mbd->fullpixel_mask = 0xfffffff8;
+
}
for (i=0; i< pc->mb_rows; i++)
@@ -212,8 +216,9 @@
for (i = 0; i < 16; i++)
{
BLOCKD *b = &xd->block[i];
+ int b_mode = xd->mode_info_context->bmi[i].as_mode;
- vp8mt_predict_intra4x4(pbi, xd, b->bmi.as_mode, b->predictor, mb_row, mb_col, i);
+ vp8mt_predict_intra4x4(pbi, xd, b_mode, b->predictor, mb_row, mb_col, i);
if (xd->eobs[i] > 1)
{
@@ -313,8 +318,6 @@
}
}
- update_blockd_bmi(xd);
-
/* Distance of MB to the various image edges.
* These are specified to 8th pel as they are always
* compared to values that are in 1/8th pel units.
@@ -378,7 +381,6 @@
xd->corrupted |= pc->yv12_fb[ref_fb_idx].corrupted;
}
- vp8_build_uvmvs(xd, pc->full_pixel);
decode_macroblock(pbi, xd, mb_row, mb_col);
/* check if the boolean decoder has suffered an error */
@@ -819,8 +821,6 @@
}
}
- update_blockd_bmi(xd);
-
/* Distance of MB to the various image edges.
* These are specified to 8th pel as they are always compared to
* values that are in 1/8th pel units.
@@ -879,7 +879,6 @@
xd->corrupted |= pc->yv12_fb[ref_fb_idx].corrupted;
}
- vp8_build_uvmvs(xd, pc->full_pixel);
decode_macroblock(pbi, xd, mb_row, mb_col);
/* check if the boolean decoder has suffered an error */
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -368,7 +368,6 @@
int *segment_counts,
int *totalrate)
{
- int i;
int recon_yoffset, recon_uvoffset;
int mb_col;
int ref_fb_idx = cm->lst_fb_idx;
@@ -534,10 +533,6 @@
// Increment the activity mask pointers.
x->mb_activity_ptr++;
- /* save the block info */
- for (i = 0; i < 16; i++)
- xd->mode_info_context->bmi[i] = xd->block[i].bmi;
-
// adjust to the next column of macroblocks
x->src.y_buffer += 16;
x->src.u_buffer += 8;
@@ -665,6 +660,9 @@
+ vp8_cost_one(cpi->prob_gf_coded);
}
+ xd->fullpixel_mask = 0xffffffff;
+ if(cm->full_pixel)
+ xd->fullpixel_mask = 0xfffffff8;
}
void vp8_encode_frame(VP8_COMP *cpi)
@@ -1280,8 +1278,6 @@
else
{
int ref_fb_idx;
-
- vp8_build_uvmvs(xd, cpi->common.full_pixel);
if (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME)
ref_fb_idx = cpi->common.lst_fb_idx;
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -615,15 +615,3 @@
RECON_INVOKE(&rtcd->common->recon, recon_mby)
(IF_RTCD(&rtcd->common->recon), &x->e_mbd);
}
-
-
-void vp8_encode_inter16x16uvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
-{
- vp8_build_inter_predictors_mbuv(&x->e_mbd);
- ENCODEMB_INVOKE(&rtcd->encodemb, submbuv)(x->src_diff, x->src.u_buffer, x->src.v_buffer, x->e_mbd.predictor, x->src.uv_stride);
-
- vp8_transform_mbuv(x);
-
- vp8_quantize_mbuv(x);
-
-}
--- a/vp8/encoder/encodemb.h
+++ b/vp8/encoder/encodemb.h
@@ -99,7 +99,7 @@
void vp8_transform_mb(MACROBLOCK *mb);
void vp8_transform_mbuv(MACROBLOCK *x);
void vp8_transform_intra_mby(MACROBLOCK *x);
-void vp8_encode_inter16x16uvrd(const struct VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
+
void vp8_optimize_mby(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
void vp8_optimize_mbuv(MACROBLOCK *x, const struct VP8_ENCODER_RTCD *rtcd);
void vp8_encode_inter16x16y(const struct VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
--- a/vp8/encoder/rdopt.c
+++ b/vp8/encoder/rdopt.c
@@ -440,15 +440,24 @@
unsigned int sse1 = 0;
unsigned int sse2 = 0;
- int mv_row;
- int mv_col;
+ int mv_row = x->e_mbd.mode_info_context->mbmi.mv.as_mv.row;
+ int mv_col = x->e_mbd.mode_info_context->mbmi.mv.as_mv.col;
int offset;
int pre_stride = x->e_mbd.block[16].pre_stride;
- vp8_build_uvmvs(&x->e_mbd, 0);
- mv_row = x->e_mbd.block[16].bmi.mv.as_mv.row;
- mv_col = x->e_mbd.block[16].bmi.mv.as_mv.col;
+ if (mv_row < 0)
+ mv_row -= 1;
+ else
+ mv_row += 1;
+ if (mv_col < 0)
+ mv_col -= 1;
+ else
+ mv_col += 1;
+
+ mv_row /= 2;
+ mv_col /= 2;
+
offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
uptr = x->e_mbd.pre.u_buffer + offset;
vptr = x->e_mbd.pre.v_buffer + offset;
@@ -786,11 +795,15 @@
}
-static int vp8_rd_inter_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *distortion, int fullpixel)
+static int rd_inter16x16_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
+ int *distortion, int fullpixel)
{
- vp8_build_uvmvs(&x->e_mbd, fullpixel);
- vp8_encode_inter16x16uvrd(IF_RTCD(&cpi->rtcd), x);
+ vp8_build_inter16x16_predictors_mbuv(&x->e_mbd);
+ ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), submbuv)(x->src_diff,
+ x->src.u_buffer, x->src.v_buffer, x->e_mbd.predictor, x->src.uv_stride);
+ vp8_transform_mbuv(x);
+ vp8_quantize_mbuv(x);
*rate = rd_cost_mbuv(x);
*distortion = ENCODEMB_INVOKE(&cpi->rtcd.encodemb, mbuverr)(x) / 4;
@@ -798,6 +811,22 @@
return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
}
+static int rd_inter4x4_uv(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
+ int *distortion, int fullpixel)
+{
+ vp8_build_inter4x4_predictors_mbuv(&x->e_mbd);
+ ENCODEMB_INVOKE(IF_RTCD(&cpi->rtcd.encodemb), submbuv)(x->src_diff,
+ x->src.u_buffer, x->src.v_buffer, x->e_mbd.predictor, x->src.uv_stride);
+
+ vp8_transform_mbuv(x);
+ vp8_quantize_mbuv(x);
+
+ *rate = rd_cost_mbuv(x);
+ *distortion = ENCODEMB_INVOKE(&cpi->rtcd.encodemb, mbuverr)(x) / 4;
+
+ return RDCOST(x->rdmult, x->rddiv, *rate, *distortion);
+}
+
static void rd_pick_intra_mbuv_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate, int *rate_tokenonly, int *distortion)
{
MB_PREDICTION_MODE mode;
@@ -1956,7 +1985,7 @@
if (tmp_rd < best_yrd)
{
// Now work out UV cost and add it in
- vp8_rd_inter_uv(cpi, x, &rate_uv, &distortion_uv, cpi->common.full_pixel);
+ rd_inter4x4_uv(cpi, x, &rate_uv, &distortion_uv, cpi->common.full_pixel);
rate2 += rate_uv;
distortion2 += distortion_uv;
}
@@ -2207,7 +2236,7 @@
distortion2 += distortion;
// UV cost and distortion
- vp8_rd_inter_uv(cpi, x, &rate_uv, &distortion_uv, cpi->common.full_pixel);
+ rd_inter16x16_uv(cpi, x, &rate_uv, &distortion_uv, cpi->common.full_pixel);
rate2 += rate_uv;
distortion2 += distortion_uv;
break;
@@ -2385,13 +2414,13 @@
if (best_mbmode.mode == B_PRED)
{
for (i = 0; i < 16; i++)
- x->e_mbd.block[i].bmi.as_mode = best_bmodes[i].as_mode;
+ xd->mode_info_context->bmi[i].as_mode = best_bmodes[i].as_mode;
}
if (best_mbmode.mode == SPLITMV)
{
for (i = 0; i < 16; i++)
- x->e_mbd.block[i].bmi.mv.as_int = best_bmodes[i].mv.as_int;
+ xd->mode_info_context->bmi[i].mv.as_int = best_bmodes[i].mv.as_int;
vpx_memcpy(x->partition_info, &best_partition, sizeof(PARTITION_INFO));
@@ -2400,6 +2429,8 @@
}
rd_update_mvcount(cpi, x, &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame]);
+
+
}
--
⑨