fi.helsinki.cs.ohtu.mpeg2.video
Class PictureCodingExtensionHeader

java.lang.Object
  extended by fi.helsinki.cs.ohtu.mpeg2.video.PictureCodingExtensionHeader

public class PictureCodingExtensionHeader
extends java.lang.Object

Represents the picture coding extension header. This header augments the picture coding type from PictureHeader with a lot of additional fields not relevant to MPEG-1. In MPEG-2 usage, this will always follow a PictureHeader.


Nested Class Summary
static class PictureCodingExtensionHeader.Flag
          Represents the different non-frame-structure flags possibly specified by this header.
static class PictureCodingExtensionHeader.FrameStructure
          Represents the allowed combinations of values for the picture structure, top field first, repeat first field and progressive frame fields.
 
Field Summary
(package private)  boolean composite
           
(package private)  UnsignedIntegerField[] fCodes
           
(package private)  java.util.EnumSet<PictureCodingExtensionHeader.Flag> flags
           
(package private)  PictureCodingExtensionHeader.FrameStructure frameStructure
           
(package private)  UnsignedIntegerField intraDCPrecision
           
 
Constructor Summary
PictureCodingExtensionHeader(int[] fCodes, int intraDCPrecision, PictureCodingExtensionHeader.FrameStructure frameStructure, java.util.EnumSet<PictureCodingExtensionHeader.Flag> flags)
          Constructs a new instance.
 
Method Summary
 int[] getFCodes()
          Gets the F codes.
 java.util.EnumSet<PictureCodingExtensionHeader.Flag> getFlags()
          Gets the non-frame-structure-essential flags.
 PictureCodingExtensionHeader.FrameStructure getFrameStructure()
          Gets the frame structure.
 int getIntraDCPrecision()
          Gets the intra DC precision.
 void setFCodes(int[] newFCodes)
          Sets the F codes.
 void setFlags(java.util.EnumSet<PictureCodingExtensionHeader.Flag> flags)
          Sets the non-frame-structure-essential flags.
 void setFrameStructure(PictureCodingExtensionHeader.FrameStructure frameStructure)
          Sets the frame structure.
 void setIntraDCPrecision(int precision)
          Sets the intra DC precision.
 void writeTo(BitOutputStream stream)
          Writes the header to a bit stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fCodes

UnsignedIntegerField[] fCodes

intraDCPrecision

UnsignedIntegerField intraDCPrecision

frameStructure

PictureCodingExtensionHeader.FrameStructure frameStructure

flags

java.util.EnumSet<PictureCodingExtensionHeader.Flag> flags

composite

boolean composite
Constructor Detail

PictureCodingExtensionHeader

public PictureCodingExtensionHeader(int[] fCodes,
                                    int intraDCPrecision,
                                    PictureCodingExtensionHeader.FrameStructure frameStructure,
                                    java.util.EnumSet<PictureCodingExtensionHeader.Flag> flags)
Constructs a new instance.

Parameters:
fCodes - The initial F codes. Same constraints as in setFCodes() apply.
intraDCPrecision - The initial intra DC precision. Same constraints as in setIntraDCPrecision() apply.
frameStructure - The initial frame structure.
flags - The initial non-frame-structure-essential flags.
Method Detail

getFCodes

public int[] getFCodes()
Gets the F codes. The returned table will have four elements, the first of which will be the forward horizontal F code. This is followed by the forward vertical F code, the backward horizontal F code and the backward vertical F code.

Returns:
The codes.

setFCodes

public void setFCodes(int[] newFCodes)
Sets the F codes. The code table should have four elements, the first of which will be the forward horizontal F code. This must be followed by the forward vertical F code, the backward horizontal F code and the backward vertical F code.

Parameters:
newFCodes - The new codes.

getIntraDCPrecision

public int getIntraDCPrecision()
Gets the intra DC precision.

Returns:
The precision, in bits. Will be in range [8..11].

setIntraDCPrecision

public void setIntraDCPrecision(int precision)
Sets the intra DC precision.

Parameters:
precision - The new precision, in bits. Must be in range [8..11].

getFrameStructure

public PictureCodingExtensionHeader.FrameStructure getFrameStructure()
Gets the frame structure.

Returns:
The structure.

setFrameStructure

public void setFrameStructure(PictureCodingExtensionHeader.FrameStructure frameStructure)
Sets the frame structure.

Parameters:
frameStructure - The new structure.

getFlags

public java.util.EnumSet<PictureCodingExtensionHeader.Flag> getFlags()
Gets the non-frame-structure-essential flags.

Returns:
The flags.

setFlags

public void setFlags(java.util.EnumSet<PictureCodingExtensionHeader.Flag> flags)
Sets the non-frame-structure-essential flags.

Parameters:
flags - The new flags.

writeTo

public void writeTo(BitOutputStream stream)
             throws java.io.IOException
Writes the header to a bit stream.

Parameters:
stream - The stream to write to.
Throws:
java.io.IOException - Propagated from the stream write.