[FFmpeg-devel] [PATCH 12/15] lavc/opus: replace pow(10, x) by exp10(x)

Ganesh Ajjanagadde gajjanag at mit.edu
Wed Dec 23 22:11:23 CET 2015


On Wed, Dec 23, 2015 at 12:40 PM, Rostislav Pehlivanov
<atomnuker at gmail.com> wrote:
> On Wed, 2015-12-23 at 10:47 -0800, Ganesh Ajjanagadde wrote:
>> exp10, introduced recently, is superior for the purpose.
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavcodec/opus.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/opus.c b/libavcodec/opus.c
>> index 6b3d3c3..cac9f85 100644
>> --- a/libavcodec/opus.c
>> +++ b/libavcodec/opus.c
>> @@ -27,6 +27,7 @@
>>  #include <stdint.h>
>>
>>  #include "libavutil/error.h"
>> +#include "libavutil/libm.h"
>>
>>  #include "opus.h"
>>  #include "vorbis.h"
>> @@ -333,7 +334,7 @@ av_cold int
>> ff_opus_parse_extradata(AVCodecContext *avctx,
>>
>>      s->gain_i = AV_RL16(extradata + 16);
>>      if (s->gain_i)
>> -        s->gain = pow(10, s->gain_i / (20.0 * 256));
>> +        s->gain = exp10(s->gain_i / (20.0 * 256));
>>
>>      map_type = extradata[18];
>>      if (!map_type) {
>
> Seems trivial, LGTM

Thanks for the review.

Just a cautionary message: sometimes the most trivial looking change
can have unforeseen consequences. For instance, in this case, there
are a few things:
1. Header avutil/libm must be included, and is easily missed since on
GNU/Linux, it will compile fine with/without it.
2. On non GNU/Linux, there are slight accuracy differences before/after.

Basically, just suggesting some things to keep an eye for while reviewing.

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


More information about the ffmpeg-devel mailing list