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_GRRDPROC_H_ 8 #define CORE_FXCODEC_JBIG2_JBIG2_GRRDPROC_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_system.h" 13 14 class CJBig2_ArithDecoder; 15 class CJBig2_Image; 16 struct JBig2ArithCtx; 17 18 class CJBig2_GRRDProc { 19 public: 20 std::unique_ptr<CJBig2_Image> decode(CJBig2_ArithDecoder* pArithDecoder, 21 JBig2ArithCtx* grContext); 22 23 uint32_t GRW; 24 uint32_t GRH; 25 bool GRTEMPLATE; 26 CJBig2_Image* GRREFERENCE; 27 int32_t GRREFERENCEDX; 28 int32_t GRREFERENCEDY; 29 bool TPGRON; 30 int8_t GRAT[4]; 31 32 private: 33 std::unique_ptr<CJBig2_Image> decode_Template0_unopt( 34 CJBig2_ArithDecoder* pArithDecoder, 35 JBig2ArithCtx* grContext); 36 uint32_t decode_Template0_unopt_CalculateContext(const CJBig2_Image& GRREG, 37 const uint32_t* lines, 38 uint32_t w, 39 uint32_t h) const; 40 void decode_Template0_unopt_SetPixel(CJBig2_Image* GRREG, 41 uint32_t* lines, 42 uint32_t w, 43 uint32_t h, 44 int bVal); 45 46 std::unique_ptr<CJBig2_Image> decode_Template0_opt( 47 CJBig2_ArithDecoder* pArithDecoder, 48 JBig2ArithCtx* grContext); 49 50 std::unique_ptr<CJBig2_Image> decode_Template1_unopt( 51 CJBig2_ArithDecoder* pArithDecoder, 52 JBig2ArithCtx* grContext); 53 54 std::unique_ptr<CJBig2_Image> decode_Template1_opt( 55 CJBig2_ArithDecoder* pArithDecoder, 56 JBig2ArithCtx* grContext); 57 }; 58 59 #endif // CORE_FXCODEC_JBIG2_JBIG2_GRRDPROC_H_ 60