| java.lang.Object jj2000.j2k.codestream.writer.HeaderEncoder
HeaderEncoder | public class HeaderEncoder implements Markers,StdEntropyCoderOptions(Code) | | 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.
See Also: Encoder See Also: Markers See Also: EBCOTRateAllocator |
Method Summary | |
public void | encodeMainHeader() Write main header. | public void | encodeTilePartHeader(int tileLength, int tileIdx) Writes tile-part header. | protected byte[] | getBuffer() Returns the byte-buffer used to store the codestream header. | protected int | getBufferLength() Returns the number of bytes used in the codestream header's
buffer. | public int | getLength() Returns the length of the header. | public void | reset() Resets the contents of this HeaderEncoder to its initial state. | protected void | writeCOC(boolean mh, int tileIdx, int compIdx) Writes COC marker segment . | protected void | writeCOD(boolean mh, int tileIdx) Writes COD marker segment. | protected void | writeMainQCC(int compIdx) Writes QCC marker segment in main header. | protected void | writeMainQCD() Writes QCD marker segment in main header. | protected void | writePOC(boolean mh, int tileIdx) Writes POC marker segment. | protected void | writeTileQCC(int t, int compIdx) Writes QCC marker segment in tile header. | protected void | writeTileQCD(int tIdx) Writes QCD marker segment in tile header. | public void | writeTo(BinaryDataOutput out) Writes the header to the specified BinaryDataOutput. | public void | writeTo(OutputStream out) Writes the header to the specified OutputStream. |
baos | protected ByteArrayOutputStream baos(Code) | | 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.
See Also: HeaderEncoder.hbuf See Also: |
hbuf | protected DataOutputStream hbuf(Code) | | The DataOutputStream to store header data. This kind of object
is useful to write short, int, .... It's constructor takes
baos as parameter.
See Also: HeaderEncoder.baos |
isOrigSig | protected boolean isOrigSig(Code) | | An array specifying, for each component,if the data was signed
or not
|
nComp | protected int nComp(Code) | | The number of components in the image
|
origSrc | protected ImgData origSrc(Code) | | The image data reader. Source of original data info
|
tiler | protected Tiler tiler(Code) | | Reference to the tiler module
|
HeaderEncoder | public HeaderEncoder(ImgData origsrc, boolean isorigsig, ForwardWT dwt, Tiler tiler, J2KImageWriteParamJava wp, ROIScaler roiSc, PostCompRateAllocator ralloc)(Code) | | Initializes the header writer with the references to the coding chain.
Parameters: origsrc - The original image data (before any component mixing,tiling, etc.) Parameters: isorigsig - An array specifying for each component if it wasoriginally signed or not. Parameters: dwt - The discrete wavelet transform module. Parameters: tiler - The tiler module. Parameters: encSpec - The encoder specifications Parameters: roiSc - The ROI scaler module. Parameters: ralloc - The post compression rate allocator. |
encodeMainHeader | public void encodeMainHeader() throws IOException(Code) | | Write main header. JJ2000 main header corresponds to the following
sequence of marker
segments:- SOC
- SIZ
- COD
- COC (if
needed)
- QCD
- QCC (if needed)
- POC (if
needed)
|
encodeTilePartHeader | public void encodeTilePartHeader(int tileLength, int tileIdx) throws IOException(Code) | | Writes tile-part header. JJ2000 tile-part header corresponds to the
following sequence of marker segments: - SOT
- COD (if
needed)
- COC (if needed)
- QCD (if needed)
- QCC
(if needed)
- RGN (if needed)
- POC (if needed)
- SOD
Parameters: length - The length of the current tile-part. Parameters: tileIdx - Index of the tile to write |
getBuffer | protected byte[] getBuffer()(Code) | | Returns the byte-buffer used to store the codestream header.
A byte array countaining codestream header |
getBufferLength | protected int getBufferLength()(Code) | | Returns the number of bytes used in the codestream header's
buffer.
Header length in buffer (without any headeroverhead) |
getLength | public int getLength()(Code) | | Returns the length of the header.
The length of the header in bytes |
reset | public void reset()(Code) | | 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.
|
writeCOC | protected void writeCOC(boolean mh, int tileIdx, int compIdx) throws IOException(Code) | | 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.
Parameters: mh - Flag indicating whether the main header is to be written Parameters: tileIdx - Tile index Parameters: compIdx - index of the component which need use of the COC markersegment. See Also: HeaderEncoder.writeCOD |
writeCOD | protected void writeCOD(boolean mh, int tileIdx) throws IOException(Code) | | 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.
Parameters: mh - Flag indicating whether this marker belongs to the mainheader Parameters: tileIdx - Tile index if the marker belongs to a tile-part header See Also: HeaderEncoder.writeCOC |
writeMainQCC | protected void writeMainQCC(int compIdx) throws IOException(Code) | | 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.
Parameters: compIdx - Index of the component which needs QCC markersegment. |
writeMainQCD | protected void writeMainQCD() throws IOException(Code) | | 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 | protected void writePOC(boolean mh, int tileIdx) throws IOException(Code) | | 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.
Parameters: mh - Flag indicating whether the main header is to be written Parameters: tileIdx - Tile index |
writeTileQCC | protected void writeTileQCC(int t, int compIdx) throws IOException(Code) | | 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.
Parameters: t - Tile index Parameters: compIdx - Index of the component which needs QCC markersegment. |
writeTileQCD | protected void writeTileQCD(int tIdx) throws IOException(Code) | | 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.
Parameters: tIdx - Tile index |
writeTo | public void writeTo(BinaryDataOutput out) throws IOException(Code) | | Writes the header to the specified BinaryDataOutput.
Parameters: out - Where to write the header. |
writeTo | public void writeTo(OutputStream out) throws IOException(Code) | | Writes the header to the specified OutputStream.
Parameters: out - Where to write the header. |
|
|