2
0

h264dsp_init.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. /*
  2. * Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "libavutil/attributes.h"
  21. #include "libavutil/cpu.h"
  22. #include "libavutil/x86/asm.h"
  23. #include "libavutil/x86/cpu.h"
  24. #include "libavcodec/h264dsp.h"
  25. /***********************************/
  26. /* IDCT */
  27. #define IDCT_ADD_FUNC(NUM, DEPTH, OPT) \
  28. void ff_h264_idct ## NUM ## _add_ ## DEPTH ## _ ## OPT(uint8_t *dst, \
  29. int16_t *block, \
  30. int stride);
  31. IDCT_ADD_FUNC(, 8, mmx)
  32. IDCT_ADD_FUNC(, 8, sse2)
  33. IDCT_ADD_FUNC(, 8, avx)
  34. IDCT_ADD_FUNC(, 10, sse2)
  35. IDCT_ADD_FUNC(_dc, 8, mmxext)
  36. IDCT_ADD_FUNC(_dc, 8, sse2)
  37. IDCT_ADD_FUNC(_dc, 8, avx)
  38. IDCT_ADD_FUNC(_dc, 10, mmxext)
  39. IDCT_ADD_FUNC(8_dc, 8, mmxext)
  40. IDCT_ADD_FUNC(8_dc, 10, sse2)
  41. IDCT_ADD_FUNC(8, 8, mmx)
  42. IDCT_ADD_FUNC(8, 8, sse2)
  43. IDCT_ADD_FUNC(8, 10, sse2)
  44. IDCT_ADD_FUNC(, 10, avx)
  45. IDCT_ADD_FUNC(8_dc, 10, avx)
  46. IDCT_ADD_FUNC(8, 10, avx)
  47. #define IDCT_ADD_REP_FUNC(NUM, REP, DEPTH, OPT) \
  48. void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
  49. (uint8_t *dst, const int *block_offset, \
  50. int16_t *block, int stride, const uint8_t nnzc[6 * 8]);
  51. IDCT_ADD_REP_FUNC(8, 4, 8, mmx)
  52. IDCT_ADD_REP_FUNC(8, 4, 8, mmxext)
  53. IDCT_ADD_REP_FUNC(8, 4, 8, sse2)
  54. IDCT_ADD_REP_FUNC(8, 4, 10, sse2)
  55. IDCT_ADD_REP_FUNC(8, 4, 10, avx)
  56. IDCT_ADD_REP_FUNC(, 16, 8, mmx)
  57. IDCT_ADD_REP_FUNC(, 16, 8, mmxext)
  58. IDCT_ADD_REP_FUNC(, 16, 8, sse2)
  59. IDCT_ADD_REP_FUNC(, 16, 10, sse2)
  60. IDCT_ADD_REP_FUNC(, 16intra, 8, mmx)
  61. IDCT_ADD_REP_FUNC(, 16intra, 8, mmxext)
  62. IDCT_ADD_REP_FUNC(, 16intra, 8, sse2)
  63. IDCT_ADD_REP_FUNC(, 16intra, 10, sse2)
  64. IDCT_ADD_REP_FUNC(, 16, 10, avx)
  65. IDCT_ADD_REP_FUNC(, 16intra, 10, avx)
  66. #define IDCT_ADD_REP_FUNC2(NUM, REP, DEPTH, OPT) \
  67. void ff_h264_idct ## NUM ## _add ## REP ## _ ## DEPTH ## _ ## OPT \
  68. (uint8_t **dst, const int *block_offset, \
  69. int16_t *block, int stride, const uint8_t nnzc[6 * 8]);
  70. IDCT_ADD_REP_FUNC2(, 8, 8, mmx)
  71. IDCT_ADD_REP_FUNC2(, 8, 8, mmxext)
  72. IDCT_ADD_REP_FUNC2(, 8, 8, sse2)
  73. IDCT_ADD_REP_FUNC2(, 8, 10, sse2)
  74. IDCT_ADD_REP_FUNC2(, 8, 10, avx)
  75. IDCT_ADD_REP_FUNC2(, 8_422, 8, mmx)
  76. IDCT_ADD_REP_FUNC2(, 8_422, 10, sse2)
  77. IDCT_ADD_REP_FUNC2(, 8_422, 10, avx)
  78. void ff_h264_luma_dc_dequant_idct_mmx(int16_t *output, int16_t *input, int qmul);
  79. void ff_h264_luma_dc_dequant_idct_sse2(int16_t *output, int16_t *input, int qmul);
  80. /***********************************/
  81. /* deblocking */
  82. void ff_h264_loop_filter_strength_mmxext(int16_t bS[2][4][4], uint8_t nnz[40],
  83. int8_t ref[2][40],
  84. int16_t mv[2][40][2],
  85. int bidir, int edges, int step,
  86. int mask_mv0, int mask_mv1, int field);
  87. #define LF_FUNC(DIR, TYPE, DEPTH, OPT) \
  88. void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT(uint8_t *pix, \
  89. int stride, \
  90. int alpha, \
  91. int beta, \
  92. int8_t *tc0);
  93. #define LF_IFUNC(DIR, TYPE, DEPTH, OPT) \
  94. void ff_deblock_ ## DIR ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT(uint8_t *pix, \
  95. int stride, \
  96. int alpha, \
  97. int beta);
  98. #define LF_FUNCS(type, depth) \
  99. LF_FUNC(h, chroma, depth, mmxext) \
  100. LF_IFUNC(h, chroma_intra, depth, mmxext) \
  101. LF_FUNC(h, chroma422, depth, mmxext) \
  102. LF_IFUNC(h, chroma422_intra, depth, mmxext) \
  103. LF_FUNC(v, chroma, depth, mmxext) \
  104. LF_IFUNC(v, chroma_intra, depth, mmxext) \
  105. LF_FUNC(h, luma, depth, mmxext) \
  106. LF_IFUNC(h, luma_intra, depth, mmxext) \
  107. LF_FUNC(h, luma, depth, sse2) \
  108. LF_IFUNC(h, luma_intra, depth, sse2) \
  109. LF_FUNC(v, luma, depth, sse2) \
  110. LF_IFUNC(v, luma_intra, depth, sse2) \
  111. LF_FUNC(h, chroma, depth, sse2) \
  112. LF_IFUNC(h, chroma_intra, depth, sse2) \
  113. LF_FUNC(h, chroma422, depth, sse2) \
  114. LF_IFUNC(h, chroma422_intra, depth, sse2) \
  115. LF_FUNC(v, chroma, depth, sse2) \
  116. LF_IFUNC(v, chroma_intra, depth, sse2) \
  117. LF_FUNC(h, luma, depth, avx) \
  118. LF_IFUNC(h, luma_intra, depth, avx) \
  119. LF_FUNC(v, luma, depth, avx) \
  120. LF_IFUNC(v, luma_intra, depth, avx) \
  121. LF_FUNC(h, chroma, depth, avx) \
  122. LF_IFUNC(h, chroma_intra, depth, avx) \
  123. LF_FUNC(h, chroma422, depth, avx) \
  124. LF_IFUNC(h, chroma422_intra, depth, avx) \
  125. LF_FUNC(v, chroma, depth, avx) \
  126. LF_IFUNC(v, chroma_intra, depth, avx)
  127. LF_FUNC(h, luma_mbaff, 8, sse2)
  128. LF_FUNC(h, luma_mbaff, 8, avx)
  129. LF_FUNCS(uint8_t, 8)
  130. LF_FUNCS(uint16_t, 10)
  131. #if ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL
  132. LF_FUNC(v8, luma, 8, mmxext)
  133. static void deblock_v_luma_8_mmxext(uint8_t *pix, int stride, int alpha,
  134. int beta, int8_t *tc0)
  135. {
  136. if ((tc0[0] & tc0[1]) >= 0)
  137. ff_deblock_v8_luma_8_mmxext(pix + 0, stride, alpha, beta, tc0);
  138. if ((tc0[2] & tc0[3]) >= 0)
  139. ff_deblock_v8_luma_8_mmxext(pix + 8, stride, alpha, beta, tc0 + 2);
  140. }
  141. LF_IFUNC(v8, luma_intra, 8, mmxext)
  142. static void deblock_v_luma_intra_8_mmxext(uint8_t *pix, int stride,
  143. int alpha, int beta)
  144. {
  145. ff_deblock_v8_luma_intra_8_mmxext(pix + 0, stride, alpha, beta);
  146. ff_deblock_v8_luma_intra_8_mmxext(pix + 8, stride, alpha, beta);
  147. }
  148. #endif /* ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL */
  149. LF_FUNC(v, luma, 10, mmxext)
  150. LF_IFUNC(v, luma_intra, 10, mmxext)
  151. /***********************************/
  152. /* weighted prediction */
  153. #define H264_WEIGHT(W, OPT) \
  154. void ff_h264_weight_ ## W ## _ ## OPT(uint8_t *dst, ptrdiff_t stride, \
  155. int height, int log2_denom, \
  156. int weight, int offset);
  157. #define H264_BIWEIGHT(W, OPT) \
  158. void ff_h264_biweight_ ## W ## _ ## OPT(uint8_t *dst, uint8_t *src, \
  159. ptrdiff_t stride, int height, \
  160. int log2_denom, int weightd, \
  161. int weights, int offset);
  162. #define H264_BIWEIGHT_MMX(W) \
  163. H264_WEIGHT(W, mmxext) \
  164. H264_BIWEIGHT(W, mmxext)
  165. #define H264_BIWEIGHT_MMX_SSE(W) \
  166. H264_BIWEIGHT_MMX(W) \
  167. H264_WEIGHT(W, sse2) \
  168. H264_BIWEIGHT(W, sse2) \
  169. H264_BIWEIGHT(W, ssse3)
  170. H264_BIWEIGHT_MMX_SSE(16)
  171. H264_BIWEIGHT_MMX_SSE(8)
  172. H264_BIWEIGHT_MMX(4)
  173. #define H264_WEIGHT_10(W, DEPTH, OPT) \
  174. void ff_h264_weight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst, \
  175. ptrdiff_t stride, \
  176. int height, \
  177. int log2_denom, \
  178. int weight, \
  179. int offset);
  180. #define H264_BIWEIGHT_10(W, DEPTH, OPT) \
  181. void ff_h264_biweight_ ## W ## _ ## DEPTH ## _ ## OPT(uint8_t *dst, \
  182. uint8_t *src, \
  183. ptrdiff_t stride, \
  184. int height, \
  185. int log2_denom, \
  186. int weightd, \
  187. int weights, \
  188. int offset);
  189. #define H264_BIWEIGHT_10_SSE(W, DEPTH) \
  190. H264_WEIGHT_10(W, DEPTH, sse2) \
  191. H264_WEIGHT_10(W, DEPTH, sse4) \
  192. H264_BIWEIGHT_10(W, DEPTH, sse2) \
  193. H264_BIWEIGHT_10(W, DEPTH, sse4)
  194. H264_BIWEIGHT_10_SSE(16, 10)
  195. H264_BIWEIGHT_10_SSE(8, 10)
  196. H264_BIWEIGHT_10_SSE(4, 10)
  197. av_cold void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth,
  198. const int chroma_format_idc)
  199. {
  200. #if HAVE_X86ASM
  201. int cpu_flags = av_get_cpu_flags();
  202. if (EXTERNAL_MMXEXT(cpu_flags) && chroma_format_idc <= 1)
  203. c->h264_loop_filter_strength = ff_h264_loop_filter_strength_mmxext;
  204. if (bit_depth == 8) {
  205. if (EXTERNAL_MMX(cpu_flags)) {
  206. c->h264_idct_dc_add =
  207. c->h264_idct_add = ff_h264_idct_add_8_mmx;
  208. c->h264_idct8_dc_add =
  209. c->h264_idct8_add = ff_h264_idct8_add_8_mmx;
  210. c->h264_idct_add16 = ff_h264_idct_add16_8_mmx;
  211. c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmx;
  212. if (chroma_format_idc <= 1) {
  213. c->h264_idct_add8 = ff_h264_idct_add8_8_mmx;
  214. } else {
  215. c->h264_idct_add8 = ff_h264_idct_add8_422_8_mmx;
  216. }
  217. c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmx;
  218. if (cpu_flags & AV_CPU_FLAG_CMOV)
  219. c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_mmx;
  220. }
  221. if (EXTERNAL_MMXEXT(cpu_flags)) {
  222. c->h264_idct_dc_add = ff_h264_idct_dc_add_8_mmxext;
  223. c->h264_idct8_dc_add = ff_h264_idct8_dc_add_8_mmxext;
  224. c->h264_idct_add16 = ff_h264_idct_add16_8_mmxext;
  225. c->h264_idct8_add4 = ff_h264_idct8_add4_8_mmxext;
  226. if (chroma_format_idc <= 1)
  227. c->h264_idct_add8 = ff_h264_idct_add8_8_mmxext;
  228. c->h264_idct_add16intra = ff_h264_idct_add16intra_8_mmxext;
  229. c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_8_mmxext;
  230. c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_8_mmxext;
  231. if (chroma_format_idc <= 1) {
  232. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_8_mmxext;
  233. c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_8_mmxext;
  234. } else {
  235. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_8_mmxext;
  236. c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma422_intra_8_mmxext;
  237. }
  238. #if ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL
  239. c->h264_v_loop_filter_luma = deblock_v_luma_8_mmxext;
  240. c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_mmxext;
  241. c->h264_v_loop_filter_luma_intra = deblock_v_luma_intra_8_mmxext;
  242. c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_mmxext;
  243. #endif /* ARCH_X86_32 && HAVE_MMXEXT_EXTERNAL */
  244. c->weight_h264_pixels_tab[0] = ff_h264_weight_16_mmxext;
  245. c->weight_h264_pixels_tab[1] = ff_h264_weight_8_mmxext;
  246. c->weight_h264_pixels_tab[2] = ff_h264_weight_4_mmxext;
  247. c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_mmxext;
  248. c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_mmxext;
  249. c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_mmxext;
  250. }
  251. if (EXTERNAL_SSE2(cpu_flags)) {
  252. c->h264_idct8_add = ff_h264_idct8_add_8_sse2;
  253. c->h264_idct_add16 = ff_h264_idct_add16_8_sse2;
  254. c->h264_idct8_add4 = ff_h264_idct8_add4_8_sse2;
  255. if (chroma_format_idc <= 1)
  256. c->h264_idct_add8 = ff_h264_idct_add8_8_sse2;
  257. c->h264_idct_add16intra = ff_h264_idct_add16intra_8_sse2;
  258. c->h264_luma_dc_dequant_idct = ff_h264_luma_dc_dequant_idct_sse2;
  259. c->weight_h264_pixels_tab[0] = ff_h264_weight_16_sse2;
  260. c->weight_h264_pixels_tab[1] = ff_h264_weight_8_sse2;
  261. c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_sse2;
  262. c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_sse2;
  263. c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_sse2;
  264. c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_sse2;
  265. c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_sse2;
  266. c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_sse2;
  267. #if ARCH_X86_64
  268. c->h264_h_loop_filter_luma_mbaff = ff_deblock_h_luma_mbaff_8_sse2;
  269. #endif
  270. c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_8_sse2;
  271. c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_8_sse2;
  272. if (chroma_format_idc <= 1) {
  273. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_8_sse2;
  274. c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_8_sse2;
  275. } else {
  276. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_8_sse2;
  277. c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma422_intra_8_sse2;
  278. }
  279. c->h264_idct_add = ff_h264_idct_add_8_sse2;
  280. c->h264_idct_dc_add = ff_h264_idct_dc_add_8_sse2;
  281. }
  282. if (EXTERNAL_SSSE3(cpu_flags)) {
  283. c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_ssse3;
  284. c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_ssse3;
  285. }
  286. if (EXTERNAL_AVX(cpu_flags)) {
  287. c->h264_v_loop_filter_luma = ff_deblock_v_luma_8_avx;
  288. c->h264_h_loop_filter_luma = ff_deblock_h_luma_8_avx;
  289. c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_8_avx;
  290. c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_8_avx;
  291. #if ARCH_X86_64
  292. c->h264_h_loop_filter_luma_mbaff = ff_deblock_h_luma_mbaff_8_avx;
  293. #endif
  294. c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_8_avx;
  295. c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_8_avx;
  296. if (chroma_format_idc <= 1) {
  297. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_8_avx;
  298. c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma_intra_8_avx;
  299. } else {
  300. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_8_avx;
  301. c->h264_h_loop_filter_chroma_intra = ff_deblock_h_chroma422_intra_8_avx;
  302. }
  303. c->h264_idct_add = ff_h264_idct_add_8_avx;
  304. c->h264_idct_dc_add = ff_h264_idct_dc_add_8_avx;
  305. }
  306. } else if (bit_depth == 10) {
  307. if (EXTERNAL_MMXEXT(cpu_flags)) {
  308. #if ARCH_X86_32
  309. c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_mmxext;
  310. c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_mmxext;
  311. if (chroma_format_idc <= 1) {
  312. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_10_mmxext;
  313. } else {
  314. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_10_mmxext;
  315. }
  316. c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_mmxext;
  317. c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_mmxext;
  318. c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_mmxext;
  319. c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_mmxext;
  320. #endif /* ARCH_X86_32 */
  321. c->h264_idct_dc_add = ff_h264_idct_dc_add_10_mmxext;
  322. }
  323. if (EXTERNAL_SSE2(cpu_flags)) {
  324. c->h264_idct_add = ff_h264_idct_add_10_sse2;
  325. c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_sse2;
  326. c->h264_idct_add16 = ff_h264_idct_add16_10_sse2;
  327. if (chroma_format_idc <= 1) {
  328. c->h264_idct_add8 = ff_h264_idct_add8_10_sse2;
  329. } else {
  330. c->h264_idct_add8 = ff_h264_idct_add8_422_10_sse2;
  331. }
  332. c->h264_idct_add16intra = ff_h264_idct_add16intra_10_sse2;
  333. #if HAVE_ALIGNED_STACK
  334. c->h264_idct8_add = ff_h264_idct8_add_10_sse2;
  335. c->h264_idct8_add4 = ff_h264_idct8_add4_10_sse2;
  336. #endif /* HAVE_ALIGNED_STACK */
  337. c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse2;
  338. c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse2;
  339. c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse2;
  340. c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_10_sse2;
  341. c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse2;
  342. c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse2;
  343. c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_sse2;
  344. c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_sse2;
  345. if (chroma_format_idc <= 1) {
  346. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_10_sse2;
  347. } else {
  348. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_10_sse2;
  349. }
  350. #if HAVE_ALIGNED_STACK
  351. c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_sse2;
  352. c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_sse2;
  353. c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_sse2;
  354. c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_sse2;
  355. #endif /* HAVE_ALIGNED_STACK */
  356. }
  357. if (EXTERNAL_SSE4(cpu_flags)) {
  358. c->weight_h264_pixels_tab[0] = ff_h264_weight_16_10_sse4;
  359. c->weight_h264_pixels_tab[1] = ff_h264_weight_8_10_sse4;
  360. c->weight_h264_pixels_tab[2] = ff_h264_weight_4_10_sse4;
  361. c->biweight_h264_pixels_tab[0] = ff_h264_biweight_16_10_sse4;
  362. c->biweight_h264_pixels_tab[1] = ff_h264_biweight_8_10_sse4;
  363. c->biweight_h264_pixels_tab[2] = ff_h264_biweight_4_10_sse4;
  364. }
  365. if (EXTERNAL_AVX(cpu_flags)) {
  366. c->h264_idct_dc_add =
  367. c->h264_idct_add = ff_h264_idct_add_10_avx;
  368. c->h264_idct8_dc_add = ff_h264_idct8_dc_add_10_avx;
  369. c->h264_idct_add16 = ff_h264_idct_add16_10_avx;
  370. if (chroma_format_idc <= 1) {
  371. c->h264_idct_add8 = ff_h264_idct_add8_10_avx;
  372. } else {
  373. c->h264_idct_add8 = ff_h264_idct_add8_422_10_avx;
  374. }
  375. c->h264_idct_add16intra = ff_h264_idct_add16intra_10_avx;
  376. #if HAVE_ALIGNED_STACK
  377. c->h264_idct8_add = ff_h264_idct8_add_10_avx;
  378. c->h264_idct8_add4 = ff_h264_idct8_add4_10_avx;
  379. #endif /* HAVE_ALIGNED_STACK */
  380. c->h264_v_loop_filter_chroma = ff_deblock_v_chroma_10_avx;
  381. c->h264_v_loop_filter_chroma_intra = ff_deblock_v_chroma_intra_10_avx;
  382. if (chroma_format_idc <= 1) {
  383. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma_10_avx;
  384. } else {
  385. c->h264_h_loop_filter_chroma = ff_deblock_h_chroma422_10_avx;
  386. }
  387. #if HAVE_ALIGNED_STACK
  388. c->h264_v_loop_filter_luma = ff_deblock_v_luma_10_avx;
  389. c->h264_h_loop_filter_luma = ff_deblock_h_luma_10_avx;
  390. c->h264_v_loop_filter_luma_intra = ff_deblock_v_luma_intra_10_avx;
  391. c->h264_h_loop_filter_luma_intra = ff_deblock_h_luma_intra_10_avx;
  392. #endif /* HAVE_ALIGNED_STACK */
  393. }
  394. }
  395. #endif
  396. }