source: code/trunk/vendor/github.com/andybalholm/brotli/constants.go@ 145

Last change on this file since 145 was 145, checked in by Izuru Yakumo, 22 months ago

Updated the Makefile and vendored depedencies

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 1.9 KB
Line 
1package brotli
2
3/* Copyright 2016 Google Inc. All Rights Reserved.
4
5 Distributed under MIT license.
6 See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
7*/
8
9/* Specification: 7.3. Encoding of the context map */
10const contextMapMaxRle = 16
11
12/* Specification: 2. Compressed representation overview */
13const maxNumberOfBlockTypes = 256
14
15/* Specification: 3.3. Alphabet sizes: insert-and-copy length */
16const numLiteralSymbols = 256
17
18const numCommandSymbols = 704
19
20const numBlockLenSymbols = 26
21
22const maxContextMapSymbols = (maxNumberOfBlockTypes + contextMapMaxRle)
23
24const maxBlockTypeSymbols = (maxNumberOfBlockTypes + 2)
25
26/* Specification: 3.5. Complex prefix codes */
27const repeatPreviousCodeLength = 16
28
29const repeatZeroCodeLength = 17
30
31const codeLengthCodes = (repeatZeroCodeLength + 1)
32
33/* "code length of 8 is repeated" */
34const initialRepeatedCodeLength = 8
35
36/* "Large Window Brotli" */
37const largeMaxDistanceBits = 62
38
39const largeMinWbits = 10
40
41const largeMaxWbits = 30
42
43/* Specification: 4. Encoding of distances */
44const numDistanceShortCodes = 16
45
46const maxNpostfix = 3
47
48const maxNdirect = 120
49
50const maxDistanceBits = 24
51
52func distanceAlphabetSize(NPOSTFIX uint, NDIRECT uint, MAXNBITS uint) uint {
53 return numDistanceShortCodes + NDIRECT + uint(MAXNBITS<<(NPOSTFIX+1))
54}
55
56/* numDistanceSymbols == 1128 */
57const numDistanceSymbols = 1128
58
59const maxDistance = 0x3FFFFFC
60
61const maxAllowedDistance = 0x7FFFFFFC
62
63/* 7.1. Context modes and context ID lookup for literals */
64/* "context IDs for literals are in the range of 0..63" */
65const literalContextBits = 6
66
67/* 7.2. Context ID for distances */
68const distanceContextBits = 2
69
70/* 9.1. Format of the Stream Header */
71/* Number of slack bytes for window size. Don't confuse
72 with BROTLI_NUM_DISTANCE_SHORT_CODES. */
73const windowGap = 16
74
75func maxBackwardLimit(W uint) uint {
76 return (uint(1) << W) - windowGap
77}
Note: See TracBrowser for help on using the repository browser.