mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
avfilter/af_surround: make channel spread from stereo image user configurable
This commit is contained in:
parent
dbb35abf28
commit
26fd40b568
@ -4889,6 +4889,18 @@ Set LFE input volume. By default, this is @var{1}.
|
||||
@item lfe_out
|
||||
Set LFE output volume. By default, this is @var{1}.
|
||||
|
||||
@item allx
|
||||
Set spread usage of stereo image across X axis for all channels.
|
||||
|
||||
@item ally
|
||||
Set spread usage of stereo image across Y axis for all channels.
|
||||
|
||||
@item fcx, flx, frx, blx, brx, slx, srx, bcx
|
||||
Set spread usage of stereo image across X axis for each channel.
|
||||
|
||||
@item fcy, fly, fry, bly, bry, sly, sry, bcy
|
||||
Set spread usage of stereo image across Y axis for each channel.
|
||||
|
||||
@item win_func
|
||||
Set window function.
|
||||
|
||||
|
@ -43,6 +43,27 @@ typedef struct AudioSurroundContext {
|
||||
int win_func;
|
||||
float overlap;
|
||||
|
||||
float all_x;
|
||||
float all_y;
|
||||
|
||||
float fc_x;
|
||||
float fl_x;
|
||||
float fr_x;
|
||||
float bl_x;
|
||||
float br_x;
|
||||
float sl_x;
|
||||
float sr_x;
|
||||
float bc_x;
|
||||
|
||||
float fc_y;
|
||||
float fl_y;
|
||||
float fr_y;
|
||||
float bl_y;
|
||||
float br_y;
|
||||
float sl_y;
|
||||
float sr_y;
|
||||
float bc_y;
|
||||
|
||||
float *input_levels;
|
||||
float *output_levels;
|
||||
int output_lfe;
|
||||
@ -263,7 +284,7 @@ static void upmix_1_0(AVFilterContext *ctx,
|
||||
|
||||
dst = (float *)s->output->extended_data[0];
|
||||
|
||||
mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
|
||||
dst[2 * n ] = mag * cosf(c_phase);
|
||||
dst[2 * n + 1] = mag * sinf(c_phase);
|
||||
@ -283,8 +304,8 @@ static void upmix_stereo(AVFilterContext *ctx,
|
||||
dstl = (float *)s->output->extended_data[0];
|
||||
dstr = (float *)s->output->extended_data[1];
|
||||
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -310,8 +331,8 @@ static void upmix_2_1(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode);
|
||||
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -338,9 +359,9 @@ static void upmix_3_0(AVFilterContext *ctx,
|
||||
dstr = (float *)s->output->extended_data[1];
|
||||
dstc = (float *)s->output->extended_data[2];
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -370,9 +391,9 @@ static void upmix_3_1(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode);
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -406,8 +427,8 @@ static void upmix_3_1_surround(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &c_mag, s->lfe_mode);
|
||||
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -430,18 +451,18 @@ static void upmix_4_0(AVFilterContext *ctx,
|
||||
float x, float y,
|
||||
int n)
|
||||
{
|
||||
float b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb;
|
||||
AudioSurroundContext *s = ctx->priv;
|
||||
float b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb;
|
||||
|
||||
dstl = (float *)s->output->extended_data[0];
|
||||
dstr = (float *)s->output->extended_data[1];
|
||||
dstc = (float *)s->output->extended_data[2];
|
||||
dstb = (float *)s->output->extended_data[3];
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
b_mag = sqrtf(1.f - fabsf(x)) * ((1.f - y) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
b_mag = powf(1.f - fabsf(x), s->bc_x) * powf((1.f - y) * .5f, s->bc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -464,8 +485,8 @@ static void upmix_4_1(AVFilterContext *ctx,
|
||||
float x, float y,
|
||||
int n)
|
||||
{
|
||||
float lfe_mag, b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb, *dstlfe;
|
||||
AudioSurroundContext *s = ctx->priv;
|
||||
float lfe_mag, b_mag, l_mag, r_mag, c_mag, *dstc, *dstl, *dstr, *dstb, *dstlfe;
|
||||
|
||||
dstl = (float *)s->output->extended_data[0];
|
||||
dstr = (float *)s->output->extended_data[1];
|
||||
@ -478,10 +499,10 @@ static void upmix_4_1(AVFilterContext *ctx,
|
||||
dstlfe[2 * n ] = lfe_mag * cosf(c_phase);
|
||||
dstlfe[2 * n + 1] = lfe_mag * sinf(c_phase);
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
b_mag = sqrtf(1.f - fabsf(x)) * ((1.f - y) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
b_mag = powf(1.f - fabsf(x), s->bc_x) * powf((1.f - y) * .5f, s->bc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -504,8 +525,8 @@ static void upmix_5_0_back(AVFilterContext *ctx,
|
||||
float x, float y,
|
||||
int n)
|
||||
{
|
||||
float l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs;
|
||||
AudioSurroundContext *s = ctx->priv;
|
||||
float l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs;
|
||||
|
||||
dstl = (float *)s->output->extended_data[0];
|
||||
dstr = (float *)s->output->extended_data[1];
|
||||
@ -513,11 +534,11 @@ static void upmix_5_0_back(AVFilterContext *ctx,
|
||||
dstls = (float *)s->output->extended_data[3];
|
||||
dstrs = (float *)s->output->extended_data[4];
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
ls_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total;
|
||||
rs_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -543,8 +564,8 @@ static void upmix_5_1_back(AVFilterContext *ctx,
|
||||
float x, float y,
|
||||
int n)
|
||||
{
|
||||
float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
|
||||
AudioSurroundContext *s = ctx->priv;
|
||||
float lfe_mag, l_mag, r_mag, ls_mag, rs_mag, c_mag, *dstc, *dstl, *dstr, *dstls, *dstrs, *dstlfe;
|
||||
|
||||
dstl = (float *)s->output->extended_data[0];
|
||||
dstr = (float *)s->output->extended_data[1];
|
||||
@ -555,11 +576,11 @@ static void upmix_5_1_back(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode);
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
ls_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total;
|
||||
rs_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -602,10 +623,10 @@ static void upmix_5_1_back_surround(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &c_mag, s->lfe_mode);
|
||||
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
ls_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total;
|
||||
rs_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -647,11 +668,11 @@ static void upmix_5_1_back_2_1(AVFilterContext *ctx,
|
||||
dstls = (float *)s->output->extended_data[4];
|
||||
dstrs = (float *)s->output->extended_data[5];
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
ls_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total;
|
||||
rs_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -692,13 +713,13 @@ static void upmix_7_0(AVFilterContext *ctx,
|
||||
dstls = (float *)s->output->extended_data[5];
|
||||
dstrs = (float *)s->output->extended_data[6];
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
lb_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
rb_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - fabsf(y)) * mag_total;
|
||||
rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - fabsf(y)) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
lb_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total;
|
||||
rb_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total;
|
||||
ls_mag = powf(.5f * ( x + 1.f), s->sl_x) * powf(1.f - fabsf(y), s->sl_y) * mag_total;
|
||||
rs_mag = powf(.5f * (-x + 1.f), s->sr_x) * powf(1.f - fabsf(y), s->sr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -745,13 +766,13 @@ static void upmix_7_1(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode);
|
||||
|
||||
c_mag = sqrtf(1.f - fabsf(x)) * ((y + 1.f) * .5f) * mag_total;
|
||||
l_mag = sqrtf(.5f * ( x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
r_mag = sqrtf(.5f * (-x + 1.f)) * ((y + 1.f) * .5f) * mag_total;
|
||||
lb_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
rb_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - ((y + 1.f) * .5f)) * mag_total;
|
||||
ls_mag = sqrtf(.5f * ( x + 1.f)) * (1.f - fabsf(y)) * mag_total;
|
||||
rs_mag = sqrtf(.5f * (-x + 1.f)) * (1.f - fabsf(y)) * mag_total;
|
||||
c_mag = powf(1.f - fabsf(x), s->fc_x) * powf((y + 1.f) * .5f, s->fc_y) * mag_total;
|
||||
l_mag = powf(.5f * ( x + 1.f), s->fl_x) * powf((y + 1.f) * .5f, s->fl_y) * mag_total;
|
||||
r_mag = powf(.5f * (-x + 1.f), s->fr_x) * powf((y + 1.f) * .5f, s->fr_y) * mag_total;
|
||||
lb_mag = powf(.5f * ( x + 1.f), s->bl_x) * powf(1.f - ((y + 1.f) * .5f), s->bl_y) * mag_total;
|
||||
rb_mag = powf(.5f * (-x + 1.f), s->br_x) * powf(1.f - ((y + 1.f) * .5f), s->br_y) * mag_total;
|
||||
ls_mag = powf(.5f * ( x + 1.f), s->sl_x) * powf(1.f - fabsf(y), s->sl_y) * mag_total;
|
||||
rs_mag = powf(.5f * (-x + 1.f), s->sr_x) * powf(1.f - fabsf(y), s->sr_y) * mag_total;
|
||||
|
||||
dstl[2 * n ] = l_mag * cosf(l_phase);
|
||||
dstl[2 * n + 1] = l_mag * sinf(l_phase);
|
||||
@ -806,12 +827,12 @@ static void upmix_7_1_5_0_side(AVFilterContext *ctx,
|
||||
|
||||
get_lfe(s->output_lfe, n, s->lowcut, s->highcut, &lfe_mag, &mag_total, s->lfe_mode);
|
||||
|
||||
fl_mag = sqrtf(.5f * (xl + 1.f)) * ((yl + 1.f) * .5f) * mag_totall;
|
||||
fr_mag = sqrtf(.5f * (xr + 1.f)) * ((yr + 1.f) * .5f) * mag_totalr;
|
||||
lb_mag = sqrtf(.5f * (-xl + 1.f)) * ((yl + 1.f) * .5f) * mag_totall;
|
||||
rb_mag = sqrtf(.5f * (-xr + 1.f)) * ((yr + 1.f) * .5f) * mag_totalr;
|
||||
ls_mag = sqrtf(1.f - fabsf(xl)) * ((yl + 1.f) * .5f) * mag_totall;
|
||||
rs_mag = sqrtf(1.f - fabsf(xr)) * ((yr + 1.f) * .5f) * mag_totalr;
|
||||
fl_mag = powf(.5f * (xl + 1.f), s->fl_x) * powf((yl + 1.f) * .5f, s->fl_y) * mag_totall;
|
||||
fr_mag = powf(.5f * (xr + 1.f), s->fr_x) * powf((yr + 1.f) * .5f, s->fr_y) * mag_totalr;
|
||||
lb_mag = powf(.5f * (-xl + 1.f), s->bl_x) * powf((yl + 1.f) * .5f, s->bl_y) * mag_totall;
|
||||
rb_mag = powf(.5f * (-xr + 1.f), s->br_x) * powf((yr + 1.f) * .5f, s->br_y) * mag_totalr;
|
||||
ls_mag = powf(1.f - fabsf(xl), s->sl_x) * powf((yl + 1.f) * .5f, s->sl_y) * mag_totall;
|
||||
rs_mag = powf(1.f - fabsf(xr), s->sr_x) * powf((yr + 1.f) * .5f, s->sr_y) * mag_totalr;
|
||||
|
||||
dstl[2 * n ] = fl_mag * cosf(fl_phase);
|
||||
dstl[2 * n + 1] = fl_mag * sinf(fl_phase);
|
||||
@ -862,12 +883,12 @@ static void upmix_7_1_5_1(AVFilterContext *ctx,
|
||||
dstls = (float *)s->output->extended_data[6];
|
||||
dstrs = (float *)s->output->extended_data[7];
|
||||
|
||||
fl_mag = sqrtf(.5f * (xl + 1.f)) * ((yl + 1.f) * .5f) * mag_totall;
|
||||
fr_mag = sqrtf(.5f * (xr + 1.f)) * ((yr + 1.f) * .5f) * mag_totalr;
|
||||
lb_mag = sqrtf(.5f * (-xl + 1.f)) * ((yl + 1.f) * .5f) * mag_totall;
|
||||
rb_mag = sqrtf(.5f * (-xr + 1.f)) * ((yr + 1.f) * .5f) * mag_totalr;
|
||||
ls_mag = sqrtf(1.f - fabsf(xl)) * ((yl + 1.f) * .5f) * mag_totall;
|
||||
rs_mag = sqrtf(1.f - fabsf(xr)) * ((yr + 1.f) * .5f) * mag_totalr;
|
||||
fl_mag = powf(.5f * (xl + 1.f), s->fl_x) * powf((yl + 1.f) * .5f, s->fl_y) * mag_totall;
|
||||
fr_mag = powf(.5f * (xr + 1.f), s->fr_x) * powf((yr + 1.f) * .5f, s->fr_y) * mag_totalr;
|
||||
lb_mag = powf(.5f * (-xl + 1.f), s->bl_x) * powf((yl + 1.f) * .5f, s->bl_y) * mag_totall;
|
||||
rb_mag = powf(.5f * (-xr + 1.f), s->br_x) * powf((yr + 1.f) * .5f, s->br_y) * mag_totalr;
|
||||
ls_mag = powf(1.f - fabsf(xl), s->sl_x) * powf((yl + 1.f) * .5f, s->sl_y) * mag_totall;
|
||||
rs_mag = powf(1.f - fabsf(xr), s->sl_x) * powf((yr + 1.f) * .5f, s->sr_y) * mag_totalr;
|
||||
|
||||
dstl[2 * n ] = fl_mag * cosf(fl_phase);
|
||||
dstl[2 * n + 1] = fl_mag * sinf(fl_phase);
|
||||
@ -1312,6 +1333,11 @@ fail:
|
||||
if (s->hop_size <= 0)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
if (s->all_x >= 0.f)
|
||||
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;
|
||||
if (s->all_y >= 0.f)
|
||||
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;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1471,6 +1497,24 @@ static const AVOption surround_options[] = {
|
||||
{ "fc_out", "set front center channel output level", OFFSET(fc_out), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
|
||||
{ "lfe_in", "set lfe channel input level", OFFSET(lfe_in), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
|
||||
{ "lfe_out", "set lfe channel output level", OFFSET(lfe_out), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 10, FLAGS },
|
||||
{ "allx", "set all channel's x spread", OFFSET(all_x), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 15, FLAGS },
|
||||
{ "ally", "set all channel's y spread", OFFSET(all_y), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 15, FLAGS },
|
||||
{ "fcx", "set front center channel x spread", OFFSET(fc_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "flx", "set front left channel x spread", OFFSET(fl_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "frx", "set front right channel x spread", OFFSET(fr_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "blx", "set back left channel x spread", OFFSET(bl_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "brx", "set back right channel x spread", OFFSET(br_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "slx", "set side left channel x spread", OFFSET(sl_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "srx", "set side right channel x spread", OFFSET(sr_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "bcx", "set back center channel x spread", OFFSET(bc_x), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "fcy", "set front center channel y spread", OFFSET(fc_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "fly", "set front left channel y spread", OFFSET(fl_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "fry", "set front right channel y spread", OFFSET(fr_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "bly", "set back left channel y spread", OFFSET(bl_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "bry", "set back right channel y spread", OFFSET(br_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "sly", "set side left channel y spread", OFFSET(sl_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "sry", "set side right channel y spread", OFFSET(sr_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "bcy", "set back center channel y spread", OFFSET(bc_y), AV_OPT_TYPE_FLOAT, {.dbl=1}, 0, 15, FLAGS },
|
||||
{ "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64 = WFUNC_HANNING}, 0, NB_WFUNC-1, FLAGS, "win_func" },
|
||||
{ "rect", "Rectangular", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_RECT}, 0, 0, FLAGS, "win_func" },
|
||||
{ "bartlett", "Bartlett", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BARTLETT}, 0, 0, FLAGS, "win_func" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user