History

avfilter/af_surround: refactor some code

Paul B Mahol committed 3 years ago

Commit d7704031 parent 822da7a1 file · +114 −802Browse files

Unified · Split

libavfilter/af_surround.c+114−802
@@ -275,14 +275,14 @@ static int config_input(AVFilterLink *inlink) · 274 unmodified lines
275275 {
276276 AVFilterContext *ctx = inlink->dst;
277277 AudioSurroundContext *s = ctx->priv;
278− int ch, ret;
278+ int ret;
279279
280280 s->rdft = av_calloc(inlink->ch_layout.nb_channels, sizeof(*s->rdft));
281281 if (!s->rdft)
282282 return AVERROR(ENOMEM);
283283 s->nb_in_channels = inlink->ch_layout.nb_channels;
284284
285− for (ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
285+ for (int ch = 0; ch < inlink->ch_layout.nb_channels; ch++) {
286286 float scale = 1.f;
287287
288288 ret = av_tx_init(&s->rdft[ch], &s->tx_fn, AV_TX_FLOAT_RDFT,
@@ -318,14 +318,14 @@ static int config_output(AVFilterLink *outlink) · 29 unmodified lines
318318 {
319319 AVFilterContext *ctx = outlink->src;
320320 AudioSurroundContext *s = ctx->priv;
321− int ch, ret;
321+ int ret;
322322
323323 s->irdft = av_calloc(outlink->ch_layout.nb_channels, sizeof(*s->irdft));
324324 if (!s->irdft)
325325 return AVERROR(ENOMEM);
326326 s->nb_out_channels = outlink->ch_layout.nb_channels;
327327
328− for (ch = 0; ch < outlink->ch_layout.nb_channels; ch++) {
328+ for (int ch = 0; ch < outlink->ch_layout.nb_channels; ch++) {
329329 float iscale = 1.f;
330330
331331 ret = av_tx_init(&s->irdft[ch], &s->itx_fn, AV_TX_FLOAT_RDFT,
@@ -372,6 +372,8 @@ static float r_distance(float a) · 40 unmodified lines
372372 return fminf(sqrtf(1.f + sqrf(tanf(a))), sqrtf(1.f + sqrf(1.f / tanf(a))));
373373 }
374374
375+#define MIN_MAG_SUM 0.00000001f
376+
375377 static void angle_transform(float *x, float *y, float angle)
376378 {
377379 float reference, r, a;
@@ -437,544 +439,150 @@ static inline void get_lfe(int output_lfe, int n, float lowcut, float highcut, · 59 unmodified lines
437439 dst[2 * n ] = mag * cosf(ph); \
438440 dst[2 * n + 1] = mag * sinf(ph);
439441
440−static int upmix_1_0(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
441−{
442− AudioSurroundContext *s = ctx->priv;
443− float *dst = (float *)s->output->extended_data[0];
444− const float *mag_total = s->mag_total;
445− const int rdft_size = s->rdft_size;
446− const float *phase = s->c_phase;
447− const float *x = s->x_pos;
448− const float *y = s->y_pos;
449− const float fc_x = s->fc_x;
450− const float fc_y = s->fc_y;
451−
452− for (int n = 0; n < rdft_size; n++) {
453− float mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
454− float ph = phase[n];
455−
456− TRANSFORM
457− }
458−
459− return 0;
460−}
461−
462−static int upmix_stereo(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
463−{
464− AudioSurroundContext *s = ctx->priv;
465− float *dst = (float *)s->output->extended_data[ch];
466− const float *phase = ch ? s->r_phase : s->l_phase;
467− const float f_x = ch ? s->fr_x : s->fl_x;
468− const float f_y = ch ? s->fr_y : s->fl_y;
469− const float *mag_total = s->mag_total;
470− const int rdft_size = s->rdft_size;
471− const float neg = ch ? -1.f : 1.f;
472− const float *x = s->x_pos;
473− const float *y = s->y_pos;
474−
475− for (int n = 0; n < rdft_size; n++) {
476− float mag = powf(.5f * (neg * x[n] + 1.f), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
477− float ph = phase[n];
478−
479− TRANSFORM
480− }
481−
482− return 0;
483−}
484−
485−static int upmix_2_1(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
486−{
487− AudioSurroundContext *s = ctx->priv;
488− float *dst = (float *)s->output->extended_data[ch];
489− const float *mag_total = s->mag_total;
490− const int rdft_size = s->rdft_size;
491− const float *phase = ch == 2 ? s->c_phase : ch == 1 ? s->r_phase : s->l_phase;
492− const float *lfe_mag = s->lfe_mag;
493− const float f_x = ch ? s->fr_x : s->fl_x;
494− const float f_y = ch ? s->fr_y : s->fl_y;
495− const float neg = ch ? -1.f : 1.f;
496− const float *x = s->x_pos;
497− const float *y = s->y_pos;
498−
499− for (int n = 0; n < rdft_size; n++) {
500− float mag = ch == 2 ? lfe_mag[n] : powf(.5f * (neg * x[n] + 1.f), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
501− float ph = phase[n];
502−
503− TRANSFORM
504− }
505−
506− return 0;
507−}
508−
509−static int upmix_3_0(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
510−{
511− AudioSurroundContext *s = ctx->priv;
512− float *dst = (float *)s->output->extended_data[ch];
513− const float *phase = ch == 2 ? s->c_phase : ch == 1 ? s->r_phase : s->l_phase;
514− const float f_x = ch ? s->fr_x : s->fl_x;
515− const float f_y = ch ? s->fr_y : s->fl_y;
516− const float *mag_total = s->mag_total;
517− const int rdft_size = s->rdft_size;
518− const float neg = ch ? -1.f : 1.f;
519− const float fc_x = s->fc_x;
520− const float fc_y = s->fc_y;
521− const float *x = s->x_pos;
522− const float *y = s->y_pos;
523−
524− for (int n = 0; n < rdft_size; n++) {
525− float mag = ch == 2 ?
526− powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n] :
527− powf(.5f * (neg * x[n] + 1.f), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
528− float ph = phase[n];
529−
530− TRANSFORM
531− }
532−
533− return 0;
534−}
535−
536−static int upmix_3_1(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
537−{
538− AudioSurroundContext *s = ctx->priv;
539− float *dst = (float *)s->output->extended_data[ch];
540− const float *phase = ch >= 2 ? s->c_phase : ch == 1 ? s->r_phase : s->l_phase;
541− const float f_x = ch ? s->fr_x : s->fl_x;
542− const float f_y = ch ? s->fr_y : s->fl_y;
543− const float *mag_total = s->mag_total;
544− const int rdft_size = s->rdft_size;
545− const float neg = ch ? -1.f : 1.f;
546− const float *lfe_mag = s->lfe_mag;
547− const float fc_x = s->fc_x;
548− const float fc_y = s->fc_y;
549− const float *x = s->x_pos;
550− const float *y = s->y_pos;
551−
552− for (int n = 0; n < rdft_size; n++) {
553− float mag = ch == 3 ? lfe_mag[n] : ch == 2 ?
554− powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n] :
555− powf(.5f * (neg * x[n] + 1.f), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
556− float ph = phase[n];
557−
558− TRANSFORM
559− }
560−
561− return 0;
562−}
563−
564−static void upmix_3_1_surround(AVFilterContext *ctx,
565− float l_phase,
566− float r_phase,
567− float c_phase,
568− float c_mag,
569− float mag_total,
570− float x, float y,
571− int n)
572−{
573− AudioSurroundContext *s = ctx->priv;
574− float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
575−
576− dstl = (float *)s->output->extended_data[0];
577− dstr = (float *)s->output->extended_data[1];
578− dstc = (float *)s->output->extended_data[2];
579− dstlfe = (float *)s->output->extended_data[3];
580−
581− get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &c_mag, s->lfe_mode);
582−
583− l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
584− r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
585−
586− dstl[2 * n ] = l_mag * cosf(l_phase);
587− dstl[2 * n + 1] = l_mag * sinf(l_phase);
588−
589− dstr[2 * n ] = r_mag * cosf(r_phase);
590− dstr[2 * n + 1] = r_mag * sinf(r_phase);
591−
592− dstc[2 * n ] = c_mag * cosf(c_phase);
593− dstc[2 * n + 1] = c_mag * sinf(c_phase);
594−
595− dstlfe[2 * n ] = lfe_mag * cosf(c_phase);
596− dstlfe[2 * n + 1] = lfe_mag * sinf(c_phase);
597−}
598−
599−static int upmix_4_0(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
600−{
601− AudioSurroundContext *s = ctx->priv;
602− float *dst = (float *)s->output->extended_data[ch];
603− const float *mag_total = s->mag_total;
604− const int rdft_size = s->rdft_size;
605− const float *l_phase = s->l_phase;
606− const float *r_phase = s->r_phase;
607− const float *c_phase = s->c_phase;
608− const float fl_x = s->fl_x;
609− const float fl_y = s->fl_y;
610− const float fr_x = s->fr_x;
611− const float fr_y = s->fr_y;
612− const float fc_x = s->fc_x;
613− const float fc_y = s->fc_y;
614− const float bc_x = s->bc_x;
615− const float bc_y = s->bc_y;
616− const float *x = s->x_pos;
617− const float *y = s->y_pos;
618−
619− for (int n = 0; n < rdft_size; n++) {
620− float mag, ph;
621−
622− switch (ch) {
623− case 0:
624− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
625− ph = l_phase[n];
626− break;
627− case 1:
628− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
629− ph = r_phase[n];
630− break;
631− case 2:
632− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
633− ph = c_phase[n];
634− break;
635− case 3:
636− mag = powf(1.f - fabsf(x[n]), bc_x) * powf((1.f - y[n]) * .5f, bc_y) * mag_total[n];
637− ph = c_phase[n];
638− break;
639− }
640−
641− TRANSFORM
642− }
643−
644− return 0;
645−}
646−
647−static int upmix_4_1(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
442+static int stereo_upmix(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
648443 {
649444 AudioSurroundContext *s = ctx->priv;
650445 float *dst = (float *)s->output->extended_data[ch];
651446 const float *mag_total = s->mag_total;
652447 const int rdft_size = s->rdft_size;
653− const float *lfe_mag = s->lfe_mag;
654− const float *l_phase = s->l_phase;
655− const float *r_phase = s->r_phase;
656448 const float *c_phase = s->c_phase;
657− const float fl_x = s->fl_x;
658− const float fl_y = s->fl_y;
659− const float fr_x = s->fr_x;
660− const float fr_y = s->fr_y;
661− const float fc_x = s->fc_x;
662− const float fc_y = s->fc_y;
663− const float bc_x = s->bc_x;
664− const float bc_y = s->bc_y;
665− const float *x = s->x_pos;
666− const float *y = s->y_pos;
667−
668− for (int n = 0; n < rdft_size; n++) {
669− float mag, ph;
670−
671− switch (ch) {
672− case 0:
673− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
674− ph = l_phase[n];
675− break;
676− case 1:
677− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
678− ph = r_phase[n];
679− break;
680− case 2:
681− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
682− ph = c_phase[n];
683− break;
684− case 3:
685− mag = lfe_mag[n];
686− ph = c_phase[n];
687− break;
688− case 4:
689− mag = powf(1.f - fabsf(x[n]), bc_x) * powf((1.f - y[n]) * .5f, bc_y) * mag_total[n];
690− ph = c_phase[n];
691− break;
692− }
693−
694− TRANSFORM
695− }
696−
697− return 0;
698−}
699−
700−static int upmix_5_0_back(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
701−{
702− AudioSurroundContext *s = ctx->priv;
703− float *dst = (float *)s->output->extended_data[ch];
704− const float *mag_total = s->mag_total;
705− const int rdft_size = s->rdft_size;
706449 const float *l_phase = s->l_phase;
707450 const float *r_phase = s->r_phase;
708− const float *c_phase = s->c_phase;
709− const float fl_x = s->fl_x;
710− const float fl_y = s->fl_y;
711− const float fr_x = s->fr_x;
712− const float fr_y = s->fr_y;
713− const float bl_x = s->bl_x;
714− const float bl_y = s->bl_y;
715− const float br_x = s->br_x;
716− const float br_y = s->br_y;
717− const float fc_x = s->fc_x;
718− const float fc_y = s->fc_y;
719− const float *x = s->x_pos;
720− const float *y = s->y_pos;
721−
722− for (int n = 0; n < rdft_size; n++) {
723− float mag, ph;
724−
725− switch (ch) {
726− case 2:
727− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
728− ph = c_phase[n];
729− break;
730− case 0:
731− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
732− ph = l_phase[n];
733− break;
734− case 1:
735− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
736− ph = r_phase[n];
737− break;
738− case 3:
739− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
740− ph = l_phase[n];
741− break;
742− case 4:
743− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
744− ph = r_phase[n];
745− break;
746− }
747−
748− TRANSFORM
749− }
750−
751− return 0;
752−}
753−
754−static int upmix_5_1_back(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
755−{
756− AudioSurroundContext *s = ctx->priv;
757− float *dst = (float *)s->output->extended_data[ch];
758− const float *mag_total = s->mag_total;
759451 const float *lfe_mag = s->lfe_mag;
760− const int rdft_size = s->rdft_size;
761− const float *l_phase = s->l_phase;
762− const float *r_phase = s->r_phase;
763− const float *c_phase = s->c_phase;
764− const float fl_x = s->fl_x;
765− const float fl_y = s->fl_y;
766− const float fr_x = s->fr_x;
767− const float fr_y = s->fr_y;
768− const float bl_x = s->bl_x;
769− const float bl_y = s->bl_y;
770− const float br_x = s->br_x;
771− const float br_y = s->br_y;
772− const float fc_x = s->fc_x;
773− const float fc_y = s->fc_y;
774452 const float *x = s->x_pos;
775453 const float *y = s->y_pos;
776− float mag, ph;
454+ const int chan = av_channel_layout_channel_from_index(&s->out_ch_layout, ch);
455+ float f_x, f_y;
777456
778− switch (ch) {
779− case 0:
457+ switch (chan) {
458+ case AV_CHAN_FRONT_CENTER:
459+ f_x = s->fc_x;
460+ f_y = s->fc_y;
780461 for (int n = 0; n < rdft_size; n++) {
781− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
782− ph = l_phase[n];
783− TRANSFORM
784− }
785− break;
786− case 1:
787− for (int n = 0; n < rdft_size; n++) {
788− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
789− ph = r_phase[n];
462+ float mag = powf(1.f - fabsf(x[n]), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
463+ float ph = c_phase[n];
464+
790465 TRANSFORM
791466 }
792467 break;
793− case 2:
468+ case AV_CHAN_FRONT_LEFT:
469+ f_x = s->fl_x;
470+ f_y = s->fl_y;
794471 for (int n = 0; n < rdft_size; n++) {
795− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
796− ph = c_phase[n];
472+ float mag = powf(.5f * ( x[n] + 1.f), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
473+ float ph = l_phase[n];
474+
797475 TRANSFORM
798476 }
799477 break;
800− case 3:
478+ case AV_CHAN_FRONT_RIGHT:
479+ f_x = s->fr_x;
480+ f_y = s->fr_y;
801481 for (int n = 0; n < rdft_size; n++) {
802− mag = lfe_mag[n];
803− ph = c_phase[n];
482+ float mag = powf(.5f * (-x[n] + 1.f), f_x) * powf((y[n] + 1.f) * .5f, f_y) * mag_total[n];
483+ float ph = r_phase[n];
484+
804485 TRANSFORM
805486 }
806487 break;
807− case 4:
488+ case AV_CHAN_LOW_FREQUENCY:
808489 for (int n = 0; n < rdft_size; n++) {
809− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
810− ph = l_phase[n];
490+ float mag = lfe_mag[n];
491+ float ph = c_phase[n];
492+
811493 TRANSFORM
812494 }
813495 break;
814− case 5:
496+ case AV_CHAN_BACK_CENTER:
497+ f_x = s->bc_x;
498+ f_y = s->bc_y;
815499 for (int n = 0; n < rdft_size; n++) {
816− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
817− ph = r_phase[n];
818− TRANSFORM
819− }
820− break;
821− }
500+ float mag = powf(1.f - fabsf(x[n]), f_x) * powf((1.f - y[n]) * .5f, f_y) * mag_total[n];
501+ float ph = c_phase[n];
822502
823− return 0;
824−}
825−
826−static int upmix_6_0(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
827−{
828− AudioSurroundContext *s = ctx->priv;
829− float *dst = (float *)s->output->extended_data[ch];
830− const float *mag_total = s->mag_total;
831− const int rdft_size = s->rdft_size;
832− const float *l_phase = s->l_phase;
833− const float *r_phase = s->r_phase;
834− const float *c_phase = s->c_phase;
835− const float fl_x = s->fl_x;
836− const float fl_y = s->fl_y;
837− const float fr_x = s->fr_x;
838− const float fr_y = s->fr_y;
839− const float bl_x = s->bl_x;
840− const float bl_y = s->bl_y;
841− const float br_x = s->br_x;
842− const float br_y = s->br_y;
843− const float bc_x = s->bc_x;
844− const float bc_y = s->bc_y;
845− const float fc_x = s->fc_x;
846− const float fc_y = s->fc_y;
847− const float *x = s->x_pos;
848− const float *y = s->y_pos;
849− float mag, ph;
850−
851− switch (ch) {
852− case 0:
853− for (int n = 0; n < rdft_size; n++) {
854− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
855− ph = l_phase[n];
856503 TRANSFORM
857504 }
858505 break;
859− case 1:
506+ case AV_CHAN_BACK_LEFT:
507+ f_x = s->bl_x;
508+ f_y = s->bl_y;
860509 for (int n = 0; n < rdft_size; n++) {
861− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
862− ph = r_phase[n];
510+ float mag = powf(.5f * ( x[n] + 1.f), f_x) * powf(1.f - ((y[n] + 1.f) * .5f), f_y) * mag_total[n];
511+ float ph = l_phase[n];
512+
863513 TRANSFORM
864514 }
865515 break;
866− case 2:
516+ case AV_CHAN_BACK_RIGHT:
517+ f_x = s->br_x;
518+ f_y = s->br_y;
867519 for (int n = 0; n < rdft_size; n++) {
868− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
869− ph = c_phase[n];
520+ float mag = powf(.5f * (-x[n] + 1.f), f_x) * powf(1.f - ((y[n] + 1.f) * .5f), f_y) * mag_total[n];
521+ float ph = r_phase[n];
522+
870523 TRANSFORM
871524 }
872525 break;
873− case 3:
526+ case AV_CHAN_SIDE_LEFT:
527+ f_x = s->sl_x;
528+ f_y = s->sl_y;
874529 for (int n = 0; n < rdft_size; n++) {
875− mag = powf(1.f - fabsf(x[n]), bc_x) * powf((1.f - y[n]) * .5f, bc_y) * mag_total[n];
876− ph = c_phase[n];
530+ float mag = powf(.5f * ( x[n] + 1.f), f_x) * powf(1.f - fabsf(y[n]), f_y) * mag_total[n];
531+ float ph = l_phase[n];
532+
877533 TRANSFORM
878534 }
879535 break;
880− case 4:
536+ case AV_CHAN_SIDE_RIGHT:
537+ f_x = s->sr_x;
538+ f_y = s->sr_y;
881539 for (int n = 0; n < rdft_size; n++) {
882− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
883− ph = l_phase[n];
540+ float mag = powf(.5f * (-x[n] + 1.f), f_x) * powf(1.f - fabsf(y[n]), f_y) * mag_total[n];
541+ float ph = r_phase[n];
542+
884543 TRANSFORM
885544 }
886545 break;
887− case 5:
888− for (int n = 0; n < rdft_size; n++) {
889− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
890− ph = r_phase[n];
891− TRANSFORM
892− }
546+ default:
893547 break;
894548 }
895549
896550 return 0;
897551 }
898552
899−static int upmix_6_1(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
553+static void upmix_3_1_surround(AVFilterContext *ctx,
554+ float l_phase,
555+ float r_phase,
556+ float c_phase,
557+ float c_mag,
558+ float mag_total,
559+ float x, float y,
560+ int n)
900561 {
901562 AudioSurroundContext *s = ctx->priv;
902− float *dst = (float *)s->output->extended_data[ch];
903− const float *mag_total = s->mag_total;
904− const int rdft_size = s->rdft_size;
905− const float *lfe_mag = s->lfe_mag;
906− const float *l_phase = s->l_phase;
907− const float *r_phase = s->r_phase;
908− const float *c_phase = s->c_phase;
909− const float fl_x = s->fl_x;
910− const float fl_y = s->fl_y;
911− const float fr_x = s->fr_x;
912− const float fr_y = s->fr_y;
913− const float bl_x = s->bl_x;
914− const float bl_y = s->bl_y;
915− const float br_x = s->br_x;
916− const float br_y = s->br_y;
917− const float bc_x = s->bc_x;
918− const float bc_y = s->bc_y;
919− const float fc_x = s->fc_x;
920− const float fc_y = s->fc_y;
921− const float *x = s->x_pos;
922− const float *y = s->y_pos;
923− float mag, ph;
563+ float lfe_mag, l_mag, r_mag, *dstc, *dstl, *dstr, *dstlfe;
924564
925− switch (ch) {
926− case 0:
927− for (int n = 0; n < rdft_size; n++) {
928− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
929− ph = l_phase[n];
930− TRANSFORM
931− }
932− break;
933− case 1:
934− for (int n = 0; n < rdft_size; n++) {
935− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
936− ph = r_phase[n];
937− TRANSFORM
938− }
939− break;
940− case 2:
941− for (int n = 0; n < rdft_size; n++) {
942− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
943− ph = c_phase[n];
944− TRANSFORM
945− }
946− break;
947− case 3:
948− for (int n = 0; n < rdft_size; n++) {
949− mag = lfe_mag[n];
950− ph = c_phase[n];
951− TRANSFORM
952− }
953− break;
954− case 4:
955− for (int n = 0; n < rdft_size; n++) {
956− mag = powf(1.f - fabsf(x[n]), bc_x) * powf((1.f - y[n]) * .5f, bc_y) * mag_total[n];
957− ph = c_phase[n];
958− TRANSFORM
959− }
960− break;
961− case 5:
962− for (int n = 0; n < rdft_size; n++) {
963− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
964− ph = l_phase[n];
965− TRANSFORM
966− }
967− break;
968− case 6:
969− for (int n = 0; n < rdft_size; n++) {
970− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
971− ph = r_phase[n];
972− TRANSFORM
973− }
974− break;
975− }
565+ dstl = (float *)s->output->extended_data[0];
566+ dstr = (float *)s->output->extended_data[1];
567+ dstc = (float *)s->output->extended_data[2];
568+ dstlfe = (float *)s->output->extended_data[3];
976569
977− return 0;
570+ get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &c_mag, s->lfe_mode);
571+
572+ l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
573+ r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
574+
575+ dstl[2 * n ] = l_mag * cosf(l_phase);
576+ dstl[2 * n + 1] = l_mag * sinf(l_phase);
577+
578+ dstr[2 * n ] = r_mag * cosf(r_phase);
579+ dstr[2 * n + 1] = r_mag * sinf(r_phase);
580+
581+ dstc[2 * n ] = c_mag * cosf(c_phase);
582+ dstc[2 * n + 1] = c_mag * sinf(c_phase);
583+
584+ dstlfe[2 * n ] = lfe_mag * cosf(c_phase);
585+ dstlfe[2 * n + 1] = lfe_mag * sinf(c_phase);
978586 }
979587
980588 static void upmix_5_1_back_surround(AVFilterContext *ctx,
@@ -1069,178 +677,6 @@ static void upmix_5_1_back_2_1(AVFilterContext *ctx, · 88 unmodified lines
1069677 dstrs[2 * n + 1] = rs_mag * sinf(r_phase);
1070678 }
1071679
1072−static int upmix_7_0(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
1073−{
1074− AudioSurroundContext *s = ctx->priv;
1075− float *dst = (float *)s->output->extended_data[ch];
1076− const float *mag_total = s->mag_total;
1077− const int rdft_size = s->rdft_size;
1078− const float *l_phase = s->l_phase;
1079− const float *r_phase = s->r_phase;
1080− const float *c_phase = s->c_phase;
1081− const float fl_x = s->fl_x;
1082− const float fl_y = s->fl_y;
1083− const float fr_x = s->fr_x;
1084− const float fr_y = s->fr_y;
1085− const float fc_x = s->fc_x;
1086− const float fc_y = s->fc_y;
1087− const float bl_x = s->bl_x;
1088− const float bl_y = s->bl_y;
1089− const float br_x = s->br_x;
1090− const float br_y = s->br_y;
1091− const float sl_x = s->sl_x;
1092− const float sl_y = s->sl_y;
1093− const float sr_x = s->sr_x;
1094− const float sr_y = s->sr_y;
1095− const float *x = s->x_pos;
1096− const float *y = s->y_pos;
1097− float mag, ph;
1098−
1099− switch (ch) {
1100− case 0:
1101− for (int n = 0; n < rdft_size; n++) {
1102− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
1103− ph = l_phase[n];
1104− TRANSFORM
1105− }
1106− break;
1107− case 1:
1108− for (int n = 0; n < rdft_size; n++) {
1109− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
1110− ph = r_phase[n];
1111− TRANSFORM
1112− }
1113− break;
1114− case 2:
1115− for (int n = 0; n < rdft_size; n++) {
1116− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
1117− ph = c_phase[n];
1118− TRANSFORM
1119− }
1120− break;
1121− case 3:
1122− for (int n = 0; n < rdft_size; n++) {
1123− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
1124− ph = l_phase[n];
1125− TRANSFORM
1126− }
1127− break;
1128− case 4:
1129− for (int n = 0; n < rdft_size; n++) {
1130− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
1131− ph = r_phase[n];
1132− TRANSFORM
1133− }
1134− break;
1135− case 5:
1136− for (int n = 0; n < rdft_size; n++) {
1137− mag = powf(.5f * ( x[n] + 1.f), sl_x) * powf(1.f - fabsf(y[n]), sl_y) * mag_total[n];
1138− ph = l_phase[n];
1139− TRANSFORM
1140− }
1141− break;
1142− case 6:
1143− for (int n = 0; n < rdft_size; n++) {
1144− mag = powf(.5f * (-x[n] + 1.f), sr_x) * powf(1.f - fabsf(y[n]), sr_y) * mag_total[n];
1145− ph = r_phase[n];
1146− TRANSFORM
1147− }
1148− break;
1149− }
1150−
1151− return 0;
1152−}
1153−
1154−static int upmix_7_1(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
1155−{
1156− AudioSurroundContext *s = ctx->priv;
1157− float *dst = (float *)s->output->extended_data[ch];
1158− const float *mag_total = s->mag_total;
1159− const int rdft_size = s->rdft_size;
1160− const float *lfe_mag = s->lfe_mag;
1161− const float *l_phase = s->l_phase;
1162− const float *r_phase = s->r_phase;
1163− const float *c_phase = s->c_phase;
1164− const float fl_x = s->fl_x;
1165− const float fl_y = s->fl_y;
1166− const float fr_x = s->fr_x;
1167− const float fr_y = s->fr_y;
1168− const float fc_x = s->fc_x;
1169− const float fc_y = s->fc_y;
1170− const float bl_x = s->bl_x;
1171− const float bl_y = s->bl_y;
1172− const float br_x = s->br_x;
1173− const float br_y = s->br_y;
1174− const float sl_x = s->sl_x;
1175− const float sl_y = s->sl_y;
1176− const float sr_x = s->sr_x;
1177− const float sr_y = s->sr_y;
1178− const float *x = s->x_pos;
1179− const float *y = s->y_pos;
1180− float mag, ph;
1181−
1182− switch (ch) {
1183− case 0:
1184− for (int n = 0; n < rdft_size; n++) {
1185− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
1186− ph = l_phase[n];
1187− TRANSFORM
1188− }
1189− break;
1190− case 1:
1191− for (int n = 0; n < rdft_size; n++) {
1192− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
1193− ph = r_phase[n];
1194− TRANSFORM
1195− }
1196− break;
1197− case 2:
1198− for (int n = 0; n < rdft_size; n++) {
1199− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
1200− ph = c_phase[n];
1201− TRANSFORM
1202− }
1203− break;
1204− case 3:
1205− for (int n = 0; n < rdft_size; n++) {
1206− mag = lfe_mag[n];
1207− ph = c_phase[n];
1208− TRANSFORM
1209− }
1210− break;
1211− case 4:
1212− for (int n = 0; n < rdft_size; n++) {
1213− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
1214− ph = l_phase[n];
1215− TRANSFORM
1216− }
1217− break;
1218− case 5:
1219− for (int n = 0; n < rdft_size; n++) {
1220− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
1221− ph = r_phase[n];
1222− TRANSFORM
1223− }
1224− break;
1225− case 6:
1226− for (int n = 0; n < rdft_size; n++) {
1227− mag = powf(.5f * ( x[n] + 1.f), sl_x) * powf(1.f - fabsf(y[n]), sl_y) * mag_total[n];
1228− ph = l_phase[n];
1229− TRANSFORM
1230− }
1231− break;
1232− case 7:
1233− for (int n = 0; n < rdft_size; n++) {
1234− mag = powf(.5f * (-x[n] + 1.f), sr_x) * powf(1.f - fabsf(y[n]), sr_y) * mag_total[n];
1235− ph = r_phase[n];
1236− TRANSFORM
1237− }
1238− break;
1239− }
1240−
1241− return 0;
1242−}
1243−
1244680 static void upmix_7_1_5_0_side(AVFilterContext *ctx,
1245681 float c_re, float c_im,
1246682 float mag_totall, float mag_totalr,
@@ -1357,97 +793,6 @@ static void upmix_7_1_5_1(AVFilterContext *ctx, · 110 unmodified lines
1357793 dstrs[2 * n + 1] = rs_mag * sinf(sr_phase);
1358794 }
1359795
1360−static int upmix_8_0(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
1361−{
1362− AudioSurroundContext *s = ctx->priv;
1363− float *dst = (float *)s->output->extended_data[ch];
1364− const float *mag_total = s->mag_total;
1365− const int rdft_size = s->rdft_size;
1366− const float *l_phase = s->l_phase;
1367− const float *r_phase = s->r_phase;
1368− const float *c_phase = s->c_phase;
1369− const float fl_x = s->fl_x;
1370− const float fl_y = s->fl_y;
1371− const float fr_x = s->fr_x;
1372− const float fr_y = s->fr_y;
1373− const float fc_x = s->fc_x;
1374− const float fc_y = s->fc_y;
1375− const float bl_x = s->bl_x;
1376− const float bl_y = s->bl_y;
1377− const float br_x = s->br_x;
1378− const float br_y = s->br_y;
1379− const float sl_x = s->sl_x;
1380− const float sl_y = s->sl_y;
1381− const float sr_x = s->sr_x;
1382− const float sr_y = s->sr_y;
1383− const float bc_x = s->bc_x;
1384− const float bc_y = s->bc_y;
1385− const float *x = s->x_pos;
1386− const float *y = s->y_pos;
1387− float mag, ph;
1388−
1389− switch (ch) {
1390− case 0:
1391− for (int n = 0; n < rdft_size; n++) {
1392− mag = powf(.5f * ( x[n] + 1.f), fl_x) * powf((y[n] + 1.f) * .5f, fl_y) * mag_total[n];
1393− ph = l_phase[n];
1394− TRANSFORM
1395− }
1396− break;
1397− case 1:
1398− for (int n = 0; n < rdft_size; n++) {
1399− mag = powf(.5f * (-x[n] + 1.f), fr_x) * powf((y[n] + 1.f) * .5f, fr_y) * mag_total[n];
1400− ph = r_phase[n];
1401− TRANSFORM
1402− }
1403− break;
1404− case 2:
1405− for (int n = 0; n < rdft_size; n++) {
1406− mag = powf(1.f - fabsf(x[n]), fc_x) * powf((y[n] + 1.f) * .5f, fc_y) * mag_total[n];
1407− ph = c_phase[n];
1408− TRANSFORM
1409− }
1410− break;
1411− case 3:
1412− for (int n = 0; n < rdft_size; n++) {
1413− mag = powf(.5f * ( x[n] + 1.f), bl_x) * powf(1.f - ((y[n] + 1.f) * .5f), bl_y) * mag_total[n];
1414− ph = l_phase[n];
1415− TRANSFORM
1416− }
1417− break;
1418− case 4:
1419− for (int n = 0; n < rdft_size; n++) {
1420− mag = powf(.5f * (-x[n] + 1.f), br_x) * powf(1.f - ((y[n] + 1.f) * .5f), br_y) * mag_total[n];
1421− ph = r_phase[n];
1422− TRANSFORM
1423− }
1424− break;
1425− case 5:
1426− for (int n = 0; n < rdft_size; n++) {
1427− mag = powf(1.f - fabsf(x[n]), bc_x) * powf((1.f - y[n]) * .5f, bc_y) * mag_total[n];
1428− ph = l_phase[n];
1429− TRANSFORM
1430− }
1431− break;
1432− case 6:
1433− for (int n = 0; n < rdft_size; n++) {
1434− mag = powf(.5f * ( x[n] + 1.f), sl_x) * powf(1.f - fabsf(y[n]), sl_y) * mag_total[n];
1435− ph = l_phase[n];
1436− TRANSFORM
1437− }
1438− break;
1439− case 7:
1440− for (int n = 0; n < rdft_size; n++) {
1441− mag = powf(.5f * (-x[n] + 1.f), sr_x) * powf(1.f - fabsf(y[n]), sr_y) * mag_total[n];
1442− ph = r_phase[n];
1443− TRANSFORM
1444− }
1445− break;
1446− }
1447−
1448− return 0;
1449−}
1450−
1451796 static void filter_stereo(AVFilterContext *ctx)
1452797 {
1453798 AudioSurroundContext *s = ctx->priv;
@@ -1473,14 +818,15 @@ static void filter_stereo(AVFilterContext *ctx) · 19 unmodified lines
1473818 float c_phase = atan2f(l_im + r_im, l_re + r_re);
1474819 float l_mag = hypotf(l_re, l_im);
1475820 float r_mag = hypotf(r_re, r_im);
821+ float mag_total = hypotf(l_mag, r_mag);
1476822 float l_phase = atan2f(l_im, l_re);
1477823 float r_phase = atan2f(r_im, r_re);
1478824 float phase_dif = fabsf(l_phase - r_phase);
1479825 float mag_sum = l_mag + r_mag;
1480− float mag_dif = mag_sum < 0.000001f ? FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1481− float mag_total = hypotf(l_mag, r_mag);
1482− float x, y;
826+ float mag_dif, x, y;
1483827
828+ mag_sum = mag_sum < MIN_MAG_SUM ? 1.f : mag_sum;
829+ mag_dif = (l_mag - r_mag) / mag_sum;
1484830 if (phase_dif > M_PI)
1485831 phase_dif = 2.f * M_PI - phase_dif;
1486832
@@ -1516,14 +862,15 @@ static void filter_surround(AVFilterContext *ctx) · 29 unmodified lines
1516862 float c_phase = atan2f(c_im, c_re);
1517863 float l_mag = hypotf(l_re, l_im);
1518864 float r_mag = hypotf(r_re, r_im);
865+ float mag_total = hypotf(l_mag, r_mag);
1519866 float l_phase = atan2f(l_im, l_re);
1520867 float r_phase = atan2f(r_im, r_re);
1521868 float phase_dif = fabsf(l_phase - r_phase);
1522869 float mag_sum = l_mag + r_mag;
1523− float mag_dif = mag_sum < 0.000001f ? FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1524− float mag_total = hypotf(l_mag, r_mag);
1525− float x, y;
870+ float mag_dif, x, y;
1526871
872+ mag_sum = mag_sum < MIN_MAG_SUM ? 1.f : mag_sum;
873+ mag_dif = (l_mag - r_mag) / mag_sum;
1527874 if (phase_dif > M_PI)
1528875 phase_dif = 2.f * M_PI - phase_dif;
1529876
@@ -1551,14 +898,15 @@ static void filter_2_1(AVFilterContext *ctx) · 21 unmodified lines
1551898 float c_phase = atan2f(l_im + r_im, l_re + r_re);
1552899 float l_mag = hypotf(l_re, l_im);
1553900 float r_mag = hypotf(r_re, r_im);
901+ float mag_total = hypotf(l_mag, r_mag);
1554902 float l_phase = atan2f(l_im, l_re);
1555903 float r_phase = atan2f(r_im, r_re);
1556904 float phase_dif = fabsf(l_phase - r_phase);
1557905 float mag_sum = l_mag + r_mag;
1558− float mag_dif = mag_sum < 0.000001f ? FFDIFFSIGN(l_mag, r_mag) : (l_mag - r_mag) / mag_sum;
1559− float mag_total = hypotf(l_mag, r_mag);
1560− float x, y;
906+ float mag_dif, x, y;
1561907
908+ mag_sum = mag_sum < MIN_MAG_SUM ? 1.f : mag_sum;
909+ mag_dif = (l_mag - r_mag) / mag_sum;
1562910 if (phase_dif > M_PI)
1563911 phase_dif = 2.f * M_PI - phase_dif;
1564912
@@ -1599,8 +947,8 @@ static void filter_5_0_side(AVFilterContext *ctx) · 34 unmodified lines
1599947 float phase_difr = fabsf(fr_phase - sr_phase);
1600948 float magl_sum = fl_mag + sl_mag;
1601949 float magr_sum = fr_mag + sr_mag;
1602− float mag_difl = magl_sum < 0.000001f ? FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1603− float mag_difr = magr_sum < 0.000001f ? FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
950+ float mag_difl = magl_sum < MIN_MAG_SUM ? FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
951+ float mag_difr = magr_sum < MIN_MAG_SUM ? FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
1604952 float mag_totall = hypotf(fl_mag, sl_mag);
1605953 float mag_totalr = hypotf(fr_mag, sr_mag);
1606954 float bl_phase = atan2f(fl_im + sl_im, fl_re + sl_re);
@@ -1658,8 +1006,8 @@ static void filter_5_1_side(AVFilterContext *ctx) · 51 unmodified lines
16581006 float phase_difr = fabsf(fr_phase - sr_phase);
16591007 float magl_sum = fl_mag + sl_mag;
16601008 float magr_sum = fr_mag + sr_mag;
1661− float mag_difl = magl_sum < 0.000001f ? FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1662− float mag_difr = magr_sum < 0.000001f ? FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
1009+ float mag_difl = magl_sum < MIN_MAG_SUM ? FFDIFFSIGN(fl_mag, sl_mag) : (fl_mag - sl_mag) / magl_sum;
1010+ float mag_difr = magr_sum < MIN_MAG_SUM ? FFDIFFSIGN(fr_mag, sr_mag) : (fr_mag - sr_mag) / magr_sum;
16631011 float mag_totall = hypotf(fl_mag, sl_mag);
16641012 float mag_totalr = hypotf(fr_mag, sr_mag);
16651013 float bl_phase = atan2f(fl_im + sl_im, fl_re + sl_re);
@@ -1717,8 +1065,8 @@ static void filter_5_1_back(AVFilterContext *ctx) · 51 unmodified lines
17171065 float phase_difr = fabsf(fr_phase - br_phase);
17181066 float magl_sum = fl_mag + bl_mag;
17191067 float magr_sum = fr_mag + br_mag;
1720− float mag_difl = magl_sum < 0.000001f ? FFDIFFSIGN(fl_mag, bl_mag) : (fl_mag - bl_mag) / magl_sum;
1721− float mag_difr = magr_sum < 0.000001f ? FFDIFFSIGN(fr_mag, br_mag) : (fr_mag - br_mag) / magr_sum;
1068+ float mag_difl = magl_sum < MIN_MAG_SUM ? FFDIFFSIGN(fl_mag, bl_mag) : (fl_mag - bl_mag) / magl_sum;
1069+ float mag_difr = magr_sum < MIN_MAG_SUM ? FFDIFFSIGN(fr_mag, br_mag) : (fr_mag - br_mag) / magr_sum;
17221070 float mag_totall = hypotf(fl_mag, bl_mag);
17231071 float mag_totalr = hypotf(fr_mag, br_mag);
17241072 float sl_phase = atan2f(fl_im + bl_im, fl_re + bl_re);
@@ -1786,59 +1134,29 @@ static av_cold int init(AVFilterContext *ctx) · 61 unmodified lines
17861134 out_channel_layout = s->out_ch_layout.order == AV_CHANNEL_ORDER_NATIVE ?
17871135 s->out_ch_layout.u.mask : 0;
17881136
1789− s->have_lfe = 0;
1137+ s->have_lfe = av_channel_layout_index_from_channel(&s->out_ch_layout,
1138+ AV_CHAN_LOW_FREQUENCY) >= 0;
17901139
17911140 switch (in_channel_layout) {
17921141 case AV_CH_LAYOUT_STEREO:
17931142 s->filter = filter_stereo;
1143+ s->upmix = stereo_upmix;
17941144 switch (out_channel_layout) {
17951145 case AV_CH_LAYOUT_MONO:
1796− s->upmix = upmix_1_0;
1797− break;
17981146 case AV_CH_LAYOUT_STEREO:
1799− s->upmix = upmix_stereo;
1800− break;
1801− case AV_CH_LAYOUT_2POINT1:
1802− s->upmix = upmix_2_1;
1803− s->have_lfe = 1;
1804− break;
18051147 case AV_CH_LAYOUT_SURROUND:
1806− s->upmix = upmix_3_0;
1807− break;
18081148 case AV_CH_LAYOUT_3POINT1:
1809− s->upmix = upmix_3_1;
1810− s->have_lfe = 1;
1811− break;
18121149 case AV_CH_LAYOUT_4POINT0:
1813− s->upmix = upmix_4_0;
1814− break;
18151150 case AV_CH_LAYOUT_4POINT1:
1816− s->upmix = upmix_4_1;
1817− s->have_lfe = 1;
1818− break;
1151+ case AV_CH_LAYOUT_5POINT0:
1152+ case AV_CH_LAYOUT_5POINT1:
18191153 case AV_CH_LAYOUT_5POINT0_BACK:
1820− s->upmix = upmix_5_0_back;
1821− break;
18221154 case AV_CH_LAYOUT_5POINT1_BACK:
1823− s->upmix = upmix_5_1_back;
1824− s->have_lfe = 1;
1825− break;
18261155 case AV_CH_LAYOUT_6POINT0:
1827− s->upmix = upmix_6_0;
1828− break;
18291156 case AV_CH_LAYOUT_6POINT1:
1830− s->upmix = upmix_6_1;
1831− s->have_lfe = 1;
1832− break;
18331157 case AV_CH_LAYOUT_7POINT0:
1834− s->upmix = upmix_7_0;
1835− break;
18361158 case AV_CH_LAYOUT_7POINT1:
1837− s->upmix = upmix_7_1;
1838− s->have_lfe = 1;
1839− break;
18401159 case AV_CH_LAYOUT_OCTAGONAL:
1841− s->upmix = upmix_8_0;
18421160 break;
18431161 default:
18441162 goto fail;
@@ -1849,7 +1167,6 @@ static av_cold int init(AVFilterContext *ctx) · 4 unmodified lines
18491167 switch (out_channel_layout) {
18501168 case AV_CH_LAYOUT_5POINT1_BACK:
18511169 s->upmix_2_1 = upmix_5_1_back_2_1;
1852− s->have_lfe = 1;
18531170 break;
18541171 default:
18551172 goto fail;
@@ -1860,11 +1177,9 @@ static av_cold int init(AVFilterContext *ctx) · 4 unmodified lines
18601177 switch (out_channel_layout) {
18611178 case AV_CH_LAYOUT_3POINT1:
18621179 s->upmix_3_0 = upmix_3_1_surround;
1863− s->have_lfe = 1;
18641180 break;
18651181 case AV_CH_LAYOUT_5POINT1_BACK:
18661182 s->upmix_3_0 = upmix_5_1_back_surround;
1867− s->have_lfe = 1;
18681183 break;
18691184 default:
18701185 goto fail;
@@ -1875,7 +1190,6 @@ static av_cold int init(AVFilterContext *ctx) · 4 unmodified lines
18751190 switch (out_channel_layout) {
18761191 case AV_CH_LAYOUT_7POINT1:
18771192 s->upmix_5_0 = upmix_7_1_5_0_side;
1878− s->have_lfe = 1;
18791193 break;
18801194 default:
18811195 goto fail;
@@ -1886,7 +1200,6 @@ static av_cold int init(AVFilterContext *ctx) · 4 unmodified lines
18861200 switch (out_channel_layout) {
18871201 case AV_CH_LAYOUT_7POINT1:
18881202 s->upmix_5_1 = upmix_7_1_5_1;
1889− s->have_lfe = 1;
18901203 break;
18911204 default:
18921205 goto fail;
@@ -1897,7 +1210,6 @@ static av_cold int init(AVFilterContext *ctx) · 4 unmodified lines
18971210 switch (out_channel_layout) {
18981211 case AV_CH_LAYOUT_7POINT1:
18991212 s->upmix_5_1 = upmix_7_1_5_1;
1900− s->have_lfe = 1;
19011213 break;
19021214 default:
19031215 goto fail;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t