139 float c_re,
float c_im,
140 float mag_totall,
float mag_totalr,
141 float fl_phase,
float fr_phase,
142 float bl_phase,
float br_phase,
143 float sl_phase,
float sr_phase,
148 float c_re,
float c_im,
149 float lfe_re,
float lfe_im,
150 float mag_totall,
float mag_totalr,
151 float fl_phase,
float fr_phase,
152 float bl_phase,
float br_phase,
153 float sl_phase,
float sr_phase,
203 s->nb_in_channels =
inlink->channels;
205 for (ch = 0; ch <
inlink->channels; ch++) {
211 if (!
s->input_levels)
213 for (ch = 0; ch <
s->nb_in_channels; ch++)
214 s->input_levels[ch] =
s->level_in;
217 s->input_levels[ch] *=
s->fc_in;
220 s->input_levels[ch] *=
s->fl_in;
223 s->input_levels[ch] *=
s->fr_in;
226 s->input_levels[ch] *=
s->sl_in;
229 s->input_levels[ch] *=
s->sr_in;
232 s->input_levels[ch] *=
s->bl_in;
235 s->input_levels[ch] *=
s->br_in;
238 s->input_levels[ch] *=
s->bc_in;
241 s->input_levels[ch] *=
s->lfe_in;
251 s->lowcut = 1.f *
s->lowcutf / (
inlink->sample_rate * 0.5) * (
s->buf_size / 2);
252 s->highcut = 1.f *
s->highcutf / (
inlink->sample_rate * 0.5) * (
s->buf_size / 2);
268 for (ch = 0; ch < outlink->
channels; ch++) {
274 if (!
s->output_levels)
276 for (ch = 0; ch <
s->nb_out_channels; ch++)
277 s->output_levels[ch] =
s->level_out;
280 s->output_levels[ch] *=
s->fc_out;
283 s->output_levels[ch] *=
s->fl_out;
286 s->output_levels[ch] *=
s->fr_out;
289 s->output_levels[ch] *=
s->sl_out;
292 s->output_levels[ch] *=
s->sr_out;
295 s->output_levels[ch] *=
s->bl_out;
298 s->output_levels[ch] *=
s->br_out;
301 s->output_levels[ch] *=
s->bc_out;
304 s->output_levels[ch] *=
s->lfe_out;
308 if (!
s->overlap_buffer || !
s->output)
316 float reference,
r,
a;
321 reference = angle *
M_PI / 180.f;
342 static inline void get_lfe(
int output_lfe,
int n,
float lowcut,
float highcut,
343 float *lfe_mag,
float *mag_total,
int lfe_mode)
345 if (output_lfe && n < highcut) {
346 *lfe_mag = n < lowcut ? 1.f : .5f*(1.f+
cosf(
M_PI*(lowcut-n)/(lowcut-highcut)));
347 *lfe_mag *= *mag_total;
349 *mag_total -= *lfe_mag;
366 dst = (
float *)
s->output->extended_data[0];
368 mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
370 dst[2 * n ] = mag *
cosf(c_phase);
371 dst[2 * n + 1] = mag *
sinf(c_phase);
383 float l_mag, r_mag, *dstl, *dstr;
385 dstl = (
float *)
s->output->extended_data[0];
386 dstr = (
float *)
s->output->extended_data[1];
388 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
389 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
391 dstl[2 * n ] = l_mag *
cosf(l_phase);
392 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
394 dstr[2 * n ] = r_mag *
cosf(r_phase);
395 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
407 float lfe_mag, l_mag, r_mag, *dstl, *dstr, *dstlfe;
409 dstl = (
float *)
s->output->extended_data[0];
410 dstr = (
float *)
s->output->extended_data[1];
411 dstlfe = (
float *)
s->output->extended_data[2];
413 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
415 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
416 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
418 dstl[2 * n ] = l_mag *
cosf(l_phase);
419 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
421 dstr[2 * n ] = r_mag *
cosf(r_phase);
422 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
424 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
425 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
437 float l_mag, r_mag, c_mag, *dstc, *dstl, *dstr;
439 dstl = (
float *)
s->output->extended_data[0];
440 dstr = (
float *)
s->output->extended_data[1];
441 dstc = (
float *)
s->output->extended_data[2];
443 c_mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
444 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
445 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
447 dstl[2 * n ] = l_mag *
cosf(l_phase);
448 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
450 dstr[2 * n ] = r_mag *
cosf(r_phase);
451 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
453 dstc[2 * n ] = c_mag *
cosf(c_phase);
454 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
466 float lfe_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstlfe;
468 dstl = (
float *)
s->output->extended_data[0];
469 dstr = (
float *)
s->output->extended_data[1];
470 dstc = (
float *)
s->output->extended_data[2];
471 dstlfe = (
float *)
s->output->extended_data[3];
473 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
476 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
477 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
479 dstl[2 * n ] = l_mag *
cosf(l_phase);
480 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
482 dstr[2 * n ] = r_mag *
cosf(r_phase);
483 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
485 dstc[2 * n ] = c_mag *
cosf(c_phase);
486 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
488 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
489 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
502 float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
504 dstl = (
float *)
s->output->extended_data[0];
505 dstr = (
float *)
s->output->extended_data[1];
506 dstc = (
float *)
s->output->extended_data[2];
507 dstlfe = (
float *)
s->output->extended_data[3];
509 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &c_mag,
s->lfe_mode);
511 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
512 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
514 dstl[2 * n ] = l_mag *
cosf(l_phase);
515 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
517 dstr[2 * n ] = r_mag *
cosf(r_phase);
518 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
520 dstc[2 * n ] = c_mag *
cosf(c_phase);
521 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
523 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
524 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
536 float b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb;
538 dstl = (
float *)
s->output->extended_data[0];
539 dstr = (
float *)
s->output->extended_data[1];
540 dstc = (
float *)
s->output->extended_data[2];
541 dstb = (
float *)
s->output->extended_data[3];
545 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
546 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
548 dstl[2 * n ] = l_mag *
cosf(l_phase);
549 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
551 dstr[2 * n ] = r_mag *
cosf(r_phase);
552 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
554 dstc[2 * n ] = c_mag *
cosf(c_phase);
555 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
557 dstb[2 * n ] = b_mag *
cosf(c_phase);
558 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
570 float lfe_mag, b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb, *dstlfe;
572 dstl = (
float *)
s->output->extended_data[0];
573 dstr = (
float *)
s->output->extended_data[1];
574 dstc = (
float *)
s->output->extended_data[2];
575 dstlfe = (
float *)
s->output->extended_data[3];
576 dstb = (
float *)
s->output->extended_data[4];
578 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
580 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
581 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
585 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
586 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
588 dstl[2 * n ] = l_mag *
cosf(l_phase);
589 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
591 dstr[2 * n ] = r_mag *
cosf(r_phase);
592 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
594 dstc[2 * n ] = c_mag *
cosf(c_phase);
595 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
597 dstb[2 * n ] = b_mag *
cosf(c_phase);
598 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
610 float l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs;
612 dstl = (
float *)
s->output->extended_data[0];
613 dstr = (
float *)
s->output->extended_data[1];
614 dstc = (
float *)
s->output->extended_data[2];
615 dstls = (
float *)
s->output->extended_data[3];
616 dstrs = (
float *)
s->output->extended_data[4];
618 c_mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
619 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
620 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
621 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
622 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
624 dstl[2 * n ] = l_mag *
cosf(l_phase);
625 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
627 dstr[2 * n ] = r_mag *
cosf(r_phase);
628 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
630 dstc[2 * n ] = c_mag *
cosf(c_phase);
631 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
633 dstls[2 * n ] = ls_mag *
cosf(l_phase);
634 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
636 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
637 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
649 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
651 dstl = (
float *)
s->output->extended_data[0];
652 dstr = (
float *)
s->output->extended_data[1];
653 dstc = (
float *)
s->output->extended_data[2];
654 dstlfe = (
float *)
s->output->extended_data[3];
655 dstls = (
float *)
s->output->extended_data[4];
656 dstrs = (
float *)
s->output->extended_data[5];
658 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
661 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
662 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
663 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
664 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
666 dstl[2 * n ] = l_mag *
cosf(l_phase);
667 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
669 dstr[2 * n ] = r_mag *
cosf(r_phase);
670 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
672 dstc[2 * n ] = c_mag *
cosf(c_phase);
673 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
675 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
676 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
678 dstls[2 * n ] = ls_mag *
cosf(l_phase);
679 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
681 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
682 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
694 float l_mag, r_mag, ls_mag, rs_mag, c_mag, b_mag, *dstc, *dstb, *dstl, *dstr, *dstls, *dstrs;
696 dstl = (
float *)
s->output->extended_data[0];
697 dstr = (
float *)
s->output->extended_data[1];
698 dstc = (
float *)
s->output->extended_data[2];
699 dstb = (
float *)
s->output->extended_data[3];
700 dstls = (
float *)
s->output->extended_data[4];
701 dstrs = (
float *)
s->output->extended_data[5];
705 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
706 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
707 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
708 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
710 dstl[2 * n ] = l_mag *
cosf(l_phase);
711 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
713 dstr[2 * n ] = r_mag *
cosf(r_phase);
714 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
716 dstc[2 * n ] = c_mag *
cosf(c_phase);
717 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
719 dstls[2 * n ] = ls_mag *
cosf(l_phase);
720 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
722 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
723 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
725 dstb[2 * n ] = b_mag *
cosf(c_phase);
726 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
738 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, b_mag, *dstc, *dstb, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
740 dstl = (
float *)
s->output->extended_data[0];
741 dstr = (
float *)
s->output->extended_data[1];
742 dstc = (
float *)
s->output->extended_data[2];
743 dstlfe = (
float *)
s->output->extended_data[3];
744 dstb = (
float *)
s->output->extended_data[4];
745 dstls = (
float *)
s->output->extended_data[5];
746 dstrs = (
float *)
s->output->extended_data[6];
748 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
752 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
753 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
754 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
755 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
757 dstl[2 * n ] = l_mag *
cosf(l_phase);
758 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
760 dstr[2 * n ] = r_mag *
cosf(r_phase);
761 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
763 dstc[2 * n ] = c_mag *
cosf(c_phase);
764 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
766 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
767 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
769 dstls[2 * n ] = ls_mag *
cosf(l_phase);
770 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
772 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
773 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
775 dstb[2 * n ] = b_mag *
cosf(c_phase);
776 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
789 float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
790 float ls_mag, rs_mag, *dstls, *dstrs;
792 dstl = (
float *)
s->output->extended_data[0];
793 dstr = (
float *)
s->output->extended_data[1];
794 dstc = (
float *)
s->output->extended_data[2];
795 dstlfe = (
float *)
s->output->extended_data[3];
796 dstls = (
float *)
s->output->extended_data[4];
797 dstrs = (
float *)
s->output->extended_data[5];
799 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &c_mag,
s->lfe_mode);
801 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
802 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
803 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
804 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
806 dstl[2 * n ] = l_mag *
cosf(l_phase);
807 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
809 dstr[2 * n ] = r_mag *
cosf(r_phase);
810 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
812 dstc[2 * n ] = c_mag *
cosf(c_phase);
813 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
815 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
816 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
818 dstls[2 * n ] = ls_mag *
cosf(l_phase);
819 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
821 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
822 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
836 float c_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
837 float ls_mag, rs_mag, *dstls, *dstrs;
839 dstl = (
float *)
s->output->extended_data[0];
840 dstr = (
float *)
s->output->extended_data[1];
841 dstc = (
float *)
s->output->extended_data[2];
842 dstlfe = (
float *)
s->output->extended_data[3];
843 dstls = (
float *)
s->output->extended_data[4];
844 dstrs = (
float *)
s->output->extended_data[5];
847 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
848 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
849 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
850 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
852 dstl[2 * n ] = l_mag *
cosf(l_phase);
853 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
855 dstr[2 * n ] = r_mag *
cosf(r_phase);
856 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
858 dstc[2 * n ] = c_mag *
cosf(c_phase);
859 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
861 dstlfe[2 * n ] = lfe_re;
862 dstlfe[2 * n + 1] = lfe_im;
864 dstls[2 * n ] = ls_mag *
cosf(l_phase);
865 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
867 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
868 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
879 float l_mag, r_mag, ls_mag, rs_mag, c_mag, lb_mag, rb_mag;
880 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb;
883 dstl = (
float *)
s->output->extended_data[0];
884 dstr = (
float *)
s->output->extended_data[1];
885 dstc = (
float *)
s->output->extended_data[2];
886 dstlb = (
float *)
s->output->extended_data[3];
887 dstrb = (
float *)
s->output->extended_data[4];
888 dstls = (
float *)
s->output->extended_data[5];
889 dstrs = (
float *)
s->output->extended_data[6];
891 c_mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
892 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
893 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
894 lb_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
895 rb_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
899 dstl[2 * n ] = l_mag *
cosf(l_phase);
900 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
902 dstr[2 * n ] = r_mag *
cosf(r_phase);
903 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
905 dstc[2 * n ] = c_mag *
cosf(c_phase);
906 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
908 dstlb[2 * n ] = lb_mag *
cosf(l_phase);
909 dstlb[2 * n + 1] = lb_mag *
sinf(l_phase);
911 dstrb[2 * n ] = rb_mag *
cosf(r_phase);
912 dstrb[2 * n + 1] = rb_mag *
sinf(r_phase);
914 dstls[2 * n ] = ls_mag *
cosf(l_phase);
915 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
917 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
918 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
929 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, lb_mag, rb_mag;
930 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
933 dstl = (
float *)
s->output->extended_data[0];
934 dstr = (
float *)
s->output->extended_data[1];
935 dstc = (
float *)
s->output->extended_data[2];
936 dstlfe = (
float *)
s->output->extended_data[3];
937 dstlb = (
float *)
s->output->extended_data[4];
938 dstrb = (
float *)
s->output->extended_data[5];
939 dstls = (
float *)
s->output->extended_data[6];
940 dstrs = (
float *)
s->output->extended_data[7];
942 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
945 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
946 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
947 lb_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
948 rb_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
952 dstl[2 * n ] = l_mag *
cosf(l_phase);
953 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
955 dstr[2 * n ] = r_mag *
cosf(r_phase);
956 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
958 dstc[2 * n ] = c_mag *
cosf(c_phase);
959 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
961 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
962 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
964 dstlb[2 * n ] = lb_mag *
cosf(l_phase);
965 dstlb[2 * n + 1] = lb_mag *
sinf(l_phase);
967 dstrb[2 * n ] = rb_mag *
cosf(r_phase);
968 dstrb[2 * n + 1] = rb_mag *
sinf(r_phase);
970 dstls[2 * n ] = ls_mag *
cosf(l_phase);
971 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
973 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
974 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
978 float c_re,
float c_im,
979 float mag_totall,
float mag_totalr,
980 float fl_phase,
float fr_phase,
981 float bl_phase,
float br_phase,
982 float sl_phase,
float sr_phase,
987 float fl_mag, fr_mag, ls_mag, rs_mag, lb_mag, rb_mag;
988 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
989 float lfe_mag, c_phase, mag_total = (mag_totall + mag_totalr) * 0.5;
992 dstl = (
float *)
s->output->extended_data[0];
993 dstr = (
float *)
s->output->extended_data[1];
994 dstc = (
float *)
s->output->extended_data[2];
995 dstlfe = (
float *)
s->output->extended_data[3];
996 dstlb = (
float *)
s->output->extended_data[4];
997 dstrb = (
float *)
s->output->extended_data[5];
998 dstls = (
float *)
s->output->extended_data[6];
999 dstrs = (
float *)
s->output->extended_data[7];
1001 c_phase =
atan2f(c_im, c_re);
1003 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
1005 fl_mag =
powf(.5
f * (xl + 1.
f),
s->fl_x) *
powf((yl + 1.
f) * .5
f,
s->fl_y) * mag_totall;
1006 fr_mag =
powf(.5
f * (xr + 1.
f),
s->fr_x) *
powf((yr + 1.
f) * .5
f,
s->fr_y) * mag_totalr;
1007 lb_mag =
powf(.5
f * (-xl + 1.
f),
s->bl_x) *
powf((yl + 1.
f) * .5
f,
s->bl_y) * mag_totall;
1008 rb_mag =
powf(.5
f * (-xr + 1.
f),
s->br_x) *
powf((yr + 1.
f) * .5
f,
s->br_y) * mag_totalr;
1009 ls_mag =
powf(1.
f -
fabsf(xl),
s->sl_x) *
powf((yl + 1.
f) * .5
f,
s->sl_y) * mag_totall;
1010 rs_mag =
powf(1.
f -
fabsf(xr),
s->sr_x) *
powf((yr + 1.
f) * .5
f,
s->sr_y) * mag_totalr;
1012 dstl[2 * n ] = fl_mag *
cosf(fl_phase);
1013 dstl[2 * n + 1] = fl_mag *
sinf(fl_phase);
1015 dstr[2 * n ] = fr_mag *
cosf(fr_phase);
1016 dstr[2 * n + 1] = fr_mag *
sinf(fr_phase);
1018 dstc[2 * n ] = c_re;
1019 dstc[2 * n + 1] = c_im;
1021 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
1022 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
1024 dstlb[2 * n ] = lb_mag *
cosf(bl_phase);
1025 dstlb[2 * n + 1] = lb_mag *
sinf(bl_phase);
1027 dstrb[2 * n ] = rb_mag *
cosf(br_phase);
1028 dstrb[2 * n + 1] = rb_mag *
sinf(br_phase);
1030 dstls[2 * n ] = ls_mag *
cosf(sl_phase);
1031 dstls[2 * n + 1] = ls_mag *
sinf(sl_phase);
1033 dstrs[2 * n ] = rs_mag *
cosf(sr_phase);
1034 dstrs[2 * n + 1] = rs_mag *
sinf(sr_phase);
1038 float c_re,
float c_im,
1039 float lfe_re,
float lfe_im,
1040 float mag_totall,
float mag_totalr,
1041 float fl_phase,
float fr_phase,
1042 float bl_phase,
float br_phase,
1043 float sl_phase,
float sr_phase,
1048 float fl_mag, fr_mag, ls_mag, rs_mag, lb_mag, rb_mag;
1049 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
1052 dstl = (
float *)
s->output->extended_data[0];
1053 dstr = (
float *)
s->output->extended_data[1];
1054 dstc = (
float *)
s->output->extended_data[2];
1055 dstlfe = (
float *)
s->output->extended_data[3];
1056 dstlb = (
float *)
s->output->extended_data[4];
1057 dstrb = (
float *)
s->output->extended_data[5];
1058 dstls = (
float *)
s->output->extended_data[6];
1059 dstrs = (
float *)
s->output->extended_data[7];
1061 fl_mag =
powf(.5
f * (xl + 1.
f),
s->fl_x) *
powf((yl + 1.
f) * .5
f,
s->fl_y) * mag_totall;
1062 fr_mag =
powf(.5
f * (xr + 1.
f),
s->fr_x) *
powf((yr + 1.
f) * .5
f,
s->fr_y) * mag_totalr;
1063 lb_mag =
powf(.5
f * (-xl + 1.
f),
s->bl_x) *
powf((yl + 1.
f) * .5
f,
s->bl_y) * mag_totall;
1064 rb_mag =
powf(.5
f * (-xr + 1.
f),
s->br_x) *
powf((yr + 1.
f) * .5
f,
s->br_y) * mag_totalr;
1065 ls_mag =
powf(1.
f -
fabsf(xl),
s->sl_x) *
powf((yl + 1.
f) * .5
f,
s->sl_y) * mag_totall;
1066 rs_mag =
powf(1.
f -
fabsf(xr),
s->sr_x) *
powf((yr + 1.
f) * .5
f,
s->sr_y) * mag_totalr;
1068 dstl[2 * n ] = fl_mag *
cosf(fl_phase);
1069 dstl[2 * n + 1] = fl_mag *
sinf(fl_phase);
1071 dstr[2 * n ] = fr_mag *
cosf(fr_phase);
1072 dstr[2 * n + 1] = fr_mag *
sinf(fr_phase);
1074 dstc[2 * n ] = c_re;
1075 dstc[2 * n + 1] = c_im;
1077 dstlfe[2 * n ] = lfe_re;
1078 dstlfe[2 * n + 1] = lfe_im;
1080 dstlb[2 * n ] = lb_mag *
cosf(bl_phase);
1081 dstlb[2 * n + 1] = lb_mag *
sinf(bl_phase);
1083 dstrb[2 * n ] = rb_mag *
cosf(br_phase);
1084 dstrb[2 * n + 1] = rb_mag *
sinf(br_phase);
1086 dstls[2 * n ] = ls_mag *
cosf(sl_phase);
1087 dstls[2 * n + 1] = ls_mag *
sinf(sl_phase);
1089 dstrs[2 * n ] = rs_mag *
cosf(sr_phase);
1090 dstrs[2 * n + 1] = rs_mag *
sinf(sr_phase);
1099 srcl = (
float *)
s->input->extended_data[0];
1100 srcr = (
float *)
s->input->extended_data[1];
1102 for (n = 0; n <
s->buf_size; n++) {
1103 float l_re = srcl[2 * n], r_re = srcr[2 * n];
1104 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
1105 float c_phase =
atan2f(l_im + r_im, l_re + r_re);
1106 float l_mag = hypotf(l_re, l_im);
1107 float r_mag = hypotf(r_re, r_im);
1108 float l_phase =
atan2f(l_im, l_re);
1109 float r_phase =
atan2f(r_im, r_re);
1110 float phase_dif =
fabsf(l_phase - r_phase);
1111 float mag_sum = l_mag + r_mag;
1112 float mag_dif = mag_sum < 0.000001 ?
FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1113 float mag_total = hypotf(l_mag, r_mag);
1116 if (phase_dif >
M_PI)
1117 phase_dif = 2 *
M_PI - phase_dif;
1122 s->upmix_stereo(
ctx, l_phase, r_phase, c_phase, mag_total, x, y, n);
1129 float *srcl, *srcr, *srcc;
1132 srcl = (
float *)
s->input->extended_data[0];
1133 srcr = (
float *)
s->input->extended_data[1];
1134 srcc = (
float *)
s->input->extended_data[2];
1136 for (n = 0; n <
s->buf_size; n++) {
1137 float l_re = srcl[2 * n], r_re = srcr[2 * n];
1138 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
1139 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1140 float c_mag = hypotf(c_re, c_im);
1141 float c_phase =
atan2f(c_im, c_re);
1142 float l_mag = hypotf(l_re, l_im);
1143 float r_mag = hypotf(r_re, r_im);
1144 float l_phase =
atan2f(l_im, l_re);
1145 float r_phase =
atan2f(r_im, r_re);
1146 float phase_dif =
fabsf(l_phase - r_phase);
1147 float mag_sum = l_mag + r_mag;
1148 float mag_dif = mag_sum < 0.000001 ?
FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1149 float mag_total = hypotf(l_mag, r_mag);
1152 if (phase_dif >
M_PI)
1153 phase_dif = 2 *
M_PI - phase_dif;
1158 s->upmix_3_0(
ctx, l_phase, r_phase, c_phase, c_mag, mag_total, x, y, n);
1165 float *srcl, *srcr, *srclfe;
1168 srcl = (
float *)
s->input->extended_data[0];
1169 srcr = (
float *)
s->input->extended_data[1];
1170 srclfe = (
float *)
s->input->extended_data[2];
1172 for (n = 0; n <
s->buf_size; n++) {
1173 float l_re = srcl[2 * n], r_re = srcr[2 * n];
1174 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
1175 float lfe_re = srclfe[2 * n], lfe_im = srclfe[2 * n + 1];
1176 float c_phase =
atan2f(l_im + r_im, l_re + r_re);
1177 float l_mag = hypotf(l_re, l_im);
1178 float r_mag = hypotf(r_re, r_im);
1179 float l_phase =
atan2f(l_im, l_re);
1180 float r_phase =
atan2f(r_im, r_re);
1181 float phase_dif =
fabsf(l_phase - r_phase);
1182 float mag_sum = l_mag + r_mag;
1183 float mag_dif = mag_sum < 0.000001 ?
FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1184 float mag_total = hypotf(l_mag, r_mag);
1187 if (phase_dif >
M_PI)
1188 phase_dif = 2 *
M_PI - phase_dif;
1193 s->upmix_2_1(
ctx, l_phase, r_phase, c_phase, mag_total, lfe_re, lfe_im, x, y, n);
1200 float *srcl, *srcr, *srcc, *srcsl, *srcsr;
1203 srcl = (
float *)
s->input->extended_data[0];
1204 srcr = (
float *)
s->input->extended_data[1];
1205 srcc = (
float *)
s->input->extended_data[2];
1206 srcsl = (
float *)
s->input->extended_data[3];
1207 srcsr = (
float *)
s->input->extended_data[4];
1209 for (n = 0; n <
s->buf_size; n++) {
1210 float fl_re = srcl[2 * n], fr_re = srcr[2 * n];
1211 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
1212 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1213 float sl_re = srcsl[2 * n], sl_im = srcsl[2 * n + 1];
1214 float sr_re = srcsr[2 * n], sr_im = srcsr[2 * n + 1];
1215 float fl_mag = hypotf(fl_re, fl_im);
1216 float fr_mag = hypotf(fr_re, fr_im);
1217 float fl_phase =
atan2f(fl_im, fl_re);
1218 float fr_phase =
atan2f(fr_im, fr_re);
1219 float sl_mag = hypotf(sl_re, sl_im);
1220 float sr_mag = hypotf(sr_re, sr_im);
1221 float sl_phase =
atan2f(sl_im, sl_re);
1222 float sr_phase =
atan2f(sr_im, sr_re);
1223 float phase_difl =
fabsf(fl_phase - sl_phase);
1224 float phase_difr =
fabsf(fr_phase - sr_phase);
1225 float magl_sum = fl_mag + sl_mag;
1226 float magr_sum = fr_mag + sr_mag;
1227 float mag_difl = magl_sum < 0.000001 ?
FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1228 float mag_difr = magr_sum < 0.000001 ?
FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
1229 float mag_totall = hypotf(fl_mag, sl_mag);
1230 float mag_totalr = hypotf(fr_mag, sr_mag);
1231 float bl_phase =
atan2f(fl_im + sl_im, fl_re + sl_re);
1232 float br_phase =
atan2f(fr_im + sr_im, fr_re + sr_re);
1236 if (phase_difl >
M_PI)
1237 phase_difl = 2 *
M_PI - phase_difl;
1239 if (phase_difr >
M_PI)
1240 phase_difr = 2 *
M_PI - phase_difr;
1245 s->upmix_5_0(
ctx, c_re, c_im,
1246 mag_totall, mag_totalr,
1257 float *srcl, *srcr, *srcc, *srclfe, *srcsl, *srcsr;
1260 srcl = (
float *)
s->input->extended_data[0];
1261 srcr = (
float *)
s->input->extended_data[1];
1262 srcc = (
float *)
s->input->extended_data[2];
1263 srclfe = (
float *)
s->input->extended_data[3];
1264 srcsl = (
float *)
s->input->extended_data[4];
1265 srcsr = (
float *)
s->input->extended_data[5];
1267 for (n = 0; n <
s->buf_size; n++) {
1268 float fl_re = srcl[2 * n], fr_re = srcr[2 * n];
1269 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
1270 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1271 float lfe_re = srclfe[2 * n], lfe_im = srclfe[2 * n + 1];
1272 float sl_re = srcsl[2 * n], sl_im = srcsl[2 * n + 1];
1273 float sr_re = srcsr[2 * n], sr_im = srcsr[2 * n + 1];
1274 float fl_mag = hypotf(fl_re, fl_im);
1275 float fr_mag = hypotf(fr_re, fr_im);
1276 float fl_phase =
atan2f(fl_im, fl_re);
1277 float fr_phase =
atan2f(fr_im, fr_re);
1278 float sl_mag = hypotf(sl_re, sl_im);
1279 float sr_mag = hypotf(sr_re, sr_im);
1280 float sl_phase =
atan2f(sl_im, sl_re);
1281 float sr_phase =
atan2f(sr_im, sr_re);
1282 float phase_difl =
fabsf(fl_phase - sl_phase);
1283 float phase_difr =
fabsf(fr_phase - sr_phase);
1284 float magl_sum = fl_mag + sl_mag;
1285 float magr_sum = fr_mag + sr_mag;
1286 float mag_difl = magl_sum < 0.000001 ?
FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1287 float mag_difr = magr_sum < 0.000001 ?
FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
1288 float mag_totall = hypotf(fl_mag, sl_mag);
1289 float mag_totalr = hypotf(fr_mag, sr_mag);
1290 float bl_phase =
atan2f(fl_im + sl_im, fl_re + sl_re);
1291 float br_phase =
atan2f(fr_im + sr_im, fr_re + sr_re);
1295 if (phase_difl >
M_PI)
1296 phase_difl = 2 *
M_PI - phase_difl;
1298 if (phase_difr >
M_PI)
1299 phase_difr = 2 *
M_PI - phase_difr;
1304 s->upmix_5_1(
ctx, c_re, c_im, lfe_re, lfe_im,
1305 mag_totall, mag_totalr,
1316 float *srcl, *srcr, *srcc, *srclfe, *srcbl, *srcbr;
1319 srcl = (
float *)
s->input->extended_data[0];
1320 srcr = (
float *)
s->input->extended_data[1];
1321 srcc = (
float *)
s->input->extended_data[2];
1322 srclfe = (
float *)
s->input->extended_data[3];
1323 srcbl = (
float *)
s->input->extended_data[4];
1324 srcbr = (
float *)
s->input->extended_data[5];
1326 for (n = 0; n <
s->buf_size; n++) {
1327 float fl_re = srcl[2 * n], fr_re = srcr[2 * n];
1328 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
1329 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1330 float lfe_re = srclfe[2 * n], lfe_im = srclfe[2 * n + 1];
1331 float bl_re = srcbl[2 * n], bl_im = srcbl[2 * n + 1];
1332 float br_re = srcbr[2 * n], br_im = srcbr[2 * n + 1];
1333 float fl_mag = hypotf(fl_re, fl_im);
1334 float fr_mag = hypotf(fr_re, fr_im);
1335 float fl_phase =
atan2f(fl_im, fl_re);
1336 float fr_phase =
atan2f(fr_im, fr_re);
1337 float bl_mag = hypotf(bl_re, bl_im);
1338 float br_mag = hypotf(br_re, br_im);
1339 float bl_phase =
atan2f(bl_im, bl_re);
1340 float br_phase =
atan2f(br_im, br_re);
1341 float phase_difl =
fabsf(fl_phase - bl_phase);
1342 float phase_difr =
fabsf(fr_phase - br_phase);
1343 float magl_sum = fl_mag + bl_mag;
1344 float magr_sum = fr_mag + br_mag;
1345 float mag_difl = magl_sum < 0.000001 ?
FFDIFFSIGN(fl_mag, bl_mag) : (fl_mag - bl_mag) / magl_sum;
1346 float mag_difr = magr_sum < 0.000001 ?
FFDIFFSIGN(fr_mag, br_mag) : (fr_mag - br_mag) / magr_sum;
1347 float mag_totall = hypotf(fl_mag, bl_mag);
1348 float mag_totalr = hypotf(fr_mag, br_mag);
1349 float sl_phase =
atan2f(fl_im + bl_im, fl_re + bl_re);
1350 float sr_phase =
atan2f(fr_im + br_im, fr_re + br_re);
1354 if (phase_difl >
M_PI)
1355 phase_difl = 2 *
M_PI - phase_difl;
1357 if (phase_difr >
M_PI)
1358 phase_difr = 2 *
M_PI - phase_difr;
1363 s->upmix_5_1(
ctx, c_re, c_im, lfe_re, lfe_im,
1364 mag_totall, mag_totalr,
1380 s->out_channel_layout_str);
1386 s->in_channel_layout_str);
1390 if (
s->lowcutf >=
s->highcutf) {
1392 s->lowcutf,
s->highcutf);
1396 switch (
s->in_channel_layout) {
1399 switch (
s->out_channel_layout) {
1445 switch (
s->out_channel_layout) {
1455 switch (
s->out_channel_layout) {
1468 switch (
s->out_channel_layout) {
1478 switch (
s->out_channel_layout) {
1488 switch (
s->out_channel_layout) {
1499 s->in_channel_layout_str,
s->out_channel_layout_str);
1503 s->buf_size = 1 <<
av_log2(
s->win_size);
1506 s->window_func_lut =
av_calloc(
s->buf_size,
sizeof(*
s->window_func_lut));
1507 if (!
s->window_func_lut)
1511 if (
s->overlap == 1)
1512 s->overlap = overlap;
1514 for (
i = 0;
i <
s->buf_size;
i++)
1515 s->window_func_lut[
i] = sqrtf(
s->window_func_lut[
i] /
s->buf_size);
1516 s->hop_size =
s->buf_size * (1. -
s->overlap);
1517 if (
s->hop_size <= 0)
1520 if (
s->all_x >= 0.f)
1521 s->fc_x =
s->fl_x =
s->fr_x =
s->bc_x =
s->sl_x =
s->sr_x =
s->bl_x =
s->br_x =
s->all_x;
1522 if (
s->all_y >= 0.f)
1523 s->fc_y =
s->fl_y =
s->fr_y =
s->bc_y =
s->sl_y =
s->sr_y =
s->bl_y =
s->br_y =
s->all_y;
1531 const float level_in =
s->input_levels[ch];
1535 memset(
s->input->extended_data[ch] +
s->buf_size *
sizeof(
float), 0,
s->buf_size *
sizeof(
float));
1537 dst = (
float *)
s->input->extended_data[ch];
1538 for (n = 0; n <
s->buf_size; n++) {
1539 dst[n] *=
s->window_func_lut[n] * level_in;
1550 const float level_out =
s->output_levels[ch];
1555 av_rdft_calc(
s->irdft[ch], (
float *)
s->output->extended_data[ch]);
1557 dst = (
float *)
s->output->extended_data[ch];
1558 ptr = (
float *)
s->overlap_buffer->extended_data[ch];
1560 memmove(
s->overlap_buffer->extended_data[ch],
1561 s->overlap_buffer->extended_data[ch] +
s->hop_size *
sizeof(
float),
1562 s->buf_size *
sizeof(
float));
1563 memset(
s->overlap_buffer->extended_data[ch] +
s->buf_size *
sizeof(
float),
1564 0,
s->hop_size *
sizeof(
float));
1566 for (n = 0; n <
s->buf_size; n++) {
1567 ptr[n] += dst[n] *
s->window_func_lut[n] * level_out;
1570 ptr = (
float *)
s->overlap_buffer->extended_data[ch];
1571 dst = (
float *)
out->extended_data[ch];
1572 memcpy(dst, ptr,
s->hop_size *
sizeof(
float));
1673 for (ch = 0; ch <
s->nb_in_channels; ch++) {
1676 for (ch = 0; ch <
s->nb_out_channels; ch++) {
1687 #define OFFSET(x) offsetof(AudioSurroundContext, x)
1688 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
1766 .priv_class = &surround_class,