68 static void ac3_bit_alloc_calc_bap_mips(int16_t *
mask, int16_t *psd,
70 int snr_offset,
int floor,
71 const uint8_t *
bap_tab, uint8_t *bap)
73 int band, band_end,
cond;
74 int m, address1, address2;
75 int16_t *psd1, *psd_end;
78 if (snr_offset == -960) {
90 band_end =
FFMIN(band_end, end);
91 psd_end = psd + band_end - 1;
94 "slt %[cond], %[psd1], %[psd_end] \n\t"
95 "beqz %[cond], 1f \n\t"
97 "lh %[address1], 0(%[psd1]) \n\t"
98 "lh %[address2], 2(%[psd1]) \n\t"
100 "subu %[address1], %[address1], %[m] \n\t"
101 "sra %[address1], %[address1], 5 \n\t"
102 "addiu %[address1], %[address1], -32 \n\t"
103 "shll_s.w %[address1], %[address1], 26 \n\t"
104 "subu %[address2], %[address2], %[m] \n\t"
105 "sra %[address2], %[address2], 5 \n\t"
106 "sra %[address1], %[address1], 26 \n\t"
107 "addiu %[address1], %[address1], 32 \n\t"
108 "lbux %[address1], %[address1](%[bap_tab]) \n\t"
109 "addiu %[address2], %[address2], -32 \n\t"
110 "shll_s.w %[address2], %[address2], 26 \n\t"
111 "sb %[address1], 0(%[bap1]) \n\t"
112 "slt %[cond], %[psd1], %[psd_end] \n\t"
113 "sra %[address2], %[address2], 26 \n\t"
114 "addiu %[address2], %[address2], 32 \n\t"
115 "lbux %[address2], %[address2](%[bap_tab]) \n\t"
116 "sb %[address2], 1(%[bap1]) \n\t"
118 "bnez %[cond], 2b \n\t"
119 PTR_ADDIU " %[psd_end], %[psd_end], 2 \n\t"
120 "slt %[cond], %[psd1], %[psd_end] \n\t"
121 "beqz %[cond], 3f \n\t"
123 "lh %[address1], 0(%[psd1]) \n\t"
125 "subu %[address1], %[address1], %[m] \n\t"
126 "sra %[address1], %[address1], 5 \n\t"
127 "addiu %[address1], %[address1], -32 \n\t"
128 "shll_s.w %[address1], %[address1], 26 \n\t"
129 "sra %[address1], %[address1], 26 \n\t"
130 "addiu %[address1], %[address1], 32 \n\t"
131 "lbux %[address1], %[address1](%[bap_tab]) \n\t"
132 "sb %[address1], 0(%[bap1]) \n\t"
136 : [address1]
"=&r"(address1), [address2]
"=&r"(address2),
137 [
cond]
"=&r"(
cond), [bap1]
"+r"(bap1),
138 [psd1]
"+r"(psd1), [psd_end]
"+r"(psd_end)
142 }
while (end > band_end);
145 static void ac3_update_bap_counts_mips(uint16_t mant_cnt[16], uint8_t *bap,
148 void *temp0, *temp2, *temp4, *temp5, *temp6, *temp7;
152 "andi %[temp3], %[len], 3 \n\t"
153 PTR_ADDU "%[temp2], %[bap], %[len] \n\t"
154 PTR_ADDU "%[temp4], %[bap], %[temp3] \n\t"
155 "beq %[temp2], %[temp4], 4f \n\t"
157 "lbu %[temp0], -1(%[temp2]) \n\t"
158 "lbu %[temp5], -2(%[temp2]) \n\t"
159 "lbu %[temp6], -3(%[temp2]) \n\t"
160 "sll %[temp0], %[temp0], 1 \n\t"
161 PTR_ADDU "%[temp0], %[mant_cnt], %[temp0] \n\t"
162 "sll %[temp5], %[temp5], 1 \n\t"
163 PTR_ADDU "%[temp5], %[mant_cnt], %[temp5] \n\t"
164 "lhu %[temp1], 0(%[temp0]) \n\t"
165 "sll %[temp6], %[temp6], 1 \n\t"
166 PTR_ADDU "%[temp6], %[mant_cnt], %[temp6] \n\t"
167 "addiu %[temp1], %[temp1], 1 \n\t"
168 "sh %[temp1], 0(%[temp0]) \n\t"
169 "lhu %[temp1], 0(%[temp5]) \n\t"
170 "lbu %[temp7], -4(%[temp2]) \n\t"
172 "addiu %[temp1], %[temp1], 1 \n\t"
173 "sh %[temp1], 0(%[temp5]) \n\t"
174 "lhu %[temp1], 0(%[temp6]) \n\t"
175 "sll %[temp7], %[temp7], 1 \n\t"
176 PTR_ADDU "%[temp7], %[mant_cnt], %[temp7] \n\t"
177 "addiu %[temp1], %[temp1],1 \n\t"
178 "sh %[temp1], 0(%[temp6]) \n\t"
179 "lhu %[temp1], 0(%[temp7]) \n\t"
180 "addiu %[temp1], %[temp1], 1 \n\t"
181 "sh %[temp1], 0(%[temp7]) \n\t"
182 "bne %[temp2], %[temp4], 1b \n\t"
184 "beqz %[temp3], 2f \n\t"
186 "addiu %[temp3], %[temp3], -1 \n\t"
187 "lbu %[temp0], -1(%[temp2]) \n\t"
189 "sll %[temp0], %[temp0], 1 \n\t"
190 PTR_ADDU "%[temp0], %[mant_cnt], %[temp0] \n\t"
191 "lhu %[temp1], 0(%[temp0]) \n\t"
192 "addiu %[temp1], %[temp1], 1 \n\t"
193 "sh %[temp1], 0(%[temp0]) \n\t"
194 "bgtz %[temp3], 3b \n\t"
197 : [temp0]
"=&r" (temp0), [temp1]
"=&r" (temp1),
198 [temp2]
"=&r" (temp2), [temp3]
"=&r" (temp3),
199 [temp4]
"=&r" (temp4), [temp5]
"=&r" (temp5),
200 [temp6]
"=&r" (temp6), [temp7]
"=&r" (temp7)
201 : [
len]
"r" (
len), [bap]
"r" (bap),
202 [mant_cnt]
"r" (mant_cnt)
209 #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
210 static void float_to_fixed24_mips(
int32_t *
dst,
const float *
src,
size_t len)
212 const float scale = 1 << 24;
214 int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
218 "lwc1 %[src0], 0(%[src]) \n\t"
219 "lwc1 %[src1], 4(%[src]) \n\t"
220 "lwc1 %[src2], 8(%[src]) \n\t"
221 "lwc1 %[src3], 12(%[src]) \n\t"
222 "lwc1 %[src4], 16(%[src]) \n\t"
223 "lwc1 %[src5], 20(%[src]) \n\t"
224 "lwc1 %[src6], 24(%[src]) \n\t"
225 "lwc1 %[src7], 28(%[src]) \n\t"
226 "mul.s %[src0], %[src0], %[scale] \n\t"
227 "mul.s %[src1], %[src1], %[scale] \n\t"
228 "mul.s %[src2], %[src2], %[scale] \n\t"
229 "mul.s %[src3], %[src3], %[scale] \n\t"
230 "mul.s %[src4], %[src4], %[scale] \n\t"
231 "mul.s %[src5], %[src5], %[scale] \n\t"
232 "mul.s %[src6], %[src6], %[scale] \n\t"
233 "mul.s %[src7], %[src7], %[scale] \n\t"
234 "cvt.w.s %[src0], %[src0] \n\t"
235 "cvt.w.s %[src1], %[src1] \n\t"
236 "cvt.w.s %[src2], %[src2] \n\t"
237 "cvt.w.s %[src3], %[src3] \n\t"
238 "cvt.w.s %[src4], %[src4] \n\t"
239 "cvt.w.s %[src5], %[src5] \n\t"
240 "cvt.w.s %[src6], %[src6] \n\t"
241 "cvt.w.s %[src7], %[src7] \n\t"
242 "mfc1 %[temp0], %[src0] \n\t"
243 "mfc1 %[temp1], %[src1] \n\t"
244 "mfc1 %[temp2], %[src2] \n\t"
245 "mfc1 %[temp3], %[src3] \n\t"
246 "mfc1 %[temp4], %[src4] \n\t"
247 "mfc1 %[temp5], %[src5] \n\t"
248 "mfc1 %[temp6], %[src6] \n\t"
249 "mfc1 %[temp7], %[src7] \n\t"
250 "sw %[temp0], 0(%[dst]) \n\t"
251 "sw %[temp1], 4(%[dst]) \n\t"
252 "sw %[temp2], 8(%[dst]) \n\t"
253 "sw %[temp3], 12(%[dst]) \n\t"
254 "sw %[temp4], 16(%[dst]) \n\t"
255 "sw %[temp5], 20(%[dst]) \n\t"
256 "sw %[temp6], 24(%[dst]) \n\t"
257 "sw %[temp7], 28(%[dst]) \n\t"
261 [
src2]
"=&f" (
src2), [src3]
"=&f" (src3),
262 [src4]
"=&f" (src4), [src5]
"=&f" (src5),
263 [src6]
"=&f" (src6), [src7]
"=&f" (src7),
264 [temp0]
"=r" (temp0), [temp1]
"=r" (temp1),
265 [temp2]
"=r" (temp2), [temp3]
"=r" (temp3),
266 [temp4]
"=r" (temp4), [temp5]
"=r" (temp5),
267 [temp6]
"=r" (temp6), [temp7]
"=r" (temp7)
277 static void ac3_downmix_mips(
float **
samples,
float (*
matrix)[2],
278 int out_ch,
int in_ch,
int len)
280 int i, j, i1, i2, i3;
281 float v0, v1, v2, v3;
282 float v4, v5, v6, v7;
283 float samples0, samples1, samples2, samples3, matrix_j, matrix_j2;
284 float *samples_p, *samples_sw, *matrix_p, **samples_x, **samples_end;
288 ".set noreorder \n\t"
292 "move %[i], $zero \n\t"
293 "sll %[j], %[in_ch], " PTRLOG " \n\t"
295 "bne %[out_ch], %[i1], 3f \n\t"
299 "move %[matrix_p], %[matrix] \n\t"
300 "move %[samples_x], %[samples] \n\t"
301 "mtc1 $zero, %[v0] \n\t"
302 "mtc1 $zero, %[v1] \n\t"
303 "mtc1 $zero, %[v2] \n\t"
304 "mtc1 $zero, %[v3] \n\t"
305 "mtc1 $zero, %[v4] \n\t"
306 "mtc1 $zero, %[v5] \n\t"
307 "mtc1 $zero, %[v6] \n\t"
308 "mtc1 $zero, %[v7] \n\t"
309 "addiu %[i1], %[i], 4 \n\t"
310 "addiu %[i2], %[i], 8 \n\t"
311 PTR_L " %[samples_p], 0(%[samples_x]) \n\t"
312 "addiu %[i3], %[i], 12 \n\t"
313 PTR_ADDU "%[samples_end],%[samples_x], %[j] \n\t"
314 "move %[samples_sw], %[samples_p] \n\t"
317 "lwc1 %[matrix_j], 0(%[matrix_p]) \n\t"
318 "lwc1 %[matrix_j2], 4(%[matrix_p]) \n\t"
319 "lwxc1 %[samples0], %[i](%[samples_p]) \n\t"
320 "lwxc1 %[samples1], %[i1](%[samples_p]) \n\t"
321 "lwxc1 %[samples2], %[i2](%[samples_p]) \n\t"
322 "lwxc1 %[samples3], %[i3](%[samples_p]) \n\t"
325 "madd.s %[v0], %[v0], %[samples0], %[matrix_j] \n\t"
326 "madd.s %[v1], %[v1], %[samples1], %[matrix_j] \n\t"
327 "madd.s %[v2], %[v2], %[samples2], %[matrix_j] \n\t"
328 "madd.s %[v3], %[v3], %[samples3], %[matrix_j] \n\t"
329 "madd.s %[v4], %[v4], %[samples0], %[matrix_j2]\n\t"
330 "madd.s %[v5], %[v5], %[samples1], %[matrix_j2]\n\t"
331 "madd.s %[v6], %[v6], %[samples2], %[matrix_j2]\n\t"
332 "madd.s %[v7], %[v7], %[samples3], %[matrix_j2]\n\t"
333 "bne %[samples_x], %[samples_end], 1b \n\t"
334 PTR_L " %[samples_p], 0(%[samples_x]) \n\t"
337 "swxc1 %[v0], %[i](%[samples_sw]) \n\t"
338 "swxc1 %[v1], %[i1](%[samples_sw]) \n\t"
339 "swxc1 %[v2], %[i2](%[samples_sw]) \n\t"
340 "swxc1 %[v3], %[i3](%[samples_sw]) \n\t"
341 "swxc1 %[v4], %[i](%[samples_p]) \n\t"
342 "addiu %[i], 16 \n\t"
343 "swxc1 %[v5], %[i1](%[samples_p]) \n\t"
344 "swxc1 %[v6], %[i2](%[samples_p]) \n\t"
345 "bne %[i], %[len], 2b \n\t"
346 " swxc1 %[v7], %[i3](%[samples_p]) \n\t"
349 "bne %[out_ch], %[i2], 6f \n\t"
353 "move %[matrix_p], %[matrix] \n\t"
354 "move %[samples_x], %[samples] \n\t"
355 "mtc1 $zero, %[v0] \n\t"
356 "mtc1 $zero, %[v1] \n\t"
357 "mtc1 $zero, %[v2] \n\t"
358 "mtc1 $zero, %[v3] \n\t"
359 "addiu %[i1], %[i], 4 \n\t"
360 "addiu %[i2], %[i], 8 \n\t"
361 PTR_L " %[samples_p], 0(%[samples_x]) \n\t"
362 "addiu %[i3], %[i], 12 \n\t"
363 PTR_ADDU "%[samples_end],%[samples_x], %[j] \n\t"
364 "move %[samples_sw], %[samples_p] \n\t"
367 "lwc1 %[matrix_j], 0(%[matrix_p]) \n\t"
368 "lwxc1 %[samples0], %[i](%[samples_p]) \n\t"
369 "lwxc1 %[samples1], %[i1](%[samples_p]) \n\t"
370 "lwxc1 %[samples2], %[i2](%[samples_p]) \n\t"
371 "lwxc1 %[samples3], %[i3](%[samples_p]) \n\t"
374 "madd.s %[v0], %[v0], %[samples0], %[matrix_j] \n\t"
375 "madd.s %[v1], %[v1], %[samples1], %[matrix_j] \n\t"
376 "madd.s %[v2], %[v2], %[samples2], %[matrix_j] \n\t"
377 "madd.s %[v3], %[v3], %[samples3], %[matrix_j] \n\t"
378 "bne %[samples_x], %[samples_end], 4b \n\t"
379 PTR_L " %[samples_p], 0(%[samples_x]) \n\t"
381 "swxc1 %[v0], %[i](%[samples_sw]) \n\t"
382 "addiu %[i], 16 \n\t"
383 "swxc1 %[v1], %[i1](%[samples_sw]) \n\t"
384 "swxc1 %[v2], %[i2](%[samples_sw]) \n\t"
385 "bne %[i], %[len], 5b \n\t"
386 " swxc1 %[v3], %[i3](%[samples_sw]) \n\t"
390 :[samples_p]
"=&r"(samples_p), [matrix_j]
"=&f"(matrix_j), [matrix_j2]
"=&f"(matrix_j2),
391 [samples0]
"=&f"(samples0), [samples1]
"=&f"(samples1),
392 [samples2]
"=&f"(samples2), [samples3]
"=&f"(samples3),
393 [v0]
"=&f"(v0), [v1]
"=&f"(v1), [v2]
"=&f"(v2), [v3]
"=&f"(v3),
394 [v4]
"=&f"(v4), [v5]
"=&f"(v5), [v6]
"=&f"(v6), [v7]
"=&f"(v7),
395 [samples_x]
"=&r"(samples_x), [matrix_p]
"=&r"(matrix_p),
396 [samples_end]
"=&r"(samples_end), [samples_sw]
"=&r"(samples_sw),
397 [i1]
"=&r"(i1), [i2]
"=&r"(i2), [i3]
"=&r"(i3), [
i]
"=&r"(
i),
398 [j]
"=&r"(j), [
len]
"+r"(
len)
400 [in_ch]
"r"(in_ch), [out_ch]
"r"(out_ch)
412 c->bit_alloc_calc_bap = ac3_bit_alloc_calc_bap_mips;
413 c->update_bap_counts = ac3_update_bap_counts_mips;
416 #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
417 c->float_to_fixed24 = float_to_fixed24_mips;