32 #define fpel_func(avg, sz, opt) \
33 void ff_##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);
48 #define mc_func(avg, sz, dir, opt) \
49 void ff_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
50 const uint8_t *src, ptrdiff_t src_stride, \
51 int h, const int8_t (*filter)[16])
52 #define mc_funcs(sz) \
53 mc_func(put, sz, h, ssse3); \
54 mc_func(avg, sz, h, ssse3); \
55 mc_func(put, sz, v, ssse3); \
56 mc_func(avg, sz, v, ssse3)
67 #define mc_rep_func(avg, sz, hsz, dir, opt) \
68 static av_always_inline void \
69 ff_##avg##_8tap_1d_##dir##_##sz##_##opt(uint8_t *dst, ptrdiff_t dst_stride, \
70 const uint8_t *src, ptrdiff_t src_stride, \
71 int h, const int8_t (*filter)[16]) \
73 ff_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst, dst_stride, src, \
74 src_stride, h, filter); \
75 ff_##avg##_8tap_1d_##dir##_##hsz##_##opt(dst + hsz, dst_stride, src + hsz, \
76 src_stride, h, filter); \
79 #define mc_rep_funcs(sz, hsz) \
80 mc_rep_func(put, sz, hsz, h, ssse3); \
81 mc_rep_func(avg, sz, hsz, h, ssse3); \
82 mc_rep_func(put, sz, hsz, v, ssse3); \
83 mc_rep_func(avg, sz, hsz, v, ssse3)
94 extern const int8_t ff_filters_ssse3[3][15][4][16];
96 #define filter_8tap_2d_fn(op, sz, f, fname) \
97 static void op##_8tap_##fname##_##sz##hv_ssse3(uint8_t *dst, ptrdiff_t dst_stride, \
98 const uint8_t *src, ptrdiff_t src_stride, \
99 int h, int mx, int my) \
101 LOCAL_ALIGNED_16(uint8_t, temp, [71 * 64]); \
102 ff_put_8tap_1d_h_##sz##_ssse3(temp, 64, src - 3 * src_stride, src_stride, \
103 h + 7, ff_filters_ssse3[f][mx - 1]); \
104 ff_##op##_8tap_1d_v_##sz##_ssse3(dst, dst_stride, temp + 3 * 64, 64, \
105 h, ff_filters_ssse3[f][my - 1]); \
108 #define filters_8tap_2d_fn(op, sz) \
109 filter_8tap_2d_fn(op, sz, FILTER_8TAP_REGULAR, regular) \
110 filter_8tap_2d_fn(op, sz, FILTER_8TAP_SHARP, sharp) \
111 filter_8tap_2d_fn(op, sz, FILTER_8TAP_SMOOTH, smooth)
113 #define filters_8tap_2d_fn2(op) \
114 filters_8tap_2d_fn(op, 64) \
115 filters_8tap_2d_fn(op, 32) \
116 filters_8tap_2d_fn(op, 16) \
117 filters_8tap_2d_fn(op, 8) \
118 filters_8tap_2d_fn(op, 4)
120 filters_8tap_2d_fn2(put)
121 filters_8tap_2d_fn2(avg)
123 #undef filters_8tap_2d_fn2
124 #undef filters_8tap_2d_fn
125 #undef filter_8tap_2d_fn
127 #define filter_8tap_1d_fn(op, sz, f, fname, dir, dvar) \
128 static void op##_8tap_##fname##_##sz##dir##_ssse3(uint8_t *dst, ptrdiff_t dst_stride, \
129 const uint8_t *src, ptrdiff_t src_stride, \
130 int h, int mx, int my) \
132 ff_##op##_8tap_1d_##dir##_##sz##_ssse3(dst, dst_stride, src, src_stride, \
133 h, ff_filters_ssse3[f][dvar - 1]); \
136 #define filters_8tap_1d_fn(op, sz, dir, dvar) \
137 filter_8tap_1d_fn(op, sz, FILTER_8TAP_REGULAR, regular, dir, dvar) \
138 filter_8tap_1d_fn(op, sz, FILTER_8TAP_SHARP, sharp, dir, dvar) \
139 filter_8tap_1d_fn(op, sz, FILTER_8TAP_SMOOTH, smooth, dir, dvar)
141 #define filters_8tap_1d_fn2(op, sz) \
142 filters_8tap_1d_fn(op, sz, h, mx) \
143 filters_8tap_1d_fn(op, sz, v, my)
145 #define filters_8tap_1d_fn3(op) \
146 filters_8tap_1d_fn2(op, 64) \
147 filters_8tap_1d_fn2(op, 32) \
148 filters_8tap_1d_fn2(op, 16) \
149 filters_8tap_1d_fn2(op, 8) \
150 filters_8tap_1d_fn2(op, 4)
152 filters_8tap_1d_fn3(put)
153 filters_8tap_1d_fn3(avg)
155 #undef filters_8tap_1d_fn
156 #undef filters_8tap_1d_fn2
157 #undef filters_8tap_1d_fn3
158 #undef filter_8tap_1d_fn
160 #define itxfm_func(typea, typeb, size, opt) \
161 void ff_vp9_##typea##_##typeb##_##size##x##size##_add_##opt(uint8_t *dst, ptrdiff_t stride, \
162 int16_t *block, int eob)
163 #define itxfm_funcs(size, opt) \
164 itxfm_func(idct, idct, size, opt); \
165 itxfm_func(iadst, idct, size, opt); \
166 itxfm_func(idct, iadst, size, opt); \
167 itxfm_func(iadst, iadst, size, opt)
169 itxfm_funcs(4, ssse3);
170 itxfm_funcs(8, ssse3);
172 itxfm_funcs(16, ssse3);
173 itxfm_funcs(16, avx);
176 itxfm_func(iwht, iwht, 4, mmx);
181 #define lpf_funcs(size1, size2, opt) \
182 void ff_vp9_loop_filter_v_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \
183 int E, int I, int H); \
184 void ff_vp9_loop_filter_h_##size1##_##size2##_##opt(uint8_t *dst, ptrdiff_t stride, \
187 lpf_funcs(16, 16, sse2);
188 lpf_funcs(16, 16, ssse3);
189 lpf_funcs(16, 16, avx);
190 lpf_funcs(44, 16, sse2);
191 lpf_funcs(44, 16, ssse3);
192 lpf_funcs(44, 16, avx);
193 lpf_funcs(84, 16, sse2);
194 lpf_funcs(84, 16, ssse3);
195 lpf_funcs(84, 16, avx);
196 lpf_funcs(48, 16, sse2);
197 lpf_funcs(48, 16, ssse3);
198 lpf_funcs(48, 16, avx);
199 lpf_funcs(88, 16, sse2);
200 lpf_funcs(88, 16, ssse3);
201 lpf_funcs(88, 16, avx);
205 #define ipred_func(size, type, opt) \
206 void ff_vp9_ipred_##type##_##size##x##size##_##opt(uint8_t *dst, ptrdiff_t stride, \
207 const uint8_t *l, const uint8_t *a)
209 #define ipred_funcs(type, opt) \
210 ipred_func(4, type, opt); \
211 ipred_func(8, type, opt); \
212 ipred_func(16, type, opt); \
213 ipred_func(32, type, opt)
215 ipred_funcs(
dc, ssse3);
216 ipred_funcs(dc_left, ssse3);
217 ipred_funcs(dc_top, ssse3);
221 ipred_func(8,
v, mmx);
222 ipred_func(16,
v, sse2);
223 ipred_func(32,
v, sse2);
225 #define ipred_func_set(size, type, opt1, opt2) \
226 ipred_func(size, type, opt1); \
227 ipred_func(size, type, opt2)
229 #define ipred_funcs(type, opt1, opt2) \
230 ipred_func(4, type, opt1); \
231 ipred_func_set(8, type, opt1, opt2); \
232 ipred_func_set(16, type, opt1, opt2); \
233 ipred_func_set(32, type, opt1, opt2)
235 ipred_funcs(h, ssse3, avx);
236 ipred_funcs(tm, ssse3, avx);
237 ipred_funcs(dl, ssse3, avx);
238 ipred_funcs(dr, ssse3, avx);
239 ipred_funcs(hu, ssse3, avx);
240 ipred_funcs(hd, ssse3, avx);
241 ipred_funcs(vl, ssse3, avx);
242 ipred_funcs(vr, ssse3, avx);
245 #undef ipred_func_set
255 #define init_fpel(idx1, idx2, sz, type, opt) \
256 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \
257 dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \
258 dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \
259 dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_##type##sz##_##opt
261 #define init_subpel1(idx1, idx2, idxh, idxv, sz, dir, type, opt) \
262 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][idxh][idxv] = type##_8tap_smooth_##sz##dir##_##opt; \
263 dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][idxh][idxv] = type##_8tap_regular_##sz##dir##_##opt; \
264 dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][idxh][idxv] = type##_8tap_sharp_##sz##dir##_##opt
266 #define init_subpel2(idx, idxh, idxv, dir, type, opt) \
267 init_subpel1(0, idx, idxh, idxv, 64, dir, type, opt); \
268 init_subpel1(1, idx, idxh, idxv, 32, dir, type, opt); \
269 init_subpel1(2, idx, idxh, idxv, 16, dir, type, opt); \
270 init_subpel1(3, idx, idxh, idxv, 8, dir, type, opt); \
271 init_subpel1(4, idx, idxh, idxv, 4, dir, type, opt)
273 #define init_subpel3(idx, type, opt) \
274 init_subpel2(idx, 1, 1, hv, type, opt); \
275 init_subpel2(idx, 0, 1, v, type, opt); \
276 init_subpel2(idx, 1, 0, h, type, opt)
278 #define init_lpf(opt) do { \
280 dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_##opt; \
281 dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_##opt; \
282 dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_##opt; \
283 dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_##opt; \
284 dsp->loop_filter_mix2[0][1][0] = ff_vp9_loop_filter_h_48_16_##opt; \
285 dsp->loop_filter_mix2[0][1][1] = ff_vp9_loop_filter_v_48_16_##opt; \
286 dsp->loop_filter_mix2[1][0][0] = ff_vp9_loop_filter_h_84_16_##opt; \
287 dsp->loop_filter_mix2[1][0][1] = ff_vp9_loop_filter_v_84_16_##opt; \
288 dsp->loop_filter_mix2[1][1][0] = ff_vp9_loop_filter_h_88_16_##opt; \
289 dsp->loop_filter_mix2[1][1][1] = ff_vp9_loop_filter_v_88_16_##opt; \
293 #define init_ipred(tx, sz, opt) do { \
294 dsp->intra_pred[tx][HOR_PRED] = ff_vp9_ipred_h_##sz##x##sz##_##opt; \
295 dsp->intra_pred[tx][DIAG_DOWN_LEFT_PRED] = ff_vp9_ipred_dl_##sz##x##sz##_##opt; \
296 dsp->intra_pred[tx][DIAG_DOWN_RIGHT_PRED] = ff_vp9_ipred_dr_##sz##x##sz##_##opt; \
297 dsp->intra_pred[tx][HOR_DOWN_PRED] = ff_vp9_ipred_hd_##sz##x##sz##_##opt; \
298 dsp->intra_pred[tx][VERT_LEFT_PRED] = ff_vp9_ipred_vl_##sz##x##sz##_##opt; \
299 dsp->intra_pred[tx][HOR_UP_PRED] = ff_vp9_ipred_hu_##sz##x##sz##_##opt; \
300 if (ARCH_X86_64 || tx != TX_32X32) { \
301 dsp->intra_pred[tx][VERT_RIGHT_PRED] = ff_vp9_ipred_vr_##sz##x##sz##_##opt; \
302 dsp->intra_pred[tx][TM_VP8_PRED] = ff_vp9_ipred_tm_##sz##x##sz##_##opt; \
305 #define init_dc_ipred(tx, sz, opt) do { \
306 init_ipred(tx, sz, opt); \
307 dsp->intra_pred[tx][DC_PRED] = ff_vp9_ipred_dc_##sz##x##sz##_##opt; \
308 dsp->intra_pred[tx][LEFT_DC_PRED] = ff_vp9_ipred_dc_left_##sz##x##sz##_##opt; \
309 dsp->intra_pred[tx][TOP_DC_PRED] = ff_vp9_ipred_dc_top_##sz##x##sz##_##opt; \
364 init_dc_ipred(
TX_4X4, 4, ssse3);
365 init_dc_ipred(
TX_8X8, 8, ssse3);
386 init_ipred(
TX_8X8, 8, avx);