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

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

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 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
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_BitStream.h ('k') | core/src/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _JBIG2_CONTEXT_H_ 7 #ifndef _JBIG2_CONTEXT_H_
8 #define _JBIG2_CONTEXT_H_ 8 #define _JBIG2_CONTEXT_H_
9 #include "JBig2_Module.h" 9 #include "JBig2_Module.h"
10 #include "JBig2_List.h" 10 #include "JBig2_List.h"
11 #include "JBig2_Segment.h" 11 #include "JBig2_Segment.h"
12 #include "JBig2_Page.h" 12 #include "JBig2_Page.h"
13 #include "JBig2_GeneralDecoder.h" 13 #include "JBig2_GeneralDecoder.h"
14 #include "../../../include/fxcodec/fx_codec_def.h" 14 #include "../../../include/fxcodec/fx_codec_def.h"
15 #include "../../../include/fxcrt/fx_basic.h" 15 #include "../../../include/fxcrt/fx_basic.h"
16 #include <utility> 16 #include <utility>
17 typedef std::pair<FX_BYTE*, CJBig2_SymbolDict*> CJBig2_CachePair; 17 typedef std::pair<uint8_t*, CJBig2_SymbolDict*> CJBig2_CachePair;
18 typedef enum { 18 typedef enum {
19 JBIG2_OUT_OF_PAGE = 0, 19 JBIG2_OUT_OF_PAGE = 0,
20 JBIG2_IN_PAGE, 20 JBIG2_IN_PAGE,
21 } JBig2State; 21 } JBig2State;
22 #define JBIG2_SUCCESS 0 22 #define JBIG2_SUCCESS 0
23 #define JBIG2_FAILED -1 23 #define JBIG2_FAILED -1
24 #define JBIG2_ERROR_TOO_SHORT -2 24 #define JBIG2_ERROR_TOO_SHORT -2
25 #define JBIG2_ERROR_FETAL -3 25 #define JBIG2_ERROR_FETAL -3
26 #define JBIG2_END_OF_PAGE 2 26 #define JBIG2_END_OF_PAGE 2
27 #define JBIG2_END_OF_FILE 3 27 #define JBIG2_END_OF_FILE 3
28 #define JBIG2_ERROR_FILE_FORMAT -4 28 #define JBIG2_ERROR_FILE_FORMAT -4
29 #define JBIG2_ERROR_STREAM_TYPE -5 29 #define JBIG2_ERROR_STREAM_TYPE -5
30 #define JBIG2_ERROR_LIMIT -6 30 #define JBIG2_ERROR_LIMIT -6
31 #define JBIG2_FILE_STREAM 0 31 #define JBIG2_FILE_STREAM 0
32 #define JBIG2_SQUENTIAL_STREAM 1 32 #define JBIG2_SQUENTIAL_STREAM 1
33 #define JBIG2_RANDOM_STREAM 2 33 #define JBIG2_RANDOM_STREAM 2
34 #define JBIG2_EMBED_STREAM 3 34 #define JBIG2_EMBED_STREAM 3
35 #define JBIG2_MIN_SEGMENT_SIZE 11 35 #define JBIG2_MIN_SEGMENT_SIZE 11
36 class CJBig2_Context : public CJBig2_Object 36 class CJBig2_Context : public CJBig2_Object
37 { 37 {
38 public: 38 public:
39 39
40 static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGloba lData, FX_DWORD dwGlobalLength, 40 static CJBig2_Context *CreateContext(CJBig2_Module *pModule, uint8_t *pGloba lData, FX_DWORD dwGlobalLength,
41 FX_BYTE *pData, FX_DWORD dwLength, FX_I NT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPau se = NULL); 41 uint8_t *pData, FX_DWORD dwLength, int3 2_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPaus e = NULL);
42 42
43 static void DestroyContext(CJBig2_Context *pContext); 43 static void DestroyContext(CJBig2_Context *pContext);
44 44
45 FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT 32 stride, IFX_Pause* pPause); 45 int32_t getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t s tride, IFX_Pause* pPause);
46 46
47 FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT3 2 stride, IFX_Pause* pPause); 47 int32_t getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t st ride, IFX_Pause* pPause);
48 48
49 FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); 49 int32_t getFirstPage(CJBig2_Image **image, IFX_Pause* pPause);
50 50
51 FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); 51 int32_t getNextPage(CJBig2_Image **image, IFX_Pause* pPause);
52 FX_INT32 Continue(IFX_Pause* pPause); 52 int32_t Continue(IFX_Pause* pPause);
53 FXCODEC_STATUS GetProcessiveStatus() 53 FXCODEC_STATUS GetProcessiveStatus()
54 { 54 {
55 return m_ProcessiveStatus; 55 return m_ProcessiveStatus;
56 }; 56 };
57 private: 57 private:
58 58
59 CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, 59 CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength,
60 FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std: :list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); 60 uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std:: list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause);
61 61
62 ~CJBig2_Context(); 62 ~CJBig2_Context();
63 63
64 FX_INT32 decodeFile(IFX_Pause* pPause); 64 int32_t decodeFile(IFX_Pause* pPause);
65 65
66 FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); 66 int32_t decode_SquentialOrgnazation(IFX_Pause* pPause);
67 67
68 FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); 68 int32_t decode_EmbedOrgnazation(IFX_Pause* pPause);
69 69
70 FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); 70 int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause);
71 71
72 FX_INT32 decode_RandomOrgnazation(IFX_Pause* pPause); 72 int32_t decode_RandomOrgnazation(IFX_Pause* pPause);
73 73
74 CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber); 74 CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber);
75 75
76 CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, FX_BYTE cType, FX_INT32 nIndex); 76 CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, uint8_t cType, int32_t nIndex);
77 77
78 FX_INT32 parseSegmentHeader(CJBig2_Segment *pSegment); 78 int32_t parseSegmentHeader(CJBig2_Segment *pSegment);
79 79
80 FX_INT32 parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); 80 int32_t parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause);
81 FX_INT32 ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPa use); 81 int32_t ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPau se);
82 82
83 FX_INT32 parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); 83 int32_t parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause);
84 84
85 FX_INT32 parseTextRegion(CJBig2_Segment *pSegment); 85 int32_t parseTextRegion(CJBig2_Segment *pSegment);
86 86
87 FX_INT32 parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); 87 int32_t parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause);
88 88
89 FX_INT32 parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); 89 int32_t parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause);
90 90
91 FX_INT32 parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); 91 int32_t parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause);
92 92
93 FX_INT32 parseGenericRefinementRegion(CJBig2_Segment *pSegment); 93 int32_t parseGenericRefinementRegion(CJBig2_Segment *pSegment);
94 94
95 FX_INT32 parseTable(CJBig2_Segment *pSegment); 95 int32_t parseTable(CJBig2_Segment *pSegment);
96 96
97 FX_INT32 parseRegionInfo(JBig2RegionInfo *pRI); 97 int32_t parseRegionInfo(JBig2RegionInfo *pRI);
98 98
99 99
100 100
101 JBig2HuffmanCode *decodeSymbolIDHuffmanTable(CJBig2_BitStream *pStream, FX_D WORD SBNUMSYMS); 101 JBig2HuffmanCode *decodeSymbolIDHuffmanTable(CJBig2_BitStream *pStream, FX_D WORD SBNUMSYMS);
102 102
103 void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); 103 void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP);
104 104
105 void huffman_assign_code(JBig2HuffmanCode *SBSYMCODES, int NTEMP); 105 void huffman_assign_code(JBig2HuffmanCode *SBSYMCODES, int NTEMP);
106 106
107 private: 107 private:
108 108
109 CJBig2_Context *m_pGlobalContext; 109 CJBig2_Context *m_pGlobalContext;
110 110
111 FX_INT32 m_nStreamType; 111 int32_t m_nStreamType;
112 112
113 CJBig2_BitStream *m_pStream; 113 CJBig2_BitStream *m_pStream;
114 114
115 FX_INT32 m_nState; 115 int32_t m_nState;
116 116
117 CJBig2_List<CJBig2_Segment> *m_pSegmentList; 117 CJBig2_List<CJBig2_Segment> *m_pSegmentList;
118 118
119 CJBig2_List<JBig2PageInfo> *m_pPageInfoList; 119 CJBig2_List<JBig2PageInfo> *m_pPageInfoList;
120 120
121 CJBig2_Image *m_pPage; 121 CJBig2_Image *m_pPage;
122 122
123 FX_BOOL m_bBufSpecified; 123 FX_BOOL m_bBufSpecified;
124 124
125 FX_INT32 m_nSegmentDecoded; 125 int32_t m_nSegmentDecoded;
126 IFX_Pause* m_pPause; 126 IFX_Pause* m_pPause;
127 FX_INT32» m_PauseStep; 127 int32_t» m_PauseStep;
128 FXCODEC_STATUS m_ProcessiveStatus; 128 FXCODEC_STATUS m_ProcessiveStatus;
129 FX_BOOL m_bFirstPage; 129 FX_BOOL m_bFirstPage;
130 CJBig2_ArithDecoder *m_pArithDecoder; 130 CJBig2_ArithDecoder *m_pArithDecoder;
131 CJBig2_GRDProc *m_pGRD; 131 CJBig2_GRDProc *m_pGRD;
132 JBig2ArithCtx *m_gbContext; 132 JBig2ArithCtx *m_gbContext;
133 CJBig2_Segment *m_pSegment; 133 CJBig2_Segment *m_pSegment;
134 FX_DWORD m_dwOffset; 134 FX_DWORD m_dwOffset;
135 JBig2RegionInfo m_ri; 135 JBig2RegionInfo m_ri;
136 std::list<CJBig2_CachePair>* m_pSymbolDictCache; 136 std::list<CJBig2_CachePair>* m_pSymbolDictCache;
137 }; 137 };
138 #endif 138 #endif
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_BitStream.h ('k') | core/src/fxcodec/jbig2/JBig2_Context.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698