Browse code

avfilter/af_sidechaincompress: kill init function

Should make addition of process_command easier.

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2015/12/03 18:05:21
Showing 1 changed files
... ...
@@ -86,20 +86,6 @@ static const AVOption options[] = {
86 86
 #define sidechaincompress_options options
87 87
 AVFILTER_DEFINE_CLASS(sidechaincompress);
88 88
 
89
-static av_cold int init(AVFilterContext *ctx)
90
-{
91
-    SidechainCompressContext *s = ctx->priv;
92
-
93
-    s->thres = log(s->threshold);
94
-    s->lin_knee_start = s->threshold / sqrt(s->knee);
95
-    s->adj_knee_start = s->lin_knee_start * s->lin_knee_start;
96
-    s->knee_start = log(s->lin_knee_start);
97
-    s->knee_stop = log(s->threshold * sqrt(s->knee));
98
-    s->compressed_knee_stop = (s->knee_stop - s->thres) / s->ratio + s->thres;
99
-
100
-    return 0;
101
-}
102
-
103 89
 // A fake infinity value (because real infinity may break some hosts)
104 90
 #define FAKE_INFINITY (65536.0 * 65536.0)
105 91
 
... ...
@@ -138,6 +124,13 @@ static int compressor_config_output(AVFilterLink *outlink)
138 138
     AVFilterContext *ctx = outlink->src;
139 139
     SidechainCompressContext *s = ctx->priv;
140 140
 
141
+    s->thres = log(s->threshold);
142
+    s->lin_knee_start = s->threshold / sqrt(s->knee);
143
+    s->adj_knee_start = s->lin_knee_start * s->lin_knee_start;
144
+    s->knee_start = log(s->lin_knee_start);
145
+    s->knee_stop = log(s->threshold * sqrt(s->knee));
146
+    s->compressed_knee_stop = (s->knee_stop - s->thres) / s->ratio + s->thres;
147
+
141 148
     s->attack_coeff = FFMIN(1., 1. / (s->attack * outlink->sample_rate / 4000.));
142 149
     s->release_coeff = FFMIN(1., 1. / (s->release * outlink->sample_rate / 4000.));
143 150
 
... ...
@@ -333,7 +326,6 @@ AVFilter ff_af_sidechaincompress = {
333 333
     .description    = NULL_IF_CONFIG_SMALL("Sidechain compressor."),
334 334
     .priv_size      = sizeof(SidechainCompressContext),
335 335
     .priv_class     = &sidechaincompress_class,
336
-    .init           = init,
337 336
     .query_formats  = query_formats,
338 337
     .inputs         = sidechaincompress_inputs,
339 338
     .outputs        = sidechaincompress_outputs,
... ...
@@ -427,7 +419,6 @@ AVFilter ff_af_acompressor = {
427 427
     .description    = NULL_IF_CONFIG_SMALL("Audio compressor."),
428 428
     .priv_size      = sizeof(SidechainCompressContext),
429 429
     .priv_class     = &acompressor_class,
430
-    .init           = init,
431 430
     .query_formats  = acompressor_query_formats,
432 431
     .inputs         = acompressor_inputs,
433 432
     .outputs        = acompressor_outputs,