Coverage Report

Created: 2025-12-31 07:57

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
238M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
238M
    const int16_t *filter_row = filter[offset];                              \
35
238M
    (void)x0_q4;                                                             \
36
238M
    (void)x_step_q4;                                                         \
37
238M
    (void)y0_q4;                                                             \
38
238M
    (void)y_step_q4;                                                         \
39
238M
    assert(filter_row[3] != 128);                                            \
40
238M
    assert(step_q4 == 16);                                                   \
41
238M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
117M
      const int num_taps = 8;                                                \
43
132M
      while (w >= 16) {                                                      \
44
15.2M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
15.2M
                                                 dst_stride, h, filter_row); \
46
15.2M
        src += 16;                                                           \
47
15.2M
        dst += 16;                                                           \
48
15.2M
        w -= 16;                                                             \
49
15.2M
      }                                                                      \
50
117M
      if (w == 8) {                                                          \
51
33.4M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
33.4M
                                                dst_stride, h, filter_row);  \
53
83.7M
      } else if (w == 4) {                                                   \
54
71.3M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
71.3M
                                                dst_stride, h, filter_row);  \
56
71.3M
      }                                                                      \
57
117M
      (void)num_taps;                                                        \
58
121M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
116M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
130M
      while (w >= 16) {                                                      \
61
13.2M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
13.2M
                                                 dst_stride, h, filter_row); \
63
13.2M
        src += 16;                                                           \
64
13.2M
        dst += 16;                                                           \
65
13.2M
        w -= 16;                                                             \
66
13.2M
      }                                                                      \
67
116M
      if (w == 8) {                                                          \
68
28.4M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
28.4M
                                                dst_stride, h, filter_row);  \
70
88.4M
      } else if (w == 4) {                                                   \
71
78.3M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
78.3M
                                                dst_stride, h, filter_row);  \
73
78.3M
      }                                                                      \
74
116M
      (void)num_taps;                                                        \
75
116M
    } else {                                                                 \
76
4.18M
      const int num_taps = 2;                                                \
77
6.06M
      while (w >= 16) {                                                      \
78
1.88M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
1.88M
                                                 dst_stride, h, filter_row); \
80
1.88M
        src += 16;                                                           \
81
1.88M
        dst += 16;                                                           \
82
1.88M
        w -= 16;                                                             \
83
1.88M
      }                                                                      \
84
4.18M
      if (w == 8) {                                                          \
85
1.24M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
1.24M
                                                dst_stride, h, filter_row);  \
87
2.93M
      } else if (w == 4) {                                                   \
88
1.62M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
1.62M
                                                dst_stride, h, filter_row);  \
90
1.62M
      }                                                                      \
91
4.18M
      (void)num_taps;                                                        \
92
4.18M
    }                                                                        \
93
238M
  }
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
70.1M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
70.1M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
70.1M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
70.1M
    (void)filter_y;                                                            \
103
70.1M
    assert(filter_x[3] != 128);                                                \
104
70.1M
    assert(filter_y[3] != 128);                                                \
105
70.1M
    assert(w <= 64);                                                           \
106
70.1M
    assert(h <= 64);                                                           \
107
70.1M
    assert(x_step_q4 == 16);                                                   \
108
70.1M
    assert(y_step_q4 == 16);                                                   \
109
70.1M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
35.5M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
35.5M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
35.5M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
35.5M
                                h + 7);                                        \
114
35.5M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
35.5M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
35.5M
                                      y_step_q4, w, h);                        \
117
35.5M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
32.9M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
32.9M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
32.9M
      vpx_convolve8_horiz_##opt(                                               \
121
32.9M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
32.9M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
32.9M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
32.9M
                                      dst, dst_stride, filter, x0_q4,          \
125
32.9M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
32.9M
    } else {                                                                   \
127
1.58M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
1.58M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
1.58M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
1.58M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
1.58M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
1.58M
                                      h);                                      \
133
1.58M
    }                                                                          \
134
70.1M
  }
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.14M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
8.14M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
8.14M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
7.91M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
5.87M
        const int num_taps = 8;                                               \
155
7.45M
        while (w >= 16) {                                                     \
156
1.57M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.57M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.57M
          src += 16;                                                          \
159
1.57M
          dst += 16;                                                          \
160
1.57M
          w -= 16;                                                            \
161
1.57M
        }                                                                     \
162
7.76M
        while (w >= 8) {                                                      \
163
1.89M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
1.89M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
1.89M
          src += 8;                                                           \
166
1.89M
          dst += 8;                                                           \
167
1.89M
          w -= 8;                                                             \
168
1.89M
        }                                                                     \
169
8.78M
        while (w >= 4) {                                                      \
170
2.91M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
2.91M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
2.91M
          src += 4;                                                           \
173
2.91M
          dst += 4;                                                           \
174
2.91M
          w -= 4;                                                             \
175
2.91M
        }                                                                     \
176
5.87M
        (void)num_taps;                                                       \
