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_REEDSOLOMONGF256POLY_H_ 8*3ac0a46fSAndroid Build Coastguard Worker #define FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_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 17*3ac0a46fSAndroid Build Coastguard Worker class CBC_ReedSolomonGF256Poly final { 18*3ac0a46fSAndroid Build Coastguard Worker public: 19*3ac0a46fSAndroid Build Coastguard Worker CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, 20*3ac0a46fSAndroid Build Coastguard Worker const std::vector<int32_t>& coefficients); 21*3ac0a46fSAndroid Build Coastguard Worker ~CBC_ReedSolomonGF256Poly(); 22*3ac0a46fSAndroid Build Coastguard Worker 23*3ac0a46fSAndroid Build Coastguard Worker int32_t GetCoefficients(int32_t degree) const; 24*3ac0a46fSAndroid Build Coastguard Worker const std::vector<int32_t>& GetCoefficients() const; 25*3ac0a46fSAndroid Build Coastguard Worker int32_t GetDegree() const; 26*3ac0a46fSAndroid Build Coastguard Worker bool IsZero() const; 27*3ac0a46fSAndroid Build Coastguard Worker std::unique_ptr<CBC_ReedSolomonGF256Poly> AddOrSubtract( 28*3ac0a46fSAndroid Build Coastguard Worker const CBC_ReedSolomonGF256Poly* other); 29*3ac0a46fSAndroid Build Coastguard Worker std::unique_ptr<CBC_ReedSolomonGF256Poly> Multiply( 30*3ac0a46fSAndroid Build Coastguard Worker const CBC_ReedSolomonGF256Poly* other); 31*3ac0a46fSAndroid Build Coastguard Worker std::unique_ptr<CBC_ReedSolomonGF256Poly> MultiplyByMonomial( 32*3ac0a46fSAndroid Build Coastguard Worker int32_t degree, 33*3ac0a46fSAndroid Build Coastguard Worker int32_t coefficient) const; 34*3ac0a46fSAndroid Build Coastguard Worker std::unique_ptr<CBC_ReedSolomonGF256Poly> Divide( 35*3ac0a46fSAndroid Build Coastguard Worker const CBC_ReedSolomonGF256Poly* other); 36*3ac0a46fSAndroid Build Coastguard Worker std::unique_ptr<CBC_ReedSolomonGF256Poly> Clone() const; 37*3ac0a46fSAndroid Build Coastguard Worker 38*3ac0a46fSAndroid Build Coastguard Worker private: 39*3ac0a46fSAndroid Build Coastguard Worker UnownedPtr<CBC_ReedSolomonGF256> const m_field; 40*3ac0a46fSAndroid Build Coastguard Worker std::vector<int32_t> m_coefficients; 41*3ac0a46fSAndroid Build Coastguard Worker }; 42*3ac0a46fSAndroid Build Coastguard Worker 43*3ac0a46fSAndroid Build Coastguard Worker #endif // FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_ 44