2 * Copyright (c) 2013 Seppo Tomperi
3 * Copyright (c) 2013 - 2014 Pierre-Edouard Lepere
6 * This file is part of ffmpeg.
8 * ffmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * ffmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with ffmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #include "libavutil/cpu.h"
25 #include "libavutil/x86/asm.h"
26 #include "libavutil/x86/cpu.h"
27 #include "libavcodec/get_bits.h" /* required for hevcdsp.h GetBitContext */
28 #include "libavcodec/hevcdsp.h"
29 #include "libavcodec/x86/hevcdsp.h"
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) \
40 LFC_FUNC(h, depth, sse2) \
41 LFC_FUNC(v, depth, sse2)
43 #define LFL_FUNCS(type, depth) \
44 LFL_FUNC(h, depth, ssse3) \
45 LFL_FUNC(v, depth, ssse3)
48 LFC_FUNCS(uint8_t, 10)
50 LFL_FUNCS(uint8_t, 10)
52 #if HAVE_SSE2_EXTERNAL
53 void ff_hevc_idct32_dc_add_8_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
55 ff_hevc_idct16_dc_add_8_sse2(dst, coeffs, stride);
56 ff_hevc_idct16_dc_add_8_sse2(dst+16, coeffs, stride);
57 ff_hevc_idct16_dc_add_8_sse2(dst+16*stride, coeffs, stride);
58 ff_hevc_idct16_dc_add_8_sse2(dst+16*stride+16, coeffs, stride);
61 void ff_hevc_idct16_dc_add_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
63 ff_hevc_idct8_dc_add_10_sse2(dst, coeffs, stride);
64 ff_hevc_idct8_dc_add_10_sse2(dst+16, coeffs, stride);
65 ff_hevc_idct8_dc_add_10_sse2(dst+8*stride, coeffs, stride);
66 ff_hevc_idct8_dc_add_10_sse2(dst+8*stride+16, coeffs, stride);
69 void ff_hevc_idct32_dc_add_10_sse2(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
71 ff_hevc_idct16_dc_add_10_sse2(dst, coeffs, stride);
72 ff_hevc_idct16_dc_add_10_sse2(dst+32, coeffs, stride);
73 ff_hevc_idct16_dc_add_10_sse2(dst+16*stride, coeffs, stride);
74 ff_hevc_idct16_dc_add_10_sse2(dst+16*stride+32, coeffs, stride);
76 #endif //HAVE_SSE2_EXTERNAL
78 void ff_hevc_idct16_dc_add_10_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
80 ff_hevc_idct8_dc_add_10_avx(dst, coeffs, stride);
81 ff_hevc_idct8_dc_add_10_avx(dst+16, coeffs, stride);
82 ff_hevc_idct8_dc_add_10_avx(dst+8*stride, coeffs, stride);
83 ff_hevc_idct8_dc_add_10_avx(dst+8*stride+16, coeffs, stride);
86 void ff_hevc_idct32_dc_add_10_avx(uint8_t *dst, int16_t *coeffs, ptrdiff_t stride)
88 ff_hevc_idct16_dc_add_10_avx(dst, coeffs, stride);
89 ff_hevc_idct16_dc_add_10_avx(dst+32, coeffs, stride);
90 ff_hevc_idct16_dc_add_10_avx(dst+16*stride, coeffs, stride);
91 ff_hevc_idct16_dc_add_10_avx(dst+16*stride+32, coeffs, stride);
93 #endif //HAVE_AVX_EXTERNAL
95 #define mc_rep_func(name, bitd, step, W, opt) \
96 void ff_hevc_put_hevc_##name##W##_##bitd##_##opt(int16_t *_dst, ptrdiff_t dststride, \
97 uint8_t *_src, ptrdiff_t _srcstride, int height, \
98 intptr_t mx, intptr_t my, int width) \
103 for (i = 0; i < W; i += step) { \
104 src = _src + (i * ((bitd + 7) / 8)); \
106 ff_hevc_put_hevc_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, height, mx, my, width); \
109 #define mc_rep_uni_func(name, bitd, step, W, opt) \
110 void ff_hevc_put_hevc_uni_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, \
111 uint8_t *_src, ptrdiff_t _srcstride, int height, \
112 intptr_t mx, intptr_t my, int width) \
117 for (i = 0; i < W; i += step) { \
118 src = _src + (i * ((bitd + 7) / 8)); \
119 dst = _dst + (i * ((bitd + 7) / 8)); \
120 ff_hevc_put_hevc_uni_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, \
121 height, mx, my, width); \
124 #define mc_rep_bi_func(name, bitd, step, W, opt) \
125 void ff_hevc_put_hevc_bi_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, uint8_t *_src, \
126 ptrdiff_t _srcstride, int16_t* _src2, ptrdiff_t _src2stride, \
127 int height, intptr_t mx, intptr_t my, int width) \
133 for (i = 0; i < W ; i += step) { \
134 src = _src + (i * ((bitd + 7) / 8)); \
135 dst = _dst + (i * ((bitd + 7) / 8)); \
137 ff_hevc_put_hevc_bi_##name##step##_##bitd##_##opt(dst, dststride, src, _srcstride, src2, \
138 _src2stride, height, mx, my, width); \
142 #define mc_rep_funcs(name, bitd, step, W, opt) \
143 mc_rep_func(name, bitd, step, W, opt); \
144 mc_rep_uni_func(name, bitd, step, W, opt); \
145 mc_rep_bi_func(name, bitd, step, W, opt)
148 #if ARCH_X86_64 && HAVE_SSE4_EXTERNAL
150 mc_rep_funcs(pel_pixels, 8, 16, 64, sse4);
151 mc_rep_funcs(pel_pixels, 8, 16, 48, sse4);
152 mc_rep_funcs(pel_pixels, 8, 16, 32, sse4);
153 mc_rep_funcs(pel_pixels, 8, 8, 24, sse4);
155 mc_rep_funcs(pel_pixels,10, 8, 64, sse4);
156 mc_rep_funcs(pel_pixels,10, 8, 48, sse4);
157 mc_rep_funcs(pel_pixels,10, 8, 32, sse4);
158 mc_rep_funcs(pel_pixels,10, 8, 24, sse4);
159 mc_rep_funcs(pel_pixels,10, 8, 16, sse4);
160 mc_rep_funcs(pel_pixels,10, 4, 12, sse4);
162 mc_rep_funcs(epel_h, 8, 16, 64, sse4);
163 mc_rep_funcs(epel_h, 8, 16, 48, sse4);
164 mc_rep_funcs(epel_h, 8, 16, 32, sse4);
165 mc_rep_funcs(epel_h, 8, 8, 24, sse4);
166 mc_rep_funcs(epel_h,10, 8, 64, sse4);
167 mc_rep_funcs(epel_h,10, 8, 48, sse4);
168 mc_rep_funcs(epel_h,10, 8, 32, sse4);
169 mc_rep_funcs(epel_h,10, 8, 24, sse4);
170 mc_rep_funcs(epel_h,10, 8, 16, sse4);
171 mc_rep_funcs(epel_h,10, 4, 12, sse4);
172 mc_rep_funcs(epel_v, 8, 16, 64, sse4);
173 mc_rep_funcs(epel_v, 8, 16, 48, sse4);
174 mc_rep_funcs(epel_v, 8, 16, 32, sse4);
175 mc_rep_funcs(epel_v, 8, 8, 24, sse4);
176 mc_rep_funcs(epel_v,10, 8, 64, sse4);
177 mc_rep_funcs(epel_v,10, 8, 48, sse4);
178 mc_rep_funcs(epel_v,10, 8, 32, sse4);
179 mc_rep_funcs(epel_v,10, 8, 24, sse4);
180 mc_rep_funcs(epel_v,10, 8, 16, sse4);
181 mc_rep_funcs(epel_v,10, 4, 12, sse4);
182 mc_rep_funcs(epel_hv, 8, 8, 64, sse4);
183 mc_rep_funcs(epel_hv, 8, 8, 48, sse4);
184 mc_rep_funcs(epel_hv, 8, 8, 32, sse4);
185 mc_rep_funcs(epel_hv, 8, 8, 24, sse4);
186 mc_rep_funcs(epel_hv, 8, 8, 16, sse4);
187 mc_rep_funcs(epel_hv, 8, 4, 12, sse4);
188 mc_rep_funcs(epel_hv,10, 8, 64, sse4);
189 mc_rep_funcs(epel_hv,10, 8, 48, sse4);
190 mc_rep_funcs(epel_hv,10, 8, 32, sse4);
191 mc_rep_funcs(epel_hv,10, 8, 24, sse4);
192 mc_rep_funcs(epel_hv,10, 8, 16, sse4);
193 mc_rep_funcs(epel_hv,10, 4, 12, sse4);
195 mc_rep_funcs(qpel_h, 8, 16, 64, sse4);
196 mc_rep_funcs(qpel_h, 8, 16, 48, sse4);
197 mc_rep_funcs(qpel_h, 8, 16, 32, sse4);
198 mc_rep_funcs(qpel_h, 8, 8, 24, sse4);
199 mc_rep_funcs(qpel_h,10, 8, 64, sse4);
200 mc_rep_funcs(qpel_h,10, 8, 48, sse4);
201 mc_rep_funcs(qpel_h,10, 8, 32, sse4);
202 mc_rep_funcs(qpel_h,10, 8, 24, sse4);
203 mc_rep_funcs(qpel_h,10, 8, 16, sse4);
204 mc_rep_funcs(qpel_h,10, 4, 12, sse4);
205 mc_rep_funcs(qpel_v, 8, 16, 64, sse4);
206 mc_rep_funcs(qpel_v, 8, 16, 48, sse4);
207 mc_rep_funcs(qpel_v, 8, 16, 32, sse4);
208 mc_rep_funcs(qpel_v, 8, 8, 24, sse4);
209 mc_rep_funcs(qpel_v,10, 8, 64, sse4);
210 mc_rep_funcs(qpel_v,10, 8, 48, sse4);
211 mc_rep_funcs(qpel_v,10, 8, 32, sse4);
212 mc_rep_funcs(qpel_v,10, 8, 24, sse4);
213 mc_rep_funcs(qpel_v,10, 8, 16, sse4);
214 mc_rep_funcs(qpel_v,10, 4, 12, sse4);
215 mc_rep_funcs(qpel_hv, 8, 8, 64, sse4);
216 mc_rep_funcs(qpel_hv, 8, 8, 48, sse4);
217 mc_rep_funcs(qpel_hv, 8, 8, 32, sse4);
218 mc_rep_funcs(qpel_hv, 8, 8, 24, sse4);
219 mc_rep_funcs(qpel_hv, 8, 8, 16, sse4);
220 mc_rep_funcs(qpel_hv, 8, 4, 12, sse4);
221 mc_rep_funcs(qpel_hv,10, 8, 64, sse4);
222 mc_rep_funcs(qpel_hv,10, 8, 48, sse4);
223 mc_rep_funcs(qpel_hv,10, 8, 32, sse4);
224 mc_rep_funcs(qpel_hv,10, 8, 24, sse4);
225 mc_rep_funcs(qpel_hv,10, 8, 16, sse4);
226 mc_rep_funcs(qpel_hv,10, 4, 12, sse4);
228 #define mc_rep_uni_w(bitd, step, W, opt) \
229 void ff_hevc_put_hevc_uni_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride,\
230 int height, int denom, int _wx, int _ox) \
235 for (i = 0; i < W; i += step) { \
237 dst= _dst + (i * ((bitd + 7) / 8)); \
238 ff_hevc_put_hevc_uni_w##step##_##bitd##_##opt(dst, dststride, src, _srcstride, \
239 height, denom, _wx, _ox); \
243 mc_rep_uni_w(8, 6, 12, sse4);
244 mc_rep_uni_w(8, 8, 16, sse4);
245 mc_rep_uni_w(8, 8, 24, sse4);
246 mc_rep_uni_w(8, 8, 32, sse4);
247 mc_rep_uni_w(8, 8, 48, sse4);
248 mc_rep_uni_w(8, 8, 64, sse4);
250 mc_rep_uni_w(10, 6, 12, sse4);
251 mc_rep_uni_w(10, 8, 16, sse4);
252 mc_rep_uni_w(10, 8, 24, sse4);
253 mc_rep_uni_w(10, 8, 32, sse4);
254 mc_rep_uni_w(10, 8, 48, sse4);
255 mc_rep_uni_w(10, 8, 64, sse4);
257 #define mc_rep_bi_w(bitd, step, W, opt) \
258 void ff_hevc_put_hevc_bi_w##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t dststride, int16_t *_src, ptrdiff_t _srcstride, \
259 int16_t *_src2, ptrdiff_t _src2stride, int height, \
260 int denom, int _wx0, int _wx1, int _ox0, int _ox1) \
266 for (i = 0; i < W; i += step) { \
269 dst = _dst + (i * ((bitd + 7) / 8)); \
270 ff_hevc_put_hevc_bi_w##step##_##bitd##_##opt(dst, dststride, src, _srcstride, src2, _src2stride, \
271 height, denom, _wx0, _wx1, _ox0, _ox1); \
275 mc_rep_bi_w(8, 6, 12, sse4);
276 mc_rep_bi_w(8, 8, 16, sse4);
277 mc_rep_bi_w(8, 8, 24, sse4);
278 mc_rep_bi_w(8, 8, 32, sse4);
279 mc_rep_bi_w(8, 8, 48, sse4);
280 mc_rep_bi_w(8, 8, 64, sse4);
282 mc_rep_bi_w(10, 6, 12, sse4);
283 mc_rep_bi_w(10, 8, 16, sse4);
284 mc_rep_bi_w(10, 8, 24, sse4);
285 mc_rep_bi_w(10, 8, 32, sse4);
286 mc_rep_bi_w(10, 8, 48, sse4);
287 mc_rep_bi_w(10, 8, 64, sse4);
289 #define mc_uni_w_func(name, bitd, W, opt) \
290 void ff_hevc_put_hevc_uni_w_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t _dststride, \
291 uint8_t *_src, ptrdiff_t _srcstride, \
292 int height, int denom, \
294 intptr_t mx, intptr_t my, int width) \
296 LOCAL_ALIGNED_16(int16_t, temp, [71 * 64]); \
297 ff_hevc_put_hevc_##name##W##_##bitd##_##opt(temp, 64, _src, _srcstride, height, mx, my, width); \
298 ff_hevc_put_hevc_uni_w##W##_##bitd##_##opt(_dst, _dststride, temp, 64, height, denom, _wx, _ox);\
301 #define mc_uni_w_funcs(name, bitd, opt) \
302 mc_uni_w_func(name, bitd, 4, opt); \
303 mc_uni_w_func(name, bitd, 8, opt); \
304 mc_uni_w_func(name, bitd, 12, opt); \
305 mc_uni_w_func(name, bitd, 16, opt); \
306 mc_uni_w_func(name, bitd, 24, opt); \
307 mc_uni_w_func(name, bitd, 32, opt); \
308 mc_uni_w_func(name, bitd, 48, opt); \
309 mc_uni_w_func(name, bitd, 64, opt)
311 mc_uni_w_funcs(pel_pixels, 8, sse4);
312 mc_uni_w_func(pel_pixels, 8, 6, sse4);
313 mc_uni_w_funcs(epel_h, 8, sse4);
314 mc_uni_w_func(epel_h, 8, 6, sse4);
315 mc_uni_w_funcs(epel_v, 8, sse4);
316 mc_uni_w_func(epel_v, 8, 6, sse4);
317 mc_uni_w_funcs(epel_hv, 8, sse4);
318 mc_uni_w_func(epel_hv, 8, 6, sse4);
319 mc_uni_w_funcs(qpel_h, 8, sse4);
320 mc_uni_w_funcs(qpel_v, 8, sse4);
321 mc_uni_w_funcs(qpel_hv, 8, sse4);
323 mc_uni_w_funcs(pel_pixels, 10, sse4);
324 mc_uni_w_func(pel_pixels, 10, 6, sse4);
325 mc_uni_w_funcs(epel_h, 10, sse4);
326 mc_uni_w_func(epel_h, 10, 6, sse4);
327 mc_uni_w_funcs(epel_v, 10, sse4);
328 mc_uni_w_func(epel_v, 10, 6, sse4);
329 mc_uni_w_funcs(epel_hv, 10, sse4);
330 mc_uni_w_func(epel_hv, 10, 6, sse4);
331 mc_uni_w_funcs(qpel_h, 10, sse4);
332 mc_uni_w_funcs(qpel_v, 10, sse4);
333 mc_uni_w_funcs(qpel_hv, 10, sse4);
336 #define mc_bi_w_func(name, bitd, W, opt) \
337 void ff_hevc_put_hevc_bi_w_##name##W##_##bitd##_##opt(uint8_t *_dst, ptrdiff_t _dststride, \
338 uint8_t *_src, ptrdiff_t _srcstride, \
339 int16_t *_src2, ptrdiff_t _src2stride, \
340 int height, int denom, \
341 int _wx0, int _wx1, int _ox0, int _ox1, \
342 intptr_t mx, intptr_t my, int width) \
344 LOCAL_ALIGNED_16(int16_t, temp, [71 * 64]); \
345 ff_hevc_put_hevc_##name##W##_##bitd##_##opt(temp, 64, _src, _srcstride, height, mx, my, width); \
346 ff_hevc_put_hevc_bi_w##W##_##bitd##_##opt(_dst, _dststride, temp, 64, _src2, _src2stride, \
347 height, denom, _wx0, _wx1, _ox0, _ox1); \
350 #define mc_bi_w_funcs(name, bitd, opt) \
351 mc_bi_w_func(name, bitd, 4, opt); \
352 mc_bi_w_func(name, bitd, 8, opt); \
353 mc_bi_w_func(name, bitd, 12, opt); \
354 mc_bi_w_func(name, bitd, 16, opt); \
355 mc_bi_w_func(name, bitd, 24, opt); \
356 mc_bi_w_func(name, bitd, 32, opt); \
357 mc_bi_w_func(name, bitd, 48, opt); \
358 mc_bi_w_func(name, bitd, 64, opt)
360 mc_bi_w_funcs(pel_pixels, 8, sse4);
361 mc_bi_w_func(pel_pixels, 8, 6, sse4);
362 mc_bi_w_funcs(epel_h, 8, sse4);
363 mc_bi_w_func(epel_h, 8, 6, sse4);
364 mc_bi_w_funcs(epel_v, 8, sse4);
365 mc_bi_w_func(epel_v, 8, 6, sse4);
366 mc_bi_w_funcs(epel_hv, 8, sse4);
367 mc_bi_w_func(epel_hv, 8, 6, sse4);
368 mc_bi_w_funcs(qpel_h, 8, sse4);
369 mc_bi_w_funcs(qpel_v, 8, sse4);
370 mc_bi_w_funcs(qpel_hv, 8, sse4);
372 mc_bi_w_funcs(pel_pixels, 10, sse4);
373 mc_bi_w_func(pel_pixels, 10, 6, sse4);
374 mc_bi_w_funcs(epel_h, 10, sse4);
375 mc_bi_w_func(epel_h, 10, 6, sse4);
376 mc_bi_w_funcs(epel_v, 10, sse4);
377 mc_bi_w_func(epel_v, 10, 6, sse4);
378 mc_bi_w_funcs(epel_hv, 10, sse4);
379 mc_bi_w_func(epel_hv, 10, 6, sse4);
380 mc_bi_w_funcs(qpel_h, 10, sse4);
381 mc_bi_w_funcs(qpel_v, 10, sse4);
382 mc_bi_w_funcs(qpel_hv, 10, sse4);
384 #endif //ARCH_X86_64 && HAVE_SSE4_EXTERNAL
387 #define EPEL_LINKS(pointer, my, mx, fname, bitd, opt ) \
388 PEL_LINK(pointer, 1, my , mx , fname##4 , bitd, opt ); \
389 PEL_LINK(pointer, 2, my , mx , fname##6 , bitd, opt ); \
390 PEL_LINK(pointer, 3, my , mx , fname##8 , bitd, opt ); \
391 PEL_LINK(pointer, 4, my , mx , fname##12, bitd, opt ); \
392 PEL_LINK(pointer, 5, my , mx , fname##16, bitd, opt ); \
393 PEL_LINK(pointer, 6, my , mx , fname##24, bitd, opt ); \
394 PEL_LINK(pointer, 7, my , mx , fname##32, bitd, opt ); \
395 PEL_LINK(pointer, 8, my , mx , fname##48, bitd, opt ); \
396 PEL_LINK(pointer, 9, my , mx , fname##64, bitd, opt )
397 #define QPEL_LINKS(pointer, my, mx, fname, bitd, opt) \
398 PEL_LINK(pointer, 1, my , mx , fname##4 , bitd, opt ); \
399 PEL_LINK(pointer, 3, my , mx , fname##8 , bitd, opt ); \
400 PEL_LINK(pointer, 4, my , mx , fname##12, bitd, opt ); \
401 PEL_LINK(pointer, 5, my , mx , fname##16, bitd, opt ); \
402 PEL_LINK(pointer, 6, my , mx , fname##24, bitd, opt ); \
403 PEL_LINK(pointer, 7, my , mx , fname##32, bitd, opt ); \
404 PEL_LINK(pointer, 8, my , mx , fname##48, bitd, opt ); \
405 PEL_LINK(pointer, 9, my , mx , fname##64, bitd, opt )
408 void ff_hevcdsp_init_x86(HEVCDSPContext *c, const int bit_depth)
410 int mm_flags = av_get_cpu_flags();
412 if (bit_depth == 8) {
413 if (EXTERNAL_MMXEXT(mm_flags)) {
414 c->transform_dc_add[0] = ff_hevc_idct4_dc_add_8_mmxext;
415 c->transform_dc_add[1] = ff_hevc_idct8_dc_add_8_mmxext;
418 if (EXTERNAL_SSE2(mm_flags)) {
419 c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_sse2;
420 c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_sse2;
422 c->transform_dc_add[2] = ff_hevc_idct16_dc_add_8_sse2;
423 c->transform_dc_add[3] = ff_hevc_idct32_dc_add_8_sse2;
425 if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {
426 c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_8_ssse3;
427 c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_8_ssse3;
429 if (EXTERNAL_SSE4(mm_flags) && ARCH_X86_64) {
431 EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 8, sse4);
432 EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 8, sse4);
433 EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 8, sse4);
434 EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 8, sse4);
436 QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 8, sse4);
437 QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 8, sse4);
438 QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 8, sse4);
439 QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 8, sse4);
441 } else if (bit_depth == 10) {
442 if (EXTERNAL_MMXEXT(mm_flags)) {
443 c->transform_dc_add[0] = ff_hevc_idct4_dc_add_10_mmxext;
446 if (EXTERNAL_SSE2(mm_flags)) {
447 c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_sse2;
448 c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_sse2;
451 c->transform_dc_add[1] = ff_hevc_idct8_dc_add_10_sse2;
452 c->transform_dc_add[2] = ff_hevc_idct16_dc_add_10_sse2;
453 c->transform_dc_add[3] = ff_hevc_idct32_dc_add_10_sse2;
455 if (EXTERNAL_SSSE3(mm_flags) && ARCH_X86_64) {
456 c->hevc_v_loop_filter_luma = ff_hevc_v_loop_filter_luma_10_ssse3;
457 c->hevc_h_loop_filter_luma = ff_hevc_h_loop_filter_luma_10_ssse3;
459 if (EXTERNAL_SSE4(mm_flags) && ARCH_X86_64) {
461 EPEL_LINKS(c->put_hevc_epel, 0, 0, pel_pixels, 10, sse4);
462 EPEL_LINKS(c->put_hevc_epel, 0, 1, epel_h, 10, sse4);
463 EPEL_LINKS(c->put_hevc_epel, 1, 0, epel_v, 10, sse4);
464 EPEL_LINKS(c->put_hevc_epel, 1, 1, epel_hv, 10, sse4);
466 QPEL_LINKS(c->put_hevc_qpel, 0, 0, pel_pixels, 10, sse4);
467 QPEL_LINKS(c->put_hevc_qpel, 0, 1, qpel_h, 10, sse4);
468 QPEL_LINKS(c->put_hevc_qpel, 1, 0, qpel_v, 10, sse4);
469 QPEL_LINKS(c->put_hevc_qpel, 1, 1, qpel_hv, 10, sse4);
471 if (EXTERNAL_AVX(mm_flags)) {
472 c->transform_dc_add[1] = ff_hevc_idct8_dc_add_10_avx;
473 c->transform_dc_add[2] = ff_hevc_idct16_dc_add_10_avx;
474 c->transform_dc_add[3] = ff_hevc_idct32_dc_add_10_avx;