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/fx_memory_wrappers.h"
13#include "core/fxcrt/unowned_ptr.h"
14
16struct JBig2ArithQe;
17
19 public:
20 struct JBig2ArithQe {
21 uint16_t Qe;
22 uint8_t NMPS;
23 uint8_t NLPS;
24 bool bSwitch;
25 };
26
28
29 int DecodeNLPS(const JBig2ArithQe& qe);
30 int DecodeNMPS(const JBig2ArithQe& qe);
31
32 unsigned int MPS() const { return m_MPS ? 1 : 0; }
33 unsigned int I() const { return m_I; }
34
35 private:
36 bool m_MPS = false;
37 unsigned int m_I = 0;
38};
40
42 public:
43 explicit CJBig2_ArithDecoder(CJBig2_BitStream* pStream);
45
46 int Decode(JBig2ArithCtx* pCX);
47
48 bool IsComplete() const { return m_Complete; }
49
50 private:
51 enum class StreamState : uint8_t {
52 kDataAvailable,
53 kDecodingFinished,
54 kLooping,
55 };
56
57 void BYTEIN();
58 void ReadValueA();
59
60 bool m_Complete = false;
61 StreamState m_State = StreamState::kDataAvailable;
62 uint8_t m_B;
63 unsigned int m_C;
64 unsigned int m_A;
65 unsigned int m_CT;
66 UnownedPtr<CJBig2_BitStream> const m_pStream;
67};
68
69#endif // CORE_FXCODEC_JBIG2_JBIG2_ARITHDECODER_H_
#define CHECK_LT(x, y)
Definition check_op.h:12
#define DCHECK_LT(x, y)
Definition check_op.h:19
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
#define FX_DATA_PARTITION_EXCEPTION(T)