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_HUFFMAN_TABLE_H_ | 7 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_H_ |
8 #define _JBIG2_HUFFMAN_TABLE_H_ | 8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_H_ |
9 | 9 |
10 #include "JBig2_HuffmanTable_Standard.h" | 10 #include <vector> |
11 #include "JBig2_BitStream.h" | 11 |
| 12 #include "core/include/fxcrt/fx_system.h" |
| 13 |
| 14 class CJBig2_BitStream; |
| 15 struct JBig2TableLine; |
12 | 16 |
13 class CJBig2_HuffmanTable { | 17 class CJBig2_HuffmanTable { |
14 public: | 18 public: |
15 CJBig2_HuffmanTable(const JBig2TableLine* pTable, int nLines, FX_BOOL bHTOOB); | 19 CJBig2_HuffmanTable(const JBig2TableLine* pTable, |
| 20 FX_DWORD nLines, |
| 21 bool bHTOOB); |
16 | 22 |
17 explicit CJBig2_HuffmanTable(CJBig2_BitStream* pStream); | 23 explicit CJBig2_HuffmanTable(CJBig2_BitStream* pStream); |
18 | 24 |
19 ~CJBig2_HuffmanTable(); | 25 ~CJBig2_HuffmanTable(); |
20 | 26 |
21 int parseFromStandardTable(const JBig2TableLine* pTable, | 27 bool IsHTOOB() const { return HTOOB; } |
22 int nLines, | 28 FX_DWORD Size() const { return NTEMP; } |
23 FX_BOOL bHTOOB); | 29 const std::vector<int>& GetCODES() const { return CODES; } |
24 | 30 const std::vector<int>& GetPREFLEN() const { return PREFLEN; } |
25 int parseFromCodedBuffer(CJBig2_BitStream* pStream); | 31 const std::vector<int>& GetRANGELEN() const { return RANGELEN; } |
26 | 32 const std::vector<int>& GetRANGELOW() const { return RANGELOW; } |
27 FX_BOOL isOK() const { return m_bOK; } | 33 bool IsOK() const { return m_bOK; } |
28 | 34 |
29 private: | 35 private: |
30 void init(); | 36 void ParseFromStandardTable(const JBig2TableLine* pTable); |
| 37 bool ParseFromCodedBuffer(CJBig2_BitStream* pStream); |
| 38 void InitCodes(); |
| 39 void ExtendBuffers(bool increment); |
31 | 40 |
32 FX_BOOL HTOOB; | 41 bool m_bOK; |
| 42 bool HTOOB; |
33 FX_DWORD NTEMP; | 43 FX_DWORD NTEMP; |
34 int* CODES; | 44 std::vector<int> CODES; |
35 int* PREFLEN; | 45 std::vector<int> PREFLEN; |
36 int* RANGELEN; | 46 std::vector<int> RANGELEN; |
37 int* RANGELOW; | 47 std::vector<int> RANGELOW; |
38 FX_BOOL m_bOK; | |
39 friend class CJBig2_HuffmanDecoder; | |
40 }; | 48 }; |
41 #endif | 49 |
| 50 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_HUFFMANTABLE_H_ |
OLD | NEW |