138 float c_re,
float c_im,
139 float mag_totall,
float mag_totalr,
140 float fl_phase,
float fr_phase,
141 float bl_phase,
float br_phase,
142 float sl_phase,
float sr_phase,
147 float c_re,
float c_im,
148 float lfe_re,
float lfe_im,
149 float mag_totall,
float mag_totalr,
150 float fl_phase,
float fr_phase,
151 float bl_phase,
float br_phase,
152 float sl_phase,
float sr_phase,
202 s->nb_in_channels =
inlink->ch_layout.nb_channels;
204 for (ch = 0; ch <
inlink->ch_layout.nb_channels; ch++) {
212 if (!
s->input_levels)
214 for (ch = 0; ch <
s->nb_in_channels; ch++)
215 s->input_levels[ch] =
s->level_in;
218 s->input_levels[ch] *=
s->fc_in;
221 s->input_levels[ch] *=
s->fl_in;
224 s->input_levels[ch] *=
s->fr_in;
227 s->input_levels[ch] *=
s->sl_in;
230 s->input_levels[ch] *=
s->sr_in;
233 s->input_levels[ch] *=
s->bl_in;
236 s->input_levels[ch] *=
s->br_in;
239 s->input_levels[ch] *=
s->bc_in;
242 s->input_levels[ch] *=
s->lfe_in;
256 s->lowcut = 1.f *
s->lowcutf / (
inlink->sample_rate * 0.5) * (
s->buf_size / 2);
257 s->highcut = 1.f *
s->highcutf / (
inlink->sample_rate * 0.5) * (
s->buf_size / 2);
281 if (!
s->output_levels)
283 for (ch = 0; ch <
s->nb_out_channels; ch++)
284 s->output_levels[ch] =
s->level_out;
287 s->output_levels[ch] *=
s->fc_out;
290 s->output_levels[ch] *=
s->fl_out;
293 s->output_levels[ch] *=
s->fr_out;
296 s->output_levels[ch] *=
s->sl_out;
299 s->output_levels[ch] *=
s->sr_out;
302 s->output_levels[ch] *=
s->bl_out;
305 s->output_levels[ch] *=
s->br_out;
308 s->output_levels[ch] *=
s->bc_out;
311 s->output_levels[ch] *=
s->lfe_out;
316 if (!
s->overlap_buffer || !
s->output || !
s->output_out)
324 float reference,
r,
a;
329 reference = angle *
M_PI / 180.f;
350 static inline void get_lfe(
int output_lfe,
int n,
float lowcut,
float highcut,
351 float *lfe_mag,
float *mag_total,
int lfe_mode)
353 if (output_lfe && n < highcut) {
354 *lfe_mag = n < lowcut ? 1.f : .5f*(1.f+
cosf(
M_PI*(lowcut-n)/(lowcut-highcut)));
355 *lfe_mag *= *mag_total;
357 *mag_total -= *lfe_mag;
374 dst = (
float *)
s->output->extended_data[0];
376 mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
378 dst[2 * n ] = mag *
cosf(c_phase);
379 dst[2 * n + 1] = mag *
sinf(c_phase);
391 float l_mag, r_mag, *dstl, *dstr;
393 dstl = (
float *)
s->output->extended_data[0];
394 dstr = (
float *)
s->output->extended_data[1];
396 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
397 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
399 dstl[2 * n ] = l_mag *
cosf(l_phase);
400 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
402 dstr[2 * n ] = r_mag *
cosf(r_phase);
403 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
415 float lfe_mag, l_mag, r_mag, *dstl, *dstr, *dstlfe;
417 dstl = (
float *)
s->output->extended_data[0];
418 dstr = (
float *)
s->output->extended_data[1];
419 dstlfe = (
float *)
s->output->extended_data[2];
421 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
423 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
424 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
426 dstl[2 * n ] = l_mag *
cosf(l_phase);
427 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
429 dstr[2 * n ] = r_mag *
cosf(r_phase);
430 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
432 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
433 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
445 float l_mag, r_mag, c_mag, *dstc, *dstl, *dstr;
447 dstl = (
float *)
s->output->extended_data[0];
448 dstr = (
float *)
s->output->extended_data[1];
449 dstc = (
float *)
s->output->extended_data[2];
451 c_mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
452 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
453 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
455 dstl[2 * n ] = l_mag *
cosf(l_phase);
456 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
458 dstr[2 * n ] = r_mag *
cosf(r_phase);
459 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
461 dstc[2 * n ] = c_mag *
cosf(c_phase);
462 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
474 float lfe_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstlfe;
476 dstl = (
float *)
s->output->extended_data[0];
477 dstr = (
float *)
s->output->extended_data[1];
478 dstc = (
float *)
s->output->extended_data[2];
479 dstlfe = (
float *)
s->output->extended_data[3];
481 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
484 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
485 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
487 dstl[2 * n ] = l_mag *
cosf(l_phase);
488 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
490 dstr[2 * n ] = r_mag *
cosf(r_phase);
491 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
493 dstc[2 * n ] = c_mag *
cosf(c_phase);
494 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
496 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
497 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
510 float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
512 dstl = (
float *)
s->output->extended_data[0];
513 dstr = (
float *)
s->output->extended_data[1];
514 dstc = (
float *)
s->output->extended_data[2];
515 dstlfe = (
float *)
s->output->extended_data[3];
517 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &c_mag,
s->lfe_mode);
519 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
520 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
522 dstl[2 * n ] = l_mag *
cosf(l_phase);
523 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
525 dstr[2 * n ] = r_mag *
cosf(r_phase);
526 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
528 dstc[2 * n ] = c_mag *
cosf(c_phase);
529 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
531 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
532 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
544 float b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb;
546 dstl = (
float *)
s->output->extended_data[0];
547 dstr = (
float *)
s->output->extended_data[1];
548 dstc = (
float *)
s->output->extended_data[2];
549 dstb = (
float *)
s->output->extended_data[3];
553 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
554 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
556 dstl[2 * n ] = l_mag *
cosf(l_phase);
557 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
559 dstr[2 * n ] = r_mag *
cosf(r_phase);
560 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
562 dstc[2 * n ] = c_mag *
cosf(c_phase);
563 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
565 dstb[2 * n ] = b_mag *
cosf(c_phase);
566 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
578 float lfe_mag, b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb, *dstlfe;
580 dstl = (
float *)
s->output->extended_data[0];
581 dstr = (
float *)
s->output->extended_data[1];
582 dstc = (
float *)
s->output->extended_data[2];
583 dstlfe = (
float *)
s->output->extended_data[3];
584 dstb = (
float *)
s->output->extended_data[4];
586 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
588 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
589 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
593 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
594 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
596 dstl[2 * n ] = l_mag *
cosf(l_phase);
597 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
599 dstr[2 * n ] = r_mag *
cosf(r_phase);
600 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
602 dstc[2 * n ] = c_mag *
cosf(c_phase);
603 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
605 dstb[2 * n ] = b_mag *
cosf(c_phase);
606 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
618 float l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs;
620 dstl = (
float *)
s->output->extended_data[0];
621 dstr = (
float *)
s->output->extended_data[1];
622 dstc = (
float *)
s->output->extended_data[2];
623 dstls = (
float *)
s->output->extended_data[3];
624 dstrs = (
float *)
s->output->extended_data[4];
626 c_mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
627 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
628 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
629 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
630 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
632 dstl[2 * n ] = l_mag *
cosf(l_phase);
633 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
635 dstr[2 * n ] = r_mag *
cosf(r_phase);
636 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
638 dstc[2 * n ] = c_mag *
cosf(c_phase);
639 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
641 dstls[2 * n ] = ls_mag *
cosf(l_phase);
642 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
644 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
645 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
657 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
659 dstl = (
float *)
s->output->extended_data[0];
660 dstr = (
float *)
s->output->extended_data[1];
661 dstc = (
float *)
s->output->extended_data[2];
662 dstlfe = (
float *)
s->output->extended_data[3];
663 dstls = (
float *)
s->output->extended_data[4];
664 dstrs = (
float *)
s->output->extended_data[5];
666 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
669 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
670 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
671 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
672 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
674 dstl[2 * n ] = l_mag *
cosf(l_phase);
675 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
677 dstr[2 * n ] = r_mag *
cosf(r_phase);
678 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
680 dstc[2 * n ] = c_mag *
cosf(c_phase);
681 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
683 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
684 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
686 dstls[2 * n ] = ls_mag *
cosf(l_phase);
687 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
689 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
690 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
702 float l_mag, r_mag, ls_mag, rs_mag, c_mag, b_mag, *dstc, *dstb, *dstl, *dstr, *dstls, *dstrs;
704 dstl = (
float *)
s->output->extended_data[0];
705 dstr = (
float *)
s->output->extended_data[1];
706 dstc = (
float *)
s->output->extended_data[2];
707 dstb = (
float *)
s->output->extended_data[3];
708 dstls = (
float *)
s->output->extended_data[4];
709 dstrs = (
float *)
s->output->extended_data[5];
713 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
714 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
715 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
716 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
718 dstl[2 * n ] = l_mag *
cosf(l_phase);
719 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
721 dstr[2 * n ] = r_mag *
cosf(r_phase);
722 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
724 dstc[2 * n ] = c_mag *
cosf(c_phase);
725 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
727 dstls[2 * n ] = ls_mag *
cosf(l_phase);
728 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
730 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
731 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
733 dstb[2 * n ] = b_mag *
cosf(c_phase);
734 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
746 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, b_mag, *dstc, *dstb, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
748 dstl = (
float *)
s->output->extended_data[0];
749 dstr = (
float *)
s->output->extended_data[1];
750 dstc = (
float *)
s->output->extended_data[2];
751 dstlfe = (
float *)
s->output->extended_data[3];
752 dstb = (
float *)
s->output->extended_data[4];
753 dstls = (
float *)
s->output->extended_data[5];
754 dstrs = (
float *)
s->output->extended_data[6];
756 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
760 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
761 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
762 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
763 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
765 dstl[2 * n ] = l_mag *
cosf(l_phase);
766 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
768 dstr[2 * n ] = r_mag *
cosf(r_phase);
769 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
771 dstc[2 * n ] = c_mag *
cosf(c_phase);
772 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
774 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
775 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
777 dstls[2 * n ] = ls_mag *
cosf(l_phase);
778 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
780 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
781 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
783 dstb[2 * n ] = b_mag *
cosf(c_phase);
784 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
797 float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
798 float ls_mag, rs_mag, *dstls, *dstrs;
800 dstl = (
float *)
s->output->extended_data[0];
801 dstr = (
float *)
s->output->extended_data[1];
802 dstc = (
float *)
s->output->extended_data[2];
803 dstlfe = (
float *)
s->output->extended_data[3];
804 dstls = (
float *)
s->output->extended_data[4];
805 dstrs = (
float *)
s->output->extended_data[5];
807 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &c_mag,
s->lfe_mode);
809 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
810 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
811 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
812 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
814 dstl[2 * n ] = l_mag *
cosf(l_phase);
815 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
817 dstr[2 * n ] = r_mag *
cosf(r_phase);
818 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
820 dstc[2 * n ] = c_mag *
cosf(c_phase);
821 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
823 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
824 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
826 dstls[2 * n ] = ls_mag *
cosf(l_phase);
827 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
829 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
830 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
844 float c_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
845 float ls_mag, rs_mag, *dstls, *dstrs;
847 dstl = (
float *)
s->output->extended_data[0];
848 dstr = (
float *)
s->output->extended_data[1];
849 dstc = (
float *)
s->output->extended_data[2];
850 dstlfe = (
float *)
s->output->extended_data[3];
851 dstls = (
float *)
s->output->extended_data[4];
852 dstrs = (
float *)
s->output->extended_data[5];
855 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
856 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
857 ls_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
858 rs_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
860 dstl[2 * n ] = l_mag *
cosf(l_phase);
861 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
863 dstr[2 * n ] = r_mag *
cosf(r_phase);
864 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
866 dstc[2 * n ] = c_mag *
cosf(c_phase);
867 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
869 dstlfe[2 * n ] = lfe_re;
870 dstlfe[2 * n + 1] = lfe_im;
872 dstls[2 * n ] = ls_mag *
cosf(l_phase);
873 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
875 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
876 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
887 float l_mag, r_mag, ls_mag, rs_mag, c_mag, lb_mag, rb_mag;
888 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb;
891 dstl = (
float *)
s->output->extended_data[0];
892 dstr = (
float *)
s->output->extended_data[1];
893 dstc = (
float *)
s->output->extended_data[2];
894 dstlb = (
float *)
s->output->extended_data[3];
895 dstrb = (
float *)
s->output->extended_data[4];
896 dstls = (
float *)
s->output->extended_data[5];
897 dstrs = (
float *)
s->output->extended_data[6];
899 c_mag =
powf(1.
f -
fabsf(x),
s->fc_x) *
powf((y + 1.
f) * .5f,
s->fc_y) * mag_total;
900 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
901 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
902 lb_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
903 rb_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
907 dstl[2 * n ] = l_mag *
cosf(l_phase);
908 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
910 dstr[2 * n ] = r_mag *
cosf(r_phase);
911 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
913 dstc[2 * n ] = c_mag *
cosf(c_phase);
914 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
916 dstlb[2 * n ] = lb_mag *
cosf(l_phase);
917 dstlb[2 * n + 1] = lb_mag *
sinf(l_phase);
919 dstrb[2 * n ] = rb_mag *
cosf(r_phase);
920 dstrb[2 * n + 1] = rb_mag *
sinf(r_phase);
922 dstls[2 * n ] = ls_mag *
cosf(l_phase);
923 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
925 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
926 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
937 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, lb_mag, rb_mag;
938 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
941 dstl = (
float *)
s->output->extended_data[0];
942 dstr = (
float *)
s->output->extended_data[1];
943 dstc = (
float *)
s->output->extended_data[2];
944 dstlfe = (
float *)
s->output->extended_data[3];
945 dstlb = (
float *)
s->output->extended_data[4];
946 dstrb = (
float *)
s->output->extended_data[5];
947 dstls = (
float *)
s->output->extended_data[6];
948 dstrs = (
float *)
s->output->extended_data[7];
950 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
953 l_mag =
powf(.5
f * ( x + 1.
f),
s->fl_x) *
powf((y + 1.
f) * .5
f,
s->fl_y) * mag_total;
954 r_mag =
powf(.5
f * (-x + 1.
f),
s->fr_x) *
powf((y + 1.
f) * .5
f,
s->fr_y) * mag_total;
955 lb_mag =
powf(.5
f * ( x + 1.
f),
s->bl_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->bl_y) * mag_total;
956 rb_mag =
powf(.5
f * (-x + 1.
f),
s->br_x) *
powf(1.
f - ((y + 1.
f) * .5
f),
s->br_y) * mag_total;
960 dstl[2 * n ] = l_mag *
cosf(l_phase);
961 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
963 dstr[2 * n ] = r_mag *
cosf(r_phase);
964 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
966 dstc[2 * n ] = c_mag *
cosf(c_phase);
967 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
969 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
970 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
972 dstlb[2 * n ] = lb_mag *
cosf(l_phase);
973 dstlb[2 * n + 1] = lb_mag *
sinf(l_phase);
975 dstrb[2 * n ] = rb_mag *
cosf(r_phase);
976 dstrb[2 * n + 1] = rb_mag *
sinf(r_phase);
978 dstls[2 * n ] = ls_mag *
cosf(l_phase);
979 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
981 dstrs[2 * n ] = rs_mag *
cosf(r_phase);
982 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
986 float c_re,
float c_im,
987 float mag_totall,
float mag_totalr,
988 float fl_phase,
float fr_phase,
989 float bl_phase,
float br_phase,
990 float sl_phase,
float sr_phase,
995 float fl_mag, fr_mag, ls_mag, rs_mag, lb_mag, rb_mag;
996 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
997 float lfe_mag, c_phase, mag_total = (mag_totall + mag_totalr) * 0.5;
1000 dstl = (
float *)
s->output->extended_data[0];
1001 dstr = (
float *)
s->output->extended_data[1];
1002 dstc = (
float *)
s->output->extended_data[2];
1003 dstlfe = (
float *)
s->output->extended_data[3];
1004 dstlb = (
float *)
s->output->extended_data[4];
1005 dstrb = (
float *)
s->output->extended_data[5];
1006 dstls = (
float *)
s->output->extended_data[6];
1007 dstrs = (
float *)
s->output->extended_data[7];
1009 c_phase =
atan2f(c_im, c_re);
1011 get_lfe(
s->output_lfe, n,
s->lowcut,
s->highcut, &lfe_mag, &mag_total,
s->lfe_mode);
1013 fl_mag =
powf(.5
f * (xl + 1.
f),
s->fl_x) *
powf((yl + 1.
f) * .5
f,
s->fl_y) * mag_totall;
1014 fr_mag =
powf(.5
f * (xr + 1.
f),
s->fr_x) *
powf((yr + 1.
f) * .5
f,
s->fr_y) * mag_totalr;
1015 lb_mag =
powf(.5
f * (-xl + 1.
f),
s->bl_x) *
powf((yl + 1.
f) * .5
f,
s->bl_y) * mag_totall;
1016 rb_mag =
powf(.5
f * (-xr + 1.
f),
s->br_x) *
powf((yr + 1.
f) * .5
f,
s->br_y) * mag_totalr;
1017 ls_mag =
powf(1.
f -
fabsf(xl),
s->sl_x) *
powf((yl + 1.
f) * .5
f,
s->sl_y) * mag_totall;
1018 rs_mag =
powf(1.
f -
fabsf(xr),
s->sr_x) *
powf((yr + 1.
f) * .5
f,
s->sr_y) * mag_totalr;
1020 dstl[2 * n ] = fl_mag *
cosf(fl_phase);
1021 dstl[2 * n + 1] = fl_mag *
sinf(fl_phase);
1023 dstr[2 * n ] = fr_mag *
cosf(fr_phase);
1024 dstr[2 * n + 1] = fr_mag *
sinf(fr_phase);
1026 dstc[2 * n ] = c_re;
1027 dstc[2 * n + 1] = c_im;
1029 dstlfe[2 * n ] = lfe_mag *
cosf(c_phase);
1030 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
1032 dstlb[2 * n ] = lb_mag *
cosf(bl_phase);
1033 dstlb[2 * n + 1] = lb_mag *
sinf(bl_phase);
1035 dstrb[2 * n ] = rb_mag *
cosf(br_phase);
1036 dstrb[2 * n + 1] = rb_mag *
sinf(br_phase);
1038 dstls[2 * n ] = ls_mag *
cosf(sl_phase);
1039 dstls[2 * n + 1] = ls_mag *
sinf(sl_phase);
1041 dstrs[2 * n ] = rs_mag *
cosf(sr_phase);
1042 dstrs[2 * n + 1] = rs_mag *
sinf(sr_phase);
1046 float c_re,
float c_im,
1047 float lfe_re,
float lfe_im,
1048 float mag_totall,
float mag_totalr,
1049 float fl_phase,
float fr_phase,
1050 float bl_phase,
float br_phase,
1051 float sl_phase,
float sr_phase,
1056 float fl_mag, fr_mag, ls_mag, rs_mag, lb_mag, rb_mag;
1057 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
1060 dstl = (
float *)
s->output->extended_data[0];
1061 dstr = (
float *)
s->output->extended_data[1];
1062 dstc = (
float *)
s->output->extended_data[2];
1063 dstlfe = (
float *)
s->output->extended_data[3];
1064 dstlb = (
float *)
s->output->extended_data[4];
1065 dstrb = (
float *)
s->output->extended_data[5];
1066 dstls = (
float *)
s->output->extended_data[6];
1067 dstrs = (
float *)
s->output->extended_data[7];
1069 fl_mag =
powf(.5
f * (xl + 1.
f),
s->fl_x) *
powf((yl + 1.
f) * .5
f,
s->fl_y) * mag_totall;
1070 fr_mag =
powf(.5
f * (xr + 1.
f),
s->fr_x) *
powf((yr + 1.
f) * .5
f,
s->fr_y) * mag_totalr;
1071 lb_mag =
powf(.5
f * (-xl + 1.
f),
s->bl_x) *
powf((yl + 1.
f) * .5
f,
s->bl_y) * mag_totall;
1072 rb_mag =
powf(.5
f * (-xr + 1.
f),
s->br_x) *
powf((yr + 1.
f) * .5
f,
s->br_y) * mag_totalr;
1073 ls_mag =
powf(1.
f -
fabsf(xl),
s->sl_x) *
powf((yl + 1.
f) * .5
f,
s->sl_y) * mag_totall;
1074 rs_mag =
powf(1.
f -
fabsf(xr),
s->sr_x) *
powf((yr + 1.
f) * .5
f,
s->sr_y) * mag_totalr;
1076 dstl[2 * n ] = fl_mag *
cosf(fl_phase);
1077 dstl[2 * n + 1] = fl_mag *
sinf(fl_phase);
1079 dstr[2 * n ] = fr_mag *
cosf(fr_phase);
1080 dstr[2 * n + 1] = fr_mag *
sinf(fr_phase);
1082 dstc[2 * n ] = c_re;
1083 dstc[2 * n + 1] = c_im;
1085 dstlfe[2 * n ] = lfe_re;
1086 dstlfe[2 * n + 1] = lfe_im;
1088 dstlb[2 * n ] = lb_mag *
cosf(bl_phase);
1089 dstlb[2 * n + 1] = lb_mag *
sinf(bl_phase);
1091 dstrb[2 * n ] = rb_mag *
cosf(br_phase);
1092 dstrb[2 * n + 1] = rb_mag *
sinf(br_phase);
1094 dstls[2 * n ] = ls_mag *
cosf(sl_phase);
1095 dstls[2 * n + 1] = ls_mag *
sinf(sl_phase);
1097 dstrs[2 * n ] = rs_mag *
cosf(sr_phase);
1098 dstrs[2 * n + 1] = rs_mag *
sinf(sr_phase);
1107 srcl = (
float *)
s->input->extended_data[0];
1108 srcr = (
float *)
s->input->extended_data[1];
1110 for (n = 0; n <
s->buf_size / 2 + 1; n++) {
1111 float l_re = srcl[2 * n], r_re = srcr[2 * n];
1112 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
1113 float c_phase =
atan2f(l_im + r_im, l_re + r_re);
1114 float l_mag = hypotf(l_re, l_im);
1115 float r_mag = hypotf(r_re, r_im);
1116 float l_phase =
atan2f(l_im, l_re);
1117 float r_phase =
atan2f(r_im, r_re);
1118 float phase_dif =
fabsf(l_phase - r_phase);
1119 float mag_sum = l_mag + r_mag;
1120 float mag_dif = mag_sum < 0.000001 ?
FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1121 float mag_total = hypotf(l_mag, r_mag);
1124 if (phase_dif >
M_PI)
1125 phase_dif = 2 *
M_PI - phase_dif;
1130 s->upmix_stereo(
ctx, l_phase, r_phase, c_phase, mag_total, x, y, n);
1137 float *srcl, *srcr, *srcc;
1140 srcl = (
float *)
s->input->extended_data[0];
1141 srcr = (
float *)
s->input->extended_data[1];
1142 srcc = (
float *)
s->input->extended_data[2];
1144 for (n = 0; n <
s->buf_size / 2 + 1; n++) {
1145 float l_re = srcl[2 * n], r_re = srcr[2 * n];
1146 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
1147 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1148 float c_mag = hypotf(c_re, c_im);
1149 float c_phase =
atan2f(c_im, c_re);
1150 float l_mag = hypotf(l_re, l_im);
1151 float r_mag = hypotf(r_re, r_im);
1152 float l_phase =
atan2f(l_im, l_re);
1153 float r_phase =
atan2f(r_im, r_re);
1154 float phase_dif =
fabsf(l_phase - r_phase);
1155 float mag_sum = l_mag + r_mag;
1156 float mag_dif = mag_sum < 0.000001 ?
FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1157 float mag_total = hypotf(l_mag, r_mag);
1160 if (phase_dif >
M_PI)
1161 phase_dif = 2 *
M_PI - phase_dif;
1166 s->upmix_3_0(
ctx, l_phase, r_phase, c_phase, c_mag, mag_total, x, y, n);
1173 float *srcl, *srcr, *srclfe;
1176 srcl = (
float *)
s->input->extended_data[0];
1177 srcr = (
float *)
s->input->extended_data[1];
1178 srclfe = (
float *)
s->input->extended_data[2];
1180 for (n = 0; n <
s->buf_size / 2 + 1; n++) {
1181 float l_re = srcl[2 * n], r_re = srcr[2 * n];
1182 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
1183 float lfe_re = srclfe[2 * n], lfe_im = srclfe[2 * n + 1];
1184 float c_phase =
atan2f(l_im + r_im, l_re + r_re);
1185 float l_mag = hypotf(l_re, l_im);
1186 float r_mag = hypotf(r_re, r_im);
1187 float l_phase =
atan2f(l_im, l_re);
1188 float r_phase =
atan2f(r_im, r_re);
1189 float phase_dif =
fabsf(l_phase - r_phase);
1190 float mag_sum = l_mag + r_mag;
1191 float mag_dif = mag_sum < 0.000001 ?
FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1192 float mag_total = hypotf(l_mag, r_mag);
1195 if (phase_dif >
M_PI)
1196 phase_dif = 2 *
M_PI - phase_dif;
1201 s->upmix_2_1(
ctx, l_phase, r_phase, c_phase, mag_total, lfe_re, lfe_im, x, y, n);
1208 float *srcl, *srcr, *srcc, *srcsl, *srcsr;
1211 srcl = (
float *)
s->input->extended_data[0];
1212 srcr = (
float *)
s->input->extended_data[1];
1213 srcc = (
float *)
s->input->extended_data[2];
1214 srcsl = (
float *)
s->input->extended_data[3];
1215 srcsr = (
float *)
s->input->extended_data[4];
1217 for (n = 0; n <
s->buf_size / 2 + 1; n++) {
1218 float fl_re = srcl[2 * n], fr_re = srcr[2 * n];
1219 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
1220 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1221 float sl_re = srcsl[2 * n], sl_im = srcsl[2 * n + 1];
1222 float sr_re = srcsr[2 * n], sr_im = srcsr[2 * n + 1];
1223 float fl_mag = hypotf(fl_re, fl_im);
1224 float fr_mag = hypotf(fr_re, fr_im);
1225 float fl_phase =
atan2f(fl_im, fl_re);
1226 float fr_phase =
atan2f(fr_im, fr_re);
1227 float sl_mag = hypotf(sl_re, sl_im);
1228 float sr_mag = hypotf(sr_re, sr_im);
1229 float sl_phase =
atan2f(sl_im, sl_re);
1230 float sr_phase =
atan2f(sr_im, sr_re);
1231 float phase_difl =
fabsf(fl_phase - sl_phase);
1232 float phase_difr =
fabsf(fr_phase - sr_phase);
1233 float magl_sum = fl_mag + sl_mag;
1234 float magr_sum = fr_mag + sr_mag;
1235 float mag_difl = magl_sum < 0.000001 ?
FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1236 float mag_difr = magr_sum < 0.000001 ?
FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
1237 float mag_totall = hypotf(fl_mag, sl_mag);
1238 float mag_totalr = hypotf(fr_mag, sr_mag);
1239 float bl_phase =
atan2f(fl_im + sl_im, fl_re + sl_re);
1240 float br_phase =
atan2f(fr_im + sr_im, fr_re + sr_re);
1244 if (phase_difl >
M_PI)
1245 phase_difl = 2 *
M_PI - phase_difl;
1247 if (phase_difr >
M_PI)
1248 phase_difr = 2 *
M_PI - phase_difr;
1253 s->upmix_5_0(
ctx, c_re, c_im,
1254 mag_totall, mag_totalr,
1265 float *srcl, *srcr, *srcc, *srclfe, *srcsl, *srcsr;
1268 srcl = (
float *)
s->input->extended_data[0];
1269 srcr = (
float *)
s->input->extended_data[1];
1270 srcc = (
float *)
s->input->extended_data[2];
1271 srclfe = (
float *)
s->input->extended_data[3];
1272 srcsl = (
float *)
s->input->extended_data[4];
1273 srcsr = (
float *)
s->input->extended_data[5];
1275 for (n = 0; n <
s->buf_size / 2 + 1; n++) {
1276 float fl_re = srcl[2 * n], fr_re = srcr[2 * n];
1277 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
1278 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1279 float lfe_re = srclfe[2 * n], lfe_im = srclfe[2 * n + 1];
1280 float sl_re = srcsl[2 * n], sl_im = srcsl[2 * n + 1];
1281 float sr_re = srcsr[2 * n], sr_im = srcsr[2 * n + 1];
1282 float fl_mag = hypotf(fl_re, fl_im);
1283 float fr_mag = hypotf(fr_re, fr_im);
1284 float fl_phase =
atan2f(fl_im, fl_re);
1285 float fr_phase =
atan2f(fr_im, fr_re);
1286 float sl_mag = hypotf(sl_re, sl_im);
1287 float sr_mag = hypotf(sr_re, sr_im);
1288 float sl_phase =
atan2f(sl_im, sl_re);
1289 float sr_phase =
atan2f(sr_im, sr_re);
1290 float phase_difl =
fabsf(fl_phase - sl_phase);
1291 float phase_difr =
fabsf(fr_phase - sr_phase);
1292 float magl_sum = fl_mag + sl_mag;
1293 float magr_sum = fr_mag + sr_mag;
1294 float mag_difl = magl_sum < 0.000001 ?
FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1295 float mag_difr = magr_sum < 0.000001 ?
FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
1296 float mag_totall = hypotf(fl_mag, sl_mag);
1297 float mag_totalr = hypotf(fr_mag, sr_mag);
1298 float bl_phase =
atan2f(fl_im + sl_im, fl_re + sl_re);
1299 float br_phase =
atan2f(fr_im + sr_im, fr_re + sr_re);
1303 if (phase_difl >
M_PI)
1304 phase_difl = 2 *
M_PI - phase_difl;
1306 if (phase_difr >
M_PI)
1307 phase_difr = 2 *
M_PI - phase_difr;
1312 s->upmix_5_1(
ctx, c_re, c_im, lfe_re, lfe_im,
1313 mag_totall, mag_totalr,
1324 float *srcl, *srcr, *srcc, *srclfe, *srcbl, *srcbr;
1327 srcl = (
float *)
s->input->extended_data[0];
1328 srcr = (
float *)
s->input->extended_data[1];
1329 srcc = (
float *)
s->input->extended_data[2];
1330 srclfe = (
float *)
s->input->extended_data[3];
1331 srcbl = (
float *)
s->input->extended_data[4];
1332 srcbr = (
float *)
s->input->extended_data[5];
1334 for (n = 0; n <
s->buf_size / 2 + 1; n++) {
1335 float fl_re = srcl[2 * n], fr_re = srcr[2 * n];
1336 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
1337 float c_re = srcc[2 * n], c_im = srcc[2 * n + 1];
1338 float lfe_re = srclfe[2 * n], lfe_im = srclfe[2 * n + 1];
1339 float bl_re = srcbl[2 * n], bl_im = srcbl[2 * n + 1];
1340 float br_re = srcbr[2 * n], br_im = srcbr[2 * n + 1];
1341 float fl_mag = hypotf(fl_re, fl_im);
1342 float fr_mag = hypotf(fr_re, fr_im);
1343 float fl_phase =
atan2f(fl_im, fl_re);
1344 float fr_phase =
atan2f(fr_im, fr_re);
1345 float bl_mag = hypotf(bl_re, bl_im);
1346 float br_mag = hypotf(br_re, br_im);
1347 float bl_phase =
atan2f(bl_im, bl_re);
1348 float br_phase =
atan2f(br_im, br_re);
1349 float phase_difl =
fabsf(fl_phase - bl_phase);
1350 float phase_difr =
fabsf(fr_phase - br_phase);
1351 float magl_sum = fl_mag + bl_mag;
1352 float magr_sum = fr_mag + br_mag;
1353 float mag_difl = magl_sum < 0.000001 ?
FFDIFFSIGN(fl_mag, bl_mag) : (fl_mag - bl_mag) / magl_sum;
1354 float mag_difr = magr_sum < 0.000001 ?
FFDIFFSIGN(fr_mag, br_mag) : (fr_mag - br_mag) / magr_sum;
1355 float mag_totall = hypotf(fl_mag, bl_mag);
1356 float mag_totalr = hypotf(fr_mag, br_mag);
1357 float sl_phase =
atan2f(fl_im + bl_im, fl_re + bl_re);
1358 float sr_phase =
atan2f(fr_im + br_im, fr_re + br_re);
1362 if (phase_difl >
M_PI)
1363 phase_difl = 2 *
M_PI - phase_difl;
1365 if (phase_difr >
M_PI)
1366 phase_difr = 2 *
M_PI - phase_difr;
1371 s->upmix_5_1(
ctx, c_re, c_im, lfe_re, lfe_im,
1372 mag_totall, mag_totalr,
1384 int64_t in_channel_layout, out_channel_layout;
1389 s->out_channel_layout_str);
1395 s->in_channel_layout_str);
1399 if (
s->lowcutf >=
s->highcutf) {
1401 s->lowcutf,
s->highcutf);
1406 s->in_channel_layout.u.mask : 0;
1408 s->out_channel_layout.u.mask : 0;
1410 switch (in_channel_layout) {
1413 switch (out_channel_layout) {
1459 switch (out_channel_layout) {
1469 switch (out_channel_layout) {
1482 switch (out_channel_layout) {
1492 switch (out_channel_layout) {
1502 switch (out_channel_layout) {
1513 s->in_channel_layout_str,
s->out_channel_layout_str);
1517 s->buf_size = 1 <<
av_log2(
s->win_size);
1519 s->window_func_lut =
av_calloc(
s->buf_size,
sizeof(*
s->window_func_lut));
1520 if (!
s->window_func_lut)
1524 if (
s->overlap == 1)
1525 s->overlap = overlap;
1527 for (
i = 0;
i <
s->buf_size;
i++)
1528 s->window_func_lut[
i] =
sqrtf(
s->window_func_lut[
i] /
s->buf_size);
1529 s->hop_size =
s->buf_size * (1. -
s->overlap);
1530 if (
s->hop_size <= 0)
1533 if (
s->all_x >= 0.f)
1534 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;
1535 if (
s->all_y >= 0.f)
1536 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;
1544 float *
src = (
float *)
s->input_in->extended_data[ch];
1545 float *
win = (
float *)
s->window->extended_data[ch];
1546 const int offset =
s->buf_size -
s->hop_size;
1547 const float level_in =
s->input_levels[ch];
1554 for (
int n = 0; n <
s->buf_size; n++) {
1555 win[n] =
src[n] *
s->window_func_lut[n] * level_in;
1558 s->tx_fn(
s->rdft[ch], (
float *)
s->input->extended_data[ch],
win,
sizeof(
float));
1566 const float level_out =
s->output_levels[ch];
1571 dst = (
float *)
s->output_out->extended_data[ch];
1572 ptr = (
float *)
s->overlap_buffer->extended_data[ch];
1573 s->itx_fn(
s->irdft[ch], dst, (
float *)
s->output->extended_data[ch],
sizeof(
float));
1575 memmove(
s->overlap_buffer->extended_data[ch],
1576 s->overlap_buffer->extended_data[ch] +
s->hop_size *
sizeof(
float),
1577 s->buf_size *
sizeof(
float));
1578 memset(
s->overlap_buffer->extended_data[ch] +
s->buf_size *
sizeof(
float),
1579 0,
s->hop_size *
sizeof(
float));
1581 for (n = 0; n <
s->buf_size; n++) {
1582 ptr[n] += dst[n] *
s->window_func_lut[n] * level_out;
1585 ptr = (
float *)
s->overlap_buffer->extended_data[ch];
1586 dst = (
float *)
out->extended_data[ch];
1587 memcpy(dst, ptr,
s->hop_size *
sizeof(
float));
1662 for (
int ch = 0; ch <
s->nb_in_channels; ch++)
1664 for (
int ch = 0; ch <
s->nb_out_channels; ch++)
1673 #define OFFSET(x) offsetof(AudioSurroundContext, x)
1674 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
1752 .priv_class = &surround_class,