Coverage Report

Created: 2026-10-17 06:45

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
599M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
599M
    const int16_t *filter_row = filter[offset];                              \
35
599M
    (void)x0_q4;                                                             \
36
599M
    (void)x_step_q4;                                                         \
37
599M
    (void)y0_q4;                                                             \
38
599M
    (void)y_step_q4;                                                         \
39
599M
    assert(filter_row[3] != 128);                                            \
40
599M
    assert(step_q4 == 16);                                                   \
41
599M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
540M
      const int num_taps = 8;                                                \
43
629M
      while (w >= 16) {                                                      \
44
88.3M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
88.3M
                                                 dst_stride, h, filter_row); \
46
88.3M
        src += 16;                                                           \
47
88.3M
        dst += 16;                                                           \
48
88.3M
        w -= 16;                                                             \
49
88.3M
      }                                                                      \
50
540M
      if (w == 8) {                                                          \
51
191M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
191M
                                                dst_stride, h, filter_row);  \
53
349M
      } else if (w == 4) {                                                   \
54
289M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
289M
                                                dst_stride, h, filter_row);  \
56
289M
      }                                                                      \
57
540M
      (void)num_taps;                                                        \
58
540M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
0
      const int num_taps = is_avg ? 8 : 4;                                   \
60
0
      while (w >= 16) {                                                      \
61
0
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
0
                                                 dst_stride, h, filter_row); \
63
0
        src += 16;                                                           \
64
0
        dst += 16;                                                           \
65
0
        w -= 16;                                                             \
66
0
      }                                                                      \
67
0
      if (w == 8) {                                                          \
68
0
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
0
                                                dst_stride, h, filter_row);  \
70
0
      } else if (w == 4) {                                                   \
71
0
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
0
                                                dst_stride, h, filter_row);  \
73
0
      }                                                                      \
74
0
      (void)num_taps;                                                        \
75
58.2M
    } else {                                                                 \
76
58.2M
      const int num_taps = 2;                                                \
77
73.6M
      while (w >= 16) {                                                      \
78
15.3M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
15.3M
                                                 dst_stride, h, filter_row); \
80
15.3M
        src += 16;                                                           \
81
15.3M
        dst += 16;                                                           \
82
15.3M
        w -= 16;                                                             \
83
15.3M
      }                                                                      \
84
58.2M
      if (w == 8) {                                                          \
85
18.7M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
18.7M
                                                dst_stride, h, filter_row);  \
87
39.4M
      } else if (w == 4) {                                                   \
88
27.7M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
27.7M
                                                dst_stride, h, filter_row);  \
90
27.7M
      }                                                                      \
91
58.2M
      (void)num_taps;                                                        \
92
58.2M
    }                                                                        \
93
599M
  }
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
169M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
169M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
169M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
169M
    (void)filter_y;                                                            \
103
169M
    assert(filter_x[3] != 128);                                                \
104
169M
    assert(filter_y[3] != 128);                                                \
105
169M
    assert(w <= 64);                                                           \
106
169M
    assert(h <= 64);                                                           \
107
169M
    assert(x_step_q4 == 16);                                                   \
108
169M
    assert(y_step_q4 == 16);                                                   \
109
169M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
144M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
144M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
144M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
144M
                                h + 7);                                        \
114
144M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
144M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
144M
                                      y_step_q4, w, h);                        \
117
144M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
0
      const int num_taps = is_avg ? 8 : 4;                                     \
119
0
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
0
      vpx_convolve8_horiz_##opt(                                               \
121
0
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
0
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
0
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
0
                                      dst, dst_stride, filter, x0_q4,          \
125
0
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
24.6M
    } else {                                                                   \
127
24.6M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
24.6M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
24.6M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
24.6M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
24.6M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
24.6M
                                      h);                                      \
133
24.6M
    }                                                                          \
134
169M
  }
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
4.55M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
4.55M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
4.55M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
4.18M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
3.89M
        const int num_taps = 8;                                               \
155
5.10M
        while (w >= 16) {                                                     \
156
1.21M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.21M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.21M
          src += 16;                                                          \
159
1.21M
          dst += 16;                                                          \
160
1.21M
          w -= 16;                                                            \
161
1.21M
        }                                                                     \
