Coverage Report

Created: 2026-02-14 06:59

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
185M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
185M
    const int16_t *filter_row = filter[offset];                              \
35
185M
    (void)x0_q4;                                                             \
36
185M
    (void)x_step_q4;                                                         \
37
185M
    (void)y0_q4;                                                             \
38
185M
    (void)y_step_q4;                                                         \
39
185M
    assert(filter_row[3] != 128);                                            \
40
185M
    assert(step_q4 == 16);                                                   \
41
185M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
83.1M
      const int num_taps = 8;                                                \
43
93.8M
      while (w >= 16) {                                                      \
44
10.6M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
10.6M
                                                 dst_stride, h, filter_row); \
46
10.6M
        src += 16;                                                           \
47
10.6M
        dst += 16;                                                           \
48
10.6M
        w -= 16;                                                             \
49
10.6M
      }                                                                      \
50
83.1M
      if (w == 8) {                                                          \
51
23.1M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
23.1M
                                                dst_stride, h, filter_row);  \
53
60.0M
      } else if (w == 4) {                                                   \
54
51.4M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
51.4M
                                                dst_stride, h, filter_row);  \
56
51.4M
      }                                                                      \
57
83.1M
      (void)num_taps;                                                        \
58
101M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
96.2M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
108M
      while (w >= 16) {                                                      \
61
11.7M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
11.7M
                                                 dst_stride, h, filter_row); \
63
11.7M
        src += 16;                                                           \
64
11.7M
        dst += 16;                                                           \
65
11.7M
        w -= 16;                                                             \
66
11.7M
      }                                                                      \
67
96.2M
      if (w == 8) {                                                          \
68
23.9M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
23.9M
                                                dst_stride, h, filter_row);  \
70
72.2M
      } else if (w == 4) {                                                   \
71
63.4M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
63.4M
                                                dst_stride, h, filter_row);  \
73
63.4M
      }                                                                      \
74
96.2M
      (void)num_taps;                                                        \
75
96.2M
    } else {                                                                 \
76
5.69M
      const int num_taps = 2;                                                \
77
8.25M
      while (w >= 16) {                                                      \
78
2.55M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
2.55M
                                                 dst_stride, h, filter_row); \
80
2.55M
        src += 16;                                                           \
81
2.55M
        dst += 16;                                                           \
82
2.55M
        w -= 16;                                                             \
83
2.55M
      }                                                                      \
84
5.69M
      if (w == 8) {                                                          \
85
1.70M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
1.70M
                                                dst_stride, h, filter_row);  \
87
3.98M
      } else if (w == 4) {                                                   \
88
2.19M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
2.19M
                                                dst_stride, h, filter_row);  \
90
2.19M
      }                                                                      \
91
5.69M
      (void)num_taps;                                                        \
92
5.69M
    }                                                                        \
93
185M
  }
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
54.3M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
54.3M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
54.3M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
54.3M
    (void)filter_y;                                                            \
103
54.3M
    assert(filter_x[3] != 128);                                                \
104
54.3M
    assert(filter_y[3] != 128);                                                \
105
54.3M
    assert(w <= 64);                                                           \
106
54.3M
    assert(h <= 64);                                                           \
107
54.3M
    assert(x_step_q4 == 16);                                                   \
108
54.3M
    assert(y_step_q4 == 16);                                                   \
109
54.3M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
25.4M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
25.4M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
25.4M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
25.4M
                                h + 7);                                        \
114
25.4M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
25.4M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
25.4M
                                      y_step_q4, w, h);                        \
117
28.8M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
26.6M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
26.6M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
26.6M
      vpx_convolve8_horiz_##opt(                                               \
121
26.6M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
26.6M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
26.6M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
26.6M
                                      dst, dst_stride, filter, x0_q4,          \
125
26.6M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
26.6M
    } else {                                                                   \
127
2.15M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
2.15M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
2.15M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
2.15M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
2.15M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
2.15M
                                      h);                                      \
133
2.15M
    }                                                                          \
134
54.3M
  }
