Statistics
| Revision:

svn-gvsig-desktop / branches / v05 / libraries / libjni-ecw / include / NCSJPCResample.h @ 40081

History | View | Annotate | Download (4.98 KB)

1
/********************************************************
2
** Copyright 2003 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/NCSJPCResample.h $
15
** CREATED:  12/02/2003 3:27:34 PM
16
** AUTHOR:   Simon Cope
17
** PURPOSE:  CNCSJPCResample class header
18
** EDITS:    [xx] ddMmmyy NAME COMMENTS
19
 *******************************************************/
20

    
21
#ifndef NCSJPCRESAMPLE_H
22
#define NCSJPCRESAMPLE_H
23

    
24
#ifndef NCSJPCPRECINCT_H
25
#include "NCSJPCPrecinct.h"
26
#endif // NCSJPCPRECINCT_H
27
#ifndef NCSJPCNODETILER_H
28
#include "NCSJPCNodeTiler.h"
29
#endif // NCSJPCNODETILER_H
30
#ifndef NCSJPC_H
31
#include "NCSJPC.h"
32
#endif // NCSJPC_H
33
#ifndef NCSECWCLIENT_H
34
#include "NCSECWClient.h"
35
#endif // NCSECWCLIENT_H
36
#ifndef NCSJPCMCTNODE_H
37
#include "NCSJPCMCTNode.h"
38
#endif // NCSJPCMCTNODE_H
39
#ifndef NCSJP2FILE_H
40
#include "NCSJP2File.h"
41
#endif // NCSJP2FILE_H
42

    
43
        /**
44
         * CNCSJPCResample class - Merges multiple tiles together, and resamples the output to the specified view..
45
         * 
46
         * @author       Simon Cope
47
         * @version      $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $ 
48
         */        
49
class NCSJPC_EXPORT_ALL CNCSJPCResample: public CNCSJPCNodeTiler {
50
public:
51
                /** Default constructor */
52
        CNCSJPCResample();
53
                /** Virtual destructor */
54
        virtual ~CNCSJPCResample();
55

    
56
                /** 
57
                 * Link this node to the view.
58
                 * @param                nCtx                Read context
59
                 * @param                JPC                        Codestream object.
60
                 * @param                pView                Current View to resample to
61
                 * @param                iComponent        Component index
62
                 * @param                iChannel        Channel index
63
                 & @param                pMCT                CNCSJPCMCTNode when MCT is required
64
                 * @return      bool                true on success, else false on error.
65
                 */
66
        virtual bool Link(ContextID nCtx, CNCSJPC &JPC, class CNCSJP2FileView *pFileView, UINT16 iComponent, UINT16 iChannel, CNCSJP2File::CNCSJP2HeaderBox &Header);
67
                /** 
68
                 * UnLink a node as the unput to this node.
69
                 * @param                nCtx                Read context
70
                 * @return      bool                true on success, else false on error.
71
                 */
72
        virtual bool UnLink(ContextID nCtx, UINT16 nInputs = 0);
73
                /** 
74
                 * Read a BufferType line from the input.
75
                 * @param                nCtx                Read context
76
                 * @param                pDst                Destination buffer.
77
                 * @param                iComponent        Output Component
78
                 * @return      bool                true on succes, else false.
79
                 */
80
        virtual bool ReadLine(ContextID nCtx, CNCSJPCBuffer *pDst, UINT16 iComponent);
81

    
82
        static UINT8 CalculateResolutionLevel(CNCSJPCComponent *pComponent, INT32 nTopX, INT32 nLeftY, INT32 nBottomX, INT32 nRightY, UINT32 nSizeX, UINT32 nSizeY);
83
protected:
84
        static CNCSJPCNodeTracker        sm_Tracker;
85

    
86
        class NCSJPC_EXPORT_ALL Context: public CNCSJPCNode::Context {
87
        public:
88
                const NCSFileViewSetInfo *m_pView;
89

    
90
                class TileInput {
91
                public:
92
                        class ChannelInput {
93
                        public:
94
                                INT32 m_nResSample;
95
                                IEEE8 m_dResSampleFactorX;
96
                                IEEE8 m_dResSampleFactorY;
97

    
98
                                UINT32 m_nResolutionWidth;
99
                                UINT32 m_nResolutionHeight;        
100

    
101
                                UINT32 m_nMax;
102
                                INT32 m_nMin;
103

    
104
                                CNCSJPCNode                *m_pInput;
105

    
106
                                ChannelInput();
107
                        };
108
                        std::vector<ChannelInput> m_CI;                        
109
                                // Multi-component transform, only if enabled in COD
110
                        CNCSJPCMCTNode        *m_pMCT;
111
                                // Color-space transformation (eg, YCrCb->sRGB), only if enabled
112
                        CNCSJPCNode                *m_pCSC;
113
                        TileInput();
114
                };
115

    
116
                std::vector<TileInput> m_Tiles;
117

    
118
                Context();
119
                virtual ~Context();
120
        };
121

    
122
                /** Clamp output data to valid range */
123
        bool m_bClamp;
124

    
125
        CNCSJPC *m_pJPC;
126
                /**
127
                 * Get the context for the given ContextID
128
                 * @param                nCtx                ContextID to retrive context
129
                 * @param                bAutoConstruct Autoconstruct a new context for this ContextID if one doesn't exist
130
                 * @return                Context*        Context for given ID.
131
                 */
132
        virtual CNCSJPCNode::Context *GetContext(ContextID nCtx, bool bAutoConstruct = true);
133
        
134
        CNCSJPCNode *BuildInputChain(ContextID nCtx, CNCSJPC &JPC, class CNCSJP2FileView *pFileView, UINT16 iComponent, UINT16 iChannel, CNCSJP2File::CNCSJP2HeaderBox &Header, CNCSJPCTilePartHeader *pTilePart);
135
                /** 
136
                 * Get normal Node Width.
137
                 * @return      INT32                Un-clipped Width of codeblocks.
138
                 */
139
        virtual UINT32 GetNodeWidth(UINT16 iComponent = 0);
140
                /** 
141
                 * Get normal Node Height.
142
                 * @return      INT32                Un-clipped height of codeblocks.
143
                 */
144
        virtual UINT32 GetNodeHeight(UINT16 iComponent = 0);
145
                /** 
146
                 * Get number of nodes wide.
147
                 * @return      INT32                Nr of codeblocks across.
148
                 */
149
        virtual UINT32 GetNumNodesWide(UINT16 iComponent = 0);
150
                /** 
151
                 * Get number of nodes high.
152
                 * @return      INT32                Nr of codeblocks high.
153
                 */
154
        virtual UINT32 GetNumNodesHigh(UINT16 iComponent = 0);
155
                /** 
156
                 * Get pointer to specific node.
157
                 * @param                UINT32                Node nr
158
                 * @return      CNCSJPCNode * Ptr to node.
159
                 */
160
        virtual CNCSJPCNode *GetNodePtr(UINT32 nNode, UINT16 iComponent = 0);
161
};
162

    
163
#endif // !NCSJPCRESAMPLE_H