94 float c_re,
float c_im,
95 float lfe_re,
float lfe_im,
96 float mag_totall,
float mag_totalr,
97 float fl_phase,
float fr_phase,
98 float bl_phase,
float br_phase,
99 float sl_phase,
float sr_phase,
153 for (ch = 0; ch < inlink->
channels; ch++) {
195 for (ch = 0; ch < outlink->
channels; ch++) {
227 static inline void get_lfe(
int output_lfe,
int n,
float lowcut,
float highcut,
228 float *lfe_mag,
float *mag_total)
230 if (output_lfe && n < highcut) {
231 *lfe_mag = n < lowcut ? 1.f : .5f*(1.f+
cosf(
M_PI*(lowcut-n)/(lowcut-highcut)));
232 *lfe_mag *= *mag_total;
233 *mag_total -= *lfe_mag;
252 mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
254 dst[2 *
n ] = mag *
cosf(c_phase);
255 dst[2 * n + 1] = mag *
sinf(c_phase);
267 float l_mag, r_mag, *dstl, *dstr;
272 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
273 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
275 dstl[2 *
n ] = l_mag *
cosf(l_phase);
276 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
278 dstr[2 *
n ] = r_mag *
cosf(r_phase);
279 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
291 float lfe_mag, l_mag, r_mag, *dstl, *dstr, *dstlfe;
299 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
300 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
302 dstl[2 *
n ] = l_mag *
cosf(l_phase);
303 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
305 dstr[2 *
n ] = r_mag *
cosf(r_phase);
306 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
308 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
309 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
321 float l_mag, r_mag, c_mag, *dstc, *dstl, *dstr;
327 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
328 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
329 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
331 dstl[2 *
n ] = l_mag *
cosf(l_phase);
332 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
334 dstr[2 *
n ] = r_mag *
cosf(r_phase);
335 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
337 dstc[2 *
n ] = c_mag *
cosf(c_phase);
338 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
350 float lfe_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstlfe;
359 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
360 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
361 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
363 dstl[2 *
n ] = l_mag *
cosf(l_phase);
364 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
366 dstr[2 *
n ] = r_mag *
cosf(r_phase);
367 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
369 dstc[2 *
n ] = c_mag *
cosf(c_phase);
370 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
372 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
373 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
386 float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
395 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
396 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
398 dstl[2 *
n ] = l_mag *
cosf(l_phase);
399 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
401 dstr[2 *
n ] = r_mag *
cosf(r_phase);
402 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
404 dstc[2 *
n ] = c_mag *
cosf(c_phase);
405 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
407 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
408 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
419 float b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb;
427 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
428 b_mag = sqrtf(1.f - fabsf(x)) * ((1.f - y) * .5f) * mag_total;
429 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
430 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
432 dstl[2 *
n ] = l_mag *
cosf(l_phase);
433 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
435 dstr[2 *
n ] = r_mag *
cosf(r_phase);
436 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
438 dstc[2 *
n ] = c_mag *
cosf(c_phase);
439 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
441 dstb[2 *
n ] = b_mag *
cosf(c_phase);
442 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
453 float lfe_mag, b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb, *dstlfe;
464 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
465 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
467 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
468 b_mag = sqrtf(1.f - fabsf(x)) * ((1.f - y) * .5f) * mag_total;
469 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
470 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
472 dstl[2 *
n ] = l_mag *
cosf(l_phase);
473 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
475 dstr[2 *
n ] = r_mag *
cosf(r_phase);
476 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
478 dstc[2 *
n ] = c_mag *
cosf(c_phase);
479 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
481 dstb[2 *
n ] = b_mag *
cosf(c_phase);
482 dstb[2 * n + 1] = b_mag *
sinf(c_phase);
493 float l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs;
502 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
503 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
504 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
505 ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
506 rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
508 dstl[2 *
n ] = l_mag *
cosf(l_phase);
509 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
511 dstr[2 *
n ] = r_mag *
cosf(r_phase);
512 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
514 dstc[2 *
n ] = c_mag *
cosf(c_phase);
515 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
517 dstls[2 *
n ] = ls_mag *
cosf(l_phase);
518 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
520 dstrs[2 *
n ] = rs_mag *
cosf(r_phase);
521 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
532 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
544 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
545 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
546 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
547 ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
548 rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
550 dstl[2 *
n ] = l_mag *
cosf(l_phase);
551 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
553 dstr[2 *
n ] = r_mag *
cosf(r_phase);
554 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
556 dstc[2 *
n ] = c_mag *
cosf(c_phase);
557 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
559 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
560 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
562 dstls[2 *
n ] = ls_mag *
cosf(l_phase);
563 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
565 dstrs[2 *
n ] = rs_mag *
cosf(r_phase);
566 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
579 float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
580 float ls_mag, rs_mag, *dstls, *dstrs;
591 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
592 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
593 ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
594 rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * 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 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
606 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
608 dstls[2 *
n ] = ls_mag *
cosf(l_phase);
609 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
611 dstrs[2 *
n ] = rs_mag *
cosf(r_phase);
612 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
626 float c_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
627 float ls_mag, rs_mag, *dstls, *dstrs;
636 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
637 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
638 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
639 ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
640 rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
642 dstl[2 *
n ] = l_mag *
cosf(l_phase);
643 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
645 dstr[2 *
n ] = r_mag *
cosf(r_phase);
646 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
648 dstc[2 *
n ] = c_mag *
cosf(c_phase);
649 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
651 dstlfe[2 *
n ] = lfe_re;
652 dstlfe[2 * n + 1] = lfe_im;
654 dstls[2 *
n ] = ls_mag *
cosf(l_phase);
655 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
657 dstrs[2 *
n ] = rs_mag *
cosf(r_phase);
658 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
669 float l_mag, r_mag, ls_mag, rs_mag, c_mag, lb_mag, rb_mag;
670 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb;
681 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
682 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
683 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
684 lb_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
685 rb_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
686 ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - fabsf(y)) * mag_total;
687 rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - fabsf(y)) * mag_total;
689 dstl[2 *
n ] = l_mag *
cosf(l_phase);
690 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
692 dstr[2 *
n ] = r_mag *
cosf(r_phase);
693 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
695 dstc[2 *
n ] = c_mag *
cosf(c_phase);
696 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
698 dstlb[2 *
n ] = lb_mag *
cosf(l_phase);
699 dstlb[2 * n + 1] = lb_mag *
sinf(l_phase);
701 dstrb[2 *
n ] = rb_mag *
cosf(r_phase);
702 dstrb[2 * n + 1] = rb_mag *
sinf(r_phase);
704 dstls[2 *
n ] = ls_mag *
cosf(l_phase);
705 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
707 dstrs[2 *
n ] = rs_mag *
cosf(r_phase);
708 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
719 float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, lb_mag, rb_mag;
720 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
734 c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
735 l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
736 r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
737 lb_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
738 rb_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
739 ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - fabsf(y)) * mag_total;
740 rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - fabsf(y)) * mag_total;
742 dstl[2 *
n ] = l_mag *
cosf(l_phase);
743 dstl[2 * n + 1] = l_mag *
sinf(l_phase);
745 dstr[2 *
n ] = r_mag *
cosf(r_phase);
746 dstr[2 * n + 1] = r_mag *
sinf(r_phase);
748 dstc[2 *
n ] = c_mag *
cosf(c_phase);
749 dstc[2 * n + 1] = c_mag *
sinf(c_phase);
751 dstlfe[2 *
n ] = lfe_mag *
cosf(c_phase);
752 dstlfe[2 * n + 1] = lfe_mag *
sinf(c_phase);
754 dstlb[2 *
n ] = lb_mag *
cosf(l_phase);
755 dstlb[2 * n + 1] = lb_mag *
sinf(l_phase);
757 dstrb[2 *
n ] = rb_mag *
cosf(r_phase);
758 dstrb[2 * n + 1] = rb_mag *
sinf(r_phase);
760 dstls[2 *
n ] = ls_mag *
cosf(l_phase);
761 dstls[2 * n + 1] = ls_mag *
sinf(l_phase);
763 dstrs[2 *
n ] = rs_mag *
cosf(r_phase);
764 dstrs[2 * n + 1] = rs_mag *
sinf(r_phase);
768 float c_re,
float c_im,
769 float lfe_re,
float lfe_im,
770 float mag_totall,
float mag_totalr,
771 float fl_phase,
float fr_phase,
772 float bl_phase,
float br_phase,
773 float sl_phase,
float sr_phase,
778 float fl_mag, fr_mag, ls_mag, rs_mag, lb_mag, rb_mag;
779 float *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlb, *dstrb, *dstlfe;
791 fl_mag = sqrtf(.5f * (xl + 1.f)) * ((yl + 1.f) * .5f) * mag_totall;
792 fr_mag = sqrtf(.5f * (xr + 1.f)) * ((yr + 1.f) * .5f) * mag_totalr;
793 lb_mag = sqrtf(.5f * (-xl + 1.f)) * ((yl + 1.f) * .5f) * mag_totall;
794 rb_mag = sqrtf(.5f * (-xr + 1.f)) * ((yr + 1.f) * .5f) * mag_totalr;
795 ls_mag = sqrtf(1.f - fabsf(xl)) * ((yl + 1.f) * .5f) * mag_totall;
796 rs_mag = sqrtf(1.f - fabsf(xr)) * ((yr + 1.f) * .5f) * mag_totalr;
798 dstl[2 *
n ] = fl_mag *
cosf(fl_phase);
799 dstl[2 * n + 1] = fl_mag *
sinf(fl_phase);
801 dstr[2 *
n ] = fr_mag *
cosf(fr_phase);
802 dstr[2 * n + 1] = fr_mag *
sinf(fr_phase);
805 dstc[2 * n + 1] = c_im;
807 dstlfe[2 *
n ] = lfe_re;
808 dstlfe[2 * n + 1] = lfe_im;
810 dstlb[2 *
n ] = lb_mag *
cosf(bl_phase);
811 dstlb[2 * n + 1] = lb_mag *
sinf(bl_phase);
813 dstrb[2 *
n ] = rb_mag *
cosf(br_phase);
814 dstrb[2 * n + 1] = rb_mag *
sinf(br_phase);
816 dstls[2 *
n ] = ls_mag *
cosf(sl_phase);
817 dstls[2 * n + 1] = ls_mag *
sinf(sl_phase);
819 dstrs[2 *
n ] = rs_mag *
cosf(sr_phase);
820 dstrs[2 * n + 1] = rs_mag *
sinf(sr_phase);
833 float l_re = srcl[2 *
n], r_re = srcr[2 *
n];
834 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
835 float c_phase =
atan2f(l_im + r_im, l_re + r_re);
836 float l_mag = hypotf(l_re, l_im);
837 float r_mag = hypotf(r_re, r_im);
838 float l_phase =
atan2f(l_im, l_re);
839 float r_phase =
atan2f(r_im, r_re);
840 float phase_dif = fabsf(l_phase - r_phase);
841 float mag_dif = (l_mag - r_mag) / (l_mag + r_mag);
842 float mag_total = hypotf(l_mag, r_mag);
845 if (phase_dif >
M_PI)
846 phase_dif = 2 *
M_PI - phase_dif;
850 s->
upmix_stereo(ctx, l_phase, r_phase, c_phase, mag_total, x, y, n);
857 float *srcl, *srcr, *srcc;
865 float l_re = srcl[2 *
n], r_re = srcr[2 *
n];
866 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
867 float c_re = srcc[2 *
n], c_im = srcc[2 * n + 1];
868 float c_mag = hypotf(c_re, c_im);
869 float c_phase =
atan2f(c_im, c_re);
870 float l_mag = hypotf(l_re, l_im);
871 float r_mag = hypotf(r_re, r_im);
872 float l_phase =
atan2f(l_im, l_re);
873 float r_phase =
atan2f(r_im, r_re);
874 float phase_dif = fabsf(l_phase - r_phase);
875 float mag_dif = (l_mag - r_mag) / (l_mag + r_mag);
876 float mag_total = hypotf(l_mag, r_mag);
879 if (phase_dif >
M_PI)
880 phase_dif = 2 *
M_PI - phase_dif;
884 s->
upmix_3_0(ctx, l_phase, r_phase, c_phase, c_mag, mag_total, x, y, n);
891 float *srcl, *srcr, *srclfe;
899 float l_re = srcl[2 *
n], r_re = srcr[2 *
n];
900 float l_im = srcl[2 * n + 1], r_im = srcr[2 * n + 1];
901 float lfe_re = srclfe[2 *
n], lfe_im = srclfe[2 * n + 1];
902 float c_phase =
atan2f(l_im + r_im, l_re + r_re);
903 float l_mag = hypotf(l_re, l_im);
904 float r_mag = hypotf(r_re, r_im);
905 float l_phase =
atan2f(l_im, l_re);
906 float r_phase =
atan2f(r_im, r_re);
907 float phase_dif = fabsf(l_phase - r_phase);
908 float mag_dif = (l_mag - r_mag) / (l_mag + r_mag);
909 float mag_total = hypotf(l_mag, r_mag);
912 if (phase_dif >
M_PI)
913 phase_dif = 2 *
M_PI - phase_dif;
917 s->
upmix_2_1(ctx, l_phase, r_phase, c_phase, mag_total, lfe_re, lfe_im, x, y, n);
924 float *srcl, *srcr, *srcc, *srclfe, *srcbl, *srcbr;
935 float fl_re = srcl[2 *
n], fr_re = srcr[2 *
n];
936 float fl_im = srcl[2 * n + 1], fr_im = srcr[2 * n + 1];
937 float c_re = srcc[2 *
n], c_im = srcc[2 * n + 1];
938 float lfe_re = srclfe[2 *
n], lfe_im = srclfe[2 * n + 1];
939 float bl_re = srcbl[2 *
n], bl_im = srcbl[2 * n + 1];
940 float br_re = srcbr[2 *
n], br_im = srcbr[2 * n + 1];
941 float fl_mag = hypotf(fl_re, fl_im);
942 float fr_mag = hypotf(fr_re, fr_im);
943 float fl_phase =
atan2f(fl_im, fl_re);
944 float fr_phase =
atan2f(fr_im, fr_re);
945 float bl_mag = hypotf(bl_re, bl_im);
946 float br_mag = hypotf(br_re, br_im);
947 float bl_phase =
atan2f(bl_im, bl_re);
948 float br_phase =
atan2f(br_im, br_re);
949 float phase_difl = fabsf(fl_phase - bl_phase);
950 float phase_difr = fabsf(fr_phase - br_phase);
951 float mag_difl = (fl_mag - bl_mag) / (fl_mag + bl_mag);
952 float mag_difr = (fr_mag - br_mag) / (fr_mag + br_mag);
953 float mag_totall = hypotf(fl_mag, bl_mag);
954 float mag_totalr = hypotf(fr_mag, br_mag);
955 float sl_phase =
atan2f(fl_im + bl_im, fl_re + bl_re);
956 float sr_phase =
atan2f(fr_im + br_im, fr_re + br_re);
960 if (phase_difl >
M_PI)
961 phase_difl = 2 *
M_PI - phase_difl;
963 if (phase_difr >
M_PI)
964 phase_difr = 2 *
M_PI - phase_difr;
969 s->
upmix_5_1(ctx, c_re, c_im, lfe_re, lfe_im,
970 mag_totall, mag_totalr,
997 av_log(ctx,
AV_LOG_ERROR,
"Low cut-off '%d' should be less than high cut-off '%d'.\n",
1136 for (n = 0; n < s->
buf_size; n++) {
1142 memcpy(dst, ptr, s->
hop_size *
sizeof(
float));
1214 #define OFFSET(x) offsetof(AudioSurroundContext, x)
1215 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
1258 .priv_class = &surround_class,
#define AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_4POINT1
AVAudioFifo * av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, int nb_samples)
Allocate an AVAudioFifo.
static int config_input(AVFilterLink *inlink)
static void stereo_position(float a, float p, float *x, float *y)
This structure describes decoded (raw) audio or video data.
static int init(AVFilterContext *ctx)
void(* filter)(AVFilterContext *ctx)
static void upmix_4_0(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
#define AV_CH_LAYOUT_SURROUND
Main libavfilter public API header.
void(* upmix_5_1)(AVFilterContext *ctx, float c_re, float c_im, float lfe_re, float lfe_im, float mag_totall, float mag_totalr, float fl_phase, float fr_phase, float bl_phase, float br_phase, float sl_phase, float sr_phase, float xl, float yl, float xr, float yr, int n)
static int query_formats(AVFilterContext *ctx)
void av_audio_fifo_free(AVAudioFifo *af)
Free an AVAudioFifo.
static void upmix_2_1(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
static av_cold void uninit(AVFilterContext *ctx)
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_STEREO
struct AVFilterChannelLayouts * in_channel_layouts
void(* upmix_stereo)(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
const char * name
Pad name.
uint64_t av_get_channel_layout(const char *name)
Return a channel layout id that matches name, or 0 if no match is found.
AVFilterLink ** inputs
array of pointers to input links
static void upmix_3_1_surround(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float c_mag, float mag_total, float x, float y, int n)
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(constuint8_t *) pi-0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(constint16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(constint32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(constint64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0f/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64,*(constint64_t *) pi *(1.0/(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(constfloat *) pi *(INT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(constdouble *) pi *(INT64_C(1)<< 63)))#defineFMT_PAIR_FUNC(out, in) staticconv_func_type *constfmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64),};staticvoidcpy1(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, len);}staticvoidcpy2(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 2 *len);}staticvoidcpy4(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 4 *len);}staticvoidcpy8(uint8_t **dst, constuint8_t **src, intlen){memcpy(*dst,*src, 8 *len);}AudioConvert *swri_audio_convert_alloc(enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, constint *ch_map, intflags){AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) returnNULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) returnNULL;if(channels==1){in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);}ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map){switch(av_get_bytes_per_sample(in_fmt)){case1:ctx->simd_f=cpy1;break;case2:ctx->simd_f=cpy2;break;case4:ctx->simd_f=cpy4;break;case8:ctx->simd_f=cpy8;break;}}if(HAVE_X86ASM &&1) swri_audio_convert_init_x86(ctx, out_fmt, in_fmt, channels);if(ARCH_ARM) swri_audio_convert_init_arm(ctx, out_fmt, in_fmt, channels);if(ARCH_AARCH64) swri_audio_convert_init_aarch64(ctx, out_fmt, in_fmt, channels);returnctx;}voidswri_audio_convert_free(AudioConvert **ctx){av_freep(ctx);}intswri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, intlen){intch;intoff=0;constintos=(out->planar?1:out->ch_count)*out->bps;unsignedmisaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask){intplanes=in->planar?in->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;}if(ctx->out_simd_align_mask){intplanes=out->planar?out->ch_count:1;unsignedm=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;}if(ctx->simd_f &&!ctx->ch_map &&!misaligned){off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){if(out->planar==in->planar){intplanes=out->planar?out->ch_count:1;for(ch=0;ch< planes;ch++){ctx->simd_f(out-> ch ch
static void upmix_7_1_5_1(AVFilterContext *ctx, float c_re, float c_im, float lfe_re, float lfe_im, float mag_totall, float mag_totalr, float fl_phase, float fr_phase, float bl_phase, float br_phase, float sl_phase, float sr_phase, float xl, float yl, float xr, float yr, int n)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AV_CH_LOW_FREQUENCY
static void filter_stereo(AVFilterContext *ctx)
static int ifft_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
A filter pad used for either input or output.
static void upmix_7_1(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int sample_rate
samples per second
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static void filter_5_1_back(AVFilterContext *ctx)
static const AVOption surround_options[]
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
static void upmix_5_1_back(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
struct AVFilterChannelLayouts * out_channel_layouts
static void upmix_5_1_back_2_1(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float lfe_re, float lfe_im, float x, float y, int n)
static void get_lfe(int output_lfe, int n, float lowcut, float highcut, float *lfe_mag, float *mag_total)
void av_rdft_calc(RDFTContext *s, FFTSample *data)
Context for an Audio FIFO Buffer.
#define FFDIFFSIGN(x, y)
Comparator.
int av_audio_fifo_size(AVAudioFifo *af)
Get the current number of samples in the AVAudioFifo available for reading.
audio channel layout utility functions
static void upmix_4_1(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
static int config_output(AVFilterLink *outlink)
#define AV_CH_LAYOUT_3POINT1
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static int fft_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
static const AVFilterPad outputs[]
char * out_channel_layout_str
void av_rdft_end(RDFTContext *s)
AVFilterContext * src
source filter
RDFTContext * av_rdft_init(int nbits, enum RDFTransformType trans)
Set up a real FFT.
#define AV_CH_FRONT_CENTER
#define AV_CH_LAYOUT_5POINT1_BACK
static void upmix_stereo(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
int format
agreed upon media format
static void upmix_1_0(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
A list of supported channel layouts.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
#define AV_CH_LAYOUT_5POINT0_BACK
const char * name
Filter name.
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
int av_get_channel_layout_channel_index(uint64_t channel_layout, uint64_t channel)
Get the index of a channel in channel_layout.
static void upmix_7_0(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
Write data to an AVAudioFifo.
void(* upmix_3_0)(AVFilterContext *ctx, float l_phase, float r_phase, float c_mag, float c_phase, float mag_total, float x, float y, int n)
int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples)
Drain data from an AVAudioFifo.
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static void upmix_5_1_back_surround(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float c_mag, float mag_total, float x, float y, int n)
static void filter_surround(AVFilterContext *ctx)
#define AV_CH_LAYOUT_2POINT1
uint64_t channel_layout
channel layout of current buffer (see libavutil/channel_layout.h)
int channels
Number of channels.
avfilter_execute_func * execute
void(* upmix_2_1)(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float lfe_im, float lfe_re, float x, float y, int n)
static void upmix_3_1(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
AVFilterContext * dst
dest filter
uint64_t in_channel_layout
char * in_channel_layout_str
int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples)
Peek data from an AVAudioFifo.
uint64_t out_channel_layout
AVFILTER_DEFINE_CLASS(surround)
#define av_malloc_array(a, b)
uint8_t ** extended_data
pointers to the data planes/channels.
#define AV_CH_LAYOUT_MONO
static void filter_2_1(AVFilterContext *ctx)
static const AVFilterPad inputs[]
static void upmix_5_0_back(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)
int nb_samples
number of audio samples (per channel) described by this frame
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void upmix_3_0(AVFilterContext *ctx, float l_phase, float r_phase, float c_phase, float mag_total, float x, float y, int n)