[FFmpeg-devel] [PATCH] lavfi/af_compensationdelay: replace pow(x, 0.5) by sqrt(x)

Ganesh Ajjanagadde gajjanagadde at gmail.com
Wed Jan 6 04:11:02 CET 2016


On Tue, Jan 5, 2016 at 2:40 AM, Paul B Mahol <onemda at gmail.com> wrote:
> On 1/5/16, Ganesh Ajjanagadde <gajjanagadde at gmail.com> wrote:
>> sqrt is faster, and is sometimes more accurate depending on the libm.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavfilter/af_compensationdelay.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavfilter/af_compensationdelay.c
>> b/libavfilter/af_compensationdelay.c
>> index 33ee7e4..d5a3484 100644
>> --- a/libavfilter/af_compensationdelay.c
>> +++ b/libavfilter/af_compensationdelay.c
>> @@ -57,7 +57,7 @@ AVFILTER_DEFINE_CLASS(compensationdelay);
>>  // The maximum distance for options
>>  #define COMP_DELAY_MAX_DISTANCE            (100.0 * 100.0 + 100.0 * 1.0 +
>> 1.0)
>>  // The actual speed of sound in normal conditions
>> -#define COMP_DELAY_SOUND_SPEED_KM_H(temp)  1.85325 * (643.95 * pow(((temp +
>> 273.15) / 273.15), 0.5))
>> +#define COMP_DELAY_SOUND_SPEED_KM_H(temp)  1.85325 * (643.95 * sqrt(((temp
>> + 273.15) / 273.15)))
>>  #define COMP_DELAY_SOUND_SPEED_CM_S(temp)
>> (COMP_DELAY_SOUND_SPEED_KM_H(temp) * (1000.0 * 100.0) /* cm/km */ / (60.0 *
>> 60.0) /* s/h */)
>>  #define COMP_DELAY_SOUND_FRONT_DELAY(temp) (1.0 /
>> COMP_DELAY_SOUND_SPEED_CM_S(temp))
>>  // The maximum delay may be reached by this filter
>> --
>> 2.6.4
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> ok

pushed, thanks


More information about the ffmpeg-devel mailing list