Go to file
Ganesh Ajjanagadde 9bec6d71a2 swresample/resample: speed up build_filter by 50%
This speeds up build_filter by ~ 50%. This gain should be pretty
consistent across all architectures and platforms.

Essentially, this relies on a observation that the filters have some
even/odd symmetry that may be exploited during the construction of the
polyphase filter bank. In particular, phases (scaled to [0, 1]) in [0.5, 1] are
easily derived from [0, 0.5] and expensive reevaluation of function
points are unnecessary. This requires some rather annoying even/odd
bookkeeping as can be seen from the patch.

I vaguely recall from signal processing theory more general symmetries allowing even greater
optimization of the construction. At a high level, "even functions"
correspond to 2, and one can imagine variations. Nevertheless, for the sake
of some generality and because of existing filters, this is all that is
being exploited.

Currently, this patch relies on phase_count being even or (trivially) 1,
though this is not an inherent limitation to the approach. This
assumption is safe as phase_count is 1 << phase_bits, and is hence a
power of two. There is no way for user API to set it to a nontrivial odd
number. This assumption has been placed as an assert in the code.

To repeat, this assumes even symmetry of the filters, which is the most common
way to get generalized linear phase anyway and is true of all currently
supported filters.

As a side note, accuracy should be identical or perhaps slightly better
due to this "forcing" filter symmetries leading to a better phase
characteristic. As before, I can't test this claim easily, though it may
be of interest.

Patch tested with FATE.

Sample benchmark (x86-64, Haswell, GNU/Linux):

test: swr-resample-dblp-44100-2626

new:
527376779 decicycles in build_filter(loop 1000),     256 runs,      0 skips
524361765 decicycles in build_filter(loop 1000),     512 runs,      0 skips
516552574 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

old:
974178658 decicycles in build_filter(loop 1000),     256 runs,      0 skips
972794408 decicycles in build_filter(loop 1000),     512 runs,      0 skips
954350046 decicycles in build_filter(loop 1000),    1024 runs,      0 skips

Note that lower level optimizations are entirely possible, I focussed on
getting the high level semantics correct. In any case, this should
provide a good foundation.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-04 17:05:57 -05:00
compat Merge commit '407ac22322e5ce67996ec54ef619cafa4c9ceb78' 2015-11-02 11:58:27 +01:00
doc avformat: add acm demuxer 2015-11-03 12:26:09 +01:00
libavcodec avcodec/mjpegdec: Reinitialize IDCT on BPP changes 2015-11-04 21:51:21 +01:00
libavdevice gdigrab: grab right desktop size if DPI in use, based on patch from Alexander Brotzge 2015-10-31 23:08:02 +11:00
libavfilter avfilter/showcqt: remove yuv offset 2015-11-03 23:47:09 +01:00
libavformat avformat/cache: Use int64_t to avoid int overflow in cache_read 2015-11-04 03:59:17 +01:00
libavresample avresample/resample: remove unused variable 2015-09-19 23:40:34 +02:00
libavutil avutil/common: add FFDIFFSIGN macro 2015-11-03 16:28:12 -05:00
libpostproc Merge commit 'e88103a7f92cf27a2868b50acc8a9912f6088249' 2015-09-05 21:35:46 +02:00
libswresample swresample/resample: speed up build_filter by 50% 2015-11-04 17:05:57 -05:00
libswscale swscale: rename sws_rgb2rgb_init to ff_sws_rgb2rgb_init 2015-10-29 23:49:46 +01:00
presets presets: remove moldering iPod presets 2014-06-17 16:15:04 -08:00
tests fate: update fate-source ref file 2015-11-03 15:05:32 -03:00
tools Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
.gitattributes Treat all '*.pnm' files as non-text file 2014-11-28 17:52:43 -05:00
.gitignore gitignore: ignore object file temporaries 2015-10-10 20:30:41 +02:00
.travis.yml Merge commit '1e0b8bf0b3b3b4247fb21e9839af342ae879607c' 2015-09-12 13:31:22 +02:00
arch.mak use mmi instead of loongson3 as simd-optimization flag 2015-07-07 03:46:57 +02:00
Changelog avformat: add acm demuxer 2015-11-03 12:26:09 +01:00
cmdutils_common_opts.h opts: add list device sources/sinks options 2014-10-25 20:20:31 +02:00
cmdutils_opencl.c all: use FFDIFFSIGN to resolve possible undefined behavior in comparators 2015-11-03 16:28:30 -05:00
cmdutils.c all: use FFDIFFSIGN to resolve possible undefined behavior in comparators 2015-11-03 16:28:30 -05:00
cmdutils.h cmdutils: remove sws_opts usage, simplify code 2015-08-08 16:51:25 +02:00
common.mak Merge commit 'c1aac39eaccd32dc3b74ccfcce701d3d888fbc6b' 2015-10-14 13:54:50 +02:00
configure Merge commit 'a0562e531723923b632684c7b51a9dd584bf534f' 2015-11-02 11:58:16 +01:00
COPYING.GPLv2
COPYING.GPLv3
COPYING.LGPLv2.1
COPYING.LGPLv3
CREDITS
ffmpeg_dxva2.c ffmpeg_dxva2: call GetDesktopWindow() in place of GetShellWindow() 2015-06-03 16:25:08 +02:00
ffmpeg_filter.c ffmpeg_filter: check encoder before using it to set frame size. 2015-10-30 10:55:10 +01:00
ffmpeg_opt.c all: remove some casts of function pointer to void * 2015-10-24 15:14:59 -04:00
ffmpeg_qsv.c Merge commit 'fb472e1a11a4e0caed2c3c91da01ea8e35d9e3f8' 2015-10-22 16:18:02 +02:00
ffmpeg_vdpau.c ffmpeg_vdpau: Ignore decoder's max supported level 2015-08-16 15:02:33 -07:00
ffmpeg_videotoolbox.c ffmpeg/videotoolbox: protect UTGetOSTypeFromString on both VDA and VT 2015-10-15 10:22:31 +02:00
ffmpeg.c all: use FFDIFFSIGN to resolve possible undefined behavior in comparators 2015-11-03 16:28:30 -05:00
ffmpeg.h ffmpeg: add abort_on option to allow aborting on empty output 2015-10-22 19:03:01 +02:00
ffplay.c Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
ffprobe.c ffprobe: add support for printing packet strings metadata as packet tags 2015-10-30 20:47:43 +01:00
ffserver_config.c ffserver_config: check for INT_MIN before doing FFABS 2015-10-13 19:40:09 -04:00
ffserver_config.h ffserver: Use singlejpeg muxer for jpeg 2015-06-08 03:36:22 +02:00
ffserver.c Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
INSTALL.md
library.mak build: add LDLIBFLAGS 2015-07-08 14:35:02 +02:00
LICENSE.md avfilter: add rubberband wrapper 2015-09-20 19:54:57 +02:00
MAINTAINERS MAINTAINERS: add key fingerprint 2015-10-25 19:15:04 -04:00
Makefile Merge commit 'fb472e1a11a4e0caed2c3c91da01ea8e35d9e3f8' 2015-10-22 16:18:02 +02:00
README.md README: replace http with https 2015-10-06 13:27:29 +02:00
RELEASE RELEASE: update to 2.8.git 2015-09-09 23:53:15 -03:00
version.sh version.sh: add note that ffversion.h is auto-generated 2015-10-25 10:14:44 -04:00

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.