You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

569 lines
16KB

  1. /*
  2. * MMX optimized forward DCT
  3. * The gcc porting is Copyright (c) 2001 Fabrice Bellard.
  4. * cleanup/optimizations are Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  5. * SSE2 optimization is Copyright (c) 2004 Denes Balatoni.
  6. *
  7. * from fdctam32.c - AP922 MMX(3D-Now) forward-DCT
  8. *
  9. * Intel Application Note AP-922 - fast, precise implementation of DCT
  10. * http://developer.intel.com/vtune/cbts/appnotes.htm
  11. *
  12. * Also of inspiration:
  13. * a page about fdct at http://www.geocities.com/ssavekar/dct.htm
  14. * Skal's fdct at http://skal.planet-d.net/coding/dct.html
  15. *
  16. * This file is part of FFmpeg.
  17. *
  18. * FFmpeg is free software; you can redistribute it and/or
  19. * modify it under the terms of the GNU Lesser General Public
  20. * License as published by the Free Software Foundation; either
  21. * version 2.1 of the License, or (at your option) any later version.
  22. *
  23. * FFmpeg is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. * Lesser General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU Lesser General Public
  29. * License along with FFmpeg; if not, write to the Free Software
  30. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  31. */
  32. #include "common.h"
  33. #include "../dsputil.h"
  34. #include "mmx.h"
  35. #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align)))
  36. //////////////////////////////////////////////////////////////////////
  37. //
  38. // constants for the forward DCT
  39. // -----------------------------
  40. //
  41. // Be sure to check that your compiler is aligning all constants to QWORD
  42. // (8-byte) memory boundaries! Otherwise the unaligned memory access will
  43. // severely stall MMX execution.
  44. //
  45. //////////////////////////////////////////////////////////////////////
  46. #define BITS_FRW_ACC 3 //; 2 or 3 for accuracy
  47. #define SHIFT_FRW_COL BITS_FRW_ACC
  48. #define SHIFT_FRW_ROW (BITS_FRW_ACC + 17 - 3)
  49. #define RND_FRW_ROW (1 << (SHIFT_FRW_ROW-1))
  50. //#define RND_FRW_COL (1 << (SHIFT_FRW_COL-1))
  51. #define X8(x) x,x,x,x,x,x,x,x
  52. //concatenated table, for forward DCT transformation
  53. static const int16_t fdct_tg_all_16[24] ATTR_ALIGN(16) = {
  54. X8(13036), // tg * (2<<16) + 0.5
  55. X8(27146), // tg * (2<<16) + 0.5
  56. X8(-21746) // tg * (2<<16) + 0.5
  57. };
  58. static const int16_t ocos_4_16[8] ATTR_ALIGN(16) = {
  59. X8(23170) //cos * (2<<15) + 0.5
  60. };
  61. static const int16_t fdct_one_corr[8] ATTR_ALIGN(16) = { X8(1) };
  62. static const int32_t fdct_r_row[2] ATTR_ALIGN(8) = {RND_FRW_ROW, RND_FRW_ROW };
  63. static struct
  64. {
  65. const int32_t fdct_r_row_sse2[4] ATTR_ALIGN(16);
  66. } fdct_r_row_sse2 ATTR_ALIGN(16)=
  67. {{
  68. RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW
  69. }};
  70. //static const long fdct_r_row_sse2[4] ATTR_ALIGN(16) = {RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW, RND_FRW_ROW};
  71. static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table
  72. 16384, 16384, 22725, 19266,
  73. 16384, 16384, 12873, 4520,
  74. 21407, 8867, 19266, -4520,
  75. -8867, -21407, -22725, -12873,
  76. 16384, -16384, 12873, -22725,
  77. -16384, 16384, 4520, 19266,
  78. 8867, -21407, 4520, -12873,
  79. 21407, -8867, 19266, -22725,
  80. 22725, 22725, 31521, 26722,
  81. 22725, 22725, 17855, 6270,
  82. 29692, 12299, 26722, -6270,
  83. -12299, -29692, -31521, -17855,
  84. 22725, -22725, 17855, -31521,
  85. -22725, 22725, 6270, 26722,
  86. 12299, -29692, 6270, -17855,
  87. 29692, -12299, 26722, -31521,
  88. 21407, 21407, 29692, 25172,
  89. 21407, 21407, 16819, 5906,
  90. 27969, 11585, 25172, -5906,
  91. -11585, -27969, -29692, -16819,
  92. 21407, -21407, 16819, -29692,
  93. -21407, 21407, 5906, 25172,
  94. 11585, -27969, 5906, -16819,
  95. 27969, -11585, 25172, -29692,
  96. 19266, 19266, 26722, 22654,
  97. 19266, 19266, 15137, 5315,
  98. 25172, 10426, 22654, -5315,
  99. -10426, -25172, -26722, -15137,
  100. 19266, -19266, 15137, -26722,
  101. -19266, 19266, 5315, 22654,
  102. 10426, -25172, 5315, -15137,
  103. 25172, -10426, 22654, -26722,
  104. 16384, 16384, 22725, 19266,
  105. 16384, 16384, 12873, 4520,
  106. 21407, 8867, 19266, -4520,
  107. -8867, -21407, -22725, -12873,
  108. 16384, -16384, 12873, -22725,
  109. -16384, 16384, 4520, 19266,
  110. 8867, -21407, 4520, -12873,
  111. 21407, -8867, 19266, -22725,
  112. 19266, 19266, 26722, 22654,
  113. 19266, 19266, 15137, 5315,
  114. 25172, 10426, 22654, -5315,
  115. -10426, -25172, -26722, -15137,
  116. 19266, -19266, 15137, -26722,
  117. -19266, 19266, 5315, 22654,
  118. 10426, -25172, 5315, -15137,
  119. 25172, -10426, 22654, -26722,
  120. 21407, 21407, 29692, 25172,
  121. 21407, 21407, 16819, 5906,
  122. 27969, 11585, 25172, -5906,
  123. -11585, -27969, -29692, -16819,
  124. 21407, -21407, 16819, -29692,
  125. -21407, 21407, 5906, 25172,
  126. 11585, -27969, 5906, -16819,
  127. 27969, -11585, 25172, -29692,
  128. 22725, 22725, 31521, 26722,
  129. 22725, 22725, 17855, 6270,
  130. 29692, 12299, 26722, -6270,
  131. -12299, -29692, -31521, -17855,
  132. 22725, -22725, 17855, -31521,
  133. -22725, 22725, 6270, 26722,
  134. 12299, -29692, 6270, -17855,
  135. 29692, -12299, 26722, -31521,
  136. };
  137. static struct
  138. {
  139. const int16_t tab_frw_01234567_sse2[256] ATTR_ALIGN(16);
  140. } tab_frw_01234567_sse2 ATTR_ALIGN(16) =
  141. {{
  142. //static const int16_t tab_frw_01234567_sse2[] ATTR_ALIGN(16) = { // forward_dct coeff table
  143. #define TABLE_SSE2 C4, C4, C1, C3, -C6, -C2, -C1, -C5, \
  144. C4, C4, C5, C7, C2, C6, C3, -C7, \
  145. -C4, C4, C7, C3, C6, -C2, C7, -C5, \
  146. C4, -C4, C5, -C1, C2, -C6, C3, -C1,
  147. // c1..c7 * cos(pi/4) * 2^15
  148. #define C1 22725
  149. #define C2 21407
  150. #define C3 19266
  151. #define C4 16384
  152. #define C5 12873
  153. #define C6 8867
  154. #define C7 4520
  155. TABLE_SSE2
  156. #undef C1
  157. #undef C2
  158. #undef C3
  159. #undef C4
  160. #undef C5
  161. #undef C6
  162. #undef C7
  163. #define C1 31521
  164. #define C2 29692
  165. #define C3 26722
  166. #define C4 22725
  167. #define C5 17855
  168. #define C6 12299
  169. #define C7 6270
  170. TABLE_SSE2
  171. #undef C1
  172. #undef C2
  173. #undef C3
  174. #undef C4
  175. #undef C5
  176. #undef C6
  177. #undef C7
  178. #define C1 29692
  179. #define C2 27969
  180. #define C3 25172
  181. #define C4 21407
  182. #define C5 16819
  183. #define C6 11585
  184. #define C7 5906
  185. TABLE_SSE2
  186. #undef C1
  187. #undef C2
  188. #undef C3
  189. #undef C4
  190. #undef C5
  191. #undef C6
  192. #undef C7
  193. #define C1 26722
  194. #define C2 25172
  195. #define C3 22654
  196. #define C4 19266
  197. #define C5 15137
  198. #define C6 10426
  199. #define C7 5315
  200. TABLE_SSE2
  201. #undef C1
  202. #undef C2
  203. #undef C3
  204. #undef C4
  205. #undef C5
  206. #undef C6
  207. #undef C7
  208. #define C1 22725
  209. #define C2 21407
  210. #define C3 19266
  211. #define C4 16384
  212. #define C5 12873
  213. #define C6 8867
  214. #define C7 4520
  215. TABLE_SSE2
  216. #undef C1
  217. #undef C2
  218. #undef C3
  219. #undef C4
  220. #undef C5
  221. #undef C6
  222. #undef C7
  223. #define C1 26722
  224. #define C2 25172
  225. #define C3 22654
  226. #define C4 19266
  227. #define C5 15137
  228. #define C6 10426
  229. #define C7 5315
  230. TABLE_SSE2
  231. #undef C1
  232. #undef C2
  233. #undef C3
  234. #undef C4
  235. #undef C5
  236. #undef C6
  237. #undef C7
  238. #define C1 29692
  239. #define C2 27969
  240. #define C3 25172
  241. #define C4 21407
  242. #define C5 16819
  243. #define C6 11585
  244. #define C7 5906
  245. TABLE_SSE2
  246. #undef C1
  247. #undef C2
  248. #undef C3
  249. #undef C4
  250. #undef C5
  251. #undef C6
  252. #undef C7
  253. #define C1 31521
  254. #define C2 29692
  255. #define C3 26722
  256. #define C4 22725
  257. #define C5 17855
  258. #define C6 12299
  259. #define C7 6270
  260. TABLE_SSE2
  261. }};
  262. #define FDCT_COL(cpu, mm, mov)\
  263. static av_always_inline void fdct_col_##cpu(const int16_t *in, int16_t *out, int offset)\
  264. {\
  265. mov##_m2r(*(in + offset + 1 * 8), mm##0);\
  266. mov##_m2r(*(in + offset + 6 * 8), mm##1);\
  267. mov##_r2r(mm##0, mm##2);\
  268. mov##_m2r(*(in + offset + 2 * 8), mm##3);\
  269. paddsw_r2r(mm##1, mm##0);\
  270. mov##_m2r(*(in + offset + 5 * 8), mm##4);\
  271. psllw_i2r(SHIFT_FRW_COL, mm##0);\
  272. mov##_m2r(*(in + offset + 0 * 8), mm##5);\
  273. paddsw_r2r(mm##3, mm##4);\
  274. paddsw_m2r(*(in + offset + 7 * 8), mm##5);\
  275. psllw_i2r(SHIFT_FRW_COL, mm##4);\
  276. mov##_r2r(mm##0, mm##6);\
  277. psubsw_r2r(mm##1, mm##2);\
  278. mov##_m2r(*(fdct_tg_all_16 + 8), mm##1);\
  279. psubsw_r2r(mm##4, mm##0);\
  280. mov##_m2r(*(in + offset + 3 * 8), mm##7);\
  281. pmulhw_r2r(mm##0, mm##1);\
  282. paddsw_m2r(*(in + offset + 4 * 8), mm##7);\
  283. psllw_i2r(SHIFT_FRW_COL, mm##5);\
  284. paddsw_r2r(mm##4, mm##6);\
  285. psllw_i2r(SHIFT_FRW_COL, mm##7);\
  286. mov##_r2r(mm##5, mm##4);\
  287. psubsw_r2r(mm##7, mm##5);\
  288. paddsw_r2r(mm##5, mm##1);\
  289. paddsw_r2r(mm##7, mm##4);\
  290. por_m2r(*fdct_one_corr, mm##1);\
  291. psllw_i2r(SHIFT_FRW_COL + 1, mm##2);\
  292. pmulhw_m2r(*(fdct_tg_all_16 + 8), mm##5);\
  293. mov##_r2r(mm##4, mm##7);\
  294. psubsw_m2r(*(in + offset + 5 * 8), mm##3);\
  295. psubsw_r2r(mm##6, mm##4);\
  296. mov##_r2m(mm##1, *(out + offset + 2 * 8));\
  297. paddsw_r2r(mm##6, mm##7);\
  298. mov##_m2r(*(in + offset + 3 * 8), mm##1);\
  299. psllw_i2r(SHIFT_FRW_COL + 1, mm##3);\
  300. psubsw_m2r(*(in + offset + 4 * 8), mm##1);\
  301. mov##_r2r(mm##2, mm##6);\
  302. mov##_r2m(mm##4, *(out + offset + 4 * 8));\
  303. paddsw_r2r(mm##3, mm##2);\
  304. pmulhw_m2r(*ocos_4_16, mm##2);\
  305. psubsw_r2r(mm##3, mm##6);\
  306. pmulhw_m2r(*ocos_4_16, mm##6);\
  307. psubsw_r2r(mm##0, mm##5);\
  308. por_m2r(*fdct_one_corr, mm##5);\
  309. psllw_i2r(SHIFT_FRW_COL, mm##1);\
  310. por_m2r(*fdct_one_corr, mm##2);\
  311. mov##_r2r(mm##1, mm##4);\
  312. mov##_m2r(*(in + offset + 0 * 8), mm##3);\
  313. paddsw_r2r(mm##6, mm##1);\
  314. psubsw_m2r(*(in + offset + 7 * 8), mm##3);\
  315. psubsw_r2r(mm##6, mm##4);\
  316. mov##_m2r(*(fdct_tg_all_16 + 0), mm##0);\
  317. psllw_i2r(SHIFT_FRW_COL, mm##3);\
  318. mov##_m2r(*(fdct_tg_all_16 + 16), mm##6);\
  319. pmulhw_r2r(mm##1, mm##0);\
  320. mov##_r2m(mm##7, *(out + offset + 0 * 8));\
  321. pmulhw_r2r(mm##4, mm##6);\
  322. mov##_r2m(mm##5, *(out + offset + 6 * 8));\
  323. mov##_r2r(mm##3, mm##7);\
  324. mov##_m2r(*(fdct_tg_all_16 + 16), mm##5);\
  325. psubsw_r2r(mm##2, mm##7);\
  326. paddsw_r2r(mm##2, mm##3);\
  327. pmulhw_r2r(mm##7, mm##5);\
  328. paddsw_r2r(mm##3, mm##0);\
  329. paddsw_r2r(mm##4, mm##6);\
  330. pmulhw_m2r(*(fdct_tg_all_16 + 0), mm##3);\
  331. por_m2r(*fdct_one_corr, mm##0);\
  332. paddsw_r2r(mm##7, mm##5);\
  333. psubsw_r2r(mm##6, mm##7);\
  334. mov##_r2m(mm##0, *(out + offset + 1 * 8));\
  335. paddsw_r2r(mm##4, mm##5);\
  336. mov##_r2m(mm##7, *(out + offset + 3 * 8));\
  337. psubsw_r2r(mm##1, mm##3);\
  338. mov##_r2m(mm##5, *(out + offset + 5 * 8));\
  339. mov##_r2m(mm##3, *(out + offset + 7 * 8));\
  340. }
  341. FDCT_COL(mmx, mm, movq)
  342. FDCT_COL(sse2, xmm, movdqa)
  343. static av_always_inline void fdct_row_sse2(const int16_t *in, int16_t *out)
  344. {
  345. asm volatile(
  346. #define FDCT_ROW_SSE2_H1(i,t) \
  347. "movq " #i "(%0), %%xmm2 \n\t" \
  348. "movq " #i "+8(%0), %%xmm0 \n\t" \
  349. "movdqa " #t "+32(%1), %%xmm3 \n\t" \
  350. "movdqa " #t "+48(%1), %%xmm7 \n\t" \
  351. "movdqa " #t "(%1), %%xmm4 \n\t" \
  352. "movdqa " #t "+16(%1), %%xmm5 \n\t"
  353. #define FDCT_ROW_SSE2_H2(i,t) \
  354. "movq " #i "(%0), %%xmm2 \n\t" \
  355. "movq " #i "+8(%0), %%xmm0 \n\t" \
  356. "movdqa " #t "+32(%1), %%xmm3 \n\t" \
  357. "movdqa " #t "+48(%1), %%xmm7 \n\t"
  358. #define FDCT_ROW_SSE2(i) \
  359. "movq %%xmm2, %%xmm1 \n\t" \
  360. "pshuflw $27, %%xmm0, %%xmm0 \n\t" \
  361. "paddsw %%xmm0, %%xmm1 \n\t" \
  362. "psubsw %%xmm0, %%xmm2 \n\t" \
  363. "punpckldq %%xmm2, %%xmm1 \n\t" \
  364. "pshufd $78, %%xmm1, %%xmm2 \n\t" \
  365. "pmaddwd %%xmm2, %%xmm3 \n\t" \
  366. "pmaddwd %%xmm1, %%xmm7 \n\t" \
  367. "pmaddwd %%xmm5, %%xmm2 \n\t" \
  368. "pmaddwd %%xmm4, %%xmm1 \n\t" \
  369. "paddd %%xmm7, %%xmm3 \n\t" \
  370. "paddd %%xmm2, %%xmm1 \n\t" \
  371. "paddd %%xmm6, %%xmm3 \n\t" \
  372. "paddd %%xmm6, %%xmm1 \n\t" \
  373. "psrad %3, %%xmm3 \n\t" \
  374. "psrad %3, %%xmm1 \n\t" \
  375. "packssdw %%xmm3, %%xmm1 \n\t" \
  376. "movdqa %%xmm1, " #i "(%4) \n\t"
  377. "movdqa (%2), %%xmm6 \n\t"
  378. FDCT_ROW_SSE2_H1(0,0)
  379. FDCT_ROW_SSE2(0)
  380. FDCT_ROW_SSE2_H2(64,0)
  381. FDCT_ROW_SSE2(64)
  382. FDCT_ROW_SSE2_H1(16,64)
  383. FDCT_ROW_SSE2(16)
  384. FDCT_ROW_SSE2_H2(112,64)
  385. FDCT_ROW_SSE2(112)
  386. FDCT_ROW_SSE2_H1(32,128)
  387. FDCT_ROW_SSE2(32)
  388. FDCT_ROW_SSE2_H2(96,128)
  389. FDCT_ROW_SSE2(96)
  390. FDCT_ROW_SSE2_H1(48,192)
  391. FDCT_ROW_SSE2(48)
  392. FDCT_ROW_SSE2_H2(80,192)
  393. FDCT_ROW_SSE2(80)
  394. :
  395. : "r" (in), "r" (tab_frw_01234567_sse2.tab_frw_01234567_sse2), "r" (fdct_r_row_sse2.fdct_r_row_sse2), "i" (SHIFT_FRW_ROW), "r" (out)
  396. );
  397. }
  398. static av_always_inline void fdct_row_mmx2(const int16_t *in, int16_t *out, const int16_t *table)
  399. {
  400. pshufw_m2r(*(in + 4), mm5, 0x1B);
  401. movq_m2r(*(in + 0), mm0);
  402. movq_r2r(mm0, mm1);
  403. paddsw_r2r(mm5, mm0);
  404. psubsw_r2r(mm5, mm1);
  405. movq_r2r(mm0, mm2);
  406. punpckldq_r2r(mm1, mm0);
  407. punpckhdq_r2r(mm1, mm2);
  408. movq_m2r(*(table + 0), mm1);
  409. movq_m2r(*(table + 4), mm3);
  410. movq_m2r(*(table + 8), mm4);
  411. movq_m2r(*(table + 12), mm5);
  412. movq_m2r(*(table + 16), mm6);
  413. movq_m2r(*(table + 20), mm7);
  414. pmaddwd_r2r(mm0, mm1);
  415. pmaddwd_r2r(mm2, mm3);
  416. pmaddwd_r2r(mm0, mm4);
  417. pmaddwd_r2r(mm2, mm5);
  418. pmaddwd_r2r(mm0, mm6);
  419. pmaddwd_r2r(mm2, mm7);
  420. pmaddwd_m2r(*(table + 24), mm0);
  421. pmaddwd_m2r(*(table + 28), mm2);
  422. paddd_r2r(mm1, mm3);
  423. paddd_r2r(mm4, mm5);
  424. paddd_r2r(mm6, mm7);
  425. paddd_r2r(mm0, mm2);
  426. movq_m2r(*fdct_r_row, mm0);
  427. paddd_r2r(mm0, mm3);
  428. paddd_r2r(mm0, mm5);
  429. paddd_r2r(mm0, mm7);
  430. paddd_r2r(mm0, mm2);
  431. psrad_i2r(SHIFT_FRW_ROW, mm3);
  432. psrad_i2r(SHIFT_FRW_ROW, mm5);
  433. psrad_i2r(SHIFT_FRW_ROW, mm7);
  434. psrad_i2r(SHIFT_FRW_ROW, mm2);
  435. packssdw_r2r(mm5, mm3);
  436. packssdw_r2r(mm2, mm7);
  437. movq_r2m(mm3, *(out + 0));
  438. movq_r2m(mm7, *(out + 4));
  439. }
  440. static av_always_inline void fdct_row_mmx(const int16_t *in, int16_t *out, const int16_t *table)
  441. {
  442. //FIXME reorder (i dont have a old mmx only cpu here to benchmark ...)
  443. movd_m2r(*(in + 6), mm1);
  444. punpcklwd_m2r(*(in + 4), mm1);
  445. movq_r2r(mm1, mm2);
  446. psrlq_i2r(0x20, mm1);
  447. movq_m2r(*(in + 0), mm0);
  448. punpcklwd_r2r(mm2, mm1);
  449. movq_r2r(mm0, mm5);
  450. paddsw_r2r(mm1, mm0);
  451. psubsw_r2r(mm1, mm5);
  452. movq_r2r(mm0, mm2);
  453. punpckldq_r2r(mm5, mm0);
  454. punpckhdq_r2r(mm5, mm2);
  455. movq_m2r(*(table + 0), mm1);
  456. movq_m2r(*(table + 4), mm3);
  457. movq_m2r(*(table + 8), mm4);
  458. movq_m2r(*(table + 12), mm5);
  459. movq_m2r(*(table + 16), mm6);
  460. movq_m2r(*(table + 20), mm7);
  461. pmaddwd_r2r(mm0, mm1);
  462. pmaddwd_r2r(mm2, mm3);
  463. pmaddwd_r2r(mm0, mm4);
  464. pmaddwd_r2r(mm2, mm5);
  465. pmaddwd_r2r(mm0, mm6);
  466. pmaddwd_r2r(mm2, mm7);
  467. pmaddwd_m2r(*(table + 24), mm0);
  468. pmaddwd_m2r(*(table + 28), mm2);
  469. paddd_r2r(mm1, mm3);
  470. paddd_r2r(mm4, mm5);
  471. paddd_r2r(mm6, mm7);
  472. paddd_r2r(mm0, mm2);
  473. movq_m2r(*fdct_r_row, mm0);
  474. paddd_r2r(mm0, mm3);
  475. paddd_r2r(mm0, mm5);
  476. paddd_r2r(mm0, mm7);
  477. paddd_r2r(mm0, mm2);
  478. psrad_i2r(SHIFT_FRW_ROW, mm3);
  479. psrad_i2r(SHIFT_FRW_ROW, mm5);
  480. psrad_i2r(SHIFT_FRW_ROW, mm7);
  481. psrad_i2r(SHIFT_FRW_ROW, mm2);
  482. packssdw_r2r(mm5, mm3);
  483. packssdw_r2r(mm2, mm7);
  484. movq_r2m(mm3, *(out + 0));
  485. movq_r2m(mm7, *(out + 4));
  486. }
  487. void ff_fdct_mmx(int16_t *block)
  488. {
  489. int64_t align_tmp[16] ATTR_ALIGN(8);
  490. int16_t * block1= (int16_t*)align_tmp;
  491. const int16_t *table= tab_frw_01234567;
  492. int i;
  493. fdct_col_mmx(block, block1, 0);
  494. fdct_col_mmx(block, block1, 4);
  495. for(i=8;i>0;i--) {
  496. fdct_row_mmx(block1, block, table);
  497. block1 += 8;
  498. table += 32;
  499. block += 8;
  500. }
  501. }
  502. void ff_fdct_mmx2(int16_t *block)
  503. {
  504. int64_t align_tmp[16] ATTR_ALIGN(8);
  505. int16_t *block1= (int16_t*)align_tmp;
  506. const int16_t *table= tab_frw_01234567;
  507. int i;
  508. fdct_col_mmx(block, block1, 0);
  509. fdct_col_mmx(block, block1, 4);
  510. for(i=8;i>0;i--) {
  511. fdct_row_mmx2(block1, block, table);
  512. block1 += 8;
  513. table += 32;
  514. block += 8;
  515. }
  516. }
  517. void ff_fdct_sse2(int16_t *block)
  518. {
  519. int64_t align_tmp[16] ATTR_ALIGN(16);
  520. int16_t * const block1= (int16_t*)align_tmp;
  521. fdct_col_sse2(block, block1, 0);
  522. fdct_row_sse2(block1, block);
  523. }