Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_2_Build_1043 / libraries / libjni-ecw / include / NCSJPCMainHeader.h @ 33914

History | View | Annotate | Download (5.82 KB)

1
/********************************************************
2
** Copyright 2002 Earth Resource Mapping Ltd.
3
** This document contains proprietary source code of
4
** Earth Resource Mapping Ltd, and can only be used under
5
** one of the three licenses as described in the 
6
** license.txt file supplied with this distribution. 
7
** See separate license.txt file for license details 
8
** and conditions.
9
**
10
** This software is covered by US patent #6,442,298,
11
** #6,102,897 and #6,633,688.  Rights to use these patents 
12
** is included in the license agreements.
13
**
14
** FILE:     $Archive: /NCS/Source/include/NCSJPCMainHeader.h $
15
** CREATED:  05/12/2002 3:27:34 PM
16
** AUTHOR:   Simon Cope
17
** PURPOSE:  CNCSJPCMainHeader class header
18
** EDITS:    [xx] ddMmmyy NAME COMMENTS
19
 *******************************************************/
20

    
21
#ifndef NCSJPCMAINHEADER_H
22
#define NCSJPCMAINHEADER_H
23

    
24
#include "NCSJPCTypes.h"
25
#include "NCSJPCMarker.h"
26
#include "NCSJPCSOCMarker.h"
27
#include "NCSJPCSIZMarker.h"
28
#include "NCSJPCCODMarker.h"
29
#include "NCSJPCCOCMarker.h"
30
#include "NCSJPCEOCMarker.h"
31
#include "NCSJPCQCDMarker.h"
32
#include "NCSJPCQCCMarker.h"
33
#include "NCSJPCRGNMarker.h"
34
#include "NCSJPCPOCMarker.h"
35
#include "NCSJPCTLMMarker.h"
36
#include "NCSJPCPLMMarker.h"
37
#include "NCSJPCPPMMarker.h"
38
#include "NCSJPCCRGMarker.h"
39
#include "NCSJPCCOMMarker.h"
40
#include "NCSJPCTypes.h"
41

    
42
        /**
43
         * CNCSJPCMainHeader class - the JPC codestream Main Header.
44
         * 
45
         * @author       Simon Cope
46
         * @version      $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $ 
47
         */        
48
class NCSJPC_EXPORT_ALL CNCSJPCMainHeader {
49
public:
50
                /** Main header is valid */
51
        bool        m_bValid;
52

    
53
                /** SOC start of codestream Marker - required */
54
        CNCSJPCSOCMarker        m_SOC;
55
                /** SIZ image size Marker - required */
56
        CNCSJPCSIZMarker        m_SIZ;
57
                /** COD coding style default Marker - required */
58
        CNCSJPCCODMarker        m_COD;
59
                /** QCD quantization default Marker - required */
60
        CNCSJPCQCDMarker        m_QCD;
61
                /** EOC end of codestream Marker - required */
62
        CNCSJPCEOCMarker        m_EOC;
63
                /** RGN markers */
64
        std::vector<CNCSJPCRGNMarker> m_RGNs;
65

    
66
                /** Any progression order changes 
67
                 * NOTE: this over-rides any progression in a tile-part COD marker
68
                 */
69
        CNCSJPCPOCMarker        m_POC;
70
                /** TLM markers */
71
        std::vector<CNCSJPCTLMMarker> m_TLMs;
72
                /** PLM markers */
73
        std::vector<CNCSJPCPLMMarker> m_PLMs;
74
                /** PPM markers */
75
        std::vector<CNCSJPCPPMMarker> m_PPMs;
76
                /** Are the PPM's from the file or dynamically created? */
77
        bool                                m_bFilePPMs;
78

    
79
                /** CRG component registration - optional */
80
        CNCSJPCCRGMarker        m_CRG;
81
                /** COM Marker - compression only */
82
        CNCSJPCCOMMarker        m_COM;
83

    
84
                /** Default constructor, initialises members */
85
        CNCSJPCMainHeader();
86
                /** Virtual destructor */
87
        virtual ~CNCSJPCMainHeader();
88

    
89
                /** 
90
                 * Parse the marker from the JPC codestream.
91
                 * @param                JPC                        CNCSJPC to use to parse file.
92
                 * @param                Stream                IOStream to use to parse file.
93
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
94
                 */
95
        virtual CNCSError Parse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream);