135
136
#if CONFIG_VP9_HIGHBITDEPTH
137
138
typedef void highbd_filter8_1dfunction(const uint16_t *src_ptr,
139
                                       const ptrdiff_t src_pitch,
140
                                       uint16_t *output_ptr,
141
                                       ptrdiff_t out_pitch,
142
                                       unsigned int output_height,
143
                                       const int16_t *filter, int bd);
144
145
#define HIGH_FUN_CONV_1D(name, offset, step_q4, dir, src_start, avg, opt,     \
146
                         is_avg)                                              \
147
  void vpx_highbd_convolve8_##name##_##opt(                                   \
148
      const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst,               \
149
      ptrdiff_t dst_stride, const InterpKernel *filter_kernel, int x0_q4,     \
150
8.10M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
8.10M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
8.10M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
7.90M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
5.92M
        const int num_taps = 8;                                               \
155
7.40M
        while (w >= 16) {                                                     \
156
1.47M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.47M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.47M
          src += 16;                                                          \
159
1.47M
          dst += 16;                                                          \
160
1.47M
          w -= 16;                                                            \
161
1.47M
        }                                                                     \
162
7.86M
        while (w >= 8) {                                                      \
163
1.93M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
1.93M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
1.93M
          src += 8;                                                           \
166
1.93M
          dst += 8;                                                           \
167
1.93M
          w -= 8;                                                             \
168
1.93M
        }                                                                     \
169
8.90M
        while (w >= 4) {                                                      \
170
2.98M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
2.98M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
2.98M
          src += 4;                                                           \
173
2.98M
          dst += 4;                                                           \
174
2.98M
          w -= 4;                                                             \
175
2.98M
        }                                                                     \
176
5.92M
        (void)num_taps;                                                       \
177
5.92M
      } 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
1.97M
      } else {                                                                \
202
1.97M
        const int num_taps = 2;                                               \
203
2.76M
        while (w >= 16) {                                                     \
204
789k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
789k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
789k
          src += 16;                                                          \
207
789k
          dst += 16;                                                          \
208
789k
          w -= 16;                                                            \
209
789k
        }                                                                     \
210
2.48M
        while (w >= 8) {                                                      \
211
506k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
506k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
506k
          src += 8;                                                           \
214
506k
          dst += 8;                                                           \
215
506k
          w -= 8;                                                             \
216
506k
        }                                                                     \
217
2.82M
        while (w >= 4) {                                                      \
218
850k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
850k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
850k
          src += 4;                                                           \
221
850k
          dst += 4;                                                           \
222
850k
          w -= 4;                                                             \
223
850k
        }                                                                     \
224
1.97M
        (void)num_taps;                                                       \
225
1.97M
      }                                                                       \
226
7.90M
    }                                                                         \
227
8.10M
    if (w) {                                                                  \
228
202k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
202k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
202k
                                      y_step_q4, w, h, bd);                   \
231
202k
    }                                                                         \
232
8.10M
  }
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.61M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.61M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.61M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.60M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.69M
        const int num_taps = 8;                                               \
155
3.35M
        while (w >= 16) {                                                     \
156
662k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
662k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
662k
          src += 16;                                                          \
159
662k
          dst += 16;                                                          \
160
662k
          w -= 16;                                                            \
161
662k
        }                                                                     \
162
3.56M
        while (w >= 8) {                                                      \
163
866k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
866k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
866k
          src += 8;                                                           \
166
866k
          dst += 8;                                                           \
167
866k
          w -= 8;                                                             \
168
866k
        }                                                                     \
169
4.07M
        while (w >= 4) {                                                      \
170
1.37M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.37M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.37M
          src += 4;                                                           \
173
1.37M
          dst += 4;                                                           \
174
1.37M
          w -= 4;                                                             \
175
1.37M
        }                                                                     \
176
2.69M
        (void)num_taps;                                                       \
177
2.69M
      } 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
