variance.c 52.2 KB
Newer Older
Johann's avatar
Johann committed
1
/*
Yaowu Xu's avatar
Yaowu Xu committed
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Johann's avatar
Johann committed
3
 *
Yaowu Xu's avatar
Yaowu Xu committed
4
5
6
7
8
9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Johann's avatar
Johann committed
10
 */
11
#include <stdlib.h>
Johann's avatar
Johann committed
12

Yaowu Xu's avatar
Yaowu Xu committed
13
14
#include "./aom_config.h"
#include "./aom_dsp_rtcd.h"
Johann's avatar
Johann committed
15

16
#include "aom_ports/mem.h"
Yaowu Xu's avatar
Yaowu Xu committed
17
#include "aom/aom_integer.h"
Johann's avatar
Johann committed
18

19
#include "aom_dsp/variance.h"
Yaowu Xu's avatar
Yaowu Xu committed
20
#include "aom_dsp/aom_filter.h"
Johann's avatar
Johann committed
21

Yaowu Xu's avatar
Yaowu Xu committed
22
uint32_t aom_get4x4sse_cs_c(const uint8_t *a, int a_stride, const uint8_t *b,
clang-format's avatar
clang-format committed
23
                            int b_stride) {
Johann's avatar
Johann committed
24
25
26
  int distortion = 0;
  int r, c;

Johann's avatar
Johann committed
27
28
  for (r = 0; r < 4; ++r) {
    for (c = 0; c < 4; ++c) {
Johann's avatar
Johann committed
29
30
31
32
33
34
35
36
37
38
39
      int diff = a[c] - b[c];
      distortion += diff * diff;
    }

    a += a_stride;
    b += b_stride;
  }

  return distortion;
}

Yaowu Xu's avatar
Yaowu Xu committed
40
uint32_t aom_get_mb_ss_c(const int16_t *a) {
Johann's avatar
Johann committed
41
42
43
44
45
46
47
48
49
  unsigned int i, sum = 0;

  for (i = 0; i < 256; ++i) {
    sum += a[i] * a[i];
  }

  return sum;
}

Yaowu Xu's avatar
Yaowu Xu committed
50
uint32_t aom_variance_halfpixvar16x16_h_c(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
51
52
                                          const uint8_t *b, int b_stride,
                                          uint32_t *sse) {
Yaowu Xu's avatar
Yaowu Xu committed
53
  return aom_sub_pixel_variance16x16_c(a, a_stride, 4, 0, b, b_stride, sse);
Johann's avatar
Johann committed
54
55
}

Yaowu Xu's avatar
Yaowu Xu committed
56
uint32_t aom_variance_halfpixvar16x16_v_c(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
57
58
                                          const uint8_t *b, int b_stride,
                                          uint32_t *sse) {
Yaowu Xu's avatar
Yaowu Xu committed
59
  return aom_sub_pixel_variance16x16_c(a, a_stride, 0, 4, b, b_stride, sse);
Johann's avatar
Johann committed
60
61
}

Yaowu Xu's avatar
Yaowu Xu committed
62
uint32_t aom_variance_halfpixvar16x16_hv_c(const uint8_t *a, int a_stride,
Johann's avatar
Johann committed
63
64
                                           const uint8_t *b, int b_stride,
                                           uint32_t *sse) {
Yaowu Xu's avatar
Yaowu Xu committed
65
  return aom_sub_pixel_variance16x16_c(a, a_stride, 4, 4, b, b_stride, sse);
Johann's avatar
Johann committed
66
67
}

clang-format's avatar
clang-format committed
68
69
static void variance(const uint8_t *a, int a_stride, const uint8_t *b,
                     int b_stride, int w, int h, uint32_t *sse, int *sum) {
Johann's avatar
Johann committed
70
71
72
73
74
  int i, j;

  *sum = 0;
  *sse = 0;

Johann's avatar
Johann committed
75
76
  for (i = 0; i < h; ++i) {
    for (j = 0; j < w; ++j) {
Johann's avatar
Johann committed
77
78
79
80
81
82
83
84
85
86
      const int diff = a[j] - b[j];
      *sum += diff;
      *sse += diff * diff;
    }

    a += a_stride;
    b += b_stride;
  }
}

Johann's avatar
Johann committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Applies a 1-D 2-tap bilinear filter to the source block in either horizontal
// or vertical direction to produce the filtered output block. Used to implement
// the first-pass of 2-D separable filter.
//
// Produces int16_t output to retain precision for the next pass. Two filter
// taps should sum to FILTER_WEIGHT. pixel_step defines whether the filter is
// applied horizontally (pixel_step = 1) or vertically (pixel_step = stride).
// It defines the offset required to move from one input to the next.
static void var_filter_block2d_bil_first_pass(const uint8_t *a, uint16_t *b,
                                              unsigned int src_pixels_per_line,
                                              int pixel_step,
                                              unsigned int output_height,
                                              unsigned int output_width,
                                              const uint8_t *filter) {
  unsigned int i, j;

  for (i = 0; i < output_height; ++i) {
    for (j = 0; j < output_width; ++j) {
clang-format's avatar
clang-format committed
105
106
      b[j] = ROUND_POWER_OF_TWO(
          (int)a[0] * filter[0] + (int)a[pixel_step] * filter[1], FILTER_BITS);
Johann's avatar
Johann committed
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

      ++a;
    }

    a += src_pixels_per_line - output_width;
    b += output_width;
  }
}

// Applies a 1-D 2-tap bilinear filter to the source block in either horizontal
// or vertical direction to produce the filtered output block. Used to implement
// the second-pass of 2-D separable filter.
//
// Requires 16-bit input as produced by filter_block2d_bil_first_pass. Two
// filter taps should sum to FILTER_WEIGHT. pixel_step defines whether the
// filter is applied horizontally (pixel_step = 1) or vertically
// (pixel_step = stride). It defines the offset required to move from one input
// to the next. Output is 8-bit.
static void var_filter_block2d_bil_second_pass(const uint16_t *a, uint8_t *b,
                                               unsigned int src_pixels_per_line,
                                               unsigned int pixel_step,
                                               unsigned int output_height,
                                               unsigned int output_width,
                                               const uint8_t *filter) {
clang-format's avatar
clang-format committed
131
  unsigned int i, j;
Johann's avatar
Johann committed
132
133
134

  for (i = 0; i < output_height; ++i) {
    for (j = 0; j < output_width; ++j) {
clang-format's avatar
clang-format committed
135
136
      b[j] = ROUND_POWER_OF_TWO(
          (int)a[0] * filter[0] + (int)a[pixel_step] * filter[1], FILTER_BITS);
Johann's avatar
Johann committed
137
138
139
140
141
142
143
144
      ++a;
    }

    a += src_pixels_per_line - output_width;
    b += output_width;
  }
}

clang-format's avatar
clang-format committed
145
#define VAR(W, H)                                                    \
Yaowu Xu's avatar
Yaowu Xu committed
146
  uint32_t aom_variance##W##x##H##_c(const uint8_t *a, int a_stride, \
clang-format's avatar
clang-format committed
147
148
149
150
                                     const uint8_t *b, int b_stride, \
                                     uint32_t *sse) {                \
    int sum;                                                         \
    variance(a, a_stride, b, b_stride, W, H, sse, &sum);             \
151
    return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H));        \
clang-format's avatar
clang-format committed
152
  }
Johann's avatar
Johann committed
153

clang-format's avatar
clang-format committed
154
#define SUBPIX_VAR(W, H)                                                \
Yaowu Xu's avatar
Yaowu Xu committed
155
  uint32_t aom_sub_pixel_variance##W##x##H##_c(                         \
clang-format's avatar
clang-format committed
156
157
158
159
160
161
162
163
164
165
      const uint8_t *a, int a_stride, int xoffset, int yoffset,         \
      const uint8_t *b, int b_stride, uint32_t *sse) {                  \
    uint16_t fdata3[(H + 1) * W];                                       \
    uint8_t temp2[H * W];                                               \
                                                                        \
    var_filter_block2d_bil_first_pass(a, fdata3, a_stride, 1, H + 1, W, \
                                      bilinear_filters_2t[xoffset]);    \
    var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W,       \
                                       bilinear_filters_2t[yoffset]);   \
                                                                        \