162
5.02M
        while (w >= 8) {                                                      \
163
1.13M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
1.13M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
1.13M
          src += 8;                                                           \
166
1.13M
          dst += 8;                                                           \
167
1.13M
          w -= 8;                                                             \
168
1.13M
        }                                                                     \
169
5.78M
        while (w >= 4) {                                                      \
170
1.88M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.88M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.88M
          src += 4;                                                           \
173
1.88M
          dst += 4;                                                           \
174
1.88M
          w -= 4;                                                             \
175
1.88M
        }                                                                     \
176
3.89M
        (void)num_taps;                                                       \
177
3.89M
      } 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
289k
      } else {                                                                \
202
289k
        const int num_taps = 2;                                               \
203
448k
        while (w >= 16) {                                                     \
204
159k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
159k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
159k
          src += 16;                                                          \
207
159k
          dst += 16;                                                          \
208
159k
          w -= 16;                                                            \
209
159k
        }                                                                     \
210
370k
        while (w >= 8) {                                                      \
211
81.3k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
81.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
81.3k
          src += 8;                                                           \
214
81.3k
          dst += 8;                                                           \
215
81.3k
          w -= 8;                                                             \
216
81.3k
        }                                                                     \
217
403k
        while (w >= 4) {                                                      \
218
114k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
114k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
114k
          src += 4;                                                           \
221
114k
          dst += 4;                                                           \
222
114k
          w -= 4;                                                             \
223
114k
        }                                                                     \
224
289k
        (void)num_taps;                                                       \
225
289k
      }                                                                       \
226
4.18M
    }                                                                         \
227
4.55M
    if (w) {                                                                  \
228
376k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
376k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
376k
                                      y_step_q4, w, h, bd);                   \
231
376k
    }                                                                         \
232
4.55M
  }
Unexecuted instantiation: vpx_highbd_convolve8_horiz_sse2
Unexecuted instantiation: vpx_highbd_convolve8_vert_sse2
Unexecuted instantiation: vpx_highbd_convolve8_avg_horiz_sse2
Unexecuted instantiation: vpx_highbd_convolve8_avg_vert_sse2
vpx_highbd_convolve8_horiz_avx2
Line
Count
Source
150
2.06M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
2.06M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
2.06M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.95M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.81M
        const int num_taps = 8;                                               \
155
2.37M
        while (w >= 16) {                                                     \
156
559k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
559k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
559k
          src += 16;                                                          \
159
559k
          dst += 16;                                                          \
160
559k
          w -= 16;                                                            \
161
559k
        }                                                                     \
162
2.34M
        while (w >= 8) {                                                      \
163
530k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
530k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
530k
          src += 8;                                                           \
166
530k
          dst += 8;                                                           \
167
530k
          w -= 8;                                                             \
168
530k
        }                                                                     \
169
2.69M
        while (w >= 4) {                                                      \
170
879k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
879k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
879k
          src += 4;                                                           \
173
879k
          dst += 4;                                                           \
174
879k
          w -= 4;                                                             \
175
879k
        }                                                                     \
176
1.81M
        (void)num_taps;                                                       \
177
1.81M
      } else if (filter_row[2] | filter_row[5]) {                             \
178
0
        const int num_taps = is_avg ? 8 : 4;                                  \
179
0
        while (w >= 16) {                                                     \
180
0
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
0
          src += 16;                                                          \
183
0
          dst += 16;                                                          \
184
0
          w -= 16;                                                            \
185
0
        }                                                                     \
186
0
        while (w >= 8) {                                                      \
187
0
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
0
          src += 8;                                                           \
190
0
          dst += 8;                                                           \
191
0
          w -= 8;                                                             \
192
0
        }                                                                     \
193
0
        while (w >= 4) {                                                      \
194
0
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
0
          src += 4;                                                           \
197
0
          dst += 4;                                                           \
198
0
          w -= 4;                                                             \
199
0
        }                                                                     \
200
0
        (void)num_taps;                                                       \
201
133k
      } else {                                                                \
202
133k
        const int num_taps = 2;                                               \
203
204k
        while (w >= 16) {                                                     \
204
71.8k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
71.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
71.8k
          src += 16;                                                          \
207
71.8k
          dst += 16;                                                          \
208
71.8k
          w -= 16;                                                            \
209
71.8k
        }                                                                     \
210
170k
        while (w >= 8) {                                                      \
211
37.5k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
37.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
37.5k
          src += 8;                                                           \
214
37.5k
          dst += 8;                                                           \
215
37.5k
          w -= 8;                                                             \
216
37.5k
        }                                                                     \
217
186k
        while (w >= 4) {                                                      \
218
53.1k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
53.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
53.1k
          src += 4;                                                           \
221
53.1k
          dst += 4;                                                           \
222
53.1k
          w -= 4;                                                             \
223
53.1k
        }                                                                     \
224
133k
        (void)num_taps;                                                       \
225
133k
      }                                                                       \
