Skip to content
  • Timothy B. Terriberry's avatar
    Change bitreader to use a larger window. · c17b62e1
    Timothy B. Terriberry authored
    Change bitreading functions to use a larger window which is refilled less
     often.
    
    This makes it cheap enough to do bounds checking each time the window is
     refilled, which avoids the need to copy the input into a large circular
     buffer.
    This uses less memory and speeds up the total decode time by 1.6% on an ARM11,
     2.8% on a Cortex A8, and 2.2% on x86-32, but less than 1% on x86-64.
    
    Inlining vp8dx_bool_decoder_fill() has a big penalty on x86-32, as does moving
     the refill loop to the front of vp8dx_decode_bool().
    However, having the refill loop between computation of the split values and
     the branch in vp8_decode_mb_tokens() is a big win on ARM (presumably due to
     memory latency and code size: refilling after normalization duplicates the
     code in the DECODE_AND_BRANCH_IF_ZERO and DECODE_AND_LOOP_IF_ZERO cases.
    Unfortunately, refilling at the end of vp8dx_bool_decoder_fill() and at the
     beginning of each decode step in vp8_decode_mb_tokens() means the latter
     requires an extra refill at the end.
    Platform-specific versions could avoid the problem, but would require most of
     detokenize.c to be duplicated.
    
    Change-Id: I16c782a63376f2a15b78f8086d899b987204c1c7
    c17b62e1