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_ARITHDECODER_H_ 8 #define CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_ 9 10 #include <stdint.h> 11 12 #include "core/fxcrt/unowned_ptr.h" 13 14 class CJBig2_BitStream; 15 16 struct JBig2ArithCtx { JBig2ArithCtxJBig2ArithCtx17 JBig2ArithCtx() : MPS(0), I(0) {} 18 19 unsigned int MPS; 20 unsigned int I; 21 }; 22 23 class CJBig2_ArithDecoder { 24 public: 25 explicit CJBig2_ArithDecoder(CJBig2_BitStream* pStream); 26 27 ~CJBig2_ArithDecoder(); 28 29 int DECODE(JBig2ArithCtx* pCX); 30 IsComplete()31 bool IsComplete() const { return m_Complete; } 32 33 private: 34 void BYTEIN(); 35 void ReadValueA(); 36 37 bool m_Complete; 38 bool m_FinishedStream; 39 uint8_t m_B; 40 unsigned int m_C; 41 unsigned int m_A; 42 unsigned int m_CT; 43 UnownedPtr<CJBig2_BitStream> const m_pStream; 44 }; 45 46 #endif // CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_ 47