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_SRC_FXCODEC_JBIG2_JBIG2_TRDPROC_H_
      8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_TRDPROC_H_
      9 
     10 #include "JBig2_Image.h"
     11 #include "core/include/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 = NULL);
     49 
     50  public:
     51   FX_BOOL SBHUFF;
     52   FX_BOOL SBREFINE;
     53   FX_DWORD SBW;
     54   FX_DWORD SBH;
     55   FX_DWORD SBNUMINSTANCES;
     56   FX_DWORD SBSTRIPS;
     57   FX_DWORD SBNUMSYMS;
     58 
     59   JBig2HuffmanCode* SBSYMCODES;
     60   uint8_t SBSYMCODELEN;
     61 
     62   CJBig2_Image** SBSYMS;
     63   FX_BOOL SBDEFPIXEL;
     64 
     65   JBig2ComposeOp SBCOMBOP;
     66   FX_BOOL TRANSPOSED;
     67 
     68   JBig2Corner REFCORNER;
     69   int8_t SBDSOFFSET;
     70   CJBig2_HuffmanTable* SBHUFFFS;
     71   CJBig2_HuffmanTable* SBHUFFDS;
     72   CJBig2_HuffmanTable* SBHUFFDT;
     73   CJBig2_HuffmanTable* SBHUFFRDW;
     74   CJBig2_HuffmanTable* SBHUFFRDH;
     75   CJBig2_HuffmanTable* SBHUFFRDX;
     76   CJBig2_HuffmanTable* SBHUFFRDY;
     77   CJBig2_HuffmanTable* SBHUFFRSIZE;
     78   FX_BOOL SBRTEMPLATE;
     79   int8_t SBRAT[4];
     80 };
     81 
     82 #endif  // CORE_SRC_FXCODEC_JBIG2_JBIG2_TRDPROC_H_
     83