|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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 |
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 |
Fields inherited from interface jj2000.j2k.codestream.Markers |
COC,
COD,
COM,
CRG,
EOC,
EPH,
EPH_LENGTH,
ERS_SEG_MARKERS,
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_PRECINCT_PARTITION,
SCOX_USE_EPH,
SCOX_USE_SOP,
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_ER_TERM,
OPT_REG_TERM,
OPT_RESET_MQ,
OPT_SEG_MARKERS,
OPT_VERT_STR_CAUSAL,
STRIPE_HEIGHT |
Constructor Summary | |
HeaderEncoder(ImgData origsrc,
boolean[] isorigsig,
ForwardWT dwt,
Tiler tiler,
EncoderSpecs encSpec,
ROIScaler roiSc,
PostCompRateAllocator ralloc)
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. |
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 a COM marker segment adding some comments 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 |
|
Field Detail |
private int defimgn
private int deftilenr
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 EncoderSpecs encSpec
Constructor Detail |
public HeaderEncoder(ImgData origsrc, boolean[] isorigsig, ForwardWT dwt, Tiler tiler, EncoderSpecs encSpec, 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.Method Detail |
public void reset()
protected byte[] getBuffer()
public int getLength()
public void writeTo(BinaryDataOutput out) throws java.io.IOException
out
- Where to write the header.protected int getBufferLength()
public void writeTo(java.io.OutputStream out) throws java.io.IOException
out
- Where to write the header.private void writeSOC() throws java.io.IOException
private void writeSIZ() throws 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 headerwriteCOC(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.writeCOD(boolean, int)
protected void writeMainQCD() throws java.io.IOException
protected void writeMainQCC(int compIdx) throws java.io.IOException
compIdx
- Index of the component which needs QCC marker
segment.protected void writeTileQCD(int tIdx) throws java.io.IOException
tIdx
- Tile indexprotected void writeTileQCC(int t, int compIdx) throws java.io.IOException
t
- Tile indexcompIdx
- Index of the component which needs QCC marker
segment.protected void writePOC(boolean mh, int tileIdx) throws java.io.IOException
mh
- Flag indicating whether the main header is to be writtentileIdx
- Tile indexpublic void encodeMainHeader() throws 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.
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 indexpublic void encodeTilePartHeader(int tileLength, int tileIdx) throws java.io.IOException
length
- The length of the current tile-part.tileIdx
- Index of the tile to write
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |