1 // Copyright 2015 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_SDDPROC_H_
8 #define CORE_FXCODEC_JBIG2_JBIG2_SDDPROC_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h"
14 #include "core/fxcrt/fx_system.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 
17 class CJBig2_BitStream;
18 class CJBig2_HuffmanTable;
19 class CJBig2_Image;
20 class CJBig2_SymbolDict;
21 
22 class CJBig2_SDDProc {
23  public:
24   CJBig2_SDDProc();
25   ~CJBig2_SDDProc();
26 
27   std::unique_ptr<CJBig2_SymbolDict> DecodeArith(
28       CJBig2_ArithDecoder* pArithDecoder,
29       std::vector<JBig2ArithCtx>* gbContext,
30       std::vector<JBig2ArithCtx>* grContext);
31 
32   std::unique_ptr<CJBig2_SymbolDict> DecodeHuffman(
33       CJBig2_BitStream* pStream,
34       std::vector<JBig2ArithCtx>* gbContext,
35       std::vector<JBig2ArithCtx>* grContext);
36 
37   bool SDHUFF;
38   bool SDREFAGG;
39   bool SDRTEMPLATE;
40   uint8_t SDTEMPLATE;
41   uint32_t SDNUMINSYMS;
42   uint32_t SDNUMNEWSYMS;
43   uint32_t SDNUMEXSYMS;
44   CJBig2_Image** SDINSYMS;
45   UnownedPtr<const CJBig2_HuffmanTable> SDHUFFDH;
46   UnownedPtr<const CJBig2_HuffmanTable> SDHUFFDW;
47   UnownedPtr<const CJBig2_HuffmanTable> SDHUFFBMSIZE;
48   UnownedPtr<const CJBig2_HuffmanTable> SDHUFFAGGINST;
49   int8_t SDAT[8];
50   int8_t SDRAT[4];
51 };
52 
53 #endif  // CORE_FXCODEC_JBIG2_JBIG2_SDDPROC_H_
54