intrapred16_dspr2.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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/mips/common_dspr2.h"
  11. #if HAVE_DSPR2
  12. void vpx_h_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t stride,
  13. const uint8_t *above, const uint8_t *left) {
  14. int32_t tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8;
  15. int32_t tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16;
  16. (void)above;
  17. __asm__ __volatile__(
  18. "lb %[tmp1], (%[left]) \n\t"
  19. "lb %[tmp2], 1(%[left]) \n\t"
  20. "lb %[tmp3], 2(%[left]) \n\t"
  21. "lb %[tmp4], 3(%[left]) \n\t"
  22. "lb %[tmp5], 4(%[left]) \n\t"
  23. "lb %[tmp6], 5(%[left]) \n\t"
  24. "lb %[tmp7], 6(%[left]) \n\t"
  25. "lb %[tmp8], 7(%[left]) \n\t"
  26. "lb %[tmp9], 8(%[left]) \n\t"
  27. "lb %[tmp10], 9(%[left]) \n\t"
  28. "lb %[tmp11], 10(%[left]) \n\t"
  29. "lb %[tmp12], 11(%[left]) \n\t"
  30. "lb %[tmp13], 12(%[left]) \n\t"
  31. "lb %[tmp14], 13(%[left]) \n\t"
  32. "lb %[tmp15], 14(%[left]) \n\t"
  33. "lb %[tmp16], 15(%[left]) \n\t"
  34. "replv.qb %[tmp1], %[tmp1] \n\t"
  35. "replv.qb %[tmp2], %[tmp2] \n\t"
  36. "replv.qb %[tmp3], %[tmp3] \n\t"
  37. "replv.qb %[tmp4], %[tmp4] \n\t"
  38. "replv.qb %[tmp5], %[tmp5] \n\t"
  39. "replv.qb %[tmp6], %[tmp6] \n\t"
  40. "replv.qb %[tmp7], %[tmp7] \n\t"
  41. "replv.qb %[tmp8], %[tmp8] \n\t"
  42. "replv.qb %[tmp9], %[tmp9] \n\t"
  43. "replv.qb %[tmp10], %[tmp10] \n\t"
  44. "replv.qb %[tmp11], %[tmp11] \n\t"
  45. "replv.qb %[tmp12], %[tmp12] \n\t"
  46. "replv.qb %[tmp13], %[tmp13] \n\t"
  47. "replv.qb %[tmp14], %[tmp14] \n\t"
  48. "replv.qb %[tmp15], %[tmp15] \n\t"
  49. "replv.qb %[tmp16], %[tmp16] \n\t"
  50. "sw %[tmp1], (%[dst]) \n\t"
  51. "sw %[tmp1], 4(%[dst]) \n\t"
  52. "sw %[tmp1], 8(%[dst]) \n\t"
  53. "sw %[tmp1], 12(%[dst]) \n\t"
  54. "add %[dst], %[dst], %[stride] \n\t"
  55. "sw %[tmp2], (%[dst]) \n\t"
  56. "sw %[tmp2], 4(%[dst]) \n\t"
  57. "sw %[tmp2], 8(%[dst]) \n\t"
  58. "sw %[tmp2], 12(%[dst]) \n\t"
  59. "add %[dst], %[dst], %[stride] \n\t"
  60. "sw %[tmp3], (%[dst]) \n\t"
  61. "sw %[tmp3], 4(%[dst]) \n\t"
  62. "sw %[tmp3], 8(%[dst]) \n\t"
  63. "sw %[tmp3], 12(%[dst]) \n\t"
  64. "add %[dst], %[dst], %[stride] \n\t"
  65. "sw %[tmp4], (%[dst]) \n\t"
  66. "sw %[tmp4], 4(%[dst]) \n\t"
  67. "sw %[tmp4], 8(%[dst]) \n\t"
  68. "sw %[tmp4], 12(%[dst]) \n\t"
  69. "add %[dst], %[dst], %[stride] \n\t"
  70. "sw %[tmp5], (%[dst]) \n\t"
  71. "sw %[tmp5], 4(%[dst]) \n\t"
  72. "sw %[tmp5], 8(%[dst]) \n\t"
  73. "sw %[tmp5], 12(%[dst]) \n\t"
  74. "add %[dst], %[dst], %[stride] \n\t"
  75. "sw %[tmp6], (%[dst]) \n\t"
  76. "sw %[tmp6], 4(%[dst]) \n\t"
  77. "sw %[tmp6], 8(%[dst]) \n\t"
  78. "sw %[tmp6], 12(%[dst]) \n\t"
  79. "add %[dst], %[dst], %[stride] \n\t"
  80. "sw %[tmp7], (%[dst]) \n\t"
  81. "sw %[tmp7], 4(%[dst]) \n\t"
  82. "sw %[tmp7], 8(%[dst]) \n\t"
  83. "sw %[tmp7], 12(%[dst]) \n\t"
  84. "add %[dst], %[dst], %[stride] \n\t"
  85. "sw %[tmp8], (%[dst]) \n\t"
  86. "sw %[tmp8], 4(%[dst]) \n\t"
  87. "sw %[tmp8], 8(%[dst]) \n\t"
  88. "sw %[tmp8], 12(%[dst]) \n\t"
  89. "add %[dst], %[dst], %[stride] \n\t"
  90. "sw %[tmp9], (%[dst]) \n\t"
  91. "sw %[tmp9], 4(%[dst]) \n\t"
  92. "sw %[tmp9], 8(%[dst]) \n\t"
  93. "sw %[tmp9], 12(%[dst]) \n\t"
  94. "add %[dst], %[dst], %[stride] \n\t"
  95. "sw %[tmp10], (%[dst]) \n\t"
  96. "sw %[tmp10], 4(%[dst]) \n\t"
  97. "sw %[tmp10], 8(%[dst]) \n\t"
  98. "sw %[tmp10], 12(%[dst]) \n\t"
  99. "add %[dst], %[dst], %[stride] \n\t"
  100. "sw %[tmp11], (%[dst]) \n\t"
  101. "sw %[tmp11], 4(%[dst]) \n\t"
  102. "sw %[tmp11], 8(%[dst]) \n\t"
  103. "sw %[tmp11], 12(%[dst]) \n\t"
  104. "add %[dst], %[dst], %[stride] \n\t"
  105. "sw %[tmp12], (%[dst]) \n\t"
  106. "sw %[tmp12], 4(%[dst]) \n\t"
  107. "sw %[tmp12], 8(%[dst]) \n\t"
  108. "sw %[tmp12], 12(%[dst]) \n\t"
  109. "add %[dst], %[dst], %[stride] \n\t"
  110. "sw %[tmp13], (%[dst]) \n\t"
  111. "sw %[tmp13], 4(%[dst]) \n\t"
  112. "sw %[tmp13], 8(%[dst]) \n\t"
  113. "sw %[tmp13], 12(%[dst]) \n\t"
  114. "add %[dst], %[dst], %[stride] \n\t"
  115. "sw %[tmp14], (%[dst]) \n\t"
  116. "sw %[tmp14], 4(%[dst]) \n\t"
  117. "sw %[tmp14], 8(%[dst]) \n\t"
  118. "sw %[tmp14], 12(%[dst]) \n\t"
  119. "add %[dst], %[dst], %[stride] \n\t"
  120. "sw %[tmp15], (%[dst]) \n\t"
  121. "sw %[tmp15], 4(%[dst]) \n\t"
  122. "sw %[tmp15], 8(%[dst]) \n\t"
  123. "sw %[tmp15], 12(%[dst]) \n\t"
  124. "add %[dst], %[dst], %[stride] \n\t"
  125. "sw %[tmp16], (%[dst]) \n\t"
  126. "sw %[tmp16], 4(%[dst]) \n\t"
  127. "sw %[tmp16], 8(%[dst]) \n\t"
  128. "sw %[tmp16], 12(%[dst]) \n\t"
  129. : [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [tmp3] "=&r"(tmp3),
  130. [tmp4] "=&r"(tmp4), [tmp5] "=&r"(tmp5), [tmp7] "=&r"(tmp7),
  131. [tmp6] "=&r"(tmp6), [tmp8] "=&r"(tmp8), [tmp9] "=&r"(tmp9),
  132. [tmp10] "=&r"(tmp10), [tmp11] "=&r"(tmp11), [tmp12] "=&r"(tmp12),
  133. [tmp13] "=&r"(tmp13), [tmp14] "=&r"(tmp14), [tmp15] "=&r"(tmp15),
  134. [tmp16] "=&r"(tmp16)
  135. : [left] "r"(left), [dst] "r"(dst), [stride] "r"(stride));
  136. }
  137. void vpx_dc_predictor_16x16_dspr2(uint8_t *dst, ptrdiff_t stride,
  138. const uint8_t *above, const uint8_t *left) {
  139. int32_t expected_dc;
  140. int32_t average;
  141. int32_t tmp, above1, above_l1, above_r1, left1, left_r1, left_l1;
  142. int32_t above2, left2;
  143. __asm__ __volatile__(
  144. "lw %[above1], (%[above]) \n\t"
  145. "lw %[above2], 4(%[above]) \n\t"
  146. "lw %[left1], (%[left]) \n\t"
  147. "lw %[left2], 4(%[left]) \n\t"
  148. "preceu.ph.qbl %[above_l1], %[above1] \n\t"
  149. "preceu.ph.qbr %[above_r1], %[above1] \n\t"
  150. "preceu.ph.qbl %[left_l1], %[left1] \n\t"
  151. "preceu.ph.qbr %[left_r1], %[left1] \n\t"
  152. "addu.ph %[average], %[above_r1], %[above_l1] \n\t"
  153. "addu.ph %[average], %[average], %[left_l1] \n\t"
  154. "addu.ph %[average], %[average], %[left_r1] \n\t"
  155. "preceu.ph.qbl %[above_l1], %[above2] \n\t"
  156. "preceu.ph.qbr %[above_r1], %[above2] \n\t"
  157. "preceu.ph.qbl %[left_l1], %[left2] \n\t"
  158. "preceu.ph.qbr %[left_r1], %[left2] \n\t"
  159. "addu.ph %[average], %[average], %[above_l1] \n\t"
  160. "addu.ph %[average], %[average], %[above_r1] \n\t"
  161. "addu.ph %[average], %[average], %[left_l1] \n\t"
  162. "addu.ph %[average], %[average], %[left_r1] \n\t"
  163. "lw %[above1], 8(%[above]) \n\t"
  164. "lw %[above2], 12(%[above]) \n\t"
  165. "lw %[left1], 8(%[left]) \n\t"
  166. "lw %[left2], 12(%[left]) \n\t"
  167. "preceu.ph.qbl %[above_l1], %[above1] \n\t"
  168. "preceu.ph.qbr %[above_r1], %[above1] \n\t"
  169. "preceu.ph.qbl %[left_l1], %[left1] \n\t"
  170. "preceu.ph.qbr %[left_r1], %[left1] \n\t"
  171. "addu.ph %[average], %[average], %[above_l1] \n\t"
  172. "addu.ph %[average], %[average], %[above_r1] \n\t"
  173. "addu.ph %[average], %[average], %[left_l1] \n\t"
  174. "addu.ph %[average], %[average], %[left_r1] \n\t"
  175. "preceu.ph.qbl %[above_l1], %[above2] \n\t"
  176. "preceu.ph.qbr %[above_r1], %[above2] \n\t"
  177. "preceu.ph.qbl %[left_l1], %[left2] \n\t"
  178. "preceu.ph.qbr %[left_r1], %[left2] \n\t"
  179. "addu.ph %[average], %[average], %[above_l1] \n\t"
  180. "addu.ph %[average], %[average], %[above_r1] \n\t"
  181. "addu.ph %[average], %[average], %[left_l1] \n\t"
  182. "addu.ph %[average], %[average], %[left_r1] \n\t"
  183. "addiu %[average], %[average], 16 \n\t"
  184. "srl %[tmp], %[average], 16 \n\t"
  185. "addu.ph %[average], %[tmp], %[average] \n\t"
  186. "srl %[expected_dc], %[average], 5 \n\t"
  187. "replv.qb %[expected_dc], %[expected_dc] \n\t"
  188. "sw %[expected_dc], (%[dst]) \n\t"
  189. "sw %[expected_dc], 4(%[dst]) \n\t"
  190. "sw %[expected_dc], 8(%[dst]) \n\t"
  191. "sw %[expected_dc], 12(%[dst]) \n\t"
  192. "add %[dst], %[dst], %[stride] \n\t"
  193. "sw %[expected_dc], (%[dst]) \n\t"
  194. "sw %[expected_dc], 4(%[dst]) \n\t"
  195. "sw %[expected_dc], 8(%[dst]) \n\t"
  196. "sw %[expected_dc], 12(%[dst]) \n\t"
  197. "add %[dst], %[dst], %[stride] \n\t"
  198. "sw %[expected_dc], (%[dst]) \n\t"
  199. "sw %[expected_dc], 4(%[dst]) \n\t"
  200. "sw %[expected_dc], 8(%[dst]) \n\t"
  201. "sw %[expected_dc], 12(%[dst]) \n\t"
  202. "add %[dst], %[dst], %[stride] \n\t"
  203. "sw %[expected_dc], (%[dst]) \n\t"
  204. "sw %[expected_dc], 4(%[dst]) \n\t"
  205. "sw %[expected_dc], 8(%[dst]) \n\t"
  206. "sw %[expected_dc], 12(%[dst]) \n\t"
  207. "add %[dst], %[dst], %[stride] \n\t"
  208. "sw %[expected_dc], (%[dst]) \n\t"
  209. "sw %[expected_dc], 4(%[dst]) \n\t"
  210. "sw %[expected_dc], 8(%[dst]) \n\t"
  211. "sw %[expected_dc], 12(%[dst]) \n\t"
  212. "add %[dst], %[dst], %[stride] \n\t"
  213. "sw %[expected_dc], (%[dst]) \n\t"
  214. "sw %[expected_dc], 4(%[dst]) \n\t"
  215. "sw %[expected_dc], 8(%[dst]) \n\t"
  216. "sw %[expected_dc], 12(%[dst]) \n\t"
  217. "add %[dst], %[dst], %[stride] \n\t"
  218. "sw %[expected_dc], (%[dst]) \n\t"
  219. "sw %[expected_dc], 4(%[dst]) \n\t"
  220. "sw %[expected_dc], 8(%[dst]) \n\t"
  221. "sw %[expected_dc], 12(%[dst]) \n\t"
  222. "add %[dst], %[dst], %[stride] \n\t"
  223. "sw %[expected_dc], (%[dst]) \n\t"
  224. "sw %[expected_dc], 4(%[dst]) \n\t"
  225. "sw %[expected_dc], 8(%[dst]) \n\t"
  226. "sw %[expected_dc], 12(%[dst]) \n\t"
  227. "add %[dst], %[dst], %[stride] \n\t"
  228. "sw %[expected_dc], (%[dst]) \n\t"
  229. "sw %[expected_dc], 4(%[dst]) \n\t"
  230. "sw %[expected_dc], 8(%[dst]) \n\t"
  231. "sw %[expected_dc], 12(%[dst]) \n\t"
  232. "add %[dst], %[dst], %[stride] \n\t"
  233. "sw %[expected_dc], (%[dst]) \n\t"
  234. "sw %[expected_dc], 4(%[dst]) \n\t"
  235. "sw %[expected_dc], 8(%[dst]) \n\t"
  236. "sw %[expected_dc], 12(%[dst]) \n\t"
  237. "add %[dst], %[dst], %[stride] \n\t"
  238. "sw %[expected_dc], (%[dst]) \n\t"
  239. "sw %[expected_dc], 4(%[dst]) \n\t"
  240. "sw %[expected_dc], 8(%[dst]) \n\t"
  241. "sw %[expected_dc], 12(%[dst]) \n\t"
  242. "add %[dst], %[dst], %[stride] \n\t"
  243. "sw %[expected_dc], (%[dst]) \n\t"
  244. "sw %[expected_dc], 4(%[dst]) \n\t"
  245. "sw %[expected_dc], 8(%[dst]) \n\t"
  246. "sw %[expected_dc], 12(%[dst]) \n\t"
  247. "add %[dst], %[dst], %[stride] \n\t"
  248. "sw %[expected_dc], (%[dst]) \n\t"
  249. "sw %[expected_dc], 4(%[dst]) \n\t"
  250. "sw %[expected_dc], 8(%[dst]) \n\t"
  251. "sw %[expected_dc], 12(%[dst]) \n\t"
  252. "add %[dst], %[dst], %[stride] \n\t"
  253. "sw %[expected_dc], (%[dst]) \n\t"
  254. "sw %[expected_dc], 4(%[dst]) \n\t"
  255. "sw %[expected_dc], 8(%[dst]) \n\t"
  256. "sw %[expected_dc], 12(%[dst]) \n\t"
  257. "add %[dst], %[dst], %[stride] \n\t"
  258. "sw %[expected_dc], (%[dst]) \n\t"
  259. "sw %[expected_dc], 4(%[dst]) \n\t"
  260. "sw %[expected_dc], 8(%[dst]) \n\t"
  261. "sw %[expected_dc], 12(%[dst]) \n\t"
  262. "add %[dst], %[dst], %[stride] \n\t"
  263. "sw %[expected_dc], (%[dst]) \n\t"
  264. "sw %[expected_dc], 4(%[dst]) \n\t"
  265. "sw %[expected_dc], 8(%[dst]) \n\t"
  266. "sw %[expected_dc], 12(%[dst]) \n\t"
  267. : [left1] "=&r"(left1), [above1] "=&r"(above1), [left_l1] "=&r"(left_l1),
  268. [above_l1] "=&r"(above_l1), [left_r1] "=&r"(left_r1),
  269. [above_r1] "=&r"(above_r1), [above2] "=&r"(above2),
  270. [left2] "=&r"(left2), [average] "=&r"(average), [tmp] "=&r"(tmp),
  271. [expected_dc] "=&r"(expected_dc)
  272. : [above] "r"(above), [left] "r"(left), [dst] "r"(dst),
  273. [stride] "r"(stride));
  274. }
  275. #endif // #if HAVE_DSPR2