com.kamikaze.pfordelta
Class Simple16WithHardCodes

java.lang.Object
  extended by com.kamikaze.pfordelta.Simple16WithHardCodes

public class Simple16WithHardCodes
extends Object

Implementation of the Simple16 algorithm for sorted integer arrays. The basic ideas are based on papers from

1. http://www2008.org/papers/pdf/p387-zhangA.pdf

2. http://www2009.org/proceedings/pdf/p401.pdf

The maximum possible integer value Simple16 can encode is < 2^28 (this is dertermined by the Simple16 algorithm itself). Therefore, in order to use Simple16, the application must write their own code to encode numbers in the range of [2^28, 2^32). A simple way is just write those numbers as 32-bit integers (that is, no compression for very big numbers).

Compared to Simple16, Simple16WithHardCodes will decompress each compressed integer using hardwired codes, resulting in faster decompression speed. However, it will sacrifice with slightly larger index size.

Author: Hao Yan, [email protected]


Constructor Summary
Simple16WithHardCodes()
           
 
Method Summary
static int s16Compress(int[] out, int outOffset, int[] in, int inOffset, int n, int blockSize, int oriBlockSize, int[] oriInputBlock)
          Compress an integer array using Simple16
static int s16CompressBackup(int[] out, int outOffset, int[] in, int inOffset, int n, int blockSize, int oriBlockSize, int[] oriInputBlock)
           
static int s16Decompress(int[] out, int outOffset, int[] in, int inOffset, int n)
          Decompress an integer array using Simple16
static int s16DecompressOneNumberWithHardCodes(int[] out, int outOffset, int value, int numIdx)
           
static int s16DecompressOneNumberWithHardCodesIntegrated(int[] out, int outOffset, int value, int numIdx, int oribits, int[] expPos)
           
static int s16DecompressWithIntBuffer(int[] out, int outOffset, int value, int n)
           
static int s16DecompressWithIntBufferBackup(int[] out, int outOffset, int value, int n)
           
static int s16DecompressWithIntBufferIntegrated(int[] out, int outOffset, int value, int n, int[] expPos, int oribits)
           
static int s16DecompressWithIntBufferIntegrated2(int[] out, int outOffset, int value, int n, int[] expPos, int oribits)
           
static int s16DecompressWithIntBufferIntegratedBackup(int[] out, int outOffset, int value, int n, int[] expPos, int oribits)
           
static int s16DecompressWithIntBufferWithHardCodes(int[] out, int outOffset, int value, int n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Simple16WithHardCodes

public Simple16WithHardCodes()
Method Detail

s16Compress

public static final int s16Compress(int[] out,
                                    int outOffset,
                                    int[] in,
                                    int inOffset,
                                    int n,
                                    int blockSize,
                                    int oriBlockSize,
                                    int[] oriInputBlock)
Compress an integer array using Simple16

Parameters:
out - the compressed output
outOffset - the offset of the output in the number of integers
in - the integer input array
inOffset - the offset of the input in the number of integers
n - the number of elements to be compressed
Returns:
the number of compressed integers

s16CompressBackup

public static final int s16CompressBackup(int[] out,
                                          int outOffset,
                                          int[] in,
                                          int inOffset,
                                          int n,
                                          int blockSize,
                                          int oriBlockSize,
                                          int[] oriInputBlock)

s16Decompress

public static final int s16Decompress(int[] out,
                                      int outOffset,
                                      int[] in,
                                      int inOffset,
                                      int n)
Decompress an integer array using Simple16

Parameters:
out - the decompressed output
outOffset - the offset of the output in the number of integers
in - the compressed input array
inOffset - the offset of the input in the number of integers
n - the number of elements to be compressed
Returns:
the number of processed integers

s16DecompressWithIntBufferBackup

public static final int s16DecompressWithIntBufferBackup(int[] out,
                                                         int outOffset,
                                                         int value,
                                                         int n)

s16DecompressWithIntBuffer

public static final int s16DecompressWithIntBuffer(int[] out,
                                                   int outOffset,
                                                   int value,
                                                   int n)

s16DecompressWithIntBufferWithHardCodes

public static final int s16DecompressWithIntBufferWithHardCodes(int[] out,
                                                                int outOffset,
                                                                int value,
                                                                int n)

s16DecompressWithIntBufferIntegrated

public static final int s16DecompressWithIntBufferIntegrated(int[] out,
                                                             int outOffset,
                                                             int value,
                                                             int n,
                                                             int[] expPos,
                                                             int oribits)

s16DecompressWithIntBufferIntegrated2

public static final int s16DecompressWithIntBufferIntegrated2(int[] out,
                                                              int outOffset,
                                                              int value,
                                                              int n,
                                                              int[] expPos,
                                                              int oribits)

s16DecompressWithIntBufferIntegratedBackup

public static final int s16DecompressWithIntBufferIntegratedBackup(int[] out,
                                                                   int outOffset,
                                                                   int value,
                                                                   int n,
                                                                   int[] expPos,
                                                                   int oribits)

s16DecompressOneNumberWithHardCodes

public static int s16DecompressOneNumberWithHardCodes(int[] out,
                                                      int outOffset,
                                                      int value,
                                                      int numIdx)

s16DecompressOneNumberWithHardCodesIntegrated

public static int s16DecompressOneNumberWithHardCodesIntegrated(int[] out,
                                                                int outOffset,
                                                                int value,
                                                                int numIdx,
                                                                int oribits,
                                                                int[] expPos)


Copyright © 2013. All Rights Reserved.