svn-gvsig-desktop / branches / v1_0_2 / libraries / libjni-ecwcompress / include / include-sdk / NCSJPCT1Coder.h @ 39946
History | View | Annotate | Download (4.38 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/NCSJPCT1Coder.h $
|
15 |
** CREATED: 12/02/2003 3:27:34 PM
|
16 |
** AUTHOR: Simon Cope
|
17 |
** PURPOSE: CNCSJPCT1Coder class header
|
18 |
** EDITS: [xx] ddMmmyy NAME COMMENTS
|
19 |
*******************************************************/
|
20 |
|
21 |
#ifndef NCSJPCT1CODER_H
|
22 |
#define NCSJPCT1CODER_H
|
23 |
|
24 |
#include "NCSJPCTypes.h" |
25 |
#ifndef NCSJPCNODE_H
|
26 |
#include "NCSJPCNode.h" |
27 |
#endif // NCSJPCNODE_H |
28 |
#ifndef NCSJPCMQCODER_H
|
29 |
#include "NCSJPCMQCoder.h" |
30 |
#endif // NCSJPCMQCODER_H |
31 |
#include "NCSJPCQCDMarker.h" |
32 |
#include "NCSJPCMemoryIOStream.h" |
33 |
#ifndef NCSJPCSEGMENT_H
|
34 |
#include "NCSJPCSegment.h" |
35 |
#endif // NCSJPCSEGMENT_H |
36 |
|
37 |
#define NCSJPC_ENCODE_BLOCK_SIZE 64 |
38 |
/**
|
39 |
* CNCSJPCT1Coder class - the JPC T1 Coder.
|
40 |
*
|
41 |
* @author Simon Cope
|
42 |
* @version $Revision: 3538 $ $Author: nacho $ $Date: 2006-01-09 12:56:54 +0100 (Mon, 09 Jan 2006) $
|
43 |
*/
|
44 |
class NCSJPC_EXPORT_ALL CNCSJPCT1Coder: public CNCSJPCMQCoder { |
45 |
public:
|
46 |
typedef UINT32 T1_FLAG_TYPE;
|
47 |
#define NCSJPC_T1_FLAG_BUFTYPE CNCSJPCBuffer::BT_INT32
|
48 |
|
49 |
const static int PREDICTABLE_TERMINATION; |
50 |
const static int PASS_RESET_CTX; |
51 |
const static int SEGMENT_SYMBOLS; |
52 |
const static int PASS_TERMINATION; |
53 |
const static int VERTICAL_CAUSAL_CTX; |
54 |
const static int SELECTIVE_CODING_BYPASS; |
55 |
|
56 |
CNCSJPCT1Coder(); |
57 |
virtual ~CNCSJPCT1Coder(); |
58 |
|
59 |
bool Decode(NCSJPCSubBandType eSBType,
|
60 |
UINT8 roiShift, |
61 |
UINT8 nBits, |
62 |
UINT8 nZeroBits, |
63 |
std::vector<CNCSJPCSegment> &m_Segments, |
64 |
CNCSJPCBuffer *pDecBuf, |
65 |
int Flags,
|
66 |
CNCSJPCQCDMarker &Quantization, |
67 |
UINT8 nComponentBits, |
68 |
UINT16 nLevels, |
69 |
UINT8 nResolution, |
70 |
IEEE4 fReconstructionParameter); |
71 |
bool Encode(NCSJPCSubBandType eSBType,
|
72 |
UINT8 nBitsTotal, |
73 |
UINT8 &nZeroBits, |
74 |
std::vector<CNCSJPCSegment> &Segments, |
75 |
CNCSJPCBuffer *pDecBuf, |
76 |
UINT16 nRatio, |
77 |
UINT16 nLayers); |
78 |
static NCSTimeStampUs sm_usTotal;
|
79 |
static NCSTimeStampUs sm_usLast;
|
80 |
static UINT64 sm_nTotalSamples;
|
81 |
static UINT64 sm_nLastSamples;
|
82 |
|
83 |
private:
|
84 |
static UINT8 m_lut_ctxno_zc0[256]; |
85 |
static UINT8 m_lut_ctxno_zc1[256]; |
86 |
static UINT8 m_lut_ctxno_zc2[256]; |
87 |
static UINT8 m_lut_ctxno_zc3[256]; |
88 |
static UINT8 *m_plut_ctxno_zc;
|
89 |
static UINT8 m_lut_ctxno_sc[256]; |
90 |
static UINT8 m_lut_spb[256]; |
91 |
|
92 |
UINT8 *m_pEncTmpBuf; |
93 |
static INT8 sm_nBitPlane;
|
94 |
static UINT8 sm_Scb;
|
95 |
static INT32 sm_one;
|
96 |
static INT32 sm_half;
|
97 |
static INT32 sm_oneplushalf;
|
98 |
static INT32 sm_i;
|
99 |
static void DecSigPass(int w, int h); |
100 |
static void DecSigPassStep(T1_FLAG_TYPE *fp, int *dp); |
101 |
static void DecRefPass(int w, int h); |
102 |
static void DecRefPassBit0(int w, int h); |
103 |
static void DecRefPassStep(T1_FLAG_TYPE *fp, int *dp); |
104 |
static void DecRefPassStepBit0(T1_FLAG_TYPE *fp); |
105 |
static void DecClnPass(int w, int h, bool segsym); |
106 |
static void DecClnPassStep(T1_FLAG_TYPE *fp, int *dp); |
107 |
static void DecClnPassStepPartial(T1_FLAG_TYPE *fp, int *dp); |
108 |
|
109 |
static void EncSigPassStep(T1_FLAG_TYPE *fp, int *dp); |
110 |
static void EncSigPass(int w, int h); |
111 |
static void EncRefPassStep(T1_FLAG_TYPE *fp, int *dp) ; |
112 |
static void EncRefPassStepSIG(T1_FLAG_TYPE *fp, int *dp) ; |
113 |
static void EncRefPass(int w, int h); |
114 |
static void EncClnPassStep(T1_FLAG_TYPE *fp, int *dp); |
115 |
static void EncClnPassStepPartial(T1_FLAG_TYPE *fp, int *dp); |
116 |
static void EncClnPass(int w, int h); |
117 |
|
118 |
static UINT8 GetCtxNo_ZC(T1_FLAG_TYPE f);
|
119 |
static UINT8 GetCtxNo_SC(T1_FLAG_TYPE f);
|
120 |
static INT32 GetSPB(T1_FLAG_TYPE f);
|
121 |
static UINT8 GetCtxNoMag(T1_FLAG_TYPE f);
|
122 |
static void UpdateFlags(T1_FLAG_TYPE *fp, int s); |
123 |
static void EncUpdateFlags(T1_FLAG_TYPE *fp, int s); |
124 |
|
125 |
UINT8 InitCtxNoZC(T1_FLAG_TYPE f, int orient);
|
126 |
UINT8 InitCtxNoSC(T1_FLAG_TYPE f); |
127 |
INT32 InitSPB(T1_FLAG_TYPE f); |
128 |
void InitLUTs();
|
129 |
|
130 |
static UINT32 sm_EncData[(NCSJPC_ENCODE_BLOCK_SIZE) * 4 * (1 + NCSJPC_ENCODE_BLOCK_SIZE / 4)]; |
131 |
static T1_FLAG_TYPE sm_EncFlags[(NCSJPC_ENCODE_BLOCK_SIZE+2) * (NCSJPC_ENCODE_BLOCK_SIZE+2)]; |
132 |
|
133 |
static CNCSJPCBuffer sm_Data;
|
134 |
static CNCSJPCBuffer sm_Flags;
|
135 |
static CNCSJPCMemoryIOStream sm_Stream;
|
136 |
static bool GetBit(); |
137 |
}; |
138 |
|
139 |
#endif // !NCSJPCT1CODER_H |