Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -601,6 +601,100 @@ static void upmix_5_1_back(AVFilterContext *ctx, · 600 unmodified lines | |||
| 601 | dstrs[2 * n + 1] = rs_mag * sinf(r_phase); | 601 | dstrs[2 * n + 1] = rs_mag * sinf(r_phase); |
| 602 | } | 602 | } |
| 603 | 603 | ||
| 604 | static void upmix_6_0(AVFilterContext *ctx, | ||
| 605 | float l_phase, | ||
| 606 | float r_phase, | ||
| 607 | float c_phase, | ||
| 608 | float mag_total, | ||
| 609 | float x, float y, | ||
| 610 | int n) | ||
| 611 | { | ||
| 612 | AudioSurroundContext *s = ctx->priv; | ||
| 613 | float l_mag, r_mag, ls_mag, rs_mag, c_mag, b_mag, *dstc, *dstb, *dstl, *dstr, *dstls, *dstrs; | ||
| 614 | |||
| 615 | dstl = (float *)s->output->extended_data[0]; | ||
| 616 | dstr = (float *)s->output->extended_data[1]; | ||
| 617 | dstc = (float *)s->output->extended_data[2]; | ||
| 618 | dstb = (float *)s->output->extended_data[3]; | ||
| 619 | dstls = (float *)s->output->extended_data[4]; | ||
| 620 | dstrs = (float *)s->output->extended_data[5]; | ||
| 621 | |||
| 622 | c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total; | ||
| 623 | b_mag = powf(1.f - fabsf(x), s->bc_x) * powf((1.f - y) * .5f, s->bc_y) * mag_total; | ||
| 624 | l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total; | ||
| 625 | r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total; | ||
| 626 | ls_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total; | ||
| 627 | rs_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total; | ||
| 628 | |||
| 629 | dstl[2 * n ] = l_mag * cosf(l_phase); | ||
| 630 | dstl[2 * n + 1] = l_mag * sinf(l_phase); | ||
| 631 | |||
| 632 | dstr[2 * n ] = r_mag * cosf(r_phase); | ||
| 633 | dstr[2 * n + 1] = r_mag * sinf(r_phase); | ||
| 634 | |||
| 635 | dstc[2 * n ] = c_mag * cosf(c_phase); | ||
| 636 | dstc[2 * n + 1] = c_mag * sinf(c_phase); | ||
| 637 | |||
| 638 | dstls[2 * n ] = ls_mag * cosf(l_phase); | ||
| 639 | dstls[2 * n + 1] = ls_mag * sinf(l_phase); | ||
| 640 | |||
| 641 | dstrs[2 * n ] = rs_mag * cosf(r_phase); | ||
| 642 | dstrs[2 * n + 1] = rs_mag * sinf(r_phase); | ||
| 643 | |||
| 644 | dstb[2 * n ] = b_mag * cosf(c_phase); | ||
| 645 | dstb[2 * n + 1] = b_mag * sinf(c_phase); | ||
| 646 | } | ||
| 647 | |||
| 648 | static void upmix_6_1(AVFilterContext *ctx, | ||
| 649 | float l_phase, | ||
| 650 | float r_phase, | ||
| 651 | float c_phase, | ||
| 652 | float mag_total, | ||
| 653 | float x, float y, | ||
| 654 | int n) | ||
| 655 | { | ||
| 656 | AudioSurroundContext *s = ctx->priv; | ||
| 657 | float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, b_mag, *dstc, *dstb, *dstl, *dstr, *dstls, *dstrs, *dstlfe; | ||
| 658 | |||
| 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 | dstb = (float *)s->output->extended_data[4]; | ||
| 664 | dstls = (float *)s->output->extended_data[5]; | ||
| 665 | dstrs = (float *)s->output->extended_data[6]; | ||
| 666 | |||
| 667 | get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode); | ||
| 668 | |||
| 669 | c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total; | ||
| 670 | b_mag = powf(1.f - fabsf(x), s->bc_x) * powf((1.f - y) * .5f, s->bc_y) * mag_total; | ||
| 671 | l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total; | ||
| 672 | r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total; | ||
| 673 | ls_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total; | ||
| 674 | rs_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total; | ||
| 675 | |||
| 676 | dstl[2 * n ] = l_mag * cosf(l_phase); | ||
| 677 | dstl[2 * n + 1] = l_mag * sinf(l_phase); | ||
| 678 | |||
| 679 | dstr[2 * n ] = r_mag * cosf(r_phase); | ||
| 680 | dstr[2 * n + 1] = r_mag * sinf(r_phase); | ||
| 681 | |||
| 682 | dstc[2 * n ] = c_mag * cosf(c_phase); | ||
| 683 | dstc[2 * n + 1] = c_mag * sinf(c_phase); | ||
| 684 | |||
| 685 | dstlfe[2 * n ] = lfe_mag * cosf(c_phase); | ||
| 686 | dstlfe[2 * n + 1] = lfe_mag * sinf(c_phase); | ||
| 687 | |||
| 688 | dstls[2 * n ] = ls_mag * cosf(l_phase); | ||
| 689 | dstls[2 * n + 1] = ls_mag * sinf(l_phase); | ||
| 690 | |||
| 691 | dstrs[2 * n ] = rs_mag * cosf(r_phase); | ||
| 692 | dstrs[2 * n + 1] = rs_mag * sinf(r_phase); | ||
| 693 | |||
| 694 | dstb[2 * n ] = b_mag * cosf(c_phase); | ||
| 695 | dstb[2 * n + 1] = b_mag * sinf(c_phase); | ||
| 696 | } | ||
| 697 | |||
| 604 | static void upmix_5_1_back_surround(AVFilterContext *ctx, | 698 | static void upmix_5_1_back_surround(AVFilterContext *ctx, |
| 605 | float l_phase, | 699 | float l_phase, |
| 606 | float r_phase, | 700 | float r_phase, |
| @@ -1246,6 +1340,12 @@ static int init(AVFilterContext *ctx) · 639 unmodified lines | |||
| 1246 | case AV_CH_LAYOUT_5POINT1_BACK: | 1340 | case AV_CH_LAYOUT_5POINT1_BACK: |
| 1247 | s->upmix_stereo = upmix_5_1_back; | 1341 | s->upmix_stereo = upmix_5_1_back; |
| 1248 | break; | 1342 | break; |
| 1343 | case AV_CH_LAYOUT_6POINT0: | ||
| 1344 | s->upmix_stereo = upmix_6_0; | ||
| 1345 | break; | ||
| 1346 | case AV_CH_LAYOUT_6POINT1: | ||
| 1347 | s->upmix_stereo = upmix_6_1; | ||
| 1348 | break; | ||
| 1249 | case AV_CH_LAYOUT_7POINT0: | 1349 | case AV_CH_LAYOUT_7POINT0: |
| 1250 | s->upmix_stereo = upmix_7_0; | 1350 | s->upmix_stereo = upmix_7_0; |
| 1251 | break; | 1351 | break; |