Coverage Report

Created: 2025-11-16 07:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvpx/vp8/common/reconinter.c
Line
Count
Source
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
 *  that can be found in the LICENSE file in the root of the source
6
 *  tree. An additional intellectual property rights grant can be found
7
 *  in the file PATENTS.  All contributing project authors may
8
 *  be found in the AUTHORS file in the root of the source tree.
9
 */
10
11
#include <limits.h>
12
#include <string.h>
13
14
#include "vpx_config.h"
15
#include "vp8_rtcd.h"
16
#include "vpx/vpx_integer.h"
17
#include "blockd.h"
18
#include "reconinter.h"
19
#if CONFIG_RUNTIME_CPU_DETECT
20
#include "onyxc_int.h"
21
#endif
22
23
void vp8_copy_mem16x16_c(unsigned char *src, int src_stride, unsigned char *dst,
24
0
                         int dst_stride) {
25
0
  int r;
26
27
0
  for (r = 0; r < 16; ++r) {
28
0
    memcpy(dst, src, 16);
29
30
0
    src += src_stride;
31
0
    dst += dst_stride;
32
0
  }
33
0
}
34
35
void vp8_copy_mem8x8_c(unsigned char *src, int src_stride, unsigned char *dst,
36
0
                       int dst_stride) {
37
0
  int r;
38
39
0
  for (r = 0; r < 8; ++r) {
40
0
    memcpy(dst, src, 8);
41
42
0
    src += src_stride;
43
0
    dst += dst_stride;
44
0
  }
45
0
}
46
47
void vp8_copy_mem8x4_c(unsigned char *src, int src_stride, unsigned char *dst,
48
0
                       int dst_stride) {
49
0
  int r;
50
51
0
  for (r = 0; r < 4; ++r) {
52
0
    memcpy(dst, src, 8);
53
54
0
    src += src_stride;
55
0
    dst += dst_stride;
56
0
  }
57
0
}
58
59
void vp8_build_inter_predictors_b(BLOCKD *d, int pitch, unsigned char *base_pre,
60
98.9M
                                  int pre_stride, vp8_subpix_fn_t sppf) {
61
98.9M
  int r;
62
98.9M
  unsigned char *pred_ptr = d->predictor;
63
98.9M
  unsigned char *ptr;
64
98.9M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
65
98.9M
        (d->bmi.mv.as_mv.col >> 3);
66
67
98.9M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
68
26.1M
    sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7,
69
26.1M
         pred_ptr, pitch);
70
72.7M
  } else {
71
363M
    for (r = 0; r < 4; ++r) {
72
290M
      pred_ptr[0] = ptr[0];
73
290M
      pred_ptr[1] = ptr[1];
74
290M
      pred_ptr[2] = ptr[2];
75
290M
      pred_ptr[3] = ptr[3];
76
290M
      pred_ptr += pitch;
77
290M
      ptr += pre_stride;
78
290M
    }
79
72.7M
  }
80
98.9M
}
81
82
static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d,
83
                                     unsigned char *dst, int dst_stride,
84
5.31M
                                     unsigned char *base_pre, int pre_stride) {
85
5.31M
  unsigned char *ptr;
86
5.31M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
87
5.31M
        (d->bmi.mv.as_mv.col >> 3);
88
89
5.31M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
90
3.44M
    x->subpixel_predict8x8(ptr, pre_stride, d->bmi.mv.as_mv.col & 7,
91
3.44M
                           d->bmi.mv.as_mv.row & 7, dst, dst_stride);
92
3.44M
  } else {
93
1.86M
    vp8_copy_mem8x8(ptr, pre_stride, dst, dst_stride);
94
1.86M
  }
95
5.31M
}
96
97
static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d,
98
                                     unsigned char *dst, int dst_stride,
99
10.7M
                                     unsigned char *base_pre, int pre_stride) {
100
10.7M
  unsigned char *ptr;
101
10.7M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
102
10.7M
        (d->bmi.mv.as_mv.col >> 3);
103
104
10.7M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
105
5.78M
    x->subpixel_predict8x4(ptr, pre_stride, d->bmi.mv.as_mv.col & 7,
106
5.78M
                           d->bmi.mv.as_mv.row & 7, dst, dst_stride);
107
5.78M
  } else {
108
4.96M
    vp8_copy_mem8x4(ptr, pre_stride, dst, dst_stride);
109
4.96M
  }
110
10.7M
}
111
112
static void build_inter_predictors_b(BLOCKD *d, unsigned char *dst,
113
                                     int dst_stride, unsigned char *base_pre,
114
10.5M
                                     int pre_stride, vp8_subpix_fn_t sppf) {
115
10.5M
  int r;
116
10.5M
  unsigned char *ptr;
117
10.5M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
118
10.5M
        (d->bmi.mv.as_mv.col >> 3);
119
120
10.5M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
121
5.27M
    sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst,
122
5.27M
         dst_stride);
123
5.27M
  } else {
124
26.1M
    for (r = 0; r < 4; ++r) {
125
20.9M
      dst[0] = ptr[0];
126
20.9M
      dst[1] = ptr[1];
127
20.9M
      dst[2] = ptr[2];
128
20.9M
      dst[3] = ptr[3];
129
20.9M
      dst += dst_stride;
130
20.9M
      ptr += pre_stride;
131
20.9M
    }
132
5.23M
  }
133
10.5M
}
134
135
/*encoder only*/
136
3.06M
void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x) {
137
3.06M
  unsigned char *uptr, *vptr;
138
3.06M
  unsigned char *upred_ptr = &x->predictor[256];
139
3.06M
  unsigned char *vpred_ptr = &x->predictor[320];
140
141
3.06M
  int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
142
3.06M
  int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
143
3.06M
  int offset;
144
3.06M
  int pre_stride = x->pre.uv_stride;
145
146
  /* calc uv motion vectors */
147
3.06M
  mv_row += 1 | (mv_row >> (sizeof(int) * CHAR_BIT - 1));
148
3.06M
  mv_col += 1 | (mv_col >> (sizeof(int) * CHAR_BIT - 1));
149
3.06M
  mv_row /= 2;
150
3.06M
  mv_col /= 2;
151
3.06M
  mv_row &= x->fullpixel_mask;
152
3.06M
  mv_col &= x->fullpixel_mask;
153
154
3.06M
  offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
155
3.06M
  uptr = x->pre.u_buffer + offset;
156
3.06M
  vptr = x->pre.v_buffer + offset;
157
158
3.06M
  if ((mv_row | mv_col) & 7) {
159
1.43M
    x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr,
160
1.43M
                           8);
161
1.43M
    x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr,
162
1.43M
                           8);
163
1.62M
  } else {
164
1.62M
    vp8_copy_mem8x8(uptr, pre_stride, upred_ptr, 8);
165
1.62M
    vp8_copy_mem8x8(vptr, pre_stride, vpred_ptr, 8);
166
1.62M
  }
