32 #define fpel_func(avg, sz, opt) \
33 void ff_vp9_##avg##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
34 const uint8_t *src, ptrdiff_t src_stride, \
35 int h, int mx, int my)
36 fpel_func(put, 4, mmx);
37 fpel_func(put, 8, mmx);
38 fpel_func(put, 16,
sse);
39 fpel_func(put, 32,
sse);
40 fpel_func(put, 64,
sse);
41 fpel_func(avg, 4, mmxext);
42 fpel_func(avg, 8, mmxext);
43 fpel_func(avg, 16, sse2);
44 fpel_func(avg, 32, sse2);
45 fpel_func(avg, 64, sse2);
46 fpel_func(put, 32, avx);
47 fpel_func(put, 64, avx);
48 fpel_func(avg, 32, avx2);
49 fpel_func(avg, 64, avx2);
52 #define mc_func(avg, sz, dir, opt, type, f_sz) \
53 void ff_vp9_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
54 const uint8_t *src, ptrdiff_t src_stride, \
55 int h, const type (*filter)[f_sz])
56 #define mc_funcs(sz, opt, type, fsz) \
57 mc_func(put, sz, h, opt, type, fsz); \
58 mc_func(avg, sz, h, opt, type, fsz); \
59 mc_func(put, sz, v, opt, type, fsz); \
60 mc_func(avg, sz, v, opt, type, fsz)
62 mc_funcs(4, mmxext, int16_t, 8);
63 mc_funcs(8, sse2, int16_t, 8);
64 mc_funcs(4, ssse3, int8_t, 32);
65 mc_funcs(8, ssse3, int8_t, 32);
67 mc_funcs(16, ssse3, int8_t, 32);
68 mc_funcs(32, avx2, int8_t, 32);
74 #define mc_rep_func(avg, sz, hsz, dir, opt, type, f_sz) \
75 static av_always_inline void \
76 ff_vp9_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
77 const uint8_t *src, ptrdiff_t src_stride, \
78 int h, const type (*filter)[f_sz]) \
80 ff_vp9_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst, dst_stride, src, \
81 src_stride, h, filter); \
82 ff_vp9_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst + hsz, dst_stride, src + hsz, \
83 src_stride, h, filter); \
86 #define mc_rep_funcs(sz, hsz, opt, type, fsz) \
87 mc_rep_func(put, sz, hsz, h, opt, type, fsz); \
88 mc_rep_func(avg, sz, hsz, h, opt, type, fsz); \
89 mc_rep_func(put, sz, hsz, v, opt, type, fsz); \
90 mc_rep_func(avg, sz, hsz, v, opt, type, fsz)
100 #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
107 extern const int8_t ff_filters_ssse3[3][15][4][32];
108 extern const int16_t ff_filters_sse2[3][15][8][8];
110 #define filter_8tap_2d_fn(op, sz, f, f_opt, fname, align, opt) \
111 static void op##_8tap_##fname##_##sz##hv_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
112 const uint8_t *src, ptrdiff_t src_stride, \
113 int h, int mx, int my) \
115 LOCAL_ALIGNED_##align(uint8_t, temp, [71 * 64]); \
116 ff_vp9_put_8tap_1d_h_##sz##_##opt(temp, 64, src - 3 * src_stride, src_stride, \
117 h + 7, ff_filters_##f_opt[f][mx - 1]); \
118 ff_vp9_##op##_8tap_1d_v_##sz##_##opt(dst, dst_stride, temp + 3 * 64, 64, \
119 h, ff_filters_##f_opt[f][my - 1]); \
122 #define filters_8tap_2d_fn(op, sz, align, opt, f_opt) \
123 filter_8tap_2d_fn(op, sz, FILTER_8TAP_REGULAR, f_opt, regular, align, opt) \
124 filter_8tap_2d_fn(op, sz, FILTER_8TAP_SHARP, f_opt, sharp, align, opt) \
125 filter_8tap_2d_fn(op, sz, FILTER_8TAP_SMOOTH, f_opt, smooth, align, opt)
127 #define filters_8tap_2d_fn2(op, align, opt4, opt8, f_opt) \
128 filters_8tap_2d_fn(op, 64, align, opt8, f_opt) \
129 filters_8tap_2d_fn(op, 32, align, opt8, f_opt) \
130 filters_8tap_2d_fn(op, 16, align, opt8, f_opt) \
131 filters_8tap_2d_fn(op, 8, align, opt8, f_opt) \
132 filters_8tap_2d_fn(op, 4, align, opt4, f_opt)
134 filters_8tap_2d_fn2(put, 16, mmxext, sse2, sse2)
135 filters_8tap_2d_fn2(avg, 16, mmxext, sse2, sse2)
136 filters_8tap_2d_fn2(put, 16, ssse3, ssse3, ssse3)
137 filters_8tap_2d_fn2(avg, 16, ssse3, ssse3, ssse3)
138 #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
139 filters_8tap_2d_fn(put, 64, 32, avx2, ssse3)
140 filters_8tap_2d_fn(put, 32, 32, avx2, ssse3)
141 filters_8tap_2d_fn(avg, 64, 32, avx2, ssse3)
142 filters_8tap_2d_fn(avg, 32, 32, avx2, ssse3)
145 #undef filters_8tap_2d_fn2
146 #undef filters_8tap_2d_fn
147 #undef filter_8tap_2d_fn
149 #define filter_8tap_1d_fn(op, sz, f, f_opt, fname, dir, dvar, opt) \
150 static void op##_8tap_##fname##_##sz##dir##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
151 const uint8_t *src, ptrdiff_t src_stride, \
152 int h, int mx, int my) \
154 ff_vp9_##op##_8tap_1d_##dir##_##sz##_##opt(dst, dst_stride, src, src_stride, \
155 h, ff_filters_##f_opt[f][dvar - 1]); \
158 #define filters_8tap_1d_fn(op, sz, dir, dvar, opt, f_opt) \
159 filter_8tap_1d_fn(op, sz, FILTER_8TAP_REGULAR, f_opt, regular, dir, dvar, opt) \
160 filter_8tap_1d_fn(op, sz, FILTER_8TAP_SHARP, f_opt, sharp, dir, dvar, opt) \
161 filter_8tap_1d_fn(op, sz, FILTER_8TAP_SMOOTH, f_opt, smooth, dir, dvar, opt)
163 #define filters_8tap_1d_fn2(op, sz, opt, f_opt) \
164 filters_8tap_1d_fn(op, sz, h, mx, opt, f_opt) \
165 filters_8tap_1d_fn(op, sz, v, my, opt, f_opt)
167 #define filters_8tap_1d_fn3(op, opt4, opt8, f_opt) \
168 filters_8tap_1d_fn2(op, 64, opt8, f_opt) \
169 filters_8tap_1d_fn2(op, 32, opt8, f_opt) \
170 filters_8tap_1d_fn2(op, 16, opt8, f_opt) \
171 filters_8tap_1d_fn2(op, 8, opt8, f_opt) \
172 filters_8tap_1d_fn2(op, 4, opt4, f_opt)
174 filters_8tap_1d_fn3(put, mmxext, sse2, sse2)
175 filters_8tap_1d_fn3(avg, mmxext, sse2, sse2)
176 filters_8tap_1d_fn3(put, ssse3, ssse3, ssse3)
177 filters_8tap_1d_fn3(avg, ssse3, ssse3, ssse3)
178 #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
179 filters_8tap_1d_fn2(put, 64, avx2, ssse3)
180 filters_8tap_1d_fn2(put, 32, avx2, ssse3)
181 filters_8tap_1d_fn2(avg, 64, avx2, ssse3)
182 filters_8tap_1d_fn2(avg, 32, avx2, ssse3)
185 #undef filters_8tap_1d_fn
186 #undef filters_8tap_1d_fn2
187 #undef filters_8tap_1d_fn3
188 #undef filter_8tap_1d_fn
190 #define itxfm_func(typea, typeb, size, opt) \
191 void ff_vp9_##typea##_##typeb##_##size##x##size##_add_##opt(uint8_t *dst, ptrdiff_t stride, \
192 int16_t *block, int eob)
193 #define itxfm_funcs(size, opt) \
194 itxfm_func(idct, idct, size, opt); \
195 itxfm_func(iadst, idct, size, opt); \
196 itxfm_func(idct, iadst, size, opt); \
197 itxfm_func(iadst, iadst, size, opt)
200 itxfm_func(
idct, iadst, 4, sse2);
201 itxfm_func(iadst,
idct, 4, sse2);
202 itxfm_func(iadst, iadst, 4, sse2);
203 itxfm_funcs(4, ssse3);
204 itxfm_funcs(8, sse2);
205 itxfm_funcs(8, ssse3);
207 itxfm_funcs(16, sse2);
208 itxfm_funcs(16, ssse3);
209 itxfm_funcs(16, avx);
213 itxfm_func(iwht, iwht, 4, mmx);
218 #define lpf_funcs(size1, size2, opt) \
219 void ff_vp9_loop_filter_v_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \
220 int E, int I, int H); \
221 void ff_vp9_loop_filter_h_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \
224 lpf_funcs(16, 16, sse2);
225 lpf_funcs(16, 16, ssse3);
226 lpf_funcs(16, 16, avx);
227 lpf_funcs(44, 16, sse2);
228 lpf_funcs(44, 16, ssse3);
229 lpf_funcs(44, 16, avx);
230 lpf_funcs(84, 16, sse2);
231 lpf_funcs(84, 16, ssse3);
232 lpf_funcs(84, 16, avx);
233 lpf_funcs(48, 16, sse2);
234 lpf_funcs(48, 16, ssse3);
235 lpf_funcs(48, 16, avx);
236 lpf_funcs(88, 16, sse2);
237 lpf_funcs(88, 16, ssse3);
238 lpf_funcs(88, 16, avx);
242 #define ipred_func(size, type, opt) \
243 void ff_vp9_ipred_##type##_##size##x##size##_##opt(uint8_t *dst, ptrdiff_t stride, \
244 const uint8_t *l, const uint8_t *a)
246 ipred_func(8,
v, mmx);
248 #define ipred_dc_funcs(size, opt) \
249 ipred_func(size, dc, opt); \
250 ipred_func(size, dc_left, opt); \
251 ipred_func(size, dc_top, opt)
253 ipred_dc_funcs(4, mmxext);
254 ipred_dc_funcs(8, mmxext);
256 #define ipred_dir_tm_funcs(size, opt) \
257 ipred_func(size, tm, opt); \
258 ipred_func(size, dl, opt); \
259 ipred_func(size, dr, opt); \
260 ipred_func(size, hd, opt); \
261 ipred_func(size, hu, opt); \
262 ipred_func(size, vl, opt); \
263 ipred_func(size, vr, opt)
265 ipred_dir_tm_funcs(4, mmxext);
267 ipred_func(16,
v,
sse);
268 ipred_func(32,
v,
sse);
270 ipred_dc_funcs(16, sse2);
271 ipred_dc_funcs(32, sse2);
273 #define ipred_dir_tm_h_funcs(size, opt) \
274 ipred_dir_tm_funcs(size, opt); \
275 ipred_func(size, h, opt)
277 ipred_dir_tm_h_funcs(8, sse2);
278 ipred_dir_tm_h_funcs(16, sse2);
279 ipred_dir_tm_h_funcs(32, sse2);
281 ipred_func(4, h, sse2);
283 #define ipred_all_funcs(size, opt) \
284 ipred_dc_funcs(size, opt); \
285 ipred_dir_tm_h_funcs(size, opt)
288 ipred_all_funcs(4, ssse3);
289 ipred_all_funcs(8, ssse3);
290 ipred_all_funcs(16, ssse3);
291 ipred_all_funcs(32, ssse3);
293 ipred_dir_tm_h_funcs(8, avx);
294 ipred_dir_tm_h_funcs(16, avx);
295 ipred_dir_tm_h_funcs(32, avx);
297 ipred_func(32,
v, avx);
299 ipred_dc_funcs(32, avx2);
300 ipred_func(32, h, avx2);
301 ipred_func(32, tm, avx2);
304 #undef ipred_dir_tm_h_funcs
305 #undef ipred_dir_tm_funcs
306 #undef ipred_dc_funcs
315 #define init_fpel(idx1, idx2, sz, type, opt) \
316 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \
317 dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \
318 dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \
319 dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_##opt
321 #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \
322 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \
323 dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \
324 dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt
326 #define init_subpel2(idx1, idx2, sz, type, opt) \
327 init_subpel1(idx1, idx2, 1, 1, sz, hv, type, opt); \
328 init_subpel1(idx1, idx2, 0, 1, sz, v, type, opt); \
329 init_subpel1(idx1, idx2, 1, 0, sz, h, type, opt)
331 #define init_subpel3_32_64(idx, type, opt) \
332 init_subpel2(0, idx, 64, type, opt); \
333 init_subpel2(1, idx, 32, type, opt)
335 #define init_subpel3_8to64(idx, type, opt) \
336 init_subpel3_32_64(idx, type, opt); \
337 init_subpel2(2, idx, 16, type, opt); \
338 init_subpel2(3, idx, 8, type, opt)
340 #define init_subpel3(idx, type, opt) \
341 init_subpel3_8to64(idx, type, opt); \
342 init_subpel2(4, idx, 4, type, opt)
344 #define init_lpf(opt) do { \
345 dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \
346 dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \
347 dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \
348 dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \
349 dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \
350 dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \
351 dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \
352 dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \
353 dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \
354 dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \
357 #define init_ipred(sz, opt, t, e) \
358 dsp->intra_pred[TX_##sz##X##sz][e##_PRED] = ff_vp9_ipred_##t##_##sz##x##sz##_##opt
360 #define ff_vp9_ipred_hd_4x4_ssse3 ff_vp9_ipred_hd_4x4_mmxext
361 #define ff_vp9_ipred_vl_4x4_ssse3 ff_vp9_ipred_vl_4x4_mmxext
362 #define init_dir_tm_ipred(sz, opt) do { \
363 init_ipred(sz, opt, dl, DIAG_DOWN_LEFT); \
364 init_ipred(sz, opt, dr, DIAG_DOWN_RIGHT); \
365 init_ipred(sz, opt, hd, HOR_DOWN); \
366 init_ipred(sz, opt, vl, VERT_LEFT); \
367 init_ipred(sz, opt, hu, HOR_UP); \
368 init_ipred(sz, opt, tm, TM_VP8); \
369 init_ipred(sz, opt, vr, VERT_RIGHT); \
371 #define init_dir_tm_h_ipred(sz, opt) do { \
372 init_dir_tm_ipred(sz, opt); \
373 init_ipred(sz, opt, h, HOR); \
375 #define init_dc_ipred(sz, opt) do { \
376 init_ipred(sz, opt, dc, DC); \
377 init_ipred(sz, opt, dc_left, LEFT_DC); \
378 init_ipred(sz, opt, dc_top, TOP_DC); \
380 #define init_all_ipred(sz, opt) do { \
381 init_dc_ipred(sz, opt); \
382 init_dir_tm_h_ipred(sz, opt); \
392 init_ipred(8, mmx,
v, VERT);
401 init_dc_ipred(4, mmxext);
402 init_dc_ipred(8, mmxext);
403 init_dir_tm_ipred(4, mmxext);
410 init_ipred(16,
sse,
v, VERT);
411 init_ipred(32,
sse,
v, VERT);
415 init_subpel3_8to64(0, put, sse2);
416 init_subpel3_8to64(1, avg, sse2);
436 init_dc_ipred(16, sse2);
437 init_dc_ipred(32, sse2);
438 init_dir_tm_h_ipred(8, sse2);
439 init_dir_tm_h_ipred(16, sse2);
440 init_dir_tm_h_ipred(32, sse2);
441 init_ipred(4, sse2, h, HOR);
464 init_all_ipred(4, ssse3);
465 init_all_ipred(8, ssse3);
466 init_all_ipred(16, ssse3);
467 init_all_ipred(32, ssse3);
486 init_dir_tm_h_ipred(8, avx);
487 init_dir_tm_h_ipred(16, avx);
488 init_dir_tm_h_ipred(32, avx);
489 init_ipred(32, avx,
v, VERT);
496 #if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
497 init_subpel3_32_64(0, put, avx2);
498 init_subpel3_32_64(1, avg, avx2);
501 init_dc_ipred(32, avx2);
502 init_ipred(32, avx2, h, HOR);
503 init_ipred(32, avx2, tm, TM_VP8);