xref: /aosp_15_r20/external/pdfium/fxbarcode/common/reedsolomon/BC_ReedSolomon.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1*3ac0a46fSAndroid Build Coastguard Worker // Copyright 2014 The PDFium Authors
2*3ac0a46fSAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*3ac0a46fSAndroid Build Coastguard Worker // found in the LICENSE file.
4*3ac0a46fSAndroid Build Coastguard Worker 
5*3ac0a46fSAndroid Build Coastguard Worker // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6*3ac0a46fSAndroid Build Coastguard Worker 
7*3ac0a46fSAndroid Build Coastguard Worker #ifndef FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
8*3ac0a46fSAndroid Build Coastguard Worker #define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
9*3ac0a46fSAndroid Build Coastguard Worker 
10*3ac0a46fSAndroid Build Coastguard Worker #include <memory>
11*3ac0a46fSAndroid Build Coastguard Worker #include <vector>
12*3ac0a46fSAndroid Build Coastguard Worker 
13*3ac0a46fSAndroid Build Coastguard Worker #include "core/fxcrt/unowned_ptr.h"
14*3ac0a46fSAndroid Build Coastguard Worker 
15*3ac0a46fSAndroid Build Coastguard Worker class CBC_ReedSolomonGF256;
16*3ac0a46fSAndroid Build Coastguard Worker class CBC_ReedSolomonGF256Poly;
17*3ac0a46fSAndroid Build Coastguard Worker 
18*3ac0a46fSAndroid Build Coastguard Worker class CBC_ReedSolomonEncoder {
19*3ac0a46fSAndroid Build Coastguard Worker  public:
20*3ac0a46fSAndroid Build Coastguard Worker   explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field);
21*3ac0a46fSAndroid Build Coastguard Worker   ~CBC_ReedSolomonEncoder();
22*3ac0a46fSAndroid Build Coastguard Worker 
23*3ac0a46fSAndroid Build Coastguard Worker   bool Encode(std::vector<int32_t>* toEncode, size_t ecBytes);
24*3ac0a46fSAndroid Build Coastguard Worker 
25*3ac0a46fSAndroid Build Coastguard Worker  private:
26*3ac0a46fSAndroid Build Coastguard Worker   CBC_ReedSolomonGF256Poly* BuildGenerator(size_t degree);
27*3ac0a46fSAndroid Build Coastguard Worker 
28*3ac0a46fSAndroid Build Coastguard Worker   UnownedPtr<CBC_ReedSolomonGF256> const m_field;
29*3ac0a46fSAndroid Build Coastguard Worker   std::vector<std::unique_ptr<CBC_ReedSolomonGF256Poly>> m_cachedGenerators;
30*3ac0a46fSAndroid Build Coastguard Worker };
31*3ac0a46fSAndroid Build Coastguard Worker 
32*3ac0a46fSAndroid Build Coastguard Worker #endif  // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
33