911k
      } else {                                                                \
202
911k
        const int num_taps = 2;                                               \
203
1.27M
        while (w >= 16) {                                                     \
204
358k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
358k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
358k
          src += 16;                                                          \
207
358k
          dst += 16;                                                          \
208
358k
          w -= 16;                                                            \
209
358k
        }                                                                     \
210
1.14M
        while (w >= 8) {                                                      \
211
233k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
233k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
233k
          src += 8;                                                           \
214
233k
          dst += 8;                                                           \
215
233k
          w -= 8;                                                             \
216
233k
        }                                                                     \
217
1.30M
        while (w >= 4) {                                                      \
218
394k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
394k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
394k
          src += 4;                                                           \
221
394k
          dst += 4;                                                           \
222
394k
          w -= 4;                                                             \
223
394k
        }                                                                     \
224
911k
        (void)num_taps;                                                       \
225
911k
      }                                                                       \
226
3.60M
    }                                                                         \
227
3.61M
    if (w) {                                                                  \
228
8.85k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
8.85k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
8.85k
                                      y_step_q4, w, h, bd);                   \
231
8.85k
    }                                                                         \
232
3.61M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
3.02M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.02M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.02M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.89M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.21M
        const int num_taps = 8;                                               \
155
2.77M
        while (w >= 16) {                                                     \
156
553k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
553k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
553k
          src += 16;                                                          \
159
553k
          dst += 16;                                                          \
160
553k
          w -= 16;                                                            \
161
553k
        }                                                                     \
162
2.95M
        while (w >= 8) {                                                      \
163
740k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
740k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
740k
          src += 8;                                                           \
166
740k
          dst += 8;                                                           \
167
740k
          w -= 8;                                                             \
168
740k
        }                                                                     \
169
3.31M
        while (w >= 4) {                                                      \
170
1.09M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.09M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.09M
          src += 4;                                                           \
173
1.09M
          dst += 4;                                                           \
174
1.09M
          w -= 4;                                                             \
175
1.09M
        }                                                                     \
176
2.21M
        (void)num_taps;                                                       \
177
2.21M
      } 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
681k
      } else {                                                                \
202
681k
        const int num_taps = 2;                                               \
203
942k
        while (w >= 16) {                                                     \
204
260k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
260k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
260k
          src += 16;                                                          \
207
260k
          dst += 16;                                                          \
208
260k
          w -= 16;                                                            \
209
260k
        }                                                                     \
210
853k
        while (w >= 8) {                                                      \
211
172k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
172k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
172k
          src += 8;                                                           \
214
172k
          dst += 8;                                                           \
215
172k
          w -= 8;                                                             \
216
172k
        }                                                                     \
217
985k
        while (w >= 4) {                                                      \
218
304k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
304k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
304k
          src += 4;                                                           \
221
304k
          dst += 4;                                                           \
222
304k
          w -= 4;                                                             \
223
304k
        }                                                                     \
224
681k
        (void)num_taps;                                                       \
225
681k
      }                                                                       \
226
2.89M
    }                                                                         \
227
3.02M
    if (w) {                                                                  \
228
128k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
128k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
128k
                                      y_step_q4, w, h, bd);                   \
231
128k
    }                                                                         \
232
3.02M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
189k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
189k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
189k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
181k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
132k
        const int num_taps = 8;                                               \
155
171k
        while (w >= 16) {                                                     \
156
39.0k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
39.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
39.0k
          src += 16;                                                          \
159
39.0k
          dst += 16;                                                          \
160
39.0k
          w -= 16;                                                            \
161
39.0k
        }                                                                     \
162
174k
        while (w >= 8) {                                                      \
163
42.8k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
42.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
42.8k
          src += 8;                                                           \
166
42.8k
          dst += 8;                                                           \
167
42.8k
          w -= 8;                                                             \
168
42.8k
        }                                                                     \
169
195k
        while (w >= 4) {                                                      \
170
63.4k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
63.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
63.4k
          src += 4;                                                           \
173
63.4k
          dst += 4;                                                           \
174
63.4k
          w -= 4;                                                             \
175
63.4k
        }                                                                     \
176
132k
        (void)num_taps;                                                       \
177
132k
      } 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
