• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 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_GRRDPROC_H_
8 #define CORE_FXCODEC_JBIG2_JBIG2_GRRDPROC_H_
9 
10 #include <stdint.h>
11 
12 #include <memory>
13 
14 #include "core/fxcrt/unowned_ptr.h"
15 
16 class CJBig2_ArithDecoder;
17 class CJBig2_Image;
18 class JBig2ArithCtx;
19 
20 class CJBig2_GRRDProc {
21  public:
22   CJBig2_GRRDProc();
23   ~CJBig2_GRRDProc();
24 
25   std::unique_ptr<CJBig2_Image> Decode(CJBig2_ArithDecoder* pArithDecoder,
26                                        JBig2ArithCtx* grContext);
27 
28   bool GRTEMPLATE;
29   bool TPGRON;
30   uint32_t GRW;
31   uint32_t GRH;
32   int32_t GRREFERENCEDX;
33   int32_t GRREFERENCEDY;
34   UnownedPtr<CJBig2_Image> GRREFERENCE;
35   int8_t GRAT[4];
36 
37  private:
38   std::unique_ptr<CJBig2_Image> DecodeTemplate0Unopt(
39       CJBig2_ArithDecoder* pArithDecoder,
40       JBig2ArithCtx* grContext);
41   uint32_t DecodeTemplate0UnoptCalculateContext(const CJBig2_Image& GRREG,
42                                                 const uint32_t* lines,
43                                                 uint32_t w,
44                                                 uint32_t h) const;
45   void DecodeTemplate0UnoptSetPixel(CJBig2_Image* GRREG,
46                                     uint32_t* lines,
47                                     uint32_t w,
48                                     uint32_t h,
49                                     int bVal);
50 
51   std::unique_ptr<CJBig2_Image> DecodeTemplate0Opt(
52       CJBig2_ArithDecoder* pArithDecoder,
53       JBig2ArithCtx* grContext);
54 
55   std::unique_ptr<CJBig2_Image> DecodeTemplate1Unopt(
56       CJBig2_ArithDecoder* pArithDecoder,
57       JBig2ArithCtx* grContext);
58 
59   std::unique_ptr<CJBig2_Image> DecodeTemplate1Opt(
60       CJBig2_ArithDecoder* pArithDecoder,
61       JBig2ArithCtx* grContext);
62 };
63 
64 #endif  // CORE_FXCODEC_JBIG2_JBIG2_GRRDPROC_H_
65