BLOCKD structure cleanup

Removed redundancies.  All of the information can be
found in the MACROBLOCKD structure.

Change-Id: I7556392c6f67b43bef2a5e9932180a737466ef93
This commit is contained in:
Scott LaVarnway 2012-01-20 13:52:16 -05:00
parent 57d459ba82
commit 749bc98618
14 changed files with 220 additions and 191 deletions

@ -185,15 +185,7 @@ typedef struct blockd
unsigned char *predictor; unsigned char *predictor;
short *dequant; short *dequant;
/* 16 Y blocks, 4 U blocks, 4 V blocks each with 16 entries */ int offset;
unsigned char **base_pre;
int pre;
int pre_stride;
unsigned char **base_dst;
int dst;
int dst_stride;
char *eob; char *eob;
union b_mode_info bmi; union b_mode_info bmi;

@ -17,33 +17,6 @@ typedef enum
DEST = 1 DEST = 1
} BLOCKSET; } BLOCKSET;
static void setup_block
(
BLOCKD *b,
int mv_stride,
unsigned char **base,
int Stride,
int offset,
BLOCKSET bs
)
{
if (bs == DEST)
{
b->dst_stride = Stride;
b->dst = offset;
b->base_dst = base;
}
else
{
b->pre_stride = Stride;
b->pre = offset;
b->base_pre = base;
}
}
static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs) static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs)
{ {
int block; int block;
@ -65,17 +38,15 @@ static void setup_macroblock(MACROBLOCKD *x, BLOCKSET bs)
for (block = 0; block < 16; block++) /* y blocks */ for (block = 0; block < 16; block++) /* y blocks */
{ {
setup_block(&x->block[block], x->dst.y_stride, y, x->dst.y_stride, x->block[block].offset =
(block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4, bs); (block >> 2) * 4 * x->dst.y_stride + (block & 3) * 4;
} }
for (block = 16; block < 20; block++) /* U and V blocks */ for (block = 16; block < 20; block++) /* U and V blocks */
{ {
setup_block(&x->block[block], x->dst.uv_stride, u, x->dst.uv_stride, x->block[block+4].offset =
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs); x->block[block].offset =
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4;
setup_block(&x->block[block+4], x->dst.uv_stride, v, x->dst.uv_stride,
((block - 16) >> 1) * 4 * x->dst.uv_stride + (block & 1) * 4, bs);
} }
} }

@ -122,25 +122,19 @@ void vp8_copy_mem8x4_c(
} }
void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf) void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, unsigned char *base_pre, int pre_stride, vp8_subpix_fn_t sppf)
{ {
int r; int r;
unsigned char *ptr_base;
unsigned char *ptr;
unsigned char *pred_ptr = d->predictor; unsigned char *pred_ptr = d->predictor;
unsigned char *ptr;
ptr_base = *(d->base_pre); ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) 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); sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
sppf(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch);
} }
else else
{ {
ptr_base += d->pre + (d->bmi.mv.as_mv.row >> 3) * d->pre_stride + (d->bmi.mv.as_mv.col >> 3);
ptr = ptr_base;
for (r = 0; r < 4; r++) for (r = 0; r < 4; r++)
{ {
#if !(CONFIG_FAST_UNALIGNED) #if !(CONFIG_FAST_UNALIGNED)
@ -152,65 +146,53 @@ void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, vp8_subpix_fn_t sppf)
*(uint32_t *)pred_ptr = *(uint32_t *)ptr ; *(uint32_t *)pred_ptr = *(uint32_t *)ptr ;
#endif #endif
pred_ptr += pitch; pred_ptr += pitch;
ptr += d->pre_stride; ptr += pre_stride;
} }
} }
} }
static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride) static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride)
{ {
unsigned char *ptr_base;
unsigned char *ptr; unsigned char *ptr;
ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
ptr_base = *(d->base_pre);
ptr = ptr_base + d->pre + (d->bmi.mv.as_mv.row >> 3) * d->pre_stride + (d->bmi.mv.as_mv.col >> 3);
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
{ {
x->subpixel_predict8x8(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride); x->subpixel_predict8x8(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
} }
else else
{ {
vp8_copy_mem8x8(ptr, d->pre_stride, dst, dst_stride); vp8_copy_mem8x8(ptr, pre_stride, dst, dst_stride);
} }
} }
static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride) static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride)
{ {
unsigned char *ptr_base;
unsigned char *ptr; unsigned char *ptr;
ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
ptr_base = *(d->base_pre);
ptr = ptr_base + d->pre + (d->bmi.mv.as_mv.row >> 3) * d->pre_stride + (d->bmi.mv.as_mv.col >> 3);
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7)
{ {
x->subpixel_predict8x4(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride); x->subpixel_predict8x4(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
} }
else else
{ {
vp8_copy_mem8x4(ptr, d->pre_stride, dst, dst_stride); vp8_copy_mem8x4(ptr, pre_stride, dst, dst_stride);
} }
} }
static void build_inter_predictors_b(BLOCKD *d, unsigned char *dst, int dst_stride, vp8_subpix_fn_t sppf) static void build_inter_predictors_b(BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride, vp8_subpix_fn_t sppf)
{ {
int r; int r;
unsigned char *ptr_base;
unsigned char *ptr; unsigned char *ptr;
ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3);
ptr_base = *(d->base_pre);
if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) 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); sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
sppf(ptr, d->pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride);
} }
else else
{ {
ptr_base += d->pre + (d->bmi.mv.as_mv.row >> 3) * d->pre_stride + (d->bmi.mv.as_mv.col >> 3);
ptr = ptr_base;
for (r = 0; r < 4; r++) for (r = 0; r < 4; r++)
{ {
#if !(CONFIG_FAST_UNALIGNED) #if !(CONFIG_FAST_UNALIGNED)
@ -222,7 +204,7 @@ static void build_inter_predictors_b(BLOCKD *d, unsigned char *dst, int dst_stri
*(uint32_t *)dst = *(uint32_t *)ptr ; *(uint32_t *)dst = *(uint32_t *)ptr ;
#endif #endif
dst += dst_stride; dst += dst_stride;
ptr += d->pre_stride; ptr += pre_stride;
} }
} }
} }
@ -238,7 +220,7 @@ void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x)
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 offset; int offset;
int pre_stride = x->block[16].pre_stride; int pre_stride = x->pre.uv_stride;
/* calc uv motion vectors */ /* calc uv motion vectors */
if (mv_row < 0) if (mv_row < 0)
@ -277,6 +259,8 @@ void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x)
void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x) void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x)
{ {
int i, j; int i, j;
int pre_stride = x->pre.uv_stride;
unsigned char *base_pre;
/* build uv mvs */ /* build uv mvs */
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
@ -316,17 +300,33 @@ void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x)
} }
} }
for (i = 16; i < 24; i += 2) base_pre = x->pre.u_buffer;
for (i = 16; i < 20; i += 2)
{ {
BLOCKD *d0 = &x->block[i]; BLOCKD *d0 = &x->block[i];
BLOCKD *d1 = &x->block[i+1]; BLOCKD *d1 = &x->block[i+1];
if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
build_inter_predictors2b(x, d0, d0->predictor, 8); build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
else else
{ {
vp8_build_inter_predictors_b(d0, 8, x->subpixel_predict); vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride, x->subpixel_predict);
vp8_build_inter_predictors_b(d1, 8, x->subpixel_predict); vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride, x->subpixel_predict);
}
}
base_pre = x->pre.v_buffer;
for (i = 20; 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, d0->predictor, 8, base_pre, pre_stride);
else
{
vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride, x->subpixel_predict);
vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride, x->subpixel_predict);
} }
} }
} }
@ -341,7 +341,7 @@ void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x,
unsigned char *ptr; unsigned char *ptr;
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->block[0].pre_stride; int pre_stride = x->pre.y_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);
@ -408,7 +408,7 @@ void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
int_mv _16x16mv; int_mv _16x16mv;
unsigned char *ptr_base = x->pre.y_buffer; unsigned char *ptr_base = x->pre.y_buffer;
int pre_stride = x->block[0].pre_stride; int pre_stride = x->pre.y_stride;
_16x16mv.as_int = x->mode_info_context->mbmi.mv.as_int; _16x16mv.as_int = x->mode_info_context->mbmi.mv.as_int;
@ -465,11 +465,13 @@ void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
static void build_inter4x4_predictors_mb(MACROBLOCKD *x) static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
{ {
int i; int i;
unsigned char *base_dst = x->dst.y_buffer;
unsigned char *base_pre = x->pre.y_buffer;
if (x->mode_info_context->mbmi.partitioning < 3) if (x->mode_info_context->mbmi.partitioning < 3)
{ {
BLOCKD *b; BLOCKD *b;
int dst_stride = x->block[ 0].dst_stride; int dst_stride = x->dst.y_stride;
x->block[ 0].bmi = x->mode_info_context->bmi[ 0]; x->block[ 0].bmi = x->mode_info_context->bmi[ 0];
x->block[ 2].bmi = x->mode_info_context->bmi[ 2]; x->block[ 2].bmi = x->mode_info_context->bmi[ 2];
@ -484,13 +486,13 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
} }
b = &x->block[ 0]; b = &x->block[ 0];
build_inter_predictors4b(x, b, *(b->base_dst) + b->dst, dst_stride); build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
b = &x->block[ 2]; b = &x->block[ 2];
build_inter_predictors4b(x, b, *(b->base_dst) + b->dst, dst_stride); build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
b = &x->block[ 8]; b = &x->block[ 8];
build_inter_predictors4b(x, b, *(b->base_dst) + b->dst, dst_stride); build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
b = &x->block[10]; b = &x->block[10];
build_inter_predictors4b(x, b, *(b->base_dst) + b->dst, dst_stride); build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride);
} }
else else
{ {
@ -498,7 +500,7 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
{ {
BLOCKD *d0 = &x->block[i]; BLOCKD *d0 = &x->block[i];
BLOCKD *d1 = &x->block[i+1]; BLOCKD *d1 = &x->block[i+1];
int dst_stride = x->block[ 0].dst_stride; int dst_stride = x->dst.y_stride;
x->block[i+0].bmi = x->mode_info_context->bmi[i+0]; x->block[i+0].bmi = x->mode_info_context->bmi[i+0];
x->block[i+1].bmi = x->mode_info_context->bmi[i+1]; x->block[i+1].bmi = x->mode_info_context->bmi[i+1];
@ -509,31 +511,51 @@ static void build_inter4x4_predictors_mb(MACROBLOCKD *x)
} }
if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
build_inter_predictors2b(x, d0, *(d0->base_dst) + d0->dst, dst_stride); build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride);
else else
{ {
build_inter_predictors_b(d0, *(d0->base_dst) + d0->dst, dst_stride, x->subpixel_predict); build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
build_inter_predictors_b(d1, *(d1->base_dst) + d1->dst, dst_stride, x->subpixel_predict); build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
} }
} }
} }
base_dst = x->dst.u_buffer;
for (i = 16; i < 24; i += 2) base_pre = x->pre.u_buffer;
for (i = 16; i < 20; i += 2)
{ {
BLOCKD *d0 = &x->block[i]; BLOCKD *d0 = &x->block[i];
BLOCKD *d1 = &x->block[i+1]; BLOCKD *d1 = &x->block[i+1];
int dst_stride = x->block[ 16].dst_stride; int dst_stride = x->dst.uv_stride;
/* Note: uv mvs already clamped in build_4x4uvmvs() */ /* Note: uv mvs already clamped in build_4x4uvmvs() */
if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
build_inter_predictors2b(x, d0, *(d0->base_dst) + d0->dst, dst_stride); build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride);
else else
{ {
build_inter_predictors_b(d0, *(d0->base_dst) + d0->dst, dst_stride, x->subpixel_predict); build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
build_inter_predictors_b(d1, *(d1->base_dst) + d1->dst, dst_stride, x->subpixel_predict); build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
}
}
base_dst = x->dst.v_buffer;
base_pre = x->pre.v_buffer;
for (i = 20; i < 24; i += 2)
{
BLOCKD *d0 = &x->block[i];
BLOCKD *d1 = &x->block[i+1];
int dst_stride = x->dst.uv_stride;
/* Note: uv mvs already clamped in build_4x4uvmvs() */
if (d0->bmi.mv.as_int == d1->bmi.mv.as_int)
build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride);
else
{
build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict);
} }
} }
} }

