1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vp8/common/reconinter.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,587 @@ 1.4 +/* 1.5 + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 + 1.15 +#include <limits.h> 1.16 +#include "vpx_config.h" 1.17 +#include "vp8_rtcd.h" 1.18 +#include "vpx/vpx_integer.h" 1.19 +#include "blockd.h" 1.20 +#include "reconinter.h" 1.21 +#if CONFIG_RUNTIME_CPU_DETECT 1.22 +#include "onyxc_int.h" 1.23 +#endif 1.24 + 1.25 +void vp8_copy_mem16x16_c( 1.26 + unsigned char *src, 1.27 + int src_stride, 1.28 + unsigned char *dst, 1.29 + int dst_stride) 1.30 +{ 1.31 + 1.32 + int r; 1.33 + 1.34 + for (r = 0; r < 16; r++) 1.35 + { 1.36 +#if !(CONFIG_FAST_UNALIGNED) 1.37 + dst[0] = src[0]; 1.38 + dst[1] = src[1]; 1.39 + dst[2] = src[2]; 1.40 + dst[3] = src[3]; 1.41 + dst[4] = src[4]; 1.42 + dst[5] = src[5]; 1.43 + dst[6] = src[6]; 1.44 + dst[7] = src[7]; 1.45 + dst[8] = src[8]; 1.46 + dst[9] = src[9]; 1.47 + dst[10] = src[10]; 1.48 + dst[11] = src[11]; 1.49 + dst[12] = src[12]; 1.50 + dst[13] = src[13]; 1.51 + dst[14] = src[14]; 1.52 + dst[15] = src[15]; 1.53 + 1.54 +#else 1.55 + ((uint32_t *)dst)[0] = ((uint32_t *)src)[0] ; 1.56 + ((uint32_t *)dst)[1] = ((uint32_t *)src)[1] ; 1.57 + ((uint32_t *)dst)[2] = ((uint32_t *)src)[2] ; 1.58 + ((uint32_t *)dst)[3] = ((uint32_t *)src)[3] ; 1.59 + 1.60 +#endif 1.61 + src += src_stride; 1.62 + dst += dst_stride; 1.63 + 1.64 + } 1.65 + 1.66 +} 1.67 + 1.68 +void vp8_copy_mem8x8_c( 1.69 + unsigned char *src, 1.70 + int src_stride, 1.71 + unsigned char *dst, 1.72 + int dst_stride) 1.73 +{ 1.74 + int r; 1.75 + 1.76 + for (r = 0; r < 8; r++) 1.77 + { 1.78 +#if !(CONFIG_FAST_UNALIGNED) 1.79 + dst[0] = src[0]; 1.80 + dst[1] = src[1]; 1.81 + dst[2] = src[2]; 1.82 + dst[3] = src[3]; 1.83 + dst[4] = src[4]; 1.84 + dst[5] = src[5]; 1.85 + dst[6] = src[6]; 1.86 + dst[7] = src[7]; 1.87 +#else 1.88 + ((uint32_t *)dst)[0] = ((uint32_t *)src)[0] ; 1.89 + ((uint32_t *)dst)[1] = ((uint32_t *)src)[1] ; 1.90 +#endif 1.91 + src += src_stride; 1.92 + dst += dst_stride; 1.93 + 1.94 + } 1.95 + 1.96 +} 1.97 + 1.98 +void vp8_copy_mem8x4_c( 1.99 + unsigned char *src, 1.100 + int src_stride, 1.101 + unsigned char *dst, 1.102 + int dst_stride) 1.103 +{ 1.104 + int r; 1.105 + 1.106 + for (r = 0; r < 4; r++) 1.107 + { 1.108 +#if !(CONFIG_FAST_UNALIGNED) 1.109 + dst[0] = src[0]; 1.110 + dst[1] = src[1]; 1.111 + dst[2] = src[2]; 1.112 + dst[3] = src[3]; 1.113 + dst[4] = src[4]; 1.114 + dst[5] = src[5]; 1.115 + dst[6] = src[6]; 1.116 + dst[7] = src[7]; 1.117 +#else 1.118 + ((uint32_t *)dst)[0] = ((uint32_t *)src)[0] ; 1.119 + ((uint32_t *)dst)[1] = ((uint32_t *)src)[1] ; 1.120 +#endif 1.121 + src += src_stride; 1.122 + dst += dst_stride; 1.123 + 1.124 + } 1.125 + 1.126 +} 1.127 + 1.128 + 1.129 +void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, unsigned char *base_pre, int pre_stride, vp8_subpix_fn_t sppf) 1.130 +{ 1.131 + int r; 1.132 + unsigned char *pred_ptr = d->predictor; 1.133 + unsigned char *ptr; 1.134 + ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3); 1.135 + 1.136 + if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) 1.137 + { 1.138 + sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, pred_ptr, pitch); 1.139 + } 1.140 + else 1.141 + { 1.142 + for (r = 0; r < 4; r++) 1.143 + { 1.144 + pred_ptr[0] = ptr[0]; 1.145 + pred_ptr[1] = ptr[1]; 1.146 + pred_ptr[2] = ptr[2]; 1.147 + pred_ptr[3] = ptr[3]; 1.148 + pred_ptr += pitch; 1.149 + ptr += pre_stride; 1.150 + } 1.151 + } 1.152 +} 1.153 + 1.154 +static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride) 1.155 +{ 1.156 + unsigned char *ptr; 1.157 + ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3); 1.158 + 1.159 + if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) 1.160 + { 1.161 + x->subpixel_predict8x8(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride); 1.162 + } 1.163 + else 1.164 + { 1.165 + vp8_copy_mem8x8(ptr, pre_stride, dst, dst_stride); 1.166 + } 1.167 +} 1.168 + 1.169 +static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d, unsigned char *dst, int dst_stride, unsigned char *base_pre, int pre_stride) 1.170 +{ 1.171 + unsigned char *ptr; 1.172 + ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3); 1.173 + 1.174 + if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) 1.175 + { 1.176 + x->subpixel_predict8x4(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride); 1.177 + } 1.178 + else 1.179 + { 1.180 + vp8_copy_mem8x4(ptr, pre_stride, dst, dst_stride); 1.181 + } 1.182 +} 1.183 + 1.184 +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) 1.185 +{ 1.186 + int r; 1.187 + unsigned char *ptr; 1.188 + ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride + (d->bmi.mv.as_mv.col >> 3); 1.189 + 1.190 + if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) 1.191 + { 1.192 + sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst, dst_stride); 1.193 + } 1.194 + else 1.195 + { 1.196 + for (r = 0; r < 4; r++) 1.197 + { 1.198 + dst[0] = ptr[0]; 1.199 + dst[1] = ptr[1]; 1.200 + dst[2] = ptr[2]; 1.201 + dst[3] = ptr[3]; 1.202 + dst += dst_stride; 1.203 + ptr += pre_stride; 1.204 + } 1.205 + } 1.206 +} 1.207 + 1.208 + 1.209 +/*encoder only*/ 1.210 +void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x) 1.211 +{ 1.212 + unsigned char *uptr, *vptr; 1.213 + unsigned char *upred_ptr = &x->predictor[256]; 1.214 + unsigned char *vpred_ptr = &x->predictor[320]; 1.215 + 1.216 + int mv_row = x->mode_info_context->mbmi.mv.as_mv.row; 1.217 + int mv_col = x->mode_info_context->mbmi.mv.as_mv.col; 1.218 + int offset; 1.219 + int pre_stride = x->pre.uv_stride; 1.220 + 1.221 + /* calc uv motion vectors */ 1.222 + mv_row += 1 | (mv_row >> (sizeof(int) * CHAR_BIT - 1)); 1.223 + mv_col += 1 | (mv_col >> (sizeof(int) * CHAR_BIT - 1)); 1.224 + mv_row /= 2; 1.225 + mv_col /= 2; 1.226 + mv_row &= x->fullpixel_mask; 1.227 + mv_col &= x->fullpixel_mask; 1.228 + 1.229 + offset = (mv_row >> 3) * pre_stride + (mv_col >> 3); 1.230 + uptr = x->pre.u_buffer + offset; 1.231 + vptr = x->pre.v_buffer + offset; 1.232 + 1.233 + if ((mv_row | mv_col) & 7) 1.234 + { 1.235 + x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr, 8); 1.236 + x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr, 8); 1.237 + } 1.238 + else 1.239 + { 1.240 + vp8_copy_mem8x8(uptr, pre_stride, upred_ptr, 8); 1.241 + vp8_copy_mem8x8(vptr, pre_stride, vpred_ptr, 8); 1.242 + } 1.243 +} 1.244 + 1.245 +/*encoder only*/ 1.246 +void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x) 1.247 +{ 1.248 + int i, j; 1.249 + int pre_stride = x->pre.uv_stride; 1.250 + unsigned char *base_pre; 1.251 + 1.252 + /* build uv mvs */ 1.253 + for (i = 0; i < 2; i++) 1.254 + { 1.255 + for (j = 0; j < 2; j++) 1.256 + { 1.257 + int yoffset = i * 8 + j * 2; 1.258 + int uoffset = 16 + i * 2 + j; 1.259 + int voffset = 20 + i * 2 + j; 1.260 + 1.261 + int temp; 1.262 + 1.263 + temp = x->block[yoffset ].bmi.mv.as_mv.row 1.264 + + x->block[yoffset+1].bmi.mv.as_mv.row 1.265 + + x->block[yoffset+4].bmi.mv.as_mv.row 1.266 + + x->block[yoffset+5].bmi.mv.as_mv.row; 1.267 + 1.268 + temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8); 1.269 + 1.270 + x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask; 1.271 + 1.272 + temp = x->block[yoffset ].bmi.mv.as_mv.col 1.273 + + x->block[yoffset+1].bmi.mv.as_mv.col 1.274 + + x->block[yoffset+4].bmi.mv.as_mv.col 1.275 + + x->block[yoffset+5].bmi.mv.as_mv.col; 1.276 + 1.277 + temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8); 1.278 + 1.279 + x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask; 1.280 + 1.281 + x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int; 1.282 + } 1.283 + } 1.284 + 1.285 + base_pre = x->pre.u_buffer; 1.286 + for (i = 16; i < 20; i += 2) 1.287 + { 1.288 + BLOCKD *d0 = &x->block[i]; 1.289 + BLOCKD *d1 = &x->block[i+1]; 1.290 + 1.291 + if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) 1.292 + build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride); 1.293 + else 1.294 + { 1.295 + vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride, x->subpixel_predict); 1.296 + vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride, x->subpixel_predict); 1.297 + } 1.298 + } 1.299 + 1.300 + base_pre = x->pre.v_buffer; 1.301 + for (i = 20; i < 24; i += 2) 1.302 + { 1.303 + BLOCKD *d0 = &x->block[i]; 1.304 + BLOCKD *d1 = &x->block[i+1]; 1.305 + 1.306 + if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) 1.307 + build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride); 1.308 + else 1.309 + { 1.310 + vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride, x->subpixel_predict); 1.311 + vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride, x->subpixel_predict); 1.312 + } 1.313 + } 1.314 +} 1.315 + 1.316 + 1.317 +/*encoder only*/ 1.318 +void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x, 1.319 + unsigned char *dst_y, 1.320 + int dst_ystride) 1.321 +{ 1.322 + unsigned char *ptr_base; 1.323 + unsigned char *ptr; 1.324 + int mv_row = x->mode_info_context->mbmi.mv.as_mv.row; 1.325 + int mv_col = x->mode_info_context->mbmi.mv.as_mv.col; 1.326 + int pre_stride = x->pre.y_stride; 1.327 + 1.328 + ptr_base = x->pre.y_buffer; 1.329 + ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3); 1.330 + 1.331 + if ((mv_row | mv_col) & 7) 1.332 + { 1.333 + x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, 1.334 + dst_y, dst_ystride); 1.335 + } 1.336 + else 1.337 + { 1.338 + vp8_copy_mem16x16(ptr, pre_stride, dst_y, 1.339 + dst_ystride); 1.340 + } 1.341 +} 1.342 + 1.343 +static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) 1.344 +{ 1.345 + /* If the MV points so far into the UMV border that no visible pixels 1.346 + * are used for reconstruction, the subpel part of the MV can be 1.347 + * discarded and the MV limited to 16 pixels with equivalent results. 1.348 + * 1.349 + * This limit kicks in at 19 pixels for the top and left edges, for 1.350 + * the 16 pixels plus 3 taps right of the central pixel when subpel 1.351 + * filtering. The bottom and right edges use 16 pixels plus 2 pixels 1.352 + * left of the central pixel when filtering. 1.353 + */ 1.354 + if (mv->col < (xd->mb_to_left_edge - (19 << 3))) 1.355 + mv->col = xd->mb_to_left_edge - (16 << 3); 1.356 + else if (mv->col > xd->mb_to_right_edge + (18 << 3)) 1.357 + mv->col = xd->mb_to_right_edge + (16 << 3); 1.358 + 1.359 + if (mv->row < (xd->mb_to_top_edge - (19 << 3))) 1.360 + mv->row = xd->mb_to_top_edge - (16 << 3); 1.361 + else if (mv->row > xd->mb_to_bottom_edge + (18 << 3)) 1.362 + mv->row = xd->mb_to_bottom_edge + (16 << 3); 1.363 +} 1.364 + 1.365 +/* A version of the above function for chroma block MVs.*/ 1.366 +static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) 1.367 +{ 1.368 + mv->col = (2*mv->col < (xd->mb_to_left_edge - (19 << 3))) ? 1.369 + (xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col; 1.370 + mv->col = (2*mv->col > xd->mb_to_right_edge + (18 << 3)) ? 1.371 + (xd->mb_to_right_edge + (16 << 3)) >> 1 : mv->col; 1.372 + 1.373 + mv->row = (2*mv->row < (xd->mb_to_top_edge - (19 << 3))) ? 1.374 + (xd->mb_to_top_edge - (16 << 3)) >> 1 : mv->row; 1.375 + mv->row = (2*mv->row > xd->mb_to_bottom_edge + (18 << 3)) ? 1.376 + (xd->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row; 1.377 +} 1.378 + 1.379 +void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x, 1.380 + unsigned char *dst_y, 1.381 + unsigned char *dst_u, 1.382 + unsigned char *dst_v, 1.383 + int dst_ystride, 1.384 + int dst_uvstride) 1.385 +{ 1.386 + int offset; 1.387 + unsigned char *ptr; 1.388 + unsigned char *uptr, *vptr; 1.389 + 1.390 + int_mv _16x16mv; 1.391 + 1.392 + unsigned char *ptr_base = x->pre.y_buffer; 1.393 + int pre_stride = x->pre.y_stride; 1.394 + 1.395 + _16x16mv.as_int = x->mode_info_context->mbmi.mv.as_int; 1.396 + 1.397 + if (x->mode_info_context->mbmi.need_to_clamp_mvs) 1.398 + { 1.399 + clamp_mv_to_umv_border(&_16x16mv.as_mv, x); 1.400 + } 1.401 + 1.402 + ptr = ptr_base + ( _16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3); 1.403 + 1.404 + if ( _16x16mv.as_int & 0x00070007) 1.405 + { 1.406 + x->subpixel_predict16x16(ptr, pre_stride, _16x16mv.as_mv.col & 7, _16x16mv.as_mv.row & 7, dst_y, dst_ystride); 1.407 + } 1.408 + else 1.409 + { 1.410 + vp8_copy_mem16x16(ptr, pre_stride, dst_y, dst_ystride); 1.411 + } 1.412 + 1.413 + /* calc uv motion vectors */ 1.414 + _16x16mv.as_mv.row += 1 | (_16x16mv.as_mv.row >> (sizeof(int) * CHAR_BIT - 1)); 1.415 + _16x16mv.as_mv.col += 1 | (_16x16mv.as_mv.col >> (sizeof(int) * CHAR_BIT - 1)); 1.416 + _16x16mv.as_mv.row /= 2; 1.417 + _16x16mv.as_mv.col /= 2; 1.418 + _16x16mv.as_mv.row &= x->fullpixel_mask; 1.419 + _16x16mv.as_mv.col &= x->fullpixel_mask; 1.420 + 1.421 + pre_stride >>= 1; 1.422 + offset = ( _16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3); 1.423 + uptr = x->pre.u_buffer + offset; 1.424 + vptr = x->pre.v_buffer + offset; 1.425 + 1.426 + if ( _16x16mv.as_int & 0x00070007) 1.427 + { 1.428 + x->subpixel_predict8x8(uptr, pre_stride, _16x16mv.as_mv.col & 7, _16x16mv.as_mv.row & 7, dst_u, dst_uvstride); 1.429 + x->subpixel_predict8x8(vptr, pre_stride, _16x16mv.as_mv.col & 7, _16x16mv.as_mv.row & 7, dst_v, dst_uvstride); 1.430 + } 1.431 + else 1.432 + { 1.433 + vp8_copy_mem8x8(uptr, pre_stride, dst_u, dst_uvstride); 1.434 + vp8_copy_mem8x8(vptr, pre_stride, dst_v, dst_uvstride); 1.435 + } 1.436 +} 1.437 + 1.438 +static void build_inter4x4_predictors_mb(MACROBLOCKD *x) 1.439 +{ 1.440 + int i; 1.441 + unsigned char *base_dst = x->dst.y_buffer; 1.442 + unsigned char *base_pre = x->pre.y_buffer; 1.443 + 1.444 + if (x->mode_info_context->mbmi.partitioning < 3) 1.445 + { 1.446 + BLOCKD *b; 1.447 + int dst_stride = x->dst.y_stride; 1.448 + 1.449 + x->block[ 0].bmi = x->mode_info_context->bmi[ 0]; 1.450 + x->block[ 2].bmi = x->mode_info_context->bmi[ 2]; 1.451 + x->block[ 8].bmi = x->mode_info_context->bmi[ 8]; 1.452 + x->block[10].bmi = x->mode_info_context->bmi[10]; 1.453 + if (x->mode_info_context->mbmi.need_to_clamp_mvs) 1.454 + { 1.455 + clamp_mv_to_umv_border(&x->block[ 0].bmi.mv.as_mv, x); 1.456 + clamp_mv_to_umv_border(&x->block[ 2].bmi.mv.as_mv, x); 1.457 + clamp_mv_to_umv_border(&x->block[ 8].bmi.mv.as_mv, x); 1.458 + clamp_mv_to_umv_border(&x->block[10].bmi.mv.as_mv, x); 1.459 + } 1.460 + 1.461 + b = &x->block[ 0]; 1.462 + build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride); 1.463 + b = &x->block[ 2]; 1.464 + build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride); 1.465 + b = &x->block[ 8]; 1.466 + build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride); 1.467 + b = &x->block[10]; 1.468 + build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre, dst_stride); 1.469 + } 1.470 + else 1.471 + { 1.472 + for (i = 0; i < 16; i += 2) 1.473 + { 1.474 + BLOCKD *d0 = &x->block[i]; 1.475 + BLOCKD *d1 = &x->block[i+1]; 1.476 + int dst_stride = x->dst.y_stride; 1.477 + 1.478 + x->block[i+0].bmi = x->mode_info_context->bmi[i+0]; 1.479 + x->block[i+1].bmi = x->mode_info_context->bmi[i+1]; 1.480 + if (x->mode_info_context->mbmi.need_to_clamp_mvs) 1.481 + { 1.482 + clamp_mv_to_umv_border(&x->block[i+0].bmi.mv.as_mv, x); 1.483 + clamp_mv_to_umv_border(&x->block[i+1].bmi.mv.as_mv, x); 1.484 + } 1.485 + 1.486 + if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) 1.487 + build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride); 1.488 + else 1.489 + { 1.490 + build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict); 1.491 + build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict); 1.492 + } 1.493 + 1.494 + } 1.495 + 1.496 + } 1.497 + base_dst = x->dst.u_buffer; 1.498 + base_pre = x->pre.u_buffer; 1.499 + for (i = 16; i < 20; i += 2) 1.500 + { 1.501 + BLOCKD *d0 = &x->block[i]; 1.502 + BLOCKD *d1 = &x->block[i+1]; 1.503 + int dst_stride = x->dst.uv_stride; 1.504 + 1.505 + /* Note: uv mvs already clamped in build_4x4uvmvs() */ 1.506 + 1.507 + if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) 1.508 + build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride); 1.509 + else 1.510 + { 1.511 + build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict); 1.512 + build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict); 1.513 + } 1.514 + } 1.515 + 1.516 + base_dst = x->dst.v_buffer; 1.517 + base_pre = x->pre.v_buffer; 1.518 + for (i = 20; i < 24; i += 2) 1.519 + { 1.520 + BLOCKD *d0 = &x->block[i]; 1.521 + BLOCKD *d1 = &x->block[i+1]; 1.522 + int dst_stride = x->dst.uv_stride; 1.523 + 1.524 + /* Note: uv mvs already clamped in build_4x4uvmvs() */ 1.525 + 1.526 + if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) 1.527 + build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride); 1.528 + else 1.529 + { 1.530 + build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict); 1.531 + build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre, dst_stride, x->subpixel_predict); 1.532 + } 1.533 + } 1.534 +} 1.535 + 1.536 +static 1.537 +void build_4x4uvmvs(MACROBLOCKD *x) 1.538 +{ 1.539 + int i, j; 1.540 + 1.541 + for (i = 0; i < 2; i++) 1.542 + { 1.543 + for (j = 0; j < 2; j++) 1.544 + { 1.545 + int yoffset = i * 8 + j * 2; 1.546 + int uoffset = 16 + i * 2 + j; 1.547 + int voffset = 20 + i * 2 + j; 1.548 + 1.549 + int temp; 1.550 + 1.551 + temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.row 1.552 + + x->mode_info_context->bmi[yoffset + 1].mv.as_mv.row 1.553 + + x->mode_info_context->bmi[yoffset + 4].mv.as_mv.row 1.554 + + x->mode_info_context->bmi[yoffset + 5].mv.as_mv.row; 1.555 + 1.556 + temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8); 1.557 + 1.558 + x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask; 1.559 + 1.560 + temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.col 1.561 + + x->mode_info_context->bmi[yoffset + 1].mv.as_mv.col 1.562 + + x->mode_info_context->bmi[yoffset + 4].mv.as_mv.col 1.563 + + x->mode_info_context->bmi[yoffset + 5].mv.as_mv.col; 1.564 + 1.565 + temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8); 1.566 + 1.567 + x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask; 1.568 + 1.569 + if (x->mode_info_context->mbmi.need_to_clamp_mvs) 1.570 + clamp_uvmv_to_umv_border(&x->block[uoffset].bmi.mv.as_mv, x); 1.571 + 1.572 + x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int; 1.573 + } 1.574 + } 1.575 +} 1.576 + 1.577 +void vp8_build_inter_predictors_mb(MACROBLOCKD *xd) 1.578 +{ 1.579 + if (xd->mode_info_context->mbmi.mode != SPLITMV) 1.580 + { 1.581 + vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer, 1.582 + xd->dst.u_buffer, xd->dst.v_buffer, 1.583 + xd->dst.y_stride, xd->dst.uv_stride); 1.584 + } 1.585 + else 1.586 + { 1.587 + build_4x4uvmvs(xd); 1.588 + build_inter4x4_predictors_mb(xd); 1.589 + } 1.590 +}