Coverage Report

Created: 2026-09-01 06:54

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
597M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
597M
    const int16_t *filter_row = filter[offset];                              \
35
597M
    (void)x0_q4;                                                             \
36
597M
    (void)x_step_q4;                                                         \
37
597M
    (void)y0_q4;                                                             \
38
597M
    (void)y_step_q4;                                                         \
39
597M
    assert(filter_row[3] != 128);                                            \
40
597M
    assert(step_q4 == 16);                                                   \
41
597M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
529M
      const int num_taps = 8;                                                \
43
618M
      while (w >= 16) {                                                      \
44
89.1M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
89.1M
                                                 dst_stride, h, filter_row); \
46
89.1M
        src += 16;                                                           \
47
89.1M
        dst += 16;                                                           \
48
89.1M
        w -= 16;                                                             \
49
89.1M
      }                                                                      \
50
529M
      if (w == 8) {                                                          \
51
187M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
187M
                                                dst_stride, h, filter_row);  \
53
342M
      } else if (w == 4) {                                                   \
54
281M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
281M
                                                dst_stride, h, filter_row);  \
56
281M
      }                                                                      \
57
529M
      (void)num_taps;                                                        \
58
529M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
0
      const int num_taps = is_avg ? 8 : 4;                                   \
60
0
      while (w >= 16) {                                                      \
61
0
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
0
                                                 dst_stride, h, filter_row); \
63
0
        src += 16;                                                           \
64
0
        dst += 16;                                                           \
65
0
        w -= 16;                                                             \
66
0
      }                                                                      \
67
0
      if (w == 8) {                                                          \
68
0
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
0
                                                dst_stride, h, filter_row);  \
70
0
      } else if (w == 4) {                                                   \
71
0
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
0
                                                dst_stride, h, filter_row);  \
73
0
      }                                                                      \
74
0
      (void)num_taps;                                                        \
75
68.3M
    } else {                                                                 \
76
68.3M
      const int num_taps = 2;                                                \
77
86.3M
      while (w >= 16) {                                                      \
78
17.9M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
17.9M
                                                 dst_stride, h, filter_row); \
80
17.9M
        src += 16;                                                           \
81
17.9M
        dst += 16;                                                           \
82
17.9M
        w -= 16;                                                             \
83
17.9M
      }                                                                      \
84
68.3M
      if (w == 8) {                                                          \
85
22.0M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
22.0M
                                                dst_stride, h, filter_row);  \
87
46.3M
      } else if (w == 4) {                                                   \
88
32.6M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
32.6M
                                                dst_stride, h, filter_row);  \
90
32.6M
      }                                                                      \
91
68.3M
      (void)num_taps;                                                        \
92
68.3M
    }                                                                        \
93
597M
  }
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
171M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
171M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
171M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
171M
    (void)filter_y;                                                            \
103
171M
    assert(filter_x[3] != 128);                                                \
104
171M
    assert(filter_y[3] != 128);                                                \
105
171M
    assert(w <= 64);                                                           \
106
171M
    assert(h <= 64);                                                           \
107
171M
    assert(x_step_q4 == 16);                                                   \
108
171M
    assert(y_step_q4 == 16);                                                   \
109
171M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
142M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
142M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
142M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
142M
                                h + 7);                                        \
114
142M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
142M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
142M
                                      y_step_q4, w, h);                        \
117
142M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
0
      const int num_taps = is_avg ? 8 : 4;                                     \
119
0
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
0
      vpx_convolve8_horiz_##opt(                                               \
121
0
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
0
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
0
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
0
                                      dst, dst_stride, filter, x0_q4,          \
125
0
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
29.0M
    } else {                                                                   \
127
29.0M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
29.0M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
29.0M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
29.0M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
29.0M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
29.0M
                                      h);                                      \
133
29.0M
    }                                                                          \
134
171M
  }
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
6.29M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
6.29M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
6.29M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
5.97M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
5.58M
        const int num_taps = 8;                                               \
