Coverage Report

Created: 2026-12-01 07:01

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
717M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
717M
    const int16_t *filter_row = filter[offset];                              \
35
717M
    (void)x0_q4;                                                             \
36
717M
    (void)x_step_q4;                                                         \
37
717M
    (void)y0_q4;                                                             \
38
717M
    (void)y_step_q4;                                                         \
39
717M
    assert(filter_row[3] != 128);                                            \
40
717M
    assert(step_q4 == 16);                                                   \
41
717M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
665M
      const int num_taps = 8;                                                \
43
768M
      while (w >= 16) {                                                      \
44
103M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
103M
                                                 dst_stride, h, filter_row); \
46
103M
        src += 16;                                                           \
47
103M
        dst += 16;                                                           \
48
103M
        w -= 16;                                                             \
49
103M
      }                                                                      \
50
665M
      if (w == 8) {                                                          \
51
235M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
235M
                                                dst_stride, h, filter_row);  \
53
430M
      } else if (w == 4) {                                                   \
54
358M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
358M
                                                dst_stride, h, filter_row);  \
56
358M
      }                                                                      \
57
665M
      (void)num_taps;                                                        \
58
665M
    } 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
51.7M
    } else {                                                                 \
76
51.7M
      const int num_taps = 2;                                                \
77
65.7M
      while (w >= 16) {                                                      \
78
14.0M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
14.0M
                                                 dst_stride, h, filter_row); \
80
14.0M
        src += 16;                                                           \
81
14.0M
        dst += 16;                                                           \
82
14.0M
        w -= 16;                                                             \
83
14.0M
      }                                                                      \
84
51.7M
      if (w == 8) {                                                          \
85
16.5M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
16.5M
                                                dst_stride, h, filter_row);  \
87
35.1M
      } else if (w == 4) {                                                   \
88
24.5M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
24.5M
                                                dst_stride, h, filter_row);  \
90
24.5M
      }                                                                      \
91
51.7M
      (void)num_taps;                                                        \
92
51.7M
    }                                                                        \
93
717M
  }
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
197M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
197M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
197M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
197M
    (void)filter_y;                                                            \
103
197M
    assert(filter_x[3] != 128);                                                \
104
197M
    assert(filter_y[3] != 128);                                                \
105
197M
    assert(w <= 64);                                                           \
106
197M
    assert(h <= 64);                                                           \
107
197M
    assert(x_step_q4 == 16);                                                   \
108
197M
    assert(y_step_q4 == 16);                                                   \
109
197M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
175M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
175M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
175M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
175M
                                h + 7);                                        \
114
175M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
175M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
175M
                                      y_step_q4, w, h);                        \
117
175M
    } 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
21.9M
    } else {                                                                   \
127
21.9M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
21.9M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
21.9M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
21.9M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
21.9M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
21.9M
                                      h);                                      \
133
21.9M
    }                                                                          \
134
197M
  }
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
3.72M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
3.72M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
3.72M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
3.41M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
3.06M
        const int num_taps = 8;                                               \
155
4.61M
        while (w >= 16) {                                                     \
156
1.54M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.54M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.54M
          src += 16;                                                          \
159
1.54M
          dst += 16;                                                          \
160
1.54M
          w -= 16;                                                            \
161
1.54M
        }                                                                     \
162
3.88M
        while (w >= 8) {                                                      \
163
824k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
824k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
824k
          src += 8;                                                           \
166
824k
          dst += 8;                                                           \
167
824k
          w -= 8;                                                             \
168
824k
        }                                                                     \
169
4.38M
        while (w >= 4) {                                                      \
170
1.32M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.32M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.32M
          src += 4;                                                           \
173
1.32M
          dst += 4;                                                           \
174
1.32M
          w -= 4;                                                             \
175
1.32M
        }                                                                     \
176
3.06M
        (void)num_taps;                                                       \
177
3.06M
      } 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
347k
      } else {                                                                \
202
347k
        const int num_taps = 2;                                               \
203
511k
        while (w >= 16) {                                                     \
204
163k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
163k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
163k
          src += 16;                                                          \
207
163k
          dst += 16;                                                          \
208
163k
          w -= 16;                                                            \
209
163k
        }                                                                     \
210
431k
        while (w >= 8) {                                                      \
211
84.0k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
84.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
84.0k
          src += 8;                                                           \
214
84.0k
          dst += 8;                                                           \
215
84.0k
          w -= 8;                                                             \
216
84.0k
        }                                                                     \
217
514k
        while (w >= 4) {                                                      \
218
167k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
167k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
167k
          src += 4;                                                           \
221
167k
          dst += 4;                                                           \
222
167k
          w -= 4;                                                             \
223
167k
        }                                                                     \
224
347k
        (void)num_taps;                                                       \
225
347k
      }                                                                       \
