• Rostislav Pehlivanov's avatar
    Rewrite msac.c · 33d16d81
    Rostislav Pehlivanov authored
    This rewrites msac.c to the point of there being no libaom project
    code left, hence changing the license of the file to the dav1d
    project's license.
    The rewrite much simplifies and optimizes entropy decoding.
    Some encoder specific code also remained, such as tell_offs, to
    tell the fractional amount of bits left, which the decoder does
    not need.
    ctx_refill is much simpler and has a tighter loop with less
    instructions, which on some CPUs can actually be ran in one cycle.
    The old mechanism which checked to see if the buffer reached the
    end to disable calling ctx_refill is gone, as all it saved was
    a mostly well predicted branch.
    The optimizations regarading this function enabled us to use
    an ec_win of 64 bits whilst improving performance. This was not
    possible with the old needlessly robust system.
    Some msac-specific API changes were made - msac_decode_bool now
    takes a scaled value directly rather than doing scaling itself.
    This saves a shift in most use cases as the function is mainly
    used to read equiprobable bools rather than ones with specific
    There's still room for optimizations, mainly in that update_cdf
    could be SIMD'd. This commit prepares for some of them by
    moving the init function at the bottom of the file.
    Overall decoder speedup seems to be around 3%-5%, specific on
    bitrate and encoder as expected.
decode.c 130 KB