idct16x16_msa.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. /*
  2. * Copyright (c) 2015 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include "./vpx_dsp_rtcd.h"
  11. #include "vpx_dsp/mips/inv_txfm_msa.h"
  12. void vpx_idct16_1d_rows_msa(const int16_t *input, int16_t *output) {
  13. v8i16 loc0, loc1, loc2, loc3;
  14. v8i16 reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14;
  15. v8i16 reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15;
  16. v8i16 tmp5, tmp6, tmp7;
  17. LD_SH8(input, 16, reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7);
  18. input += 8;
  19. LD_SH8(input, 16, reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15);
  20. TRANSPOSE8x8_SH_SH(reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7, reg0, reg1,
  21. reg2, reg3, reg4, reg5, reg6, reg7);
  22. TRANSPOSE8x8_SH_SH(reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15, reg8,
  23. reg9, reg10, reg11, reg12, reg13, reg14, reg15);
  24. DOTP_CONST_PAIR(reg2, reg14, cospi_28_64, cospi_4_64, reg2, reg14);
  25. DOTP_CONST_PAIR(reg10, reg6, cospi_12_64, cospi_20_64, reg10, reg6);
  26. BUTTERFLY_4(reg2, reg14, reg6, reg10, loc0, loc1, reg14, reg2);
  27. DOTP_CONST_PAIR(reg14, reg2, cospi_16_64, cospi_16_64, loc2, loc3);
  28. DOTP_CONST_PAIR(reg0, reg8, cospi_16_64, cospi_16_64, reg0, reg8);
  29. DOTP_CONST_PAIR(reg4, reg12, cospi_24_64, cospi_8_64, reg4, reg12);
  30. BUTTERFLY_4(reg8, reg0, reg4, reg12, reg2, reg6, reg10, reg14);
  31. SUB4(reg2, loc1, reg14, loc0, reg6, loc3, reg10, loc2, reg0, reg12, reg4,
  32. reg8);
  33. ADD4(reg2, loc1, reg14, loc0, reg6, loc3, reg10, loc2, reg2, reg14, reg6,
  34. reg10);
  35. /* stage 2 */
  36. DOTP_CONST_PAIR(reg1, reg15, cospi_30_64, cospi_2_64, reg1, reg15);
  37. DOTP_CONST_PAIR(reg9, reg7, cospi_14_64, cospi_18_64, loc2, loc3);
  38. reg9 = reg1 - loc2;
  39. reg1 = reg1 + loc2;
  40. reg7 = reg15 - loc3;
  41. reg15 = reg15 + loc3;
  42. DOTP_CONST_PAIR(reg5, reg11, cospi_22_64, cospi_10_64, reg5, reg11);
  43. DOTP_CONST_PAIR(reg13, reg3, cospi_6_64, cospi_26_64, loc0, loc1);
  44. BUTTERFLY_4(loc0, loc1, reg11, reg5, reg13, reg3, reg11, reg5);
  45. loc1 = reg15 + reg3;
  46. reg3 = reg15 - reg3;
  47. loc2 = reg2 + loc1;
  48. reg15 = reg2 - loc1;
  49. loc1 = reg1 + reg13;
  50. reg13 = reg1 - reg13;
  51. loc0 = reg0 + loc1;
  52. loc1 = reg0 - loc1;
  53. tmp6 = loc0;
  54. tmp7 = loc1;
  55. reg0 = loc2;
  56. DOTP_CONST_PAIR(reg7, reg9, cospi_24_64, cospi_8_64, reg7, reg9);
  57. DOTP_CONST_PAIR((-reg5), (-reg11), cospi_8_64, cospi_24_64, reg5, reg11);
  58. loc0 = reg9 + reg5;
  59. reg5 = reg9 - reg5;
  60. reg2 = reg6 + loc0;
  61. reg1 = reg6 - loc0;
  62. loc0 = reg7 + reg11;
  63. reg11 = reg7 - reg11;
  64. loc1 = reg4 + loc0;
  65. loc2 = reg4 - loc0;
  66. tmp5 = loc1;
  67. DOTP_CONST_PAIR(reg5, reg11, cospi_16_64, cospi_16_64, reg5, reg11);
  68. BUTTERFLY_4(reg8, reg10, reg11, reg5, loc0, reg4, reg9, loc1);
  69. reg10 = loc0;
  70. reg11 = loc1;
  71. DOTP_CONST_PAIR(reg3, reg13, cospi_16_64, cospi_16_64, reg3, reg13);
  72. BUTTERFLY_4(reg12, reg14, reg13, reg3, reg8, reg6, reg7, reg5);
  73. reg13 = loc2;
  74. /* Transpose and store the output */
  75. reg12 = tmp5;
  76. reg14 = tmp6;
  77. reg3 = tmp7;
  78. /* transpose block */
  79. TRANSPOSE8x8_SH_SH(reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14, reg0,
  80. reg2, reg4, reg6, reg8, reg10, reg12, reg14);
  81. ST_SH8(reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14, output, 16);
  82. /* transpose block */
  83. TRANSPOSE8x8_SH_SH(reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15, reg3,
  84. reg13, reg11, reg5, reg7, reg9, reg1, reg15);
  85. ST_SH8(reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15, (output + 8), 16);
  86. }
  87. void vpx_idct16_1d_columns_addblk_msa(int16_t *input, uint8_t *dst,
  88. int32_t dst_stride) {
  89. v8i16 loc0, loc1, loc2, loc3;
  90. v8i16 reg0, reg2, reg4, reg6, reg8, reg10, reg12, reg14;
  91. v8i16 reg3, reg13, reg11, reg5, reg7, reg9, reg1, reg15;
  92. v8i16 tmp5, tmp6, tmp7;
  93. /* load up 8x8 */
  94. LD_SH8(input, 16, reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7);
  95. input += 8 * 16;
  96. /* load bottom 8x8 */
  97. LD_SH8(input, 16, reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15);
  98. DOTP_CONST_PAIR(reg2, reg14, cospi_28_64, cospi_4_64, reg2, reg14);
  99. DOTP_CONST_PAIR(reg10, reg6, cospi_12_64, cospi_20_64, reg10, reg6);
  100. BUTTERFLY_4(reg2, reg14, reg6, reg10, loc0, loc1, reg14, reg2);
  101. DOTP_CONST_PAIR(reg14, reg2, cospi_16_64, cospi_16_64, loc2, loc3);
  102. DOTP_CONST_PAIR(reg0, reg8, cospi_16_64, cospi_16_64, reg0, reg8);
  103. DOTP_CONST_PAIR(reg4, reg12, cospi_24_64, cospi_8_64, reg4, reg12);
  104. BUTTERFLY_4(reg8, reg0, reg4, reg12, reg2, reg6, reg10, reg14);
  105. reg0 = reg2 - loc1;
  106. reg2 = reg2 + loc1;
  107. reg12 = reg14 - loc0;
  108. reg14 = reg14 + loc0;
  109. reg4 = reg6 - loc3;
  110. reg6 = reg6 + loc3;
  111. reg8 = reg10 - loc2;
  112. reg10 = reg10 + loc2;
  113. /* stage 2 */
  114. DOTP_CONST_PAIR(reg1, reg15, cospi_30_64, cospi_2_64, reg1, reg15);
  115. DOTP_CONST_PAIR(reg9, reg7, cospi_14_64, cospi_18_64, loc2, loc3);
  116. reg9 = reg1 - loc2;
  117. reg1 = reg1 + loc2;
  118. reg7 = reg15 - loc3;
  119. reg15 = reg15 + loc3;
  120. DOTP_CONST_PAIR(reg5, reg11, cospi_22_64, cospi_10_64, reg5, reg11);
  121. DOTP_CONST_PAIR(reg13, reg3, cospi_6_64, cospi_26_64, loc0, loc1);
  122. BUTTERFLY_4(loc0, loc1, reg11, reg5, reg13, reg3, reg11, reg5);
  123. loc1 = reg15 + reg3;
  124. reg3 = reg15 - reg3;
  125. loc2 = reg2 + loc1;
  126. reg15 = reg2 - loc1;
  127. loc1 = reg1 + reg13;
  128. reg13 = reg1 - reg13;
  129. loc0 = reg0 + loc1;
  130. loc1 = reg0 - loc1;
  131. tmp6 = loc0;
  132. tmp7 = loc1;
  133. reg0 = loc2;
  134. DOTP_CONST_PAIR(reg7, reg9, cospi_24_64, cospi_8_64, reg7, reg9);
  135. DOTP_CONST_PAIR((-reg5), (-reg11), cospi_8_64, cospi_24_64, reg5, reg11);
  136. loc0 = reg9 + reg5;
  137. reg5 = reg9 - reg5;
  138. reg2 = reg6 + loc0;
  139. reg1 = reg6 - loc0;
  140. loc0 = reg7 + reg11;
  141. reg11 = reg7 - reg11;
  142. loc1 = reg4 + loc0;
  143. loc2 = reg4 - loc0;
  144. tmp5 = loc1;
  145. DOTP_CONST_PAIR(reg5, reg11, cospi_16_64, cospi_16_64, reg5, reg11);
  146. BUTTERFLY_4(reg8, reg10, reg11, reg5, loc0, reg4, reg9, loc1);
  147. reg10 = loc0;
  148. reg11 = loc1;
  149. DOTP_CONST_PAIR(reg3, reg13, cospi_16_64, cospi_16_64, reg3, reg13);
  150. BUTTERFLY_4(reg12, reg14, reg13, reg3, reg8, reg6, reg7, reg5);
  151. reg13 = loc2;
  152. /* Transpose and store the output */
  153. reg12 = tmp5;
  154. reg14 = tmp6;
  155. reg3 = tmp7;
  156. SRARI_H4_SH(reg0, reg2, reg4, reg6, 6);
  157. VP9_ADDBLK_ST8x4_UB(dst, dst_stride, reg0, reg2, reg4, reg6);
  158. dst += (4 * dst_stride);
  159. SRARI_H4_SH(reg8, reg10, reg12, reg14, 6);
  160. VP9_ADDBLK_ST8x4_UB(dst, dst_stride, reg8, reg10, reg12, reg14);
  161. dst += (4 * dst_stride);
  162. SRARI_H4_SH(reg3, reg13, reg11, reg5, 6);
  163. VP9_ADDBLK_ST8x4_UB(dst, dst_stride, reg3, reg13, reg11, reg5);
  164. dst += (4 * dst_stride);
  165. SRARI_H4_SH(reg7, reg9, reg1, reg15, 6);
  166. VP9_ADDBLK_ST8x4_UB(dst, dst_stride, reg7, reg9, reg1, reg15);
  167. }
  168. void vpx_idct16x16_256_add_msa(const int16_t *input, uint8_t *dst,
  169. int32_t dst_stride) {
  170. int32_t i;
  171. DECLARE_ALIGNED(32, int16_t, out_arr[16 * 16]);
  172. int16_t *out = out_arr;
  173. /* transform rows */
  174. for (i = 0; i < 2; ++i) {
  175. /* process 16 * 8 block */
  176. vpx_idct16_1d_rows_msa((input + (i << 7)), (out + (i << 7)));
  177. }
  178. /* transform columns */
  179. for (i = 0; i < 2; ++i) {
  180. /* process 8 * 16 block */
  181. vpx_idct16_1d_columns_addblk_msa((out + (i << 3)), (dst + (i << 3)),
  182. dst_stride);
  183. }
  184. }
  185. void vpx_idct16x16_10_add_msa(const int16_t *input, uint8_t *dst,
  186. int32_t dst_stride) {
  187. uint8_t i;
  188. DECLARE_ALIGNED(32, int16_t, out_arr[16 * 16]);
  189. int16_t *out = out_arr;
  190. /* process 16 * 8 block */
  191. vpx_idct16_1d_rows_msa(input, out);
  192. /* short case just considers top 4 rows as valid output */
  193. out += 4 * 16;
  194. for (i = 12; i--;) {
  195. __asm__ __volatile__(
  196. "sw $zero, 0(%[out]) \n\t"
  197. "sw $zero, 4(%[out]) \n\t"
  198. "sw $zero, 8(%[out]) \n\t"
  199. "sw $zero, 12(%[out]) \n\t"
  200. "sw $zero, 16(%[out]) \n\t"
  201. "sw $zero, 20(%[out]) \n\t"
  202. "sw $zero, 24(%[out]) \n\t"
  203. "sw $zero, 28(%[out]) \n\t"
  204. :
  205. : [out] "r"(out));
  206. out += 16;
  207. }
  208. out = out_arr;
  209. /* transform columns */
  210. for (i = 0; i < 2; ++i) {
  211. /* process 8 * 16 block */
  212. vpx_idct16_1d_columns_addblk_msa((out + (i << 3)), (dst + (i << 3)),
  213. dst_stride);
  214. }
  215. }
  216. void vpx_idct16x16_1_add_msa(const int16_t *input, uint8_t *dst,
  217. int32_t dst_stride) {
  218. uint8_t i;
  219. int16_t out;
  220. v8i16 vec, res0, res1, res2, res3, res4, res5, res6, res7;
  221. v16u8 dst0, dst1, dst2, dst3, tmp0, tmp1, tmp2, tmp3;
  222. out = ROUND_POWER_OF_TWO((input[0] * cospi_16_64), DCT_CONST_BITS);
  223. out = ROUND_POWER_OF_TWO((out * cospi_16_64), DCT_CONST_BITS);
  224. out = ROUND_POWER_OF_TWO(out, 6);
  225. vec = __msa_fill_h(out);
  226. for (i = 4; i--;) {
  227. LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
  228. UNPCK_UB_SH(dst0, res0, res4);
  229. UNPCK_UB_SH(dst1, res1, res5);
  230. UNPCK_UB_SH(dst2, res2, res6);
  231. UNPCK_UB_SH(dst3, res3, res7);
  232. ADD4(res0, vec, res1, vec, res2, vec, res3, vec, res0, res1, res2, res3);
  233. ADD4(res4, vec, res5, vec, res6, vec, res7, vec, res4, res5, res6, res7);
  234. CLIP_SH4_0_255(res0, res1, res2, res3);
  235. CLIP_SH4_0_255(res4, res5, res6, res7);
  236. PCKEV_B4_UB(res4, res0, res5, res1, res6, res2, res7, res3, tmp0, tmp1,
  237. tmp2, tmp3);
  238. ST_UB4(tmp0, tmp1, tmp2, tmp3, dst, dst_stride);
  239. dst += (4 * dst_stride);
  240. }
  241. }
  242. void vpx_iadst16_1d_rows_msa(const int16_t *input, int16_t *output) {
  243. v8i16 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
  244. v8i16 l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15;
  245. /* load input data */
  246. LD_SH16(input, 8, l0, l8, l1, l9, l2, l10, l3, l11, l4, l12, l5, l13, l6, l14,
  247. l7, l15);
  248. TRANSPOSE8x8_SH_SH(l0, l1, l2, l3, l4, l5, l6, l7, l0, l1, l2, l3, l4, l5, l6,
  249. l7);
  250. TRANSPOSE8x8_SH_SH(l8, l9, l10, l11, l12, l13, l14, l15, l8, l9, l10, l11,
  251. l12, l13, l14, l15);
  252. /* ADST in horizontal */
  253. VP9_IADST8x16_1D(l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
  254. l14, l15, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11,
  255. r12, r13, r14, r15);
  256. l1 = -r8;
  257. l3 = -r4;
  258. l13 = -r13;
  259. l15 = -r1;
  260. TRANSPOSE8x8_SH_SH(r0, l1, r12, l3, r6, r14, r10, r2, l0, l1, l2, l3, l4, l5,
  261. l6, l7);
  262. ST_SH8(l0, l1, l2, l3, l4, l5, l6, l7, output, 16);
  263. TRANSPOSE8x8_SH_SH(r3, r11, r15, r7, r5, l13, r9, l15, l8, l9, l10, l11, l12,
  264. l13, l14, l15);
  265. ST_SH8(l8, l9, l10, l11, l12, l13, l14, l15, (output + 8), 16);
  266. }
  267. void vpx_iadst16_1d_columns_addblk_msa(int16_t *input, uint8_t *dst,
  268. int32_t dst_stride) {
  269. v8i16 v0, v2, v4, v6, k0, k1, k2, k3;
  270. v8i16 r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
  271. v8i16 out0, out1, out2, out3, out4, out5, out6, out7;
  272. v8i16 out8, out9, out10, out11, out12, out13, out14, out15;
  273. v8i16 g0, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13, g14, g15;
  274. v8i16 h0, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11;
  275. v8i16 res0, res1, res2, res3, res4, res5, res6, res7;
  276. v8i16 res8, res9, res10, res11, res12, res13, res14, res15;
  277. v16u8 dst0, dst1, dst2, dst3, dst4, dst5, dst6, dst7;
  278. v16u8 dst8, dst9, dst10, dst11, dst12, dst13, dst14, dst15;
  279. v16i8 zero = { 0 };
  280. r0 = LD_SH(input + 0 * 16);
  281. r3 = LD_SH(input + 3 * 16);
  282. r4 = LD_SH(input + 4 * 16);
  283. r7 = LD_SH(input + 7 * 16);
  284. r8 = LD_SH(input + 8 * 16);
  285. r11 = LD_SH(input + 11 * 16);
  286. r12 = LD_SH(input + 12 * 16);
  287. r15 = LD_SH(input + 15 * 16);
  288. /* stage 1 */
  289. k0 = VP9_SET_COSPI_PAIR(cospi_1_64, cospi_31_64);
  290. k1 = VP9_SET_COSPI_PAIR(cospi_31_64, -cospi_1_64);
  291. k2 = VP9_SET_COSPI_PAIR(cospi_17_64, cospi_15_64);
  292. k3 = VP9_SET_COSPI_PAIR(cospi_15_64, -cospi_17_64);
  293. MADD_BF(r15, r0, r7, r8, k0, k1, k2, k3, g0, g1, g2, g3);
  294. k0 = VP9_SET_COSPI_PAIR(cospi_9_64, cospi_23_64);
  295. k1 = VP9_SET_COSPI_PAIR(cospi_23_64, -cospi_9_64);
  296. k2 = VP9_SET_COSPI_PAIR(cospi_25_64, cospi_7_64);
  297. k3 = VP9_SET_COSPI_PAIR(cospi_7_64, -cospi_25_64);
  298. MADD_BF(r11, r4, r3, r12, k0, k1, k2, k3, g8, g9, g10, g11);
  299. BUTTERFLY_4(g0, g2, g10, g8, h8, h9, v2, v0);
  300. k0 = VP9_SET_COSPI_PAIR(cospi_4_64, cospi_28_64);
  301. k1 = VP9_SET_COSPI_PAIR(cospi_28_64, -cospi_4_64);
  302. k2 = VP9_SET_COSPI_PAIR(-cospi_28_64, cospi_4_64);
  303. MADD_BF(g1, g3, g9, g11, k0, k1, k2, k0, h0, h1, h2, h3);
  304. r1 = LD_SH(input + 1 * 16);
  305. r2 = LD_SH(input + 2 * 16);
  306. r5 = LD_SH(input + 5 * 16);
  307. r6 = LD_SH(input + 6 * 16);
  308. r9 = LD_SH(input + 9 * 16);
  309. r10 = LD_SH(input + 10 * 16);
  310. r13 = LD_SH(input + 13 * 16);
  311. r14 = LD_SH(input + 14 * 16);
  312. k0 = VP9_SET_COSPI_PAIR(cospi_5_64, cospi_27_64);
  313. k1 = VP9_SET_COSPI_PAIR(cospi_27_64, -cospi_5_64);
  314. k2 = VP9_SET_COSPI_PAIR(cospi_21_64, cospi_11_64);
  315. k3 = VP9_SET_COSPI_PAIR(cospi_11_64, -cospi_21_64);
  316. MADD_BF(r13, r2, r5, r10, k0, k1, k2, k3, g4, g5, g6, g7);
  317. k0 = VP9_SET_COSPI_PAIR(cospi_13_64, cospi_19_64);
  318. k1 = VP9_SET_COSPI_PAIR(cospi_19_64, -cospi_13_64);
  319. k2 = VP9_SET_COSPI_PAIR(cospi_29_64, cospi_3_64);
  320. k3 = VP9_SET_COSPI_PAIR(cospi_3_64, -cospi_29_64);
  321. MADD_BF(r9, r6, r1, r14, k0, k1, k2, k3, g12, g13, g14, g15);
  322. BUTTERFLY_4(g4, g6, g14, g12, h10, h11, v6, v4);
  323. BUTTERFLY_4(h8, h9, h11, h10, out0, out1, h11, h10);
  324. out1 = -out1;
  325. SRARI_H2_SH(out0, out1, 6);
  326. dst0 = LD_UB(dst + 0 * dst_stride);
  327. dst1 = LD_UB(dst + 15 * dst_stride);
  328. ILVR_B2_SH(zero, dst0, zero, dst1, res0, res1);
  329. ADD2(res0, out0, res1, out1, res0, res1);
  330. CLIP_SH2_0_255(res0, res1);
  331. PCKEV_B2_SH(res0, res0, res1, res1, res0, res1);
  332. ST8x1_UB(res0, dst);
  333. ST8x1_UB(res1, dst + 15 * dst_stride);
  334. k0 = VP9_SET_COSPI_PAIR(cospi_12_64, cospi_20_64);
  335. k1 = VP9_SET_COSPI_PAIR(-cospi_20_64, cospi_12_64);
  336. k2 = VP9_SET_COSPI_PAIR(cospi_20_64, -cospi_12_64);
  337. MADD_BF(g7, g5, g15, g13, k0, k1, k2, k0, h4, h5, h6, h7);
  338. BUTTERFLY_4(h0, h2, h6, h4, out8, out9, out11, out10);
  339. out8 = -out8;
  340. SRARI_H2_SH(out8, out9, 6);
  341. dst8 = LD_UB(dst + 1 * dst_stride);
  342. dst9 = LD_UB(dst + 14 * dst_stride);
  343. ILVR_B2_SH(zero, dst8, zero, dst9, res8, res9);
  344. ADD2(res8, out8, res9, out9, res8, res9);
  345. CLIP_SH2_0_255(res8, res9);
  346. PCKEV_B2_SH(res8, res8, res9, res9, res8, res9);
  347. ST8x1_UB(res8, dst + dst_stride);
  348. ST8x1_UB(res9, dst + 14 * dst_stride);
  349. k0 = VP9_SET_COSPI_PAIR(cospi_8_64, cospi_24_64);
  350. k1 = VP9_SET_COSPI_PAIR(cospi_24_64, -cospi_8_64);
  351. k2 = VP9_SET_COSPI_PAIR(-cospi_24_64, cospi_8_64);
  352. MADD_BF(v0, v2, v4, v6, k0, k1, k2, k0, out4, out6, out5, out7);
  353. out4 = -out4;
  354. SRARI_H2_SH(out4, out5, 6);
  355. dst4 = LD_UB(dst + 3 * dst_stride);
  356. dst5 = LD_UB(dst + 12 * dst_stride);
  357. ILVR_B2_SH(zero, dst4, zero, dst5, res4, res5);
  358. ADD2(res4, out4, res5, out5, res4, res5);
  359. CLIP_SH2_0_255(res4, res5);
  360. PCKEV_B2_SH(res4, res4, res5, res5, res4, res5);
  361. ST8x1_UB(res4, dst + 3 * dst_stride);
  362. ST8x1_UB(res5, dst + 12 * dst_stride);
  363. MADD_BF(h1, h3, h5, h7, k0, k1, k2, k0, out12, out14, out13, out15);
  364. out13 = -out13;
  365. SRARI_H2_SH(out12, out13, 6);
  366. dst12 = LD_UB(dst + 2 * dst_stride);
  367. dst13 = LD_UB(dst + 13 * dst_stride);
  368. ILVR_B2_SH(zero, dst12, zero, dst13, res12, res13);
  369. ADD2(res12, out12, res13, out13, res12, res13);
  370. CLIP_SH2_0_255(res12, res13);
  371. PCKEV_B2_SH(res12, res12, res13, res13, res12, res13);
  372. ST8x1_UB(res12, dst + 2 * dst_stride);
  373. ST8x1_UB(res13, dst + 13 * dst_stride);
  374. k0 = VP9_SET_COSPI_PAIR(cospi_16_64, cospi_16_64);
  375. k3 = VP9_SET_COSPI_PAIR(-cospi_16_64, cospi_16_64);
  376. MADD_SHORT(out6, out7, k0, k3, out6, out7);
  377. SRARI_H2_SH(out6, out7, 6);
  378. dst6 = LD_UB(dst + 4 * dst_stride);
  379. dst7 = LD_UB(dst + 11 * dst_stride);
  380. ILVR_B2_SH(zero, dst6, zero, dst7, res6, res7);
  381. ADD2(res6, out6, res7, out7, res6, res7);
  382. CLIP_SH2_0_255(res6, res7);
  383. PCKEV_B2_SH(res6, res6, res7, res7, res6, res7);
  384. ST8x1_UB(res6, dst + 4 * dst_stride);
  385. ST8x1_UB(res7, dst + 11 * dst_stride);
  386. MADD_SHORT(out10, out11, k0, k3, out10, out11);
  387. SRARI_H2_SH(out10, out11, 6);
  388. dst10 = LD_UB(dst + 6 * dst_stride);
  389. dst11 = LD_UB(dst + 9 * dst_stride);
  390. ILVR_B2_SH(zero, dst10, zero, dst11, res10, res11);
  391. ADD2(res10, out10, res11, out11, res10, res11);
  392. CLIP_SH2_0_255(res10, res11);
  393. PCKEV_B2_SH(res10, res10, res11, res11, res10, res11);
  394. ST8x1_UB(res10, dst + 6 * dst_stride);
  395. ST8x1_UB(res11, dst + 9 * dst_stride);
  396. k1 = VP9_SET_COSPI_PAIR(-cospi_16_64, -cospi_16_64);
  397. k2 = VP9_SET_COSPI_PAIR(cospi_16_64, -cospi_16_64);
  398. MADD_SHORT(h10, h11, k1, k2, out2, out3);
  399. SRARI_H2_SH(out2, out3, 6);
  400. dst2 = LD_UB(dst + 7 * dst_stride);
  401. dst3 = LD_UB(dst + 8 * dst_stride);
  402. ILVR_B2_SH(zero, dst2, zero, dst3, res2, res3);
  403. ADD2(res2, out2, res3, out3, res2, res3);
  404. CLIP_SH2_0_255(res2, res3);
  405. PCKEV_B2_SH(res2, res2, res3, res3, res2, res3);
  406. ST8x1_UB(res2, dst + 7 * dst_stride);
  407. ST8x1_UB(res3, dst + 8 * dst_stride);
  408. MADD_SHORT(out14, out15, k1, k2, out14, out15);
  409. SRARI_H2_SH(out14, out15, 6);
  410. dst14 = LD_UB(dst + 5 * dst_stride);
  411. dst15 = LD_UB(dst + 10 * dst_stride);
  412. ILVR_B2_SH(zero, dst14, zero, dst15, res14, res15);
  413. ADD2(res14, out14, res15, out15, res14, res15);
  414. CLIP_SH2_0_255(res14, res15);
  415. PCKEV_B2_SH(res14, res14, res15, res15, res14, res15);
  416. ST8x1_UB(res14, dst + 5 * dst_stride);
  417. ST8x1_UB(res15, dst + 10 * dst_stride);
  418. }