226
3.41M
    }                                                                         \
227
3.72M
    if (w) {                                                                  \
228
312k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
312k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
312k
                                      y_step_q4, w, h, bd);                   \
231
312k
    }                                                                         \
232
3.72M
  }
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
1.65M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.65M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.65M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.54M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.39M
        const int num_taps = 8;                                               \
155
2.08M
        while (w >= 16) {                                                     \
156
690k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
690k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
690k
          src += 16;                                                          \
159
690k
          dst += 16;                                                          \
160
690k
          w -= 16;                                                            \
161
690k
        }                                                                     \
162
1.77M
        while (w >= 8) {                                                      \
163
382k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
382k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
382k
          src += 8;                                                           \
166
382k
          dst += 8;                                                           \
167
382k
          w -= 8;                                                             \
168
382k
        }                                                                     \
169
1.99M
        while (w >= 4) {                                                      \
170
599k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
599k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
599k
          src += 4;                                                           \
173
599k
          dst += 4;                                                           \
174
599k
          w -= 4;                                                             \
175
599k
        }                                                                     \
176
1.39M
        (void)num_taps;                                                       \
177
1.39M
      } 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
149k
      } else {                                                                \
202
149k
        const int num_taps = 2;                                               \
203
221k
        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
186k
        while (w >= 8) {                                                      \
211
37.0k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
37.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
37.0k
          src += 8;                                                           \
214
37.0k
          dst += 8;                                                           \
215
37.0k
          w -= 8;                                                             \
216
37.0k
        }                                                                     \
217
219k
        while (w >= 4) {                                                      \
218
69.8k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
69.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
69.8k
          src += 4;                                                           \
221
69.8k
          dst += 4;                                                           \
222
69.8k
          w -= 4;                                                             \
223
69.8k
        }                                                                     \
224
149k
        (void)num_taps;                                                       \
225
149k
      }                                                                       \
226
1.54M
    }                                                                         \
227
1.65M
    if (w) {                                                                  \
228
102k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
102k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
102k
                                      y_step_q4, w, h, bd);                   \
231
102k
    }                                                                         \
232
1.65M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
1.47M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
1.47M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
1.47M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
1.39M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.29M
        const int num_taps = 8;                                               \
155
1.97M
        while (w >= 16) {                                                     \
156
688k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
688k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
688k
          src += 16;                                                          \
159
688k
          dst += 16;                                                          \
160
688k
          w -= 16;                                                            \
161
688k
        }                                                                     \
162
1.63M
        while (w >= 8) {                                                      \
163
341k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
341k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
341k
          src += 8;                                                           \
166
341k
          dst += 8;                                                           \
167
341k
          w -= 8;                                                             \
168
341k
        }                                                                     \
169
1.83M
        while (w >= 4) {                                                      \
170
546k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
546k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
546k
          src += 4;                                                           \
173
546k
          dst += 4;                                                           \
174
546k
          w -= 4;                                                             \
175
546k
        }                                                                     \
176
1.29M
        (void)num_taps;                                                       \
177
1.29M
      } 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
103k
      } else {                                                                \
202
103k
        const int num_taps = 2;                                               \
203
154k
        while (w >= 16) {                                                     \
204
50.7k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
50.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
50.7k
          src += 16;                                                          \
207
50.7k
          dst += 16;                                                          \
208
50.7k
          w -= 16;                                                            \
209
50.7k
        }                                                                     \
210
129k
        while (w >= 8) {                                                      \
211
25.8k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
25.8k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
25.8k
          src += 8;                                                           \
214
25.8k
          dst += 8;                                                           \
215
25.8k
          w -= 8;                                                             \
216
25.8k
        }                                                                     \
217
151k
        while (w >= 4) {                                                      \
218
48.2k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
48.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
48.2k
          src += 4;                                                           \
221
48.2k
          dst += 4;                                                           \
222
48.2k
          w -= 4;                                                             \
223
48.2k
        }                                                                     \
224
103k
        (void)num_taps;                                                       \
225
103k
      }                                                                       \
226
1.39M
    }                                                                         \
227
1.47M
    if (w) {                                                                  \
228
80.0k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
80.0k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
80.0k
                                      y_step_q4, w, h, bd);                   \
231
80.0k
    }                                                                         \
232
1.47M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
190k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
190k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
190k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
95.3k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
76.0k
        const int num_taps = 8;                                               \
155
117k
        while (w >= 16) {                                                     \
156
41.3k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
41.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
41.3k
          src += 16;                                                          \
159
41.3k
          dst += 16;                                                          \
160
41.3k
          w -= 16;                                                            \
161
41.3k
        }                                                                     \
