kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 1 | // Copyright 2015 The PDFium Authors |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 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 | |
kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 10 | #include <stdint.h> |
| 11 | |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 12 | #include <memory> |
| 13 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 14 | #include "core/fxcrt/unowned_ptr.h" |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 15 | |
| 16 | class CJBig2_ArithDecoder; |
| 17 | class CJBig2_Image; |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 18 | class JBig2ArithCtx; |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 19 | |
| 20 | class CJBig2_GRRDProc { |
| 21 | public: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 22 | CJBig2_GRRDProc(); |
| 23 | ~CJBig2_GRRDProc(); |
| 24 | |
| 25 | std::unique_ptr<CJBig2_Image> Decode(CJBig2_ArithDecoder* pArithDecoder, |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 26 | JBig2ArithCtx* grContext); |
| 27 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 28 | bool GRTEMPLATE; |
| 29 | bool TPGRON; |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 30 | uint32_t GRW; |
| 31 | uint32_t GRH; |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 32 | int32_t GRREFERENCEDX; |
| 33 | int32_t GRREFERENCEDY; |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 34 | UnownedPtr<CJBig2_Image> GRREFERENCE; |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 35 | int8_t GRAT[4]; |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 36 | |
| 37 | private: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 38 | std::unique_ptr<CJBig2_Image> DecodeTemplate0Unopt( |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 39 | CJBig2_ArithDecoder* pArithDecoder, |
| 40 | JBig2ArithCtx* grContext); |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 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); |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 50 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 51 | std::unique_ptr<CJBig2_Image> DecodeTemplate0Opt( |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 52 | CJBig2_ArithDecoder* pArithDecoder, |
| 53 | JBig2ArithCtx* grContext); |
| 54 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 55 | std::unique_ptr<CJBig2_Image> DecodeTemplate1Unopt( |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 56 | CJBig2_ArithDecoder* pArithDecoder, |
| 57 | JBig2ArithCtx* grContext); |
| 58 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 59 | std::unique_ptr<CJBig2_Image> DecodeTemplate1Opt( |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 60 | CJBig2_ArithDecoder* pArithDecoder, |
| 61 | JBig2ArithCtx* grContext); |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 62 | }; |
| 63 | |
| 64 | #endif // CORE_FXCODEC_JBIG2_JBIG2_GRRDPROC_H_ |