|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.helsinki.cs.ohtu.mpeg2.video.MacroblockHeader
public class MacroblockHeader
Represents the continuous purely header fields in a MPEG-2 macroblock. The class intentionally contains very little logic, as the actual value for most of the fields is best derived with knowledge of the actual macroblock data (presence and type of motion vectors foremost). Therefore, the logic is best placed in the layer which also contains the data (unlike this pure header).
Field Summary | |
---|---|
private int |
addressIncrement
|
private java.lang.Boolean |
dctType
|
private java.lang.Integer |
motionType
|
private UnsignedIntegerField |
quantizerScaleCode
|
Constructor Summary | |
---|---|
MacroblockHeader()
Constructs a macroblock header instance. |
Method Summary | |
---|---|
int |
getAddressIncrement()
Gets the address increment. |
int |
getMotionType()
Returns the specified motion type. |
int |
getQuantizerScaleCode()
Gets the specified override quantizer scale code. |
boolean |
hasDCTType()
Determines if the type of DCT used is specified. |
boolean |
hasMotionType()
Determines if the macroblock specifies a motion type. |
boolean |
hasQuantizerScaleCode()
Determines if the macroblock specifies an override quantizer scale code. |
boolean |
isDCTTypeField()
Determines if the specified DCT type is field-based. |
boolean |
isDCTTypeFrame()
Determines if the specified DCT type is frame-based. |
void |
setAddressIncrement(int addressIncrement)
Sets the address increment. |
void |
setDCTTypeField()
Sets the macroblock to specify a field-based DCT type. |
void |
setDCTTypeFrame()
Sets the macroblock to specify a frame-based DCT type. |
void |
setMotionType(int motionType)
Sets the macroblock to specify a given (field or frame) motion type. |
void |
setQuantizerScaleCode(int quantizerScaleCode)
Sets the macroblock to specify an override quantizer scale code. |
void |
unsetDCTType()
Unsets any DCT type specification previously set by setDCTTypeField() and/or setDCTTypeFrame(). |
void |
unsetMotionType()
Unsets any motion type previously set by setMotionType(). |
void |
unsetQuantizerScaleCode()
Unsets any override quantizer scale code previously set by setQuantizerScaleCode(). |
void |
writeTo(BitOutputStream stream,
int[] type)
Writes the header to a bit-by-bit output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int addressIncrement
private java.lang.Integer motionType
private java.lang.Boolean dctType
private UnsignedIntegerField quantizerScaleCode
Constructor Detail |
---|
public MacroblockHeader()
Method Detail |
---|
public int getAddressIncrement()
public void setAddressIncrement(int addressIncrement)
addressIncrement
- The increment to set. Must be positive.public boolean hasMotionType()
true
if a motion type is specified, false
if not.public int getMotionType()
public void setMotionType(int motionType)
motionType
- The encoded value of the motion type to specify. Must be in {1, 2, 3}.public void unsetMotionType()
public boolean hasDCTType()
true
if a dct type is specified, false
if not.public boolean isDCTTypeField()
true
if field-based, false
if frame-based.public boolean isDCTTypeFrame()
true
if frame-based, false
if field-based.public void setDCTTypeField()
public void setDCTTypeFrame()
public void unsetDCTType()
public boolean hasQuantizerScaleCode()
true
if a scale code is specified, false
if not.public int getQuantizerScaleCode()
public void setQuantizerScaleCode(int quantizerScaleCode)
quantizerScaleCode
- The scale code to set. Must fit into 5 bits as an unsigned integer.public void unsetQuantizerScaleCode()
public void writeTo(BitOutputStream stream, int[] type) throws java.io.IOException
stream
- the stream to write to.type
- The macroblock type VLC code. Should be derived from the actual macroblock contents by the macroblock
high-level logic at the time of writing (depending on both the header fields and the actual macroblock data
contents). For example, a VLC code implying backwards motion should only be supplied if there actually is a
backwards motion vector.
java.io.IOException
- Propagated from the stream write.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |