Coverage Report

Created: 2026-10-28 08:13

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
208M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
208M
    const int16_t *filter_row = filter[offset];                              \
35
208M
    (void)x0_q4;                                                             \
36
208M
    (void)x_step_q4;                                                         \
37
208M
    (void)y0_q4;                                                             \
38
208M
    (void)y_step_q4;                                                         \
39
208M
    assert(filter_row[3] != 128);                                            \
40
208M
    assert(step_q4 == 16);                                                   \
41
208M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
94.5M
      const int num_taps = 8;                                                \
43
107M
      while (w >= 16) {                                                      \
44
12.6M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
12.6M
                                                 dst_stride, h, filter_row); \
46
12.6M
        src += 16;                                                           \
47
12.6M
        dst += 16;                                                           \
48
12.6M
        w -= 16;                                                             \
49
12.6M
      }                                                                      \
50
94.5M
      if (w == 8) {                                                          \
51
27.3M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
27.3M
                                                dst_stride, h, filter_row);  \
53
67.1M
      } else if (w == 4) {                                                   \
54
56.9M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
56.9M
                                                dst_stride, h, filter_row);  \
56
56.9M
      }                                                                      \
57
94.5M
      (void)num_taps;                                                        \
58
114M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
111M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
124M
      while (w >= 16) {                                                      \
61
12.9M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
12.9M
                                                 dst_stride, h, filter_row); \
63
12.9M
        src += 16;                                                           \
64
12.9M
        dst += 16;                                                           \
65
12.9M
        w -= 16;                                                             \
66
12.9M
      }                                                                      \
67
111M
      if (w == 8) {                                                          \
68
28.4M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
28.4M
                                                dst_stride, h, filter_row);  \
70
83.5M
      } else if (w == 4) {                                                   \
71
73.6M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
73.6M
                                                dst_stride, h, filter_row);  \
73
73.6M
      }                                                                      \
74
111M
      (void)num_taps;                                                        \
75
111M
    } else {                                                                 \
76
2.29M
      const int num_taps = 2;                                                \
77
3.39M
      while (w >= 16) {                                                      \
78
1.10M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
1.10M
                                                 dst_stride, h, filter_row); \
80
1.10M
        src += 16;                                                           \
81
1.10M
        dst += 16;                                                           \
82
1.10M
        w -= 16;                                                             \
83
1.10M
      }                                                                      \
84
2.29M
      if (w == 8) {                                                          \
85
670k
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
670k
                                                dst_stride, h, filter_row);  \
87
1.62M
      } else if (w == 4) {                                                   \
88
877k
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
877k
                                                dst_stride, h, filter_row);  \
90
877k
      }                                                                      \
91
2.29M
      (void)num_taps;                                                        \
92
2.29M
    }                                                                        \
93
208M
  }
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
60.4M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
60.4M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
60.4M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
60.4M
    (void)filter_y;                                                            \
103
60.4M
    assert(filter_x[3] != 128);                                                \
104
60.4M
    assert(filter_y[3] != 128);                                                \
105
60.4M
    assert(w <= 64);                                                           \
106
60.4M
    assert(h <= 64);                                                           \
107
60.4M
    assert(x_step_q4 == 16);                                                   \
108
60.4M
    assert(y_step_q4 == 16);                                                   \
109
60.4M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
27.7M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
27.7M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
27.7M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
27.7M
                                h + 7);                                        \
114
27.7M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
27.7M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
27.7M
                                      y_step_q4, w, h);                        \
117
32.7M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
31.9M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
31.9M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
31.9M
      vpx_convolve8_horiz_##opt(                                               \
121
31.9M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
31.9M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
31.9M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
31.9M
                                      dst, dst_stride, filter, x0_q4,          \
125
31.9M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
31.9M
    } else {                                                                   \
127
870k
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
870k
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
870k
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
870k
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
870k
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
870k
                                      h);                                      \
133
870k
    }                                                                          \
134
60.4M
  }
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.96M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
8.96M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
8.96M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
8.77M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
6.26M
        const int num_taps = 8;                                               \
155
7.84M
        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.42M
        while (w >= 8) {                                                      \
163
2.15M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
2.15M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
2.15M
          src += 8;                                                           \
166
2.15M
          dst += 8;                                                           \
167
2.15M
          w -= 8;                                                             \
168
2.15M
        }                                                                     \
169
9.28M
        while (w >= 4) {                                                      \
170
3.01M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
3.01M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
3.01M
          src += 4;                                                           \
173
3.01M
          dst += 4;                                                           \
174
3.01M
          w -= 4;                                                             \
175
3.01M
        }                                                                     \
