]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.lz4/src/net/jpountz/lz4/LZ4Constants.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.lz4 / src / net / jpountz / lz4 / LZ4Constants.java
1 package net.jpountz.lz4;
2
3 /*
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 enum LZ4Constants {
19   ;
20
21   static final int DEFAULT_COMPRESSION_LEVEL = 8+1;
22   static final int MAX_COMPRESSION_LEVEL = 16+1;
23
24   static final int MEMORY_USAGE = 14;
25   static final int NOT_COMPRESSIBLE_DETECTION_LEVEL = 6;
26
27   static final int MIN_MATCH = 4;
28
29   static final int HASH_LOG = MEMORY_USAGE - 2;
30   static final int HASH_TABLE_SIZE = 1 << HASH_LOG;
31
32   static final int SKIP_STRENGTH = Math.max(NOT_COMPRESSIBLE_DETECTION_LEVEL, 2);
33   static final int COPY_LENGTH = 8;
34   static final int LAST_LITERALS = 5;
35   static final int MF_LIMIT = COPY_LENGTH + MIN_MATCH;
36   static final int MIN_LENGTH = MF_LIMIT + 1;
37
38   static final int MAX_DISTANCE = 1 << 16;
39
40   static final int ML_BITS = 4;
41   static final int ML_MASK = (1 << ML_BITS) - 1;
42   static final int RUN_BITS = 8 - ML_BITS;
43   static final int RUN_MASK = (1 << RUN_BITS) - 1;
44
45   static final int LZ4_64K_LIMIT = (1 << 16) + (MF_LIMIT - 1);
46   static final int HASH_LOG_64K = HASH_LOG + 1;
47   static final int HASH_TABLE_SIZE_64K = 1 << HASH_LOG_64K;
48
49   static final int HASH_LOG_HC = 15;
50   static final int HASH_TABLE_SIZE_HC = 1 << HASH_LOG_HC;
51   static final int OPTIMAL_ML = ML_MASK - 1 + MIN_MATCH;
52
53 }