TER.TERcoder.WriteFile
Class WriteSegments

java.lang.Object
  extended by TER.TERcoder.WriteFile.WriteSegments

public class WriteSegments
extends java.lang.Object

This class writes the encoded segments into a file. Usage example:
  construct
  setParameters
  run

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

Field Summary
(package private)  int[] adjustHeaderParameters
          Indicates if parameters in the header must be re-definied in order to improve compression performance.
(package private)  int[] bitDepthAC
          Defintion in SegmentCode2D.bitDepthAC
(package private)  int[] bitDepthDC
          Defintion in SegmentCode2D.bitDepthDC
(package private)  int[] bitPlaneStop
          Defintion in SegmentCode2D.bitPlaneStop
(package private)  int[] blocksPerSegment
          Defintion in SegmentCode2D.blocksPerSegment
(package private)  BitStream[][] codedBitDepthACBlock
          This array stores for each segment and gaggle the encoded bit depth of AC components of each block
(package private)  int[] codeWordLength
          Indicates the coded word length for each segment
(package private)  float[][] customWeight
          Defintion in ForwardWeighting.customWeight
(package private)  int[] customWtFlag
          Defintion in ForwardWeighting.customWtFlag
(package private)  int[] DCStop
          Defintion in SegmentCode2D.DCStop
(package private)  java.io.RandomAccessFile fOut
           
(package private)  BitStream[][] initialCodedDC
          This array stores for each segment and gaggle the initial coding of DC quantized components
(package private)  int[] optACSelect
          Definition in SegmentCode2D.optACSelect
(package private)  int[] optDCSelect
          Definition in SegmentCode2D.optDCSelect
protected  java.lang.String outFile
          Definition in Coder.outFile
(package private)  int[] padRows
          Defintion in ImageExtension.padRows
(package private)  boolean parametersSet
          To know if parameters are set.
(package private)  int[] part2Flag
          Indicates for each segment the presence of Part 2 header
(package private)  int[] part3Flag
          Indicates for each segment the presence of Part 3 header
(package private)  int[] part4Flag
          Indicates for each segment the presence of Part 4 header
(package private)  int[] pixelBitDepth
          Defintion in Coder.pixelBitDepth
(package private)  int[] progressionOrder
          This integer indicates the progression order for each encoded segment.
(package private)  BitStream[][][][][] refinementAC
          This array stores for each segment, gaggle, bitplane, block and resolution level the refinement of AC components refinementAC[segment][gaggle][bitPlane][block][resolutionLevel]
(package private)  BitStream[][][] refinementDC
          This array stores for each segment, gaggle and bitplane the refinement of DC components
(package private)  int[] resolutionLevels
          Definition in SegmentCode2D.resolutionLevels
(package private)  int[] segByteLimit
          Defintion in SegmentCode2D.segByteLimit
(package private)  int[] signedPixels
          Defintion in Coder.signedPixels
(package private)  BitStream[][][][] sortingAC
          This array stores for each segment, gaggle, bitplane and resolution level the encoded significance of AC components of the segment sortingAC[segment][gaggle][bitPlane][resolutionLevel]
(package private)  int[] stageStop
          Defintion in SegmentCode2D.stageStop
(package private)  int[] transposeImg
          Defintion in TransposeImage.transposeImg
(package private)  int[] truncationPoints
          Defintion in InterleaveSegment.truncationPoints
(package private)  int[] useFill
          Indicates for each segment whether fill bits will be used to produce segByteLimit bytes in a segment
(package private)  int[] WTType
          Defintion in ForwardWaveletTransform.WTTypes
(package private)  int xOriginalSize
          Image width.
 
Constructor Summary
WriteSegments()
          Constructor of WriteSegments
 
