• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
8 #define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
9 
10 #include <memory>
11 
12 #include "fxbarcode/utils.h"
13 
14 class CBC_ReedSolomonGF256Poly;
15 
16 class CBC_ReedSolomonGF256 {
17  public:
18   explicit CBC_ReedSolomonGF256(int32_t primitive);
19   ~CBC_ReedSolomonGF256();
20 
21   static void Initialize();
22   static void Finalize();
23 
24   CBC_ReedSolomonGF256Poly* GetZero() const;
25   CBC_ReedSolomonGF256Poly* GetOne() const;
26   std::unique_ptr<CBC_ReedSolomonGF256Poly> BuildMonomial(int32_t degree,
27                                                           int32_t coefficient,
28                                                           int32_t& e);
29   static int32_t AddOrSubtract(int32_t a, int32_t b);
30   int32_t Exp(int32_t a);
31   int32_t Log(int32_t a, int32_t& e);
32   int32_t Inverse(int32_t a, int32_t& e);
33   int32_t Multiply(int32_t a, int32_t b);
34   void Init();
35 
36   static CBC_ReedSolomonGF256* QRCodeField;
37   static CBC_ReedSolomonGF256* DataMatrixField;
38 
39  private:
40   int32_t m_expTable[256];
41   int32_t m_logTable[256];
42   std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero;
43   std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one;
44 };
45 
46 #endif  // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
47