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

java.lang.Object
  extended by fi.helsinki.cs.ohtu.mpeg2.video.IntraBlock
All Implemented Interfaces:
Block

public class IntraBlock
extends java.lang.Object
implements Block

Represents a block in an intra type macroblock.


Nested Class Summary
static class IntraBlock.ColourComponent
          The possible types of intra blocks.
static class IntraBlock.Predictors
          Encapsulates the predictors used in the encoding of intra blocks.
 
Field Summary
private  IntraBlock.ColourComponent cc
           
private  int[] coefficients
           
private  IntraBlock.Predictors predictors
           
private  VLC.IntraVLCFormat vlcFormat
           
 
Constructor Summary
IntraBlock(IntraBlock.ColourComponent cc, IntraBlock.Predictors predictors, int[] coefficients, VLC.IntraVLCFormat vlcFormat)
          Constructs a new IntraBlock with the given colour component, predictors, coefficients and intra VLC format.
 
Method Summary
 int[] getCoefficients()
          Returns the coefficients of this block.
 IntraBlock.ColourComponent getColourComponent()
          Returns the colour component selected for this block.
 IntraBlock.Predictors getPredictors()
          Returns the IntraBlock.Predictors instance this block uses.
 VLC.IntraVLCFormat getVLCFormat()
          Returns the intra VLC format of this block.
private  int selectDCSize(int differential)
           
 void setCoefficients(int[] coefficients)
          Sets the coefficients for this block.
 void setColourComponent(IntraBlock.ColourComponent cc)
          Sets this blocks colour component.
 void setPredictors(IntraBlock.Predictors predictors)
          Sets the IntraBlock.Predictors instance this block should use.
 void setVLCFormat(VLC.IntraVLCFormat vlcFormat)
          Sets this blocks intra VLC format.
 void writeTo(BitOutputStream stream)
          Writes the block to a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cc

private IntraBlock.ColourComponent cc

predictors

private IntraBlock.Predictors predictors

coefficients

private int[] coefficients

vlcFormat

private VLC.IntraVLCFormat vlcFormat
Constructor Detail

IntraBlock

public IntraBlock(IntraBlock.ColourComponent cc,
                  IntraBlock.Predictors predictors,
                  int[] coefficients,
                  VLC.IntraVLCFormat vlcFormat)
Constructs a new IntraBlock with the given colour component, predictors, coefficients and intra VLC format.

Parameters:
cc - The colour component to use.
predictors - The IntraBlock.Predictors to use. The instance should be the same for atleast all intra blocks to be written without a predictor reset.
coefficients - The coefficients to use. Must be an array of 64 elements.
vlcFormat - The intra VLC format for this block.
Method Detail

getColourComponent

public IntraBlock.ColourComponent getColourComponent()
Returns the colour component selected for this block.

Returns:
This block's colour component.

setColourComponent

public void setColourComponent(IntraBlock.ColourComponent cc)
Sets this blocks colour component.

Parameters:
cc - The new colour component to use.

getPredictors

public IntraBlock.Predictors getPredictors()
Returns the IntraBlock.Predictors instance this block uses.

Returns:
The block's predictors.

setPredictors

public void setPredictors(IntraBlock.Predictors predictors)
Sets the IntraBlock.Predictors instance this block should use.

Parameters:
predictors - The new predictors to use.

getCoefficients

public int[] getCoefficients()
Returns the coefficients of this block.

Returns:
This block's coefficients.

setCoefficients

public void setCoefficients(int[] coefficients)
Sets the coefficients for this block.

Parameters:
coefficients - The new coefficients. Must be 64 elements long.

getVLCFormat

public VLC.IntraVLCFormat getVLCFormat()
Returns the intra VLC format of this block.

Returns:
This block's intra VLC format.

setVLCFormat

public void setVLCFormat(VLC.IntraVLCFormat vlcFormat)
Sets this blocks intra VLC format.

Parameters:
vlcFormat - The intra VLC format to use.

writeTo

public void writeTo(BitOutputStream stream)
             throws java.io.IOException
Description copied from interface: Block
Writes the block to a stream.

Specified by:
writeTo in interface Block
Parameters:
stream - The stream to write to.
Throws:
java.io.IOException - Exception from the stream.

selectDCSize

private int selectDCSize(int differential)