Yaowu Xu's avatar
Yaowu Xu committed
166
    return aom_variance##W##x##H##_c(temp2, W, b, b_stride, sse);       \
clang-format's avatar
clang-format committed
167
  }
Johann's avatar
Johann committed
168

clang-format's avatar
clang-format committed
169
#define SUBPIX_AVG_VAR(W, H)                                            \
Yaowu Xu's avatar
Yaowu Xu committed
170
  uint32_t aom_sub_pixel_avg_variance##W##x##H##_c(                     \
clang-format's avatar
clang-format committed
171
172
173
174
175
176
177
178
179
180
181
182
      const uint8_t *a, int a_stride, int xoffset, int yoffset,         \
      const uint8_t *b, int b_stride, uint32_t *sse,                    \
      const uint8_t *second_pred) {                                     \
    uint16_t fdata3[(H + 1) * W];                                       \
    uint8_t temp2[H * W];                                               \
    DECLARE_ALIGNED(16, uint8_t, temp3[H * W]);                         \
                                                                        \
    var_filter_block2d_bil_first_pass(a, fdata3, a_stride, 1, H + 1, W, \
                                      bilinear_filters_2t[xoffset]);    \
    var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W,       \
                                       bilinear_filters_2t[yoffset]);   \
                                                                        \
Yaowu Xu's avatar
Yaowu Xu committed
183
    aom_comp_avg_pred(temp3, second_pred, W, H, temp2, W);              \
clang-format's avatar
clang-format committed
184
                                                                        \
Yaowu Xu's avatar
Yaowu Xu committed
185
    return aom_variance##W##x##H##_c(temp3, W, b, b_stride, sse);       \
clang-format's avatar
clang-format committed
186
  }
Johann's avatar
Johann committed
187

Johann's avatar
Johann committed
188
189
190
191
/* Identical to the variance call except it takes an additional parameter, sum,
 * and returns that value using pass-by-reference instead of returning
 * sse - sum^2 / w*h
 */
clang-format's avatar
clang-format committed
192
#define GET_VAR(W, H)                                                         \
Yaowu Xu's avatar
Yaowu Xu committed
193
  void aom_get##W##x##H##var_c(const uint8_t *a, int a_stride,                \
clang-format's avatar
clang-format committed
194
195
196
197
                               const uint8_t *b, int b_stride, uint32_t *sse, \
                               int *sum) {                                    \
    variance(a, a_stride, b, b_stride, W, H, sse, sum);                       \
  }
Johann's avatar
Johann committed
198
199
200
201
202

/* Identical to the variance call except it does not calculate the
 * sse - sum^2 / w*h and returns sse in addtion to modifying the passed in
 * variable.
 */
clang-format's avatar
clang-format committed
203
#define MSE(W, H)                                               \
Yaowu Xu's avatar
Yaowu Xu committed
204
  uint32_t aom_mse##W##x##H##_c(const uint8_t *a, int a_stride, \
clang-format's avatar
clang-format committed
205
206
207
208
209
210
                                const uint8_t *b, int b_stride, \
                                uint32_t *sse) {                \
    int sum;                                                    \
    variance(a, a_stride, b, b_stride, W, H, sse, &sum);        \
    return *sse;                                                \
  }
Johann's avatar
Johann committed
211

Johann's avatar
Johann committed
212
213
/* All three forms of the variance are available in the same sizes. */
#define VARIANCES(W, H) \
clang-format's avatar
clang-format committed
214
215
216
  VAR(W, H)             \
  SUBPIX_VAR(W, H)      \
  SUBPIX_AVG_VAR(W, H)
Johann's avatar
Johann committed
217

Yaowu Xu's avatar
Yaowu Xu committed
218
#if CONFIG_AV1 && CONFIG_EXT_PARTITION
219
220
221
VARIANCES(128, 128)
VARIANCES(128, 64)
VARIANCES(64, 128)
Yaowu Xu's avatar
Yaowu Xu committed
222
#endif  // CONFIG_AV1 && CONFIG_EXT_PARTITION
Johann's avatar
Johann committed
223
224
225
226
227
228
229
230
231
232
233
234
235
VARIANCES(64, 64)
VARIANCES(64, 32)
VARIANCES(32, 64)
VARIANCES(32, 32)
VARIANCES(32, 16)
VARIANCES(16, 32)
VARIANCES(16, 16)
VARIANCES(16, 8)
VARIANCES(8, 16)
VARIANCES(8, 8)
VARIANCES(8, 4)
VARIANCES(4, 8)
VARIANCES(4, 4)
236
237
VARIANCES(4, 2)
VARIANCES(2, 4)
Jingning Han's avatar
Jingning Han committed
238
VARIANCES(2, 2)
Johann's avatar
Johann committed
239
240
241
242
243
244
245
246
247

GET_VAR(16, 16)
GET_VAR(8, 8)

MSE(16, 16)
MSE(16, 8)
MSE(8, 16)
MSE(8, 8)

Yaowu Xu's avatar
Yaowu Xu committed
248
void aom_comp_avg_pred_c(uint8_t *comp_pred, const uint8_t *pred, int width,
clang-format's avatar
clang-format committed
249
                         int height, const uint8_t *ref, int ref_stride) {
Johann's avatar
Johann committed
250
251
  int i, j;

Johann's avatar
Johann committed
252
253
  for (i = 0; i < height; ++i) {
    for (j = 0; j < width; ++j) {
Johann's avatar
Johann committed
254
255
256
257
258
259
260
261
262
      const int tmp = pred[j] + ref[j];
      comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
    }
    comp_pred += width;
    pred += width;
    ref += ref_stride;
  }
}

263
// Get pred block from up-sampled reference.
Yaowu Xu's avatar
Yaowu Xu committed
264
void aom_upsampled_pred_c(uint8_t *comp_pred, int width, int height,
clang-format's avatar
clang-format committed
265
266
267
268
269
270
271
                          const uint8_t *ref, int ref_stride) {
  int i, j, k;
  int stride = ref_stride << 3;

  for (i = 0; i < height; i++) {
    for (j = 0, k = 0; j < width; j++, k += 8) {
      comp_pred[j] = ref[k];
272
    }
clang-format's avatar
clang-format committed
273
274
275
    comp_pred += width;
    ref += stride;
  }
276
277
}

Yaowu Xu's avatar
Yaowu Xu committed
278
void aom_comp_avg_upsampled_pred_c(uint8_t *comp_pred, const uint8_t *pred,
clang-format's avatar
clang-format committed
279
280
281
282
283
284
285
286
287
                                   int width, int height, const uint8_t *ref,
                                   int ref_stride) {
  int i, j;
  int stride = ref_stride << 3;

  for (i = 0; i < height; i++) {
    for (j = 0; j < width; j++) {
      const int tmp = ref[(j << 3)] + pred[j];
      comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
288
    }
clang-format's avatar
clang-format committed
289
290
291
292
    comp_pred += width;
    pred += width;
    ref += stride;
  }
293
294
}

Yaowu Xu's avatar
Yaowu Xu committed
295
#if CONFIG_AOM_HIGHBITDEPTH
clang-format's avatar
clang-format committed
296
297
298
static void highbd_variance64(const uint8_t *a8, int a_stride,
                              const uint8_t *b8, int b_stride, int w, int h,
                              uint64_t *sse, int64_t *sum) {
Johann's avatar
Johann committed
299
300
301
302
303
304
305
  int i, j;

  uint16_t *a = CONVERT_TO_SHORTPTR(a8);
  uint16_t *b = CONVERT_TO_SHORTPTR(b8);
  *sum = 0;
  *sse = 0;

Johann's avatar
Johann committed
306
307
  for (i = 0; i < h; ++i) {
    for (j = 0; j < w; ++j) {
Johann's avatar
Johann committed
308
309
310
311
312
313
314
315
316
      const int diff = a[j] - b[j];
      *sum += diff;
      *sse += diff * diff;
    }
    a += a_stride;
    b += b_stride;
  }
}

clang-format's avatar
clang-format committed
317
318
319
static void highbd_8_variance(const uint8_t *a8, int a_stride,
                              const uint8_t *b8, int b_stride, int w, int h,
                              uint32_t *sse, int *sum) {
Johann's avatar
Johann committed
320
  uint64_t sse_long = 0;
321
  int64_t sum_long = 0;
Johann's avatar
Johann committed
322
  highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
Johann's avatar
Johann committed
323
  *sse = (uint32_t)sse_long;
Johann's avatar
Johann committed
324
325
326
  *sum = (int)sum_long;
}

clang-format's avatar
clang-format committed
327
328
329
static void highbd_10_variance(const uint8_t *a8, int a_stride,
                               const uint8_t *b8, int b_stride, int w, int h,
                               uint32_t *sse, int *sum) {
Johann's avatar
Johann committed
330
  uint64_t sse_long = 0;
331
  int64_t sum_long = 0;
Johann's avatar
Johann committed
332
  highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
Johann's avatar
Johann committed
333
  *sse = (uint32_t)ROUND_POWER_OF_TWO(sse_long, 4);
Johann's avatar
Johann committed
334
335
336
  *sum = (int)ROUND_POWER_OF_TWO(sum_long, 2);
}

clang-format's avatar
clang-format committed
337
338
339
static void highbd_12_variance(const uint8_t *a8, int a_stride,
                               const uint8_t *b8, int b_stride, int w, int h,
                               uint32_t *sse, int *sum) {
Johann's avatar
Johann committed
340
  uint64_t sse_long = 0;
341
  int64_t sum_long = 0;
Johann's avatar
Johann committed
342
  highbd_variance64(a8, a_stride, b8, b_stride, w, h, &sse_long, &sum_long);
Johann's avatar
Johann committed
343
  *sse = (uint32_t)ROUND_POWER_OF_TWO(sse_long, 8);
Johann's avatar
Johann committed
344
345
346
  *sum = (int)ROUND_POWER_OF_TWO(sum_long, 4);
}

clang-format's avatar
clang-format committed
347
#define HIGHBD_VAR(W, H)                                                       \
Yaowu Xu's avatar
Yaowu Xu committed
348
  uint32_t aom_highbd_8_variance##W##x##H##_c(const uint8_t *a, int a_stride,  \
clang-format's avatar
clang-format committed
349
350
351
352
353
354
355
                                              const uint8_t *b, int b_stride,  \
                                              uint32_t *sse) {                 \
    int sum;                                                                   \
    highbd_8_variance(a, a_stride, b, b_stride, W, H, sse, &sum);              \
    return *sse - (((int64_t)sum * sum) / (W * H));                            \
  }                                                                            \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
356
  uint32_t aom_highbd_10_variance##W##x##H##_c(const uint8_t *a, int a_stride, \
clang-format's avatar
clang-format committed
357
358
359
360
361
362
363
364
365
                                               const uint8_t *b, int b_stride, \
                                               uint32_t *sse) {                \
    int sum;                                                                   \
    int64_t var;                                                               \
    highbd_10_variance(a, a_stride, b, b_stride, W, H, sse, &sum);             \
    var = (int64_t)(*sse) - (((int64_t)sum * sum) / (W * H));                  \
    return (var >= 0) ? (uint32_t)var : 0;                                     \
  }                                                                            \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
366
  uint32_t aom_highbd_12_variance##W##x##H##_c(const uint8_t *a, int a_stride, \
clang-format's avatar
clang-format committed
367
368
369
370
371
372
373
374
                                               const uint8_t *b, int b_stride, \
                                               uint32_t *sse) {                \
    int sum;                                                                   \
    int64_t var;                                                               \
    highbd_12_variance(a, a_stride, b, b_stride, W, H, sse, &sum);             \
    var = (int64_t)(*sse) - (((int64_t)sum * sum) / (W * H));                  \
    return (var >= 0) ? (uint32_t)var : 0;                                     \
  }
Johann's avatar
Johann committed
375

clang-format's avatar
clang-format committed
376
#define HIGHBD_GET_VAR(S)                                                    \
Yaowu Xu's avatar
Yaowu Xu committed
377
  void aom_highbd_8_get##S##x##S##var_c(const uint8_t *src, int src_stride,  \
clang-format's avatar
clang-format committed
378
379
380
381
382
                                        const uint8_t *ref, int ref_stride,  \
                                        uint32_t *sse, int *sum) {           \
    highbd_8_variance(src, src_stride, ref, ref_stride, S, S, sse, sum);     \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
383
  void aom_highbd_10_get##S##x##S##var_c(const uint8_t *src, int src_stride, \
clang-format's avatar
clang-format committed
384
385
386
387
388
                                         const uint8_t *ref, int ref_stride, \
                                         uint32_t *sse, int *sum) {          \
    highbd_10_variance(src, src_stride, ref, ref_stride, S, S, sse, sum);    \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
389
  void aom_highbd_12_get##S##x##S##var_c(const uint8_t *src, int src_stride, \
clang-format's avatar
clang-format committed
390
391
392
393
                                         const uint8_t *ref, int ref_stride, \
                                         uint32_t *sse, int *sum) {          \
    highbd_12_variance(src, src_stride, ref, ref_stride, S, S, sse, sum);    \
  }
Johann's avatar
Johann committed
394

clang-format's avatar
clang-format committed
395
#define HIGHBD_MSE(W, H)                                                      \
Yaowu Xu's avatar
Yaowu Xu committed
396
  uint32_t aom_highbd_8_mse##W##x##H##_c(const uint8_t *src, int src_stride,  \
clang-format's avatar
clang-format committed
397
398
399
400
401
402
403
                                         const uint8_t *ref, int ref_stride,  \
                                         uint32_t *sse) {                     \
    int sum;                                                                  \
    highbd_8_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum);     \
    return *sse;                                                              \
  }                                                                           \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
404
  uint32_t aom_highbd_10_mse##W##x##H##_c(const uint8_t *src, int src_stride, \
clang-format's avatar
clang-format committed
405
406
407
408
409
410
411
                                          const uint8_t *ref, int ref_stride, \
                                          uint32_t *sse) {                    \
    int sum;                                                                  \
    highbd_10_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum);    \
    return *sse;                                                              \
  }                                                                           \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
412
  uint32_t aom_highbd_12_mse##W##x##H##_c(const uint8_t *src, int src_stride, \
clang-format's avatar
clang-format committed
413
414
415
416
417
418
                                          const uint8_t *ref, int ref_stride, \
                                          uint32_t *sse) {                    \
    int sum;                                                                  \
    highbd_12_variance(src, src_stride, ref, ref_stride, W, H, sse, &sum);    \
    return *sse;                                                              \
  }
Johann's avatar
Johann committed
419

