|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.helsinki.cs.ohtu.mpeg2.video.VLC
public class VLC
VLC contains methods for writing to a BitOutputStream
the various
variable length codes used in MPEG-2 encoding.
Nested Class Summary | |
---|---|
static class |
VLC.DCTCoefficientTable
These are the two variable length code tables used for coding DCT coefficients. |
static class |
VLC.IntraVLCFormat
These are the two intra VLC format options. |
Field Summary | |
---|---|
private BitOutputStream |
output
|
Constructor Summary | |
---|---|
VLC(BitOutputStream bitStream)
Class constructor. |
Method Summary | |
---|---|
private int |
abs(int a)
|
VLC.DCTCoefficientTable |
getIntraTable(VLC.IntraVLCFormat format)
Returns the variable length code table to use for intra blocks. |
VLC.DCTCoefficientTable |
getNonIntraTable()
Returns the variable length code table to use for non intra blocks. |
BitOutputStream |
getStream()
Gets the underlying stream the variable length codes are written to. |
void |
setStream(BitOutputStream stream)
Sets the stream the variable length codes are written to. |
void |
writeCodedBlockPattern(boolean[] coded)
Writes the coded block pattern variable length code to the stream. |
void |
writeDCTCoefficient(int run,
int level,
VLC.DCTCoefficientTable tableToUse,
boolean dcCoefficient)
Writes a single variable length code for a given run and level. |
private void |
writeDCTCoefficientTableOne(int run,
int level)
|
private void |
writeDCTCoefficientTableZero(int run,
int level,
boolean dcCoefficient)
|
void |
writeDCTDcSizeChrominance(int dcSize)
Writes the variable length code for a given size of a DC coefficient (in an intra block). |
void |
writeDCTDcSizeLuminance(int dcSize)
Writes the variable length code for a given size of a DC coefficient (in an intra block). |
void |
writeDCTEndOfBlock(VLC.DCTCoefficientTable tableToUse)
|
private void |
writeEscapedDCTCoefficient(int run,
int level)
|
void |
writeMacroblockAddressIncrement(int addressIncrement)
Writes the variable length code of the given macroblock address increment to the stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private BitOutputStream output
Constructor Detail |
---|
public VLC(BitOutputStream bitStream)
bitStream
- The stream to write the variable length codes toMethod Detail |
---|
public BitOutputStream getStream()
public void setStream(BitOutputStream stream)
stream
- The new stream to write to.public void writeMacroblockAddressIncrement(int addressIncrement) throws java.io.IOException
addressIncrement
- The macroblock address increment to write. Must be greater
than zero.
java.io.IOException
- Exception from the underlying streampublic void writeCodedBlockPattern(boolean[] coded) throws java.io.IOException
Writes the coded block pattern variable length code to the stream. The order of the blocks is as follows:
Y:0 | 1 |
2 | 3 |
4 |
5 |
coded
- Indicates whether a given block is to be marked as coded. If
coded[i], where i is a the number of the block, equals true
then that block is coded in its macroblock.
java.io.IOException
- Exception from the underlying streampublic void writeDCTDcSizeLuminance(int dcSize) throws java.io.IOException
dcSize
- Must be in range [0,11]
java.io.IOException
- Exception from the underlying streampublic void writeDCTDcSizeChrominance(int dcSize) throws java.io.IOException
dcSize
- Must be in range [0,11]
java.io.IOException
- Exception from the underlying streampublic VLC.DCTCoefficientTable getIntraTable(VLC.IntraVLCFormat format)
format
- The intra VLC format to be used.
public VLC.DCTCoefficientTable getNonIntraTable()
public void writeDCTCoefficient(int run, int level, VLC.DCTCoefficientTable tableToUse, boolean dcCoefficient) throws java.io.IOException
run
- The number of zeros preceding the non-zero coefficient. Must
be in range [0,63].level
- The level of the non-zero coefficient. Must be in range
[-2047,2047] and shall not be zero.tableToUse
- The variable length code table to use.dcCoefficient
- Whether the coefficient to be written is the DC coefficient of
the block.
java.io.IOException
- Exception from the underlying streampublic void writeDCTEndOfBlock(VLC.DCTCoefficientTable tableToUse) throws java.io.IOException
java.io.IOException
private void writeDCTCoefficientTableZero(int run, int level, boolean dcCoefficient) throws java.io.IOException
java.io.IOException
private void writeDCTCoefficientTableOne(int run, int level) throws java.io.IOException
java.io.IOException
private int abs(int a)
private void writeEscapedDCTCoefficient(int run, int level) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |