[varStore] Adjust encoding overhead in optimize()

Previously we were not accounting for the LOffset to VarData.
This commit is contained in:
Behdad Esfahbod 2023-05-24 13:21:33 -06:00
parent 0677c0e705
commit b72a8da045
2 changed files with 4 additions and 4 deletions

View File

@ -406,7 +406,7 @@ class _Encoding(object):
def _characteristic_overhead(chars): def _characteristic_overhead(chars):
"""Returns overhead in bytes of encoding this characteristic """Returns overhead in bytes of encoding this characteristic
as a VarData.""" as a VarData."""
c = 6 c = 4 + 6 # 4 bytes for LOffset, 6 bytes for VarData header
while chars: while chars:
if chars & 0b1111: if chars & 0b1111:
c += 2 c += 2
@ -485,7 +485,7 @@ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True):
# #
# Each encoding as such has a number of "active" (ie. non-zero) # Each encoding as such has a number of "active" (ie. non-zero)
# columns. The overhead of encoding the characteristic bitmap # columns. The overhead of encoding the characteristic bitmap
# is 6 bytes, plus 2 bytes per active column. # is 10 bytes, plus 2 bytes per active column.
# #
# When an encoding is merged into another one, if the characteristic # When an encoding is merged into another one, if the characteristic
# of the old encoding is a subset of the new one, then the overhead # of the old encoding is a subset of the new one, then the overhead

View File

@ -105,8 +105,8 @@ def buildAxis(axisTag):
[10, 13, 0, 0, 20], [10, 13, 0, 0, 20],
{3: 300}, {3: 300},
], ],
2, 1,
186, 175,
), ),
( (
5, 5,