Coverage Report

Created: 2026-09-14 08:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libvpx/vpx_dsp/x86/convolve.h
Line
Count
Source
1
/*
2
 *  Copyright (c) 2015 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
#ifndef VPX_VPX_DSP_X86_CONVOLVE_H_
11
#define VPX_VPX_DSP_X86_CONVOLVE_H_
12
13
#include <assert.h>
14
15
#include "./vpx_config.h"
16
#include "vpx/vpx_integer.h"
17
#include "vpx_ports/compiler_attributes.h"
18
19
// TODO(chiyotsai@google.com): Refactor the code here. Currently this is pretty
20
// hacky and awful to read. Note that there is a filter_x[3] == 128 check in
21
// HIGHBD_FUN_CONV_2D to avoid seg fault due to the fact that the c function
22
// assumes the filter is always 8 tap.
23
typedef void filter8_1dfunction(const uint8_t *src_ptr, ptrdiff_t src_pitch,
24
                                uint8_t *output_ptr, ptrdiff_t out_pitch,
25
                                uint32_t output_height, const int16_t *filter);
26
27
// TODO(chiyotsai@google.com): Remove the is_avg argument to the MACROS once we
28
// have 4-tap vert avg filter.
29
#define FUN_CONV_1D(name, offset, step_q4, dir, src_start, avg, opt, is_avg) \
30
  void vpx_convolve8_##name##_##opt(                                         \
31
      const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,                \
32
      ptrdiff_t dst_stride, const InterpKernel *filter, int x0_q4,           \
33
172M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
172M
    const int16_t *filter_row = filter[offset];                              \
35
172M
    (void)x0_q4;                                                             \
36
172M
    (void)x_step_q4;                                                         \
37
172M
    (void)y0_q4;                                                             \
38
172M
    (void)y_step_q4;                                                         \
39
172M
    assert(filter_row[3] != 128);                                            \
40
172M
    assert(step_q4 == 16);                                                   \
41
172M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
82.9M
      const int num_taps = 8;                                                \
43
94.4M
      while (w >= 16) {                                                      \
44
11.4M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
11.4M
                                                 dst_stride, h, filter_row); \
46
11.4M
        src += 16;                                                           \
47
11.4M
        dst += 16;                                                           \
48
11.4M
        w -= 16;                                                             \
49
11.4M
      }                                                                      \
50
82.9M
      if (w == 8) {                                                          \
51
24.1M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
24.1M
                                                dst_stride, h, filter_row);  \
53
58.8M
      } else if (w == 4) {                                                   \
54
49.4M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
49.4M
                                                dst_stride, h, filter_row);  \
56
49.4M
      }                                                                      \
57
82.9M
      (void)num_taps;                                                        \
58
89.6M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
86.3M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
96.9M
      while (w >= 16) {                                                      \
61
10.5M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
10.5M
                                                 dst_stride, h, filter_row); \
63
10.5M
        src += 16;                                                           \
64
10.5M
        dst += 16;                                                           \
65
10.5M
        w -= 16;                                                             \
66
10.5M
      }                                                                      \
67
86.3M
      if (w == 8) {                                                          \
68
21.7M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
21.7M
                                                dst_stride, h, filter_row);  \
70
64.5M
      } else if (w == 4) {                                                   \
71
56.5M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
56.5M
                                                dst_stride, h, filter_row);  \
73
56.5M
      }                                                                      \
74
86.3M
      (void)num_taps;                                                        \
75
86.3M
    } else {                                                                 \
76
3.32M
      const int num_taps = 2;                                                \
77
4.91M
      while (w >= 16) {                                                      \
78
1.58M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
1.58M
                                                 dst_stride, h, filter_row); \
80
1.58M
        src += 16;                                                           \
81
1.58M
        dst += 16;                                                           \
82
1.58M
        w -= 16;                                                             \
83
1.58M
      }                                                                      \
84
3.32M
      if (w == 8) {                                                          \
85
977k
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
977k
                                                dst_stride, h, filter_row);  \
87
2.34M
      } else if (w == 4) {                                                   \
88
1.27M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
1.27M
                                                dst_stride, h, filter_row);  \
90
1.27M
      }                                                                      \
91
3.32M
      (void)num_taps;                                                        \
92
3.32M
    }                                                                        \
93
172M
  }
94
95
#define FUN_CONV_2D(avg, opt, is_avg)                                          \
96
  void vpx_convolve8_##avg##opt(                                               \
97
      const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,                  \
98
      ptrdiff_t dst_stride, const InterpKernel *filter, int x0_q4,             \
99
50.3M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
50.3M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
50.3M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
50.3M
    (void)filter_y;                                                            \
103
50.3M
    assert(filter_x[3] != 128);                                                \
104
50.3M
    assert(filter_y[3] != 128);                                                \
105
50.3M
    assert(w <= 64);                                                           \
106
50.3M
    assert(h <= 64);                                                           \
107
50.3M
    assert(x_step_q4 == 16);                                                   \
108
50.3M
    assert(y_step_q4 == 16);                                                   \
109
50.3M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
24.9M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
24.9M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
24.9M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
24.9M
                                h + 7);                                        \
114
24.9M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
24.9M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
24.9M
                                      y_step_q4, w, h);                        \
117
25.4M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
24.1M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
24.1M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
24.1M
      vpx_convolve8_horiz_##opt(                                               \
121
24.1M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
24.1M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
24.1M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
24.1M
                                      dst, dst_stride, filter, x0_q4,          \
125
24.1M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
24.1M
    } else {                                                                   \
127
1.26M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
1.26M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
1.26M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
1.26M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
1.26M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
1.26M
                                      h);                                      \
133
1.26M
    }                                                                          \
134
50.3M
  }
135
136
#if CONFIG_VP9_HIGHBITDEPTH
137
138
typedef void highbd_filter8_1dfunction(const uint16_t *src_ptr,
139
                                       const ptrdiff_t src_pitch,
140
                                       uint16_t *output_ptr,
141
                                       ptrdiff_t out_pitch,
142
                                       unsigned int output_height,
143
                                       const int16_t *filter, int bd);
144
145
#define HIGH_FUN_CONV_1D(name, offset, step_q4, dir, src_start, avg, opt,     \
146
                         is_avg)                                              \
147
  void vpx_highbd_convolve8_##name##_##opt(                                   \
148
      const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst,               \
149
      ptrdiff_t dst_stride, const InterpKernel *filter_kernel, int x0_q4,     \
150
8.87M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
8.87M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
8.87M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
8.70M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
6.36M
        const int num_taps = 8;                                               \
155
7.94M
        while (w >= 16) {                                                     \
156
1.57M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.57M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.57M
          src += 16;                                                          \
159
1.57M
          dst += 16;                                                          \
160
1.57M
          w -= 16;                                                            \
161
1.57M
        }                                                                     \
162
8.54M
        while (w >= 8) {                                                      \
163
2.17M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
2.17M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
2.17M
          src += 8;                                                           \
166
2.17M
          dst += 8;                                                           \
167
2.17M
          w -= 8;                                                             \
168
2.17M
        }                                                                     \
169
9.46M
        while (w >= 4) {                                                      \
170
3.09M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
3.09M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
3.09M
          src += 4;                                                           \
173
3.09M
          dst += 4;                                                           \
174
3.09M
          w -= 4;                                                             \
175
3.09M
        }                                                                     \
176
6.36M
        (void)num_taps;                                                       \
177
6.36M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
118k
        const int num_taps = is_avg ? 8 : 4;                                  \
179
191k
        while (w >= 16) {                                                     \
180
73.5k
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
73.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
73.5k
          src += 16;                                                          \
183
73.5k
          dst += 16;                                                          \
184
73.5k
          w -= 16;                                                            \
185
73.5k
        }                                                                     \
186
177k
        while (w >= 8) {                                                      \
187
59.3k
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
59.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
59.3k
          src += 8;                                                           \
190
59.3k
          dst += 8;                                                           \
191
59.3k
          w -= 8;                                                             \
192
59.3k
        }                                                                     \
193
135k
        while (w >= 4) {                                                      \
194
17.0k
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
17.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
17.0k
          src += 4;                                                           \
197
17.0k
          dst += 4;                                                           \
198
17.0k
          w -= 4;                                                             \
199
17.0k
        }                                                                     \
200
118k
        (void)num_taps;                                                       \
201
2.22M
      } else {                                                                \
202
2.22M
        const int num_taps = 2;                                               \
203
3.10M
        while (w >= 16) {                                                     \
204
887k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
887k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
887k
          src += 16;                                                          \
207
887k
          dst += 16;                                                          \
208
887k
          w -= 16;                                                            \
209
887k
        }                                                                     \
210
2.79M
        while (w >= 8) {                                                      \
211
577k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
577k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
577k
          src += 8;                                                           \
214
577k
          dst += 8;                                                           \
215
577k
          w -= 8;                                                             \
216
577k
        }                                                                     \
217
3.16M
        while (w >= 4) {                                                      \
218
940k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
940k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
940k
          src += 4;                                                           \
221
940k
          dst += 4;                                                           \
222
940k
          w -= 4;                                                             \
223
940k
        }                                                                     \
224
2.22M
        (void)num_taps;                                                       \
225
2.22M
      }                                                                       \
226
8.70M
    }                                                                         \
227
8.87M
    if (w) {                                                                  \
228
168k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
168k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
168k
                                      y_step_q4, w, h, bd);                   \
231
168k
    }                                                                         \
232
8.87M
  }
Unexecuted instantiation: vpx_highbd_convolve8_horiz_sse2
Unexecuted instantiation: vpx_highbd_convolve8_vert_sse2
Unexecuted instantiation: vpx_highbd_convolve8_avg_horiz_sse2
Unexecuted instantiation: vpx_highbd_convolve8_avg_vert_sse2
vpx_highbd_convolve8_horiz_avx2
Line
Count
Source
150
3.92M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.92M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.92M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.90M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.82M
        const int num_taps = 8;                                               \
155
3.51M
        while (w >= 16) {                                                     \
156
688k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
688k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
688k
          src += 16;                                                          \
159
688k
          dst += 16;                                                          \
160
688k
          w -= 16;                                                            \
161
688k
        }                                                                     \
162
3.76M
        while (w >= 8) {                                                      \
163
939k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
939k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
939k
          src += 8;                                                           \
166
939k
          dst += 8;                                                           \
167
939k
          w -= 8;                                                             \
168
939k
        }                                                                     \
169
4.22M
        while (w >= 4) {                                                      \
170
1.40M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.40M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.40M
          src += 4;                                                           \
173
1.40M
          dst += 4;                                                           \
174
1.40M
          w -= 4;                                                             \
175
1.40M
        }                                                                     \
176
2.82M
        (void)num_taps;                                                       \
177
2.82M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
60.3k
        const int num_taps = is_avg ? 8 : 4;                                  \
179
97.1k
        while (w >= 16) {                                                     \
180
36.8k
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
36.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
36.8k
          src += 16;                                                          \
183
36.8k
          dst += 16;                                                          \
184
36.8k
          w -= 16;                                                            \
185
36.8k
        }                                                                     \
186
90.8k
        while (w >= 8) {                                                      \
187
30.5k
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
30.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
30.5k
          src += 8;                                                           \
190
30.5k
          dst += 8;                                                           \
191
30.5k
          w -= 8;                                                             \
192
30.5k
        }                                                                     \
193
69.0k
        while (w >= 4) {                                                      \
194
8.72k
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
8.72k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
8.72k
          src += 4;                                                           \
197
8.72k
          dst += 4;                                                           \
198
8.72k
          w -= 4;                                                             \
199
8.72k
        }                                                                     \
200
60.3k
        (void)num_taps;                                                       \
201
1.02M
      } else {                                                                \
202
1.02M
        const int num_taps = 2;                                               \
203
1.42M
        while (w >= 16) {                                                     \
204
400k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
400k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
400k
          src += 16;                                                          \
207
400k
          dst += 16;                                                          \
208
400k
          w -= 16;                                                            \
209
400k
        }                                                                     \
210
1.29M
        while (w >= 8) {                                                      \
211
267k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
267k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
267k
          src += 8;                                                           \
214
267k
          dst += 8;                                                           \
215
267k
          w -= 8;                                                             \
216
267k
        }                                                                     \
217
1.46M
        while (w >= 4) {                                                      \
218
438k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
438k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
438k
          src += 4;                                                           \
221
438k
          dst += 4;                                                           \
222
438k
          w -= 4;                                                             \
223
438k
        }                                                                     \
224
1.02M
        (void)num_taps;                                                       \
225
1.02M
      }                                                                       \
226
3.90M
    }                                                                         \
227
3.92M
    if (w) {                                                                  \
228
19.4k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
19.4k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
19.4k
                                      y_step_q4, w, h, bd);                   \
231
19.4k
    }                                                                         \
232
3.92M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
3.22M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.22M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.22M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.13M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.29M
        const int num_taps = 8;                                               \
155
2.86M
        while (w >= 16) {                                                     \
156
576k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
576k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
576k
          src += 16;                                                          \
159
576k
          dst += 16;                                                          \
160
576k
          w -= 16;                                                            \
161
576k
        }                                                                     \
162
3.08M
        while (w >= 8) {                                                      \
163
797k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
797k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
797k
          src += 8;                                                           \
166
797k
          dst += 8;                                                           \
167
797k
          w -= 8;                                                             \
168
797k
        }                                                                     \
169
3.38M
        while (w >= 4) {                                                      \
170
1.09M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.09M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.09M
          src += 4;                                                           \
173
1.09M
          dst += 4;                                                           \
174
1.09M
          w -= 4;                                                             \
175
1.09M
        }                                                                     \
176
2.29M
        (void)num_taps;                                                       \
177
2.29M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
57.9k
        const int num_taps = is_avg ? 8 : 4;                                  \
179
94.6k
        while (w >= 16) {                                                     \
180
36.7k
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
36.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
36.7k
          src += 16;                                                          \
183
36.7k
          dst += 16;                                                          \
184
36.7k
          w -= 16;                                                            \
185
36.7k
        }                                                                     \
186
86.7k
        while (w >= 8) {                                                      \
187
28.8k
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
28.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
28.8k
          src += 8;                                                           \
190
28.8k
          dst += 8;                                                           \
191
28.8k
          w -= 8;                                                             \
192
28.8k
        }                                                                     \
193
66.1k
        while (w >= 4) {                                                      \
194
8.28k
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
8.28k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
8.28k
          src += 4;                                                           \
197
8.28k
          dst += 4;                                                           \
198
8.28k
          w -= 4;                                                             \
199
8.28k
        }                                                                     \
200
57.9k
        (void)num_taps;                                                       \
201
783k
      } else {                                                                \
202
783k
        const int num_taps = 2;                                               \
203
1.08M
        while (w >= 16) {                                                     \
204
303k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
303k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
303k
          src += 16;                                                          \
207
303k
          dst += 16;                                                          \
208
303k
          w -= 16;                                                            \
209
303k
        }                                                                     \
210
984k
        while (w >= 8) {                                                      \
211
201k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
201k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
201k
          src += 8;                                                           \
214
201k
          dst += 8;                                                           \
215
201k
          w -= 8;                                                             \
216
201k
        }                                                                     \
217
1.12M
        while (w >= 4) {                                                      \
218
340k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
340k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
340k
          src += 4;                                                           \
221
340k
          dst += 4;                                                           \
222
340k
          w -= 4;                                                             \
223
340k
        }                                                                     \
224
783k
        (void)num_taps;                                                       \
225
783k
      }                                                                       \
226
3.13M
    }                                                                         \
227
3.22M
    if (w) {                                                                  \
228
90.4k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
90.4k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
90.4k
                                      y_step_q4, w, h, bd);                   \
231
90.4k
    }                                                                         \
232
3.22M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
235k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
235k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
235k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
219k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
165k
        const int num_taps = 8;                                               \
155
211k
        while (w >= 16) {                                                     \
156
46.0k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
46.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
46.0k
          src += 16;                                                          \
159
46.0k
          dst += 16;                                                          \
160
46.0k
          w -= 16;                                                            \
161
46.0k
        }                                                                     \
162
222k
        while (w >= 8) {                                                      \
163
57.1k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
57.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
57.1k
          src += 8;                                                           \
166
57.1k
          dst += 8;                                                           \
167
57.1k
          w -= 8;                                                             \
168
57.1k
        }                                                                     \
169
243k
        while (w >= 4) {                                                      \
170
78.0k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
78.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
78.0k
          src += 4;                                                           \
173
78.0k
          dst += 4;                                                           \
174
78.0k
          w -= 4;                                                             \
175
78.0k
        }                                                                     \
176
165k
        (void)num_taps;                                                       \
177
165k
      } else if (filter_row[2] | filter_row[5]) {                             \
178
0
        const int num_taps = is_avg ? 8 : 4;                                  \
179
0
        while (w >= 16) {                                                     \
180
0
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
0
          src += 16;                                                          \
183
0
          dst += 16;                                                          \
184
0
          w -= 16;                                                            \
185
0
        }                                                                     \
186
0
        while (w >= 8) {                                                      \
187
0
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
0
          src += 8;                                                           \
190
0
          dst += 8;                                                           \
191
0
          w -= 8;                                                             \
192
0
        }                                                                     \
193
0
        while (w >= 4) {                                                      \
194
0
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
0
          src += 4;                                                           \
197
0
          dst += 4;                                                           \
198
0
          w -= 4;                                                             \
199
0
        }                                                                     \
200
0
        (void)num_taps;                                                       \
201
53.9k
      } else {                                                                \
202
53.9k
        const int num_taps = 2;                                               \
203
82.2k
        while (w >= 16) {                                                     \
204
28.2k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
28.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
28.2k
          src += 16;                                                          \
207
28.2k
          dst += 16;                                                          \
208
28.2k
          w -= 16;                                                            \
209
28.2k
        }                                                                     \
210
67.3k
        while (w >= 8) {                                                      \
211
13.4k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
13.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
13.4k
          src += 8;                                                           \
214
13.4k
          dst += 8;                                                           \
215
13.4k
          w -= 8;                                                             \
216
13.4k
        }                                                                     \
217
73.4k
        while (w >= 4) {                                                      \
218
19.5k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
19.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
19.5k
          src += 4;                                                           \
221
19.5k
          dst += 4;                                                           \
222
19.5k
          w -= 4;                                                             \
223
19.5k
        }                                                                     \
224
53.9k
        (void)num_taps;                                                       \
225
53.9k
      }                                                                       \
226
219k
    }                                                                         \
227
235k
    if (w) {                                                                  \
228
16.0k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
16.0k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
16.0k
                                      y_step_q4, w, h, bd);                   \
231
16.0k
    }                                                                         \
232
235k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
1.49M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.49M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.49M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.44M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.08M
        const int num_taps = 8;                                               \
155
1.35M
        while (w >= 16) {                                                     \
156
266k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
266k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
266k
          src += 16;                                                          \
159
266k
          dst += 16;                                                          \
160
266k
          w -= 16;                                                            \
161
266k
        }                                                                     \
162
1.47M
        while (w >= 8) {                                                      \
163
383k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
383k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
383k
          src += 8;                                                           \
166
383k
          dst += 8;                                                           \
167
383k
          w -= 8;                                                             \
168
383k
        }                                                                     \
169
1.61M
        while (w >= 4) {                                                      \
170
521k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
521k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
521k
          src += 4;                                                           \
173
521k
          dst += 4;                                                           \
174
521k
          w -= 4;                                                             \
175
521k
        }                                                                     \
176
1.08M
        (void)num_taps;                                                       \
177
1.08M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
0
        const int num_taps = is_avg ? 8 : 4;                                  \
179
0
        while (w >= 16) {                                                     \
180
0
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
0
          src += 16;                                                          \
183
0
          dst += 16;                                                          \
184
0
          w -= 16;                                                            \
185
0
        }                                                                     \
186
0
        while (w >= 8) {                                                      \
187
0
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
0
          src += 8;                                                           \
190
0
          dst += 8;                                                           \
191
0
          w -= 8;                                                             \
192
0
        }                                                                     \
193
0
        while (w >= 4) {                                                      \
194
0
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
0
          src += 4;                                                           \
197
0
          dst += 4;                                                           \
198
0
          w -= 4;                                                             \
199
0
        }                                                                     \
200
0
        (void)num_taps;                                                       \
201
359k
      } else {                                                                \
202
359k
        const int num_taps = 2;                                               \
203
515k
        while (w >= 16) {                                                     \
204
155k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
155k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
155k
          src += 16;                                                          \
207
155k
          dst += 16;                                                          \
208
155k
          w -= 16;                                                            \
209
155k
        }                                                                     \
210
455k
        while (w >= 8) {                                                      \
211
95.9k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
95.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
95.9k
          src += 8;                                                           \
214
95.9k
          dst += 8;                                                           \
215
95.9k
          w -= 8;                                                             \
216
95.9k
        }                                                                     \
217
501k
        while (w >= 4) {                                                      \
218
141k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
141k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
141k
          src += 4;                                                           \
221
141k
          dst += 4;                                                           \
222
141k
          w -= 4;                                                             \
223
141k
        }                                                                     \
224
359k
        (void)num_taps;                                                       \
225
359k
      }                                                                       \
226
1.44M
    }                                                                         \
227
1.49M
    if (w) {                                                                  \
228
42.2k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
42.2k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
42.2k
                                      y_step_q4, w, h, bd);                   \
231
42.2k
    }                                                                         \
232
1.49M
  }
233
234
#define HIGH_FUN_CONV_2D(avg, opt, is_avg)                                     \
235
  void vpx_highbd_convolve8_##avg##opt(                                        \
236
      const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst,                \
237
      ptrdiff_t dst_stride, const InterpKernel *filter, int x0_q4,             \
238
3.42M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
3.42M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
3.42M
    assert(w <= 64);                                                           \
241
3.42M
    assert(h <= 64);                                                           \
242
3.42M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
3.33M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
3.33M
          filter_x[3] == 128) {                                                \
245
2.41M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.41M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.41M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.41M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.41M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.41M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.41M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.41M
      } else if (filter_x[2] | filter_x[5]) {                                  \
253
23.8k
        const int num_taps = is_avg ? 8 : 4;                                   \
254
23.8k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
255
23.8k
        vpx_highbd_convolve8_horiz_##opt(                                      \
256
23.8k
            src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,     \
257
23.8k
            filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1,   \
258
23.8k
            bd);                                                               \
259
23.8k
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
260
23.8k
            fdata2 + 64 * (num_taps / 2 - 1), 64, dst, dst_stride, filter,     \
261
23.8k
            x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd);                     \
262
894k
      } else {                                                                 \
263
894k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
894k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
894k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
894k
                                         w, h + 1, bd);                        \
267
894k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
894k
                                               filter, x0_q4, x_step_q4,       \
269
894k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
894k
      }                                                                        \
271
3.33M
    } else {                                                                   \
272
98.9k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
98.9k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
98.9k
                                    bd);                                       \
275
98.9k
    }                                                                          \
276
3.42M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_