Coverage Report

Created: 2025-11-16 07:20

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
257M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {               \
34
257M
    const int16_t *filter_row = filter[offset];                              \
35
257M
    (void)x0_q4;                                                             \
36
257M
    (void)x_step_q4;                                                         \
37
257M
    (void)y0_q4;                                                             \
38
257M
    (void)y_step_q4;                                                         \
39
257M
    assert(filter_row[3] != 128);                                            \
40
257M
    assert(step_q4 == 16);                                                   \
41
257M
    if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {     \
42
126M
      const int num_taps = 8;                                                \
43
142M
      while (w >= 16) {                                                      \
44
16.4M
        vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \
45
16.4M
                                                 dst_stride, h, filter_row); \
46
16.4M
        src += 16;                                                           \
47
16.4M
        dst += 16;                                                           \
48
16.4M
        w -= 16;                                                             \
49
16.4M
      }                                                                      \
50
126M
      if (w == 8) {                                                          \
51
35.8M
        vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst,  \
52
35.8M
                                                dst_stride, h, filter_row);  \
53
90.5M
      } else if (w == 4) {                                                   \
54
77.2M
        vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst,  \
55
77.2M
                                                dst_stride, h, filter_row);  \
56
77.2M
      }                                                                      \
57
126M
      (void)num_taps;                                                        \
58
130M
    } else if (filter_row[2] | filter_row[5]) {                              \
59
127M
      const int num_taps = is_avg ? 8 : 4;                                   \
60
140M
      while (w >= 16) {                                                      \
61
13.1M
        vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \
62
13.1M
                                                 dst_stride, h, filter_row); \
63
13.1M
        src += 16;                                                           \
64
13.1M
        dst += 16;                                                           \
65
13.1M
        w -= 16;                                                             \
66
13.1M
      }                                                                      \
67
127M
      if (w == 8) {                                                          \
68
29.6M
        vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst,  \
69
29.6M
                                                dst_stride, h, filter_row);  \
70
97.5M
      } else if (w == 4) {                                                   \
71
87.5M
        vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst,  \
72
87.5M
                                                dst_stride, h, filter_row);  \
73
87.5M
      }                                                                      \
74
127M
      (void)num_taps;                                                        \
75
127M
    } else {                                                                 \
76
3.37M
      const int num_taps = 2;                                                \
77
4.86M
      while (w >= 16) {                                                      \
78
1.48M
        vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \
79
1.48M
                                                 dst_stride, h, filter_row); \
80
1.48M
        src += 16;                                                           \
81
1.48M
        dst += 16;                                                           \
82
1.48M
        w -= 16;                                                             \
83
1.48M
      }                                                                      \
84
3.37M
      if (w == 8) {                                                          \
85
1.02M
        vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst,  \
86
1.02M
                                                dst_stride, h, filter_row);  \
87
2.35M
      } else if (w == 4) {                                                   \
88
1.31M
        vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst,  \
89
1.31M
                                                dst_stride, h, filter_row);  \
90
1.31M
      }                                                                      \
91
3.37M
      (void)num_taps;                                                        \
92
3.37M
    }                                                                        \
93
257M
  }
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
77.1M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h) {                 \
100
77.1M
    const int16_t *filter_x = filter[x0_q4];                                   \
101
77.1M
    const int16_t *filter_y = filter[y0_q4];                                   \
102
77.1M
    (void)filter_y;                                                            \
103
77.1M
    assert(filter_x[3] != 128);                                                \
104
77.1M
    assert(filter_y[3] != 128);                                                \
105
77.1M
    assert(w <= 64);                                                           \
106
77.1M
    assert(h <= 64);                                                           \
107
77.1M
    assert(x_step_q4 == 16);                                                   \
108
77.1M
    assert(y_step_q4 == 16);                                                   \
109
77.1M
    if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) {               \
110
38.7M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
111
38.7M
      vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64,  \
112
38.7M
                                filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \
113
38.7M
                                h + 7);                                        \
114
38.7M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride,    \
115
38.7M
                                      filter, x0_q4, x_step_q4, y0_q4,         \
116
38.7M
                                      y_step_q4, w, h);                        \