155
7.43M
        while (w >= 16) {                                                     \
156
1.85M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.85M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.85M
          src += 16;                                                          \
159
1.85M
          dst += 16;                                                          \
160
1.85M
          w -= 16;                                                            \
161
1.85M
        }                                                                     \
162
7.26M
        while (w >= 8) {                                                      \
163
1.68M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
1.68M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
1.68M
          src += 8;                                                           \
166
1.68M
          dst += 8;                                                           \
167
1.68M
          w -= 8;                                                             \
168
1.68M
        }                                                                     \
169
8.19M
        while (w >= 4) {                                                      \
170
2.60M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
2.60M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
2.60M
          src += 4;                                                           \
173
2.60M
          dst += 4;                                                           \
174
2.60M
          w -= 4;                                                             \
175
2.60M
        }                                                                     \
176
5.58M
        (void)num_taps;                                                       \
177
5.58M
      } 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
388k
      } else {                                                                \
202
388k
        const int num_taps = 2;                                               \
203
596k
        while (w >= 16) {                                                     \
204
208k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
208k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
208k
          src += 16;                                                          \
207
208k
          dst += 16;                                                          \
208
208k
          w -= 16;                                                            \
209
208k
        }                                                                     \
210
500k
        while (w >= 8) {                                                      \
211
112k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
112k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
112k
          src += 8;                                                           \
214
112k
          dst += 8;                                                           \
215
112k
          w -= 8;                                                             \
216
112k
        }                                                                     \
217
540k
        while (w >= 4) {                                                      \
218
152k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
152k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
152k
          src += 4;                                                           \
221
152k
          dst += 4;                                                           \
222
152k
          w -= 4;                                                             \
223
152k
        }                                                                     \
224
388k
        (void)num_taps;                                                       \
225
388k
      }                                                                       \
226
5.97M
    }                                                                         \
227
6.29M
    if (w) {                                                                  \
228
324k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
324k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
324k
                                      y_step_q4, w, h, bd);                   \
231
324k
    }                                                                         \
232
6.29M
  }
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
2.88M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
2.88M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
2.88M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.79M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.61M
        const int num_taps = 8;                                               \
155
3.46M
        while (w >= 16) {                                                     \
156
848k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
848k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
848k
          src += 16;                                                          \
159
848k
          dst += 16;                                                          \
160
848k
          w -= 16;                                                            \
161
848k
        }                                                                     \
162
3.40M
        while (w >= 8) {                                                      \
163
788k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
788k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
788k
          src += 8;                                                           \
166
788k
          dst += 8;                                                           \
167
788k
          w -= 8;                                                             \
168
788k
        }                                                                     \
169
3.83M
        while (w >= 4) {                                                      \
170
1.22M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.22M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.22M
          src += 4;                                                           \
173
1.22M
          dst += 4;                                                           \
174
1.22M
          w -= 4;                                                             \
175
1.22M
        }                                                                     \
176
2.61M
        (void)num_taps;                                                       \
177
2.61M
      } 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
179k
      } else {                                                                \
202
179k
        const int num_taps = 2;                                               \
203
275k
        while (w >= 16) {                                                     \
204
96.2k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
96.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
96.2k
          src += 16;                                                          \
207
96.2k
          dst += 16;                                                          \
208
96.2k
          w -= 16;                                                            \
209
96.2k
        }                                                                     \
210
231k
        while (w >= 8) {                                                      \
211
51.8k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
51.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
51.8k
          src += 8;                                                           \
214
51.8k
          dst += 8;                                                           \
215
51.8k
          w -= 8;                                                             \
216
51.8k
        }                                                                     \
217
249k
        while (w >= 4) {                                                      \
218
70.2k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
70.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
70.2k
          src += 4;                                                           \
221
70.2k
          dst += 4;                                                           \
222
70.2k
          w -= 4;                                                             \
223
70.2k
        }                                                                     \
224
179k
        (void)num_taps;                                                       \
225
179k
      }                                                                       \
226
2.79M
    }                                                                         \