176
6.26M
        (void)num_taps;                                                       \
177
6.26M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
293k
        const int num_taps = is_avg ? 8 : 4;                                  \
179
439k
        while (w >= 16) {                                                     \
180
145k
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
145k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
145k
          src += 16;                                                          \
183
145k
          dst += 16;                                                          \
184
145k
          w -= 16;                                                            \
185
145k
        }                                                                     \
186
432k
        while (w >= 8) {                                                      \
187
139k
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
139k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
139k
          src += 8;                                                           \
190
139k
          dst += 8;                                                           \
191
139k
          w -= 8;                                                             \
192
139k
        }                                                                     \
193
353k
        while (w >= 4) {                                                      \
194
59.4k
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
59.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
59.4k
          src += 4;                                                           \
197
59.4k
          dst += 4;                                                           \
198
59.4k
          w -= 4;                                                             \
199
59.4k
        }                                                                     \
200
293k
        (void)num_taps;                                                       \
201
2.21M
      } else {                                                                \
202
2.21M
        const int num_taps = 2;                                               \
203
3.10M
        while (w >= 16) {                                                     \
204
886k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
886k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
886k
          src += 16;                                                          \
207
886k
          dst += 16;                                                          \
208
886k
          w -= 16;                                                            \
209
886k
        }                                                                     \
210
2.79M
        while (w >= 8) {                                                      \
211
575k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
575k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
575k
          src += 8;                                                           \
214
575k
          dst += 8;                                                           \
215
575k
          w -= 8;                                                             \
216
575k
        }                                                                     \
217
3.15M
        while (w >= 4) {                                                      \
218
938k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
938k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
938k
          src += 4;                                                           \
221
938k
          dst += 4;                                                           \
222
938k
          w -= 4;                                                             \
223
938k
        }                                                                     \
224
2.21M
        (void)num_taps;                                                       \
225
2.21M
      }                                                                       \
226
8.77M
    }                                                                         \
227
8.96M
    if (w) {                                                                  \
228
182k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
182k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
182k
                                      y_step_q4, w, h, bd);                   \
231
182k
    }                                                                         \
232
8.96M
  }
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.94M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.94M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.94M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.93M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.76M
        const int num_taps = 8;                                               \
155
3.44M
        while (w >= 16) {                                                     \
156
684k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
684k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
684k
          src += 16;                                                          \
159
684k
          dst += 16;                                                          \
160
684k
          w -= 16;                                                            \
161
684k
        }                                                                     \
162
3.68M
        while (w >= 8) {                                                      \
163
922k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
922k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
922k
          src += 8;                                                           \
166
922k
          dst += 8;                                                           \
167
922k
          w -= 8;                                                             \
168
922k
        }                                                                     \
169
4.11M
        while (w >= 4) {                                                      \
170
1.35M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.35M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.35M
          src += 4;                                                           \
173
1.35M
          dst += 4;                                                           \
174
1.35M
          w -= 4;                                                             \
175
1.35M
        }                                                                     \
176
2.76M
        (void)num_taps;                                                       \
177
2.76M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
146k
        const int num_taps = is_avg ? 8 : 4;                                  \
179
218k
        while (w >= 16) {                                                     \
180
72.4k
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
72.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
72.4k
          src += 16;                                                          \
183
72.4k
          dst += 16;                                                          \
184
72.4k
          w -= 16;                                                            \
185
72.4k
        }                                                                     \
186
215k
        while (w >= 8) {                                                      \
187
69.4k
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
69.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
69.4k
          src += 8;                                                           \
190
69.4k
          dst += 8;                                                           \
191
69.4k
          w -= 8;                                                             \
192
69.4k
        }                                                                     \
193
176k
        while (w >= 4) {                                                      \
194
29.6k
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
29.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
29.6k
          src += 4;                                                           \
197
29.6k
          dst += 4;                                                           \
198
29.6k
          w -= 4;                                                             \
199
29.6k
        }                                                                     \
200
146k
        (void)num_taps;                                                       \
