vpx_convolve8_vert_msa.c 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  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 <assert.h>
  11. #include "./vpx_dsp_rtcd.h"
  12. #include "vpx_dsp/mips/vpx_convolve_msa.h"
  13. static void common_vt_8t_4w_msa(const uint8_t *src, int32_t src_stride,
  14. uint8_t *dst, int32_t dst_stride,
  15. int8_t *filter, int32_t height) {
  16. uint32_t loop_cnt;
  17. v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
  18. v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
  19. v16i8 src65_r, src87_r, src109_r, src2110, src4332, src6554, src8776;
  20. v16i8 src10998, filt0, filt1, filt2, filt3;
  21. v16u8 out;
  22. v8i16 filt, out10, out32;
  23. src -= (3 * src_stride);
  24. filt = LD_SH(filter);
  25. SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
  26. LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
  27. src += (7 * src_stride);
  28. ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
  29. src54_r, src21_r);
  30. ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
  31. ILVR_D3_SB(src21_r, src10_r, src43_r, src32_r, src65_r, src54_r, src2110,
  32. src4332, src6554);
  33. XORI_B3_128_SB(src2110, src4332, src6554);
  34. for (loop_cnt = (height >> 2); loop_cnt--;) {
  35. LD_SB4(src, src_stride, src7, src8, src9, src10);
  36. src += (4 * src_stride);
  37. ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
  38. src87_r, src98_r, src109_r);
  39. ILVR_D2_SB(src87_r, src76_r, src109_r, src98_r, src8776, src10998);
  40. XORI_B2_128_SB(src8776, src10998);
  41. out10 = FILT_8TAP_DPADD_S_H(src2110, src4332, src6554, src8776, filt0,
  42. filt1, filt2, filt3);
  43. out32 = FILT_8TAP_DPADD_S_H(src4332, src6554, src8776, src10998, filt0,
  44. filt1, filt2, filt3);
  45. SRARI_H2_SH(out10, out32, FILTER_BITS);
  46. SAT_SH2_SH(out10, out32, 7);
  47. out = PCKEV_XORI128_UB(out10, out32);
  48. ST4x4_UB(out, out, 0, 1, 2, 3, dst, dst_stride);
  49. dst += (4 * dst_stride);
  50. src2110 = src6554;
  51. src4332 = src8776;
  52. src6554 = src10998;
  53. src6 = src10;
  54. }
  55. }
  56. static void common_vt_8t_8w_msa(const uint8_t *src, int32_t src_stride,
  57. uint8_t *dst, int32_t dst_stride,
  58. int8_t *filter, int32_t height) {
  59. uint32_t loop_cnt;
  60. v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
  61. v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
  62. v16i8 src65_r, src87_r, src109_r, filt0, filt1, filt2, filt3;
  63. v16u8 tmp0, tmp1;
  64. v8i16 filt, out0_r, out1_r, out2_r, out3_r;
  65. src -= (3 * src_stride);
  66. filt = LD_SH(filter);
  67. SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
  68. LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
  69. XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
  70. src += (7 * src_stride);
  71. ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
  72. src54_r, src21_r);
  73. ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
  74. for (loop_cnt = (height >> 2); loop_cnt--;) {
  75. LD_SB4(src, src_stride, src7, src8, src9, src10);
  76. XORI_B4_128_SB(src7, src8, src9, src10);
  77. src += (4 * src_stride);
  78. ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
  79. src87_r, src98_r, src109_r);
  80. out0_r = FILT_8TAP_DPADD_S_H(src10_r, src32_r, src54_r, src76_r, filt0,
  81. filt1, filt2, filt3);
  82. out1_r = FILT_8TAP_DPADD_S_H(src21_r, src43_r, src65_r, src87_r, filt0,
  83. filt1, filt2, filt3);
  84. out2_r = FILT_8TAP_DPADD_S_H(src32_r, src54_r, src76_r, src98_r, filt0,
  85. filt1, filt2, filt3);
  86. out3_r = FILT_8TAP_DPADD_S_H(src43_r, src65_r, src87_r, src109_r, filt0,
  87. filt1, filt2, filt3);
  88. SRARI_H4_SH(out0_r, out1_r, out2_r, out3_r, FILTER_BITS);
  89. SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7);
  90. tmp0 = PCKEV_XORI128_UB(out0_r, out1_r);
  91. tmp1 = PCKEV_XORI128_UB(out2_r, out3_r);
  92. ST8x4_UB(tmp0, tmp1, dst, dst_stride);
  93. dst += (4 * dst_stride);
  94. src10_r = src54_r;
  95. src32_r = src76_r;
  96. src54_r = src98_r;
  97. src21_r = src65_r;
  98. src43_r = src87_r;
  99. src65_r = src109_r;
  100. src6 = src10;
  101. }
  102. }
  103. static void common_vt_8t_16w_msa(const uint8_t *src, int32_t src_stride,
  104. uint8_t *dst, int32_t dst_stride,
  105. int8_t *filter, int32_t height) {
  106. uint32_t loop_cnt;
  107. v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
  108. v16i8 filt0, filt1, filt2, filt3;
  109. v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
  110. v16i8 src65_r, src87_r, src109_r, src10_l, src32_l, src54_l, src76_l;
  111. v16i8 src98_l, src21_l, src43_l, src65_l, src87_l, src109_l;
  112. v16u8 tmp0, tmp1, tmp2, tmp3;
  113. v8i16 filt, out0_r, out1_r, out2_r, out3_r, out0_l, out1_l, out2_l, out3_l;
  114. src -= (3 * src_stride);
  115. filt = LD_SH(filter);
  116. SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
  117. LD_SB7(src, src_stride, src0, src1, src2, src3, src4, src5, src6);
  118. XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
  119. src += (7 * src_stride);
  120. ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
  121. src54_r, src21_r);
  122. ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
  123. ILVL_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_l, src32_l,
  124. src54_l, src21_l);
  125. ILVL_B2_SB(src4, src3, src6, src5, src43_l, src65_l);
  126. for (loop_cnt = (height >> 2); loop_cnt--;) {
  127. LD_SB4(src, src_stride, src7, src8, src9, src10);
  128. XORI_B4_128_SB(src7, src8, src9, src10);
  129. src += (4 * src_stride);
  130. ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
  131. src87_r, src98_r, src109_r);
  132. ILVL_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_l,
  133. src87_l, src98_l, src109_l);
  134. out0_r = FILT_8TAP_DPADD_S_H(src10_r, src32_r, src54_r, src76_r, filt0,
  135. filt1, filt2, filt3);
  136. out1_r = FILT_8TAP_DPADD_S_H(src21_r, src43_r, src65_r, src87_r, filt0,
  137. filt1, filt2, filt3);
  138. out2_r = FILT_8TAP_DPADD_S_H(src32_r, src54_r, src76_r, src98_r, filt0,
  139. filt1, filt2, filt3);
  140. out3_r = FILT_8TAP_DPADD_S_H(src43_r, src65_r, src87_r, src109_r, filt0,
  141. filt1, filt2, filt3);
  142. out0_l = FILT_8TAP_DPADD_S_H(src10_l, src32_l, src54_l, src76_l, filt0,
  143. filt1, filt2, filt3);
  144. out1_l = FILT_8TAP_DPADD_S_H(src21_l, src43_l, src65_l, src87_l, filt0,
  145. filt1, filt2, filt3);
  146. out2_l = FILT_8TAP_DPADD_S_H(src32_l, src54_l, src76_l, src98_l, filt0,
  147. filt1, filt2, filt3);
  148. out3_l = FILT_8TAP_DPADD_S_H(src43_l, src65_l, src87_l, src109_l, filt0,
  149. filt1, filt2, filt3);
  150. SRARI_H4_SH(out0_r, out1_r, out2_r, out3_r, FILTER_BITS);
  151. SRARI_H4_SH(out0_l, out1_l, out2_l, out3_l, FILTER_BITS);
  152. SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7);
  153. SAT_SH4_SH(out0_l, out1_l, out2_l, out3_l, 7);
  154. PCKEV_B4_UB(out0_l, out0_r, out1_l, out1_r, out2_l, out2_r, out3_l, out3_r,
  155. tmp0, tmp1, tmp2, tmp3);
  156. XORI_B4_128_UB(tmp0, tmp1, tmp2, tmp3);
  157. ST_UB4(tmp0, tmp1, tmp2, tmp3, dst, dst_stride);
  158. dst += (4 * dst_stride);
  159. src10_r = src54_r;
  160. src32_r = src76_r;
  161. src54_r = src98_r;
  162. src21_r = src65_r;
  163. src43_r = src87_r;
  164. src65_r = src109_r;
  165. src10_l = src54_l;
  166. src32_l = src76_l;
  167. src54_l = src98_l;
  168. src21_l = src65_l;
  169. src43_l = src87_l;
  170. src65_l = src109_l;
  171. src6 = src10;
  172. }
  173. }
  174. static void common_vt_8t_16w_mult_msa(const uint8_t *src, int32_t src_stride,
  175. uint8_t *dst, int32_t dst_stride,
  176. int8_t *filter, int32_t height,
  177. int32_t width) {
  178. const uint8_t *src_tmp;
  179. uint8_t *dst_tmp;
  180. uint32_t loop_cnt, cnt;
  181. v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
  182. v16i8 filt0, filt1, filt2, filt3;
  183. v16i8 src10_r, src32_r, src54_r, src76_r, src98_r, src21_r, src43_r;
  184. v16i8 src65_r, src87_r, src109_r, src10_l, src32_l, src54_l, src76_l;
  185. v16i8 src98_l, src21_l, src43_l, src65_l, src87_l, src109_l;
  186. v16u8 tmp0, tmp1, tmp2, tmp3;
  187. v8i16 filt, out0_r, out1_r, out2_r, out3_r, out0_l, out1_l, out2_l, out3_l;
  188. src -= (3 * src_stride);
  189. filt = LD_SH(filter);
  190. SPLATI_H4_SB(filt, 0, 1, 2, 3, filt0, filt1, filt2, filt3);
  191. for (cnt = (width >> 4); cnt--;) {
  192. src_tmp = src;
  193. dst_tmp = dst;
  194. LD_SB7(src_tmp, src_stride, src0, src1, src2, src3, src4, src5, src6);
  195. XORI_B7_128_SB(src0, src1, src2, src3, src4, src5, src6);
  196. src_tmp += (7 * src_stride);
  197. ILVR_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_r, src32_r,
  198. src54_r, src21_r);
  199. ILVR_B2_SB(src4, src3, src6, src5, src43_r, src65_r);
  200. ILVL_B4_SB(src1, src0, src3, src2, src5, src4, src2, src1, src10_l, src32_l,
  201. src54_l, src21_l);
  202. ILVL_B2_SB(src4, src3, src6, src5, src43_l, src65_l);
  203. for (loop_cnt = (height >> 2); loop_cnt--;) {
  204. LD_SB4(src_tmp, src_stride, src7, src8, src9, src10);
  205. XORI_B4_128_SB(src7, src8, src9, src10);
  206. src_tmp += (4 * src_stride);
  207. ILVR_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_r,
  208. src87_r, src98_r, src109_r);
  209. ILVL_B4_SB(src7, src6, src8, src7, src9, src8, src10, src9, src76_l,
  210. src87_l, src98_l, src109_l);
  211. out0_r = FILT_8TAP_DPADD_S_H(src10_r, src32_r, src54_r, src76_r, filt0,
  212. filt1, filt2, filt3);
  213. out1_r = FILT_8TAP_DPADD_S_H(src21_r, src43_r, src65_r, src87_r, filt0,
  214. filt1, filt2, filt3);
  215. out2_r = FILT_8TAP_DPADD_S_H(src32_r, src54_r, src76_r, src98_r, filt0,
  216. filt1, filt2, filt3);
  217. out3_r = FILT_8TAP_DPADD_S_H(src43_r, src65_r, src87_r, src109_r, filt0,
  218. filt1, filt2, filt3);
  219. out0_l = FILT_8TAP_DPADD_S_H(src10_l, src32_l, src54_l, src76_l, filt0,
  220. filt1, filt2, filt3);
  221. out1_l = FILT_8TAP_DPADD_S_H(src21_l, src43_l, src65_l, src87_l, filt0,
  222. filt1, filt2, filt3);
  223. out2_l = FILT_8TAP_DPADD_S_H(src32_l, src54_l, src76_l, src98_l, filt0,
  224. filt1, filt2, filt3);
  225. out3_l = FILT_8TAP_DPADD_S_H(src43_l, src65_l, src87_l, src109_l, filt0,
  226. filt1, filt2, filt3);
  227. SRARI_H4_SH(out0_r, out1_r, out2_r, out3_r, FILTER_BITS);
  228. SRARI_H4_SH(out0_l, out1_l, out2_l, out3_l, FILTER_BITS);
  229. SAT_SH4_SH(out0_r, out1_r, out2_r, out3_r, 7);
  230. SAT_SH4_SH(out0_l, out1_l, out2_l, out3_l, 7);
  231. PCKEV_B4_UB(out0_l, out0_r, out1_l, out1_r, out2_l, out2_r, out3_l,
  232. out3_r, tmp0, tmp1, tmp2, tmp3);
  233. XORI_B4_128_UB(tmp0, tmp1, tmp2, tmp3);
  234. ST_UB4(tmp0, tmp1, tmp2, tmp3, dst_tmp, dst_stride);
  235. dst_tmp += (4 * dst_stride);
  236. src10_r = src54_r;
  237. src32_r = src76_r;
  238. src54_r = src98_r;
  239. src21_r = src65_r;
  240. src43_r = src87_r;
  241. src65_r = src109_r;
  242. src10_l = src54_l;
  243. src32_l = src76_l;
  244. src54_l = src98_l;
  245. src21_l = src65_l;
  246. src43_l = src87_l;
  247. src65_l = src109_l;
  248. src6 = src10;
  249. }
  250. src += 16;
  251. dst += 16;
  252. }
  253. }
  254. static void common_vt_8t_32w_msa(const uint8_t *src, int32_t src_stride,
  255. uint8_t *dst, int32_t dst_stride,
  256. int8_t *filter, int32_t height) {
  257. common_vt_8t_16w_mult_msa(src, src_stride, dst, dst_stride, filter, height,
  258. 32);
  259. }
  260. static void common_vt_8t_64w_msa(const uint8_t *src, int32_t src_stride,
  261. uint8_t *dst, int32_t dst_stride,
  262. int8_t *filter, int32_t height) {
  263. common_vt_8t_16w_mult_msa(src, src_stride, dst, dst_stride, filter, height,
  264. 64);
  265. }
  266. static void common_vt_2t_4x4_msa(const uint8_t *src, int32_t src_stride,
  267. uint8_t *dst, int32_t dst_stride,
  268. int8_t *filter) {
  269. v16i8 src0, src1, src2, src3, src4;
  270. v16i8 src10_r, src32_r, src21_r, src43_r, src2110, src4332;
  271. v16u8 filt0;
  272. v8i16 filt;
  273. v8u16 tmp0, tmp1;
  274. filt = LD_SH(filter);
  275. filt0 = (v16u8)__msa_splati_h(filt, 0);
  276. LD_SB5(src, src_stride, src0, src1, src2, src3, src4);
  277. src += (5 * src_stride);
  278. ILVR_B4_SB(src1, src0, src2, src1, src3, src2, src4, src3, src10_r, src21_r,
  279. src32_r, src43_r);
  280. ILVR_D2_SB(src21_r, src10_r, src43_r, src32_r, src2110, src4332);
  281. DOTP_UB2_UH(src2110, src4332, filt0, filt0, tmp0, tmp1);
  282. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  283. src2110 = __msa_pckev_b((v16i8)tmp1, (v16i8)tmp0);
  284. ST4x4_UB(src2110, src2110, 0, 1, 2, 3, dst, dst_stride);
  285. }
  286. static void common_vt_2t_4x8_msa(const uint8_t *src, int32_t src_stride,
  287. uint8_t *dst, int32_t dst_stride,
  288. int8_t *filter) {
  289. v16i8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
  290. v16i8 src10_r, src32_r, src54_r, src76_r, src21_r, src43_r;
  291. v16i8 src65_r, src87_r, src2110, src4332, src6554, src8776;
  292. v8u16 tmp0, tmp1, tmp2, tmp3;
  293. v16u8 filt0;
  294. v8i16 filt;
  295. filt = LD_SH(filter);
  296. filt0 = (v16u8)__msa_splati_h(filt, 0);
  297. LD_SB8(src, src_stride, src0, src1, src2, src3, src4, src5, src6, src7);
  298. src += (8 * src_stride);
  299. src8 = LD_SB(src);
  300. src += src_stride;
  301. ILVR_B4_SB(src1, src0, src2, src1, src3, src2, src4, src3, src10_r, src21_r,
  302. src32_r, src43_r);
  303. ILVR_B4_SB(src5, src4, src6, src5, src7, src6, src8, src7, src54_r, src65_r,
  304. src76_r, src87_r);
  305. ILVR_D4_SB(src21_r, src10_r, src43_r, src32_r, src65_r, src54_r, src87_r,
  306. src76_r, src2110, src4332, src6554, src8776);
  307. DOTP_UB4_UH(src2110, src4332, src6554, src8776, filt0, filt0, filt0, filt0,
  308. tmp0, tmp1, tmp2, tmp3);
  309. SRARI_H4_UH(tmp0, tmp1, tmp2, tmp3, FILTER_BITS);
  310. PCKEV_B2_SB(tmp1, tmp0, tmp3, tmp2, src2110, src4332);
  311. ST4x4_UB(src2110, src2110, 0, 1, 2, 3, dst, dst_stride);
  312. ST4x4_UB(src4332, src4332, 0, 1, 2, 3, dst + 4 * dst_stride, dst_stride);
  313. }
  314. static void common_vt_2t_4w_msa(const uint8_t *src, int32_t src_stride,
  315. uint8_t *dst, int32_t dst_stride,
  316. int8_t *filter, int32_t height) {
  317. if (4 == height) {
  318. common_vt_2t_4x4_msa(src, src_stride, dst, dst_stride, filter);
  319. } else if (8 == height) {
  320. common_vt_2t_4x8_msa(src, src_stride, dst, dst_stride, filter);
  321. }
  322. }
  323. static void common_vt_2t_8x4_msa(const uint8_t *src, int32_t src_stride,
  324. uint8_t *dst, int32_t dst_stride,
  325. int8_t *filter) {
  326. v16u8 src0, src1, src2, src3, src4, vec0, vec1, vec2, vec3, filt0;
  327. v16i8 out0, out1;
  328. v8u16 tmp0, tmp1, tmp2, tmp3;
  329. v8i16 filt;
  330. /* rearranging filter_y */
  331. filt = LD_SH(filter);
  332. filt0 = (v16u8)__msa_splati_h(filt, 0);
  333. LD_UB5(src, src_stride, src0, src1, src2, src3, src4);
  334. ILVR_B2_UB(src1, src0, src2, src1, vec0, vec1);
  335. ILVR_B2_UB(src3, src2, src4, src3, vec2, vec3);
  336. DOTP_UB4_UH(vec0, vec1, vec2, vec3, filt0, filt0, filt0, filt0, tmp0, tmp1,
  337. tmp2, tmp3);
  338. SRARI_H4_UH(tmp0, tmp1, tmp2, tmp3, FILTER_BITS);
  339. PCKEV_B2_SB(tmp1, tmp0, tmp3, tmp2, out0, out1);
  340. ST8x4_UB(out0, out1, dst, dst_stride);
  341. }
  342. static void common_vt_2t_8x8mult_msa(const uint8_t *src, int32_t src_stride,
  343. uint8_t *dst, int32_t dst_stride,
  344. int8_t *filter, int32_t height) {
  345. uint32_t loop_cnt;
  346. v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8;
  347. v16u8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, filt0;
  348. v16i8 out0, out1;
  349. v8u16 tmp0, tmp1, tmp2, tmp3;
  350. v8i16 filt;
  351. /* rearranging filter_y */
  352. filt = LD_SH(filter);
  353. filt0 = (v16u8)__msa_splati_h(filt, 0);
  354. src0 = LD_UB(src);
  355. src += src_stride;
  356. for (loop_cnt = (height >> 3); loop_cnt--;) {
  357. LD_UB8(src, src_stride, src1, src2, src3, src4, src5, src6, src7, src8);
  358. src += (8 * src_stride);
  359. ILVR_B4_UB(src1, src0, src2, src1, src3, src2, src4, src3, vec0, vec1, vec2,
  360. vec3);
  361. ILVR_B4_UB(src5, src4, src6, src5, src7, src6, src8, src7, vec4, vec5, vec6,
  362. vec7);
  363. DOTP_UB4_UH(vec0, vec1, vec2, vec3, filt0, filt0, filt0, filt0, tmp0, tmp1,
  364. tmp2, tmp3);
  365. SRARI_H4_UH(tmp0, tmp1, tmp2, tmp3, FILTER_BITS);
  366. PCKEV_B2_SB(tmp1, tmp0, tmp3, tmp2, out0, out1);
  367. ST8x4_UB(out0, out1, dst, dst_stride);
  368. dst += (4 * dst_stride);
  369. DOTP_UB4_UH(vec4, vec5, vec6, vec7, filt0, filt0, filt0, filt0, tmp0, tmp1,
  370. tmp2, tmp3);
  371. SRARI_H4_UH(tmp0, tmp1, tmp2, tmp3, FILTER_BITS);
  372. PCKEV_B2_SB(tmp1, tmp0, tmp3, tmp2, out0, out1);
  373. ST8x4_UB(out0, out1, dst, dst_stride);
  374. dst += (4 * dst_stride);
  375. src0 = src8;
  376. }
  377. }
  378. static void common_vt_2t_8w_msa(const uint8_t *src, int32_t src_stride,
  379. uint8_t *dst, int32_t dst_stride,
  380. int8_t *filter, int32_t height) {
  381. if (4 == height) {
  382. common_vt_2t_8x4_msa(src, src_stride, dst, dst_stride, filter);
  383. } else {
  384. common_vt_2t_8x8mult_msa(src, src_stride, dst, dst_stride, filter, height);
  385. }
  386. }
  387. static void common_vt_2t_16w_msa(const uint8_t *src, int32_t src_stride,
  388. uint8_t *dst, int32_t dst_stride,
  389. int8_t *filter, int32_t height) {
  390. uint32_t loop_cnt;
  391. v16u8 src0, src1, src2, src3, src4;
  392. v16u8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, filt0;
  393. v8u16 tmp0, tmp1, tmp2, tmp3;
  394. v8i16 filt;
  395. /* rearranging filter_y */
  396. filt = LD_SH(filter);
  397. filt0 = (v16u8)__msa_splati_h(filt, 0);
  398. src0 = LD_UB(src);
  399. src += src_stride;
  400. for (loop_cnt = (height >> 2); loop_cnt--;) {
  401. LD_UB4(src, src_stride, src1, src2, src3, src4);
  402. src += (4 * src_stride);
  403. ILVR_B2_UB(src1, src0, src2, src1, vec0, vec2);
  404. ILVL_B2_UB(src1, src0, src2, src1, vec1, vec3);
  405. DOTP_UB2_UH(vec0, vec1, filt0, filt0, tmp0, tmp1);
  406. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  407. PCKEV_ST_SB(tmp0, tmp1, dst);
  408. dst += dst_stride;
  409. ILVR_B2_UB(src3, src2, src4, src3, vec4, vec6);
  410. ILVL_B2_UB(src3, src2, src4, src3, vec5, vec7);
  411. DOTP_UB2_UH(vec2, vec3, filt0, filt0, tmp2, tmp3);
  412. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  413. PCKEV_ST_SB(tmp2, tmp3, dst);
  414. dst += dst_stride;
  415. DOTP_UB2_UH(vec4, vec5, filt0, filt0, tmp0, tmp1);
  416. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  417. PCKEV_ST_SB(tmp0, tmp1, dst);
  418. dst += dst_stride;
  419. DOTP_UB2_UH(vec6, vec7, filt0, filt0, tmp2, tmp3);
  420. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  421. PCKEV_ST_SB(tmp2, tmp3, dst);
  422. dst += dst_stride;
  423. src0 = src4;
  424. }
  425. }
  426. static void common_vt_2t_32w_msa(const uint8_t *src, int32_t src_stride,
  427. uint8_t *dst, int32_t dst_stride,
  428. int8_t *filter, int32_t height) {
  429. uint32_t loop_cnt;
  430. v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9;
  431. v16u8 vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, filt0;
  432. v8u16 tmp0, tmp1, tmp2, tmp3;
  433. v8i16 filt;
  434. /* rearranging filter_y */
  435. filt = LD_SH(filter);
  436. filt0 = (v16u8)__msa_splati_h(filt, 0);
  437. src0 = LD_UB(src);
  438. src5 = LD_UB(src + 16);
  439. src += src_stride;
  440. for (loop_cnt = (height >> 2); loop_cnt--;) {
  441. LD_UB4(src, src_stride, src1, src2, src3, src4);
  442. ILVR_B2_UB(src1, src0, src2, src1, vec0, vec2);
  443. ILVL_B2_UB(src1, src0, src2, src1, vec1, vec3);
  444. LD_UB4(src + 16, src_stride, src6, src7, src8, src9);
  445. src += (4 * src_stride);
  446. DOTP_UB2_UH(vec0, vec1, filt0, filt0, tmp0, tmp1);
  447. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  448. PCKEV_ST_SB(tmp0, tmp1, dst);
  449. DOTP_UB2_UH(vec2, vec3, filt0, filt0, tmp2, tmp3);
  450. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  451. PCKEV_ST_SB(tmp2, tmp3, dst + dst_stride);
  452. ILVR_B2_UB(src3, src2, src4, src3, vec4, vec6);
  453. ILVL_B2_UB(src3, src2, src4, src3, vec5, vec7);
  454. DOTP_UB2_UH(vec4, vec5, filt0, filt0, tmp0, tmp1);
  455. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  456. PCKEV_ST_SB(tmp0, tmp1, dst + 2 * dst_stride);
  457. DOTP_UB2_UH(vec6, vec7, filt0, filt0, tmp2, tmp3);
  458. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  459. PCKEV_ST_SB(tmp2, tmp3, dst + 3 * dst_stride);
  460. ILVR_B2_UB(src6, src5, src7, src6, vec0, vec2);
  461. ILVL_B2_UB(src6, src5, src7, src6, vec1, vec3);
  462. DOTP_UB2_UH(vec0, vec1, filt0, filt0, tmp0, tmp1);
  463. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  464. PCKEV_ST_SB(tmp0, tmp1, dst + 16);
  465. DOTP_UB2_UH(vec2, vec3, filt0, filt0, tmp2, tmp3);
  466. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  467. PCKEV_ST_SB(tmp2, tmp3, dst + 16 + dst_stride);
  468. ILVR_B2_UB(src8, src7, src9, src8, vec4, vec6);
  469. ILVL_B2_UB(src8, src7, src9, src8, vec5, vec7);
  470. DOTP_UB2_UH(vec4, vec5, filt0, filt0, tmp0, tmp1);
  471. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  472. PCKEV_ST_SB(tmp0, tmp1, dst + 16 + 2 * dst_stride);
  473. DOTP_UB2_UH(vec6, vec7, filt0, filt0, tmp2, tmp3);
  474. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  475. PCKEV_ST_SB(tmp2, tmp3, dst + 16 + 3 * dst_stride);
  476. dst += (4 * dst_stride);
  477. src0 = src4;
  478. src5 = src9;
  479. }
  480. }
  481. static void common_vt_2t_64w_msa(const uint8_t *src, int32_t src_stride,
  482. uint8_t *dst, int32_t dst_stride,
  483. int8_t *filter, int32_t height) {
  484. uint32_t loop_cnt;
  485. v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, src10;
  486. v16u8 src11, vec0, vec1, vec2, vec3, vec4, vec5, vec6, vec7, filt0;
  487. v8u16 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
  488. v8i16 filt;
  489. /* rearranging filter_y */
  490. filt = LD_SH(filter);
  491. filt0 = (v16u8)__msa_splati_h(filt, 0);
  492. LD_UB4(src, 16, src0, src3, src6, src9);
  493. src += src_stride;
  494. for (loop_cnt = (height >> 1); loop_cnt--;) {
  495. LD_UB2(src, src_stride, src1, src2);
  496. LD_UB2(src + 16, src_stride, src4, src5);
  497. LD_UB2(src + 32, src_stride, src7, src8);
  498. LD_UB2(src + 48, src_stride, src10, src11);
  499. src += (2 * src_stride);
  500. ILVR_B2_UB(src1, src0, src2, src1, vec0, vec2);
  501. ILVL_B2_UB(src1, src0, src2, src1, vec1, vec3);
  502. DOTP_UB2_UH(vec0, vec1, filt0, filt0, tmp0, tmp1);
  503. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  504. PCKEV_ST_SB(tmp0, tmp1, dst);
  505. DOTP_UB2_UH(vec2, vec3, filt0, filt0, tmp2, tmp3);
  506. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  507. PCKEV_ST_SB(tmp2, tmp3, dst + dst_stride);
  508. ILVR_B2_UB(src4, src3, src5, src4, vec4, vec6);
  509. ILVL_B2_UB(src4, src3, src5, src4, vec5, vec7);
  510. DOTP_UB2_UH(vec4, vec5, filt0, filt0, tmp4, tmp5);
  511. SRARI_H2_UH(tmp4, tmp5, FILTER_BITS);
  512. PCKEV_ST_SB(tmp4, tmp5, dst + 16);
  513. DOTP_UB2_UH(vec6, vec7, filt0, filt0, tmp6, tmp7);
  514. SRARI_H2_UH(tmp6, tmp7, FILTER_BITS);
  515. PCKEV_ST_SB(tmp6, tmp7, dst + 16 + dst_stride);
  516. ILVR_B2_UB(src7, src6, src8, src7, vec0, vec2);
  517. ILVL_B2_UB(src7, src6, src8, src7, vec1, vec3);
  518. DOTP_UB2_UH(vec0, vec1, filt0, filt0, tmp0, tmp1);
  519. SRARI_H2_UH(tmp0, tmp1, FILTER_BITS);
  520. PCKEV_ST_SB(tmp0, tmp1, dst + 32);
  521. DOTP_UB2_UH(vec2, vec3, filt0, filt0, tmp2, tmp3);
  522. SRARI_H2_UH(tmp2, tmp3, FILTER_BITS);
  523. PCKEV_ST_SB(tmp2, tmp3, dst + 32 + dst_stride);
  524. ILVR_B2_UB(src10, src9, src11, src10, vec4, vec6);
  525. ILVL_B2_UB(src10, src9, src11, src10, vec5, vec7);
  526. DOTP_UB2_UH(vec4, vec5, filt0, filt0, tmp4, tmp5);
  527. SRARI_H2_UH(tmp4, tmp5, FILTER_BITS);
  528. PCKEV_ST_SB(tmp4, tmp5, dst + 48);
  529. DOTP_UB2_UH(vec6, vec7, filt0, filt0, tmp6, tmp7);
  530. SRARI_H2_UH(tmp6, tmp7, FILTER_BITS);
  531. PCKEV_ST_SB(tmp6, tmp7, dst + 48 + dst_stride);
  532. dst += (2 * dst_stride);
  533. src0 = src2;
  534. src3 = src5;
  535. src6 = src8;
  536. src9 = src11;
  537. }
  538. }
  539. void vpx_convolve8_vert_msa(const uint8_t *src, ptrdiff_t src_stride,
  540. uint8_t *dst, ptrdiff_t dst_stride,
  541. const InterpKernel *filter, int x0_q4,
  542. int32_t x_step_q4, int y0_q4, int y_step_q4, int w,
  543. int h) {
  544. const int16_t *const filter_y = filter[y0_q4];
  545. int8_t cnt, filt_ver[8];
  546. assert(y_step_q4 == 16);
  547. assert(((const int32_t *)filter_y)[1] != 0x800000);
  548. for (cnt = 8; cnt--;) {
  549. filt_ver[cnt] = filter_y[cnt];
  550. }
  551. if (vpx_get_filter_taps(filter_y) == 2) {
  552. switch (w) {
  553. case 4:
  554. common_vt_2t_4w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  555. &filt_ver[3], h);
  556. break;
  557. case 8:
  558. common_vt_2t_8w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  559. &filt_ver[3], h);
  560. break;
  561. case 16:
  562. common_vt_2t_16w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  563. &filt_ver[3], h);
  564. break;
  565. case 32:
  566. common_vt_2t_32w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  567. &filt_ver[3], h);
  568. break;
  569. case 64:
  570. common_vt_2t_64w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  571. &filt_ver[3], h);
  572. break;
  573. default:
  574. vpx_convolve8_vert_c(src, src_stride, dst, dst_stride, filter, x0_q4,
  575. x_step_q4, y0_q4, y_step_q4, w, h);
  576. break;
  577. }
  578. } else {
  579. switch (w) {
  580. case 4:
  581. common_vt_8t_4w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  582. filt_ver, h);
  583. break;
  584. case 8:
  585. common_vt_8t_8w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  586. filt_ver, h);
  587. break;
  588. case 16:
  589. common_vt_8t_16w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  590. filt_ver, h);
  591. break;
  592. case 32:
  593. common_vt_8t_32w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  594. filt_ver, h);
  595. break;
  596. case 64:
  597. common_vt_8t_64w_msa(src, (int32_t)src_stride, dst, (int32_t)dst_stride,
  598. filt_ver, h);
  599. break;
  600. default:
  601. vpx_convolve8_vert_c(src, src_stride, dst, dst_stride, filter, x0_q4,
  602. x_step_q4, y0_q4, y_step_q4, w, h);
  603. break;
  604. }
  605. }
  606. }