/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 | 244M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \ |
34 | 244M | const int16_t *filter_row = filter[offset]; \ |
35 | 244M | (void)x0_q4; \ |
36 | 244M | (void)x_step_q4; \ |
37 | 244M | (void)y0_q4; \ |
38 | 244M | (void)y_step_q4; \ |
39 | 244M | assert(filter_row[3] != 128); \ |
40 | 244M | assert(step_q4 == 16); \ |
41 | 244M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ |
42 | 113M | const int num_taps = 8; \ |
43 | 127M | while (w >= 16) { \ |
44 | 14.1M | vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
45 | 14.1M | dst_stride, h, filter_row); \ |
46 | 14.1M | src += 16; \ |
47 | 14.1M | dst += 16; \ |
48 | 14.1M | w -= 16; \ |
49 | 14.1M | } \ |
50 | 113M | if (w == 8) { \ |
51 | 31.6M | vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
52 | 31.6M | dst_stride, h, filter_row); \ |
53 | 81.8M | } else if (w == 4) { \ |
54 | 70.3M | vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
55 | 70.3M | dst_stride, h, filter_row); \ |
56 | 70.3M | } \ |
57 | 113M | (void)num_taps; \ |
58 | 130M | } else if (filter_row[2] | filter_row[5]) { \ |
59 | 126M | const int num_taps = is_avg ? 8 : 4; \ |
60 | 140M | while (w >= 16) { \ |
61 | 14.1M | vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \ |
62 | 14.1M | dst_stride, h, filter_row); \ |
63 | 14.1M | src += 16; \ |
64 | 14.1M | dst += 16; \ |
65 | 14.1M | w -= 16; \ |
66 | 14.1M | } \ |
67 | 126M | if (w == 8) { \ |
68 | 31.0M | vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst, \ |
69 | 31.0M | dst_stride, h, filter_row); \ |
70 | 95.5M | } else if (w == 4) { \ |
71 | 84.9M | vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst, \ |
72 | 84.9M | dst_stride, h, filter_row); \ |
73 | 84.9M | } \ |
74 | 126M | (void)num_taps; \ |
75 | 126M | } else { \ |
76 | 4.29M | const int num_taps = 2; \ |
77 | 6.22M | while (w >= 16) { \ |
78 | 1.92M | vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
79 | 1.92M | dst_stride, h, filter_row); \ |
80 | 1.92M | src += 16; \ |
81 | 1.92M | dst += 16; \ |
82 | 1.92M | w -= 16; \ |
83 | 1.92M | } \ |
84 | 4.29M | if (w == 8) { \ |
85 | 1.28M | vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
86 | 1.28M | dst_stride, h, filter_row); \ |
87 | 3.01M | } else if (w == 4) { \ |
88 | 1.66M | vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
89 | 1.66M | dst_stride, h, filter_row); \ |
90 | 1.66M | } \ |
91 | 4.29M | (void)num_taps; \ |
92 | 4.29M | } \ |
93 | 244M | } |
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 | 72.5M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \ |
100 | 72.5M | const int16_t *filter_x = filter[x0_q4]; \ |
101 | 72.5M | const int16_t *filter_y = filter[y0_q4]; \ |
102 | 72.5M | (void)filter_y; \ |
103 | 72.5M | assert(filter_x[3] != 128); \ |
104 | 72.5M | assert(filter_y[3] != 128); \ |
105 | 72.5M | assert(w <= 64); \ |
106 | 72.5M | assert(h <= 64); \ |
107 | 72.5M | assert(x_step_q4 == 16); \ |
108 | 72.5M | assert(y_step_q4 == 16); \ |
109 | 72.5M | if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) { \ |
110 | 34.7M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
111 | 34.7M | vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64, \ |
112 | 34.7M | filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \ |
113 | 34.7M | h + 7); \ |
114 | 34.7M | vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride, \ |
115 | 34.7M | filter, x0_q4, x_step_q4, y0_q4, \ |
116 | 34.7M | y_step_q4, w, h); \ |
117 | 37.7M | } else if (filter_x[2] | filter_x[5]) { \ |
118 | 36.1M | const int num_taps = is_avg ? 8 : 4; \ |
119 | 36.1M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
120 | 36.1M | vpx_convolve8_horiz_##opt( \ |
121 | 36.1M | src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64, \ |
122 | 36.1M | filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1); \ |
123 | 36.1M | vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64, \ |
124 | 36.1M | dst, dst_stride, filter, x0_q4, \ |
125 | 36.1M | x_step_q4, y0_q4, y_step_q4, w, h); \ |
126 | 36.1M | } else { \ |
127 | 1.62M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED); \ |
128 | 1.62M | vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4, \ |
129 | 1.62M | x_step_q4, y0_q4, y_step_q4, w, h + 1); \ |
130 | 1.62M | vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter, \ |
131 | 1.62M | x0_q4, x_step_q4, y0_q4, y_step_q4, w, \ |
132 | 1.62M | h); \ |
133 | 1.62M | } \ |
134 | 72.5M | } |
135 | | |
136 | | #if CONFIG_VP9_HIGHBITDEPTH |
137 | | |
138 | | typedef void highbd_filter8_1dfunction(const uint16_t *src_ptr, |
139 | | const ptrdiff_t src_pitch, |
140 | | uint16_t *output_ptr, |
141 | | ptrdiff_t out_pitch, |
142 | | unsigned int output_height, |
143 | | const int16_t *filter, int bd); |
144 | | |
145 | | #define HIGH_FUN_CONV_1D(name, offset, step_q4, dir, src_start, avg, opt, \ |
146 | | is_avg) \ |
147 | | void vpx_highbd_convolve8_##name##_##opt( \ |
148 | | const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst, \ |
149 | | ptrdiff_t dst_stride, const InterpKernel *filter_kernel, int x0_q4, \ |
150 | 8.95M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ |
151 | 8.95M | const int16_t *filter_row = filter_kernel[offset]; \ |
152 | 8.95M | if (step_q4 == 16 && filter_row[3] != 128) { \ |
153 | 8.77M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ |
154 | 6.87M | const int num_taps = 8; \ |
155 | 8.58M | while (w >= 16) { \ |
156 | 1.71M | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ |
157 | 1.71M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
158 | 1.71M | src += 16; \ |
159 | 1.71M | dst += 16; \ |
160 | 1.71M | w -= 16; \ |
161 | 1.71M | } \ |
162 | 9.19M | while (w >= 8) { \ |
163 | 2.32M | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ |
164 | 2.32M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
165 | 2.32M | src += 8; \ |
166 | 2.32M | dst += 8; \ |
167 | 2.32M | w -= 8; \ |
168 | 2.32M | } \ |
169 | 10.2M | while (w >= 4) { \ |
170 | 3.36M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ |
171 | 3.36M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
172 | 3.36M | src += 4; \ |
173 | 3.36M | dst += 4; \ |
174 | 3.36M | w -= 4; \ |
175 | 3.36M | } \ |
176 | 6.87M | (void)num_taps; \ |
177 | 6.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 | 1.90M | } else { \ |
202 | 1.90M | const int num_taps = 2; \ |
203 | 2.66M | while (w >= 16) { \ |
204 | 756k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ |
205 | 756k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
206 | 756k | src += 16; \ |
207 | 756k | dst += 16; \ |
208 | 756k | w -= 16; \ |
209 | 756k | } \ |
210 | 2.39M | while (w >= 8) { \ |
211 | 488k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ |
212 | 488k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
213 | 488k | src += 8; \ |
214 | 488k | dst += 8; \ |
215 | 488k | w -= 8; \ |
216 | 488k | } \ |
217 | 2.72M | while (w >= 4) { \ |
218 | 820k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ |
219 | 820k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
220 | 820k | src += 4; \ |
221 | 820k | dst += 4; \ |
222 | 820k | w -= 4; \ |
223 | 820k | } \ |
224 | 1.90M | (void)num_taps; \ |
225 | 1.90M | } \ |
226 | 8.77M | } \ |
227 | 8.95M | if (w) { \ |
228 | 179k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ |
229 | 179k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ |
230 | 179k | y_step_q4, w, h, bd); \ |
231 | 179k | } \ |
232 | 8.95M | } Unexecuted instantiation: vpx_highbd_convolve8_horiz_sse2 Unexecuted instantiation: vpx_highbd_convolve8_vert_sse2 Unexecuted instantiation: vpx_highbd_convolve8_avg_horiz_sse2 Unexecuted instantiation: vpx_highbd_convolve8_avg_vert_sse2 vpx_highbd_convolve8_horiz_avx2 Line | Count | Source | 150 | 3.98M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 3.98M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 3.98M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 3.98M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 3.10M | const int num_taps = 8; \ | 155 | 3.86M | while (w >= 16) { \ | 156 | 763k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 763k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 763k | src += 16; \ | 159 | 763k | dst += 16; \ | 160 | 763k | w -= 16; \ | 161 | 763k | } \ | 162 | 4.13M | while (w >= 8) { \ | 163 | 1.02M | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 1.02M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 1.02M | src += 8; \ | 166 | 1.02M | dst += 8; \ | 167 | 1.02M | w -= 8; \ | 168 | 1.02M | } \ | 169 | 4.64M | while (w >= 4) { \ | 170 | 1.54M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 1.54M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 1.54M | src += 4; \ | 173 | 1.54M | dst += 4; \ | 174 | 1.54M | w -= 4; \ | 175 | 1.54M | } \ | 176 | 3.10M | (void)num_taps; \ | 177 | 3.10M | } 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 | 878k | } else { \ | 202 | 878k | const int num_taps = 2; \ | 203 | 1.22M | while (w >= 16) { \ | 204 | 344k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 344k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 344k | src += 16; \ | 207 | 344k | dst += 16; \ | 208 | 344k | w -= 16; \ | 209 | 344k | } \ | 210 | 1.10M | while (w >= 8) { \ | 211 | 225k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 225k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 225k | src += 8; \ | 214 | 225k | dst += 8; \ | 215 | 225k | w -= 8; \ | 216 | 225k | } \ | 217 | 1.25M | while (w >= 4) { \ | 218 | 381k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 381k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 381k | src += 4; \ | 221 | 381k | dst += 4; \ | 222 | 381k | w -= 4; \ | 223 | 381k | } \ | 224 | 878k | (void)num_taps; \ | 225 | 878k | } \ | 226 | 3.98M | } \ | 227 | 3.98M | if (w) { \ | 228 | 7.96k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 7.96k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 7.96k | y_step_q4, w, h, bd); \ | 231 | 7.96k | } \ | 232 | 3.98M | } |
vpx_highbd_convolve8_vert_avx2 Line | Count | Source | 150 | 3.33M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 3.33M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 3.33M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 3.22M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 2.56M | const int num_taps = 8; \ | 155 | 3.20M | while (w >= 16) { \ | 156 | 643k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 643k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 643k | src += 16; \ | 159 | 643k | dst += 16; \ | 160 | 643k | w -= 16; \ | 161 | 643k | } \ | 162 | 3.44M | while (w >= 8) { \ | 163 | 881k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 881k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 881k | src += 8; \ | 166 | 881k | dst += 8; \ | 167 | 881k | w -= 8; \ | 168 | 881k | } \ | 169 | 3.80M | while (w >= 4) { \ | 170 | 1.23M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 1.23M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 1.23M | src += 4; \ | 173 | 1.23M | dst += 4; \ | 174 | 1.23M | w -= 4; \ | 175 | 1.23M | } \ | 176 | 2.56M | (void)num_taps; \ | 177 | 2.56M | } 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 | 657k | } else { \ | 202 | 657k | const int num_taps = 2; \ | 203 | 906k | while (w >= 16) { \ | 204 | 249k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 249k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 249k | src += 16; \ | 207 | 249k | dst += 16; \ | 208 | 249k | w -= 16; \ | 209 | 249k | } \ | 210 | 823k | while (w >= 8) { \ | 211 | 166k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 166k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 166k | src += 8; \ | 214 | 166k | dst += 8; \ | 215 | 166k | w -= 8; \ | 216 | 166k | } \ | 217 | 951k | while (w >= 4) { \ | 218 | 294k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 294k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 294k | src += 4; \ | 221 | 294k | dst += 4; \ | 222 | 294k | w -= 4; \ | 223 | 294k | } \ | 224 | 657k | (void)num_taps; \ | 225 | 657k | } \ | 226 | 3.22M | } \ | 227 | 3.33M | if (w) { \ | 228 | 113k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 113k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 113k | y_step_q4, w, h, bd); \ | 231 | 113k | } \ | 232 | 3.33M | } |
vpx_highbd_convolve8_avg_horiz_avx2 Line | Count | Source | 150 | 209k | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 209k | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 209k | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 203k | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 156k | const int num_taps = 8; \ | 155 | 201k | while (w >= 16) { \ | 156 | 44.8k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 44.8k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 44.8k | src += 16; \ | 159 | 44.8k | dst += 16; \ | 160 | 44.8k | w -= 16; \ | 161 | 44.8k | } \ | 162 | 209k | while (w >= 8) { \ | 163 | 53.4k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 53.4k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 53.4k | src += 8; \ | 166 | 53.4k | dst += 8; \ | 167 | 53.4k | w -= 8; \ | 168 | 53.4k | } \ | 169 | 229k | while (w >= 4) { \ | 170 | 73.0k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 73.0k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 73.0k | src += 4; \ | 173 | 73.0k | dst += 4; \ | 174 | 73.0k | w -= 4; \ | 175 | 73.0k | } \ | 176 | 156k | (void)num_taps; \ | 177 | 156k | } 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 | 47.2k | } else { \ | 202 | 47.2k | const int num_taps = 2; \ | 203 | 71.0k | while (w >= 16) { \ | 204 | 23.7k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 23.7k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 23.7k | src += 16; \ | 207 | 23.7k | dst += 16; \ | 208 | 23.7k | w -= 16; \ | 209 | 23.7k | } \ | 210 | 58.5k | while (w >= 8) { \ | 211 | 11.3k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 11.3k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 11.3k | src += 8; \ | 214 | 11.3k | dst += 8; \ | 215 | 11.3k | w -= 8; \ | 216 | 11.3k | } \ | 217 | 65.9k | while (w >= 4) { \ | 218 | 18.6k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 18.6k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 18.6k | src += 4; \ | 221 | 18.6k | dst += 4; \ | 222 | 18.6k | w -= 4; \ | 223 | 18.6k | } \ | 224 | 47.2k | (void)num_taps; \ | 225 | 47.2k | } \ | 226 | 203k | } \ | 227 | 209k | if (w) { \ | 228 | 6.46k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 6.46k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 6.46k | y_step_q4, w, h, bd); \ | 231 | 6.46k | } \ | 232 | 209k | } |
vpx_highbd_convolve8_avg_vert_avx2 Line | Count | Source | 150 | 1.42M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 1.42M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 1.42M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 1.37M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 1.04M | const int num_taps = 8; \ | 155 | 1.31M | while (w >= 16) { \ | 156 | 262k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 262k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 262k | src += 16; \ | 159 | 262k | dst += 16; \ | 160 | 262k | w -= 16; \ | 161 | 262k | } \ | 162 | 1.41M | while (w >= 8) { \ | 163 | 362k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 362k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 362k | src += 8; \ | 166 | 362k | dst += 8; \ | 167 | 362k | w -= 8; \ | 168 | 362k | } \ | 169 | 1.55M | while (w >= 4) { \ | 170 | 505k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 505k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 505k | src += 4; \ | 173 | 505k | dst += 4; \ | 174 | 505k | w -= 4; \ | 175 | 505k | } \ | 176 | 1.04M | (void)num_taps; \ | 177 | 1.04M | } 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 | 321k | } else { \ | 202 | 321k | const int num_taps = 2; \ | 203 | 460k | while (w >= 16) { \ | 204 | 139k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 139k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 139k | src += 16; \ | 207 | 139k | dst += 16; \ | 208 | 139k | w -= 16; \ | 209 | 139k | } \ | 210 | 406k | while (w >= 8) { \ | 211 | 85.3k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 85.3k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 85.3k | src += 8; \ | 214 | 85.3k | dst += 8; \ | 215 | 85.3k | w -= 8; \ | 216 | 85.3k | } \ | 217 | 448k | while (w >= 4) { \ | 218 | 126k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 126k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 126k | src += 4; \ | 221 | 126k | dst += 4; \ | 222 | 126k | w -= 4; \ | 223 | 126k | } \ | 224 | 321k | (void)num_taps; \ | 225 | 321k | } \ | 226 | 1.37M | } \ | 227 | 1.42M | if (w) { \ | 228 | 50.6k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 50.6k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 50.6k | y_step_q4, w, h, bd); \ | 231 | 50.6k | } \ | 232 | 1.42M | } |
|
233 | | |
234 | | #define HIGH_FUN_CONV_2D(avg, opt, is_avg) \ |
235 | | void vpx_highbd_convolve8_##avg##opt( \ |
236 | | const uint16_t *src, ptrdiff_t src_stride, uint16_t *dst, \ |
237 | | ptrdiff_t dst_stride, const InterpKernel *filter, int x0_q4, \ |
238 | 3.51M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ |
239 | 3.51M | const int16_t *filter_x = filter[x0_q4]; \ |
240 | 3.51M | assert(w <= 64); \ |
241 | 3.51M | assert(h <= 64); \ |
242 | 3.51M | if (x_step_q4 == 16 && y_step_q4 == 16) { \ |
243 | 3.42M | if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) || \ |
244 | 3.42M | filter_x[3] == 128) { \ |
245 | 2.65M | DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
246 | 2.65M | vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, \ |
247 | 2.65M | fdata2, 64, filter, x0_q4, x_step_q4, \ |
248 | 2.65M | y0_q4, y_step_q4, w, h + 7, bd); \ |
249 | 2.65M | vpx_highbd_convolve8_##avg##vert_##opt( \ |
250 | 2.65M | fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4, \ |
251 | 2.65M | y0_q4, y_step_q4, w, h, bd); \ |
252 | 2.65M | } 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 | 767k | } else { \ |
263 | 767k | DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED); \ |
264 | 767k | vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, \ |
265 | 767k | x0_q4, x_step_q4, y0_q4, y_step_q4, \ |
266 | 767k | w, h + 1, bd); \ |
267 | 767k | vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, \ |
268 | 767k | filter, x0_q4, x_step_q4, \ |
269 | 767k | y0_q4, y_step_q4, w, h, bd); \ |
270 | 767k | } \ |
271 | 3.42M | } else { \ |
272 | 92.2k | vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter, \ |
273 | 92.2k | x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, \ |
274 | 92.2k | bd); \ |
275 | 92.2k | } \ |
276 | 3.51M | } |
277 | | |
278 | | #endif // CONFIG_VP9_HIGHBITDEPTH |
279 | | #endif // VPX_VPX_DSP_X86_CONVOLVE_H_ |