227
2.88M
    if (w) {                                                                  \
228
89.9k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
89.9k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
89.9k
                                      y_step_q4, w, h, bd);                   \
231
89.9k
    }                                                                         \
232
2.88M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
2.65M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
2.65M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
2.65M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.55M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.42M
        const int num_taps = 8;                                               \
155
3.23M
        while (w >= 16) {                                                     \
156
809k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
809k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
809k
          src += 16;                                                          \
159
809k
          dst += 16;                                                          \
160
809k
          w -= 16;                                                            \
161
809k
        }                                                                     \
162
3.15M
        while (w >= 8) {                                                      \
163
731k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
731k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
731k
          src += 8;                                                           \
166
731k
          dst += 8;                                                           \
167
731k
          w -= 8;                                                             \
168
731k
        }                                                                     \
169
3.55M
        while (w >= 4) {                                                      \
170
1.12M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.12M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.12M
          src += 4;                                                           \
173
1.12M
          dst += 4;                                                           \
174
1.12M
          w -= 4;                                                             \
175
1.12M
        }                                                                     \
176
2.42M
        (void)num_taps;                                                       \
177
2.42M
      } 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
133k
      } else {                                                                \
202
133k
        const int num_taps = 2;                                               \
203
200k
        while (w >= 16) {                                                     \
204
67.1k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
67.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
67.1k
          src += 16;                                                          \
207
67.1k
          dst += 16;                                                          \
208
67.1k
          w -= 16;                                                            \
209
67.1k
        }                                                                     \
210
173k
        while (w >= 8) {                                                      \
211
39.3k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
39.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
39.3k
          src += 8;                                                           \
214
39.3k
          dst += 8;                                                           \
215
39.3k
          w -= 8;                                                             \
216
39.3k
        }                                                                     \
217
187k
        while (w >= 4) {                                                      \
218
54.0k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
54.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
54.0k
          src += 4;                                                           \
221
54.0k
          dst += 4;                                                           \
222
54.0k
          w -= 4;                                                             \
223
54.0k
        }                                                                     \
224
133k
        (void)num_taps;                                                       \
225
133k
      }                                                                       \
226
2.55M
    }                                                                         \
227
2.65M
    if (w) {                                                                  \
228
93.4k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
93.4k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
93.4k
                                      y_step_q4, w, h, bd);                   \
231
93.4k
    }                                                                         \
232
2.65M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
203k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
203k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
203k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
108k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
86.4k
        const int num_taps = 8;                                               \
155
120k
        while (w >= 16) {                                                     \
156
33.9k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
33.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
33.9k
          src += 16;                                                          \
159
33.9k
          dst += 16;                                                          \
160
33.9k
          w -= 16;                                                            \
161
33.9k
        }                                                                     \
162
111k
        while (w >= 8) {                                                      \
163
24.9k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
24.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
24.9k
          src += 8;                                                           \
166
24.9k
          dst += 8;                                                           \
167
24.9k
          w -= 8;                                                             \
168
24.9k
        }                                                                     \
169
126k
        while (w >= 4) {                                                      \
170
40.3k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
40.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
40.3k
          src += 4;                                                           \
173
40.3k
          dst += 4;                                                           \
174
40.3k
          w -= 4;                                                             \
175
40.3k
        }                                                                     \
176
86.4k
        (void)num_taps;                                                       \
177
86.4k
      } 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
21.7k
      } else {                                                                \
202
21.7k
        const int num_taps = 2;                                               \
203
37.3k
        while (w >= 16) {                                                     \
204
15.6k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
15.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
15.6k
          src += 16;                                                          \
207
15.6k
          dst += 16;                                                          \
208
15.6k
          w -= 16;                                                            \
209
15.6k
        }                                                                     \
210
27.5k
        while (w >= 8) {                                                      \
211
5.83k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
5.83k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
5.83k
          src += 8;                                                           \
214
5.83k
          dst += 8;                                                           \
215
5.83k
          w -= 8;                                                             \
216
5.83k
        }                                                                     \
217
29.5k
        while (w >= 4) {                                                      \
218
7.84k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
7.84k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
7.84k
          src += 4;                                                           \
221
7.84k
          dst += 4;                                                           \
222
7.84k
          w -= 4;                                                             \
223
7.84k
        }                                                                     \
224
21.7k
        (void)num_taps;                                                       \
225
21.7k
      }                                                                       \
