[FFmpeg-devel] [PATCH 03/15] lavfi/f_ebur128: replace pow(10, x) by exp10(x)

Ganesh Ajjanagadde gajjanag at mit.edu
Wed Dec 23 20:15:01 CET 2015


On Wed, Dec 23, 2015 at 11:08 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> Hi,
>
> On Wed, Dec 23, 2015 at 2:00 PM, Ganesh Ajjanagadde <gajjanag at mit.edu>
> wrote:
>
>> On Wed, Dec 23, 2015 at 10:54 AM, Clément Bœsch <u at pkh.me> wrote:
>> > On Wed, Dec 23, 2015 at 10:47:23AM -0800, Ganesh Ajjanagadde wrote:
>> >> exp10, recently introduced, is superior for the purpose.
>> >>
>> >> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> >> ---
>> >>  libavfilter/f_ebur128.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
>> >> index b9577c5..6749bcd 100644
>> >> --- a/libavfilter/f_ebur128.c
>> >> +++ b/libavfilter/f_ebur128.c
>> >> @@ -435,7 +435,7 @@ static int config_audio_output(AVFilterLink
>> *outlink)
>> >>      return 0;
>> >>  }
>> >>
>> >> -#define ENERGY(loudness) (pow(10, ((loudness) + 0.691) / 10.))
>> >> +#define ENERGY(loudness) (exp10(((loudness) + 0.691) / 10.))
>> >>  #define LOUDNESS(energy) (-0.691 + 10 * log10(energy))
>> >>  #define DBFS(energy) (20 * log10(energy))
>> >
>> > OK if FATE is happy
>>
>> FATE is happy on GNU/Linux, where exp10 is correctly rounded. Can't
>> speak for the fallback; it was a risk that I explained in detail. Now
>> that I see its use, I am myself leaning towards a pow(10,x) fallback
>> instead of the exp2 based one.
>
>
> That's because your refactoring origin is biased. If you had started from
> libavcodec/acelp_pitch_delay.c:135 (the only place I could find where we
> use exp2 but where we should use exp10), you'd say the opposite.

ha ha, my bias comes from my pickiness about numerical issues.

>
> (I think the current fallback is fine.)

Ok.

>
> Ronald
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list