• Ronald S. Bultje's avatar
    get_bits: introduce safe bitreading to prevent overreads. · 8cfbbd92
    Ronald S. Bultje authored
    When turned on, H264/CAVLC gets ~15% (CVPCMNL1_SVA_C.264) slower for
    ultra-high-bitrate files, or ~2.5% (CVFI1_SVA_C.264) for lower-bitrate
    files. Other codecs are affected to a lesser extent because they are
    less optimized; e.g., VC-1 slows down by less than 1% (all on x86).
    The patch generated 3 extra instructions (cmp, cmovae and mov) per
    call to get_bits().
    
    The performance penalty on ARM is within the error margin for most
    files, up to 4% in extreme cases such as CVPCMNL1_SVA_C.264.
    
    Based on work (for GCI) by Aneesh Dogra <lionaneesh@gmail.com>, and
    inspired by patch in Chromium by Chris Evans <cevans@chromium.org>.
    8cfbbd92