You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/af_dynaudnorm: remove wasteful pow
This removes wasteful pow(x, 2.0) that although not terribly important for speed, is still useless. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
This commit is contained in:
@@ -237,13 +237,13 @@ static void init_gaussian_filter(DynamicAudioNormalizerContext *s)
|
|||||||
// Pre-compute constants
|
// Pre-compute constants
|
||||||
const int offset = s->filter_size / 2;
|
const int offset = s->filter_size / 2;
|
||||||
const double c1 = 1.0 / (sigma * sqrt(2.0 * M_PI));
|
const double c1 = 1.0 / (sigma * sqrt(2.0 * M_PI));
|
||||||
const double c2 = 2.0 * pow(sigma, 2.0);
|
const double c2 = 2.0 * sigma * sigma;
|
||||||
|
|
||||||
// Compute weights
|
// Compute weights
|
||||||
for (i = 0; i < s->filter_size; i++) {
|
for (i = 0; i < s->filter_size; i++) {
|
||||||
const int x = i - offset;
|
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];
|
total_weight += s->weights[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user