Coverage Report

Created: 2026-05-23 07:06

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
279M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
279M
    const int16_t *filter_row = filter[offset];                              \
35
279M
    (void)x0_q4;                                                             \
36
279M
    (void)x_step_q4;                                                         \
37
279M
    (void)y0_q4;                                                             \
38
279M
    (void)y_step_q4;                                                         \
39
279M
    assert(filter_row[3] != 128);                                            \
40
279M
    assert(step_q4 == 16);                                                   \
41
279M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
129M
      const int num_taps = 8;                                                \
43
145M
      while (w >= 16) {                                                      \
44
16.3M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
16.3M
                                                 dst_stride, h, filter_row); \
46
16.3M
        src += 16;                                                           \
47
16.3M
        dst += 16;                                                           \
48
16.3M
        w -= 16;                                                             \
49
16.3M
      }                                                                      \
50
129M
      if (w == 8) {                                                          \
51
36.0M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
36.0M
                                                dst_stride, h, filter_row);  \
53
93.1M
      } else if (w == 4) {                                                   \
54
79.8M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
79.8M
                                                dst_stride, h, filter_row);  \
56
79.8M
      }                                                                      \
57
129M
      (void)num_taps;                                                        \
58
150M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
145M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
160M
      while (w >= 16) {                                                      \
61
15.7M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
15.7M
                                                 dst_stride, h, filter_row); \
63
15.7M
        src += 16;                                                           \
64
15.7M
        dst += 16;                                                           \
65
15.7M
        w -= 16;                                                             \
66
15.7M
      }                                                                      \
67
145M
      if (w == 8) {                                                          \
68
35.7M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
35.7M
                                                dst_stride, h, filter_row);  \
70
109M
      } else if (w == 4) {                                                   \
71
97.4M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
97.4M
                                                dst_stride, h, filter_row);  \
73
97.4M
      }                                                                      \
74
145M
      (void)num_taps;                                                        \
75
145M
    } else {                                                                 \
76
4.91M
      const int num_taps = 2;                                                \
77
7.19M
      while (w >= 16) {                                                      \
78
2.28M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
2.28M
                                                 dst_stride, h, filter_row); \
80
2.28M
        src += 16;                                                           \
81
2.28M
        dst += 16;                                                           \
82
2.28M
        w -= 16;                                                             \
83
2.28M
      }                                                                      \
84
4.91M
      if (w == 8) {                                                          \
85
1.46M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
1.46M
                                                dst_stride, h, filter_row);  \
87
3.45M
      } else if (w == 4) {                                                   \
88
1.88M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
1.88M
                                                dst_stride, h, filter_row);  \
90
1.88M
      }                                                                      \
91
4.91M
      (void)num_taps;                                                        \
92
4.91M
    }                                                                        \
93
279M
  }
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
83.3M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
83.3M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
83.3M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
83.3M
    (void)filter_y;                                                            \
103
83.3M
    assert(filter_x[3] != 128);                                                \
104
83.3M
    assert(filter_y[3] != 128);                                                \
105
83.3M
    assert(w <= 64);                                                           \
106
83.3M
    assert(h <= 64);                                                           \
107
83.3M
    assert(x_step_q4 == 16);                                                   \
108
83.3M
    assert(y_step_q4 == 16);                                                   \
109
83.3M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
39.8M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
39.8M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
39.8M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
39.8M
                                h + 7);                                        \
114
39.8M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
39.8M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
39.8M
                                      y_step_q4, w, h);                        \
117
43.5M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
41.6M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
41.6M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
41.6M
      vpx_convolve8_horiz_##opt(                                               \
121
41.6M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
41.6M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
41.6M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
41.6M
                                      dst, dst_stride, filter, x0_q4,          \
125
41.6M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
41.6M
    } else {                                                                   \
127
1.86M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
1.86M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
1.86M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
1.86M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
1.86M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
1.86M
                                      h);                                      \
133
1.86M
    }                                                                          \
134
83.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.91M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
8.91M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
8.91M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
8.71M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
6.22M
        const int num_taps = 8;                                               \
155
7.70M
        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
8.38M
        while (w >= 8) {                                                      \
163
2.16M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
2.16M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
2.16M
          src += 8;                                                           \
166
2.16M
          dst += 8;                                                           \
167
2.16M
          w -= 8;                                                             \
168
2.16M
        }                                                                     \
169
9.27M
        while (w >= 4) {                                                      \
170
3.04M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
3.04M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
3.04M
          src += 4;                                                           \
173
3.04M
          dst += 4;                                                           \
174
3.04M
          w -= 4;                                                             \
175
3.04M
        }                                                                     \
176
6.22M
        (void)num_taps;                                                       \
