Coverage Report

Created: 2026-01-16 07:48

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
270M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
270M
    const int16_t *filter_row = filter[offset];                              \
35
270M
    (void)x0_q4;                                                             \
36
270M
    (void)x_step_q4;                                                         \
37
270M
    (void)y0_q4;                                                             \
38
270M
    (void)y_step_q4;                                                         \
39
270M
    assert(filter_row[3] != 128);                                            \
40
270M
    assert(step_q4 == 16);                                                   \
41
270M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
129M
      const int num_taps = 8;                                                \
43
146M
      while (w >= 16) {                                                      \
44
16.6M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
16.6M
                                                 dst_stride, h, filter_row); \
46
16.6M
        src += 16;                                                           \
47
16.6M
        dst += 16;                                                           \
48
16.6M
        w -= 16;                                                             \
49
16.6M
      }                                                                      \
50
129M
      if (w == 8) {                                                          \
51
36.8M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
36.8M
                                                dst_stride, h, filter_row);  \
53
92.8M
      } else if (w == 4) {                                                   \
54
79.3M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
79.3M
                                                dst_stride, h, filter_row);  \
56
79.3M
      }                                                                      \
57
129M
      (void)num_taps;                                                        \
58
140M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
135M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
150M
      while (w >= 16) {                                                      \
61
15.4M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
15.4M
                                                 dst_stride, h, filter_row); \
63
15.4M
        src += 16;                                                           \
64
15.4M
        dst += 16;                                                           \
65
15.4M
        w -= 16;                                                             \
66
15.4M
      }                                                                      \
67
135M
      if (w == 8) {                                                          \
68
33.2M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
33.2M
                                                dst_stride, h, filter_row);  \
70
101M
      } else if (w == 4) {                                                   \
71
90.2M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
90.2M
                                                dst_stride, h, filter_row);  \
73
90.2M
      }                                                                      \
74
135M
      (void)num_taps;                                                        \
75
135M
    } else {                                                                 \
76
5.32M
      const int num_taps = 2;                                                \
77
7.74M
      while (w >= 16) {                                                      \
78
2.42M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
2.42M
                                                 dst_stride, h, filter_row); \
80
2.42M
        src += 16;                                                           \
81
2.42M
        dst += 16;                                                           \
82
2.42M
        w -= 16;                                                             \
83
2.42M
      }                                                                      \
84
5.32M
      if (w == 8) {                                                          \
85
1.58M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
1.58M
                                                dst_stride, h, filter_row);  \
87
3.73M
      } else if (w == 4) {                                                   \
88
2.06M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
2.06M
                                                dst_stride, h, filter_row);  \
90
2.06M
      }                                                                      \
91
5.32M
      (void)num_taps;                                                        \
92
5.32M
    }                                                                        \
93
270M
  }
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
79.9M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
79.9M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
79.9M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
79.9M
    (void)filter_y;                                                            \
103
79.9M
    assert(filter_x[3] != 128);                                                \
104
79.9M
    assert(filter_y[3] != 128);                                                \
105
79.9M
    assert(w <= 64);                                                           \
106
79.9M
    assert(h <= 64);                                                           \
107
79.9M
    assert(x_step_q4 == 16);                                                   \
108
79.9M
    assert(y_step_q4 == 16);                                                   \
109
79.9M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
39.5M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
39.5M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
39.5M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
39.5M
                                h + 7);                                        \
114
39.5M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
39.5M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
39.5M
                                      y_step_q4, w, h);                        \
117
40.3M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
38.3M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
38.3M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
38.3M
      vpx_convolve8_horiz_##opt(                                               \
121
38.3M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
38.3M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
38.3M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
38.3M
                                      dst, dst_stride, filter, x0_q4,          \
125
38.3M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
38.3M
    } else {                                                                   \
127
2.01M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
2.01M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
2.01M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
2.01M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
2.01M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
2.01M
                                      h);                                      \
133
2.01M
    }                                                                          \
134
79.9M
  }
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
7.57M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
7.57M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
7.57M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
7.34M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
5.26M
        const int num_taps = 8;                                               \
