architect
developer
@@ -57,13 +56,8 @@
GitHub Issue Tracking
- https://github.com/lemire/JavaFastPFOR/issues
+ https://github.com/fast-pack/JavaFastPFOR/issues
-
- org.sonatype.oss
- oss-parent
- 9
-
@@ -71,8 +65,8 @@
maven-compiler-plugin
3.12.1
- 17
- 17
+ 21
+ 21
@@ -88,7 +82,7 @@
-
+
@@ -121,20 +115,6 @@
me.lemire.integercompression.benchmarktools.Benchmark
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.4
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
org.apache.maven.plugins
maven-javadoc-plugin
@@ -167,7 +147,7 @@
org.jacoco
jacoco-maven-plugin
- 0.8.8
+ 0.8.13
me/lemire/integercompression/Kamikaze
@@ -190,11 +170,51 @@
3.2.1
+
+
+
+
+ maven-clean-plugin
+ 2.5
+
+
+ maven-deploy-plugin
+ 2.8.1
+
+
+ maven-install-plugin
+ 2.5.1
+
+
+ maven-jar-plugin
+ 2.4
+
+
+ maven-javadoc-plugin
+ 2.9.1
+
+
+ maven-resources-plugin
+ 2.6
+
+
+ maven-site-plugin
+ 3.3
+
+
+ maven-source-plugin
+ 2.2.1
+
+
+ maven-surefire-plugin
+ 2.17
+
+
+
JavaFastPFOR
- https://github.com/lemire/JavaFastPFOR/
+ https://github.com/fast-pack/JavaFastPFOR/
-It is a library to compress and uncompress arrays of integers
-very fast. The assumption is that most (but not all) values in
-your array use less than 32 bits.
+A library to compress and uncompress arrays of integers
+very quickly.
diff --git a/src/main/java/me/lemire/integercompression/BinaryPacking.java b/src/main/java/me/lemire/integercompression/BinaryPacking.java
index 8d5ff90..ce37ff0 100644
--- a/src/main/java/me/lemire/integercompression/BinaryPacking.java
+++ b/src/main/java/me/lemire/integercompression/BinaryPacking.java
@@ -37,8 +37,9 @@
* @author Daniel Lemire
*/
public final class BinaryPacking implements IntegerCODEC, SkippableIntegerCODEC {
- final static int BLOCK_SIZE = 32;
-
+ public final static int BLOCK_SIZE = 32;
+ private static final int MAX_BIT_WIDTH = Integer.SIZE;
+
@Override
public void compress(int[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos) {
@@ -131,7 +132,16 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
outpos.add(outlength);
inpos.set(tmpinpos);
}
-
+
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int blockCount = inlength / BLOCK_SIZE;
+ int headersSizeInInts = blockCount / Integer.BYTES + (blockCount % Integer.BYTES);
+ int blocksSizeInInts = blockCount * MAX_BIT_WIDTH;
+ compressedPositions.add(blockCount * BLOCK_SIZE);
+ return headersSizeInInts + blocksSizeInInts;
+ }
+
@Override
public String toString() {
return this.getClass().getSimpleName();
diff --git a/src/main/java/me/lemire/integercompression/FastPFOR.java b/src/main/java/me/lemire/integercompression/FastPFOR.java
index 47969f4..5475496 100644
--- a/src/main/java/me/lemire/integercompression/FastPFOR.java
+++ b/src/main/java/me/lemire/integercompression/FastPFOR.java
@@ -40,6 +40,13 @@
*/
public class FastPFOR implements IntegerCODEC,SkippableIntegerCODEC {
final static int OVERHEAD_OF_EACH_EXCEPT = 8;
+ private static final int OVERHEAD_OF_EACH_PAGE_IN_INTS = 36; // 1 int for the header
+ // 1 int for the byte array size
+ // 1 int for the bitmap
+ // 1 int for byte array padding (to align to 4 bytes)
+ // 32 to have enough space to bit-pack the exceptions
+ private static final int OVERHEAD_OF_EACH_BLOCK_IN_INTS = 1; // 1 byte for the number of bits allocated per truncated integer
+ // 1 byte for the number of exceptions
/**
*
*/
@@ -65,7 +72,7 @@ public class FastPFOR implements IntegerCODEC,SkippableIntegerCODEC {
* @param pagesize
* the desired page size (recommended value is FastPFOR.DEFAULT_PAGE_SIZE)
*/
- private FastPFOR(int pagesize) {
+ FastPFOR(int pagesize) {
pageSize = pagesize;
// Initiate arrrays.
byteContainer = makeBuffer(3 * pageSize
@@ -230,6 +237,18 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
}
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+
+ int pageCount = (inlength + pageSize - 1) / pageSize;
+ int blockCount = inlength / BLOCK_SIZE;
+
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int blockSizeInInts = OVERHEAD_OF_EACH_BLOCK_IN_INTS + BLOCK_SIZE;
+ return OVERHEAD_OF_EACH_PAGE_IN_INTS * pageCount + blockSizeInInts * blockCount + 24;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
final int initpos = inpos.get();
diff --git a/src/main/java/me/lemire/integercompression/FastPFOR128.java b/src/main/java/me/lemire/integercompression/FastPFOR128.java
index 83a3e1f..0557c62 100644
--- a/src/main/java/me/lemire/integercompression/FastPFOR128.java
+++ b/src/main/java/me/lemire/integercompression/FastPFOR128.java
@@ -23,6 +23,13 @@
*/
public class FastPFOR128 implements IntegerCODEC,SkippableIntegerCODEC {
final static int OVERHEAD_OF_EACH_EXCEPT = 8;
+ private static final int OVERHEAD_OF_EACH_PAGE_IN_INTS = 36; // 1 int for the header
+ // 1 int for the byte array size
+ // 1 int for the bitmap
+ // 1 int for byte array padding (to align to 4 bytes)
+ // 32 to have enough space to bit-pack the exceptions
+ private static final int OVERHEAD_OF_EACH_BLOCK_IN_INTS = 1; // 1 byte for the number of bits allocated per truncated integer
+ // 1 byte for the number of exceptions
/**
*
*/
@@ -209,6 +216,18 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
}
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+
+ int pageCount = (inlength + pageSize - 1) / pageSize;
+ int blockCount = inlength / BLOCK_SIZE;
+
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int blockSizeInInts = OVERHEAD_OF_EACH_BLOCK_IN_INTS + BLOCK_SIZE;
+ return OVERHEAD_OF_EACH_PAGE_IN_INTS * pageCount + blockSizeInInts * blockCount + 24;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
final int initpos = inpos.get();
diff --git a/src/main/java/me/lemire/integercompression/GroupSimple9.java b/src/main/java/me/lemire/integercompression/GroupSimple9.java
index 0ce10ce..bd8acfa 100644
--- a/src/main/java/me/lemire/integercompression/GroupSimple9.java
+++ b/src/main/java/me/lemire/integercompression/GroupSimple9.java
@@ -13,3540 +13,3546 @@
public final class GroupSimple9 implements IntegerCODEC, SkippableIntegerCODEC {
- private static final int[][] M = { { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, { 9, 10, 11, 12, 13, 14, 15, 16, 17 },
- { 18, 19, 20, 21, 22, 23, 24, 25, 26 }, { 27, 28, 29, 30, 31, 32, 33, 34, 35 },
- { 36, 37, 38, 39, 40, 41, 42, 43, 44 }, { 45, 46, 47, 48, 49, 50, 51, 52, 53 },
- { 54, 55, 56, 57, 58, 59, 60, 61, 62 }, { 63, 64, 65, 66, 67, 68, 69, 70, 71 },
- { 72, 73, 74, 75, 76, 77, 78, 79, 80 } };
-
- @Override
- public void compress(int[] in, IntWrapper inpos, int inlength, int out[], IntWrapper outpos) {
- if (inlength == 0)
- return;
- out[outpos.get()] = inlength;
- outpos.increment();
- headlessCompress(in, inpos, inlength, out, outpos);
- }
-
- private void encode0(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + (in[inf + i]);
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode1(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode2(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 28 + i];// 第二个28位是低位存储的,所以浪费的1比特在最顶端。
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode3(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode4(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode5(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode6(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode7(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode8(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 24; i++)
- out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 28 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode9(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode10(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++) {
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
-
- }
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode11(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode12(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode13(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode14(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode15(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode16(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode17(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 12; i++)
- out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 14 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode18(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 9 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode19(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 9 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode20(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 9 + i];
-
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode21(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 9 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode22(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 9 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode23(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 9 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode24(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 9 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode25(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 9 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode26(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 8; i++)
- out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 9 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode27(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode28(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode29(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode30(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode31(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode32(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode33(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode34(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode35(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 6; i++)
- out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 7 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode36(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode37(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode38(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode39(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode40(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode41(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode42(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode43(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode44(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 4; i++)
- out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
- out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 5 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode45(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode46(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode47(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode48(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode49(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode50(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode51(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode52(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode53(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 3; i++)
- out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 4 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode54(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode55(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode56(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode57(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode58(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode59(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode60(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode61(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode62(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- for (int i = 0; i < 2; i++)
- out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
- out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
- out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 3 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode63(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
-
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode64(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode65(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode66(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode67(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode68(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode69(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode70(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode71(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 14) + in[inf];
- out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 2 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode72(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
-
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 28; i++)
- out[outf + 1] = (out[outf + 1] << 1) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode73(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 14; i++)
- out[outf + 1] = (out[outf + 1] << 2) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode74(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 9; i++)
- out[outf + 1] = (out[outf + 1] << 3) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode75(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 7; i++)
- out[outf + 1] = (out[outf + 1] << 4) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode76(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 5; i++)
- out[outf + 1] = (out[outf + 1] << 5) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode77(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 4; i++)
- out[outf + 1] = (out[outf + 1] << 7) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode78(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 3; i++)
- out[outf + 1] = (out[outf + 1] << 9) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode79(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 2; i++)
- out[outf + 1] = (out[outf + 1] << 14) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- private void encode80(final int[] in, final int inf, final int code, final int[] out,
- final int outf) {
- out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
- out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
- for (int i = 0; i < 1; i++)
- out[outf + 1] = (out[outf + 1] << 28) + in[inf + 1 + i];
- out[outf + 0] = code << 24 | out[outf + 0];
-
- }
-
- @Override
- public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
- if (inlength == 0)
- return;
- final int outlength = in[inpos.get()];
- inpos.increment();
- headlessUncompress(in, inpos, inlength, out, outpos, outlength);
- }
-
-
-
- private void decode80(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode79(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
- // number :2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode78(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 27);
- // number : 3, bitwidth :9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode77(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode76(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 25);
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode75(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode74(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 27);
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode73(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode72(int val, int valn, int[] out, int currentPos) {
- // number : 1, bitwidth : 28
- out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode71(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode70(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode69(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 27);
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode68(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode67(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 25);
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode66(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode65(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 27);
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode64(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode63(int val, int valn, int[] out, int currentPos) {
- // number : 2, bitwidth : 14
- out[currentPos++] = (val << 8) >>> 18;
- out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode62(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode61(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode60(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 27);
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode59(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode58(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 25);
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode57(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode56(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 27);
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode55(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode54(int val, int valn, int[] out, int currentPos) {
- // number : 3, bitwidth : 9
- out[currentPos++] = (val << 8) >>> 23;
- out[currentPos++] = (val << 17) >>> 23;
- out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode53(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode52(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode51(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 27);
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode50(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode49(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 25);
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode48(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode47(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 27);
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode46(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode45(int val, int valn, int[] out, int currentPos) {
- // number : 4, bitwidth : 7
- out[currentPos++] = (val << 8) >>> 25;
- out[currentPos++] = (val << 15) >>> 25;
- out[currentPos++] = (val << 22) >>> 25;
- out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode44(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode43(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode42(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 27);
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode41(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode40(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 25);
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode39(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode38(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 27);
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode37(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode36(int val, int valn, int[] out, int currentPos) {
- // number : 5, bitwidth : 5
- out[currentPos++] = (val << 8) >>> 27;
- out[currentPos++] = (val << 13) >>> 27;
- out[currentPos++] = (val << 18) >>> 27;
- out[currentPos++] = (val << 23) >>> 27;
- out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode35(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 0) >>> 28;
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode34(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 0) >>> 28;
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode33(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 1) >>> 28;
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode32(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 0) >>> 28;
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode31(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 3) >>> 28;
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode30(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 0) >>> 28;
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode29(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 1) >>> 28;
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode28(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 0) >>> 28;
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode27(int val, int valn, int[] out, int currentPos) {
- // number : 7, bitwidth : 4
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- out[currentPos++] = (valn << 0) >>> 28;
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode26(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 1) >>> 29;
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode25(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 1) >>> 29;
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode24(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 2) >>> 29;
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode23(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 1) >>> 29;
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode22(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 4) >>> 29;
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode21(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 1) >>> 29;
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode20(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 2) >>> 29;
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode19(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 1) >>> 29;
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode18(int val, int valn, int[] out, int currentPos) {
- // number : 9, bitwidth : 3
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- out[currentPos++] = (valn << 1) >>> 29;
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode17(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 0) >>> 30;
- out[currentPos++] = (valn << 2) >>> 30;
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode16(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 0) >>> 30;
- out[currentPos++] = (valn << 2) >>> 30;
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode15(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 1) >>> 30;
- out[currentPos++] = (valn << 3) >>> 30;
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode14(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 0) >>> 30;
- out[currentPos++] = (valn << 2) >>> 30;
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode13(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 3) >>> 30;
- out[currentPos++] = (valn << 5) >>> 30;
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
-
- }
-
- private void decode12(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 0) >>> 30;
- out[currentPos++] = (valn << 2) >>> 30;
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
-
- }
-
- private void decode11(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 1) >>> 30;
- out[currentPos++] = (valn << 3) >>> 30;
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
-
- }
-
- private void decode10(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 0) >>> 30;
- out[currentPos++] = (valn << 2) >>> 30;
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode9(int val, int valn, int[] out, int currentPos) {
- // number : 14, bitwidth : 2
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- out[currentPos++] = (valn << 0) >>> 30;
- out[currentPos++] = (valn << 2) >>> 30;
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
- private void decode8(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = valn >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- // number : 1, bitwidth : 28
- out[currentPos++] = (valn << 4) >>> 4;
- }
-
- private void decode7(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = valn >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- // number : 2, bitwidth : 14
- out[currentPos++] = (valn << 4) >>> 18;
- out[currentPos++] = (valn << 18) >>> 18;
- }
-
- private void decode6(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- out[currentPos++] = (valn << 4) >>> 31;
- // number : 3, bitwidth : 9
- out[currentPos++] = (valn << 5) >>> 23;
- out[currentPos++] = (valn << 14) >>> 23;
- out[currentPos++] = (valn << 23) >>> 23;
- }
-
- private void decode5(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = valn >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- // number : 4, bitwidth : 7
- out[currentPos++] = (valn << 4) >>> 25;
- out[currentPos++] = (valn << 11) >>> 25;
- out[currentPos++] = (valn << 18) >>> 25;
- out[currentPos++] = (valn << 25) >>> 25;
- }
-
- private void decode4(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;// 头部3bit
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- // number : 5, bitwidth : 5
- out[currentPos++] = (valn << 7) >>> 27;
- out[currentPos++] = (valn << 12) >>> 27;
- out[currentPos++] = (valn << 17) >>> 27;
- out[currentPos++] = (valn << 22) >>> 27;
- out[currentPos++] = (valn << 27) >>> 27;
- }
-
- private void decode3(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = valn >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- // number : 7, bitwidth : 4
- out[currentPos++] = (valn << 4) >>> 28;
- out[currentPos++] = (valn << 8) >>> 28;
- out[currentPos++] = (valn << 12) >>> 28;
- out[currentPos++] = (valn << 16) >>> 28;
- out[currentPos++] = (valn << 20) >>> 28;
- out[currentPos++] = (valn << 24) >>> 28;
- out[currentPos++] = (valn << 28) >>> 28;
- }
-
- private void decode2(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;// 头部1bit
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- out[currentPos++] = (valn << 4) >>> 31;
- // number : 9, bitwidth : 3
- out[currentPos++] = (valn << 5) >>> 29;
- out[currentPos++] = (valn << 8) >>> 29;
- out[currentPos++] = (valn << 11) >>> 29;
- out[currentPos++] = (valn << 14) >>> 29;
- out[currentPos++] = (valn << 17) >>> 29;
- out[currentPos++] = (valn << 20) >>> 29;
- out[currentPos++] = (valn << 23) >>> 29;
- out[currentPos++] = (valn << 26) >>> 29;
- out[currentPos++] = (valn << 29) >>> 29;
- }
-
- private void decode1(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31;// 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = valn >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- // number : 14, bitwidth : 2
- out[currentPos++] = (valn << 4) >>> 30;
- out[currentPos++] = (valn << 6) >>> 30;
- out[currentPos++] = (valn << 8) >>> 30;
- out[currentPos++] = (valn << 10) >>> 30;
- out[currentPos++] = (valn << 12) >>> 30;
- out[currentPos++] = (valn << 14) >>> 30;
- out[currentPos++] = (valn << 16) >>> 30;
- out[currentPos++] = (valn << 18) >>> 30;
- out[currentPos++] = (valn << 20) >>> 30;
- out[currentPos++] = (valn << 22) >>> 30; // 10
- out[currentPos++] = (valn << 24) >>> 30;
- out[currentPos++] = (valn << 26) >>> 30;
- out[currentPos++] = (valn << 28) >>> 30;
- out[currentPos++] = (valn << 30) >>> 30;
- }
-
- private void decode0(int val, int valn, int[] out, int currentPos) {
- // number : 28, bitwidth : 1
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- out[currentPos++] = valn >>> 31;
- out[currentPos++] = (valn << 1) >>> 31;
- out[currentPos++] = (valn << 2) >>> 31;
- out[currentPos++] = (valn << 3) >>> 31;
- // number : 28, bitwidth : 1
- out[currentPos++] = (valn << 4) >>> 31;
- out[currentPos++] = (valn << 5) >>> 31;
- out[currentPos++] = (valn << 6) >>> 31;
- out[currentPos++] = (valn << 7) >>> 31;
- out[currentPos++] = (valn << 8) >>> 31;
- out[currentPos++] = (valn << 9) >>> 31;
- out[currentPos++] = (valn << 10) >>> 31;
- out[currentPos++] = (valn << 11) >>> 31;
- out[currentPos++] = (valn << 12) >>> 31;
- out[currentPos++] = (valn << 13) >>> 31; // 10
- out[currentPos++] = (valn << 14) >>> 31;
- out[currentPos++] = (valn << 15) >>> 31;
- out[currentPos++] = (valn << 16) >>> 31;
- out[currentPos++] = (valn << 17) >>> 31;
- out[currentPos++] = (valn << 18) >>> 31;
- out[currentPos++] = (valn << 19) >>> 31;
- out[currentPos++] = (valn << 20) >>> 31;
- out[currentPos++] = (valn << 21) >>> 31;
- out[currentPos++] = (valn << 22) >>> 31;
- out[currentPos++] = (valn << 23) >>> 31; // 20
- out[currentPos++] = (valn << 24) >>> 31;
- out[currentPos++] = (valn << 25) >>> 31;
- out[currentPos++] = (valn << 26) >>> 31;
- out[currentPos++] = (valn << 27) >>> 31;
- out[currentPos++] = (valn << 28) >>> 31;
- out[currentPos++] = (valn << 29) >>> 31;
- out[currentPos++] = (valn << 30) >>> 31;
- out[currentPos++] = (valn << 31) >>> 31;
- }
-
-
- private final static int bitLength[] = { 1, 2, 3, 4, 5, 7, 9, 14, 28 };
-
- private final static int codeNum[] = { 28, 14, 9, 7, 5, 4, 3, 2, 1 };
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-
- @Override
- public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
- int tmpoutpos = outpos.get();
- int currentPos = inpos.get();
- int selector1 = 0;
- int selector2 = 0;
- final int finalin = currentPos + inlength;
- while (currentPos < finalin - 28 * 2) {
- int nextCurrentPos = currentPos;
- mainloop1: for (selector1=0; selector1 <= 8; selector1++) {
- int compressedNum = codeNum[selector1];
- //if (finalin <= nextCurrentPos + compressedNum - 1)
- // compressedNum = finalin - nextCurrentPos;
- int b = bitLength[selector1];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++) {
- if (Util.smallerorequalthan(max, in[nextCurrentPos + i]))
- continue mainloop1;
- }
- nextCurrentPos += compressedNum;
- break;
- }
- mainloop2: for (selector2 = 0; selector2 <= 8; selector2++) {
- int compressedNum = codeNum[selector2];
- //if (finalin <= nextCurrentPos + compressedNum - 1)
- // compressedNum = finalin - nextCurrentPos;
- int b = bitLength[selector2];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++) {
- if (Util.smallerorequalthan(max, in[nextCurrentPos + i]))
- continue mainloop2;
- }
- nextCurrentPos += compressedNum;
- break;
- }
- int code = M[selector1][selector2];
- out[tmpoutpos] = 0;
- out[tmpoutpos + 1] = 0;
- switch (code) {
- case 0:
- encode0(in, currentPos, code, out, tmpoutpos);
- break;
- case 1:
- encode1(in, currentPos, code, out, tmpoutpos);
- break;
- case 2:
- encode2(in, currentPos, code, out, tmpoutpos);
- break;
- case 3:
- encode3(in, currentPos, code, out, tmpoutpos);
- break;
- case 4:
- encode4(in, currentPos, code, out, tmpoutpos);
- break;
- case 5:
- encode5(in, currentPos, code, out, tmpoutpos);
- break;
- case 6:
- encode6(in, currentPos, code, out, tmpoutpos);
- break;
- case 7:
- encode7(in, currentPos, code, out, tmpoutpos);
- break;
- case 8:
- encode8(in, currentPos, code, out, tmpoutpos);
- break;
- case 9:
- encode9(in, currentPos, code, out, tmpoutpos);
- break;
- case 10:
- encode10(in, currentPos, code, out, tmpoutpos);
- break;
- case 11:
- encode11(in, currentPos, code, out, tmpoutpos);
- break;
- case 12:
- encode12(in, currentPos, code, out, tmpoutpos);
- break;
- case 13:
- encode13(in, currentPos, code, out, tmpoutpos);
- break;
- case 14:
- encode14(in, currentPos, code, out, tmpoutpos);
- break;
- case 15:
- encode15(in, currentPos, code, out, tmpoutpos);
- break;
- case 16:
- encode16(in, currentPos, code, out, tmpoutpos);
- break;
- case 17:
- encode17(in, currentPos, code, out, tmpoutpos);
- break;
- case 18:
- encode18(in, currentPos, code, out, tmpoutpos);
- break;
- case 19:
- encode19(in, currentPos, code, out, tmpoutpos);
- break;
- case 20:
- encode20(in, currentPos, code, out, tmpoutpos);
- break;
- case 21:
- encode21(in, currentPos, code, out, tmpoutpos);
- break;
- case 22:
- encode22(in, currentPos, code, out, tmpoutpos);
- break;
- case 23:
- encode23(in, currentPos, code, out, tmpoutpos);
- break;
- case 24:
- encode24(in, currentPos, code, out, tmpoutpos);
- break;
- case 25:
- encode25(in, currentPos, code, out, tmpoutpos);
- break;
- case 26:
- encode26(in, currentPos, code, out, tmpoutpos);
- break;
- case 27:
- encode27(in, currentPos, code, out, tmpoutpos);
- break;
- case 28:
- encode28(in, currentPos, code, out, tmpoutpos);
- break;
- case 29:
- encode29(in, currentPos, code, out, tmpoutpos);
- break;
- case 30:
- encode30(in, currentPos, code, out, tmpoutpos);
- break;
- case 31:
- encode31(in, currentPos, code, out, tmpoutpos);
- break;
- case 32:
- encode32(in, currentPos, code, out, tmpoutpos);
- break;
- case 33:
- encode33(in, currentPos, code, out, tmpoutpos);
- break;
- case 34:
- encode34(in, currentPos, code, out, tmpoutpos);
- break;
- case 35:
- encode35(in, currentPos, code, out, tmpoutpos);
- break;
- case 36:
- encode36(in, currentPos, code, out, tmpoutpos);
- break;
- case 37:
- encode37(in, currentPos, code, out, tmpoutpos);
- break;
- case 38:
- encode38(in, currentPos, code, out, tmpoutpos);
- break;
- case 39:
- encode39(in, currentPos, code, out, tmpoutpos);
- break;
- case 40:
- encode40(in, currentPos, code, out, tmpoutpos);
- break;
- case 41:
- encode41(in, currentPos, code, out, tmpoutpos);
- break;
- case 42:
- encode42(in, currentPos, code, out, tmpoutpos);
- break;
- case 43:
- encode43(in, currentPos, code, out, tmpoutpos);
- break;
- case 44:
- encode44(in, currentPos, code, out, tmpoutpos);
- break;
- case 45:
- encode45(in, currentPos, code, out, tmpoutpos);
- break;
- case 46:
- encode46(in, currentPos, code, out, tmpoutpos);
- break;
- case 47:
- encode47(in, currentPos, code, out, tmpoutpos);
- break;
- case 48:
- encode48(in, currentPos, code, out, tmpoutpos);
- break;
- case 49:
- encode49(in, currentPos, code, out, tmpoutpos);
- break;
- case 50:
- encode50(in, currentPos, code, out, tmpoutpos);
- break;
- case 51:
- encode51(in, currentPos, code, out, tmpoutpos);
- break;
- case 52:
- encode52(in, currentPos, code, out, tmpoutpos);
- break;
- case 53:
- encode53(in, currentPos, code, out, tmpoutpos);
- break;
- case 54:
- encode54(in, currentPos, code, out, tmpoutpos);
- break;
- case 55:
- encode55(in, currentPos, code, out, tmpoutpos);
- break;
- case 56:
- encode56(in, currentPos, code, out, tmpoutpos);
- break;
- case 57:
- encode57(in, currentPos, code, out, tmpoutpos);
- break;
- case 58:
- encode58(in, currentPos, code, out, tmpoutpos);
- break;
- case 59:
- encode59(in, currentPos, code, out, tmpoutpos);
- break;
- case 60:
- encode60(in, currentPos, code, out, tmpoutpos);
- break;
- case 61:
- encode61(in, currentPos, code, out, tmpoutpos);
- break;
- case 62:
- encode62(in, currentPos, code, out, tmpoutpos);
- break;
- case 63:
- encode63(in, currentPos, code, out, tmpoutpos);
- break;
- case 64:
- encode64(in, currentPos, code, out, tmpoutpos);
- break;
- case 65:
- encode65(in, currentPos, code, out, tmpoutpos);
- break;
- case 66:
- encode66(in, currentPos, code, out, tmpoutpos);
- break;
- case 67:
- encode67(in, currentPos, code, out, tmpoutpos);
- break;
- case 68:
- encode68(in, currentPos, code, out, tmpoutpos);
- break;
- case 69:
- encode69(in, currentPos, code, out, tmpoutpos);
- break;
- case 70:
- encode70(in, currentPos, code, out, tmpoutpos);
- break;
- case 71:
- encode71(in, currentPos, code, out, tmpoutpos);
- break;
- case 72:
- encode72(in, currentPos, code, out, tmpoutpos);
- break;
- case 73:
- encode73(in, currentPos, code, out, tmpoutpos);
- break;
- case 74:
- encode74(in, currentPos, code, out, tmpoutpos);
- break;
- case 75:
- encode75(in, currentPos, code, out, tmpoutpos);
- break;
- case 76:
- encode76(in, currentPos, code, out, tmpoutpos);
- break;
- case 77:
- encode77(in, currentPos, code, out, tmpoutpos);
- break;
- case 78:
- encode78(in, currentPos, code, out, tmpoutpos);
- break;
- case 79:
- encode79(in, currentPos, code, out, tmpoutpos);
- break;
- case 80:
- encode80(in, currentPos, code, out, tmpoutpos);
- break;
- default:
- throw new RuntimeException("unsupported code");
- }// end switch
- tmpoutpos += 2;
- currentPos = nextCurrentPos;
- }
-
- outer: while (currentPos < finalin) {
- mainloop: for (int selector = 0; selector < 8; selector++) {
- int res = 0;
- int compressedNum = codeNum[selector];
- if (finalin <= currentPos + compressedNum - 1)
- compressedNum = finalin - currentPos;
- int b = bitLength[selector];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++) {
- if (Util.smallerorequalthan(max, in[currentPos + i]))
- continue mainloop;
- res = (res << b) + in[currentPos + i];
- }
- if (compressedNum != codeNum[selector]) {
- res <<= (codeNum[selector] - compressedNum) * b;
- }
- res |= selector << 28;
- out[tmpoutpos++] = res;
-
- currentPos += compressedNum;
- continue outer;
- }
- final int selector = 8;
- out[tmpoutpos++] = in[currentPos++] | (selector << 28);
- }
- inpos.set(currentPos);
- outpos.set(tmpoutpos);
- }
-
- @Override
- public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos, int num) {
- int currentPos = outpos.get();
- int tmpinpos = inpos.get();
- final int finalout = currentPos + num;
- while (currentPos < finalout - 2 * 28) {
-
- int val = in[tmpinpos++];
- int valn = in[tmpinpos++];
- int header = val >>> 24;
- switch (header) {
- case 0: {
- decode0(val, valn, out, currentPos);
- currentPos+=56;
- break;
- }
- case 1: {
- decode1(val, valn, out, currentPos);
- currentPos+=42;
- break;
- }
- case 2: {
- decode2(val, valn, out, currentPos);
- currentPos+=37;
- break;
- }
- case 3: {
- decode3(val, valn, out, currentPos);
- currentPos+=35;
- break;
- }
- case 4: {
- decode4(val, valn, out, currentPos);
- currentPos+=33;
- break;
- }
- case 5: {
- decode5(val, valn, out, currentPos);
- currentPos+=32;
- break;
- }
- case 6: {
- decode6(val, valn, out, currentPos);
- currentPos+=31;
- break;
- }
- case 7: {
- decode7(val, valn, out, currentPos);
- currentPos+=30;
- break;
- }
- case 8: {
- decode8(val, valn, out, currentPos);
- currentPos+=29;
- break;
- }
- case 9: {
- decode9(val, valn, out, currentPos);
- currentPos+=42;
- break;
- }
- case 10: {
- decode10(val, valn, out, currentPos);
- currentPos+=28;
- break;
- }
- case 11: {
- decode11(val, valn, out, currentPos);
- currentPos+=23;
- break;
- }
- case 12: {
- decode12(val, valn, out, currentPos);
- currentPos+=21;
- break;
- }
- case 13: {
- decode13(val, valn, out, currentPos);
- currentPos+=19;
- break;
- }
- case 14: {
- decode14(val, valn, out, currentPos);
- currentPos+=18;
- break;
- }
- case 15: {
- decode15(val, valn, out, currentPos);
- currentPos+=17;
- break;
- }
- case 16: {
- decode16(val, valn, out, currentPos);
- currentPos+=16;
- break;
- }
- case 17: {
- decode17(val, valn, out, currentPos);
- currentPos+=15;
- break;
- }
- case 18: {
- decode18(val, valn, out, currentPos);
- currentPos+=37;
- break;
- }
- case 19: {
- decode19(val, valn, out, currentPos);
- currentPos+=23;
- break;
- }
- case 20: {
- decode20(val, valn, out, currentPos);
- currentPos+=18;
- break;
- }
- case 21: {
- decode21(val, valn, out, currentPos);
- currentPos+=16;
- break;
- }
- case 22: {
- decode22(val, valn, out, currentPos);
- currentPos+=14;
- break;
- }
- case 23: {
- decode23(val, valn, out, currentPos);
- currentPos+=13;
- break;
- }
- case 24: {
- decode24(val, valn, out, currentPos);
- currentPos+=12;
- break;
- }
- case 25: {
- decode25(val, valn, out, currentPos);
- currentPos+=11;
- break;
- }
- case 26: {
- decode26(val, valn, out, currentPos);
- currentPos+=10;
- break;
- }
- case 27: {
- decode27(val, valn, out, currentPos);
- currentPos+=35;
- break;
- }
- case 28: {
- decode28(val, valn, out, currentPos);
- currentPos+=21;
- break;
- }
- case 29: {
- decode29(val, valn, out, currentPos);
- currentPos+=16;
- break;
- }
-
- case 30: {
- decode30(val, valn, out, currentPos);
- currentPos+=14;
- break;
- }
- case 31: {
- decode31(val, valn, out, currentPos);
- currentPos+=12;
- break;
- }
- case 32: {
- decode32(val, valn, out, currentPos);
- currentPos+=11;
- break;
- }
- case 33: {
- decode33(val, valn, out, currentPos);
- currentPos+=10;
- break;
- }
- case 34: {
- decode34(val, valn, out, currentPos);
- currentPos+=9;
- break;
- }
- case 35: {
- decode35(val, valn, out, currentPos);
- currentPos+=8;
- break;
- }
- case 36: {
- decode36(val, valn, out, currentPos);
- currentPos+=33;
- break;
- }
- case 37: {
- decode37(val, valn, out, currentPos);
- currentPos+=19;
- break;
- }
- case 38: {
- decode38(val, valn, out, currentPos);
- currentPos+=14;
- break;
- }
- case 39: {
- decode39(val, valn, out, currentPos);
- currentPos+=12;
- break;
- }
- case 40: {
- decode40(val, valn, out, currentPos);
- currentPos+=10;
- break;
- }
- case 41: {
- decode41(val, valn, out, currentPos);
- currentPos+=9;
- break;
- }
- case 42: {
- decode42(val, valn, out, currentPos);
- currentPos+=8;
- break;
- }
- case 43: {
- decode43(val, valn, out, currentPos);
- currentPos+=7;
- break;
- }
- case 44: {
- decode44(val, valn, out, currentPos);
- currentPos+=6;
- break;
- }
- case 45: {
- decode45(val, valn, out, currentPos);
- currentPos+=32;
- break;
- }
- case 46: {
- decode46(val, valn, out, currentPos);
- currentPos+=18;
- break;
- }
- case 47: {
- decode47(val, valn, out, currentPos);
- currentPos+=13;
- break;
- }
- case 48: {
- decode48(val, valn, out, currentPos);
- currentPos+=11;
- break;
- }
- case 49: {
- decode49(val, valn, out, currentPos);
- currentPos+=9;
- break;
- }
- case 50: {
- decode50(val, valn, out, currentPos);
- currentPos+=8;
- break;
- }
- case 51: {
- decode51(val, valn, out, currentPos);
- currentPos+=7;
- break;
- }
- case 52: {
- decode52(val, valn, out, currentPos);
- currentPos+=6;
- break;
- }
- case 53: {
- decode53(val, valn, out, currentPos);
- currentPos+=5;
- break;
- }
- case 54: {
- decode54(val, valn, out, currentPos);
- currentPos+=31;
- break;
- }
- case 55: {
- decode55(val, valn, out, currentPos);
- currentPos+=17;
- break;
- }
- case 56: {
- decode56(val, valn, out, currentPos);
- currentPos+=12;
- break;
- }
- case 57: {
- decode57(val, valn, out, currentPos);
- currentPos+=10;
- break;
- }
- case 58: {
- decode58(val, valn, out, currentPos);
- currentPos+=8;
- break;
- }
- case 59: {
- decode59(val, valn, out, currentPos);
- currentPos+=7;
- break;
- }
- case 60: {
- decode60(val, valn, out, currentPos);
- currentPos+=6;
- break;
- }
- case 61: {
- decode61(val, valn, out, currentPos);
- currentPos+=5;
- break;
- }
- case 62: {
- decode62(val, valn, out, currentPos);
- currentPos+=4;
- break;
- }
- case 63: {
- decode63(val, valn, out, currentPos);
- currentPos+=30;
- break;
- }
- case 64: {
- decode64(val, valn, out, currentPos);
- currentPos+=16;
- break;
- }
- case 65: {
- decode65(val, valn, out, currentPos);
- currentPos+=11;
- break;
- }
- case 66: {
- decode66(val, valn, out, currentPos);
- currentPos+=9;
- break;
- }
- case 67: {
- decode67(val, valn, out, currentPos);
- currentPos+=7;
- break;
- }
- case 68: {
- decode68(val, valn, out, currentPos);
- currentPos+=6;
- break;
- }
- case 69: {
- decode69(val, valn, out, currentPos);
- currentPos+=5;
- break;
- }
- case 70: {
- decode70(val, valn, out, currentPos);
- currentPos+=4;
- break;
- }
- case 71: {
- decode71(val, valn, out, currentPos);
- currentPos+=3;
- break;
- }
- case 72: {
- decode72(val, valn, out, currentPos);
- currentPos+=29;
- break;
- }
- case 73: {
- decode73(val, valn, out, currentPos);
- currentPos+=15;
- break;
- }
- case 74: {
- decode74(val, valn, out, currentPos);
- currentPos+=10;
- break;
- }
- case 75: {
- decode75(val, valn, out, currentPos);
- currentPos+=8;
- break;
- }
- case 76: {
- decode76(val, valn, out, currentPos);
- currentPos+=6;
- break;
- }
- case 77: {
- decode77(val, valn, out, currentPos);
- currentPos+=5;
- break;
- }
- case 78: {
- decode78(val, valn, out, currentPos);
- currentPos+=4;
- break;
- }
- case 79: {
- decode79(val, valn, out, currentPos);
- currentPos+=3;
- break;
- }
- case 80: {
- decode80(val, valn, out, currentPos);
- currentPos+=2;
- break;
- }
- default:
- throw new RuntimeException("Wrong code: " + header);
- }// end switch
- } // end while
-
- while (currentPos < finalout) {
- int val = in[tmpinpos++];
- int header = val >>> 28;
- switch (header) {
- case 0: { // number : 28, bitwidth : 1
- final int howmany = finalout - currentPos < 28 ? finalout - currentPos : 28;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (k + 4)) >>> 31;
- }
- break;
- }
- case 1: { // number : 14, bitwidth : 2
- final int howmany = finalout - currentPos < 14 ? finalout - currentPos : 14;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (2 * k + 4)) >>> 30;
- }
- break;
- }
- case 2: { // number : 9, bitwidth : 3
- final int howmany = finalout - currentPos < 9 ? finalout - currentPos : 9;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (3 * k + 5)) >>> 29;
- }
- break;
- }
- case 3: { // number : 7, bitwidth : 4
- final int howmany = finalout - currentPos < 7 ? finalout - currentPos : 7;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (4 * k + 4)) >>> 28;
- }
- break;
- }
- case 4: { // number : 5, bitwidth : 5
- final int howmany = finalout - currentPos < 5 ? finalout - currentPos : 5;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (5 * k + 7)) >>> 27;
- }
- break;
- }
- case 5: { // number : 4, bitwidth : 7
- final int howmany = finalout - currentPos < 4 ? finalout - currentPos : 4;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (7 * k + 4)) >>> 25;
- }
- break;
- }
- case 6: { // number : 3, bitwidth : 9
- final int howmany = finalout - currentPos < 3 ? finalout - currentPos : 3;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (9 * k + 5)) >>> 23;
- }
- break;
- }
- case 7: { // number : 2, bitwidth : 14
- final int howmany = finalout - currentPos < 2 ? finalout - currentPos : 2;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (14 * k + 4)) >>> 18;
- }
- break;
- }
- case 8: { // number : 1, bitwidth : 28
- out[currentPos++] = (val << 4) >>> 4;
- break;
- }
- default: {
- throw new RuntimeException("shouldn't happen");
- }
- }
- }
-
- outpos.set(finalout);
- inpos.set(tmpinpos);
-
- }
-}
\ No newline at end of file
+ private static final int[][] M = { { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, { 9, 10, 11, 12, 13, 14, 15, 16, 17 },
+ { 18, 19, 20, 21, 22, 23, 24, 25, 26 }, { 27, 28, 29, 30, 31, 32, 33, 34, 35 },
+ { 36, 37, 38, 39, 40, 41, 42, 43, 44 }, { 45, 46, 47, 48, 49, 50, 51, 52, 53 },
+ { 54, 55, 56, 57, 58, 59, 60, 61, 62 }, { 63, 64, 65, 66, 67, 68, 69, 70, 71 },
+ { 72, 73, 74, 75, 76, 77, 78, 79, 80 } };
+
+ @Override
+ public void compress(int[] in, IntWrapper inpos, int inlength, int out[], IntWrapper outpos) {
+ if (inlength == 0)
+ return;
+ out[outpos.get()] = inlength;
+ outpos.increment();
+ headlessCompress(in, inpos, inlength, out, outpos);
+ }
+
+ private void encode0(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + (in[inf + i]);
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode1(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode2(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 28 + i];// 第二个28位是低位存储的,所以浪费的1比特在最顶端。
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode3(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode4(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode5(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode6(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode7(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode8(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 24; i++)
+ out[outf + 0] = (out[outf + 0] << 1) + in[inf + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 24 + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 28 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode9(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode10(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++) {
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+
+ }
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode11(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode12(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode13(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode14(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode15(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode16(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode17(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 12; i++)
+ out[outf + 0] = (out[outf + 0] << 2) + in[inf + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 12 + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 14 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode18(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 9 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode19(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 9 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode20(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 9 + i];
+
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode21(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 9 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode22(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 9 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode23(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 9 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode24(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 9 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode25(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 9 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode26(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 8; i++)
+ out[outf + 0] = (out[outf + 0] << 3) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 8 + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 9 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode27(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode28(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode29(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode30(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode31(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode32(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode33(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode34(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode35(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 6; i++)
+ out[outf + 0] = (out[outf + 0] << 4) + in[inf + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 6 + i];
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 7 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode36(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode37(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode38(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode39(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode40(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode41(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode42(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode43(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode44(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 4; i++)
+ out[outf + 0] = (out[outf + 0] << 5) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 4) + (in[inf + 4] >>> 1);
+ out[outf + 1] = (out[outf + 1] << 1) + ((in[inf + 4] << 31) >>> 31);
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 5 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode45(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode46(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode47(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode48(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode49(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode50(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode51(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode52(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode53(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 3; i++)
+ out[outf + 0] = (out[outf + 0] << 7) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 3) + (in[inf + 3] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 3] << 28) >>> 28);
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 4 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode54(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode55(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode56(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode57(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode58(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode59(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode60(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode61(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode62(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ for (int i = 0; i < 2; i++)
+ out[outf + 0] = (out[outf + 0] << 9) + in[inf + i];
+ out[outf + 0] = (out[outf + 0] << 6) + (in[inf + 2] >>> 3);
+ out[outf + 1] = (out[outf + 1] << 3) + ((in[inf + 2] << 29) >>> 29);
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 3 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode63(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode64(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode65(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode66(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode67(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode68(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode69(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode70(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode71(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 14) + in[inf];
+ out[outf + 0] = (out[outf + 0] << 10) + (in[inf + 1] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf + 1] << 28) >>> 28);
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 2 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode72(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 28; i++)
+ out[outf + 1] = (out[outf + 1] << 1) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode73(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 14; i++)
+ out[outf + 1] = (out[outf + 1] << 2) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode74(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 9; i++)
+ out[outf + 1] = (out[outf + 1] << 3) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode75(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 7; i++)
+ out[outf + 1] = (out[outf + 1] << 4) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode76(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 5; i++)
+ out[outf + 1] = (out[outf + 1] << 5) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode77(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 4; i++)
+ out[outf + 1] = (out[outf + 1] << 7) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode78(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 3; i++)
+ out[outf + 1] = (out[outf + 1] << 9) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode79(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 2; i++)
+ out[outf + 1] = (out[outf + 1] << 14) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ private void encode80(final int[] in, final int inf, final int code, final int[] out,
+ final int outf) {
+ out[outf + 0] = (out[outf + 0] << 24) + (in[inf] >>> 4);
+ out[outf + 1] = (out[outf + 1] << 4) + ((in[inf] << 28) >>> 28);
+ for (int i = 0; i < 1; i++)
+ out[outf + 1] = (out[outf + 1] << 28) + in[inf + 1 + i];
+ out[outf + 0] = code << 24 | out[outf + 0];
+
+ }
+
+ @Override
+ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
+ if (inlength == 0)
+ return;
+ final int outlength = in[inpos.get()];
+ inpos.increment();
+ headlessUncompress(in, inpos, inlength, out, outpos, outlength);
+ }
+
+
+
+ private void decode80(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode79(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
+ // number :2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode78(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 27);
+ // number : 3, bitwidth :9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode77(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode76(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 25);
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode75(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode74(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 27);
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode73(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode72(int val, int valn, int[] out, int currentPos) {
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 8) >>> 4 | (valn >>> 28);
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode71(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode70(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode69(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 27);
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode68(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode67(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 25);
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode66(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode65(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 27);
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode64(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode63(int val, int valn, int[] out, int currentPos) {
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 8) >>> 18;
+ out[currentPos++] = (val << 22) >>> 18 | (valn >>> 28);
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode62(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode61(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode60(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 27);
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode59(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode58(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 25);
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode57(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode56(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 27);
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode55(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode54(int val, int valn, int[] out, int currentPos) {
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 8) >>> 23;
+ out[currentPos++] = (val << 17) >>> 23;
+ out[currentPos++] = (val << 26) >>> 23 | (valn >>> 28);
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode53(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode52(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode51(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 27);
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode50(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode49(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 25);
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode48(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode47(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 27);
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode46(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode45(int val, int valn, int[] out, int currentPos) {
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 8) >>> 25;
+ out[currentPos++] = (val << 15) >>> 25;
+ out[currentPos++] = (val << 22) >>> 25;
+ out[currentPos++] = (val << 29) >>> 25 | (valn >>> 28);
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode44(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode43(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode42(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 27);
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode41(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode40(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 25);
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode39(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode38(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 27);
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode37(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode36(int val, int valn, int[] out, int currentPos) {
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 8) >>> 27;
+ out[currentPos++] = (val << 13) >>> 27;
+ out[currentPos++] = (val << 18) >>> 27;
+ out[currentPos++] = (val << 23) >>> 27;
+ out[currentPos++] = (val << 28) >>> 27 | (valn >>> 28);
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode35(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 0) >>> 28;
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode34(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 0) >>> 28;
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode33(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 1) >>> 28;
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode32(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 0) >>> 28;
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode31(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 3) >>> 28;
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode30(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 0) >>> 28;
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode29(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 1) >>> 28;
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode28(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 0) >>> 28;
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode27(int val, int valn, int[] out, int currentPos) {
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ out[currentPos++] = (valn << 0) >>> 28;
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode26(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 1) >>> 29;
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode25(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 1) >>> 29;
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode24(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 2) >>> 29;
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode23(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 1) >>> 29;
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode22(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 4) >>> 29;
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode21(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 1) >>> 29;
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode20(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 2) >>> 29;
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode19(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 1) >>> 29;
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode18(int val, int valn, int[] out, int currentPos) {
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ out[currentPos++] = (valn << 1) >>> 29;
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode17(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 0) >>> 30;
+ out[currentPos++] = (valn << 2) >>> 30;
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode16(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 0) >>> 30;
+ out[currentPos++] = (valn << 2) >>> 30;
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode15(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 1) >>> 30;
+ out[currentPos++] = (valn << 3) >>> 30;
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode14(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 0) >>> 30;
+ out[currentPos++] = (valn << 2) >>> 30;
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode13(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 3) >>> 30;
+ out[currentPos++] = (valn << 5) >>> 30;
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+
+ }
+
+ private void decode12(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 0) >>> 30;
+ out[currentPos++] = (valn << 2) >>> 30;
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+
+ }
+
+ private void decode11(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 1) >>> 30;
+ out[currentPos++] = (valn << 3) >>> 30;
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+
+ }
+
+ private void decode10(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 0) >>> 30;
+ out[currentPos++] = (valn << 2) >>> 30;
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode9(int val, int valn, int[] out, int currentPos) {
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ out[currentPos++] = (valn << 0) >>> 30;
+ out[currentPos++] = (valn << 2) >>> 30;
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+ private void decode8(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = valn >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ // number : 1, bitwidth : 28
+ out[currentPos++] = (valn << 4) >>> 4;
+ }
+
+ private void decode7(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = valn >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ // number : 2, bitwidth : 14
+ out[currentPos++] = (valn << 4) >>> 18;
+ out[currentPos++] = (valn << 18) >>> 18;
+ }
+
+ private void decode6(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ out[currentPos++] = (valn << 4) >>> 31;
+ // number : 3, bitwidth : 9
+ out[currentPos++] = (valn << 5) >>> 23;
+ out[currentPos++] = (valn << 14) >>> 23;
+ out[currentPos++] = (valn << 23) >>> 23;
+ }
+
+ private void decode5(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = valn >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ // number : 4, bitwidth : 7
+ out[currentPos++] = (valn << 4) >>> 25;
+ out[currentPos++] = (valn << 11) >>> 25;
+ out[currentPos++] = (valn << 18) >>> 25;
+ out[currentPos++] = (valn << 25) >>> 25;
+ }
+
+ private void decode4(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;// 头部3bit
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ // number : 5, bitwidth : 5
+ out[currentPos++] = (valn << 7) >>> 27;
+ out[currentPos++] = (valn << 12) >>> 27;
+ out[currentPos++] = (valn << 17) >>> 27;
+ out[currentPos++] = (valn << 22) >>> 27;
+ out[currentPos++] = (valn << 27) >>> 27;
+ }
+
+ private void decode3(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = valn >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ // number : 7, bitwidth : 4
+ out[currentPos++] = (valn << 4) >>> 28;
+ out[currentPos++] = (valn << 8) >>> 28;
+ out[currentPos++] = (valn << 12) >>> 28;
+ out[currentPos++] = (valn << 16) >>> 28;
+ out[currentPos++] = (valn << 20) >>> 28;
+ out[currentPos++] = (valn << 24) >>> 28;
+ out[currentPos++] = (valn << 28) >>> 28;
+ }
+
+ private void decode2(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;// 头部1bit
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ out[currentPos++] = (valn << 4) >>> 31;
+ // number : 9, bitwidth : 3
+ out[currentPos++] = (valn << 5) >>> 29;
+ out[currentPos++] = (valn << 8) >>> 29;
+ out[currentPos++] = (valn << 11) >>> 29;
+ out[currentPos++] = (valn << 14) >>> 29;
+ out[currentPos++] = (valn << 17) >>> 29;
+ out[currentPos++] = (valn << 20) >>> 29;
+ out[currentPos++] = (valn << 23) >>> 29;
+ out[currentPos++] = (valn << 26) >>> 29;
+ out[currentPos++] = (valn << 29) >>> 29;
+ }
+
+ private void decode1(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31;// 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = valn >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ // number : 14, bitwidth : 2
+ out[currentPos++] = (valn << 4) >>> 30;
+ out[currentPos++] = (valn << 6) >>> 30;
+ out[currentPos++] = (valn << 8) >>> 30;
+ out[currentPos++] = (valn << 10) >>> 30;
+ out[currentPos++] = (valn << 12) >>> 30;
+ out[currentPos++] = (valn << 14) >>> 30;
+ out[currentPos++] = (valn << 16) >>> 30;
+ out[currentPos++] = (valn << 18) >>> 30;
+ out[currentPos++] = (valn << 20) >>> 30;
+ out[currentPos++] = (valn << 22) >>> 30; // 10
+ out[currentPos++] = (valn << 24) >>> 30;
+ out[currentPos++] = (valn << 26) >>> 30;
+ out[currentPos++] = (valn << 28) >>> 30;
+ out[currentPos++] = (valn << 30) >>> 30;
+ }
+
+ private void decode0(int val, int valn, int[] out, int currentPos) {
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ out[currentPos++] = valn >>> 31;
+ out[currentPos++] = (valn << 1) >>> 31;
+ out[currentPos++] = (valn << 2) >>> 31;
+ out[currentPos++] = (valn << 3) >>> 31;
+ // number : 28, bitwidth : 1
+ out[currentPos++] = (valn << 4) >>> 31;
+ out[currentPos++] = (valn << 5) >>> 31;
+ out[currentPos++] = (valn << 6) >>> 31;
+ out[currentPos++] = (valn << 7) >>> 31;
+ out[currentPos++] = (valn << 8) >>> 31;
+ out[currentPos++] = (valn << 9) >>> 31;
+ out[currentPos++] = (valn << 10) >>> 31;
+ out[currentPos++] = (valn << 11) >>> 31;
+ out[currentPos++] = (valn << 12) >>> 31;
+ out[currentPos++] = (valn << 13) >>> 31; // 10
+ out[currentPos++] = (valn << 14) >>> 31;
+ out[currentPos++] = (valn << 15) >>> 31;
+ out[currentPos++] = (valn << 16) >>> 31;
+ out[currentPos++] = (valn << 17) >>> 31;
+ out[currentPos++] = (valn << 18) >>> 31;
+ out[currentPos++] = (valn << 19) >>> 31;
+ out[currentPos++] = (valn << 20) >>> 31;
+ out[currentPos++] = (valn << 21) >>> 31;
+ out[currentPos++] = (valn << 22) >>> 31;
+ out[currentPos++] = (valn << 23) >>> 31; // 20
+ out[currentPos++] = (valn << 24) >>> 31;
+ out[currentPos++] = (valn << 25) >>> 31;
+ out[currentPos++] = (valn << 26) >>> 31;
+ out[currentPos++] = (valn << 27) >>> 31;
+ out[currentPos++] = (valn << 28) >>> 31;
+ out[currentPos++] = (valn << 29) >>> 31;
+ out[currentPos++] = (valn << 30) >>> 31;
+ out[currentPos++] = (valn << 31) >>> 31;
+ }
+
+
+ private final static int bitLength[] = { 1, 2, 3, 4, 5, 7, 9, 14, 28 };
+
+ private final static int codeNum[] = { 28, 14, 9, 7, 5, 4, 3, 2, 1 };
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+
+ @Override
+ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
+ int tmpoutpos = outpos.get();
+ int currentPos = inpos.get();
+ int selector1 = 0;
+ int selector2 = 0;
+ final int finalin = currentPos + inlength;
+ while (currentPos < finalin - 28 * 2) {
+ int nextCurrentPos = currentPos;
+ mainloop1: for (selector1=0; selector1 <= 8; selector1++) {
+ int compressedNum = codeNum[selector1];
+ //if (finalin <= nextCurrentPos + compressedNum - 1)
+ // compressedNum = finalin - nextCurrentPos;
+ int b = bitLength[selector1];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++) {
+ if (Util.smallerorequalthan(max, in[nextCurrentPos + i]))
+ continue mainloop1;
+ }
+ nextCurrentPos += compressedNum;
+ break;
+ }
+ mainloop2: for (selector2 = 0; selector2 <= 8; selector2++) {
+ int compressedNum = codeNum[selector2];
+ //if (finalin <= nextCurrentPos + compressedNum - 1)
+ // compressedNum = finalin - nextCurrentPos;
+ int b = bitLength[selector2];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++) {
+ if (Util.smallerorequalthan(max, in[nextCurrentPos + i]))
+ continue mainloop2;
+ }
+ nextCurrentPos += compressedNum;
+ break;
+ }
+ int code = M[selector1][selector2];
+ out[tmpoutpos] = 0;
+ out[tmpoutpos + 1] = 0;
+ switch (code) {
+ case 0:
+ encode0(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 1:
+ encode1(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 2:
+ encode2(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 3:
+ encode3(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 4:
+ encode4(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 5:
+ encode5(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 6:
+ encode6(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 7:
+ encode7(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 8:
+ encode8(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 9:
+ encode9(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 10:
+ encode10(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 11:
+ encode11(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 12:
+ encode12(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 13:
+ encode13(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 14:
+ encode14(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 15:
+ encode15(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 16:
+ encode16(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 17:
+ encode17(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 18:
+ encode18(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 19:
+ encode19(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 20:
+ encode20(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 21:
+ encode21(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 22:
+ encode22(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 23:
+ encode23(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 24:
+ encode24(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 25:
+ encode25(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 26:
+ encode26(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 27:
+ encode27(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 28:
+ encode28(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 29:
+ encode29(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 30:
+ encode30(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 31:
+ encode31(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 32:
+ encode32(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 33:
+ encode33(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 34:
+ encode34(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 35:
+ encode35(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 36:
+ encode36(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 37:
+ encode37(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 38:
+ encode38(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 39:
+ encode39(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 40:
+ encode40(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 41:
+ encode41(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 42:
+ encode42(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 43:
+ encode43(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 44:
+ encode44(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 45:
+ encode45(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 46:
+ encode46(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 47:
+ encode47(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 48:
+ encode48(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 49:
+ encode49(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 50:
+ encode50(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 51:
+ encode51(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 52:
+ encode52(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 53:
+ encode53(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 54:
+ encode54(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 55:
+ encode55(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 56:
+ encode56(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 57:
+ encode57(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 58:
+ encode58(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 59:
+ encode59(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 60:
+ encode60(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 61:
+ encode61(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 62:
+ encode62(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 63:
+ encode63(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 64:
+ encode64(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 65:
+ encode65(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 66:
+ encode66(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 67:
+ encode67(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 68:
+ encode68(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 69:
+ encode69(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 70:
+ encode70(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 71:
+ encode71(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 72:
+ encode72(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 73:
+ encode73(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 74:
+ encode74(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 75:
+ encode75(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 76:
+ encode76(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 77:
+ encode77(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 78:
+ encode78(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 79:
+ encode79(in, currentPos, code, out, tmpoutpos);
+ break;
+ case 80:
+ encode80(in, currentPos, code, out, tmpoutpos);
+ break;
+ default:
+ throw new RuntimeException("unsupported code");
+ }// end switch
+ tmpoutpos += 2;
+ currentPos = nextCurrentPos;
+ }
+
+ outer: while (currentPos < finalin) {
+ mainloop: for (int selector = 0; selector < 8; selector++) {
+ int res = 0;
+ int compressedNum = codeNum[selector];
+ if (finalin <= currentPos + compressedNum - 1)
+ compressedNum = finalin - currentPos;
+ int b = bitLength[selector];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++) {
+ if (Util.smallerorequalthan(max, in[currentPos + i]))
+ continue mainloop;
+ res = (res << b) + in[currentPos + i];
+ }
+ if (compressedNum != codeNum[selector]) {
+ res <<= (codeNum[selector] - compressedNum) * b;
+ }
+ res |= selector << 28;
+ out[tmpoutpos++] = res;
+
+ currentPos += compressedNum;
+ continue outer;
+ }
+ final int selector = 8;
+ out[tmpoutpos++] = in[currentPos++] | (selector << 28);
+ }
+ inpos.set(currentPos);
+ outpos.set(tmpoutpos);
+ }
+
+ @Override
+ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos, int num) {
+ int currentPos = outpos.get();
+ int tmpinpos = inpos.get();
+ final int finalout = currentPos + num;
+ while (currentPos < finalout - 2 * 28) {
+
+ int val = in[tmpinpos++];
+ int valn = in[tmpinpos++];
+ int header = val >>> 24;
+ switch (header) {
+ case 0: {
+ decode0(val, valn, out, currentPos);
+ currentPos+=56;
+ break;
+ }
+ case 1: {
+ decode1(val, valn, out, currentPos);
+ currentPos+=42;
+ break;
+ }
+ case 2: {
+ decode2(val, valn, out, currentPos);
+ currentPos+=37;
+ break;
+ }
+ case 3: {
+ decode3(val, valn, out, currentPos);
+ currentPos+=35;
+ break;
+ }
+ case 4: {
+ decode4(val, valn, out, currentPos);
+ currentPos+=33;
+ break;
+ }
+ case 5: {
+ decode5(val, valn, out, currentPos);
+ currentPos+=32;
+ break;
+ }
+ case 6: {
+ decode6(val, valn, out, currentPos);
+ currentPos+=31;
+ break;
+ }
+ case 7: {
+ decode7(val, valn, out, currentPos);
+ currentPos+=30;
+ break;
+ }
+ case 8: {
+ decode8(val, valn, out, currentPos);
+ currentPos+=29;
+ break;
+ }
+ case 9: {
+ decode9(val, valn, out, currentPos);
+ currentPos+=42;
+ break;
+ }
+ case 10: {
+ decode10(val, valn, out, currentPos);
+ currentPos+=28;
+ break;
+ }
+ case 11: {
+ decode11(val, valn, out, currentPos);
+ currentPos+=23;
+ break;
+ }
+ case 12: {
+ decode12(val, valn, out, currentPos);
+ currentPos+=21;
+ break;
+ }
+ case 13: {
+ decode13(val, valn, out, currentPos);
+ currentPos+=19;
+ break;
+ }
+ case 14: {
+ decode14(val, valn, out, currentPos);
+ currentPos+=18;
+ break;
+ }
+ case 15: {
+ decode15(val, valn, out, currentPos);
+ currentPos+=17;
+ break;
+ }
+ case 16: {
+ decode16(val, valn, out, currentPos);
+ currentPos+=16;
+ break;
+ }
+ case 17: {
+ decode17(val, valn, out, currentPos);
+ currentPos+=15;
+ break;
+ }
+ case 18: {
+ decode18(val, valn, out, currentPos);
+ currentPos+=37;
+ break;
+ }
+ case 19: {
+ decode19(val, valn, out, currentPos);
+ currentPos+=23;
+ break;
+ }
+ case 20: {
+ decode20(val, valn, out, currentPos);
+ currentPos+=18;
+ break;
+ }
+ case 21: {
+ decode21(val, valn, out, currentPos);
+ currentPos+=16;
+ break;
+ }
+ case 22: {
+ decode22(val, valn, out, currentPos);
+ currentPos+=14;
+ break;
+ }
+ case 23: {
+ decode23(val, valn, out, currentPos);
+ currentPos+=13;
+ break;
+ }
+ case 24: {
+ decode24(val, valn, out, currentPos);
+ currentPos+=12;
+ break;
+ }
+ case 25: {
+ decode25(val, valn, out, currentPos);
+ currentPos+=11;
+ break;
+ }
+ case 26: {
+ decode26(val, valn, out, currentPos);
+ currentPos+=10;
+ break;
+ }
+ case 27: {
+ decode27(val, valn, out, currentPos);
+ currentPos+=35;
+ break;
+ }
+ case 28: {
+ decode28(val, valn, out, currentPos);
+ currentPos+=21;
+ break;
+ }
+ case 29: {
+ decode29(val, valn, out, currentPos);
+ currentPos+=16;
+ break;
+ }
+
+ case 30: {
+ decode30(val, valn, out, currentPos);
+ currentPos+=14;
+ break;
+ }
+ case 31: {
+ decode31(val, valn, out, currentPos);
+ currentPos+=12;
+ break;
+ }
+ case 32: {
+ decode32(val, valn, out, currentPos);
+ currentPos+=11;
+ break;
+ }
+ case 33: {
+ decode33(val, valn, out, currentPos);
+ currentPos+=10;
+ break;
+ }
+ case 34: {
+ decode34(val, valn, out, currentPos);
+ currentPos+=9;
+ break;
+ }
+ case 35: {
+ decode35(val, valn, out, currentPos);
+ currentPos+=8;
+ break;
+ }
+ case 36: {
+ decode36(val, valn, out, currentPos);
+ currentPos+=33;
+ break;
+ }
+ case 37: {
+ decode37(val, valn, out, currentPos);
+ currentPos+=19;
+ break;
+ }
+ case 38: {
+ decode38(val, valn, out, currentPos);
+ currentPos+=14;
+ break;
+ }
+ case 39: {
+ decode39(val, valn, out, currentPos);
+ currentPos+=12;
+ break;
+ }
+ case 40: {
+ decode40(val, valn, out, currentPos);
+ currentPos+=10;
+ break;
+ }
+ case 41: {
+ decode41(val, valn, out, currentPos);
+ currentPos+=9;
+ break;
+ }
+ case 42: {
+ decode42(val, valn, out, currentPos);
+ currentPos+=8;
+ break;
+ }
+ case 43: {
+ decode43(val, valn, out, currentPos);
+ currentPos+=7;
+ break;
+ }
+ case 44: {
+ decode44(val, valn, out, currentPos);
+ currentPos+=6;
+ break;
+ }
+ case 45: {
+ decode45(val, valn, out, currentPos);
+ currentPos+=32;
+ break;
+ }
+ case 46: {
+ decode46(val, valn, out, currentPos);
+ currentPos+=18;
+ break;
+ }
+ case 47: {
+ decode47(val, valn, out, currentPos);
+ currentPos+=13;
+ break;
+ }
+ case 48: {
+ decode48(val, valn, out, currentPos);
+ currentPos+=11;
+ break;
+ }
+ case 49: {
+ decode49(val, valn, out, currentPos);
+ currentPos+=9;
+ break;
+ }
+ case 50: {
+ decode50(val, valn, out, currentPos);
+ currentPos+=8;
+ break;
+ }
+ case 51: {
+ decode51(val, valn, out, currentPos);
+ currentPos+=7;
+ break;
+ }
+ case 52: {
+ decode52(val, valn, out, currentPos);
+ currentPos+=6;
+ break;
+ }
+ case 53: {
+ decode53(val, valn, out, currentPos);
+ currentPos+=5;
+ break;
+ }
+ case 54: {
+ decode54(val, valn, out, currentPos);
+ currentPos+=31;
+ break;
+ }
+ case 55: {
+ decode55(val, valn, out, currentPos);
+ currentPos+=17;
+ break;
+ }
+ case 56: {
+ decode56(val, valn, out, currentPos);
+ currentPos+=12;
+ break;
+ }
+ case 57: {
+ decode57(val, valn, out, currentPos);
+ currentPos+=10;
+ break;
+ }
+ case 58: {
+ decode58(val, valn, out, currentPos);
+ currentPos+=8;
+ break;
+ }
+ case 59: {
+ decode59(val, valn, out, currentPos);
+ currentPos+=7;
+ break;
+ }
+ case 60: {
+ decode60(val, valn, out, currentPos);
+ currentPos+=6;
+ break;
+ }
+ case 61: {
+ decode61(val, valn, out, currentPos);
+ currentPos+=5;
+ break;
+ }
+ case 62: {
+ decode62(val, valn, out, currentPos);
+ currentPos+=4;
+ break;
+ }
+ case 63: {
+ decode63(val, valn, out, currentPos);
+ currentPos+=30;
+ break;
+ }
+ case 64: {
+ decode64(val, valn, out, currentPos);
+ currentPos+=16;
+ break;
+ }
+ case 65: {
+ decode65(val, valn, out, currentPos);
+ currentPos+=11;
+ break;
+ }
+ case 66: {
+ decode66(val, valn, out, currentPos);
+ currentPos+=9;
+ break;
+ }
+ case 67: {
+ decode67(val, valn, out, currentPos);
+ currentPos+=7;
+ break;
+ }
+ case 68: {
+ decode68(val, valn, out, currentPos);
+ currentPos+=6;
+ break;
+ }
+ case 69: {
+ decode69(val, valn, out, currentPos);
+ currentPos+=5;
+ break;
+ }
+ case 70: {
+ decode70(val, valn, out, currentPos);
+ currentPos+=4;
+ break;
+ }
+ case 71: {
+ decode71(val, valn, out, currentPos);
+ currentPos+=3;
+ break;
+ }
+ case 72: {
+ decode72(val, valn, out, currentPos);
+ currentPos+=29;
+ break;
+ }
+ case 73: {
+ decode73(val, valn, out, currentPos);
+ currentPos+=15;
+ break;
+ }
+ case 74: {
+ decode74(val, valn, out, currentPos);
+ currentPos+=10;
+ break;
+ }
+ case 75: {
+ decode75(val, valn, out, currentPos);
+ currentPos+=8;
+ break;
+ }
+ case 76: {
+ decode76(val, valn, out, currentPos);
+ currentPos+=6;
+ break;
+ }
+ case 77: {
+ decode77(val, valn, out, currentPos);
+ currentPos+=5;
+ break;
+ }
+ case 78: {
+ decode78(val, valn, out, currentPos);
+ currentPos+=4;
+ break;
+ }
+ case 79: {
+ decode79(val, valn, out, currentPos);
+ currentPos+=3;
+ break;
+ }
+ case 80: {
+ decode80(val, valn, out, currentPos);
+ currentPos+=2;
+ break;
+ }
+ default:
+ throw new RuntimeException("Wrong code: " + header);
+ }// end switch
+ } // end while
+
+ while (currentPos < finalout) {
+ int val = in[tmpinpos++];
+ int header = val >>> 28;
+ switch (header) {
+ case 0: { // number : 28, bitwidth : 1
+ final int howmany = finalout - currentPos < 28 ? finalout - currentPos : 28;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (k + 4)) >>> 31;
+ }
+ break;
+ }
+ case 1: { // number : 14, bitwidth : 2
+ final int howmany = finalout - currentPos < 14 ? finalout - currentPos : 14;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (2 * k + 4)) >>> 30;
+ }
+ break;
+ }
+ case 2: { // number : 9, bitwidth : 3
+ final int howmany = finalout - currentPos < 9 ? finalout - currentPos : 9;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (3 * k + 5)) >>> 29;
+ }
+ break;
+ }
+ case 3: { // number : 7, bitwidth : 4
+ final int howmany = finalout - currentPos < 7 ? finalout - currentPos : 7;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (4 * k + 4)) >>> 28;
+ }
+ break;
+ }
+ case 4: { // number : 5, bitwidth : 5
+ final int howmany = finalout - currentPos < 5 ? finalout - currentPos : 5;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (5 * k + 7)) >>> 27;
+ }
+ break;
+ }
+ case 5: { // number : 4, bitwidth : 7
+ final int howmany = finalout - currentPos < 4 ? finalout - currentPos : 4;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (7 * k + 4)) >>> 25;
+ }
+ break;
+ }
+ case 6: { // number : 3, bitwidth : 9
+ final int howmany = finalout - currentPos < 3 ? finalout - currentPos : 3;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (9 * k + 5)) >>> 23;
+ }
+ break;
+ }
+ case 7: { // number : 2, bitwidth : 14
+ final int howmany = finalout - currentPos < 2 ? finalout - currentPos : 2;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (14 * k + 4)) >>> 18;
+ }
+ break;
+ }
+ case 8: { // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 4) >>> 4;
+ break;
+ }
+ default: {
+ throw new RuntimeException("shouldn't happen");
+ }
+ }
+ }
+
+ outpos.set(finalout);
+ inpos.set(tmpinpos);
+
+ }
+
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ compressedPositions.add(inlength);
+ return inlength;
+ }
+}
diff --git a/src/main/java/me/lemire/integercompression/IntCompressor.java b/src/main/java/me/lemire/integercompression/IntCompressor.java
index abaeea9..30f755c 100644
--- a/src/main/java/me/lemire/integercompression/IntCompressor.java
+++ b/src/main/java/me/lemire/integercompression/IntCompressor.java
@@ -33,21 +33,14 @@ public IntCompressor() {
*
* @param input array to be compressed
* @return compressed array
- * @throws UncompressibleInputException if the data is too poorly compressible
*/
public int[] compress(int[] input) {
- int[] compressed = new int[input.length + input.length / 100 + 1024];
+ int maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length);
+ int[] compressed = new int[maxCompressedLength + 1]; // +1 to store the length of the input
// Store at index=0 the length of the input, hence enabling .headlessCompress
compressed[0] = input.length;
IntWrapper outpos = new IntWrapper(1);
- try {
- codec.headlessCompress(input, new IntWrapper(0),
- input.length, compressed, outpos);
- } catch (IndexOutOfBoundsException ioebe) {
- throw new
- UncompressibleInputException("Your input is too poorly compressible "
- + "with the current codec : "+codec);
- }
+ codec.headlessCompress(input, new IntWrapper(0), input.length, compressed, outpos);
compressed = Arrays.copyOf(compressed,outpos.intValue());
return compressed;
}
diff --git a/src/main/java/me/lemire/integercompression/JustCopy.java b/src/main/java/me/lemire/integercompression/JustCopy.java
index 709b86a..f57282c 100644
--- a/src/main/java/me/lemire/integercompression/JustCopy.java
+++ b/src/main/java/me/lemire/integercompression/JustCopy.java
@@ -42,6 +42,12 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ compressedPositions.add(inlength);
+ return inlength;
+ }
+
@Override
public void compress(int[] in, IntWrapper inpos, int inlength,
int[] out, IntWrapper outpos) {
diff --git a/src/main/java/me/lemire/integercompression/Kamikaze.java b/src/main/java/me/lemire/integercompression/Kamikaze.java
index fd1ac82..4cab30b 100644
--- a/src/main/java/me/lemire/integercompression/Kamikaze.java
+++ b/src/main/java/me/lemire/integercompression/Kamikaze.java
@@ -38,6 +38,11 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o
}
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ throw new UnsupportedOperationException("Calculating the max compressed length is not supported yet.");
+ }
+
@Override
public String toString() {
return "Kamikaze's PForDelta";
@@ -64,4 +69,4 @@ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out,
headlessUncompress(in, inpos, inlength, out, outpos, outlength);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/me/lemire/integercompression/NewPFD.java b/src/main/java/me/lemire/integercompression/NewPFD.java
index 6dd01aa..3da3002 100644
--- a/src/main/java/me/lemire/integercompression/NewPFD.java
+++ b/src/main/java/me/lemire/integercompression/NewPFD.java
@@ -132,6 +132,17 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
decodePage(in, inpos, out, outpos, mynvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+ int blockCount = inlength / BLOCK_SIZE;
+ // +1 for the header
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int maxBlockSizeInInts = 1 + BLOCK_SIZE;
+ compressedPositions.add(inlength);
+ return maxBlockSizeInInts * blockCount;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
int tmpoutpos = outpos.get();
diff --git a/src/main/java/me/lemire/integercompression/NewPFDS16.java b/src/main/java/me/lemire/integercompression/NewPFDS16.java
index 98370d2..526b8fb 100644
--- a/src/main/java/me/lemire/integercompression/NewPFDS16.java
+++ b/src/main/java/me/lemire/integercompression/NewPFDS16.java
@@ -131,6 +131,17 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
decodePage(in, inpos, out, outpos, mynvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+ int blockCount = inlength / BLOCK_SIZE;
+ // +1 for the header
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int maxBlockSizeInInts = 1 + BLOCK_SIZE;
+ compressedPositions.add(inlength);
+ return maxBlockSizeInInts * blockCount;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
int tmpoutpos = outpos.get();
diff --git a/src/main/java/me/lemire/integercompression/NewPFDS9.java b/src/main/java/me/lemire/integercompression/NewPFDS9.java
index c8389c1..bd802b6 100644
--- a/src/main/java/me/lemire/integercompression/NewPFDS9.java
+++ b/src/main/java/me/lemire/integercompression/NewPFDS9.java
@@ -130,6 +130,17 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
decodePage(in, inpos, out, outpos, mynvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+ int blockCount = inlength / BLOCK_SIZE;
+ // +1 for the header
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int maxBlockSizeInInts = 1 + BLOCK_SIZE;
+ compressedPositions.add(inlength);
+ return maxBlockSizeInInts * blockCount;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
int tmpoutpos = outpos.get();
diff --git a/src/main/java/me/lemire/integercompression/OptPFD.java b/src/main/java/me/lemire/integercompression/OptPFD.java
index 8c90586..cfda92e 100644
--- a/src/main/java/me/lemire/integercompression/OptPFD.java
+++ b/src/main/java/me/lemire/integercompression/OptPFD.java
@@ -147,6 +147,17 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
decodePage(in, inpos, out, outpos, mynvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+ int blockCount = inlength / BLOCK_SIZE;
+ // +1 for the header
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int maxBlockSizeInInts = 1 + BLOCK_SIZE;
+ compressedPositions.add(inlength);
+ return maxBlockSizeInInts * blockCount;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
int tmpoutpos = outpos.get();
diff --git a/src/main/java/me/lemire/integercompression/OptPFDS16.java b/src/main/java/me/lemire/integercompression/OptPFDS16.java
index 8574b10..95c4f62 100644
--- a/src/main/java/me/lemire/integercompression/OptPFDS16.java
+++ b/src/main/java/me/lemire/integercompression/OptPFDS16.java
@@ -147,6 +147,17 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
decodePage(in, inpos, out, outpos, mynvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+ int blockCount = inlength / BLOCK_SIZE;
+ // +1 for the header
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int maxBlockSizeInInts = 1 + BLOCK_SIZE;
+ compressedPositions.add(inlength);
+ return maxBlockSizeInInts * blockCount;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
int tmpoutpos = outpos.get();
@@ -197,4 +208,4 @@ public String toString() {
return this.getClass().getSimpleName();
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/me/lemire/integercompression/OptPFDS9.java b/src/main/java/me/lemire/integercompression/OptPFDS9.java
index 34f4206..0e2563b 100644
--- a/src/main/java/me/lemire/integercompression/OptPFDS9.java
+++ b/src/main/java/me/lemire/integercompression/OptPFDS9.java
@@ -146,6 +146,17 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
decodePage(in, inpos, out, outpos, mynvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ inlength = Util.greatestMultiple(inlength, BLOCK_SIZE);
+ int blockCount = inlength / BLOCK_SIZE;
+ // +1 for the header
+ // getBestBFromData limits the memory used for exceptions so that the total size of the block does not exceed BLOCK_SIZE integers.
+ int maxBlockSizeInInts = 1 + BLOCK_SIZE;
+ compressedPositions.add(inlength);
+ return maxBlockSizeInInts * blockCount;
+ }
+
private void decodePage(int[] in, IntWrapper inpos, int[] out,
IntWrapper outpos, int thissize) {
int tmpoutpos = outpos.get();
@@ -197,4 +208,4 @@ public String toString() {
return this.getClass().getSimpleName();
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/me/lemire/integercompression/S16.java b/src/main/java/me/lemire/integercompression/S16.java
index 08ffbc4..e40522d 100644
--- a/src/main/java/me/lemire/integercompression/S16.java
+++ b/src/main/java/me/lemire/integercompression/S16.java
@@ -15,191 +15,191 @@
*/
public final class S16 {
- /**
- * Compress an integer array using Simple16
- *
- *
- * @param in
- * array to compress
- * @param currentPos
- * where to start reading
- * @param inlength
- * how many integers to read
- * @param out
- * output array
- * @param tmpoutpos
- * location in the output array
- * @return the number of 32-bit words written (in compressed form)
- */
- public static int compress(final int[] in, int currentPos, int inlength, final int out[], final int tmpoutpos) {
- int outpos = tmpoutpos;
- final int finalin = currentPos + inlength;
- while (currentPos < finalin) {
- int inoffset = compressblock(out, outpos++, in, currentPos, inlength);
- if (inoffset == -1)
- throw new RuntimeException("Too big a number");
- currentPos += inoffset;
- inlength -= inoffset;
- }
- return outpos - tmpoutpos;
- }
-
- /**
- * Estimate size of the compressed output.
- *
- * @param in
- * array to compress
- * @param currentPos
- * where to start reading
- * @param inlength
- * how many integers to read
- * @return estimated size of the output (in 32-bit integers)
- */
- public static int estimatecompress(final int[] in, int currentPos, int inlength) {
- final int finalin = currentPos + inlength;
- int counter = 0;
- while (currentPos < finalin) {
- int inoffset = fakecompressblock(in, currentPos, inlength);
- if (inoffset == -1)
- throw new RuntimeException("Too big a number");
- currentPos += inoffset;
- inlength -= inoffset;
- ++counter;
- }
- return counter;
- }
-
- /**
- * Compress an integer array using Simple16
- *
- * @param out
- * the compressed output
- * @param outOffset
- * the offset of the output in the number of integers
- * @param in
- * the integer input array
- * @param inOffset
- * the offset of the input in the number of integers
- * @param n
- * the number of elements to be compressed
- * @return the size of the outputs in 32-bit integers
- *
- */
- public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
- int numIdx, j, num, bits;
- for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
- out[outOffset] = numIdx << S16_BITSSIZE;
- num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
-
- for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
- out[outOffset] |= (in[inOffset + j] << bits);
- bits += S16_BITS[numIdx][j];
- j++;
- }
-
- if (j == num) {
- return num;
- }
- }
-
- return -1;
- }
-
- private static final int fakecompressblock(int[] in, int inOffset, int n) {
- int numIdx, j, num;
- for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
- num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
-
- for (j = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
- j++;
- }
-
- if (j == num) {
- return num;
- }
- }
-
- return -1;
- }
-
- /**
- * Decompress an integer array using Simple16
- *
- * @param out
- * the decompressed output
- * @param outOffset
- * the offset of the output in the number of integers
- * @param in
- * the compressed input array
- * @param inOffset
- * the offset of the input in the number of integers
- * @param n
- * the number of elements to be compressed
- * @return the number of processed integers
- */
- public static final int decompressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
- int numIdx, j = 0, bits = 0;
- numIdx = in[inOffset] >>> S16_BITSSIZE;
- int num = S16_NUM[numIdx] < n ? S16_NUM[numIdx] : n;
- for (j = 0, bits = 0; j < num; j++) {
- out[outOffset + j] = (in[inOffset] >>> bits) & (0xffffffff >>> (32 - S16_BITS[numIdx][j]));
- bits += S16_BITS[numIdx][j];
- }
- return num;
- }
-
- /**
- * Uncompressed data from an input array into an output array
- *
- * @param in
- * input array (in compressed form)
- * @param tmpinpos
- * starting location in the compressed input array
- * @param inlength
- * how much data we wish the read (in 32-bit words)
- * @param out
- * output array (in decompressed form)
- * @param currentPos
- * current position in the output array
- * @param outlength
- * available data in the output array
- */
- public static void uncompress(final int[] in, int tmpinpos, final int inlength, final int[] out, int currentPos,
- int outlength) {
- final int finalpos = tmpinpos + inlength;
- while (tmpinpos < finalpos) {
- final int howmany = decompressblock(out, currentPos, in, tmpinpos, outlength);
- outlength -= howmany;
- currentPos += howmany;
- tmpinpos += 1;
- }
-
- }
-
- private static int[][] shiftme(int[][] x) {
- int[][] answer = new int[x.length][];
- for (int k = 0; k < x.length; ++k) {
- answer[k] = new int[x[k].length];
- for (int z = 0; z < answer[k].length; ++z)
- answer[k][z] = 1 << x[k][z];
- }
- return answer;
- }
-
- private static final int S16_NUMSIZE = 16;
- private static final int S16_BITSSIZE = 28;
- // the possible number of bits used to represent one integer
- private static final int[] S16_NUM = { 28, 21, 21, 21, 14, 9, 8, 7, 6, 6, 5, 5, 4, 3, 2, 1 };
- // the corresponding number of elements for each value of the number of
- // bits
- private static final int[][] S16_BITS = {
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
- { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
- { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 },
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 },
- { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, { 4, 3, 3, 3, 3, 3, 3, 3, 3 }, { 3, 4, 4, 4, 4, 3, 3, 3 },
- { 4, 4, 4, 4, 4, 4, 4 }, { 5, 5, 5, 5, 4, 4 }, { 4, 4, 5, 5, 5, 5 }, { 6, 6, 6, 5, 5 }, { 5, 5, 6, 6, 6 },
- { 7, 7, 7, 7 }, { 10, 9, 9, }, { 14, 14 }, { 28 } };
- private static final int[][] SHIFTED_S16_BITS = shiftme(S16_BITS);
+ /**
+ * Compress an integer array using Simple16
+ *
+ *
+ * @param in
+ * array to compress
+ * @param currentPos
+ * where to start reading
+ * @param inlength
+ * how many integers to read
+ * @param out
+ * output array
+ * @param tmpoutpos
+ * location in the output array
+ * @return the number of 32-bit words written (in compressed form)
+ */
+ public static int compress(final int[] in, int currentPos, int inlength, final int out[], final int tmpoutpos) {
+ int outpos = tmpoutpos;
+ final int finalin = currentPos + inlength;
+ while (currentPos < finalin) {
+ int inoffset = compressblock(out, outpos++, in, currentPos, inlength);
+ if (inoffset == -1)
+ throw new RuntimeException("Too big a number");
+ currentPos += inoffset;
+ inlength -= inoffset;
+ }
+ return outpos - tmpoutpos;
+ }
+
+ /**
+ * Estimate size of the compressed output.
+ *
+ * @param in
+ * array to compress
+ * @param currentPos
+ * where to start reading
+ * @param inlength
+ * how many integers to read
+ * @return estimated size of the output (in 32-bit integers)
+ */
+ public static int estimatecompress(final int[] in, int currentPos, int inlength) {
+ final int finalin = currentPos + inlength;
+ int counter = 0;
+ while (currentPos < finalin) {
+ int inoffset = fakecompressblock(in, currentPos, inlength);
+ if (inoffset == -1)
+ throw new RuntimeException("Too big a number");
+ currentPos += inoffset;
+ inlength -= inoffset;
+ ++counter;
+ }
+ return counter;
+ }
+
+ /**
+ * Compress an integer array using Simple16
+ *
+ * @param out
+ * the compressed output
+ * @param outOffset
+ * the offset of the output in the number of integers
+ * @param in
+ * the integer input array
+ * @param inOffset
+ * the offset of the input in the number of integers
+ * @param n
+ * the number of elements to be compressed
+ * @return the size of the outputs in 32-bit integers
+ *
+ */
+ public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
+ int numIdx, j, num, bits;
+ for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
+ out[outOffset] = numIdx << S16_BITSSIZE;
+ num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
+
+ for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
+ out[outOffset] |= (in[inOffset + j] << bits);
+ bits += S16_BITS[numIdx][j];
+ j++;
+ }
+
+ if (j == num) {
+ return num;
+ }
+ }
+
+ return -1;
+ }
+
+ private static final int fakecompressblock(int[] in, int inOffset, int n) {
+ int numIdx, j, num;
+ for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
+ num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
+
+ for (j = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
+ j++;
+ }
+
+ if (j == num) {
+ return num;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Decompress an integer array using Simple16
+ *
+ * @param out
+ * the decompressed output
+ * @param outOffset
+ * the offset of the output in the number of integers
+ * @param in
+ * the compressed input array
+ * @param inOffset
+ * the offset of the input in the number of integers
+ * @param n
+ * the number of elements to be compressed
+ * @return the number of processed integers
+ */
+ public static final int decompressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
+ int numIdx, j = 0, bits = 0;
+ numIdx = in[inOffset] >>> S16_BITSSIZE;
+ int num = S16_NUM[numIdx] < n ? S16_NUM[numIdx] : n;
+ for (j = 0, bits = 0; j < num; j++) {
+ out[outOffset + j] = (in[inOffset] >>> bits) & (0xffffffff >>> (32 - S16_BITS[numIdx][j]));
+ bits += S16_BITS[numIdx][j];
+ }
+ return num;
+ }
+
+ /**
+ * Uncompressed data from an input array into an output array
+ *
+ * @param in
+ * input array (in compressed form)
+ * @param tmpinpos
+ * starting location in the compressed input array
+ * @param inlength
+ * how much data we wish the read (in 32-bit words)
+ * @param out
+ * output array (in decompressed form)
+ * @param currentPos
+ * current position in the output array
+ * @param outlength
+ * available data in the output array
+ */
+ public static void uncompress(final int[] in, int tmpinpos, final int inlength, final int[] out, int currentPos,
+ int outlength) {
+ final int finalpos = tmpinpos + inlength;
+ while (tmpinpos < finalpos) {
+ final int howmany = decompressblock(out, currentPos, in, tmpinpos, outlength);
+ outlength -= howmany;
+ currentPos += howmany;
+ tmpinpos += 1;
+ }
+
+ }
+
+ private static int[][] shiftme(int[][] x) {
+ int[][] answer = new int[x.length][];
+ for (int k = 0; k < x.length; ++k) {
+ answer[k] = new int[x[k].length];
+ for (int z = 0; z < answer[k].length; ++z)
+ answer[k][z] = 1 << x[k][z];
+ }
+ return answer;
+ }
+
+ private static final int S16_NUMSIZE = 16;
+ private static final int S16_BITSSIZE = 28;
+ // the possible number of bits used to represent one integer
+ private static final int[] S16_NUM = { 28, 21, 21, 21, 14, 9, 8, 7, 6, 6, 5, 5, 4, 3, 2, 1 };
+ // the corresponding number of elements for each value of the number of
+ // bits
+ private static final int[][] S16_BITS = {
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 },
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 },
+ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, { 4, 3, 3, 3, 3, 3, 3, 3, 3 }, { 3, 4, 4, 4, 4, 3, 3, 3 },
+ { 4, 4, 4, 4, 4, 4, 4 }, { 5, 5, 5, 5, 4, 4 }, { 4, 4, 5, 5, 5, 5 }, { 6, 6, 6, 5, 5 }, { 5, 5, 6, 6, 6 },
+ { 7, 7, 7, 7 }, { 10, 9, 9, }, { 14, 14 }, { 28 } };
+ private static final int[][] SHIFTED_S16_BITS = shiftme(S16_BITS);
}
diff --git a/src/main/java/me/lemire/integercompression/S9.java b/src/main/java/me/lemire/integercompression/S9.java
index 2180e5a..7e03e42 100644
--- a/src/main/java/me/lemire/integercompression/S9.java
+++ b/src/main/java/me/lemire/integercompression/S9.java
@@ -17,187 +17,187 @@
public final class S9 {
- /**
- * Estimate size of the compressed output.
- *
- * @param in
- * array to compress
- * @param currentPos
- * where to start reading
- * @param inlength
- * how many integers to read
- * @return estimated size of the output (in 32-bit integers)
- */
- public static int estimatecompress(int[] in, int currentPos, int inlength) {
- int tmpoutpos = 0;
- int finalpos = currentPos + inlength;
- outer: while (currentPos < finalpos) {
- mainloop: for (int selector = 0; selector < 8; selector++) {
+ /**
+ * Estimate size of the compressed output.
+ *
+ * @param in
+ * array to compress
+ * @param currentPos
+ * where to start reading
+ * @param inlength
+ * how many integers to read
+ * @return estimated size of the output (in 32-bit integers)
+ */
+ public static int estimatecompress(int[] in, int currentPos, int inlength) {
+ int tmpoutpos = 0;
+ int finalpos = currentPos + inlength;
+ outer: while (currentPos < finalpos) {
+ mainloop: for (int selector = 0; selector < 8; selector++) {
- int compressedNum = codeNum[selector];
- if (finalpos <= currentPos + compressedNum - 1)
- compressedNum = finalpos - currentPos;
- int b = bitLength[selector];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++)
- if (Util.smallerorequalthan(max , in[currentPos + i]))
- continue mainloop;
- currentPos += compressedNum;
- ++tmpoutpos;
- continue outer;
- }
- final int selector = 8;
- if (in[currentPos] >= 1 << bitLength[selector])
- throw new RuntimeException("Too big a number");
- tmpoutpos++;
- currentPos++;
+ int compressedNum = codeNum[selector];
+ if (finalpos <= currentPos + compressedNum - 1)
+ compressedNum = finalpos - currentPos;
+ int b = bitLength[selector];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++)
+ if (Util.smallerorequalthan(max , in[currentPos + i]))
+ continue mainloop;
+ currentPos += compressedNum;
+ ++tmpoutpos;
+ continue outer;
+ }
+ final int selector = 8;
+ if (in[currentPos] >= 1 << bitLength[selector])
+ throw new RuntimeException("Too big a number");
+ tmpoutpos++;
+ currentPos++;
- }
- return tmpoutpos;
- }
+ }
+ return tmpoutpos;
+ }
- /**
- * Compress an integer array using Simple9
- *
- *
- * @param in
- * array to compress
- * @param currentPos
- * where to start reading
- * @param inlength
- * how many integers to read
- * @param out
- * output array
- * @param tmpoutpos
- * location in the output array
- * @return the number of 32-bit words written (in compressed form)
- */
- public static int compress(int[] in, int currentPos, int inlength, int out[], int tmpoutpos) {
- int origtmpoutpos = tmpoutpos;
- int finalpos = currentPos + inlength;
- outer: while (currentPos < finalpos) {
- mainloop: for (int selector = 0; selector < 8; selector++) {
- int res = 0;
- int compressedNum = codeNum[selector];
- if (finalpos <= currentPos + compressedNum - 1)
- compressedNum = finalpos - currentPos;
- int b = bitLength[selector];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++) {
- if (Util.smallerorequalthan(max, in[currentPos + i]))
- continue mainloop;
- res = (res << b) + in[currentPos + i];
- }
- if (compressedNum != codeNum[selector])
- res <<= (codeNum[selector] - compressedNum) * b;
- res |= selector << 28;
- out[tmpoutpos++] = res;
- currentPos += compressedNum;
- continue outer;
- }
- final int selector = 8;
- if (in[currentPos] >= 1 << bitLength[selector])
- throw new RuntimeException("Too big a number");
- out[tmpoutpos++] = in[currentPos++] | (selector << 28);
- }
- return tmpoutpos - origtmpoutpos;
- }
+ /**
+ * Compress an integer array using Simple9
+ *
+ *
+ * @param in
+ * array to compress
+ * @param currentPos
+ * where to start reading
+ * @param inlength
+ * how many integers to read
+ * @param out
+ * output array
+ * @param tmpoutpos
+ * location in the output array
+ * @return the number of 32-bit words written (in compressed form)
+ */
+ public static int compress(int[] in, int currentPos, int inlength, int out[], int tmpoutpos) {
+ int origtmpoutpos = tmpoutpos;
+ int finalpos = currentPos + inlength;
+ outer: while (currentPos < finalpos) {
+ mainloop: for (int selector = 0; selector < 8; selector++) {
+ int res = 0;
+ int compressedNum = codeNum[selector];
+ if (finalpos <= currentPos + compressedNum - 1)
+ compressedNum = finalpos - currentPos;
+ int b = bitLength[selector];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++) {
+ if (Util.smallerorequalthan(max, in[currentPos + i]))
+ continue mainloop;
+ res = (res << b) + in[currentPos + i];
+ }
+ if (compressedNum != codeNum[selector])
+ res <<= (codeNum[selector] - compressedNum) * b;
+ res |= selector << 28;
+ out[tmpoutpos++] = res;
+ currentPos += compressedNum;
+ continue outer;
+ }
+ final int selector = 8;
+ if (in[currentPos] >= 1 << bitLength[selector])
+ throw new RuntimeException("Too big a number");
+ out[tmpoutpos++] = in[currentPos++] | (selector << 28);
+ }
+ return tmpoutpos - origtmpoutpos;
+ }
- /**
- * Uncompressed data from an input array into an output array
- *
- * @param in
- * input array (in compressed form)
- * @param tmpinpos
- * starting location in the compressed input array
- * @param inlength
- * how much data we wish the read (in 32-bit words)
- * @param out
- * output array (in decompressed form)
- * @param currentPos
- * current position in the output array
- * @param outlength
- * available data in the output array
- */
- public static void uncompress(int[] in, int tmpinpos, int inlength, int[] out, int currentPos, int outlength) {
- int finallength = currentPos + outlength;
+ /**
+ * Uncompressed data from an input array into an output array
+ *
+ * @param in
+ * input array (in compressed form)
+ * @param tmpinpos
+ * starting location in the compressed input array
+ * @param inlength
+ * how much data we wish the read (in 32-bit words)
+ * @param out
+ * output array (in decompressed form)
+ * @param currentPos
+ * current position in the output array
+ * @param outlength
+ * available data in the output array
+ */
+ public static void uncompress(int[] in, int tmpinpos, int inlength, int[] out, int currentPos, int outlength) {
+ int finallength = currentPos + outlength;
- while (currentPos < finallength) {
- int val = in[tmpinpos++];
- int header = val >>> 28;
- switch (header) {
- case 0: { // number : 28, bitwidth : 1
- final int howmany = finallength - currentPos < 28 ? finallength - currentPos : 28;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (k + 4)) >>> 31;
- }
- break;
- }
- case 1: { // number : 14, bitwidth : 2
- final int howmany = finallength - currentPos < 14 ? finallength - currentPos : 14;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (2 * k + 4)) >>> 30;
- }
- break;
- }
- case 2: { // number : 9, bitwidth : 3
- final int howmany = finallength - currentPos < 9 ? finallength - currentPos : 9;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (3 * k + 5)) >>> 29;
- }
- break;
- }
- case 3: { // number : 7, bitwidth : 4
- final int howmany = finallength - currentPos < 7 ? finallength - currentPos : 7;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (4 * k + 4)) >>> 28;
- }
- break;
- }
- case 4: { // number : 5, bitwidth : 5
- final int howmany = finallength - currentPos < 5 ? finallength - currentPos : 5;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (5 * k + 7)) >>> 27;
- }
- break;
- }
- case 5: { // number : 4, bitwidth : 7
- final int howmany = finallength - currentPos < 4 ? finallength - currentPos : 4;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (7 * k + 4)) >>> 25;
- }
- break;
- }
- case 6: { // number : 3, bitwidth : 9
- final int howmany = finallength - currentPos < 3 ? finallength - currentPos : 3;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (9 * k + 5)) >>> 23;
- }
- break;
- }
- case 7: { // number : 2, bitwidth : 14
- final int howmany = finallength - currentPos < 2 ? finallength - currentPos : 2;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (14 * k + 4)) >>> 18;
- }
- break;
- }
- case 8: { // number : 1, bitwidth : 28
- out[currentPos++] = (val << 4) >>> 4;
- break;
- }
- default: {
- throw new RuntimeException("shouldn't happen");
- }
- }
- }
+ while (currentPos < finallength) {
+ int val = in[tmpinpos++];
+ int header = val >>> 28;
+ switch (header) {
+ case 0: { // number : 28, bitwidth : 1
+ final int howmany = finallength - currentPos < 28 ? finallength - currentPos : 28;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (k + 4)) >>> 31;
+ }
+ break;
+ }
+ case 1: { // number : 14, bitwidth : 2
+ final int howmany = finallength - currentPos < 14 ? finallength - currentPos : 14;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (2 * k + 4)) >>> 30;
+ }
+ break;
+ }
+ case 2: { // number : 9, bitwidth : 3
+ final int howmany = finallength - currentPos < 9 ? finallength - currentPos : 9;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (3 * k + 5)) >>> 29;
+ }
+ break;
+ }
+ case 3: { // number : 7, bitwidth : 4
+ final int howmany = finallength - currentPos < 7 ? finallength - currentPos : 7;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (4 * k + 4)) >>> 28;
+ }
+ break;
+ }
+ case 4: { // number : 5, bitwidth : 5
+ final int howmany = finallength - currentPos < 5 ? finallength - currentPos : 5;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (5 * k + 7)) >>> 27;
+ }
+ break;
+ }
+ case 5: { // number : 4, bitwidth : 7
+ final int howmany = finallength - currentPos < 4 ? finallength - currentPos : 4;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (7 * k + 4)) >>> 25;
+ }
+ break;
+ }
+ case 6: { // number : 3, bitwidth : 9
+ final int howmany = finallength - currentPos < 3 ? finallength - currentPos : 3;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (9 * k + 5)) >>> 23;
+ }
+ break;
+ }
+ case 7: { // number : 2, bitwidth : 14
+ final int howmany = finallength - currentPos < 2 ? finallength - currentPos : 2;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (14 * k + 4)) >>> 18;
+ }
+ break;
+ }
+ case 8: { // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 4) >>> 4;
+ break;
+ }
+ default: {
+ throw new RuntimeException("shouldn't happen");
+ }
+ }
+ }
- }
+ }
- private final static int bitLength[] = { 1, 2, 3, 4, 5, 7, 9, 14, 28 };
+ private final static int bitLength[] = { 1, 2, 3, 4, 5, 7, 9, 14, 28 };
- private final static int codeNum[] = { 28, 14, 9, 7, 5, 4, 3, 2, 1 };
+ private final static int codeNum[] = { 28, 14, 9, 7, 5, 4, 3, 2, 1 };
}
diff --git a/src/main/java/me/lemire/integercompression/Simple16.java b/src/main/java/me/lemire/integercompression/Simple16.java
index e0f9d5a..2b7f27f 100644
--- a/src/main/java/me/lemire/integercompression/Simple16.java
+++ b/src/main/java/me/lemire/integercompression/Simple16.java
@@ -13,173 +13,179 @@
*/
public final class Simple16 implements IntegerCODEC, SkippableIntegerCODEC {
- public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int out[], IntWrapper outpos) {
- int i_inpos = inpos.get();
- int i_outpos = outpos.get();
- final int finalin = i_inpos + inlength;
- while (i_inpos < finalin) {
- int inoffset = compressblock(out, i_outpos++, in, i_inpos, inlength);
- if (inoffset == -1)
- throw new RuntimeException("Too big a number");
- i_inpos += inoffset;
- inlength -= inoffset;
- }
- inpos.set(i_inpos);
- outpos.set(i_outpos);
- }
-
- /**
- * Compress an integer array using Simple16
- *
- * @param out
- * the compressed output
- * @param outOffset
- * the offset of the output in the number of integers
- * @param in
- * the integer input array
- * @param inOffset
- * the offset of the input in the number of integers
- * @param n
- * the number of elements to be compressed
- * @return the number of compressed integers
- */
- public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
- int numIdx, j, num, bits;
- for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
- out[outOffset] = numIdx << S16_BITSSIZE;
- num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
-
- for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
- out[outOffset] |= (in[inOffset + j] << bits);
- bits += S16_BITS[numIdx][j];
- j++;
- }
-
- if (j == num) {
- return num;
- }
- }
-
- return -1;
- }
-
- /**
- * Decompress an integer array using Simple16
- *
- * @param out
- * the decompressed output
- * @param outOffset
- * the offset of the output in the number of integers
- * @param in
- * the compressed input array
- * @param inOffset
- * the offset of the input in the number of integers
- * @param n
- * the number of elements to be compressed
- * @return the number of processed integers
- */
- public static final int decompressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
- int numIdx, j = 0, bits = 0;
- numIdx = in[inOffset] >>> S16_BITSSIZE;
- int num = S16_NUM[numIdx] < n ? S16_NUM[numIdx] : n;
- for (j = 0, bits = 0; j < num; j++) {
- out[outOffset + j] = (in[inOffset] >>> bits) & (0xffffffff >>> (32 - S16_BITS[numIdx][j]));
- bits += S16_BITS[numIdx][j];
- }
- return num;
- }
-
- @Override
- public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos, int num) {
- int i_inpos = inpos.get();
- int i_outpos = outpos.get();
- while (num > 0) {
- final int howmany = decompressblock(out, i_outpos, in, i_inpos, num);
- num -= howmany;
- i_outpos += howmany;
- i_inpos++;
- }
- inpos.set(i_inpos);
- outpos.set(i_outpos);
- }
-
- /**
- * Uncompress data from an array to another array.
- *
- * Both inpos and outpos parameters are modified to indicate new positions
- * after read/write.
- *
- * @param in
- * array containing data in compressed form
- * @param tmpinpos
- * where to start reading in the array
- * @param inlength
- * length of the compressed data (ignored by some schemes)
- * @param out
- * array where to write the compressed output
- * @param currentPos
- * where to write the compressed output in out
- * @param outlength
- * number of integers we want to decode
- */
- public static void uncompress(int[] in, int tmpinpos, int inlength, int[] out, int currentPos, int outlength) {
- final int finalpos = tmpinpos + inlength;
- while (tmpinpos < finalpos) {
- final int howmany = decompressblock(out, currentPos, in, tmpinpos, outlength);
- outlength -= howmany;
- currentPos += howmany;
- tmpinpos += 1;
- }
-
- }
-
- private static int[][] shiftme(int[][] x) {
- int[][] answer = new int[x.length][];
- for (int k = 0; k < x.length; ++k) {
- answer[k] = new int[x[k].length];
- for (int z = 0; z < answer[k].length; ++z)
- answer[k][z] = 1 << x[k][z];
- }
- return answer;
- }
-
- @Override
- public void compress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
- if (inlength == 0)
- return;
- out[outpos.get()] = inlength;
- outpos.increment();
- headlessCompress(in, inpos, inlength, out, outpos);
- }
-
- @Override
- public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
- if (inlength == 0)
- return;
- final int outlength = in[inpos.get()];
- inpos.increment();
- headlessUncompress(in, inpos, inlength, out, outpos, outlength);
-
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-
- private static final int S16_NUMSIZE = 16;
- private static final int S16_BITSSIZE = 28;
- // the possible number of bits used to represent one integer
- private static final int[] S16_NUM = { 28, 21, 21, 21, 14, 9, 8, 7, 6, 6, 5, 5, 4, 3, 2, 1 };
- // the corresponding number of elements for each value of the number of bits
- private static final int[][] S16_BITS = {
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
- { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
- { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 },
- { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 },
- { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, { 4, 3, 3, 3, 3, 3, 3, 3, 3 }, { 3, 4, 4, 4, 4, 3, 3, 3 },
- { 4, 4, 4, 4, 4, 4, 4 }, { 5, 5, 5, 5, 4, 4 }, { 4, 4, 5, 5, 5, 5 }, { 6, 6, 6, 5, 5 }, { 5, 5, 6, 6, 6 },
- { 7, 7, 7, 7 }, { 10, 9, 9, }, { 14, 14 }, { 28 } };
- private static final int[][] SHIFTED_S16_BITS = shiftme(S16_BITS);
-
-}
\ No newline at end of file
+ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int out[], IntWrapper outpos) {
+ int i_inpos = inpos.get();
+ int i_outpos = outpos.get();
+ final int finalin = i_inpos + inlength;
+ while (i_inpos < finalin) {
+ int inoffset = compressblock(out, i_outpos++, in, i_inpos, inlength);
+ if (inoffset == -1)
+ throw new RuntimeException("Too big a number");
+ i_inpos += inoffset;
+ inlength -= inoffset;
+ }
+ inpos.set(i_inpos);
+ outpos.set(i_outpos);
+ }
+
+ /**
+ * Compress an integer array using Simple16
+ *
+ * @param out
+ * the compressed output
+ * @param outOffset
+ * the offset of the output in the number of integers
+ * @param in
+ * the integer input array
+ * @param inOffset
+ * the offset of the input in the number of integers
+ * @param n
+ * the number of elements to be compressed
+ * @return the number of compressed integers
+ */
+ public static final int compressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
+ int numIdx, j, num, bits;
+ for (numIdx = 0; numIdx < S16_NUMSIZE; numIdx++) {
+ out[outOffset] = numIdx << S16_BITSSIZE;
+ num = (S16_NUM[numIdx] < n) ? S16_NUM[numIdx] : n;
+
+ for (j = 0, bits = 0; (j < num) && (in[inOffset + j] < SHIFTED_S16_BITS[numIdx][j]);) {
+ out[outOffset] |= (in[inOffset + j] << bits);
+ bits += S16_BITS[numIdx][j];
+ j++;
+ }
+
+ if (j == num) {
+ return num;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Decompress an integer array using Simple16
+ *
+ * @param out
+ * the decompressed output
+ * @param outOffset
+ * the offset of the output in the number of integers
+ * @param in
+ * the compressed input array
+ * @param inOffset
+ * the offset of the input in the number of integers
+ * @param n
+ * the number of elements to be compressed
+ * @return the number of processed integers
+ */
+ public static final int decompressblock(int[] out, int outOffset, int[] in, int inOffset, int n) {
+ int numIdx, j = 0, bits = 0;
+ numIdx = in[inOffset] >>> S16_BITSSIZE;
+ int num = S16_NUM[numIdx] < n ? S16_NUM[numIdx] : n;
+ for (j = 0, bits = 0; j < num; j++) {
+ out[outOffset + j] = (in[inOffset] >>> bits) & (0xffffffff >>> (32 - S16_BITS[numIdx][j]));
+ bits += S16_BITS[numIdx][j];
+ }
+ return num;
+ }
+
+ @Override
+ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos, int num) {
+ int i_inpos = inpos.get();
+ int i_outpos = outpos.get();
+ while (num > 0) {
+ final int howmany = decompressblock(out, i_outpos, in, i_inpos, num);
+ num -= howmany;
+ i_outpos += howmany;
+ i_inpos++;
+ }
+ inpos.set(i_inpos);
+ outpos.set(i_outpos);
+ }
+
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ compressedPositions.add(inlength);
+ return inlength;
+ }
+
+ /**
+ * Uncompress data from an array to another array.
+ *
+ * Both inpos and outpos parameters are modified to indicate new positions
+ * after read/write.
+ *
+ * @param in
+ * array containing data in compressed form
+ * @param tmpinpos
+ * where to start reading in the array
+ * @param inlength
+ * length of the compressed data (ignored by some schemes)
+ * @param out
+ * array where to write the compressed output
+ * @param currentPos
+ * where to write the compressed output in out
+ * @param outlength
+ * number of integers we want to decode
+ */
+ public static void uncompress(int[] in, int tmpinpos, int inlength, int[] out, int currentPos, int outlength) {
+ final int finalpos = tmpinpos + inlength;
+ while (tmpinpos < finalpos) {
+ final int howmany = decompressblock(out, currentPos, in, tmpinpos, outlength);
+ outlength -= howmany;
+ currentPos += howmany;
+ tmpinpos += 1;
+ }
+
+ }
+
+ private static int[][] shiftme(int[][] x) {
+ int[][] answer = new int[x.length][];
+ for (int k = 0; k < x.length; ++k) {
+ answer[k] = new int[x[k].length];
+ for (int z = 0; z < answer[k].length; ++z)
+ answer[k][z] = 1 << x[k][z];
+ }
+ return answer;
+ }
+
+ @Override
+ public void compress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
+ if (inlength == 0)
+ return;
+ out[outpos.get()] = inlength;
+ outpos.increment();
+ headlessCompress(in, inpos, inlength, out, outpos);
+ }
+
+ @Override
+ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
+ if (inlength == 0)
+ return;
+ final int outlength = in[inpos.get()];
+ inpos.increment();
+ headlessUncompress(in, inpos, inlength, out, outpos, outlength);
+
+ }
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
+
+ private static final int S16_NUMSIZE = 16;
+ private static final int S16_BITSSIZE = 28;
+ // the possible number of bits used to represent one integer
+ private static final int[] S16_NUM = { 28, 21, 21, 21, 14, 9, 8, 7, 6, 6, 5, 5, 4, 3, 2, 1 };
+ // the corresponding number of elements for each value of the number of bits
+ private static final int[][] S16_BITS = {
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ { 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 },
+ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2 },
+ { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, { 4, 3, 3, 3, 3, 3, 3, 3, 3 }, { 3, 4, 4, 4, 4, 3, 3, 3 },
+ { 4, 4, 4, 4, 4, 4, 4 }, { 5, 5, 5, 5, 4, 4 }, { 4, 4, 5, 5, 5, 5 }, { 6, 6, 6, 5, 5 }, { 5, 5, 6, 6, 6 },
+ { 7, 7, 7, 7 }, { 10, 9, 9, }, { 14, 14 }, { 28 } };
+ private static final int[][] SHIFTED_S16_BITS = shiftme(S16_BITS);
+
+}
diff --git a/src/main/java/me/lemire/integercompression/Simple9.java b/src/main/java/me/lemire/integercompression/Simple9.java
index 032489d..fd5194d 100644
--- a/src/main/java/me/lemire/integercompression/Simple9.java
+++ b/src/main/java/me/lemire/integercompression/Simple9.java
@@ -20,280 +20,286 @@
public final class Simple9 implements IntegerCODEC, SkippableIntegerCODEC {
- @Override
- public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int out[], IntWrapper outpos) {
- int tmpoutpos = outpos.get();
- int currentPos = inpos.get();
- final int finalin = currentPos + inlength;
- outer: while (currentPos < finalin - 28) {
- mainloop: for (int selector = 0; selector < 8; selector++) {
+ @Override
+ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int out[], IntWrapper outpos) {
+ int tmpoutpos = outpos.get();
+ int currentPos = inpos.get();
+ final int finalin = currentPos + inlength;
+ outer: while (currentPos < finalin - 28) {
+ mainloop: for (int selector = 0; selector < 8; selector++) {
- int res = 0;
- int compressedNum = codeNum[selector];
- int b = bitLength[selector];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++) {
- if (max <= in[currentPos + i])
- continue mainloop;
- res = (res << b) + in[currentPos + i];
- }
- res |= selector << 28;
- out[tmpoutpos++] = res;
- currentPos += compressedNum;
- continue outer;
- }
- final int selector = 8;
- if (in[currentPos] >= 1 << bitLength[selector])
- throw new RuntimeException("Too big a number");
- out[tmpoutpos++] = in[currentPos++] | (selector << 28);
- }
- outer: while (currentPos < finalin) {
- mainloop: for (int selector = 0; selector < 8; selector++) {
- int res = 0;
- int compressedNum = codeNum[selector];
- if (finalin <= currentPos + compressedNum - 1)
- compressedNum = finalin - currentPos;
- int b = bitLength[selector];
- int max = 1 << b;
- int i = 0;
- for (; i < compressedNum; i++) {
- if (max <= in[currentPos + i])
- continue mainloop;
- res = (res << b) + in[currentPos + i];
- }
+ int res = 0;
+ int compressedNum = codeNum[selector];
+ int b = bitLength[selector];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++) {
+ if (max <= in[currentPos + i])
+ continue mainloop;
+ res = (res << b) + in[currentPos + i];
+ }
+ res |= selector << 28;
+ out[tmpoutpos++] = res;
+ currentPos += compressedNum;
+ continue outer;
+ }
+ final int selector = 8;
+ if (in[currentPos] >= 1 << bitLength[selector])
+ throw new RuntimeException("Too big a number");
+ out[tmpoutpos++] = in[currentPos++] | (selector << 28);
+ }
+ outer: while (currentPos < finalin) {
+ mainloop: for (int selector = 0; selector < 8; selector++) {
+ int res = 0;
+ int compressedNum = codeNum[selector];
+ if (finalin <= currentPos + compressedNum - 1)
+ compressedNum = finalin - currentPos;
+ int b = bitLength[selector];
+ int max = 1 << b;
+ int i = 0;
+ for (; i < compressedNum; i++) {
+ if (max <= in[currentPos + i])
+ continue mainloop;
+ res = (res << b) + in[currentPos + i];
+ }
- if (compressedNum != codeNum[selector])
- res <<= (codeNum[selector] - compressedNum) * b;
- res |= selector << 28;
- out[tmpoutpos++] = res;
- currentPos += compressedNum;
- continue outer;
- }
- final int selector = 8;
- if (in[currentPos] >= 1 << bitLength[selector])
- throw new RuntimeException("Too big a number");
- out[tmpoutpos++] = in[currentPos++] | (selector << 28);
- }
- inpos.set(currentPos);
- outpos.set(tmpoutpos);
- }
+ if (compressedNum != codeNum[selector])
+ res <<= (codeNum[selector] - compressedNum) * b;
+ res |= selector << 28;
+ out[tmpoutpos++] = res;
+ currentPos += compressedNum;
+ continue outer;
+ }
+ final int selector = 8;
+ if (in[currentPos] >= 1 << bitLength[selector])
+ throw new RuntimeException("Too big a number");
+ out[tmpoutpos++] = in[currentPos++] | (selector << 28);
+ }
+ inpos.set(currentPos);
+ outpos.set(tmpoutpos);
+ }
- @Override
- public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos,
- int outlength) {
- int currentPos = outpos.get();
- int tmpinpos = inpos.get();
- final int finalout = currentPos + outlength;
- while (currentPos < finalout - 28) {
- int val = in[tmpinpos++];
- int header = val >>> 28;
- switch (header) {
- case 0: { // number : 28, bitwidth : 1
- out[currentPos++] = (val << 4) >>> 31;
- out[currentPos++] = (val << 5) >>> 31;
- out[currentPos++] = (val << 6) >>> 31;
- out[currentPos++] = (val << 7) >>> 31;
- out[currentPos++] = (val << 8) >>> 31;
- out[currentPos++] = (val << 9) >>> 31;
- out[currentPos++] = (val << 10) >>> 31;
- out[currentPos++] = (val << 11) >>> 31;
- out[currentPos++] = (val << 12) >>> 31;
- out[currentPos++] = (val << 13) >>> 31; // 10
- out[currentPos++] = (val << 14) >>> 31;
- out[currentPos++] = (val << 15) >>> 31;
- out[currentPos++] = (val << 16) >>> 31;
- out[currentPos++] = (val << 17) >>> 31;
- out[currentPos++] = (val << 18) >>> 31;
- out[currentPos++] = (val << 19) >>> 31;
- out[currentPos++] = (val << 20) >>> 31;
- out[currentPos++] = (val << 21) >>> 31;
- out[currentPos++] = (val << 22) >>> 31;
- out[currentPos++] = (val << 23) >>> 31; // 20
- out[currentPos++] = (val << 24) >>> 31;
- out[currentPos++] = (val << 25) >>> 31;
- out[currentPos++] = (val << 26) >>> 31;
- out[currentPos++] = (val << 27) >>> 31;
- out[currentPos++] = (val << 28) >>> 31;
- out[currentPos++] = (val << 29) >>> 31;
- out[currentPos++] = (val << 30) >>> 31;
- out[currentPos++] = (val << 31) >>> 31;
- break;
- }
- case 1: { // number : 14, bitwidth : 2
- out[currentPos++] = (val << 4) >>> 30;
- out[currentPos++] = (val << 6) >>> 30;
- out[currentPos++] = (val << 8) >>> 30;
- out[currentPos++] = (val << 10) >>> 30;
- out[currentPos++] = (val << 12) >>> 30;
- out[currentPos++] = (val << 14) >>> 30;
- out[currentPos++] = (val << 16) >>> 30;
- out[currentPos++] = (val << 18) >>> 30;
- out[currentPos++] = (val << 20) >>> 30;
- out[currentPos++] = (val << 22) >>> 30; // 10
- out[currentPos++] = (val << 24) >>> 30;
- out[currentPos++] = (val << 26) >>> 30;
- out[currentPos++] = (val << 28) >>> 30;
- out[currentPos++] = (val << 30) >>> 30;
- break;
- }
- case 2: { // number : 9, bitwidth : 3
- out[currentPos++] = (val << 5) >>> 29;
- out[currentPos++] = (val << 8) >>> 29;
- out[currentPos++] = (val << 11) >>> 29;
- out[currentPos++] = (val << 14) >>> 29;
- out[currentPos++] = (val << 17) >>> 29;
- out[currentPos++] = (val << 20) >>> 29;
- out[currentPos++] = (val << 23) >>> 29;
- out[currentPos++] = (val << 26) >>> 29;
- out[currentPos++] = (val << 29) >>> 29;
- break;
- }
- case 3: { // number : 7, bitwidth : 4
- out[currentPos++] = (val << 4) >>> 28;
- out[currentPos++] = (val << 8) >>> 28;
- out[currentPos++] = (val << 12) >>> 28;
- out[currentPos++] = (val << 16) >>> 28;
- out[currentPos++] = (val << 20) >>> 28;
- out[currentPos++] = (val << 24) >>> 28;
- out[currentPos++] = (val << 28) >>> 28;
- break;
- }
- case 4: { // number : 5, bitwidth : 5
- out[currentPos++] = (val << 7) >>> 27;
- out[currentPos++] = (val << 12) >>> 27;
- out[currentPos++] = (val << 17) >>> 27;
- out[currentPos++] = (val << 22) >>> 27;
- out[currentPos++] = (val << 27) >>> 27;
- break;
- }
- case 5: { // number : 4, bitwidth : 7
- out[currentPos++] = (val << 4) >>> 25;
- out[currentPos++] = (val << 11) >>> 25;
- out[currentPos++] = (val << 18) >>> 25;
- out[currentPos++] = (val << 25) >>> 25;
- break;
- }
- case 6: { // number : 3, bitwidth : 9
- out[currentPos++] = (val << 5) >>> 23;
- out[currentPos++] = (val << 14) >>> 23;
- out[currentPos++] = (val << 23) >>> 23;
- break;
- }
- case 7: { // number : 2, bitwidth : 14
- out[currentPos++] = (val << 4) >>> 18;
- out[currentPos++] = (val << 18) >>> 18;
- break;
- }
- case 8: { // number : 1, bitwidth : 28
- out[currentPos++] = (val << 4) >>> 4;
- break;
- }
- default: {
- throw new RuntimeException("shouldn't happen: limited to 28-bit integers");
- }
- }
- }
- while (currentPos < finalout) {
- int val = in[tmpinpos++];
- int header = val >>> 28;
- switch (header) {
- case 0: { // number : 28, bitwidth : 1
- final int howmany = finalout - currentPos;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (k + 4)) >>> 31;
- }
- break;
- }
- case 1: { // number : 14, bitwidth : 2
- final int howmany = finalout - currentPos < 14 ? finalout - currentPos : 14;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (2 * k + 4)) >>> 30;
- }
- break;
- }
- case 2: { // number : 9, bitwidth : 3
- final int howmany = finalout - currentPos < 9 ? finalout - currentPos : 9;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (3 * k + 5)) >>> 29;
- }
- break;
- }
- case 3: { // number : 7, bitwidth : 4
- final int howmany = finalout - currentPos < 7 ? finalout - currentPos : 7;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (4 * k + 4)) >>> 28;
- }
- break;
- }
- case 4: { // number : 5, bitwidth : 5
- final int howmany = finalout - currentPos < 5 ? finalout - currentPos : 5;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (5 * k + 7)) >>> 27;
- }
- break;
- }
- case 5: { // number : 4, bitwidth : 7
- final int howmany = finalout - currentPos < 4 ? finalout - currentPos : 4;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (7 * k + 4)) >>> 25;
- }
- break;
- }
- case 6: { // number : 3, bitwidth : 9
- final int howmany = finalout - currentPos < 3 ? finalout - currentPos : 3;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (9 * k + 5)) >>> 23;
- }
- break;
- }
- case 7: { // number : 2, bitwidth : 14
- final int howmany = finalout - currentPos < 2 ? finalout - currentPos : 2;
- for (int k = 0; k < howmany; ++k) {
- out[currentPos++] = (val << (14 * k + 4)) >>> 18;
- }
- break;
- }
- case 8: { // number : 1, bitwidth : 28
- out[currentPos++] = (val << 4) >>> 4;
- break;
- }
- default: {
- throw new RuntimeException("shouldn't happen");
- }
- }
- }
- outpos.set(currentPos);
- inpos.set(tmpinpos);
+ @Override
+ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos,
+ int outlength) {
+ int currentPos = outpos.get();
+ int tmpinpos = inpos.get();
+ final int finalout = currentPos + outlength;
+ while (currentPos < finalout - 28) {
+ int val = in[tmpinpos++];
+ int header = val >>> 28;
+ switch (header) {
+ case 0: { // number : 28, bitwidth : 1
+ out[currentPos++] = (val << 4) >>> 31;
+ out[currentPos++] = (val << 5) >>> 31;
+ out[currentPos++] = (val << 6) >>> 31;
+ out[currentPos++] = (val << 7) >>> 31;
+ out[currentPos++] = (val << 8) >>> 31;
+ out[currentPos++] = (val << 9) >>> 31;
+ out[currentPos++] = (val << 10) >>> 31;
+ out[currentPos++] = (val << 11) >>> 31;
+ out[currentPos++] = (val << 12) >>> 31;
+ out[currentPos++] = (val << 13) >>> 31; // 10
+ out[currentPos++] = (val << 14) >>> 31;
+ out[currentPos++] = (val << 15) >>> 31;
+ out[currentPos++] = (val << 16) >>> 31;
+ out[currentPos++] = (val << 17) >>> 31;
+ out[currentPos++] = (val << 18) >>> 31;
+ out[currentPos++] = (val << 19) >>> 31;
+ out[currentPos++] = (val << 20) >>> 31;
+ out[currentPos++] = (val << 21) >>> 31;
+ out[currentPos++] = (val << 22) >>> 31;
+ out[currentPos++] = (val << 23) >>> 31; // 20
+ out[currentPos++] = (val << 24) >>> 31;
+ out[currentPos++] = (val << 25) >>> 31;
+ out[currentPos++] = (val << 26) >>> 31;
+ out[currentPos++] = (val << 27) >>> 31;
+ out[currentPos++] = (val << 28) >>> 31;
+ out[currentPos++] = (val << 29) >>> 31;
+ out[currentPos++] = (val << 30) >>> 31;
+ out[currentPos++] = (val << 31) >>> 31;
+ break;
+ }
+ case 1: { // number : 14, bitwidth : 2
+ out[currentPos++] = (val << 4) >>> 30;
+ out[currentPos++] = (val << 6) >>> 30;
+ out[currentPos++] = (val << 8) >>> 30;
+ out[currentPos++] = (val << 10) >>> 30;
+ out[currentPos++] = (val << 12) >>> 30;
+ out[currentPos++] = (val << 14) >>> 30;
+ out[currentPos++] = (val << 16) >>> 30;
+ out[currentPos++] = (val << 18) >>> 30;
+ out[currentPos++] = (val << 20) >>> 30;
+ out[currentPos++] = (val << 22) >>> 30; // 10
+ out[currentPos++] = (val << 24) >>> 30;
+ out[currentPos++] = (val << 26) >>> 30;
+ out[currentPos++] = (val << 28) >>> 30;
+ out[currentPos++] = (val << 30) >>> 30;
+ break;
+ }
+ case 2: { // number : 9, bitwidth : 3
+ out[currentPos++] = (val << 5) >>> 29;
+ out[currentPos++] = (val << 8) >>> 29;
+ out[currentPos++] = (val << 11) >>> 29;
+ out[currentPos++] = (val << 14) >>> 29;
+ out[currentPos++] = (val << 17) >>> 29;
+ out[currentPos++] = (val << 20) >>> 29;
+ out[currentPos++] = (val << 23) >>> 29;
+ out[currentPos++] = (val << 26) >>> 29;
+ out[currentPos++] = (val << 29) >>> 29;
+ break;
+ }
+ case 3: { // number : 7, bitwidth : 4
+ out[currentPos++] = (val << 4) >>> 28;
+ out[currentPos++] = (val << 8) >>> 28;
+ out[currentPos++] = (val << 12) >>> 28;
+ out[currentPos++] = (val << 16) >>> 28;
+ out[currentPos++] = (val << 20) >>> 28;
+ out[currentPos++] = (val << 24) >>> 28;
+ out[currentPos++] = (val << 28) >>> 28;
+ break;
+ }
+ case 4: { // number : 5, bitwidth : 5
+ out[currentPos++] = (val << 7) >>> 27;
+ out[currentPos++] = (val << 12) >>> 27;
+ out[currentPos++] = (val << 17) >>> 27;
+ out[currentPos++] = (val << 22) >>> 27;
+ out[currentPos++] = (val << 27) >>> 27;
+ break;
+ }
+ case 5: { // number : 4, bitwidth : 7
+ out[currentPos++] = (val << 4) >>> 25;
+ out[currentPos++] = (val << 11) >>> 25;
+ out[currentPos++] = (val << 18) >>> 25;
+ out[currentPos++] = (val << 25) >>> 25;
+ break;
+ }
+ case 6: { // number : 3, bitwidth : 9
+ out[currentPos++] = (val << 5) >>> 23;
+ out[currentPos++] = (val << 14) >>> 23;
+ out[currentPos++] = (val << 23) >>> 23;
+ break;
+ }
+ case 7: { // number : 2, bitwidth : 14
+ out[currentPos++] = (val << 4) >>> 18;
+ out[currentPos++] = (val << 18) >>> 18;
+ break;
+ }
+ case 8: { // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 4) >>> 4;
+ break;
+ }
+ default: {
+ throw new RuntimeException("shouldn't happen: limited to 28-bit integers");
+ }
+ }
+ }
+ while (currentPos < finalout) {
+ int val = in[tmpinpos++];
+ int header = val >>> 28;
+ switch (header) {
+ case 0: { // number : 28, bitwidth : 1
+ final int howmany = finalout - currentPos;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (k + 4)) >>> 31;
+ }
+ break;
+ }
+ case 1: { // number : 14, bitwidth : 2
+ final int howmany = finalout - currentPos < 14 ? finalout - currentPos : 14;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (2 * k + 4)) >>> 30;
+ }
+ break;
+ }
+ case 2: { // number : 9, bitwidth : 3
+ final int howmany = finalout - currentPos < 9 ? finalout - currentPos : 9;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (3 * k + 5)) >>> 29;
+ }
+ break;
+ }
+ case 3: { // number : 7, bitwidth : 4
+ final int howmany = finalout - currentPos < 7 ? finalout - currentPos : 7;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (4 * k + 4)) >>> 28;
+ }
+ break;
+ }
+ case 4: { // number : 5, bitwidth : 5
+ final int howmany = finalout - currentPos < 5 ? finalout - currentPos : 5;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (5 * k + 7)) >>> 27;
+ }
+ break;
+ }
+ case 5: { // number : 4, bitwidth : 7
+ final int howmany = finalout - currentPos < 4 ? finalout - currentPos : 4;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (7 * k + 4)) >>> 25;
+ }
+ break;
+ }
+ case 6: { // number : 3, bitwidth : 9
+ final int howmany = finalout - currentPos < 3 ? finalout - currentPos : 3;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (9 * k + 5)) >>> 23;
+ }
+ break;
+ }
+ case 7: { // number : 2, bitwidth : 14
+ final int howmany = finalout - currentPos < 2 ? finalout - currentPos : 2;
+ for (int k = 0; k < howmany; ++k) {
+ out[currentPos++] = (val << (14 * k + 4)) >>> 18;
+ }
+ break;
+ }
+ case 8: { // number : 1, bitwidth : 28
+ out[currentPos++] = (val << 4) >>> 4;
+ break;
+ }
+ default: {
+ throw new RuntimeException("shouldn't happen");
+ }
+ }
+ }
+ outpos.set(currentPos);
+ inpos.set(tmpinpos);
- }
+ }
- @Override
- public void compress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
- if (inlength == 0)
- return;
- out[outpos.get()] = inlength;
- outpos.increment();
- headlessCompress(in, inpos, inlength, out, outpos);
- }
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ compressedPositions.add(inlength);
+ return inlength;
+ }
- @Override
- public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
- if (inlength == 0)
- return;
- final int outlength = in[inpos.get()];
- inpos.increment();
- headlessUncompress(in, inpos, inlength, out, outpos, outlength);
+ @Override
+ public void compress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
+ if (inlength == 0)
+ return;
+ out[outpos.get()] = inlength;
+ outpos.increment();
+ headlessCompress(in, inpos, inlength, out, outpos);
+ }
- }
+ @Override
+ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) {
+ if (inlength == 0)
+ return;
+ final int outlength = in[inpos.get()];
+ inpos.increment();
+ headlessUncompress(in, inpos, inlength, out, outpos, outlength);
- private final static int bitLength[] = { 1, 2, 3, 4, 5, 7, 9, 14, 28 };
+ }
- private final static int codeNum[] = { 28, 14, 9, 7, 5, 4, 3, 2, 1 };
+ private final static int bitLength[] = { 1, 2, 3, 4, 5, 7, 9, 14, 28 };
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
+ private final static int codeNum[] = { 28, 14, 9, 7, 5, 4, 3, 2, 1 };
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName();
+ }
}
diff --git a/src/main/java/me/lemire/integercompression/SkippableComposition.java b/src/main/java/me/lemire/integercompression/SkippableComposition.java
index a235c47..7dd4736 100644
--- a/src/main/java/me/lemire/integercompression/SkippableComposition.java
+++ b/src/main/java/me/lemire/integercompression/SkippableComposition.java
@@ -54,13 +54,23 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o
int init = inpos.get();
F1.headlessUncompress(in, inpos, inlength, out, outpos, num);
if (inpos.get() == init) {
- inpos.increment();
+ inpos.increment();
}
inlength -= inpos.get() - init;
num -= outpos.get();
F2.headlessUncompress(in, inpos, inlength, out, outpos, num);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int init = compressedPositions.get();
+ int maxLength = F1.maxHeadlessCompressedLength(compressedPositions, inlength);
+ maxLength += 1; // Add +1 for the potential F2 header. Question: is this header actually needed in the headless version?
+ inlength -= compressedPositions.get() - init;
+ maxLength += F2.maxHeadlessCompressedLength(compressedPositions, inlength);
+ return maxLength;
+ }
+
@Override
public String toString() {
return F1.toString() + "+" + F2.toString();
diff --git a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java
index 66143b9..b9bdc04 100644
--- a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java
+++ b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java
@@ -69,4 +69,21 @@ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out
public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out,
IntWrapper outpos, int num);
+ /**
+ * Compute the maximum number of integers that might be required to store
+ * the compressed form of a given input array segment, without headers.
+ *
+ * This is useful to pre-allocate the output buffer before calling
+ * {@link #headlessCompress(int[], IntWrapper, int, int[], IntWrapper)}.
+ *
+ *
+ * @param compressedPositions
+ * since not all schemes compress every input integer, this parameter
+ * returns how many input integers will actually be compressed.
+ * This is useful when composing multiple schemes.
+ * @param inlength
+ * number of integers to be compressed
+ * @return the maximum number of integers needed in the output array
+ */
+ int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength);
}
diff --git a/src/main/java/me/lemire/integercompression/UncompressibleInputException.java b/src/main/java/me/lemire/integercompression/UncompressibleInputException.java
deleted file mode 100644
index c490946..0000000
--- a/src/main/java/me/lemire/integercompression/UncompressibleInputException.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package me.lemire.integercompression;
-
-/**
- * This exception might be thrown if the input is poorly compressible.
- *
- */
-public class UncompressibleInputException extends RuntimeException {
-
- /**
- * Create new exception
- * @param string explanation for the exception
- */
- public UncompressibleInputException(String string) {
- super(string);
- }
-
- private static final long serialVersionUID = -798583799846489873L;
-
-}
diff --git a/src/main/java/me/lemire/integercompression/Util.java b/src/main/java/me/lemire/integercompression/Util.java
index 346e3b2..63fc918 100644
--- a/src/main/java/me/lemire/integercompression/Util.java
+++ b/src/main/java/me/lemire/integercompression/Util.java
@@ -15,13 +15,13 @@
public final class Util {
-
- // check whether x is small than y as unsigned ints (supported by Java 8 natively);
- protected static final boolean smallerorequalthan(int x, int y) {
- return (x + Integer.MIN_VALUE) <= (y + Integer.MIN_VALUE);
- }
-
- /**
+
+ // check whether x is small than y as unsigned ints (supported by Java 8 natively);
+ protected static final boolean smallerorequalthan(int x, int y) {
+ return (x + Integer.MIN_VALUE) <= (y + Integer.MIN_VALUE);
+ }
+
+ /**
* Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range
* of value
*
diff --git a/src/main/java/me/lemire/integercompression/VariableByte.java b/src/main/java/me/lemire/integercompression/VariableByte.java
index 92cfaeb..c9b04d0 100644
--- a/src/main/java/me/lemire/integercompression/VariableByte.java
+++ b/src/main/java/me/lemire/integercompression/VariableByte.java
@@ -21,6 +21,8 @@
*/
public class VariableByte implements IntegerCODEC, ByteIntegerCODEC, SkippableIntegerCODEC {
+ private static final int MAX_BYTES_PER_INT = 5;
+
private static byte extract7bits(int i, long val) {
return (byte) ((val >> (7 * i)) & ((1 << 7) - 1));
}
@@ -208,6 +210,14 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o
inpos.set(p + (s!=0 ? 1 : 0));
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int maxLengthInBytes = inlength * MAX_BYTES_PER_INT;
+ int maxLengthInInts = (maxLengthInBytes + Integer.BYTES - 1) / Integer.BYTES;
+ compressedPositions.add(inlength);
+ return maxLengthInInts;
+ }
+
/**
* Creates a new buffer of the requested size.
*
diff --git a/src/main/java/me/lemire/integercompression/benchmarktools/Benchmark.java b/src/main/java/me/lemire/integercompression/benchmarktools/Benchmark.java
index c5fee69..ef4a386 100644
--- a/src/main/java/me/lemire/integercompression/benchmarktools/Benchmark.java
+++ b/src/main/java/me/lemire/integercompression/benchmarktools/Benchmark.java
@@ -308,10 +308,10 @@ private static void testByteCodec(PrintWriter csvLog, int sparsity,
public static void main(String args[]) throws FileNotFoundException {
System.out
.println("# benchmark based on the ClusterData model from:");
- System.out.println("# Vo Ngoc Anh and Alistair Moffat. ");
- System.out.println("# Index compression using 64-bit words.");
+ System.out.println("# Vo Ngoc Anh and Alistair Moffat. ");
+ System.out.println("# Index compression using 64-bit words.");
System.out
- .println("# Softw. Pract. Exper.40, 2 (February 2010), 131-147. ");
+ .println("# Softw. Pract. Exper.40, 2 (February 2010), 131-147. ");
System.out.println();
PrintWriter writer = null;
diff --git a/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java b/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java
index 363b841..b930568 100644
--- a/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java
+++ b/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java
@@ -241,10 +241,10 @@ private static void testCodec(PrintWriter csvLog, int sparsity, Object c,
*/
public static void main(String args[]) throws FileNotFoundException {
System.out.println("# benchmark based on the ClusterData model from:");
- System.out.println("# Vo Ngoc Anh and Alistair Moffat. ");
- System.out.println("# Index compression using 64-bit words.");
+ System.out.println("# Vo Ngoc Anh and Alistair Moffat. ");
+ System.out.println("# Index compression using 64-bit words.");
System.out
- .println("# Softw. Pract. Exper.40, 2 (February 2010), 131-147. ");
+ .println("# Softw. Pract. Exper.40, 2 (February 2010), 131-147. ");
System.out.println();
PrintWriter writer = null;
diff --git a/src/main/java/me/lemire/integercompression/differential/IntegratedBinaryPacking.java b/src/main/java/me/lemire/integercompression/differential/IntegratedBinaryPacking.java
index 7e1c161..f50a367 100644
--- a/src/main/java/me/lemire/integercompression/differential/IntegratedBinaryPacking.java
+++ b/src/main/java/me/lemire/integercompression/differential/IntegratedBinaryPacking.java
@@ -49,7 +49,8 @@
public class IntegratedBinaryPacking implements IntegratedIntegerCODEC,
SkippableIntegratedIntegerCODEC {
- static final int BLOCK_SIZE = 32;
+ public static final int BLOCK_SIZE = 32;
+ private static final int MAX_BIT_WIDTH = Integer.SIZE;
@Override
public void compress(int[] in, IntWrapper inpos, int inlength, int[] out,
@@ -170,4 +171,13 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
initvalue.set(initoffset);
inpos.set(tmpinpos);
}
+
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int blockCount = inlength / BLOCK_SIZE;
+ int headersSizeInInts = blockCount / Integer.BYTES + (blockCount % Integer.BYTES);
+ int blocksSizeInInts = blockCount * MAX_BIT_WIDTH;
+ compressedPositions.add(blockCount * BLOCK_SIZE);
+ return headersSizeInInts + blocksSizeInInts;
+ }
}
diff --git a/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java b/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java
index 5808bdd..1d935c4 100644
--- a/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java
+++ b/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java
@@ -3,7 +3,6 @@
import java.util.Arrays;
import me.lemire.integercompression.IntWrapper;
-import me.lemire.integercompression.UncompressibleInputException;
/**
* This is a convenience class that wraps a codec to provide
@@ -36,19 +35,14 @@ public IntegratedIntCompressor() {
*
* @param input array to be compressed
* @return compressed array
- * @throws UncompressibleInputException if the data is too poorly compressible
*/
public int[] compress(int[] input) {
- int [] compressed = new int[input.length + input.length / 100 + 1024];
+ int maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length);
+ int [] compressed = new int[maxCompressedLength + 1]; // +1 to store the length of the input
compressed[0] = input.length;
IntWrapper outpos = new IntWrapper(1);
IntWrapper initvalue = new IntWrapper(0);
- try {
- codec.headlessCompress(input, new IntWrapper(0), input.length, compressed, outpos, initvalue);
- } catch (IndexOutOfBoundsException ioebe) {
- throw new UncompressibleInputException(
- "Your input is too poorly compressible with the current codec : " + codec);
- }
+ codec.headlessCompress(input, new IntWrapper(0), input.length, compressed, outpos, initvalue);
compressed = Arrays.copyOf(compressed,outpos.intValue());
return compressed;
}
diff --git a/src/main/java/me/lemire/integercompression/differential/IntegratedVariableByte.java b/src/main/java/me/lemire/integercompression/differential/IntegratedVariableByte.java
index 918a900..a577031 100644
--- a/src/main/java/me/lemire/integercompression/differential/IntegratedVariableByte.java
+++ b/src/main/java/me/lemire/integercompression/differential/IntegratedVariableByte.java
@@ -24,6 +24,8 @@
public class IntegratedVariableByte implements IntegratedIntegerCODEC, IntegratedByteIntegerCODEC,
SkippableIntegratedIntegerCODEC {
+ private static final int MAX_BYTES_PER_INT = 5;
+
private static byte extract7bits(int i, long val) {
return (byte)((val >> (7 * i)) & ((1 << 7) - 1));
}
@@ -257,6 +259,14 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
inpos.set(p + (s!=0 ? 1 : 0));
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int maxLengthInBytes = inlength * MAX_BYTES_PER_INT;
+ int maxLengthInInts = (maxLengthInBytes + Integer.BYTES - 1) / Integer.BYTES;
+ compressedPositions.add(inlength);
+ return maxLengthInInts;
+ }
+
/**
* Creates a new buffer of the requested size.
*
diff --git a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java
index 09c4dd8..a1379ad 100644
--- a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java
+++ b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java
@@ -68,7 +68,7 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
int init = inpos.get();
F1.headlessUncompress(in, inpos, inlength, out, outpos,num,initvalue);
if (inpos.get() == init) {
- inpos.increment();
+ inpos.increment();
}
inlength -= inpos.get() - init;
@@ -76,4 +76,13 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
F2.headlessUncompress(in, inpos, inlength, out, outpos,num,initvalue);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int init = compressedPositions.get();
+ int maxLength = F1.maxHeadlessCompressedLength(compressedPositions, inlength);
+ maxLength += 1; // Add +1 for the potential F2 header. Question: is this header actually needed in the headless version?
+ inlength -= compressedPositions.get() - init;
+ maxLength += F2.maxHeadlessCompressedLength(compressedPositions, inlength);
+ return maxLength;
+ }
}
diff --git a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedIntegerCODEC.java b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedIntegerCODEC.java
index 8b7fd4b..e2df754 100644
--- a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedIntegerCODEC.java
+++ b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedIntegerCODEC.java
@@ -71,4 +71,21 @@ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out
public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out,
IntWrapper outpos, int num, IntWrapper initvalue);
+ /**
+ * Compute the maximum number of integers that might be required to store
+ * the compressed form of a given input array segment, without headers.
+ *
+ * This is useful to pre-allocate the output buffer before calling
+ * {@link #headlessCompress(int[], IntWrapper, int, int[], IntWrapper, IntWrapper)}.
+ *
+ *
+ * @param compressedPositions
+ * since not all schemes compress every input integer, this parameter
+ * returns how many input integers will actually be compressed.
+ * This is useful when composing multiple schemes.
+ * @param inlength
+ * number of integers to be compressed
+ * @return the maximum number of integers needed in the output array
+ */
+ int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength);
}
diff --git a/src/main/java/me/lemire/integercompression/vector/VectorFastPFOR.java b/src/main/java/me/lemire/integercompression/vector/VectorFastPFOR.java
index 0b6ca17..7374fa5 100644
--- a/src/main/java/me/lemire/integercompression/vector/VectorFastPFOR.java
+++ b/src/main/java/me/lemire/integercompression/vector/VectorFastPFOR.java
@@ -229,6 +229,11 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength,
}
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ throw new UnsupportedOperationException("Calculating the max compressed length is not supported yet.");
+ }
+
private void loadMetaData(int[] in, int inexcept, int bytesize) {
// Arrays.fill(bem, (byte)0);
int len = (bytesize + 3) / 4;
diff --git a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java
index 33bb8f1..b6ea58f 100644
--- a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java
+++ b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java
@@ -23,8 +23,9 @@
* @author Benoit Lacelle
*/
public final class LongBinaryPacking implements LongCODEC, SkippableLongCODEC {
- final static int BLOCK_SIZE = 64;
-
+ public final static int BLOCK_SIZE = 64;
+ private static final int MAX_BIT_WIDTH = Long.SIZE;
+
@Override
public void compress(long[] in, IntWrapper inpos, int inlength,
long[] out, IntWrapper outpos) {
@@ -136,6 +137,15 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength,
inpos.set(tmpinpos);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int blockCount = inlength / BLOCK_SIZE;
+ int headersSizeInLongs = blockCount / Long.BYTES + (blockCount % Long.BYTES);
+ int blocksSizeInLongs = blockCount * MAX_BIT_WIDTH;
+ compressedPositions.add(blockCount * BLOCK_SIZE);
+ return headersSizeInLongs + blocksSizeInLongs;
+ }
+
@Override
public String toString() {
return this.getClass().getSimpleName();
diff --git a/src/main/java/me/lemire/longcompression/LongCODEC.java b/src/main/java/me/lemire/longcompression/LongCODEC.java
index 1068f9f..0951ffd 100644
--- a/src/main/java/me/lemire/longcompression/LongCODEC.java
+++ b/src/main/java/me/lemire/longcompression/LongCODEC.java
@@ -36,7 +36,7 @@ public interface LongCODEC {
* where to write in the output array
*/
public void compress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos);
+ long[] out, IntWrapper outpos);
/**
* Uncompress data from an array to another array.
@@ -57,6 +57,6 @@ public void compress(long[] in, IntWrapper inpos, int inlength,
* where to start writing the uncompressed output in out
*/
public void uncompress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos);
+ long[] out, IntWrapper outpos);
}
diff --git a/src/main/java/me/lemire/longcompression/LongComposition.java b/src/main/java/me/lemire/longcompression/LongComposition.java
index 1394a78..5111a51 100644
--- a/src/main/java/me/lemire/longcompression/LongComposition.java
+++ b/src/main/java/me/lemire/longcompression/LongComposition.java
@@ -37,7 +37,7 @@ public LongComposition(LongCODEC f1, LongCODEC f2) {
@Override
public void compress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos) {
+ long[] out, IntWrapper outpos) {
if (inlength == 0) {
return;
}
@@ -54,7 +54,7 @@ public void compress(long[] in, IntWrapper inpos, int inlength,
@Override
public void uncompress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos) {
+ long[] out, IntWrapper outpos) {
if (inlength == 0)
return;
final int init = inpos.get();
diff --git a/src/main/java/me/lemire/longcompression/LongCompressor.java b/src/main/java/me/lemire/longcompression/LongCompressor.java
index a2c79fd..246647f 100644
--- a/src/main/java/me/lemire/longcompression/LongCompressor.java
+++ b/src/main/java/me/lemire/longcompression/LongCompressor.java
@@ -3,7 +3,6 @@
import java.util.Arrays;
import me.lemire.integercompression.IntWrapper;
-import me.lemire.integercompression.UncompressibleInputException;
/**
* This is a convenience class that wraps a codec to provide
@@ -37,20 +36,14 @@ public LongCompressor() {
*
* @param input array to be compressed
* @return compressed array
- * @throws UncompressibleInputException if the data is too poorly compressible
*/
public long[] compress(long[] input) {
- long[] compressed = new long[input.length + input.length / 100 + 1024];
+ int maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length);
+ long[] compressed = new long[maxCompressedLength + 1]; // +1 to store the length of the input
// Store at index=0 the length of the input, hence enabling .headlessCompress
compressed[0] = input.length;
IntWrapper outpos = new IntWrapper(1);
- try {
- codec.headlessCompress(input, new IntWrapper(0),
- input.length, compressed, outpos);
- } catch (IndexOutOfBoundsException ioebe) {
- throw new UncompressibleInputException("Your input is too poorly compressible "
- + "with the current codec : "+codec);
- }
+ codec.headlessCompress(input, new IntWrapper(0), input.length, compressed, outpos);
compressed = Arrays.copyOf(compressed,outpos.intValue());
return compressed;
}
diff --git a/src/main/java/me/lemire/longcompression/LongJustCopy.java b/src/main/java/me/lemire/longcompression/LongJustCopy.java
index 7a5a67a..95abc1e 100644
--- a/src/main/java/me/lemire/longcompression/LongJustCopy.java
+++ b/src/main/java/me/lemire/longcompression/LongJustCopy.java
@@ -17,7 +17,7 @@ public final class LongJustCopy implements LongCODEC, SkippableLongCODEC {
@Override
public void headlessCompress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos) {
+ long[] out, IntWrapper outpos) {
System.arraycopy(in, inpos.get(), out, outpos.get(), inlength);
inpos.add(inlength);
outpos.add(inlength);
@@ -25,7 +25,7 @@ public void headlessCompress(long[] in, IntWrapper inpos, int inlength,
@Override
public void uncompress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos) {
+ long[] out, IntWrapper outpos) {
headlessUncompress(in,inpos,inlength,out,outpos,inlength);
}
@@ -36,16 +36,22 @@ public String toString() {
@Override
public void headlessUncompress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos, int num) {
+ long[] out, IntWrapper outpos, int num) {
System.arraycopy(in, inpos.get(), out, outpos.get(), num);
inpos.add(num);
outpos.add(num);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ compressedPositions.add(inlength);
+ return inlength;
+ }
+
@Override
public void compress(long[] in, IntWrapper inpos, int inlength,
- long[] out, IntWrapper outpos) {
+ long[] out, IntWrapper outpos) {
headlessCompress(in,inpos,inlength,out,outpos);
}
diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java
index ad2b0eb..e60ebd0 100644
--- a/src/main/java/me/lemire/longcompression/LongVariableByte.java
+++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java
@@ -22,6 +22,7 @@
* @author Benoit Lacelle
*/
public class LongVariableByte implements LongCODEC, ByteLongCODEC, SkippableLongCODEC {
+ private static final int MAX_BYTES_PER_INT = 10;
private static byte extract7bits(int i, long val) {
return (byte) ((val >>> (7 * i)) & ((1 << 7) - 1));
@@ -326,6 +327,14 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[]
inpos.set(p + (s!=0 ? 1 : 0));
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int maxLengthInBytes = inlength * MAX_BYTES_PER_INT;
+ int maxLengthInLongs = (maxLengthInBytes + Long.BYTES - 1) / Long.BYTES;
+ compressedPositions.add(inlength);
+ return maxLengthInLongs;
+ }
+
/**
* Creates a new buffer of the requested size.
*
diff --git a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java
index 7fe1fe5..33fd562 100644
--- a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java
+++ b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java
@@ -67,4 +67,21 @@ public void headlessCompress(long[] in, IntWrapper inpos, int inlength, long[] o
public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[] out,
IntWrapper outpos, int num);
+ /**
+ * Compute the maximum number of longs that might be required to store
+ * the compressed form of a given input array segment, without headers.
+ *
+ * This is useful to pre-allocate the output buffer before calling
+ * {@link #headlessCompress(long[], IntWrapper, int, long[], IntWrapper)}.
+ *
+ *
+ * @param compressedPositions
+ * since not all schemes compress every input integer, this parameter
+ * returns how many input integers will actually be compressed.
+ * This is useful when composing multiple schemes.
+ * @param inlength
+ * number of longs to be compressed
+ * @return the maximum number of longs needed in the output array
+ */
+ int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength);
}
diff --git a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java
index 5568489..0f9800e 100644
--- a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java
+++ b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java
@@ -55,13 +55,23 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[]
int init = inpos.get();
F1.headlessUncompress(in, inpos, inlength, out, outpos, num);
if (inpos.get() == init) {
- inpos.increment();
+ inpos.increment();
}
inlength -= inpos.get() - init;
num -= outpos.get();
F2.headlessUncompress(in, inpos, inlength, out, outpos, num);
}
+ @Override
+ public int maxHeadlessCompressedLength(IntWrapper compressedPositions, int inlength) {
+ int init = compressedPositions.get();
+ int maxLength = F1.maxHeadlessCompressedLength(compressedPositions, inlength);
+ maxLength += 1; // Add +1 for the potential F2 header. Question: is this header actually needed in the headless version?
+ inlength -= compressedPositions.get() - init;
+ maxLength += F2.maxHeadlessCompressedLength(compressedPositions, inlength);
+ return maxLength;
+ }
+
@Override
public String toString() {
return F1.toString() + "+" + F2.toString();
diff --git a/src/main/java/me/lemire/longcompression/differential/LongDelta.java b/src/main/java/me/lemire/longcompression/differential/LongDelta.java
index 2b0e077..184e53c 100644
--- a/src/main/java/me/lemire/longcompression/differential/LongDelta.java
+++ b/src/main/java/me/lemire/longcompression/differential/LongDelta.java
@@ -66,7 +66,7 @@ public static long delta(long[] data, int start, int length, int init) {
* @return next initial vale
*/
public static long delta(long[] data, int start, int length, int init,
- long[] out) {
+ long[] out) {
for (int i = length - 1; i > 0; --i) {
out[i] = data[start + i] - data[start + i - 1];
}
@@ -98,7 +98,7 @@ public static void fastinverseDelta(long[] data) {
int sz0 = data.length / 4 * 4;
int i = 1;
if (sz0 >= 4) {
- long a = data[0];
+ long a = data[0];
for (; i < sz0 - 4; i += 4) {
a = data[i] += a;
a = data[i + 1] += a;
@@ -132,7 +132,7 @@ public static long fastinverseDelta(long[] data, int start, int length,
int sz0 = length / 4 * 4;
int i = 1;
if (sz0 >= 4) {
- long a = data[start];
+ long a = data[start];
for (; i < sz0 - 4; i += 4) {
a = data[start + i] += a;
a = data[start + i + 1] += a;
diff --git a/src/test/java/me/lemire/integercompression/AdhocTest.java b/src/test/java/me/lemire/integercompression/AdhocTest.java
index 8fd4049..ee911b3 100644
--- a/src/test/java/me/lemire/integercompression/AdhocTest.java
+++ b/src/test/java/me/lemire/integercompression/AdhocTest.java
@@ -22,13 +22,48 @@
@SuppressWarnings({ "static-method" })
public class AdhocTest {
-
- /**
- *
- */
+ @Test
+ public void testIssue59() {
+ FastPFOR128 fastpfor = new FastPFOR128();
+
+ int N = 9984;
+ int[] data = new int[N];
+ for (var i = 0; i < N; i += 150) {
+ data[i] = i;
+ }
+
+ int[] compressedoutput1 = new int[N + 1024];
+
+ IntWrapper inputoffset1 = new IntWrapper(0);
+ IntWrapper outputoffset1 = new IntWrapper(0);
+
+ fastpfor.compress(data, inputoffset1, N, compressedoutput1, outputoffset1);
+ int compressedsize1 = outputoffset1.get();
+
+ int[] recovered1 = new int[N];
+ inputoffset1 = new IntWrapper(0);
+ outputoffset1 = new IntWrapper(0);
+ fastpfor.uncompress(compressedoutput1, outputoffset1, compressedsize1, recovered1, inputoffset1);
+ Assert.assertArrayEquals(data, recovered1);
+
+ int[] compressedoutput2 = new int[N + 1024];
+
+ IntWrapper inputoffset2 = new IntWrapper(0);
+ IntWrapper outputoffset2 = new IntWrapper(0);
+
+ fastpfor.compress(data, inputoffset2, N, compressedoutput2, outputoffset2);
+ int compressedsize2 = outputoffset2.get();
+
+ int[] recovered2 = new int[N];
+ inputoffset2 = new IntWrapper(0);
+ outputoffset2 = new IntWrapper(0);
+ fastpfor.uncompress(compressedoutput2, outputoffset2, compressedsize2, recovered2, inputoffset2);
+ Assert.assertArrayEquals(data, recovered2);
+ }
+
@Test
public void testIssue29() {
- for(int x = 0; x < 64; x++) {
+ for(int x = 0; x < 64; x++) {
int[] a = {2, 3, 4, 5};
int[] b = new int[90];
int[] c = new int[a.length];
@@ -42,7 +77,7 @@ public void testIssue29() {
IntWrapper cOffset = new IntWrapper(0);
codec.uncompress(b, bOffset, len, c, cOffset);
Assert.assertArrayEquals(a,c);
- }
+ }
}
/**
@@ -50,20 +85,20 @@ public void testIssue29() {
*/
@Test
public void testIssue29b() {
- for(int x = 0; x < 64; x++) {
- int[] a = {2, 3, 4, 5};
- int[] b = new int[90];
- int[] c = new int[a.length];
- SkippableIntegerCODEC codec = new SkippableComposition(new BinaryPacking(), new VariableByte());
- IntWrapper aOffset = new IntWrapper(0);
- IntWrapper bOffset = new IntWrapper(x);
- codec.headlessCompress(a, aOffset, a.length, b, bOffset);
- int len = bOffset.get() - x;
- bOffset.set(x);
- IntWrapper cOffset = new IntWrapper(0);
- codec.headlessUncompress(b, bOffset, len, c, cOffset, a.length);
- Assert.assertArrayEquals(a,c);
- }
+ for(int x = 0; x < 64; x++) {
+ SkippableIntegerCODEC codec = new SkippableComposition(new BinaryPacking(), new VariableByte());
+ int[] a = {2, 3, 4, 5};
+ int[] b = new int[x + codec.maxHeadlessCompressedLength(new IntWrapper(0), a.length)];
+ int[] c = new int[a.length];
+ IntWrapper aOffset = new IntWrapper(0);
+ IntWrapper bOffset = new IntWrapper(x);
+ codec.headlessCompress(a, aOffset, a.length, b, bOffset);
+ int len = bOffset.get() - x;
+ bOffset.set(x);
+ IntWrapper cOffset = new IntWrapper(0);
+ codec.headlessUncompress(b, bOffset, len, c, cOffset, a.length);
+ Assert.assertArrayEquals(a,c);
+ }
}
@@ -71,30 +106,27 @@ public void testIssue29b() {
*
*/
@Test
- public void testIssue41() {
- for (int x = 0; x < 64; x++) {
- int[] a = { 2, 3, 4, 5 };
- int[] b = new int[90];
- int[] c = new int[a.length];
- SkippableIntegratedIntegerCODEC codec = new SkippableIntegratedComposition(new IntegratedBinaryPacking(),
- new IntegratedVariableByte());
- IntWrapper aOffset = new IntWrapper(0);
- IntWrapper bOffset = new IntWrapper(x);
- IntWrapper initValue = new IntWrapper(0);
-
- codec.headlessCompress(a, aOffset, a.length, b, bOffset, initValue);
- int len = bOffset.get() - x;
- bOffset.set(x);
- IntWrapper cOffset = new IntWrapper(0);
- initValue = new IntWrapper(0);
- codec.headlessUncompress(b, bOffset, len, c, cOffset, a.length, initValue);
- Assert.assertArrayEquals(a, c);
- }
- }
+ public void testIssue41() {
+ for (int x = 0; x < 64; x++) {
+ SkippableIntegratedIntegerCODEC codec = new SkippableIntegratedComposition(new IntegratedBinaryPacking(),
+ new IntegratedVariableByte());
+ int[] a = { 2, 3, 4, 5 };
+ int[] b = new int[x + codec.maxHeadlessCompressedLength(new IntWrapper(0), a.length)];
+ int[] c = new int[a.length];
+ IntWrapper aOffset = new IntWrapper(0);
+ IntWrapper bOffset = new IntWrapper(x);
+ IntWrapper initValue = new IntWrapper(0);
+
+ codec.headlessCompress(a, aOffset, a.length, b, bOffset, initValue);
+ int len = bOffset.get() - x;
+ bOffset.set(x);
+ IntWrapper cOffset = new IntWrapper(0);
+ initValue = new IntWrapper(0);
+ codec.headlessUncompress(b, bOffset, len, c, cOffset, a.length, initValue);
+ Assert.assertArrayEquals(a, c);
+ }
+ }
- /**
- * a test
- */
@Test
public void biggerCompressedArray0() {
// No problem: for comparison.
@@ -102,12 +134,8 @@ public void biggerCompressedArray0() {
assertSymmetry(c, 0, 16384);
c = new Composition(new FastPFOR(), new VariableByte());
assertSymmetry(c, 0, 16384);
-
}
- /**
- * a test
- */
@Test
public void biggerCompressedArray1() {
// Compressed array is bigger than original, because of VariableByte.
@@ -115,9 +143,6 @@ public void biggerCompressedArray1() {
assertSymmetry(c, -1);
}
- /**
- * a test
- */
@Test
public void biggerCompressedArray2() {
// Compressed array is bigger than original, because of Composition.
diff --git a/src/test/java/me/lemire/integercompression/BasicTest.java b/src/test/java/me/lemire/integercompression/BasicTest.java
index b5f292e..b29ae0d 100644
--- a/src/test/java/me/lemire/integercompression/BasicTest.java
+++ b/src/test/java/me/lemire/integercompression/BasicTest.java
@@ -48,35 +48,35 @@ public class BasicTest {
new GroupSimple9(),
new Composition(new XorBinaryPacking(), new VariableByte()),
new Composition(new DeltaZigzagBinaryPacking(),
- new DeltaZigzagVariableByte()) };
+ new DeltaZigzagVariableByte()) };
- /**
+ /**
* This tests with a compressed array with various offset
*/
- @Test
- public void saulTest() {
- for (IntegerCODEC C : codecs) {
- for (int x = 0; x < 50; ++x) {
- int[] a = { 2, 3, 4, 5 };
- int[] b = new int[90];
- int[] c = new int[a.length];
-
- IntWrapper aOffset = new IntWrapper(0);
- IntWrapper bOffset = new IntWrapper(x);
- C.compress(a, aOffset, a.length, b, bOffset);
- int len = bOffset.get() - x;
-
- bOffset.set(x);
- IntWrapper cOffset = new IntWrapper(0);
- C.uncompress(b, bOffset, len, c, cOffset);
- if(!Arrays.equals(a, c)) {
- System.out.println("Problem with "+C);
- }
- assertArrayEquals(a, c);
-
- }
- }
- }
+ @Test
+ public void saulTest() {
+ for (IntegerCODEC C : codecs) {
+ for (int x = 0; x < 50; ++x) {
+ int[] a = { 2, 3, 4, 5 };
+ int[] b = new int[90];
+ int[] c = new int[a.length];
+
+ IntWrapper aOffset = new IntWrapper(0);
+ IntWrapper bOffset = new IntWrapper(x);
+ C.compress(a, aOffset, a.length, b, bOffset);
+ int len = bOffset.get() - x;
+
+ bOffset.set(x);
+ IntWrapper cOffset = new IntWrapper(0);
+ C.uncompress(b, bOffset, len, c, cOffset);
+ if(!Arrays.equals(a, c)) {
+ System.out.println("Problem with "+C);
+ }
+ assertArrayEquals(a, c);
+
+ }
+ }
+ }
/**
*
*/
diff --git a/src/test/java/me/lemire/integercompression/ByteBasicTest.java b/src/test/java/me/lemire/integercompression/ByteBasicTest.java
index 93112c3..2b2d4f1 100644
--- a/src/test/java/me/lemire/integercompression/ByteBasicTest.java
+++ b/src/test/java/me/lemire/integercompression/ByteBasicTest.java
@@ -28,32 +28,32 @@ public class ByteBasicTest {
new IntegratedVariableByte(),
};
- /**
+ /**
*
*/
- @Test
- public void saulTest() {
- for (ByteIntegerCODEC C : codecs) {
- for (int x = 0; x < 50 * 4; ++x) {
- int[] a = { 2, 3, 4, 5 };
- byte[] b = new byte[90*4];
- int[] c = new int[a.length];
+ @Test
+ public void saulTest() {
+ for (ByteIntegerCODEC C : codecs) {
+ for (int x = 0; x < 50 * 4; ++x) {
+ int[] a = { 2, 3, 4, 5 };
+ byte[] b = new byte[90*4];
+ int[] c = new int[a.length];
- IntWrapper aOffset = new IntWrapper(0);
- IntWrapper bOffset = new IntWrapper(x);
- C.compress(a, aOffset, a.length, b, bOffset);
- int len = bOffset.get() - x;
+ IntWrapper aOffset = new IntWrapper(0);
+ IntWrapper bOffset = new IntWrapper(x);
+ C.compress(a, aOffset, a.length, b, bOffset);
+ int len = bOffset.get() - x;
- bOffset.set(x);
- IntWrapper cOffset = new IntWrapper(0);
- C.uncompress(b, bOffset, len, c, cOffset);
- if(!Arrays.equals(a, c)) {
- System.out.println("Problem with "+C);
- }
- assertArrayEquals(a, c);
- }
- }
- }
+ bOffset.set(x);
+ IntWrapper cOffset = new IntWrapper(0);
+ C.uncompress(b, bOffset, len, c, cOffset);
+ if(!Arrays.equals(a, c)) {
+ System.out.println("Problem with "+C);
+ }
+ assertArrayEquals(a, c);
+ }
+ }
+ }
/**
*
*/
diff --git a/src/test/java/me/lemire/integercompression/ExampleTest.java b/src/test/java/me/lemire/integercompression/ExampleTest.java
index f6038b8..c63c69b 100644
--- a/src/test/java/me/lemire/integercompression/ExampleTest.java
+++ b/src/test/java/me/lemire/integercompression/ExampleTest.java
@@ -17,305 +17,303 @@
*
*/
public class ExampleTest {
- /**
- *
- */
- @Test
-
- public void superSimpleExample() {
- IntegratedIntCompressor iic = new IntegratedIntCompressor();
- int[] data = new int[2342351];
- for (int k = 0; k < data.length; ++k)
- data[k] = k;
- System.out.println("Compressing " + data.length + " integers using friendly interface");
- int[] compressed = iic.compress(data);
- int[] recov = iic.uncompress(compressed);
- System.out
- .println("compressed from " + data.length * 4 / 1024 + "KB to " + compressed.length * 4 / 1024 + "KB");
- if (!Arrays.equals(recov, data))
- throw new RuntimeException("bug");
- }
-
- /**
- *
- */
- @Test
-
- public void basicExample() {
- int[] data = new int[2342351];
- System.out.println("Compressing " + data.length + " integers in one go");
- // data should be sorted for best
- // results
- for (int k = 0; k < data.length; ++k)
- data[k] = k;
- // Very important: the data is in sorted order!!! If not, you
- // will get very poor compression with IntegratedBinaryPacking,
- // you should use another CODEC.
-
- // next we compose a CODEC. Most of the processing
- // will be done with binary packing, and leftovers will
- // be processed using variable byte
- IntegratedIntegerCODEC codec = new IntegratedComposition(new IntegratedBinaryPacking(),
- new IntegratedVariableByte());
- // output vector should be large enough...
- int[] compressed = new int[data.length + 1024];
- // compressed might not be large enough in some cases
- // if you get java.lang.ArrayIndexOutOfBoundsException, try
- // allocating more memory
-
- /**
- *
- * compressing
- *
- */
- IntWrapper inputoffset = new IntWrapper(0);
- IntWrapper outputoffset = new IntWrapper(0);
- codec.compress(data, inputoffset, data.length, compressed, outputoffset);
- // got it!
- // inputoffset should be at data.length but outputoffset tells
- // us where we are...
- System.out.println(
- "compressed from " + data.length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
- // we can repack the data: (optional)
- compressed = Arrays.copyOf(compressed, outputoffset.intValue());
-
- /**
- *
- * now uncompressing
- *
- * This assumes that we otherwise know how many integers have been
- * compressed. See basicExampleHeadless for a more general case.
- */
- int[] recovered = new int[data.length];
- IntWrapper recoffset = new IntWrapper(0);
- codec.uncompress(compressed, new IntWrapper(0), compressed.length, recovered, recoffset);
- if (Arrays.equals(data, recovered))
- System.out.println("data is recovered without loss");
- else
- throw new RuntimeException("bug"); // could use assert
- System.out.println();
- }
-
- /**
- * Like the basicExample, but we store the input array size manually.
- */
- @Test
- public void basicExampleHeadless() {
- int[] data = new int[2342351];
- System.out.println("Compressing " + data.length + " integers in one go using the headless approach");
- // data should be sorted for best
- // results
- for (int k = 0; k < data.length; ++k)
- data[k] = k;
- // Very important: the data is in sorted order!!! If not, you
- // will get very poor compression with IntegratedBinaryPacking,
- // you should use another CODEC.
-
- // next we compose a CODEC. Most of the processing
- // will be done with binary packing, and leftovers will
- // be processed using variable byte
- SkippableIntegratedComposition codec = new SkippableIntegratedComposition(new IntegratedBinaryPacking(),
- new IntegratedVariableByte());
- // output vector should be large enough...
- int[] compressed = new int[data.length + 1024];
- // compressed might not be large enough in some cases
- // if you get java.lang.ArrayIndexOutOfBoundsException, try
- // allocating more memory
-
- /**
- *
- * compressing
- *
- */
- IntWrapper inputoffset = new IntWrapper(0);
- IntWrapper outputoffset = new IntWrapper(1);
- compressed[0] = data.length; // we manually store how many integers we
- codec.headlessCompress(data, inputoffset, data.length, compressed, outputoffset, new IntWrapper(0));
- // got it!
- // inputoffset should be at data.length but outputoffset tells
- // us where we are...
- System.out.println(
- "compressed from " + data.length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
- // we can repack the data: (optional)
- compressed = Arrays.copyOf(compressed, outputoffset.intValue());
-
- /**
- *
- * now uncompressing
- *
- */
- int howmany = compressed[0];// we manually stored the number of
- // compressed integers
- int[] recovered = new int[howmany];
- IntWrapper recoffset = new IntWrapper(0);
- codec.headlessUncompress(compressed, new IntWrapper(1), compressed.length, recovered, recoffset, howmany, new IntWrapper(0));
- if (Arrays.equals(data, recovered))
- System.out.println("data is recovered without loss");
- else
- throw new RuntimeException("bug"); // could use assert
- System.out.println();
- }
-
- /**
- * This is an example to show you can compress unsorted integers as long as
- * most are small.
- */
- @Test
- public void unsortedExample() {
- final int N = 1333333;
- int[] data = new int[N];
- // initialize the data (most will be small
- for (int k = 0; k < N; k += 1)
- data[k] = 3;
- // throw some larger values
- for (int k = 0; k < N; k += 5)
- data[k] = 100;
- for (int k = 0; k < N; k += 533)
- data[k] = 10000;
- int[] compressed = new int[N + 1024];// could need more
- IntegerCODEC codec = new Composition(new FastPFOR(), new VariableByte());
- // compressing
- IntWrapper inputoffset = new IntWrapper(0);
- IntWrapper outputoffset = new IntWrapper(0);
- codec.compress(data, inputoffset, data.length, compressed, outputoffset);
- System.out.println("compressed unsorted integers from " + data.length * 4 / 1024 + "KB to "
- + outputoffset.intValue() * 4 / 1024 + "KB");
- // we can repack the data: (optional)
- compressed = Arrays.copyOf(compressed, outputoffset.intValue());
-
- int[] recovered = new int[N];
- IntWrapper recoffset = new IntWrapper(0);
- codec.uncompress(compressed, new IntWrapper(0), compressed.length, recovered, recoffset);
- if (Arrays.equals(data, recovered))
- System.out.println("data is recovered without loss");
- else
- throw new RuntimeException("bug"); // could use assert
- System.out.println();
-
- }
-
- /**
- * This is like the basic example, but we show how to process larger arrays
- * in chunks.
- *
- * Some of this code was written by Pavel Klinov.
- */
- @Test
- public void advancedExample() {
- int TotalSize = 2342351; // some arbitrary number
- int ChunkSize = 16384; // size of each chunk, choose a multiple of 128
- System.out.println("Compressing " + TotalSize + " integers using chunks of " + ChunkSize + " integers ("
- + ChunkSize * 4 / 1024 + "KB)");
- System.out.println("(It is often better for applications to work in chunks fitting in CPU cache.)");
- int[] data = new int[TotalSize];
- // data should be sorted for best
- // results
- for (int k = 0; k < data.length; ++k)
- data[k] = k;
- // next we compose a CODEC. Most of the processing
- // will be done with binary packing, and leftovers will
- // be processed using variable byte, using variable byte
- // only for the last chunk!
- IntegratedIntegerCODEC regularcodec = new IntegratedBinaryPacking();
- IntegratedVariableByte ivb = new IntegratedVariableByte();
- IntegratedIntegerCODEC lastcodec = new IntegratedComposition(regularcodec, ivb);
- // output vector should be large enough...
- int[] compressed = new int[TotalSize + 1024];
-
- /**
- *
- * compressing
- *
- */
- IntWrapper inputoffset = new IntWrapper(0);
- IntWrapper outputoffset = new IntWrapper(0);
- for (int k = 0; k < TotalSize / ChunkSize; ++k)
- regularcodec.compress(data, inputoffset, ChunkSize, compressed, outputoffset);
- lastcodec.compress(data, inputoffset, TotalSize % ChunkSize, compressed, outputoffset);
- // got it!
- // inputoffset should be at data.length but outputoffset tells
- // us where we are...
- System.out.println(
- "compressed from " + data.length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
- // we can repack the data:
- compressed = Arrays.copyOf(compressed, outputoffset.intValue());
-
- /**
- *
- * now uncompressing
- *
- * We are *not* assuming that the original array length is known,
- * however we assume that the chunk size (ChunkSize) is known.
- *
- */
- int[] recovered = new int[ChunkSize];
- IntWrapper compoff = new IntWrapper(0);
- IntWrapper recoffset;
- int currentpos = 0;
-
- while (compoff.get() < compressed.length) {
- recoffset = new IntWrapper(0);
- regularcodec.uncompress(compressed, compoff, compressed.length - compoff.get(), recovered, recoffset);
-
- if (recoffset.get() < ChunkSize) {// last chunk detected
- ivb.uncompress(compressed, compoff, compressed.length - compoff.get(), recovered, recoffset);
- }
- for (int i = 0; i < recoffset.get(); ++i) {
- if (data[currentpos + i] != recovered[i])
- throw new RuntimeException("bug"); // could use assert
- }
- currentpos += recoffset.get();
- }
- System.out.println("data is recovered without loss");
- System.out.println();
-
- }
-
- /**
- * Demo of the headless approach where we must supply the array length
- */
- @Test
- public void headlessDemo() {
- System.out.println("Compressing arrays with minimal header...");
- int[] uncompressed1 = { 1, 2, 1, 3, 1 };
- int[] uncompressed2 = { 3, 2, 4, 6, 1 };
-
- int[] compressed = new int[uncompressed1.length + uncompressed2.length + 1024];
-
- SkippableIntegerCODEC codec = new SkippableComposition(new BinaryPacking(), new VariableByte());
-
- // compressing
- IntWrapper outPos = new IntWrapper();
-
- IntWrapper previous = new IntWrapper();
-
- codec.headlessCompress(uncompressed1, new IntWrapper(), uncompressed1.length, compressed, outPos);
- int length1 = outPos.get() - previous.get();
- previous = new IntWrapper(outPos.get());
- codec.headlessCompress(uncompressed2, new IntWrapper(), uncompressed2.length, compressed, outPos);
- int length2 = outPos.get() - previous.get();
-
- compressed = Arrays.copyOf(compressed, length1 + length2);
- System.out
- .println("compressed unsorted integers from " + uncompressed1.length * 4 + "B to " + length1 * 4 + "B");
- System.out
- .println("compressed unsorted integers from " + uncompressed2.length * 4 + "B to " + length2 * 4 + "B");
- System.out.println("Total compressed output " + compressed.length);
-
- int[] recovered1 = new int[uncompressed1.length];
- int[] recovered2 = new int[uncompressed1.length];
- IntWrapper inPos = new IntWrapper();
- System.out.println("Decoding first array starting at pos = " + inPos);
- codec.headlessUncompress(compressed, inPos, compressed.length, recovered1, new IntWrapper(0),
- uncompressed1.length);
- System.out.println("Decoding second array starting at pos = " + inPos);
- codec.headlessUncompress(compressed, inPos, compressed.length, recovered2, new IntWrapper(0),
- uncompressed2.length);
- if (!Arrays.equals(uncompressed1, recovered1))
- throw new RuntimeException("First array does not match.");
- if (!Arrays.equals(uncompressed2, recovered2))
- throw new RuntimeException("Second array does not match.");
- System.out.println("The arrays match, your code is probably ok.");
-
- }
+ /**
+ *
+ */
+ @Test
+
+ public void superSimpleExample() {
+ IntegratedIntCompressor iic = new IntegratedIntCompressor();
+ int[] data = new int[2342351];
+ for (int k = 0; k < data.length; ++k)
+ data[k] = k;
+ System.out.println("Compressing " + data.length + " integers using friendly interface");
+ int[] compressed = iic.compress(data);
+ int[] recov = iic.uncompress(compressed);
+ System.out
+ .println("compressed from " + data.length * 4 / 1024 + "KB to " + compressed.length * 4 / 1024 + "KB");
+ if (!Arrays.equals(recov, data))
+ throw new RuntimeException("bug");
+ }
+
+ /**
+ *
+ */
+ @Test
+
+ public void basicExample() {
+ int[] data = new int[2342351];
+ System.out.println("Compressing " + data.length + " integers in one go");
+ // data should be sorted for best
+ // results
+ for (int k = 0; k < data.length; ++k)
+ data[k] = k;
+ // Very important: the data is in sorted order!!! If not, you
+ // will get very poor compression with IntegratedBinaryPacking,
+ // you should use another CODEC.
+
+ // next we compose a CODEC. Most of the processing
+ // will be done with binary packing, and leftovers will
+ // be processed using variable byte
+ IntegratedIntegerCODEC codec = new IntegratedComposition(new IntegratedBinaryPacking(),
+ new IntegratedVariableByte());
+ // output vector should be large enough...
+ int[] compressed = new int[data.length + 1024];
+ // compressed might not be large enough in some cases
+ // if you get java.lang.ArrayIndexOutOfBoundsException, try
+ // allocating more memory
+
+ /**
+ *
+ * compressing
+ *
+ */
+ IntWrapper inputoffset = new IntWrapper(0);
+ IntWrapper outputoffset = new IntWrapper(0);
+ codec.compress(data, inputoffset, data.length, compressed, outputoffset);
+ // got it!
+ // inputoffset should be at data.length but outputoffset tells
+ // us where we are...
+ System.out.println(
+ "compressed from " + data.length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
+ // we can repack the data: (optional)
+ compressed = Arrays.copyOf(compressed, outputoffset.intValue());
+
+ /**
+ *
+ * now uncompressing
+ *
+ * This assumes that we otherwise know how many integers have been
+ * compressed. See basicExampleHeadless for a more general case.
+ */
+ int[] recovered = new int[data.length];
+ IntWrapper recoffset = new IntWrapper(0);
+ codec.uncompress(compressed, new IntWrapper(0), compressed.length, recovered, recoffset);
+ if (Arrays.equals(data, recovered))
+ System.out.println("data is recovered without loss");
+ else
+ throw new RuntimeException("bug"); // could use assert
+ System.out.println();
+ }
+
+ /**
+ * Like the basicExample, but we store the input array size manually.
+ */
+ @Test
+ public void basicExampleHeadless() {
+ int[] data = new int[2342351];
+ System.out.println("Compressing " + data.length + " integers in one go using the headless approach");
+ // data should be sorted for best
+ // results
+ for (int k = 0; k < data.length; ++k)
+ data[k] = k;
+ // Very important: the data is in sorted order!!! If not, you
+ // will get very poor compression with IntegratedBinaryPacking,
+ // you should use another CODEC.
+
+ // next we compose a CODEC. Most of the processing
+ // will be done with binary packing, and leftovers will
+ // be processed using variable byte
+ SkippableIntegratedComposition codec = new SkippableIntegratedComposition(new IntegratedBinaryPacking(),
+ new IntegratedVariableByte());
+ int[] compressed = new int[codec.maxHeadlessCompressedLength(new IntWrapper(0), data.length)];
+
+ /**
+ *
+ * compressing
+ *
+ */
+ IntWrapper inputoffset = new IntWrapper(0);
+ IntWrapper outputoffset = new IntWrapper(1);
+ compressed[0] = data.length; // we manually store how many integers we
+ codec.headlessCompress(data, inputoffset, data.length, compressed, outputoffset, new IntWrapper(0));
+ // got it!
+ // inputoffset should be at data.length but outputoffset tells
+ // us where we are...
+ System.out.println(
+ "compressed from " + data.length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
+ // we can repack the data: (optional)
+ compressed = Arrays.copyOf(compressed, outputoffset.intValue());
+
+ /**
+ *
+ * now uncompressing
+ *
+ */
+ int howmany = compressed[0];// we manually stored the number of
+ // compressed integers
+ int[] recovered = new int[howmany];
+ IntWrapper recoffset = new IntWrapper(0);
+ codec.headlessUncompress(compressed, new IntWrapper(1), compressed.length, recovered, recoffset, howmany, new IntWrapper(0));
+ if (Arrays.equals(data, recovered))
+ System.out.println("data is recovered without loss");
+ else
+ throw new RuntimeException("bug"); // could use assert
+ System.out.println();
+ }
+
+ /**
+ * This is an example to show you can compress unsorted integers as long as
+ * most are small.
+ */
+ @Test
+ public void unsortedExample() {
+ final int N = 1333333;
+ int[] data = new int[N];
+ // initialize the data (most will be small
+ for (int k = 0; k < N; k += 1)
+ data[k] = 3;
+ // throw some larger values
+ for (int k = 0; k < N; k += 5)
+ data[k] = 100;
+ for (int k = 0; k < N; k += 533)
+ data[k] = 10000;
+ int[] compressed = new int[N + 1024];// could need more
+ IntegerCODEC codec = new Composition(new FastPFOR(), new VariableByte());
+ // compressing
+ IntWrapper inputoffset = new IntWrapper(0);
+ IntWrapper outputoffset = new IntWrapper(0);
+ codec.compress(data, inputoffset, data.length, compressed, outputoffset);
+ System.out.println("compressed unsorted integers from " + data.length * 4 / 1024 + "KB to "
+ + outputoffset.intValue() * 4 / 1024 + "KB");
+ // we can repack the data: (optional)
+ compressed = Arrays.copyOf(compressed, outputoffset.intValue());
+
+ int[] recovered = new int[N];
+ IntWrapper recoffset = new IntWrapper(0);
+ codec.uncompress(compressed, new IntWrapper(0), compressed.length, recovered, recoffset);
+ if (Arrays.equals(data, recovered))
+ System.out.println("data is recovered without loss");
+ else
+ throw new RuntimeException("bug"); // could use assert
+ System.out.println();
+
+ }
+
+ /**
+ * This is like the basic example, but we show how to process larger arrays
+ * in chunks.
+ *
+ * Some of this code was written by Pavel Klinov.
+ */
+ @Test
+ public void advancedExample() {
+ int TotalSize = 2342351; // some arbitrary number
+ int ChunkSize = 16384; // size of each chunk, choose a multiple of 128
+ System.out.println("Compressing " + TotalSize + " integers using chunks of " + ChunkSize + " integers ("
+ + ChunkSize * 4 / 1024 + "KB)");
+ System.out.println("(It is often better for applications to work in chunks fitting in CPU cache.)");
+ int[] data = new int[TotalSize];
+ // data should be sorted for best
+ // results
+ for (int k = 0; k < data.length; ++k)
+ data[k] = k;
+ // next we compose a CODEC. Most of the processing
+ // will be done with binary packing, and leftovers will
+ // be processed using variable byte, using variable byte
+ // only for the last chunk!
+ IntegratedIntegerCODEC regularcodec = new IntegratedBinaryPacking();
+ IntegratedVariableByte ivb = new IntegratedVariableByte();
+ IntegratedIntegerCODEC lastcodec = new IntegratedComposition(regularcodec, ivb);
+ // output vector should be large enough...
+ int[] compressed = new int[TotalSize + 1024];
+
+ /**
+ *
+ * compressing
+ *
+ */
+ IntWrapper inputoffset = new IntWrapper(0);
+ IntWrapper outputoffset = new IntWrapper(0);
+ for (int k = 0; k < TotalSize / ChunkSize; ++k)
+ regularcodec.compress(data, inputoffset, ChunkSize, compressed, outputoffset);
+ lastcodec.compress(data, inputoffset, TotalSize % ChunkSize, compressed, outputoffset);
+ // got it!
+ // inputoffset should be at data.length but outputoffset tells
+ // us where we are...
+ System.out.println(
+ "compressed from " + data.length * 4 / 1024 + "KB to " + outputoffset.intValue() * 4 / 1024 + "KB");
+ // we can repack the data:
+ compressed = Arrays.copyOf(compressed, outputoffset.intValue());
+
+ /**
+ *
+ * now uncompressing
+ *
+ * We are *not* assuming that the original array length is known,
+ * however we assume that the chunk size (ChunkSize) is known.
+ *
+ */
+ int[] recovered = new int[ChunkSize];
+ IntWrapper compoff = new IntWrapper(0);
+ IntWrapper recoffset;
+ int currentpos = 0;
+
+ while (compoff.get() < compressed.length) {
+ recoffset = new IntWrapper(0);
+ regularcodec.uncompress(compressed, compoff, compressed.length - compoff.get(), recovered, recoffset);
+
+ if (recoffset.get() < ChunkSize) {// last chunk detected
+ ivb.uncompress(compressed, compoff, compressed.length - compoff.get(), recovered, recoffset);
+ }
+ for (int i = 0; i < recoffset.get(); ++i) {
+ if (data[currentpos + i] != recovered[i])
+ throw new RuntimeException("bug"); // could use assert
+ }
+ currentpos += recoffset.get();
+ }
+ System.out.println("data is recovered without loss");
+ System.out.println();
+
+ }
+
+ /**
+ * Demo of the headless approach where we must supply the array length
+ */
+ @Test
+ public void headlessDemo() {
+ System.out.println("Compressing arrays with minimal header...");
+ int[] uncompressed1 = { 1, 2, 1, 3, 1 };
+ int[] uncompressed2 = { 3, 2, 4, 6, 1 };
+
+ SkippableIntegerCODEC codec = new SkippableComposition(new BinaryPacking(), new VariableByte());
+
+ int maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), uncompressed1.length)
+ + codec.maxHeadlessCompressedLength(new IntWrapper(0), uncompressed2.length);
+ int[] compressed = new int[maxCompressedLength];
+
+ // compressing
+ IntWrapper outPos = new IntWrapper();
+
+ IntWrapper previous = new IntWrapper();
+
+ codec.headlessCompress(uncompressed1, new IntWrapper(), uncompressed1.length, compressed, outPos);
+ int length1 = outPos.get() - previous.get();
+ previous = new IntWrapper(outPos.get());
+ codec.headlessCompress(uncompressed2, new IntWrapper(), uncompressed2.length, compressed, outPos);
+ int length2 = outPos.get() - previous.get();
+
+ compressed = Arrays.copyOf(compressed, length1 + length2);
+ System.out
+ .println("compressed unsorted integers from " + uncompressed1.length * 4 + "B to " + length1 * 4 + "B");
+ System.out
+ .println("compressed unsorted integers from " + uncompressed2.length * 4 + "B to " + length2 * 4 + "B");
+ System.out.println("Total compressed output " + compressed.length);
+
+ int[] recovered1 = new int[uncompressed1.length];
+ int[] recovered2 = new int[uncompressed1.length];
+ IntWrapper inPos = new IntWrapper();
+ System.out.println("Decoding first array starting at pos = " + inPos);
+ codec.headlessUncompress(compressed, inPos, compressed.length, recovered1, new IntWrapper(0),
+ uncompressed1.length);
+ System.out.println("Decoding second array starting at pos = " + inPos);
+ codec.headlessUncompress(compressed, inPos, compressed.length, recovered2, new IntWrapper(0),
+ uncompressed2.length);
+ if (!Arrays.equals(uncompressed1, recovered1))
+ throw new RuntimeException("First array does not match.");
+ if (!Arrays.equals(uncompressed2, recovered2))
+ throw new RuntimeException("Second array does not match.");
+ System.out.println("The arrays match, your code is probably ok.");
+
+ }
}
diff --git a/src/test/java/me/lemire/integercompression/ResourcedTest.java b/src/test/java/me/lemire/integercompression/ResourcedTest.java
index 34f1d05..8316129 100644
--- a/src/test/java/me/lemire/integercompression/ResourcedTest.java
+++ b/src/test/java/me/lemire/integercompression/ResourcedTest.java
@@ -24,65 +24,65 @@
*
*/
public class ResourcedTest {
- SkippableIntegerCODEC[] codecs = { new JustCopy(), new VariableByte(),
- new SkippableComposition(new BinaryPacking(), new VariableByte()),
- new SkippableComposition(new NewPFD(), new VariableByte()),
- new SkippableComposition(new NewPFDS9(), new VariableByte()),
- new SkippableComposition(new NewPFDS16(), new VariableByte()),
- new SkippableComposition(new OptPFD(), new VariableByte()),
- new SkippableComposition(new OptPFDS9(), new VariableByte()),
- new SkippableComposition(new OptPFDS16(), new VariableByte()),
- new SkippableComposition(new FastPFOR128(), new VariableByte()),
- new SkippableComposition(new FastPFOR(), new VariableByte()), new Simple9(), new Simple16() };
+ SkippableIntegerCODEC[] codecs = { new JustCopy(), new VariableByte(),
+ new SkippableComposition(new BinaryPacking(), new VariableByte()),
+ new SkippableComposition(new NewPFD(), new VariableByte()),
+ new SkippableComposition(new NewPFDS9(), new VariableByte()),
+ new SkippableComposition(new NewPFDS16(), new VariableByte()),
+ new SkippableComposition(new OptPFD(), new VariableByte()),
+ new SkippableComposition(new OptPFDS9(), new VariableByte()),
+ new SkippableComposition(new OptPFDS16(), new VariableByte()),
+ new SkippableComposition(new FastPFOR128(), new VariableByte()),
+ new SkippableComposition(new FastPFOR(), new VariableByte()), new Simple9(), new Simple16() };
- /**
- * @throws IOException
- * if the resource cannot be accessed (should be considered a
- * bug)
- *
- */
- @Test
- public void IntCompressorTest() throws IOException {
- // next line requires Java8?
- // int[] data =
- // Files.lines(Paths.get("integers.txt")).mapToInt(Integer::parseInt).toArray();
- File f = new File("src/test/resources/integers.txt");
- System.out.println("loading test data from "+ f.getAbsolutePath());
- BufferedReader bfr = new BufferedReader(new FileReader(f));
- String line;
- ArrayList ai = new ArrayList();
- while ((line = bfr.readLine()) != null) {
- ai.add(Integer.parseInt(line));
- }
- bfr.close();
- int[] data = new int[ai.size()];
- for (int k = 0; k < data.length; ++k)
- data[k] = ai.get(k).intValue();
- ai = null;
- // finally!
- {
- IntegratedIntCompressor iic = new IntegratedIntCompressor();
- int[] compressed = iic.compress(data);
- int[] recovered = iic.uncompress(compressed);
- Assert.assertArrayEquals(recovered, data);
- }
- for (SkippableIntegerCODEC C : codecs) {
- IntCompressor iic = new IntCompressor(C);
- int[] compressed = iic.compress(data);
- int[] recovered = iic.uncompress(compressed);
- Assert.assertArrayEquals(recovered, data);
+ /**
+ * @throws IOException
+ * if the resource cannot be accessed (should be considered a
+ * bug)
+ *
+ */
+ @Test
+ public void IntCompressorTest() throws IOException {
+ // next line requires Java8?
+ // int[] data =
+ // Files.lines(Paths.get("integers.txt")).mapToInt(Integer::parseInt).toArray();
+ File f = new File("src/test/resources/integers.txt");
+ System.out.println("loading test data from "+ f.getAbsolutePath());
+ BufferedReader bfr = new BufferedReader(new FileReader(f));
+ String line;
+ ArrayList ai = new ArrayList();
+ while ((line = bfr.readLine()) != null) {
+ ai.add(Integer.parseInt(line));
+ }
+ bfr.close();
+ int[] data = new int[ai.size()];
+ for (int k = 0; k < data.length; ++k)
+ data[k] = ai.get(k).intValue();
+ ai = null;
+ // finally!
+ {
+ IntegratedIntCompressor iic = new IntegratedIntCompressor();
+ int[] compressed = iic.compress(data);
+ int[] recovered = iic.uncompress(compressed);
+ Assert.assertArrayEquals(recovered, data);
+ }
+ for (SkippableIntegerCODEC C : codecs) {
+ IntCompressor iic = new IntCompressor(C);
+ int[] compressed = iic.compress(data);
+ int[] recovered = iic.uncompress(compressed);
+ Assert.assertArrayEquals(recovered, data);
- }
- for (SkippableIntegerCODEC C : codecs) {
- if (C instanceof SkippableIntegratedIntegerCODEC) {
- IntegratedIntCompressor iic = new IntegratedIntCompressor((SkippableIntegratedIntegerCODEC) C);
- int[] compressed = iic.compress(data);
- int[] recovered = iic.uncompress(compressed);
- Assert.assertArrayEquals(recovered, data);
- }
+ }
+ for (SkippableIntegerCODEC C : codecs) {
+ if (C instanceof SkippableIntegratedIntegerCODEC) {
+ IntegratedIntCompressor iic = new IntegratedIntCompressor((SkippableIntegratedIntegerCODEC) C);
+ int[] compressed = iic.compress(data);
+ int[] recovered = iic.uncompress(compressed);
+ Assert.assertArrayEquals(recovered, data);
+ }
- }
+ }
- }
+ }
}
diff --git a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java
index 93c1784..57a07e3 100644
--- a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java
+++ b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java
@@ -9,8 +9,13 @@
import java.util.Arrays;
+import me.lemire.integercompression.differential.IntegratedBinaryPacking;
+import me.lemire.integercompression.differential.IntegratedVariableByte;
+import me.lemire.integercompression.differential.SkippableIntegratedComposition;
+import me.lemire.integercompression.differential.SkippableIntegratedIntegerCODEC;
import org.junit.Test;
+import static org.junit.Assert.assertTrue;
/**
* Just some basic sanity tests.
@@ -19,7 +24,7 @@
*/
@SuppressWarnings({ "static-method" })
public class SkippableBasicTest {
- final SkippableIntegerCODEC[] codecs = {
+ final SkippableIntegerCODEC[] codecs = {
new JustCopy(),
new VariableByte(),
new SkippableComposition(new BinaryPacking(), new VariableByte()),
@@ -48,10 +53,11 @@ public void consistentTest() {
for (SkippableIntegerCODEC c : codecs) {
System.out.println("[SkippeableBasicTest.consistentTest] codec = "
+ c);
- int[] outBuf = new int[N + 1024];
for (int n = 0; n <= N; ++n) {
IntWrapper inPos = new IntWrapper();
IntWrapper outPos = new IntWrapper();
+ int[] outBuf = new int[c.maxHeadlessCompressedLength(new IntWrapper(0), n)];
+
c.headlessCompress(data, inPos, n, outBuf, outPos);
IntWrapper inPoso = new IntWrapper();
@@ -147,5 +153,87 @@ public void varyingLengthTest2() {
}
}
+ @Test
+ public void testMaxHeadlessCompressedLength() {
+ testMaxHeadlessCompressedLength(new IntegratedBinaryPacking(), 16 * IntegratedBinaryPacking.BLOCK_SIZE);
+ testMaxHeadlessCompressedLength(new IntegratedVariableByte(), 128);
+ testMaxHeadlessCompressedLength(new SkippableIntegratedComposition(new IntegratedBinaryPacking(), new IntegratedVariableByte()), 16 * IntegratedBinaryPacking.BLOCK_SIZE + 10);
+
+ testMaxHeadlessCompressedLength(new BinaryPacking(), 16 * BinaryPacking.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new VariableByte(), 128, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new BinaryPacking(), new VariableByte()), 16 * BinaryPacking.BLOCK_SIZE + 10, 32);
+ testMaxHeadlessCompressedLength(new JustCopy(), 128, 32);
+ testMaxHeadlessCompressedLength(new Simple9(), 128, 28);
+ testMaxHeadlessCompressedLength(new Simple16(), 128, 28);
+ testMaxHeadlessCompressedLength(new GroupSimple9(), 128, 28);
+ testMaxHeadlessCompressedLength(new OptPFD(), 4 * OptPFD.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new OptPFD(), new VariableByte()), 4 * OptPFD.BLOCK_SIZE + 10, 32);
+ testMaxHeadlessCompressedLength(new OptPFDS9(), 4 * OptPFDS9.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new OptPFDS9(), new VariableByte()), 4 * OptPFDS9.BLOCK_SIZE + 10, 32);
+ testMaxHeadlessCompressedLength(new OptPFDS16(), 4 * OptPFDS16.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new OptPFDS9(), new VariableByte()), 4 * OptPFDS16.BLOCK_SIZE + 10, 32);
+ testMaxHeadlessCompressedLength(new NewPFD(), 4 * NewPFD.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new NewPFD(), new VariableByte()), 4 * NewPFD.BLOCK_SIZE + 10, 32);
+ testMaxHeadlessCompressedLength(new NewPFDS9(), 4 * NewPFDS9.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new NewPFDS9(), new VariableByte()), 4 * NewPFDS9.BLOCK_SIZE + 10, 32);
+ testMaxHeadlessCompressedLength(new NewPFDS16(), 4 * NewPFDS16.BLOCK_SIZE, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new NewPFDS16(), new VariableByte()), 4 * NewPFDS16.BLOCK_SIZE + 10, 32);
+
+ int fastPfor128PageSize = FastPFOR128.BLOCK_SIZE * 4; // smaller page size than the default to speed up the test
+ testMaxHeadlessCompressedLength(new FastPFOR128(fastPfor128PageSize), 2 * fastPfor128PageSize, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new FastPFOR128(fastPfor128PageSize), new VariableByte()), 2 * fastPfor128PageSize + 10, 32);
+ int fastPforPageSize = FastPFOR.BLOCK_SIZE * 4; // smaller page size than the default to speed up the test
+ testMaxHeadlessCompressedLength(new FastPFOR(fastPforPageSize), 2 * fastPforPageSize, 32);
+ testMaxHeadlessCompressedLength(new SkippableComposition(new FastPFOR(fastPforPageSize), new VariableByte()), 2 * fastPforPageSize + 10, 32);
+ }
+
+ private static void testMaxHeadlessCompressedLength(SkippableIntegratedIntegerCODEC codec, int inlengthTo) {
+ // We test the worst-case scenario by making all deltas and the initial value negative.
+ int delta = -1;
+ int value = delta;
+ for (int inlength = 0; inlength < inlengthTo; ++inlength) {
+ int[] input = new int[inlength];
+ for (int i = 0; i < inlength; i++) {
+ input[i] = value;
+ value += delta;
+ }
+
+ int maxOutputLength = codec.maxHeadlessCompressedLength(new IntWrapper(), inlength);
+ int[] output = new int[maxOutputLength];
+ IntWrapper outPos = new IntWrapper();
+
+ codec.headlessCompress(input, new IntWrapper(), inlength, output, outPos, new IntWrapper());
+ // If we reach this point, no exception was thrown, which means the calculated output length was sufficient.
+
+ assertTrue(maxOutputLength <= outPos.get() + 1); // +1 because SkippableIntegratedComposition always adds one extra integer for the potential header
+ }
+ }
+
+ private static void testMaxHeadlessCompressedLength(SkippableIntegerCODEC codec, int inlengthTo, int maxBitWidth) {
+ // Some schemes ignore bit widths between 21 and 31. Therefore, in addition to maxBitWidth - 1, we also test 20.
+ assertTrue(maxBitWidth >= 20);
+ int[] regularValueBitWidths = { 20, maxBitWidth - 1 };
+
+ for (int inlength = 0; inlength < inlengthTo; ++inlength) {
+ int[] input = new int[inlength];
+
+ int maxOutputLength = codec.maxHeadlessCompressedLength(new IntWrapper(), inlength);
+ int[] output = new int[maxOutputLength];
+
+ for (int exceptionCount = 0; exceptionCount < inlength; exceptionCount++) {
+ int exception = maxBitWidth == 32 ? -1 : (1 << maxBitWidth) - 1;
+
+ for (int regularValueBitWidth : regularValueBitWidths) {
+ int regularValue = regularValueBitWidth == 32 ? -1 : (1 << regularValueBitWidth) - 1;
+
+ Arrays.fill(input, 0, exceptionCount, exception);
+ Arrays.fill(input, exceptionCount, input.length, regularValue);
+
+ codec.headlessCompress(input, new IntWrapper(), inlength, output, new IntWrapper());
+ // If we reach this point, no exception was thrown, which means the calculated output length was sufficient.
+ }
+ }
+ }
+ }
}
diff --git a/src/test/java/me/lemire/integercompression/TestUtils.java b/src/test/java/me/lemire/integercompression/TestUtils.java
index 7ce51b3..b3cbff3 100644
--- a/src/test/java/me/lemire/integercompression/TestUtils.java
+++ b/src/test/java/me/lemire/integercompression/TestUtils.java
@@ -165,7 +165,7 @@ protected static int[] uncompress(ByteIntegerCODEC codec, byte[] data, int len)
}
protected static int[] compressHeadless(SkippableIntegerCODEC codec, int[] data) {
- int[] outBuf = new int[data.length * 4];
+ int[] outBuf = new int[codec.maxHeadlessCompressedLength(new IntWrapper(0), data.length)];
IntWrapper inPos = new IntWrapper();
IntWrapper outPos = new IntWrapper();
codec.headlessCompress(data, inPos, data.length, outBuf, outPos);
diff --git a/src/test/java/me/lemire/longcompression/LongBasicTest.java b/src/test/java/me/lemire/longcompression/LongBasicTest.java
index 1963246..8dc0c9b 100644
--- a/src/test/java/me/lemire/longcompression/LongBasicTest.java
+++ b/src/test/java/me/lemire/longcompression/LongBasicTest.java
@@ -34,33 +34,33 @@ public class LongBasicTest {
new LongComposition(new LongBinaryPacking(), new LongVariableByte()),
};
- /**
+ /**
* This tests with a compressed array with various offset
*/
- @Test
- public void saulTest() {
- for (LongCODEC C : codecs) {
- for (int x = 0; x < 50; ++x) {
- long[] a = { 2, 3, 4, 5 };
- long[] b = new long[90];
- long[] c = new long[a.length];
-
- IntWrapper aOffset = new IntWrapper(0);
- IntWrapper bOffset = new IntWrapper(x);
- C.compress(a, aOffset, a.length, b, bOffset);
- int len = bOffset.get() - x;
-
- bOffset.set(x);
- IntWrapper cOffset = new IntWrapper(0);
- C.uncompress(b, bOffset, len, c, cOffset);
- if(!Arrays.equals(a, c)) {
- System.out.println("Problem with "+C);
- }
- assertArrayEquals(a, c);
-
- }
- }
- }
+ @Test
+ public void saulTest() {
+ for (LongCODEC C : codecs) {
+ for (int x = 0; x < 50; ++x) {
+ long[] a = { 2, 3, 4, 5 };
+ long[] b = new long[90];
+ long[] c = new long[a.length];
+
+ IntWrapper aOffset = new IntWrapper(0);
+ IntWrapper bOffset = new IntWrapper(x);
+ C.compress(a, aOffset, a.length, b, bOffset);
+ int len = bOffset.get() - x;
+
+ bOffset.set(x);
+ IntWrapper cOffset = new IntWrapper(0);
+ C.uncompress(b, bOffset, len, c, cOffset);
+ if(!Arrays.equals(a, c)) {
+ System.out.println("Problem with "+C);
+ }
+ assertArrayEquals(a, c);
+
+ }
+ }
+ }
/**
*
*/
@@ -159,16 +159,16 @@ public void varyingLengthTest2() {
@Test
public void checkVariousCases() {
for (LongCODEC c : codecs) {
- testZeroInZeroOut(c);
- test(c, c, 5, 10);
- test(c, c, 5, 14);
- test(c, c, 2, 18);
- // TODO Unclear which codec should manage an empty output array or not
- // Some IntegerCodec does not output anything if the input is smaller than some block size
- // testSpurious(c);
- testUnsorted(c);
- testUnsorted2(c);
- testUnsorted3(c);
+ testZeroInZeroOut(c);
+ test(c, c, 5, 10);
+ test(c, c, 5, 14);
+ test(c, c, 2, 18);
+ // TODO Unclear which codec should manage an empty output array or not
+ // Some IntegerCodec does not output anything if the input is smaller than some block size
+ // testSpurious(c);
+ testUnsorted(c);
+ testUnsorted2(c);
+ testUnsorted3(c);
}
}
@@ -265,7 +265,7 @@ private static void testCodec(LongCODEC c, LongCODEC co,
buffer[0] = backupdata[0];
co.uncompress(dataout, inpos, thiscompsize - 1, buffer, outpos);
if (!(c instanceof IntegratedLongCODEC))
- LongDelta.fastinverseDelta(buffer);
+ LongDelta.fastinverseDelta(buffer);
// Check assertions.
assertEquals("length is not match", outpos.get(), data[k].length);
@@ -373,19 +373,19 @@ public void fastPforTest() {
@Test
public void fastPfor128Test() {
// proposed by Stefan Ackermann (https://github.com/Stivo)
- for (LongCODEC codec : codecs) {
- int N = FastPFOR128.BLOCK_SIZE;
- long[] data = new long[N];
- for (int i = 0; i < N; i++)
- data[i] = 0;
- data[126] = -1;
- long[] comp = LongTestUtils.compress(codec, Arrays.copyOf(data, N));
- long[] answer = LongTestUtils.uncompress(codec, comp, N);
- for (int k = 0; k < N; ++k)
- if (answer[k] != data[k])
- throw new RuntimeException("bug " + k + " " + answer[k]
- + " != " + data[k]);
- }
+ for (LongCODEC codec : codecs) {
+ int N = FastPFOR128.BLOCK_SIZE;
+ long[] data = new long[N];
+ for (int i = 0; i < N; i++)
+ data[i] = 0;
+ data[126] = -1;
+ long[] comp = LongTestUtils.compress(codec, Arrays.copyOf(data, N));
+ long[] answer = LongTestUtils.uncompress(codec, comp, N);
+ for (int k = 0; k < N; ++k)
+ if (answer[k] != data[k])
+ throw new RuntimeException("bug " + k + " " + answer[k]
+ + " != " + data[k]);
+ }
}
}
diff --git a/src/test/java/me/lemire/longcompression/LongTestUtils.java b/src/test/java/me/lemire/longcompression/LongTestUtils.java
index a44e665..b7d9c63 100644
--- a/src/test/java/me/lemire/longcompression/LongTestUtils.java
+++ b/src/test/java/me/lemire/longcompression/LongTestUtils.java
@@ -111,7 +111,7 @@ protected static long[] uncompress(ByteLongCODEC codec, byte[] data, int len) {
}
protected static long[] compressHeadless(SkippableLongCODEC codec, long[] data) {
- long[] outBuf = new long[data.length * 4];
+ long[] outBuf = new long[codec.maxHeadlessCompressedLength(new IntWrapper(0), data.length)];
IntWrapper inPos = new IntWrapper();
IntWrapper outPos = new IntWrapper();
codec.headlessCompress(data, inPos, data.length, outBuf, outPos);
@@ -127,7 +127,7 @@ protected static long[] uncompressHeadless(SkippableLongCODEC codec, long[] data
return Arrays.copyOf(outBuf, outPos.get());
}
- public static String longToBinaryWithLeading(long l) {
- return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0');
- }
+ public static String longToBinaryWithLeading(long l) {
+ return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0');
+ }
}
diff --git a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java
index 24cb712..4309e9d 100644
--- a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java
+++ b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java
@@ -15,6 +15,7 @@
import me.lemire.integercompression.TestUtils;
import me.lemire.integercompression.VariableByte;
+import static org.junit.Assert.assertTrue;
/**
* Just some basic sanity tests.
@@ -42,10 +43,11 @@ public void consistentTest() {
for (SkippableLongCODEC c : codecs) {
System.out.println("[SkippeableBasicTest.consistentTest] codec = "
+ c);
- long[] outBuf = new long[N + 1024];
for (int n = 0; n <= N; ++n) {
IntWrapper inPos = new IntWrapper();
IntWrapper outPos = new IntWrapper();
+ long[] outBuf = new long[c.maxHeadlessCompressedLength(new IntWrapper(0), n)];
+
c.headlessCompress(data, inPos, n, outBuf, outPos);
IntWrapper inPoso = new IntWrapper();
@@ -79,15 +81,15 @@ public void varyingLengthTest() {
for (SkippableLongCODEC c : codecs) {
System.out.println("[SkippeableBasicTest.varyingLengthTest] codec = "+c);
for (int L = 1; L <= 128; L++) {
- long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
- long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
+ long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
+ long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
for (int k = 0; k < L; ++k)
if (answer[k] != data[k])
throw new RuntimeException("bug "+c.toString()+" "+k+" "+answer[k]+" "+data[k]);
}
for (int L = 128; L <= N; L *= 2) {
- long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
- long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
+ long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
+ long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
for (int k = 0; k < L; ++k)
if (answer[k] != data[k])
throw new RuntimeException("bug");
@@ -124,16 +126,16 @@ public void varyingLengthTest2() {
e.printStackTrace();
}
for (int L = 1; L <= 128; L++) {
- long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
- long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
+ long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
+ long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
for (int k = 0; k < L; ++k)
if (answer[k] != data[k]) {
- throw new RuntimeException("L=" + L + ": bug at k = "+k+" "+answer[k]+" "+data[k]+" for "+c.toString());
+ throw new RuntimeException("L=" + L + ": bug at k = "+k+" "+answer[k]+" "+data[k]+" for "+c.toString());
}
}
for (int L = 128; L <= N; L *= 2) {
- long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
- long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
+ long[] comp = LongTestUtils.compressHeadless(c, Arrays.copyOf(data, L));
+ long[] answer = LongTestUtils.uncompressHeadless(c, comp, L);
for (int k = 0; k < L; ++k)
if (answer[k] != data[k])
throw new RuntimeException("bug");
@@ -142,5 +144,27 @@ public void varyingLengthTest2() {
}
}
+ @Test
+ public void testMaxHeadlessCompressedLength() {
+ testMaxHeadlessCompressedLength(new LongJustCopy(), 128);
+ testMaxHeadlessCompressedLength(new LongBinaryPacking(), 16 * LongBinaryPacking.BLOCK_SIZE);
+ testMaxHeadlessCompressedLength(new LongVariableByte(), 128);
+ testMaxHeadlessCompressedLength(new SkippableLongComposition(new LongBinaryPacking(), new LongVariableByte()), 16 * LongBinaryPacking.BLOCK_SIZE + 10);
+ }
+
+ private static void testMaxHeadlessCompressedLength(SkippableLongCODEC codec, int inlengthTo) {
+ for (int inlength = 0; inlength < inlengthTo; ++inlength) {
+ long[] input = new long[inlength];
+ Arrays.fill(input, -1L);
+ int maxOutputLength = codec.maxHeadlessCompressedLength(new IntWrapper(), inlength);
+ long[] output = new long[maxOutputLength];
+ IntWrapper outPos = new IntWrapper();
+
+ codec.headlessCompress(input, new IntWrapper(), inlength, output, outPos);
+ // If we reach this point, no exception was thrown, which means the calculated output length was sufficient.
+
+ assertTrue(maxOutputLength <= outPos.get() + 1); // +1 because SkippableLongComposition always adds one extra integer for the potential header
+ }
+ }
}
diff --git a/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java b/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java
index 5b8014e..bddff2a 100644
--- a/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java
+++ b/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java
@@ -23,9 +23,9 @@ public LongCODEC getCodec() {
return codec;
}
- @Test
- public void testCodec_intermediateHighPowerOfTwo() {
- Assert.assertEquals(3, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length);
- }
+ @Test
+ public void testCodec_intermediateHighPowerOfTwo() {
+ Assert.assertEquals(3, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length);
+ }
}
diff --git a/src/test/java/me/lemire/longcompression/synth/LongClusteredDataGenerator.java b/src/test/java/me/lemire/longcompression/synth/LongClusteredDataGenerator.java
index 5b90ee0..c964f6f 100644
--- a/src/test/java/me/lemire/longcompression/synth/LongClusteredDataGenerator.java
+++ b/src/test/java/me/lemire/longcompression/synth/LongClusteredDataGenerator.java
@@ -29,7 +29,7 @@ public LongClusteredDataGenerator() {
}
void fillUniform(long[] array, int offset, int length, long Min, long Max) {
- long[] v = this.unidg.generateUniform(length, Max - Min);
+ long[] v = this.unidg.generateUniform(length, Max - Min);
for (int k = 0; k < v.length; ++k)
array[k + offset] = Min + v[k];
}
@@ -70,7 +70,7 @@ void fillClustered(long[] array, int offset, int length, long Min, long Max) {
* @return array containing the integers
*/
public long[] generateClustered(int N, long Max) {
- long[] array = new long[N];
+ long[] array = new long[N];
fillClustered(array, 0, N, 0, Max);
return array;
}
@@ -82,7 +82,7 @@ public long[] generateClustered(int N, long Max) {
* arguments are ignored
*/
public static void main(final String[] args) {
- long[] example = (new LongClusteredDataGenerator())
+ long[] example = (new LongClusteredDataGenerator())
.generateClustered(20, 1000);
for (int k = 0; k < example.length; ++k)
System.out.println(example[k]);
diff --git a/src/test/java/me/lemire/longcompression/synth/LongUniformDataGenerator.java b/src/test/java/me/lemire/longcompression/synth/LongUniformDataGenerator.java
index 4d435f2..4aa797b 100644
--- a/src/test/java/me/lemire/longcompression/synth/LongUniformDataGenerator.java
+++ b/src/test/java/me/lemire/longcompression/synth/LongUniformDataGenerator.java
@@ -59,12 +59,12 @@ long[] generateUniformHash(int N, long Max) {
* output all longs from the range [0,Max) that are not in the array
*/
static long[] negate(long[] x, long Max) {
- int newLength = saturatedCast(Max - x.length);
- long[] ans = new long[newLength];
+ int newLength = saturatedCast(Max - x.length);
+ long[] ans = new long[newLength];
int i = 0;
int c = 0;
for (int j = 0; j < x.length; ++j) {
- long v = x[j];
+ long v = x[j];
for (; i < v; ++i)
ans[c++] = i;
++i;
@@ -74,13 +74,13 @@ static long[] negate(long[] x, long Max) {
return ans;
}
- private static int saturatedCast(long toInt) {
- if (toInt > Integer.MAX_VALUE) {
- return Integer.MAX_VALUE;
- } else {
- return (int) toInt;
- }
- }
+ private static int saturatedCast(long toInt) {
+ if (toInt > Integer.MAX_VALUE) {
+ return Integer.MAX_VALUE;
+ } else {
+ return (int) toInt;
+ }
+ }
/**
* generates randomly N distinct longs from 0 to Max.
@@ -92,7 +92,7 @@ private static int saturatedCast(long toInt) {
* @return an array containing randomly selected longs
*/
public long[] generateUniform(int N, long Max) {
- assert N >= 0;
+ assert N >= 0;
assert Max >= 0;
if (N * 2 > Max) {
return negate(generateUniform(saturatedCast(Max - N), Max), Max);