1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00
Go to file
Ganesh Ajjanagadde 42868ca569 avcodec/jpeg2000: replace naive pow call with smarter exp2fi
pow is a very wasteful function for this purpose. A low hanging fruit
would be simply to replace with exp2f, and that does yield some speedup.
However, there are 2 drawbacks of this:
1. It does not exploit the integer nature of the argument.
2. (minor) Some platforms lack a proper exp2f routine, making benefits available
only to non broken libm.
3. exp2f does not solve the same issue that plagues pow, namely terrible
worst case performance. This is a fundamental issue known as the
"table-maker's dilemma" recognized by Prof. Kahan himself and
subsequently elaborated and researched by many others. All this is clear from benchmarks below.

This exploits the IEEE-754 format to get very good performance even in
the worst case for integer powers of 2. This solves all the issues noted
above. Function tested with clang usan over [-1000, 1000] (beyond range of
relevance for this, which is [-255, 255]), patch itself with FATE.

Benchmarks obtained on x86-64, Haswell, GNU-Linux via 10^5 iterations of
the pow call, START/STOP, and command ffplay ~/samples/jpeg2000/chiens_dcinema2K.mxf.
Low number of runs also given to prove the point about worst case:

pow:
 216270 decicycles in pow,       1 runs,      0 skips
 110175 decicycles in pow,       2 runs,      0 skips
  56085 decicycles in pow,       4 runs,      0 skips
  29013 decicycles in pow,       8 runs,      0 skips
  15472 decicycles in pow,      16 runs,      0 skips
   8689 decicycles in pow,      32 runs,      0 skips
   5295 decicycles in pow,      64 runs,      0 skips
   3599 decicycles in pow,     128 runs,      0 skips
   2748 decicycles in pow,     256 runs,      0 skips
   2304 decicycles in pow,     511 runs,      1 skips
   2072 decicycles in pow,    1022 runs,      2 skips
   1963 decicycles in pow,    2044 runs,      4 skips
   1894 decicycles in pow,    4091 runs,      5 skips
   1860 decicycles in pow,    8184 runs,      8 skips

exp2f:
 134140 decicycles in pow,       1 runs,      0 skips
  68110 decicycles in pow,       2 runs,      0 skips
  34530 decicycles in pow,       4 runs,      0 skips
  17677 decicycles in pow,       8 runs,      0 skips
   9175 decicycles in pow,      16 runs,      0 skips
   4931 decicycles in pow,      32 runs,      0 skips
   2808 decicycles in pow,      64 runs,      0 skips
   1747 decicycles in pow,     128 runs,      0 skips
   1208 decicycles in pow,     256 runs,      0 skips
    952 decicycles in pow,     512 runs,      0 skips
    822 decicycles in pow,    1024 runs,      0 skips
    765 decicycles in pow,    2047 runs,      1 skips
    722 decicycles in pow,    4094 runs,      2 skips
    693 decicycles in pow,    8190 runs,      2 skips

exp2fi:
   2740 decicycles in pow,       1 runs,      0 skips
   1530 decicycles in pow,       2 runs,      0 skips
    955 decicycles in pow,       4 runs,      0 skips
    622 decicycles in pow,       8 runs,      0 skips
    477 decicycles in pow,      16 runs,      0 skips
    368 decicycles in pow,      32 runs,      0 skips
    317 decicycles in pow,      64 runs,      0 skips
    291 decicycles in pow,     128 runs,      0 skips
    277 decicycles in pow,     256 runs,      0 skips
    268 decicycles in pow,     512 runs,      0 skips
    265 decicycles in pow,    1024 runs,      0 skips
    263 decicycles in pow,    2048 runs,      0 skips
    263 decicycles in pow,    4095 runs,      1 skips
    260 decicycles in pow,    8191 runs,      1 skips

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-12-08 22:00:05 -05:00
compat
doc Merge commit 'f023d57d355ff3b917f1aad9b03db5c293ec4244' 2015-12-07 15:50:45 +01:00
libavcodec avcodec/jpeg2000: replace naive pow call with smarter exp2fi 2015-12-08 22:00:05 -05:00
libavdevice
libavfilter avfilter/af_biquads: pass filter ctx to av_log calls 2015-12-07 11:47:43 +01:00
libavformat Merge commit '5f3a081b42b84404a40a52c80ef7a354cf048c56' 2015-12-08 09:41:43 +01:00
libavresample
libavutil lavu/frame: use AVPALETTE_SIZE instead of 1024 2015-12-08 17:50:40 +01:00
libpostproc
libswresample swresample: use AV_OPT_TYPE_BOOL for linear_interp and cheby options 2015-12-04 15:43:33 +01:00
libswscale swscale/arm: add ff_nv{12,21}_to_{argb,rgba,abgr,bgra}_neon_16 2015-12-08 08:12:42 +01:00
presets
tests fate/api-jpeg-codec-param: rename to api-mjpeg-codec-param 2015-12-08 20:43:20 +01:00
tools
.gitattributes
.gitignore
.travis.yml
arch.mak mips: rename mipsdspr1 to mipsdsp 2015-12-04 02:35:42 +01:00
Changelog avcodec: implement vp9 dxva2 hwaccel 2015-12-07 09:38:59 +01:00
cmdutils_common_opts.h
cmdutils_opencl.c
cmdutils.c cosmetics: Fix weird indentations 2015-12-07 10:43:43 -08:00
cmdutils.h
common.mak Merge commit '9f57f134c19773d54269b6cb9ee455ff87c2e9e1' 2015-12-05 12:21:33 +01:00
configure configure: fix vp9_d3d11va_hwaccel deps 2015-12-07 13:12:21 -03:00
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
ffmpeg_dxva2.c ffmpeg_dxva2: support vp9 hwaccel 2015-12-07 09:47:51 +01:00
ffmpeg_filter.c
ffmpeg_opt.c
ffmpeg_qsv.c
ffmpeg_vdpau.c
ffmpeg_videotoolbox.c
ffmpeg.c ffmpeg: When streamcopying, only add the input seek position when copying timestamps. 2015-12-05 04:24:22 +01:00
ffmpeg.h
ffplay.c ffplay: use hypot() 2015-12-06 08:11:47 -05:00
ffprobe.c ffprobe: Do not print profile names in -bitexact 2015-12-06 14:37:40 +01:00
ffserver_config.c
ffserver_config.h
ffserver.c ffserver: Clear avio context after closing it in rtp_new_av_stream() 2015-11-30 23:31:12 +01:00
INSTALL.md
library.mak
LICENSE.md
MAINTAINERS
Makefile mips: rename mipsdspr1 to mipsdsp 2015-12-04 02:35:42 +01:00
README.md
RELEASE
version.sh

FFmpeg README

FFmpeg is a collection of libraries and tools to process multimedia content such as audio, video, subtitles and related metadata.

Libraries

  • libavcodec provides implementation of a wider range of codecs.
  • libavformat implements streaming protocols, container formats and basic I/O access.
  • libavutil includes hashers, decompressors and miscellaneous utility functions.
  • libavfilter provides a mean to alter decoded Audio and Video through chain of filters.
  • libavdevice provides an abstraction to access capture and playback devices.
  • libswresample implements audio mixing and resampling routines.
  • libswscale implements color conversion and scaling routines.

Tools

  • ffmpeg is a command line toolbox to manipulate, convert and stream multimedia content.
  • ffplay is a minimalistic multimedia player.
  • ffprobe is a simple analysis tool to inspect multimedia content.
  • ffserver is a multimedia streaming server for live broadcasts.
  • Additional small tools such as aviocat, ismindex and qt-faststart.

Documentation

The offline documentation is available in the doc/ directory.

The online documentation is available in the main website and in the wiki.

Examples

Coding examples are available in the doc/examples directory.

License

FFmpeg codebase is mainly LGPL-licensed with optional components licensed under GPL. Please refer to the LICENSE file for detailed information.

Contributing

Patches should be submitted to the ffmpeg-devel mailing list using git format-patch or git send-email. Github pull requests should be avoided because they are not part of our review process. Few developers follow pull requests so they will likely be ignored.