• Martin Storsjo's avatar
    Don't try to shift more bits than the variable length · 8f9f42c1
    Martin Storsjo authored
    Shifting by more than (or equal to) the variable length is
    undefined in C.
    
    This caused the quantized spectrum values to remain unshifted,
    causing loud beeps in some samples.
    
    The exact same change was originally applied in
    65745694 (for AOSP) and in 24021f19 (in the separate fdk-aac
    repo), but was overwritten and silently reverted by the new
    upstream code drop for Android 4.2 in 381d6984. After the code
    drop, I chose not to reapply this change since the crashes that
    it fixed had been fixed in other ways upstream and I was unable to
    reproduce them after the new code drop.
    8f9f42c1
quantize.cpp 14.2 KB