blob: d1a729b204bbfc24fd5b9193c1bcec26056d1659 [file] [log] [blame]
kumarashishg826308d2023-06-23 13:21:22 +00001// Copyright 2015 The PDFium Authors
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -07002// 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
kumarashishg826308d2023-06-23 13:21:22 +000010#include <stdint.h>
11
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070012#include <memory>
13
Haibo Huang49cc9302020-04-27 16:14:24 -070014#include "core/fxcrt/unowned_ptr.h"
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070015
16class CJBig2_ArithDecoder;
17class CJBig2_Image;
Haibo Huang49cc9302020-04-27 16:14:24 -070018class JBig2ArithCtx;
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070019
20class CJBig2_GRRDProc {
21 public:
Haibo Huang49cc9302020-04-27 16:14:24 -070022 CJBig2_GRRDProc();
23 ~CJBig2_GRRDProc();
24
25 std::unique_ptr<CJBig2_Image> Decode(CJBig2_ArithDecoder* pArithDecoder,
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070026 JBig2ArithCtx* grContext);
27
Haibo Huang49cc9302020-04-27 16:14:24 -070028 bool GRTEMPLATE;
29 bool TPGRON;
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070030 uint32_t GRW;
31 uint32_t GRH;
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070032 int32_t GRREFERENCEDX;
33 int32_t GRREFERENCEDY;
Haibo Huang49cc9302020-04-27 16:14:24 -070034 UnownedPtr<CJBig2_Image> GRREFERENCE;
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070035 int8_t GRAT[4];
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070036
37 private:
Haibo Huang49cc9302020-04-27 16:14:24 -070038 std::unique_ptr<CJBig2_Image> DecodeTemplate0Unopt(
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070039 CJBig2_ArithDecoder* pArithDecoder,
40 JBig2ArithCtx* grContext);
Haibo Huang49cc9302020-04-27 16:14:24 -070041 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);
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070050
Haibo Huang49cc9302020-04-27 16:14:24 -070051 std::unique_ptr<CJBig2_Image> DecodeTemplate0Opt(
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070052 CJBig2_ArithDecoder* pArithDecoder,
53 JBig2ArithCtx* grContext);
54
Haibo Huang49cc9302020-04-27 16:14:24 -070055 std::unique_ptr<CJBig2_Image> DecodeTemplate1Unopt(
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070056 CJBig2_ArithDecoder* pArithDecoder,
57 JBig2ArithCtx* grContext);
58
Haibo Huang49cc9302020-04-27 16:14:24 -070059 std::unique_ptr<CJBig2_Image> DecodeTemplate1Opt(
Philip P. Moltmannd904c1e2018-03-19 09:26:45 -070060 CJBig2_ArithDecoder* pArithDecoder,
61 JBig2ArithCtx* grContext);
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070062};
63
64#endif // CORE_FXCODEC_JBIG2_JBIG2_GRRDPROC_H_