C# Класс CSJ2K.j2k.codestream.writer.HeaderEncoder

This class writes almost of the markers and marker segments in main header and in tile-part headers. It is created by the run() method of the Encoder instance.

A marker segment includes a marker and eventually marker segment parameters. It is designed by the three letter code of the marker associated with the marker segment. JPEG 2000 part I defines 6 types of markers:

  • Delimiting : SOC,SOT,SOD,EOC (written in FileCodestreamWriter).
  • Fixed information: SIZ.
  • Functional: COD,COC,RGN,QCD,QCC,POC.
  • In bit-stream: SOP,EPH.
  • Pointer: TLM,PLM,PLT,PPM,PPT.
  • Informational: CRG,COM.

Main Header is written when Encoder instance calls encodeMainHeader whereas tile-part headers are written when the EBCOTRateAllocator instance calls encodeTilePartHeader.

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
baos System.IO.MemoryStream
dwt CSJ2K.j2k.wavelet.analysis.ForwardWT
encSpec CSJ2K.j2k.encoder.EncoderSpecs
hbuf System.IO.BinaryWriter
isOrigSig bool[]
origSrc ImgData
ralloc CSJ2K.j2k.entropy.encoder.PostCompRateAllocator
roiSc CSJ2K.j2k.roi.encoder.ROIScaler
tiler CSJ2K.j2k.image.Tiler

Открытые методы

Метод Описание
HeaderEncoder ( ImgData origsrc, bool isorigsig, ForwardWT dwt, Tiler tiler, CSJ2K.j2k.encoder.EncoderSpecs encSpec, ROIScaler roiSc, PostCompRateAllocator ralloc, CSJ2K.j2k.util.ParameterList pl ) : System

Initializes the header writer with the references to the coding chain.

encodeMainHeader ( ) : void

Write main header. JJ2000 main header corresponds to the following sequence of marker segments:

  1. SOC
  2. SIZ
  3. COD
  4. COC (if needed)
  5. QCD
  6. QCC (if needed)
  7. POC (if needed)

encodeTilePartHeader ( int tileLength, int tileIdx ) : void

Writes tile-part header. JJ2000 tile-part header corresponds to the following sequence of marker segments:

  1. SOT
  2. COD (if needed)
  3. COC (if needed)
  4. QCD (if needed)
  5. QCC (if needed)
  6. RGN (if needed)
  7. POC (if needed)
  8. SOD

reset ( ) : void

Resets the contents of this HeaderEncoder to its initial state. It erases all the data in the header buffer and reactualizes the headerLength field of the bit stream writer.

writeTo ( BinaryDataOutput out_Renamed ) : void

Writes the header to the specified BinaryDataOutput.

writeTo ( System out_Renamed ) : void

Writes the header to the specified OutputStream.

Защищенные методы

Метод Описание
writeCOC ( bool mh, int tileIdx, int compIdx ) : void

Writes COC marker segment . It is a functional marker containing the coding style for one component (coding style, decomposition, layering).

Its values overrides any value previously set in COD in the main header or in the tile header.

writeCOD ( bool mh, int tileIdx ) : void

Writes COD marker segment. COD is a functional marker segment containing the code style default (coding style, decomposition, layering) used for compressing all the components in an image.

The values can be overriden for an individual component by a COC marker in either the main or the tile header.

writeMainQCC ( int compIdx ) : void

Writes QCC marker segment in main header. It is a functional marker segment countaining the quantization used for compressing the specified component in an image. The values override for the specified component what was defined by a QCC marker in either the main or the tile header.

writeMainQCD ( ) : void

Writes QCD marker segment in main header. QCD is a functional marker segment countaining the quantization default used for compressing all the components in an image. The values can be overriden for an individual component by a QCC marker in either the main or the tile header.

writePOC ( bool mh, int tileIdx ) : void

Writes POC marker segment. POC is a functional marker segment containing the bounds and progression order for any progression order other than default in the codestream.

writeTileQCC ( int t, int compIdx ) : void

