• Ganesh Ajjanagadde's avatar
    avfilter/vf_deshake: replace qsort with AV_QSORT · 7910a2c2
    Ganesh Ajjanagadde authored
    qsort is called indirectly in filter_frame, suggesting its performance
    criticality. AV_QSORT is substantially faster due to the inlining of the
    comparison callback. Thus, the increase in performance should be worth
    the increase in binary size.
    
    This optimization is just a low hanging fruit. The trac ticket 1430 is
    a request for an improved deshake filter.
    
    Sample benchmark (x86-64, Haswell, GNU/Linux):
    File: original from https://trac.ffmpeg.org/ticket/1430
    command: ffmpeg -stream_loop 8 -i file.webm -vf deshake=rx=64:ry=64 -f null -
    
    Timer truncated at 1024 runs.
    new:
    28260 decicycles in qsort,       1 runs,      0 skips
    35570 decicycles in qsort,       2 runs,      0 skips
    39010 decicycles in qsort,       4 runs,      0 skips
    46897 decicycles in qsort,       8 runs,      0 skips
    40442 decicycles in qsort,      16 runs,      0 skips
    41611 decicycles in qsort,      32 runs,      0 skips
    40345 decicycles in qsort,      64 runs,      0 skips
    38967 decicycles in qsort,     128 runs,      0 skips
    38647 decicycles in qsort,     256 runs,      0 skips
    40238 decicycles in qsort,     512 runs,      0 skips
    39676 decicycles in qsort,    1024 runs,      0 skips
    
    old:
    1740280 decicycles in qsort,       1 runs,      0 skips
     923560 decicycles in qsort,       2 runs,      0 skips
     511330 decicycles in qsort,       4 runs,      0 skips
     309720 decicycles in qsort,       8 runs,      0 skips
     194900 decicycles in qsort,      16 runs,      0 skips
     142686 decicycles in qsort,      32 runs,      0 skips
     112516 decicycles in qsort,      64 runs,      0 skips
      98166 decicycles in qsort,     128 runs,      0 skips
      88147 decicycles in qsort,     256 runs,      0 skips
      88706 decicycles in qsort,     512 runs,      0 skips
      86783 decicycles in qsort,    1024 runs,      0 skips
    Reviewed-by: 's avatarNicolas George <george@nsup.org>
    Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
    Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
    7910a2c2
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...