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