204 |
int yin1, yin2, yin3; |
int yin1, yin2, yin3; |
205 |
int vec1, vec2, vec3; |
int vec1, vec2, vec3; |
206 |
|
|
|
static VECTOR zeroMV; |
|
207 |
uint32_t index = x + y * x_dim; |
uint32_t index = x + y * x_dim; |
208 |
zeroMV.x = zeroMV.y = 0; |
const VECTOR zeroMV = { 0,0 }; |
209 |
|
|
210 |
// first row (special case) |
// first row of blocks (special case) |
211 |
if (y == 0 && (block == 0 || block == 1)) |
if (y == 0 && (block == 0 || block == 1)) |
212 |
{ |
{ |
213 |
if ((x == 0) && (block == 0)) // first column, first block |
if ((x == 0) && (block == 0)) // first column, first block |
214 |
{ |
{ |
215 |
pmv[0] = pmv[1] = pmv[2] = pmv[3] = zeroMV; |
pmv[0] = pmv[1] = pmv[2] = pmv[3] = zeroMV; |
216 |
psad[0] = psad[1] = psad[2] = psad[3] = 0; |
psad[0] = 0; |
217 |
|
psad[1] = psad[2] = psad[3] = MV_MAX_ERROR; |
218 |
return 0; |
return 0; |
219 |
} |
} |
220 |
if (block == 1) // second block; has only a left neighbour |
if (block == 1) // second block; has only a left neighbour |
222 |
pmv[0] = pmv[1] = pMBs[index].mvs[0]; |
pmv[0] = pmv[1] = pMBs[index].mvs[0]; |
223 |
pmv[2] = pmv[3] = zeroMV; |
pmv[2] = pmv[3] = zeroMV; |
224 |
psad[0] = psad[1] = pMBs[index].sad8[0]; |
psad[0] = psad[1] = pMBs[index].sad8[0]; |
225 |
psad[2] = psad[3] = 0; |
psad[2] = psad[3] = MV_MAX_ERROR; |
226 |
return 0; |
return 0; |
227 |
} |
} |
228 |
else /* block==0, but x!=0, so again, there is a left neighbour*/ |
else /* block==0, but x!=0, so again, there is a left neighbour*/ |
230 |
pmv[0] = pmv[1] = pMBs[index-1].mvs[1]; |
pmv[0] = pmv[1] = pMBs[index-1].mvs[1]; |
231 |
pmv[2] = pmv[3] = zeroMV; |
pmv[2] = pmv[3] = zeroMV; |
232 |
psad[0] = psad[1] = pMBs[index-1].sad8[1]; |
psad[0] = psad[1] = pMBs[index-1].sad8[1]; |
233 |
psad[2] = psad[3] = 0; |
psad[2] = psad[3] = MV_MAX_ERROR; |
234 |
return 0; |
return 0; |
235 |
} |
} |
236 |
} |
} |
272 |
} |
} |
273 |
|
|
274 |
|
|
275 |
if (xin1 < 0 || /* yin1 < 0 || */ xin1 >= (int32_t)x_dim) |
if (xin1 < 0 || xin1 >= (int32_t)x_dim) |
276 |
{ |
{ |
277 |
pmv[1] = zeroMV; |
pmv[1] = zeroMV; |
278 |
psad[1] = MV_MAX_ERROR; |
psad[1] = MV_MAX_ERROR; |
283 |
psad[1] = pMBs[xin1 + yin1 * x_dim].sad8[vec1]; |
psad[1] = pMBs[xin1 + yin1 * x_dim].sad8[vec1]; |
284 |
} |
} |
285 |
|
|
286 |
if (xin2 < 0 || /* yin2 < 0 || */ xin2 >= (int32_t)x_dim) |
if (xin2 < 0 || xin2 >= (int32_t)x_dim) |
287 |
{ |
{ |
288 |
pmv[2] = zeroMV; |
pmv[2] = zeroMV; |
289 |
psad[2] = MV_MAX_ERROR; |
psad[2] = MV_MAX_ERROR; |
294 |
psad[2] = pMBs[xin2 + yin2 * x_dim].sad8[vec2]; |
psad[2] = pMBs[xin2 + yin2 * x_dim].sad8[vec2]; |
295 |
} |
} |
296 |
|
|
297 |
if (xin3 < 0 || /* yin3 < 0 || */ xin3 >= (int32_t)x_dim) |
if (xin3 < 0 || xin3 >= (int32_t)x_dim) |
298 |
{ |
{ |
299 |
pmv[3] = zeroMV; |
pmv[3] = zeroMV; |
300 |
psad[3] = MV_MAX_ERROR; |
psad[3] = MV_MAX_ERROR; |