49.7k
      } else {                                                                \
202
49.7k
        const int num_taps = 2;                                               \
203
74.3k
        while (w >= 16) {                                                     \
204
24.6k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
24.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
24.6k
          src += 16;                                                          \
207
24.6k
          dst += 16;                                                          \
208
24.6k
          w -= 16;                                                            \
209
24.6k
        }                                                                     \
210
61.8k
        while (w >= 8) {                                                      \
211
12.0k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
12.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
12.0k
          src += 8;                                                           \
214
12.0k
          dst += 8;                                                           \
215
12.0k
          w -= 8;                                                             \
216
12.0k
        }                                                                     \
217
69.5k
        while (w >= 4) {                                                      \
218
19.7k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
19.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
19.7k
          src += 4;                                                           \
221
19.7k
          dst += 4;                                                           \
222
19.7k
          w -= 4;                                                             \
223
19.7k
        }                                                                     \
224
49.7k
        (void)num_taps;                                                       \
225
49.7k
      }                                                                       \
226
181k
    }                                                                         \
227
189k
    if (w) {                                                                  \
228
7.34k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
7.34k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
7.34k
                                      y_step_q4, w, h, bd);                   \
231
7.34k
    }                                                                         \
232
189k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
1.27M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.27M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.27M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.21M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
883k
        const int num_taps = 8;                                               \
155
1.10M
        while (w >= 16) {                                                     \
156
220k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
220k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
220k
          src += 16;                                                          \
159
220k
          dst += 16;                                                          \
160
220k
          w -= 16;                                                            \
161
220k
        }                                                                     \
162
1.16M
        while (w >= 8) {                                                      \
163
284k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
284k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
284k
          src += 8;                                                           \
166
284k
          dst += 8;                                                           \
167
284k
          w -= 8;                                                             \
168
284k
        }                                                                     \
169
1.32M
        while (w >= 4) {                                                      \
170
446k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
446k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
446k
          src += 4;                                                           \
173
446k
          dst += 4;                                                           \
174
446k
          w -= 4;                                                             \
175
446k
        }                                                                     \
176
883k
        (void)num_taps;                                                       \
177
883k
      } 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
335k
      } else {                                                                \
202
335k
        const int num_taps = 2;                                               \
203
481k
        while (w >= 16) {                                                     \
204
146k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
146k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
146k
          src += 16;                                                          \
207
146k
          dst += 16;                                                          \
208
146k
          w -= 16;                                                            \
209
146k
        }                                                                     \
210
424k
        while (w >= 8) {                                                      \
211
88.7k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
88.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
88.7k
          src += 8;                                                           \
214
88.7k
          dst += 8;                                                           \
215
88.7k
          w -= 8;                                                             \
216
88.7k
        }                                                                     \
217
467k
        while (w >= 4) {                                                      \
218
131k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
131k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
131k
          src += 4;                                                           \
221
131k
          dst += 4;                                                           \
222
131k
          w -= 4;                                                             \
223
131k
        }                                                                     \
224
335k
        (void)num_taps;                                                       \
225
335k
      }                                                                       \
226
1.21M
    }                                                                         \
227
1.27M
    if (w) {                                                                  \
228
57.4k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
57.4k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
57.4k
                                      y_step_q4, w, h, bd);                   \
231
57.4k
    }                                                                         \
232
1.27M
  }
233
234
#define HIGH_FUN_CONV_2D(avg, opt, is_avg)                                     \
235
  void vpx_highbd_convolve8_##avg##opt(                                        \
236
      const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst,                \
237
      ptrdiff_t dst_stride, const InterpKernel *filter, int x0_q4,             \
238
3.18M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
3.18M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
3.18M
    assert(w <= 64);                                                           \
241
3.18M
    assert(h <= 64);                                                           \
242
3.18M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
3.09M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
3.09M
          filter_x[3] == 128) {                                                \
245
2.30M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.30M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.30M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.30M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.30M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.30M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.30M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.30M
      } 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
796k
      } else {                                                                 \
263
796k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
796k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
796k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
796k
                                         w, h + 1, bd);                        \
267
796k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
796k
                                               filter, x0_q4, x_step_q4,       \
269
796k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
796k
      }                                                                        \
271
3.09M
    } else {                                                                   \
272
90.1k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
90.1k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
90.1k
                                    bd);                                       \
275
90.1k
    }                                                                          \
276
3.18M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_