• Ganesh Ajjanagadde's avatar
    lavc/aacenc_utils: replace sqrtf(Q*sqrtf(Q)) by precomputed value · bd9c5875
    Ganesh Ajjanagadde authored
    It makes no sense whatsoever to do this at each function call; we
    already have a table for this.
    
    Yields a 2x improvement in find_min_book (x86-64, Haswell+GCC):
    ffmpeg -i sin.flac -acodec aac -y sin.aac
    find_min_book
    old
        605 decicycles in find_min_book, 8388453 runs,    155 skips.9x
        606 decicycles in find_min_book,16776912 runs,    304 skips.9x
        607 decicycles in find_min_book,33553819 runs,    613 skips.2x
        607 decicycles in find_min_book,67107668 runs,   1196 skips.3x
        607 decicycles in find_min_book,134215360 runs,   2368 skips3x
    
    new
        359 decicycles in find_min_book, 8388552 runs,     56 skips.3x
        360 decicycles in find_min_book,16777112 runs,    104 skips.1x
        361 decicycles in find_min_book,33554218 runs,    214 skips.4x
        361 decicycles in find_min_book,67108381 runs,    483 skips.5x
        361 decicycles in find_min_book,134216725 runs,   1003 skips5x
    
    and more importantly a non-negligible speedup (~ 8%) to overall AAC encoding:
    old:
    ffmpeg -i sin.flac -acodec aac -strict -2 -y sin_new.aac  6.82s user 0.03s system 104% cpu 6.565 total
    new:
    ffmpeg -i sin.flac -acodec aac -strict -2 -y sin_old.aac  6.24s user 0.03s system 104% cpu 5.993 total
    
    This also improves accuracy of the expression by ~ 2 ulp in some cases.
    Reviewed-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
    Reviewed-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
    Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanag@gmail.com>
    bd9c5875
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
cmdutils_opencl.c Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_dxva2.c Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffmpeg_qsv.c Loading commit data...
ffmpeg_vdpau.c Loading commit data...
ffmpeg_videotoolbox.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
ffserver_config.c Loading commit data...
ffserver_config.h Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...