57 for (
i = 0;
i <
len;
i++, in++) {
62 for (j = 0; j < 6; j += 2) {
68 re_op = (re_op + 0x40000000) >> 31;
69 im_op = (im_op + 0x40000000) >> 31;
87 for (
i = 0;
i <
len;
i++, in++) {
110 for (
i = 0;
i <
len;
i++, in++) {
120 for (
i = 0;
i < 5;
i++) {
121 for (j = 0; j < 38; j++) {
122 in[
i][j+6][0] =
L[0][j][
i];
123 in[
i][j+6][1] =
L[1][j][
i];
140 for (
i = 0;
i < 5;
i++) {
141 memcpy(in[
i], in[
i]+32, 6 *
sizeof(in[
i][0]));
150 for (n = 0; n <
len; n++) {
151 memset(
out[0][n], 0, 5*
sizeof(
out[0][n][0]));
152 memset(
out[1][n], 0, 5*
sizeof(
out[1][n][0]));
153 for (
i = 0;
i < 12;
i++) {
157 for (
i = 0;
i < 8;
i++) {
161 for (
i = 0;
i < 4;
i++) {
172 for (n = 0; n <
len; n++) {
173 out[0][n][0] = (
UINTFLOAT)in[0][n][0] + in[1][n][0] + in[2][n][0] +
174 (
UINTFLOAT)in[3][n][0] + in[4][n][0] + in[5][n][0];
175 out[1][n][0] = (
UINTFLOAT)in[0][n][1] + in[1][n][1] + in[2][n][1] +
176 (
UINTFLOAT)in[3][n][1] + in[4][n][1] + in[5][n][1];
187 #define DECAY_SLOPE Q30(0.05f)
210 for (;
b >= 0;
b--) {
211 par_mapped[2*
b+1] = par_mapped[2*
b] = par[
b];
217 par_mapped[ 0] = (2*par[ 0] + par[ 1]) / 3;
218 par_mapped[ 1] = ( par[ 1] + 2*par[ 2]) / 3;
219 par_mapped[ 2] = (2*par[ 3] + par[ 4]) / 3;
220 par_mapped[ 3] = ( par[ 4] + 2*par[ 5]) / 3;
221 par_mapped[ 4] = ( par[ 6] + par[ 7]) / 2;
222 par_mapped[ 5] = ( par[ 8] + par[ 9]) / 2;
223 par_mapped[ 6] = par[10];
224 par_mapped[ 7] = par[11];
225 par_mapped[ 8] = ( par[12] + par[13]) / 2;
226 par_mapped[ 9] = ( par[14] + par[15]) / 2;
227 par_mapped[10] = par[16];
229 par_mapped[11] = par[17];
230 par_mapped[12] = par[18];
231 par_mapped[13] = par[19];
232 par_mapped[14] = ( par[20] + par[21]) / 2;
233 par_mapped[15] = ( par[22] + par[23]) / 2;
234 par_mapped[16] = ( par[24] + par[25]) / 2;
235 par_mapped[17] = ( par[26] + par[27]) / 2;
236 par_mapped[18] = ( par[28] + par[29] + par[30] + par[31]) / 4;
237 par_mapped[19] = ( par[32] + par[33]) / 2;
244 par[ 0] = (
int)(((
int64_t)(par[ 0] + (
unsigned)(par[ 1]>>1)) * 1431655765 + \
246 par[ 1] = (
int)(((
int64_t)((par[ 1]>>1) + (
unsigned)par[ 2]) * 1431655765 + \
248 par[ 2] = (
int)(((
int64_t)(par[ 3] + (unsigned)(par[ 4]>>1)) * 1431655765 + \
250 par[ 3] = (
int)(((
int64_t)((par[ 4]>>1) + (
unsigned)par[ 5]) * 1431655765 + \
253 par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333
f;
254 par[ 1] = ( par[ 1] + 2*par[ 2]) * 0.33333333
f;
255 par[ 2] = (2*par[ 3] + par[ 4]) * 0.33333333
f;
256 par[ 3] = ( par[ 4] + 2*par[ 5]) * 0.33333333
f;
273 par[18] = (((par[28]+2)>>2) + ((par[29]+2)>>2) + ((par[30]+2)>>2) + ((par[31]+2)>>2));
275 par[18] = ( par[28] + par[29] + par[30] + par[31]) * 0.25
f;
283 par_mapped[33] = par[9];
284 par_mapped[32] = par[9];
285 par_mapped[31] = par[9];
286 par_mapped[30] = par[9];
287 par_mapped[29] = par[9];
288 par_mapped[28] = par[9];
289 par_mapped[27] = par[8];
290 par_mapped[26] = par[8];
291 par_mapped[25] = par[8];
292 par_mapped[24] = par[8];
293 par_mapped[23] = par[7];
294 par_mapped[22] = par[7];
295 par_mapped[21] = par[7];
296 par_mapped[20] = par[7];
297 par_mapped[19] = par[6];
298 par_mapped[18] = par[6];
299 par_mapped[17] = par[5];
300 par_mapped[16] = par[5];
304 par_mapped[15] = par[4];
305 par_mapped[14] = par[4];
306 par_mapped[13] = par[4];
307 par_mapped[12] = par[4];
308 par_mapped[11] = par[3];
309 par_mapped[10] = par[3];
310 par_mapped[ 9] = par[2];
311 par_mapped[ 8] = par[2];
312 par_mapped[ 7] = par[2];
313 par_mapped[ 6] = par[2];
314 par_mapped[ 5] = par[1];
315 par_mapped[ 4] = par[1];
316 par_mapped[ 3] = par[1];
317 par_mapped[ 2] = par[0];
318 par_mapped[ 1] = par[0];
319 par_mapped[ 0] = par[0];
325 par_mapped[33] = par[19];
326 par_mapped[32] = par[19];
327 par_mapped[31] = par[18];
328 par_mapped[30] = par[18];
329 par_mapped[29] = par[18];
330 par_mapped[28] = par[18];
331 par_mapped[27] = par[17];
332 par_mapped[26] = par[17];
333 par_mapped[25] = par[16];
334 par_mapped[24] = par[16];
335 par_mapped[23] = par[15];
336 par_mapped[22] = par[15];
337 par_mapped[21] = par[14];
338 par_mapped[20] = par[14];
339 par_mapped[19] = par[13];
340 par_mapped[18] = par[12];
341 par_mapped[17] = par[11];
343 par_mapped[16] = par[10];
344 par_mapped[15] = par[ 9];
345 par_mapped[14] = par[ 9];
346 par_mapped[13] = par[ 8];
347 par_mapped[12] = par[ 8];
348 par_mapped[11] = par[ 7];
349 par_mapped[10] = par[ 6];
350 par_mapped[ 9] = par[ 5];
351 par_mapped[ 8] = par[ 5];
352 par_mapped[ 7] = par[ 4];
353 par_mapped[ 6] = par[ 4];
354 par_mapped[ 5] = par[ 3];
355 par_mapped[ 4] = (par[ 2] + par[ 3]) / 2;
356 par_mapped[ 3] = par[ 2];
357 par_mapped[ 2] = par[ 1];
358 par_mapped[ 1] = (par[ 0] + par[ 1]) / 2;
359 par_mapped[ 0] = par[ 0];
409 const float transient_impact = 1.5f;
410 const float a_smooth = 0.25f;
415 const INTFLOAT peak_decay_factor =
Q31(0.76592833836465
f);
427 for (k = 0; k <
NR_BANDS[is34]; k++) {
435 for (n = n0; n < nL; n++) {
437 decayed_peak = (
int)(((
int64_t)peak_decay_factor * \
438 peak_decay_nrg[
i] + 0x40000000) >> 31);
440 power_smooth[
i] += (
power[
i][n] + 2LL - power_smooth[
i]) >> 2;
441 peak_decay_diff_smooth[
i] += (peak_decay_nrg[
i] + 2LL -
power[
i][n] - \
442 peak_decay_diff_smooth[
i]) >> 2;
444 if (peak_decay_diff_smooth[
i]) {
445 transient_gain[
i][n] =
FFMIN(power_smooth[
i]*43691LL / peak_decay_diff_smooth[
i], 1<<16);
447 transient_gain[
i][n] = 1 << 16;
452 for (n = n0; n < nL; n++) {
453 float decayed_peak = peak_decay_factor * peak_decay_nrg[
i];
456 power_smooth[
i] += a_smooth * (
power[
i][n] - power_smooth[
i]);
457 peak_decay_diff_smooth[
i] += a_smooth * (peak_decay_nrg[
i] -
power[
i][n] - peak_decay_diff_smooth[
i]);
458 denom = transient_impact * peak_decay_diff_smooth[
i];
459 transient_gain[
i][n] = (denom > power_smooth[
i]) ?
460 power_smooth[
i] / denom : 1.0
f;
479 g_decay_slope = 1 << 30;
489 g_decay_slope =
av_clipf(g_decay_slope, 0.
f, 1.
f);
491 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
494 memcpy(ap_delay[k][m], ap_delay[k][m]+
numQMFSlots, 5*
sizeof(ap_delay[k][m][0]));
499 transient_gain[
b], g_decay_slope, nL - n0);
503 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
507 transient_gain[
i], nL - n0);
511 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
515 transient_gain[
i], nL - n0);
521 int num_par,
int num_env,
int full)
525 if (num_par == 20 || num_par == 11) {
526 for (e = 0; e < num_env; e++) {
529 }
else if (num_par == 10 || num_par == 5) {
530 for (e = 0; e < num_env; e++) {
540 int num_par,
int num_env,
int full)
544 if (num_par == 34 || num_par == 17) {
545 for (e = 0; e < num_env; e++) {
548 }
else if (num_par == 10 || num_par == 5) {
549 for (e = 0; e < num_env; e++) {
581 memcpy(H11[0][0], H11[0][ps2->
num_env_old],
sizeof(H11[0][0]));
582 memcpy(H11[1][0], H11[1][ps2->
num_env_old],
sizeof(H11[1][0]));
583 memcpy(H12[0][0], H12[0][ps2->
num_env_old],
sizeof(H12[0][0]));
584 memcpy(H12[1][0], H12[1][ps2->
num_env_old],
sizeof(H12[1][0]));
585 memcpy(H21[0][0], H21[0][ps2->
num_env_old],
sizeof(H21[0][0]));
586 memcpy(H21[1][0], H21[1][ps2->
num_env_old],
sizeof(H21[1][0]));
587 memcpy(H22[0][0], H22[0][ps2->
num_env_old],
sizeof(H22[0][0]));
588 memcpy(H22[1][0], H22[1][ps2->
num_env_old],
sizeof(H22[1][0]));
630 for (e = 0; e < ps2->
num_env; e++) {
633 h11 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][0];
634 h12 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][1];
635 h21 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][2];
636 h22 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][3];
643 int opd_idx = opd_hist[
b] * 8 + opd_mapped[e][
b];
644 int ipd_idx = ipd_hist[
b] * 8 + ipd_mapped[e][
b];
649 opd_hist[
b] = opd_idx & 0x3F;
650 ipd_hist[
b] = ipd_idx & 0x3F;
652 ipd_adj_re =
AAC_MADD30(opd_re, ipd_re, opd_im, ipd_im);
653 ipd_adj_im =
AAC_MSUB30(opd_im, ipd_re, opd_re, ipd_im);
662 H11[1][e+1][
b] = h11i;
663 H12[1][e+1][
b] = h12i;
664 H21[1][e+1][
b] = h21i;
665 H22[1][e+1][
b] = h22i;
667 H11[0][e+1][
b] = h11;
668 H12[0][e+1][
b] = h12;
669 H21[0][e+1][
b] = h21;
670 H22[0][e+1][
b] = h22;
672 for (k = 0; k <
NR_BANDS[is34]; k++) {
682 h[0][0] = H11[0][e][
b];
683 h[0][1] = H12[0][e][
b];
684 h[0][2] = H21[0][e][
b];
685 h[0][3] = H22[0][e][
b];
688 if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
689 h[1][0] = -H11[1][e][
b];
690 h[1][1] = -H12[1][e][
b];
691 h[1][2] = -H21[1][e][
b];
692 h[1][3] = -H22[1][e][
b];
694 h[1][0] = H11[1][e][
b];
695 h[1][1] = H12[1][e][
b];
696 h[1][2] = H21[1][e][
b];
697 h[1][3] = H22[1][e][
b];
713 l[k] + 1 + start,
r[k] + 1 + start,
714 h, h_step, stop - start);
724 int is34 = ps->common.is34bands;
727 memset(ps->delay+top, 0, (
NR_BANDS[is34] - top)*
sizeof(ps->delay[0]));
729 memset(ps->ap_delay + top, 0, (
NR_ALLPASS_BANDS[is34] - top)*
sizeof(ps->ap_delay[0]));