]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_sidechaincompress.c
Merge commit 'c3e5c47bdae2bb8219fea62d91b7455650b22c60'
[ffmpeg] / libavfilter / af_sidechaincompress.c
index e45fd720d7c47b767800e0169dfbd1712fe7767d..b8a81fc0bbd73762c44f4f6f621474adc540994d 100644 (file)
@@ -32,6 +32,7 @@
 #include "audio.h"
 #include "avfilter.h"
 #include "formats.h"
+#include "hermite.h"
 #include "internal.h"
 
 typedef struct SidechainCompressContext {
@@ -90,29 +91,6 @@ static av_cold int init(AVFilterContext *ctx)
     return 0;
 }
 
-static inline float hermite_interpolation(float x, float x0, float x1,
-                                          float p0, float p1,
-                                          float m0, float m1)
-{
-    float width = x1 - x0;
-    float t = (x - x0) / width;
-    float t2, t3;
-    float ct0, ct1, ct2, ct3;
-
-    m0 *= width;
-    m1 *= width;
-
-    t2 = t*t;
-    t3 = t2*t;
-    ct0 = p0;
-    ct1 = m0;
-
-    ct2 = -3 * p0 - 2 * m0 + 3 * p1 - m1;
-    ct3 = 2 * p0 + m0  - 2 * p1 + m1;
-
-    return ct3 * t3 + ct2 * t2 + ct1 * t + ct0;
-}
-
 // A fake infinity value (because real infinity may break some hosts)
 #define FAKE_INFINITY (65536.0 * 65536.0)
 
@@ -294,8 +272,8 @@ static int config_output(AVFilterLink *outlink)
     outlink->channel_layout = ctx->inputs[0]->channel_layout;
     outlink->channels = ctx->inputs[0]->channels;
 
-    s->attack_coeff = FFMIN(1.f, 1.f / (s->attack * outlink->sample_rate / 4000.f));
-    s->release_coeff = FFMIN(1.f, 1.f / (s->release * outlink->sample_rate / 4000.f));
+    s->attack_coeff = FFMIN(1., 1. / (s->attack * outlink->sample_rate / 4000.));
+    s->release_coeff = FFMIN(1., 1. / (s->release * outlink->sample_rate / 4000.));
 
     return 0;
 }