226
108k
    }                                                                         \
227
203k
    if (w) {                                                                  \
228
95.4k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
95.4k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
95.4k
                                      y_step_q4, w, h, bd);                   \
231
95.4k
    }                                                                         \
232
203k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
557k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
557k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
557k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
511k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
458k
        const int num_taps = 8;                                               \
155
618k
        while (w >= 16) {                                                     \
156
160k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
160k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
160k
          src += 16;                                                          \
159
160k
          dst += 16;                                                          \
160
160k
          w -= 16;                                                            \
161
160k
        }                                                                     \
162
596k
        while (w >= 8) {                                                      \
163
138k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
138k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
138k
          src += 8;                                                           \
166
138k
          dst += 8;                                                           \
167
138k
          w -= 8;                                                             \
168
138k
        }                                                                     \
169
672k
        while (w >= 4) {                                                      \
170
213k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
213k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
213k
          src += 4;                                                           \
173
213k
          dst += 4;                                                           \
174
213k
          w -= 4;                                                             \
175
213k
        }                                                                     \
176
458k
        (void)num_taps;                                                       \
177
458k
      } 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.3k
      } else {                                                                \
202
53.3k
        const int num_taps = 2;                                               \
203
82.7k
        while (w >= 16) {                                                     \
204
29.3k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
29.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
29.3k
          src += 16;                                                          \
207
29.3k
          dst += 16;                                                          \
208
29.3k
          w -= 16;                                                            \
209
29.3k
        }                                                                     \
210
68.3k
        while (w >= 8) {                                                      \
211
14.9k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
14.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
14.9k
          src += 8;                                                           \
214
14.9k
          dst += 8;                                                           \
215
14.9k
          w -= 8;                                                             \
216
14.9k
        }                                                                     \
217
73.9k
        while (w >= 4) {                                                      \
218
20.6k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
20.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
20.6k
          src += 4;                                                           \
221
20.6k
          dst += 4;                                                           \
222
20.6k
          w -= 4;                                                             \
223
20.6k
        }                                                                     \
224
53.3k
        (void)num_taps;                                                       \
225
53.3k
      }                                                                       \
226
511k
    }                                                                         \
227
557k
    if (w) {                                                                  \
228
46.0k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
46.0k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
46.0k
                                      y_step_q4, w, h, bd);                   \
231
46.0k
    }                                                                         \
232
557k
  }
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
4.43M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
4.43M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
4.43M
    assert(w <= 64);                                                           \
241
4.43M
    assert(h <= 64);                                                           \
242
4.43M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
2.27M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
2.27M
          filter_x[3] == 128) {                                                \
245
2.13M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.13M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.13M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.13M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.13M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.13M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.13M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.13M
      } else if (filter_x[2] | filter_x[5]) {                                  \
253
0
        const int num_taps = is_avg ? 8 : 4;                                   \
254
0
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
255
0
        vpx_highbd_convolve8_horiz_##opt(                                      \
256
0
            src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,     \
257
0
            filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1,   \
258
0
            bd);                                                               \
259
0
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
260
0
            fdata2 + 64 * (num_taps / 2 - 1), 64, dst, dst_stride, filter,     \
261
0
            x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, bd);                     \
262
139k
      } else {                                                                 \
263
139k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
139k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
139k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
139k
                                         w, h + 1, bd);                        \
267
139k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
139k
                                               filter, x0_q4, x_step_q4,       \
269
139k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
139k
      }                                                                        \
271
2.27M
    } else {                                                                   \
272
2.15M
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
2.15M
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
2.15M
                                    bd);                                       \
275
2.15M
    }                                                                          \
276
4.43M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_