OLD | NEW |
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> |
| 17 typedef std::pair<FX_BYTE*, CJBig2_SymbolDict*> CJBig2_CachePair; |
16 typedef enum { | 18 typedef enum { |
17 JBIG2_OUT_OF_PAGE = 0, | 19 JBIG2_OUT_OF_PAGE = 0, |
18 JBIG2_IN_PAGE, | 20 JBIG2_IN_PAGE, |
19 } JBig2State; | 21 } JBig2State; |
20 #define JBIG2_SUCCESS 0 | 22 #define JBIG2_SUCCESS 0 |
21 #define JBIG2_FAILED -1 | 23 #define JBIG2_FAILED -1 |
22 #define JBIG2_ERROR_TOO_SHORT -2 | 24 #define JBIG2_ERROR_TOO_SHORT -2 |
23 #define JBIG2_ERROR_FETAL -3 | 25 #define JBIG2_ERROR_FETAL -3 |
24 #define JBIG2_END_OF_PAGE 2 | 26 #define JBIG2_END_OF_PAGE 2 |
25 #define JBIG2_END_OF_FILE 3 | 27 #define JBIG2_END_OF_FILE 3 |
26 #define JBIG2_ERROR_FILE_FORMAT -4 | 28 #define JBIG2_ERROR_FILE_FORMAT -4 |
27 #define JBIG2_ERROR_STREAM_TYPE -5 | 29 #define JBIG2_ERROR_STREAM_TYPE -5 |
28 #define JBIG2_ERROR_LIMIT -6 | 30 #define JBIG2_ERROR_LIMIT -6 |
29 #define JBIG2_FILE_STREAM 0 | 31 #define JBIG2_FILE_STREAM 0 |
30 #define JBIG2_SQUENTIAL_STREAM 1 | 32 #define JBIG2_SQUENTIAL_STREAM 1 |
31 #define JBIG2_RANDOM_STREAM 2 | 33 #define JBIG2_RANDOM_STREAM 2 |
32 #define JBIG2_EMBED_STREAM 3 | 34 #define JBIG2_EMBED_STREAM 3 |
33 #define JBIG2_MIN_SEGMENT_SIZE 11 | 35 #define JBIG2_MIN_SEGMENT_SIZE 11 |
34 class CJBig2_Context : public CJBig2_Object | 36 class CJBig2_Context : public CJBig2_Object |
35 { | 37 { |
36 public: | 38 public: |
37 | 39 |
38 static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGloba
lData, FX_DWORD dwGlobalLength, | 40 static CJBig2_Context *CreateContext(CJBig2_Module *pModule, FX_BYTE *pGloba
lData, FX_DWORD dwGlobalLength, |
39 FX_BYTE *pData, FX_DWORD dwLength, FX_I
NT32 nStreamType, IFX_Pause* pPause = NULL); | 41 FX_BYTE *pData, FX_DWORD dwLength, FX_I
NT32 nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPau
se = NULL); |
40 | 42 |
41 static void DestroyContext(CJBig2_Context *pContext); | 43 static void DestroyContext(CJBig2_Context *pContext); |
42 | 44 |
43 FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT
32 stride, IFX_Pause* pPause); | 45 FX_INT32 getFirstPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT
32 stride, IFX_Pause* pPause); |
44 | 46 |
45 FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT3
2 stride, IFX_Pause* pPause); | 47 FX_INT32 getNextPage(FX_BYTE *pBuf, FX_INT32 width, FX_INT32 height, FX_INT3
2 stride, IFX_Pause* pPause); |
46 | 48 |
47 FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); | 49 FX_INT32 getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); |
48 | 50 |
49 FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); | 51 FX_INT32 getNextPage(CJBig2_Image **image, IFX_Pause* pPause); |
50 FX_INT32 Continue(IFX_Pause* pPause); | 52 FX_INT32 Continue(IFX_Pause* pPause); |
51 FXCODEC_STATUS GetProcessiveStatus() | 53 FXCODEC_STATUS GetProcessiveStatus() |
52 { | 54 { |
53 return m_ProcessiveStatus; | 55 return m_ProcessiveStatus; |
54 }; | 56 }; |
55 private: | 57 private: |
56 | 58 |
57 CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, | 59 CJBig2_Context(FX_BYTE *pGlobalData, FX_DWORD dwGlobalLength, |
58 FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, IFX_
Pause* pPause); | 60 FX_BYTE *pData, FX_DWORD dwLength, FX_INT32 nStreamType, std:
:list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); |
59 | 61 |
60 ~CJBig2_Context(); | 62 ~CJBig2_Context(); |
61 | 63 |
62 FX_INT32 decodeFile(IFX_Pause* pPause); | 64 FX_INT32 decodeFile(IFX_Pause* pPause); |
63 | 65 |
64 FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); | 66 FX_INT32 decode_SquentialOrgnazation(IFX_Pause* pPause); |
65 | 67 |
66 FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); | 68 FX_INT32 decode_EmbedOrgnazation(IFX_Pause* pPause); |
67 | 69 |
68 FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); | 70 FX_INT32 decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 IFX_Pause* m_pPause; | 126 IFX_Pause* m_pPause; |
125 FX_INT32 m_PauseStep; | 127 FX_INT32 m_PauseStep; |
126 FXCODEC_STATUS m_ProcessiveStatus; | 128 FXCODEC_STATUS m_ProcessiveStatus; |
127 FX_BOOL m_bFirstPage; | 129 FX_BOOL m_bFirstPage; |
128 CJBig2_ArithDecoder *m_pArithDecoder; | 130 CJBig2_ArithDecoder *m_pArithDecoder; |
129 CJBig2_GRDProc *m_pGRD; | 131 CJBig2_GRDProc *m_pGRD; |
130 JBig2ArithCtx *m_gbContext; | 132 JBig2ArithCtx *m_gbContext; |
131 CJBig2_Segment *m_pSegment; | 133 CJBig2_Segment *m_pSegment; |
132 FX_DWORD m_dwOffset; | 134 FX_DWORD m_dwOffset; |
133 JBig2RegionInfo m_ri; | 135 JBig2RegionInfo m_ri; |
| 136 std::list<CJBig2_CachePair>* m_pSymbolDictCache; |
134 }; | 137 }; |
135 #endif | 138 #endif |
OLD | NEW |