Coverage Report

Created: 2025-08-28 07:12

/src/libvpx/vp8/common/reconinter.c
Line
Count
Source (jump to first uncovered line)
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
93.8M
                                  int pre_stride, vp8_subpix_fn_t sppf) {
61
93.8M
  int r;
62
93.8M
  unsigned char *pred_ptr = d->predictor;
63
93.8M
  unsigned char *ptr;
64
93.8M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
65
93.8M
        (d->bmi.mv.as_mv.col >> 3);
66
67
93.8M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
68
24.8M
    sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7,
69
24.8M
         pred_ptr, pitch);
70
68.9M
  } else {
71
344M
    for (r = 0; r < 4; ++r) {
72
275M
      pred_ptr[0] = ptr[0];
73
275M
      pred_ptr[1] = ptr[1];
74
275M
      pred_ptr[2] = ptr[2];
75
275M
      pred_ptr[3] = ptr[3];
76
275M
      pred_ptr += pitch;
77
275M
      ptr += pre_stride;
78
275M
    }
79
68.9M
  }
80
93.8M
}
81
82
static void build_inter_predictors4b(MACROBLOCKD *x, BLOCKD *d,
83
                                     unsigned char *dst, int dst_stride,
84
3.98M
                                     unsigned char *base_pre, int pre_stride) {
85
3.98M
  unsigned char *ptr;
86
3.98M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
87
3.98M
        (d->bmi.mv.as_mv.col >> 3);
88
89
3.98M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
90
2.55M
    x->subpixel_predict8x8(ptr, pre_stride, d->bmi.mv.as_mv.col & 7,
91
2.55M
                           d->bmi.mv.as_mv.row & 7, dst, dst_stride);
92
2.55M
  } else {
93
1.43M
    vp8_copy_mem8x8(ptr, pre_stride, dst, dst_stride);
94
1.43M
  }
95
3.98M
}
96
97
static void build_inter_predictors2b(MACROBLOCKD *x, BLOCKD *d,
98
                                     unsigned char *dst, int dst_stride,
99
7.90M
                                     unsigned char *base_pre, int pre_stride) {
100
7.90M
  unsigned char *ptr;
101
7.90M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
102
7.90M
        (d->bmi.mv.as_mv.col >> 3);
103
104
7.90M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
105
4.09M
    x->subpixel_predict8x4(ptr, pre_stride, d->bmi.mv.as_mv.col & 7,
106
4.09M
                           d->bmi.mv.as_mv.row & 7, dst, dst_stride);
107
4.09M
  } else {
108
3.81M
    vp8_copy_mem8x4(ptr, pre_stride, dst, dst_stride);
109
3.81M
  }