155
6.69M
        while (w >= 16) {                                                     \
156
1.42M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.42M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.42M
          src += 16;                                                          \
159
1.42M
          dst += 16;                                                          \
160
1.42M
          w -= 16;                                                            \
161
1.42M
        }                                                                     \
162
7.00M
        while (w >= 8) {                                                      \
163
1.73M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
1.73M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
1.73M
          src += 8;                                                           \
166
1.73M
          dst += 8;                                                           \
167
1.73M
          w -= 8;                                                             \
168
1.73M
        }                                                                     \
169
7.84M
        while (w >= 4) {                                                      \
170
2.57M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
2.57M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
2.57M
          src += 4;                                                           \
173
2.57M
          dst += 4;                                                           \
174
2.57M
          w -= 4;                                                             \
175
2.57M
        }                                                                     \
176
5.26M
        (void)num_taps;                                                       \
177
5.26M
      } 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
2.07M
      } else {                                                                \
202
2.07M
        const int num_taps = 2;                                               \
203
2.90M
        while (w >= 16) {                                                     \
204
831k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
831k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
831k
          src += 16;                                                          \
207
831k
          dst += 16;                                                          \
208
831k
          w -= 16;                                                            \
209
831k
        }                                                                     \
210
2.61M
        while (w >= 8) {                                                      \
211
533k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
533k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
533k
          src += 8;                                                           \
214
533k
          dst += 8;                                                           \
215
533k
          w -= 8;                                                             \
216
533k
        }                                                                     \
217
2.97M
        while (w >= 4) {                                                      \
218
894k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
894k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
894k
          src += 4;                                                           \
221
894k
          dst += 4;                                                           \
222
894k
          w -= 4;                                                             \
223
894k
        }                                                                     \
224
2.07M
        (void)num_taps;                                                       \
225
2.07M
      }                                                                       \
226
7.34M
    }                                                                         \
227
7.57M
    if (w) {                                                                  \
228
224k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
224k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
224k
                                      y_step_q4, w, h, bd);                   \
231
224k
    }                                                                         \
232
7.57M
  }
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.38M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.38M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.38M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.37M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.41M
        const int num_taps = 8;                                               \
155
3.05M
        while (w >= 16) {                                                     \
156
640k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
640k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
640k
          src += 16;                                                          \
159
640k
          dst += 16;                                                          \
160
640k
          w -= 16;                                                            \
161
640k
        }                                                                     \
162
3.20M
        while (w >= 8) {                                                      \
163
789k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
789k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
789k
          src += 8;                                                           \
166
789k
          dst += 8;                                                           \
167
789k
          w -= 8;                                                             \
168
789k
        }                                                                     \
169
3.60M
        while (w >= 4) {                                                      \
170
1.18M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.18M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.18M
          src += 4;                                                           \
173
1.18M
          dst += 4;                                                           \
174
1.18M
          w -= 4;                                                             \
175
1.18M
        }                                                                     \
176
2.41M
        (void)num_taps;                                                       \
177
2.41M
      } 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
962k
      } else {                                                                \
202
962k
        const int num_taps = 2;                                               \
203
1.34M
        while (w >= 16) {                                                     \
204
381k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
381k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
381k
          src += 16;                                                          \
207
381k
          dst += 16;                                                          \
208
381k
          w -= 16;                                                            \
209
381k
        }                                                                     \
210
1.20M
        while (w >= 8) {                                                      \
211
247k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
247k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
247k
          src += 8;                                                           \
214
247k
          dst += 8;                                                           \
215
247k
          w -= 8;                                                             \
216
247k
        }                                                                     \
217
1.37M
        while (w >= 4) {                                                      \
218
416k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
416k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
416k
          src += 4;                                                           \
221
416k
          dst += 4;                                                           \
222
416k
          w -= 4;                                                             \
223
416k
        }                                                                     \
224
962k
        (void)num_taps;                                                       \
225
962k
      }                                                                       \
226
3.37M
    }                                                                         \