167
3.06M
}
168
169
/*encoder only*/
170
406k
void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x) {
171
406k
  int i, j;
172
406k
  int pre_stride = x->pre.uv_stride;
173
406k
  unsigned char *base_pre;
174
175
  /* build uv mvs */
176
1.22M
  for (i = 0; i < 2; ++i) {
177
2.44M
    for (j = 0; j < 2; ++j) {
178
1.62M
      int yoffset = i * 8 + j * 2;
179
1.62M
      int uoffset = 16 + i * 2 + j;
180
1.62M
      int voffset = 20 + i * 2 + j;
181
182
1.62M
      int temp;
183
184
1.62M
      temp = x->block[yoffset].bmi.mv.as_mv.row +
185
1.62M
             x->block[yoffset + 1].bmi.mv.as_mv.row +
186
1.62M
             x->block[yoffset + 4].bmi.mv.as_mv.row +
187
1.62M
             x->block[yoffset + 5].bmi.mv.as_mv.row;
188
189
1.62M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
190
191
1.62M
      x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
192
193
1.62M
      temp = x->block[yoffset].bmi.mv.as_mv.col +
194
1.62M
             x->block[yoffset + 1].bmi.mv.as_mv.col +
195
1.62M
             x->block[yoffset + 4].bmi.mv.as_mv.col +
196
1.62M
             x->block[yoffset + 5].bmi.mv.as_mv.col;
197
198
1.62M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
199
200
1.62M
      x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
201
202
1.62M
      x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int;
203
1.62M
    }
204
813k
  }
205
206
406k
  base_pre = x->pre.u_buffer;
207
1.22M
  for (i = 16; i < 20; i += 2) {
208
813k
    BLOCKD *d0 = &x->block[i];
209
813k
    BLOCKD *d1 = &x->block[i + 1];
210
211
813k
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
212
475k
      build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
213
475k
    } else {
214
338k
      vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride,
215
338k
                                   x->subpixel_predict);
216
338k
      vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride,
217
338k
                                   x->subpixel_predict);
218
338k
    }
219
813k
  }
220
221
406k
  base_pre = x->pre.v_buffer;
222
1.22M
  for (i = 20; i < 24; i += 2) {
223
813k
    BLOCKD *d0 = &x->block[i];
224
813k
    BLOCKD *d1 = &x->block[i + 1];
225
226
813k
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
227
475k
      build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
228
475k
    } else {
229
338k
      vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride,
230
338k
                                   x->subpixel_predict);
231
338k
      vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride,
232
338k
                                   x->subpixel_predict);
233
338k
    }
234
813k
  }
235
406k
}
236
237
/*encoder only*/
238
void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x, unsigned char *dst_y,
239
3.06M
                                         int dst_ystride) {
240
3.06M
  unsigned char *ptr_base;
241
3.06M
  unsigned char *ptr;
242
3.06M
  int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
243
3.06M
  int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
244
3.06M
  int pre_stride = x->pre.y_stride;
245
246
3.06M
  ptr_base = x->pre.y_buffer;
247
3.06M
  ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3);
248
249
3.06M
  if ((mv_row | mv_col) & 7) {
250
757k
    x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, dst_y,
251
757k
                             dst_ystride);
252
2.30M
  } else {
253
2.30M
    vp8_copy_mem16x16(ptr, pre_stride, dst_y, dst_ystride);
254
2.30M
  }
255
3.06M
}
256
257
2.18M
static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd) {
258
  /* If the MV points so far into the UMV border that no visible pixels
259
   * are used for reconstruction, the subpel part of the MV can be
260
   * discarded and the MV limited to 16 pixels with equivalent results.
261
   *
262
   * This limit kicks in at 19 pixels for the top and left edges, for
263
   * the 16 pixels plus 3 taps right of the central pixel when subpel
264
   * filtering. The bottom and right edges use 16 pixels plus 2 pixels
265
   * left of the central pixel when filtering.
266
   */
267
2.18M
  if (mv->col < (xd->mb_to_left_edge - (19 << 3))) {
268
1.05M
    mv->col = xd->mb_to_left_edge - (16 << 3);
269
1.12M
  } else if (mv->col > xd->mb_to_right_edge + (18 << 3)) {
270
104k
    mv->col = xd->mb_to_right_edge + (16 << 3);
271
104k
  }
272
273
2.18M
  if (mv->row < (xd->mb_to_top_edge - (19 << 3))) {
274
489k
    mv->row = xd->mb_to_top_edge - (16 << 3);
275
1.69M
  } else if (mv->row > xd->mb_to_bottom_edge + (18 << 3)) {
276
145k
    mv->row = xd->mb_to_bottom_edge + (16 << 3);
277
145k
  }
278
2.18M
}
279
280
/* A version of the above function for chroma block MVs.*/
281
1.40M
static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) {
282
1.40M
  mv->col = (2 * mv->col < (xd->mb_to_left_edge - (19 << 3)))
283
1.40M
                ? (xd->mb_to_left_edge - (16 << 3)) >> 1
284
1.40M
                : mv->col;
285
1.40M
  mv->col = (2 * mv->col > xd->mb_to_right_edge + (18 << 3))
286
1.40M
                ? (xd->mb_to_right_edge + (16 << 3)) >> 1
287
1.40M
                : mv->col;
288
289
1.40M
  mv->row = (2 * mv->row < (xd->mb_to_top_edge - (19 << 3)))
290
1.40M
                ? (xd->mb_to_top_edge - (16 << 3)) >> 1
291
1.40M
                : mv->row;
292
1.40M
  mv->row = (2 * mv->row > xd->mb_to_bottom_edge + (18 << 3))
293
1.40M
                ? (xd->mb_to_bottom_edge + (16 << 3)) >> 1
294
1.40M
                : mv->row;
295
1.40M
}
296
297
void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x, unsigned char *dst_y,
298
                                        unsigned char *dst_u,