@ -25,6 +25,8 @@ extern void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x,
unsigned char *dst_y, unsigned char *dst_y,
int dst_ystride); int dst_ystride);
extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch,
unsigned char *base_pre,
int pre_stride,
vp8_subpix_fn_t sppf); vp8_subpix_fn_t sppf);
extern void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x); extern void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x);

@ -304,12 +304,13 @@ void vp8_intra4x4_predict_c(unsigned char *src, int src_stride,
*/ */
void vp8_intra_prediction_down_copy(MACROBLOCKD *x) void vp8_intra_prediction_down_copy(MACROBLOCKD *x)
{ {
unsigned char *above_right = *(x->block[0].base_dst) + x->block[0].dst - x->block[0].dst_stride + 16; int dst_stride = x->dst.y_stride;
unsigned char *above_right = x->dst.y_buffer - dst_stride + 16;
unsigned int *src_ptr = (unsigned int *)above_right; unsigned int *src_ptr = (unsigned int *)above_right;
unsigned int *dst_ptr0 = (unsigned int *)(above_right + 4 * x->block[0].dst_stride); unsigned int *dst_ptr0 = (unsigned int *)(above_right + 4 * dst_stride);
unsigned int *dst_ptr1 = (unsigned int *)(above_right + 8 * x->block[0].dst_stride); unsigned int *dst_ptr1 = (unsigned int *)(above_right + 8 * dst_stride);
unsigned int *dst_ptr2 = (unsigned int *)(above_right + 12 * x->block[0].dst_stride); unsigned int *dst_ptr2 = (unsigned int *)(above_right + 12 * dst_stride);
*dst_ptr0 = *src_ptr; *dst_ptr0 = *src_ptr;
*dst_ptr1 = *src_ptr; *dst_ptr1 = *src_ptr;

@ -165,6 +165,8 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
else else
{ {
short *DQC = xd->dequant_y1; short *DQC = xd->dequant_y1;
int dst_stride = xd->dst.y_stride;
unsigned char *base_dst = xd->dst.y_buffer;
/* clear out residual eob info */ /* clear out residual eob info */
if(xd->mode_info_context->mbmi.mb_skip_coeff) if(xd->mode_info_context->mbmi.mb_skip_coeff)
@ -177,9 +179,9 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
BLOCKD *b = &xd->block[i]; BLOCKD *b = &xd->block[i];
int b_mode = xd->mode_info_context->bmi[i].as_mode; int b_mode = xd->mode_info_context->bmi[i].as_mode;
vp8_intra4x4_predict
( *(b->base_dst) + b->dst, b->dst_stride, b_mode, vp8_intra4x4_predict (base_dst + b->offset, dst_stride, b_mode,
*(b->base_dst) + b->dst, b->dst_stride ); base_dst + b->offset, dst_stride );
if (xd->eobs[i]) if (xd->eobs[i])
{ {
@ -187,14 +189,14 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd,
{ {
vp8_dequant_idct_add vp8_dequant_idct_add
(b->qcoeff, DQC, (b->qcoeff, DQC,
*(b->base_dst) + b->dst, b->dst_stride); base_dst + b->offset, dst_stride);
} }
else else
{ {
vp8_dc_only_idct_add vp8_dc_only_idct_add
(b->qcoeff[0] * DQC[0], (b->qcoeff[0] * DQC[0],
*(b->base_dst) + b->dst, b->dst_stride, base_dst + b->offset, dst_stride,
*(b->base_dst) + b->dst, b->dst_stride); base_dst + b->offset, dst_stride);
((int *)b->qcoeff)[0] = 0; ((int *)b->qcoeff)[0] = 0;
} }
} }

@ -617,12 +617,15 @@ void vp8mt_predict_intra4x4(VP8D_COMP *pbi,
unsigned char top_left; /* = Above[-1]; */ unsigned char top_left; /* = Above[-1]; */
BLOCKD *x = &xd->block[num]; BLOCKD *x = &xd->block[num];
int dst_stride = xd->dst.y_stride;
unsigned char *base_dst = xd->dst.y_buffer;
/*Caution: For some b_mode, it needs 8 pixels (4 above + 4 above-right).*/ /*Caution: For some b_mode, it needs 8 pixels (4 above + 4 above-right).*/
if (num < 4 && pbi->common.filter_level) if (num < 4 && pbi->common.filter_level)
Above = pbi->mt_yabove_row[mb_row] + mb_col*16 + num*4 + 32; Above = pbi->mt_yabove_row[mb_row] + mb_col*16 + num*4 + 32;
else else
Above = *(x->base_dst) + x->dst - x->dst_stride; Above = base_dst + x->offset - dst_stride;
if (num%4==0 && pbi->common.filter_level) if (num%4==0 && pbi->common.filter_level)
{ {
@ -630,10 +633,10 @@ void vp8mt_predict_intra4x4(VP8D_COMP *pbi,
Left[i] = pbi->mt_yleft_col[mb_row][num + i]; Left[i] = pbi->mt_yleft_col[mb_row][num + i];
}else }else
{ {
Left[0] = (*(x->base_dst))[x->dst - 1]; Left[0] = (base_dst)[x->offset - 1];
Left[1] = (*(x->base_dst))[x->dst - 1 + x->dst_stride]; Left[1] = (base_dst)[x->offset - 1 + dst_stride];
Left[2] = (*(x->base_dst))[x->dst - 1 + 2 * x->dst_stride]; Left[2] = (base_dst)[x->offset - 1 + 2 * dst_stride];
Left[3] = (*(x->base_dst))[x->dst - 1 + 3 * x->dst_stride]; Left[3] = (base_dst)[x->offset - 1 + 3 * dst_stride];
} }
if ((num==4 || num==8 || num==12) && pbi->common.filter_level) if ((num==4 || num==8 || num==12) && pbi->common.filter_level)
@ -918,19 +921,22 @@ void vp8mt_intra_prediction_down_copy(VP8D_COMP *pbi, MACROBLOCKD *x, int mb_row
unsigned int *dst_ptr0; unsigned int *dst_ptr0;
unsigned int *dst_ptr1; unsigned int *dst_ptr1;
unsigned int *dst_ptr2; unsigned int *dst_ptr2;
int dst_stride = x->dst.y_stride;
unsigned char *base_dst = x->dst.y_buffer;
if (pbi->common.filter_level) if (pbi->common.filter_level)
above_right = pbi->mt_yabove_row[mb_row] + mb_col*16 + 32 +16; above_right = pbi->mt_yabove_row[mb_row] + mb_col*16 + 32 +16;
else else
above_right = *(x->block[0].base_dst) + x->block[0].dst - x->block[0].dst_stride + 16; above_right = base_dst + x->block[0].offset - dst_stride + 16;
src_ptr = (unsigned int *)above_right; src_ptr = (unsigned int *)above_right;
/*dst_ptr0 = (unsigned int *)(above_right + 4 * x->block[0].dst_stride); /*dst_ptr0 = (unsigned int *)(above_right + 4 * x->block[0].dst_stride);
dst_ptr1 = (unsigned int *)(above_right + 8 * x->block[0].dst_stride); dst_ptr1 = (unsigned int *)(above_right + 8 * x->block[0].dst_stride);
dst_ptr2 = (unsigned int *)(above_right + 12 * x->block[0].dst_stride);*/ dst_ptr2 = (unsigned int *)(above_right + 12 * x->block[0].dst_stride);*/
dst_ptr0 = (unsigned int *)(*(x->block[0].base_dst) + x->block[0].dst + 16 + 3 * x->block[0].dst_stride); dst_ptr0 = (unsigned int *)(base_dst + x->block[0].offset + 16 + 3 * dst_stride);
dst_ptr1 = (unsigned int *)(*(x->block[0].base_dst) + x->block[0].dst + 16 + 7 * x->block[0].dst_stride); dst_ptr1 = (unsigned int *)(base_dst + x->block[0].offset + 16 + 7 * dst_stride);
dst_ptr2 = (unsigned int *)(*(x->block[0].base_dst) + x->block[0].dst + 16 + 11 * x->block[0].dst_stride); dst_ptr2 = (unsigned int *)(base_dst + x->block[0].offset + 16 + 11 * dst_stride);
*dst_ptr0 = *src_ptr; *dst_ptr0 = *src_ptr;
*dst_ptr1 = *src_ptr; *dst_ptr1 = *src_ptr;
*dst_ptr2 = *src_ptr; *dst_ptr2 = *src_ptr;

@ -171,14 +171,16 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int m
if (xd->mode_info_context->mbmi.mode == B_PRED) if (xd->mode_info_context->mbmi.mode == B_PRED)
{ {
short *DQC = xd->dequant_y1; short *DQC = xd->dequant_y1;
int dst_stride = xd->dst.y_stride;
unsigned char *base_dst = xd->dst.y_buffer;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
BLOCKD *b = &xd->block[i]; BLOCKD *b = &xd->block[i];
int b_mode = xd->mode_info_context->bmi[i].as_mode; int b_mode = xd->mode_info_context->bmi[i].as_mode;
vp8mt_predict_intra4x4(pbi, xd, b_mode, *(b->base_dst) + b->dst, vp8mt_predict_intra4x4(pbi, xd, b_mode, base_dst + b->offset,
b->dst_stride, mb_row, mb_col, i); dst_stride, mb_row, mb_col, i);
if (xd->eobs[i] ) if (xd->eobs[i] )
{ {
@ -186,14 +188,14 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int m
{ {
vp8_dequant_idct_add vp8_dequant_idct_add
(b->qcoeff, DQC, (b->qcoeff, DQC,
*(b->base_dst) + b->dst, b->dst_stride); base_dst + b->offset, dst_stride);
} }
else else
{ {
vp8_dc_only_idct_add vp8_dc_only_idct_add
(b->qcoeff[0] * DQC[0], (b->qcoeff[0] * DQC[0],
*(b->base_dst) + b->dst, b->dst_stride, base_dst + b->offset, dst_stride,
*(b->base_dst) + b->dst, b->dst_stride); base_dst + b->offset, dst_stride);
((int *)b->qcoeff)[0] = 0; ((int *)b->qcoeff)[0] = 0;
} }
} }

@ -53,9 +53,10 @@ void vp8_encode_intra4x4block(MACROBLOCK *x, int ib)
{ {
BLOCKD *b = &x->e_mbd.block[ib]; BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->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;
vp8_intra4x4_predict vp8_intra4x4_predict(base_dst + b->offset, dst_stride,
(*(b->base_dst) + b->dst, b->dst_stride,
b->bmi.as_mode, b->predictor, 16); b->bmi.as_mode, b->predictor, 16);
vp8_subtract_b(be, b, 16); vp8_subtract_b(be, b, 16);
@ -66,14 +67,14 @@ void vp8_encode_intra4x4block(MACROBLOCK *x, int ib)
if (*b->eob > 1) if (*b->eob > 1)
{ {
vp8_short_idct4x4llm(b->dqcoeff, vp8_short_idct4x4llm(b->dqcoeff,
b->predictor, 16, *(b->base_dst) + b->dst, b->dst_stride); b->predictor, 16, base_dst + b->offset, dst_stride);
} }
else else
{ {
vp8_dc_only_idct_add vp8_dc_only_idct_add
(b->dqcoeff[0], b->predictor, 16, *(b->base_dst) + b->dst, (b->dqcoeff[0], b->predictor, 16, base_dst + b->offset,
b->dst_stride); dst_stride);
} }
} }

@ -396,12 +396,12 @@ static void zz_motion_search( VP8_COMP *cpi, MACROBLOCK * x, YV12_BUFFER_CONFIG
unsigned char *src_ptr = (*(b->base_src) + b->src); unsigned char *src_ptr = (*(b->base_src) + b->src);
int src_stride = b->src_stride; int src_stride = b->src_stride;
unsigned char *ref_ptr; unsigned char *ref_ptr;
int ref_stride=d->pre_stride; int ref_stride = x->e_mbd.pre.y_stride;
// Set up pointers for this macro block recon buffer // Set up pointers for this macro block recon buffer
xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset; xd->pre.y_buffer = recon_buffer->y_buffer + recon_yoffset;
ref_ptr = (unsigned char *)(*(d->base_pre) + d->pre ); ref_ptr = (unsigned char *)(xd->pre.y_buffer + d->offset );
vp8_mse16x16 ( src_ptr, src_stride, ref_ptr, ref_stride, (unsigned int *)(best_motion_err)); vp8_mse16x16 ( src_ptr, src_stride, ref_ptr, ref_stride, (unsigned int *)(best_motion_err));
} }

@ -211,10 +211,13 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int y_stride; int y_stride;
int offset; int offset;
int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
#if ARCH_X86 || ARCH_X86_64 #if ARCH_X86 || ARCH_X86_64
MACROBLOCKD *xd = &x->e_mbd; MACROBLOCKD *xd = &x->e_mbd;
unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col; unsigned char *y0 = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
unsigned char *y; unsigned char *y;
int buf_r1, buf_r2, buf_c1, buf_c2; int buf_r1, buf_r2, buf_c1, buf_c2;
@ -226,11 +229,11 @@ int vp8_find_best_sub_pixel_step_iteratively(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
y_stride = 32; y_stride = 32;
/* Copy to intermediate buffer before searching. */ /* Copy to intermediate buffer before searching. */
vfp->copymem(y0 - buf_c1 - d->pre_stride*buf_r1, d->pre_stride, xd->y_buf, y_stride, 16+buf_r1+buf_r2); vfp->copymem(y0 - buf_c1 - pre_stride*buf_r1, pre_stride, xd->y_buf, y_stride, 16+buf_r1+buf_r2);
y = xd->y_buf + y_stride*buf_r1 +buf_c1; y = xd->y_buf + y_stride*buf_r1 +buf_c1;
#else #else
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col; unsigned char *y = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
y_stride = d->pre_stride; y_stride = pre_stride;
#endif #endif
offset = (bestmv->as_mv.row) * y_stride + bestmv->as_mv.col; offset = (bestmv->as_mv.row) * y_stride + bestmv->as_mv.col;
@ -347,19 +350,21 @@ int vp8_find_best_sub_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int whichdir ; int whichdir ;
int thismse; int thismse;
int y_stride; int y_stride;
int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
#if ARCH_X86 || ARCH_X86_64 #if ARCH_X86 || ARCH_X86_64
MACROBLOCKD *xd = &x->e_mbd; MACROBLOCKD *xd = &x->e_mbd;
unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col; unsigned char *y0 = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
unsigned char *y; unsigned char *y;
y_stride = 32; y_stride = 32;
/* Copy 18 rows x 32 cols area to intermediate buffer before searching. */ /* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
vfp->copymem(y0 - 1 - d->pre_stride, d->pre_stride, xd->y_buf, y_stride, 18); vfp->copymem(y0 - 1 - pre_stride, pre_stride, xd->y_buf, y_stride, 18);
y = xd->y_buf + y_stride + 1; y = xd->y_buf + y_stride + 1;
#else #else
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col; unsigned char *y = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
y_stride = d->pre_stride; y_stride = pre_stride;
#endif #endif
// central mv // central mv
@ -662,19 +667,21 @@ int vp8_find_best_half_pixel_step(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
int whichdir ; int whichdir ;
int thismse; int thismse;
int y_stride; int y_stride;
int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
#if ARCH_X86 || ARCH_X86_64 #if ARCH_X86 || ARCH_X86_64
MACROBLOCKD *xd = &x->e_mbd; MACROBLOCKD *xd = &x->e_mbd;
unsigned char *y0 = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col; unsigned char *y0 = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
unsigned char *y; unsigned char *y;
y_stride = 32; y_stride = 32;
/* Copy 18 rows x 32 cols area to intermediate buffer before searching. */ /* Copy 18 rows x 32 cols area to intermediate buffer before searching. */
vfp->copymem(y0 - 1 - d->pre_stride, d->pre_stride, xd->y_buf, y_stride, 18); vfp->copymem(y0 - 1 - pre_stride, pre_stride, xd->y_buf, y_stride, 18);
y = xd->y_buf + y_stride + 1; y = xd->y_buf + y_stride + 1;
#else #else
unsigned char *y = *(d->base_pre) + d->pre + (bestmv->as_mv.row) * d->pre_stride + bestmv->as_mv.col; unsigned char *y = base_pre + d->offset + (bestmv->as_mv.row) * pre_stride + bestmv->as_mv.col;
y_stride = d->pre_stride; y_stride = pre_stride;
#endif #endif
// central mv // central mv
@ -842,7 +849,10 @@ int vp8_hex_search
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
int br, bc; int br, bc;
int_mv this_mv; int_mv this_mv;
unsigned int bestsad = 0x7fffffff; unsigned int bestsad = 0x7fffffff;
@ -865,8 +875,8 @@ int vp8_hex_search
bc = ref_mv->as_mv.col; bc = ref_mv->as_mv.col;
// Work out the start point for the search // Work out the start point for the search
base_offset = (unsigned char *)(*(d->base_pre) + d->pre); base_offset = (unsigned char *)(base_pre + d->offset);
this_offset = base_offset + (br * (d->pre_stride)) + bc; this_offset = base_offset + (br * (pre_stride)) + bc;
this_mv.as_mv.row = br; this_mv.as_mv.row = br;
this_mv.as_mv.col = bc; this_mv.as_mv.col = bc;
bestsad = vfp->sdf( what, what_stride, this_offset, bestsad = vfp->sdf( what, what_stride, this_offset,
@ -1029,7 +1039,9 @@ int vp8_diamond_search_sad_c
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
unsigned char *in_what; unsigned char *in_what;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
unsigned char *best_address; unsigned char *best_address;
int tot_steps; int tot_steps;
@ -1061,7 +1073,7 @@ int vp8_diamond_search_sad_c
best_mv->as_mv.col = ref_col; best_mv->as_mv.col = ref_col;
// Work out the start point for the search // Work out the start point for the search
in_what = (unsigned char *)(*(d->base_pre) + d->pre + (ref_row * (d->pre_stride)) + ref_col); in_what = (unsigned char *)(base_pre + d->offset + (ref_row * pre_stride) + ref_col);
best_address = in_what; best_address = in_what;
// Check the starting position // Check the starting position
@ -1150,7 +1162,9 @@ int vp8_diamond_search_sadx4
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
unsigned char *in_what; unsigned char *in_what;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
unsigned char *best_address; unsigned char *best_address;
int tot_steps; int tot_steps;
@ -1182,7 +1196,7 @@ int vp8_diamond_search_sadx4
best_mv->as_mv.col = ref_col; best_mv->as_mv.col = ref_col;
// Work out the start point for the search // Work out the start point for the search
in_what = (unsigned char *)(*(d->base_pre) + d->pre + (ref_row * (d->pre_stride)) + ref_col); in_what = (unsigned char *)(base_pre + d->offset + (ref_row * pre_stride) + ref_col);
best_address = in_what; best_address = in_what;
// Check the starting position // Check the starting position
@ -1300,8 +1314,10 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
unsigned char *in_what; unsigned char *in_what;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
int mv_stride = d->pre_stride; unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
int mv_stride = pre_stride;
unsigned char *bestaddress; unsigned char *bestaddress;
int_mv *best_mv = &d->bmi.mv; int_mv *best_mv = &d->bmi.mv;
int_mv this_mv; int_mv this_mv;
@ -1325,8 +1341,8 @@ int vp8_full_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
// Work out the mid point for the search // Work out the mid point for the search
in_what = *(d->base_pre) + d->pre; in_what = base_pre + d->offset;
bestaddress = in_what + (ref_row * d->pre_stride) + ref_col; bestaddress = in_what + (ref_row * pre_stride) + ref_col;
best_mv->as_mv.row = ref_row; best_mv->as_mv.row = ref_row;
best_mv->as_mv.col = ref_col; best_mv->as_mv.col = ref_col;
@ -1392,8 +1408,10 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
unsigned char *in_what; unsigned char *in_what;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
int mv_stride = d->pre_stride; unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
int mv_stride = pre_stride;
unsigned char *bestaddress; unsigned char *bestaddress;
int_mv *best_mv = &d->bmi.mv; int_mv *best_mv = &d->bmi.mv;
int_mv this_mv; int_mv this_mv;
@ -1419,8 +1437,8 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
// Work out the mid point for the search // Work out the mid point for the search
in_what = *(d->base_pre) + d->pre; in_what = base_pre + d->offset;
bestaddress = in_what + (ref_row * d->pre_stride) + ref_col; bestaddress = in_what + (ref_row * pre_stride) + ref_col;
best_mv->as_mv.row = ref_row; best_mv->as_mv.row = ref_row;
best_mv->as_mv.col = ref_col; best_mv->as_mv.col = ref_col;
@ -1521,9 +1539,11 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
{ {
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
unsigned char *in_what; unsigned char *in_what;
int in_what_stride = d->pre_stride; int in_what_stride = pre_stride;
int mv_stride = d->pre_stride; int mv_stride = pre_stride;
unsigned char *bestaddress; unsigned char *bestaddress;
int_mv *best_mv = &d->bmi.mv; int_mv *best_mv = &d->bmi.mv;
int_mv this_mv; int_mv this_mv;
@ -1550,8 +1570,8 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv,
fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3; fcenter_mv.as_mv.col = center_mv->as_mv.col >> 3;
// Work out the mid point for the search // Work out the mid point for the search
in_what = *(d->base_pre) + d->pre; in_what = base_pre + d->offset;
bestaddress = in_what + (ref_row * d->pre_stride) + ref_col; bestaddress = in_what + (ref_row * pre_stride) + ref_col;
best_mv->as_mv.row = ref_row; best_mv->as_mv.row = ref_row;
best_mv->as_mv.col = ref_col; best_mv->as_mv.col = ref_col;
@ -1684,10 +1704,12 @@ int vp8_refining_search_sad_c(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv
short this_row_offset, this_col_offset; short this_row_offset, this_col_offset;
int what_stride = b->src_stride; int what_stride = b->src_stride;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
unsigned char *best_address = (unsigned char *)(*(d->base_pre) + d->pre + unsigned char *best_address = (unsigned char *)(base_pre + d->offset +
(ref_mv->as_mv.row * (d->pre_stride)) + ref_mv->as_mv.col); (ref_mv->as_mv.row * pre_stride) + ref_mv->as_mv.col);
unsigned char *check_here; unsigned char *check_here;
unsigned int thissad; unsigned int thissad;
int_mv this_mv; int_mv this_mv;
@ -1761,10 +1783,12 @@ int vp8_refining_search_sadx4(MACROBLOCK *x, BLOCK *b, BLOCKD *d,
short this_row_offset, this_col_offset; short this_row_offset, this_col_offset;
int what_stride = b->src_stride; int what_stride = b->src_stride;
int in_what_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int in_what_stride = pre_stride;
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
unsigned char *best_address = (unsigned char *)(*(d->base_pre) + d->pre + unsigned char *best_address = (unsigned char *)(base_pre + d->offset +
(ref_mv->as_mv.row * (d->pre_stride)) + ref_mv->as_mv.col); (ref_mv->as_mv.row * pre_stride) + ref_mv->as_mv.col);
unsigned char *check_here; unsigned char *check_here;
unsigned int thissad; unsigned int thissad;
int_mv this_mv; int_mv this_mv;

@ -68,12 +68,13 @@ static int get_inter_mbpred_error(MACROBLOCK *mb,
BLOCKD *d = &mb->e_mbd.block[0]; BLOCKD *d = &mb->e_mbd.block[0];
unsigned char *what = (*(b->base_src) + b->src); unsigned char *what = (*(b->base_src) + b->src);
int what_stride = b->src_stride; int what_stride = b->src_stride;
unsigned char *in_what = *(d->base_pre) + d->pre ; int pre_stride = mb->e_mbd.pre.y_stride;
int in_what_stride = d->pre_stride; unsigned char *in_what = mb->e_mbd.pre.y_buffer + d->offset ;
int in_what_stride = pre_stride;
int xoffset = this_mv.as_mv.col & 7; int xoffset = this_mv.as_mv.col & 7;
int yoffset = this_mv.as_mv.row & 7; int yoffset = this_mv.as_mv.row & 7;
in_what += (this_mv.as_mv.row >> 3) * d->pre_stride + (this_mv.as_mv.col >> 3); in_what += (this_mv.as_mv.row >> 3) * pre_stride + (this_mv.as_mv.col >> 3);
if (xoffset | yoffset) if (xoffset | yoffset)
{ {
@ -136,6 +137,8 @@ static int pick_intra4x4block(
BLOCKD *b = &x->e_mbd.block[ib]; BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->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;
B_PREDICTION_MODE mode; B_PREDICTION_MODE mode;
int best_rd = INT_MAX; // 1<<30 int best_rd = INT_MAX; // 1<<30
int rate; int rate;
@ -147,7 +150,7 @@ static int pick_intra4x4block(
rate = mode_costs[mode]; rate = mode_costs[mode];
vp8_intra4x4_predict vp8_intra4x4_predict
(*(b->base_dst) + b->dst, b->dst_stride, (base_dst + b->offset, dst_stride,
mode, b->predictor, 16); mode, b->predictor, 16);
distortion = get_prediction_error(be, b); distortion = get_prediction_error(be, b);
this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion); this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);

@ -457,7 +457,7 @@ int VP8_UVSSE(MACROBLOCK *x)
int mv_row = x->e_mbd.mode_info_context->mbmi.mv.as_mv.row; 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 mv_col = x->e_mbd.mode_info_context->mbmi.mv.as_mv.col;
int offset; int offset;
int pre_stride = x->e_mbd.block[16].pre_stride; int pre_stride = x->e_mbd.pre.uv_stride;
if (mv_row < 0) if (mv_row < 0)
mv_row -= 1; mv_row -= 1;
@ -635,6 +635,8 @@ static int rd_pick_intra4x4block(
* */ * */
DECLARE_ALIGNED_ARRAY(16, unsigned char, best_predictor, 16*4); DECLARE_ALIGNED_ARRAY(16, unsigned char, best_predictor, 16*4);
DECLARE_ALIGNED_ARRAY(16, short, best_dqcoeff, 16); 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;
for (mode = B_DC_PRED; mode <= B_HU_PRED; mode++) for (mode = B_DC_PRED; mode <= B_HU_PRED; mode++)
{ {
@ -643,9 +645,8 @@ static int rd_pick_intra4x4block(
rate = bmode_costs[mode]; rate = bmode_costs[mode];
vp8_intra4x4_predict vp8_intra4x4_predict(base_dst + b->offset, dst_stride, mode,
(*(b->base_dst) + b->dst, b->dst_stride, b->predictor, 16);
mode, b->predictor, 16);
vp8_subtract_b(be, b, 16); vp8_subtract_b(be, b, 16);
x->short_fdct4x4(be->src_diff, be->coeff, 32); x->short_fdct4x4(be->src_diff, be->coeff, 32);
x->quantize_b(be, b); x->quantize_b(be, b);
@ -674,8 +675,8 @@ static int rd_pick_intra4x4block(
} }
b->bmi.as_mode = (B_PREDICTION_MODE)(*best_mode); b->bmi.as_mode = (B_PREDICTION_MODE)(*best_mode);
vp8_short_idct4x4llm(best_dqcoeff, vp8_short_idct4x4llm(best_dqcoeff, best_predictor, 16, base_dst + b->offset,
best_predictor, 16, *(b->base_dst) + b->dst, b->dst_stride); dst_stride);
return best_rd; return best_rd;
} }
@ -1008,6 +1009,9 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels
{ {
int i; int i;
unsigned int distortion = 0; unsigned int distortion = 0;
int pre_stride = x->e_mbd.pre.y_stride;
unsigned char *base_pre = x->e_mbd.pre.y_buffer;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
@ -1016,8 +1020,7 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels
BLOCKD *bd = &x->e_mbd.block[i]; BLOCKD *bd = &x->e_mbd.block[i];
BLOCK *be = &x->block[i]; BLOCK *be = &x->block[i];
vp8_build_inter_predictors_b(bd, 16, base_pre, pre_stride, x->e_mbd.subpixel_predict);
vp8_build_inter_predictors_b(bd, 16, x->e_mbd.subpixel_predict);
vp8_subtract_b(be, bd, 16); vp8_subtract_b(be, bd, 16);
x->short_fdct4x4(be->src_diff, be->coeff, 32); x->short_fdct4x4(be->src_diff, be->coeff, 32);

@ -164,9 +164,9 @@ static int vp8_temporal_filter_find_matching_mb_c
unsigned char **base_src = b->base_src; unsigned char **base_src = b->base_src;
int src = b->src; int src = b->src;
int src_stride = b->src_stride; int src_stride = b->src_stride;
unsigned char **base_pre = d->base_pre; unsigned char *base_pre = x->e_mbd.pre.y_buffer;
int pre = d->pre; int pre = d->offset;
int pre_stride = d->pre_stride; int pre_stride = x->e_mbd.pre.y_stride;
best_ref_mv1.as_int = 0; best_ref_mv1.as_int = 0;
best_ref_mv1_full.as_mv.col = best_ref_mv1.as_mv.col >>3; best_ref_mv1_full.as_mv.col = best_ref_mv1.as_mv.col >>3;
@ -177,9 +177,9 @@ static int vp8_temporal_filter_find_matching_mb_c
b->src_stride = arf_frame->y_stride; b->src_stride = arf_frame->y_stride;
b->src = mb_offset; b->src = mb_offset;
d->base_pre = &frame_ptr->y_buffer; x->e_mbd.pre.y_buffer = frame_ptr->y_buffer;
d->pre_stride = frame_ptr->y_stride; x->e_mbd.pre.y_stride = frame_ptr->y_stride;
d->pre = mb_offset; d->offset = mb_offset;
// Further step/diamond searches as necessary // Further step/diamond searches as necessary
if (cpi->Speed < 8) if (cpi->Speed < 8)
@ -221,9 +221,9 @@ static int vp8_temporal_filter_find_matching_mb_c
b->base_src = base_src; b->base_src = base_src;
b->src = src; b->src = src;
b->src_stride = src_stride; b->src_stride = src_stride;
d->base_pre = base_pre; x->e_mbd.pre.y_buffer = base_pre;
d->pre = pre; d->offset = pre;
d->pre_stride = pre_stride; x->e_mbd.pre.y_stride = pre_stride;
return bestsme; return bestsme;
} }