[FFmpeg-devel] [PATCHv3 1/2] lavc/aacenc_utils: replace powf(x, y) by expf(logf(x), y)

Michael Niedermayer michael at niedermayer.cc
Thu Mar 17 03:14:56 CET 2016


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

[...]
-- 
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 ..."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160317/c3e01567/attachment.sig>


More information about the ffmpeg-devel mailing list