117
38.7M
    } else if (filter_x[2] | filter_x[5]) {                                    \
118
37.0M
      const int num_taps = is_avg ? 8 : 4;                                     \
119
37.0M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED);         \
120
37.0M
      vpx_convolve8_horiz_##opt(                                               \
121
37.0M
          src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64,       \
122
37.0M
          filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1);    \
123
37.0M
      vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64,    \
124
37.0M
                                      dst, dst_stride, filter, x0_q4,          \
125
37.0M
                                      x_step_q4, y0_q4, y_step_q4, w, h);      \
126
37.0M
    } else {                                                                   \
127
1.28M
      DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED);         \
128
1.28M
      vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4,    \
129
1.28M
                                x_step_q4, y0_q4, y_step_q4, w, h + 1);        \
130
1.28M
      vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter,     \
131
1.28M
                                      x0_q4, x_step_q4, y0_q4, y_step_q4, w,   \
132
1.28M
                                      h);                                      \
133
1.28M
    }                                                                          \
134
77.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
6.15M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
6.15M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
6.15M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
5.90M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
5.17M
        const int num_taps = 8;                                               \
155
6.55M
        while (w >= 16) {                                                     \
156
1.37M
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
1.37M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
1.37M
          src += 16;                                                          \
159
1.37M
          dst += 16;                                                          \
160
1.37M
          w -= 16;                                                            \
161
1.37M
        }                                                                     \
162
6.93M
        while (w >= 8) {                                                      \
163
1.75M
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
1.75M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
1.75M
          src += 8;                                                           \
166
1.75M
          dst += 8;                                                           \
167
1.75M
          w -= 8;                                                             \
168
1.75M
        }                                                                     \
169
7.68M
        while (w >= 4) {                                                      \
170
2.50M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
2.50M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
2.50M
          src += 4;                                                           \
173
2.50M
          dst += 4;                                                           \
174
2.50M
          w -= 4;                                                             \
175
2.50M
        }                                                                     \
176
5.17M
        (void)num_taps;                                                       \
177
5.17M
      } 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
721k
      } else {                                                                \
202
721k
        const int num_taps = 2;                                               \
203
925k
        while (w >= 16) {                                                     \
204
203k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
203k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
203k
          src += 16;                                                          \
207
203k
          dst += 16;                                                          \
208
203k
          w -= 16;                                                            \
209
203k
        }                                                                     \
210
935k
        while (w >= 8) {                                                      \
211
213k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
213k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
213k
          src += 8;                                                           \
214
213k
          dst += 8;                                                           \
215
213k
          w -= 8;                                                             \
216
213k
        }                                                                     \
217
1.08M
        while (w >= 4) {                                                      \
218
365k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
365k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
365k
          src += 4;                                                           \
221
365k
          dst += 4;                                                           \
222
365k
          w -= 4;                                                             \
223
365k
        }                                                                     \
224
721k
        (void)num_taps;                                                       \
225
721k
      }                                                                       \
226
5.90M
    }                                                                         \
227
6.15M
    if (w) {                                                                  \
228
250k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
250k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
250k
                                      y_step_q4, w, h, bd);                   \
231
250k
    }                                                                         \
232
6.15M
  }
Unexecuted instantiation: vpx_highbd_convolve8_horiz_sse2
Unexecuted instantiation: vpx_highbd_convolve8_vert_sse2
Unexecuted instantiation: vpx_highbd_convolve8_avg_horiz_sse2
Unexecuted instantiation: vpx_highbd_convolve8_avg_vert_sse2
vpx_highbd_convolve8_horiz_avx2
Line
Count
Source
150
2.72M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
2.72M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
2.72M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.71M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
2.38M
        const int num_taps = 8;                                               \
155
3.00M
        while (w >= 16) {                                                     \
156
617k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
617k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
617k
          src += 16;                                                          \
159
617k
          dst += 16;                                                          \
160
617k
          w -= 16;                                                            \
161
617k
        }                                                                     \
162
3.19M
        while (w >= 8) {                                                      \
163
811k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
811k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
811k
          src += 8;                                                           \
166
811k
          dst += 8;                                                           \
167
811k
          w -= 8;                                                             \
168
811k
        }                                                                     \
