aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-12-03 10:05:21 +0100
committerPaul B Mahol <onemda@gmail.com>2015-12-03 11:07:52 +0100
commit4a43e559e1b31072b384eb96fc0a8533f2b849ac (patch)
tree337d4e403a944375dff94af44f70b4a19120a590
parent1b22bdf4e3506f889025044d02b9505988a8507a (diff)
downloadffmpeg-4a43e559e1b31072b384eb96fc0a8533f2b849ac.tar.gz
avfilter/af_sidechaincompress: kill init function
Should make addition of process_command easier. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavfilter/af_sidechaincompress.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/libavfilter/af_sidechaincompress.c b/libavfilter/af_sidechaincompress.c
index 717ddcfb56..dac4605d0c 100644
--- a/libavfilter/af_sidechaincompress.c
+++ b/libavfilter/af_sidechaincompress.c
@@ -86,20 +86,6 @@ static const AVOption options[] = {
#define sidechaincompress_options options
AVFILTER_DEFINE_CLASS(sidechaincompress);
-static av_cold int init(AVFilterContext *ctx)
-{
- SidechainCompressContext *s = ctx->priv;
-
- s->thres = log(s->threshold);
- s->lin_knee_start = s->threshold / sqrt(s->knee);
- s->adj_knee_start = s->lin_knee_start * s->lin_knee_start;
- s->knee_start = log(s->lin_knee_start);
- s->knee_stop = log(s->threshold * sqrt(s->knee));
- s->compressed_knee_stop = (s->knee_stop - s->thres) / s->ratio + s->thres;
-
- return 0;
-}
-
// A fake infinity value (because real infinity may break some hosts)
#define FAKE_INFINITY (65536.0 * 65536.0)
@@ -138,6 +124,13 @@ static int compressor_config_output(AVFilterLink *outlink)
AVFilterContext *ctx = outlink->src;
SidechainCompressContext *s = ctx->priv;
+ s->thres = log(s->threshold);
+ s->lin_knee_start = s->threshold / sqrt(s->knee);
+ s->adj_knee_start = s->lin_knee_start * s->lin_knee_start;
+ s->knee_start = log(s->lin_knee_start);
+ s->knee_stop = log(s->threshold * sqrt(s->knee));
+ s->compressed_knee_stop = (s->knee_stop - s->thres) / s->ratio + s->thres;
+
s->attack_coeff = FFMIN(1., 1. / (s->attack * outlink->sample_rate / 4000.));
s->release_coeff = FFMIN(1., 1. / (s->release * outlink->sample_rate / 4000.));
@@ -333,7 +326,6 @@ AVFilter ff_af_sidechaincompress = {
.description = NULL_IF_CONFIG_SMALL("Sidechain compressor."),
.priv_size = sizeof(SidechainCompressContext),
.priv_class = &sidechaincompress_class,
- .init = init,
.query_formats = query_formats,
.inputs = sidechaincompress_inputs,
.outputs = sidechaincompress_outputs,
@@ -427,7 +419,6 @@ AVFilter ff_af_acompressor = {
.description = NULL_IF_CONFIG_SMALL("Audio compressor."),
.priv_size = sizeof(SidechainCompressContext),
.priv_class = &acompressor_class,
- .init = init,
.query_formats = acompressor_query_formats,
.inputs = acompressor_inputs,
.outputs = acompressor_outputs,