226
1.95M
    }                                                                         \
227
2.06M
    if (w) {                                                                  \
228
109k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
109k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
109k
                                      y_step_q4, w, h, bd);                   \
231
109k
    }                                                                         \
232
2.06M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
1.96M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.96M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.96M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.85M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.75M
        const int num_taps = 8;                                               \
155
2.26M
        while (w >= 16) {                                                     \
156
516k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
516k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
516k
          src += 16;                                                          \
159
516k
          dst += 16;                                                          \
160
516k
          w -= 16;                                                            \
161
516k
        }                                                                     \
162
2.27M
        while (w >= 8) {                                                      \
163
517k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
517k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
517k
          src += 8;                                                           \
166
517k
          dst += 8;                                                           \
167
517k
          w -= 8;                                                             \
168
517k
        }                                                                     \
169
2.60M
        while (w >= 4) {                                                      \
170
856k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
856k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
856k
          src += 4;                                                           \
173
856k
          dst += 4;                                                           \
174
856k
          w -= 4;                                                             \
175
856k
        }                                                                     \
176
1.75M
        (void)num_taps;                                                       \
177
1.75M
      } 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
102k
      } else {                                                                \
202
102k
        const int num_taps = 2;                                               \
203
157k
        while (w >= 16) {                                                     \
204
55.1k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
55.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
55.1k
          src += 16;                                                          \
207
55.1k
          dst += 16;                                                          \
208
55.1k
          w -= 16;                                                            \
209
55.1k
        }                                                                     \
210
131k
        while (w >= 8) {                                                      \
211
29.1k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
29.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
29.1k
          src += 8;                                                           \
214
29.1k
          dst += 8;                                                           \
215
29.1k
          w -= 8;                                                             \
216
29.1k
        }                                                                     \
217
143k
        while (w >= 4) {                                                      \
218
41.0k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
41.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
41.0k
          src += 4;                                                           \
221
41.0k
          dst += 4;                                                           \
222
41.0k
          w -= 4;                                                             \
223
41.0k
        }                                                                     \
224
102k
        (void)num_taps;                                                       \
225
102k
      }                                                                       \
226
1.85M
    }                                                                         \
227
1.96M
    if (w) {                                                                  \
228
104k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
104k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
104k
                                      y_step_q4, w, h, bd);                   \
231
104k
    }                                                                         \
232
1.96M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
177k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
177k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
177k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
73.4k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
59.3k
        const int num_taps = 8;                                               \
155
89.1k
        while (w >= 16) {                                                     \
156
29.8k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
29.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
29.8k
          src += 16;                                                          \
159
29.8k
          dst += 16;                                                          \
160
29.8k
          w -= 16;                                                            \
161
29.8k
        }                                                                     \
162
74.0k
        while (w >= 8) {                                                      \
163
14.7k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
14.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
14.7k
          src += 8;                                                           \
166
14.7k
          dst += 8;                                                           \
167
14.7k
          w -= 8;                                                             \
168
14.7k
        }                                                                     \
169
87.1k
        while (w >= 4) {                                                      \
170
27.8k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
27.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
27.8k
          src += 4;                                                           \
173
27.8k
          dst += 4;                                                           \
174
27.8k
          w -= 4;                                                             \
175
27.8k
        }                                                                     \
176
59.3k
        (void)num_taps;                                                       \
177
59.3k
      } 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