110
7.90M
}
111
112
static void build_inter_predictors_b(BLOCKD *d, unsigned char *dst,
113
                                     int dst_stride, unsigned char *base_pre,
114
7.45M
                                     int pre_stride, vp8_subpix_fn_t sppf) {
115
7.45M
  int r;
116
7.45M
  unsigned char *ptr;
117
7.45M
  ptr = base_pre + d->offset + (d->bmi.mv.as_mv.row >> 3) * pre_stride +
118
7.45M
        (d->bmi.mv.as_mv.col >> 3);
119
120
7.45M
  if (d->bmi.mv.as_mv.row & 7 || d->bmi.mv.as_mv.col & 7) {
121
3.35M
    sppf(ptr, pre_stride, d->bmi.mv.as_mv.col & 7, d->bmi.mv.as_mv.row & 7, dst,
122
3.35M
         dst_stride);
123
4.09M
  } else {
124
20.4M
    for (r = 0; r < 4; ++r) {
125
16.3M
      dst[0] = ptr[0];
126
16.3M
      dst[1] = ptr[1];
127
16.3M
      dst[2] = ptr[2];
128
16.3M
      dst[3] = ptr[3];
129
16.3M
      dst += dst_stride;
130
16.3M
      ptr += pre_stride;
131
16.3M
    }
132
4.09M
  }
133
7.45M
}
134
135
/*encoder only*/
136
2.93M
void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x) {
137
2.93M
  unsigned char *uptr, *vptr;
138
2.93M
  unsigned char *upred_ptr = &x->predictor[256];
139
2.93M
  unsigned char *vpred_ptr = &x->predictor[320];
140
141
2.93M
  int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
142
2.93M
  int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
143
2.93M
  int offset;
144
2.93M
  int pre_stride = x->pre.uv_stride;
145
146
  /* calc uv motion vectors */
147
2.93M
  mv_row += 1 | (mv_row >> (sizeof(int) * CHAR_BIT - 1));
148
2.93M
  mv_col += 1 | (mv_col >> (sizeof(int) * CHAR_BIT - 1));
149
2.93M
  mv_row /= 2;
150
2.93M
  mv_col /= 2;
151
2.93M
  mv_row &= x->fullpixel_mask;
152
2.93M
  mv_col &= x->fullpixel_mask;
153
154
2.93M
  offset = (mv_row >> 3) * pre_stride + (mv_col >> 3);
155
2.93M
  uptr = x->pre.u_buffer + offset;
156
2.93M
  vptr = x->pre.v_buffer + offset;
157
158
2.93M
  if ((mv_row | mv_col) & 7) {
159
1.36M
    x->subpixel_predict8x8(uptr, pre_stride, mv_col & 7, mv_row & 7, upred_ptr,
160
1.36M
                           8);
161
1.36M
    x->subpixel_predict8x8(vptr, pre_stride, mv_col & 7, mv_row & 7, vpred_ptr,
162
1.36M
                           8);
163
1.56M
  } else {
164
1.56M
    vp8_copy_mem8x8(uptr, pre_stride, upred_ptr, 8);
165
1.56M
    vp8_copy_mem8x8(vptr, pre_stride, vpred_ptr, 8);
166
1.56M
  }
167
2.93M
}
168
169
/*encoder only*/
170
382k
void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x) {
171
382k
  int i, j;
172
382k
  int pre_stride = x->pre.uv_stride;
173
382k
  unsigned char *base_pre;
174
175
  /* build uv mvs */
176
1.14M
  for (i = 0; i < 2; ++i) {
177
2.29M
    for (j = 0; j < 2; ++j) {
178
1.52M
      int yoffset = i * 8 + j * 2;
179
1.52M
      int uoffset = 16 + i * 2 + j;
180
1.52M
      int voffset = 20 + i * 2 + j;
181
182
1.52M
      int temp;
183
184
1.52M
      temp = x->block[yoffset].bmi.mv.as_mv.row +
185
1.52M
             x->block[yoffset + 1].bmi.mv.as_mv.row +
186
1.52M
             x->block[yoffset + 4].bmi.mv.as_mv.row +
187
1.52M
             x->block[yoffset + 5].bmi.mv.as_mv.row;
188
189
1.52M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
190
191
1.52M
      x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
192
193
1.52M
      temp = x->block[yoffset].bmi.mv.as_mv.col +
194
1.52M
             x->block[yoffset + 1].bmi.mv.as_mv.col +
195
1.52M
             x->block[yoffset + 4].bmi.mv.as_mv.col +
196
1.52M
             x->block[yoffset + 5].bmi.mv.as_mv.col;
197
198
1.52M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
199
200
1.52M
      x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
201
202
1.52M
      x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int;
203
1.52M
    }
204
764k
  }
205
206
382k
  base_pre = x->pre.u_buffer;
207
1.14M
  for (i = 16; i < 20; i += 2) {
208
764k
    BLOCKD *d0 = &x->block[i];
209
764k
    BLOCKD *d1 = &x->block[i + 1];
210
211
764k
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
212
438k
      build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
213
438k
    } else {
214
325k
      vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride,
215
325k
                                   x->subpixel_predict);
216
325k
      vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride,
217
325k
                                   x->subpixel_predict);
218
325k
    }
219
764k
  }
220
221
382k
  base_pre = x->pre.v_buffer;
222
1.14M
  for (i = 20; i < 24; i += 2) {
223
764k
    BLOCKD *d0 = &x->block[i];
224
764k
    BLOCKD *d1 = &x->block[i + 1];
225
226
764k
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
227
438k
      build_inter_predictors2b(x, d0, d0->predictor, 8, base_pre, pre_stride);
228
438k
    } else {
229
325k
      vp8_build_inter_predictors_b(d0, 8, base_pre, pre_stride,
230
325k
                                   x->subpixel_predict);
231
325k
      vp8_build_inter_predictors_b(d1, 8, base_pre, pre_stride,
232
325k
                                   x->subpixel_predict);
233
325k
    }
234
764k
  }
235
382k
}
236
237
/*encoder only*/
238
void vp8_build_inter16x16_predictors_mby(MACROBLOCKD *x, unsigned char *dst_y,
239
2.93M
                                         int dst_ystride) {
240
2.93M
  unsigned char *ptr_base;
241
2.93M
  unsigned char *ptr;
242
2.93M
  int mv_row = x->mode_info_context->mbmi.mv.as_mv.row;
243
2.93M
  int mv_col = x->mode_info_context->mbmi.mv.as_mv.col;
244
2.93M
  int pre_stride = x->pre.y_stride;
245
246
2.93M
  ptr_base = x->pre.y_buffer;
247
2.93M
  ptr = ptr_base + (mv_row >> 3) * pre_stride + (mv_col >> 3);
248
249
2.93M
  if ((mv_row | mv_col) & 7) {
250
728k
    x->subpixel_predict16x16(ptr, pre_stride, mv_col & 7, mv_row & 7, dst_y,
251
728k
                             dst_ystride);
252
2.20M
  } else {
253
2.20M
    vp8_copy_mem16x16(ptr, pre_stride, dst_y, dst_ystride);
254
2.20M
  }
255
2.93M
}
256
257
1.61M
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
1.61M
  if (mv->col < (xd->mb_to_left_edge - (19 << 3))) {
268
1.01M
    mv->col = xd->mb_to_left_edge - (16 << 3);
269
1.01M
  } else if (mv->col > xd->mb_to_right_edge + (18 << 3)) {
270
28.8k
    mv->col = xd->mb_to_right_edge + (16 << 3);
271
28.8k
  }
272
273
1.61M
  if (mv->row < (xd->mb_to_top_edge - (19 << 3))) {
274
369k
    mv->row = xd->mb_to_top_edge - (16 << 3);
275
1.24M
  } else if (mv->row > xd->mb_to_bottom_edge + (18 << 3)) {
276
68.2k
    mv->row = xd->mb_to_bottom_edge + (16 << 3);
277
68.2k
  }
278
1.61M
}
279
280
/* A version of the above function for chroma block MVs.*/
281
1.20M
static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd) {
282
1.20M
  mv->col = (2 * mv->col < (xd->mb_to_left_edge - (19 << 3)))
283
1.20M
                ? (xd->mb_to_left_edge - (16 << 3)) >> 1
284
1.20M
                : mv->col;
285
1.20M
  mv->col = (2 * mv->col > xd->mb_to_right_edge + (18 << 3))
286
1.20M
                ? (xd->mb_to_right_edge + (16 << 3)) >> 1
287
1.20M
                : mv->col;
288
289
1.20M
  mv->row = (2 * mv->row < (xd->mb_to_top_edge - (19 << 3)))
290
1.20M
                ? (xd->mb_to_top_edge - (16 << 3)) >> 1
291
1.20M
                : mv->row;
292
1.20M
  mv->row = (2 * mv->row > xd->mb_to_bottom_edge + (18 << 3))
293
1.20M
                ? (xd->mb_to_bottom_edge + (16 << 3)) >> 1
294
1.20M
                : mv->row;
295
1.20M
}
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
3.10M
                                        int dst_uvstride) {
301
3.10M
  int offset;
302
3.10M
  unsigned char *ptr;
303
3.10M
  unsigned char *uptr, *vptr;
304
305
3.10M
  int_mv _16x16mv;
306
307
3.10M
  unsigned char *ptr_base = x->pre.y_buffer;
308
3.10M
  int pre_stride = x->pre.y_stride;
309
310
3.10M
  _16x16mv.as_int = x->mode_info_context->mbmi.mv.as_int;
311
312
3.10M
  if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
313
32.6k
    clamp_mv_to_umv_border(&_16x16mv.as_mv, x);
314
32.6k
  }