177
6.22M
      } 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.48M
      } else {                                                                \
202
2.48M
        const int num_taps = 2;                                               \
203
3.48M
        while (w >= 16) {                                                     \
204
995k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
995k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
995k
          src += 16;                                                          \
207
995k
          dst += 16;                                                          \
208
995k
          w -= 16;                                                            \
209
995k
        }                                                                     \
210
3.13M
        while (w >= 8) {                                                      \
211
646k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
646k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
646k
          src += 8;                                                           \
214
646k
          dst += 8;                                                           \
215
646k
          w -= 8;                                                             \
216
646k
        }                                                                     \
217
3.54M
        while (w >= 4) {                                                      \
218
1.05M
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
1.05M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
1.05M
          src += 4;                                                           \
221
1.05M
          dst += 4;                                                           \
222
1.05M
          w -= 4;                                                             \
223
1.05M
        }                                                                     \
224
2.48M
        (void)num_taps;                                                       \
225
2.48M
      }                                                                       \
226
8.71M
    }                                                                         \
227
8.91M
    if (w) {                                                                  \
228
194k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
194k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
194k
                                      y_step_q4, w, h, bd);                   \
231
194k
    }                                                                         \
232
8.91M
  }
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.89M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.89M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.89M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.88M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.73M
        const int num_taps = 8;                                               \
155
3.37M
        while (w >= 16) {                                                     \
156
639k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
639k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
639k
          src += 16;                                                          \
159
639k
          dst += 16;                                                          \
160
639k
          w -= 16;                                                            \
161
639k
        }                                                                     \
162
3.66M
        while (w >= 8) {                                                      \
163
923k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
923k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
923k
          src += 8;                                                           \
166
923k
          dst += 8;                                                           \
167
923k
          w -= 8;                                                             \
168
923k
        }                                                                     \
169
4.11M
        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.73M
        (void)num_taps;                                                       \
177
2.73M
      } 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.14M
      } else {                                                                \
202
1.14M
        const int num_taps = 2;                                               \
203
1.59M
        while (w >= 16) {                                                     \
204
450k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
450k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
450k
          src += 16;                                                          \
207
450k
          dst += 16;                                                          \
208
450k
          w -= 16;                                                            \
209
450k
        }                                                                     \
210
1.44M
        while (w >= 8) {                                                      \
211
298k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
298k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
298k
          src += 8;                                                           \
214
298k
          dst += 8;                                                           \
215
298k
          w -= 8;                                                             \
216
298k
        }                                                                     \
217
1.63M
        while (w >= 4) {                                                      \
218
491k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
491k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
491k
          src += 4;                                                           \
221
491k
          dst += 4;                                                           \
222
491k
          w -= 4;                                                             \
223
491k
        }                                                                     \
224
1.14M
        (void)num_taps;                                                       \
225
1.14M
      }                                                                       \
226
3.88M
    }                                                                         \
227
3.89M
    if (w) {                                                                  \
228
9.80k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
9.80k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
9.80k
                                      y_step_q4, w, h, bd);                   \
231
9.80k
    }                                                                         \
232
3.89M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
3.24M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.24M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.24M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.12M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.25M
        const int num_taps = 8;                                               \
155
2.80M
        while (w >= 16) {                                                     \
156
546k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
546k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
546k
          src += 16;                                                          \
159
546k
          dst += 16;                                                          \
160
546k
          w -= 16;                                                            \
161
546k
        }                                                                     \
162
3.04M
        while (w >= 8) {                                                      \
163
793k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
793k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
793k
          src += 8;                                                           \
166
793k
          dst += 8;                                                           \
167
793k
          w -= 8;                                                             \
168
793k
        }                                                                     \
169
3.34M
        while (w >= 4) {                                                      \
170
1.08M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.08M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.08M
          src += 4;                                                           \
173
1.08M
          dst += 4;                                                           \
174
1.08M
          w -= 4;                                                             \
175
1.08M
        }                                                                     \
176
2.25M
        (void)num_taps;                                                       \
177
2.25M
      } 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
868k
      } else {                                                                \
202
868k
        const int num_taps = 2;                                               \
203
1.20M
        while (w >= 16) {                                                     \
204
336k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
336k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
336k
          src += 16;                                                          \
207
336k
          dst += 16;                                                          \
208
336k
          w -= 16;                                                            \
209
336k
        }                                                                     \
210
1.09M
        while (w >= 8) {                                                      \
211
222k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
222k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
222k
          src += 8;                                                           \
214
222k
          dst += 8;                                                           \
215
222k
          w -= 8;                                                             \
216
222k
        }                                                                     \
217
1.24M
        while (w >= 4) {                                                      \
218
378k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
378k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
378k
          src += 4;                                                           \
221
378k
          dst += 4;                                                           \
222
378k
          w -= 4;                                                             \
223
378k
        }                                                                     \
224
868k
        (void)num_taps;                                                       \
225
868k
      }                                                                       \
226
3.12M
    }                                                                         \
227
3.24M
    if (w) {                                                                  \
228
120k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
120k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
120k
                                      y_step_q4, w, h, bd);                   \
231
120k
    }                                                                         \
