]> git.sesse.net Git - ffmpeg/commit
avcodec/smacker: Avoid allocations for decoding Smacker
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 24 Jul 2020 19:28:34 +0000 (21:28 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 18 Sep 2020 00:09:34 +0000 (02:09 +0200)
commit010e345afe5d9744956dbc6253a4999e6851e7e9
treebc585a965d63a7bdd4a87dbdfc8d73fb4483d494
parent43d02b4634de4882818cd226bba5952312df9a0a
avcodec/smacker: Avoid allocations for decoding Smacker

by using buffers on the stack instead. The fact that the effective
lifetime of most of the allocated buffers doesn't overlap enables one to
limit the stack space used to a fairly modest size (about 1.5 KiB).

That all the buffers used in HuffContexts have always the same number of
elements (namely 256) makes it possible to include the buffers directly
in the HuffContext. Doing so also makes the length field redundant; it has
therefore been removed.

This is beneficial for performance: For GCC 9 the time for one call to
smka_decode_frame() for the sample in ticket #2425 went down from
1794494 to 1709043 decicyles; for Clang 9 it decreased from 1449420 to
1355273 decicycles.

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