]> git.sesse.net Git - x264/commit
CABAC trellis opts part 2: C optimizations
authorLoren Merritt <pengvado@akuvian.org>
Thu, 22 Dec 2011 17:56:06 +0000 (17:56 +0000)
committerFiona Glaser <fiona@x264.com>
Sun, 15 Jan 2012 22:27:32 +0000 (14:27 -0800)
commit4abcf60a04e358b87da284f3a5fac3e2949b6de1
treed76a34a7c4c324e9ec21f3fbe4f5d33aae890d76
parent253cd7baefb7f5d101725034b2c37afacc012305
CABAC trellis opts part 2: C optimizations

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.
common/dct.c
common/dct.h
encoder/encoder.c
encoder/rdo.c