cz.cuni.jagrlib.iface
Interface BlockCodec

All Superinterfaces:
PersistentParamsBinary, Property
All Known Implementing Classes:
ZigZagCodec

public interface BlockCodec
extends Property, PersistentParamsBinary

Codec for integer block data. In coding mode external EntropyCodec module is feeded by linearized data.
In decoding mode input is read from EntropyCodec and converted back to integer matrix.

Since:
0.24
See Also:
BlockCodec.java

Field Summary
 
Fields inherited from interface cz.cuni.jagrlib.iface.Property
LOGGING, STATISTICS, TEXT_DESCRIPTION
 
Method Summary
 int decode(int[] data, int[][] predict)
          Block decoding.
 void encode(int[] data, int[][] predict)
          Block coding.
 void init()
          Prepares the underlying EntropyCodec.
 void setBlockSize(int width, int height)
          Sets actual block size.
 int setVariant(int variant)
          Set actual codec variant (context).
 
Methods inherited from interface cz.cuni.jagrlib.iface.Property
commit, get, set
 
Methods inherited from interface cz.cuni.jagrlib.iface.PersistentParamsBinary
loadData, storeData
 

Method Detail

init

void init()
          throws java.io.IOException
Prepares the underlying EntropyCodec. Should be called before any of encode(int[], int[][])s or decode(int[], int[][])s.

Throws:
java.io.IOException

setVariant

int setVariant(int variant)
Set actual codec variant (context). Should set mode of the underlying EntropyCodec too.

Parameters:
variant - Variant number (from 0).
Returns:
Old variant number.
See Also:
setBlockSize(int, int)

setBlockSize

void setBlockSize(int width,
                  int height)
                  throws java.io.IOException
Sets actual block size. Can be used both for 1D and 2D quantization.

Parameters:
width - Horizontal block size (1D block size).
height - Vertical block size (1 for 1D).
Throws:
java.io.IOException
See Also:
setVariant(int)

encode

void encode(int[] data,
            int[][] predict)
            throws java.io.IOException
Block coding. Converts matrix of integer data to EntropyCodec input. Connected EntropyCodec module will be feeded by them.

Parameters:
data - Source data to be encoded.
predict - Pre-allocated array used for predicition passing. predict[1] will be used as source, predict[0] is filled with prediction for the next block[s]. Can be null.
Throws:
java.io.IOException
See Also:
decode(int[], int[][])

decode

int decode(int[] data,
           int[][] predict)
           throws java.io.IOException
Block decoding. Reads input from underlying EntropyCodec and converts them back into given integer matrix.

Parameters:
data - Target data array (pre-allocated to sufficient size).
predict - Pre-allocated array used for predicition passing. predict[1] will be used as source, predict[0] is filled with prediction for the next block[s]. Can be null.
Returns:
Number of decoded array items (should be with * height if successful).
Throws:
java.io.IOException
See Also:
encode(int[], int[][])