mpegts: Remove one 64-bit integer modulus operation per packet
authorBen Avison <bavison@riscosopen.org>
Mon, 5 Aug 2013 12:12:49 +0000 (13:12 +0100)
committerMartin Storsjö <martin@martin.st>
Mon, 5 Aug 2013 16:25:55 +0000 (19:25 +0300)
commita22ae9f0c579793f411e2bd7a8db557091a3a4ae
tree9c2c26d112c1860e0db7f915eec99214d950b342
parent43bacd5b7d3d265a77cd29d8abb131057796aecc
mpegts: Remove one 64-bit integer modulus operation per packet

The common case of the pointer having increased by one packet (which results
in no change to the modulus) can be detected with a 64-bit subtraction,
which is far cheaper than a division on many platforms.

           Before          After
           Mean   StdDev   Mean   StdDev  Change
Divisions   248.3  8.8      51.5   7.4    +381.7%
Overall    2773.2 25.6     2372.5 43.1     +16.9%

Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/mathops.h
libavformat/mpegts.c