1// Copyright 2015 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_TRDPROC_H_ 8#define CORE_FXCODEC_JBIG2_JBIG2_TRDPROC_H_ 9 10#include <memory> 11#include <vector> 12 13#include "core/fxcodec/jbig2/JBig2_Image.h" 14#include "core/fxcrt/fx_system.h" 15 16class CJBig2_ArithDecoder; 17class CJBig2_ArithIaidDecoder; 18class CJBig2_ArithIntDecoder; 19class CJBig2_BitStream; 20class CJBig2_HuffmanTable; 21struct JBig2ArithCtx; 22struct JBig2HuffmanCode; 23 24struct JBig2IntDecoderState { 25 CJBig2_ArithIntDecoder* IADT; 26 CJBig2_ArithIntDecoder* IAFS; 27 CJBig2_ArithIntDecoder* IADS; 28 CJBig2_ArithIntDecoder* IAIT; 29 CJBig2_ArithIntDecoder* IARI; 30 CJBig2_ArithIntDecoder* IARDW; 31 CJBig2_ArithIntDecoder* IARDH; 32 CJBig2_ArithIntDecoder* IARDX; 33 CJBig2_ArithIntDecoder* IARDY; 34 CJBig2_ArithIaidDecoder* IAID; 35}; 36 37enum JBig2Corner { 38 JBIG2_CORNER_BOTTOMLEFT = 0, 39 JBIG2_CORNER_TOPLEFT = 1, 40 JBIG2_CORNER_BOTTOMRIGHT = 2, 41 JBIG2_CORNER_TOPRIGHT = 3 42}; 43 44class CJBig2_TRDProc { 45 public: 46 CJBig2_TRDProc(); 47 ~CJBig2_TRDProc(); 48 49 std::unique_ptr<CJBig2_Image> decode_Huffman(CJBig2_BitStream* pStream, 50 JBig2ArithCtx* grContext); 51 52 std::unique_ptr<CJBig2_Image> decode_Arith(CJBig2_ArithDecoder* pArithDecoder, 53 JBig2ArithCtx* grContext, 54 JBig2IntDecoderState* pIDS); 55 56 bool SBHUFF; 57 bool SBREFINE; 58 uint32_t SBW; 59 uint32_t SBH; 60 uint32_t SBNUMINSTANCES; 61 uint32_t SBSTRIPS; 62 uint32_t SBNUMSYMS; 63 64 std::vector<JBig2HuffmanCode> SBSYMCODES; 65 uint8_t SBSYMCODELEN; 66 67 CJBig2_Image** SBSYMS; 68 bool SBDEFPIXEL; 69 70 JBig2ComposeOp SBCOMBOP; 71 bool TRANSPOSED; 72 73 JBig2Corner REFCORNER; 74 int8_t SBDSOFFSET; 75 CJBig2_HuffmanTable* SBHUFFFS; 76 CJBig2_HuffmanTable* SBHUFFDS; 77 CJBig2_HuffmanTable* SBHUFFDT; 78 CJBig2_HuffmanTable* SBHUFFRDW; 79 CJBig2_HuffmanTable* SBHUFFRDH; 80 CJBig2_HuffmanTable* SBHUFFRDX; 81 CJBig2_HuffmanTable* SBHUFFRDY; 82 CJBig2_HuffmanTable* SBHUFFRSIZE; 83 bool SBRTEMPLATE; 84 int8_t SBRAT[4]; 85}; 86 87#endif // CORE_FXCODEC_JBIG2_JBIG2_TRDPROC_H_ 88