32 #define LFC_FUNC(DIR, DEPTH, OPT) \
33 void ff_hevc_ ## DIR ## _loop_filter_chroma_ ## DEPTH ## _ ## OPT(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q);
35 #define LFL_FUNC(DIR, DEPTH, OPT) \
36 void ff_hevc_ ## DIR ## _loop_filter_luma_ ## DEPTH ## _ ## OPT(uint8_t *_pix, ptrdiff_t stride, int *_beta, int *_tc, \
37 uint8_t *_no_p, uint8_t *_no_q);
39 #define LFC_FUNCS(type, depth, opt) \
40 LFC_FUNC(h, depth, opt) \
41 LFC_FUNC(v, depth, opt)
43 #define LFL_FUNCS(type, depth, opt) \
44 LFL_FUNC(h, depth, opt) \
45 LFL_FUNC(v, depth, opt)
54 #if HAVE_SSE2_EXTERNAL
55 void ff_hevc_idct32_dc_add_8_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t
stride)
57 ff_hevc_idct16_dc_add_8_sse2(dst, coeffs, stride);
58 ff_hevc_idct16_dc_add_8_sse2(dst+16, coeffs, stride);
59 ff_hevc_idct16_dc_add_8_sse2(dst+16*stride, coeffs, stride);
60 ff_hevc_idct16_dc_add_8_sse2(dst+16*stride+16, coeffs, stride);
63 void ff_hevc_idct16_dc_add_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t
stride)
65 ff_hevc_idct8_dc_add_10_sse2(dst, coeffs, stride);
66 ff_hevc_idct8_dc_add_10_sse2(dst+16, coeffs, stride);
67 ff_hevc_idct8_dc_add_10_sse2(dst+8*stride, coeffs, stride);
68 ff_hevc_idct8_dc_add_10_sse2(dst+8*stride+16, coeffs, stride);
71 void ff_hevc_idct32_dc_add_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t
stride)
73 ff_hevc_idct16_dc_add_10_sse2(dst, coeffs, stride);
74 ff_hevc_idct16_dc_add_10_sse2(dst+32, coeffs, stride);
75 ff_hevc_idct16_dc_add_10_sse2(dst+16*stride, coeffs, stride);
76 ff_hevc_idct16_dc_add_10_sse2(dst+16*stride+32, coeffs, stride);
78 #endif //HAVE_SSE2_EXTERNAL
80 void ff_hevc_idct16_dc_add_10_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t
stride)
82 ff_hevc_idct8_dc_add_10_avx(dst, coeffs, stride);
83 ff_hevc_idct8_dc_add_10_avx(dst+16, coeffs, stride);
84 ff_hevc_idct8_dc_add_10_avx(dst+8*stride, coeffs, stride);
85 ff_hevc_idct8_dc_add_10_avx(dst+8*stride+16, coeffs, stride);
88 void ff_hevc_idct32_dc_add_10_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t
stride)
90 ff_hevc_idct16_dc_add_10_avx(dst, coeffs, stride);
91 ff_hevc_idct16_dc_add_10_avx(dst+32, coeffs, stride);
92 ff_hevc_idct16_dc_add_10_avx(dst+16*stride, coeffs, stride);
93 ff_hevc_idct16_dc_add_10_avx(dst+16*stride+32, coeffs, stride);
95 #endif //HAVE_AVX_EXTERNAL
97 #if HAVE_AVX2_EXTERNAL
99 void ff_hevc_idct32_dc_add_10_avx2(uint8_t *dst, int16_t *coeffs, ptrdiff_t
stride)
101 ff_hevc_idct16_dc_add_10_avx2(dst, coeffs, stride);
102 ff_hevc_idct16_dc_add_10_avx2(dst+32, coeffs, stride);
103 ff_hevc_idct16_dc_add_10_avx2(dst+16*stride, coeffs, stride);
104 ff_hevc_idct16_dc_add_10_avx2(dst+16*stride+32, coeffs, stride);
106 #endif //HAVE_AVX2_EXTERNAL
108 #define mc_rep_func(name, bitd, step, W, opt) \
109 void ff_hevc_put_hevc_##name##W##_##bitd##_##opt(int16_t *_dst, ptrdiff_t dststride, \
110 uint8_t *_src, ptrdiff_t _srcstride, int height, \
111 intptr_t mx, intptr_t my, int width) \
116 for (i = 0; i < W; i += step) { \
117 src = _src + (i * ((bitd + 7) / 8)); \
119 ff_hevc_put_hevc_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, height, mx, my, width); \
122 #define mc_rep_uni_func(name, bitd, step, W, opt) \
123 void ff_hevc_put_hevc_uni_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, \
124 uint8_t *_src, ptrdiff_t _srcstride, int height, \
125 intptr_t mx, intptr_t my, int width) \
130 for (i = 0; i < W; i += step) { \
131 src = _src + (i * ((bitd + 7) / 8)); \
132 dst = _dst + (i * ((bitd + 7) / 8)); \
133 ff_hevc_put_hevc_uni_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, \
134 height, mx, my, width); \
137 #define mc_rep_bi_func(name, bitd, step, W, opt) \
138 void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, uint8_t *_src, \
139 ptrdiff_t _srcstride, int16_t* _src2, ptrdiff_t _src2stride, \
140 int height, intptr_t mx, intptr_t my, int width) \
146 for (i = 0; i < W ; i += step) { \
147 src = _src + (i * ((bitd + 7) / 8)); \
148 dst = _dst + (i * ((bitd + 7) / 8)); \
150 ff_hevc_put_hevc_bi_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, src2, \
151 _src2stride, height, mx, my, width); \
155 #define mc_rep_funcs(name, bitd, step, W, opt) \
156 mc_rep_func(name, bitd, step, W, opt); \
157 mc_rep_uni_func(name, bitd, step, W, opt); \
158 mc_rep_bi_func(name, bitd, step, W, opt)
161 #if ARCH_X86_64 && HAVE_SSE4_EXTERNAL
241 #define mc_rep_uni_w(bitd, step, W, opt) \
242 void ff_hevc_put_hevc_uni_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride,\
243 int height, int denom, int _wx, int _ox) \
248 for (i = 0; i < W; i += step) { \
250 dst= _dst + (i * ((bitd + 7) / 8)); \
251 ff_hevc_put_hevc_uni_w##step##_##bitd##_##opt(dst, dststride, src, _srcstride, \
252 height, denom, _wx, _ox); \
256 mc_rep_uni_w(8, 6, 12, sse4);
257 mc_rep_uni_w(8, 8, 16, sse4);
258 mc_rep_uni_w(8, 8, 24, sse4);
259 mc_rep_uni_w(8, 8, 32, sse4);
260 mc_rep_uni_w(8, 8, 48, sse4);
261 mc_rep_uni_w(8, 8, 64, sse4);
263 mc_rep_uni_w(10, 6, 12, sse4);
264 mc_rep_uni_w(10, 8, 16, sse4);
265 mc_rep_uni_w(10, 8, 24, sse4);
266 mc_rep_uni_w(10, 8, 32, sse4);
267 mc_rep_uni_w(10, 8, 48, sse4);
268 mc_rep_uni_w(10, 8, 64, sse4);
270 #define mc_rep_bi_w(bitd, step, W, opt) \
271 void ff_hevc_put_hevc_bi_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride, \
272 int16_t *_src2, ptrdiff_t _src2stride, int height, \
273 int denom, int _wx0, int _wx1, int _ox0, int _ox1) \
279 for (i = 0; i < W; i += step) { \
282 dst = _dst + (i * ((bitd + 7) / 8)); \
283 ff_hevc_put_hevc_bi_w##step##_##bitd##_##opt(dst, dststride, src, _srcstride, src2, _src2stride, \
284 height, denom, _wx0, _wx1, _ox0, _ox1); \
288 mc_rep_bi_w(8, 6, 12, sse4);
289 mc_rep_bi_w(8, 8, 16, sse4);
290 mc_rep_bi_w(8, 8, 24, sse4);
291 mc_rep_bi_w(8, 8, 32, sse4);
292 mc_rep_bi_w(8, 8, 48, sse4);
293 mc_rep_bi_w(8, 8, 64, sse4);
295 mc_rep_bi_w(10, 6, 12, sse4);
296 mc_rep_bi_w(10, 8, 16, sse4);
297 mc_rep_bi_w(10, 8, 24, sse4);
298 mc_rep_bi_w(10, 8, 32, sse4);
299 mc_rep_bi_w(10, 8, 48, sse4);
300 mc_rep_bi_w(10, 8, 64, sse4);
302 #define mc_uni_w_func(name, bitd, W, opt) \
303 void ff_hevc_put_hevc_uni_w_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t _dststride, \
304 uint8_t *_src, ptrdiff_t _srcstride, \
305 int height, int denom, \
307 intptr_t mx, intptr_t my, int width) \
309 LOCAL_ALIGNED_16(int16_t, temp, [71 * 64]); \
310 ff_hevc_put_hevc_##name##W##_##bitd##_##opt(temp, 64, _src, _srcstride, height, mx, my, width); \
311 ff_hevc_put_hevc_uni_w##W##_##bitd##_##opt(_dst, _dststride, temp, 64, height, denom, _wx, _ox);\
314 #define mc_uni_w_funcs(name, bitd, opt) \
315 mc_uni_w_func(name, bitd, 4, opt); \
316 mc_uni_w_func(name, bitd, 8, opt); \
317 mc_uni_w_func(name, bitd, 12, opt); \
318 mc_uni_w_func(name, bitd, 16, opt); \
319 mc_uni_w_func(name, bitd, 24, opt); \
320 mc_uni_w_func(name, bitd, 32, opt); \
321 mc_uni_w_func(name, bitd, 48, opt); \
322 mc_uni_w_func(name, bitd, 64, opt)
324 mc_uni_w_funcs(pel_pixels, 8, sse4);
325 mc_uni_w_func(pel_pixels, 8, 6, sse4);
326 mc_uni_w_funcs(epel_h, 8, sse4);
327 mc_uni_w_func(epel_h, 8, 6, sse4);
328 mc_uni_w_funcs(epel_v, 8, sse4);
329 mc_uni_w_func(epel_v, 8, 6, sse4);
330 mc_uni_w_funcs(epel_hv, 8, sse4);
331 mc_uni_w_func(epel_hv, 8, 6, sse4);
332 mc_uni_w_funcs(qpel_h, 8, sse4);
333 mc_uni_w_funcs(qpel_v, 8, sse4);
334 mc_uni_w_funcs(qpel_hv, 8, sse4);
336 mc_uni_w_funcs(pel_pixels, 10, sse4);
337 mc_uni_w_func(pel_pixels, 10, 6, sse4);
338 mc_uni_w_funcs(epel_h, 10, sse4);
339 mc_uni_w_func(epel_h, 10, 6, sse4);
340 mc_uni_w_funcs(epel_v, 10, sse4);
341 mc_uni_w_func(epel_v, 10, 6, sse4);
342 mc_uni_w_funcs(epel_hv, 10, sse4);
343 mc_uni_w_func(epel_hv, 10, 6, sse4);
344 mc_uni_w_funcs(qpel_h, 10, sse4);
345 mc_uni_w_funcs(qpel_v, 10, sse4);
346 mc_uni_w_funcs(qpel_hv, 10, sse4);
349 #define mc_bi_w_func(name, bitd, W, opt) \
350 void ff_hevc_put_hevc_bi_w_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t _dststride, \
351 uint8_t *_src, ptrdiff_t _srcstride, \
352 int16_t *_src2, ptrdiff_t _src2stride, \
353 int height, int denom, \
354 int _wx0, int _wx1, int _ox0, int _ox1, \
355 intptr_t mx, intptr_t my, int width) \
357 LOCAL_ALIGNED_16(int16_t, temp, [71 * 64]); \
358 ff_hevc_put_hevc_##name##W##_##bitd##_##opt(temp, 64, _src, _srcstride, height, mx, my, width); \
359 ff_hevc_put_hevc_bi_w##W##_##bitd##_##opt(_dst, _dststride, temp, 64, _src2, _src2stride, \
360 height, denom, _wx0, _wx1, _ox0, _ox1); \
363 #define mc_bi_w_funcs(name, bitd, opt) \
364 mc_bi_w_func(name, bitd, 4, opt); \
365 mc_bi_w_func(name, bitd, 8, opt); \
366 mc_bi_w_func(name, bitd, 12, opt); \
367 mc_bi_w_func(name, bitd, 16, opt); \
368 mc_bi_w_func(name, bitd, 24, opt); \
369 mc_bi_w_func(name, bitd, 32, opt); \
370 mc_bi_w_func(name, bitd, 48, opt); \
371 mc_bi_w_func(name, bitd, 64, opt)
373 mc_bi_w_funcs(pel_pixels, 8, sse4);
374 mc_bi_w_func(pel_pixels, 8, 6, sse4);
375 mc_bi_w_funcs(epel_h, 8, sse4);
376 mc_bi_w_func(epel_h, 8, 6, sse4);
377 mc_bi_w_funcs(epel_v, 8, sse4);
378 mc_bi_w_func(epel_v, 8, 6, sse4);
379 mc_bi_w_funcs(epel_hv, 8, sse4);
380 mc_bi_w_func(epel_hv, 8, 6, sse4);
381 mc_bi_w_funcs(qpel_h, 8, sse4);
382 mc_bi_w_funcs(qpel_v, 8, sse4);
383 mc_bi_w_funcs(qpel_hv, 8, sse4);
385 mc_bi_w_funcs(pel_pixels, 10, sse4);
386 mc_bi_w_func(pel_pixels, 10, 6, sse4);
387 mc_bi_w_funcs(epel_h, 10, sse4);
388 mc_bi_w_func(epel_h, 10, 6, sse4);
389 mc_bi_w_funcs(epel_v, 10, sse4);
390 mc_bi_w_func(epel_v, 10, 6, sse4);
391 mc_bi_w_funcs(epel_hv, 10, sse4);
392 mc_bi_w_func(epel_hv, 10, 6, sse4);
393 mc_bi_w_funcs(qpel_h, 10, sse4);
394 mc_bi_w_funcs(qpel_v, 10, sse4);
395 mc_bi_w_funcs(qpel_hv, 10, sse4);
397 #endif //ARCH_X86_64 && HAVE_SSE4_EXTERNAL
400 #define EPEL_LINKS(pointer, my, mx, fname, bitd, opt ) \
401 PEL_LINK(pointer, 1, my , mx , fname##4 , bitd, opt ); \
402 PEL_LINK(pointer, 2, my , mx , fname##6 , bitd, opt ); \
403 PEL_LINK(pointer, 3, my , mx , fname##8 , bitd, opt ); \
404 PEL_LINK(pointer, 4, my , mx , fname##12, bitd, opt ); \
405 PEL_LINK(pointer, 5, my , mx , fname##16, bitd, opt ); \
406 PEL_LINK(pointer, 6, my , mx , fname##24, bitd, opt ); \
407 PEL_LINK(pointer, 7, my , mx , fname##32, bitd, opt ); \
408 PEL_LINK(pointer, 8, my , mx , fname##48, bitd, opt ); \
409 PEL_LINK(pointer, 9, my , mx , fname##64, bitd, opt )
410 #define QPEL_LINKS(pointer, my, mx, fname, bitd, opt) \
411 PEL_LINK(pointer, 1, my , mx , fname##4 , bitd, opt ); \
412 PEL_LINK(pointer, 3, my , mx , fname##8 , bitd, opt ); \
413 PEL_LINK(pointer, 4, my , mx , fname##12, bitd, opt ); \
414 PEL_LINK(pointer, 5, my , mx , fname##16, bitd, opt ); \
415 PEL_LINK(pointer, 6, my , mx , fname##24, bitd, opt ); \
416 PEL_LINK(pointer, 7, my , mx , fname##32, bitd, opt ); \
417 PEL_LINK(pointer, 8, my , mx , fname##48, bitd, opt ); \
418 PEL_LINK(pointer, 9, my , mx , fname##64, bitd, opt )
425 if (bit_depth == 8) {
461 }
else if (bit_depth == 10) {