1 // Copyright 2014 The PDFium Authors 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_ARITHINTDECODER_H_ 8 #define CORE_FXCODEC_JBIG2_JBIG2_ARITHINTDECODER_H_ 9 10 #include <stdint.h> 11 12 #include <vector> 13 14 #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" 15 16 class CJBig2_ArithIntDecoder { 17 public: 18 CJBig2_ArithIntDecoder(); 19 ~CJBig2_ArithIntDecoder(); 20 21 // Returns true on success, and false when an OOB condition occurs. Many 22 // callers can tolerate OOB and do not check the return value. 23 bool Decode(CJBig2_ArithDecoder* pArithDecoder, int* nResult); 24 25 private: 26 std::vector<JBig2ArithCtx> m_IAx; 27 }; 28 29 class CJBig2_ArithIaidDecoder { 30 public: 31 explicit CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA); 32 ~CJBig2_ArithIaidDecoder(); 33 34 void Decode(CJBig2_ArithDecoder* pArithDecoder, uint32_t* nResult); 35 36 private: 37 std::vector<JBig2ArithCtx> m_IAID; 38 39 const unsigned char SBSYMCODELEN; 40 }; 41 42 #endif // CORE_FXCODEC_JBIG2_JBIG2_ARITHINTDECODER_H_ 43