315
316
3.10M
  ptr = ptr_base + (_16x16mv.as_mv.row >> 3) * pre_stride +
317
3.10M
        (_16x16mv.as_mv.col >> 3);
318
319
3.10M
  if (_16x16mv.as_int & 0x00070007) {
320
1.81M
    x->subpixel_predict16x16(ptr, pre_stride, _16x16mv.as_mv.col & 7,
321
1.81M
                             _16x16mv.as_mv.row & 7, dst_y, dst_ystride);
322
1.81M
  } else {
323
1.29M
    vp8_copy_mem16x16(ptr, pre_stride, dst_y, dst_ystride);
324
1.29M
  }
325
326
  /* calc uv motion vectors */
327
3.10M
  _16x16mv.as_mv.row +=
328
3.10M
      1 | (_16x16mv.as_mv.row >> (sizeof(int) * CHAR_BIT - 1));
329
3.10M
  _16x16mv.as_mv.col +=
330
3.10M
      1 | (_16x16mv.as_mv.col >> (sizeof(int) * CHAR_BIT - 1));
331
3.10M
  _16x16mv.as_mv.row /= 2;
332
3.10M
  _16x16mv.as_mv.col /= 2;
333
3.10M
  _16x16mv.as_mv.row &= x->fullpixel_mask;
334
3.10M
  _16x16mv.as_mv.col &= x->fullpixel_mask;
335
336
3.10M
  if (2 * _16x16mv.as_mv.col < (x->mb_to_left_edge - (19 << 3)) ||
337
3.10M
      2 * _16x16mv.as_mv.col > x->mb_to_right_edge + (18 << 3) ||
338
3.10M
      2 * _16x16mv.as_mv.row < (x->mb_to_top_edge - (19 << 3)) ||
339
3.10M
      2 * _16x16mv.as_mv.row > x->mb_to_bottom_edge + (18 << 3)) {
340
1.63k
    return;
341
1.63k
  }
342
343
3.10M
  pre_stride >>= 1;
344
3.10M
  offset = (_16x16mv.as_mv.row >> 3) * pre_stride + (_16x16mv.as_mv.col >> 3);
345
3.10M
  uptr = x->pre.u_buffer + offset;
346
3.10M
  vptr = x->pre.v_buffer + offset;
347
348
3.10M
  if (_16x16mv.as_int & 0x00070007) {
349
613k
    x->subpixel_predict8x8(uptr, pre_stride, _16x16mv.as_mv.col & 7,
350
613k
                           _16x16mv.as_mv.row & 7, dst_u, dst_uvstride);
351
613k
    x->subpixel_predict8x8(vptr, pre_stride, _16x16mv.as_mv.col & 7,
352
613k
                           _16x16mv.as_mv.row & 7, dst_v, dst_uvstride);
353
2.48M
  } else {
354
2.48M
    vp8_copy_mem8x8(uptr, pre_stride, dst_u, dst_uvstride);
355
2.48M
    vp8_copy_mem8x8(vptr, pre_stride, dst_v, dst_uvstride);
356
2.48M
  }
