]> git.sesse.net Git - ffmpeg/commit
avcodec/smacker: Use unsigned for prediction values
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 26 Jun 2020 09:36:57 +0000 (11:36 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 18 Sep 2020 00:11:34 +0000 (02:11 +0200)
commitb2c42f02337301583b51bea2ede9dbfd837991c0
treedfacb04223b14b1b4c3aeec7dd62e39799462a3a
parent010e345afe5d9744956dbc6253a4999e6851e7e9
avcodec/smacker: Use unsigned for prediction values

Up until now, the Smacker decoder has pretended that the prediction
values are signed in code like 'pred[0] += (unsigned)sign_extend(val, 16)'
(the cast has been added to this code later to fix undefined behaviour).
This has been even done in case the PCM format is u8.

Yet in case of 8/16 bit samples, only the lower 8/16 bit of the predicition
values are ever used, so one can just as well just use unsigned and
remove the sign extensions. This is what this commit does.

For GCC 9 the time for one call to smka_decode_frame() for the sample from
ticket #2425 decreased from 1709043 to 1693619 decicycles; for Clang 9
it went up from 1355273 to 1369089 decicycles.

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