299
                                        unsigned char *dst_v, int dst_ystride,
300
4.36M
                                        int dst_uvstride) {
301
4.36M
  int offset;
302
4.36M
  unsigned char *ptr;
303
4.36M
  unsigned char *uptr, *vptr;
304
305
4.36M
  int_mv _16x16mv;
306
307
4.36M
  unsigned char *ptr_base = x->pre.y_buffer;
308
4.36M
  int pre_stride = x->pre.y_stride;
309
310
4.36M
  _16x16mv.as_int = x->mode_info_context->mbmi.mv.as_int;
311
312
4.36M
  if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
313
70.1k
    clamp_mv_to_umv_border(&_16x16mv.as_mv, x);
314
70.1k
  }
315
316
4.36M
  ptr = ptr_base + (_16x16mv.as_mv.row >> 3) * pre_stride +
317
4.36M
        (_16x16mv.as_mv.col >> 3);
318
319
4.36M
  if (_16x16mv.as_int & 0x00070007) {
320
2.63M
    x->subpixel_predict16x16(ptr, pre_stride, _16x16mv.as_mv.col & 7,
321
2.63M
                             _16x16mv.as_mv.row & 7, dst_y, dst_ystride);
322
2.63M
  } else {
323
1.73M
    vp8_copy_mem16x16(ptr, pre_stride, dst_y, dst_ystride);
324
1.73M
  }
325
326
  /* calc uv motion vectors */
327
4.36M
  _16x16mv.as_mv.row +=
328
4.36M
      1 | (_16x16mv.as_mv.row >> (sizeof(int) * CHAR_BIT - 1));
329
4.36M
  _16x16mv.as_mv.col +=
330
4.36M
      1 | (_16x16mv.as_mv.col >> (sizeof(int) * CHAR_BIT - 1));
331
4.36M
  _16x16mv.as_mv.row /= 2;
332
4.36M
  _16x16mv.as_mv.col /= 2;
333
4.36M
  _16x16mv.as_mv.row &= x->fullpixel_mask;
334
4.36M
  _16x16mv.as_mv.col &= x->fullpixel_mask;
335
336
4.36M
  if (2 * _16x16mv.as_mv.col < (x->mb_to_left_edge - (19 << 3)) ||
337
4.36M
      2 * _16x16mv.as_mv.col > x->mb_to_right_edge + (18 << 3) ||
338
4.36M
      2 * _16x16mv.as_mv.row < (x->mb_to_top_edge - (19 << 3)) ||
339
4.36M
      2 * _16x16mv.as_mv.row > x->mb_to_bottom_edge + (18 << 3)) {
340
1.99k
    return;
341
1.99k
  }
342
343
4.36M
  pre_stride >>= 1;
344
4.36M
  offset = (_16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3);
345
4.36M
  uptr = x->pre.u_buffer + offset;
