[FFmpeg-devel] [PATCHv3 1/2] lavc/aacenc_utils: replace powf(x, y) by expf(logf(x), y)
Ganesh Ajjanagadde
gajjanag at gmail.com
Fri Mar 18 15:55:10 CET 2016
On Wed, Mar 16, 2016 at 7:14 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Mon, Mar 14, 2016 at 10:04:59PM -0400, Ganesh Ajjanagadde wrote:
>> This is ~2x faster for y not an integer on Haswell+GCC, and should
>> generally be faster due to the fact that anyway powf essentially does
>> this under the hood. Made an inline function in lavu/internal.h for this
>> purpose.
>>
>> Note that there are some accuracy differences, that should generally be
>> negligible. In particular, FATE still passes on this platform.
>>
>> Results in ~ 7% speedup in aac encoding with -march=native, Haswell+GCC.
>> before:
>> ffmpeg -i sin.flac -acodec aac -y sin_new.aac 6.05s user 0.06s system 104% cpu 5.821 total
>>
>> after:
>> ffmpeg -i sin.flac -acodec aac -y sin_new.aac 5.67s user 0.03s system 105% cpu 5.416 total
>>
>> This is also faster than an alternative approach that pulls in powf, gets rid of
>> the crufty NaN checks and other special cases, exploits knowledge about the intervals, etc.
>> This of course does not exclude smarter approaches; just suggests that
>> there would need to be significant work on this front of lower utility than
>> searches for hotspots elsewhere.
>>
>> Reviewed-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
>> Reviewed-by: Ronald S. Bultje <rsbultje at gmail.com>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanag at gmail.com>
>> ---
>> libavcodec/aacenc_utils.h | 6 +++++-
>> libavutil/internal.h | 16 ++++++++++++++++
>> 2 files changed, 21 insertions(+), 1 deletion(-)
>
> Tested on mingw-wine, linux x86_64 & x86_32 and mips qemu
pushed, thanks
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> The real ebay dictionary, page 1
> "Used only once" - "Some unspecified defect prevented a second use"
> "In good condition" - "Can be repaird by experienced expert"
> "As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list