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 _BC_REEDSOLOMONGF256_H_
8#define _BC_REEDSOLOMONGF256_H_
9class CBC_ReedSolomonGF256Poly;
10class CBC_ReedSolomonGF256 {
11 public:
12  static void Initialize();
13  static void Finalize();
14  static CBC_ReedSolomonGF256* QRCodeFild;
15  static CBC_ReedSolomonGF256* DataMatrixField;
16  CBC_ReedSolomonGF256(int32_t primitive);
17  virtual ~CBC_ReedSolomonGF256();
18  CBC_ReedSolomonGF256Poly* GetZero();
19  CBC_ReedSolomonGF256Poly* GetOne();
20  CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree,
21                                          int32_t coefficient,
22                                          int32_t& e);
23  static int32_t AddOrSubtract(int32_t a, int32_t b);
24  int32_t Exp(int32_t a);
25  int32_t Log(int32_t a, int32_t& e);
26  int32_t Inverse(int32_t a, int32_t& e);
27  int32_t Multiply(int32_t a, int32_t b);
28  virtual void Init();
29
30 private:
31  int32_t m_expTable[256];
32  int32_t m_logTable[256];
33  CBC_ReedSolomonGF256Poly* m_zero;
34  CBC_ReedSolomonGF256Poly* m_one;
35};
36#endif
37