]> git.sesse.net Git - ffmpeg/commit
avcodec/smacker: Replace implicit checks for overread by explicit ones
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 25 Jul 2020 17:00:28 +0000 (19:00 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 18 Sep 2020 00:03:36 +0000 (02:03 +0200)
commit527b853d1a72beb08ffaa63239d13b2c0c327c66
treec9770f34258edf4dbe40ed33fda947801d8631cd
parentb3e89ad6466a2b2dd14a0a675aa97a61b81300b8
avcodec/smacker: Replace implicit checks for overread by explicit ones

Using explicit checks has the advantage that one can combine several
checks into one and does not have to check every time. E.g. reading a
16bit PCM sample involves two calls to get_vlc2(), each of which may
read up to three times up to SMKTREE_BITS (= 9) bits. But given that the
padding that the input packet is supposed to have is large enough, it is
no problem to only check once for each sample.

This turned out to be beneficial for performance: For GCC 9, the time for
one call of smka_decode_frame() for the sample from ticket #2425 went down
from 2055905 to 1804751 decicycles; for Clang 9 it went down from 1510538
to 1479680 decicycles.

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