• Mans Rullgard's avatar
    g723.1: optimise scale_vector() · 4aca716a
    Mans Rullgard authored
    Firstly, nothing in this function can overflow 32 bits so the use
    of a 64-bit type is completely unnecessary.  Secondly, the scale
    is either a power of two or 0x7fff.  Doing separate loops for these
    cases avoids using multiplications.  Finally, since only the number
    of bits, not the actual value, of the maximum value is needed, the
    bitwise or of all the values serves the purpose while being faster.
    
    It is worth noting that even if overflow could happen, it was not
    handled correctly anyway.
    Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
    4aca716a
g723_1.c 36.3 KB