227
3.38M
    if (w) {                                                                  \
228
9.05k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
9.05k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
9.05k
                                      y_step_q4, w, h, bd);                   \
231
9.05k
    }                                                                         \
232
3.38M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
2.82M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
2.82M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
2.82M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.68M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.98M
        const int num_taps = 8;                                               \
155
2.51M
        while (w >= 16) {                                                     \
156
530k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
530k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
530k
          src += 16;                                                          \
159
530k
          dst += 16;                                                          \
160
530k
          w -= 16;                                                            \
161
530k
        }                                                                     \
162
2.65M
        while (w >= 8) {                                                      \
163
672k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
672k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
672k
          src += 8;                                                           \
166
672k
          dst += 8;                                                           \
167
672k
          w -= 8;                                                             \
168
672k
        }                                                                     \
169
2.93M
        while (w >= 4) {                                                      \
170
950k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
950k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
950k
          src += 4;                                                           \
173
950k
          dst += 4;                                                           \
174
950k
          w -= 4;                                                             \
175
950k
        }                                                                     \
176
1.98M
        (void)num_taps;                                                       \
177
1.98M
      } 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
699k
      } else {                                                                \
202
699k
        const int num_taps = 2;                                               \
203
966k
        while (w >= 16) {                                                     \
204
266k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
266k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
266k
          src += 16;                                                          \
207
266k
          dst += 16;                                                          \
208
266k
          w -= 16;                                                            \
209
266k
        }                                                                     \
210
877k
        while (w >= 8) {                                                      \
211
177k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
177k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
177k
          src += 8;                                                           \
214
177k
          dst += 8;                                                           \
215
177k
          w -= 8;                                                             \
216
177k
        }                                                                     \
217
1.01M
        while (w >= 4) {                                                      \
218
313k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
313k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
313k
          src += 4;                                                           \
221
313k
          dst += 4;                                                           \
222
313k
          w -= 4;                                                             \
223
313k
        }                                                                     \
224
699k
        (void)num_taps;                                                       \
225
699k
      }                                                                       \
226
2.68M
    }                                                                         \
227
2.82M
    if (w) {                                                                  \
228
148k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
148k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
148k
                                      y_step_q4, w, h, bd);                   \
231
148k
    }                                                                         \
232
2.82M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
183k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
183k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
183k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
176k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
120k
        const int num_taps = 8;                                               \
155
160k
        while (w >= 16) {                                                     \
156
40.3k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
40.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
40.3k
          src += 16;                                                          \
159
40.3k
          dst += 16;                                                          \
160
40.3k
          w -= 16;                                                            \
161
40.3k
        }                                                                     \
162
158k
        while (w >= 8) {                                                      \
163
38.2k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
38.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
38.2k
          src += 8;                                                           \
166
38.2k
          dst += 8;                                                           \
167
38.2k
          w -= 8;                                                             \
168
38.2k
        }                                                                     \
169
176k
        while (w >= 4) {                                                      \
170
56.1k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
56.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
56.1k
          src += 4;                                                           \
173
56.1k
          dst += 4;                                                           \
174
56.1k
          w -= 4;                                                             \
175
56.1k
        }                                                                     \
176
120k
        (void)num_taps;                                                       \
177
120k
      } 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
55.5k
      } else {                                                                \
202
55.5k
        const int num_taps = 2;                                               \
203
81.7k
        while (w >= 16) {                                                     \
204
26.2k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
26.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
26.2k
          src += 16;                                                          \
207
26.2k
          dst += 16;                                                          \
208
26.2k
          w -= 16;                                                            \
209
26.2k
        }                                                                     \
210
69.4k
        while (w >= 8) {                                                      \
211
13.9k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
13.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
13.9k
          src += 8;                                                           \
214
13.9k
          dst += 8;                                                           \
215
13.9k
          w -= 8;                                                             \
216
13.9k
        }                                                                     \
217
78.1k
        while (w >= 4) {                                                      \
218
22.6k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
22.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
22.6k
          src += 4;                                                           \
221
22.6k
          dst += 4;                                                           \
222
22.6k
          w -= 4;                                                             \
223
22.6k
        }                                                                     \
224
55.5k
        (void)num_taps;                                                       \
225
55.5k
      }                                                                       \
