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