public virtual void extractTilePartMarkSeg(short marker, RandomAccessIO ehs, int tileIdx, int tilePartIdx)
{
System.String htKey = ""; // Name used as a hash-table key
if (ht == null)
{
ht = new Dictionary<string, byte[]>();
}
switch (marker)
{
case CSJ2K.j2k.codestream.Markers.SOT:
throw new CorruptedCodestreamException("Second SOT marker " + "segment found in tile-" + "part header");
case CSJ2K.j2k.codestream.Markers.SIZ:
throw new CorruptedCodestreamException("SIZ found in tile-part" + " header");
case CSJ2K.j2k.codestream.Markers.EOC:
throw new CorruptedCodestreamException("EOC found in tile-part" + " header");
case CSJ2K.j2k.codestream.Markers.TLM:
throw new CorruptedCodestreamException("TLM found in tile-part" + " header");
case CSJ2K.j2k.codestream.Markers.PLM:
throw new CorruptedCodestreamException("PLM found in tile-part" + " header");
case CSJ2K.j2k.codestream.Markers.PPM:
throw new CorruptedCodestreamException("PPM found in tile-part" + " header");
case CSJ2K.j2k.codestream.Markers.COD:
if ((nfMarkSeg & COD_FOUND) != 0)
{
throw new CorruptedCodestreamException("More than one COD " + "marker " + "found in tile-part" + " header");
}
nfMarkSeg |= COD_FOUND;
htKey = "COD";
break;
case CSJ2K.j2k.codestream.Markers.COC:
nfMarkSeg |= COC_FOUND;
htKey = "COC" + (nCOCMarkSeg++);
break;
case CSJ2K.j2k.codestream.Markers.QCD:
if ((nfMarkSeg & QCD_FOUND) != 0)
{
throw new CorruptedCodestreamException("More than one QCD " + "marker " + "found in tile-part" + " header");
}
nfMarkSeg |= QCD_FOUND;
htKey = "QCD";
break;
case CSJ2K.j2k.codestream.Markers.QCC:
nfMarkSeg |= QCC_FOUND;
htKey = "QCC" + (nQCCMarkSeg++);
break;
case CSJ2K.j2k.codestream.Markers.RGN:
nfMarkSeg |= RGN_FOUND;
htKey = "RGN" + (nRGNMarkSeg++);
break;
case CSJ2K.j2k.codestream.Markers.COM:
nfMarkSeg |= COM_FOUND;
htKey = "COM" + (nCOMMarkSeg++);
break;
case CSJ2K.j2k.codestream.Markers.CRG:
throw new CorruptedCodestreamException("CRG marker found in " + "tile-part header");
case CSJ2K.j2k.codestream.Markers.PPT:
nfMarkSeg |= PPT_FOUND;
if (nPPTMarkSeg == null)
{
nPPTMarkSeg = new int[nTiles][];
}
if (nPPTMarkSeg[tileIdx] == null)
{
nPPTMarkSeg[tileIdx] = new int[nTileParts[tileIdx]];
}
htKey = "PPT" + (nPPTMarkSeg[tileIdx][tilePartIdx]++);
break;
case CSJ2K.j2k.codestream.Markers.SOD:
nfMarkSeg |= SOD_FOUND;
return ;
case CSJ2K.j2k.codestream.Markers.POC:
if ((nfMarkSeg & POC_FOUND) != 0)
throw new CorruptedCodestreamException("More than one POC " + "marker segment found " + "in tile-part" + " header");
nfMarkSeg |= POC_FOUND;
htKey = "POC";
break;
case CSJ2K.j2k.codestream.Markers.PLT:
if ((nfMarkSeg & PLM_FOUND) != 0)
{
throw new CorruptedCodestreamException("PLT marker found even" + "though PLM marker " + "found in main header");
}
FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, "PLT marker segment found but " + "not used by JJ2000 decoder.");
htKey = "UNKNOWN";
break;
default:
htKey = "UNKNOWN";
FacilityManager.getMsgLogger().printmsg(CSJ2K.j2k.util.MsgLogger_Fields.WARNING, "Non recognized marker segment (0x" + System.Convert.ToString(marker, 16) + ") in tile-part header" + " of tile " + tileIdx + " !");
break;
}
// Read marker segment length and create corresponding byte buffer
int markSegLen = ehs.readUnsignedShort();
byte[] buf = new byte[markSegLen];
// Copy data (after re-insertion of marker segment length);
buf[0] = (byte) ((markSegLen >> 8) & 0xFF);
buf[1] = (byte) (markSegLen & 0xFF);
ehs.readFully(buf, 2, markSegLen - 2);
if (!htKey.Equals("UNKNOWN"))
{
// Store array in hashTable
ht[htKey] = buf;
}
}