Yaowu Xu's avatar
Yaowu Xu committed
420
void aom_highbd_var_filter_block2d_bil_first_pass(
clang-format's avatar
clang-format committed
421
422
423
    const uint8_t *src_ptr8, uint16_t *output_ptr,
    unsigned int src_pixels_per_line, int pixel_step,
    unsigned int output_height, unsigned int output_width,
Johann's avatar
Johann committed
424
425
426
427
428
    const uint8_t *filter) {
  unsigned int i, j;
  uint16_t *src_ptr = CONVERT_TO_SHORTPTR(src_ptr8);
  for (i = 0; i < output_height; ++i) {
    for (j = 0; j < output_width; ++j) {
clang-format's avatar
clang-format committed
429
430
431
      output_ptr[j] = ROUND_POWER_OF_TWO(
          (int)src_ptr[0] * filter[0] + (int)src_ptr[pixel_step] * filter[1],
          FILTER_BITS);
Johann's avatar
Johann committed
432
433
434
435
436
437
438
439
440
441

      ++src_ptr;
    }

    // Next row...
    src_ptr += src_pixels_per_line - output_width;
    output_ptr += output_width;
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
442
void aom_highbd_var_filter_block2d_bil_second_pass(
clang-format's avatar
clang-format committed
443
444
445
    const uint16_t *src_ptr, uint16_t *output_ptr,
    unsigned int src_pixels_per_line, unsigned int pixel_step,
    unsigned int output_height, unsigned int output_width,
Johann's avatar
Johann committed
446
    const uint8_t *filter) {
clang-format's avatar
clang-format committed
447
  unsigned int i, j;
Johann's avatar
Johann committed
448
449
450

  for (i = 0; i < output_height; ++i) {
    for (j = 0; j < output_width; ++j) {
clang-format's avatar
clang-format committed
451
452
453
      output_ptr[j] = ROUND_POWER_OF_TWO(
          (int)src_ptr[0] * filter[0] + (int)src_ptr[pixel_step] * filter[1],
          FILTER_BITS);
Johann's avatar
Johann committed
454
455
456
457
458
459
460
461
      ++src_ptr;
    }

    src_ptr += src_pixels_per_line - output_width;
    output_ptr += output_width;
  }
}

clang-format's avatar
clang-format committed
462
#define HIGHBD_SUBPIX_VAR(W, H)                                              \
Yaowu Xu's avatar
Yaowu Xu committed
463
  uint32_t aom_highbd_8_sub_pixel_variance##W##x##H##_c(                     \
clang-format's avatar
clang-format committed
464
465
466
467
468
      const uint8_t *src, int src_stride, int xoffset, int yoffset,          \
      const uint8_t *dst, int dst_stride, uint32_t *sse) {                   \
    uint16_t fdata3[(H + 1) * W];                                            \
    uint16_t temp2[H * W];                                                   \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
469
    aom_highbd_var_filter_block2d_bil_first_pass(                            \
clang-format's avatar
clang-format committed
470
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
Yaowu Xu's avatar
Yaowu Xu committed
471
    aom_highbd_var_filter_block2d_bil_second_pass(                           \
clang-format's avatar
clang-format committed
472
473
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);            \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
474
    return aom_highbd_8_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W,  \
clang-format's avatar
clang-format committed
475
476
477
                                              dst, dst_stride, sse);         \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
478
  uint32_t aom_highbd_10_sub_pixel_variance##W##x##H##_c(                    \
clang-format's avatar
clang-format committed
479
480
481
482
483
      const uint8_t *src, int src_stride, int xoffset, int yoffset,          \
      const uint8_t *dst, int dst_stride, uint32_t *sse) {                   \
    uint16_t fdata3[(H + 1) * W];                                            \
    uint16_t temp2[H * W];                                                   \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
484
    aom_highbd_var_filter_block2d_bil_first_pass(                            \
clang-format's avatar
clang-format committed
485
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
Yaowu Xu's avatar
Yaowu Xu committed
486
    aom_highbd_var_filter_block2d_bil_second_pass(                           \
clang-format's avatar
clang-format committed
487
488
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);            \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
489
    return aom_highbd_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, \
clang-format's avatar
clang-format committed
490
491
492
                                               dst, dst_stride, sse);        \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
493
  uint32_t aom_highbd_12_sub_pixel_variance##W##x##H##_c(                    \
clang-format's avatar
clang-format committed
494
495
496
497
498
      const uint8_t *src, int src_stride, int xoffset, int yoffset,          \
      const uint8_t *dst, int dst_stride, uint32_t *sse) {                   \
    uint16_t fdata3[(H + 1) * W];                                            \
    uint16_t temp2[H * W];                                                   \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
499
    aom_highbd_var_filter_block2d_bil_first_pass(                            \
clang-format's avatar
clang-format committed
500
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
Yaowu Xu's avatar
Yaowu Xu committed
501
    aom_highbd_var_filter_block2d_bil_second_pass(                           \
clang-format's avatar
clang-format committed
502
503
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);            \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
504
    return aom_highbd_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, \
clang-format's avatar
clang-format committed
505
506
                                               dst, dst_stride, sse);        \
  }
Johann's avatar
Johann committed
507

clang-format's avatar
clang-format committed
508
#define HIGHBD_SUBPIX_AVG_VAR(W, H)                                          \
Yaowu Xu's avatar
Yaowu Xu committed
509
  uint32_t aom_highbd_8_sub_pixel_avg_variance##W##x##H##_c(                 \
clang-format's avatar
clang-format committed
510
511
512
513
514
515
516
      const uint8_t *src, int src_stride, int xoffset, int yoffset,          \
      const uint8_t *dst, int dst_stride, uint32_t *sse,                     \
      const uint8_t *second_pred) {                                          \
    uint16_t fdata3[(H + 1) * W];                                            \
    uint16_t temp2[H * W];                                                   \
    DECLARE_ALIGNED(16, uint16_t, temp3[H * W]);                             \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
517
    aom_highbd_var_filter_block2d_bil_first_pass(                            \
clang-format's avatar
clang-format committed
518
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
Yaowu Xu's avatar
Yaowu Xu committed
519
    aom_highbd_var_filter_block2d_bil_second_pass(                           \
clang-format's avatar
clang-format committed
520
521
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);            \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
522
    aom_highbd_comp_avg_pred_c(temp3, second_pred, W, H,                     \
clang-format's avatar
clang-format committed
523
524
                               CONVERT_TO_BYTEPTR(temp2), W);                \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
525
    return aom_highbd_8_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W,  \
clang-format's avatar
clang-format committed
526
527
528
                                              dst, dst_stride, sse);         \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
529
  uint32_t aom_highbd_10_sub_pixel_avg_variance##W##x##H##_c(                \
clang-format's avatar
clang-format committed
530
531
532
533
534
535
536
      const uint8_t *src, int src_stride, int xoffset, int yoffset,          \
      const uint8_t *dst, int dst_stride, uint32_t *sse,                     \
      const uint8_t *second_pred) {                                          \
    uint16_t fdata3[(H + 1) * W];                                            \
    uint16_t temp2[H * W];                                                   \
    DECLARE_ALIGNED(16, uint16_t, temp3[H * W]);                             \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
537
    aom_highbd_var_filter_block2d_bil_first_pass(                            \
clang-format's avatar
clang-format committed
538
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
Yaowu Xu's avatar
Yaowu Xu committed
539
    aom_highbd_var_filter_block2d_bil_second_pass(                           \
clang-format's avatar
clang-format committed
540
541
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);            \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
542
    aom_highbd_comp_avg_pred_c(temp3, second_pred, W, H,                     \
clang-format's avatar
clang-format committed
543
544
                               CONVERT_TO_BYTEPTR(temp2), W);                \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
545
    return aom_highbd_10_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
clang-format's avatar
clang-format committed
546
547
548
                                               dst, dst_stride, sse);        \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
549
  uint32_t aom_highbd_12_sub_pixel_avg_variance##W##x##H##_c(                \
clang-format's avatar
clang-format committed
550
551
552
553
554
555
556
      const uint8_t *src, int src_stride, int xoffset, int yoffset,          \
      const uint8_t *dst, int dst_stride, uint32_t *sse,                     \
      const uint8_t *second_pred) {                                          \
    uint16_t fdata3[(H + 1) * W];                                            \
    uint16_t temp2[H * W];                                                   \
    DECLARE_ALIGNED(16, uint16_t, temp3[H * W]);                             \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
557
    aom_highbd_var_filter_block2d_bil_first_pass(                            \
clang-format's avatar
clang-format committed
558
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]); \
Yaowu Xu's avatar
Yaowu Xu committed
559
    aom_highbd_var_filter_block2d_bil_second_pass(                           \
clang-format's avatar
clang-format committed
560
561
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);            \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
562
    aom_highbd_comp_avg_pred_c(temp3, second_pred, W, H,                     \
clang-format's avatar
clang-format committed
563
564
                               CONVERT_TO_BYTEPTR(temp2), W);                \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
565
    return aom_highbd_12_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp3), W, \
clang-format's avatar
clang-format committed
566
567
                                               dst, dst_stride, sse);        \
  }
Johann's avatar
Johann committed
568
569
570

/* All three forms of the variance are available in the same sizes. */
#define HIGHBD_VARIANCES(W, H) \
clang-format's avatar
clang-format committed
571
572
573
  HIGHBD_VAR(W, H)             \
  HIGHBD_SUBPIX_VAR(W, H)      \
  HIGHBD_SUBPIX_AVG_VAR(W, H)
Johann's avatar
Johann committed
574

