|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.jpeg.jj2000.j2k.codestream.writer.HeaderEncoder
public class 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:
Main Header is written when Encoder instance calls encodeMainHeader whereas tile-part headers are written when the EBCOTRateAllocator instance calls encodeTilePartHeader.
Encoder
,
Markers
,
EBCOTRateAllocator
Field Summary | |
---|---|
protected ByteArrayOutputStream |
baos
The ByteArrayOutputStream to store header data. |
protected ForwardWT |
dwt
Reference to the DWT module |
protected EncoderSpecs |
encSpec
The encoder specifications |
protected DataOutputStream |
hbuf
The DataOutputStream to store header data. |
protected boolean[] |
isOrigSig
An array specifying, for each component,if the data was signed or not |
static char |
OPT_PREFIX
The prefix for the header encoder options: 'H' |
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 |
Fields inherited from interface ucar.jpeg.jj2000.j2k.codestream.Markers |
---|
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 |
Fields inherited from interface ucar.jpeg.jj2000.j2k.entropy.StdEntropyCoderOptions |
---|
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 Summary | |
---|---|
HeaderEncoder(ImgData origsrc,
boolean[] isorigsig,
ForwardWT dwt,
Tiler tiler,
EncoderSpecs encSpec,
ROIScaler roiSc,
PostCompRateAllocator ralloc,
ParameterList pl)
Initializes the header writer with the references to the coding chain. |
Method Summary | |
---|---|
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. |
static String[][] |
getParameterInfo()
Returns the parameters that are used in this class and implementing classes. |
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(OutputStream out)
Writes the header to the specified OutputStream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char OPT_PREFIX
protected ByteArrayOutputStream baos
hbuf
protected DataOutputStream hbuf
baos
protected ImgData origSrc
protected boolean[] isOrigSig
protected PostCompRateAllocator ralloc
protected ForwardWT dwt
protected Tiler tiler
protected ROIScaler roiSc
protected EncoderSpecs encSpec
Constructor Detail |
---|
public HeaderEncoder(ImgData origsrc, boolean[] isorigsig, ForwardWT dwt, Tiler tiler, EncoderSpecs encSpec, ROIScaler roiSc, PostCompRateAllocator ralloc, ParameterList pl)
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.pl
- ParameterList instance.Method Detail |
---|
public static String[][] getParameterInfo()
public void reset()
protected byte[] getBuffer()
public int getLength()
public void writeTo(BinaryDataOutput out) throws IOException
out
- Where to write the header.
IOException
protected int getBufferLength()
public void writeTo(OutputStream out) throws IOException
out
- Where to write the header.
IOException
protected void writeCOD(boolean mh, int tileIdx) throws 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 header
IOException
writeCOC(boolean, int, int)
protected void writeCOC(boolean mh, int tileIdx, int compIdx) throws 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 written.tileIdx
- Tile index.compIdx
- index of the component which need use of the COC marker
segment.
IOException
writeCOD(boolean, int)
protected void writeMainQCD() throws IOException
IOException
protected void writeMainQCC(int compIdx) throws IOException
compIdx
- Index of the component which needs QCC marker segment.
IOException
protected void writeTileQCD(int tIdx) throws IOException
tIdx
- Tile index
IOException
protected void writeTileQCC(int t, int compIdx) throws IOException
t
- Tile indexcompIdx
- Index of the component which needs QCC marker segment.
IOException
protected void writePOC(boolean mh, int tileIdx) throws IOException
mh
- Flag indicating whether the main header is to be writtentileIdx
- Tile index
IOException
public void encodeMainHeader() throws IOException
IOException
public void encodeTilePartHeader(int tileLength, int tileIdx) throws IOException
length
- The length of the current tile-part.tileIdx
- Index of the tile to write
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |