[FFmpeg-devel] [PATCH 15/21] avcodec/smacker: Replace implicit checks for overread by explicit ones
Paul B Mahol
onemda at gmail.com
Sat Aug 1 17:11:30 EEST 2020
On 8/1/20, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
> 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.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> libavcodec/smacker.c | 39 ++++++++++++++++++++++++++++++---------
> 1 file changed, 30 insertions(+), 9 deletions(-)
>
Should be OK if tested under ASAN.
More information about the ffmpeg-devel
mailing list