1ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Copyright 2014 PDFium Authors. All rights reserved.
2ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Use of this source code is governed by a BSD-style license that can be
3ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// found in the LICENSE file.
4ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
5ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
7ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#ifndef _BC_REEDSOLOMONGF256_H_
8ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#define _BC_REEDSOLOMONGF256_H_
9ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannclass CBC_ReedSolomonGF256Poly;
10ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmannclass CBC_ReedSolomonGF256 {
11ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann public:
12ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  static void Initialize();
13ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  static void Finalize();
14ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  static CBC_ReedSolomonGF256* QRCodeFild;
15ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  static CBC_ReedSolomonGF256* DataMatrixField;
16ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  CBC_ReedSolomonGF256(int32_t primitive);
17ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  virtual ~CBC_ReedSolomonGF256();
18ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  CBC_ReedSolomonGF256Poly* GetZero();
19ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  CBC_ReedSolomonGF256Poly* GetOne();
20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree,
21ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                                          int32_t coefficient,
22ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann                                          int32_t& e);
23ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  static int32_t AddOrSubtract(int32_t a, int32_t b);
24ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int32_t Exp(int32_t a);
25ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int32_t Log(int32_t a, int32_t& e);
26ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int32_t Inverse(int32_t a, int32_t& e);
27ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int32_t Multiply(int32_t a, int32_t b);
28ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  virtual void Init();
29ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann
30ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann private:
31ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int32_t m_expTable[256];
32ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  int32_t m_logTable[256];
33ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  CBC_ReedSolomonGF256Poly* m_zero;
34ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann  CBC_ReedSolomonGF256Poly* m_one;
35ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann};
36ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#endif
37