|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jj2000.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:
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 java.io.ByteArrayOutputStream |
baos
The ByteArrayOutputStream to store header data. |
private int |
defimgn
Nominal range bit of the component defining default values in QCD for main header |
private int |
deftilenr
Nominal range bit of the component defining default values in QCD for tile headers |
protected ForwardWT |
dwt
Reference to the DWT module |
protected EncoderSpecs |
encSpec
The encoder specifications |
private boolean |
enJJ2KMarkSeg
Whether or not to write the JJ2000 COM marker segment |
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 |
private int |
nComp
The number of components in the image |
static char |
OPT_PREFIX
The prefix for the header encoder options: 'H' |
protected ImgData |
origSrc
The image data reader. |
private java.lang.String |
otherCOMMarkSeg
Other COM marker segments specified in the command line |
private static java.lang.String[][] |
pinfo
The list of parameters that are accepted for the header encoder module. |
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 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 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 java.lang.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. |
private void |
writeCOM()
Write COM marker segment(s) to the codestream. |
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. |
private void |
writeRGN(int tIdx)
Writes the RGN marker segment in the tile header. |
private void |
writeSIZ()
Writes SIZ marker segment of the codestream header. |
private void |
writeSOC()
Start Of Codestream marker (SOC) signalling the beginning of a codestream. |
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. |
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
private static final java.lang.String[][] pinfo
private int defimgn
private int deftilenr
private int nComp
private boolean enJJ2KMarkSeg
private java.lang.String otherCOMMarkSeg
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 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 java.lang.String[][] getParameterInfo()
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
private void writeSOC() throws java.io.IOException
java.io.IOException
private void writeSIZ() throws java.io.IOException
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 header
java.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 written.tileIdx
- Tile index.compIdx
- 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 index
java.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 index
java.io.IOException
public void encodeMainHeader() throws java.io.IOException
java.io.IOException
private void writeCOM() throws java.io.IOException
This marker is currently written in main header and indicates the JJ2000 encoder's version that has created the codestream.
java.io.IOException
private void writeRGN(int tIdx) throws java.io.IOException
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.
tIdx
- The tile index
java.io.IOException
- If an I/O error occurs while reading from the
encoder header streampublic void encodeTilePartHeader(int tileLength, int tileIdx) throws java.io.IOException
tileIdx
- Index of the tile to write
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |