Unified · Split
| @@ -387,11 +387,11 @@ static void stereo_position(float a, float p, float *x, float *y) · 386 unmodified lines | ||
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | static inline void get_lfe(int output_lfe, int n, float lowcut, float highcut, |
| 390 | − float *lfe_mag, float *mag_total, int lfe_mode) | |
| 390 | + float *lfe_mag, float c_mag, float *mag_total, int lfe_mode) | |
| 391 | 391 | { |
| 392 | 392 | if (output_lfe && n < highcut) { |
| 393 | 393 | *lfe_mag = n < lowcut ? 1.f : .5f*(1.f+cosf(M_PI*(lowcut-n)/(lowcut-highcut))); |
| 394 | − *lfe_mag *= *mag_total; | |
| 394 | + *lfe_mag *= c_mag; | |
| 395 | 395 | if (lfe_mode) |
| 396 | 396 | *mag_total -= *lfe_mag; |
| 397 | 397 | } else { |
| @@ -440,7 +440,7 @@ static int stereo_upmix(AVFilterContext *ctx, int ch) · 42 unmodified lines | ||
| 440 | 440 | break; |
| 441 | 441 | case AV_CHAN_LOW_FREQUENCY: |
| 442 | 442 | for (int n = 0; n < rdft_size; n++) |
| 443 | − factor[n] = lfe_mag[n]; | |
| 443 | + factor[n] = powf(1.f - fabsf(x[n]), f_x) * powf((1.f - fabs(y[n])), f_y); | |
| 444 | 444 | break; |
| 445 | 445 | case AV_CHAN_BACK_CENTER: |
| 446 | 446 | for (int n = 0; n < rdft_size; n++) |
| @@ -543,7 +543,7 @@ static void upmix_3_1_surround(AVFilterContext *ctx, · 96 unmodified lines | ||
| 543 | 543 | dstc = (float *)s->output->extended_data[2]; |
| 544 | 544 | dstlfe = (float *)s->output->extended_data[3]; |
| 545 | 545 | |
| 546 | − get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &c_mag, s->lfe_mode); | |
| 546 | + get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, c_mag, &mag_total, s->lfe_mode); | |
| 547 | 547 | |
| 548 | 548 | l_mag = powf(.5f * ( x + 1.f), s->f_x[SC_FL]) * powf((y + 1.f) * .5f, s->f_y[SC_FL]) * mag_total; |
| 549 | 549 | r_mag = powf(.5f * (-x + 1.f), s->f_x[SC_FR]) * powf((y + 1.f) * .5f, s->f_y[SC_FR]) * mag_total; |
| @@ -581,7 +581,7 @@ static void upmix_5_1_back_surround(AVFilterContext *ctx, · 31 unmodified lines | ||
| 581 | 581 | dstls = (float *)s->output->extended_data[4]; |
| 582 | 582 | dstrs = (float *)s->output->extended_data[5]; |
| 583 | 583 | |
| 584 | − get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &c_mag, s->lfe_mode); | |
| 584 | + get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, c_mag, &mag_total, s->lfe_mode); | |
| 585 | 585 | |
| 586 | 586 | l_mag = powf(.5f * ( x + 1.f), s->f_x[SC_FL]) * powf((y + 1.f) * .5f, s->f_y[SC_FL]) * mag_total; |
| 587 | 587 | r_mag = powf(.5f * (-x + 1.f), s->f_x[SC_FR]) * powf((y + 1.f) * .5f, s->f_y[SC_FR]) * mag_total; |
| @@ -679,7 +679,7 @@ static void upmix_7_1_5_0_side(AVFilterContext *ctx, · 91 unmodified lines | ||
| 679 | 679 | |
| 680 | 680 | c_phase = atan2f(c_im, c_re); |
| 681 | 681 | |
| 682 | − get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode); | |
| 682 | + get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, hypotf(c_re, c_im), &mag_total, s->lfe_mode); | |
| 683 | 683 | |
| 684 | 684 | fl_mag = powf(.5f * (xl + 1.f), s->f_x[SC_FL]) * powf((yl + 1.f) * .5f, s->f_y[SC_FL]) * mag_totall; |
| 685 | 685 | fr_mag = powf(.5f * (xr + 1.f), s->f_x[SC_FR]) * powf((yr + 1.f) * .5f, s->f_y[SC_FR]) * mag_totalr; |
| @@ -811,7 +811,7 @@ static void filter_stereo(AVFilterContext *ctx) · 125 unmodified lines | ||
| 811 | 811 | stereo_position(mag_dif, phase_dif, &x, &y); |
| 812 | 812 | angle_transform(&x, &y, angle); |
| 813 | 813 | focus_transform(&x, &y, focus); |
| 814 | − get_lfe(output_lfe, n, lowcut, highcut, &lfemag[n], &mag_total, lfe_mode); | |
| 814 | + get_lfe(output_lfe, n, lowcut, highcut, &lfemag[n], c_mag, &mag_total, lfe_mode); | |
| 815 | 815 | |
| 816 | 816 | xpos[n] = x; |
| 817 | 817 | ypos[n] = y; |