169
3.53M
        while (w >= 4) {                                                      \
170
1.15M
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
1.15M
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
1.15M
          src += 4;                                                           \
173
1.15M
          dst += 4;                                                           \
174
1.15M
          w -= 4;                                                             \
175
1.15M
        }                                                                     \
176
2.38M
        (void)num_taps;                                                       \
177
2.38M
      } 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
333k
      } else {                                                                \
202
333k
        const int num_taps = 2;                                               \
203
425k
        while (w >= 16) {                                                     \
204
91.3k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
91.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
91.3k
          src += 16;                                                          \
207
91.3k
          dst += 16;                                                          \
208
91.3k
          w -= 16;                                                            \
209
91.3k
        }                                                                     \
210
432k
        while (w >= 8) {                                                      \
211
98.2k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
98.2k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
98.2k
          src += 8;                                                           \
214
98.2k
          dst += 8;                                                           \
215
98.2k
          w -= 8;                                                             \
216
98.2k
        }                                                                     \
217
505k
        while (w >= 4) {                                                      \
218
171k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
171k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
171k
          src += 4;                                                           \
221
171k
          dst += 4;                                                           \
222
171k
          w -= 4;                                                             \
223
171k
        }                                                                     \
224
333k
        (void)num_taps;                                                       \
225
333k
      }                                                                       \
226
2.71M
    }                                                                         \
227
2.72M
    if (w) {                                                                  \
228
8.45k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
8.45k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
8.45k
                                      y_step_q4, w, h, bd);                   \
231
8.45k
    }                                                                         \
232
2.72M
  }
vpx_highbd_convolve8_vert_avx2
Line
Count
Source
150
2.31M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
2.31M
    const int16_t *filter_row = filter_kernel[offset];                        \
152
2.31M
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
2.14M
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
1.87M
        const int num_taps = 8;                                               \
155
2.36M
        while (w >= 16) {                                                     \
156
490k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
490k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
490k
          src += 16;                                                          \
159
490k
          dst += 16;                                                          \
160
490k
          w -= 16;                                                            \
161
490k
        }                                                                     \
162
2.53M
        while (w >= 8) {                                                      \
163
660k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
660k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
660k
          src += 8;                                                           \
166
660k
          dst += 8;                                                           \
167
660k
          w -= 8;                                                             \
168
660k
        }                                                                     \
169
2.75M
        while (w >= 4) {                                                      \
170
884k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
884k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
884k
          src += 4;                                                           \
173
884k
          dst += 4;                                                           \
174
884k
          w -= 4;                                                             \
175
884k
        }                                                                     \
176
1.87M
        (void)num_taps;                                                       \
177
1.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
270k
      } else {                                                                \
202
270k
        const int num_taps = 2;                                               \
203
341k
        while (w >= 16) {                                                     \
204
71.1k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
71.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
71.1k
          src += 16;                                                          \
207
71.1k
          dst += 16;                                                          \
208
71.1k
          w -= 16;                                                            \
209
71.1k
        }                                                                     \
210
347k
        while (w >= 8) {                                                      \
211
77.0k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
77.0k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
77.0k
          src += 8;                                                           \
214
77.0k
          dst += 8;                                                           \
215
77.0k
          w -= 8;                                                             \
216
77.0k
        }                                                                     \
217
413k
        while (w >= 4) {                                                      \
218
143k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
143k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
143k
          src += 4;                                                           \
221
143k
          dst += 4;                                                           \
222
143k
          w -= 4;                                                             \
223
143k
        }                                                                     \
224
270k
        (void)num_taps;                                                       \
225
270k
      }                                                                       \
226
2.14M
    }                                                                         \
227
2.31M
    if (w) {                                                                  \
228
175k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
175k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
175k
                                      y_step_q4, w, h, bd);                   \
231
175k
    }                                                                         \
232
2.31M
  }
vpx_highbd_convolve8_avg_horiz_avx2
Line
Count
Source
150
157k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
157k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
157k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
150k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
132k
        const int num_taps = 8;                                               \
155
175k
        while (w >= 16) {                                                     \
156
43.1k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
43.1k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
43.1k
          src += 16;                                                          \
159
43.1k
          dst += 16;                                                          \
160
43.1k
          w -= 16;                                                            \
161
43.1k
        }                                                                     \
162
172k
        while (w >= 8) {                                                      \
163
40.3k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
40.3k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
40.3k
          src += 8;                                                           \
166
40.3k
          dst += 8;                                                           \
167
40.3k
          w -= 8;                                                             \
168
40.3k
        }                                                                     \
169
196k
        while (w >= 4) {                                                      \
170
63.5k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
63.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
63.5k
          src += 4;                                                           \
173
63.5k
          dst += 4;                                                           \
174
63.5k
          w -= 4;                                                             \
175
63.5k
        }                                                                     \
176
132k
        (void)num_taps;                                                       \
177
132k
      } else if (filter_row[2] | filter_row[5]) {                             \
178
0
        const int num_taps = is_avg ? 8 : 4;                                  \
179
0
        while (w >= 16) {                                                     \
180
0
          vpx_highbd_filter_block1d16_##dir##4_##avg##opt(                    \
181
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
182
0
          src += 16;                                                          \
183
0
          dst += 16;                                                          \
184
0
          w -= 16;                                                            \
185
0
        }                                                                     \
186
0
        while (w >= 8) {                                                      \
187
0
          vpx_highbd_filter_block1d8_##dir##4_##avg##opt(                     \
188
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
189
0
          src += 8;                                                           \
190
0
          dst += 8;                                                           \
191
0
          w -= 8;                                                             \
192
0
        }                                                                     \
193
0
        while (w >= 4) {                                                      \
194
0
          vpx_highbd_filter_block1d4_##dir##4_##avg##opt(                     \
195
0
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
196
0
          src += 4;                                                           \
197
0
          dst += 4;                                                           \
198
0
          w -= 4;                                                             \
199
0
        }                                                                     \
200
0
        (void)num_taps;                                                       \
201
18.3k
      } else {                                                                \
202
18.3k
        const int num_taps = 2;                                               \
203
26.0k
        while (w >= 16) {                                                     \
204
7.72k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
7.72k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
7.72k
          src += 16;                                                          \
207
7.72k
          dst += 16;                                                          \
208
7.72k
          w -= 16;                                                            \
209
7.72k
        }                                                                     \
210
24.0k
        while (w >= 8) {                                                      \
211
5.76k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
5.76k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
5.76k
          src += 8;                                                           \
214
5.76k
          dst += 8;                                                           \
215
5.76k
          w -= 8;                                                             \
216
5.76k
        }                                                                     \
217
25.9k
        while (w >= 4) {                                                      \
218
7.61k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
7.61k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
7.61k
          src += 4;                                                           \
221
7.61k
          dst += 4;                                                           \
222
7.61k
          w -= 4;                                                             \
223
7.61k
        }                                                                     \
224
18.3k
        (void)num_taps;                                                       \
225
18.3k
      }                                                                       \
226
150k
    }                                                                         \
227
157k
    if (w) {                                                                  \
228
6.90k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
6.90k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
6.90k
                                      y_step_q4, w, h, bd);                   \
231
6.90k
    }                                                                         \
232
157k
  }