346
4.36M
  vptr = x->pre.v_buffer + offset;
347
348
4.36M
  if (_16x16mv.as_int & 0x00070007) {
349
1.14M
    x->subpixel_predict8x8(uptr, pre_stride, _16x16mv.as_mv.col & 7,
350
1.14M
                           _16x16mv.as_mv.row & 7, dst_u, dst_uvstride);
351
1.14M
    x->subpixel_predict8x8(vptr, pre_stride, _16x16mv.as_mv.col & 7,
352
1.14M
                           _16x16mv.as_mv.row & 7, dst_v, dst_uvstride);
353
3.21M
  } else {
354
3.21M
    vp8_copy_mem8x8(uptr, pre_stride, dst_u, dst_uvstride);
355
3.21M
    vp8_copy_mem8x8(vptr, pre_stride, dst_v, dst_uvstride);
356
3.21M
  }
357
4.36M
}
358
359
2.13M
static void build_inter4x4_predictors_mb(MACROBLOCKD *x) {
360
2.13M
  int i;
361
2.13M
  unsigned char *base_dst = x->dst.y_buffer;
362
2.13M
  unsigned char *base_pre = x->pre.y_buffer;
363
364
2.13M
  if (x->mode_info_context->mbmi.partitioning < 3) {
365
1.32M
    BLOCKD *b;
366
1.32M
    int dst_stride = x->dst.y_stride;
367
368
1.32M
    x->block[0].bmi = x->mode_info_context->bmi[0];
369
1.32M
    x->block[2].bmi = x->mode_info_context->bmi[2];
370
1.32M
    x->block[8].bmi = x->mode_info_context->bmi[8];
371
1.32M
    x->block[10].bmi = x->mode_info_context->bmi[10];
372
1.32M
    if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
373
293k
      clamp_mv_to_umv_border(&x->block[0].bmi.mv.as_mv, x);
374
293k
      clamp_mv_to_umv_border(&x->block[2].bmi.mv.as_mv, x);
375
293k
      clamp_mv_to_umv_border(&x->block[8].bmi.mv.as_mv, x);
376
293k
      clamp_mv_to_umv_border(&x->block[10].bmi.mv.as_mv, x);
377
293k
    }
378
379
1.32M
    b = &x->block[0];
380
1.32M
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
381
1.32M
                             dst_stride);
382
1.32M
    b = &x->block[2];
383
1.32M
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
384
1.32M
                             dst_stride);
385
1.32M
    b = &x->block[8];
386
1.32M
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
387
1.32M
                             dst_stride);
388
1.32M
    b = &x->block[10];
389
1.32M
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
390
1.32M
                             dst_stride);
391
1.32M
  } else {
392
7.30M
    for (i = 0; i < 16; i += 2) {
393
6.49M
      BLOCKD *d0 = &x->block[i];
394
6.49M
      BLOCKD *d1 = &x->block[i + 1];
395
6.49M
      int dst_stride = x->dst.y_stride;
396
397
6.49M
      x->block[i + 0].bmi = x->mode_info_context->bmi[i + 0];
398
6.49M
      x->block[i + 1].bmi = x->mode_info_context->bmi[i + 1];
399
6.49M
      if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
400
470k
        clamp_mv_to_umv_border(&x->block[i + 0].bmi.mv.as_mv, x);
401
470k
        clamp_mv_to_umv_border(&x->block[i + 1].bmi.mv.as_mv, x);
402
470k
      }
403
404
6.49M
      if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
405
4.48M
        build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride,
406
4.48M
                                 base_pre, dst_stride);
407
4.48M
      } else {
408
2.00M
        build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride,
409
2.00M
                                 base_pre, dst_stride, x->subpixel_predict);
410
2.00M
        build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride,
411
2.00M
                                 base_pre, dst_stride, x->subpixel_predict);
412
2.00M
      }
413
6.49M
    }
414
811k
  }
415
2.13M
  base_dst = x->dst.u_buffer;