357
3.10M
}
358
359
1.56M
static void build_inter4x4_predictors_mb(MACROBLOCKD *x) {
360
1.56M
  int i;
361
1.56M
  unsigned char *base_dst = x->dst.y_buffer;
362
1.56M
  unsigned char *base_pre = x->pre.y_buffer;
363
364
1.56M
  if (x->mode_info_context->mbmi.partitioning < 3) {
365
996k
    BLOCKD *b;
366
996k
    int dst_stride = x->dst.y_stride;
367
368
996k
    x->block[0].bmi = x->mode_info_context->bmi[0];
369
996k
    x->block[2].bmi = x->mode_info_context->bmi[2];
370
996k
    x->block[8].bmi = x->mode_info_context->bmi[8];
371
996k
    x->block[10].bmi = x->mode_info_context->bmi[10];
372
996k
    if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
373
269k
      clamp_mv_to_umv_border(&x->block[0].bmi.mv.as_mv, x);
374
269k
      clamp_mv_to_umv_border(&x->block[2].bmi.mv.as_mv, x);
375
269k
      clamp_mv_to_umv_border(&x->block[8].bmi.mv.as_mv, x);
376
269k
      clamp_mv_to_umv_border(&x->block[10].bmi.mv.as_mv, x);
377
269k
    }
378
379
996k
    b = &x->block[0];
380
996k
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
381
996k
                             dst_stride);
382
996k
    b = &x->block[2];
383
996k
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
384
996k
                             dst_stride);
385
996k
    b = &x->block[8];
386
996k
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
387
996k
                             dst_stride);
388
996k
    b = &x->block[10];
389
996k
    build_inter_predictors4b(x, b, base_dst + b->offset, dst_stride, base_pre,
390
996k
                             dst_stride);
391
996k
  } else {
392
5.07M
    for (i = 0; i < 16; i += 2) {
393
4.51M
      BLOCKD *d0 = &x->block[i];
394
4.51M
      BLOCKD *d1 = &x->block[i + 1];
395
4.51M
      int dst_stride = x->dst.y_stride;
396
397
4.51M
      x->block[i + 0].bmi = x->mode_info_context->bmi[i + 0];
398
4.51M
      x->block[i + 1].bmi = x->mode_info_context->bmi[i + 1];
399
4.51M
      if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
400
250k
        clamp_mv_to_umv_border(&x->block[i + 0].bmi.mv.as_mv, x);
401
250k
        clamp_mv_to_umv_border(&x->block[i + 1].bmi.mv.as_mv, x);
402
250k
      }
403
404
4.51M
      if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
405
3.06M
        build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride,
406
3.06M
                                 base_pre, dst_stride);
407
3.06M
      } else {
408
1.44M
        build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride,
409
1.44M
                                 base_pre, dst_stride, x->subpixel_predict);
410
1.44M
        build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride,
411
1.44M
                                 base_pre, dst_stride, x->subpixel_predict);
412
1.44M
      }
413
4.51M
    }
414
564k
  }
415
1.56M
  base_dst = x->dst.u_buffer;
416
1.56M
  base_pre = x->pre.u_buffer;
417
4.68M
  for (i = 16; i < 20; i += 2) {
418
3.12M
    BLOCKD *d0 = &x->block[i];
419
3.12M
    BLOCKD *d1 = &x->block[i + 1];
420
3.12M
    int dst_stride = x->dst.uv_stride;
421
422
    /* Note: uv mvs already clamped in build_4x4uvmvs() */
423
424
3.12M
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
425
1.98M
      build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride,
426
1.98M
                               base_pre, dst_stride);
427
1.98M
    } else {
428
1.13M
      build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre,
429
1.13M
                               dst_stride, x->subpixel_predict);
430
1.13M
      build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre,
431
1.13M
                               dst_stride, x->subpixel_predict);
432
1.13M
    }
433
3.12M
  }
434
435
1.56M
  base_dst = x->dst.v_buffer;
436
1.56M
  base_pre = x->pre.v_buffer;
