public final class FastArithmeticCoder extends Object implements FastArithmeticCoderI
(MG4J).| Modifier and Type | Field and Description |
|---|---|
static int |
BITS
Number of bits used by the coder.
|
| Constructor and Description |
|---|
FastArithmeticCoder(int n)
Creates a new coder.
|
| Modifier and Type | Method and Description |
|---|---|
int |
encode(int x,
it.unimi.dsi.io.OutputBitStream obs)
Encodes a symbol.
|
int |
flush(it.unimi.dsi.io.OutputBitStream obs)
Flushes the last bits.
|
void |
reset() |
public static final int BITS
public FastArithmeticCoder(int n)
n - number of symbols used by the coder.public void reset()
reset in interface FastArithmeticCoderIpublic int encode(int x,
it.unimi.dsi.io.OutputBitStream obs)
throws IOException
encode in interface FastArithmeticCoderIx - a bit.obs - the output stream.IOException - if obs does.public int flush(it.unimi.dsi.io.OutputBitStream obs)
throws IOException
This method must be called when coding is over. It guarantees that enough bits are output to make the decoding of the last symbol nonambiguous, whichever bits follow in the stream.
flush in interface FastArithmeticCoderIobs - the output stream.IOException - if obs does.Copyright © 2018 Campagne Laboratory. All rights reserved.