You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
avfilter/af_afftdn: add gain_smooth option
This commit is contained in:
@@ -1390,6 +1390,12 @@ Stop sample noise capture and measure new noise band profile.
|
|||||||
|
|
||||||
Default value is @code{none}.
|
Default value is @code{none}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@item gain_smooth, gs
|
||||||
|
Set gain smooth factor, used to lowpass gains applied to each frequency bin.
|
||||||
|
Useful to reduce random music noise artefacts.
|
||||||
|
Higher values reduce smoothing of gains.
|
||||||
|
Default value is @code{1.0}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@subsection Commands
|
@subsection Commands
|
||||||
|
@@ -114,6 +114,7 @@ typedef struct AudioFFTDeNoiseContext {
|
|||||||
int output_mode;
|
int output_mode;
|
||||||
int noise_floor_link;
|
int noise_floor_link;
|
||||||
float ratio;
|
float ratio;
|
||||||
|
float gain_smooth;
|
||||||
float band_multiplier;
|
float band_multiplier;
|
||||||
float floor_offset;
|
float floor_offset;
|
||||||
|
|
||||||
@@ -207,6 +208,8 @@ static const AVOption afftdn_options[] = {
|
|||||||
{ "begin", "start", 0, AV_OPT_TYPE_CONST, {.i64 = SAMPLE_START}, 0, 0, AFR, "sample" },
|
{ "begin", "start", 0, AV_OPT_TYPE_CONST, {.i64 = SAMPLE_START}, 0, 0, AFR, "sample" },
|
||||||
{ "stop", "stop", 0, AV_OPT_TYPE_CONST, {.i64 = SAMPLE_STOP}, 0, 0, AFR, "sample" },
|
{ "stop", "stop", 0, AV_OPT_TYPE_CONST, {.i64 = SAMPLE_STOP}, 0, 0, AFR, "sample" },
|
||||||
{ "end", "stop", 0, AV_OPT_TYPE_CONST, {.i64 = SAMPLE_STOP}, 0, 0, AFR, "sample" },
|
{ "end", "stop", 0, AV_OPT_TYPE_CONST, {.i64 = SAMPLE_STOP}, 0, 0, AFR, "sample" },
|
||||||
|
{ "gain_smooth", "set gain smooth factor",OFFSET(gain_smooth), AV_OPT_TYPE_FLOAT, {.dbl = 1.00}, 0.0001, 1, AFR },
|
||||||
|
{ "gs", "set gain smooth factor",OFFSET(gain_smooth), AV_OPT_TYPE_FLOAT, {.dbl = 1.00}, 0.0001, 1, AFR },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -421,6 +424,14 @@ static void process_frame(AVFilterContext *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const double f = s->gain_smooth;
|
||||||
|
const double F = 1. - f;
|
||||||
|
|
||||||
|
for (int i = 1; i < s->bin_count; i++)
|
||||||
|
gain[i] = gain[i-1] * F + f * gain[i];
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < s->bin_count; i++) {
|
for (int i = 0; i < s->bin_count; i++) {
|
||||||
const double new_gain = gain[i];
|
const double new_gain = gain[i];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user