96
                /** 
97
                 * UnParse the marker to the JPC codestream.
98
                 * @param                Stream                IOStream to use to parse file.
99
                 * @param                JPC                        CNCSJPC to use to parse file.
100
                 * @return      CNCSError        NCS_SUCCESS, or Error code on failure.
101
                 */
102
        virtual CNCSError UnParse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream);
103

    
104
                /**
105
                 * Get X0, the component top left in reference grid
106
                 * @param                INT32                Component Index
107
                 * @return                INT32                Component coordinate
108
                 */
109
        INT32 GetComponentX0(INT32 iComponent);
110
                /**
111
                 * Get X1, the component bottom right in reference grid
112
                 * @param                INT32                Component Index
113
                 * @return                INT32                Component coordinate
114
                 */
115
        INT32 GetComponentX1(INT32 iComponent);
116
                /**
117
                 * Get Y0, the component top left in reference grid
118
                 * @param                INT32                Component Index
119
                 * @return                INT32                Component coordinate
120
                 */
121
        INT32 GetComponentY0(INT32 iComponent);
122
                /**
123
                 * Get Y1, the component bottom right in reference grid
124
                 * @param                INT32                Component Index
125
                 * @return                INT32                Component coordinate
126
                 */
127
        INT32 GetComponentY1(INT32 iComponent);
128
                /**
129
                 * Get the component width in reference grid
130
                 * @param                INT32                Component Index
131
                 * @return                INT32                Component width
132
                 */
133
        INT32 GetComponentWidth(INT32 iComponent);
134
                /**
135
                 * Get the component height in reference grid
136
                 * @param                INT32                Component Index
137
                 * @return                INT32                Component height
138
                 */
139
        INT32 GetComponentHeight(INT32 iComponent);
140

    
141
                /**
142
                 * Get the number of tile across the image
143
                 * @return                INT32                Number of tiles across image
144
                 */
145
        INT32 GetNumXTiles();
146
                /**
147
                 * Get the number of tile down the image
148
                 * @return                INT32                Number of tiles down image
149
                 */
150
        INT32 GetNumYTiles();
151
                /**
152
                 * Get the Tile P index from the tile index
153
                 * @param                INT32                Tile Index, >= 0
154
                 * @return                INT32                X of the tile, >= 0
155
                 */
156
        INT32 GetTilePFromIndex(INT32 iIndex);
157
                /**
158
                 * Get the Tile Q index from the tile index
159
                 * @param                INT32                Tile Index, >= 0
160
                 * @return                INT32                Y of the tile, >= 0
161
                 */
162
        INT32 GetTileQFromIndex(INT32 iIndex);
163
                /**
164
                 * Get the Tile Index from the tile PQ index
165
                 * @param                INT32                Tile P Index
166
                 * @param                INT32                Tile Q Index
167
                 * @return                INT32                Tile Index
168
                 */
169
        INT32 GetTileIndexFromPQ(INT32 iPIndex, INT32 iQIndex);
170

    
171
                /** Tmp directory for encoding */
172
        char                                *m_pTmpDir;
173

    
174
                /** Encoder PLT Stream - holds all packet lengths during encoding */
175
        CNCSJPCIOStream                *m_pEncoderPLTFile;
176
                /** Encoder Resolution Packet Offset temp files */
177
        CNCSJPCIOStream                *m_pEncoderOffsetFile;
178
                /** Encoder Resolution Packet temp files */
179
        CNCSJPCIOStreamVector m_EncoderFiles;
180

    
181
        bool OpenEncoderFiles(bool bWrite);
182
        bool CloseEncoderFiles(bool bDelete);
183

    
184
protected:
185
        friend class CNCSJPCTilePartHeader;
186
        friend class CNCSJP2File;
187
                        /** CodingStyle for each component */
188
        std::vector<CNCSJPCCODMarker> m_CodingStyles;
189
                /** QuantizationStyle for each component */
190
        std::vector<CNCSJPCQCDMarker> m_QuantizationStyles;
191
};
192

    
193

    
194

    
195
#endif // !NCSJPCMAINHEADER_H