Method Summary
private  void adjustHeaderFlags(int segmentId)
          In case that some parameters must be redefined, here we asure that the parts of the header containing such parameters will be included.
 void run()
          Creates the encoded file according with the progression given by the user
 void setParameters(java.lang.String outFile, BitStream[][] initialCodedDC, BitStream[][] codedBitDepthACBlock, BitStream[][][] refinementDC, BitStream[][][][] sortingAC, BitStream[][][][][] refinementAC, int[] resolutionLevels, int[] progressionOrder, int[] truncationPoints, int[] adjustHeaderParameters, int[] bitDepthDC, int[] bitDepthAC, int[] part2Flag, int[] part3Flag, int[] part4Flag, int[] padRows, int[] segByteLimit, int[] DCStop, int[] bitPlaneStop, int[] stageStop, int[] useFill, int[] blocksPerSegment, int[] optDCSelect, int[] optACSelect, int[] WTType, int[] signedPixels, int[] pixelBitDepth, int xOriginalSize, int[] transposeImg, int[] codeWordLength, int[] customWtFlag, float[][] customWeight)
          Set the parameters required to create the encoded file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialCodedDC

BitStream[][] initialCodedDC
This array stores for each segment and gaggle the initial coding of DC quantized components


codedBitDepthACBlock

BitStream[][] codedBitDepthACBlock
This array stores for each segment and gaggle the encoded bit depth of AC components of each block


refinementDC

BitStream[][][] refinementDC
This array stores for each segment, gaggle and bitplane the refinement of DC components


sortingAC

BitStream[][][][] sortingAC
This array stores for each segment, gaggle, bitplane and resolution level the encoded significance of AC components of the segment sortingAC[segment][gaggle][bitPlane][resolutionLevel]


refinementAC

BitStream[][][][][] refinementAC
This array stores for each segment, gaggle, bitplane, block and resolution level the refinement of AC components refinementAC[segment][gaggle][bitPlane][block][resolutionLevel]


resolutionLevels

int[] resolutionLevels
Definition in SegmentCode2D.resolutionLevels


progressionOrder

int[] progressionOrder
This integer indicates the progression order for each encoded segment.

Valid values are:


parametersSet

boolean parametersSet
To know if parameters are set.

True indicates that they are set otherwise false.


outFile

protected java.lang.String outFile
Definition in Coder.outFile


truncationPoints

int[] truncationPoints
Defintion in InterleaveSegment.truncationPoints


adjustHeaderParameters

int[] adjustHeaderParameters
Indicates if parameters in the header must be re-definied in order to improve compression performance.

Valid values are:


bitDepthDC

int[] bitDepthDC
Defintion in SegmentCode2D.bitDepthDC


bitDepthAC

int[] bitDepthAC
Defintion in SegmentCode2D.bitDepthAC


part2Flag

int[] part2Flag
Indicates for each segment the presence of Part 2 header

Valid values are:


part3Flag

int[] part3Flag
Indicates for each segment the presence of Part 3 header

Valid values are:


part4Flag

int[] part4Flag
Indicates for each segment the presence of Part 4 header

Valid values are:


padRows

int[] padRows
Defintion in ImageExtension.padRows


segByteLimit

int[] segByteLimit
Defintion in SegmentCode2D.segByteLimit


DCStop

int[] DCStop
Defintion in SegmentCode2D.DCStop


bitPlaneStop

int[] bitPlaneStop
Defintion in SegmentCode2D.bitPlaneStop


stageStop

int[] stageStop
Defintion in SegmentCode2D.stageStop


useFill

int[] useFill
Indicates for each segment whether fill bits will be used to produce segByteLimit bytes in a segment

Valid values for wl DWT levels are:


blocksPerSegment

int[] blocksPerSegment
Defintion in SegmentCode2D.blocksPerSegment


optDCSelect

int[] optDCSelect
Definition in SegmentCode2D.optDCSelect


optACSelect

int[] optACSelect
Definition in SegmentCode2D.optACSelect


WTType

int[] WTType
Defintion in ForwardWaveletTransform.WTTypes


signedPixels

int[] signedPixels
Defintion in Coder.signedPixels


pixelBitDepth

