int tmpB = currentB; boolean hasBigNum = checkBigNumbers(inBlock, POSSIBLE_B[POSSIBLE_B.length - 1], blockSize); if (hasBigNum) { + currentB); } else { int optSize = estimateCompressedSize(inBlock, tmpB, blockSize); for (int i = 1; i < POSSIBLE_B.length; ++i) { tmpB = POSSIBLE_B[i]; int curSize = estimateCompressedSize(inBlock, tmpB, blockSize); if (curSize < optSize) { outBlock = compressOneBlock(inBlock, currentB, blockSize);
writeBits(tmpCompressedBlock, inputBlock[i], outputOffset, bits); writeBits(tmpCompressedBlock, inputBlock[i] & MASK[bits], outputOffset, bits); int compressedBitSize = compressBlockByS16(tmpCompressedBlock, outputOffset, expAux, expNum*2); outputOffset += compressedBitSize;
compressedBits = decompressBBitSlots(outBlock, inBlock, blockSize, bits); compressedBits = decompressBlockByS16(expPos, inBlock, offset, expNum); offset += compressedBits; compressedBits = decompressBlockByS16(expHighBits, inBlock, offset, expNum); offset += compressedBits;
/** * Decompress a compressed block into an integer array * * @param compBlock the compressed input block * @param blockSize the block size which is 256 by default * @return the decompressed output block */ public int decompressOneBlock(int[] decompBlock, int[] compBlock, int blockSize) { return PForDelta.decompressOneBlock(decompBlock, compBlock, blockSize); } }
for (int K = 0; K < data[k].length; K += 128) { final int[] compressedbuf = PForDelta .compressOneBlockOpt(Arrays .copyOfRange( backupdata, K, PForDelta.decompressOneBlock(tmpbuf, compbuf, 128); tmpbuf[0] += deltaoffset;
/** * Decompress b-bit slots * @param outDecompSlots decompressed block which is the output * @param inCompBlock the compressed block which is the input * @param blockSize the block size * @param bits the value of the parameter b * @return the compressed size in bits of the data that has been decompressed */ public static int decompressBBitSlots(int[] outDecompSlots, int[] inCompBlock, int blockSize, int bits) { int compressedBitSize = 0; int offset = HEADER_SIZE; for(int i =0; i<blockSize; i++) { outDecompSlots[i] = readBits(inCompBlock, offset, bits); offset += bits; } compressedBitSize = bits * blockSize; return compressedBitSize; }
/** * Estimated the compressed size of one block of integers using PForDelta * */ private int PForDeltaEstimateCompSize(int[] srcData, int b) { return PForDelta.estimateCompressedSize(srcData, b, _blockSize); }
@Override public void headlessCompress(int[] in, IntWrapper inpos, int inlength, int[] out, IntWrapper outpos) { inlength = Util.greatestMultiple(inlength, BLOCK_SIZE); if (inlength > 0) { int[] out2 = PForDelta.compressOneBlockOpt(in, inlength); inpos.add(inlength); System.arraycopy(out2, 0, out, outpos.get(), out2.length); outpos.add(out2.length); } }
/** * Compress an integer array * * @param inputBlock the integer input array * @param bits the value of b in the PForDelta algorithm * @param blockSize the block size which is 256 by default * @return CompResult which contains the compressed size in number of bits and the reference to the compressed data * @throws IllegalArgumentException */ public CompResult compressOneBlock(int[] inputBlock, int bits, int blockSize) throws IllegalArgumentException { int[] compBlock = PForDelta.compressOneBlock(inputBlock, bits, blockSize); CompResult res = new CompResult(); res.setCompressedSize(compBlock.length<<5); res.setCompressedBlock(compBlock); return res; }
private void printSet() { for (int i = 0; i < _blockSize; i++) { PForDelta.decompressOneBlock(iterDecompBlock, sequenceOfCompBlocks.get(i), _blockSize); postProcessBlock(iterDecompBlock, _blockSize); System.out.print(iterDecompBlock + ","); } }
for (int K = 0; K < data[k].length; K += 128) { final int[] compressedbuf = PForDelta .compressOneBlockOpt(Arrays .copyOfRange( backupdata, K, PForDelta.decompressOneBlock(tmpbuf, compbuf, 128); tmpbuf[0] += deltaoffset;
/** * Decompress b-bit slots * @param outDecompSlots decompressed block which is the output * @param inCompBlock the compressed block which is the input * @param blockSize the block size * @param bits the value of the parameter b * @return the compressed size in bits of the data that has been decompressed */ public static int decompressBBitSlots(int[] outDecompSlots, int[] inCompBlock, int blockSize, int bits) { int compressedBitSize = 0; int offset = HEADER_SIZE; for(int i =0; i<blockSize; i++) { outDecompSlots[i] = readBits(inCompBlock, offset, bits); offset += bits; } compressedBitSize = bits * blockSize; return compressedBitSize; }
/** * Estimated the compressed size of one block of integers using PForDelta * */ private int PForDeltaEstimateCompSize(int[] srcData, int b) { return PForDelta.estimateCompressedSize(srcData, b, _blockSize); }
/** * Compress one block of integers using PForDelta * */ private CompResult PForDeltaCompressOneBlock(int[] srcData) { int[] compBlock = PForDelta.compressOneBlockOpt(srcData, _blockSize); CompResult res = new CompResult(); res.setCompressedSize(compBlock.length<<5); res.setCompressedBlock(compBlock); return res; }
int tmpB = currentB; boolean hasBigNum = checkBigNumbers(inBlock, POSSIBLE_B[POSSIBLE_B.length-1], blockSize); if(hasBigNum) int optSize = estimateCompressedSize(inBlock, tmpB, blockSize); for (int i = 1; i < POSSIBLE_B.length; ++i) int curSize = estimateCompressedSize(inBlock, tmpB, blockSize); if(curSize < optSize) outBlock = compressOneBlock(inBlock, currentB, blockSize);
Arrays.fill(outBlock, 0); } else { compressedBits = decompressBBitSlots(outBlock, inBlock, blockSize, bits); compressedBits = decompressBlockByS16(expAux, inBlock, offset, expNum * 2); offset += compressedBits;
writeBits(tmpCompressedBlock, inputBlock[i], outputOffset, bits); writeBits(tmpCompressedBlock, inputBlock[i] & MASK[bits], outputOffset, bits); int compressedBitSize = compressBlockByS16(tmpCompressedBlock, outputOffset, expPos, expNum); outputOffset += compressedBitSize; compressedBitSize = compressBlockByS16(tmpCompressedBlock, outputOffset, expHighBits, expNum); outputOffset += compressedBitSize;
private void printSet() { for (int i = 0; i < _blockSize; i++) { PForDelta.decompressOneBlock(iterDecompBlock, sequenceOfCompBlocks.get(i), _blockSize); postProcessBlock(iterDecompBlock, _blockSize); System.out.print(iterDecompBlock + ","); } }
/** * Decompress b-bit slots * * @param outDecompSlots * decompressed block which is the output * @param inCompBlock * the compressed block which is the input * @param blockSize * the block size * @param bits * the value of the parameter b * @return the compressed size in bits of the data that has been * decompressed */ public static int decompressBBitSlots(int[] outDecompSlots, int[] inCompBlock, int blockSize, int bits) { int compressedBitSize = 0; int offset = HEADER_SIZE; for (int i = 0; i < blockSize; i++) { outDecompSlots[i] = readBits(inCompBlock, offset, bits); offset += bits; } compressedBitSize = bits * blockSize; return compressedBitSize; }
/** * Estimate the compressed size of a block * * @param inputBlock a block of non-negative integers to be compressed * @param bits the value of b in the PForDelta algorithm * @param blockSize the block size which is 256 by default * @return CompResult * @throws IllegalArgumentException */ public int estimateCompSize(int[] inputBlock, int bits, int blockSize) throws IllegalArgumentException { return PForDelta.estimateCompressedSize(inputBlock, bits, blockSize); }