Writes QCC marker segment in tile header. It is a functional marker segment countaining the quantization used for compressing the specified component in an image. The values override for the specified component what was defined by a QCC marker in either the main or the tile header.

writeTileQCD ( int tIdx ) : void

Writes QCD marker segment in tile header. QCD is a functional marker segment countaining the quantization default used for compressing all the components in an image. The values can be overriden for an individual component by a QCC marker in either the main or the tile header.

Приватные методы

Метод Описание
writeCOM ( ) : void

Write COM marker segment(s) to the codestream.

This marker is currently written in main header and indicates the JJ2000 encoder's version that has created the codestream.

writeRGN ( int tIdx ) : void

Writes the RGN marker segment in the tile header. It describes the scaling value in each tile component

May be used in tile or main header. If used in main header, it refers to a ROI of the whole image, regardless of tiling. When used in tile header, only the particular tile is affected.

writeSIZ ( ) : void

Writes SIZ marker segment of the codestream header. It is a fixed information marker segment containing informations about image and tile sizes. It is required in the main header immediately after SOC marker segment.

writeSOC ( ) : void

Start Of Codestream marker (SOC) signalling the beginning of a codestream.

Описание методов

HeaderEncoder() публичный Метод

Initializes the header writer with the references to the coding chain.
public HeaderEncoder ( ImgData origsrc, bool isorigsig, ForwardWT dwt, Tiler tiler, CSJ2K.j2k.encoder.EncoderSpecs encSpec, ROIScaler roiSc, PostCompRateAllocator ralloc, CSJ2K.j2k.util.ParameterList pl ) : System
origsrc ImgData The original image data (before any component mixing, /// tiling, etc.) /// ///
isorigsig bool An array specifying for each component if it was /// originally signed or not. /// ///
dwt CSJ2K.j2k.wavelet.analysis.ForwardWT The discrete wavelet transform module. /// ///
tiler CSJ2K.j2k.image.Tiler The tiler module. /// ///
encSpec CSJ2K.j2k.encoder.EncoderSpecs The encoder specifications /// ///
roiSc CSJ2K.j2k.roi.encoder.ROIScaler The ROI scaler module. /// ///
ralloc CSJ2K.j2k.entropy.encoder.PostCompRateAllocator The post compression rate allocator. /// ///
pl CSJ2K.j2k.util.ParameterList ParameterList instance. /// ///
Результат System

encodeMainHeader() публичный Метод

Write main header. JJ2000 main header corresponds to the following sequence of marker segments:
  1. SOC
  2. SIZ
  3. COD
  4. COC (if needed)
  5. QCD
  6. QCC (if needed)
  7. POC (if needed)
public encodeMainHeader ( ) : void
Результат void

encodeTilePartHeader() публичный Метод

Writes tile-part header. JJ2000 tile-part header corresponds to the following sequence of marker segments:
  1. SOT
  2. COD (if needed)
  3. COC (if needed)
  4. QCD (if needed)
  5. QCC (if needed)
  6. RGN (if needed)
  7. POC (if needed)
  8. SOD
public encodeTilePartHeader ( int tileLength, int tileIdx ) : void
tileLength int
tileIdx int Index of the tile to write /// ///
Результат void

reset() публичный Метод

Resets the contents of this HeaderEncoder to its initial state. It erases all the data in the header buffer and reactualizes the headerLength field of the bit stream writer.
public reset ( ) : void
Результат void

writeCOC() защищенный Метод

Writes COC marker segment . It is a functional marker containing the coding style for one component (coding style, decomposition, layering).

Its values overrides any value previously set in COD in the main header or in the tile header.

protected writeCOC ( bool mh, int tileIdx, int compIdx ) : void
mh bool Flag indicating whether the main header is to be written. /// ///
tileIdx int Tile index. /// ///
compIdx int index of the component which need use of the COC marker /// segment. /// ///
Результат void

writeCOD() защищенный Метод

Writes COD marker segment. COD is a functional marker segment containing the code style default (coding style, decomposition, layering) used for compressing all the components in an image.

The values can be overriden for an individual component by a COC marker in either the main or the tile header.

protected writeCOD ( bool mh, int tileIdx ) : void
mh bool Flag indicating whether this marker belongs to the main /// header /// ///
tileIdx int Tile index if the marker belongs to a tile-part header /// ///
Результат void

writeMainQCC() защищенный Метод

Writes QCC marker segment in main header. It is a functional marker segment countaining the quantization used for compressing the specified component in an image. The values override for the specified component what was defined by a QCC marker in either the main or the tile header.
protected writeMainQCC ( int compIdx ) : void
compIdx int Index of the component which needs QCC marker segment. /// ///
Результат void

writeMainQCD() защищенный Метод

Writes QCD marker segment in main header. QCD is a functional marker segment countaining the quantization default used for compressing all the components in an image. The values can be overriden for an individual component by a QCC marker in either the main or the tile header.
protected writeMainQCD ( ) : void
Результат void

writePOC() защищенный Метод

Writes POC marker segment. POC is a functional marker segment containing the bounds and progression order for any progression order other than default in the codestream.
protected writePOC ( bool mh, int tileIdx ) : void
mh bool Flag indicating whether the main header is to be written /// ///
tileIdx int Tile index /// ///
Результат void

writeTileQCC() защищенный Метод

Writes QCC marker segment in tile header. It is a functional marker segment countaining the quantization used for compressing the specified component in an image. The values override for the specified component what was defined by a QCC marker in either the main or the tile header.
protected writeTileQCC ( int t, int compIdx ) : void
t int Tile index /// ///
compIdx int Index of the component which needs QCC marker segment. /// ///
Результат void

writeTileQCD() защищенный Метод

Writes QCD marker segment in tile header. QCD is a functional marker segment countaining the quantization default used for compressing all the components in an image. The values can be overriden for an individual component by a QCC marker in either the main or the tile header.
protected writeTileQCD ( int tIdx ) : void
tIdx int Tile index /// ///
Результат void

writeTo() публичный Метод

Writes the header to the specified BinaryDataOutput.
public writeTo ( BinaryDataOutput out_Renamed ) : void
out_Renamed BinaryDataOutput
Результат void

writeTo() публичный Метод

Writes the header to the specified OutputStream.
public writeTo ( System out_Renamed ) : void
out_Renamed System
Результат void

Описание свойств

baos защищенное свойство

The ByteArrayOutputStream to store header data. This handler is kept in order to use methods not accessible from a general DataOutputStream. For the other methods, it's better to use variable hbuf.
protected System.IO.MemoryStream baos
Результат System.IO.MemoryStream

dwt защищенное свойство

Reference to the DWT module
protected ForwardWT,CSJ2K.j2k.wavelet.analysis dwt
Результат CSJ2K.j2k.wavelet.analysis.ForwardWT

encSpec защищенное свойство

The encoder specifications
protected EncoderSpecs,CSJ2K.j2k.encoder encSpec
Результат CSJ2K.j2k.encoder.EncoderSpecs

hbuf защищенное свойство

The DataOutputStream to store header data. This kind of object is useful to write short, int, .... It's constructor takes baos as parameter.
protected System.IO.BinaryWriter hbuf
Результат System.IO.BinaryWriter

isOrigSig защищенное свойство

An array specifying, for each component,if the data was signed or not
protected bool[] isOrigSig
Результат bool[]

origSrc защищенное свойство

The image data reader. Source of original data info
protected ImgData origSrc
Результат ImgData

ralloc защищенное свойство

Reference to the rate allocator
protected PostCompRateAllocator,CSJ2K.j2k.entropy.encoder ralloc
Результат CSJ2K.j2k.entropy.encoder.PostCompRateAllocator

roiSc защищенное свойство

Reference to the ROI module
protected ROIScaler,CSJ2K.j2k.roi.encoder roiSc
Результат CSJ2K.j2k.roi.encoder.ROIScaler

tiler защищенное свойство

Reference to the tiler module
protected Tiler,CSJ2K.j2k.image tiler
Результат CSJ2K.j2k.image.Tiler