201
1.02M
      } else {                                                                \
202
1.02M
        const int num_taps = 2;                                               \
203
1.42M
        while (w >= 16) {                                                     \
204
401k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
401k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
401k
          src += 16;                                                          \
207
401k
          dst += 16;                                                          \
208
401k
          w -= 16;                                                            \
209
401k
        }                                                                     \
210
1.29M
        while (w >= 8) {                                                      \
211
266k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
266k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
266k
          src += 8;                                                           \
214
266k
          dst += 8;                                                           \
215
266k
          w -= 8;                                                             \
216
266k
        }                                                                     \
217
1.46M
        while (w >= 4) {                                                      \
218
439k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
439k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
439k
          src += 4;                                                           \
221
439k
          dst += 4;                                                           \
222
439k
          w -= 4;                                                             \
223
439k
        }                                                                     \
224
1.02M
        (void)num_taps;                                                       \
225
1.02M
      }                                                                       \
226
3.93M
    }                                                                         \
227
3.94M
    if (w) {                                                                  \
228
15.7k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
15.7k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
15.7k
                                      y_step_q4, w, h, bd);                   \
231
15.7k
    }                                                                         \
232
3.94M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
3.34M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.34M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.34M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.23M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.31M
        const int num_taps = 8;                                               \
155
2.90M
        while (w >= 16) {                                                     \
156
590k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
590k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
590k
          src += 16;                                                          \
159
590k
          dst += 16;                                                          \
160
590k
          w -= 16;                                                            \
161
590k
        }                                                                     \
162
3.11M
        while (w >= 8) {                                                      \
163
807k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
807k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
807k
          src += 8;                                                           \
166
807k
          dst += 8;                                                           \
167
807k
          w -= 8;                                                             \
168
807k
        }                                                                     \
169
3.40M
        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.31M
        (void)num_taps;                                                       \
177
2.31M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
147k
        const int num_taps = is_avg ? 8 : 4;                                  \
179
220k
        while (w >= 16) {                                                     \
180
73.3k
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
73.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
73.3k
          src += 16;                                                          \
183
73.3k
          dst += 16;                                                          \
184
73.3k
          w -= 16;                                                            \
185
73.3k
        }                                                                     \
186
217k
        while (w >= 8) {                                                      \
187
69.6k
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
69.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
69.6k
          src += 8;                                                           \
190
69.6k
          dst += 8;                                                           \
191
69.6k
          w -= 8;                                                             \
192
69.6k
        }                                                                     \
193
177k
        while (w >= 4) {                                                      \
194
29.8k
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
29.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
29.8k
          src += 4;                                                           \
197
29.8k
          dst += 4;                                                           \
198
29.8k
          w -= 4;                                                             \
199
29.8k
        }                                                                     \
200
147k
        (void)num_taps;                                                       \
201
775k
      } else {                                                                \
202
775k
        const int num_taps = 2;                                               \
203
1.07M
        while (w >= 16) {                                                     \
204
300k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
300k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
300k
          src += 16;                                                          \
207
300k
          dst += 16;                                                          \
208
300k
          w -= 16;                                                            \
209
300k
        }                                                                     \
210
974k
        while (w >= 8) {                                                      \
211
198k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
198k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
198k
          src += 8;                                                           \
214
198k
          dst += 8;                                                           \
215
198k
          w -= 8;                                                             \
216
198k
        }                                                                     \
217
1.11M
        while (w >= 4) {                                                      \
218
337k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
337k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
337k
          src += 4;                                                           \
221
337k
          dst += 4;                                                           \
222
337k
          w -= 4;                                                             \
223
337k
        }                                                                     \
224
775k
        (void)num_taps;                                                       \
225
775k
      }                                                                       \
226
3.23M
    }                                                                         \
227
3.34M
    if (w) {                                                                  \
228
105k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
105k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
105k
                                      y_step_q4, w, h, bd);                   \
231
105k
    }                                                                         \
232
3.34M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
228k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
228k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
228k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
214k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
156k
        const int num_taps = 8;                                               \
155
200k
        while (w >= 16) {                                                     \
156
43.6k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
43.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
43.6k
          src += 16;                                                          \
159
43.6k
          dst += 16;                                                          \
160
43.6k
          w -= 16;                                                            \
161
43.6k
        }                                                                     \
162
211k
        while (w >= 8) {                                                      \
163
54.6k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
54.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
54.6k
          src += 8;                                                           \
166
54.6k
          dst += 8;                                                           \
167
54.6k
          w -= 8;                                                             \
168
54.6k
        }                                                                     \
169
229k
        while (w >= 4) {                                                      \
170
73.2k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
73.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
73.2k
          src += 4;                                                           \
173
73.2k
          dst += 4;                                                           \
174
73.2k
          w -= 4;                                                             \
175
73.2k
        }                                                                     \
