// Parse the marker in from the JP2 file. CNCSError CNCSJPCPPTMarker::Parse(CNCSJPC &JPC, CNCSJPCIOStream &Stream) { &JPC;//Keep compiler happy CNCSError Error; m_bHaveMarker = true; NCSJP2_CHECKIO_BEGIN(Error, Stream); NCSJP2_CHECKIO(ReadUINT16(m_nLength)); NCSJP2_CHECKIO(ReadUINT8(m_nZppt)); NCSJP2_CHECKIO(Seek(m_nLength - (sizeof(UINT16) + sizeof(UINT8)))); if(Error == NCS_SUCCESS) { m_bValid = true; } NCSJP2_CHECKIO_END(); return(Error); }
// UnParse the box to the stream CNCSError CNCSJP2File::CNCSJP2SignatureBox::UnParse(class CNCSJP2File &JP2File, CNCSJPCIOStream &Stream) { CNCSError Error; Error = CNCSJP2Box::UnParse(JP2File, Stream); NCSJP2_CHECKIO_BEGIN(Error, Stream); NCSJP2_CHECKIO(WriteUINT32(sm_JP2Signature)); NCSJP2_CHECKIO_END(); return(Error); }
// UnParse the marker out to the stream. CNCSError CNCSJPCRGNMarker::UnParse(CNCSJPC &JPC, CNCSJPCIOStream &Stream) { CNCSError Error; Error = CNCSJPCMarker::UnParse(JPC, Stream); NCSJP2_CHECKIO_BEGIN(Error, Stream); NCSJP2_CHECKIO(WriteUINT16(m_nLength)); if(JPC.m_SIZ.m_nCsiz < 257) { NCSJP2_CHECKIO(WriteUINT8((UINT8)m_nCrgn)); } else { NCSJP2_CHECKIO(WriteUINT16(m_nCrgn)); } NCSJP2_CHECKIO(WriteUINT8((UINT8)m_eSrgn)); NCSJP2_CHECKIO(WriteUINT8(m_nSPrgn)); NCSJP2_CHECKIO_END(); return(Error); }
// Parse the marker in from the JP2 file. CNCSError CNCSJPCCRGMarker::Parse(CNCSJPC &JPC, CNCSJPCIOStream &Stream) { CNCSError Error; m_bHaveMarker = true; NCSJP2_CHECKIO_BEGIN(Error, Stream); NCSJP2_CHECKIO(ReadUINT16(m_nLength)); for(int i = 0; i < JPC.m_SIZ.m_nCsiz; i++) { Registration reg; NCSJP2_CHECKIO(ReadUINT16(reg.m_nXcrg)); NCSJP2_CHECKIO(ReadUINT16(reg.m_nYcrg)); m_Offsets.push_back(reg); } if(Error == NCS_SUCCESS) { m_bValid = true; } NCSJP2_CHECKIO_END(); return(Error); }
// Parse the marker in from the JP2 file. CNCSError CNCSJPCComponentDepthType::Parse(CNCSJPC &JPC, CNCSJPCIOStream &Stream) { &JPC;//Keep compiler happy CNCSError Error; NCSJP2_CHECKIO_BEGIN(Error, Stream); NCSJP2_CHECKIO(ReadUINT8(m_nBits)); if(m_nBits != 255) { if(m_nBits & 0x80) { m_bSigned = true; } else { m_bSigned = false; } m_nBits = (m_nBits & 0x7f) + 1; } NCSJP2_CHECKIO_END(); return(Error); }
// Parse the box from the stream CNCSError CNCSJP2File::CNCSJP2SignatureBox::Parse(class CNCSJP2File &JP2File, CNCSJPCIOStream &Stream) { CNCSError Error; NCSJP2_CHECKIO_BEGIN(Error, Stream); // UINT8 buf[4]; // Read in the signature // NCSJP2_CHECKIO(Read(buf, 4)); UINT32 buf; NCSJP2_CHECKIO(ReadUINT32(buf)); if(memcmp(&sm_JP2Signature, &buf, sizeof(buf)) == 0) { // Signature is valid m_bValid = true; } else { Error = NCS_FILE_INVALID; } NCSJP2_CHECKIO_END(); return(Error); }
CNCSError JP2UUID3DNBox::Parse(class CNCSJP2File &JP2File, CNCSJPCIOStream &Stream) { CNCSError Error; //See NCSJPCIOStream.h to get an understanding of these macros NCSJP2_CHECKIO_BEGIN(Error, Stream); NCSJP2_CHECKIO(Read(m_UUID.m_UUID, sizeof(m_UUID.m_UUID))); if (m_UUID == sm_UUID) { Stream.ReadIEEE8(_OrigMaxVal); Stream.ReadIEEE8(_OrigMinVal); Stream.ReadUINT32(_NormalizedMaxVal); Stream.ReadUINT32(_NormalizedMinVal); } // if NCSJP2_CHECKIO_END(); return(Error); } // JP2UUID3DNBox::Parse