437
4.68M
  for (i = 20; i < 24; i += 2) {
438
3.12M
    BLOCKD *d0 = &x->block[i];
439
3.12M
    BLOCKD *d1 = &x->block[i + 1];
440
3.12M
    int dst_stride = x->dst.uv_stride;
441
442
    /* Note: uv mvs already clamped in build_4x4uvmvs() */
443
444
3.12M
    if (d0->bmi.mv.as_int == d1->bmi.mv.as_int) {
445
1.98M
      build_inter_predictors2b(x, d0, base_dst + d0->offset, dst_stride,
446
1.98M
                               base_pre, dst_stride);
447
1.98M
    } else {
448
1.13M
      build_inter_predictors_b(d0, base_dst + d0->offset, dst_stride, base_pre,
449
1.13M
                               dst_stride, x->subpixel_predict);
450
1.13M
      build_inter_predictors_b(d1, base_dst + d1->offset, dst_stride, base_pre,
451
1.13M
                               dst_stride, x->subpixel_predict);
452
1.13M
    }
453
3.12M
  }
454
1.56M
}
455
456
1.56M
static void build_4x4uvmvs(MACROBLOCKD *x) {
457
1.56M
  int i, j;
458
459
4.68M
  for (i = 0; i < 2; ++i) {
460
9.36M
    for (j = 0; j < 2; ++j) {
461
6.24M
      int yoffset = i * 8 + j * 2;
462
6.24M
      int uoffset = 16 + i * 2 + j;
463
6.24M
      int voffset = 20 + i * 2 + j;
464
465
6.24M
      int temp;
466
467
6.24M
      temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.row +
468
6.24M
             x->mode_info_context->bmi[yoffset + 1].mv.as_mv.row +
469
6.24M
             x->mode_info_context->bmi[yoffset + 4].mv.as_mv.row +
470
6.24M
             x->mode_info_context->bmi[yoffset + 5].mv.as_mv.row;
471
472
6.24M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
473
474
6.24M
      x->block[uoffset].bmi.mv.as_mv.row = (temp / 8) & x->fullpixel_mask;
475
476
6.24M
      temp = x->mode_info_context->bmi[yoffset + 0].mv.as_mv.col +
477
6.24M
             x->mode_info_context->bmi[yoffset + 1].mv.as_mv.col +
478
6.24M
             x->mode_info_context->bmi[yoffset + 4].mv.as_mv.col +
479
6.24M
             x->mode_info_context->bmi[yoffset + 5].mv.as_mv.col;
480
481
6.24M
      temp += 4 + ((temp >> (sizeof(temp) * CHAR_BIT - 1)) * 8);
482
483
6.24M
      x->block[uoffset].bmi.mv.as_mv.col = (temp / 8) & x->fullpixel_mask;
484
485
6.24M
      if (x->mode_info_context->mbmi.need_to_clamp_mvs) {
486
1.20M
        clamp_uvmv_to_umv_border(&x->block[uoffset].bmi.mv.as_mv, x);
487
1.20M
      }
488
489
6.24M
      x->block[voffset].bmi.mv.as_int = x->block[uoffset].bmi.mv.as_int;
490
6.24M
    }
491
3.12M
  }
492
1.56M
}
493
494
4.66M
void vp8_build_inter_predictors_mb(MACROBLOCKD *xd) {
495
4.66M
  if (xd->mode_info_context->mbmi.mode != SPLITMV) {
496
3.10M
    vp8_build_inter16x16_predictors_mb(xd, xd->dst.y_buffer, xd->dst.u_buffer,
497
3.10M
                                       xd->dst.v_buffer, xd->dst.y_stride,
498
3.10M
                                       xd->dst.uv_stride);
499
3.10M
  } else {
500
1.56M
    build_4x4uvmvs(xd);
501
1.56M
    build_inter4x4_predictors_mb(xd);
502
1.56M
  }
503
4.66M
}