Commit 09c933ea authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

Removed redundant checks of the mode_info_context flags

Code cleanup.  The build inter predictor functions are
redundantly checking the mode_info_context for either
INTRA_FRAME or SPLITMV.

Change-Id: I4d58c3a5192a4c2cec5c24ab1caf608bf13aebfb
parent 4a2b684e
...@@ -207,12 +207,12 @@ static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, int pitch) ...@@ -207,12 +207,12 @@ static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, int pitch)
} }
/*encoder only*/
void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x) void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x)
{ {
int i; int i;
if (x->mode_info_context->mbmi.ref_frame != INTRA_FRAME && if (x->mode_info_context->mbmi.mode != SPLITMV)
x->mode_info_context->mbmi.mode != SPLITMV)
{ {
unsigned char *uptr, *vptr; unsigned char *uptr, *vptr;
unsigned char *upred_ptr = &x->predictor[256]; unsigned char *upred_ptr = &x->predictor[256];
...@@ -257,69 +257,32 @@ void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x) ...@@ -257,69 +257,32 @@ void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x)
} }
/*encoder only*/ /*encoder only*/
void vp8_build_inter_predictors_mby(MACROBLOCKD *x) void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x)
{ {
unsigned char *ptr_base;
unsigned char *ptr;
unsigned char *pred_ptr = x->predictor;
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 pre_stride = x->block[0].pre_stride;
if (x->mode_info_context->mbmi.ref_frame != INTRA_FRAME && ptr_base = x->pre.y_buffer;
x->mode_info_context->mbmi.mode != SPLITMV) ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3);
{
unsigned char *ptr_base;
unsigned char *ptr;
unsigned char *pred_ptr = x->predictor;
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 pre_stride = x->block[0].pre_stride;
ptr_base = x->pre.y_buffer;
ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3);
if ((mv_row | mv_col) & 7) if ((mv_row | mv_col) & 7)
{ {
x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, pred_ptr, 16); x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, pred_ptr, 16);
}
else
{
RECON_INVOKE(&x->rtcd->recon, copy16x16)(ptr, pre_stride, pred_ptr, 16);
}
} }
else else
{ {
int i; RECON_INVOKE(&x->rtcd->recon, copy16x16)(ptr, pre_stride, pred_ptr, 16);
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);
}
}
else
{
for (i = 0; i < 16; 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, 16);
else
{
vp8_build_inter_predictors_b(d0, 16, x->subpixel_predict);
vp8_build_inter_predictors_b(d1, 16, x->subpixel_predict);
}
}
}
} }
} }
void vp8_build_inter_predictors_mb(MACROBLOCKD *x) void vp8_build_inter_predictors_mb(MACROBLOCKD *x)
{ {
if (x->mode_info_context->mbmi.ref_frame != INTRA_FRAME && if (x->mode_info_context->mbmi.mode != SPLITMV)
x->mode_info_context->mbmi.mode != SPLITMV)
{ {
int offset; int offset;
unsigned char *ptr_base; unsigned char *ptr_base;
...@@ -535,58 +498,58 @@ static void vp8_build_inter_predictors_b_s(BLOCKD *d, unsigned char *dst_ptr, vp ...@@ -535,58 +498,58 @@ static void vp8_build_inter_predictors_b_s(BLOCKD *d, unsigned char *dst_ptr, vp
void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x) void vp8_build_inter16x16_predictors_mb_s(MACROBLOCKD *x)
{ {
/*unsigned char *pred_ptr = x->block[0].predictor;
unsigned char *dst_ptr = *(x->block[0].base_dst) + x->block[0].dst;*/
unsigned char *pred_ptr = x->predictor;
unsigned char *dst_ptr = x->dst.y_buffer; unsigned char *dst_ptr = x->dst.y_buffer;
if (x->mode_info_context->mbmi.mode != SPLITMV) int offset;
{ unsigned char *ptr_base;
int offset; unsigned char *ptr;
unsigned char *ptr_base; unsigned char *uptr, *vptr;
unsigned char *ptr; unsigned char *udst_ptr = x->dst.u_buffer;
unsigned char *uptr, *vptr; unsigned char *vdst_ptr = x->dst.v_buffer;
/*unsigned char *pred_ptr = x->predictor;
unsigned char *upred_ptr = &x->predictor[256];
unsigned char *vpred_ptr = &x->predictor[320];*/
unsigned char *udst_ptr = x->dst.u_buffer;
unsigned char *vdst_ptr = x->dst.v_buffer;
int mv_row = x->mode_info_context->mbmi.mv.as_mv.row; 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 mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
int pre_stride = x->dst.y_stride; /*x->block[0].pre_stride;*/ int pre_stride = x->dst.y_stride; /*x->block[0].pre_stride;*/
ptr_base = x->pre.y_buffer; ptr_base = x->pre.y_buffer;
ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3); ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3);
if ((mv_row | mv_col) & 7) if ((mv_row | mv_col) & 7)
{ {
x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/ x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/
} }
else else
{ {
RECON_INVOKE(&x->rtcd->recon, copy16x16)(ptr, pre_stride, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/ RECON_INVOKE(&x->rtcd->recon, copy16x16)(ptr, pre_stride, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/
} }
mv_row = x->block[16].bmi.mv.as_mv.row; mv_row = x->block[16].bmi.mv.as_mv.row;
mv_col = x->block[16].bmi.mv.as_mv.col; mv_col = x->block[16].bmi.mv.as_mv.col;
pre_stride >>= 1; pre_stride >>= 1;
offset = (mv_row >> 3) * pre_stride + (mv_col >> 3); offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
uptr = x->pre.u_buffer + offset; uptr = x->pre.u_buffer + offset;
vptr = x->pre.v_buffer + offset; vptr = x->pre.v_buffer + offset;
if ((mv_row | mv_col) & 7) if ((mv_row | mv_col) & 7)
{ {
x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, udst_ptr, x->dst.uv_stride); x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, udst_ptr, x->dst.uv_stride);
x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vdst_ptr, x->dst.uv_stride); x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vdst_ptr, x->dst.uv_stride);
} }
else else
{ {
RECON_INVOKE(&x->rtcd->recon, copy8x8)(uptr, pre_stride, udst_ptr, x->dst.uv_stride); RECON_INVOKE(&x->rtcd->recon, copy8x8)(uptr, pre_stride, udst_ptr, x->dst.uv_stride);
RECON_INVOKE(&x->rtcd->recon, copy8x8)(vptr, pre_stride, vdst_ptr, x->dst.uv_stride); RECON_INVOKE(&x->rtcd->recon, copy8x8)(vptr, pre_stride, vdst_ptr, x->dst.uv_stride);
} }
}
void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x)
{
unsigned char *dst_ptr = x->dst.y_buffer;
if (x->mode_info_context->mbmi.mode != SPLITMV)
{
vp8_build_inter16x16_predictors_mb_s(x);
} }
else else
{ {
...@@ -599,25 +562,20 @@ void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x) ...@@ -599,25 +562,20 @@ void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
unsigned char *ptr_base;
unsigned char *ptr;
BLOCKD *d = &x->block[bbb[i]]; BLOCKD *d = &x->block[bbb[i]];
/*build_inter_predictors4b(x, d, 16);*/
{ ptr_base = *(d->base_pre);
unsigned char *ptr_base; ptr = ptr_base + d->pre + (d->bmi.mv.as_mv.row >> 3) * d->pre_stride + (d->bmi.mv.as_mv.col >> 3);
unsigned char *ptr;
unsigned char *pred_ptr = d->predictor;
ptr_base = *(d->base_pre); if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
ptr = ptr_base + d->pre + (d->bmi.mv.as_mv.row >> 3) * d->pre_stride + (d->bmi.mv.as_mv.col >> 3); {
x->subpixel_predict8x8(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) }
{ else
x->subpixel_predict8x8(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/ {
} RECON_INVOKE(&x->rtcd->recon, copy8x8)(ptr, d->pre_stride, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/
else
{
RECON_INVOKE(&x->rtcd->recon, copy8x8)(ptr, d->pre_stride, dst_ptr, x->dst.y_stride); /*x->block[0].dst_stride);*/
}
} }
} }
} }
...@@ -633,7 +591,6 @@ void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x) ...@@ -633,7 +591,6 @@ void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x)
/*build_inter_predictors2b(x, d0, 16);*/ /*build_inter_predictors2b(x, d0, 16);*/
unsigned char *ptr_base; unsigned char *ptr_base;
unsigned char *ptr; unsigned char *ptr;
unsigned char *pred_ptr = d0->predictor;
ptr_base = *(d0->base_pre); ptr_base = *(d0->base_pre);
ptr = ptr_base + d0->pre + (d0->bmi.mv.as_mv.row >> 3) * d0->pre_stride + (d0->bmi.mv.as_mv.col >> 3); ptr = ptr_base + d0->pre + (d0->bmi.mv.as_mv.row >> 3) * d0->pre_stride + (d0->bmi.mv.as_mv.col >> 3);
...@@ -665,7 +622,6 @@ void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x) ...@@ -665,7 +622,6 @@ void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x)
/*build_inter_predictors2b(x, d0, 8);*/ /*build_inter_predictors2b(x, d0, 8);*/
unsigned char *ptr_base; unsigned char *ptr_base;
unsigned char *ptr; unsigned char *ptr;
unsigned char *pred_ptr = d0->predictor;
ptr_base = *(d0->base_pre); ptr_base = *(d0->base_pre);
ptr = ptr_base + d0->pre + (d0->bmi.mv.as_mv.row >> 3) * d0->pre_stride + (d0->bmi.mv.as_mv.col >> 3); ptr = ptr_base + d0->pre + (d0->bmi.mv.as_mv.row >> 3) * d0->pre_stride + (d0->bmi.mv.as_mv.col >> 3);
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
extern void vp8_build_inter_predictors_mb(MACROBLOCKD *x); extern void vp8_build_inter_predictors_mb(MACROBLOCKD *x);
extern void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x); extern void vp8_build_inter_predictors_mb_s(MACROBLOCKD *x);
extern void vp8_build_inter16x16_predictors_mb_s(MACROBLOCKD *x);
extern void vp8_build_inter_predictors_mby(MACROBLOCKD *x); extern void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x);
extern void vp8_build_uvmvs(MACROBLOCKD *x, int fullpixel); 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_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf);
extern void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x); extern void vp8_build_inter_predictors_mbuv(MACROBLOCKD *x);
......
...@@ -120,7 +120,7 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd) ...@@ -120,7 +120,7 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
} }
else else
{ {
vp8_build_inter_predictors_mb_s(xd); vp8_build_inter16x16_predictors_mb_s(xd);
} }
} }
......
...@@ -122,7 +122,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int m ...@@ -122,7 +122,7 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int m
} }
else else
{ {
vp8_build_inter_predictors_mb_s(xd); vp8_build_inter16x16_predictors_mb_s(xd);
} }
return; return;
} }
......
...@@ -1391,7 +1391,7 @@ int vp8cx_encode_inter_macroblock ...@@ -1391,7 +1391,7 @@ int vp8cx_encode_inter_macroblock
} }
else else
vp8_stuff_inter16x16(x); vp8_build_inter_predictors_mb_s(xd);
} }
if (!x->skip) if (!x->skip)
......
...@@ -196,39 +196,6 @@ static void transform_mby(MACROBLOCK *x) ...@@ -196,39 +196,6 @@ static void transform_mby(MACROBLOCK *x)
} }
void vp8_stuff_inter16x16(MACROBLOCK *x)
{
vp8_build_inter_predictors_mb_s(&x->e_mbd);
/*
// recon = copy from predictors to destination
{
BLOCKD *b = &x->e_mbd.block[0];
unsigned char *pred_ptr = b->predictor;
unsigned char *dst_ptr = *(b->base_dst) + b->dst;
int stride = b->dst_stride;
int i;
for(i=0;i<16;i++)
vpx_memcpy(dst_ptr+i*stride,pred_ptr+16*i,16);
b = &x->e_mbd.block[16];
pred_ptr = b->predictor;
dst_ptr = *(b->base_dst) + b->dst;
stride = b->dst_stride;
for(i=0;i<8;i++)
vpx_memcpy(dst_ptr+i*stride,pred_ptr+8*i,8);
b = &x->e_mbd.block[20];
pred_ptr = b->predictor;
dst_ptr = *(b->base_dst) + b->dst;
stride = b->dst_stride;
for(i=0;i<8;i++)
vpx_memcpy(dst_ptr+i*stride,pred_ptr+8*i,8);
}
*/
}
#define RDTRUNC(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF ) #define RDTRUNC(RM,DM,R,D) ( (128+(R)*(RM)) & 0xFF )
...@@ -631,7 +598,7 @@ void vp8_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) ...@@ -631,7 +598,7 @@ void vp8_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
/* this funciton is used by first pass only */ /* this funciton is used by first pass only */
void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x) void vp8_encode_inter16x16y(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
{ {
vp8_build_inter_predictors_mby(&x->e_mbd); vp8_build_inter16x16_predictors_mby(&x->e_mbd);
ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_mbd.predictor, x->src.y_stride); ENCODEMB_INVOKE(&rtcd->encodemb, submby)(x->src_diff, x->src.y_buffer, x->e_mbd.predictor, x->src.y_stride);
......
...@@ -95,8 +95,6 @@ typedef struct ...@@ -95,8 +95,6 @@ typedef struct
struct VP8_ENCODER_RTCD; struct VP8_ENCODER_RTCD;
void vp8_encode_inter16x16(const struct VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x); void vp8_encode_inter16x16(const struct VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x);
extern void vp8_stuff_inter16x16(MACROBLOCK *x);
void vp8_build_dcblock(MACROBLOCK *b); void vp8_build_dcblock(MACROBLOCK *b);
void vp8_transform_mb(MACROBLOCK *mb); void vp8_transform_mb(MACROBLOCK *mb);
void vp8_transform_mbuv(MACROBLOCK *x); void vp8_transform_mbuv(MACROBLOCK *x);
......
...@@ -2234,7 +2234,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int ...@@ -2234,7 +2234,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
continue; continue;
vp8_set_mbmode_and_mvs(x, this_mode, &mode_mv[this_mode]); vp8_set_mbmode_and_mvs(x, this_mode, &mode_mv[this_mode]);
vp8_build_inter_predictors_mby(&x->e_mbd); vp8_build_inter16x16_predictors_mby(&x->e_mbd);
if (cpi->active_map_enabled && x->active_ptr[0] == 0) { if (cpi->active_map_enabled && x->active_ptr[0] == 0) {
x->skip = 1; x->skip = 1;
......
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