44 const int *sfo = sce->sfo;
49 for (
int sfb = 0; sfb < ics->
max_sfb; sfb++, idx++) {
50 switch (sce->band_type[
g*ics->
max_sfb + sfb]) {
57 sf[idx] = 100 - (sfo[idx] + 100);
64 sf[idx] = -(100 + sfo[idx]);
71 sf[idx] = -sfo[idx] - 100;
87 INTFLOAT *ch0 = cpe->ch[0].AAC_RENAME(coeffs);
88 INTFLOAT *ch1 = cpe->ch[1].AAC_RENAME(coeffs);
91 for (
int sfb = 0; sfb < cpe->max_sfb_ste; sfb++) {
92 const int idx =
g*cpe->max_sfb_ste + sfb;
93 if (cpe->ms_mask[idx] &&
94 cpe->ch[0].band_type[idx] <
NOISE_BT &&
95 cpe->ch[1].band_type[idx] <
NOISE_BT) {
96 for (
int group = 0; group < ics->
group_len[
g]; group++)
98 ac->fdsp->butterflies_fixed(ch0 + group * 128 +
offsets[sfb],
99 ch1 + group * 128 +
offsets[sfb],
102 ac->fdsp->butterflies_float(ch0 + group * 128 +
offsets[sfb],
103 ch1 + group * 128 +
offsets[sfb],
125 INTFLOAT *coef0 = cpe->ch[0].AAC_RENAME(coeffs), *coef1 = cpe->ch[1].AAC_RENAME(coeffs);
130 for (
int sfb = 0; sfb < ics->
max_sfb; sfb++) {
131 const int idx =
g*ics->
max_sfb + sfb;
136 c *= 1 - 2 * cpe->ms_mask[idx];
137 scale =
c * sce1->AAC_RENAME(sf)[idx];
138 for (
int group = 0; group < ics->
group_len[
g]; group++)
141 coef0 + group * 128 +
offsets[sfb],
146 ac->fdsp->vector_fmul_scalar(coef1 + group * 128 +
offsets[sfb],
147 coef0 + group * 128 +
offsets[sfb],
167 const int mmm =
FFMIN(ics->tns_max_bands, ics->max_sfb);
169 int bottom, top, order, start, end,
size,
inc;
178 for (
w = 0;
w < ics->num_windows;
w++) {
179 bottom = ics->num_swb;
182 bottom =
FFMAX(0, top - tns->length[
w][
filt]);
183 order = tns->order[
w][
filt];
190 start = ics->swb_offset[
FFMIN(bottom, mmm)];
191 end = ics->swb_offset[
FFMIN( top, mmm)];
192 if ((
size = end - start) <= 0)
194 if (tns->direction[
w][
filt]) {
204 for (m = 0; m <
size; m++, start +=
inc)
205 for (
i = 1;
i <=
FFMIN(m, order);
i++)
209 for (m = 0; m <
size; m++, start +=
inc) {
210 tmp[0] = coef[start];
211 for (
i = 1;
i <=
FFMIN(m, order);
i++)
213 for (
i = order;
i > 0;
i--)
235 ac->fdsp->vector_fmul(in, in, lwindow_prev, 1024);
237 memset(in, 0, 448 *
sizeof(*in));
238 ac->fdsp->vector_fmul(in + 448, in + 448, swindow_prev, 128);
241 ac->fdsp->vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024);
243 ac->fdsp->vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128);
244 memset(in + 1024 + 576, 0, 448 *
sizeof(*in));
246 ac->mdct_ltp_fn(ac->mdct_ltp,
out, in,
sizeof(
INTFLOAT));
255 const uint16_t *
offsets = sce->ics.swb_offset;
260 INTFLOAT *predFreq = ac->AAC_RENAME(buf_mdct);
261 int16_t num_samples = 2048;
264 num_samples = ltp->
lag + 1024;
265 for (
i = 0;
i < num_samples;
i++)
266 predTime[
i] =
AAC_MUL30(sce->AAC_RENAME(ltp_state)[
i + 2048 - ltp->
lag], ltp->AAC_RENAME(coef));
267 memset(&predTime[
i], 0, (2048 -
i) *
sizeof(*predTime));
271 if (sce->tns.present)
277 sce->AAC_RENAME(coeffs)[
i] += (
UINTFLOAT)predFreq[
i];
287 INTFLOAT *saved = sce->AAC_RENAME(saved);
288 INTFLOAT *saved_ltp = sce->AAC_RENAME(coeffs);
294 memcpy(saved_ltp, saved, 512 *
sizeof(*saved_ltp));
295 memset(saved_ltp + 576, 0, 448 *
sizeof(*saved_ltp));
296 ac->fdsp->vector_fmul_reverse(saved_ltp + 448, ac->AAC_RENAME(buf_mdct) + 960, &swindow[64], 64);
298 for (
i = 0;
i < 64;
i++)
299 saved_ltp[
i + 512] =
AAC_MUL31(ac->AAC_RENAME(buf_mdct)[1023 -
i], swindow[63 -
i]);
301 memcpy(saved_ltp, ac->AAC_RENAME(buf_mdct) + 512, 448 *
sizeof(*saved_ltp));
302 memset(saved_ltp + 576, 0, 448 *
sizeof(*saved_ltp));
303 ac->fdsp->vector_fmul_reverse(saved_ltp + 448, ac->AAC_RENAME(buf_mdct) + 960, &swindow[64], 64);
305 for (
i = 0;
i < 64;
i++)
306 saved_ltp[
i + 512] =
AAC_MUL31(ac->AAC_RENAME(buf_mdct)[1023 -
i], swindow[63 -
i]);
308 ac->fdsp->vector_fmul_reverse(saved_ltp, ac->AAC_RENAME(buf_mdct) + 512, &lwindow[512], 512);
310 for (
i = 0;
i < 512;
i++)
311 saved_ltp[
i + 512] =
AAC_MUL31(ac->AAC_RENAME(buf_mdct)[1023 -
i], lwindow[511 -
i]);
314 memcpy(sce->AAC_RENAME(ltp_state), sce->AAC_RENAME(ltp_state)+1024,
315 1024 *
sizeof(*sce->AAC_RENAME(ltp_state)));
316 memcpy(sce->AAC_RENAME(ltp_state) + 1024, sce->AAC_RENAME(
output),
317 1024 *
sizeof(*sce->AAC_RENAME(ltp_state)));
318 memcpy(sce->AAC_RENAME(ltp_state) + 2048, saved_ltp,
319 1024 *
sizeof(*sce->AAC_RENAME(ltp_state)));
328 INTFLOAT *in = sce->AAC_RENAME(coeffs);
330 INTFLOAT *saved = sce->AAC_RENAME(saved);
334 INTFLOAT *buf = ac->AAC_RENAME(buf_mdct);
340 for (
i = 0;
i < 1024;
i += 128)
341 ac->mdct128_fn(ac->mdct128, buf +
i, in +
i,
sizeof(
INTFLOAT));
343 ac->mdct1024_fn(ac->mdct1024, buf, in,
sizeof(
INTFLOAT));
354 ac->fdsp->vector_fmul_window(
out, saved, buf, lwindow_prev, 512);
356 memcpy(
out, saved, 448 *
sizeof(*
out));
359 ac->fdsp->vector_fmul_window(
out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 64);
360 ac->fdsp->vector_fmul_window(
out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 64);
361 ac->fdsp->vector_fmul_window(
out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 64);
362 ac->fdsp->vector_fmul_window(
out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 64);
363 ac->fdsp->vector_fmul_window(
temp, buf + 3*128 + 64, buf + 4*128, swindow, 64);
364 memcpy(
out + 448 + 4*128,
temp, 64 *
sizeof(*
out));
366 ac->fdsp->vector_fmul_window(
out + 448, saved + 448, buf, swindow_prev, 64);
367 memcpy(
out + 576, buf + 64, 448 *
sizeof(*
out));
373 memcpy( saved,
temp + 64, 64 *
sizeof(*saved));
374 ac->fdsp->vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 64);
375 ac->fdsp->vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 64);
376 ac->fdsp->vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 64);
377 memcpy( saved + 448, buf + 7*128 + 64, 64 *
sizeof(*saved));
379 memcpy( saved, buf + 512, 448 *
sizeof(*saved));
380 memcpy( saved + 448, buf + 7*128 + 64, 64 *
sizeof(*saved));
382 memcpy( saved, buf + 512, 512 *
sizeof(*saved));
392 INTFLOAT *in = sce->AAC_RENAME(coeffs);
394 INTFLOAT *saved = sce->AAC_RENAME(saved);
398 INTFLOAT *buf = ac->AAC_RENAME(buf_mdct);
404 for (
i = 0;
i < 8;
i++)
405 ac->mdct96_fn(ac->mdct96, buf +
i * 96, in +
i * 96,
sizeof(
INTFLOAT));
407 ac->mdct768_fn(ac->mdct768, buf, in,
sizeof(
INTFLOAT));
419 ac->fdsp->vector_fmul_window(
out, saved, buf, lwindow_prev, 384);
421 memcpy(
out, saved, 336 *
sizeof(*
out));
424 ac->fdsp->vector_fmul_window(
out + 336 + 0*96, saved + 336, buf + 0*96, swindow_prev, 48);
425 ac->fdsp->vector_fmul_window(
out + 336 + 1*96, buf + 0*96 + 48, buf + 1*96, swindow, 48);
426 ac->fdsp->vector_fmul_window(
out + 336 + 2*96, buf + 1*96 + 48, buf + 2*96, swindow, 48);
427 ac->fdsp->vector_fmul_window(
out + 336 + 3*96, buf + 2*96 + 48, buf + 3*96, swindow, 48);
428 ac->fdsp->vector_fmul_window(
temp, buf + 3*96 + 48, buf + 4*96, swindow, 48);
429 memcpy(
out + 336 + 4*96,
temp, 48 *
sizeof(*
out));
431 ac->fdsp->vector_fmul_window(
out + 336, saved + 336, buf, swindow_prev, 48);
432 memcpy(
out + 432, buf + 48, 336 *
sizeof(*
out));
438 memcpy( saved,
temp + 48, 48 *
sizeof(*saved));
439 ac->fdsp->vector_fmul_window(saved + 48, buf + 4*96 + 48, buf + 5*96, swindow, 48);
440 ac->fdsp->vector_fmul_window(saved + 144, buf + 5*96 + 48, buf + 6*96, swindow, 48);
441 ac->fdsp->vector_fmul_window(saved + 240, buf + 6*96 + 48, buf + 7*96, swindow, 48);
442 memcpy( saved + 336, buf + 7*96 + 48, 48 *
sizeof(*saved));
444 memcpy( saved, buf + 384, 336 *
sizeof(*saved));
445 memcpy( saved + 336, buf + 7*96 + 48, 48 *
sizeof(*saved));
447 memcpy( saved, buf + 384, 384 *
sizeof(*saved));
457 INTFLOAT *in = sce->AAC_RENAME(coeffs);
459 INTFLOAT *saved = sce->AAC_RENAME(saved);
463 INTFLOAT *buf = ac->AAC_RENAME(buf_mdct);
469 for (
i = 0;
i < 8;
i++)
470 ac->mdct120_fn(ac->mdct120, buf +
i * 120, in +
i * 128,
sizeof(
INTFLOAT));
472 ac->mdct960_fn(ac->mdct960, buf, in,
sizeof(
INTFLOAT));
484 ac->fdsp->vector_fmul_window(
out, saved, buf, lwindow_prev, 480);
486 memcpy(
out, saved, 420 *
sizeof(*
out));
489 ac->fdsp->vector_fmul_window(
out + 420 + 0*120, saved + 420, buf + 0*120, swindow_prev, 60);
490 ac->fdsp->vector_fmul_window(
out + 420 + 1*120, buf + 0*120 + 60, buf + 1*120, swindow, 60);
491 ac->fdsp->vector_fmul_window(
out + 420 + 2*120, buf + 1*120 + 60, buf + 2*120, swindow, 60);
492 ac->fdsp->vector_fmul_window(
out + 420 + 3*120, buf + 2*120 + 60, buf + 3*120, swindow, 60);
493 ac->fdsp->vector_fmul_window(
temp, buf + 3*120 + 60, buf + 4*120, swindow, 60);
494 memcpy(
out + 420 + 4*120,
temp, 60 *
sizeof(*
out));
496 ac->fdsp->vector_fmul_window(
out + 420, saved + 420, buf, swindow_prev, 60);
497 memcpy(
out + 540, buf + 60, 420 *
sizeof(*
out));
503 memcpy( saved,
temp + 60, 60 *
sizeof(*saved));
504 ac->fdsp->vector_fmul_window(saved + 60, buf + 4*120 + 60, buf + 5*120, swindow, 60);
505 ac->fdsp->vector_fmul_window(saved + 180, buf + 5*120 + 60, buf + 6*120, swindow, 60);
506 ac->fdsp->vector_fmul_window(saved + 300, buf + 6*120 + 60, buf + 7*120, swindow, 60);
507 memcpy( saved + 420, buf + 7*120 + 60, 60 *
sizeof(*saved));
509 memcpy( saved, buf + 480, 420 *
sizeof(*saved));
510 memcpy( saved + 420, buf + 7*120 + 60, 60 *
sizeof(*saved));
512 memcpy( saved, buf + 480, 480 *
sizeof(*saved));
519 INTFLOAT *in = sce->AAC_RENAME(coeffs);
521 INTFLOAT *saved = sce->AAC_RENAME(saved);
522 INTFLOAT *buf = ac->AAC_RENAME(buf_mdct);
525 ac->mdct512_fn(ac->mdct512, buf, in,
sizeof(
INTFLOAT));
530 memcpy(
out, saved, 192 *
sizeof(*
out));
531 ac->fdsp->vector_fmul_window(
out + 192, saved + 192, buf,
AAC_RENAME2(sine_128), 64);
532 memcpy(
out + 320, buf + 64, 192 *
sizeof(*
out));
534 ac->fdsp->vector_fmul_window(
out, saved, buf,
AAC_RENAME2(sine_512), 256);
538 memcpy(saved, buf + 256, 256 *
sizeof(*saved));
545 INTFLOAT *saved = sce->AAC_RENAME(saved);
546 INTFLOAT *buf = ac->AAC_RENAME(buf_mdct);
548 const int n = ac->oc[1].m4ac.frame_length_short ? 480 : 512;
549 const int n2 = n >> 1;
550 const int n4 = n >> 2;
559 for (
i = 0;
i < n2;
i+=2) {
561 temp = in[
i ]; in[
i ] = -in[n - 1 -
i]; in[n - 1 -
i] =
temp;
562 temp = -in[
i + 1]; in[
i + 1] = in[n - 2 -
i]; in[n - 2 -
i] =
temp;
566 ac->mdct480_fn(ac->mdct480, buf, in,
sizeof(
INTFLOAT));
568 ac->mdct512_fn(ac->mdct512, buf, in,
sizeof(
INTFLOAT));
570 for (
i = 0;
i < n;
i+=2) {
581 for (
i = n4;
i < n2;
i ++) {
587 for (
i = 0;
i < n2;
i ++) {
593 for (
i = 0;
i < n4;
i ++) {
600 memmove(saved + n, saved, 2 * n *
sizeof(*saved));
601 memcpy( saved, buf, n *
sizeof(*saved));
609 for (
int j = 0; j <
samples; j++){
611 INT32_MIN, INT32_MAX-0x8000)+0x8000;
614 INT32_MIN, INT32_MAX-0x8000)+0x8000;
640 if (!sce->ics.predictor_initialized) {
642 sce->ics.predictor_initialized = 1;
649 for (k = sce->ics.swb_offset[sfb];
650 k < sce->ics.swb_offset[sfb + 1];
652 predict(&sce->AAC_RENAME(predictor_state)[k],
653 &sce->AAC_RENAME(coeffs)[k],
654 sce->ics.predictor_present &&
655 sce->ics.prediction_used[sfb]);
658 if (sce->ics.predictor_reset_group)
660 sce->ics.predictor_reset_group);
667 #define SET(member) aac_dsp->member = AAC_RENAME(member)