]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/af_dynaudnorm.c
avfilter/af_compand: do not clip; allow >0dB curve points
[ffmpeg] / libavfilter / af_dynaudnorm.c
index 8f0c2d0858ddcbc7d475292ed55f3cfaa404074c..5f412f5d9170688a063aa81c3b0a36ef7bb9f6c7 100644 (file)
@@ -227,8 +227,6 @@ static int cqueue_pop(cqueue *q)
     return 0;
 }
 
-static const double s_pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
-
 static void init_gaussian_filter(DynamicAudioNormalizerContext *s)
 {
     double total_weight = 0.0;
@@ -238,14 +236,14 @@ static void init_gaussian_filter(DynamicAudioNormalizerContext *s)
 
     // Pre-compute constants
     const int offset = s->filter_size / 2;
-    const double c1 = 1.0 / (sigma * sqrt(2.0 * s_pi));
-    const double c2 = 2.0 * pow(sigma, 2.0);
+    const double c1 = 1.0 / (sigma * sqrt(2.0 * M_PI));
+    const double c2 = 2.0 * sigma * sigma;
 
     // Compute weights
     for (i = 0; i < s->filter_size; i++) {
         const int x = i - offset;
 
-        s->weights[i] = c1 * exp(-(pow(x, 2.0) / c2));
+        s->weights[i] = c1 * exp(-x * x / c2);
         total_weight += s->weights[i];
     }