232
3.24M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
229k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
229k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
229k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
219k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
158k
        const int num_taps = 8;                                               \
155
199k
        while (w >= 16) {                                                     \
156
40.2k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
40.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
40.2k
          src += 16;                                                          \
159
40.2k
          dst += 16;                                                          \
160
40.2k
          w -= 16;                                                            \
161
40.2k
        }                                                                     \
162
215k
        while (w >= 8) {                                                      \
163
56.9k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
56.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
56.9k
          src += 8;                                                           \
166
56.9k
          dst += 8;                                                           \
167
56.9k
          w -= 8;                                                             \
168
56.9k
        }                                                                     \
169
234k
        while (w >= 4) {                                                      \
170
75.2k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
75.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
75.2k
          src += 4;                                                           \
173
75.2k
          dst += 4;                                                           \
174
75.2k
          w -= 4;                                                             \
175
75.2k
        }                                                                     \
176
158k
        (void)num_taps;                                                       \
177
158k
      } 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
60.8k
      } else {                                                                \
202
60.8k
        const int num_taps = 2;                                               \
203
92.4k
        while (w >= 16) {                                                     \
204
31.5k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
31.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
31.5k
          src += 16;                                                          \
207
31.5k
          dst += 16;                                                          \
208
31.5k
          w -= 16;                                                            \
209
31.5k
        }                                                                     \
210
75.7k
        while (w >= 8) {                                                      \
211
14.9k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
14.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
14.9k
          src += 8;                                                           \
214
14.9k
          dst += 8;                                                           \
215
14.9k
          w -= 8;                                                             \
216
14.9k
        }                                                                     \
217
83.5k
        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
60.8k
        (void)num_taps;                                                       \
225
60.8k
      }                                                                       \
226
219k
    }                                                                         \
227
229k
    if (w) {                                                                  \
228
9.63k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
9.63k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
9.63k
                                      y_step_q4, w, h, bd);                   \
231
9.63k
    }                                                                         \
232
229k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
1.53M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.53M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.53M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.48M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.07M
        const int num_taps = 8;                                               \
155
1.32M
        while (w >= 16) {                                                     \
156
251k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
251k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
251k
          src += 16;                                                          \
159
251k
          dst += 16;                                                          \
160
251k
          w -= 16;                                                            \
161
251k
        }                                                                     \
162
1.46M
        while (w >= 8) {                                                      \
163
388k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
388k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
388k
          src += 8;                                                           \
166
388k
          dst += 8;                                                           \
167
388k
          w -= 8;                                                             \
168
388k
        }                                                                     \
169
1.58M
        while (w >= 4) {                                                      \
170
510k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
510k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
510k
          src += 4;                                                           \
173
510k
          dst += 4;                                                           \
174
510k
          w -= 4;                                                             \
175
510k
        }                                                                     \
176
1.07M
        (void)num_taps;                                                       \
177
1.07M
      } 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
411k
      } else {                                                                \
202
411k
        const int num_taps = 2;                                               \
203
587k
        while (w >= 16) {                                                     \
204
176k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
176k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
176k
          src += 16;                                                          \
207
176k
          dst += 16;                                                          \
208
176k
          w -= 16;                                                            \
209
176k
        }                                                                     \
210
520k
        while (w >= 8) {                                                      \
211
109k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
109k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
109k
          src += 8;                                                           \
214
109k
          dst += 8;                                                           \
215
109k
          w -= 8;                                                             \
216
109k
        }                                                                     \
217
573k
        while (w >= 4) {                                                      \
218
162k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
162k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
162k
          src += 4;                                                           \
221
162k
          dst += 4;                                                           \
222
162k
          w -= 4;                                                             \
223
162k
        }                                                                     \
224
411k
        (void)num_taps;                                                       \
225
411k
      }                                                                       \
226
1.48M
    }                                                                         \
227
1.53M
    if (w) {                                                                  \
228
54.9k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
54.9k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
54.9k
                                      y_step_q4, w, h, bd);                   \
231
54.9k
    }                                                                         \
232
1.53M
  }
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.44M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
3.44M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
3.44M
    assert(w <= 64);                                                           \
241
3.44M
    assert(h <= 64);                                                           \
242
3.44M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
3.35M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
3.35M
          filter_x[3] == 128) {                                                \
245
2.34M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.34M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.34M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.34M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.34M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.34M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.34M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.34M
      } 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
1.00M
      } else {                                                                 \
263
1.00M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
1.00M
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
1.00M
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
1.00M
                                         w, h + 1, bd);                        \
267
1.00M
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
1.00M
                                               filter, x0_q4, x_step_q4,       \
269
1.00M
                                               y0_q4, y_step_q4, w, h, bd);    \
270
1.00M
      }                                                                        \
271
3.35M
    } else {                                                                   \
272
86.5k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
86.5k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
86.5k
                                    bd);                                       \
275
86.5k
    }                                                                          \
276
3.44M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_