Yaowu Xu's avatar
Yaowu Xu committed
575
#if CONFIG_AV1 && CONFIG_EXT_PARTITION
576
577
578
HIGHBD_VARIANCES(128, 128)
HIGHBD_VARIANCES(128, 64)
HIGHBD_VARIANCES(64, 128)
Yaowu Xu's avatar
Yaowu Xu committed
579
#endif  // CONFIG_AV1 && CONFIG_EXT_PARTITION
Johann's avatar
Johann committed
580
581
582
583
584
585
586
587
588
589
590
591
592
HIGHBD_VARIANCES(64, 64)
HIGHBD_VARIANCES(64, 32)
HIGHBD_VARIANCES(32, 64)
HIGHBD_VARIANCES(32, 32)
HIGHBD_VARIANCES(32, 16)
HIGHBD_VARIANCES(16, 32)
HIGHBD_VARIANCES(16, 16)
HIGHBD_VARIANCES(16, 8)
HIGHBD_VARIANCES(8, 16)
HIGHBD_VARIANCES(8, 8)
HIGHBD_VARIANCES(8, 4)
HIGHBD_VARIANCES(4, 8)
HIGHBD_VARIANCES(4, 4)
593
594
595
HIGHBD_VARIANCES(4, 2)
HIGHBD_VARIANCES(2, 4)
HIGHBD_VARIANCES(2, 2)
Johann's avatar
Johann committed
596

Johann's avatar
Johann committed
597
598
599
600
601
602
603
604
HIGHBD_GET_VAR(8)
HIGHBD_GET_VAR(16)

HIGHBD_MSE(16, 16)
HIGHBD_MSE(16, 8)
HIGHBD_MSE(8, 16)
HIGHBD_MSE(8, 8)

Yaowu Xu's avatar
Yaowu Xu committed
605
void aom_highbd_comp_avg_pred_c(uint16_t *comp_pred, const uint8_t *pred8,
606
607
                                int width, int height, const uint8_t *ref8,
                                int ref_stride) {
Johann's avatar
Johann committed
608
609
610
  int i, j;
  uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
  uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
Johann's avatar
Johann committed
611
612
  for (i = 0; i < height; ++i) {
    for (j = 0; j < width; ++j) {
Johann's avatar
Johann committed
613
614
615
616
617
618
619
620
      const int tmp = pred[j] + ref[j];
      comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
    }
    comp_pred += width;
    pred += width;
    ref += ref_stride;
  }
}
621

Yaowu Xu's avatar
Yaowu Xu committed
622
void aom_highbd_upsampled_pred_c(uint16_t *comp_pred, int width, int height,
clang-format's avatar
clang-format committed
623
                                 const uint8_t *ref8, int ref_stride) {
624
625
626
627
628
629
630
631
632
633
634
635
636
  int i, j;
  int stride = ref_stride << 3;

  uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
  for (i = 0; i < height; ++i) {
    for (j = 0; j < width; ++j) {
      comp_pred[j] = ref[(j << 3)];
    }
    comp_pred += width;
    ref += stride;
  }
}

Yaowu Xu's avatar
Yaowu Xu committed
637
void aom_highbd_comp_avg_upsampled_pred_c(uint16_t *comp_pred,
clang-format's avatar
clang-format committed
638
639
                                          const uint8_t *pred8, int width,
                                          int height, const uint8_t *ref8,
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
                                          int ref_stride) {
  int i, j;
  int stride = ref_stride << 3;

  uint16_t *pred = CONVERT_TO_SHORTPTR(pred8);
  uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
  for (i = 0; i < height; ++i) {
    for (j = 0; j < width; ++j) {
      const int tmp = pred[j] + ref[(j << 3)];
      comp_pred[j] = ROUND_POWER_OF_TWO(tmp, 1);
    }
    comp_pred += width;
    pred += width;
    ref += stride;
  }
}
Yaowu Xu's avatar
Yaowu Xu committed
656
#endif  // CONFIG_AOM_HIGHBITDEPTH
657

Yaowu Xu's avatar
Yaowu Xu committed
658
#if CONFIG_AV1 && CONFIG_EXT_INTER
clang-format's avatar
clang-format committed
659
660
661
void masked_variance(const uint8_t *a, int a_stride, const uint8_t *b,
                     int b_stride, const uint8_t *m, int m_stride, int w, int h,
                     unsigned int *sse, int *sum) {
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
  int i, j;

  int64_t sum64 = 0;
  uint64_t sse64 = 0;

  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      const int diff = (a[j] - b[j]) * (m[j]);
      sum64 += diff;
      sse64 += diff * diff;
    }

    a += a_stride;
    b += b_stride;
    m += m_stride;
  }
clang-format's avatar
clang-format committed
678
  sum64 = (sum64 >= 0) ? sum64 : -sum64;
Yaowu Xu's avatar
Yaowu Xu committed
679
680
  *sum = (int)ROUND_POWER_OF_TWO(sum64, 6);
  *sse = (uint32_t)ROUND_POWER_OF_TWO(sse64, 12);
681
682
}

clang-format's avatar
clang-format committed
683
#define MASK_VAR(W, H)                                                       \
Yaowu Xu's avatar
Yaowu Xu committed
684
  unsigned int aom_masked_variance##W##x##H##_c(                             \
clang-format's avatar
clang-format committed
685
686
687
688
689
690
      const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,        \
      const uint8_t *m, int m_stride, unsigned int *sse) {                   \
    int sum;                                                                 \
    masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, sse, &sum); \
    return *sse - (((int64_t)sum * sum) / (W * H));                          \
  }
691

clang-format's avatar
clang-format committed
692
#define MASK_SUBPIX_VAR(W, H)                                                 \
Yaowu Xu's avatar
Yaowu Xu committed
693
  unsigned int aom_masked_sub_pixel_variance##W##x##H##_c(                    \
clang-format's avatar
clang-format committed
694
695
696
697
698
699
700
701
702
703
704
      const uint8_t *src, int src_stride, int xoffset, int yoffset,           \
      const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
      unsigned int *sse) {                                                    \
    uint16_t fdata3[(H + 1) * W];                                             \
    uint8_t temp2[H * W];                                                     \
                                                                              \
    var_filter_block2d_bil_first_pass(src, fdata3, src_stride, 1, H + 1, W,   \
                                      bilinear_filters_2t[xoffset]);          \
    var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W,             \
                                       bilinear_filters_2t[yoffset]);         \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
705
    return aom_masked_variance##W##x##H##_c(temp2, W, dst, dst_stride, msk,   \
clang-format's avatar
clang-format committed
706
707
                                            msk_stride, sse);                 \
  }
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758

MASK_VAR(4, 4)
MASK_SUBPIX_VAR(4, 4)

MASK_VAR(4, 8)
MASK_SUBPIX_VAR(4, 8)

MASK_VAR(8, 4)
MASK_SUBPIX_VAR(8, 4)

MASK_VAR(8, 8)
MASK_SUBPIX_VAR(8, 8)

MASK_VAR(8, 16)
MASK_SUBPIX_VAR(8, 16)

MASK_VAR(16, 8)
MASK_SUBPIX_VAR(16, 8)

MASK_VAR(16, 16)
MASK_SUBPIX_VAR(16, 16)

MASK_VAR(16, 32)
MASK_SUBPIX_VAR(16, 32)

MASK_VAR(32, 16)
MASK_SUBPIX_VAR(32, 16)

MASK_VAR(32, 32)
MASK_SUBPIX_VAR(32, 32)

MASK_VAR(32, 64)
MASK_SUBPIX_VAR(32, 64)

MASK_VAR(64, 32)
MASK_SUBPIX_VAR(64, 32)

MASK_VAR(64, 64)
MASK_SUBPIX_VAR(64, 64)

#if CONFIG_EXT_PARTITION
MASK_VAR(64, 128)
MASK_SUBPIX_VAR(64, 128)

MASK_VAR(128, 64)
MASK_SUBPIX_VAR(128, 64)

MASK_VAR(128, 128)
MASK_SUBPIX_VAR(128, 128)
#endif  // CONFIG_EXT_PARTITION

