diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-02 00:46:11 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-10-09 09:15:40 +0200 |
commit | cad1593330e9d1990fa092bc7cd2fa4324d6ccf9 (patch) | |
tree | da46ed7e960e29ce2ab226f167201cb7197b8fa9 /tests/fate-run.sh | |
parent | 566280c3f464512446768fa5ee625edbf6a53c81 (diff) | |
download | ffmpeg-cad1593330e9d1990fa092bc7cd2fa4324d6ccf9.tar.gz |
avcodec/huffyuv: Speed up generating Huffman codes
The codes here have the property that the long codes
are to the left of the tree (each zero bit child node
is by definition to the left of its one bit sibling);
they also have the property that among codes of the same length,
the symbol is ascending from left to right.
These properties can be used to create the codes from
the lengths in only two passes over the array of lengths
(the current code uses one pass for each length, i.e. 32):
First one counts how many nodes of each length there are.
Then one calculates the range of codes of each length
(possible because the codes are ordered by length in the tree).
This enables one to calculate the actual codes with only
one further traversal of the length array.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'tests/fate-run.sh')
0 files changed, 0 insertions, 0 deletions