14.1k
      } else {                                                                \
202
14.1k
        const int num_taps = 2;                                               \
203
23.6k
        while (w >= 16) {                                                     \
204
9.52k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
9.52k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
9.52k
          src += 16;                                                          \
207
9.52k
          dst += 16;                                                          \
208
9.52k
          w -= 16;                                                            \
209
9.52k
        }                                                                     \
210
18.0k
        while (w >= 8) {                                                      \
211
3.90k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
3.90k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
3.90k
          src += 8;                                                           \
214
3.90k
          dst += 8;                                                           \
215
3.90k
          w -= 8;                                                             \
216
3.90k
        }                                                                     \
217
19.2k
        while (w >= 4) {                                                      \
218
5.10k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
5.10k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
5.10k
          src += 4;                                                           \
221
5.10k
          dst += 4;                                                           \
222
5.10k
          w -= 4;                                                             \
223
5.10k
        }                                                                     \
224
14.1k
        (void)num_taps;                                                       \
225
14.1k
      }                                                                       \
226
73.4k
    }                                                                         \
227
177k
    if (w) {                                                                  \
228
104k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
104k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
104k
                                      y_step_q4, w, h, bd);                   \
231
104k
    }                                                                         \
232
177k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
359k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
359k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
359k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
301k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
262k
        const int num_taps = 8;                                               \
155
373k
        while (w >= 16) {                                                     \
156
111k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
111k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
111k
          src += 16;                                                          \
159
111k
          dst += 16;                                                          \
160
111k
          w -= 16;                                                            \
161
111k
        }                                                                     \
162
333k
        while (w >= 8) {                                                      \
163
70.9k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
70.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
70.9k
          src += 8;                                                           \
166
70.9k
          dst += 8;                                                           \
167
70.9k
          w -= 8;                                                             \
168
70.9k
        }                                                                     \
169
386k
        while (w >= 4) {                                                      \
170
124k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
124k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
124k
          src += 4;                                                           \
173
124k
          dst += 4;                                                           \
174
124k
          w -= 4;                                                             \
175
124k
        }                                                                     \
176
262k
        (void)num_taps;                                                       \
177
262k
      } 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
39.2k
      } else {                                                                \
202
39.2k
        const int num_taps = 2;                                               \
203
61.7k
        while (w >= 16) {                                                     \
204
22.5k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
22.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
22.5k
          src += 16;                                                          \
207
22.5k
          dst += 16;                                                          \
208
22.5k
          w -= 16;                                                            \
209
22.5k
        }                                                                     \
210
49.9k
        while (w >= 8) {                                                      \
211
10.7k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
10.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
10.7k
          src += 8;                                                           \
214
10.7k
          dst += 8;                                                           \
215
10.7k
          w -= 8;                                                             \
216
10.7k
        }                                                                     \
217
54.5k
        while (w >= 4) {                                                      \
218
15.3k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
15.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
15.3k
          src += 4;                                                           \
221
15.3k
          dst += 4;                                                           \
222
15.3k
          w -= 4;                                                             \
223
15.3k
        }                                                                     \
224
39.2k
        (void)num_taps;                                                       \
225
39.2k
      }                                                                       \
226
301k
    }                                                                         \
227
359k
    if (w) {                                                                  \
228
57.7k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
57.7k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
57.7k
                                      y_step_q4, w, h, bd);                   \
231
57.7k
    }                                                                         \
232
359k
  }
233
234
#define HIGH_FUN_CONV_2D(avg, opt, is_avg)                                     \
235
  void vpx_highbd_convolve8_##avg##opt(                                        \
236
      const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst,                \
237
      ptrdiff_t dst_stride, const InterpKernel *filter, int x0_q4,             \
238
4.06M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
4.06M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
4.06M
    assert(w <= 64);                                                           \
241
4.06M
    assert(h <= 64);                                                           \
242
4.06M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
1.53M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
1.53M
          filter_x[3] == 128) {                                                \
245
1.43M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
1.43M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
1.43M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
1.43M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
1.43M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
1.43M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
1.43M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
1.43M
      } 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
103k
      } else {                                                                 \
263
103k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
103k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
103k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
103k
                                         w, h + 1, bd);                        \
267
103k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
103k
                                               filter, x0_q4, x_step_q4,       \
269
103k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
103k
      }                                                                        \
271
2.52M
    } else {                                                                   \
272
2.52M
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
2.52M
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
2.52M
                                    bd);                                       \
275
2.52M
    }                                                                          \
276
4.06M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_