int[] pixelBitDepth
Defintion in Coder.pixelBitDepth


xOriginalSize

int xOriginalSize
Image width.

Negative values are not allowed for this field.


transposeImg

int[] transposeImg
Defintion in TransposeImage.transposeImg


codeWordLength

int[] codeWordLength
Indicates the coded word length for each segment

Valid values are:


customWtFlag

int[] customWtFlag
Defintion in ForwardWeighting.customWtFlag


customWeight

float[][] customWeight
Defintion in ForwardWeighting.customWeight


fOut

java.io.RandomAccessFile fOut
Constructor Detail

WriteSegments

public WriteSegments()
Constructor of WriteSegments

Method Detail

setParameters

public void setParameters(java.lang.String outFile,
                          BitStream[][] initialCodedDC,
                          BitStream[][] codedBitDepthACBlock,
                          BitStream[][][] refinementDC,
                          BitStream[][][][] sortingAC,
                          BitStream[][][][][] refinementAC,
                          int[] resolutionLevels,
                          int[] progressionOrder,
                          int[] truncationPoints,
                          int[] adjustHeaderParameters,
                          int[] bitDepthDC,
                          int[] bitDepthAC,
                          int[] part2Flag,
                          int[] part3Flag,
                          int[] part4Flag,
                          int[] padRows,
                          int[] segByteLimit,
                          int[] DCStop,
                          int[] bitPlaneStop,
                          int[] stageStop,
                          int[] useFill,
                          int[] blocksPerSegment,
                          int[] optDCSelect,
                          int[] optACSelect,
                          int[] WTType,
                          int[] signedPixels,
                          int[] pixelBitDepth,
                          int xOriginalSize,
                          int[] transposeImg,
                          int[] codeWordLength,
                          int[] customWtFlag,
                          float[][] customWeight)
Set the parameters required to create the encoded file

Parameters:
outFile - definition in Coder.outFile
initialCodedDC - definition in initialCodedDC
codedBitDepthACBlock - definition in codedBitDepthACBlock
refinementDC - definition in refinementDC
sortingAC - definition in sortingAC
refinementAC - definition in refinementAC
resolutionLevels - definition in SegmentCode2D.resolutionLevels
progressionOrder - definition in progressionOrder
truncationPoints - definition in truncationPoints
adjustHeaderParameters - definition in adjustHeaderParameters
bitDepthDC - definition in SegmentCode2D.bitDepthDC
bitDepthAC - definition in SegmentCode2D.bitDepthAC
part2Flag - definition in part2Flag
part3Flag - definition in part3Flag
part4Flag - definition in part4Flag
padRows - definition in ImageExtension.padRows
segByteLimit - definition in Defintion in SegmentCode2D.segByteLimit
DCStop - definition in SegmentCode2D.DCStop
bitPlaneStop - definition in SegmentCode2D.bitPlaneStop
stageStop - definition in SegmentCode2D.stageStop
useFill - definition in useFill
blocksPerSegment - definition in SegmentCode2D.blocksPerSegment
optDCSelect - definition in SegmentCode2D.optDCSelect
optACSelect - definition in SegmentCode2D.optACSelect
WTType - definition in ForwardWaveletTransform.WTTypes
signedPixels - definition in Coder.signedPixels
pixelBitDepth - definition in Coder.pixelBitDepth
xOriginalSize - definition in xOriginalSize
transposeImg - definition in TransposeImage.transposeImg
codeWordLength - definition in codeWordLength
customWtFlag - definition in ForwardWeighting.customWtFlag
customWeight - definition in ForwardWeighting.customWeight

run

public void run()
         throws java.lang.Exception
Creates the encoded file according with the progression given by the user

Throws:
java.lang.Exception - when something goes wrong and segments cannot be written

adjustHeaderFlags

private void adjustHeaderFlags(int segmentId)
In case that some parameters must be redefined, here we asure that the parts of the header containing such parameters will be included.

Parameters:
segmentId - this integer indicates the number of the segment that is being written


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)