/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 | 607M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \ |
34 | 607M | const int16_t *filter_row = filter[offset]; \ |
35 | 607M | (void)x0_q4; \ |
36 | 607M | (void)x_step_q4; \ |
37 | 607M | (void)y0_q4; \ |
38 | 607M | (void)y_step_q4; \ |
39 | 607M | assert(filter_row[3] != 128); \ |
40 | 607M | assert(step_q4 == 16); \ |
41 | 607M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ |
42 | 545M | const int num_taps = 8; \ |
43 | 640M | while (w >= 16) { \ |
44 | 94.4M | vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
45 | 94.4M | dst_stride, h, filter_row); \ |
46 | 94.4M | src += 16; \ |
47 | 94.4M | dst += 16; \ |
48 | 94.4M | w -= 16; \ |
49 | 94.4M | } \ |
50 | 545M | if (w == 8) { \ |
51 | 193M | vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
52 | 193M | dst_stride, h, filter_row); \ |
53 | 352M | } else if (w == 4) { \ |
54 | 288M | vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
55 | 288M | dst_stride, h, filter_row); \ |
56 | 288M | } \ |
57 | 545M | (void)num_taps; \ |
58 | 545M | } 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 | 61.6M | } else { \ |
76 | 61.6M | const int num_taps = 2; \ |
77 | 77.9M | while (w >= 16) { \ |
78 | 16.2M | vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
79 | 16.2M | dst_stride, h, filter_row); \ |
80 | 16.2M | src += 16; \ |
81 | 16.2M | dst += 16; \ |
82 | 16.2M | w -= 16; \ |
83 | 16.2M | } \ |
84 | 61.6M | if (w == 8) { \ |
85 | 19.9M | vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
86 | 19.9M | dst_stride, h, filter_row); \ |
87 | 41.7M | } else if (w == 4) { \ |
88 | 29.2M | vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
89 | 29.2M | dst_stride, h, filter_row); \ |
90 | 29.2M | } \ |
91 | 61.6M | (void)num_taps; \ |
92 | 61.6M | } \ |
93 | 607M | } |
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 | 170M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \ |
100 | 170M | const int16_t *filter_x = filter[x0_q4]; \ |
101 | 170M | const int16_t *filter_y = filter[y0_q4]; \ |
102 | 170M | (void)filter_y; \ |
103 | 170M | assert(filter_x[3] != 128); \ |
104 | 170M | assert(filter_y[3] != 128); \ |
105 | 170M | assert(w <= 64); \ |
106 | 170M | assert(h <= 64); \ |
107 | 170M | assert(x_step_q4 == 16); \ |
108 | 170M | assert(y_step_q4 == 16); \ |
109 | 170M | if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) { \ |
110 | 144M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
111 | 144M | vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64, \ |
112 | 144M | filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \ |
113 | 144M | h + 7); \ |
114 | 144M | vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride, \ |
115 | 144M | filter, x0_q4, x_step_q4, y0_q4, \ |
116 | 144M | y_step_q4, w, h); \ |
117 | 144M | } else if (filter_x[2] | filter_x[5]) { \ |
118 | 0 | const int num_taps = is_avg ? 8 : 4; \ |
119 | 0 | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
120 | 0 | vpx_convolve8_horiz_##opt( \ |
121 | 0 | src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64, \ |
122 | 0 | filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1); \ |
123 | 0 | vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64, \ |
124 | 0 | dst, dst_stride, filter, x0_q4, \ |
125 | 0 | x_step_q4, y0_q4, y_step_q4, w, h); \ |
126 | 26.1M | } else { \ |
127 | 26.1M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED); \ |
128 | 26.1M | vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4, \ |
129 | 26.1M | x_step_q4, y0_q4, y_step_q4, w, h + 1); \ |
130 | 26.1M | vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter, \ |
131 | 26.1M | x0_q4, x_step_q4, y0_q4, y_step_q4, w, \ |
132 | 26.1M | h); \ |
133 | 26.1M | } \ |
134 | 170M | } |
135 | | |
136 | | #if CONFIG_VP9_HIGHBITDEPTH |
137 | | |
138 | | typedef void highbd_filter8_1dfunction(const uint16_t *src_ptr, |
139 | | const ptrdiff_t src_pitch, |
140 | | uint16_t *output_ptr, |
141 | | ptrdiff_t out_pitch, |
142 | | unsigned int output_height, |
143 | | const int16_t *filter, int bd); |
144 | | |
145 | | #define HIGH_FUN_CONV_1D(name, offset, step_q4, dir, src_start, avg, opt, \ |
146 | | is_avg) \ |
147 | | void vpx_highbd_convolve8_##name##_##opt( \ |
148 | | const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst, \ |
149 | | ptrdiff_t dst_stride, const InterpKernel *filter_kernel, int x0_q4, \ |
150 | 4.30M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ |
151 | 4.30M | const int16_t *filter_row = filter_kernel[offset]; \ |
152 | 4.30M | if (step_q4 == 16 && filter_row[3] != 128) { \ |
153 | 4.01M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ |
154 | 3.68M | const int num_taps = 8; \ |
155 | 5.32M | while (w >= 16) { \ |
156 | 1.64M | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ |
157 | 1.64M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
158 | 1.64M | src += 16; \ |
159 | 1.64M | dst += 16; \ |
160 | 1.64M | w -= 16; \ |
161 | 1.64M | } \ |
162 | 4.69M | while (w >= 8) { \ |
163 | 1.01M | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ |
164 | 1.01M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
165 | 1.01M | src += 8; \ |
166 | 1.01M | dst += 8; \ |
167 | 1.01M | w -= 8; \ |
168 | 1.01M | } \ |
169 | 5.31M | while (w >= 4) { \ |
170 | 1.63M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ |
171 | 1.63M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
172 | 1.63M | src += 4; \ |
173 | 1.63M | dst += 4; \ |
174 | 1.63M | w -= 4; \ |
175 | 1.63M | } \ |
176 | 3.68M | (void)num_taps; \ |
177 | 3.68M | } 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 | 335k | } else { \ |
202 | 335k | const int num_taps = 2; \ |
203 | 529k | while (w >= 16) { \ |
204 | 194k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ |
205 | 194k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
206 | 194k | src += 16; \ |
207 | 194k | dst += 16; \ |
208 | 194k | w -= 16; \ |
209 | 194k | } \ |
210 | 427k | while (w >= 8) { \ |
211 | 91.8k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ |
212 | 91.8k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
213 | 91.8k | src += 8; \ |
214 | 91.8k | dst += 8; \ |
215 | 91.8k | w -= 8; \ |
216 | 91.8k | } \ |
217 | 470k | while (w >= 4) { \ |
218 | 134k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ |
219 | 134k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
220 | 134k | src += 4; \ |
221 | 134k | dst += 4; \ |
222 | 134k | w -= 4; \ |
223 | 134k | } \ |
224 | 335k | (void)num_taps; \ |
225 | 335k | } \ |
226 | 4.01M | } \ |
227 | 4.30M | if (w) { \ |
228 | 286k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ |
229 | 286k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ |
230 | 286k | y_step_q4, w, h, bd); \ |
231 | 286k | } \ |
232 | 4.30M | } 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.89M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 1.89M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 1.89M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 1.80M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 1.64M | const int num_taps = 8; \ | 155 | 2.39M | while (w >= 16) { \ | 156 | 747k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 747k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 747k | src += 16; \ | 159 | 747k | dst += 16; \ | 160 | 747k | w -= 16; \ | 161 | 747k | } \ | 162 | 2.10M | while (w >= 8) { \ | 163 | 452k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 452k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 452k | src += 8; \ | 166 | 452k | dst += 8; \ | 167 | 452k | w -= 8; \ | 168 | 452k | } \ | 169 | 2.37M | while (w >= 4) { \ | 170 | 725k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 725k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 725k | src += 4; \ | 173 | 725k | dst += 4; \ | 174 | 725k | w -= 4; \ | 175 | 725k | } \ | 176 | 1.64M | (void)num_taps; \ | 177 | 1.64M | } 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 | 154k | } else { \ | 202 | 154k | const int num_taps = 2; \ | 203 | 243k | while (w >= 16) { \ | 204 | 88.5k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 88.5k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 88.5k | src += 16; \ | 207 | 88.5k | dst += 16; \ | 208 | 88.5k | w -= 16; \ | 209 | 88.5k | } \ | 210 | 197k | while (w >= 8) { \ | 211 | 42.5k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 42.5k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 42.5k | src += 8; \ | 214 | 42.5k | dst += 8; \ | 215 | 42.5k | w -= 8; \ | 216 | 42.5k | } \ | 217 | 217k | while (w >= 4) { \ | 218 | 62.3k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 62.3k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 62.3k | src += 4; \ | 221 | 62.3k | dst += 4; \ | 222 | 62.3k | w -= 4; \ | 223 | 62.3k | } \ | 224 | 154k | (void)num_taps; \ | 225 | 154k | } \ | 226 | 1.80M | } \ | 227 | 1.89M | if (w) { \ | 228 | 91.5k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 91.5k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 91.5k | y_step_q4, w, h, bd); \ | 231 | 91.5k | } \ | 232 | 1.89M | } |
vpx_highbd_convolve8_vert_avx2 Line | Count | Source | 150 | 1.66M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 1.66M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 1.66M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 1.59M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 1.47M | const int num_taps = 8; \ | 155 | 2.16M | while (w >= 16) { \ | 156 | 687k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 687k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 687k | src += 16; \ | 159 | 687k | dst += 16; \ | 160 | 687k | w -= 16; \ | 161 | 687k | } \ | 162 | 1.88M | while (w >= 8) { \ | 163 | 402k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 402k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 402k | src += 8; \ | 166 | 402k | dst += 8; \ | 167 | 402k | w -= 8; \ | 168 | 402k | } \ | 169 | 2.12M | while (w >= 4) { \ | 170 | 649k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 649k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 649k | src += 4; \ | 173 | 649k | dst += 4; \ | 174 | 649k | w -= 4; \ | 175 | 649k | } \ | 176 | 1.47M | (void)num_taps; \ | 177 | 1.47M | } 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 | 111k | } else { \ | 202 | 111k | const int num_taps = 2; \ | 203 | 171k | while (w >= 16) { \ | 204 | 59.8k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 59.8k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 59.8k | src += 16; \ | 207 | 59.8k | dst += 16; \ | 208 | 59.8k | w -= 16; \ | 209 | 59.8k | } \ | 210 | 142k | while (w >= 8) { \ | 211 | 31.0k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 31.0k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 31.0k | src += 8; \ | 214 | 31.0k | dst += 8; \ | 215 | 31.0k | w -= 8; \ | 216 | 31.0k | } \ | 217 | 156k | while (w >= 4) { \ | 218 | 45.3k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 45.3k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 45.3k | src += 4; \ | 221 | 45.3k | dst += 4; \ | 222 | 45.3k | w -= 4; \ | 223 | 45.3k | } \ | 224 | 111k | (void)num_taps; \ | 225 | 111k | } \ | 226 | 1.59M | } \ | 227 | 1.66M | if (w) { \ | 228 | 74.2k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 74.2k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 74.2k | y_step_q4, w, h, bd); \ | 231 | 74.2k | } \ | 232 | 1.66M | } |
vpx_highbd_convolve8_avg_horiz_avx2 Line | Count | Source | 150 | 205k | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 205k | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 205k | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 109k | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 91.5k | const int num_taps = 8; \ | 155 | 131k | while (w >= 16) { \ | 156 | 39.9k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 39.9k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 39.9k | src += 16; \ | 159 | 39.9k | dst += 16; \ | 160 | 39.9k | w -= 16; \ | 161 | 39.9k | } \ | 162 | 116k | while (w >= 8) { \ | 163 | 24.5k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 24.5k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 24.5k | src += 8; \ | 166 | 24.5k | dst += 8; \ | 167 | 24.5k | w -= 8; \ | 168 | 24.5k | } \ | 169 | 136k | while (w >= 4) { \ | 170 | 44.6k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 44.6k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 44.6k | src += 4; \ | 173 | 44.6k | dst += 4; \ | 174 | 44.6k | w -= 4; \ | 175 | 44.6k | } \ | 176 | 91.5k | (void)num_taps; \ | 177 | 91.5k | } 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 | 33.7k | while (w >= 16) { \ | 204 | 15.3k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 15.3k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 15.3k | src += 16; \ | 207 | 15.3k | dst += 16; \ | 208 | 15.3k | w -= 16; \ | 209 | 15.3k | } \ | 210 | 23.2k | while (w >= 8) { \ | 211 | 4.86k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 4.86k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 4.86k | src += 8; \ | 214 | 4.86k | dst += 8; \ | 215 | 4.86k | w -= 8; \ | 216 | 4.86k | } \ | 217 | 24.9k | while (w >= 4) { \ | 218 | 6.58k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 6.58k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 6.58k | src += 4; \ | 221 | 6.58k | dst += 4; \ | 222 | 6.58k | w -= 4; \ | 223 | 6.58k | } \ | 224 | 18.3k | (void)num_taps; \ | 225 | 18.3k | } \ | 226 | 109k | } \ | 227 | 205k | if (w) { \ | 228 | 95.6k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 95.6k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 95.6k | y_step_q4, w, h, bd); \ | 231 | 95.6k | } \ | 232 | 205k | } |
vpx_highbd_convolve8_avg_vert_avx2 Line | Count | Source | 150 | 536k | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 536k | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 536k | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 511k | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 460k | const int num_taps = 8; \ | 155 | 629k | while (w >= 16) { \ | 156 | 168k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 168k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 168k | src += 16; \ | 159 | 168k | dst += 16; \ | 160 | 168k | w -= 16; \ | 161 | 168k | } \ | 162 | 598k | while (w >= 8) { \ | 163 | 137k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 137k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 137k | src += 8; \ | 166 | 137k | dst += 8; \ | 167 | 137k | w -= 8; \ | 168 | 137k | } \ | 169 | 674k | while (w >= 4) { \ | 170 | 214k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 214k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 214k | src += 4; \ | 173 | 214k | dst += 4; \ | 174 | 214k | w -= 4; \ | 175 | 214k | } \ | 176 | 460k | (void)num_taps; \ | 177 | 460k | } 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 | 51.0k | } else { \ | 202 | 51.0k | const int num_taps = 2; \ | 203 | 81.6k | while (w >= 16) { \ | 204 | 30.6k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 30.6k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 30.6k | src += 16; \ | 207 | 30.6k | dst += 16; \ | 208 | 30.6k | w -= 16; \ | 209 | 30.6k | } \ | 210 | 64.4k | while (w >= 8) { \ | 211 | 13.3k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 13.3k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 13.3k | src += 8; \ | 214 | 13.3k | dst += 8; \ | 215 | 13.3k | w -= 8; \ | 216 | 13.3k | } \ | 217 | 71.4k | while (w >= 4) { \ | 218 | 20.4k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 20.4k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 20.4k | src += 4; \ | 221 | 20.4k | dst += 4; \ | 222 | 20.4k | w -= 4; \ | 223 | 20.4k | } \ | 224 | 51.0k | (void)num_taps; \ | 225 | 51.0k | } \ | 226 | 511k | } \ | 227 | 536k | if (w) { \ | 228 | 24.7k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 24.7k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 24.7k | y_step_q4, w, h, bd); \ | 231 | 24.7k | } \ | 232 | 536k | } |
|
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.16M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ |
239 | 4.16M | const int16_t *filter_x = filter[x0_q4]; \ |
240 | 4.16M | assert(w <= 64); \ |
241 | 4.16M | assert(h <= 64); \ |
242 | 4.16M | if (x_step_q4 == 16 && y_step_q4 == 16) { \ |
243 | 1.46M | if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) || \ |
244 | 1.46M | filter_x[3] == 128) { \ |
245 | 1.33M | DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
246 | 1.33M | vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, \ |
247 | 1.33M | fdata2, 64, filter, x0_q4, x_step_q4, \ |
248 | 1.33M | y0_q4, y_step_q4, w, h + 7, bd); \ |
249 | 1.33M | vpx_highbd_convolve8_##avg##vert_##opt( \ |
250 | 1.33M | fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4, \ |
251 | 1.33M | y0_q4, y_step_q4, w, h, bd); \ |
252 | 1.33M | } 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 | 122k | } else { \ |
263 | 122k | DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED); \ |
264 | 122k | vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, \ |
265 | 122k | x0_q4, x_step_q4, y0_q4, y_step_q4, \ |
266 | 122k | w, h + 1, bd); \ |
267 | 122k | vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, \ |
268 | 122k | filter, x0_q4, x_step_q4, \ |
269 | 122k | y0_q4, y_step_q4, w, h, bd); \ |
270 | 122k | } \ |
271 | 2.70M | } else { \ |
272 | 2.70M | vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter, \ |
273 | 2.70M | x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, \ |
274 | 2.70M | bd); \ |
275 | 2.70M | } \ |
276 | 4.16M | } |
277 | | |
278 | | #endif // CONFIG_VP9_HIGHBITDEPTH |
279 | | #endif // VPX_VPX_DSP_X86_CONVOLVE_H_ |