177
5.87M
      } 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.03M
      } else {                                                                \
202
2.03M
        const int num_taps = 2;                                               \
203
2.85M
        while (w >= 16) {                                                     \
204
819k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
819k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
819k
          src += 16;                                                          \
207
819k
          dst += 16;                                                          \
208
819k
          w -= 16;                                                            \
209
819k
        }                                                                     \
210
2.56M
        while (w >= 8) {                                                      \
211
521k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
521k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
521k
          src += 8;                                                           \
214
521k
          dst += 8;                                                           \
215
521k
          w -= 8;                                                             \
216
521k
        }                                                                     \
217
2.91M
        while (w >= 4) {                                                      \
218
874k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
874k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
874k
          src += 4;                                                           \
221
874k
          dst += 4;                                                           \
222
874k
          w -= 4;                                                             \
223
874k
        }                                                                     \
224
2.03M
        (void)num_taps;                                                       \
225
2.03M
      }                                                                       \
226
7.91M
    }                                                                         \
227
8.14M
    if (w) {                                                                  \
228
226k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
226k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
226k
                                      y_step_q4, w, h, bd);                   \
231
226k
    }                                                                         \
232
8.14M
  }
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.65M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.65M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.65M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.64M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.70M
        const int num_taps = 8;                                               \
155
3.41M
        while (w >= 16) {                                                     \
156
716k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
716k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
716k
          src += 16;                                                          \
159
716k
          dst += 16;                                                          \
160
716k
          w -= 16;                                                            \
161
716k
        }                                                                     \
162
3.57M
        while (w >= 8) {                                                      \
163
866k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
866k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
866k
          src += 8;                                                           \
166
866k
          dst += 8;                                                           \
167
866k
          w -= 8;                                                             \
168
866k
        }                                                                     \
169
4.05M
        while (w >= 4) {                                                      \
170
1.35M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.35M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.35M
          src += 4;                                                           \
173
1.35M
          dst += 4;                                                           \
174
1.35M
          w -= 4;                                                             \
175
1.35M
        }                                                                     \
176
2.70M
        (void)num_taps;                                                       \
177
2.70M
      } 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
944k
      } else {                                                                \
202
944k
        const int num_taps = 2;                                               \
203
1.32M
        while (w >= 16) {                                                     \
204
377k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
377k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
377k
          src += 16;                                                          \
207
377k
          dst += 16;                                                          \
208
377k
          w -= 16;                                                            \
209
377k
        }                                                                     \
210
1.18M
        while (w >= 8) {                                                      \
211
241k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
241k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
241k
          src += 8;                                                           \
214
241k
          dst += 8;                                                           \
215
241k
          w -= 8;                                                             \
216
241k
        }                                                                     \
217
1.34M
        while (w >= 4) {                                                      \
218
405k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
405k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
405k
          src += 4;                                                           \
221
405k
          dst += 4;                                                           \
222
405k
          w -= 4;                                                             \
223
405k
        }                                                                     \
224
944k
        (void)num_taps;                                                       \
225
944k
      }                                                                       \
226
3.64M
    }                                                                         \
227
3.65M
    if (w) {                                                                  \
228
7.88k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
7.88k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
7.88k
                                      y_step_q4, w, h, bd);                   \
231
7.88k
    }                                                                         \
232
3.65M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
3.06M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.06M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.06M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.91M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.22M
        const int num_taps = 8;                                               \
155
2.82M
        while (w >= 16) {                                                     \
156
594k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
594k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
594k
          src += 16;                                                          \
159
594k
          dst += 16;                                                          \
160
594k
          w -= 16;                                                            \
161
594k
        }                                                                     \
162
2.96M
        while (w >= 8) {                                                      \
163
737k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
737k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
737k
          src += 8;                                                           \
166
737k
          dst += 8;                                                           \
167
737k
          w -= 8;                                                             \
168
737k
        }                                                                     \
169
3.31M
        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.22M
        (void)num_taps;                                                       \
177
2.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
685k
      } else {                                                                \
202
685k
        const int num_taps = 2;                                               \
203
948k
        while (w >= 16) {                                                     \
204
262k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
262k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
262k
          src += 16;                                                          \
207
262k
          dst += 16;                                                          \
208
262k
          w -= 16;                                                            \
209
262k
        }                                                                     \
210
858k
        while (w >= 8) {                                                      \
211
172k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
172k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
172k
          src += 8;                                                           \
214
172k
          dst += 8;                                                           \
215
172k
          w -= 8;                                                             \
216
172k
        }                                                                     \
217
992k
        while (w >= 4) {                                                      \
218
306k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
306k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
306k
          src += 4;                                                           \
221
306k
          dst += 4;                                                           \
222
306k
          w -= 4;                                                             \
223
306k
        }                                                                     \
224
685k
        (void)num_taps;                                                       \
225
685k
      }                                                                       \
226
2.91M
    }                                                                         \
227
3.06M
    if (w) {                                                                  \
228
152k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
152k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
152k
                                      y_step_q4, w, h, bd);                   \
231
152k
    }                                                                         \
