]> git.sesse.net Git - ffmpeg/commit
avcodec/smacker: Improve creating Huffman VLC tables
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 25 Oct 2020 09:24:31 +0000 (10:24 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 8 Dec 2020 16:51:44 +0000 (17:51 +0100)
commitfefe2cbbf2a50039bc6f212a5d1ab92781662665
tree191900e5ba185b8a48ce79067351d4629fd84cda
parent09062eece2e8f188330adab9ddd873341dcf9862
avcodec/smacker: Improve creating Huffman VLC tables

The Smacker Huffman tables are already stored in a tree-like structure;
in particular, they are naturally ordered from left to right in the
tree and are therefore suitable to be initialized by
ff_init_vlc_from_lengths() which avoids traversing the data twice in
order to sort only the codes that are so long that they need into a
subtable.

This improves performance (and reduces codesize): For the sample from
ticket #2425 the number of decicycles for parsing and creating the VLCs
in smka_decode_frame() decreased from 412322 to 359152 (tested with
10 runs each looping 20 times over the file).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/smacker.c