416
2.13M
  base_pre = x->pre.u_buffer;
417
6.41M
  for (i = 16; i < 20; i += 2) {
418
4.27M
    BLOCKD *d0 = &x->block[i];
419
4.27M
    BLOCKD *d1 = &x->block[i + 1];
420
4.27M
    int dst_stride = x->dst.uv_stride;
421
422
    /* Note: uv mvs already clamped in build_4x4uvmvs() */
423
424
4.27M
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
425
2.65M
      build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride,
426
2.65M
                               base_pre, dst_stride);
427
2.65M
    } else {
428
1.62M
      build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre,
429
1.62M
                               dst_stride, x->subpixel_predict);
430
1.62M
      build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre,
431
1.62M
                               dst_stride, x->subpixel_predict);
432
1.62M
    }
433
4.27M
  }
434
435
2.13M
  base_dst = x->dst.v_buffer;
436
2.13M
  base_pre = x->pre.v_buffer;
437
6.41M
  for (i = 20; i < 24; i += 2) {
438
4.27M
    BLOCKD *d0 = &x->block[i];
439
4.27M
    BLOCKD *d1 = &x->block[i + 1];
440
4.27M
    int dst_stride = x->dst.uv_stride;
441
442
    /* Note: uv mvs already clamped in build_4x4uvmvs() */
443
444
4.27M
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
445
2.65M
      build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride,
446
2.65M
                               base_pre, dst_stride);
447
2.65M
    } else {
448
1.62M
      build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre,
449
1.62M
                               dst_stride, x->subpixel_predict);
450
1.62M
      build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre,
451
1.62M
                               dst_stride, x->subpixel_predict);
452
1.62M
    }
453
4.27M
  }
454
2.13M
}
455
456
2.13M
static void build_4x4uvmvs(MACROBLOCKD *x) {
457
2.13M
  int i, j;
458
459
6.41M
  for (i = 0; i < 2; ++i) {
460
12.8M
    for (j = 0; j < 2; ++j) {
461
8.55M
      int yoffset = i * 8 + j * 2;
462
8.55M
      int uoffset = 16 + i * 2 + j;
463
8.55M
      int voffset = 20 + i * 2 + j;
464
465
8.55M
      int temp;
466
467
8.55M
      temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.row +
468
8.55M
             x->mode_info_context->bmi[yoffset + 1].mv.as_mv.row +
469
8.55M
             x->mode_info_context->bmi[yoffset + 4].mv.as_mv.row +
470
8.55M
             x->mode_info_context->bmi[yoffset + 5].mv.as_mv.row;
471
472
8.55M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
473
474
8.55M
      x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
475
476
8.55M
      temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.col +
477
8.55M
             x->mode_info_context->bmi[yoffset + 1].mv.as_mv.col +
478
8.55M
             x->mode_info_context->bmi[yoffset + 4].mv.as_mv.col +
479
8.55M
             x->mode_info_context->bmi[yoffset + 5].mv.as_mv.col;
480
481
8.55M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
482
483
8.55M
      x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
484
485
8.55M
      if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
486
1.40M
        clamp_uvmv_to_umv_border(&x->block[uoffset].bmi.mv.as_mv, x);
487
1.40M
      }
488
489
8.55M
      x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int;
490
8.55M
    }
491
4.27M
  }
492
2.13M
}
493
494
6.50M
void vp8_build_inter_predictors_mb(MACROBLOCKD *xd) {
495
6.50M
  if (xd->mode_info_context->mbmi.mode != SPLITMV) {
496
4.36M
    vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer, xd->dst.u_buffer,
497
4.36M
                                       xd->dst.v_buffer, xd->dst.y_stride,
498
4.36M
                                       xd->dst.uv_stride);
499
4.36M
  } else {
500
2.13M
    build_4x4uvmvs(xd);
501
2.13M
    build_inter4x4_predictors_mb(xd);
502
2.13M
  }
503
6.50M
}