176
156k
        (void)num_taps;                                                       \
177
156k
      } 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
57.8k
      } else {                                                                \
202
57.8k
        const int num_taps = 2;                                               \
203
87.4k
        while (w >= 16) {                                                     \
204
29.6k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
29.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
29.6k
          src += 16;                                                          \
207
29.6k
          dst += 16;                                                          \
208
29.6k
          w -= 16;                                                            \
209
29.6k
        }                                                                     \
210
72.2k
        while (w >= 8) {                                                      \
211
14.3k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
14.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
14.3k
          src += 8;                                                           \
214
14.3k
          dst += 8;                                                           \
215
14.3k
          w -= 8;                                                             \
216
14.3k
        }                                                                     \
217
79.3k
        while (w >= 4) {                                                      \
218
21.4k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
21.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
21.4k
          src += 4;                                                           \
221
21.4k
          dst += 4;                                                           \
222
21.4k
          w -= 4;                                                             \
223
21.4k
        }                                                                     \
224
57.8k
        (void)num_taps;                                                       \
225
57.8k
      }                                                                       \
226
214k
    }                                                                         \
227
228k
    if (w) {                                                                  \
228
13.9k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
13.9k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
13.9k
                                      y_step_q4, w, h, bd);                   \
231
13.9k
    }                                                                         \
232
228k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
1.44M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.44M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.44M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.39M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.04M
        const int num_taps = 8;                                               \
155
1.29M
        while (w >= 16) {                                                     \
156
255k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
255k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
255k
          src += 16;                                                          \
159
255k
          dst += 16;                                                          \
160
255k
          w -= 16;                                                            \
161
255k
        }                                                                     \
162
1.41M
        while (w >= 8) {                                                      \
163
372k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
372k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
372k
          src += 8;                                                           \
166
372k
          dst += 8;                                                           \
167
372k
          w -= 8;                                                             \
168
372k
        }                                                                     \
169
1.53M
        while (w >= 4) {                                                      \
170
491k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
491k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
491k
          src += 4;                                                           \
173
491k
          dst += 4;                                                           \
174
491k
          w -= 4;                                                             \
175
491k
        }                                                                     \
176
1.04M
        (void)num_taps;                                                       \
177
1.04M
      } 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
357k
      } else {                                                                \
202
357k
        const int num_taps = 2;                                               \
203
512k
        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
452k
        while (w >= 8) {                                                      \
211
95.1k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
95.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
95.1k
          src += 8;                                                           \
214
95.1k
          dst += 8;                                                           \
215
95.1k
          w -= 8;                                                             \
216
95.1k
        }                                                                     \
217
497k
        while (w >= 4) {                                                      \
218
140k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
140k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
140k
          src += 4;                                                           \
221
140k
          dst += 4;                                                           \
222
140k
          w -= 4;                                                             \
223
140k
        }                                                                     \
224
357k
        (void)num_taps;                                                       \
225
357k
      }                                                                       \
226
1.39M
    }                                                                         \
227
1.44M
    if (w) {                                                                  \
228
47.2k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
47.2k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
47.2k
                                      y_step_q4, w, h, bd);                   \
231
47.2k
    }                                                                         \
232
1.44M
  }
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.36M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
3.36M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
3.36M
    assert(w <= 64);                                                           \
241
3.36M
    assert(h <= 64);                                                           \
242
3.36M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
3.27M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
3.27M
          filter_x[3] == 128) {                                                \
245
2.32M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.32M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.32M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.32M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.32M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.32M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.32M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.32M
      } else if (filter_x[2] | filter_x[5]) {                                  \
253
61.6k
        const int num_taps = is_avg ? 8 : 4;                                   \
254
61.6k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
255
61.6k
        vpx_highbd_convolve8_horiz_##opt(                                      \
256
61.6k
            src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,     \
257
61.6k
            filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1,   \
258
61.6k
            bd);                                                               \
259
61.6k
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
260
61.6k
            fdata2 + 64 * (num_taps / 2 - 1), 64, dst, dst_stride, filter,     \
261
61.6k
            x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd);                     \
262
885k
      } else {                                                                 \
263
885k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
885k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
885k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
885k
                                         w, h + 1, bd);                        \
267
885k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
885k
                                               filter, x0_q4, x_step_q4,       \
269
885k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
885k
      }                                                                        \
271
3.27M
    } else {                                                                   \
272
89.2k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
89.2k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
89.2k
                                    bd);                                       \
275
89.2k
    }                                                                          \
276
3.36M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_