int bcost = COST_MAX;
int pass = 0;
/* each byte of visited represents 8 possible m1y positions, so a 4D array isn't needed */
- uint8_t visited[8][8][8];
+ DECLARE_ALIGNED_16( uint8_t visited[8][8][8] );
h->mc.memzero_aligned( visited, sizeof(visited) );
BIME_CACHE( 0, 0 );
h->mb.mv_max_fpel[0] = 8*( h->sps->i_mb_width - h->mb.i_mb_x - 1 ) + 4;
h->mb.mv_min_spel[0] = 4*( h->mb.mv_min_fpel[0] - 8 );
h->mb.mv_max_spel[0] = 4*( h->mb.mv_max_fpel[0] + 8 );
- h->mb.mv_min_fpel[1] = -8*h->mb.i_mb_y - 4;
- h->mb.mv_max_fpel[1] = 8*( h->sps->i_mb_height - h->mb.i_mb_y - 1 ) + 4;
- h->mb.mv_min_spel[1] = 4*( h->mb.mv_min_fpel[1] - 8 );
- h->mb.mv_max_spel[1] = 4*( h->mb.mv_max_fpel[1] + 8 );
+ if( h->mb.i_mb_x >= h->sps->i_mb_width - 2 )
+ {
+ h->mb.mv_min_fpel[1] = -8*h->mb.i_mb_y - 4;
+ h->mb.mv_max_fpel[1] = 8*( h->sps->i_mb_height - h->mb.i_mb_y - 1 ) + 4;
+ h->mb.mv_min_spel[1] = 4*( h->mb.mv_min_fpel[1] - 8 );
+ h->mb.mv_max_spel[1] = 4*( h->mb.mv_max_fpel[1] + 8 );
+ }
#define LOAD_HPELS_LUMA(dst, src) \
{ \