|
||||||||||
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.ArithmeticCodec
public class ArithmeticCodec
Arithmetic codec.
Nested Class Summary | |
---|---|
protected static class |
ArithmeticCodec.OpenState
Codec state: closed/input/output. |
Field Summary | |
---|---|
protected static java.lang.String |
CATEGORY
Object category. |
static java.lang.String |
DECIMATION_LIMIT
|
protected int |
decimationLimit
Actual decimation limit. |
protected int |
defaultCtx
Default context Id. |
protected int |
defaultMaxSymbol
Default alphabet size (for new context creation). |
protected long |
follow
Number of center-doublings (unknown bits to write later). |
protected long |
h
Arithmetic encoder/decoder range and value. |
protected EntropyHistogram |
hist
EntropyHistogram to manage contexts. |
protected int |
increment
Increment of frequency for every encoded symbol. |
static java.lang.String |
INCREMENT
|
protected long |
l
Arithmetic encoder/decoder range and value. |
protected static int |
MAX_DECIMATION_LIMIT
Maximal decimation limit for entropy histograms. |
protected long |
position
Actual position in the original (logical) stream in symbols. |
protected long |
rawBits
Actual position in the coded stream in bits. |
static RegPiece |
reg
Static registration instance for this class. |
protected ArithmeticCodec.OpenState |
state
Actual codec state. |
protected boolean |
statistics
Print summary statistics at the end of encoding? |
protected BitStream |
stream
Associated I/O stream. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
protected long |
v
Arithmetic encoder/decoder range and value. |
protected static long |
VAL_1_2
One half of the maximal interval. |
protected static long |
VAL_1_4
One quarter of the maximal interval. |
protected static long |
VAL_3_4
Three quarters of the maximal interval. |
protected static int |
VAL_BITS
Number of bits for maximum value in interval arithmetic. |
protected static long |
VAL_MAX
Maximum working arithmetic value. |
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 | |
---|---|
ArithmeticCodec()
|
Method Summary | |
---|---|
boolean |
available()
Are they any input symbols (bits) available? |
void |
close()
Codec close. |
long |
compressed()
Actual codec compressed position in bits (total amount in all contexts). |
void |
flush()
Codec flush. |
int |
get()
Decodes one symbol (using the current context). |
java.lang.Object |
get(java.lang.String key)
Gets the given property. |
int |
get(WheelOfFortune wheel)
Decodes one subinterval from the given WheelOfFortune . |
long |
getBits(int length)
Reads the given amount of "raw" bits (by-passes the entropy decoder). |
int |
getMaxSymbol()
Retrieves maximal symbol value for the actual context. |
void |
open(boolean output,
int ctx)
Codec initialization. |
long |
position()
Actual codec external position in symbols (total amount in all contexts). |
void |
put(int s)
Encodes the given symbol (in the current context). |
void |
put(WheelOfFortune wheel,
int s)
Encodes one subinterval from the given WheelOfFortune . |
void |
putBits(long bits,
int length)
Writes the given "raw" bits (by-passes the entropy encoder). |
void |
set(java.lang.String key,
java.lang.Object value)
Sets the given property. |
int |
setContext(int ctx)
Sets the given context as current. |
void |
setMaxSymbol(int maxSymbol)
Sets maximal symbol value for the actual context and all subsequently created ones. |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
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 ArithmeticCodec.OpenState state
protected BitStream stream
null
if the codec is not opened.
protected EntropyHistogram hist
protected long position
protected long rawBits
protected int defaultMaxSymbol
protected int defaultCtx
protected int increment
protected int decimationLimit
protected static final int MAX_DECIMATION_LIMIT
protected static final int VAL_BITS
VAL_MAX
* decimationLimit
must not overflow!
protected static final long VAL_1_4
protected static final long VAL_1_2
protected static final long VAL_3_4
protected static final long VAL_MAX
protected long follow
protected long l
protected long h
protected long v
protected boolean statistics
public static final java.lang.String INCREMENT
public static final java.lang.String DECIMATION_LIMIT
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public ArithmeticCodec()
Method Detail |
---|
public void flush() throws java.io.IOException
EntropyCodec
flush
in interface EntropyCodec
java.io.IOException
EntropyCodec.open(boolean, int)
,
EntropyCodec.close()
public void put(int s) throws java.io.IOException
put
in interface EntropyCodec
s
- Symbol to encode.
java.io.IOException
putBits(long, int)
,
get()
public void put(WheelOfFortune wheel, int s) throws java.io.IOException
WheelOfFortune
.
Doesn't use contexts and assigned histograms..
put
in interface EntropyCodec
wheel
- Set of intervals (wheel of fortune).s
- Index of an interval to encode.
java.io.IOException
public void putBits(long bits, int length) throws java.io.IOException
putBits
in interface EntropyCodec
bits
- Bits to be written ("MSB first" order).length
- Number of bits to write.
java.io.IOException
put(int)
,
getBits(int)
public int get() throws java.io.IOException
get
in interface EntropyCodec
-1
if no symbol is available).
java.io.IOException
getBits(int)
,
put(int)
,
available()
public int get(WheelOfFortune wheel) throws java.io.IOException
WheelOfFortune
.
Doesn't use contexts and assigned histograms..
get
in interface EntropyCodec
wheel
- Set of intervals (wheel of fortune).
java.io.IOException
public long getBits(int length) throws java.io.IOException
getBits
in interface EntropyCodec
length
- Number of bits to read.
-1
if no bits are available).
java.io.IOException
get()
,
putBits(long, int)
,
available()
public void open(boolean output, int ctx) throws java.io.IOException
EntropyCodec
open
in interface EntropyCodec
output
- Open for output?ctx
- Initial context.
java.io.IOException
BitStream
,
EntropyCodec.setContext(int)
public void close() throws java.io.IOException
EntropyCodec
close
in interface EntropyCodec
java.io.IOException
EntropyCodec.open(boolean, int)
,
EntropyCodec.flush()
public int setContext(int ctx) throws java.io.IOException
EntropyCodec
setContext
in interface EntropyCodec
ctx
- Id of the new context.
java.io.IOException
public int getMaxSymbol()
EntropyCodec
getMaxSymbol
in interface EntropyCodec
public void setMaxSymbol(int maxSymbol)
EntropyCodec
EntropyCodec.open(boolean, int)
!
setMaxSymbol
in interface EntropyCodec
maxSymbol
- New maximal symbol value.public long position() throws java.io.IOException
EntropyCodec
position
in interface EntropyCodec
java.io.IOException
EntropyCodec.compressed()
public long compressed() throws java.io.IOException
EntropyCodec
compressed
in interface EntropyCodec
java.io.IOException
EntropyCodec.position()
public boolean available() throws java.io.IOException
EntropyCodec
available
in interface EntropyCodec
java.io.IOException
EntropyCodec.position()
,
EntropyCodec.compressed()
public void set(java.lang.String key, java.lang.Object value)
set
in interface Property
set
in class DefaultProperty
key
- Key string.value
- The new value.Property.commit()
public java.lang.Object get(java.lang.String key)
get
in interface Property
get
in class DefaultProperty
key
- 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 |