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