TER.TERcoder.SegmentCoder
Class InitialCoding

java.lang.Object
  extended by TER.TERcoder.SegmentCoder.InitialCoding

public class InitialCoding
extends java.lang.Object

This class code the quantized DC components or the bitDepthAC_Block. Usage example:
  construct
  setParameters
  run
  get functions

Version:
1.0
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
(package private)  int bitDepthAC
          Definition in SegmentCode2D.bitDepthAC
(package private)  int bitDepthDC
          Definition in SegmentCode2D.bitDepthDC
(package private)  int blocksPerSegment
          This integer determines the number of blocks in the segment
(package private)  int BPLL
          For the residual subband indicates the number of bitplanes that are necessary zero
(package private)  boolean computeDistortion
           
(package private)  DistortionCompute distortion
          Definition in SegmentCode2D.distortion
(package private)  int gaggleSize
          Specifies the size of a gaggle for the coded values
(package private)  int id
          Specifies the frequency of appareance of id in the segment.
(package private)  boolean isDC
          Indicate if the valuesToCode are DC components (true) or not (false).
(package private)  int optSelect
          Specifies the method employed to select value of k parameters when coding the valuesToCode
(package private)  boolean parametersSet
          To know if parameters are set.
(package private)  int q
          This integer indicates the number of bitplanes quantized for DC components
(package private)  int[] valuesToCode
          This array contains the values to be encoded.
 
Constructor Summary
InitialCoding(int[] valuesToCode)
          Constructor that receives the values to be encoded.
 
Method Summary
 int[] doDPCMandMap(int xMin, int xMax)
          This function performs DPCM and maps obtained values into non-negative integers.
 BitStream[] entropyCode(int[] values, int N)
          This function entropy codes the given values according to the paramateres selected by the user.
 int getCodeOption(int[] values, int gaggle, int codeLength, int N)
          This funtion selects for each gaggle the number of bits that should be split in the entropy coder
 int getCodeOptionLength(int N)
          This funtion get the number of bits required to encode the code option for entropy.
 int getDinamicRange()
          Get the number of quantized bit planes for DC components.
 void quantizeDCs(int N)
          This function quantizes (and computes distortion if needed) the initial values.
 BitStream[] run()
          Run the initial coding of either DC components or bitDepthAC_Block
 void setDinamicRange()
          Set the quantization factor for initially DC coding.
 void setParameters(int bitDepthDC, int bitDepthAC, int optSelect, int gaggleSize, int id, int BPLL, boolean isDC, DistortionCompute distortion)
          Set the parameters used to perform the initial coding of DC or bitDepthACBlock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parametersSet

boolean parametersSet
To know if parameters are set.

True indicates that they are set otherwise false.


valuesToCode

int[] valuesToCode
This array contains the values to be encoded.


bitDepthAC

int bitDepthAC
Definition in SegmentCode2D.bitDepthAC


bitDepthDC

int bitDepthDC
Definition in SegmentCode2D.bitDepthDC


blocksPerSegment

int blocksPerSegment
This integer determines the number of blocks in the segment


optSelect

int optSelect
Specifies the method employed to select value of k parameters when coding the valuesToCode

Valid values are:


gaggleSize

int gaggleSize
Specifies the size of a gaggle for the coded values

Valid values are positive values.


id

int id
Specifies the frequency of appareance of id in the segment.

Valid values are positive values. 0 value means that only one id is used in the segment.


BPLL

int BPLL
For the residual subband indicates the number of bitplanes that are necessary zero

Negative values are not allowed.


isDC

boolean isDC
Indicate if the valuesToCode are DC components (true) or not (false).


distortion

DistortionCompute distortion
Definition in SegmentCode2D.distortion


q

int q
This integer indicates the number of bitplanes quantized for DC components


computeDistortion

boolean computeDistortion
Constructor Detail

InitialCoding

public InitialCoding(int[] valuesToCode)
Constructor that receives the values to be encoded.

Parameters:
valuesToCode - defintion in valuesToCode
Method Detail

setParameters

public void setParameters(int bitDepthDC,
                          int bitDepthAC,
                          int optSelect,
                          int gaggleSize,
                          int id,
                          int BPLL,
                          boolean isDC,
                          DistortionCompute distortion)
Set the parameters used to perform the initial coding of DC or bitDepthACBlock.

Parameters:
bitDepthDC - SegmentCode2D.bitDepthDC
bitDepthAC - SegmentCode2D.bitDepthAC
optSelect - optSelect
gaggleSize - gaggleSize
id - id
BPLL - BPLL
isDC - isDC
distortion - distortion

run

public BitStream[] run()
                throws java.lang.Exception
Run the initial coding of either DC components or bitDepthAC_Block

Returns:
a bit stream array containing the values coded according to the parameters set.
Throws:
ErrorException - when something goes wrong, for example parameters are not set, and compression must be stopped.
java.lang.Exception

entropyCode

public BitStream[] entropyCode(int[] values,
                               int N)
This function entropy codes the given values according to the paramateres selected by the user.

Parameters:
values - array containing the values to be entropy coded.
N - number of bits needed to represent the values.
Returns:
an array of bit streams which return the values entropy coded.

getCodeOption

public int getCodeOption(int[] values,
                         int gaggle,
                         int codeLength,
                         int N)
This funtion selects for each gaggle the number of bits that should be split in the entropy coder

Parameters:
values - array containing the values to be entropy encoded.
gaggle - indicates the gaggle that is going to be encoded.
codeLength - indicates the length of the code (i.e. the number of bits needed to represent the code option).
N - number of bits needed to represent the values.
Returns:
an integer that represents the option to be taken for the entropy coder

getCodeOptionLength

public int getCodeOptionLength(int N)
This funtion get the number of bits required to encode the code option for entropy.

Parameters:
N - number of bits needed to represent the values.
Returns:
which represent the number of bits needed to represent the code option.

doDPCMandMap

public int[] doDPCMandMap(int xMin,
                          int xMax)
This function performs DPCM and maps obtained values into non-negative integers.

Parameters:
xMin - reprensents the minimum value that could be taken by the input values.
xMax - reprensents the maximum value that could be taken by the input values.
Returns:
an integer array containing the DPCM and mapped values.

quantizeDCs

public void quantizeDCs(int N)
This function quantizes (and computes distortion if needed) the initial values.

Parameters:
N - number of bits to required to represent quantized DCs in two's-complement

setDinamicRange

public void setDinamicRange()
Set the quantization factor for initially DC coding.


getDinamicRange

public int getDinamicRange()
Get the number of quantized bit planes for DC components.



TER - Copyright (C) 2006
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) - UAB (Spain)