mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 17:32:06 +00:00
FFmpeg git repo
1bf30a1beb
The MagicYUV format stores Huffman tables in its bitstream by coding the length of a given symbol; it does not code the actual code directly, instead this is to be inferred by the rule that a symbol is to the left of every shorter symbol in the Huffman tree and that for symbols of the same length the symbol is ascending from left to right. Our decoder implemented this by first sorting the array containing length and symbol of each element according to descending length and for equal length, according to ascending symbol. Afterwards, the current state in the tree got encoded in a variable code; if the next array entry had length len, then the len most significant bits of code contained the code of this entry. Whenever an entry of the array of length len was processed, code was incremented by 1U << (32 - len). So two entries of length len have the same effect as incrementing code by 1U << (32 - (len - 1)), which corresponds to the parent node of length len - 1 of the two nodes of length len etc. This commit modifies this to avoid sorting the entries before calculating the codes. This is done by calculating how many non-leaf nodes there are on each level of the tree before calculating the codes. Afterwards every leaf node on this level gets assigned the number of nodes already on this level as code. This of course works only because the entries are already sorted by their symbol initially, so that this algorithm indeed gives ascending symbols from left to right on every level. This offers both speed- as well as (obvious) codesize advantages. With Clang 10 the number of decicycles for build_huffman decreased from 1561987 to 1228405; for GCC 9 it went from 1825096 decicyles to 1429921. These tests were carried out with a sample with 150 frames that was looped 13 times; and this was iterated 10 times. The earlier reference point here is from the point when the loop generating the codes was traversed in reverse order (as the patch reversing the order led to performance penalties). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> |
||
---|---|---|
compat | ||
doc | ||
ffbuild | ||
fftools | ||
libavcodec | ||
libavdevice | ||
libavfilter | ||
libavformat | ||
libavresample | ||
libavutil | ||
libpostproc | ||
libswresample | ||
libswscale | ||
presets | ||
tests | ||
tools | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.travis.yml | ||
Changelog | ||
configure | ||
CONTRIBUTING.md | ||
COPYING.GPLv2 | ||
COPYING.GPLv3 | ||
COPYING.LGPLv2.1 | ||
COPYING.LGPLv3 | ||
CREDITS | ||
INSTALL.md | ||
LICENSE.md | ||
MAINTAINERS | ||
Makefile | ||
README.md | ||
RELEASE |
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.
- Additional small tools such as
aviocat
,ismindex
andqt-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 and will be ignored.