Skip to content
  • Loren Merritt's avatar
    CABAC trellis opts part 2: C optimizations · 4abcf60a
    Loren Merritt authored
    Hoist the branch on coef value out of the loop over node contexts.
    Special cases for each possible coef value (0,1,n).
    Special case for dc-only blocks.
    Template the main loop for two common subsets of nodes, to avoid a bunch of branches about which nodes are live.
    Use the nonupdating version of cabac_size_decision in more cases, and omit those bins from the node struct.
    CABAC offsets are now compile-time constants.
    Change TRELLIS_SCORE_MAX from a specific constant to anything negative, which is cheaper to test.
    Remove dct_weight2_zigzag[], since trellis has to lookup zigzag[] anyway.
    
    60% faster on x86_64.
    25k->18k codesize.
    4abcf60a