X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Faf_dynaudnorm.c;h=5f412f5d9170688a063aa81c3b0a36ef7bb9f6c7;hb=b2517b02d99054b18398427ba890fee582a8c7bf;hp=8f0c2d0858ddcbc7d475292ed55f3cfaa404074c;hpb=3df9ec5ce7bc57ee303e715b949f65727a52c916;p=ffmpeg diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c index 8f0c2d0858d..5f412f5d917 100644 --- a/libavfilter/af_dynaudnorm.c +++ b/libavfilter/af_dynaudnorm.c @@ -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]; }