Yaowu Xu's avatar
Yaowu Xu committed
759
#if CONFIG_AOM_HIGHBITDEPTH
clang-format's avatar
clang-format committed
760
761
762
763
void highbd_masked_variance64(const uint8_t *a8, int a_stride,
                              const uint8_t *b8, int b_stride, const uint8_t *m,
                              int m_stride, int w, int h, uint64_t *sse,
                              int64_t *sum) {
764
765
766
767
  int i, j;
  uint16_t *a = CONVERT_TO_SHORTPTR(a8);
  uint16_t *b = CONVERT_TO_SHORTPTR(b8);

768
769
  *sum = 0;
  *sse = 0;
770
771
772
773

  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      const int diff = (a[j] - b[j]) * (m[j]);
774
775
      *sum += (int64_t)diff;
      *sse += (int64_t)diff * diff;
776
777
778
779
780
781
    }

    a += a_stride;
    b += b_stride;
    m += m_stride;
  }
clang-format's avatar
clang-format committed
782
  *sum = (*sum >= 0) ? *sum : -*sum;
783
784
  *sum = ROUND_POWER_OF_TWO(*sum, 6);
  *sse = ROUND_POWER_OF_TWO(*sse, 12);
785
786
}

clang-format's avatar
clang-format committed
787
788
789
void highbd_masked_variance(const uint8_t *a8, int a_stride, const uint8_t *b8,
                            int b_stride, const uint8_t *m, int m_stride, int w,
                            int h, unsigned int *sse, int *sum) {
790
  int64_t sum64;
791
  uint64_t sse64;
clang-format's avatar
clang-format committed
792
793
  highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
                           &sse64, &sum64);
794
  *sum = (int)sum64;
795
796
797
  *sse = (unsigned int)sse64;
}

clang-format's avatar
clang-format committed
798
799
800
void highbd_10_masked_variance(const uint8_t *a8, int a_stride,
                               const uint8_t *b8, int b_stride,
                               const uint8_t *m, int m_stride, int w, int h,
801
                               unsigned int *sse, int *sum) {
802
  int64_t sum64;
803
  uint64_t sse64;
clang-format's avatar
clang-format committed
804
805
  highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
                           &sse64, &sum64);
806
  *sum = (int)ROUND_POWER_OF_TWO(sum64, 2);
807
808
809
  *sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 4);
}

clang-format's avatar
clang-format committed
810
811
812
void highbd_12_masked_variance(const uint8_t *a8, int a_stride,
                               const uint8_t *b8, int b_stride,
                               const uint8_t *m, int m_stride, int w, int h,
813
                               unsigned int *sse, int *sum) {
814
  int64_t sum64;
815
  uint64_t sse64;
clang-format's avatar
clang-format committed
816
817
  highbd_masked_variance64(a8, a_stride, b8, b_stride, m, m_stride, w, h,
                           &sse64, &sum64);
818
  *sum = (int)ROUND_POWER_OF_TWO(sum64, 4);
819
820
821
  *sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 8);
}

clang-format's avatar
clang-format committed
822
#define HIGHBD_MASK_VAR(W, H)                                                \
Yaowu Xu's avatar
Yaowu Xu committed
823
  unsigned int aom_highbd_masked_variance##W##x##H##_c(                      \
clang-format's avatar
clang-format committed
824
825
826
827
828
829
830
831
      const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,        \
      const uint8_t *m, int m_stride, unsigned int *sse) {                   \
    int sum;                                                                 \
    highbd_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H, sse, \
                           &sum);                                            \
    return *sse - (((int64_t)sum * sum) / (W * H));                          \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
832
  unsigned int aom_highbd_10_masked_variance##W##x##H##_c(                   \
clang-format's avatar
clang-format committed
833
834
835
836
837
838
839
840
      const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,        \
      const uint8_t *m, int m_stride, unsigned int *sse) {                   \
    int sum;                                                                 \
    highbd_10_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H,   \
                              sse, &sum);                                    \
    return *sse - (((int64_t)sum * sum) / (W * H));                          \
  }                                                                          \
                                                                             \
Yaowu Xu's avatar
Yaowu Xu committed
841
  unsigned int aom_highbd_12_masked_variance##W##x##H##_c(                   \
clang-format's avatar
clang-format committed
842
843
844
845
846
847
848
      const uint8_t *a, int a_stride, const uint8_t *b, int b_stride,        \
      const uint8_t *m, int m_stride, unsigned int *sse) {                   \
    int sum;                                                                 \
    highbd_12_masked_variance(a, a_stride, b, b_stride, m, m_stride, W, H,   \
                              sse, &sum);                                    \
    return *sse - (((int64_t)sum * sum) / (W * H));                          \
  }
849

clang-format's avatar
clang-format committed
850
#define HIGHBD_MASK_SUBPIX_VAR(W, H)                                          \
Yaowu Xu's avatar
Yaowu Xu committed
851
  unsigned int aom_highbd_masked_sub_pixel_variance##W##x##H##_c(             \
clang-format's avatar
clang-format committed
852
853
854
855
856
857
      const uint8_t *src, int src_stride, int xoffset, int yoffset,           \
      const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
      unsigned int *sse) {                                                    \
    uint16_t fdata3[(H + 1) * W];                                             \
    uint16_t temp2[H * W];                                                    \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
858
    aom_highbd_var_filter_block2d_bil_first_pass(                             \
clang-format's avatar
clang-format committed
859
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]);  \
Yaowu Xu's avatar
Yaowu Xu committed
860
    aom_highbd_var_filter_block2d_bil_second_pass(                            \
clang-format's avatar
clang-format committed
861
862
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);             \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
863
    return aom_highbd_masked_variance##W##x##H##_c(                           \
clang-format's avatar
clang-format committed
864
865
866
        CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
  }                                                                           \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
867
  unsigned int aom_highbd_10_masked_sub_pixel_variance##W##x##H##_c(          \
clang-format's avatar
clang-format committed
868
869
870
871
872
873
      const uint8_t *src, int src_stride, int xoffset, int yoffset,           \
      const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
      unsigned int *sse) {                                                    \
    uint16_t fdata3[(H + 1) * W];                                             \
    uint16_t temp2[H * W];                                                    \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
874
    aom_highbd_var_filter_block2d_bil_first_pass(                             \
clang-format's avatar
clang-format committed
875
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]);  \
Yaowu Xu's avatar
Yaowu Xu committed
876
    aom_highbd_var_filter_block2d_bil_second_pass(                            \
clang-format's avatar
clang-format committed
877
878
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);             \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
879
    return aom_highbd_10_masked_variance##W##x##H##_c(                        \
clang-format's avatar
clang-format committed
880
881
882
        CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
  }                                                                           \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
883
  unsigned int aom_highbd_12_masked_sub_pixel_variance##W##x##H##_c(          \
clang-format's avatar
clang-format committed
884
885
886
887
888
889
      const uint8_t *src, int src_stride, int xoffset, int yoffset,           \
      const uint8_t *dst, int dst_stride, const uint8_t *msk, int msk_stride, \
      unsigned int *sse) {                                                    \
    uint16_t fdata3[(H + 1) * W];                                             \
    uint16_t temp2[H * W];                                                    \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
890
    aom_highbd_var_filter_block2d_bil_first_pass(                             \
clang-format's avatar
clang-format committed
891
        src, fdata3, src_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]);  \
Yaowu Xu's avatar
Yaowu Xu committed
892
    aom_highbd_var_filter_block2d_bil_second_pass(                            \
clang-format's avatar
clang-format committed
893
894
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);             \
                                                                              \
Yaowu Xu's avatar
Yaowu Xu committed
895
    return aom_highbd_12_masked_variance##W##x##H##_c(                        \
clang-format's avatar
clang-format committed
896
897
        CONVERT_TO_BYTEPTR(temp2), W, dst, dst_stride, msk, msk_stride, sse); \
  }
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947

HIGHBD_MASK_VAR(4, 4)
HIGHBD_MASK_SUBPIX_VAR(4, 4)

HIGHBD_MASK_VAR(4, 8)
HIGHBD_MASK_SUBPIX_VAR(4, 8)

HIGHBD_MASK_VAR(8, 4)
HIGHBD_MASK_SUBPIX_VAR(8, 4)

HIGHBD_MASK_VAR(8, 8)
HIGHBD_MASK_SUBPIX_VAR(8, 8)

HIGHBD_MASK_VAR(8, 16)
HIGHBD_MASK_SUBPIX_VAR(8, 16)

HIGHBD_MASK_VAR(16, 8)
HIGHBD_MASK_SUBPIX_VAR(16, 8)

HIGHBD_MASK_VAR(16, 16)
HIGHBD_MASK_SUBPIX_VAR(16, 16)