226
176k
    }                                                                         \
227
183k
    if (w) {                                                                  \
228
7.54k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
7.54k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
7.54k
                                      y_step_q4, w, h, bd);                   \
231
7.54k
    }                                                                         \
232
183k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
1.17M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.17M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.17M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.11M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
757k
        const int num_taps = 8;                                               \
155
968k
        while (w >= 16) {                                                     \
156
210k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
210k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
210k
          src += 16;                                                          \
159
210k
          dst += 16;                                                          \
160
210k
          w -= 16;                                                            \
161
210k
        }                                                                     \
162
995k
        while (w >= 8) {                                                      \
163
238k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
238k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
238k
          src += 8;                                                           \
166
238k
          dst += 8;                                                           \
167
238k
          w -= 8;                                                             \
168
238k
        }                                                                     \
169
1.13M
        while (w >= 4) {                                                      \
170
376k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
376k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
376k
          src += 4;                                                           \
173
376k
          dst += 4;                                                           \
174
376k
          w -= 4;                                                             \
175
376k
        }                                                                     \
176
757k
        (void)num_taps;                                                       \
177
757k
      } else if (filter_row[2] | filter_row[5]) {                             \
178
0
        const int num_taps = is_avg ? 8 : 4;                                  \
179
0
        while (w >= 16) {                                                     \
180
0
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
0
          src += 16;                                                          \
183
0
          dst += 16;                                                          \
184
0
          w -= 16;                                                            \
185
0
        }                                                                     \
186
0
        while (w >= 8) {                                                      \
187
0
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
0
          src += 8;                                                           \
190
0
          dst += 8;                                                           \
191
0
          w -= 8;                                                             \
192
0
        }                                                                     \
193
0
        while (w >= 4) {                                                      \
194
0
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
0
          src += 4;                                                           \
197
0
          dst += 4;                                                           \
198
0
          w -= 4;                                                             \
199
0
        }                                                                     \
200
0
        (void)num_taps;                                                       \
201
359k
      } else {                                                                \
202
359k
        const int num_taps = 2;                                               \
203
516k
        while (w >= 16) {                                                     \
204
156k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
156k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
156k
          src += 16;                                                          \
207
156k
          dst += 16;                                                          \
208
156k
          w -= 16;                                                            \
209
156k
        }                                                                     \
210
454k
        while (w >= 8) {                                                      \
211
94.5k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
94.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
94.5k
          src += 8;                                                           \
214
94.5k
          dst += 8;                                                           \
215
94.5k
          w -= 8;                                                             \
216
94.5k
        }                                                                     \
217
502k
        while (w >= 4) {                                                      \
218
142k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
142k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
142k
          src += 4;                                                           \
221
142k
          dst += 4;                                                           \
222
142k
          w -= 4;                                                             \
223
142k
        }                                                                     \
224
359k
        (void)num_taps;                                                       \
225
359k
      }                                                                       \
226
1.11M
    }                                                                         \
227
1.17M
    if (w) {                                                                  \
228
60.1k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
60.1k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
60.1k
                                      y_step_q4, w, h, bd);                   \
231
60.1k
    }                                                                         \
232
1.17M
  }
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
2.97M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
2.97M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
2.97M
    assert(w <= 64);                                                           \
241
2.97M
    assert(h <= 64);                                                           \
242
2.97M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
2.88M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
2.88M
          filter_x[3] == 128) {                                                \
245
2.04M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.04M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.04M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.04M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.04M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.04M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.04M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.04M
      } 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
836k
      } else {                                                                 \
263
836k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
836k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
836k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
836k
                                         w, h + 1, bd);                        \
267
836k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
836k
                                               filter, x0_q4, x_step_q4,       \
269
836k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
836k
      }                                                                        \
271
2.88M
    } else {                                                                   \
272
94.0k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
94.0k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
94.0k
                                    bd);                                       \
275
94.0k
    }                                                                          \
276
2.97M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_