]> git.sesse.net Git - ffmpeg/commit
avcodec/smacker: Use better nb_codes estimate when initializing VLC
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 25 Jun 2020 14:50:24 +0000 (16:50 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 17 Sep 2020 23:52:08 +0000 (01:52 +0200)
commit2db38ae7349c4d5f311723ea45cb03bc1745d26d
treee45b13a2f26015ac55cfc78d8ef8308d8236de29
parent01dbcbb37a30b77dcdc7b2d9ed6a4fcccf4f4eec
avcodec/smacker: Use better nb_codes estimate when initializing VLC

Using the real number of read codes allows to leave a loop in
ff_init_vlc_sparse earlier; notice that all codes not explicitly
set by reading data have been set to zero earlier (i.e. they are
zero-length codes) and such codes are ignored by ff_init_vlc_sparse.

This improves performance: When compiled with GCC 9, the time spent on
one call to smka_decode_frame() for the sample from ticket #2425
decreased from 2195367 decicycles to 2068389 decicycles. For Clang 9,
it improved from 1602075 to 1534188 decicycles. These tests have been
performed 20 times and each times the input file has been looped
32 times to get a sufficient number of frames.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/smacker.c