Skip to content

Commit

Permalink
vertexcodec: Update kBitsV1 table for slightly better compression
Browse files Browse the repository at this point in the history
This table was found by bruteforcing all 455 permutations of 15 possible
bit combinations in each entry; the best result was ~4.90% reduction,
but for now we pick the version with 0/2/4/8 as one of the entries
(which is ~4.83% reduction) as that makes it easier to retain
compatibility with v0. The previous table that this code replaces got
~4.59% reduction.

The new table also makes more logical sense: 0/1/2/4 optimizes for
well-compressible data, and 1/4/6/8 optimizes for poorly-compressible
data. 2/4/6/8 would perhaps make more sense, but 1/4/6/8 performs
better.
  • Loading branch information
zeux committed Dec 4, 2024
1 parent 0d267f3 commit edccd9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vertexcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ const size_t kTailMaxSize = 32;
static const int kBitsV0[4] = {0, 2, 4, 8};
static const int kBitsV1[3][4] = {
{0, 2, 4, 8},
{0, 1, 2, 8},
{2, 4, 6, 8},
{0, 1, 2, 4},
{1, 4, 6, 8},
};

static size_t getVertexBlockSize(size_t vertex_size)
Expand Down

0 comments on commit edccd9c

Please sign in to comment.