|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.piece.ZigZagCodec
public class ZigZagCodec
Zig-zag block coding. Used as back-end in block transform compression methods of raster 2D data.
| Field Summary | |
|---|---|
protected static java.lang.String |
CATEGORY
Object category. |
protected EntropyCodec |
codec
Actual entropy codec (accelerator). |
protected static int |
CTX_SKIP
Context number for zero-skipping. |
protected static int |
CTX_VALUE
Context number for non-zero values encoding. |
protected int |
height
Actual block height in samples. |
protected java.lang.StringBuffer |
logSb
StringBuffer for logging purposes. |
static RegPiece |
reg
Static registration instance for this class. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
protected int |
variant
Actual codec variant (not used yet). |
protected int |
width
Actual block width in samples. |
| Fields inherited from class cz.cuni.jagrlib.Piece |
|---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
| Fields inherited from interface cz.cuni.jagrlib.iface.Property |
|---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
| Constructor Summary | |
|---|---|
ZigZagCodec()
|
|
| Method Summary | |
|---|---|
int |
decode(int[] data,
int[][] predict)
Block decoding. |
void |
encode(int[] data,
int[][] predict)
Block coding. |
protected int |
findNonzero(int[] data,
int[] pos)
Finds next non-zero number, alters pos, returns CTX_SKIP-encoded value. |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
void |
init()
Prepares the underlying EntropyCodec. |
boolean |
loadData(byte[] data)
Loads instance parameters from (previously stored) binary data. |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
void |
setBlockSize(int width,
int height)
Sets actual block size. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
int |
setVariant(int variant)
Set actual codec variant (context). |
protected boolean |
step(int[] pos)
Performs one step, returns true if succeeded. |
protected boolean |
step(int[] pos,
int size)
Performs step of the given size, returns true if succeeded. |
byte[] |
storeData()
Pack instance parameters into binary format. |
| Methods inherited from class cz.cuni.jagrlib.Piece |
|---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
| Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
|---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, stringProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface cz.cuni.jagrlib.iface.Property |
|---|
commit |
| Field Detail |
|---|
protected int variant
protected int width
protected int height
protected EntropyCodec codec
protected java.lang.StringBuffer logSb
StringBuffer for logging purposes.
Property.LOGGINGprotected static final int CTX_VALUE
protected static final int CTX_SKIP
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
| Constructor Detail |
|---|
public ZigZagCodec()
| Method Detail |
|---|
protected final boolean step(int[] pos)
true if succeeded.
protected final boolean step(int[] pos,
int size)
true if succeeded.
protected final int findNonzero(int[] data,
int[] pos)
CTX_SKIP-encoded value.
public void init()
throws java.io.IOException
EntropyCodec.
Should be called before any of encode(int[], int[][])s or decode(int[], int[][])s.
init in interface BlockCodecjava.io.IOExceptionpublic int setVariant(int variant)
EntropyCodec too.
setVariant in interface BlockCodecvariant - Variant number (from 0).
setBlockSize(int, int)
public void setBlockSize(int width,
int height)
throws java.io.IOException
setBlockSize in interface BlockCodecwidth - Horizontal block size (1D block size).height - Vertical block size (1 for 1D).
java.io.IOExceptionsetVariant(int)
public void encode(int[] data,
int[][] predict)
throws java.io.IOException
EntropyCodec input.
Connected EntropyCodec module will be feeded by them.
encode in interface BlockCodecdata - 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.
java.io.IOExceptiondecode(int[], int[][])
public int decode(int[] data,
int[][] predict)
throws java.io.IOException
EntropyCodec and converts them back into
given integer matrix.
decode in interface BlockCodecdata - 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.
java.io.IOExceptionencode(int[], int[][])public byte[] storeData()
storeData in interface PersistentParamsBinarynull.
The array can be shared by all method calls.loadData(byte[])public boolean loadData(byte[] data)
loadData in interface PersistentParamsBinarydata - Binary data to be interpreted. Can be null.
true if successful.storeData()
public void set(java.lang.String key,
java.lang.Object value)
set in interface Propertyset in class DefaultPropertykey - Key string.value - The new value.Property.commit()public java.lang.Object get(java.lang.String key)
get in interface Propertyget in class DefaultPropertykey - Key string.
null.
public static int setTemplate(Template t,
int ord)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||