vpx_highbd_convolve8_avg_vert_avx2
Line
Count
Source
150
949k
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {        \
151
949k
    const int16_t *filter_row = filter_kernel[offset];                        \
152
949k
    if (step_q4 == 16 && filter_row[3] != 128) {                              \
153
889k
      if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) {    \
154
790k
        const int num_taps = 8;                                               \
155
1.01M
        while (w >= 16) {                                                     \
156
220k
          vpx_highbd_filter_block1d16_##dir##8_##avg##opt(                    \
157
220k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
158
220k
          src += 16;                                                          \
159
220k
          dst += 16;                                                          \
160
220k
          w -= 16;                                                            \
161
220k
        }                                                                     \
162
1.02M
        while (w >= 8) {                                                      \
163
239k
          vpx_highbd_filter_block1d8_##dir##8_##avg##opt(                     \
164
239k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
165
239k
          src += 8;                                                           \
166
239k
          dst += 8;                                                           \
167
239k
          w -= 8;                                                             \
168
239k
        }                                                                     \
169
1.19M
        while (w >= 4) {                                                      \
170
400k
          vpx_highbd_filter_block1d4_##dir##8_##avg##opt(                     \
171
400k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
172
400k
          src += 4;                                                           \
173
400k
          dst += 4;                                                           \
174
400k
          w -= 4;                                                             \
175
400k
        }                                                                     \
176
790k
        (void)num_taps;                                                       \
177
790k
      } 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
98.7k
      } else {                                                                \
202
98.7k
        const int num_taps = 2;                                               \
203
132k
        while (w >= 16) {                                                     \
204
33.5k
          vpx_highbd_filter_block1d16_##dir##2_##avg##opt(                    \
205
33.5k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
206
33.5k
          src += 16;                                                          \
207
33.5k
          dst += 16;                                                          \
208
33.5k
          w -= 16;                                                            \
209
33.5k
        }                                                                     \
210
131k
        while (w >= 8) {                                                      \
211
32.7k
          vpx_highbd_filter_block1d8_##dir##2_##avg##opt(                     \
212
32.7k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
213
32.7k
          src += 8;                                                           \
214
32.7k
          dst += 8;                                                           \
215
32.7k
          w -= 8;                                                             \
216
32.7k
        }                                                                     \
217
141k
        while (w >= 4) {                                                      \
218
42.9k
          vpx_highbd_filter_block1d4_##dir##2_##avg##opt(                     \
219
42.9k
              src_start, src_stride, dst, dst_stride, h, filter_row, bd);     \
220
42.9k
          src += 4;                                                           \
221
42.9k
          dst += 4;                                                           \
222
42.9k
          w -= 4;                                                             \
223
42.9k
        }                                                                     \
224
98.7k
        (void)num_taps;                                                       \
225
98.7k
      }                                                                       \
226
889k
    }                                                                         \
227
949k
    if (w) {                                                                  \
228
60.1k
      vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride,       \
229
60.1k
                                      filter_kernel, x0_q4, x_step_q4, y0_q4, \
230
60.1k
                                      y_step_q4, w, h, bd);                   \
231
60.1k
    }                                                                         \
232
949k
  }
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
2.42M
      int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) {         \
239
2.42M
    const int16_t *filter_x = filter[x0_q4];                                   \
240
2.42M
    assert(w <= 64);                                                           \
241
2.42M
    assert(h <= 64);                                                           \
242
2.42M
    if (x_step_q4 == 16 && y_step_q4 == 16) {                                  \
243
2.30M
      if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) ||           \
244
2.30M
          filter_x[3] == 128) {                                                \
245
2.02M
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED);      \
246
2.02M
        vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride,     \
247
2.02M
                                         fdata2, 64, filter, x0_q4, x_step_q4, \
248
2.02M
                                         y0_q4, y_step_q4, w, h + 7, bd);      \
249
2.02M
        vpx_highbd_convolve8_##avg##vert_##opt(                                \
250
2.02M
            fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4,       \
251
2.02M
            y0_q4, y_step_q4, w, h, bd);                                       \
252
2.02M
      } 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
282k
      } else {                                                                 \
263
282k
        DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED);      \
264
282k
        vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter,  \
265
282k
                                         x0_q4, x_step_q4, y0_q4, y_step_q4,   \
266
282k
                                         w, h + 1, bd);                        \
267
282k
        vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride,    \
268
282k
                                               filter, x0_q4, x_step_q4,       \
269
282k
                                               y0_q4, y_step_q4, w, h, bd);    \
270
282k
      }                                                                        \
271
2.30M
    } else {                                                                   \
272
120k
      vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter,  \
273
120k
                                    x0_q4, x_step_q4, y0_q4, y_step_q4, w, h,  \
274
120k
                                    bd);                                       \
275
120k
    }                                                                          \
276
2.42M
  }
277
278
#endif  // CONFIG_VP9_HIGHBITDEPTH
279
#endif  // VPX_VPX_DSP_X86_CONVOLVE_H_