/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 | 159M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \ |
34 | 159M | const int16_t *filter_row = filter[offset]; \ |
35 | 159M | (void)x0_q4; \ |
36 | 159M | (void)x_step_q4; \ |
37 | 159M | (void)y0_q4; \ |
38 | 159M | (void)y_step_q4; \ |
39 | 159M | assert(filter_row[3] != 128); \ |
40 | 159M | assert(step_q4 == 16); \ |
41 | 159M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ |
42 | 76.0M | const int num_taps = 8; \ |
43 | 86.6M | while (w >= 16) { \ |
44 | 10.5M | vpx_filter_block1d16_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
45 | 10.5M | dst_stride, h, filter_row); \ |
46 | 10.5M | src += 16; \ |
47 | 10.5M | dst += 16; \ |
48 | 10.5M | w -= 16; \ |
49 | 10.5M | } \ |
50 | 76.0M | if (w == 8) { \ |
51 | 22.2M | vpx_filter_block1d8_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
52 | 22.2M | dst_stride, h, filter_row); \ |
53 | 53.8M | } else if (w == 4) { \ |
54 | 45.3M | vpx_filter_block1d4_##dir##8_##avg##opt(src_start, src_stride, dst, \ |
55 | 45.3M | dst_stride, h, filter_row); \ |
56 | 45.3M | } \ |
57 | 76.0M | (void)num_taps; \ |
58 | 83.1M | } else if (filter_row[2] | filter_row[5]) { \ |
59 | 80.5M | const int num_taps = is_avg ? 8 : 4; \ |
60 | 90.3M | while (w >= 16) { \ |
61 | 9.72M | vpx_filter_block1d16_##dir##4_##avg##opt(src_start, src_stride, dst, \ |
62 | 9.72M | dst_stride, h, filter_row); \ |
63 | 9.72M | src += 16; \ |
64 | 9.72M | dst += 16; \ |
65 | 9.72M | w -= 16; \ |
66 | 9.72M | } \ |
67 | 80.5M | if (w == 8) { \ |
68 | 20.2M | vpx_filter_block1d8_##dir##4_##avg##opt(src_start, src_stride, dst, \ |
69 | 20.2M | dst_stride, h, filter_row); \ |
70 | 60.3M | } else if (w == 4) { \ |
71 | 52.9M | vpx_filter_block1d4_##dir##4_##avg##opt(src_start, src_stride, dst, \ |
72 | 52.9M | dst_stride, h, filter_row); \ |
73 | 52.9M | } \ |
74 | 80.5M | (void)num_taps; \ |
75 | 80.5M | } else { \ |
76 | 2.54M | const int num_taps = 2; \ |
77 | 3.74M | while (w >= 16) { \ |
78 | 1.19M | vpx_filter_block1d16_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
79 | 1.19M | dst_stride, h, filter_row); \ |
80 | 1.19M | src += 16; \ |
81 | 1.19M | dst += 16; \ |
82 | 1.19M | w -= 16; \ |
83 | 1.19M | } \ |
84 | 2.54M | if (w == 8) { \ |
85 | 750k | vpx_filter_block1d8_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
86 | 750k | dst_stride, h, filter_row); \ |
87 | 1.79M | } else if (w == 4) { \ |
88 | 982k | vpx_filter_block1d4_##dir##2_##avg##opt(src_start, src_stride, dst, \ |
89 | 982k | dst_stride, h, filter_row); \ |
90 | 982k | } \ |
91 | 2.54M | (void)num_taps; \ |
92 | 2.54M | } \ |
93 | 159M | } |
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 | 46.3M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h) { \ |
100 | 46.3M | const int16_t *filter_x = filter[x0_q4]; \ |
101 | 46.3M | const int16_t *filter_y = filter[y0_q4]; \ |
102 | 46.3M | (void)filter_y; \ |
103 | 46.3M | assert(filter_x[3] != 128); \ |
104 | 46.3M | assert(filter_y[3] != 128); \ |
105 | 46.3M | assert(w <= 64); \ |
106 | 46.3M | assert(h <= 64); \ |
107 | 46.3M | assert(x_step_q4 == 16); \ |
108 | 46.3M | assert(y_step_q4 == 16); \ |
109 | 46.3M | if (filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) { \ |
110 | 22.7M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
111 | 22.7M | vpx_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, fdata2, 64, \ |
112 | 22.7M | filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, \ |
113 | 22.7M | h + 7); \ |
114 | 22.7M | vpx_convolve8_##avg##vert_##opt(fdata2 + 3 * 64, 64, dst, dst_stride, \ |
115 | 22.7M | filter, x0_q4, x_step_q4, y0_q4, \ |
116 | 22.7M | y_step_q4, w, h); \ |
117 | 23.5M | } else if (filter_x[2] | filter_x[5]) { \ |
118 | 22.5M | const int num_taps = is_avg ? 8 : 4; \ |
119 | 22.5M | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
120 | 22.5M | vpx_convolve8_horiz_##opt( \ |
121 | 22.5M | src - (num_taps / 2 - 1) * src_stride, src_stride, fdata2, 64, \ |
122 | 22.5M | filter, x0_q4, x_step_q4, y0_q4, y_step_q4, w, h + num_taps - 1); \ |
123 | 22.5M | vpx_convolve8_##avg##vert_##opt(fdata2 + 64 * (num_taps / 2 - 1), 64, \ |
124 | 22.5M | dst, dst_stride, filter, x0_q4, \ |
125 | 22.5M | x_step_q4, y0_q4, y_step_q4, w, h); \ |
126 | 22.5M | } else { \ |
127 | 964k | DECLARE_ALIGNED(16, uint8_t, fdata2[64 * 65] VPX_UNINITIALIZED); \ |
128 | 964k | vpx_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, x0_q4, \ |
129 | 964k | x_step_q4, y0_q4, y_step_q4, w, h + 1); \ |
130 | 964k | vpx_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, filter, \ |
131 | 964k | x0_q4, x_step_q4, y0_q4, y_step_q4, w, \ |
132 | 964k | h); \ |
133 | 964k | } \ |
134 | 46.3M | } |
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.78M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ |
151 | 8.78M | const int16_t *filter_row = filter_kernel[offset]; \ |
152 | 8.78M | if (step_q4 == 16 && filter_row[3] != 128) { \ |
153 | 8.62M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ |
154 | 6.34M | const int num_taps = 8; \ |
155 | 7.87M | while (w >= 16) { \ |
156 | 1.52M | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ |
157 | 1.52M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
158 | 1.52M | src += 16; \ |
159 | 1.52M | dst += 16; \ |
160 | 1.52M | w -= 16; \ |
161 | 1.52M | } \ |
162 | 8.51M | while (w >= 8) { \ |
163 | 2.16M | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ |
164 | 2.16M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
165 | 2.16M | src += 8; \ |
166 | 2.16M | dst += 8; \ |
167 | 2.16M | w -= 8; \ |
168 | 2.16M | } \ |
169 | 9.47M | while (w >= 4) { \ |
170 | 3.12M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ |
171 | 3.12M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
172 | 3.12M | src += 4; \ |
173 | 3.12M | dst += 4; \ |
174 | 3.12M | w -= 4; \ |
175 | 3.12M | } \ |
176 | 6.34M | (void)num_taps; \ |
177 | 6.34M | } else if (filter_row[2] | filter_row[5]) { \ |
178 | 0 | const int num_taps = is_avg ? 8 : 4; \ |
179 | 0 | while (w >= 16) { \ |
180 | 0 | vpx_highbd_filter_block1d16_##dir##4_##avg##opt( \ |
181 | 0 | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
182 | 0 | src += 16; \ |
183 | 0 | dst += 16; \ |
184 | 0 | w -= 16; \ |
185 | 0 | } \ |
186 | 0 | while (w >= 8) { \ |
187 | 0 | vpx_highbd_filter_block1d8_##dir##4_##avg##opt( \ |
188 | 0 | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
189 | 0 | src += 8; \ |
190 | 0 | dst += 8; \ |
191 | 0 | w -= 8; \ |
192 | 0 | } \ |
193 | 0 | while (w >= 4) { \ |
194 | 0 | vpx_highbd_filter_block1d4_##dir##4_##avg##opt( \ |
195 | 0 | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
196 | 0 | src += 4; \ |
197 | 0 | dst += 4; \ |
198 | 0 | w -= 4; \ |
199 | 0 | } \ |
200 | 0 | (void)num_taps; \ |
201 | 2.27M | } else { \ |
202 | 2.27M | const int num_taps = 2; \ |
203 | 3.18M | while (w >= 16) { \ |
204 | 907k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ |
205 | 907k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
206 | 907k | src += 16; \ |
207 | 907k | dst += 16; \ |
208 | 907k | w -= 16; \ |
209 | 907k | } \ |
210 | 2.86M | while (w >= 8) { \ |
211 | 585k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ |
212 | 585k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
213 | 585k | src += 8; \ |
214 | 585k | dst += 8; \ |
215 | 585k | w -= 8; \ |
216 | 585k | } \ |
217 | 3.24M | while (w >= 4) { \ |
218 | 969k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ |
219 | 969k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ |
220 | 969k | src += 4; \ |
221 | 969k | dst += 4; \ |
222 | 969k | w -= 4; \ |
223 | 969k | } \ |
224 | 2.27M | (void)num_taps; \ |
225 | 2.27M | } \ |
226 | 8.62M | } \ |
227 | 8.78M | if (w) { \ |
228 | 159k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ |
229 | 159k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ |
230 | 159k | y_step_q4, w, h, bd); \ |
231 | 159k | } \ |
232 | 8.78M | } 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.86M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 3.86M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 3.86M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 3.84M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 2.79M | const int num_taps = 8; \ | 155 | 3.46M | while (w >= 16) { \ | 156 | 660k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 660k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 660k | src += 16; \ | 159 | 660k | dst += 16; \ | 160 | 660k | w -= 16; \ | 161 | 660k | } \ | 162 | 3.72M | while (w >= 8) { \ | 163 | 927k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 927k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 927k | src += 8; \ | 166 | 927k | dst += 8; \ | 167 | 927k | w -= 8; \ | 168 | 927k | } \ | 169 | 4.21M | while (w >= 4) { \ | 170 | 1.41M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 1.41M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 1.41M | src += 4; \ | 173 | 1.41M | dst += 4; \ | 174 | 1.41M | w -= 4; \ | 175 | 1.41M | } \ | 176 | 2.79M | (void)num_taps; \ | 177 | 2.79M | } 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.05M | } else { \ | 202 | 1.05M | const int num_taps = 2; \ | 203 | 1.46M | while (w >= 16) { \ | 204 | 411k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 411k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 411k | src += 16; \ | 207 | 411k | dst += 16; \ | 208 | 411k | w -= 16; \ | 209 | 411k | } \ | 210 | 1.32M | while (w >= 8) { \ | 211 | 270k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 270k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 270k | src += 8; \ | 214 | 270k | dst += 8; \ | 215 | 270k | w -= 8; \ | 216 | 270k | } \ | 217 | 1.50M | while (w >= 4) { \ | 218 | 451k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 451k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 451k | src += 4; \ | 221 | 451k | dst += 4; \ | 222 | 451k | w -= 4; \ | 223 | 451k | } \ | 224 | 1.05M | (void)num_taps; \ | 225 | 1.05M | } \ | 226 | 3.84M | } \ | 227 | 3.86M | if (w) { \ | 228 | 12.4k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 12.4k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 12.4k | y_step_q4, w, h, bd); \ | 231 | 12.4k | } \ | 232 | 3.86M | } |
vpx_highbd_convolve8_vert_avx2 Line | Count | Source | 150 | 3.17M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 3.17M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 3.17M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 3.08M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 2.29M | const int num_taps = 8; \ | 155 | 2.84M | while (w >= 16) { \ | 156 | 555k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 555k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 555k | src += 16; \ | 159 | 555k | dst += 16; \ | 160 | 555k | w -= 16; \ | 161 | 555k | } \ | 162 | 3.08M | while (w >= 8) { \ | 163 | 794k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 794k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 794k | src += 8; \ | 166 | 794k | dst += 8; \ | 167 | 794k | w -= 8; \ | 168 | 794k | } \ | 169 | 3.39M | while (w >= 4) { \ | 170 | 1.10M | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 1.10M | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 1.10M | src += 4; \ | 173 | 1.10M | dst += 4; \ | 174 | 1.10M | w -= 4; \ | 175 | 1.10M | } \ | 176 | 2.29M | (void)num_taps; \ | 177 | 2.29M | } else if (filter_row[2] | filter_row[5]) { \ | 178 | 0 | const int num_taps = is_avg ? 8 : 4; \ | 179 | 0 | while (w >= 16) { \ | 180 | 0 | vpx_highbd_filter_block1d16_##dir##4_##avg##opt( \ | 181 | 0 | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 182 | 0 | src += 16; \ | 183 | 0 | dst += 16; \ | 184 | 0 | w -= 16; \ | 185 | 0 | } \ | 186 | 0 | while (w >= 8) { \ | 187 | 0 | vpx_highbd_filter_block1d8_##dir##4_##avg##opt( \ | 188 | 0 | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 189 | 0 | src += 8; \ | 190 | 0 | dst += 8; \ | 191 | 0 | w -= 8; \ | 192 | 0 | } \ | 193 | 0 | while (w >= 4) { \ | 194 | 0 | vpx_highbd_filter_block1d4_##dir##4_##avg##opt( \ | 195 | 0 | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 196 | 0 | src += 4; \ | 197 | 0 | dst += 4; \ | 198 | 0 | w -= 4; \ | 199 | 0 | } \ | 200 | 0 | (void)num_taps; \ | 201 | 793k | } else { \ | 202 | 793k | const int num_taps = 2; \ | 203 | 1.09M | while (w >= 16) { \ | 204 | 306k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 306k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 306k | src += 16; \ | 207 | 306k | dst += 16; \ | 208 | 306k | w -= 16; \ | 209 | 306k | } \ | 210 | 994k | while (w >= 8) { \ | 211 | 201k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 201k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 201k | src += 8; \ | 214 | 201k | dst += 8; \ | 215 | 201k | w -= 8; \ | 216 | 201k | } \ | 217 | 1.14M | while (w >= 4) { \ | 218 | 347k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 347k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 347k | src += 4; \ | 221 | 347k | dst += 4; \ | 222 | 347k | w -= 4; \ | 223 | 347k | } \ | 224 | 793k | (void)num_taps; \ | 225 | 793k | } \ | 226 | 3.08M | } \ | 227 | 3.17M | if (w) { \ | 228 | 92.3k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 92.3k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 92.3k | y_step_q4, w, h, bd); \ | 231 | 92.3k | } \ | 232 | 3.17M | } |
vpx_highbd_convolve8_avg_horiz_avx2 Line | Count | Source | 150 | 230k | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 230k | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 230k | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 219k | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 163k | const int num_taps = 8; \ | 155 | 208k | while (w >= 16) { \ | 156 | 44.5k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 44.5k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 44.5k | src += 16; \ | 159 | 44.5k | dst += 16; \ | 160 | 44.5k | w -= 16; \ | 161 | 44.5k | } \ | 162 | 220k | while (w >= 8) { \ | 163 | 57.1k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 57.1k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 57.1k | src += 8; \ | 166 | 57.1k | dst += 8; \ | 167 | 57.1k | w -= 8; \ | 168 | 57.1k | } \ | 169 | 240k | while (w >= 4) { \ | 170 | 77.1k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 77.1k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 77.1k | src += 4; \ | 173 | 77.1k | dst += 4; \ | 174 | 77.1k | w -= 4; \ | 175 | 77.1k | } \ | 176 | 163k | (void)num_taps; \ | 177 | 163k | } 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 | 56.0k | } else { \ | 202 | 56.0k | const int num_taps = 2; \ | 203 | 84.8k | while (w >= 16) { \ | 204 | 28.7k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 28.7k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 28.7k | src += 16; \ | 207 | 28.7k | dst += 16; \ | 208 | 28.7k | w -= 16; \ | 209 | 28.7k | } \ | 210 | 69.8k | while (w >= 8) { \ | 211 | 13.7k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 13.7k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 13.7k | src += 8; \ | 214 | 13.7k | dst += 8; \ | 215 | 13.7k | w -= 8; \ | 216 | 13.7k | } \ | 217 | 77.0k | while (w >= 4) { \ | 218 | 21.0k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 21.0k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 21.0k | src += 4; \ | 221 | 21.0k | dst += 4; \ | 222 | 21.0k | w -= 4; \ | 223 | 21.0k | } \ | 224 | 56.0k | (void)num_taps; \ | 225 | 56.0k | } \ | 226 | 219k | } \ | 227 | 230k | if (w) { \ | 228 | 11.4k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 11.4k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 11.4k | y_step_q4, w, h, bd); \ | 231 | 11.4k | } \ | 232 | 230k | } |
vpx_highbd_convolve8_avg_vert_avx2 Line | Count | Source | 150 | 1.51M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ | 151 | 1.51M | const int16_t *filter_row = filter_kernel[offset]; \ | 152 | 1.51M | if (step_q4 == 16 && filter_row[3] != 128) { \ | 153 | 1.47M | if (filter_row[0] | filter_row[1] | filter_row[6] | filter_row[7]) { \ | 154 | 1.09M | const int num_taps = 8; \ | 155 | 1.35M | while (w >= 16) { \ | 156 | 260k | vpx_highbd_filter_block1d16_##dir##8_##avg##opt( \ | 157 | 260k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 158 | 260k | src += 16; \ | 159 | 260k | dst += 16; \ | 160 | 260k | w -= 16; \ | 161 | 260k | } \ | 162 | 1.48M | while (w >= 8) { \ | 163 | 387k | vpx_highbd_filter_block1d8_##dir##8_##avg##opt( \ | 164 | 387k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 165 | 387k | src += 8; \ | 166 | 387k | dst += 8; \ | 167 | 387k | w -= 8; \ | 168 | 387k | } \ | 169 | 1.62M | while (w >= 4) { \ | 170 | 527k | vpx_highbd_filter_block1d4_##dir##8_##avg##opt( \ | 171 | 527k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 172 | 527k | src += 4; \ | 173 | 527k | dst += 4; \ | 174 | 527k | w -= 4; \ | 175 | 527k | } \ | 176 | 1.09M | (void)num_taps; \ | 177 | 1.09M | } 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 | 376k | } else { \ | 202 | 376k | const int num_taps = 2; \ | 203 | 538k | while (w >= 16) { \ | 204 | 161k | vpx_highbd_filter_block1d16_##dir##2_##avg##opt( \ | 205 | 161k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 206 | 161k | src += 16; \ | 207 | 161k | dst += 16; \ | 208 | 161k | w -= 16; \ | 209 | 161k | } \ | 210 | 476k | while (w >= 8) { \ | 211 | 99.4k | vpx_highbd_filter_block1d8_##dir##2_##avg##opt( \ | 212 | 99.4k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 213 | 99.4k | src += 8; \ | 214 | 99.4k | dst += 8; \ | 215 | 99.4k | w -= 8; \ | 216 | 99.4k | } \ | 217 | 525k | while (w >= 4) { \ | 218 | 149k | vpx_highbd_filter_block1d4_##dir##2_##avg##opt( \ | 219 | 149k | src_start, src_stride, dst, dst_stride, h, filter_row, bd); \ | 220 | 149k | src += 4; \ | 221 | 149k | dst += 4; \ | 222 | 149k | w -= 4; \ | 223 | 149k | } \ | 224 | 376k | (void)num_taps; \ | 225 | 376k | } \ | 226 | 1.47M | } \ | 227 | 1.51M | if (w) { \ | 228 | 43.7k | vpx_highbd_convolve8_##name##_c(src, src_stride, dst, dst_stride, \ | 229 | 43.7k | filter_kernel, x0_q4, x_step_q4, y0_q4, \ | 230 | 43.7k | y_step_q4, w, h, bd); \ | 231 | 43.7k | } \ | 232 | 1.51M | } |
|
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.40M | int x_step_q4, int y0_q4, int y_step_q4, int w, int h, int bd) { \ |
239 | 3.40M | const int16_t *filter_x = filter[x0_q4]; \ |
240 | 3.40M | assert(w <= 64); \ |
241 | 3.40M | assert(h <= 64); \ |
242 | 3.40M | if (x_step_q4 == 16 && y_step_q4 == 16) { \ |
243 | 3.32M | if ((filter_x[0] | filter_x[1] | filter_x[6] | filter_x[7]) || \ |
244 | 3.32M | filter_x[3] == 128) { \ |
245 | 2.40M | DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 71] VPX_UNINITIALIZED); \ |
246 | 2.40M | vpx_highbd_convolve8_horiz_##opt(src - 3 * src_stride, src_stride, \ |
247 | 2.40M | fdata2, 64, filter, x0_q4, x_step_q4, \ |
248 | 2.40M | y0_q4, y_step_q4, w, h + 7, bd); \ |
249 | 2.40M | vpx_highbd_convolve8_##avg##vert_##opt( \ |
250 | 2.40M | fdata2 + 192, 64, dst, dst_stride, filter, x0_q4, x_step_q4, \ |
251 | 2.40M | y0_q4, y_step_q4, w, h, bd); \ |
252 | 2.40M | } 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 | 918k | } else { \ |
263 | 918k | DECLARE_ALIGNED(16, uint16_t, fdata2[64 * 65] VPX_UNINITIALIZED); \ |
264 | 918k | vpx_highbd_convolve8_horiz_##opt(src, src_stride, fdata2, 64, filter, \ |
265 | 918k | x0_q4, x_step_q4, y0_q4, y_step_q4, \ |
266 | 918k | w, h + 1, bd); \ |
267 | 918k | vpx_highbd_convolve8_##avg##vert_##opt(fdata2, 64, dst, dst_stride, \ |
268 | 918k | filter, x0_q4, x_step_q4, \ |
269 | 918k | y0_q4, y_step_q4, w, h, bd); \ |
270 | 918k | } \ |
271 | 3.32M | } else { \ |
272 | 84.7k | vpx_highbd_convolve8_##avg##c(src, src_stride, dst, dst_stride, filter, \ |
273 | 84.7k | x0_q4, x_step_q4, y0_q4, y_step_q4, w, h, \ |
274 | 84.7k | bd); \ |
275 | 84.7k | } \ |
276 | 3.40M | } |
277 | | |
278 | | #endif // CONFIG_VP9_HIGHBITDEPTH |
279 | | #endif // VPX_VPX_DSP_X86_CONVOLVE_H_ |