60 static void ps_hybrid_analysis_ileave_mips(
float (*
out)[32][2],
float L[2][38][64],
63 int temp0, temp1, temp2, temp3;
64 int temp4, temp5, temp6, temp7;
65 float *out1=&
out[i][0][0];
66 float *
L1=&L[0][0][i];
74 "lw %[temp0], 0(%[L1]) \n\t"
75 "lw %[temp1], 9728(%[L1]) \n\t"
76 "lw %[temp2], 256(%[L1]) \n\t"
77 "lw %[temp3], 9984(%[L1]) \n\t"
78 "lw %[temp4], 512(%[L1]) \n\t"
79 "lw %[temp5], 10240(%[L1]) \n\t"
80 "lw %[temp6], 768(%[L1]) \n\t"
81 "lw %[temp7], 10496(%[L1]) \n\t"
82 "sw %[temp0], 0(%[out1]) \n\t"
83 "sw %[temp1], 4(%[out1]) \n\t"
84 "sw %[temp2], 8(%[out1]) \n\t"
85 "sw %[temp3], 12(%[out1]) \n\t"
86 "sw %[temp4], 16(%[out1]) \n\t"
87 "sw %[temp5], 20(%[out1]) \n\t"
88 "sw %[temp6], 24(%[out1]) \n\t"
89 "sw %[temp7], 28(%[out1]) \n\t"
92 "bne %[out1], %[j], 1b \n\t"
94 : [out1]
"+r"(out1), [L1]
"+r"(L1), [j]
"+r"(j),
95 [temp0]
"=&r"(temp0), [temp1]
"=&r"(temp1),
96 [temp2]
"=&r"(temp2), [temp3]
"=&r"(temp3),
97 [temp4]
"=&r"(temp4), [temp5]
"=&r"(temp5),
98 [temp6]
"=&r"(temp6), [temp7]
"=&r"(temp7)
108 static void ps_hybrid_synthesis_deint_mips(
float out[2][38][64],
113 int temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7;
114 float *out1 = (
float*)out + i;
115 float *out2 = (
float*)out + 2432 + i;
116 float *in1 = (
float*)
in + 64 * i;
117 float *in2 = (
float*)
in + 64 * i + 1;
119 for (; i < 64; i++) {
120 for (n = 0; n < 7; n++) {
124 "lw %[temp0], 0(%[in1]) \n\t"
125 "lw %[temp1], 0(%[in2]) \n\t"
126 "lw %[temp2], 8(%[in1]) \n\t"
127 "lw %[temp3], 8(%[in2]) \n\t"
128 "lw %[temp4], 16(%[in1]) \n\t"
129 "lw %[temp5], 16(%[in2]) \n\t"
130 "lw %[temp6], 24(%[in1]) \n\t"
131 "lw %[temp7], 24(%[in2]) \n\t"
136 "sw %[temp0], -1024(%[out1]) \n\t"
137 "sw %[temp1], -1024(%[out2]) \n\t"
138 "sw %[temp2], -768(%[out1]) \n\t"
139 "sw %[temp3], -768(%[out2]) \n\t"
140 "sw %[temp4], -512(%[out1]) \n\t"
141 "sw %[temp5], -512(%[out2]) \n\t"
142 "sw %[temp6], -256(%[out1]) \n\t"
143 "sw %[temp7], -256(%[out2]) \n\t"
145 : [temp0]
"=&r"(temp0), [temp1]
"=&r"(temp1),
146 [temp2]
"=&r"(temp2), [temp3]
"=&r"(temp3),
147 [temp4]
"=&r"(temp4), [temp5]
"=&r"(temp5),
148 [temp6]
"=&r"(temp6), [temp7]
"=&r"(temp7),
149 [out1]
"+r"(out1), [out2]
"+r"(out2),
150 [in1]
"+r"(in1), [in2]
"+r"(in2)
157 "lw %[temp0], 0(%[in1]) \n\t"
158 "lw %[temp1], 0(%[in2]) \n\t"
159 "lw %[temp2], 8(%[in1]) \n\t"
160 "lw %[temp3], 8(%[in2]) \n\t"
161 "lw %[temp4], 16(%[in1]) \n\t"
162 "lw %[temp5], 16(%[in2]) \n\t"
163 "lw %[temp6], 24(%[in1]) \n\t"
164 "lw %[temp7], 24(%[in2]) \n\t"
169 "sw %[temp0], 7164(%[out1]) \n\t"
170 "sw %[temp1], 7164(%[out2]) \n\t"
171 "sw %[temp2], 7420(%[out1]) \n\t"
172 "sw %[temp3], 7420(%[out2]) \n\t"
173 "sw %[temp4], 7676(%[out1]) \n\t"
174 "sw %[temp5], 7676(%[out2]) \n\t"
175 "sw %[temp6], 7932(%[out1]) \n\t"
176 "sw %[temp7], 7932(%[out2]) \n\t"
178 : [temp0]
"=&r"(temp0), [temp1]
"=&r"(temp1),
179 [temp2]
"=&r"(temp2), [temp3]
"=&r"(temp3),
180 [temp4]
"=&r"(temp4), [temp5]
"=&r"(temp5),
181 [temp6]
"=&r"(temp6), [temp7]
"=&r"(temp7),
182 [out1]
"+r"(out1), [out2]
"+r"(out2),
183 [in1]
"+r"(in1), [in2]
"+r"(in2)
191 static void ps_add_squares_mips(
float *dst,
const float (*
src)[2],
int n)
194 float temp0, temp1, temp2, temp3, temp4, temp5;
195 float temp6, temp7, temp8, temp9, temp10, temp11;
196 float *src0 = (
float*)&
src[0][0];
197 float *dst0 = &dst[0];
199 for (i = 0; i < 8; i++) {
202 "lwc1 %[temp0], 0(%[src0]) \n\t"
203 "lwc1 %[temp1], 4(%[src0]) \n\t"
204 "lwc1 %[temp2], 8(%[src0]) \n\t"
205 "lwc1 %[temp3], 12(%[src0]) \n\t"
206 "lwc1 %[temp4], 16(%[src0]) \n\t"
207 "lwc1 %[temp5], 20(%[src0]) \n\t"
208 "lwc1 %[temp6], 24(%[src0]) \n\t"
209 "lwc1 %[temp7], 28(%[src0]) \n\t"
210 "lwc1 %[temp8], 0(%[dst0]) \n\t"
211 "lwc1 %[temp9], 4(%[dst0]) \n\t"
212 "lwc1 %[temp10], 8(%[dst0]) \n\t"
213 "lwc1 %[temp11], 12(%[dst0]) \n\t"
214 "mul.s %[temp1], %[temp1], %[temp1] \n\t"
215 "mul.s %[temp3], %[temp3], %[temp3] \n\t"
216 "mul.s %[temp5], %[temp5], %[temp5] \n\t"
217 "mul.s %[temp7], %[temp7], %[temp7] \n\t"
218 "madd.s %[temp0], %[temp1], %[temp0], %[temp0] \n\t"
219 "madd.s %[temp2], %[temp3], %[temp2], %[temp2] \n\t"
220 "madd.s %[temp4], %[temp5], %[temp4], %[temp4] \n\t"
221 "madd.s %[temp6], %[temp7], %[temp6], %[temp6] \n\t"
222 "add.s %[temp0], %[temp8], %[temp0] \n\t"
223 "add.s %[temp2], %[temp9], %[temp2] \n\t"
224 "add.s %[temp4], %[temp10], %[temp4] \n\t"
225 "add.s %[temp6], %[temp11], %[temp6] \n\t"
226 "swc1 %[temp0], 0(%[dst0]) \n\t"
227 "swc1 %[temp2], 4(%[dst0]) \n\t"
228 "swc1 %[temp4], 8(%[dst0]) \n\t"
229 "swc1 %[temp6], 12(%[dst0]) \n\t"
233 : [temp0]
"=&f"(temp0), [temp1]
"=&f"(temp1), [temp2]
"=&f"(temp2),
234 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4), [temp5]
"=&f"(temp5),
235 [temp6]
"=&f"(temp6), [temp7]
"=&f"(temp7), [temp8]
"=&f"(temp8),
236 [temp9]
"=&f"(temp9), [dst0]
"+r"(dst0), [src0]
"+r"(src0),
237 [temp10]
"=&f"(temp10), [temp11]
"=&f"(temp11)
244 static void ps_mul_pair_single_mips(
float (*dst)[2],
float (*src0)[2],
float *src1,
247 float temp0, temp1, temp2;
248 float *p_d, *p_s0, *p_s1, *
end;
256 ".set noreorder \n\t"
258 "lwc1 %[temp2], 0(%[p_s1]) \n\t"
259 "lwc1 %[temp0], 0(%[p_s0]) \n\t"
260 "lwc1 %[temp1], 4(%[p_s0]) \n\t"
262 "mul.s %[temp0], %[temp0], %[temp2] \n\t"
263 "mul.s %[temp1], %[temp1], %[temp2] \n\t"
265 "swc1 %[temp0], -8(%[p_d]) \n\t"
266 "swc1 %[temp1], -4(%[p_d]) \n\t"
267 "bne %[p_s1], %[end], 1b \n\t"
271 : [temp0]
"=&f"(temp0), [temp1]
"=&f"(temp1),
272 [temp2]
"=&f"(temp2), [p_d]
"+r"(p_d),
273 [p_s0]
"+r"(p_s0), [p_s1]
"+r"(p_s1)
279 static void ps_decorrelate_mips(
float (*out)[2],
float (*delay)[2],
281 const float phi_fract[2],
const float (*Q_fract)[2],
282 const float *transient_gain,
286 float *p_delay = &delay[0][0];
287 float *p_out = &out[0][0];
288 float *p_ap_delay = &ap_delay[0][0][0];
289 const float *p_t_gain = transient_gain;
290 const float *p_Q_fract = &Q_fract[0][0];
292 float phi_fract0 = phi_fract[0];
293 float phi_fract1 = phi_fract[1];
294 float temp0, temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9;
296 float *p_delay_end = (p_delay + (len << 1));
301 ".set noreorder \n\t"
302 "li.s %[ag0], 0.65143905753106 \n\t"
303 "li.s %[ag1], 0.56471812200776 \n\t"
304 "li.s %[ag2], 0.48954165955695 \n\t"
305 "mul.s %[ag0], %[ag0], %[g_decay_slope] \n\t"
306 "mul.s %[ag1], %[ag1], %[g_decay_slope] \n\t"
307 "mul.s %[ag2], %[ag2], %[g_decay_slope] \n\t"
309 "lwc1 %[temp0], 0(%[p_delay]) \n\t"
310 "lwc1 %[temp1], 4(%[p_delay]) \n\t"
311 "lwc1 %[temp4], 16(%[p_ap_delay]) \n\t"
312 "lwc1 %[temp5], 20(%[p_ap_delay]) \n\t"
313 "mul.s %[temp3], %[temp0], %[phi_fract1] \n\t"
314 "lwc1 %[temp6], 0(%[p_Q_fract]) \n\t"
315 "mul.s %[temp2], %[temp1], %[phi_fract1] \n\t"
316 "lwc1 %[temp7], 4(%[p_Q_fract]) \n\t"
317 "madd.s %[temp3], %[temp3], %[temp1], %[phi_fract0] \n\t"
318 "msub.s %[temp2], %[temp2], %[temp0], %[phi_fract0] \n\t"
319 "mul.s %[temp8], %[temp5], %[temp7] \n\t"
320 "mul.s %[temp9], %[temp4], %[temp7] \n\t"
321 "lwc1 %[temp7], 12(%[p_Q_fract]) \n\t"
322 "mul.s %[temp0], %[ag0], %[temp2] \n\t"
323 "mul.s %[temp1], %[ag0], %[temp3] \n\t"
324 "msub.s %[temp8], %[temp8], %[temp4], %[temp6] \n\t"
325 "lwc1 %[temp4], 304(%[p_ap_delay]) \n\t"
326 "madd.s %[temp9], %[temp9], %[temp5], %[temp6] \n\t"
327 "lwc1 %[temp5], 308(%[p_ap_delay]) \n\t"
328 "sub.s %[temp0], %[temp8], %[temp0] \n\t"
329 "sub.s %[temp1], %[temp9], %[temp1] \n\t"
330 "madd.s %[temp2], %[temp2], %[ag0], %[temp0] \n\t"
331 "lwc1 %[temp6], 8(%[p_Q_fract]) \n\t"
332 "madd.s %[temp3], %[temp3], %[ag0], %[temp1] \n\t"
333 "mul.s %[temp8], %[temp5], %[temp7] \n\t"
334 "mul.s %[temp9], %[temp4], %[temp7] \n\t"
335 "lwc1 %[temp7], 20(%[p_Q_fract]) \n\t"
336 "msub.s %[temp8], %[temp8], %[temp4], %[temp6] \n\t"
337 "swc1 %[temp2], 40(%[p_ap_delay]) \n\t"
338 "mul.s %[temp2], %[ag1], %[temp0] \n\t"
339 "swc1 %[temp3], 44(%[p_ap_delay]) \n\t"
340 "mul.s %[temp3], %[ag1], %[temp1] \n\t"
341 "lwc1 %[temp4], 592(%[p_ap_delay]) \n\t"
342 "madd.s %[temp9], %[temp9], %[temp5], %[temp6] \n\t"
343 "lwc1 %[temp5], 596(%[p_ap_delay]) \n\t"
344 "sub.s %[temp2], %[temp8], %[temp2] \n\t"
345 "sub.s %[temp3], %[temp9], %[temp3] \n\t"
346 "lwc1 %[temp6], 16(%[p_Q_fract]) \n\t"
347 "madd.s %[temp0], %[temp0], %[ag1], %[temp2] \n\t"
348 "madd.s %[temp1], %[temp1], %[ag1], %[temp3] \n\t"
349 "mul.s %[temp8], %[temp5], %[temp7] \n\t"
350 "mul.s %[temp9], %[temp4], %[temp7] \n\t"
351 "msub.s %[temp8], %[temp8], %[temp4], %[temp6] \n\t"
352 "madd.s %[temp9], %[temp9], %[temp5], %[temp6] \n\t"
353 "swc1 %[temp0], 336(%[p_ap_delay]) \n\t"
354 "mul.s %[temp0], %[ag2], %[temp2] \n\t"
355 "swc1 %[temp1], 340(%[p_ap_delay]) \n\t"
356 "mul.s %[temp1], %[ag2], %[temp3] \n\t"
357 "lwc1 %[temp4], 0(%[p_t_gain]) \n\t"
358 "sub.s %[temp0], %[temp8], %[temp0] \n\t"
359 PTR_ADDIU "%[p_ap_delay], %[p_ap_delay], 8 \n\t"
360 "sub.s %[temp1], %[temp9], %[temp1] \n\t"
361 PTR_ADDIU "%[p_t_gain], %[p_t_gain], 4 \n\t"
362 "madd.s %[temp2], %[temp2], %[ag2], %[temp0] \n\t"
363 PTR_ADDIU "%[p_delay], %[p_delay], 8 \n\t"
364 "madd.s %[temp3], %[temp3], %[ag2], %[temp1] \n\t"
366 "mul.s %[temp5], %[temp4], %[temp0] \n\t"
367 "mul.s %[temp6], %[temp4], %[temp1] \n\t"
368 "swc1 %[temp2], 624(%[p_ap_delay]) \n\t"
369 "swc1 %[temp3], 628(%[p_ap_delay]) \n\t"
370 "swc1 %[temp5], -8(%[p_out]) \n\t"
371 "swc1 %[temp6], -4(%[p_out]) \n\t"
372 "bne %[p_delay], %[p_delay_end],1b \n\t"
373 " swc1 %[temp6], -4(%[p_out]) \n\t"
376 : [temp0]
"=&f"(temp0), [temp1]
"=&f"(temp1), [temp2]
"=&f"(temp2),
377 [temp3]
"=&f"(temp3), [temp4]
"=&f"(temp4), [temp5]
"=&f"(temp5),
378 [temp6]
"=&f"(temp6), [temp7]
"=&f"(temp7), [temp8]
"=&f"(temp8),
379 [temp9]
"=&f"(temp9), [p_delay]
"+r"(p_delay), [p_ap_delay]
"+r"(p_ap_delay),
380 [p_Q_fract]
"+r"(p_Q_fract), [p_t_gain]
"+r"(p_t_gain), [p_out]
"+r"(p_out),
381 [ag0]
"=&f"(ag0), [ag1]
"=&f"(ag1), [ag2]
"=&f"(ag2)
382 : [phi_fract0]
"f"(phi_fract0), [phi_fract1]
"f"(phi_fract1),
383 [p_delay_end]
"r"(p_delay_end), [g_decay_slope]
"f"(g_decay_slope)
388 static void ps_stereo_interpolate_mips(
float (*l)[2],
float (*
r)[2],
389 float h[2][4],
float h_step[2][4],
396 float hs0 = h_step[0][0];
397 float hs1 = h_step[0][1];
398 float hs2 = h_step[0][2];
399 float hs3 = h_step[0][3];
400 float temp0, temp1, temp2, temp3;
401 float l_re, l_im, r_re, r_im;
403 float *l_end = ((
float *)l + (len << 1));
407 ".set noreorder \n\t"
409 "add.s %[h0], %[h0], %[hs0] \n\t"
410 "lwc1 %[l_re], 0(%[l]) \n\t"
411 "add.s %[h1], %[h1], %[hs1] \n\t"
412 "lwc1 %[r_re], 0(%[r]) \n\t"
413 "add.s %[h2], %[h2], %[hs2] \n\t"
414 "lwc1 %[l_im], 4(%[l]) \n\t"
415 "add.s %[h3], %[h3], %[hs3] \n\t"
416 "lwc1 %[r_im], 4(%[r]) \n\t"
417 "mul.s %[temp0], %[h0], %[l_re] \n\t"
419 "mul.s %[temp2], %[h1], %[l_re] \n\t"
421 "madd.s %[temp0], %[temp0], %[h2], %[r_re] \n\t"
422 "madd.s %[temp2], %[temp2], %[h3], %[r_re] \n\t"
423 "mul.s %[temp1], %[h0], %[l_im] \n\t"
424 "mul.s %[temp3], %[h1], %[l_im] \n\t"
425 "madd.s %[temp1], %[temp1], %[h2], %[r_im] \n\t"
426 "madd.s %[temp3], %[temp3], %[h3], %[r_im] \n\t"
427 "swc1 %[temp0], -8(%[l]) \n\t"
428 "swc1 %[temp2], -8(%[r]) \n\t"
429 "swc1 %[temp1], -4(%[l]) \n\t"
430 "bne %[l], %[l_end], 1b \n\t"
431 " swc1 %[temp3], -4(%[r]) \n\t"
434 : [temp0]
"=&f"(temp0), [temp1]
"=&f"(temp1),
435 [temp2]
"=&f"(temp2), [temp3]
"=&f"(temp3),
436 [h0]
"+f"(h0), [h1]
"+f"(h1), [h2]
"+f"(h2),
437 [h3]
"+f"(h3), [l]
"+r"(l), [
r]
"+r"(
r),
438 [l_re]
"=&f"(l_re), [l_im]
"=&f"(l_im),
439 [r_re]
"=&f"(r_re), [r_im]
"=&f"(r_im)
440 : [hs0]
"f"(hs0), [hs1]
"f"(hs1), [hs2]
"f"(hs2),
441 [hs3]
"f"(hs3), [l_end]
"r"(l_end)
MIPS assembly defines from sys/asm.h but rewritten for use with C inline assembly (rather than from w...
void(* decorrelate)(float(*out)[2], float(*delay)[2], float(*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], const float phi_fract[2], const float(*Q_fract)[2], const float *transient_gain, float g_decay_slope, int len)
void(* hybrid_analysis_ileave)(float(*out)[32][2], float L[2][38][64], int i, int len)
void(* mul_pair_single)(float(*dst)[2], float(*src0)[2], float *src1, int n)
void(* stereo_interpolate[2])(float(*l)[2], float(*r)[2], float h[2][4], float h_step[2][4], int len)
static av_cold int end(AVCodecContext *avctx)
static float phi_fract[2][50][2]
void(* hybrid_synthesis_deint)(float out[2][38][64], float(*in)[32][2], int i, int len)
void ff_psdsp_init_mips(PSDSPContext *s)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
#define PS_QMF_TIME_SLOTS
void(* add_squares)(float *dst, const float(*src)[2], int n)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out