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 CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ | 7 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ |
8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ | 8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
| 11 #include <memory> |
11 #include <utility> | 12 #include <utility> |
12 | 13 |
13 #include "JBig2_List.h" | 14 #include "JBig2_List.h" |
14 #include "JBig2_Page.h" | 15 #include "JBig2_Page.h" |
15 #include "JBig2_Segment.h" | 16 #include "JBig2_Segment.h" |
16 #include "core/include/fpdfapi/fpdf_objects.h" | 17 #include "core/include/fpdfapi/fpdf_objects.h" |
17 #include "core/include/fxcodec/fx_codec_def.h" | 18 #include "core/include/fxcodec/fx_codec_def.h" |
18 #include "third_party/base/nonstd_unique_ptr.h" | |
19 | 19 |
20 class CJBig2_ArithDecoder; | 20 class CJBig2_ArithDecoder; |
21 class CJBig2_GRDProc; | 21 class CJBig2_GRDProc; |
22 class IFX_Pause; | 22 class IFX_Pause; |
23 | 23 |
24 // Cache is keyed by the ObjNum of a stream and an index within the stream. | 24 // Cache is keyed by the ObjNum of a stream and an index within the stream. |
25 using CJBig2_CacheKey = std::pair<FX_DWORD, FX_DWORD>; | 25 using CJBig2_CacheKey = std::pair<FX_DWORD, FX_DWORD>; |
26 // NB: CJBig2_SymbolDict* is owned. | 26 // NB: CJBig2_SymbolDict* is owned. |
27 using CJBig2_CachePair = std::pair<CJBig2_CacheKey, CJBig2_SymbolDict*>; | 27 using CJBig2_CachePair = std::pair<CJBig2_CacheKey, CJBig2_SymbolDict*>; |
28 | 28 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 JBig2HuffmanCode* decodeSymbolIDHuffmanTable(CJBig2_BitStream* pStream, | 104 JBig2HuffmanCode* decodeSymbolIDHuffmanTable(CJBig2_BitStream* pStream, |
105 FX_DWORD SBNUMSYMS); | 105 FX_DWORD SBNUMSYMS); |
106 | 106 |
107 void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); | 107 void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); |
108 | 108 |
109 void huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, int NTEMP); | 109 void huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, int NTEMP); |
110 | 110 |
111 private: | 111 private: |
112 CJBig2_Context* m_pGlobalContext; | 112 CJBig2_Context* m_pGlobalContext; |
113 nonstd::unique_ptr<CJBig2_BitStream> m_pStream; | 113 std::unique_ptr<CJBig2_BitStream> m_pStream; |
114 CJBig2_List<CJBig2_Segment> m_SegmentList; | 114 CJBig2_List<CJBig2_Segment> m_SegmentList; |
115 CJBig2_List<JBig2PageInfo> m_PageInfoList; | 115 CJBig2_List<JBig2PageInfo> m_PageInfoList; |
116 nonstd::unique_ptr<CJBig2_Image> m_pPage; | 116 std::unique_ptr<CJBig2_Image> m_pPage; |
117 size_t m_nSegmentDecoded; | 117 size_t m_nSegmentDecoded; |
118 bool m_bInPage; | 118 bool m_bInPage; |
119 bool m_bBufSpecified; | 119 bool m_bBufSpecified; |
120 int32_t m_PauseStep; | 120 int32_t m_PauseStep; |
121 IFX_Pause* m_pPause; | 121 IFX_Pause* m_pPause; |
122 FXCODEC_STATUS m_ProcessingStatus; | 122 FXCODEC_STATUS m_ProcessingStatus; |
123 nonstd::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder; | 123 std::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder; |
124 nonstd::unique_ptr<CJBig2_GRDProc> m_pGRD; | 124 std::unique_ptr<CJBig2_GRDProc> m_pGRD; |
125 JBig2ArithCtx* m_gbContext; | 125 JBig2ArithCtx* m_gbContext; |
126 nonstd::unique_ptr<CJBig2_Segment> m_pSegment; | 126 std::unique_ptr<CJBig2_Segment> m_pSegment; |
127 FX_DWORD m_dwOffset; | 127 FX_DWORD m_dwOffset; |
128 JBig2RegionInfo m_ri; | 128 JBig2RegionInfo m_ri; |
129 std::list<CJBig2_CachePair>* const m_pSymbolDictCache; | 129 std::list<CJBig2_CachePair>* const m_pSymbolDictCache; |
130 bool m_bIsGlobal; | 130 bool m_bIsGlobal; |
131 }; | 131 }; |
132 | 132 |
133 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ | 133 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ |
OLD | NEW |