232
3.06M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
188k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
188k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
188k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
181k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
127k
        const int num_taps = 8;                                               \
155
169k
        while (w >= 16) {                                                     \
156
42.1k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
42.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
42.1k
          src += 16;                                                          \
159
42.1k
          dst += 16;                                                          \
160
42.1k
          w -= 16;                                                            \
161
42.1k
        }                                                                     \
162
166k
        while (w >= 8) {                                                      \
163
39.4k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
39.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
39.4k
          src += 8;                                                           \
166
39.4k
          dst += 8;                                                           \
167
39.4k
          w -= 8;                                                             \
168
39.4k
        }                                                                     \
169
188k
        while (w >= 4) {                                                      \
170
60.5k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
60.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
60.5k
          src += 4;                                                           \
173
60.5k
          dst += 4;                                                           \
174
60.5k
          w -= 4;                                                             \
175
60.5k
        }                                                                     \
176
127k
        (void)num_taps;                                                       \
177
127k
      } 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
54.3k
      } else {                                                                \
202
54.3k
        const int num_taps = 2;                                               \
203
79.9k
        while (w >= 16) {                                                     \
204
25.6k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
25.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
25.6k
          src += 16;                                                          \
207
25.6k
          dst += 16;                                                          \
208
25.6k
          w -= 16;                                                            \
209
25.6k
        }                                                                     \
210
67.6k
        while (w >= 8) {                                                      \
211
13.2k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
13.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
13.2k
          src += 8;                                                           \
214
13.2k
          dst += 8;                                                           \
215
13.2k
          w -= 8;                                                             \
216
13.2k
        }                                                                     \
217
76.8k
        while (w >= 4) {                                                      \
218
22.4k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
22.4k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
22.4k
          src += 4;                                                           \
221
22.4k
          dst += 4;                                                           \
222
22.4k
          w -= 4;                                                             \
223
22.4k
        }                                                                     \
224
54.3k
        (void)num_taps;                                                       \
225
54.3k
      }                                                                       \
226
181k
    }                                                                         \
227
188k
    if (w) {                                                                  \
228
6.56k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
6.56k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
6.56k
                                      y_step_q4, w, h, bd);                   \
231
6.56k
    }                                                                         \
232
188k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
1.23M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.23M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.23M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.17M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
816k
        const int num_taps = 8;                                               \
155
1.04M
        while (w >= 16) {                                                     \
156
223k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
223k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
223k
          src += 16;                                                          \
159
223k
          dst += 16;                                                          \
160
223k
          w -= 16;                                                            \
161
223k
        }                                                                     \
162
1.06M
        while (w >= 8) {                                                      \
163
250k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
250k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
250k
          src += 8;                                                           \
166
250k
          dst += 8;                                                           \
167
250k
          w -= 8;                                                             \
168
250k
        }                                                                     \
169
1.23M
        while (w >= 4) {                                                      \
170
413k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
413k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
413k
          src += 4;                                                           \
173
413k
          dst += 4;                                                           \
174
413k
          w -= 4;                                                             \
175
413k
        }                                                                     \
176
816k
        (void)num_taps;                                                       \
177
816k
      } 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
355k
      } else {                                                                \
202
355k
        const int num_taps = 2;                                               \
203
510k
        while (w >= 16) {                                                     \
204
154k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
154k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
154k
          src += 16;                                                          \
207
154k
          dst += 16;                                                          \
208
154k
          w -= 16;                                                            \
209
154k
        }                                                                     \
210
448k
        while (w >= 8) {                                                      \
211
93.5k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
93.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
93.5k
          src += 8;                                                           \
214
93.5k
          dst += 8;                                                           \
215
93.5k
          w -= 8;                                                             \
216
93.5k
        }                                                                     \
217
495k
        while (w >= 4) {                                                      \
218
140k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
140k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
140k
          src += 4;                                                           \
221
140k
          dst += 4;                                                           \
222
140k
          w -= 4;                                                             \
223
140k
        }                                                                     \
224
355k
        (void)num_taps;                                                       \
225
355k
      }                                                                       \
226
1.17M
    }                                                                         \
227
1.23M
    if (w) {                                                                  \
228
59.6k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
59.6k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
59.6k
                                      y_step_q4, w, h, bd);                   \
231
59.6k
    }                                                                         \
232
1.23M
  }
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.21M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
3.21M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
3.21M
    assert(w <= 64);                                                           \
241
3.21M
    assert(h <= 64);                                                           \
242
3.21M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
3.11M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
3.11M
          filter_x[3] == 128) {                                                \
245
2.29M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.29M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.29M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.29M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.29M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.29M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.29M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.29M
      } 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
820k
      } else {                                                                 \
263
820k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
820k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
820k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
820k
                                         w, h + 1, bd);                        \
267
820k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
820k
                                               filter, x0_q4, x_step_q4,       \
269
820k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
820k
      }                                                                        \
271
3.11M
    } else {                                                                   \
272
96.2k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
96.2k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
96.2k
                                    bd);                                       \
275
96.2k
    }                                                                          \
276
3.21M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_