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.

460 lines
23KB

  1. /*
  2. * Copyright (c) 2012
  3. * MIPS Technologies, Inc., California.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its
  14. * contributors may be used to endorse or promote products derived from
  15. * this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
  18. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
  21. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27. * SUCH DAMAGE.
  28. *
  29. * Authors: Darko Laus (darko@mips.com)
  30. * Djordje Pesut (djordje@mips.com)
  31. * Mirjana Vulin (mvulin@mips.com)
  32. *
  33. * This file is part of FFmpeg.
  34. *
  35. * FFmpeg is free software; you can redistribute it and/or
  36. * modify it under the terms of the GNU Lesser General Public
  37. * License as published by the Free Software Foundation; either
  38. * version 2.1 of the License, or (at your option) any later version.
  39. *
  40. * FFmpeg is distributed in the hope that it will be useful,
  41. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  42. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  43. * Lesser General Public License for more details.
  44. *
  45. * You should have received a copy of the GNU Lesser General Public
  46. * License along with FFmpeg; if not, write to the Free Software
  47. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  48. */
  49. /**
  50. * @file
  51. * Reference: libavcodec/aacpsdsp.c
  52. */
  53. #include "config.h"
  54. #include "libavcodec/aacpsdsp.h"
  55. #if HAVE_INLINE_ASM
  56. static void ps_hybrid_analysis_ileave_mips(float (*out)[32][2], float L[2][38][64],
  57. int i, int len)
  58. {
  59. int temp0, temp1, temp2, temp3;
  60. int temp4, temp5, temp6, temp7;
  61. float *out1=&out[i][0][0];
  62. float *L1=&L[0][0][i];
  63. float *j=out1+ len*2;
  64. for (; i < 64; i++) {
  65. /* loop unrolled 8 times */
  66. __asm__ volatile (
  67. "1: \n\t"
  68. "lw %[temp0], 0(%[L1]) \n\t"
  69. "lw %[temp1], 9728(%[L1]) \n\t"
  70. "lw %[temp2], 256(%[L1]) \n\t"
  71. "lw %[temp3], 9984(%[L1]) \n\t"
  72. "lw %[temp4], 512(%[L1]) \n\t"
  73. "lw %[temp5], 10240(%[L1]) \n\t"
  74. "lw %[temp6], 768(%[L1]) \n\t"
  75. "lw %[temp7], 10496(%[L1]) \n\t"
  76. "sw %[temp0], 0(%[out1]) \n\t"
  77. "sw %[temp1], 4(%[out1]) \n\t"
  78. "sw %[temp2], 8(%[out1]) \n\t"
  79. "sw %[temp3], 12(%[out1]) \n\t"
  80. "sw %[temp4], 16(%[out1]) \n\t"
  81. "sw %[temp5], 20(%[out1]) \n\t"
  82. "sw %[temp6], 24(%[out1]) \n\t"
  83. "sw %[temp7], 28(%[out1]) \n\t"
  84. "addiu %[out1], %[out1], 32 \n\t"
  85. "addiu %[L1], %[L1], 1024 \n\t"
  86. "bne %[out1], %[j], 1b \n\t"
  87. : [out1]"+r"(out1), [L1]"+r"(L1), [j]"+r"(j),
  88. [temp0]"=&r"(temp0), [temp1]"=&r"(temp1),
  89. [temp2]"=&r"(temp2), [temp3]"=&r"(temp3),
  90. [temp4]"=&r"(temp4), [temp5]"=&r"(temp5),
  91. [temp6]"=&r"(temp6), [temp7]"=&r"(temp7)
  92. : [len]"r"(len)
  93. : "memory"
  94. );
  95. out1-=(len<<1)-64;
  96. L1-=(len<<6)-1;
  97. j+=len*2;
  98. }
  99. }
  100. static void ps_hybrid_synthesis_deint_mips(float out[2][38][64],
  101. float (*in)[32][2],
  102. int i, int len)
  103. {
  104. int n;
  105. int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
  106. float *out1 = (float*)out + i;
  107. float *out2 = (float*)out + 2432 + i;
  108. float *in1 = (float*)in + 64 * i;
  109. float *in2 = (float*)in + 64 * i + 1;
  110. for (; i < 64; i++) {
  111. for (n = 0; n < 7; n++) {
  112. /* loop unrolled 8 times */
  113. __asm__ volatile (
  114. "lw %[temp0], 0(%[in1]) \n\t"
  115. "lw %[temp1], 0(%[in2]) \n\t"
  116. "lw %[temp2], 8(%[in1]) \n\t"
  117. "lw %[temp3], 8(%[in2]) \n\t"
  118. "lw %[temp4], 16(%[in1]) \n\t"
  119. "lw %[temp5], 16(%[in2]) \n\t"
  120. "lw %[temp6], 24(%[in1]) \n\t"
  121. "lw %[temp7], 24(%[in2]) \n\t"
  122. "addiu %[out1], %[out1], 1024 \n\t"
  123. "addiu %[out2], %[out2], 1024 \n\t"
  124. "addiu %[in1], %[in1], 32 \n\t"
  125. "addiu %[in2], %[in2], 32 \n\t"
  126. "sw %[temp0], -1024(%[out1]) \n\t"
  127. "sw %[temp1], -1024(%[out2]) \n\t"
  128. "sw %[temp2], -768(%[out1]) \n\t"
  129. "sw %[temp3], -768(%[out2]) \n\t"
  130. "sw %[temp4], -512(%[out1]) \n\t"
  131. "sw %[temp5], -512(%[out2]) \n\t"
  132. "sw %[temp6], -256(%[out1]) \n\t"
  133. "sw %[temp7], -256(%[out2]) \n\t"
  134. : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1),
  135. [temp2]"=&r"(temp2), [temp3]"=&r"(temp3),
  136. [temp4]"=&r"(temp4), [temp5]"=&r"(temp5),
  137. [temp6]"=&r"(temp6), [temp7]"=&r"(temp7),
  138. [out1]"+r"(out1), [out2]"+r"(out2),
  139. [in1]"+r"(in1), [in2]"+r"(in2)
  140. :
  141. : "memory"
  142. );
  143. }
  144. /* loop unrolled 8 times */
  145. __asm__ volatile (
  146. "lw %[temp0], 0(%[in1]) \n\t"
  147. "lw %[temp1], 0(%[in2]) \n\t"
  148. "lw %[temp2], 8(%[in1]) \n\t"
  149. "lw %[temp3], 8(%[in2]) \n\t"
  150. "lw %[temp4], 16(%[in1]) \n\t"
  151. "lw %[temp5], 16(%[in2]) \n\t"
  152. "lw %[temp6], 24(%[in1]) \n\t"
  153. "lw %[temp7], 24(%[in2]) \n\t"
  154. "addiu %[out1], %[out1], -7164 \n\t"
  155. "addiu %[out2], %[out2], -7164 \n\t"
  156. "addiu %[in1], %[in1], 32 \n\t"
  157. "addiu %[in2], %[in2], 32 \n\t"
  158. "sw %[temp0], 7164(%[out1]) \n\t"
  159. "sw %[temp1], 7164(%[out2]) \n\t"
  160. "sw %[temp2], 7420(%[out1]) \n\t"
  161. "sw %[temp3], 7420(%[out2]) \n\t"
  162. "sw %[temp4], 7676(%[out1]) \n\t"
  163. "sw %[temp5], 7676(%[out2]) \n\t"
  164. "sw %[temp6], 7932(%[out1]) \n\t"
  165. "sw %[temp7], 7932(%[out2]) \n\t"
  166. : [temp0]"=&r"(temp0), [temp1]"=&r"(temp1),
  167. [temp2]"=&r"(temp2), [temp3]"=&r"(temp3),
  168. [temp4]"=&r"(temp4), [temp5]"=&r"(temp5),
  169. [temp6]"=&r"(temp6), [temp7]"=&r"(temp7),
  170. [out1]"+r"(out1), [out2]"+r"(out2),
  171. [in1]"+r"(in1), [in2]"+r"(in2)
  172. :
  173. : "memory"
  174. );
  175. }
  176. }
  177. #if HAVE_MIPSFPU
  178. static void ps_add_squares_mips(float *dst, const float (*src)[2], int n)
  179. {
  180. int i;
  181. float temp0, temp1, temp2, temp3, temp4, temp5;
  182. float temp6, temp7, temp8, temp9, temp10, temp11;
  183. float *src0 = (float*)&src[0][0];
  184. float *dst0 = &dst[0];
  185. for (i = 0; i < 8; i++) {
  186. /* loop unrolled 4 times */
  187. __asm__ volatile (
  188. "lwc1 %[temp0], 0(%[src0]) \n\t"
  189. "lwc1 %[temp1], 4(%[src0]) \n\t"
  190. "lwc1 %[temp2], 8(%[src0]) \n\t"
  191. "lwc1 %[temp3], 12(%[src0]) \n\t"
  192. "lwc1 %[temp4], 16(%[src0]) \n\t"
  193. "lwc1 %[temp5], 20(%[src0]) \n\t"
  194. "lwc1 %[temp6], 24(%[src0]) \n\t"
  195. "lwc1 %[temp7], 28(%[src0]) \n\t"
  196. "lwc1 %[temp8], 0(%[dst0]) \n\t"
  197. "lwc1 %[temp9], 4(%[dst0]) \n\t"
  198. "lwc1 %[temp10], 8(%[dst0]) \n\t"
  199. "lwc1 %[temp11], 12(%[dst0]) \n\t"
  200. "mul.s %[temp1], %[temp1], %[temp1] \n\t"
  201. "mul.s %[temp3], %[temp3], %[temp3] \n\t"
  202. "mul.s %[temp5], %[temp5], %[temp5] \n\t"
  203. "mul.s %[temp7], %[temp7], %[temp7] \n\t"
  204. "madd.s %[temp0], %[temp1], %[temp0], %[temp0] \n\t"
  205. "madd.s %[temp2], %[temp3], %[temp2], %[temp2] \n\t"
  206. "madd.s %[temp4], %[temp5], %[temp4], %[temp4] \n\t"
  207. "madd.s %[temp6], %[temp7], %[temp6], %[temp6] \n\t"
  208. "add.s %[temp0], %[temp8], %[temp0] \n\t"
  209. "add.s %[temp2], %[temp9], %[temp2] \n\t"
  210. "add.s %[temp4], %[temp10], %[temp4] \n\t"
  211. "add.s %[temp6], %[temp11], %[temp6] \n\t"
  212. "swc1 %[temp0], 0(%[dst0]) \n\t"
  213. "swc1 %[temp2], 4(%[dst0]) \n\t"
  214. "swc1 %[temp4], 8(%[dst0]) \n\t"
  215. "swc1 %[temp6], 12(%[dst0]) \n\t"
  216. "addiu %[dst0], %[dst0], 16 \n\t"
  217. "addiu %[src0], %[src0], 32 \n\t"
  218. : [temp0]"=&f"(temp0), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
  219. [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
  220. [temp6]"=&f"(temp6), [temp7]"=&f"(temp7), [temp8]"=&f"(temp8),
  221. [temp9]"=&f"(temp9), [dst0]"+r"(dst0), [src0]"+r"(src0),
  222. [temp10]"=&f"(temp10), [temp11]"=&f"(temp11)
  223. :
  224. : "memory"
  225. );
  226. }
  227. }
  228. static void ps_mul_pair_single_mips(float (*dst)[2], float (*src0)[2], float *src1,
  229. int n)
  230. {
  231. float temp0, temp1, temp2;
  232. float *p_d, *p_s0, *p_s1, *end;
  233. p_d = &dst[0][0];
  234. p_s0 = &src0[0][0];
  235. p_s1 = &src1[0];
  236. end = p_s1 + n;
  237. __asm__ volatile(
  238. ".set push \n\t"
  239. ".set noreorder \n\t"
  240. "1: \n\t"
  241. "lwc1 %[temp2], 0(%[p_s1]) \n\t"
  242. "lwc1 %[temp0], 0(%[p_s0]) \n\t"
  243. "lwc1 %[temp1], 4(%[p_s0]) \n\t"
  244. "addiu %[p_d], %[p_d], 8 \n\t"
  245. "mul.s %[temp0], %[temp0], %[temp2] \n\t"
  246. "mul.s %[temp1], %[temp1], %[temp2] \n\t"
  247. "addiu %[p_s0], %[p_s0], 8 \n\t"
  248. "swc1 %[temp0], -8(%[p_d]) \n\t"
  249. "swc1 %[temp1], -4(%[p_d]) \n\t"
  250. "bne %[p_s1], %[end], 1b \n\t"
  251. " addiu %[p_s1], %[p_s1], 4 \n\t"
  252. ".set pop \n\t"
  253. : [temp0]"=&f"(temp0), [temp1]"=&f"(temp1),
  254. [temp2]"=&f"(temp2), [p_d]"+r"(p_d),
  255. [p_s0]"+r"(p_s0), [p_s1]"+r"(p_s1)
  256. : [end]"r"(end)
  257. : "memory"
  258. );
  259. }
  260. static void ps_decorrelate_mips(float (*out)[2], float (*delay)[2],
  261. float (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2],
  262. const float phi_fract[2], float (*Q_fract)[2],
  263. const float *transient_gain,
  264. float g_decay_slope,
  265. int len)
  266. {
  267. float *p_delay = &delay[0][0];
  268. float *p_out = &out[0][0];
  269. float *p_ap_delay = &ap_delay[0][0][0];
  270. float *p_t_gain = (float*)transient_gain;
  271. float *p_Q_fract = &Q_fract[0][0];
  272. float ag0, ag1, ag2;
  273. float phi_fract0 = phi_fract[0];
  274. float phi_fract1 = phi_fract[1];
  275. float temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9;
  276. len = (int)((int*)p_delay + (len << 1));
  277. /* merged 2 loops */
  278. __asm__ volatile(
  279. ".set push \n\t"
  280. ".set noreorder \n\t"
  281. "li.s %[ag0], 0.65143905753106 \n\t"
  282. "li.s %[ag1], 0.56471812200776 \n\t"
  283. "li.s %[ag2], 0.48954165955695 \n\t"
  284. "mul.s %[ag0], %[ag0], %[g_decay_slope] \n\t"
  285. "mul.s %[ag1], %[ag1], %[g_decay_slope] \n\t"
  286. "mul.s %[ag2], %[ag2], %[g_decay_slope] \n\t"
  287. "1: \n\t"
  288. "lwc1 %[temp0], 0(%[p_delay]) \n\t"
  289. "lwc1 %[temp1], 4(%[p_delay]) \n\t"
  290. "lwc1 %[temp4], 16(%[p_ap_delay]) \n\t"
  291. "lwc1 %[temp5], 20(%[p_ap_delay]) \n\t"
  292. "mul.s %[temp3], %[temp0], %[phi_fract1] \n\t"
  293. "lwc1 %[temp6], 0(%[p_Q_fract]) \n\t"
  294. "mul.s %[temp2], %[temp1], %[phi_fract1] \n\t"
  295. "lwc1 %[temp7], 4(%[p_Q_fract]) \n\t"
  296. "madd.s %[temp3], %[temp3], %[temp1], %[phi_fract0] \n\t"
  297. "msub.s %[temp2], %[temp2], %[temp0], %[phi_fract0] \n\t"
  298. "mul.s %[temp8], %[temp5], %[temp7] \n\t"
  299. "mul.s %[temp9], %[temp4], %[temp7] \n\t"
  300. "lwc1 %[temp7], 12(%[p_Q_fract]) \n\t"
  301. "mul.s %[temp0], %[ag0], %[temp2] \n\t"
  302. "mul.s %[temp1], %[ag0], %[temp3] \n\t"
  303. "msub.s %[temp8], %[temp8], %[temp4], %[temp6] \n\t"
  304. "lwc1 %[temp4], 304(%[p_ap_delay]) \n\t"
  305. "madd.s %[temp9], %[temp9], %[temp5], %[temp6] \n\t"
  306. "lwc1 %[temp5], 308(%[p_ap_delay]) \n\t"
  307. "sub.s %[temp0], %[temp8], %[temp0] \n\t"
  308. "sub.s %[temp1], %[temp9], %[temp1] \n\t"
  309. "madd.s %[temp2], %[temp2], %[ag0], %[temp0] \n\t"
  310. "lwc1 %[temp6], 8(%[p_Q_fract]) \n\t"
  311. "madd.s %[temp3], %[temp3], %[ag0], %[temp1] \n\t"
  312. "mul.s %[temp8], %[temp5], %[temp7] \n\t"
  313. "mul.s %[temp9], %[temp4], %[temp7] \n\t"
  314. "lwc1 %[temp7], 20(%[p_Q_fract]) \n\t"
  315. "msub.s %[temp8], %[temp8], %[temp4], %[temp6] \n\t"
  316. "swc1 %[temp2], 40(%[p_ap_delay]) \n\t"
  317. "mul.s %[temp2], %[ag1], %[temp0] \n\t"
  318. "swc1 %[temp3], 44(%[p_ap_delay]) \n\t"
  319. "mul.s %[temp3], %[ag1], %[temp1] \n\t"
  320. "lwc1 %[temp4], 592(%[p_ap_delay]) \n\t"
  321. "madd.s %[temp9], %[temp9], %[temp5], %[temp6] \n\t"
  322. "lwc1 %[temp5], 596(%[p_ap_delay]) \n\t"
  323. "sub.s %[temp2], %[temp8], %[temp2] \n\t"
  324. "sub.s %[temp3], %[temp9], %[temp3] \n\t"
  325. "lwc1 %[temp6], 16(%[p_Q_fract]) \n\t"
  326. "madd.s %[temp0], %[temp0], %[ag1], %[temp2] \n\t"
  327. "madd.s %[temp1], %[temp1], %[ag1], %[temp3] \n\t"
  328. "mul.s %[temp8], %[temp5], %[temp7] \n\t"
  329. "mul.s %[temp9], %[temp4], %[temp7] \n\t"
  330. "msub.s %[temp8], %[temp8], %[temp4], %[temp6] \n\t"
  331. "madd.s %[temp9], %[temp9], %[temp5], %[temp6] \n\t"
  332. "swc1 %[temp0], 336(%[p_ap_delay]) \n\t"
  333. "mul.s %[temp0], %[ag2], %[temp2] \n\t"
  334. "swc1 %[temp1], 340(%[p_ap_delay]) \n\t"
  335. "mul.s %[temp1], %[ag2], %[temp3] \n\t"
  336. "lwc1 %[temp4], 0(%[p_t_gain]) \n\t"
  337. "sub.s %[temp0], %[temp8], %[temp0] \n\t"
  338. "addiu %[p_ap_delay], %[p_ap_delay], 8 \n\t"
  339. "sub.s %[temp1], %[temp9], %[temp1] \n\t"
  340. "addiu %[p_t_gain], %[p_t_gain], 4 \n\t"
  341. "madd.s %[temp2], %[temp2], %[ag2], %[temp0] \n\t"
  342. "addiu %[p_delay], %[p_delay], 8 \n\t"
  343. "madd.s %[temp3], %[temp3], %[ag2], %[temp1] \n\t"
  344. "addiu %[p_out], %[p_out], 8 \n\t"
  345. "mul.s %[temp5], %[temp4], %[temp0] \n\t"
  346. "mul.s %[temp6], %[temp4], %[temp1] \n\t"
  347. "swc1 %[temp2], 624(%[p_ap_delay]) \n\t"
  348. "swc1 %[temp3], 628(%[p_ap_delay]) \n\t"
  349. "swc1 %[temp5], -8(%[p_out]) \n\t"
  350. "swc1 %[temp6], -4(%[p_out]) \n\t"
  351. "bne %[p_delay], %[len], 1b \n\t"
  352. " swc1 %[temp6], -4(%[p_out]) \n\t"
  353. ".set pop \n\t"
  354. : [temp0]"=&f"(temp0), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2),
  355. [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5),
  356. [temp6]"=&f"(temp6), [temp7]"=&f"(temp7), [temp8]"=&f"(temp8),
  357. [temp9]"=&f"(temp9), [p_delay]"+r"(p_delay), [p_ap_delay]"+r"(p_ap_delay),
  358. [p_Q_fract]"+r"(p_Q_fract), [p_t_gain]"+r"(p_t_gain), [p_out]"+r"(p_out),
  359. [ag0]"=&f"(ag0), [ag1]"=&f"(ag1), [ag2]"=&f"(ag2)
  360. : [phi_fract0]"f"(phi_fract0), [phi_fract1]"f"(phi_fract1),
  361. [len]"r"(len), [g_decay_slope]"f"(g_decay_slope)
  362. : "memory"
  363. );
  364. }
  365. static void ps_stereo_interpolate_mips(float (*l)[2], float (*r)[2],
  366. float h[2][4], float h_step[2][4],
  367. int len)
  368. {
  369. float h0 = h[0][0];
  370. float h1 = h[0][1];
  371. float h2 = h[0][2];
  372. float h3 = h[0][3];
  373. float hs0 = h_step[0][0];
  374. float hs1 = h_step[0][1];
  375. float hs2 = h_step[0][2];
  376. float hs3 = h_step[0][3];
  377. float temp0, temp1, temp2, temp3;
  378. float l_re, l_im, r_re, r_im;
  379. len = (int)((int*)l + (len << 1));
  380. __asm__ volatile(
  381. ".set push \n\t"
  382. ".set noreorder \n\t"
  383. "1: \n\t"
  384. "add.s %[h0], %[h0], %[hs0] \n\t"
  385. "lwc1 %[l_re], 0(%[l]) \n\t"
  386. "add.s %[h1], %[h1], %[hs1] \n\t"
  387. "lwc1 %[r_re], 0(%[r]) \n\t"
  388. "add.s %[h2], %[h2], %[hs2] \n\t"
  389. "lwc1 %[l_im], 4(%[l]) \n\t"
  390. "add.s %[h3], %[h3], %[hs3] \n\t"
  391. "lwc1 %[r_im], 4(%[r]) \n\t"
  392. "mul.s %[temp0], %[h0], %[l_re] \n\t"
  393. "addiu %[l], %[l], 8 \n\t"
  394. "mul.s %[temp2], %[h1], %[l_re] \n\t"
  395. "addiu %[r], %[r], 8 \n\t"
  396. "madd.s %[temp0], %[temp0], %[h2], %[r_re] \n\t"
  397. "madd.s %[temp2], %[temp2], %[h3], %[r_re] \n\t"
  398. "mul.s %[temp1], %[h0], %[l_im] \n\t"
  399. "mul.s %[temp3], %[h1], %[l_im] \n\t"
  400. "madd.s %[temp1], %[temp1], %[h2], %[r_im] \n\t"
  401. "madd.s %[temp3], %[temp3], %[h3], %[r_im] \n\t"
  402. "swc1 %[temp0], -8(%[l]) \n\t"
  403. "swc1 %[temp2], -8(%[r]) \n\t"
  404. "swc1 %[temp1], -4(%[l]) \n\t"
  405. "bne %[l], %[len], 1b \n\t"
  406. " swc1 %[temp3], -4(%[r]) \n\t"
  407. ".set pop \n\t"
  408. : [temp0]"=&f"(temp0), [temp1]"=&f"(temp1),
  409. [temp2]"=&f"(temp2), [temp3]"=&f"(temp3),
  410. [h0]"+f"(h0), [h1]"+f"(h1), [h2]"+f"(h2),
  411. [h3]"+f"(h3), [l]"+r"(l), [r]"+r"(r),
  412. [l_re]"=&f"(l_re), [l_im]"=&f"(l_im),
  413. [r_re]"=&f"(r_re), [r_im]"=&f"(r_im)
  414. : [hs0]"f"(hs0), [hs1]"f"(hs1), [hs2]"f"(hs2),
  415. [hs3]"f"(hs3), [len]"r"(len)
  416. : "memory"
  417. );
  418. }
  419. #endif /* HAVE_MIPSFPU */
  420. #endif /* HAVE_INLINE_ASM */
  421. void ff_psdsp_init_mips(PSDSPContext *s)
  422. {
  423. #if HAVE_INLINE_ASM
  424. s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_mips;
  425. s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_mips;
  426. #if HAVE_MIPSFPU
  427. s->add_squares = ps_add_squares_mips;
  428. s->mul_pair_single = ps_mul_pair_single_mips;
  429. s->decorrelate = ps_decorrelate_mips;
  430. s->stereo_interpolate[0] = ps_stereo_interpolate_mips;
  431. #endif /* HAVE_MIPSFPU */
  432. #endif /* HAVE_INLINE_ASM */
  433. }