Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
JBig2_ArithDecoder.h
Go to the documentation of this file.
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_ARITHDECODER_H_
8#define CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_
9
10#include <stdint.h>
11
12#include "core/fxcrt/unowned_ptr.h"
13
15struct JBig2ArithQe;
16
18 public:
19 struct JBig2ArithQe {
20 uint16_t Qe;
21 uint8_t NMPS;
22 uint8_t NLPS;
23 bool bSwitch;
24 };
25
27
28 int DecodeNLPS(const JBig2ArithQe& qe);
29 int DecodeNMPS(const JBig2ArithQe& qe);
30
31 unsigned int MPS() const { return m_MPS ? 1 : 0; }
32 unsigned int I() const { return m_I; }
33
34 private:
35 bool m_MPS = false;
36 unsigned int m_I = 0;
37};
38
40 public:
41 explicit CJBig2_ArithDecoder(CJBig2_BitStream* pStream);
43
44 int Decode(JBig2ArithCtx* pCX);
45
46 bool IsComplete() const { return m_Complete; }
47
48 private:
49 enum class StreamState : uint8_t {
50 kDataAvailable,
51 kDecodingFinished,
52 kLooping,
53 };
54
55 void BYTEIN();
56 void ReadValueA();
57
58 bool m_Complete = false;
59 StreamState m_State = StreamState::kDataAvailable;
60 uint8_t m_B;
61 unsigned int m_C;
62 unsigned int m_A;
63 unsigned int m_CT;
64 UnownedPtr<CJBig2_BitStream> const m_pStream;
65};
66
67#endif // CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_
CJBig2_ArithDecoder(CJBig2_BitStream *pStream)
int Decode(JBig2ArithCtx *pCX)
int DecodeNLPS(const JBig2ArithQe &qe)
unsigned int I() const
int DecodeNMPS(const JBig2ArithQe &qe)
unsigned int MPS() const