Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h

Issue 1359233002: Split up JBig2_GeneralDecoder.cpp. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _JBIG2_GENERAL_DECODER_H_
8 #define _JBIG2_GENERAL_DECODER_H_
9
10 #include "../../../include/fxcodec/fx_codec_def.h"
11 #include "../../../include/fxcrt/fx_coordinates.h"
12 #include "JBig2_ArithDecoder.h"
13 #include "JBig2_ArithIntDecoder.h"
14 #include "JBig2_Define.h"
15 #include "JBig2_SymbolDict.h"
16
17 class CJBig2_HuffmanTable;
18 class CJBig2_Image;
19 class CJBig2_PatternDict;
20
21 enum JBig2Corner {
22 JBIG2_CORNER_BOTTOMLEFT = 0,
23 JBIG2_CORNER_TOPLEFT = 1,
24 JBIG2_CORNER_BOTTOMRIGHT = 2,
25 JBIG2_CORNER_TOPRIGHT = 3
26 };
27
28 class CJBig2_GRDProc {
29 public:
30 CJBig2_GRDProc() {
31 m_loopIndex = 0;
32 m_pLine = NULL;
33 m_pPause = NULL;
34 m_DecodeType = 0;
35 LTP = 0;
36 m_ReplaceRect.left = 0;
37 m_ReplaceRect.bottom = 0;
38 m_ReplaceRect.top = 0;
39 m_ReplaceRect.right = 0;
40 }
41
42 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
43 JBig2ArithCtx* gbContext);
44
45 FXCODEC_STATUS Start_decode_Arith(CJBig2_Image** pImage,
46 CJBig2_ArithDecoder* pArithDecoder,
47 JBig2ArithCtx* gbContext,
48 IFX_Pause* pPause = NULL);
49 FXCODEC_STATUS Start_decode_MMR(CJBig2_Image** pImage,
50 CJBig2_BitStream* pStream,
51 IFX_Pause* pPause = NULL);
52 FXCODEC_STATUS Continue_decode(IFX_Pause* pPause);
53 FX_RECT GetReplaceRect() { return m_ReplaceRect; }
54
55 FX_BOOL MMR;
56 FX_DWORD GBW;
57 FX_DWORD GBH;
58 uint8_t GBTEMPLATE;
59 FX_BOOL TPGDON;
60 FX_BOOL USESKIP;
61 CJBig2_Image* SKIP;
62 int8_t GBAT[8];
63
64 private:
65 bool UseTemplate0Opt3() const;
66 bool UseTemplate1Opt3() const;
67 bool UseTemplate23Opt3() const;
68
69 FXCODEC_STATUS decode_Arith(IFX_Pause* pPause);
70 FXCODEC_STATUS decode_Arith_Template0_opt3(CJBig2_Image* pImage,
71 CJBig2_ArithDecoder* pArithDecoder,
72 JBig2ArithCtx* gbContext,
73 IFX_Pause* pPause);
74 FXCODEC_STATUS decode_Arith_Template0_unopt(
75 CJBig2_Image* pImage,
76 CJBig2_ArithDecoder* pArithDecoder,
77 JBig2ArithCtx* gbContext,
78 IFX_Pause* pPause);
79 FXCODEC_STATUS decode_Arith_Template1_opt3(CJBig2_Image* pImage,
80 CJBig2_ArithDecoder* pArithDecoder,
81 JBig2ArithCtx* gbContext,
82 IFX_Pause* pPause);
83 FXCODEC_STATUS decode_Arith_Template1_unopt(
84 CJBig2_Image* pImage,
85 CJBig2_ArithDecoder* pArithDecoder,
86 JBig2ArithCtx* gbContext,
87 IFX_Pause* pPause);
88 FXCODEC_STATUS decode_Arith_Template2_opt3(CJBig2_Image* pImage,
89 CJBig2_ArithDecoder* pArithDecoder,
90 JBig2ArithCtx* gbContext,
91 IFX_Pause* pPause);
92 FXCODEC_STATUS decode_Arith_Template2_unopt(
93 CJBig2_Image* pImage,
94 CJBig2_ArithDecoder* pArithDecoder,
95 JBig2ArithCtx* gbContext,
96 IFX_Pause* pPause);
97 FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image* pImage,
98 CJBig2_ArithDecoder* pArithDecoder,
99 JBig2ArithCtx* gbContext,
100 IFX_Pause* pPause);
101 FXCODEC_STATUS decode_Arith_Template3_unopt(
102 CJBig2_Image* pImage,
103 CJBig2_ArithDecoder* pArithDecoder,
104 JBig2ArithCtx* gbContext,
105 IFX_Pause* pPause);
106 CJBig2_Image* decode_Arith_Template0_opt3(CJBig2_ArithDecoder* pArithDecoder,
107 JBig2ArithCtx* gbContext);
108
109 CJBig2_Image* decode_Arith_Template0_unopt(CJBig2_ArithDecoder* pArithDecoder,
110 JBig2ArithCtx* gbContext);
111
112 CJBig2_Image* decode_Arith_Template1_opt3(CJBig2_ArithDecoder* pArithDecoder,
113 JBig2ArithCtx* gbContext);
114
115 CJBig2_Image* decode_Arith_Template1_unopt(CJBig2_ArithDecoder* pArithDecoder,
116 JBig2ArithCtx* gbContext);
117
118 CJBig2_Image* decode_Arith_Template2_opt3(CJBig2_ArithDecoder* pArithDecoder,
119 JBig2ArithCtx* gbContext);
120
121 CJBig2_Image* decode_Arith_Template2_unopt(CJBig2_ArithDecoder* pArithDecoder,
122 JBig2ArithCtx* gbContext);
123
124 CJBig2_Image* decode_Arith_Template3_opt3(CJBig2_ArithDecoder* pArithDecoder,
125 JBig2ArithCtx* gbContext);
126
127 CJBig2_Image* decode_Arith_Template3_unopt(CJBig2_ArithDecoder* pArithDecoder,
128 JBig2ArithCtx* gbContext);
129
130 FX_DWORD m_loopIndex;
131 uint8_t* m_pLine;
132 IFX_Pause* m_pPause;
133 FXCODEC_STATUS m_ProssiveStatus;
134 CJBig2_Image** m_pImage;
135 CJBig2_ArithDecoder* m_pArithDecoder;
136 JBig2ArithCtx* m_gbContext;
137 FX_WORD m_DecodeType;
138 FX_BOOL LTP;
139 FX_RECT m_ReplaceRect;
140 };
141
142 class CJBig2_GRRDProc {
143 public:
144 CJBig2_Image* decode(CJBig2_ArithDecoder* pArithDecoder,
145 JBig2ArithCtx* grContext);
146
147 CJBig2_Image* decode_Template0_unopt(CJBig2_ArithDecoder* pArithDecoder,
148 JBig2ArithCtx* grContext);
149
150 CJBig2_Image* decode_Template0_opt(CJBig2_ArithDecoder* pArithDecoder,
151 JBig2ArithCtx* grContext);
152
153 CJBig2_Image* decode_Template1_unopt(CJBig2_ArithDecoder* pArithDecoder,
154 JBig2ArithCtx* grContext);
155
156 CJBig2_Image* decode_Template1_opt(CJBig2_ArithDecoder* pArithDecoder,
157 JBig2ArithCtx* grContext);
158
159 FX_DWORD GRW;
160 FX_DWORD GRH;
161 FX_BOOL GRTEMPLATE;
162 CJBig2_Image* GRREFERENCE;
163 int32_t GRREFERENCEDX;
164 int32_t GRREFERENCEDY;
165 FX_BOOL TPGRON;
166 int8_t GRAT[4];
167 };
168
169 typedef struct {
170 CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH,
171 *IARDX, *IARDY;
172 CJBig2_ArithIaidDecoder* IAID;
173 } JBig2IntDecoderState;
174
175 class CJBig2_TRDProc {
176 public:
177 CJBig2_Image* decode_Huffman(CJBig2_BitStream* pStream,
178 JBig2ArithCtx* grContext);
179
180 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
181 JBig2ArithCtx* grContext,
182 JBig2IntDecoderState* pIDS = NULL);
183
184 public:
185 FX_BOOL SBHUFF;
186 FX_BOOL SBREFINE;
187 FX_DWORD SBW;
188 FX_DWORD SBH;
189 FX_DWORD SBNUMINSTANCES;
190 FX_DWORD SBSTRIPS;
191 FX_DWORD SBNUMSYMS;
192
193 JBig2HuffmanCode* SBSYMCODES;
194 uint8_t SBSYMCODELEN;
195
196 CJBig2_Image** SBSYMS;
197 FX_BOOL SBDEFPIXEL;
198
199 JBig2ComposeOp SBCOMBOP;
200 FX_BOOL TRANSPOSED;
201
202 JBig2Corner REFCORNER;
203 int8_t SBDSOFFSET;
204 CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH,
205 *SBHUFFRDX, *SBHUFFRDY, *SBHUFFRSIZE;
206 FX_BOOL SBRTEMPLATE;
207 int8_t SBRAT[4];
208 };
209 class CJBig2_SDDProc {
210 public:
211 CJBig2_SymbolDict* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
212 JBig2ArithCtx* gbContext,
213 JBig2ArithCtx* grContext);
214
215 CJBig2_SymbolDict* decode_Huffman(CJBig2_BitStream* pStream,
216 JBig2ArithCtx* gbContext,
217 JBig2ArithCtx* grContext,
218 IFX_Pause* pPause);
219
220 public:
221 FX_BOOL SDHUFF;
222 FX_BOOL SDREFAGG;
223 FX_DWORD SDNUMINSYMS;
224 CJBig2_Image** SDINSYMS;
225 FX_DWORD SDNUMNEWSYMS;
226 FX_DWORD SDNUMEXSYMS;
227 CJBig2_HuffmanTable *SDHUFFDH, *SDHUFFDW, *SDHUFFBMSIZE, *SDHUFFAGGINST;
228 uint8_t SDTEMPLATE;
229 int8_t SDAT[8];
230 FX_BOOL SDRTEMPLATE;
231 int8_t SDRAT[4];
232 };
233 class CJBig2_HTRDProc {
234 public:
235 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
236 JBig2ArithCtx* gbContext,
237 IFX_Pause* pPause);
238
239 CJBig2_Image* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause);
240
241 public:
242 FX_DWORD HBW, HBH;
243 FX_BOOL HMMR;
244 uint8_t HTEMPLATE;
245 FX_DWORD HNUMPATS;
246 CJBig2_Image** HPATS;
247 FX_BOOL HDEFPIXEL;
248 JBig2ComposeOp HCOMBOP;
249 FX_BOOL HENABLESKIP;
250 FX_DWORD HGW, HGH;
251 int32_t HGX, HGY;
252 FX_WORD HRX, HRY;
253 uint8_t HPW, HPH;
254 };
255 class CJBig2_PDDProc {
256 public:
257 CJBig2_PatternDict* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
258 JBig2ArithCtx* gbContext,
259 IFX_Pause* pPause);
260
261 CJBig2_PatternDict* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause);
262
263 public:
264 FX_BOOL HDMMR;
265 uint8_t HDPW, HDPH;
266 FX_DWORD GRAYMAX;
267 uint8_t HDTEMPLATE;
268 };
269 class CJBig2_GSIDProc {
270 public:
271 FX_DWORD* decode_Arith(CJBig2_ArithDecoder* pArithDecoder,
272 JBig2ArithCtx* gbContext,
273 IFX_Pause* pPause);
274
275 FX_DWORD* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause);
276
277 public:
278 FX_BOOL GSMMR;
279 FX_BOOL GSUSESKIP;
280 uint8_t GSBPP;
281 FX_DWORD GSW, GSH;
282 uint8_t GSTEMPLATE;
283 CJBig2_Image* GSKIP;
284 };
285 #endif
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_Context.cpp ('k') | core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698