[FFmpeg-devel] [PATCH] all: use M_SQRT1_2, M_SQRT2, M_PI

James Darnley james.darnley at gmail.com
Thu Nov 19 16:53:22 CET 2015


On 2015-11-19 13:52, Ganesh Ajjanagadde wrote:
> diff --git a/libavfilter/af_dynaudnorm.c b/libavfilter/af_dynaudnorm.c
>> index 8f0c2d0..62a2653 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,7 +236,7 @@ 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 c1 = 1.0 / (sigma * sqrt(2.0 * M_PI));
>>      const double c2 = 2.0 * pow(sigma, 2.0);
>>

Paul asked you to drop this.  I didn't see whether he replied that time
but when I asked why he didn't use M_PI when he first created the
filter, I got this reply.

>>> +static const double s_pi =
>>> 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679;
>>
>> Why not use the standard M_PI define?
> 
> Its too short. And I try hard to produce exact same output as
> reference implementation as possible, even if doubles are used.
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151119/18bbb54d/attachment.sig>


More information about the ffmpeg-devel mailing list