162
94.1k
        while (w >= 8) {                                                      \
163
18.0k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
18.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
18.0k
          src += 8;                                                           \
166
18.0k
          dst += 8;                                                           \
167
18.0k
          w -= 8;                                                             \
168
18.0k
        }                                                                     \
169
111k
        while (w >= 4) {                                                      \
170
35.6k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
35.6k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
35.6k
          src += 4;                                                           \
173
35.6k
          dst += 4;                                                           \
174
35.6k
          w -= 4;                                                             \
175
35.6k
        }                                                                     \
176
76.0k
        (void)num_taps;                                                       \
177
76.0k
      } 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
19.2k
      } else {                                                                \
202
19.2k
        const int num_taps = 2;                                               \
203
30.1k
        while (w >= 16) {                                                     \
204
10.9k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
10.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
10.9k
          src += 16;                                                          \
207
10.9k
          dst += 16;                                                          \
208
10.9k
          w -= 16;                                                            \
209
10.9k
        }                                                                     \
210
24.3k
        while (w >= 8) {                                                      \
211
5.09k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
5.09k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
5.09k
          src += 8;                                                           \
214
5.09k
          dst += 8;                                                           \
215
5.09k
          w -= 8;                                                             \
216
5.09k
        }                                                                     \
217
27.1k
        while (w >= 4) {                                                      \
218
7.89k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
7.89k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
7.89k
          src += 4;                                                           \
221
7.89k
          dst += 4;                                                           \
222
7.89k
          w -= 4;                                                             \
223
7.89k
        }                                                                     \
224
19.2k
        (void)num_taps;                                                       \
225
19.2k
      }                                                                       \
226
95.3k
    }                                                                         \
227
190k
    if (w) {                                                                  \
228
95.3k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
95.3k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
95.3k
                                      y_step_q4, w, h, bd);                   \
231
95.3k
    }                                                                         \
232
190k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
408k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
408k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
408k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
374k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
299k
        const int num_taps = 8;                                               \
155
425k
        while (w >= 16) {                                                     \
156
125k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
125k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
125k
          src += 16;                                                          \
159
125k
          dst += 16;                                                          \
160
125k
          w -= 16;                                                            \
161
125k
        }                                                                     \
162
382k
        while (w >= 8) {                                                      \
163
82.9k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
82.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
82.9k
          src += 8;                                                           \
166
82.9k
          dst += 8;                                                           \
167
82.9k
          w -= 8;                                                             \
168
82.9k
        }                                                                     \
169
441k
        while (w >= 4) {                                                      \
170
141k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
141k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
141k
          src += 4;                                                           \
173
141k
          dst += 4;                                                           \
174
141k
          w -= 4;                                                             \
175
141k
        }                                                                     \
176
299k
        (void)num_taps;                                                       \
177
299k
      } 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
75.0k
      } else {                                                                \
202
75.0k
        const int num_taps = 2;                                               \
203
105k
        while (w >= 16) {                                                     \
204
30.3k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
30.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
30.3k
          src += 16;                                                          \
207
30.3k
          dst += 16;                                                          \
208
30.3k
          w -= 16;                                                            \
209
30.3k
        }                                                                     \
210
91.0k
        while (w >= 8) {                                                      \
211
16.0k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
16.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
16.0k
          src += 8;                                                           \
214
16.0k
          dst += 8;                                                           \
215
16.0k
          w -= 8;                                                             \
216
16.0k
        }                                                                     \
217
116k
        while (w >= 4) {                                                      \
218
41.1k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
41.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
41.1k
          src += 4;                                                           \
221
41.1k
          dst += 4;                                                           \
222
41.1k
          w -= 4;                                                             \
223
41.1k
        }                                                                     \
224
75.0k
        (void)num_taps;                                                       \
225
75.0k
      }                                                                       \
226
374k
    }                                                                         \
227
408k
    if (w) {                                                                  \
228
33.9k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
33.9k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
33.9k
                                      y_step_q4, w, h, bd);                   \
231
33.9k
    }                                                                         \
232
408k
  }
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.04M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
4.04M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
4.04M
    assert(w <= 64);                                                           \
241
4.04M
    assert(h <= 64);                                                           \
242
4.04M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
1.20M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
1.20M
          filter_x[3] == 128) {                                                \
245
1.08M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
1.08M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
1.08M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
1.08M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
1.08M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
1.08M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
1.08M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
1.08M
      } 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
121k
      } else {                                                                 \
263
121k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
121k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
121k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
121k
                                         w, h + 1, bd);                        \
267
121k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
121k
                                               filter, x0_q4, x_step_q4,       \
269
121k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
121k
      }                                                                        \
271
2.83M
    } else {                                                                   \
272
2.83M
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
2.83M
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
2.83M
                                    bd);                                       \
275
2.83M
    }                                                                          \
276
4.04M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_