58 for (
i = 0;
i <
len;
i++, in++) {
63 for (j = 0; j < 6; j += 2) {
69 re_op = (re_op + 0x40000000) >> 31;
70 im_op = (im_op + 0x40000000) >> 31;
88 for (
i = 0;
i <
len;
i++, in++) {
111 for (
i = 0;
i <
len;
i++, in++) {
121 for (
i = 0;
i < 5;
i++) {
122 for (j = 0; j < 38; j++) {
123 in[
i][j+6][0] =
L[0][j][
i];
124 in[
i][j+6][1] =
L[1][j][
i];
141 for (
i = 0;
i < 5;
i++) {
142 memcpy(in[
i], in[
i]+32, 6 *
sizeof(in[
i][0]));
151 for (n = 0; n <
len; n++) {
152 memset(
out[0][n], 0, 5*
sizeof(
out[0][n][0]));
153 memset(
out[1][n], 0, 5*
sizeof(
out[1][n][0]));
154 for (
i = 0;
i < 12;
i++) {
158 for (
i = 0;
i < 8;
i++) {
162 for (
i = 0;
i < 4;
i++) {
173 for (n = 0; n <
len; n++) {
174 out[0][n][0] = (
UINTFLOAT)in[0][n][0] + in[1][n][0] + in[2][n][0] +
175 (
UINTFLOAT)in[3][n][0] + in[4][n][0] + in[5][n][0];
176 out[1][n][0] = (
UINTFLOAT)in[0][n][1] + in[1][n][1] + in[2][n][1] +
177 (
UINTFLOAT)in[3][n][1] + in[4][n][1] + in[5][n][1];
188 #define DECAY_SLOPE Q30(0.05f)
211 for (;
b >= 0;
b--) {
212 par_mapped[2*
b+1] = par_mapped[2*
b] = par[
b];
218 par_mapped[ 0] = (2*par[ 0] + par[ 1]) / 3;
219 par_mapped[ 1] = ( par[ 1] + 2*par[ 2]) / 3;
220 par_mapped[ 2] = (2*par[ 3] + par[ 4]) / 3;
221 par_mapped[ 3] = ( par[ 4] + 2*par[ 5]) / 3;
222 par_mapped[ 4] = ( par[ 6] + par[ 7]) / 2;
223 par_mapped[ 5] = ( par[ 8] + par[ 9]) / 2;
224 par_mapped[ 6] = par[10];
225 par_mapped[ 7] = par[11];
226 par_mapped[ 8] = ( par[12] + par[13]) / 2;
227 par_mapped[ 9] = ( par[14] + par[15]) / 2;
228 par_mapped[10] = par[16];
230 par_mapped[11] = par[17];
231 par_mapped[12] = par[18];
232 par_mapped[13] = par[19];
233 par_mapped[14] = ( par[20] + par[21]) / 2;
234 par_mapped[15] = ( par[22] + par[23]) / 2;
235 par_mapped[16] = ( par[24] + par[25]) / 2;
236 par_mapped[17] = ( par[26] + par[27]) / 2;
237 par_mapped[18] = ( par[28] + par[29] + par[30] + par[31]) / 4;
238 par_mapped[19] = ( par[32] + par[33]) / 2;
245 par[ 0] = (
int)(((int64_t)(par[ 0] + (
unsigned)(par[ 1]>>1)) * 1431655765 + \
247 par[ 1] = (
int)(((int64_t)((par[ 1]>>1) + (
unsigned)par[ 2]) * 1431655765 + \
249 par[ 2] = (
int)(((int64_t)(par[ 3] + (unsigned)(par[ 4]>>1)) * 1431655765 + \
251 par[ 3] = (
int)(((int64_t)((par[ 4]>>1) + (
unsigned)par[ 5]) * 1431655765 + \
254 par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333
f;
255 par[ 1] = ( par[ 1] + 2*par[ 2]) * 0.33333333
f;
256 par[ 2] = (2*par[ 3] + par[ 4]) * 0.33333333
f;
257 par[ 3] = ( par[ 4] + 2*par[ 5]) * 0.33333333
f;
274 par[18] = (((par[28]+2)>>2) + ((par[29]+2)>>2) + ((par[30]+2)>>2) + ((par[31]+2)>>2));
276 par[18] = ( par[28] + par[29] + par[30] + par[31]) * 0.25
f;
284 par_mapped[33] = par[9];
285 par_mapped[32] = par[9];
286 par_mapped[31] = par[9];
287 par_mapped[30] = par[9];
288 par_mapped[29] = par[9];
289 par_mapped[28] = par[9];
290 par_mapped[27] = par[8];
291 par_mapped[26] = par[8];
292 par_mapped[25] = par[8];
293 par_mapped[24] = par[8];
294 par_mapped[23] = par[7];
295 par_mapped[22] = par[7];
296 par_mapped[21] = par[7];
297 par_mapped[20] = par[7];
298 par_mapped[19] = par[6];
299 par_mapped[18] = par[6];
300 par_mapped[17] = par[5];
301 par_mapped[16] = par[5];
305 par_mapped[15] = par[4];
306 par_mapped[14] = par[4];
307 par_mapped[13] = par[4];
308 par_mapped[12] = par[4];
309 par_mapped[11] = par[3];
310 par_mapped[10] = par[3];
311 par_mapped[ 9] = par[2];
312 par_mapped[ 8] = par[2];
313 par_mapped[ 7] = par[2];
314 par_mapped[ 6] = par[2];
315 par_mapped[ 5] = par[1];
316 par_mapped[ 4] = par[1];
317 par_mapped[ 3] = par[1];
318 par_mapped[ 2] = par[0];
319 par_mapped[ 1] = par[0];
320 par_mapped[ 0] = par[0];
326 par_mapped[33] = par[19];
327 par_mapped[32] = par[19];
328 par_mapped[31] = par[18];
329 par_mapped[30] = par[18];
330 par_mapped[29] = par[18];
331 par_mapped[28] = par[18];
332 par_mapped[27] = par[17];
333 par_mapped[26] = par[17];
334 par_mapped[25] = par[16];
335 par_mapped[24] = par[16];
336 par_mapped[23] = par[15];
337 par_mapped[22] = par[15];
338 par_mapped[21] = par[14];
339 par_mapped[20] = par[14];
340 par_mapped[19] = par[13];
341 par_mapped[18] = par[12];
342 par_mapped[17] = par[11];
344 par_mapped[16] = par[10];
345 par_mapped[15] = par[ 9];
346 par_mapped[14] = par[ 9];
347 par_mapped[13] = par[ 8];
348 par_mapped[12] = par[ 8];
349 par_mapped[11] = par[ 7];
350 par_mapped[10] = par[ 6];
351 par_mapped[ 9] = par[ 5];
352 par_mapped[ 8] = par[ 5];
353 par_mapped[ 7] = par[ 4];
354 par_mapped[ 6] = par[ 4];
355 par_mapped[ 5] = par[ 3];
356 par_mapped[ 4] = (par[ 2] + par[ 3]) / 2;
357 par_mapped[ 3] = par[ 2];
358 par_mapped[ 2] = par[ 1];
359 par_mapped[ 1] = (par[ 0] + par[ 1]) / 2;
360 par_mapped[ 0] = par[ 0];
410 const float transient_impact = 1.5f;
411 const float a_smooth = 0.25f;
416 const INTFLOAT peak_decay_factor =
Q31(0.76592833836465
f);
428 for (k = 0; k <
NR_BANDS[is34]; k++) {
436 for (n = n0; n < nL; n++) {
438 decayed_peak = (
int)(((int64_t)peak_decay_factor * \
439 peak_decay_nrg[
i] + 0x40000000) >> 31);
441 power_smooth[
i] += (
power[
i][n] + 2LL - power_smooth[
i]) >> 2;
442 peak_decay_diff_smooth[
i] += (peak_decay_nrg[
i] + 2LL -
power[
i][n] - \
443 peak_decay_diff_smooth[
i]) >> 2;
445 if (peak_decay_diff_smooth[
i]) {
446 transient_gain[
i][n] =
FFMIN(power_smooth[
i]*43691LL / peak_decay_diff_smooth[
i], 1<<16);
448 transient_gain[
i][n] = 1 << 16;
453 for (n = n0; n < nL; n++) {
454 float decayed_peak = peak_decay_factor * peak_decay_nrg[
i];
457 power_smooth[
i] += a_smooth * (
power[
i][n] - power_smooth[
i]);
458 peak_decay_diff_smooth[
i] += a_smooth * (peak_decay_nrg[
i] -
power[
i][n] - peak_decay_diff_smooth[
i]);
459 denom = transient_impact * peak_decay_diff_smooth[
i];
460 transient_gain[
i][n] = (denom > power_smooth[
i]) ?
461 power_smooth[
i] / denom : 1.0
f;
480 g_decay_slope = 1 << 30;
490 g_decay_slope =
av_clipf(g_decay_slope, 0.
f, 1.
f);
492 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
495 memcpy(ap_delay[k][m], ap_delay[k][m]+
numQMFSlots, 5*
sizeof(ap_delay[k][m][0]));
500 transient_gain[
b], g_decay_slope, nL - n0);
504 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
508 transient_gain[
i], nL - n0);
512 memcpy(delay[k], delay[k]+nL,
PS_MAX_DELAY*
sizeof(delay[k][0]));
516 transient_gain[
i], nL - n0);
522 int num_par,
int num_env,
int full)
526 if (num_par == 20 || num_par == 11) {
527 for (e = 0; e < num_env; e++) {
530 }
else if (num_par == 10 || num_par == 5) {
531 for (e = 0; e < num_env; e++) {
541 int num_par,
int num_env,
int full)
545 if (num_par == 34 || num_par == 17) {
546 for (e = 0; e < num_env; e++) {
549 }
else if (num_par == 10 || num_par == 5) {
550 for (e = 0; e < num_env; e++) {
582 memcpy(H11[0][0], H11[0][ps2->
num_env_old],
sizeof(H11[0][0]));
583 memcpy(H11[1][0], H11[1][ps2->
num_env_old],
sizeof(H11[1][0]));
584 memcpy(H12[0][0], H12[0][ps2->
num_env_old],
sizeof(H12[0][0]));
585 memcpy(H12[1][0], H12[1][ps2->
num_env_old],
sizeof(H12[1][0]));
586 memcpy(H21[0][0], H21[0][ps2->
num_env_old],
sizeof(H21[0][0]));
587 memcpy(H21[1][0], H21[1][ps2->
num_env_old],
sizeof(H21[1][0]));
588 memcpy(H22[0][0], H22[0][ps2->
num_env_old],
sizeof(H22[0][0]));
589 memcpy(H22[1][0], H22[1][ps2->
num_env_old],
sizeof(H22[1][0]));
631 for (e = 0; e < ps2->
num_env; e++) {
634 h11 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][0];
635 h12 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][1];
636 h21 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][2];
637 h22 = H_LUT[iid_mapped[e][
b] + 7 + 23 * ps2->
iid_quant][icc_mapped[e][
b]][3];
644 int opd_idx = opd_hist[
b] * 8 + opd_mapped[e][
b];
645 int ipd_idx = ipd_hist[
b] * 8 + ipd_mapped[e][
b];
650 opd_hist[
b] = opd_idx & 0x3F;
651 ipd_hist[
b] = ipd_idx & 0x3F;
653 ipd_adj_re =
AAC_MADD30(opd_re, ipd_re, opd_im, ipd_im);
654 ipd_adj_im =
AAC_MSUB30(opd_im, ipd_re, opd_re, ipd_im);
663 H11[1][e+1][
b] = h11i;
664 H12[1][e+1][
b] = h12i;
665 H21[1][e+1][
b] = h21i;
666 H22[1][e+1][
b] = h22i;
668 H11[0][e+1][
b] = h11;
669 H12[0][e+1][
b] = h12;
670 H21[0][e+1][
b] = h21;
671 H22[0][e+1][
b] = h22;
673 for (k = 0; k <
NR_BANDS[is34]; k++) {
683 h[0][0] = H11[0][e][
b];
684 h[0][1] = H12[0][e][
b];
685 h[0][2] = H21[0][e][
b];
686 h[0][3] = H22[0][e][
b];
689 if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
690 h[1][0] = -H11[1][e][
b];
691 h[1][1] = -H12[1][e][
b];
692 h[1][2] = -H21[1][e][
b];
693 h[1][3] = -H22[1][e][
b];
695 h[1][0] = H11[1][e][
b];
696 h[1][1] = H12[1][e][
b];
697 h[1][2] = H21[1][e][
b];
698 h[1][3] = H22[1][e][
b];
714 l[k] + 1 + start,
r[k] + 1 + start,
715 h, h_step, stop - start);
725 int is34 = ps->common.is34bands;
728 memset(ps->delay+top, 0, (
NR_BANDS[is34] - top)*
sizeof(ps->delay[0]));
730 memset(ps->ap_delay + top, 0, (
NR_ALLPASS_BANDS[is34] - top)*
sizeof(ps->ap_delay[0]));