HIGHBD_MASK_VAR(16, 32)
HIGHBD_MASK_SUBPIX_VAR(16, 32)

HIGHBD_MASK_VAR(32, 16)
HIGHBD_MASK_SUBPIX_VAR(32, 16)

HIGHBD_MASK_VAR(32, 32)
HIGHBD_MASK_SUBPIX_VAR(32, 32)

HIGHBD_MASK_VAR(32, 64)
HIGHBD_MASK_SUBPIX_VAR(32, 64)

HIGHBD_MASK_VAR(64, 32)
HIGHBD_MASK_SUBPIX_VAR(64, 32)

HIGHBD_MASK_VAR(64, 64)
HIGHBD_MASK_SUBPIX_VAR(64, 64)

#if CONFIG_EXT_PARTITION
HIGHBD_MASK_VAR(64, 128)
HIGHBD_MASK_SUBPIX_VAR(64, 128)

HIGHBD_MASK_VAR(128, 64)
HIGHBD_MASK_SUBPIX_VAR(128, 64)

HIGHBD_MASK_VAR(128, 128)
HIGHBD_MASK_SUBPIX_VAR(128, 128)
#endif  // CONFIG_EXT_PARTITION
Yaowu Xu's avatar
Yaowu Xu committed
948
949
#endif  // CONFIG_AOM_HIGHBITDEPTH
#endif  // CONFIG_AV1 && CONFIG_EXT_INTER
950

Yue Chen's avatar
Yue Chen committed
951
#if CONFIG_AV1 && CONFIG_MOTION_VAR
clang-format's avatar
clang-format committed
952
static INLINE void obmc_variance(const uint8_t *pre, int pre_stride,
953
954
                                 const int32_t *wsrc, const int32_t *mask,
                                 int w, int h, unsigned int *sse, int *sum) {
955
956
957
958
959
960
961
  int i, j;

  *sse = 0;
  *sum = 0;

  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
962
      int diff = ROUND_POWER_OF_TWO_SIGNED(wsrc[j] - pre[j] * mask[j], 12);
963
964
965
966
      *sum += diff;
      *sse += diff * diff;
    }

967
968
969
    pre += pre_stride;
    wsrc += w;
    mask += w;
970
971
972
  }
}

clang-format's avatar
clang-format committed
973
#define OBMC_VAR(W, H)                                           \
Yaowu Xu's avatar
Yaowu Xu committed
974
  unsigned int aom_obmc_variance##W##x##H##_c(                   \
clang-format's avatar
clang-format committed
975
976
977
978
979
980
      const uint8_t *pre, int pre_stride, const int32_t *wsrc,   \
      const int32_t *mask, unsigned int *sse) {                  \
    int sum;                                                     \
    obmc_variance(pre, pre_stride, wsrc, mask, W, H, sse, &sum); \
    return *sse - (((int64_t)sum * sum) / (W * H));              \
  }
981

clang-format's avatar
clang-format committed
982
#define OBMC_SUBPIX_VAR(W, H)                                               \
Yaowu Xu's avatar
Yaowu Xu committed
983
  unsigned int aom_obmc_sub_pixel_variance##W##x##H##_c(                    \
clang-format's avatar
clang-format committed
984
985
986
987
988
989
990
991
992
993
      const uint8_t *pre, int pre_stride, int xoffset, int yoffset,         \
      const int32_t *wsrc, const int32_t *mask, unsigned int *sse) {        \
    uint16_t fdata3[(H + 1) * W];                                           \
    uint8_t temp2[H * W];                                                   \
                                                                            \
    var_filter_block2d_bil_first_pass(pre, fdata3, pre_stride, 1, H + 1, W, \
                                      bilinear_filters_2t[xoffset]);        \
    var_filter_block2d_bil_second_pass(fdata3, temp2, W, W, H, W,           \
                                       bilinear_filters_2t[yoffset]);       \
                                                                            \
Yaowu Xu's avatar
Yaowu Xu committed
994
    return aom_obmc_variance##W##x##H##_c(temp2, W, wsrc, mask, sse);       \
clang-format's avatar
clang-format committed
995
  }
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046

OBMC_VAR(4, 4)
OBMC_SUBPIX_VAR(4, 4)

OBMC_VAR(4, 8)
OBMC_SUBPIX_VAR(4, 8)

OBMC_VAR(8, 4)
OBMC_SUBPIX_VAR(8, 4)

OBMC_VAR(8, 8)
OBMC_SUBPIX_VAR(8, 8)

OBMC_VAR(8, 16)
OBMC_SUBPIX_VAR(8, 16)

OBMC_VAR(16, 8)
OBMC_SUBPIX_VAR(16, 8)

OBMC_VAR(16, 16)
OBMC_SUBPIX_VAR(16, 16)

OBMC_VAR(16, 32)
OBMC_SUBPIX_VAR(16, 32)

OBMC_VAR(32, 16)
OBMC_SUBPIX_VAR(32, 16)

OBMC_VAR(32, 32)
OBMC_SUBPIX_VAR(32, 32)

OBMC_VAR(32, 64)
OBMC_SUBPIX_VAR(32, 64)

OBMC_VAR(64, 32)
OBMC_SUBPIX_VAR(64, 32)

OBMC_VAR(64, 64)
OBMC_SUBPIX_VAR(64, 64)

#if CONFIG_EXT_PARTITION
OBMC_VAR(64, 128)
OBMC_SUBPIX_VAR(64, 128)

OBMC_VAR(128, 64)
OBMC_SUBPIX_VAR(128, 64)

OBMC_VAR(128, 128)
OBMC_SUBPIX_VAR(128, 128)
#endif  // CONFIG_EXT_PARTITION

Yaowu Xu's avatar
Yaowu Xu committed
1047
#if CONFIG_AOM_HIGHBITDEPTH
1048
1049
static INLINE void highbd_obmc_variance64(const uint8_t *pre8, int pre_stride,
                                          const int32_t *wsrc,
clang-format's avatar
clang-format committed
1050
                                          const int32_t *mask, int w, int h,
1051
                                          uint64_t *sse, int64_t *sum) {
1052
  int i, j;
1053
  uint16_t *pre = CONVERT_TO_SHORTPTR(pre8);
1054
1055
1056
1057
1058
1059

  *sse = 0;
  *sum = 0;

  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
1060
      int diff = ROUND_POWER_OF_TWO_SIGNED(wsrc[j] - pre[j] * mask[j], 12);
1061
1062
1063
1064
      *sum += diff;
      *sse += diff * diff;
    }

1065
1066
1067
    pre += pre_stride;
    wsrc += w;
    mask += w;
1068
1069
1070
  }
}

1071
1072
static INLINE void highbd_obmc_variance(const uint8_t *pre8, int pre_stride,
                                        const int32_t *wsrc,
clang-format's avatar
clang-format committed
1073
                                        const int32_t *mask, int w, int h,
1074
                                        unsigned int *sse, int *sum) {
1075
1076
  int64_t sum64;
  uint64_t sse64;
1077
  highbd_obmc_variance64(pre8, pre_stride, wsrc, mask, w, h, &sse64, &sum64);
1078
1079
1080
1081
  *sum = (int)sum64;
  *sse = (unsigned int)sse64;
}

clang-format's avatar
clang-format committed
1082
static INLINE void highbd_10_obmc_variance(const uint8_t *pre8, int pre_stride,
1083
                                           const int32_t *wsrc,
clang-format's avatar
clang-format committed
1084
                                           const int32_t *mask, int w, int h,
1085
                                           unsigned int *sse, int *sum) {
1086
1087
  int64_t sum64;
  uint64_t sse64;
1088
  highbd_obmc_variance64(pre8, pre_stride, wsrc, mask, w, h, &sse64, &sum64);
1089
1090
1091
1092
  *sum = (int)ROUND_POWER_OF_TWO(sum64, 2);
  *sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 4);
}

