encoder speed-up: hardcode special level values

1-3% faster

Change-Id: Ib2131989fbf819bcbfa6456adbeea0ba27c914f7
This commit is contained in:
Pascal Massimino
2011-07-12 15:52:43 -07:00
parent c558bdad28
commit c915fb2aa7
3 changed files with 30 additions and 8 deletions

View File

@ -55,7 +55,7 @@ const uint16_t VP8EntropyCost[256] = {
// For each given level, the following table given the pattern of contexts
// to use for coding it (in [][0]) as well as the bit value to use for
// each context (in [][1]).
static const uint16_t kLevelCodes[MAX_VARIABLE_LEVEL][2] = {
const uint16_t VP8LevelCodes[MAX_VARIABLE_LEVEL][2] = {
{0x001, 0x000}, {0x007, 0x001}, {0x00f, 0x005},
{0x00f, 0x00d}, {0x033, 0x003}, {0x033, 0x003}, {0x033, 0x023},
{0x033, 0x023}, {0x033, 0x023}, {0x033, 0x023}, {0x0d3, 0x013},
@ -337,8 +337,8 @@ const uint16_t VP8LevelFixedCosts[2048] = {
};
static int VariableLevelCost(int level, const uint8_t probas[NUM_PROBAS]) {
int pattern = kLevelCodes[level - 1][0];
int bits = kLevelCodes[level - 1][1];
int pattern = VP8LevelCodes[level - 1][0];
int bits = VP8LevelCodes[level - 1][1];
int cost = 0;
int i;
for (i = 2; pattern; ++i) {