Coverage Report

Created: 2025-11-24 06:33

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvpx/vpx_dsp/vpx_convolve.c
Line
Count
Source
1
/*
2
 *  Copyright (c) 2013 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 <assert.h>
12
#include <string.h>
13
14
#include "./vpx_config.h"
15
#include "./vpx_dsp_rtcd.h"
16
#include "vpx/vpx_integer.h"
17
#include "vpx_dsp/vpx_convolve.h"
18
#include "vpx_dsp/vpx_dsp_common.h"
19
#include "vpx_dsp/vpx_filter.h"
20
#include "vpx_ports/mem.h"
21
22
static void convolve_horiz(const uint8_t *src, ptrdiff_t src_stride,
23
                           uint8_t *dst, ptrdiff_t dst_stride,
24
                           const InterpKernel *x_filters, int x0_q4,
25
2.45M
                           int x_step_q4, int w, int h) {
26
2.45M
  int x, y;
27
2.45M
  src -= SUBPEL_TAPS / 2 - 1;
28
29
24.2M
  for (y = 0; y < h; ++y) {
30
21.7M
    int x_q4 = x0_q4;
31
278M
    for (x = 0; x < w; ++x) {
32
256M
      const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
33
256M
      const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
34
256M
      int k, sum = 0;
35
2.30G
      for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
36
256M
      dst[x] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
37
256M
      x_q4 += x_step_q4;
38
256M
    }
39
21.7M
    src += src_stride;
40
21.7M
    dst += dst_stride;
41
21.7M
  }
42
2.45M
}
43
44
static void convolve_avg_horiz(const uint8_t *src, ptrdiff_t src_stride,
45
                               uint8_t *dst, ptrdiff_t dst_stride,
46
                               const InterpKernel *x_filters, int x0_q4,
47
25.8k
                               int x_step_q4, int w, int h) {
48
25.8k
  int x, y;
49
25.8k
  src -= SUBPEL_TAPS / 2 - 1;
50
51
244k
  for (y = 0; y < h; ++y) {
52
219k
    int x_q4 = x0_q4;
53
5.07M
    for (x = 0; x < w; ++x) {
54
4.85M
      const uint8_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
55
4.85M
      const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
56
4.85M
      int k, sum = 0;
57
43.5M
      for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
58
4.85M
      dst[x] = ROUND_POWER_OF_TWO(
59
4.85M
          dst[x] + clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)), 1);
60
4.85M
      x_q4 += x_step_q4;
61
4.85M
    }
62
219k
    src += src_stride;
63
219k
    dst += dst_stride;
64
219k
  }
65
25.8k
}
66
67
static void convolve_vert(const uint8_t *src, ptrdiff_t src_stride,
68
                          uint8_t *dst, ptrdiff_t dst_stride,
69
                          const InterpKernel *y_filters, int y0_q4,
70
2.43M
                          int y_step_q4, int w, int h) {
71
2.43M
  int x, y;
72
2.43M
  src -= src_stride * (SUBPEL_TAPS / 2 - 1);
73
74
28.1M
  for (x = 0; x < w; ++x) {
75
25.7M
    int y_q4 = y0_q4;
76
565M
    for (y = 0; y < h; ++y) {
77
539M
      const uint8_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
78
539M
      const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
79
539M
      int k, sum = 0;
80
4.85G
      for (k = 0; k < SUBPEL_TAPS; ++k)
81
4.31G
        sum += src_y[k * src_stride] * y_filter[k];
82
539M
      dst[y * dst_stride] = clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS));
83
539M
      y_q4 += y_step_q4;
84
539M
    }
85
25.7M
    ++src;
86
25.7M
    ++dst;
87
25.7M
  }
88
2.43M
}
89
90
static void convolve_avg_vert(const uint8_t *src, ptrdiff_t src_stride,
91
                              uint8_t *dst, ptrdiff_t dst_stride,
92
                              const InterpKernel *y_filters, int y0_q4,
93
12.9k
                              int y_step_q4, int w, int h) {
94
12.9k
  int x, y;
95
12.9k
  src -= src_stride * (SUBPEL_TAPS / 2 - 1);
96
97
90.3k
  for (x = 0; x < w; ++x) {
98
77.3k
    int y_q4 = y0_q4;
99
1.21M
    for (y = 0; y < h; ++y) {
100
1.13M
      const uint8_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
101
1.13M
      const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
102
1.13M
      int k, sum = 0;
103
10.2M
      for (k = 0; k < SUBPEL_TAPS; ++k)
104
9.11M
        sum += src_y[k * src_stride] * y_filter[k];
105
1.13M
      dst[y * dst_stride] = ROUND_POWER_OF_TWO(
106
1.13M
          dst[y * dst_stride] +
107
1.13M
              clip_pixel(ROUND_POWER_OF_TWO(sum, FILTER_BITS)),
108
1.13M
          1);
109
1.13M
      y_q4 += y_step_q4;
110
1.13M
    }
111
77.3k
    ++src;
112
77.3k
    ++dst;
113
77.3k
  }
114
12.9k
}
115
116
void vpx_convolve8_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
117
                           uint8_t *dst, ptrdiff_t dst_stride,
118
                           const InterpKernel *filter, int x0_q4, int x_step_q4,
119
37.4k
                           int y0_q4, int y_step_q4, int w, int h) {
120
37.4k
  (void)y0_q4;
121
37.4k
  (void)y_step_q4;
122
37.4k
  convolve_horiz(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4, w,
123
37.4k
                 h);
124
37.4k
}
125
126
void vpx_convolve8_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
127
                               uint8_t *dst, ptrdiff_t dst_stride,
128
                               const InterpKernel *filter, int x0_q4,
129
                               int x_step_q4, int y0_q4, int y_step_q4, int w,
130
25.8k
                               int h) {
131
25.8k
  (void)y0_q4;
132
25.8k
  (void)y_step_q4;
133
25.8k
  convolve_avg_horiz(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4,
134
25.8k
                     w, h);
135
25.8k
}
136
137
void vpx_convolve8_vert_c(const uint8_t *src, ptrdiff_t src_stride,
138
                          uint8_t *dst, ptrdiff_t dst_stride,
139
                          const InterpKernel *filter, int x0_q4, int x_step_q4,
140
19.5k
                          int y0_q4, int y_step_q4, int w, int h) {
141
19.5k
  (void)x0_q4;
142
19.5k
  (void)x_step_q4;
143
19.5k
  convolve_vert(src, src_stride, dst, dst_stride, filter, y0_q4, y_step_q4, w,
144
19.5k
                h);
145
19.5k
}
146
147
void vpx_convolve8_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
148
                              uint8_t *dst, ptrdiff_t dst_stride,
149
                              const InterpKernel *filter, int x0_q4,
150
                              int x_step_q4, int y0_q4, int y_step_q4, int w,
151
12.9k
                              int h) {
152
12.9k
  (void)x0_q4;
153
12.9k
  (void)x_step_q4;
154
12.9k
  convolve_avg_vert(src, src_stride, dst, dst_stride, filter, y0_q4, y_step_q4,
155
12.9k
                    w, h);
156
12.9k
}
157
158
void vpx_convolve8_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
159
                     ptrdiff_t dst_stride, const InterpKernel *filter,
160
                     int x0_q4, int x_step_q4, int y0_q4, int y_step_q4, int w,
161
2.41M
                     int h) {
162
  // Note: Fixed size intermediate buffer, temp, places limits on parameters.
163
  // 2d filtering proceeds in 2 steps:
164
  //   (1) Interpolate horizontally into an intermediate buffer, temp.
165
  //   (2) Interpolate temp vertically to derive the sub-pixel result.
166
  // Deriving the maximum number of rows in the temp buffer (135):
167
  // --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
168
  // --Largest block size is 64x64 pixels.
169
  // --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
170
  //   original frame (in 1/16th pixel units).
171
  // --Must round-up because block may be located at sub-pixel position.
172
  // --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
173
  // --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
174
  // When calling in frame scaling function, the smallest scaling factor is x1/4
175
  // ==> y_step_q4 = 64. Since w and h are at most 16, the temp buffer is still
176
  // big enough.
177
2.41M
  uint8_t temp[64 * 135];
178
2.41M
  const int intermediate_height =
179
2.41M
      (((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
180
181
2.41M
  assert(w <= 64);
182
2.41M
  assert(h <= 64);
183
2.41M
  assert(y_step_q4 <= 32 || (y_step_q4 <= 64 && h <= 32));
184
2.41M
  assert(x_step_q4 <= 64);
185
186
2.41M
  convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride, temp, 64,
187
2.41M
                 filter, x0_q4, x_step_q4, w, intermediate_height);
188
2.41M
  convolve_vert(temp + 64 * (SUBPEL_TAPS / 2 - 1), 64, dst, dst_stride, filter,
189
2.41M
                y0_q4, y_step_q4, w, h);
190
2.41M
}
191
192
void vpx_convolve8_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
193
                         ptrdiff_t dst_stride, const InterpKernel *filter,
194
                         int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
195
2.41M
                         int w, int h) {
196
  // Fixed size intermediate buffer places limits on parameters.
197
2.41M
  DECLARE_ALIGNED(16, uint8_t, temp[64 * 64]);
198
2.41M
  assert(w <= 64);
199
2.41M
  assert(h <= 64);
200
201
2.41M
  vpx_convolve8_c(src, src_stride, temp, 64, filter, x0_q4, x_step_q4, y0_q4,
202
2.41M
                  y_step_q4, w, h);
203
2.41M
  vpx_convolve_avg_c(temp, 64, dst, dst_stride, NULL, 0, 0, 0, 0, w, h);
204
2.41M
}
205
206
void vpx_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
207
                         ptrdiff_t dst_stride, const InterpKernel *filter,
208
                         int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
209
0
                         int w, int h) {
210
0
  int r;
211
212
0
  (void)filter;
213
0
  (void)x0_q4;
214
0
  (void)x_step_q4;
215
0
  (void)y0_q4;
216
0
  (void)y_step_q4;
217
218
0
  for (r = h; r > 0; --r) {
219
0
    memcpy(dst, src, w);
220
0
    src += src_stride;
221
0
    dst += dst_stride;
222
0
  }
223
0
}
224
225
void vpx_convolve_avg_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
226
                        ptrdiff_t dst_stride, const InterpKernel *filter,
227
                        int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
228
2.41M
                        int w, int h) {
229
2.41M
  int x, y;
230
231
2.41M
  (void)filter;
232
2.41M
  (void)x0_q4;
233
2.41M
  (void)x_step_q4;
234
2.41M
  (void)y0_q4;
235
2.41M
  (void)y_step_q4;
236
237
27.0M
  for (y = 0; y < h; ++y) {
238
564M
    for (x = 0; x < w; ++x) dst[x] = ROUND_POWER_OF_TWO(dst[x] + src[x], 1);
239
24.6M
    src += src_stride;
240
24.6M
    dst += dst_stride;
241
24.6M
  }
242
2.41M
}
243
244
void vpx_scaled_horiz_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
245
                        ptrdiff_t dst_stride, const InterpKernel *filter,
246
                        int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
247
37.4k
                        int w, int h) {
248
37.4k
  vpx_convolve8_horiz_c(src, src_stride, dst, dst_stride, filter, x0_q4,
249
37.4k
                        x_step_q4, y0_q4, y_step_q4, w, h);
250
37.4k
}
251
252
void vpx_scaled_vert_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
253
                       ptrdiff_t dst_stride, const InterpKernel *filter,
254
                       int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
255
19.5k
                       int w, int h) {
256
19.5k
  vpx_convolve8_vert_c(src, src_stride, dst, dst_stride, filter, x0_q4,
257
19.5k
                       x_step_q4, y0_q4, y_step_q4, w, h);
258
19.5k
}
259
260
void vpx_scaled_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
261
                     ptrdiff_t dst_stride, const InterpKernel *filter,
262
                     int x0_q4, int x_step_q4, int y0_q4, int y_step_q4, int w,
263
0
                     int h) {
264
0
  vpx_convolve8_c(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4,
265
0
                  y0_q4, y_step_q4, w, h);
266
0
}
267
268
void vpx_scaled_avg_horiz_c(const uint8_t *src, ptrdiff_t src_stride,
269
                            uint8_t *dst, ptrdiff_t dst_stride,
270
                            const InterpKernel *filter, int x0_q4,
271
                            int x_step_q4, int y0_q4, int y_step_q4, int w,
272
25.8k
                            int h) {
273
25.8k
  vpx_convolve8_avg_horiz_c(src, src_stride, dst, dst_stride, filter, x0_q4,
274
25.8k
                            x_step_q4, y0_q4, y_step_q4, w, h);
275
25.8k
}
276
277
void vpx_scaled_avg_vert_c(const uint8_t *src, ptrdiff_t src_stride,
278
                           uint8_t *dst, ptrdiff_t dst_stride,
279
                           const InterpKernel *filter, int x0_q4, int x_step_q4,
280
12.9k
                           int y0_q4, int y_step_q4, int w, int h) {
281
12.9k
  vpx_convolve8_avg_vert_c(src, src_stride, dst, dst_stride, filter, x0_q4,
282
12.9k
                           x_step_q4, y0_q4, y_step_q4, w, h);
283
12.9k
}
284
285
void vpx_scaled_avg_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
286
                         ptrdiff_t dst_stride, const InterpKernel *filter,
287
                         int x0_q4, int x_step_q4, int y0_q4, int y_step_q4,
288
2.41M
                         int w, int h) {
289
2.41M
  vpx_convolve8_avg_c(src, src_stride, dst, dst_stride, filter, x0_q4,
290
2.41M
                      x_step_q4, y0_q4, y_step_q4, w, h);
291
2.41M
}
292
293
#if CONFIG_VP9_HIGHBITDEPTH
294
static void highbd_convolve_horiz(const uint16_t *src, ptrdiff_t src_stride,
295
                                  uint16_t *dst, ptrdiff_t dst_stride,
296
                                  const InterpKernel *x_filters, int x0_q4,
297
1.72M
                                  int x_step_q4, int w, int h, int bd) {
298
1.72M
  int x, y;
299
1.72M
  src -= SUBPEL_TAPS / 2 - 1;
300
301
18.6M
  for (y = 0; y < h; ++y) {
302
16.9M
    int x_q4 = x0_q4;
303
412M
    for (x = 0; x < w; ++x) {
304
395M
      const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
305
395M
      const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
306
395M
      int k, sum = 0;
307
3.55G
      for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
308
395M
      dst[x] = clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
309
395M
      x_q4 += x_step_q4;
310
395M
    }
311
16.9M
    src += src_stride;
312
16.9M
    dst += dst_stride;
313
16.9M
  }
314
1.72M
}
315
316
static void highbd_convolve_avg_horiz(const uint16_t *src, ptrdiff_t src_stride,
317
                                      uint16_t *dst, ptrdiff_t dst_stride,
318
                                      const InterpKernel *x_filters, int x0_q4,
319
56.2k
                                      int x_step_q4, int w, int h, int bd) {
320
56.2k
  int x, y;
321
56.2k
  src -= SUBPEL_TAPS / 2 - 1;
322
323
408k
  for (y = 0; y < h; ++y) {
324
352k
    int x_q4 = x0_q4;
325
3.60M
    for (x = 0; x < w; ++x) {
326
3.24M
      const uint16_t *const src_x = &src[x_q4 >> SUBPEL_BITS];
327
3.24M
      const int16_t *const x_filter = x_filters[x_q4 & SUBPEL_MASK];
328
3.24M
      int k, sum = 0;
329
29.2M
      for (k = 0; k < SUBPEL_TAPS; ++k) sum += src_x[k] * x_filter[k];
330
3.24M
      dst[x] = ROUND_POWER_OF_TWO(
331
3.24M
          dst[x] + clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
332
3.24M
          1);
333
3.24M
      x_q4 += x_step_q4;
334
3.24M
    }
335
352k
    src += src_stride;
336
352k
    dst += dst_stride;
337
352k
  }
338
56.2k
}
339
340
static void highbd_convolve_vert(const uint16_t *src, ptrdiff_t src_stride,
341
                                 uint16_t *dst, ptrdiff_t dst_stride,
342
                                 const InterpKernel *y_filters, int y0_q4,
343
1.68M
                                 int y_step_q4, int w, int h, int bd) {
344
1.68M
  int x, y;
345
1.68M
  src -= src_stride * (SUBPEL_TAPS / 2 - 1);
346
347
39.2M
  for (x = 0; x < w; ++x) {
348
37.5M
    int y_q4 = y0_q4;
349
1.03G
    for (y = 0; y < h; ++y) {
350
998M
      const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
351
998M
      const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
352
998M
      int k, sum = 0;
353
8.97G
      for (k = 0; k < SUBPEL_TAPS; ++k)
354
7.98G
        sum += src_y[k * src_stride] * y_filter[k];
355
998M
      dst[y * dst_stride] =
356
998M
          clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd);
357
998M
      y_q4 += y_step_q4;
358
998M
    }
359
37.5M
    ++src;
360
37.5M
    ++dst;
361
37.5M
  }
362
1.68M
}
363
364
static void highbd_convolve_avg_vert(const uint16_t *src, ptrdiff_t src_stride,
365
                                     uint16_t *dst, ptrdiff_t dst_stride,
366
                                     const InterpKernel *y_filters, int y0_q4,
367
28.3k
                                     int y_step_q4, int w, int h, int bd) {
368
28.3k
  int x, y;
369
28.3k
  src -= src_stride * (SUBPEL_TAPS / 2 - 1);
370
371
212k
  for (x = 0; x < w; ++x) {
372
184k
    int y_q4 = y0_q4;
373
2.66M
    for (y = 0; y < h; ++y) {
374
2.48M
      const uint16_t *src_y = &src[(y_q4 >> SUBPEL_BITS) * src_stride];
375
2.48M
      const int16_t *const y_filter = y_filters[y_q4 & SUBPEL_MASK];
376
2.48M
      int k, sum = 0;
377
22.3M
      for (k = 0; k < SUBPEL_TAPS; ++k)
378
19.8M
        sum += src_y[k * src_stride] * y_filter[k];
379
2.48M
      dst[y * dst_stride] = ROUND_POWER_OF_TWO(
380
2.48M
          dst[y * dst_stride] +
381
2.48M
              clip_pixel_highbd(ROUND_POWER_OF_TWO(sum, FILTER_BITS), bd),
382
2.48M
          1);
383
2.48M
      y_q4 += y_step_q4;
384
2.48M
    }
385
184k
    ++src;
386
184k
    ++dst;
387
184k
  }
388
28.3k
}
389
390
static void highbd_convolve(const uint16_t *src, ptrdiff_t src_stride,
391
                            uint16_t *dst, ptrdiff_t dst_stride,
392
                            const InterpKernel *filter, int x0_q4,
393
                            int x_step_q4, int y0_q4, int y_step_q4, int w,
394
1.63M
                            int h, int bd) {
395
  // Note: Fixed size intermediate buffer, temp, places limits on parameters.
396
  // 2d filtering proceeds in 2 steps:
397
  //   (1) Interpolate horizontally into an intermediate buffer, temp.
398
  //   (2) Interpolate temp vertically to derive the sub-pixel result.
399
  // Deriving the maximum number of rows in the temp buffer (135):
400
  // --Smallest scaling factor is x1/2 ==> y_step_q4 = 32 (Normative).
401
  // --Largest block size is 64x64 pixels.
402
  // --64 rows in the downscaled frame span a distance of (64 - 1) * 32 in the
403
  //   original frame (in 1/16th pixel units).
404
  // --Must round-up because block may be located at sub-pixel position.
405
  // --Require an additional SUBPEL_TAPS rows for the 8-tap filter tails.
406
  // --((64 - 1) * 32 + 15) >> 4 + 8 = 135.
407
1.63M
  uint16_t temp[64 * 135];
408
1.63M
  const int intermediate_height =
409
1.63M
      (((h - 1) * y_step_q4 + y0_q4) >> SUBPEL_BITS) + SUBPEL_TAPS;
410
411
1.63M
  assert(w <= 64);
412
1.63M
  assert(h <= 64);
413
1.63M
  assert(y_step_q4 <= 32);
414
1.63M
  assert(x_step_q4 <= 32);
415
416
1.63M
  highbd_convolve_horiz(src - src_stride * (SUBPEL_TAPS / 2 - 1), src_stride,
417
1.63M
                        temp, 64, filter, x0_q4, x_step_q4, w,
418
1.63M
                        intermediate_height, bd);
419
1.63M
  highbd_convolve_vert(temp + 64 * (SUBPEL_TAPS / 2 - 1), 64, dst, dst_stride,
420
1.63M
                       filter, y0_q4, y_step_q4, w, h, bd);
421
1.63M
}
422
423
void vpx_highbd_convolve8_horiz_c(const uint16_t *src, ptrdiff_t src_stride,
424
                                  uint16_t *dst, ptrdiff_t dst_stride,
425
                                  const InterpKernel *filter, int x0_q4,
426
                                  int x_step_q4, int y0_q4, int y_step_q4,
427
92.6k
                                  int w, int h, int bd) {
428
92.6k
  (void)y0_q4;
429
92.6k
  (void)y_step_q4;
430
431
92.6k
  highbd_convolve_horiz(src, src_stride, dst, dst_stride, filter, x0_q4,
432
92.6k
                        x_step_q4, w, h, bd);
433
92.6k
}
434
435
void vpx_highbd_convolve8_avg_horiz_c(const uint16_t *src, ptrdiff_t src_stride,
436
                                      uint16_t *dst, ptrdiff_t dst_stride,
437
                                      const InterpKernel *filter, int x0_q4,
438
                                      int x_step_q4, int y0_q4, int y_step_q4,
439
56.2k
                                      int w, int h, int bd) {
440
56.2k
  (void)y0_q4;
441
56.2k
  (void)y_step_q4;
442
443
56.2k
  highbd_convolve_avg_horiz(src, src_stride, dst, dst_stride, filter, x0_q4,
444
56.2k
                            x_step_q4, w, h, bd);
445
56.2k
}
446
447
void vpx_highbd_convolve8_vert_c(const uint16_t *src, ptrdiff_t src_stride,
448
                                 uint16_t *dst, ptrdiff_t dst_stride,
449
                                 const InterpKernel *filter, int x0_q4,
450
                                 int x_step_q4, int y0_q4, int y_step_q4, int w,
451
52.4k
                                 int h, int bd) {
452
52.4k
  (void)x0_q4;
453
52.4k
  (void)x_step_q4;
454
455
52.4k
  highbd_convolve_vert(src, src_stride, dst, dst_stride, filter, y0_q4,
456
52.4k
                       y_step_q4, w, h, bd);
457
52.4k
}
458
459
void vpx_highbd_convolve8_avg_vert_c(const uint16_t *src, ptrdiff_t src_stride,
460
                                     uint16_t *dst, ptrdiff_t dst_stride,
461
                                     const InterpKernel *filter, int x0_q4,
462
                                     int x_step_q4, int y0_q4, int y_step_q4,
463
28.3k
                                     int w, int h, int bd) {
464
28.3k
  (void)x0_q4;
465
28.3k
  (void)x_step_q4;
466
467
28.3k
  highbd_convolve_avg_vert(src, src_stride, dst, dst_stride, filter, y0_q4,
468
28.3k
                           y_step_q4, w, h, bd);
469
28.3k
}
470
471
void vpx_highbd_convolve8_c(const uint16_t *src, ptrdiff_t src_stride,
472
                            uint16_t *dst, ptrdiff_t dst_stride,
473
                            const InterpKernel *filter, int x0_q4,
474
                            int x_step_q4, int y0_q4, int y_step_q4, int w,
475
1.63M
                            int h, int bd) {
476
1.63M
  highbd_convolve(src, src_stride, dst, dst_stride, filter, x0_q4, x_step_q4,
477
1.63M
                  y0_q4, y_step_q4, w, h, bd);
478
1.63M
}
479
480
void vpx_highbd_convolve8_avg_c(const uint16_t *src, ptrdiff_t src_stride,
481
                                uint16_t *dst, ptrdiff_t dst_stride,
482
                                const InterpKernel *filter, int x0_q4,
483
                                int x_step_q4, int y0_q4, int y_step_q4, int w,
484
271k
                                int h, int bd) {
485
  // Fixed size intermediate buffer places limits on parameters.
486
271k
  DECLARE_ALIGNED(16, uint16_t, temp[64 * 64]);
487
271k
  assert(w <= 64);
488
271k
  assert(h <= 64);
489
490
271k
  vpx_highbd_convolve8_c(src, src_stride, temp, 64, filter, x0_q4, x_step_q4,
491
271k
                         y0_q4, y_step_q4, w, h, bd);
492
271k
  vpx_highbd_convolve_avg_c(temp, 64, dst, dst_stride, NULL, 0, 0, 0, 0, w, h,
493
271k
                            bd);
494
271k
}
495
496
void vpx_highbd_convolve_copy_c(const uint16_t *src, ptrdiff_t src_stride,
497
                                uint16_t *dst, ptrdiff_t dst_stride,
498
                                const InterpKernel *filter, int x0_q4,
499
                                int x_step_q4, int y0_q4, int y_step_q4, int w,
500
0
                                int h, int bd) {
501
0
  int r;
502
503
0
  (void)filter;
504
0
  (void)x0_q4;
505
0
  (void)x_step_q4;
506
0
  (void)y0_q4;
507
0
  (void)y_step_q4;
508
0
  (void)bd;
509
510
0
  for (r = h; r > 0; --r) {
511
0
    memcpy(dst, src, w * sizeof(uint16_t));
512
0
    src += src_stride;
513
0
    dst += dst_stride;
514
0
  }
515
0
}
516
517
void vpx_highbd_convolve_avg_c(const uint16_t *src, ptrdiff_t src_stride,
518
                               uint16_t *dst, ptrdiff_t dst_stride,
519
                               const InterpKernel *filter, int x0_q4,
520
                               int x_step_q4, int y0_q4, int y_step_q4, int w,
521
271k
                               int h, int bd) {
522
271k
  int x, y;
523
524
271k
  (void)filter;
525
271k
  (void)x0_q4;
526
271k
  (void)x_step_q4;
527
271k
  (void)y0_q4;
528
271k
  (void)y_step_q4;
529
271k
  (void)bd;
530
531
4.35M
  for (y = 0; y < h; ++y) {
532
142M
    for (x = 0; x < w; ++x) dst[x] = ROUND_POWER_OF_TWO(dst[x] + src[x], 1);
533
4.08M
    src += src_stride;
534
4.08M
    dst += dst_stride;
535
4.08M
  }
536
271k
}
537
#endif