clang-format's avatar
clang-format committed
1093
static INLINE void highbd_12_obmc_variance(const uint8_t *pre8, int pre_stride,
1094
                                           const int32_t *wsrc,
clang-format's avatar
clang-format committed
1095
                                           const int32_t *mask, int w, int h,
1096
                                           unsigned int *sse, int *sum) {
1097
1098
  int64_t sum64;
  uint64_t sse64;
1099
  highbd_obmc_variance64(pre8, pre_stride, wsrc, mask, w, h, &sse64, &sum64);
1100
1101
1102
1103
  *sum = (int)ROUND_POWER_OF_TWO(sum64, 4);
  *sse = (unsigned int)ROUND_POWER_OF_TWO(sse64, 8);
}

clang-format's avatar
clang-format committed
1104
#define HIGHBD_OBMC_VAR(W, H)                                              \
Yaowu Xu's avatar
Yaowu Xu committed
1105
  unsigned int aom_highbd_obmc_variance##W##x##H##_c(                      \
clang-format's avatar
clang-format committed
1106
1107
1108
1109
1110
1111
1112
      const uint8_t *pre, int pre_stride, const int32_t *wsrc,             \
      const int32_t *mask, unsigned int *sse) {                            \
    int sum;                                                               \
    highbd_obmc_variance(pre, pre_stride, wsrc, mask, W, H, sse, &sum);    \
    return *sse - (((int64_t)sum * sum) / (W * H));                        \
  }                                                                        \
                                                                           \
Yaowu Xu's avatar
Yaowu Xu committed
1113
  unsigned int aom_highbd_10_obmc_variance##W##x##H##_c(                   \
clang-format's avatar
clang-format committed
1114
1115
1116
1117
1118
1119
1120
      const uint8_t *pre, int pre_stride, const int32_t *wsrc,             \
      const int32_t *mask, unsigned int *sse) {                            \
    int sum;                                                               \
    highbd_10_obmc_variance(pre, pre_stride, wsrc, mask, W, H, sse, &sum); \
    return *sse - (((int64_t)sum * sum) / (W * H));                        \
  }                                                                        \
                                                                           \
Yaowu Xu's avatar
Yaowu Xu committed
1121
  unsigned int aom_highbd_12_obmc_variance##W##x##H##_c(                   \
clang-format's avatar
clang-format committed
1122
1123
1124
1125
1126
1127
      const uint8_t *pre, int pre_stride, const int32_t *wsrc,             \
      const int32_t *mask, unsigned int *sse) {                            \
    int sum;                                                               \
    highbd_12_obmc_variance(pre, pre_stride, wsrc, mask, W, H, sse, &sum); \
    return *sse - (((int64_t)sum * sum) / (W * H));                        \
  }
1128

clang-format's avatar
clang-format committed
1129
#define HIGHBD_OBMC_SUBPIX_VAR(W, H)                                           \
Yaowu Xu's avatar
Yaowu Xu committed
1130
  unsigned int aom_highbd_obmc_sub_pixel_variance##W##x##H##_c(                \
clang-format's avatar
clang-format committed
1131
1132
1133
1134
1135
      const uint8_t *pre, int pre_stride, int xoffset, int yoffset,            \
      const int32_t *wsrc, const int32_t *mask, unsigned int *sse) {           \
    uint16_t fdata3[(H + 1) * W];                                              \
    uint16_t temp2[H * W];                                                     \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1136
    aom_highbd_var_filter_block2d_bil_first_pass(                              \
clang-format's avatar
clang-format committed
1137
        pre, fdata3, pre_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]);   \
Yaowu Xu's avatar
Yaowu Xu committed
1138
    aom_highbd_var_filter_block2d_bil_second_pass(                             \
clang-format's avatar
clang-format committed
1139
1140
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);              \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1141
    return aom_highbd_obmc_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), W, \
clang-format's avatar
clang-format committed
1142
1143
1144
                                                 wsrc, mask, sse);             \
  }                                                                            \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1145
  unsigned int aom_highbd_10_obmc_sub_pixel_variance##W##x##H##_c(             \
clang-format's avatar
clang-format committed
1146
1147
1148
1149
1150
      const uint8_t *pre, int pre_stride, int xoffset, int yoffset,            \
      const int32_t *wsrc, const int32_t *mask, unsigned int *sse) {           \
    uint16_t fdata3[(H + 1) * W];                                              \
    uint16_t temp2[H * W];                                                     \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1151
    aom_highbd_var_filter_block2d_bil_first_pass(                              \
clang-format's avatar
clang-format committed
1152
        pre, fdata3, pre_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]);   \
Yaowu Xu's avatar
Yaowu Xu committed
1153
    aom_highbd_var_filter_block2d_bil_second_pass(                             \
clang-format's avatar
clang-format committed
1154
1155
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);              \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1156
    return aom_highbd_10_obmc_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), \
clang-format's avatar
clang-format committed
1157
1158
1159
                                                    W, wsrc, mask, sse);       \
  }                                                                            \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1160
  unsigned int aom_highbd_12_obmc_sub_pixel_variance##W##x##H##_c(             \
clang-format's avatar
clang-format committed
1161
1162
1163
1164
1165
      const uint8_t *pre, int pre_stride, int xoffset, int yoffset,            \
      const int32_t *wsrc, const int32_t *mask, unsigned int *sse) {           \
    uint16_t fdata3[(H + 1) * W];                                              \
    uint16_t temp2[H * W];                                                     \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1166
    aom_highbd_var_filter_block2d_bil_first_pass(                              \
clang-format's avatar
clang-format committed
1167
        pre, fdata3, pre_stride, 1, H + 1, W, bilinear_filters_2t[xoffset]);   \
Yaowu Xu's avatar
Yaowu Xu committed
1168
    aom_highbd_var_filter_block2d_bil_second_pass(                             \
clang-format's avatar
clang-format committed
1169
1170
        fdata3, temp2, W, W, H, W, bilinear_filters_2t[yoffset]);              \
                                                                               \
Yaowu Xu's avatar
Yaowu Xu committed
1171
    return aom_highbd_12_obmc_variance##W##x##H##_c(CONVERT_TO_BYTEPTR(temp2), \
clang-format's avatar
clang-format committed
1172
1173
                                                    W, wsrc, mask, sse);       \
  }
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223

HIGHBD_OBMC_VAR(4, 4)
HIGHBD_OBMC_SUBPIX_VAR(4, 4)

HIGHBD_OBMC_VAR(4, 8)
HIGHBD_OBMC_SUBPIX_VAR(4, 8)

HIGHBD_OBMC_VAR(8, 4)
HIGHBD_OBMC_SUBPIX_VAR(8, 4)

HIGHBD_OBMC_VAR(8, 8)
HIGHBD_OBMC_SUBPIX_VAR(8, 8)

HIGHBD_OBMC_VAR(8, 16)
HIGHBD_OBMC_SUBPIX_VAR(8, 16)

HIGHBD_OBMC_VAR(16, 8)
HIGHBD_OBMC_SUBPIX_VAR(16, 8)

HIGHBD_OBMC_VAR(16, 16)
HIGHBD_OBMC_SUBPIX_VAR(16, 16)

HIGHBD_OBMC_VAR(16, 32)
HIGHBD_OBMC_SUBPIX_VAR(16, 32)

HIGHBD_OBMC_VAR(32, 16)
HIGHBD_OBMC_SUBPIX_VAR(32, 16)

HIGHBD_OBMC_VAR(32, 32)
HIGHBD_OBMC_SUBPIX_VAR(32, 32)

HIGHBD_OBMC_VAR(32, 64)
HIGHBD_OBMC_SUBPIX_VAR(32, 64)

HIGHBD_OBMC_VAR(64, 32)
HIGHBD_OBMC_SUBPIX_VAR(64, 32)

HIGHBD_OBMC_VAR(64, 64)
HIGHBD_OBMC_SUBPIX_VAR(64, 64)

#if CONFIG_EXT_PARTITION
HIGHBD_OBMC_VAR(64, 128)
HIGHBD_OBMC_SUBPIX_VAR(64, 128)

HIGHBD_OBMC_VAR(128, 64)
HIGHBD_OBMC_SUBPIX_VAR(128, 64)

HIGHBD_OBMC_VAR(128, 128)
HIGHBD_OBMC_SUBPIX_VAR(128, 128)
#endif  // CONFIG_EXT_PARTITION
Yaowu Xu's avatar
Yaowu Xu committed
1224
#endif  // CONFIG_AOM_HIGHBITDEPTH