hyparquet-compressors
Version:
Decompressors for hyparquet
51 lines (44 loc) • 1.48 kB
JavaScript
/* Copyright 2013 Google Inc. All Rights Reserved.
Lookup tables to map prefix codes to value ranges. This is used during
decoding of the block lengths, literal insertion lengths and copy lengths.
*/
/**
* Represents the range of values belonging to a prefix code:
* [offset, offset + 2^nbits)
* @param {number[]} pair
* @returns {{offset: number, nbits: number}}
*/
function prefix([ offset, nbits ]) {
return { offset, nbits }
}
export const kBlockLengthPrefixCode = [
[], [5, 2], [9, 2], [13, 2],
[], [25, 3], [33, 3], [41, 3],
[], [65, 4], [81, 4], [97, 4],
[], [145, 5], [177, 5], [209, 5],
[], [305, 6], [369, 7], [497, 8],
[], [1265, 10], [2289, 11], [4337, 12],
[], [16625, 24],
].map(prefix)
export const kInsertLengthPrefixCode = [
[], [1, 0], [2, 0], [3, 0],
[], [5, 0], [6, 1], [8, 1],
[], [14, 2], [18, 3], [26, 3],
[], [50, 4], [66, 5], [98, 5],
[], [194, 7], [322, 8], [578, 9],
[], [2114, 12], [6210, 14], [22594, 24],
].map(prefix)
export const kCopyLengthPrefixCode = [
[], [3, 0], [4, 0], [5, 0],
[], [7, 0], [8, 0], [9, 0],
[], [12, 1], [14, 2], [18, 2],
[], [30, 3], [38, 4], [54, 4],
[], [102, 5], [134, 6], [198, 7],
[], [582, 9], [1094, 10], [2118, 24],
].map(prefix)
export const kInsertRangeLut = [
0, 0, 8, 8, 0, 16, 8, 16, 16,
]
export const kCopyRangeLut = [
0, 8, 0, 8, 16, 0, 16, 8, 16,
]