From b40c7e623e2889462e1a974453d3564ef389b406 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 28 Nov 2022 11:24:54 -0500 Subject: [PATCH 01/78] Cleaning. --- src/main/java/me/lemire/longcompression/LongVariableByte.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java index 478db20..f3d10ee 100644 --- a/src/main/java/me/lemire/longcompression/LongVariableByte.java +++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java @@ -46,7 +46,6 @@ public void headlessCompress(long[] in, IntWrapper inpos, int inlength, long[] o buf.order(ByteOrder.LITTLE_ENDIAN); for (int k = inpos.get(); k < inpos.get() + inlength; ++k) { final long val = in[k]; - // System.out.println(LongUtil.longToBinaryWithLeading(val)); if (val >= 0 && val < (1 << 7)) { buf.put((byte) (val | (1 << 7))); } else if (val >= 0 && val < (1 << 14)) { @@ -187,7 +186,6 @@ public void compress(long[] in, IntWrapper inpos, int inlength, byte[] out, out[outpostmp++] = (byte) extract7bits(7, val); out[outpostmp++] = (byte) (extract7bitsmaskless(8, (val)) | (1 << 7)); } else { - // System.out.println(LongUtil.longToBinaryWithLeading(val)); out[outpostmp++] = (byte) extract7bits(0, val); out[outpostmp++] = (byte) extract7bits(1, val); out[outpostmp++] = (byte) extract7bits(2, val); @@ -214,7 +212,6 @@ public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, int tmpoutpos = outpos.get(); for (long v = 0, shift = 0; p < finalp;) { val = in[p]; - // System.out.println(LongUtil.longToBinaryWithLeading(val)); long c = (byte) (val >>> s); // Shift to next byte s += 8; @@ -309,7 +306,6 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[] int finaloutpos = num + tmpoutpos; for (long v = 0, shift = 0; tmpoutpos < finaloutpos;) { val = in[p]; - // System.out.println(longToBinaryWithLeading(val)); long c = val >>> s; // Shift to next byte s += 8; From 324c2823eff1bcd3c013c5ebc89fa143a2274a12 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 28 Nov 2022 11:27:08 -0500 Subject: [PATCH 02/78] Reverted random -> head --- src/main/java/me/lemire/longcompression/SkippableLongCODEC.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java index e3e7b84..c55a9ef 100644 --- a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java +++ b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java @@ -11,7 +11,7 @@ /** * Interface describing a standard CODEC to compress longs. This is a - * variation on the LongCODEC interface meant to be used for head access. + * variation on the LongCODEC interface meant to be used for random access. * * The main difference is that we must specify the number of longs we wish to * decode. This information should be stored elsewhere. From e2a90c6bc73d3f0dcd66a3a3d13f57c54607789b Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 28 Nov 2022 12:58:46 -0500 Subject: [PATCH 03/78] Minor fixes. --- .../me/lemire/integercompression/SkippableIntegerCODEC.java | 2 +- .../integercompression/benchmarktools/BenchmarkSkippable.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java index 4568d71..719d9d5 100644 --- a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java +++ b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java @@ -10,7 +10,7 @@ /** * Interface describing a standard CODEC to compress integers. This is a - * variation on the IntegerCODEC interface meant to be used for head access. + * variation on the IntegerCODEC interface meant to be used for random access. * * The main difference is that we must specify the number of integers we wish to * decode. This information should be stored elsewhere. diff --git a/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java b/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java index 58bbc4a..363b841 100644 --- a/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java +++ b/src/main/java/me/lemire/integercompression/benchmarktools/BenchmarkSkippable.java @@ -83,7 +83,6 @@ private static int decompressFromSkipTable(Object c, int[] compressed, if (num > length - uncomppos.get()) num = length - uncomppos.get(); int location = metadata[metapos++]; - // System.out.println("location = "+location); int initvalue = metadata[metapos++]; int outputlocation = uncomppos.get(); if (location != compressedpos.get()) From 7dc74015890b580bb5004686920be43543542c4f Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 28 Nov 2022 12:59:39 -0500 Subject: [PATCH 04/78] Removing spurious "we". --- example.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.java b/example.java index 817e94f..71ccd63 100644 --- a/example.java +++ b/example.java @@ -117,7 +117,7 @@ public static void basicExampleHeadless() { */ IntWrapper inputoffset = new IntWrapper(0); IntWrapper outputoffset = new IntWrapper(1); - compressed[0] = data.length; // we manually store how many integers we + compressed[0] = data.length; // we manually store how many integers codec.headlessCompress(data, inputoffset, data.length, compressed, outputoffset, new IntWrapper(0)); // got it! // inputoffset should be at data.length but outputoffset tells From 1e48bd09f32d5cb65e42be90e47c99d731b4cfb3 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 28 Nov 2022 13:24:22 -0500 Subject: [PATCH 05/78] Extending the 'random access' documentation. --- .../me/lemire/integercompression/SkippableIntegerCODEC.java | 3 ++- .../java/me/lemire/longcompression/SkippableLongCODEC.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java index 719d9d5..8b4dd8b 100644 --- a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java +++ b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java @@ -10,7 +10,8 @@ /** * Interface describing a standard CODEC to compress integers. This is a - * variation on the IntegerCODEC interface meant to be used for random access. + * variation on the IntegerCODEC interface meant to be used for random access + * (i.e., given a large array, you can segment it and decode just the subarray you need). * * The main difference is that we must specify the number of integers we wish to * decode. This information should be stored elsewhere. diff --git a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java index c55a9ef..984914f 100644 --- a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java +++ b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java @@ -11,7 +11,8 @@ /** * Interface describing a standard CODEC to compress longs. This is a - * variation on the LongCODEC interface meant to be used for random access. + * variation on the LongCODEC interface meant to be used for random access + * (i.e., given a large array, you can segment it and decode just the subarray you need). * * The main difference is that we must specify the number of longs we wish to * decode. This information should be stored elsewhere. From 5b86fe74fd62b7b3f8911cb309d6252da58b932e Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Date: Mon, 28 Nov 2022 22:56:07 +0400 Subject: [PATCH 06/78] Introduce LongBinaryPacking --- .../lemire/integercompression/BitPacking.java | 4 +- .../DeltaZigzagVariableByte.java | 3 + .../lemire/integercompression/FastPFOR.java | 3 + .../integercompression/FastPFOR128.java | 3 + .../integercompression/IntCompressor.java | 4 +- .../integercompression/IntegerCODEC.java | 4 +- .../SkippableIntegerCODEC.java | 6 +- .../integercompression/VariableByte.java | 7 +- .../longcompression/LongBinaryPacking.java | 143 +++++++++++++++++ .../longcompression/LongBitPacking.java | 146 ++++++++++++++++++ .../me/lemire/longcompression/LongCODEC.java | 6 +- .../longcompression/LongCompressor.java | 76 +++++++++ .../me/lemire/longcompression/LongUtil.java | 30 ++++ .../longcompression/LongVariableByte.java | 4 +- .../longcompression/RoaringIntPacking.java | 62 -------- .../longcompression/SkippableLongCODEC.java | 6 +- .../longcompression/ATestLongCODEC.java | 96 ++++++++++++ .../lemire/longcompression/LongBasicTest.java | 33 ++-- .../SkippableLongBasicTest.java | 3 +- .../longcompression/TestLongAs2IntsCodec.java | 83 +--------- .../TestLongBinaryPacking.java | 26 ++++ .../longcompression/TestLongVariableByte.java | 81 +--------- 22 files changed, 575 insertions(+), 254 deletions(-) create mode 100644 src/main/java/me/lemire/longcompression/LongBinaryPacking.java create mode 100644 src/main/java/me/lemire/longcompression/LongBitPacking.java create mode 100644 src/main/java/me/lemire/longcompression/LongCompressor.java create mode 100644 src/test/java/me/lemire/longcompression/ATestLongCODEC.java create mode 100644 src/test/java/me/lemire/longcompression/TestLongBinaryPacking.java diff --git a/src/main/java/me/lemire/integercompression/BitPacking.java b/src/main/java/me/lemire/integercompression/BitPacking.java index e83c9e0..8652be4 100644 --- a/src/main/java/me/lemire/integercompression/BitPacking.java +++ b/src/main/java/me/lemire/integercompression/BitPacking.java @@ -1690,7 +1690,7 @@ protected static void fastpack9(final int[] in, int inpos, } /** - * Unpack 32 integers + * Pack without mask 32 integers * * @param in * source array @@ -3005,7 +3005,7 @@ protected static void fastpackwithoutmask9(final int[] in, int inpos, } /** - * Pack the 32 integers + * Unpack the 32 integers * * @param in * source array diff --git a/src/main/java/me/lemire/integercompression/DeltaZigzagVariableByte.java b/src/main/java/me/lemire/integercompression/DeltaZigzagVariableByte.java index ca9d0ad..2f8c709 100644 --- a/src/main/java/me/lemire/integercompression/DeltaZigzagVariableByte.java +++ b/src/main/java/me/lemire/integercompression/DeltaZigzagVariableByte.java @@ -134,6 +134,9 @@ public void uncompress(int[] inBuf, IntWrapper inPos, int inLen, * In case you need a different way to allocate buffers, you can override this method * with a custom behavior. The default implementation allocates a new Java direct * {@link ByteBuffer} on each invocation. + * + * @param sizeInBytes + * @return */ protected ByteBuffer makeBuffer(int sizeInBytes) { return ByteBuffer.allocateDirect(sizeInBytes); diff --git a/src/main/java/me/lemire/integercompression/FastPFOR.java b/src/main/java/me/lemire/integercompression/FastPFOR.java index 36226c0..47969f4 100644 --- a/src/main/java/me/lemire/integercompression/FastPFOR.java +++ b/src/main/java/me/lemire/integercompression/FastPFOR.java @@ -336,6 +336,9 @@ public String toString() { * In case you need a different way to allocate buffers, you can override this method * with a custom behavior. The default implementation allocates a new Java direct * {@link ByteBuffer} on each invocation. + * + * @param sizeInBytes + * @return */ protected ByteBuffer makeBuffer(int sizeInBytes) { return ByteBuffer.allocateDirect(sizeInBytes); diff --git a/src/main/java/me/lemire/integercompression/FastPFOR128.java b/src/main/java/me/lemire/integercompression/FastPFOR128.java index b124072..83a3e1f 100644 --- a/src/main/java/me/lemire/integercompression/FastPFOR128.java +++ b/src/main/java/me/lemire/integercompression/FastPFOR128.java @@ -317,6 +317,9 @@ public String toString() { * In case you need a different way to allocate buffers, you can override this method * with a custom behavior. The default implementation allocates a new Java direct * {@link ByteBuffer} on each invocation. + * + * @param sizeInBytes + * @return */ protected ByteBuffer makeBuffer(int sizeInBytes) { return ByteBuffer.allocateDirect(sizeInBytes); diff --git a/src/main/java/me/lemire/integercompression/IntCompressor.java b/src/main/java/me/lemire/integercompression/IntCompressor.java index 87e7bde..abaeea9 100644 --- a/src/main/java/me/lemire/integercompression/IntCompressor.java +++ b/src/main/java/me/lemire/integercompression/IntCompressor.java @@ -36,7 +36,8 @@ public IntCompressor() { * @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[] compressed = new int[input.length + input.length / 100 + 1024]; + // Store at index=0 the length of the input, hence enabling .headlessCompress compressed[0] = input.length; IntWrapper outpos = new IntWrapper(1); try { @@ -58,6 +59,7 @@ public int[] compress(int[] input) { * @return uncompressed array */ public int[] uncompress(int[] compressed) { + // Read at index=0 the length of the input, hence enabling .headlessUncompress int[] decompressed = new int[compressed[0]]; IntWrapper inpos = new IntWrapper(1); codec.headlessUncompress(compressed, inpos, diff --git a/src/main/java/me/lemire/integercompression/IntegerCODEC.java b/src/main/java/me/lemire/integercompression/IntegerCODEC.java index f2c9c7a..1dd9a4c 100644 --- a/src/main/java/me/lemire/integercompression/IntegerCODEC.java +++ b/src/main/java/me/lemire/integercompression/IntegerCODEC.java @@ -25,7 +25,7 @@ public interface IntegerCODEC { * @param in * input array * @param inpos - * location in the input array + * where to start reading in the array * @param inlength * how many integers to compress * @param out @@ -52,7 +52,7 @@ public void compress(int[] in, IntWrapper inpos, int inlength, * @param out * array where to write the compressed output * @param outpos - * where to write the compressed output in out + * where to start writing the uncompressed output in out */ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos); diff --git a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java index 4568d71..0b6e825 100644 --- a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java +++ b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java @@ -32,7 +32,7 @@ public interface SkippableIntegerCODEC { * @param in * input array * @param inpos - * location in the input array + * where to start reading in the array * @param inlength * how many integers to compress * @param out @@ -56,9 +56,9 @@ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out * @param inlength * length of the compressed data (ignored by some schemes) * @param out - * array where to write the compressed output + * array where to write the uncompressed output * @param outpos - * where to write the compressed output in out + * where to start writing the uncompressed output in out * @param num * number of integers we want to decode, the actual number of integers decoded can be less */ diff --git a/src/main/java/me/lemire/integercompression/VariableByte.java b/src/main/java/me/lemire/integercompression/VariableByte.java index 09e479b..1e28537 100644 --- a/src/main/java/me/lemire/integercompression/VariableByte.java +++ b/src/main/java/me/lemire/integercompression/VariableByte.java @@ -126,7 +126,7 @@ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, s += 8; // Shift to next integer if s==32 p += s>>5; - // cycle from 31 to 0 + // cycle from 32 to 0 s = s & 31; v += ((c & 127) << shift); if ((c & 128) == 128) { @@ -194,7 +194,7 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o s += 8; // Shift to next integer if s==32 p += s>>5; - // cycle from 31 to 0 + // cycle from 32 to 0 s = s & 31; v += ((c & 127) << shift); if ((c & 128) == 128) { @@ -214,6 +214,9 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o * In case you need a different way to allocate buffers, you can override this method * with a custom behavior. The default implementation allocates a new Java direct * {@link ByteBuffer} on each invocation. + * + * @param sizeInBytes + * @return */ protected ByteBuffer makeBuffer(int sizeInBytes) { return ByteBuffer.allocateDirect(sizeInBytes); diff --git a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java new file mode 100644 index 0000000..dba5cbc --- /dev/null +++ b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java @@ -0,0 +1,143 @@ +package me.lemire.longcompression; + +import me.lemire.integercompression.BinaryPacking; +import me.lemire.integercompression.IntWrapper; +import me.lemire.integercompression.Util; + +/** + * Scheme based on a commonly used idea: can be extremely fast. + * It encodes integers in blocks of 64 longs. For arrays containing + * an arbitrary number of longs, you should use it in conjunction + * with another CODEC: + * + *
LongCODEC ic = 
+ *  new Composition(new LongBinaryPacking(), new LongVariableByte()).
+ * + * Note that this does not use differential coding: if you are working on sorted + * lists, you must compute the deltas separately. + * + *

+ * For details, please see {@link BinaryPacking} + *

+ * + * @author Benoit Lacelle + */ +public final class LongBinaryPacking implements LongCODEC, SkippableLongCODEC { + final static int BLOCK_SIZE = 64; + + @Override + public void compress(long[] in, IntWrapper inpos, int inlength, + long[] out, IntWrapper outpos) { + inlength = Util.greatestMultiple(inlength, BLOCK_SIZE); + if (inlength == 0) + return; + out[outpos.get()] = inlength; + outpos.increment(); + headlessCompress(in, inpos, inlength, out, outpos); + } + + @Override + public void headlessCompress(long[] in, IntWrapper inpos, int inlength, + long[] out, IntWrapper outpos) { + inlength = Util.greatestMultiple(inlength, BLOCK_SIZE); + int tmpoutpos = outpos.get(); + int s = inpos.get(); + // Compress by block of 8 * 64 longs as much as possible + for (; s + BLOCK_SIZE * 8 - 1 < inpos.get() + inlength; s += BLOCK_SIZE * 8) { + // maxbits can be anything between 0 and 64 included: expressed within a byte (1 << 6) + final long mbits1 = LongUtil.maxbits(in, s + 0 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits2 = LongUtil.maxbits(in, s + 1 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits3 = LongUtil.maxbits(in, s + 2 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits4 = LongUtil.maxbits(in, s + 3 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits5 = LongUtil.maxbits(in, s + 4 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits6 = LongUtil.maxbits(in, s + 5 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits7 = LongUtil.maxbits(in, s + 6 * BLOCK_SIZE, BLOCK_SIZE); + final long mbits8 = LongUtil.maxbits(in, s + 7 * BLOCK_SIZE, BLOCK_SIZE); + // The first long expressed the maxbits for the 8 buckets + out[tmpoutpos++] = (mbits1 << 56) | (mbits2 << 48) | (mbits3 << 40) | (mbits4 << 32) | (mbits5 << 24) | (mbits6 << 16) | (mbits7 << 8) | (mbits8); + LongBitPacking.fastpackwithoutmask(in, s + 0 * BLOCK_SIZE, out, tmpoutpos, (int) mbits1); + tmpoutpos += mbits1; + LongBitPacking.fastpackwithoutmask(in, s + 1 * BLOCK_SIZE, out, tmpoutpos, (int) mbits2); + tmpoutpos += mbits2; + LongBitPacking.fastpackwithoutmask(in, s + 2 * BLOCK_SIZE, out, tmpoutpos, (int) mbits3); + tmpoutpos += mbits3; + LongBitPacking.fastpackwithoutmask(in, s + 3 * BLOCK_SIZE, out, tmpoutpos, (int) mbits4); + tmpoutpos += mbits4; + LongBitPacking.fastpackwithoutmask(in, s + 4 * BLOCK_SIZE, out, tmpoutpos, (int) mbits5); + tmpoutpos += mbits5; + LongBitPacking.fastpackwithoutmask(in, s + 5 * BLOCK_SIZE, out, tmpoutpos, (int) mbits6); + tmpoutpos += mbits6; + LongBitPacking.fastpackwithoutmask(in, s + 6 * BLOCK_SIZE, out, tmpoutpos, (int) mbits7); + tmpoutpos += mbits7; + LongBitPacking.fastpackwithoutmask(in, s + 7 * BLOCK_SIZE, out, tmpoutpos, (int) mbits8); + tmpoutpos += mbits8; + } + // Then we compress up to 7 blocks of 64 longs + for (; s < inpos.get() + inlength; s += BLOCK_SIZE ) { + final int mbits = LongUtil.maxbits(in, s, BLOCK_SIZE); + out[tmpoutpos++] = mbits; + LongBitPacking.fastpackwithoutmask(in, s, out, tmpoutpos, mbits); + tmpoutpos += mbits; + } + inpos.add(inlength); + outpos.set(tmpoutpos); + } + + @Override + public void uncompress(long[] in, IntWrapper inpos, int inlength, + long[] out, IntWrapper outpos) { + if (inlength == 0) + return; + final int outlength = (int) in[inpos.get()]; + inpos.increment(); + headlessUncompress(in,inpos, inlength,out,outpos,outlength); + } + + @Override + public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, + long[] out, IntWrapper outpos, int num) { + final int outlength = Util.greatestMultiple(num, BLOCK_SIZE); + int tmpinpos = inpos.get(); + int s = outpos.get(); + for (; s + BLOCK_SIZE * 8 - 1 < outpos.get() + outlength; s += BLOCK_SIZE * 8) { + final long mbits1 = (in[tmpinpos] >>> 56); + final long mbits2 = (in[tmpinpos] >>> 48) & 0xFF; + final long mbits3 = (in[tmpinpos] >>> 40) & 0xFF; + final long mbits4 = (in[tmpinpos] >>> 32) & 0xFF; + final long mbits5 = (in[tmpinpos] >>> 24) & 0xFF; + final long mbits6 = (in[tmpinpos] >>> 16) & 0xFF; + final long mbits7 = (in[tmpinpos] >>> 8) & 0xFF; + final long mbits8 = (in[tmpinpos]) & 0xFF; + ++tmpinpos; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 0 * BLOCK_SIZE, (int) mbits1); + tmpinpos += mbits1; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 1 * BLOCK_SIZE, (int) mbits2); + tmpinpos += mbits2; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 2 * BLOCK_SIZE, (int) mbits3); + tmpinpos += mbits3; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 3 * BLOCK_SIZE, (int) mbits4); + tmpinpos += mbits4; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 4 * BLOCK_SIZE, (int) mbits5); + tmpinpos += mbits5; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 5 * BLOCK_SIZE, (int) mbits6); + tmpinpos += mbits6; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 6 * BLOCK_SIZE, (int) mbits7); + tmpinpos += mbits7; + LongBitPacking.fastunpack(in, tmpinpos, out, s + 7 * BLOCK_SIZE, (int) mbits8); + tmpinpos += mbits8; + } + for (; s < outpos.get() + outlength; s += BLOCK_SIZE ) { + final int mbits = (int) in[tmpinpos]; + ++tmpinpos; + LongBitPacking.fastunpack(in, tmpinpos, out, s, mbits); + tmpinpos += mbits; + } + outpos.add(outlength); + inpos.set(tmpinpos); + } + + @Override + public String toString() { + return this.getClass().getSimpleName(); + } +} diff --git a/src/main/java/me/lemire/longcompression/LongBitPacking.java b/src/main/java/me/lemire/longcompression/LongBitPacking.java new file mode 100644 index 0000000..7da1c7f --- /dev/null +++ b/src/main/java/me/lemire/longcompression/LongBitPacking.java @@ -0,0 +1,146 @@ +/** + * This code is released under the + * Apache License Version 2.0 http://www.apache.org/licenses/. + * + * (c) Daniel Lemire, http://lemire.me/en/ + */ + +package me.lemire.longcompression; + +import java.util.Arrays; + +/** + * Bitpacking routines + * + *

For details, please see

+ *

+ * Daniel Lemire and Leonid Boytsov, Decoding billions of integers per second + * through vectorization Software: Practice & Experience + * http://onlinelibrary.wiley.com/doi/10.1002/spe.2203/abstract + * http://arxiv.org/abs/1209.2137 + *

+ * + * @author Benoit Lacelle + * + */ +public final class LongBitPacking { + + /** + * Pack 64 longs + * + * @param in + * source array + * @param inpos + * position in source array + * @param out + * output array + * @param outpos + * position in output array + * @param bit + * number of bits to use per long + */ + public static void fastpackwithoutmask(final long[] in, final int inpos, + final long[] out, final int outpos, final int bit) { + if (bit == 0) { + fastpackwithoutmask0(in, inpos, out, outpos); + } else if (bit == 64) { + fastpackwithoutmask64(in, inpos, out, outpos); + } else if (bit > 0 && bit < 64) { + slowpackwithoutmask(in, inpos, out, outpos, bit); + } else { + throw new IllegalArgumentException("Unsupported bit width: " + bit); + } + } + + protected static void fastpackwithoutmask0(final long[] in, int inpos, + final long[] out, int outpos) { + // nothing + } + + protected static void fastpackwithoutmask64(final long[] in, int inpos, + final long[] out, int outpos) { + System.arraycopy(in, inpos, out, outpos, 64); + } + + protected static void slowpackwithoutmask(final long[] in, int inpos, + final long[] out, int outpos, final int bit) { + int bucket = 0; + int shift = 0; + + out[outpos + bucket] = 0L; + for (int i = 0 ; i < 64 ; i++) { + if (shift >= 64) { + bucket++; + out[bucket + outpos] = 0L; + shift -= 64; + + if (shift > 0) { + // There is some leftovers from previous input in the next bucket + out[outpos + bucket] |= in[inpos + i - 1] >> (bit - shift); + } + } + out[outpos + bucket] |= in[inpos + i] << shift; + + shift += bit; + } + } + + + /** + * Unpack the 64 longs + * + * @param in + * source array + * @param inpos + * starting point in the source array + * @param out + * output array + * @param outpos + * starting point in the output array + * @param bit + * how many bits to use per integer + */ + public static void fastunpack(final long[] in, final int inpos, + final long[] out, final int outpos, final int bit) { + if (bit == 0) { + fastunpack0(in, inpos, out, outpos); + } else if (bit == 64) { + fastunpack64(in, inpos, out, outpos); + } else if (bit > 0 && bit < 64) { + slowunpack(in, inpos, out, outpos, bit); + } else { + throw new IllegalArgumentException("Unsupported bit width: " + bit); + } + } + + + protected static void fastunpack0(final long[] in, int inpos, + final long[] out, int outpos) { + Arrays.fill(out, outpos, outpos + 64, 0); + } + + protected static void fastunpack64(final long[] in, int inpos, + final long[] out, int outpos) { + System.arraycopy(in, inpos, out, outpos, 64); + } + + protected static void slowunpack(final long[] in, int inpos, + final long[] out, int outpos, final int bit) { + int bucket = 0; + int shift = 0; + for (int i = 0 ; i < 64 ; i++) { + if (shift >= 64) { + bucket++; + shift -= 64; + + if (shift > 0) { + // There is some leftovers from previous input in the next bucket + out[outpos + i - 1] |= (in[inpos + bucket] << (bit - shift) & ((1L << bit) - 1)); + } + } + out[outpos + i] = ((in[inpos + bucket] >>> shift) & ((1L << bit) - 1)); + + shift += bit; + } + } +} diff --git a/src/main/java/me/lemire/longcompression/LongCODEC.java b/src/main/java/me/lemire/longcompression/LongCODEC.java index c0f67b2..1068f9f 100644 --- a/src/main/java/me/lemire/longcompression/LongCODEC.java +++ b/src/main/java/me/lemire/longcompression/LongCODEC.java @@ -27,7 +27,7 @@ public interface LongCODEC { * @param in * input array * @param inpos - * location in the input array + * where to start reading in the array * @param inlength * how many longs to compress * @param out @@ -52,9 +52,9 @@ public void compress(long[] in, IntWrapper inpos, int inlength, * length of the compressed data (ignored by some * schemes) * @param out - * array where to write the compressed output + * array where to write the uncompressed output * @param outpos - * where to write the compressed output in out + * where to start writing the uncompressed output in out */ public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos); diff --git a/src/main/java/me/lemire/longcompression/LongCompressor.java b/src/main/java/me/lemire/longcompression/LongCompressor.java new file mode 100644 index 0000000..a140911 --- /dev/null +++ b/src/main/java/me/lemire/longcompression/LongCompressor.java @@ -0,0 +1,76 @@ +package me.lemire.longcompression; + +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 + * a "friendly" API. + * + * @author Benoit Lacelle + */ +public class LongCompressor { + + + SkippableLongCODEC codec; + /** + * Constructor wrapping a codec. + * + * @param c the underlying codec + */ + public LongCompressor(SkippableLongCODEC c) { + codec = c; + } + + /** + * Constructor with default codec. + */ + public LongCompressor() { + codec = new SkippableLongComposition(new LongBinaryPacking(), + new LongVariableByte()); + } + + /** + * Compress an array and returns the compressed result as a new array. + * + * @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]; + // 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); + } + compressed = Arrays.copyOf(compressed,outpos.intValue()); + return compressed; + } + + /** + * Uncompress an array and returns the uncompressed result as a new array. + * + * @param compressed compressed array + * @return uncompressed array + */ + public long[] uncompress(long[] compressed) { + // Read at index=0 the length of the input, hence enabling .headlessUncompress + long[] decompressed = new long[(int) compressed[0]]; + IntWrapper inpos = new IntWrapper(1); + codec.headlessUncompress(compressed, inpos, + compressed.length - inpos.intValue(), + decompressed, new IntWrapper(0), + decompressed.length); + return decompressed; + } + +} diff --git a/src/main/java/me/lemire/longcompression/LongUtil.java b/src/main/java/me/lemire/longcompression/LongUtil.java index c06433f..596a134 100644 --- a/src/main/java/me/lemire/longcompression/LongUtil.java +++ b/src/main/java/me/lemire/longcompression/LongUtil.java @@ -15,7 +15,37 @@ */ @Deprecated public class LongUtil { + + /** + * Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range + * of value + * + * @param i + * source array + * @param pos + * starting position + * @param length + * number of integers to consider + * @return integer logarithm + */ + public static int maxbits(long[] i, int pos, int length) { + long mask = 0; + for (int k = pos; k < pos + length; ++k) + mask |= i[k]; + return bits(mask); + } + /** + * Compute the integer logarithms (ceil(log(x+1)) of a value + * + * @param i + * source value + * @return integer logarithm + */ + public static int bits(long i) { + return 64 - Long.numberOfLeadingZeros(i); + } + protected static String longToBinaryWithLeading(long l) { return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0'); } diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java index 478db20..d31967a 100644 --- a/src/main/java/me/lemire/longcompression/LongVariableByte.java +++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java @@ -220,7 +220,7 @@ public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, s += 8; // Shift to next long if s==64 p += s>>6; - // cycle from 63 to 0 + // Cycle from 64 to 0 s = s & 63; v += ((c & 127) << shift); if ((c & 128) == 128) { @@ -315,7 +315,7 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[] s += 8; // Shift to next long if s == 64 p += s>>6; - // cycle from 63 to 0 + // Cycle from 64 to 0 s = s & 63; v += ((c & 127) << shift); if ((c & 128) == 128) { diff --git a/src/main/java/me/lemire/longcompression/RoaringIntPacking.java b/src/main/java/me/lemire/longcompression/RoaringIntPacking.java index f109ab3..d6b6baa 100644 --- a/src/main/java/me/lemire/longcompression/RoaringIntPacking.java +++ b/src/main/java/me/lemire/longcompression/RoaringIntPacking.java @@ -3,9 +3,6 @@ */ package me.lemire.longcompression; -import java.math.BigInteger; -import java.util.Comparator; - /** * Used to hold the logic packing 2 integers in a long, and separating a long in two integers. It is * useful in {@link Roaring64NavigableMap} as the implementation split the input long in two @@ -46,63 +43,4 @@ public static int low(long id) { public static long pack(int high, int low) { return (((long) high) << 32) | (low & 0xffffffffL); } - - - /** - * - * @param signedLongs true if long put in a {@link Roaring64NavigableMap} should be considered as - * signed long. - * @return the int representing the highest value which can be set as high value in a - * {@link Roaring64NavigableMap} - */ - public static int highestHigh(boolean signedLongs) { - if (signedLongs) { - return Integer.MAX_VALUE; - } else { - return -1; - } - } - - /** - * @return A comparator for unsigned longs: a negative long is a long greater than Long.MAX_VALUE - */ - public static Comparator unsignedComparator() { - return new Comparator() { - - @Override - public int compare(Integer o1, Integer o2) { - return compareUnsigned(o1, o2); - } - }; - } - - /** - * Compares two {@code int} values numerically treating the values as unsigned. - * - * @param x the first {@code int} to compare - * @param y the second {@code int} to compare - * @return the value {@code 0} if {@code x == y}; a value less than {@code 0} if {@code x < y} as - * unsigned values; and a value greater than {@code 0} if {@code x > y} as unsigned values - * @since 1.8 - */ - // Duplicated from jdk8 Integer.compareUnsigned - public static int compareUnsigned(int x, int y) { - return Integer.compare(x + Integer.MIN_VALUE, y + Integer.MIN_VALUE); - } - - /** the constant 2^64 */ - private static final BigInteger TWO_64 = BigInteger.ONE.shiftLeft(64); - - /** - * JDK8 Long.toUnsignedString was too complex to backport. Go for a slow version relying on - * BigInteger - */ - // https://stackoverflow.com/questions/7031198/java-signed-long-to-unsigned-long-string - static String toUnsignedString(long l) { - BigInteger b = BigInteger.valueOf(l); - if (b.signum() < 0) { - b = b.add(TWO_64); - } - return b.toString(); - } } diff --git a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java index e3e7b84..57475f5 100644 --- a/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java +++ b/src/main/java/me/lemire/longcompression/SkippableLongCODEC.java @@ -33,7 +33,7 @@ public interface SkippableLongCODEC { * @param in * input array * @param inpos - * location in the input array + * where to start reading in the array * @param inlength * how many longs to compress * @param out @@ -57,9 +57,9 @@ public void headlessCompress(long[] in, IntWrapper inpos, int inlength, long[] o * @param inlength * length of the compressed data (ignored by some schemes) * @param out - * array where to write the compressed output + * array where to write the uncompressed output * @param outpos - * where to write the compressed output in out + * where to start writing the uncompressed output in out * @param num * number of longs we want to decode, the actual number of longs decoded can be less */ diff --git a/src/test/java/me/lemire/longcompression/ATestLongCODEC.java b/src/test/java/me/lemire/longcompression/ATestLongCODEC.java new file mode 100644 index 0000000..c61ea69 --- /dev/null +++ b/src/test/java/me/lemire/longcompression/ATestLongCODEC.java @@ -0,0 +1,96 @@ +/** + * This code is released under the + * Apache License Version 2.0 http://www.apache.org/licenses/. + * + * (c) Daniel Lemire, http://lemire.me/en/ + */ + +package me.lemire.longcompression; + +import java.util.stream.LongStream; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Edge-cases to be tested on a per-codec basis + * + * @author Benoit Lacelle + */ +public abstract class ATestLongCODEC { + protected void checkConsistency(LongCODEC codec, long[] array) { + { + long[] compressed = LongTestUtils.compress(codec, array); + long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + + if (codec instanceof ByteLongCODEC) { + byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); + long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + + if (codec instanceof SkippableLongCODEC) { + long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); + long[] uncompressed = + LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + } + + public abstract LongCODEC getCodec(); + + @Test + public void testCodec_Minus1() { + checkConsistency(getCodec(), new long[] { -1 }); + } + + @Test + public void testCodec_ZeroTimes8Minus1() { + checkConsistency(getCodec(), new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); + } + + @Test + public void testCodec_ZeroTimes127Minus1() { + long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); + + checkConsistency(getCodec(), array); + } + + @Test + public void testCodec_ZeroTimes128Minus1() { + long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); + + checkConsistency(getCodec(), array); + } + + @Test + public void testCodec_MinValue() { + checkConsistency(getCodec(), new long[] { Long.MIN_VALUE }); + } + + @Test + public void testCodec_ZeroMinValue() { + checkConsistency(getCodec(), new long[] { 0, Long.MIN_VALUE }); + } + + @Test + public void testCodec_allPowerOfTwo() { + checkConsistency(getCodec(), new long[] { 1L << 42 }); + for (int i = 0; i < 64; i++) { + checkConsistency(getCodec(), new long[] { 1L << i }); + } + } + + @Test + public void testCodec_ZeroThenAllPowerOfTwo() { + for (int i = 0; i < 64; i++) { + checkConsistency(getCodec(), new long[] { 0, 1L << i }); + } + } + +} diff --git a/src/test/java/me/lemire/longcompression/LongBasicTest.java b/src/test/java/me/lemire/longcompression/LongBasicTest.java index 5aa3551..1963246 100644 --- a/src/test/java/me/lemire/longcompression/LongBasicTest.java +++ b/src/test/java/me/lemire/longcompression/LongBasicTest.java @@ -14,24 +14,9 @@ import org.junit.Test; -import me.lemire.integercompression.BinaryPacking; -import me.lemire.integercompression.Composition; import me.lemire.integercompression.FastPFOR; import me.lemire.integercompression.FastPFOR128; import me.lemire.integercompression.IntWrapper; -import me.lemire.integercompression.JustCopy; -import me.lemire.integercompression.NewPFD; -import me.lemire.integercompression.NewPFDS16; -import me.lemire.integercompression.NewPFDS9; -import me.lemire.integercompression.OptPFD; -import me.lemire.integercompression.OptPFDS16; -import me.lemire.integercompression.OptPFDS9; -import me.lemire.integercompression.Simple9; -import me.lemire.integercompression.VariableByte; -import me.lemire.integercompression.differential.Delta; -import me.lemire.integercompression.differential.IntegratedBinaryPacking; -import me.lemire.integercompression.differential.IntegratedComposition; -import me.lemire.integercompression.differential.IntegratedVariableByte; import me.lemire.longcompression.differential.LongDelta; import me.lemire.longcompression.synth.LongClusteredDataGenerator; @@ -45,7 +30,9 @@ public class LongBasicTest { final LongCODEC[] codecs = { new LongJustCopy(), new LongVariableByte(), - new LongAs2IntsCodec()}; + new LongAs2IntsCodec(), + new LongComposition(new LongBinaryPacking(), new LongVariableByte()), + }; /** * This tests with a compressed array with various offset @@ -89,14 +76,19 @@ public void varyingLengthTest() { long[] comp = LongTestUtils.compress(c, Arrays.copyOf(data, L)); long[] answer = LongTestUtils.uncompress(c, comp, L); for (int k = 0; k < L; ++k) - if (answer[k] != data[k]) - throw new RuntimeException("bug"); + if (answer[k] != data[k]) { + long[] comp2 = LongTestUtils.compress(c, Arrays.copyOf(data, L)); + long[] answer2 = LongTestUtils.uncompress(c, comp2, L); + throw new RuntimeException("bug"); + } } for (int L = 128; L <= N; L *= 2) { long[] comp = LongTestUtils.compress(c, Arrays.copyOf(data, L)); long[] answer = LongTestUtils.uncompress(c, comp, L); for (int k = 0; k < L; ++k) if (answer[k] != data[k]) { + long[] comp2 = LongTestUtils.compress(c, Arrays.copyOf(data, L)); + long[] answer2 = LongTestUtils.uncompress(c, comp2, L); System.out.println(Arrays.toString(Arrays.copyOf( answer, L))); System.out.println(Arrays.toString(Arrays.copyOf(data, @@ -366,9 +358,12 @@ public void fastPforTest() { 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]) + if (answer[k] != data[k]) { + long[] comp2 = LongTestUtils.compress(codec, Arrays.copyOf(data, N)); + long[] answer2 = LongTestUtils.uncompress(codec, comp2, N); throw new RuntimeException("bug " + k + " " + answer[k] + " != " + data[k]); + } } } diff --git a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java index e900c9c..24cb712 100644 --- a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java +++ b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java @@ -25,7 +25,8 @@ public class SkippableLongBasicTest { final SkippableLongCODEC[] codecs = { new LongJustCopy(), - new LongVariableByte(), }; + new LongVariableByte(), + new SkippableLongComposition(new LongBinaryPacking(), new LongVariableByte()), }; /** diff --git a/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java b/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java index 00bb52a..5b8014e 100644 --- a/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java +++ b/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java @@ -7,8 +7,6 @@ package me.lemire.longcompression; -import java.util.stream.LongStream; - import org.junit.Assert; import org.junit.Test; @@ -17,85 +15,12 @@ * * @author Benoit Lacelle */ -public class TestLongAs2IntsCodec { +public class TestLongAs2IntsCodec extends ATestLongCODEC { final LongAs2IntsCodec codec = new LongAs2IntsCodec(); - private void checkConsistency(LongCODEC codec, long[] array) { - { - long[] compressed = LongTestUtils.compress(codec, array); - long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof ByteLongCODEC) { - byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); - long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof SkippableLongCODEC) { - long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); - long[] uncompressed = - LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - } - - @Test - public void testCodec_Zero() { - checkConsistency(codec, new long[] { 0 }); - } - - @Test - public void testCodec_Minus1() { - checkConsistency(codec, new long[] { -1 }); - } - - @Test - public void testCodec_ZeroTimes8Minus1() { - checkConsistency(codec, new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); - } - - @Test - public void testCodec_ZeroTimes127Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_ZeroTimes128Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_MinValue() { - checkConsistency(codec, new long[] { Long.MIN_VALUE }); - } - - @Test - public void testCodec_ZeroMinValue() { - checkConsistency(codec, new long[] { 0, Long.MIN_VALUE }); - } - - @Test - public void testCodec_allPowerOfTwo() { - checkConsistency(codec, new long[] { 1L << 42 }); - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 1L << i }); - } - } - - @Test - public void testCodec_ZeroThenAllPowerOfTwo() { - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 0, 1L << i }); - } + @Override + public LongCODEC getCodec() { + return codec; } @Test diff --git a/src/test/java/me/lemire/longcompression/TestLongBinaryPacking.java b/src/test/java/me/lemire/longcompression/TestLongBinaryPacking.java new file mode 100644 index 0000000..ecc3f2e --- /dev/null +++ b/src/test/java/me/lemire/longcompression/TestLongBinaryPacking.java @@ -0,0 +1,26 @@ +/** + * This code is released under the + * Apache License Version 2.0 http://www.apache.org/licenses/. + * + * (c) Daniel Lemire, http://lemire.me/en/ + */ + +package me.lemire.longcompression; + +import org.junit.Ignore; + +/** + * Edge-cases having caused issue specifically with LongBinaryPacking. + * + * @author Benoit Lacelle + */ +@Ignore("Parent class tests are not valid as LongBinaryPacking process by chunks of 64 longs") +public class TestLongBinaryPacking extends ATestLongCODEC { + final LongBinaryPacking codec = new LongBinaryPacking(); + + @Override + public LongCODEC getCodec() { + return codec; + } + +} diff --git a/src/test/java/me/lemire/longcompression/TestLongVariableByte.java b/src/test/java/me/lemire/longcompression/TestLongVariableByte.java index 15613f2..ee1755a 100644 --- a/src/test/java/me/lemire/longcompression/TestLongVariableByte.java +++ b/src/test/java/me/lemire/longcompression/TestLongVariableByte.java @@ -7,8 +7,6 @@ package me.lemire.longcompression; -import java.util.stream.LongStream; - import org.junit.Assert; import org.junit.Test; @@ -17,87 +15,20 @@ * * @author Benoit Lacelle */ -public class TestLongVariableByte { +public class TestLongVariableByte extends ATestLongCODEC { final LongVariableByte codec = new LongVariableByte(); - private void checkConsistency(LongCODEC codec, long[] array) { - { - long[] compressed = LongTestUtils.compress(codec, array); - long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof ByteLongCODEC) { - byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); - long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof SkippableLongCODEC) { - long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); - long[] uncompressed = - LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - } - - @Test - public void testCodec_ZeroMinus1() { - checkConsistency(codec, new long[] { -1 }); - } - - @Test - public void testCodec_ZeroTimes8Minus1() { - checkConsistency(codec, new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); - } - - @Test - public void testCodec_ZeroTimes127Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_ZeroTimes128Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_MinValue() { - checkConsistency(codec, new long[] { Long.MIN_VALUE }); - } - - @Test - public void testCodec_ZeroMinValue() { - checkConsistency(codec, new long[] { 0, Long.MIN_VALUE }); - } - - @Test - public void testCodec_allPowerOfTwo() { - checkConsistency(codec, new long[] { 1L << 42 }); - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 1L << i }); - } - } - - @Test - public void testCodec_ZeroThenAllPowerOfTwo() { - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 0, 1L << i }); - } + @Override + public LongCODEC getCodec() { + return codec; } @Test public void testCodec_intermediateHighPowerOfTwo() { Assert.assertEquals(1, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length); Assert.assertEquals(7, LongTestUtils.compress((ByteLongCODEC) codec, new long[] { 1L << 42 }).length); - Assert.assertEquals(1, LongTestUtils.compressHeadless((SkippableLongCODEC) codec, new long[] { 1L << 42 }).length); + Assert.assertEquals(1, + LongTestUtils.compressHeadless((SkippableLongCODEC) codec, new long[] { 1L << 42 }).length); } } From 4fb854fd4582732e6934f6c0317ff14c41b9e3db Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Date: Mon, 28 Nov 2022 23:10:17 +0400 Subject: [PATCH 07/78] Fix tab to 4-spaces --- .../lemire/longcompression/ByteLongCODEC.java | 2 +- .../longcompression/LongAs2IntsCodec.java | 338 +++++++++--------- .../longcompression/LongBinaryPacking.java | 10 +- .../longcompression/LongBitPacking.java | 36 +- .../me/lemire/longcompression/LongUtil.java | 10 +- .../longcompression/LongVariableByte.java | 2 +- 6 files changed, 199 insertions(+), 199 deletions(-) diff --git a/src/main/java/me/lemire/longcompression/ByteLongCODEC.java b/src/main/java/me/lemire/longcompression/ByteLongCODEC.java index e405370..dbc6864 100644 --- a/src/main/java/me/lemire/longcompression/ByteLongCODEC.java +++ b/src/main/java/me/lemire/longcompression/ByteLongCODEC.java @@ -57,6 +57,6 @@ public void compress(long[] in, IntWrapper inpos, int inlength, * where to write the compressed output in out */ public void uncompress(byte[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos); + long[] out, IntWrapper outpos); } diff --git a/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java b/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java index 3b2bc76..35c1166 100644 --- a/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java +++ b/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java @@ -16,174 +16,174 @@ * */ public class LongAs2IntsCodec implements LongCODEC { - final IntegerCODEC highPartsCodec; - final IntegerCODEC lowPartsCodec; - - public LongAs2IntsCodec(IntegerCODEC highPartsCodec, IntegerCODEC lowPartsCodec) { - this.highPartsCodec = highPartsCodec; - this.lowPartsCodec = lowPartsCodec; - } - - /** - * By default, we expect longs to be slightly above Integer.MAX_VALUE. Hence highParts to be small and positive - * integers. For lowParts, we rely on {@link IntCompressor} default IntegerCODEC - */ - public LongAs2IntsCodec() { - this(new VariableByte(), new Composition(new BinaryPacking(), new VariableByte())); - } - - @Override - public void compress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { - if (inlength == 0) { - return; - } - - int[] highParts = new int[inlength]; - int[] lowParts = new int[inlength]; - - for (int i = 0; i < inlength; i++) { - int inPosition = inpos.get() + i; - - highParts[i] = RoaringIntPacking.high(in[inPosition]); - lowParts[i] = RoaringIntPacking.low(in[inPosition]); - } - - // TODO What would be a relevant buffer size? - int[] buffer = new int[inlength * 16]; - - int outPosition = outpos.get(); - - boolean hasLeftover; - { - // The first integer is reserved to hold the number of compressed ints - IntWrapper highPartsOutPosition = new IntWrapper(1); - - highPartsCodec.compress(highParts, new IntWrapper(), inlength, buffer, highPartsOutPosition); - - // Record the compressedHighparts length - buffer[0] = highPartsOutPosition.get() - 1; - - for (int i = 0; i < highPartsOutPosition.get() / 2; i++) { - long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); - out[outPosition++] = pack; - } - - if (1 == highPartsOutPosition.get() % 2) { - // Shift the trailing integer as first in the buffer - hasLeftover = true; - buffer[0] = buffer[highPartsOutPosition.get() - 1]; - } else { - hasLeftover = false; - } - } - - { - // The first integer is reserved to hold the number of compressed ints - IntWrapper lowPartsOutPosition = new IntWrapper(1); - if (hasLeftover) { - // Keep the trailing int from highParts before the reserved int from lowParts compressed length - lowPartsOutPosition.set(2); - } - - lowPartsCodec.compress(lowParts, new IntWrapper(0), inlength, buffer, lowPartsOutPosition); - - // Record the compressedHighparts length - buffer[hasLeftover ? 1 : 0] = lowPartsOutPosition.get() - (hasLeftover ? 2 : 1); - - for (int i = 0; i < lowPartsOutPosition.get() / 2; i++) { - long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); - out[outPosition++] = pack; - } - - if (1 == lowPartsOutPosition.get() % 2) { - // The trailing integer is packed with a 0 - long pack = RoaringIntPacking.pack(buffer[lowPartsOutPosition.get() - 1], 0); - out[outPosition++] = pack; - } - } - - inpos.add(inlength); - outpos.set(outPosition); - } - - /** - * inlength is ignored by this codec. We may rely on it instead of storing the compressedLowPart length - */ - @Override - public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { - if (inlength == 0) { - return; - } - - int longIndex = inpos.get(); - - int nbCompressedHighParts = RoaringIntPacking.high(in[longIndex]); - int[] compressedHighParts = new int[nbCompressedHighParts]; - - // !highPart as we just read the highPart for nbCompressedHighParts - boolean highPart = false; - for (int i = 0; i < nbCompressedHighParts; i++) { - int nextInt; - if (highPart) { - nextInt = RoaringIntPacking.high(in[longIndex + (i + 1) / 2]); - } else { - nextInt = RoaringIntPacking.low(in[longIndex + (i + 1) / 2]); - } - compressedHighParts[i] = nextInt; - - highPart = !highPart; - } - - // TODO What would be a relevant buffer size? - int[] buffer = new int[inlength * 16]; - - IntWrapper highPartsOutPosition = new IntWrapper(); - highPartsCodec.uncompress(compressedHighParts, - new IntWrapper(), - compressedHighParts.length, - buffer, - highPartsOutPosition); - int[] highParts = Arrays.copyOf(buffer, highPartsOutPosition.get()); - - // +1 as we initially read nbCompressedHighParts - int intIndexNbCompressedLowParts = longIndex * 2 + 1 + nbCompressedHighParts; - int nbCompressedLowParts; - if (highPart) { - nbCompressedLowParts = RoaringIntPacking.high(in[intIndexNbCompressedLowParts / 2]); - } else { - nbCompressedLowParts = RoaringIntPacking.low(in[intIndexNbCompressedLowParts / 2]); - } - highPart = !highPart; - - int[] compressedLowParts = new int[nbCompressedLowParts]; - for (int i = 0; i < nbCompressedLowParts; i++) { - int nextInt; - if (highPart) { - nextInt = RoaringIntPacking.high(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); - } else { - nextInt = RoaringIntPacking.low(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); - } - compressedLowParts[i] = nextInt; - - highPart = !highPart; - } - - IntWrapper lowPartsOutPosition = new IntWrapper(); - lowPartsCodec.uncompress(compressedLowParts, - new IntWrapper(), - compressedLowParts.length, - buffer, - lowPartsOutPosition); - int[] lowParts = Arrays.copyOf(buffer, lowPartsOutPosition.get()); - assert highParts.length == lowParts.length; - - int outposition = outpos.get(); - for (int i = 0; i < highParts.length; i++) { - out[outposition++] = RoaringIntPacking.pack(highParts[i], lowParts[i]); - } - - inpos.add(inlength); - outpos.set(outposition); - } + final IntegerCODEC highPartsCodec; + final IntegerCODEC lowPartsCodec; + + public LongAs2IntsCodec(IntegerCODEC highPartsCodec, IntegerCODEC lowPartsCodec) { + this.highPartsCodec = highPartsCodec; + this.lowPartsCodec = lowPartsCodec; + } + + /** + * By default, we expect longs to be slightly above Integer.MAX_VALUE. Hence highParts to be small and positive + * integers. For lowParts, we rely on {@link IntCompressor} default IntegerCODEC + */ + public LongAs2IntsCodec() { + this(new VariableByte(), new Composition(new BinaryPacking(), new VariableByte())); + } + + @Override + public void compress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { + if (inlength == 0) { + return; + } + + int[] highParts = new int[inlength]; + int[] lowParts = new int[inlength]; + + for (int i = 0; i < inlength; i++) { + int inPosition = inpos.get() + i; + + highParts[i] = RoaringIntPacking.high(in[inPosition]); + lowParts[i] = RoaringIntPacking.low(in[inPosition]); + } + + // TODO What would be a relevant buffer size? + int[] buffer = new int[inlength * 16]; + + int outPosition = outpos.get(); + + boolean hasLeftover; + { + // The first integer is reserved to hold the number of compressed ints + IntWrapper highPartsOutPosition = new IntWrapper(1); + + highPartsCodec.compress(highParts, new IntWrapper(), inlength, buffer, highPartsOutPosition); + + // Record the compressedHighparts length + buffer[0] = highPartsOutPosition.get() - 1; + + for (int i = 0; i < highPartsOutPosition.get() / 2; i++) { + long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); + out[outPosition++] = pack; + } + + if (1 == highPartsOutPosition.get() % 2) { + // Shift the trailing integer as first in the buffer + hasLeftover = true; + buffer[0] = buffer[highPartsOutPosition.get() - 1]; + } else { + hasLeftover = false; + } + } + + { + // The first integer is reserved to hold the number of compressed ints + IntWrapper lowPartsOutPosition = new IntWrapper(1); + if (hasLeftover) { + // Keep the trailing int from highParts before the reserved int from lowParts compressed length + lowPartsOutPosition.set(2); + } + + lowPartsCodec.compress(lowParts, new IntWrapper(0), inlength, buffer, lowPartsOutPosition); + + // Record the compressedHighparts length + buffer[hasLeftover ? 1 : 0] = lowPartsOutPosition.get() - (hasLeftover ? 2 : 1); + + for (int i = 0; i < lowPartsOutPosition.get() / 2; i++) { + long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); + out[outPosition++] = pack; + } + + if (1 == lowPartsOutPosition.get() % 2) { + // The trailing integer is packed with a 0 + long pack = RoaringIntPacking.pack(buffer[lowPartsOutPosition.get() - 1], 0); + out[outPosition++] = pack; + } + } + + inpos.add(inlength); + outpos.set(outPosition); + } + + /** + * inlength is ignored by this codec. We may rely on it instead of storing the compressedLowPart length + */ + @Override + public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { + if (inlength == 0) { + return; + } + + int longIndex = inpos.get(); + + int nbCompressedHighParts = RoaringIntPacking.high(in[longIndex]); + int[] compressedHighParts = new int[nbCompressedHighParts]; + + // !highPart as we just read the highPart for nbCompressedHighParts + boolean highPart = false; + for (int i = 0; i < nbCompressedHighParts; i++) { + int nextInt; + if (highPart) { + nextInt = RoaringIntPacking.high(in[longIndex + (i + 1) / 2]); + } else { + nextInt = RoaringIntPacking.low(in[longIndex + (i + 1) / 2]); + } + compressedHighParts[i] = nextInt; + + highPart = !highPart; + } + + // TODO What would be a relevant buffer size? + int[] buffer = new int[inlength * 16]; + + IntWrapper highPartsOutPosition = new IntWrapper(); + highPartsCodec.uncompress(compressedHighParts, + new IntWrapper(), + compressedHighParts.length, + buffer, + highPartsOutPosition); + int[] highParts = Arrays.copyOf(buffer, highPartsOutPosition.get()); + + // +1 as we initially read nbCompressedHighParts + int intIndexNbCompressedLowParts = longIndex * 2 + 1 + nbCompressedHighParts; + int nbCompressedLowParts; + if (highPart) { + nbCompressedLowParts = RoaringIntPacking.high(in[intIndexNbCompressedLowParts / 2]); + } else { + nbCompressedLowParts = RoaringIntPacking.low(in[intIndexNbCompressedLowParts / 2]); + } + highPart = !highPart; + + int[] compressedLowParts = new int[nbCompressedLowParts]; + for (int i = 0; i < nbCompressedLowParts; i++) { + int nextInt; + if (highPart) { + nextInt = RoaringIntPacking.high(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); + } else { + nextInt = RoaringIntPacking.low(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); + } + compressedLowParts[i] = nextInt; + + highPart = !highPart; + } + + IntWrapper lowPartsOutPosition = new IntWrapper(); + lowPartsCodec.uncompress(compressedLowParts, + new IntWrapper(), + compressedLowParts.length, + buffer, + lowPartsOutPosition); + int[] lowParts = Arrays.copyOf(buffer, lowPartsOutPosition.get()); + assert highParts.length == lowParts.length; + + int outposition = outpos.get(); + for (int i = 0; i < highParts.length; i++) { + out[outposition++] = RoaringIntPacking.pack(highParts[i], lowParts[i]); + } + + inpos.add(inlength); + outpos.set(outposition); + } } diff --git a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java index dba5cbc..0d33ec6 100644 --- a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java +++ b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java @@ -27,7 +27,7 @@ public final class LongBinaryPacking implements LongCODEC, SkippableLongCODEC { @Override public void compress(long[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos) { + long[] out, IntWrapper outpos) { inlength = Util.greatestMultiple(inlength, BLOCK_SIZE); if (inlength == 0) return; @@ -38,13 +38,13 @@ public void compress(long[] in, IntWrapper inpos, int inlength, @Override public void headlessCompress(long[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos) { + long[] out, IntWrapper outpos) { inlength = Util.greatestMultiple(inlength, BLOCK_SIZE); int tmpoutpos = outpos.get(); int s = inpos.get(); // Compress by block of 8 * 64 longs as much as possible for (; s + BLOCK_SIZE * 8 - 1 < inpos.get() + inlength; s += BLOCK_SIZE * 8) { - // maxbits can be anything between 0 and 64 included: expressed within a byte (1 << 6) + // maxbits can be anything between 0 and 64 included: expressed within a byte (1 << 6) final long mbits1 = LongUtil.maxbits(in, s + 0 * BLOCK_SIZE, BLOCK_SIZE); final long mbits2 = LongUtil.maxbits(in, s + 1 * BLOCK_SIZE, BLOCK_SIZE); final long mbits3 = LongUtil.maxbits(in, s + 2 * BLOCK_SIZE, BLOCK_SIZE); @@ -85,7 +85,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) { if (inlength == 0) return; final int outlength = (int) in[inpos.get()]; @@ -95,7 +95,7 @@ public void uncompress(long[] in, IntWrapper inpos, int inlength, @Override public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos, int num) { + long[] out, IntWrapper outpos, int num) { final int outlength = Util.greatestMultiple(num, BLOCK_SIZE); int tmpinpos = inpos.get(); int s = outpos.get(); diff --git a/src/main/java/me/lemire/longcompression/LongBitPacking.java b/src/main/java/me/lemire/longcompression/LongBitPacking.java index 7da1c7f..2d282ec 100644 --- a/src/main/java/me/lemire/longcompression/LongBitPacking.java +++ b/src/main/java/me/lemire/longcompression/LongBitPacking.java @@ -41,15 +41,15 @@ public final class LongBitPacking { */ public static void fastpackwithoutmask(final long[] in, final int inpos, final long[] out, final int outpos, final int bit) { - if (bit == 0) { - fastpackwithoutmask0(in, inpos, out, outpos); - } else if (bit == 64) { - fastpackwithoutmask64(in, inpos, out, outpos); - } else if (bit > 0 && bit < 64) { - slowpackwithoutmask(in, inpos, out, outpos, bit); - } else { + if (bit == 0) { + fastpackwithoutmask0(in, inpos, out, outpos); + } else if (bit == 64) { + fastpackwithoutmask64(in, inpos, out, outpos); + } else if (bit > 0 && bit < 64) { + slowpackwithoutmask(in, inpos, out, outpos, bit); + } else { throw new IllegalArgumentException("Unsupported bit width: " + bit); - } + } } protected static void fastpackwithoutmask0(final long[] in, int inpos, @@ -75,8 +75,8 @@ protected static void slowpackwithoutmask(final long[] in, int inpos, shift -= 64; if (shift > 0) { - // There is some leftovers from previous input in the next bucket - out[outpos + bucket] |= in[inpos + i - 1] >> (bit - shift); + // There is some leftovers from previous input in the next bucket + out[outpos + bucket] |= in[inpos + i - 1] >> (bit - shift); } } out[outpos + bucket] |= in[inpos + i] << shift; @@ -102,15 +102,15 @@ protected static void slowpackwithoutmask(final long[] in, int inpos, */ public static void fastunpack(final long[] in, final int inpos, final long[] out, final int outpos, final int bit) { - if (bit == 0) { - fastunpack0(in, inpos, out, outpos); - } else if (bit == 64) { - fastunpack64(in, inpos, out, outpos); - } else if (bit > 0 && bit < 64) { + if (bit == 0) { + fastunpack0(in, inpos, out, outpos); + } else if (bit == 64) { + fastunpack64(in, inpos, out, outpos); + } else if (bit > 0 && bit < 64) { slowunpack(in, inpos, out, outpos, bit); - } else { + } else { throw new IllegalArgumentException("Unsupported bit width: " + bit); - } + } } @@ -134,7 +134,7 @@ protected static void slowunpack(final long[] in, int inpos, shift -= 64; if (shift > 0) { - // There is some leftovers from previous input in the next bucket + // There is some leftovers from previous input in the next bucket out[outpos + i - 1] |= (in[inpos + bucket] << (bit - shift) & ((1L << bit) - 1)); } } diff --git a/src/main/java/me/lemire/longcompression/LongUtil.java b/src/main/java/me/lemire/longcompression/LongUtil.java index 596a134..7bdce83 100644 --- a/src/main/java/me/lemire/longcompression/LongUtil.java +++ b/src/main/java/me/lemire/longcompression/LongUtil.java @@ -15,8 +15,8 @@ */ @Deprecated public class LongUtil { - - /** + + /** * Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range * of value * @@ -46,7 +46,7 @@ public static int bits(long i) { return 64 - Long.numberOfLeadingZeros(i); } - protected static String longToBinaryWithLeading(long l) { - return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0'); - } + protected static String longToBinaryWithLeading(long l) { + return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0'); + } } diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java index d31967a..1be4494 100644 --- a/src/main/java/me/lemire/longcompression/LongVariableByte.java +++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java @@ -237,7 +237,7 @@ public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, @Override public void uncompress(byte[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos) { + long[] out, IntWrapper outpos) { int p = inpos.get(); int finalp = inpos.get() + inlength; int tmpoutpos = outpos.get(); From 65159cd2f18f2e9ed19a727ceb016397c7f99d59 Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Date: Mon, 28 Nov 2022 23:13:15 +0400 Subject: [PATCH 08/78] Fix LGTM --- .../longcompression/LongBinaryPacking.java | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java index 0d33ec6..33bb8f1 100644 --- a/src/main/java/me/lemire/longcompression/LongBinaryPacking.java +++ b/src/main/java/me/lemire/longcompression/LongBinaryPacking.java @@ -45,16 +45,16 @@ public void headlessCompress(long[] in, IntWrapper inpos, int inlength, // Compress by block of 8 * 64 longs as much as possible for (; s + BLOCK_SIZE * 8 - 1 < inpos.get() + inlength; s += BLOCK_SIZE * 8) { // maxbits can be anything between 0 and 64 included: expressed within a byte (1 << 6) - final long mbits1 = LongUtil.maxbits(in, s + 0 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits2 = LongUtil.maxbits(in, s + 1 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits3 = LongUtil.maxbits(in, s + 2 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits4 = LongUtil.maxbits(in, s + 3 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits5 = LongUtil.maxbits(in, s + 4 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits6 = LongUtil.maxbits(in, s + 5 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits7 = LongUtil.maxbits(in, s + 6 * BLOCK_SIZE, BLOCK_SIZE); - final long mbits8 = LongUtil.maxbits(in, s + 7 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits1 = LongUtil.maxbits(in, s + 0 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits2 = LongUtil.maxbits(in, s + 1 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits3 = LongUtil.maxbits(in, s + 2 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits4 = LongUtil.maxbits(in, s + 3 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits5 = LongUtil.maxbits(in, s + 4 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits6 = LongUtil.maxbits(in, s + 5 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits7 = LongUtil.maxbits(in, s + 6 * BLOCK_SIZE, BLOCK_SIZE); + final int mbits8 = LongUtil.maxbits(in, s + 7 * BLOCK_SIZE, BLOCK_SIZE); // The first long expressed the maxbits for the 8 buckets - out[tmpoutpos++] = (mbits1 << 56) | (mbits2 << 48) | (mbits3 << 40) | (mbits4 << 32) | (mbits5 << 24) | (mbits6 << 16) | (mbits7 << 8) | (mbits8); + out[tmpoutpos++] = ((long) mbits1 << 56) | ((long) mbits2 << 48) | ((long) mbits3 << 40) | ((long) mbits4 << 32) | (mbits5 << 24) | (mbits6 << 16) | (mbits7 << 8) | (mbits8); LongBitPacking.fastpackwithoutmask(in, s + 0 * BLOCK_SIZE, out, tmpoutpos, (int) mbits1); tmpoutpos += mbits1; LongBitPacking.fastpackwithoutmask(in, s + 1 * BLOCK_SIZE, out, tmpoutpos, (int) mbits2); @@ -100,30 +100,30 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, int tmpinpos = inpos.get(); int s = outpos.get(); for (; s + BLOCK_SIZE * 8 - 1 < outpos.get() + outlength; s += BLOCK_SIZE * 8) { - final long mbits1 = (in[tmpinpos] >>> 56); - final long mbits2 = (in[tmpinpos] >>> 48) & 0xFF; - final long mbits3 = (in[tmpinpos] >>> 40) & 0xFF; - final long mbits4 = (in[tmpinpos] >>> 32) & 0xFF; - final long mbits5 = (in[tmpinpos] >>> 24) & 0xFF; - final long mbits6 = (in[tmpinpos] >>> 16) & 0xFF; - final long mbits7 = (in[tmpinpos] >>> 8) & 0xFF; - final long mbits8 = (in[tmpinpos]) & 0xFF; + final int mbits1 = (int) ((in[tmpinpos] >>> 56)); + final int mbits2 = (int) ((in[tmpinpos] >>> 48) & 0xFF); + final int mbits3 = (int) ((in[tmpinpos] >>> 40) & 0xFF); + final int mbits4 = (int) ((in[tmpinpos] >>> 32) & 0xFF); + final int mbits5 = (int) ((in[tmpinpos] >>> 24) & 0xFF); + final int mbits6 = (int) ((in[tmpinpos] >>> 16) & 0xFF); + final int mbits7 = (int) ((in[tmpinpos] >>> 8) & 0xFF); + final int mbits8 = (int) ((in[tmpinpos]) & 0xFF); ++tmpinpos; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 0 * BLOCK_SIZE, (int) mbits1); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 0 * BLOCK_SIZE, mbits1); tmpinpos += mbits1; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 1 * BLOCK_SIZE, (int) mbits2); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 1 * BLOCK_SIZE, mbits2); tmpinpos += mbits2; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 2 * BLOCK_SIZE, (int) mbits3); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 2 * BLOCK_SIZE, mbits3); tmpinpos += mbits3; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 3 * BLOCK_SIZE, (int) mbits4); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 3 * BLOCK_SIZE, mbits4); tmpinpos += mbits4; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 4 * BLOCK_SIZE, (int) mbits5); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 4 * BLOCK_SIZE, mbits5); tmpinpos += mbits5; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 5 * BLOCK_SIZE, (int) mbits6); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 5 * BLOCK_SIZE, mbits6); tmpinpos += mbits6; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 6 * BLOCK_SIZE, (int) mbits7); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 6 * BLOCK_SIZE, mbits7); tmpinpos += mbits7; - LongBitPacking.fastunpack(in, tmpinpos, out, s + 7 * BLOCK_SIZE, (int) mbits8); + LongBitPacking.fastunpack(in, tmpinpos, out, s + 7 * BLOCK_SIZE, mbits8); tmpinpos += mbits8; } for (; s < outpos.get() + outlength; s += BLOCK_SIZE ) { From 6b5df2066d8d333bf60b1a69a5573373c5b84107 Mon Sep 17 00:00:00 2001 From: LGTM Migrator Date: Wed, 30 Nov 2022 10:31:07 +0000 Subject: [PATCH 09/78] Add CodeQL workflow for GitHub code scanning --- .github/workflows/codeql.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..ab99519 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,41 @@ +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: "49 16 * * 6" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ java ] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{ matrix.language }}" From 56f86a6c3a903735aaa410a5a9d826b3df4964d3 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sat, 11 Mar 2023 13:14:20 -0500 Subject: [PATCH 10/78] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f629b5e..89afe78 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ He also posted his slides online: http://www.slideshare.net/ikhtearSharif/ikhtea Other recommended libraries ----------------------------- +* Fast integer compression in Go: https://github.com/ronanh/intcomp * Encoding: Integer Compression Libraries for Go https://github.com/zhenjl/encoding * CSharpFastPFOR: A C# integer compression library https://github.com/Genbox/CSharpFastPFOR * TurboPFor is a C library that offers lots of interesting optimizations and Java wrappers. Well worth checking! (Uses a GPL license.) https://github.com/powturbo/TurboPFor From 0ecdda9e431da96d044b5773ec13eee9f4e9d2ed Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Thu, 13 Jul 2023 14:32:23 -0400 Subject: [PATCH 11/78] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 89afe78..84f07cb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ JavaFastPFOR: A simple integer compression library in Java ========================================================== [![][maven img]][maven] [![][license img]][license] [![docs-badge][]][docs] -[![Code Quality: Cpp](https://img.shields.io/lgtm/grade/java/g/lemire/JavaFastPFOR.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/lemire/JavaFastPFOR/context:java) [![Java CI](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml/badge.svg)](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml) From 6e4daafa827e4e8048753b2b63da7b28c66b9153 Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Date: Wed, 28 Feb 2024 20:21:57 +0400 Subject: [PATCH 12/78] Polish --- .../integercompression/SkippableIntegerCODEC.java | 11 +++++++---- .../me/lemire/integercompression/VariableByte.java | 4 ++-- .../me/lemire/longcompression/LongCompressor.java | 5 ++--- .../me/lemire/longcompression/LongVariableByte.java | 6 ++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java index 0b6e825..31771d6 100644 --- a/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java +++ b/src/main/java/me/lemire/integercompression/SkippableIntegerCODEC.java @@ -10,10 +10,10 @@ /** * Interface describing a standard CODEC to compress integers. This is a - * variation on the IntegerCODEC interface meant to be used for head access. + * variation on the IntegerCODEC interface meant to be used for partial reads. * - * The main difference is that we must specify the number of integers we wish to - * decode. This information should be stored elsewhere. + * The main difference is that you must specify the number of integers you wish to + * uncompress. This information should be stored elsewhere. * * This interface was designed by the Terrier team for their search engine. * @@ -29,6 +29,9 @@ public interface SkippableIntegerCODEC { * inpos will be incremented by 12 while outpos will be incremented by 3. We * use IntWrapper to pass the values by reference. * + * Implementation note: contrary to {@link IntegerCODEC#compress}, + * this may skip writing information about the number of encoded integers. + * * @param in * input array * @param inpos @@ -60,7 +63,7 @@ public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out * @param outpos * where to start writing the uncompressed output in out * @param num - * number of integers we want to decode, the actual number of integers decoded can be less + * number of integers we want to decode. May be less than the actual number of compressed integers */ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos, int num); diff --git a/src/main/java/me/lemire/integercompression/VariableByte.java b/src/main/java/me/lemire/integercompression/VariableByte.java index 1e28537..92cfaeb 100644 --- a/src/main/java/me/lemire/integercompression/VariableByte.java +++ b/src/main/java/me/lemire/integercompression/VariableByte.java @@ -126,7 +126,7 @@ public void uncompress(int[] in, IntWrapper inpos, int inlength, int[] out, s += 8; // Shift to next integer if s==32 p += s>>5; - // cycle from 32 to 0 + // cycle from 31 to 0 s = s & 31; v += ((c & 127) << shift); if ((c & 128) == 128) { @@ -194,7 +194,7 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o s += 8; // Shift to next integer if s==32 p += s>>5; - // cycle from 32 to 0 + // cycle from 31 to 0 s = s & 31; v += ((c & 127) << shift); if ((c & 128) == 128) { diff --git a/src/main/java/me/lemire/longcompression/LongCompressor.java b/src/main/java/me/lemire/longcompression/LongCompressor.java index a140911..a2c79fd 100644 --- a/src/main/java/me/lemire/longcompression/LongCompressor.java +++ b/src/main/java/me/lemire/longcompression/LongCompressor.java @@ -13,8 +13,8 @@ */ public class LongCompressor { - SkippableLongCODEC codec; + /** * Constructor wrapping a codec. * @@ -48,8 +48,7 @@ public long[] compress(long[] input) { codec.headlessCompress(input, new IntWrapper(0), input.length, compressed, outpos); } catch (IndexOutOfBoundsException ioebe) { - throw new - UncompressibleInputException("Your input is too poorly compressible " + throw new UncompressibleInputException("Your input is too poorly compressible " + "with the current codec : "+codec); } compressed = Arrays.copyOf(compressed,outpos.intValue()); diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java index 1be4494..e1f56df 100644 --- a/src/main/java/me/lemire/longcompression/LongVariableByte.java +++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java @@ -187,7 +187,6 @@ public void compress(long[] in, IntWrapper inpos, int inlength, byte[] out, out[outpostmp++] = (byte) extract7bits(7, val); out[outpostmp++] = (byte) (extract7bitsmaskless(8, (val)) | (1 << 7)); } else { - // System.out.println(LongUtil.longToBinaryWithLeading(val)); out[outpostmp++] = (byte) extract7bits(0, val); out[outpostmp++] = (byte) extract7bits(1, val); out[outpostmp++] = (byte) extract7bits(2, val); @@ -220,7 +219,7 @@ public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, s += 8; // Shift to next long if s==64 p += s>>6; - // Cycle from 64 to 0 + // Cycle from 63 to 0 s = s & 63; v += ((c & 127) << shift); if ((c & 128) == 128) { @@ -309,13 +308,12 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[] int finaloutpos = num + tmpoutpos; for (long v = 0, shift = 0; tmpoutpos < finaloutpos;) { val = in[p]; - // System.out.println(longToBinaryWithLeading(val)); long c = val >>> s; // Shift to next byte s += 8; // Shift to next long if s == 64 p += s>>6; - // Cycle from 64 to 0 + // Cycle from 63 to 0 s = s & 63; v += ((c & 127) << shift); if ((c & 128) == 128) { From 867e9579e5801f4f7a1ace21ceb032e2f96b5328 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 14:59:56 -0500 Subject: [PATCH 13/78] updating --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a960b2c..ba1fca5 100644 --- a/pom.xml +++ b/pom.xml @@ -69,10 +69,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.12.1 - 11 - 11 + 17 + 17 From 43cb373522e98137688b4746120dd427e8b073c1 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:03:45 -0500 Subject: [PATCH 14/78] adding long compression --- src/main/java/module-info.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index d2a749c..d254c12 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -5,5 +5,6 @@ // This is currently only for advanced users: // requires jdk.incubator.vector; exports me.lemire.integercompression; - exports me.lemire.integercompression.vector; + exports me.lemire.longcompression; + // exports me.lemire.integercompression.vector; } From f3e7857a144981ad5e82e742441915900b9b5386 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:04:26 -0500 Subject: [PATCH 15/78] [maven-release-plugin] prepare release JavaFastPFOR-0.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ba1fca5..3db7c2f 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.1.13-SNAPSHOT + 0.2.0 jar 1.7 From 2f32b0c628373a078cb3e22fa81941522dcb923c Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:04:28 -0500 Subject: [PATCH 16/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3db7c2f..a3c47da 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.2.0 + 0.2.1-SNAPSHOT jar 1.7 From 78afe707559f603ea63f582dd19c60f703ea331a Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:07:05 -0500 Subject: [PATCH 17/78] Update basic.yml --- .github/workflows/basic.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index cb3e3e8..4688fa2 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -8,11 +8,11 @@ jobs: strategy: fail-fast: false matrix: - java: [ 11, 16 ] + java: [ 17, 21 ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.1 - name: Set up JDK - uses: actions/setup-java@v2.5.0 + uses: actions/setup-java@v4.1.0 with: java-version: ${{ matrix.java }} distribution: 'adopt' @@ -21,4 +21,4 @@ jobs: - name: Build example run: javac -cp target/classes/:. example.java - name: Run example - run: java -cp target/classes/:. example \ No newline at end of file + run: java -cp target/classes/:. example From 022682f83f4044e4293003178c36e4322c970bd1 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:08:24 -0500 Subject: [PATCH 18/78] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 84f07cb..5d3fc30 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ the following code in your pom.xml file: me.lemire.integercompression JavaFastPFOR - [0.1,) + [0.2,) ``` From c99e15d39d730e2ac45232d0c7608eaa1afba05d Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:10:22 -0500 Subject: [PATCH 19/78] bumping javadoc --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3c47da..5237403 100644 --- a/pom.xml +++ b/pom.xml @@ -138,7 +138,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.4.1 + 3.6.3 me.lemire.integercompression.vector;com.kamikaze.pfordelta:me.lemire.integercompression.benchmarktools From 53a53073425c934a54ec78a3988b57b7ec185132 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:18:30 -0500 Subject: [PATCH 20/78] bump --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5237403..7fbfc6d 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,8 @@ 0.2.1-SNAPSHOT jar - 1.7 - 1.7 + 1.8 + 1.8 UTF-8 From bb8318aaa820e17e6d0c8958a85709ab0cd36c7a Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 28 Feb 2024 15:23:53 -0500 Subject: [PATCH 21/78] Delete .github/workflows/codeql.yml --- .github/workflows/codeql.yml | 41 ------------------------------------ 1 file changed, 41 deletions(-) delete mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index ab99519..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: "49 16 * * 6" - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ java ] - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - queries: +security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{ matrix.language }}" From 7412c29c667234f45accaf87347aef719c9b2c67 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sun, 9 Jun 2024 10:18:34 -0400 Subject: [PATCH 22/78] [maven-release-plugin] prepare release JavaFastPFOR-0.2.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7fbfc6d..7dc9678 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.2.1-SNAPSHOT + 0.2.1 jar 1.8 From d75c85f796d6b955f18c5fb0dbc295ffd28fe353 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sun, 9 Jun 2024 10:18:37 -0400 Subject: [PATCH 23/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7dc9678..2587c46 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.2.1 + 0.2.2-SNAPSHOT jar 1.8 From 82a4d19820d000e62952ae84b37268497ec16deb Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 19 Jun 2024 10:43:44 -0400 Subject: [PATCH 24/78] minor fixes --- README.md | 6 +- .../benchmarkresults_haswell_18sept2014.txt | 414 +- .../benchmarkresults_icore7_10may2013.txt | 288 +- ...benchmarkresults_icore7_12november2013.txt | 414 +- ...rkresults_skippable_haswell_18sept2014.txt | 318 +- pom.xml | 45 +- .../integercompression/GroupSimple9.java | 7072 ++++++++--------- .../me/lemire/integercompression/S16.java | 372 +- .../java/me/lemire/integercompression/S9.java | 348 +- .../lemire/integercompression/Simple16.java | 336 +- .../me/lemire/integercompression/Simple9.java | 530 +- .../SkippableComposition.java | 2 +- .../UncompressibleInputException.java | 16 +- .../me/lemire/integercompression/Util.java | 14 +- .../benchmarktools/Benchmark.java | 6 +- .../benchmarktools/BenchmarkSkippable.java | 6 +- .../differential/IntegratedIntCompressor.java | 12 +- .../SkippableIntegratedComposition.java | 2 +- .../lemire/longcompression/ByteLongCODEC.java | 2 +- .../longcompression/LongAs2IntsCodec.java | 338 +- .../me/lemire/longcompression/LongCODEC.java | 4 +- .../longcompression/LongComposition.java | 4 +- .../lemire/longcompression/LongJustCopy.java | 8 +- .../me/lemire/longcompression/LongUtil.java | 6 +- .../longcompression/LongVariableByte.java | 2 +- .../SkippableLongComposition.java | 2 +- .../differential/LongDelta.java | 6 +- .../lemire/integercompression/AdhocTest.java | 125 +- .../lemire/integercompression/BasicTest.java | 52 +- .../integercompression/ByteBasicTest.java | 44 +- .../integercompression/ExampleTest.java | 602 +- .../integercompression/ResourcedTest.java | 112 +- .../SkippableBasicTest.java | 2 +- .../lemire/longcompression/LongBasicTest.java | 124 +- .../lemire/longcompression/LongTestUtils.java | 6 +- .../SkippableLongBasicTest.java | 18 +- .../longcompression/TestLongAs2IntsCodec.java | 168 +- .../longcompression/TestLongVariableByte.java | 162 +- .../synth/LongClusteredDataGenerator.java | 6 +- .../synth/LongUniformDataGenerator.java | 22 +- 40 files changed, 6041 insertions(+), 5975 deletions(-) diff --git a/README.md b/README.md index f629b5e..535e452 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,9 @@ the following code in your pom.xml file: ```xml - me.lemire.integercompression - JavaFastPFOR - [0.1,) + me.lemire.integercompression + JavaFastPFOR + [0.1,) ``` diff --git a/benchmarkresults/benchmarkresults_haswell_18sept2014.txt b/benchmarkresults/benchmarkresults_haswell_18sept2014.txt index 43fa98b..a501d5d 100644 --- a/benchmarkresults/benchmarkresults_haswell_18sept2014.txt +++ b/benchmarkresults/benchmarkresults_haswell_18sept2014.txt @@ -1,7 +1,7 @@ # benchmark based on the ClusterData model from: -# Vo Ngoc Anh and Alistair Moffat. -# Index compression using 64-bit words. -# Softw. Pract. Exper.40, 2 (February 2010), 131-147. +# Vo Ngoc Anh and Alistair Moffat. +# Index compression using 64-bit words. +# Softw. Pract. Exper.40, 2 (February 2010), 131-147. # Results will be written into a CSV file: benchmark-20140918T011257.csv @@ -10,852 +10,852 @@ # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.56 246 1061 + 2.56 246 1061 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 3.21 66 275 + 3.21 66 275 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.96 838 1679 + 2.96 838 1679 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1276 1805 + 32.00 1276 1805 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 490 509 + 8.00 490 509 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 582 774 + 8.00 582 774 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.96 765 1193 + 2.96 765 1193 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.88 139 896 + 2.88 139 896 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.90 166 905 + 2.90 166 905 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.88 139 898 + 2.88 139 898 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.87 25 938 + 2.87 25 938 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.90 29 960 + 2.90 29 960 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.87 25 882 + 2.87 25 882 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.63 274 1015 + 2.63 274 1015 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 2.83 280 771 + 2.83 280 771 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.84 444 837 + 2.84 444 837 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.27 498 652 + 3.27 498 652 # sparsity 2 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.51 244 1048 + 3.51 244 1048 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 4.18 55 247 + 4.18 55 247 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.93 862 1611 + 3.93 862 1611 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1286 1816 + 32.00 1286 1816 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.01 486 508 + 8.01 486 508 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.01 575 763 + 8.01 575 763 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.93 774 1159 + 3.93 774 1159 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.83 118 865 + 3.83 118 865 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.86 141 875 + 3.86 141 875 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.83 118 867 + 3.83 118 867 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.82 18 881 + 3.82 18 881 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.85 22 887 + 3.85 22 887 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.82 18 838 + 3.82 18 838 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.58 273 990 + 3.58 273 990 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 3.82 201 656 + 3.82 201 656 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.90 442 819 + 3.90 442 819 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.50 494 640 + 4.50 494 640 # sparsity 3 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.28 244 1030 + 4.28 244 1030 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 4.95 51 247 + 4.95 51 247 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.71 850 1577 + 4.71 850 1577 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1252 1769 + 32.00 1252 1769 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 478 504 + 8.02 478 504 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 573 762 + 8.02 573 762 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.71 770 1139 + 4.71 770 1139 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.60 107 850 + 4.60 107 850 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.63 127 863 + 4.63 127 863 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.60 107 853 + 4.60 107 853 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.59 14 865 + 4.59 14 865 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.62 18 882 + 4.62 18 882 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.59 14 844 + 4.59 14 844 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.34 268 969 + 4.34 268 969 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 4.72 170 610 + 4.72 170 610 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.68 434 783 + 4.68 434 783 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.33 472 624 + 5.33 472 624 # sparsity 4 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.03 239 1004 + 5.03 239 1004 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 5.73 47 251 + 5.73 47 251 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.48 846 1556 + 5.48 846 1556 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1274 1799 + 32.00 1274 1799 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.12 439 486 + 8.12 439 486 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.12 537 715 + 8.12 537 715 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.48 769 1134 + 5.48 769 1134 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.36 95 817 + 5.36 95 817 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.39 115 838 + 5.39 115 838 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.36 96 827 + 5.36 96 827 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.34 12 842 + 5.34 12 842 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.37 16 871 + 5.37 16 871 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.34 12 803 + 5.34 12 803 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.09 268 963 + 5.09 268 963 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 5.57 150 587 + 5.57 150 587 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.47 432 800 + 5.47 432 800 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.16 491 635 + 6.16 491 635 # sparsity 5 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.00 236 999 + 6.00 236 999 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 6.70 43 242 + 6.70 43 242 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.45 863 1584 + 6.45 863 1584 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1236 1792 + 32.00 1236 1792 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.40 369 452 + 8.40 369 452 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.40 486 617 + 8.40 486 617 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.45 777 1132 + 6.45 777 1132 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.33 86 808 + 6.33 86 808 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.36 103 828 + 6.36 103 828 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.33 86 813 + 6.33 86 813 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.31 9 825 + 6.31 9 825 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.34 13 858 + 6.34 13 858 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.31 9 819 + 6.31 9 819 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.06 265 945 + 6.06 265 945 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 6.65 139 546 + 6.65 139 546 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.45 442 804 + 6.45 442 804 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.18 493 635 + 7.18 493 635 # sparsity 6 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.76 238 998 + 6.76 238 998 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 7.45 42 251 + 7.45 42 251 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.20 854 1525 + 7.20 854 1525 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1177 1663 + 32.00 1177 1663 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.10 259 362 + 9.10 259 362 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.10 380 450 + 9.10 380 450 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.20 718 1098 + 7.20 718 1098 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.08 79 786 + 7.08 79 786 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.11 95 821 + 7.11 95 821 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.08 81 814 + 7.08 81 814 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.06 8 836 + 7.06 8 836 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.09 11 860 + 7.09 11 860 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.06 8 822 + 7.06 8 822 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.81 268 962 + 6.81 268 962 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 7.56 129 509 + 7.56 129 509 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.19 433 789 + 7.19 433 789 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.93 491 632 + 7.93 491 632 # sparsity 7 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.05 236 985 + 8.05 236 985 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 8.75 39 247 + 8.75 39 247 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.50 861 1526 + 8.50 861 1526 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1279 1788 + 32.00 1279 1788 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.11 190 305 + 10.11 190 305 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.11 311 355 + 10.11 311 355 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.50 753 1092 + 8.50 753 1092 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.37 71 792 + 8.37 71 792 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.40 83 804 + 8.40 83 804 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.37 72 805 + 8.37 72 805 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.35 7 808 + 8.35 7 808 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.38 10 835 + 8.38 10 835 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.35 7 796 + 8.35 7 796 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.10 259 920 + 8.10 259 920 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 9.16 111 447 + 9.16 111 447 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.52 435 784 + 8.52 435 784 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.32 485 622 + 9.32 485 622 # sparsity 8 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.73 234 972 + 8.73 234 972 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 9.44 37 250 + 9.44 37 250 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.19 848 1493 + 9.19 848 1493 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1279 1858 + 32.00 1279 1858 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.04 167 307 + 11.04 167 307 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.04 309 353 + 11.04 309 353 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.19 751 1095 + 9.19 751 1095 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.06 67 770 + 9.06 67 770 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.09 78 781 + 9.09 78 781 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.06 68 792 + 9.06 68 792 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.03 6 795 + 9.03 6 795 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.07 9 824 + 9.07 9 824 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.03 6 787 + 9.03 6 787 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.78 266 936 + 8.78 266 936 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 10.34 101 427 + 10.34 101 427 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.21 437 794 + 9.21 437 794 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.01 488 626 + 10.01 488 626 # sparsity 9 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.75 234 980 + 9.75 234 980 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 10.48 36 242 + 10.48 36 242 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.21 844 1474 + 10.21 844 1474 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1262 1795 + 32.00 1262 1795 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.18 145 300 + 12.18 145 300 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.18 302 340 + 12.18 302 340 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.21 761 1096 + 10.21 761 1096 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.08 63 786 + 10.08 63 786 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.12 72 752 + 10.12 72 752 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.08 63 783 + 10.08 63 783 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.05 6 787 + 10.05 6 787 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.09 8 798 + 10.09 8 798 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.05 6 779 + 10.05 6 779 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.80 264 930 + 9.80 264 930 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 11.77 92 410 + 11.77 92 410 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.23 438 789 + 10.23 438 789 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.05 486 624 + 11.05 486 624 # sparsity 10 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.73 235 979 + 10.73 235 979 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 11.46 35 239 + 11.46 35 239 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.18 840 1456 + 11.18 840 1456 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1248 1746 + 32.00 1248 1746 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.14 135 312 + 13.14 135 312 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.14 309 354 + 13.14 309 354 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.18 761 1097 + 11.18 761 1097 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.09 59 802 + 11.09 59 802 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.13 69 814 + 11.13 69 814 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.09 59 771 + 11.09 59 771 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.04 5 783 + 11.04 5 783 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.08 8 816 + 11.08 8 816 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.04 5 776 + 11.04 5 776 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.78 265 934 + 10.78 265 934 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 12.98 89 415 + 12.98 89 415 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.20 436 787 + 11.20 436 787 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.02 483 620 + 12.02 483 620 # sparsity 11 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.79 232 950 + 11.79 232 950 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 12.68 34 256 + 12.68 34 256 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.23 842 1450 + 12.23 842 1450 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1292 1826 + 32.00 1292 1826 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.00 127 324 + 14.00 127 324 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.00 308 369 + 14.00 308 369 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.23 760 1092 + 12.23 760 1092 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.35 56 795 + 12.35 56 795 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.38 65 829 + 12.38 65 829 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.35 57 822 + 12.35 57 822 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.13 5 706 + 12.13 5 706 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.17 7 750 + 12.17 7 750 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.13 5 712 + 12.13 5 712 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.83 261 919 + 11.83 261 919 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 14.17 85 401 + 14.17 85 401 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.25 436 781 + 12.25 436 781 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.08 489 623 + 13.08 489 623 # sparsity 12 # generating random data... # generating random data... ok. # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.70 226 932 + 12.70 226 932 # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 13.76 34 261 + 13.76 34 261 # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.16 849 1453 + 13.16 849 1453 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1208 1804 + 32.00 1208 1804 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.84 117 307 + 14.84 117 307 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.84 260 352 + 14.84 260 352 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.16 762 1095 + 13.16 762 1095 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.46 56 899 + 13.46 56 899 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.48 63 915 + 13.48 63 915 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.46 56 897 + 13.46 56 897 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.20 5 681 + 13.20 5 681 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.24 7 735 + 13.24 7 735 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.20 5 699 + 13.20 5 699 # IntegratedFastPFOR + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.75 260 914 + 12.75 260 914 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 15.51 80 359 + 15.51 80 359 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.18 435 781 + 13.18 435 781 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.00 489 626 + 14.00 489 626 Results were written into a CSV file: benchmark-20140918T011257.csv diff --git a/benchmarkresults/benchmarkresults_icore7_10may2013.txt b/benchmarkresults/benchmarkresults_icore7_10may2013.txt index 5b776fb..d10579e 100644 --- a/benchmarkresults/benchmarkresults_icore7_10may2013.txt +++ b/benchmarkresults/benchmarkresults_icore7_10may2013.txt @@ -3,610 +3,610 @@ # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 3.34 51 262 + 3.34 51 262 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.09 639 1183 + 3.09 639 1183 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1151 1468 + 32.00 1151 1468 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 199 299 + 8.00 199 299 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 148 339 + 8.00 148 339 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.09 613 920 + 3.09 613 920 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.02 143 721 + 3.02 143 721 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.05 164 705 + 3.05 164 705 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.01 26 790 + 3.01 26 790 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.03 30 816 + 3.03 30 816 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.78 226 811 + 2.78 226 811 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 2.97 236 604 + 2.97 236 604 # sparsity 2 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 4.17 47 266 + 4.17 47 266 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.92 672 1261 + 3.92 672 1261 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1218 1562 + 32.00 1218 1562 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 204 290 + 8.00 204 290 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 236 343 + 8.00 236 343 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.92 505 917 + 3.92 505 917 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.82 127 698 + 3.82 127 698 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.85 151 726 + 3.85 151 726 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.81 18 752 + 3.81 18 752 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.84 23 779 + 3.84 23 779 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.56 228 828 + 3.56 228 828 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 3.82 182 562 + 3.82 182 562 # sparsity 3 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 4.96 43 276 + 4.96 43 276 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.72 662 1187 + 4.72 662 1187 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1215 1566 + 32.00 1215 1566 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 198 286 + 8.02 198 286 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 254 340 + 8.02 254 340 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.72 576 848 + 4.72 576 848 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.61 111 654 + 4.61 111 654 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.64 129 699 + 4.64 129 699 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.60 14 732 + 4.60 14 732 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.63 18 761 + 4.63 18 761 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.36 226 813 + 4.36 226 813 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 4.76 148 511 + 4.76 148 511 # sparsity 4 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 5.97 39 270 + 5.97 39 270 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.72 656 1148 + 5.72 656 1148 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1212 1555 + 32.00 1212 1555 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.09 206 287 + 8.09 206 287 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.09 213 334 + 8.09 213 334 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.72 626 891 + 5.72 626 891 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.60 105 672 + 5.60 105 672 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.63 121 701 + 5.63 121 701 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.58 10 667 + 5.58 10 667 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.62 14 736 + 5.62 14 736 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.33 226 805 + 5.33 226 805 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 5.86 123 464 + 5.86 123 464 # sparsity 5 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 6.49 39 262 + 6.49 39 262 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.25 659 1121 + 6.25 659 1121 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1154 1168 + 32.00 1154 1168 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.44 192 265 + 8.44 192 265 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.44 240 297 + 8.44 240 297 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.25 631 907 + 6.25 631 907 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.13 101 685 + 6.13 101 685 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.16 116 714 + 6.16 116 714 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.11 9 708 + 6.11 9 708 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.14 13 741 + 6.14 13 741 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.86 225 806 + 5.86 225 806 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 6.44 120 442 + 6.44 120 442 # sparsity 6 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 7.64 35 269 + 7.64 35 269 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.39 654 1111 + 7.39 654 1111 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1207 1553 + 32.00 1207 1553 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.06 185 225 + 9.06 185 225 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.06 166 248 + 9.06 166 248 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.39 620 888 + 7.39 620 888 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.26 91 679 + 7.26 91 679 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.30 104 704 + 7.30 104 704 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.24 7 704 + 7.24 7 704 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.28 10 735 + 7.28 10 735 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.00 221 792 + 7.00 221 792 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 7.76 106 393 + 7.76 106 393 # sparsity 7 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 8.66 33 266 + 8.66 33 266 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.41 675 1165 + 8.41 675 1165 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1210 1553 + 32.00 1210 1553 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.10 154 194 + 10.10 154 194 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.10 176 207 + 10.10 176 207 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.41 628 896 + 8.41 628 896 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.27 84 643 + 8.27 84 643 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.31 95 685 + 8.31 95 685 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.25 6 693 + 8.25 6 693 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.29 9 723 + 8.29 9 723 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 215 773 + 8.00 215 773 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 9.10 94 357 + 9.10 94 357 # sparsity 8 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 9.52 32 241 + 9.52 32 241 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.26 692 1194 + 9.26 692 1194 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1208 1525 + 32.00 1208 1525 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.14 138 178 + 11.14 138 178 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.14 187 190 + 11.14 187 190 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.26 647 893 + 9.26 647 893 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.14 79 655 + 9.14 79 655 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.18 88 684 + 9.18 88 684 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.11 6 680 + 9.11 6 680 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.15 8 712 + 9.15 8 712 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.86 220 778 + 8.86 220 778 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 10.39 86 330 + 10.39 86 330 # sparsity 9 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 10.46 31 253 + 10.46 31 253 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.19 661 1122 + 10.19 661 1122 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1210 1546 + 32.00 1210 1546 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.27 126 173 + 12.27 126 173 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.27 155 181 + 12.27 155 181 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.19 617 886 + 10.19 617 886 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.07 73 634 + 10.07 73 634 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.11 82 669 + 10.11 82 669 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.04 5 663 + 10.04 5 663 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.08 7 700 + 10.08 7 700 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.79 215 757 + 9.79 215 757 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 11.79 78 325 + 11.79 78 325 # sparsity 10 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 11.13 30 243 + 11.13 30 243 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.83 628 1028 + 10.83 628 1028 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1167 1498 + 32.00 1167 1498 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.71 152 179 + 12.71 152 179 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.71 151 187 + 12.71 151 187 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.83 389 820 + 10.83 389 820 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.76 72 638 + 10.76 72 638 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.79 79 683 + 10.79 79 683 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.69 5 655 + 10.69 5 655 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.73 7 682 + 10.73 7 682 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.42 219 767 + 10.42 219 767 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 12.49 77 332 + 12.49 77 332 # sparsity 11 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 12.38 29 254 + 12.38 29 254 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.01 660 1112 + 12.01 660 1112 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1142 1445 + 32.00 1142 1445 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.87 143 172 + 13.87 143 172 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.87 144 178 + 13.87 144 178 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.01 582 830 + 12.01 582 830 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.04 64 647 + 12.04 64 647 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.08 69 649 + 12.08 69 649 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.91 4 637 + 11.91 4 637 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.95 7 660 + 11.95 7 660 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.61 217 766 + 11.61 217 766 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 13.96 73 313 + 13.96 73 313 # sparsity 12 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 13.57 29 265 + 13.57 29 265 # me.lemire.integercompression.IntegratedBinaryPacking+me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.01 611 1012 + 13.01 611 1012 # me.lemire.integercompression.JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1215 1565 + 32.00 1215 1565 # me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.73 121 160 + 14.73 121 160 # me.lemire.integercompression.IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.73 131 166 + 14.73 131 166 # me.lemire.integercompression.BinaryPacking+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.01 603 832 + 13.01 603 832 # me.lemire.integercompression.NewPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.26 68 737 + 13.26 68 737 # me.lemire.integercompression.NewPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.29 72 761 + 13.29 72 761 # me.lemire.integercompression.OptPFD+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.06 4 591 + 13.06 4 591 # me.lemire.integercompression.OptPFDS9+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.10 6 625 + 13.10 6 625 # me.lemire.integercompression.FastPFOR+me.lemire.integercompression.VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.61 213 755 + 12.61 213 755 # me.lemire.integercompression.Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 15.38 69 281 + 15.38 69 281 diff --git a/benchmarkresults/benchmarkresults_icore7_12november2013.txt b/benchmarkresults/benchmarkresults_icore7_12november2013.txt index 07b11b3..795650e 100644 --- a/benchmarkresults/benchmarkresults_icore7_12november2013.txt +++ b/benchmarkresults/benchmarkresults_icore7_12november2013.txt @@ -10,9 +10,9 @@ Its dependencies (if any) will NOT be available to the current build. [INFO] [enforcer:enforce {execution: enforce-maven}] [INFO] [exec:java {execution: default-cli}] # benchmark based on the ClusterData model from: -# Vo Ngoc Anh and Alistair Moffat. -# Index compression using 64-bit words. -# Softw. Pract. Exper.40, 2 (February 2010), 131-147. +# Vo Ngoc Anh and Alistair Moffat. +# Index compression using 64-bit words. +# Softw. Pract. Exper.40, 2 (February 2010), 131-147. # Results will be written into a CSV file: benchmark-20131112T105209.csv @@ -21,852 +21,852 @@ Its dependencies (if any) will NOT be available to the current build. # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 3.28 48 218 + 3.28 48 218 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 3.03 623 1205 + 3.03 623 1205 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1154 1331 + 32.00 1154 1331 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 508 554 + 8.00 508 554 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 592 709 + 8.00 592 709 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.03 596 900 + 3.03 596 900 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.95 115 701 + 2.95 115 701 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.98 135 726 + 2.98 135 726 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.95 116 726 + 2.95 116 726 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.94 19 761 + 2.94 19 761 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.97 22 767 + 2.97 22 767 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.94 19 765 + 2.94 19 765 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 2.71 219 797 + 2.71 219 797 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.71 217 813 + 2.71 217 813 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 2.90 254 599 + 2.90 254 599 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.92 375 669 + 2.92 375 669 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.36 394 503 + 3.36 394 503 # sparsity 2 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 4.09 47 254 + 4.09 47 254 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 3.84 636 1160 + 3.84 636 1160 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1152 1264 + 32.00 1152 1264 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.01 510 551 + 8.01 510 551 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.01 594 704 + 8.01 594 704 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.84 602 875 + 3.84 602 875 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.74 101 673 + 3.74 101 673 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.77 117 695 + 3.77 117 695 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.74 101 694 + 3.74 101 694 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.73 15 725 + 3.73 15 725 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.76 18 741 + 3.76 18 741 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.73 15 731 + 3.73 15 731 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 3.48 215 782 + 3.48 215 782 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.48 212 789 + 3.48 212 789 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 3.72 190 530 + 3.72 190 530 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.76 375 657 + 3.76 375 657 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.32 392 499 + 4.32 392 499 # sparsity 3 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 5.03 42 250 + 5.03 42 250 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 4.77 643 1141 + 4.77 643 1141 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1149 1337 + 32.00 1149 1337 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 506 547 + 8.02 506 547 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 590 698 + 8.02 590 698 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.77 619 904 + 4.77 619 904 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.66 89 640 + 4.66 89 640 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.69 103 672 + 4.69 103 672 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.66 89 668 + 4.66 89 668 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.64 12 700 + 4.64 12 700 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.68 14 712 + 4.68 14 712 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.64 12 704 + 4.64 12 704 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 4.39 212 762 + 4.39 212 762 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.39 209 763 + 4.39 209 763 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 4.81 146 480 + 4.81 146 480 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.75 373 646 + 4.75 373 646 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.40 386 496 + 5.40 386 496 # sparsity 4 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 5.77 39 245 + 5.77 39 245 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 5.53 629 1095 + 5.53 629 1095 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1148 1332 + 32.00 1148 1332 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.11 482 522 + 8.11 482 522 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.11 557 655 + 8.11 557 655 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.53 617 889 + 5.53 617 889 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.42 82 659 + 5.42 82 659 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.45 94 684 + 5.45 94 684 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.42 82 686 + 5.42 82 686 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.40 10 695 + 5.40 10 695 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.43 12 715 + 5.43 12 715 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.40 10 705 + 5.40 10 705 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 5.16 214 776 + 5.16 214 776 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.16 211 780 + 5.16 211 780 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 5.66 128 457 + 5.66 128 457 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.53 370 645 + 5.53 370 645 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.23 389 493 + 6.23 389 493 # sparsity 5 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 6.57 37 248 + 6.57 37 248 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 6.32 640 1113 + 6.32 640 1113 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1150 1349 + 32.00 1150 1349 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.41 416 456 + 8.41 416 456 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.41 473 548 + 8.41 473 548 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.32 622 898 + 6.32 622 898 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.20 75 643 + 6.20 75 643 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.23 86 668 + 6.23 86 668 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.20 75 666 + 6.20 75 666 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.18 8 690 + 6.18 8 690 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.21 11 705 + 6.21 11 705 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.18 8 697 + 6.18 8 697 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 5.93 211 741 + 5.93 211 741 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.93 208 772 + 5.93 208 772 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 6.51 118 426 + 6.51 118 426 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.32 374 639 + 6.32 374 639 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.05 390 492 + 7.05 390 492 # sparsity 6 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 7.73 35 242 + 7.73 35 242 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 7.48 630 1071 + 7.48 630 1071 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1143 1350 + 32.00 1143 1350 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.04 328 365 + 9.04 328 365 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.04 365 415 + 9.04 365 415 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.48 620 882 + 7.48 620 882 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.36 67 641 + 7.36 67 641 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.39 76 668 + 7.39 76 668 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.36 67 667 + 7.36 67 667 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.33 7 679 + 7.33 7 679 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.37 9 695 + 7.37 9 695 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.33 7 686 + 7.33 7 686 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 7.09 211 749 + 7.09 211 749 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.09 208 764 + 7.09 208 764 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 7.88 101 383 + 7.88 101 383 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.49 372 630 + 7.49 372 630 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.27 389 489 + 8.27 389 489 # sparsity 7 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 8.46 33 244 + 8.46 33 244 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 8.21 628 1052 + 8.21 628 1052 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1148 1334 + 32.00 1148 1334 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.01 257 290 + 10.01 257 290 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.01 284 315 + 10.01 284 315 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.21 612 859 + 8.21 612 859 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.08 63 626 + 8.08 63 626 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.11 71 665 + 8.11 71 665 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.08 63 663 + 8.08 63 663 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.06 6 675 + 8.06 6 675 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.09 8 687 + 8.09 8 687 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.06 6 682 + 8.06 6 682 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 7.81 210 756 + 7.81 210 756 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 7.81 207 759 + 7.81 207 759 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 8.85 92 353 + 8.85 92 353 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.22 369 622 + 8.22 369 622 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.00 389 486 + 9.00 389 486 # sparsity 8 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 9.41 32 234 + 9.41 32 234 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 9.16 636 1062 + 9.16 636 1062 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1151 1326 + 32.00 1151 1326 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.08 231 269 + 11.08 231 269 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.08 259 288 + 11.08 259 288 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.16 616 873 + 9.16 616 873 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.04 59 638 + 9.04 59 638 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.07 65 664 + 9.07 65 664 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.04 59 664 + 9.04 59 664 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.01 5 665 + 9.01 5 665 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.05 7 680 + 9.05 7 680 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.01 5 671 + 9.01 5 671 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 8.77 209 746 + 8.77 209 746 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.77 207 738 + 8.77 207 738 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 10.25 81 324 + 10.25 81 324 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.18 372 625 + 9.18 372 625 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.98 387 479 + 9.98 387 479 # sparsity 9 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 10.41 31 238 + 10.41 31 238 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 10.15 637 1070 + 10.15 637 1070 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1145 1413 + 32.00 1145 1413 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.15 221 267 + 12.15 221 267 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.15 252 284 + 12.15 252 284 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.15 609 849 + 10.15 609 849 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.03 54 624 + 10.03 54 624 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.06 60 650 + 10.06 60 650 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.03 54 649 + 10.03 54 649 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.00 5 653 + 10.00 5 653 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.03 7 666 + 10.03 7 666 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.00 5 659 + 10.00 5 659 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 9.75 207 739 + 9.75 207 739 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.75 206 743 + 9.75 206 743 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 11.72 73 313 + 11.72 73 313 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.17 369 611 + 10.17 369 611 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.98 381 474 + 10.98 381 474 # sparsity 10 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 11.57 29 236 + 11.57 29 236 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 11.28 626 1033 + 11.28 626 1033 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1141 1328 + 32.00 1141 1328 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.18 219 276 + 13.18 219 276 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.18 254 294 + 13.18 254 294 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.28 610 848 + 11.28 610 848 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.19 50 617 + 11.19 50 617 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.23 56 638 + 11.23 56 638 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.19 50 640 + 11.19 50 640 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.13 4 640 + 11.13 4 640 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.17 6 655 + 11.17 6 655 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.13 4 647 + 11.13 4 647 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 10.87 207 736 + 10.87 207 736 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.87 204 734 + 10.87 204 734 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 13.19 68 311 + 13.19 68 311 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.30 369 612 + 11.30 369 612 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.13 386 477 + 12.13 386 477 # sparsity 11 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 12.41 29 229 + 12.41 29 229 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 12.01 634 1046 + 12.01 634 1046 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1148 1365 + 32.00 1148 1365 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.84 208 261 + 13.84 208 261 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.84 241 277 + 13.84 241 277 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.01 605 832 + 12.01 605 832 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.07 49 650 + 12.07 49 650 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.10 54 674 + 12.10 54 674 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.07 49 675 + 12.07 49 675 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.93 4 604 + 11.93 4 604 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.97 6 618 + 11.97 6 618 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.93 4 611 + 11.93 4 611 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 11.60 206 724 + 11.60 206 724 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.60 203 724 + 11.60 203 724 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 13.98 66 291 + 13.98 66 291 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.04 367 603 + 12.04 367 603 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.86 385 478 + 12.86 385 478 # sparsity 12 # generating random data... # generating random data... ok. # kamikaze PForDelta # bits per int, compress speed (mis), decompression speed (mis) - 13.48 28 236 + 13.48 28 236 # IntegratedBinaryPacking + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 12.96 634 1051 + 12.96 634 1051 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1150 1307 + 32.00 1150 1307 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.69 202 258 + 14.69 202 258 # IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.69 235 272 + 14.69 235 272 # BinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.96 610 849 + 12.96 610 849 # NewPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.17 48 698 + 13.17 48 698 # NewPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.20 52 714 + 13.20 52 714 # NewPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.17 48 720 + 13.17 48 720 # OptPFD + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.96 4 588 + 12.96 4 588 # OptPFDS9 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.00 6 602 + 13.00 6 602 # OptPFDS16 + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.96 4 597 + 12.96 4 597 # IntegratedFastPFOR + IntegratedVariableByte (Integrated) # bits per int, compress speed (mis), decompression speed (mis) - 12.55 206 726 + 12.55 206 726 # FastPFOR + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.55 203 725 + 12.55 203 725 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 15.40 63 269 + 15.40 63 269 # XorBinaryPacking + VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.99 368 613 + 12.99 368 613 # DeltaZigzagBinaryPacking + DeltaZigzagVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.81 384 476 + 13.81 384 476 Results were written into a CSV file: benchmark-20131112T105209.csv diff --git a/benchmarkresults/benchmarkresults_skippable_haswell_18sept2014.txt b/benchmarkresults/benchmarkresults_skippable_haswell_18sept2014.txt index 4159637..7e35696 100644 --- a/benchmarkresults/benchmarkresults_skippable_haswell_18sept2014.txt +++ b/benchmarkresults/benchmarkresults_skippable_haswell_18sept2014.txt @@ -1,7 +1,7 @@ # benchmark based on the ClusterData model from: -# Vo Ngoc Anh and Alistair Moffat. -# Index compression using 64-bit words. -# Softw. Pract. Exper.40, 2 (February 2010), 131-147. +# Vo Ngoc Anh and Alistair Moffat. +# Index compression using 64-bit words. +# Softw. Pract. Exper.40, 2 (February 2010), 131-147. # Results will be written into a CSV file: benchmark-20140918T011322.csv @@ -10,504 +10,504 @@ # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.04 840 1619 + 3.04 840 1619 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1169 1698 + 32.00 1169 1698 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 195 369 + 8.00 195 369 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.04 651 1148 + 3.04 651 1148 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.96 129 865 + 2.96 129 865 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.98 158 877 + 2.98 158 877 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.96 130 879 + 2.96 130 879 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.95 25 930 + 2.95 25 930 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.97 27 951 + 2.97 27 951 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.95 25 935 + 2.95 25 935 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 2.82 235 928 + 2.82 235 928 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 2.93 255 740 + 2.93 255 740 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 2.77 147 395 + 2.77 147 395 # sparsity 2 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.82 831 1555 + 3.82 831 1555 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1183 1800 + 32.00 1183 1800 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.00 220 372 + 8.00 220 372 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.82 659 1139 + 3.82 659 1139 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.72 116 855 + 3.72 116 855 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.75 136 851 + 3.75 136 851 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.72 115 853 + 3.72 115 853 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.71 19 895 + 3.71 19 895 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.74 22 917 + 3.74 22 917 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.71 19 900 + 3.71 19 900 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 3.59 230 908 + 3.59 230 908 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 3.74 195 654 + 3.74 195 654 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 3.49 111 366 + 3.49 111 366 # sparsity 3 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.78 817 1519 + 4.78 817 1519 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1019 1759 + 32.00 1019 1759 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.02 238 370 + 8.02 238 370 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.78 680 1121 + 4.78 680 1121 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.67 98 825 + 4.67 98 825 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.70 123 840 + 4.70 123 840 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.67 102 834 + 4.67 102 834 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.66 15 861 + 4.66 15 861 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.69 18 895 + 4.69 18 895 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.66 14 871 + 4.66 14 871 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 4.54 231 904 + 4.54 231 904 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 4.84 153 589 + 4.84 153 589 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 4.40 83 339 + 4.40 83 339 # sparsity 4 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.65 788 1505 + 5.65 788 1505 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1142 1757 + 32.00 1142 1757 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.09 242 363 + 8.09 242 363 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.65 636 1113 + 5.65 636 1113 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.52 92 828 + 5.52 92 828 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.56 112 826 + 5.56 112 826 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.52 94 826 + 5.52 94 826 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.51 12 854 + 5.51 12 854 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.54 15 883 + 5.54 15 883 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.51 12 858 + 5.51 12 858 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 5.39 218 886 + 5.39 218 886 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 5.80 136 566 + 5.80 136 566 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 5.32 68 319 + 5.32 68 319 # sparsity 5 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.31 804 1490 + 6.31 804 1490 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1105 1860 + 32.00 1105 1860 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.40 245 330 + 8.40 245 330 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.31 673 1121 + 6.31 673 1121 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.19 87 832 + 6.19 87 832 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.22 107 844 + 6.22 107 844 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.19 88 830 + 6.19 88 830 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.17 10 851 + 6.17 10 851 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.20 14 883 + 6.20 14 883 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.17 10 852 + 6.17 10 852 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.07 217 875 + 6.07 217 875 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 6.51 130 513 + 6.51 130 513 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 6.13 60 307 + 6.13 60 307 # sparsity 6 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.99 742 1431 + 6.99 742 1431 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1163 1660 + 32.00 1163 1660 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.99 205 290 + 8.99 205 290 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.99 637 1107 + 6.99 637 1107 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.87 82 821 + 6.87 82 821 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.90 100 830 + 6.90 100 830 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.87 82 818 + 6.87 82 818 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.85 9 834 + 6.85 9 834 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.88 12 865 + 6.88 12 865 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.85 9 836 + 6.85 9 836 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 6.75 224 877 + 6.75 224 877 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 7.33 118 485 + 7.33 118 485 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 6.98 54 296 + 6.98 54 296 # sparsity 7 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.31 770 1463 + 8.31 770 1463 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1074 1832 + 32.00 1074 1832 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.01 203 240 + 10.01 203 240 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.31 664 1105 + 8.31 664 1105 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.18 73 796 + 8.18 73 796 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.22 88 808 + 8.22 88 808 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.18 73 792 + 8.18 73 792 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.16 7 819 + 8.16 7 819 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.20 10 849 + 8.20 10 849 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.16 7 810 + 8.16 7 810 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.05 217 851 + 8.05 217 851 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 9.01 103 430 + 9.01 103 430 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 8.61 47 277 + 8.61 47 277 # sparsity 8 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.88 800 1414 + 8.88 800 1414 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1078 1718 + 32.00 1078 1718 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.91 211 227 + 10.91 211 227 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.88 671 1083 + 8.88 671 1083 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.76 70 804 + 8.76 70 804 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.80 84 814 + 8.80 84 814 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.76 70 800 + 8.76 70 800 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.73 7 807 + 8.73 7 807 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.77 9 792 + 8.77 9 792 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.73 7 801 + 8.73 7 801 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 8.64 211 837 + 8.64 211 837 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 9.94 96 417 + 9.94 96 417 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 9.51 44 268 + 9.51 44 268 # sparsity 9 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.19 834 1442 + 10.19 834 1442 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1200 1632 + 32.00 1200 1632 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.16 206 212 + 12.16 206 212 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.19 675 1092 + 10.19 675 1092 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.07 64 804 + 10.07 64 804 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.10 76 814 + 10.10 76 814 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.07 63 802 + 10.07 63 802 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.04 6 810 + 10.04 6 810 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.08 9 841 + 10.08 9 841 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.04 6 808 + 10.04 6 808 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 9.94 222 858 + 9.94 222 858 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 11.79 88 397 + 11.79 88 397 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 11.40 38 253 + 11.40 38 253 # sparsity 10 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.10 814 1406 + 11.10 814 1406 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1215 1820 + 32.00 1215 1820 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.07 207 208 + 13.07 207 208 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.10 681 1073 + 11.10 681 1073 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.00 60 800 + 11.00 60 800 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.04 72 809 + 11.04 72 809 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 11.00 60 796 + 11.00 60 796 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.95 6 785 + 10.95 6 785 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.99 8 815 + 10.99 8 815 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.95 6 782 + 10.95 6 782 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 10.84 226 860 + 10.84 226 860 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 12.93 84 389 + 12.93 84 389 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 12.58 36 245 + 12.58 36 245 # sparsity 11 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.31 814 1392 + 12.31 814 1392 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1171 1846 + 32.00 1171 1846 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.14 172 201 + 14.14 172 201 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.31 668 1071 + 12.31 668 1071 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.42 56 825 + 12.42 56 825 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.45 67 832 + 12.45 67 832 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.42 56 821 + 12.42 56 821 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.22 5 729 + 12.22 5 729 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.27 8 758 + 12.27 8 758 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.22 5 731 + 12.22 5 731 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.07 222 836 + 12.07 222 836 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 14.31 81 377 + 14.31 81 377 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 14.05 33 238 + 14.05 33 238 # sparsity 12 # generating random data... # generating random data... ok. # IntegratedBinaryPacking + IntegratedVariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.97 805 1375 + 12.97 805 1375 # JustCopy # bits per int, compress speed (mis), decompression speed (mis) - 32.00 1160 1737 + 32.00 1160 1737 # VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 14.72 186 193 + 14.72 186 193 # BinaryPacking+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.97 656 1037 + 12.97 656 1037 # NewPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.22 56 886 + 13.22 56 886 # NewPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.24 67 891 + 13.24 67 891 # NewPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.22 56 883 + 13.22 56 883 # OptPFD+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.98 5 704 + 12.98 5 704 # OptPFDS9+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 13.02 8 740 + 13.02 8 740 # OptPFDS16+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.98 5 704 + 12.98 5 704 # FastPFOR+VariableByte # bits per int, compress speed (mis), decompression speed (mis) - 12.73 223 845 + 12.73 223 845 # Simple9 # bits per int, compress speed (mis), decompression speed (mis) - 15.35 78 347 + 15.35 78 347 # Simple16 # bits per int, compress speed (mis), decompression speed (mis) - 15.15 31 225 + 15.15 31 225 Results were written into a CSV file: benchmark-20140918T011322.csv diff --git a/pom.xml b/pom.xml index a960b2c..7f89da1 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,8 @@ 0.1.13-SNAPSHOT jar - 1.7 - 1.7 + 1.8 + 1.8 UTF-8 @@ -190,6 +190,47 @@ 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/ diff --git a/src/main/java/me/lemire/integercompression/GroupSimple9.java b/src/main/java/me/lemire/integercompression/GroupSimple9.java index 0ce10ce..a294080 100644 --- a/src/main/java/me/lemire/integercompression/GroupSimple9.java +++ b/src/main/java/me/lemire/integercompression/GroupSimple9.java @@ -13,3540 +13,3540 @@ 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); - - } + 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 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..cdc7308 100644 --- a/src/main/java/me/lemire/integercompression/Simple16.java +++ b/src/main/java/me/lemire/integercompression/Simple16.java @@ -13,173 +13,173 @@ */ 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); + 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 diff --git a/src/main/java/me/lemire/integercompression/Simple9.java b/src/main/java/me/lemire/integercompression/Simple9.java index 032489d..4864756 100644 --- a/src/main/java/me/lemire/integercompression/Simple9.java +++ b/src/main/java/me/lemire/integercompression/Simple9.java @@ -20,280 +20,280 @@ 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 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 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 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 }; - @Override - public String toString() { - return this.getClass().getSimpleName(); - } + @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..5faf7c2 100644 --- a/src/main/java/me/lemire/integercompression/SkippableComposition.java +++ b/src/main/java/me/lemire/integercompression/SkippableComposition.java @@ -54,7 +54,7 @@ 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(); diff --git a/src/main/java/me/lemire/integercompression/UncompressibleInputException.java b/src/main/java/me/lemire/integercompression/UncompressibleInputException.java index c490946..c0ed41f 100644 --- a/src/main/java/me/lemire/integercompression/UncompressibleInputException.java +++ b/src/main/java/me/lemire/integercompression/UncompressibleInputException.java @@ -6,14 +6,14 @@ */ public class UncompressibleInputException extends RuntimeException { - /** - * Create new exception - * @param string explanation for the exception - */ - public UncompressibleInputException(String string) { - super(string); - } + /** + * Create new exception + * @param string explanation for the exception + */ + public UncompressibleInputException(String string) { + super(string); + } - private static final long serialVersionUID = -798583799846489873L; + 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/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/IntegratedIntCompressor.java b/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java index 5808bdd..72159ba 100644 --- a/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java +++ b/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java @@ -43,12 +43,12 @@ public int[] compress(int[] 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); - } + 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); + } compressed = Arrays.copyOf(compressed,outpos.intValue()); return compressed; } diff --git a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java index 09c4dd8..abcc027 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; diff --git a/src/main/java/me/lemire/longcompression/ByteLongCODEC.java b/src/main/java/me/lemire/longcompression/ByteLongCODEC.java index e405370..dbc6864 100644 --- a/src/main/java/me/lemire/longcompression/ByteLongCODEC.java +++ b/src/main/java/me/lemire/longcompression/ByteLongCODEC.java @@ -57,6 +57,6 @@ public void compress(long[] in, IntWrapper inpos, int inlength, * where to write the compressed output in out */ public void uncompress(byte[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos); + long[] out, IntWrapper outpos); } diff --git a/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java b/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java index 3b2bc76..35c1166 100644 --- a/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java +++ b/src/main/java/me/lemire/longcompression/LongAs2IntsCodec.java @@ -16,174 +16,174 @@ * */ public class LongAs2IntsCodec implements LongCODEC { - final IntegerCODEC highPartsCodec; - final IntegerCODEC lowPartsCodec; - - public LongAs2IntsCodec(IntegerCODEC highPartsCodec, IntegerCODEC lowPartsCodec) { - this.highPartsCodec = highPartsCodec; - this.lowPartsCodec = lowPartsCodec; - } - - /** - * By default, we expect longs to be slightly above Integer.MAX_VALUE. Hence highParts to be small and positive - * integers. For lowParts, we rely on {@link IntCompressor} default IntegerCODEC - */ - public LongAs2IntsCodec() { - this(new VariableByte(), new Composition(new BinaryPacking(), new VariableByte())); - } - - @Override - public void compress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { - if (inlength == 0) { - return; - } - - int[] highParts = new int[inlength]; - int[] lowParts = new int[inlength]; - - for (int i = 0; i < inlength; i++) { - int inPosition = inpos.get() + i; - - highParts[i] = RoaringIntPacking.high(in[inPosition]); - lowParts[i] = RoaringIntPacking.low(in[inPosition]); - } - - // TODO What would be a relevant buffer size? - int[] buffer = new int[inlength * 16]; - - int outPosition = outpos.get(); - - boolean hasLeftover; - { - // The first integer is reserved to hold the number of compressed ints - IntWrapper highPartsOutPosition = new IntWrapper(1); - - highPartsCodec.compress(highParts, new IntWrapper(), inlength, buffer, highPartsOutPosition); - - // Record the compressedHighparts length - buffer[0] = highPartsOutPosition.get() - 1; - - for (int i = 0; i < highPartsOutPosition.get() / 2; i++) { - long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); - out[outPosition++] = pack; - } - - if (1 == highPartsOutPosition.get() % 2) { - // Shift the trailing integer as first in the buffer - hasLeftover = true; - buffer[0] = buffer[highPartsOutPosition.get() - 1]; - } else { - hasLeftover = false; - } - } - - { - // The first integer is reserved to hold the number of compressed ints - IntWrapper lowPartsOutPosition = new IntWrapper(1); - if (hasLeftover) { - // Keep the trailing int from highParts before the reserved int from lowParts compressed length - lowPartsOutPosition.set(2); - } - - lowPartsCodec.compress(lowParts, new IntWrapper(0), inlength, buffer, lowPartsOutPosition); - - // Record the compressedHighparts length - buffer[hasLeftover ? 1 : 0] = lowPartsOutPosition.get() - (hasLeftover ? 2 : 1); - - for (int i = 0; i < lowPartsOutPosition.get() / 2; i++) { - long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); - out[outPosition++] = pack; - } - - if (1 == lowPartsOutPosition.get() % 2) { - // The trailing integer is packed with a 0 - long pack = RoaringIntPacking.pack(buffer[lowPartsOutPosition.get() - 1], 0); - out[outPosition++] = pack; - } - } - - inpos.add(inlength); - outpos.set(outPosition); - } - - /** - * inlength is ignored by this codec. We may rely on it instead of storing the compressedLowPart length - */ - @Override - public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { - if (inlength == 0) { - return; - } - - int longIndex = inpos.get(); - - int nbCompressedHighParts = RoaringIntPacking.high(in[longIndex]); - int[] compressedHighParts = new int[nbCompressedHighParts]; - - // !highPart as we just read the highPart for nbCompressedHighParts - boolean highPart = false; - for (int i = 0; i < nbCompressedHighParts; i++) { - int nextInt; - if (highPart) { - nextInt = RoaringIntPacking.high(in[longIndex + (i + 1) / 2]); - } else { - nextInt = RoaringIntPacking.low(in[longIndex + (i + 1) / 2]); - } - compressedHighParts[i] = nextInt; - - highPart = !highPart; - } - - // TODO What would be a relevant buffer size? - int[] buffer = new int[inlength * 16]; - - IntWrapper highPartsOutPosition = new IntWrapper(); - highPartsCodec.uncompress(compressedHighParts, - new IntWrapper(), - compressedHighParts.length, - buffer, - highPartsOutPosition); - int[] highParts = Arrays.copyOf(buffer, highPartsOutPosition.get()); - - // +1 as we initially read nbCompressedHighParts - int intIndexNbCompressedLowParts = longIndex * 2 + 1 + nbCompressedHighParts; - int nbCompressedLowParts; - if (highPart) { - nbCompressedLowParts = RoaringIntPacking.high(in[intIndexNbCompressedLowParts / 2]); - } else { - nbCompressedLowParts = RoaringIntPacking.low(in[intIndexNbCompressedLowParts / 2]); - } - highPart = !highPart; - - int[] compressedLowParts = new int[nbCompressedLowParts]; - for (int i = 0; i < nbCompressedLowParts; i++) { - int nextInt; - if (highPart) { - nextInt = RoaringIntPacking.high(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); - } else { - nextInt = RoaringIntPacking.low(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); - } - compressedLowParts[i] = nextInt; - - highPart = !highPart; - } - - IntWrapper lowPartsOutPosition = new IntWrapper(); - lowPartsCodec.uncompress(compressedLowParts, - new IntWrapper(), - compressedLowParts.length, - buffer, - lowPartsOutPosition); - int[] lowParts = Arrays.copyOf(buffer, lowPartsOutPosition.get()); - assert highParts.length == lowParts.length; - - int outposition = outpos.get(); - for (int i = 0; i < highParts.length; i++) { - out[outposition++] = RoaringIntPacking.pack(highParts[i], lowParts[i]); - } - - inpos.add(inlength); - outpos.set(outposition); - } + final IntegerCODEC highPartsCodec; + final IntegerCODEC lowPartsCodec; + + public LongAs2IntsCodec(IntegerCODEC highPartsCodec, IntegerCODEC lowPartsCodec) { + this.highPartsCodec = highPartsCodec; + this.lowPartsCodec = lowPartsCodec; + } + + /** + * By default, we expect longs to be slightly above Integer.MAX_VALUE. Hence highParts to be small and positive + * integers. For lowParts, we rely on {@link IntCompressor} default IntegerCODEC + */ + public LongAs2IntsCodec() { + this(new VariableByte(), new Composition(new BinaryPacking(), new VariableByte())); + } + + @Override + public void compress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { + if (inlength == 0) { + return; + } + + int[] highParts = new int[inlength]; + int[] lowParts = new int[inlength]; + + for (int i = 0; i < inlength; i++) { + int inPosition = inpos.get() + i; + + highParts[i] = RoaringIntPacking.high(in[inPosition]); + lowParts[i] = RoaringIntPacking.low(in[inPosition]); + } + + // TODO What would be a relevant buffer size? + int[] buffer = new int[inlength * 16]; + + int outPosition = outpos.get(); + + boolean hasLeftover; + { + // The first integer is reserved to hold the number of compressed ints + IntWrapper highPartsOutPosition = new IntWrapper(1); + + highPartsCodec.compress(highParts, new IntWrapper(), inlength, buffer, highPartsOutPosition); + + // Record the compressedHighparts length + buffer[0] = highPartsOutPosition.get() - 1; + + for (int i = 0; i < highPartsOutPosition.get() / 2; i++) { + long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); + out[outPosition++] = pack; + } + + if (1 == highPartsOutPosition.get() % 2) { + // Shift the trailing integer as first in the buffer + hasLeftover = true; + buffer[0] = buffer[highPartsOutPosition.get() - 1]; + } else { + hasLeftover = false; + } + } + + { + // The first integer is reserved to hold the number of compressed ints + IntWrapper lowPartsOutPosition = new IntWrapper(1); + if (hasLeftover) { + // Keep the trailing int from highParts before the reserved int from lowParts compressed length + lowPartsOutPosition.set(2); + } + + lowPartsCodec.compress(lowParts, new IntWrapper(0), inlength, buffer, lowPartsOutPosition); + + // Record the compressedHighparts length + buffer[hasLeftover ? 1 : 0] = lowPartsOutPosition.get() - (hasLeftover ? 2 : 1); + + for (int i = 0; i < lowPartsOutPosition.get() / 2; i++) { + long pack = RoaringIntPacking.pack(buffer[i * 2], buffer[i * 2 + 1]); + out[outPosition++] = pack; + } + + if (1 == lowPartsOutPosition.get() % 2) { + // The trailing integer is packed with a 0 + long pack = RoaringIntPacking.pack(buffer[lowPartsOutPosition.get() - 1], 0); + out[outPosition++] = pack; + } + } + + inpos.add(inlength); + outpos.set(outPosition); + } + + /** + * inlength is ignored by this codec. We may rely on it instead of storing the compressedLowPart length + */ + @Override + public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, IntWrapper outpos) { + if (inlength == 0) { + return; + } + + int longIndex = inpos.get(); + + int nbCompressedHighParts = RoaringIntPacking.high(in[longIndex]); + int[] compressedHighParts = new int[nbCompressedHighParts]; + + // !highPart as we just read the highPart for nbCompressedHighParts + boolean highPart = false; + for (int i = 0; i < nbCompressedHighParts; i++) { + int nextInt; + if (highPart) { + nextInt = RoaringIntPacking.high(in[longIndex + (i + 1) / 2]); + } else { + nextInt = RoaringIntPacking.low(in[longIndex + (i + 1) / 2]); + } + compressedHighParts[i] = nextInt; + + highPart = !highPart; + } + + // TODO What would be a relevant buffer size? + int[] buffer = new int[inlength * 16]; + + IntWrapper highPartsOutPosition = new IntWrapper(); + highPartsCodec.uncompress(compressedHighParts, + new IntWrapper(), + compressedHighParts.length, + buffer, + highPartsOutPosition); + int[] highParts = Arrays.copyOf(buffer, highPartsOutPosition.get()); + + // +1 as we initially read nbCompressedHighParts + int intIndexNbCompressedLowParts = longIndex * 2 + 1 + nbCompressedHighParts; + int nbCompressedLowParts; + if (highPart) { + nbCompressedLowParts = RoaringIntPacking.high(in[intIndexNbCompressedLowParts / 2]); + } else { + nbCompressedLowParts = RoaringIntPacking.low(in[intIndexNbCompressedLowParts / 2]); + } + highPart = !highPart; + + int[] compressedLowParts = new int[nbCompressedLowParts]; + for (int i = 0; i < nbCompressedLowParts; i++) { + int nextInt; + if (highPart) { + nextInt = RoaringIntPacking.high(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); + } else { + nextInt = RoaringIntPacking.low(in[(intIndexNbCompressedLowParts + 1 + i) / 2]); + } + compressedLowParts[i] = nextInt; + + highPart = !highPart; + } + + IntWrapper lowPartsOutPosition = new IntWrapper(); + lowPartsCodec.uncompress(compressedLowParts, + new IntWrapper(), + compressedLowParts.length, + buffer, + lowPartsOutPosition); + int[] lowParts = Arrays.copyOf(buffer, lowPartsOutPosition.get()); + assert highParts.length == lowParts.length; + + int outposition = outpos.get(); + for (int i = 0; i < highParts.length; i++) { + out[outposition++] = RoaringIntPacking.pack(highParts[i], lowParts[i]); + } + + inpos.add(inlength); + outpos.set(outposition); + } } diff --git a/src/main/java/me/lemire/longcompression/LongCODEC.java b/src/main/java/me/lemire/longcompression/LongCODEC.java index c0f67b2..0b77a43 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 write the compressed 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/LongJustCopy.java b/src/main/java/me/lemire/longcompression/LongJustCopy.java index 7a5a67a..9b25f71 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,7 +36,7 @@ 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); @@ -45,7 +45,7 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int 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/LongUtil.java b/src/main/java/me/lemire/longcompression/LongUtil.java index c06433f..abb8ab4 100644 --- a/src/main/java/me/lemire/longcompression/LongUtil.java +++ b/src/main/java/me/lemire/longcompression/LongUtil.java @@ -16,7 +16,7 @@ @Deprecated public class LongUtil { - protected static String longToBinaryWithLeading(long l) { - return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0'); - } + protected static String longToBinaryWithLeading(long l) { + return String.format("%64s", Long.toBinaryString(l)).replace(' ', '0'); + } } diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java index f3d10ee..6ac129c 100644 --- a/src/main/java/me/lemire/longcompression/LongVariableByte.java +++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java @@ -234,7 +234,7 @@ public void uncompress(long[] in, IntWrapper inpos, int inlength, long[] out, @Override public void uncompress(byte[] in, IntWrapper inpos, int inlength, - long[] out, IntWrapper outpos) { + long[] out, IntWrapper outpos) { int p = inpos.get(); int finalp = inpos.get() + inlength; int tmpoutpos = outpos.get(); diff --git a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java index 5568489..f2e9a55 100644 --- a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java +++ b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java @@ -55,7 +55,7 @@ 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(); 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..aa6718b 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++) { + 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); + } } @@ -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++) { + 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); + } + } - /** - * 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..ce10d18 100644 --- a/src/test/java/me/lemire/integercompression/ExampleTest.java +++ b/src/test/java/me/lemire/integercompression/ExampleTest.java @@ -17,305 +17,305 @@ * */ 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()); + // 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."); + + } } 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..9018229 100644 --- a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java +++ b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java @@ -19,7 +19,7 @@ */ @SuppressWarnings({ "static-method" }) public class SkippableBasicTest { - final SkippableIntegerCODEC[] codecs = { + final SkippableIntegerCODEC[] codecs = { new JustCopy(), new VariableByte(), new SkippableComposition(new BinaryPacking(), new VariableByte()), diff --git a/src/test/java/me/lemire/longcompression/LongBasicTest.java b/src/test/java/me/lemire/longcompression/LongBasicTest.java index 5aa3551..ab306d4 100644 --- a/src/test/java/me/lemire/longcompression/LongBasicTest.java +++ b/src/test/java/me/lemire/longcompression/LongBasicTest.java @@ -47,33 +47,33 @@ public class LongBasicTest { new LongVariableByte(), new LongAs2IntsCodec()}; - /** + /** * 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); + + } + } + } /** * */ @@ -167,16 +167,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); } } @@ -273,7 +273,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); @@ -357,19 +357,19 @@ private void testUnsorted3(LongCODEC codec) { @Test public void fastPforTest() { // proposed by Stefan Ackermann (https://github.com/Stivo) - for (LongCODEC codec : codecs) { - int N = FastPFOR.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 = FastPFOR.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]); + } } /** @@ -378,19 +378,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..4a30b41 100644 --- a/src/test/java/me/lemire/longcompression/LongTestUtils.java +++ b/src/test/java/me/lemire/longcompression/LongTestUtils.java @@ -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 e900c9c..d7f6f2c 100644 --- a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java +++ b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java @@ -78,15 +78,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"); @@ -123,16 +123,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"); diff --git a/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java b/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java index 00bb52a..b247ed8 100644 --- a/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java +++ b/src/test/java/me/lemire/longcompression/TestLongAs2IntsCodec.java @@ -18,89 +18,89 @@ * @author Benoit Lacelle */ public class TestLongAs2IntsCodec { - final LongAs2IntsCodec codec = new LongAs2IntsCodec(); - - private void checkConsistency(LongCODEC codec, long[] array) { - { - long[] compressed = LongTestUtils.compress(codec, array); - long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof ByteLongCODEC) { - byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); - long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof SkippableLongCODEC) { - long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); - long[] uncompressed = - LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - } - - @Test - public void testCodec_Zero() { - checkConsistency(codec, new long[] { 0 }); - } - - @Test - public void testCodec_Minus1() { - checkConsistency(codec, new long[] { -1 }); - } - - @Test - public void testCodec_ZeroTimes8Minus1() { - checkConsistency(codec, new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); - } - - @Test - public void testCodec_ZeroTimes127Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_ZeroTimes128Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_MinValue() { - checkConsistency(codec, new long[] { Long.MIN_VALUE }); - } - - @Test - public void testCodec_ZeroMinValue() { - checkConsistency(codec, new long[] { 0, Long.MIN_VALUE }); - } - - @Test - public void testCodec_allPowerOfTwo() { - checkConsistency(codec, new long[] { 1L << 42 }); - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 1L << i }); - } - } - - @Test - public void testCodec_ZeroThenAllPowerOfTwo() { - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 0, 1L << i }); - } - } - - @Test - public void testCodec_intermediateHighPowerOfTwo() { - Assert.assertEquals(3, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length); - } + final LongAs2IntsCodec codec = new LongAs2IntsCodec(); + + private void checkConsistency(LongCODEC codec, long[] array) { + { + long[] compressed = LongTestUtils.compress(codec, array); + long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + + if (codec instanceof ByteLongCODEC) { + byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); + long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + + if (codec instanceof SkippableLongCODEC) { + long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); + long[] uncompressed = + LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + } + + @Test + public void testCodec_Zero() { + checkConsistency(codec, new long[] { 0 }); + } + + @Test + public void testCodec_Minus1() { + checkConsistency(codec, new long[] { -1 }); + } + + @Test + public void testCodec_ZeroTimes8Minus1() { + checkConsistency(codec, new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); + } + + @Test + public void testCodec_ZeroTimes127Minus1() { + long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); + + checkConsistency(codec, array); + } + + @Test + public void testCodec_ZeroTimes128Minus1() { + long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); + + checkConsistency(codec, array); + } + + @Test + public void testCodec_MinValue() { + checkConsistency(codec, new long[] { Long.MIN_VALUE }); + } + + @Test + public void testCodec_ZeroMinValue() { + checkConsistency(codec, new long[] { 0, Long.MIN_VALUE }); + } + + @Test + public void testCodec_allPowerOfTwo() { + checkConsistency(codec, new long[] { 1L << 42 }); + for (int i = 0; i < 64; i++) { + checkConsistency(codec, new long[] { 1L << i }); + } + } + + @Test + public void testCodec_ZeroThenAllPowerOfTwo() { + for (int i = 0; i < 64; i++) { + checkConsistency(codec, new long[] { 0, 1L << i }); + } + } + + @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/TestLongVariableByte.java b/src/test/java/me/lemire/longcompression/TestLongVariableByte.java index 15613f2..9ba3818 100644 --- a/src/test/java/me/lemire/longcompression/TestLongVariableByte.java +++ b/src/test/java/me/lemire/longcompression/TestLongVariableByte.java @@ -18,86 +18,86 @@ * @author Benoit Lacelle */ public class TestLongVariableByte { - final LongVariableByte codec = new LongVariableByte(); - - private void checkConsistency(LongCODEC codec, long[] array) { - { - long[] compressed = LongTestUtils.compress(codec, array); - long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof ByteLongCODEC) { - byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); - long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - - if (codec instanceof SkippableLongCODEC) { - long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); - long[] uncompressed = - LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); - - Assert.assertArrayEquals(array, uncompressed); - } - } - - @Test - public void testCodec_ZeroMinus1() { - checkConsistency(codec, new long[] { -1 }); - } - - @Test - public void testCodec_ZeroTimes8Minus1() { - checkConsistency(codec, new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); - } - - @Test - public void testCodec_ZeroTimes127Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_ZeroTimes128Minus1() { - long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); - - checkConsistency(codec, array); - } - - @Test - public void testCodec_MinValue() { - checkConsistency(codec, new long[] { Long.MIN_VALUE }); - } - - @Test - public void testCodec_ZeroMinValue() { - checkConsistency(codec, new long[] { 0, Long.MIN_VALUE }); - } - - @Test - public void testCodec_allPowerOfTwo() { - checkConsistency(codec, new long[] { 1L << 42 }); - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 1L << i }); - } - } - - @Test - public void testCodec_ZeroThenAllPowerOfTwo() { - for (int i = 0; i < 64; i++) { - checkConsistency(codec, new long[] { 0, 1L << i }); - } - } - - @Test - public void testCodec_intermediateHighPowerOfTwo() { - Assert.assertEquals(1, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length); - Assert.assertEquals(7, LongTestUtils.compress((ByteLongCODEC) codec, new long[] { 1L << 42 }).length); - Assert.assertEquals(1, LongTestUtils.compressHeadless((SkippableLongCODEC) codec, new long[] { 1L << 42 }).length); - } + final LongVariableByte codec = new LongVariableByte(); + + private void checkConsistency(LongCODEC codec, long[] array) { + { + long[] compressed = LongTestUtils.compress(codec, array); + long[] uncompressed = LongTestUtils.uncompress(codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + + if (codec instanceof ByteLongCODEC) { + byte[] compressed = LongTestUtils.compress((ByteLongCODEC) codec, array); + long[] uncompressed = LongTestUtils.uncompress((ByteLongCODEC) codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + + if (codec instanceof SkippableLongCODEC) { + long[] compressed = LongTestUtils.compressHeadless((SkippableLongCODEC) codec, array); + long[] uncompressed = + LongTestUtils.uncompressHeadless((SkippableLongCODEC) codec, compressed, array.length); + + Assert.assertArrayEquals(array, uncompressed); + } + } + + @Test + public void testCodec_ZeroMinus1() { + checkConsistency(codec, new long[] { -1 }); + } + + @Test + public void testCodec_ZeroTimes8Minus1() { + checkConsistency(codec, new long[] { 0, 0, 0, 0, 0, 0, 0, 0, -1 }); + } + + @Test + public void testCodec_ZeroTimes127Minus1() { + long[] array = LongStream.concat(LongStream.range(0, 127).map(l -> 0), LongStream.of(-1)).toArray(); + + checkConsistency(codec, array); + } + + @Test + public void testCodec_ZeroTimes128Minus1() { + long[] array = LongStream.concat(LongStream.range(0, 128).map(l -> 0), LongStream.of(-1)).toArray(); + + checkConsistency(codec, array); + } + + @Test + public void testCodec_MinValue() { + checkConsistency(codec, new long[] { Long.MIN_VALUE }); + } + + @Test + public void testCodec_ZeroMinValue() { + checkConsistency(codec, new long[] { 0, Long.MIN_VALUE }); + } + + @Test + public void testCodec_allPowerOfTwo() { + checkConsistency(codec, new long[] { 1L << 42 }); + for (int i = 0; i < 64; i++) { + checkConsistency(codec, new long[] { 1L << i }); + } + } + + @Test + public void testCodec_ZeroThenAllPowerOfTwo() { + for (int i = 0; i < 64; i++) { + checkConsistency(codec, new long[] { 0, 1L << i }); + } + } + + @Test + public void testCodec_intermediateHighPowerOfTwo() { + Assert.assertEquals(1, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length); + Assert.assertEquals(7, LongTestUtils.compress((ByteLongCODEC) codec, new long[] { 1L << 42 }).length); + Assert.assertEquals(1, LongTestUtils.compressHeadless((SkippableLongCODEC) 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); From 9640566814326385a73c0f794f4c6d36050200d5 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 29 Sep 2025 18:21:32 +0200 Subject: [PATCH 25/78] Fix variable-byte encoding of large longs Previously, the branch encoding longs in 9 bytes was unreachable because the condition `val < (1L << 63)` is always false. Only negative longs should be encoded using 10 bytes. --- .../longcompression/LongVariableByte.java | 4 ++-- .../longcompression/TestLongVariableByte.java | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/lemire/longcompression/LongVariableByte.java b/src/main/java/me/lemire/longcompression/LongVariableByte.java index ad2b0eb..884d538 100644 --- a/src/main/java/me/lemire/longcompression/LongVariableByte.java +++ b/src/main/java/me/lemire/longcompression/LongVariableByte.java @@ -90,7 +90,7 @@ public void headlessCompress(long[] in, IntWrapper inpos, int inlength, long[] o buf.put((byte) extract7bits(5, val)); buf.put((byte) extract7bits(6, val)); buf.put((byte) (extract7bitsmaskless(7, (val)) | (1 << 7))); - } else if (val >= 0 && val < (1L << 63)) { + } else if (val >= 0) { buf.put((byte) extract7bits(0, val)); buf.put((byte) extract7bits(1, val)); buf.put((byte) extract7bits(2, val)); @@ -175,7 +175,7 @@ public void compress(long[] in, IntWrapper inpos, int inlength, byte[] out, out[outpostmp++] = (byte) extract7bits(5, val); out[outpostmp++] = (byte) extract7bits(6, val); out[outpostmp++] = (byte) (extract7bitsmaskless(7, (val)) | (1 << 7)); - } else if (val >= 0 && val < (1L << 63)) { + } else if (val >= 0) { out[outpostmp++] = (byte) extract7bits(0, val); out[outpostmp++] = (byte) extract7bits(1, val); out[outpostmp++] = (byte) extract7bits(2, val); diff --git a/src/test/java/me/lemire/longcompression/TestLongVariableByte.java b/src/test/java/me/lemire/longcompression/TestLongVariableByte.java index ee1755a..3cb2a49 100644 --- a/src/test/java/me/lemire/longcompression/TestLongVariableByte.java +++ b/src/test/java/me/lemire/longcompression/TestLongVariableByte.java @@ -24,11 +24,17 @@ public LongCODEC getCodec() { } @Test - public void testCodec_intermediateHighPowerOfTwo() { - Assert.assertEquals(1, LongTestUtils.compress((LongCODEC) codec, new long[] { 1L << 42 }).length); - Assert.assertEquals(7, LongTestUtils.compress((ByteLongCODEC) codec, new long[] { 1L << 42 }).length); - Assert.assertEquals(1, - LongTestUtils.compressHeadless((SkippableLongCODEC) codec, new long[] { 1L << 42 }).length); - } + public void testCodec_allBitWidths() { + for (int bitWidth = 0; bitWidth <= 64; bitWidth++) { + long value = bitWidth == 0 ? 0 : 1L << (bitWidth - 1); + + int expectedSizeInBytes = Math.max(1, (bitWidth + 6) / 7); + int expectedSizeInLongs = (expectedSizeInBytes > 8) ? 2 : 1; + Assert.assertEquals(expectedSizeInLongs, LongTestUtils.compress((LongCODEC) codec, new long[] { value }).length); + Assert.assertEquals(expectedSizeInBytes, LongTestUtils.compress((ByteLongCODEC) codec, new long[] { value }).length); + Assert.assertEquals(expectedSizeInLongs, + LongTestUtils.compressHeadless((SkippableLongCODEC) codec, new long[] { value }).length); + } + } } From e19e01874753ca8492d76e50340d69fb796259d6 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 29 Sep 2025 11:55:17 +0200 Subject: [PATCH 26/78] Compute max compressed length for SkippableIntegratedIntegerCODEC --- example.java | 6 +--- .../differential/IntegratedBinaryPacking.java | 12 ++++++- .../differential/IntegratedIntCompressor.java | 3 +- .../differential/IntegratedVariableByte.java | 10 ++++++ .../SkippableIntegratedComposition.java | 9 +++++ .../SkippableIntegratedIntegerCODEC.java | 17 ++++++++++ .../lemire/integercompression/AdhocTest.java | 6 ++-- .../integercompression/ExampleTest.java | 6 +--- .../SkippableBasicTest.java | 33 +++++++++++++++++++ 9 files changed, 87 insertions(+), 15 deletions(-) diff --git a/example.java b/example.java index 71ccd63..25acc0c 100644 --- a/example.java +++ b/example.java @@ -104,11 +104,7 @@ public static void basicExampleHeadless() { // 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 + int[] compressed = new int[codec.maxHeadlessCompressedLength(new IntWrapper(0), data.length)]; /** * 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 72159ba..ad6467a 100644 --- a/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java +++ b/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java @@ -39,7 +39,8 @@ public IntegratedIntCompressor() { * @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); 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 abcc027..a1379ad 100644 --- a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java +++ b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java @@ -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/test/java/me/lemire/integercompression/AdhocTest.java b/src/test/java/me/lemire/integercompression/AdhocTest.java index aa6718b..ea7800b 100644 --- a/src/test/java/me/lemire/integercompression/AdhocTest.java +++ b/src/test/java/me/lemire/integercompression/AdhocTest.java @@ -108,11 +108,11 @@ 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()); + 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); diff --git a/src/test/java/me/lemire/integercompression/ExampleTest.java b/src/test/java/me/lemire/integercompression/ExampleTest.java index ce10d18..62eb6f6 100644 --- a/src/test/java/me/lemire/integercompression/ExampleTest.java +++ b/src/test/java/me/lemire/integercompression/ExampleTest.java @@ -116,11 +116,7 @@ public void basicExampleHeadless() { // 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 + int[] compressed = new int[codec.maxHeadlessCompressedLength(new IntWrapper(0), data.length)]; /** * diff --git a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java index 9018229..3c31305 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. @@ -147,5 +152,33 @@ 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); + } + + 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 + } + } } From 32e374a350ccfa0764f5860b412028f2f3887231 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 29 Sep 2025 13:36:07 +0200 Subject: [PATCH 27/78] Compute max compressed length for SkippableIntegerCODEC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calculating the maximum compressed length is now implemented for all schemes except: * Kamikaze — as stated in the Javadoc, it is not intended for production use. * VectorFastPFOR — it does not appear to be supported for production yet, as it is not included in the release package. --- example.java | 6 +- .../integercompression/BinaryPacking.java | 16 +++++- .../lemire/integercompression/FastPFOR.java | 21 ++++++- .../integercompression/FastPFOR128.java | 19 +++++++ .../integercompression/GroupSimple9.java | 8 ++- .../integercompression/IntCompressor.java | 3 +- .../lemire/integercompression/JustCopy.java | 6 ++ .../lemire/integercompression/Kamikaze.java | 7 ++- .../me/lemire/integercompression/NewPFD.java | 11 ++++ .../lemire/integercompression/NewPFDS16.java | 11 ++++ .../lemire/integercompression/NewPFDS9.java | 11 ++++ .../me/lemire/integercompression/OptPFD.java | 11 ++++ .../lemire/integercompression/OptPFDS16.java | 13 ++++- .../lemire/integercompression/OptPFDS9.java | 13 ++++- .../lemire/integercompression/Simple16.java | 8 ++- .../me/lemire/integercompression/Simple9.java | 6 ++ .../SkippableComposition.java | 10 ++++ .../SkippableIntegerCODEC.java | 17 ++++++ .../integercompression/VariableByte.java | 10 ++++ .../vector/VectorFastPFOR.java | 5 ++ .../lemire/integercompression/AdhocTest.java | 4 +- .../integercompression/ExampleTest.java | 6 +- .../SkippableBasicTest.java | 57 ++++++++++++++++++- .../lemire/integercompression/TestUtils.java | 2 +- 24 files changed, 263 insertions(+), 18 deletions(-) diff --git a/example.java b/example.java index 25acc0c..75dfb05 100644 --- a/example.java +++ b/example.java @@ -263,10 +263,12 @@ public static void headlessDemo() { 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()); + 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(); 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 a294080..bd8acfa 100644 --- a/src/main/java/me/lemire/integercompression/GroupSimple9.java +++ b/src/main/java/me/lemire/integercompression/GroupSimple9.java @@ -3549,4 +3549,10 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o inpos.set(tmpinpos); } -} \ No newline at end of file + + @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..57b29f6 100644 --- a/src/main/java/me/lemire/integercompression/IntCompressor.java +++ b/src/main/java/me/lemire/integercompression/IntCompressor.java @@ -36,7 +36,8 @@ public IntCompressor() { * @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); 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/Simple16.java b/src/main/java/me/lemire/integercompression/Simple16.java index cdc7308..2b7f27f 100644 --- a/src/main/java/me/lemire/integercompression/Simple16.java +++ b/src/main/java/me/lemire/integercompression/Simple16.java @@ -103,6 +103,12 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o 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. * @@ -182,4 +188,4 @@ public String toString() { { 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 +} diff --git a/src/main/java/me/lemire/integercompression/Simple9.java b/src/main/java/me/lemire/integercompression/Simple9.java index 4864756..fd5194d 100644 --- a/src/main/java/me/lemire/integercompression/Simple9.java +++ b/src/main/java/me/lemire/integercompression/Simple9.java @@ -268,6 +268,12 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o } + @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) { if (inlength == 0) diff --git a/src/main/java/me/lemire/integercompression/SkippableComposition.java b/src/main/java/me/lemire/integercompression/SkippableComposition.java index 5faf7c2..7dd4736 100644 --- a/src/main/java/me/lemire/integercompression/SkippableComposition.java +++ b/src/main/java/me/lemire/integercompression/SkippableComposition.java @@ -61,6 +61,16 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, int[] o 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/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/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/test/java/me/lemire/integercompression/AdhocTest.java b/src/test/java/me/lemire/integercompression/AdhocTest.java index ea7800b..ee911b3 100644 --- a/src/test/java/me/lemire/integercompression/AdhocTest.java +++ b/src/test/java/me/lemire/integercompression/AdhocTest.java @@ -86,10 +86,10 @@ public void testIssue29() { @Test public void testIssue29b() { 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[90]; + int[] b = new int[x + codec.maxHeadlessCompressedLength(new IntWrapper(0), a.length)]; 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); diff --git a/src/test/java/me/lemire/integercompression/ExampleTest.java b/src/test/java/me/lemire/integercompression/ExampleTest.java index 62eb6f6..c63c69b 100644 --- a/src/test/java/me/lemire/integercompression/ExampleTest.java +++ b/src/test/java/me/lemire/integercompression/ExampleTest.java @@ -276,10 +276,12 @@ public void headlessDemo() { 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()); + 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(); diff --git a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java index 3c31305..57a07e3 100644 --- a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java +++ b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java @@ -53,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(); @@ -157,6 +158,33 @@ 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) { @@ -181,4 +209,31 @@ private static void testMaxHeadlessCompressedLength(SkippableIntegratedIntegerCO 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); From 6b86ee3dd0ce92545d07ef722209c49a1eb59ff3 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 29 Sep 2025 14:11:33 +0200 Subject: [PATCH 28/78] Compute max compressed length for SkippableLongCODEC --- .../longcompression/LongBinaryPacking.java | 14 ++++++++-- .../longcompression/LongCompressor.java | 3 ++- .../lemire/longcompression/LongJustCopy.java | 6 +++++ .../longcompression/LongVariableByte.java | 9 +++++++ .../longcompression/SkippableLongCODEC.java | 17 ++++++++++++ .../SkippableLongComposition.java | 10 +++++++ .../lemire/longcompression/LongTestUtils.java | 2 +- .../SkippableLongBasicTest.java | 26 ++++++++++++++++++- 8 files changed, 82 insertions(+), 5 deletions(-) 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/LongCompressor.java b/src/main/java/me/lemire/longcompression/LongCompressor.java index a2c79fd..ae1dd1a 100644 --- a/src/main/java/me/lemire/longcompression/LongCompressor.java +++ b/src/main/java/me/lemire/longcompression/LongCompressor.java @@ -40,7 +40,8 @@ public LongCompressor() { * @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); diff --git a/src/main/java/me/lemire/longcompression/LongJustCopy.java b/src/main/java/me/lemire/longcompression/LongJustCopy.java index 9b25f71..95abc1e 100644 --- a/src/main/java/me/lemire/longcompression/LongJustCopy.java +++ b/src/main/java/me/lemire/longcompression/LongJustCopy.java @@ -43,6 +43,12 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, } + @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) { 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 f2e9a55..0f9800e 100644 --- a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java +++ b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java @@ -62,6 +62,16 @@ public void headlessUncompress(long[] in, IntWrapper inpos, int inlength, long[] 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/test/java/me/lemire/longcompression/LongTestUtils.java b/src/test/java/me/lemire/longcompression/LongTestUtils.java index 4a30b41..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); diff --git a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java index b317d4f..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(); @@ -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 + } + } } From 1d2749faafb30d401a6daf24d225d5693aed5730 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 29 Sep 2025 14:16:03 +0200 Subject: [PATCH 29/78] Remove UncompressibleInputException Since we can now calculate the maximum compressed length, there is no longer a need to handle underestimated output array lengths by throwing this exception. --- .../integercompression/IntCompressor.java | 10 +--------- .../UncompressibleInputException.java | 19 ------------------- .../differential/IntegratedIntCompressor.java | 9 +-------- .../longcompression/LongCompressor.java | 10 +--------- 4 files changed, 3 insertions(+), 45 deletions(-) delete mode 100644 src/main/java/me/lemire/integercompression/UncompressibleInputException.java diff --git a/src/main/java/me/lemire/integercompression/IntCompressor.java b/src/main/java/me/lemire/integercompression/IntCompressor.java index 57b29f6..30f755c 100644 --- a/src/main/java/me/lemire/integercompression/IntCompressor.java +++ b/src/main/java/me/lemire/integercompression/IntCompressor.java @@ -33,7 +33,6 @@ 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 maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length); @@ -41,14 +40,7 @@ public int[] compress(int[] 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/UncompressibleInputException.java b/src/main/java/me/lemire/integercompression/UncompressibleInputException.java deleted file mode 100644 index c0ed41f..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/differential/IntegratedIntCompressor.java b/src/main/java/me/lemire/integercompression/differential/IntegratedIntCompressor.java index ad6467a..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,7 +35,6 @@ 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 maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length); @@ -44,12 +42,7 @@ public int[] compress(int[] 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/longcompression/LongCompressor.java b/src/main/java/me/lemire/longcompression/LongCompressor.java index ae1dd1a..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,7 +36,6 @@ 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) { int maxCompressedLength = codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length); @@ -45,13 +43,7 @@ public long[] compress(long[] 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; } From e322d8ae643ebfa5fb3ab427837a400878016374 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 19:44:22 -0400 Subject: [PATCH 30/78] minor updates to maven --- jitpack.yml | 5 +++++ pom.xml | 37 +++++++++++++++---------------------- 2 files changed, 20 insertions(+), 22 deletions(-) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..255e0f4 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,5 @@ +jdk: + - openjdk21 +before_install: + - sdk install java 21-open + - sdk use java 21-open diff --git a/pom.xml b/pom.xml index 5240577..c21680c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,9 @@ 0.2.2-SNAPSHOT jar - 1.8 - 1.8 + 21 + 21 + 21 UTF-8 @@ -18,18 +19,16 @@ - scm:git:git@github.com:lemire/JavaFastPFOR.git - scm:git:git@github.com:lemire/JavaFastPFOR.git - scm:git:git@github.com:lemire/JavaFastPFOR.git + scm:git:git@github.com:fastpack/JavaFastPFOR.git + scm:git:git@github.com:fastpack/JavaFastPFOR.git + scm:git:git@github.com:fastpack/JavaFastPFOR.git lemire Daniel Lemire - lemire@gmail.com + daniel@lemire.me http://lemire.me/en/ - LICEF Research Center - http://licef.ca architect developer @@ -57,13 +56,8 @@ GitHub Issue Tracking - https://github.com/lemire/JavaFastPFOR/issues + https://github.com/fastpack/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 @@ - + @@ -233,9 +227,8 @@ JavaFastPFOR - https://github.com/lemire/JavaFastPFOR/ + https://github.com/fastpack/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. From 762fdb1942a4987709ac60b5fa92d2bd439df988 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 19:47:09 -0400 Subject: [PATCH 31/78] updating jacoco --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c21680c..bd26590 100644 --- a/pom.xml +++ b/pom.xml @@ -161,7 +161,7 @@ org.jacoco jacoco-maven-plugin - 0.8.8 + 0.8.13 me/lemire/integercompression/Kamikaze From 7efa9327eee6104ec69c439f4dc08fb09f590d5c Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 19:51:18 -0400 Subject: [PATCH 32/78] removing gpg --- pom.xml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/pom.xml b/pom.xml index bd26590..113c99a 100644 --- a/pom.xml +++ b/pom.xml @@ -115,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 From 309b37618c899c8ed3aa67d46e4f0f3d6662adf0 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 19:53:32 -0400 Subject: [PATCH 33/78] fix name --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 113c99a..6975671 100644 --- a/pom.xml +++ b/pom.xml @@ -19,9 +19,9 @@ - scm:git:git@github.com:fastpack/JavaFastPFOR.git - scm:git:git@github.com:fastpack/JavaFastPFOR.git - scm:git:git@github.com:fastpack/JavaFastPFOR.git + scm:git:git@github.com:fast-pack/JavaFastPFOR.git + scm:git:git@github.com:fast-pack/JavaFastPFOR.git + scm:git:git@github.com:fast-pack/JavaFastPFOR.git @@ -56,7 +56,7 @@ GitHub Issue Tracking - https://github.com/fastpack/JavaFastPFOR/issues + https://github.com/fast-pack/JavaFastPFOR/issues @@ -213,7 +213,7 @@ JavaFastPFOR - https://github.com/fastpack/JavaFastPFOR/ + https://github.com/fast-pack/JavaFastPFOR/ A library to compress and uncompress arrays of integers very quickly. From 5b8e8aef9a0d3ac11eaafe3665c6608858d416de Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:01:17 -0400 Subject: [PATCH 34/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.0 --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6975671..56f7cdf 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.2.2-SNAPSHOT + 0.3.0 jar 21 @@ -22,6 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git + JavaFastPFOR-0.3.0 From 443210a34d6f9a8d4c6da4e2550db71a84f305e2 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:05:59 -0400 Subject: [PATCH 35/78] Update Java version in workflow to 21 --- .github/workflows/basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 4688fa2..7f12ed7 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - java: [ 17, 21 ] + java: [ 21 ] steps: - uses: actions/checkout@v4.1.1 - name: Set up JDK From 8834bd4042f366c0a638451edb569e74c485bea9 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:06:46 -0400 Subject: [PATCH 36/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 56f7cdf..b0d3657 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.0 + 0.3.1-SNAPSHOT jar 21 From 511e2ca24b3ff01b5e70d0f85c5657d2de8b1433 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:09:26 -0400 Subject: [PATCH 37/78] up --- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index b0d3657..a1b9d5f 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.1-SNAPSHOT + 0.3.0-SNAPSHOT jar 21 @@ -22,7 +22,6 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.0 From 1d79fc23f93a425a65e19f16cd737e6eb51d3ddd Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:09:46 -0400 Subject: [PATCH 38/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a1b9d5f..82ad7f1 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.0-SNAPSHOT + 0.3.1-SNAPSHOT jar 21 @@ -22,6 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git + HEAD From 4470b9f718ad2444d89ee96bafeb0251b7dfe97d Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:18:02 -0400 Subject: [PATCH 39/78] Revise dependency instructions for JitPack usage Updated Maven and Gradle instructions to use JitPack and the latest version of JavaFastPFor. --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5d3fc30..59be8cd 100644 --- a/README.md +++ b/README.md @@ -72,31 +72,65 @@ non-vectorized implementation. For an example usage, see examples/vector/Example.java. The feature requires JDK 19+ and is currently for advanced users. -Maven central repository +JitPack ------------------------ +1. **Maven** + Using this code in your own project is easy with maven, just add the following code in your pom.xml file: ```xml - - - me.lemire.integercompression - JavaFastPFOR - [0.2,) - - + + com.github.fast-pack + JavaFastPFor + JavaFastPFOR-0.3.0 + +``` + +as well as jitpack as a repository... + +```xml + + + jitpack.io + https://jitpack.io + + ``` Naturally, you should replace "version" by the version you desire. +2. **Gradle (groovy)** + + +Then all you need is to edit your `build.gradle` file like so: + -You can also download JavaFastPFOR from the Maven central repository: -http://repo1.maven.org/maven2/me/lemire/integercompression/JavaFastPFOR/ +```groovy +plugins { + id 'java' +} +repositories { + mavenCentral() + maven { + url 'https://jitpack.io/' + } +} + +dependencies { + implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.0' +} +``` + + +Naturally, you should replace "version" by the version +you desire. + Why? ---- From 5f7e77e2a897f1caaa552c53eeb9680e553cdfe6 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:35:36 -0400 Subject: [PATCH 40/78] Add JitPack version badge to README Added a JitPack version badge to the README. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 59be8cd..38f6baf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ JavaFastPFOR: A simple integer compression library in Java ========================================================== +[![](https://jitpack.io/v/fast-pack/JavaFastPFor.svg)](https://jitpack.io/#fast-pack/JavaFastPFor) [![][maven img]][maven] [![][license img]][license] [![docs-badge][]][docs] [![Java CI](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml/badge.svg)](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml) From 760efdbf6db9078100d1514777ace9dc1f4b22da Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:46:46 -0400 Subject: [PATCH 41/78] updating pom --- pom.xml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 82ad7f1..227409f 100644 --- a/pom.xml +++ b/pom.xml @@ -166,9 +166,13 @@
- org.eluder.coveralls - coveralls-maven-plugin - 3.2.1 + org.apache.maven.plugins + maven-release-plugin + 3.0.1 + + install + true + From 015084e2f6e86b5af831615d7fbcc3473c52f407 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:49:17 -0400 Subject: [PATCH 42/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.1 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 227409f..e88e3f8 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.1-SNAPSHOT + 0.3.1 jar 21 @@ -22,7 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.1 From a0a5affd5eb0e7b16186fd38fa8a19ff466f317d Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 20:49:19 -0400 Subject: [PATCH 43/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e88e3f8..e873dab 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.1 + 0.3.2-SNAPSHOT jar 21 @@ -22,7 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.1 + HEAD From f92dc36074b43c3f7daf053f91de6bfc4a3abd5e Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 21:08:07 -0400 Subject: [PATCH 44/78] Update JavaFastPFOR version to 0.3.1 Updated the dependency version for JavaFastPFOR in both Maven and Gradle sections of the README. --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 38f6baf..b738fea 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,13 @@ non-vectorized implementation. For an example usage, see examples/vector/Example.java. The feature requires JDK 19+ and is currently for advanced users. -JitPack +JavaFastPFOR as a dependency (JitPack) ------------------------ +We have a demo project using JavaFastPFOR as a dependency (both Maven and Gradle). See... + +https://github.com/fast-pack/JavaFastPFORDemo + 1. **Maven** Using this code in your own project is easy with maven, just add @@ -85,7 +89,7 @@ the following code in your pom.xml file: com.github.fast-pack JavaFastPFor - JavaFastPFOR-0.3.0 + JavaFastPFOR-0.3.1 ``` @@ -124,7 +128,7 @@ repositories { } dependencies { - implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.0' + implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.1' } ``` From 597a7ef18931c8986580abbecce08343d3926efb Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 21:09:41 -0400 Subject: [PATCH 45/78] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b738fea..f073db3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ JavaFastPFOR: A simple integer compression library in Java ========================================================== -[![](https://jitpack.io/v/fast-pack/JavaFastPFor.svg)](https://jitpack.io/#fast-pack/JavaFastPFor) - [![][maven img]][maven] [![][license img]][license] [![docs-badge][]][docs] +[![](https://jitpack.io/v/fast-pack/JavaFastPFor.svg)](https://jitpack.io/#fast-pack/JavaFastPFor) [![][license img]][license] [![docs-badge][]][docs] [![Java CI](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml/badge.svg)](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml) From bc4478110417dba21de19de3b8e313b4e10ef1f5 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 21:10:44 -0400 Subject: [PATCH 46/78] Update README by removing authors and changing JDK version Removed author section and updated JDK version requirement. --- README.md | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/README.md b/README.md index f073db3..2e6853a 100644 --- a/README.md +++ b/README.md @@ -153,20 +153,6 @@ Nevertheless, if you want to reuse codec instances, note that by convention, unless the documentation of a codec specify that it is not thread-safe, then it can be assumed to be thread-safe. -Authors -------- - -Main contributors -* Daniel Lemire, http://lemire.me/en/ -* Muraoka Taro, https://github.com/koron - -with contributions by -* the Terrier team (Matteo Catena, Craig Macdonald, Saúl Vargas and Iadh Ounis) -* Di Wu, http://www.facebook.com/diwu1989 -* Stefan Ackermann, https://github.com/Stivo -* Samit Roy, https://github.com/roysamit -* Mulugeta Mammo, https://github.com/mulugetam (for VectorFastPFOR) - How does it compare to the Kamikaze PForDelta library? ------------------------------------------------------ @@ -186,7 +172,7 @@ Requirements Releases up to 0.1.12 require Java 7 or better. -The current development versions assume JDK 11 or better. +The current development versions assume JDK 21 or better. @@ -270,8 +256,6 @@ Funding This work was supported by NSERC grant number 26143. -[maven img]:https://maven-badges.herokuapp.com/maven-central/me.lemire.integercompression/JavaFastPFOR/badge.svg -[maven]:http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22me.lemire.integercompression%22%20 [license]:LICENSE [license img]:https://img.shields.io/badge/License-Apache%202-blue.svg From 73f164beea740c9609336f20c1eed70841dc0a5b Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 21:12:11 -0400 Subject: [PATCH 47/78] Revise README with Java example for compression Updated usage section with a complete Java example demonstrating the compression and uncompression process using FastPFOR128. --- README.md | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e6853a..63193e9 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,50 @@ as well as in GMAP and GSNAP (http://research-pub.gene.com/gmap/). Usage ------ -Really simple usage: ```java - IntegratedIntCompressor iic = new IntegratedIntCompressor(); - int[] data = ... ; // to be compressed - int[] compressed = iic.compress(data); // compressed array - int[] recov = iic.uncompress(compressed); // equals to data +package org.example; + +import me.lemire.integercompression.FastPFOR128; +import me.lemire.integercompression.IntWrapper; + +import java.util.Arrays; + +public class Main { + public static void main(String[] args) { + 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); + + // quick verification: count mismatches + int mismatches = 0; + for (int i = 0; i < N; i++) { + if (data[i] != recovered1[i]) mismatches++; + } + + System.out.println("N=" + N + " compressedSizeWords=" + compressedsize1 + " mismatches=" + mismatches); + System.out.println("first 20 original: " + Arrays.toString(Arrays.copyOf(data, 20))); + System.out.println("first 20 recovered: " + Arrays.toString(Arrays.copyOf(recovered1, 20))); + } +} + ``` For more examples, see example.java or the examples folder. From 1414beb03b85f0568c088937367219c57ff953fd Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 21:13:20 -0400 Subject: [PATCH 48/78] Remove license information from README Removed license section from README. --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 63193e9..77a86dc 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,6 @@ JavaFastPFOR: A simple integer compression library in Java [![Java CI](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml/badge.svg)](https://github.com/lemire/JavaFastPFOR/actions/workflows/basic.yml) -License -------- - -This code is released under the -Apache License Version 2.0 http://www.apache.org/licenses/. What does this do? From 43888441156c73e6bcf7fcf4897e399fbec5ccdd Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 22:33:57 -0400 Subject: [PATCH 49/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.2 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e873dab..dd1665e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.2-SNAPSHOT + 0.3.2 jar 21 @@ -22,7 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.2 From 75093a3f636c79287977bc63ac4994eba16f58cb Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 22:33:59 -0400 Subject: [PATCH 50/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index dd1665e..928a3d2 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.2 + 0.3.3-SNAPSHOT jar 21 @@ -22,7 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.2 + HEAD From beb74608ff996e209a856b3373c99a2f4b187839 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Fri, 3 Oct 2025 22:36:34 -0400 Subject: [PATCH 51/78] Update README.md --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 77a86dc..2ef8fc5 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ the following code in your pom.xml file: com.github.fast-pack JavaFastPFor - JavaFastPFOR-0.3.1 + JavaFastPFOR-0.3.2 ``` @@ -159,7 +159,7 @@ repositories { } dependencies { - implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.1' + implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.2' } ``` @@ -167,12 +167,6 @@ dependencies { Naturally, you should replace "version" by the version you desire. -Why? ----- - -We found no library that implemented state-of-the-art integer coding techniques -such as Binary Packing, NewPFD, OptPFD, Variable Byte, Simple 9 and so on in Java. -We wrote one. Thread safety ---- From 3eef81bc6551a304e415f9af625ac365c96e8f11 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Sat, 4 Oct 2025 21:40:52 +0200 Subject: [PATCH 52/78] Fix handling of output offset in SkippableComposition classes Previously, when outpos passed to headlessUncompress was greater than zero, the second scheme would receive an incorrect number of remaining integers to decode. --- .../SkippableComposition.java | 4 +- .../SkippableIntegratedComposition.java | 4 +- .../SkippableLongComposition.java | 4 +- .../SkippableBasicTest.java | 49 +++++++++++++++++++ .../SkippableLongBasicTest.java | 24 +++++++++ 5 files changed, 82 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/lemire/integercompression/SkippableComposition.java b/src/main/java/me/lemire/integercompression/SkippableComposition.java index 7dd4736..fc3c18e 100644 --- a/src/main/java/me/lemire/integercompression/SkippableComposition.java +++ b/src/main/java/me/lemire/integercompression/SkippableComposition.java @@ -52,12 +52,14 @@ 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) { int init = inpos.get(); + int outposInit = outpos.get(); + F1.headlessUncompress(in, inpos, inlength, out, outpos, num); if (inpos.get() == init) { inpos.increment(); } inlength -= inpos.get() - init; - num -= outpos.get(); + num -= outpos.get() - outposInit; F2.headlessUncompress(in, inpos, inlength, out, outpos, num); } diff --git a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java index a1379ad..4786ec5 100644 --- a/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java +++ b/src/main/java/me/lemire/integercompression/differential/SkippableIntegratedComposition.java @@ -66,13 +66,15 @@ public void headlessUncompress(int[] in, IntWrapper inpos, int inlength, if (inlength == 0) return; int init = inpos.get(); + int outposInit = outpos.get(); + F1.headlessUncompress(in, inpos, inlength, out, outpos,num,initvalue); if (inpos.get() == init) { inpos.increment(); } inlength -= inpos.get() - init; - num -= outpos.get(); + num -= outpos.get() - outposInit; F2.headlessUncompress(in, inpos, inlength, out, outpos,num,initvalue); } diff --git a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java index 0f9800e..eb03b72 100644 --- a/src/main/java/me/lemire/longcompression/SkippableLongComposition.java +++ b/src/main/java/me/lemire/longcompression/SkippableLongComposition.java @@ -53,12 +53,14 @@ 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) { int init = inpos.get(); + int outposInit = outpos.get(); + F1.headlessUncompress(in, inpos, inlength, out, outpos, num); if (inpos.get() == init) { inpos.increment(); } inlength -= inpos.get() - init; - num -= outpos.get(); + num -= outpos.get() - outposInit; F2.headlessUncompress(in, inpos, inlength, out, outpos, num); } diff --git a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java index 57a07e3..881dada 100644 --- a/src/test/java/me/lemire/integercompression/SkippableBasicTest.java +++ b/src/test/java/me/lemire/integercompression/SkippableBasicTest.java @@ -15,6 +15,7 @@ import me.lemire.integercompression.differential.SkippableIntegratedIntegerCODEC; import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertTrue; /** @@ -236,4 +237,52 @@ private static void testMaxHeadlessCompressedLength(SkippableIntegerCODEC codec, } } } + + @Test + public void testUncompressOutputOffset_SkippableComposition() { + for (int offset : new int[] {0, 1, 6}) { + SkippableComposition codec = new SkippableComposition(new BinaryPacking(), new VariableByte()); + + int[] input = { 2, 3, 4, 5 }; + int[] compressed = new int[codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length)]; + int[] uncompressed = new int[offset + input.length]; + + IntWrapper inputOffset = new IntWrapper(0); + IntWrapper compressedOffset = new IntWrapper(0); + + codec.headlessCompress(input, inputOffset, input.length, compressed, compressedOffset); + + int compressedLength = compressedOffset.get(); + IntWrapper uncompressedOffset = new IntWrapper(offset); + compressedOffset = new IntWrapper(0); + codec.headlessUncompress(compressed, compressedOffset, compressedLength, uncompressed, uncompressedOffset, input.length); + + assertArrayEquals(input, Arrays.copyOfRange(uncompressed, offset, offset + input.length)); + } + } + + @Test + public void testUncompressOutputOffset_SkippableIntegratedComposition() { + for (int offset : new int[] {0, 1, 6}) { + SkippableIntegratedComposition codec = new SkippableIntegratedComposition(new IntegratedBinaryPacking(), new IntegratedVariableByte()); + + int[] input = { 2, 3, 4, 5 }; + int[] compressed = new int[codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length)]; + int[] uncompressed = new int[offset + input.length]; + + IntWrapper inputOffset = new IntWrapper(0); + IntWrapper compressedOffset = new IntWrapper(0); + IntWrapper initValue = new IntWrapper(0); + + codec.headlessCompress(input, inputOffset, input.length, compressed, compressedOffset, initValue); + + int compressedLength = compressedOffset.get(); + IntWrapper uncompressedOffset = new IntWrapper(offset); + compressedOffset = new IntWrapper(0); + initValue = new IntWrapper(0); + codec.headlessUncompress(compressed, compressedOffset, compressedLength, uncompressed, uncompressedOffset, input.length, initValue); + + assertArrayEquals(input, Arrays.copyOfRange(uncompressed, offset, offset + input.length)); + } + } } diff --git a/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java b/src/test/java/me/lemire/longcompression/SkippableLongBasicTest.java index 4309e9d..c4b7e01 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.assertArrayEquals; import static org.junit.Assert.assertTrue; /** @@ -167,4 +168,27 @@ private static void testMaxHeadlessCompressedLength(SkippableLongCODEC codec, in assertTrue(maxOutputLength <= outPos.get() + 1); // +1 because SkippableLongComposition always adds one extra integer for the potential header } } + + @Test + public void testUncompressOutputOffset_SkippableLongComposition() { + for (int offset : new int[] {0, 1, 6}) { + SkippableLongComposition codec = new SkippableLongComposition(new LongBinaryPacking(), new LongVariableByte()); + + long[] input = { 2, 3, 4, 5 }; + long[] compressed = new long[codec.maxHeadlessCompressedLength(new IntWrapper(0), input.length)]; + long[] uncompressed = new long[offset + input.length]; + + IntWrapper inputOffset = new IntWrapper(0); + IntWrapper compressedOffset = new IntWrapper(0); + + codec.headlessCompress(input, inputOffset, input.length, compressed, compressedOffset); + + int compressedLength = compressedOffset.get(); + IntWrapper uncompressedOffset = new IntWrapper(offset); + compressedOffset = new IntWrapper(0); + codec.headlessUncompress(compressed, compressedOffset, compressedLength, uncompressed, uncompressedOffset, input.length); + + assertArrayEquals(input, Arrays.copyOfRange(uncompressed, offset, offset + input.length)); + } + } } From 182f19168793be444c7336a59210247ab63558bb Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sun, 5 Oct 2025 13:02:31 -0400 Subject: [PATCH 53/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.3 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 928a3d2..a76e4aa 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.3-SNAPSHOT + 0.3.3 jar 21 @@ -22,7 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.3 From 0e6bab01c5f1b4103138afd83aa505322b40a224 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sun, 5 Oct 2025 13:02:33 -0400 Subject: [PATCH 54/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a76e4aa..09e48fa 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.3 + 0.3.4-SNAPSHOT jar 21 @@ -22,7 +22,7 @@ scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git scm:git:git@github.com:fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.3 + HEAD From 21252a7008ecb9c1cf13df0015eb6aa9d9dd3ce3 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Sun, 19 Oct 2025 10:03:08 +0200 Subject: [PATCH 55/78] Include IntelliJ files in .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 88b3320..5a78c84 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ tags target/ tmp/ /bin +.idea +*.iml From aac18eee72ac1c6c6e72a765c9ff906561c6d1d9 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Sun, 19 Oct 2025 10:05:00 +0200 Subject: [PATCH 56/78] Add release action --- .github/release-settings.xml | 20 ++++++++++ .github/workflows/release.yml | 75 +++++++++++++++++++++++++++++++++++ pom.xml | 47 ++++++++++++++++++++-- 3 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 .github/release-settings.xml create mode 100644 .github/workflows/release.yml diff --git a/.github/release-settings.xml b/.github/release-settings.xml new file mode 100644 index 0000000..be56a53 --- /dev/null +++ b/.github/release-settings.xml @@ -0,0 +1,20 @@ + + + + eu.maveniverse.maven.plugins + + + + + sonatype-central-portal + ${env.MAVEN_USER} + ${env.MAVEN_PASSWORD} + + sonatype-cp + njord:template:release-sca + + + + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..12e1db6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: Release + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: "Release version, e.g. 0.3.6 (optional — auto-detected from the current POM)" + required: false + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Validate release version + if: ${{ github.event.inputs.releaseVersion != '' }} + run: | + RELEASE=${{ github.event.inputs.releaseVersion }} + if [[ ! $RELEASE =~ ^[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]]; then + echo "Error: releaseVersion '$RELEASE' is not in the correct format x.y.z or x.y.z-SNAPSHOT" + exit 1 + fi + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'adopt' + + - name: Configure git + run: | + git config user.email "actions@github.com" + git config user.name "GitHub Actions" + + - name: Prepare Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + MVN_ARGS="" + if [ -n "${{ github.event.inputs.releaseVersion }}" ]; then + MVN_ARGS="$MVN_ARGS -DreleaseVersion=${{ github.event.inputs.releaseVersion }}" + fi + mvn -B release:prepare $MVN_ARGS + + - name: Determine release version + id: version + run: | + export TAG=$(grep 'scm.tag=' release.properties | cut -d'=' -f2) + export VERSION=${TAG#JavaFastPFOR-} + + echo "released_tag=${TAG}" >> $GITHUB_OUTPUT + echo "released_version=${VERSION}" >> $GITHUB_OUTPUT + + echo "Releasing tag: ${TAG}" + echo "Releasing version: ${VERSION}" + + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + run: | + mvn -B release:perform -Darguments="-DskipTests -Dnjord.autoPublish -s .github/release-settings.xml" + + - name: Create GitHub Release + run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pom.xml b/pom.xml index 09e48fa..2bfe5e8 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,7 @@ 21 21 UTF-8 + 0.8.5 @@ -19,11 +20,25 @@ - scm:git:git@github.com:fast-pack/JavaFastPFOR.git - scm:git:git@github.com:fast-pack/JavaFastPFOR.git - scm:git:git@github.com:fast-pack/JavaFastPFOR.git + scm:git:https://github.com/fast-pack/JavaFastPFOR.git + scm:git:https://github.com/fast-pack/JavaFastPFOR.git + scm:git:https://github.com/fast-pack/JavaFastPFOR.git HEAD + + + + sonatype-central-portal + Sonatype Central Portal + https://central.sonatype.com/repository/maven-snapshots/ + + + sonatype-central-portal + Sonatype Central Portal + https://repo.maven.apache.org/maven2/ + + + lemire @@ -60,6 +75,13 @@ https://github.com/fast-pack/JavaFastPFOR/issues + + + eu.maveniverse.maven.njord + extension3 + ${njord.version} + + org.apache.maven.plugins @@ -174,10 +196,29 @@ true + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.8 + + + sign-artifacts + verify + + sign + + + + + + eu.maveniverse.maven.plugins + njord + ${njord.version} + maven-clean-plugin 2.5 From 729b2603f6589327df672631d8f46b8689e85cf1 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 05:30:22 +0000 Subject: [PATCH 57/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.4 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2bfe5e8..113cbc1 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.4-SNAPSHOT + 0.3.4 jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.4 From 53fa8e8fe8afbf8f7bd8354dc7adff5c8f6d74fe Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 05:30:23 +0000 Subject: [PATCH 58/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 113cbc1..139a82d 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.4 + 0.3.5-SNAPSHOT jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.4 + HEAD From b1be2d85b9474764cfe9368d402fc5772e49513e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 08:58:56 +0000 Subject: [PATCH 59/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.5 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 139a82d..6ad5a19 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.5-SNAPSHOT + 0.3.5 jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.5 From 077c0a2055f6873ba7f9bc84158777886adb4663 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 08:58:58 +0000 Subject: [PATCH 60/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6ad5a19..67e904f 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.5 + 0.3.6-SNAPSHOT jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.5 + HEAD From 5504fcbe0dcfcb37319e1ebf3d1990932beff3df Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 20 Oct 2025 11:50:26 +0200 Subject: [PATCH 61/78] Set maven-release-plugin goals to deploy --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 67e904f..26864d0 100644 --- a/pom.xml +++ b/pom.xml @@ -192,7 +192,7 @@ maven-release-plugin 3.0.1 - install + deploy true From 806a712b063ef14643f554909a127e5bb79fa2b8 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 20 Oct 2025 06:42:52 +0200 Subject: [PATCH 62/78] Add missing env variables in release action --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12e1db6..8630f07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,8 @@ jobs: with: java-version: '21' distribution: 'adopt' + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Configure git run: | @@ -40,6 +42,7 @@ jobs: - name: Prepare Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} run: | MVN_ARGS="" if [ -n "${{ github.event.inputs.releaseVersion }}" ]; then From dd8461908ec33cd35fca97e6031b9f11e790109a Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 20 Oct 2025 07:27:13 +0200 Subject: [PATCH 63/78] Allow release action to create tags --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8630f07..79a9686 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,8 @@ on: jobs: release: runs-on: ubuntu-latest + permissions: + contents: write # to automatically create tags steps: - name: Validate release version From 6b167c42a5c24bbca4768a6ffde3db86d0d77e33 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 20 Oct 2025 10:51:53 +0200 Subject: [PATCH 64/78] Fix njord configuration --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79a9686..0b2f1c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,7 +72,7 @@ jobs: MAVEN_USER: ${{ secrets.MAVEN_USER }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} run: | - mvn -B release:perform -Darguments="-DskipTests -Dnjord.autoPublish -s .github/release-settings.xml" + mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish" -s .github/release-settings.xml - name: Create GitHub Release run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" From 12177805238aa06cf1a217bc8837c2b9175b34c1 Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Mon, 20 Oct 2025 10:20:58 +0200 Subject: [PATCH 65/78] [tmp] checkout master --- .github/workflows/release.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b2f1c4..291318f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: master - name: Set up Java uses: actions/setup-java@v4 @@ -74,7 +75,7 @@ jobs: run: | mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish" -s .github/release-settings.xml - - name: Create GitHub Release - run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# - name: Create GitHub Release +# run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9caa716d489848a928279264f585ab66d5e19b3c Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 09:55:40 +0000 Subject: [PATCH 66/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.6 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 26864d0..d8d30c1 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.6-SNAPSHOT + 0.3.6 jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.6 From f7ff2bd53b513fa6a82d6f0d02ad598fb9c9c5ff Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 09:55:42 +0000 Subject: [PATCH 67/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d8d30c1..00de0dc 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.6 + 0.3.7-SNAPSHOT jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.6 + HEAD From 1ca1e014e8fe7a1e74bb729944dd95f567bcb710 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 17:44:06 +0000 Subject: [PATCH 68/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.7 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 00de0dc..1c80152 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.7-SNAPSHOT + 0.3.7 jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.7 From 6d5b4c926c7ed81edfe4167c118422675c7f7009 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 17:44:07 +0000 Subject: [PATCH 69/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1c80152..f240455 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.7 + 0.3.8-SNAPSHOT jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.7 + HEAD From 1fcfa0b41cb7bd8b8c47a6ae29693f77d9e77273 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Oct 2025 14:08:49 -0400 Subject: [PATCH 70/78] can we make publishing automated ? --- .github/workflows/release.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 291318f..ac28c0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,9 +73,4 @@ jobs: MAVEN_USER: ${{ secrets.MAVEN_USER }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} run: | - mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish" -s .github/release-settings.xml - -# - name: Create GitHub Release -# run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" -# env: -# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish=true -Dnjord.publishingType=automatic" -s .github/release-settings.xml \ No newline at end of file From eb8f27fdc585aa6b4a570303a288ca8b0bf88690 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Oct 2025 19:30:07 -0400 Subject: [PATCH 71/78] minor change to the random generator (excuse to trigger a release). --- .../lemire/integercompression/synth/UniformDataGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/lemire/integercompression/synth/UniformDataGenerator.java b/src/main/java/me/lemire/integercompression/synth/UniformDataGenerator.java index bbd386a..a50497c 100644 --- a/src/main/java/me/lemire/integercompression/synth/UniformDataGenerator.java +++ b/src/main/java/me/lemire/integercompression/synth/UniformDataGenerator.java @@ -42,7 +42,7 @@ int[] generateUniformHash(int N, int Max) { int[] ans = new int[N]; HashSet s = new HashSet(); while (s.size() < N) - s.add(new Integer(this.rand.nextInt(Max))); + s.add(this.rand.nextInt(Max)); Iterator i = s.iterator(); for (int k = 0; k < N; ++k) ans[k] = i.next().intValue(); From 7e7567fda5eb20c7b1df6ea8d2ea33bb1ec6dbf1 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Oct 2025 19:37:00 -0400 Subject: [PATCH 72/78] putting back GitHub Release --- .github/workflows/release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ac28c0f..29bc28a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,4 +73,9 @@ jobs: MAVEN_USER: ${{ secrets.MAVEN_USER }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} run: | - mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish=true -Dnjord.publishingType=automatic" -s .github/release-settings.xml \ No newline at end of file + mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish=true -Dnjord.publishingType=automatic" -s .github/release-settings.xml + + - name: Create GitHub Release + run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 78c5799dcdd2fac1b11f159f024b4f29562da01e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 23:49:55 +0000 Subject: [PATCH 73/78] [maven-release-plugin] prepare release JavaFastPFOR-0.3.8 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f240455..ac78f6d 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.8-SNAPSHOT + 0.3.8 jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - HEAD + JavaFastPFOR-0.3.8 From 41fa4c03d500870955db901209d19305e787a5e5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 20 Oct 2025 23:49:56 +0000 Subject: [PATCH 74/78] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ac78f6d..9b53d0e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 me.lemire.integercompression JavaFastPFOR - 0.3.8 + 0.3.9-SNAPSHOT jar 21 @@ -23,7 +23,7 @@ scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git scm:git:https://github.com/fast-pack/JavaFastPFOR.git - JavaFastPFOR-0.3.8 + HEAD From 763bd2ddc61a8e66d39c62bea1b43b0a815e80b4 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Oct 2025 21:42:16 -0400 Subject: [PATCH 75/78] update name --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29bc28a..ec0e674 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,6 +76,6 @@ jobs: mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish=true -Dnjord.publishingType=automatic" -s .github/release-settings.xml - name: Create GitHub Release - run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" + run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "${{ steps.version.outputs.released_version }}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 6025cd079eb932617a09b18abbbcbd053e8e17cc Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Oct 2025 21:43:46 -0400 Subject: [PATCH 76/78] adding a check --- .github/workflows/release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec0e674..2098fe9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,6 +53,15 @@ jobs: fi mvn -B release:prepare $MVN_ARGS + - name: Check release.properties + run: | + if [ ! -f release.properties ]; then + echo "release.properties not found" + exit 1 + fi + echo "Contents of release.properties:" + cat release.properties + - name: Determine release version id: version run: | From 58b142eaa1795003d54d85c8d872549783af2eff Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 20 Oct 2025 21:47:58 -0400 Subject: [PATCH 77/78] undoing --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2098fe9..d6ad167 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,6 +85,6 @@ jobs: mvn -B release:perform -Darguments="-DskipTests -DaltDeploymentRepository=id::default::njord: -Dnjord.autoPublish=true -Dnjord.publishingType=automatic" -s .github/release-settings.xml - name: Create GitHub Release - run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "${{ steps.version.outputs.released_version }}" + run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 8b59184298825781dffb46c6fcb50f3dbd5a055c Mon Sep 17 00:00:00 2001 From: Piotr Rzysko Date: Tue, 21 Oct 2025 06:49:54 +0200 Subject: [PATCH 78/78] Add information about Maven Central to README --- README.md | 66 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 2ef8fc5..8fcd32c 100644 --- a/README.md +++ b/README.md @@ -104,53 +104,62 @@ non-vectorized implementation. For an example usage, see examples/vector/Example.java. The feature requires JDK 19+ and is currently for advanced users. -JavaFastPFOR as a dependency (JitPack) +JavaFastPFOR as a dependency ------------------------ +JavaFastPFOR is available both on Maven Central and JitPack, so you can easily +include it in your project using either source. + We have a demo project using JavaFastPFOR as a dependency (both Maven and Gradle). See... https://github.com/fast-pack/JavaFastPFORDemo -1. **Maven** +### Maven Central + +You can add JavaFastPFOR directly from Maven Central — no extra repository configuration needed: -Using this code in your own project is easy with maven, just add -the following code in your pom.xml file: +**Maven** ```xml - - com.github.fast-pack - JavaFastPFor - JavaFastPFOR-0.3.2 - + + me.lemire.integercompression + JavaFastPFOR + 0.3.8 + ``` -as well as jitpack as a repository... +**Gradle (Groovy)** -```xml - - - jitpack.io - https://jitpack.io - - +```groovy +dependencies { + implementation 'me.lemire.integercompression:JavaFastPFOR:0.3.8' +} ``` -Naturally, you should replace "version" by the version -you desire. +### JitPack +If you prefer or need to use JitPack, you can include the dependency like this: -2. **Gradle (groovy)** +**Maven** +```xml + + + jitpack.io + https://jitpack.io + + + + + com.github.fast-pack + JavaFastPFOR + JavaFastPFOR-0.3.8 + +``` -Then all you need is to edit your `build.gradle` file like so: - +**Gradle (groovy)** ```groovy -plugins { - id 'java' -} - - repositories { mavenCentral() maven { @@ -159,11 +168,10 @@ repositories { } dependencies { - implementation 'com.github.fast-pack:JavaFastPFor:JavaFastPFOR-0.3.2' + implementation 'com.github.fast-pack:JavaFastPFOR:JavaFastPFOR-0.3.8' } ``` - Naturally, you should replace "version" by the version you desire.