vp8dsp_init.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. /*
  2. * VP8 DSP functions x86-optimized
  3. * Copyright (c) 2010 Ronald S. Bultje <rsbultje@gmail.com>
  4. * Copyright (c) 2010 Fiona Glaser <fiona@x264.com>
  5. *
  6. * This file is part of FFmpeg.
  7. *
  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.
  12. *
  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.
  17. *
  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
  21. */
  22. #include "libavutil/attributes.h"
  23. #include "libavutil/cpu.h"
  24. #include "libavutil/mem.h"
  25. #include "libavutil/x86/cpu.h"
  26. #include "libavcodec/vp8dsp.h"
  27. #if HAVE_X86ASM
  28. /*
  29. * MC functions
  30. */
  31. void ff_put_vp8_epel4_h4_mmxext(uint8_t *dst, ptrdiff_t dststride,
  32. uint8_t *src, ptrdiff_t srcstride,
  33. int height, int mx, int my);
  34. void ff_put_vp8_epel4_h6_mmxext(uint8_t *dst, ptrdiff_t dststride,
  35. uint8_t *src, ptrdiff_t srcstride,
  36. int height, int mx, int my);
  37. void ff_put_vp8_epel4_v4_mmxext(uint8_t *dst, ptrdiff_t dststride,
  38. uint8_t *src, ptrdiff_t srcstride,
  39. int height, int mx, int my);
  40. void ff_put_vp8_epel4_v6_mmxext(uint8_t *dst, ptrdiff_t dststride,
  41. uint8_t *src, ptrdiff_t srcstride,
  42. int height, int mx, int my);
  43. void ff_put_vp8_epel8_h4_sse2 (uint8_t *dst, ptrdiff_t dststride,
  44. uint8_t *src, ptrdiff_t srcstride,
  45. int height, int mx, int my);
  46. void ff_put_vp8_epel8_h6_sse2 (uint8_t *dst, ptrdiff_t dststride,
  47. uint8_t *src, ptrdiff_t srcstride,
  48. int height, int mx, int my);
  49. void ff_put_vp8_epel8_v4_sse2 (uint8_t *dst, ptrdiff_t dststride,
  50. uint8_t *src, ptrdiff_t srcstride,
  51. int height, int mx, int my);
  52. void ff_put_vp8_epel8_v6_sse2 (uint8_t *dst, ptrdiff_t dststride,
  53. uint8_t *src, ptrdiff_t srcstride,
  54. int height, int mx, int my);
  55. void ff_put_vp8_epel4_h4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  56. uint8_t *src, ptrdiff_t srcstride,
  57. int height, int mx, int my);
  58. void ff_put_vp8_epel4_h6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  59. uint8_t *src, ptrdiff_t srcstride,
  60. int height, int mx, int my);
  61. void ff_put_vp8_epel4_v4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  62. uint8_t *src, ptrdiff_t srcstride,
  63. int height, int mx, int my);
  64. void ff_put_vp8_epel4_v6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  65. uint8_t *src, ptrdiff_t srcstride,
  66. int height, int mx, int my);
  67. void ff_put_vp8_epel8_h4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  68. uint8_t *src, ptrdiff_t srcstride,
  69. int height, int mx, int my);
  70. void ff_put_vp8_epel8_h6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  71. uint8_t *src, ptrdiff_t srcstride,
  72. int height, int mx, int my);
  73. void ff_put_vp8_epel8_v4_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  74. uint8_t *src, ptrdiff_t srcstride,
  75. int height, int mx, int my);
  76. void ff_put_vp8_epel8_v6_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  77. uint8_t *src, ptrdiff_t srcstride,
  78. int height, int mx, int my);
  79. void ff_put_vp8_bilinear4_h_mmxext(uint8_t *dst, ptrdiff_t dststride,
  80. uint8_t *src, ptrdiff_t srcstride,
  81. int height, int mx, int my);
  82. void ff_put_vp8_bilinear8_h_sse2 (uint8_t *dst, ptrdiff_t dststride,
  83. uint8_t *src, ptrdiff_t srcstride,
  84. int height, int mx, int my);
  85. void ff_put_vp8_bilinear4_h_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  86. uint8_t *src, ptrdiff_t srcstride,
  87. int height, int mx, int my);
  88. void ff_put_vp8_bilinear8_h_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  89. uint8_t *src, ptrdiff_t srcstride,
  90. int height, int mx, int my);
  91. void ff_put_vp8_bilinear4_v_mmxext(uint8_t *dst, ptrdiff_t dststride,
  92. uint8_t *src, ptrdiff_t srcstride,
  93. int height, int mx, int my);
  94. void ff_put_vp8_bilinear8_v_sse2 (uint8_t *dst, ptrdiff_t dststride,
  95. uint8_t *src, ptrdiff_t srcstride,
  96. int height, int mx, int my);
  97. void ff_put_vp8_bilinear4_v_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  98. uint8_t *src, ptrdiff_t srcstride,
  99. int height, int mx, int my);
  100. void ff_put_vp8_bilinear8_v_ssse3 (uint8_t *dst, ptrdiff_t dststride,
  101. uint8_t *src, ptrdiff_t srcstride,
  102. int height, int mx, int my);
  103. void ff_put_vp8_pixels8_mmx (uint8_t *dst, ptrdiff_t dststride,
  104. uint8_t *src, ptrdiff_t srcstride,
  105. int height, int mx, int my);
  106. void ff_put_vp8_pixels16_mmx(uint8_t *dst, ptrdiff_t dststride,
  107. uint8_t *src, ptrdiff_t srcstride,
  108. int height, int mx, int my);
  109. void ff_put_vp8_pixels16_sse(uint8_t *dst, ptrdiff_t dststride,
  110. uint8_t *src, ptrdiff_t srcstride,
  111. int height, int mx, int my);
  112. #define TAP_W16(OPT, FILTERTYPE, TAPTYPE) \
  113. static void ff_put_vp8_ ## FILTERTYPE ## 16_ ## TAPTYPE ## _ ## OPT( \
  114. uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
  115. ptrdiff_t srcstride, int height, int mx, int my) \
  116. { \
  117. ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
  118. dst, dststride, src, srcstride, height, mx, my); \
  119. ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
  120. dst + 8, dststride, src + 8, srcstride, height, mx, my); \
  121. }
  122. #define TAP_W8(OPT, FILTERTYPE, TAPTYPE) \
  123. static void ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \
  124. uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
  125. ptrdiff_t srcstride, int height, int mx, int my) \
  126. { \
  127. ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
  128. dst, dststride, src, srcstride, height, mx, my); \
  129. ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \
  130. dst + 4, dststride, src + 4, srcstride, height, mx, my); \
  131. }
  132. #if ARCH_X86_32
  133. TAP_W8 (mmxext, epel, h4)
  134. TAP_W8 (mmxext, epel, h6)
  135. TAP_W16(mmxext, epel, h6)
  136. TAP_W8 (mmxext, epel, v4)
  137. TAP_W8 (mmxext, epel, v6)
  138. TAP_W16(mmxext, epel, v6)
  139. TAP_W8 (mmxext, bilinear, h)
  140. TAP_W16(mmxext, bilinear, h)
  141. TAP_W8 (mmxext, bilinear, v)
  142. TAP_W16(mmxext, bilinear, v)
  143. #endif
  144. TAP_W16(sse2, epel, h6)
  145. TAP_W16(sse2, epel, v6)
  146. TAP_W16(sse2, bilinear, h)
  147. TAP_W16(sse2, bilinear, v)
  148. TAP_W16(ssse3, epel, h6)
  149. TAP_W16(ssse3, epel, v6)
  150. TAP_W16(ssse3, bilinear, h)
  151. TAP_W16(ssse3, bilinear, v)
  152. #define HVTAP(OPT, ALIGN, TAPNUMX, TAPNUMY, SIZE, MAXHEIGHT) \
  153. static void ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## v ## TAPNUMY ## _ ## OPT( \
  154. uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
  155. ptrdiff_t srcstride, int height, int mx, int my) \
  156. { \
  157. LOCAL_ALIGNED(ALIGN, uint8_t, tmp, [SIZE * (MAXHEIGHT + TAPNUMY - 1)]); \
  158. uint8_t *tmpptr = tmp + SIZE * (TAPNUMY / 2 - 1); \
  159. src -= srcstride * (TAPNUMY / 2 - 1); \
  160. ff_put_vp8_epel ## SIZE ## _h ## TAPNUMX ## _ ## OPT( \
  161. tmp, SIZE, src, srcstride, height + TAPNUMY - 1, mx, my); \
  162. ff_put_vp8_epel ## SIZE ## _v ## TAPNUMY ## _ ## OPT( \
  163. dst, dststride, tmpptr, SIZE, height, mx, my); \
  164. }
  165. #if ARCH_X86_32
  166. #define HVTAPMMX(x, y) \
  167. HVTAP(mmxext, 8, x, y, 4, 8) \
  168. HVTAP(mmxext, 8, x, y, 8, 16)
  169. HVTAP(mmxext, 8, 6, 6, 16, 16)
  170. #else
  171. #define HVTAPMMX(x, y) \
  172. HVTAP(mmxext, 8, x, y, 4, 8)
  173. #endif
  174. HVTAPMMX(4, 4)
  175. HVTAPMMX(4, 6)
  176. HVTAPMMX(6, 4)
  177. HVTAPMMX(6, 6)
  178. #define HVTAPSSE2(x, y, w) \
  179. HVTAP(sse2, 16, x, y, w, 16) \
  180. HVTAP(ssse3, 16, x, y, w, 16)
  181. HVTAPSSE2(4, 4, 8)
  182. HVTAPSSE2(4, 6, 8)
  183. HVTAPSSE2(6, 4, 8)
  184. HVTAPSSE2(6, 6, 8)
  185. HVTAPSSE2(6, 6, 16)
  186. HVTAP(ssse3, 16, 4, 4, 4, 8)
  187. HVTAP(ssse3, 16, 4, 6, 4, 8)
  188. HVTAP(ssse3, 16, 6, 4, 4, 8)
  189. HVTAP(ssse3, 16, 6, 6, 4, 8)
  190. #define HVBILIN(OPT, ALIGN, SIZE, MAXHEIGHT) \
  191. static void ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT( \
  192. uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \
  193. ptrdiff_t srcstride, int height, int mx, int my) \
  194. { \
  195. LOCAL_ALIGNED(ALIGN, uint8_t, tmp, [SIZE * (MAXHEIGHT + 2)]); \
  196. ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT( \
  197. tmp, SIZE, src, srcstride, height + 1, mx, my); \
  198. ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT( \
  199. dst, dststride, tmp, SIZE, height, mx, my); \
  200. }
  201. HVBILIN(mmxext, 8, 4, 8)
  202. #if ARCH_X86_32
  203. HVBILIN(mmxext, 8, 8, 16)
  204. HVBILIN(mmxext, 8, 16, 16)
  205. #endif
  206. HVBILIN(sse2, 8, 8, 16)
  207. HVBILIN(sse2, 8, 16, 16)
  208. HVBILIN(ssse3, 8, 4, 8)
  209. HVBILIN(ssse3, 8, 8, 16)
  210. HVBILIN(ssse3, 8, 16, 16)
  211. void ff_vp8_idct_dc_add_mmx(uint8_t *dst, int16_t block[16],
  212. ptrdiff_t stride);
  213. void ff_vp8_idct_dc_add_sse2(uint8_t *dst, int16_t block[16],
  214. ptrdiff_t stride);
  215. void ff_vp8_idct_dc_add_sse4(uint8_t *dst, int16_t block[16],
  216. ptrdiff_t stride);
  217. void ff_vp8_idct_dc_add4y_mmx(uint8_t *dst, int16_t block[4][16],
  218. ptrdiff_t stride);
  219. void ff_vp8_idct_dc_add4y_sse2(uint8_t *dst, int16_t block[4][16],
  220. ptrdiff_t stride);
  221. void ff_vp8_idct_dc_add4uv_mmx(uint8_t *dst, int16_t block[2][16],
  222. ptrdiff_t stride);
  223. void ff_vp8_luma_dc_wht_mmx(int16_t block[4][4][16], int16_t dc[16]);
  224. void ff_vp8_luma_dc_wht_sse(int16_t block[4][4][16], int16_t dc[16]);
  225. void ff_vp8_idct_add_mmx(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
  226. void ff_vp8_idct_add_sse(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
  227. #define DECLARE_LOOP_FILTER(NAME) \
  228. void ff_vp8_v_loop_filter_simple_ ## NAME(uint8_t *dst, \
  229. ptrdiff_t stride, \
  230. int flim); \
  231. void ff_vp8_h_loop_filter_simple_ ## NAME(uint8_t *dst, \
  232. ptrdiff_t stride, \
  233. int flim); \
  234. void ff_vp8_v_loop_filter16y_inner_ ## NAME (uint8_t *dst, \
  235. ptrdiff_t stride, \
  236. int e, int i, int hvt); \
  237. void ff_vp8_h_loop_filter16y_inner_ ## NAME (uint8_t *dst, \
  238. ptrdiff_t stride, \
  239. int e, int i, int hvt); \
  240. void ff_vp8_v_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, \
  241. uint8_t *dstV, \
  242. ptrdiff_t s, \
  243. int e, int i, int hvt); \
  244. void ff_vp8_h_loop_filter8uv_inner_ ## NAME (uint8_t *dstU, \
  245. uint8_t *dstV, \
  246. ptrdiff_t s, \
  247. int e, int i, int hvt); \
  248. void ff_vp8_v_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, \
  249. ptrdiff_t stride, \
  250. int e, int i, int hvt); \
  251. void ff_vp8_h_loop_filter16y_mbedge_ ## NAME(uint8_t *dst, \
  252. ptrdiff_t stride, \
  253. int e, int i, int hvt); \
  254. void ff_vp8_v_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, \
  255. uint8_t *dstV, \
  256. ptrdiff_t s, \
  257. int e, int i, int hvt); \
  258. void ff_vp8_h_loop_filter8uv_mbedge_ ## NAME(uint8_t *dstU, \
  259. uint8_t *dstV, \
  260. ptrdiff_t s, \
  261. int e, int i, int hvt);
  262. DECLARE_LOOP_FILTER(mmx)
  263. DECLARE_LOOP_FILTER(mmxext)
  264. DECLARE_LOOP_FILTER(sse2)
  265. DECLARE_LOOP_FILTER(ssse3)
  266. DECLARE_LOOP_FILTER(sse4)
  267. #endif /* HAVE_X86ASM */
  268. #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
  269. c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
  270. c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \
  271. c->put_vp8_epel_pixels_tab[IDX][2][2] = ff_put_vp8_epel ## SIZE ## _h6v6_ ## OPT
  272. #define VP8_MC_FUNC(IDX, SIZE, OPT) \
  273. c->put_vp8_epel_pixels_tab[IDX][0][1] = ff_put_vp8_epel ## SIZE ## _h4_ ## OPT; \
  274. c->put_vp8_epel_pixels_tab[IDX][1][0] = ff_put_vp8_epel ## SIZE ## _v4_ ## OPT; \
  275. c->put_vp8_epel_pixels_tab[IDX][1][1] = ff_put_vp8_epel ## SIZE ## _h4v4_ ## OPT; \
  276. c->put_vp8_epel_pixels_tab[IDX][1][2] = ff_put_vp8_epel ## SIZE ## _h6v4_ ## OPT; \
  277. c->put_vp8_epel_pixels_tab[IDX][2][1] = ff_put_vp8_epel ## SIZE ## _h4v6_ ## OPT; \
  278. VP8_LUMA_MC_FUNC(IDX, SIZE, OPT)
  279. #define VP8_BILINEAR_MC_FUNC(IDX, SIZE, OPT) \
  280. c->put_vp8_bilinear_pixels_tab[IDX][0][1] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
  281. c->put_vp8_bilinear_pixels_tab[IDX][0][2] = ff_put_vp8_bilinear ## SIZE ## _h_ ## OPT; \
  282. c->put_vp8_bilinear_pixels_tab[IDX][1][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
  283. c->put_vp8_bilinear_pixels_tab[IDX][1][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
  284. c->put_vp8_bilinear_pixels_tab[IDX][1][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
  285. c->put_vp8_bilinear_pixels_tab[IDX][2][0] = ff_put_vp8_bilinear ## SIZE ## _v_ ## OPT; \
  286. c->put_vp8_bilinear_pixels_tab[IDX][2][1] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT; \
  287. c->put_vp8_bilinear_pixels_tab[IDX][2][2] = ff_put_vp8_bilinear ## SIZE ## _hv_ ## OPT
  288. av_cold void ff_vp78dsp_init_x86(VP8DSPContext *c)
  289. {
  290. #if HAVE_X86ASM
  291. int cpu_flags = av_get_cpu_flags();
  292. if (EXTERNAL_MMX(cpu_flags)) {
  293. #if ARCH_X86_32
  294. c->put_vp8_epel_pixels_tab[0][0][0] =
  295. c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_mmx;
  296. #endif
  297. c->put_vp8_epel_pixels_tab[1][0][0] =
  298. c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx;
  299. }
  300. /* note that 4-tap width=16 functions are missing because w=16
  301. * is only used for luma, and luma is always a copy or sixtap. */
  302. if (EXTERNAL_MMXEXT(cpu_flags)) {
  303. VP8_MC_FUNC(2, 4, mmxext);
  304. VP8_BILINEAR_MC_FUNC(2, 4, mmxext);
  305. #if ARCH_X86_32
  306. VP8_LUMA_MC_FUNC(0, 16, mmxext);
  307. VP8_MC_FUNC(1, 8, mmxext);
  308. VP8_BILINEAR_MC_FUNC(0, 16, mmxext);
  309. VP8_BILINEAR_MC_FUNC(1, 8, mmxext);
  310. #endif
  311. }
  312. if (EXTERNAL_SSE(cpu_flags)) {
  313. c->put_vp8_epel_pixels_tab[0][0][0] =
  314. c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
  315. }
  316. if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags)) {
  317. VP8_LUMA_MC_FUNC(0, 16, sse2);
  318. VP8_MC_FUNC(1, 8, sse2);
  319. VP8_BILINEAR_MC_FUNC(0, 16, sse2);
  320. VP8_BILINEAR_MC_FUNC(1, 8, sse2);
  321. }
  322. if (EXTERNAL_SSSE3(cpu_flags)) {
  323. VP8_LUMA_MC_FUNC(0, 16, ssse3);
  324. VP8_MC_FUNC(1, 8, ssse3);
  325. VP8_MC_FUNC(2, 4, ssse3);
  326. VP8_BILINEAR_MC_FUNC(0, 16, ssse3);
  327. VP8_BILINEAR_MC_FUNC(1, 8, ssse3);
  328. VP8_BILINEAR_MC_FUNC(2, 4, ssse3);
  329. }
  330. #endif /* HAVE_X86ASM */
  331. }
  332. av_cold void ff_vp8dsp_init_x86(VP8DSPContext *c)
  333. {
  334. #if HAVE_X86ASM
  335. int cpu_flags = av_get_cpu_flags();
  336. if (EXTERNAL_MMX(cpu_flags)) {
  337. c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
  338. #if ARCH_X86_32
  339. c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
  340. c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
  341. c->vp8_idct_add = ff_vp8_idct_add_mmx;
  342. c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmx;
  343. c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmx;
  344. c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmx;
  345. c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmx;
  346. c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmx;
  347. c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmx;
  348. c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmx;
  349. c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmx;
  350. c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmx;
  351. c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmx;
  352. c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmx;
  353. #endif
  354. }
  355. /* note that 4-tap width=16 functions are missing because w=16
  356. * is only used for luma, and luma is always a copy or sixtap. */
  357. if (EXTERNAL_MMXEXT(cpu_flags)) {
  358. #if ARCH_X86_32
  359. c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_mmxext;
  360. c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_mmxext;
  361. c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_mmxext;
  362. c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_mmxext;
  363. c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_mmxext;
  364. c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_mmxext;
  365. c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_mmxext;
  366. c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_mmxext;
  367. c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_mmxext;
  368. c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_mmxext;
  369. #endif
  370. }
  371. if (EXTERNAL_SSE(cpu_flags)) {
  372. c->vp8_idct_add = ff_vp8_idct_add_sse;
  373. c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse;
  374. }
  375. if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags)) {
  376. c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2;
  377. c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2;
  378. c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_sse2;
  379. c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_sse2;
  380. c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_sse2;
  381. }
  382. if (EXTERNAL_SSE2(cpu_flags)) {
  383. c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse2;
  384. c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2;
  385. c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
  386. c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_sse2;
  387. c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_sse2;
  388. c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse2;
  389. c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse2;
  390. }
  391. if (EXTERNAL_SSSE3(cpu_flags)) {
  392. c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_ssse3;
  393. c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_ssse3;
  394. c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_ssse3;
  395. c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16y_inner_ssse3;
  396. c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_ssse3;
  397. c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_ssse3;
  398. c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16y_mbedge_ssse3;
  399. c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_ssse3;
  400. c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_mbedge_ssse3;
  401. c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_ssse3;
  402. }
  403. if (EXTERNAL_SSE4(cpu_flags)) {
  404. c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse4;
  405. c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse4;
  406. c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4;
  407. c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4;
  408. }
  409. #endif /* HAVE_X86ASM */
  410. }