OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ | 7 #ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ |
8 #define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ | 8 #define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "core/fxcrt/include/fx_basic.h" | 12 #include "core/fxcrt/include/fx_basic.h" |
11 #include "xfa/fxbarcode/utils.h" | 13 #include "xfa/fxbarcode/utils.h" |
12 | 14 |
13 class CBC_ReedSolomonGF256Poly; | 15 class CBC_ReedSolomonGF256Poly; |
| 16 |
14 class CBC_ReedSolomonGF256 { | 17 class CBC_ReedSolomonGF256 { |
15 public: | 18 public: |
| 19 explicit CBC_ReedSolomonGF256(int32_t primitive); |
| 20 virtual ~CBC_ReedSolomonGF256(); |
| 21 |
16 static void Initialize(); | 22 static void Initialize(); |
17 static void Finalize(); | 23 static void Finalize(); |
18 static CBC_ReedSolomonGF256* QRCodeFild; | 24 |
19 static CBC_ReedSolomonGF256* DataMatrixField; | 25 CBC_ReedSolomonGF256Poly* GetZero() const; |
20 CBC_ReedSolomonGF256(int32_t primitive); | 26 CBC_ReedSolomonGF256Poly* GetOne() const; |
21 virtual ~CBC_ReedSolomonGF256(); | |
22 CBC_ReedSolomonGF256Poly* GetZero(); | |
23 CBC_ReedSolomonGF256Poly* GetOne(); | |
24 CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree, | 27 CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree, |
25 int32_t coefficient, | 28 int32_t coefficient, |
26 int32_t& e); | 29 int32_t& e); |
27 static int32_t AddOrSubtract(int32_t a, int32_t b); | 30 static int32_t AddOrSubtract(int32_t a, int32_t b); |
28 int32_t Exp(int32_t a); | 31 int32_t Exp(int32_t a); |
29 int32_t Log(int32_t a, int32_t& e); | 32 int32_t Log(int32_t a, int32_t& e); |
30 int32_t Inverse(int32_t a, int32_t& e); | 33 int32_t Inverse(int32_t a, int32_t& e); |
31 int32_t Multiply(int32_t a, int32_t b); | 34 int32_t Multiply(int32_t a, int32_t b); |
32 virtual void Init(); | 35 virtual void Init(); |
33 | 36 |
| 37 static CBC_ReedSolomonGF256* QRCodeField; |
| 38 static CBC_ReedSolomonGF256* DataMatrixField; |
| 39 |
34 private: | 40 private: |
35 int32_t m_expTable[256]; | 41 int32_t m_expTable[256]; |
36 int32_t m_logTable[256]; | 42 int32_t m_logTable[256]; |
37 CBC_ReedSolomonGF256Poly* m_zero; | 43 std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero; |
38 CBC_ReedSolomonGF256Poly* m_one; | 44 std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one; |
39 }; | 45 }; |
40 | 46 |
41 #endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ | 47 #endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_ |
OLD | NEW |