public class HeaderEncoder extends java.lang.Object implements Markers, StdEntropyCoderOptions
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:
Main Header is written when Encoder instance calls encodeMainHeader whereas tile-part headers are written when the EBCOTRateAllocator instance calls encodeTilePartHeader.
Encoder
,
Markers
,
EBCOTRateAllocator
Modifier and Type | Field and Description |
---|---|
protected java.io.ByteArrayOutputStream |
baos
The ByteArrayOutputStream to store header data.
|
protected ForwardWT |
dwt
Reference to the DWT module
|
protected java.io.DataOutputStream |
hbuf
The DataOutputStream to store header data.
|
protected boolean[] |
isOrigSig
An array specifying, for each component,if the data was signed
or not
|
protected int |
nComp
The number of components in the image
|
protected ImgData |
origSrc
The image data reader.
|
protected PostCompRateAllocator |
ralloc
Reference to the rate allocator
|
protected ROIScaler |
roiSc
Reference to the ROI module
|
protected Tiler |
tiler
Reference to the tiler module
|
protected J2KImageWriteParamJava |
wp
The encoder specifications
|
COC, COD, COM, CRG, EOC, EPH, EPH_LENGTH, ERS_SEG_SYMBOLS, ERS_SOP, MAX_COMP_BITDEPTH, MAX_LPPM, MAX_LPPT, PLM, PLT, POC, PPM, PPT, PRECINCT_PARTITION_DEF_SIZE, QCC, QCD, RCOM_GEN_USE, RGN, RSIZ_BASELINE, RSIZ_ER_FLAG, RSIZ_ROI, SCOX_HOR_CB_PART, SCOX_PRECINCT_PARTITION, SCOX_USE_EPH, SCOX_USE_SOP, SCOX_VER_CB_PART, SIZ, SOC, SOD, SOP, SOP_LENGTH, SOT, SQCX_EXP_MASK, SQCX_EXP_SHIFT, SQCX_GB_MSK, SQCX_GB_SHIFT, SQCX_NO_QUANTIZATION, SQCX_SCALAR_DERIVED, SQCX_SCALAR_EXPOUNDED, SRGN_IMPLICIT, SSIZ_DEPTH_BITS, TLM
FIRST_BYPASS_PASS_IDX, MAX_CB_AREA, MAX_CB_DIM, MIN_CB_DIM, NUM_EMPTY_PASSES_IN_MS_BP, NUM_NON_BYPASS_MS_BP, NUM_PASSES, OPT_BYPASS, OPT_PRED_TERM, OPT_RESET_MQ, OPT_SEG_SYMBOLS, OPT_TERM_PASS, OPT_VERT_STR_CAUSAL, STRIPE_HEIGHT
Constructor and Description |
---|
HeaderEncoder(ImgData origsrc,
boolean[] isorigsig,
ForwardWT dwt,
Tiler tiler,
J2KImageWriteParamJava wp,
ROIScaler roiSc,
PostCompRateAllocator ralloc)
Initializes the header writer with the references to the coding chain.
|
Modifier and Type | Method and Description |
---|---|
void |
encodeMainHeader()
Write main header.
|
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.
|
int |
getLength()
Returns the length of the header.
|
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.
|
void |
writeTo(BinaryDataOutput out)
Writes the header to the specified BinaryDataOutput.
|
void |
writeTo(java.io.OutputStream out)
Writes the header to the specified OutputStream.
|
protected int nComp
protected java.io.ByteArrayOutputStream baos
hbuf
protected java.io.DataOutputStream hbuf
baos
protected ImgData origSrc
protected boolean[] isOrigSig
protected PostCompRateAllocator ralloc
protected ForwardWT dwt
protected Tiler tiler
protected ROIScaler roiSc
protected J2KImageWriteParamJava wp
public HeaderEncoder(ImgData origsrc, boolean[] isorigsig, ForwardWT dwt, Tiler tiler, J2KImageWriteParamJava wp, ROIScaler roiSc, PostCompRateAllocator ralloc)
origsrc
- The original image data (before any component mixing,
tiling, etc.)isorigsig
- An array specifying for each component if it was
originally signed or not.dwt
- The discrete wavelet transform module.tiler
- The tiler module.encSpec
- The encoder specificationsroiSc
- The ROI scaler module.ralloc
- The post compression rate allocator.public void reset()
protected byte[] getBuffer()
public int getLength()
public void writeTo(BinaryDataOutput out) throws java.io.IOException
out
- Where to write the header.java.io.IOException
protected int getBufferLength()
public void writeTo(java.io.OutputStream out) throws java.io.IOException
out
- Where to write the header.java.io.IOException
protected void writeCOD(boolean mh, int tileIdx) throws java.io.IOException
The values can be overriden for an individual component by a COC marker in either the main or the tile header.
mh
- Flag indicating whether this marker belongs to the main
headertileIdx
- Tile index if the marker belongs to a tile-part headerjava.io.IOException
writeCOC(boolean, int, int)
protected void writeCOC(boolean mh, int tileIdx, int compIdx) throws java.io.IOException
Its values overrides any value previously set in COD in the main header or in the tile header.
mh
- Flag indicating whether the main header is to be writtentileIdx
- Tile indexcompIdx
- index of the component which need use of the COC marker
segment.java.io.IOException
writeCOD(boolean, int)
protected void writeMainQCD() throws java.io.IOException
java.io.IOException
protected void writeMainQCC(int compIdx) throws java.io.IOException
compIdx
- Index of the component which needs QCC marker
segment.java.io.IOException
protected void writeTileQCD(int tIdx) throws java.io.IOException
tIdx
- Tile indexjava.io.IOException
protected void writeTileQCC(int t, int compIdx) throws java.io.IOException
t
- Tile indexcompIdx
- Index of the component which needs QCC marker
segment.java.io.IOException
protected void writePOC(boolean mh, int tileIdx) throws java.io.IOException
mh
- Flag indicating whether the main header is to be writtentileIdx
- Tile indexjava.io.IOException
public void encodeMainHeader() throws java.io.IOException
java.io.IOException
public void encodeTilePartHeader(int tileLength, int tileIdx) throws java.io.IOException
length
- The length of the current tile-part.tileIdx
- Index of the tile to writejava.io.IOException
Copyright © 2014 Open Microscopy Environment