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_Context.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_CONTEXT_H_
8#define CORE_FXCODEC_JBIG2_JBIG2_CONTEXT_H_
9
10#include <list>
11#include <memory>
12#include <utility>
13#include <vector>
14
15#include "core/fxcodec/fx_codec_def.h"
16#include "core/fxcodec/jbig2/JBig2_DocumentContext.h"
17#include "core/fxcodec/jbig2/JBig2_Page.h"
18#include "core/fxcodec/jbig2/JBig2_Segment.h"
19#include "core/fxcrt/unowned_ptr.h"
20#include "third_party/base/containers/span.h"
21
23class CJBig2_GRDProc;
25
26#define JBIG2_MIN_SEGMENT_SIZE 11
27
29
31 public:
33 pdfium::span<const uint8_t> pGlobalSpan,
34 uint64_t global_key,
35 pdfium::span<const uint8_t> pSrcSpan,
36 uint64_t src_key,
37 std::list<CJBig2_CachePair>* pSymbolDictCache);
38
40
41 static bool HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES, uint32_t NTEMP);
42
43 bool GetFirstPage(pdfium::span<uint8_t> pBuf,
44 int32_t width,
45 int32_t height,
46 int32_t stride,
47 PauseIndicatorIface* pPause);
48
49 bool Continue(PauseIndicatorIface* pPause);
50 FXCODEC_STATUS GetProcessingStatus() const { return m_ProcessingStatus; }
51
52 private:
53 CJBig2_Context(pdfium::span<const uint8_t> pSrcSpan,
54 uint64_t src_key,
55 std::list<CJBig2_CachePair>* pSymbolDictCache,
56 bool bIsGlobal);
57
58 JBig2_Result DecodeSequential(PauseIndicatorIface* pPause);
59
60 CJBig2_Segment* FindSegmentByNumber(uint32_t dwNumber);
61 CJBig2_Segment* FindReferredTableSegmentByIndex(CJBig2_Segment* pSegment,
62 int32_t nIndex);
63
64 JBig2_Result ParseSegmentHeader(CJBig2_Segment* pSegment);
65 JBig2_Result ParseSegmentData(CJBig2_Segment* pSegment,
66 PauseIndicatorIface* pPause);
67 JBig2_Result ProcessingParseSegmentData(CJBig2_Segment* pSegment,
68 PauseIndicatorIface* pPause);
69 JBig2_Result ParseSymbolDict(CJBig2_Segment* pSegment);
70 JBig2_Result ParseTextRegion(CJBig2_Segment* pSegment);
71 JBig2_Result ParsePatternDict(CJBig2_Segment* pSegment,
72 PauseIndicatorIface* pPause);
73 JBig2_Result ParseHalftoneRegion(CJBig2_Segment* pSegment,
74 PauseIndicatorIface* pPause);
75 JBig2_Result ParseGenericRegion(CJBig2_Segment* pSegment,
76 PauseIndicatorIface* pPause);
77 JBig2_Result ParseGenericRefinementRegion(CJBig2_Segment* pSegment);
78 JBig2_Result ParseTable(CJBig2_Segment* pSegment);
79 JBig2_Result ParseRegionInfo(JBig2RegionInfo* pRI);
80
81 std::vector<JBig2HuffmanCode> DecodeSymbolIDHuffmanTable(uint32_t SBNUMSYMS);
82 const CJBig2_HuffmanTable* GetHuffmanTable(size_t idx);
83
84 std::unique_ptr<CJBig2_Context> m_pGlobalContext;
85 std::unique_ptr<CJBig2_BitStream> m_pStream;
86 std::vector<std::unique_ptr<CJBig2_Segment>> m_SegmentList;
87 std::vector<std::unique_ptr<JBig2PageInfo>> m_PageInfoList;
88 std::unique_ptr<CJBig2_Image> m_pPage;
89 std::vector<std::unique_ptr<CJBig2_HuffmanTable>> m_HuffmanTables;
90 const bool m_bIsGlobal;
91 bool m_bInPage = false;
92 bool m_bBufSpecified = false;
93 int32_t m_PauseStep = 10;
95 std::vector<JBig2ArithCtx> m_gbContext;
96 std::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder;
97 std::unique_ptr<CJBig2_GRDProc> m_pGRD;
98 std::unique_ptr<CJBig2_Segment> m_pSegment;
99 uint32_t m_nOffset = 0;
100 JBig2RegionInfo m_ri = {};
101 UnownedPtr<std::list<CJBig2_CachePair>> const m_pSymbolDictCache;
102};
103
104#endif // CORE_FXCODEC_JBIG2_JBIG2_CONTEXT_H_
static const size_t kSymbolDictCacheMaxSize
JBig2_Result
#define JBIG2_MIN_SEGMENT_SIZE
constexpr uint32_t kJBig2MaxNewSymbols
constexpr int32_t kJBig2MaxReferredSegmentCount
constexpr uint32_t kJBig2MaxExportSymbols
constexpr uint32_t kJBig2MaxPatternIndex
JBig2ComposeOp
Definition JBig2_Image.h:19
@ JBIG2_IMAGE_POINTER
@ JBIG2_HUFFMAN_TABLE_POINTER
@ JBIG2_SYMBOL_DICT_POINTER
@ JBIG2_PATTERN_DICT_POINTER
@ JBIG2_SEGMENT_DATA_UNPARSED
JBig2Corner
static std::unique_ptr< CJBig2_Context > Create(pdfium::span< const uint8_t > pGlobalSpan, uint64_t global_key, pdfium::span< const uint8_t > pSrcSpan, uint64_t src_key, std::list< CJBig2_CachePair > *pSymbolDictCache)
static bool HuffmanAssignCode(JBig2HuffmanCode *SBSYMCODES, uint32_t NTEMP)
bool GetFirstPage(pdfium::span< uint8_t > pBuf, int32_t width, int32_t height, int32_t stride, PauseIndicatorIface *pPause)
bool Continue(PauseIndicatorIface *pPause)
FXCODEC_STATUS GetProcessingStatus() const
static bool IsValidImageSize(int32_t w, int32_t h)
JBig2_SegmentState m_State
JBig2_ResultType m_nResultType
uint8_t page_association_size
int32_t m_nReferred_to_segment_count
uint32_t m_dwPage_association
uint32_t m_dwNumber
virtual bool NeedToPauseNow()=0
FXCODEC_STATUS