summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common/reedsolomon
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/common/reedsolomon')
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp105
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h32
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp135
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h47
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp253
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h49
6 files changed, 0 insertions, 621 deletions
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
deleted file mode 100644
index 82a729b067..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h"
-
-#include <memory>
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-CBC_ReedSolomonEncoder::CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field) {
- m_field = field;
-}
-
-void CBC_ReedSolomonEncoder::Init() {
- m_cachedGenerators.push_back(new CBC_ReedSolomonGF256Poly(m_field, 1));
-}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(size_t degree,
- int32_t& e) {
- if (degree >= m_cachedGenerators.size()) {
- CBC_ReedSolomonGF256Poly* lastGenerator = m_cachedGenerators.back();
- for (size_t d = m_cachedGenerators.size(); d <= degree; ++d) {
- std::vector<int32_t> temp = {1, m_field->Exp(d - 1)};
- CBC_ReedSolomonGF256Poly temp_poly;
- temp_poly.Init(m_field, &temp, e);
- if (e != BCExceptionNO)
- return nullptr;
- CBC_ReedSolomonGF256Poly* nextGenerator =
- lastGenerator->Multiply(&temp_poly, e);
- if (e != BCExceptionNO)
- return nullptr;
- m_cachedGenerators.push_back(nextGenerator);
- lastGenerator = nextGenerator;
- }
- }
- return m_cachedGenerators[degree];
-}
-
-void CBC_ReedSolomonEncoder::Encode(std::vector<int32_t>* toEncode,
- size_t ecBytes,
- int32_t& e) {
- if (ecBytes == 0) {
- e = BCExceptionNoCorrectionBytes;
- return;
- }
- if (toEncode->size() <= ecBytes) {
- e = BCExceptionNoDataBytesProvided;
- return;
- }
- CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes, e);
- if (e != BCExceptionNO)
- return;
- size_t dataBytes = toEncode->size() - ecBytes;
- std::vector<int32_t> infoCoefficients(dataBytes);
- for (size_t x = 0; x < dataBytes; x++) {
- infoCoefficients[x] = (*toEncode)[x];
- }
- CBC_ReedSolomonGF256Poly info;
- info.Init(m_field, &infoCoefficients, e);
- if (e != BCExceptionNO)
- return;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> infoTemp(
- info.MultiplyByMonomial(ecBytes, 1, e));
- if (e != BCExceptionNO)
- return;
- std::unique_ptr<std::vector<CBC_ReedSolomonGF256Poly*>> temp(
- infoTemp->Divide(generator, e));
- if (e != BCExceptionNO)
- return;
- CBC_ReedSolomonGF256Poly* remainder = (*temp)[1];
- std::vector<int32_t>* coefficients = remainder->GetCoefficients();
- size_t numZeroCoefficients =
- ecBytes > coefficients->size() ? ecBytes - coefficients->size() : 0;
- for (size_t i = 0; i < numZeroCoefficients; i++)
- (*toEncode)[dataBytes + i] = 0;
- for (size_t y = 0; y < coefficients->size(); y++)
- (*toEncode)[dataBytes + numZeroCoefficients + y] = (*coefficients)[y];
- for (size_t k = 0; k < temp->size(); k++)
- delete (*temp)[k];
-}
-
-CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder() {
- for (size_t i = 0; i < m_cachedGenerators.size(); i++)
- delete m_cachedGenerators[i];
-}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
deleted file mode 100644
index 5e5c7c52d3..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
-
-#include <vector>
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_ReedSolomonGF256;
-class CBC_ReedSolomonGF256Poly;
-
-class CBC_ReedSolomonEncoder {
- public:
- explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field);
- virtual ~CBC_ReedSolomonEncoder();
-
- void Encode(std::vector<int32_t>* toEncode, size_t ecBytes, int32_t& e);
- virtual void Init();
-
- private:
- CBC_ReedSolomonGF256Poly* BuildGenerator(size_t degree, int32_t& e);
-
- CBC_ReedSolomonGF256* m_field;
- std::vector<CBC_ReedSolomonGF256Poly*> m_cachedGenerators;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
deleted file mode 100644
index 349ed0789a..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-
-#include <vector>
-
-#include "third_party/base/ptr_util.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::QRCodeField = nullptr;
-CBC_ReedSolomonGF256* CBC_ReedSolomonGF256::DataMatrixField = nullptr;
-
-void CBC_ReedSolomonGF256::Initialize() {
- QRCodeField = new CBC_ReedSolomonGF256(0x011D);
- QRCodeField->Init();
- DataMatrixField = new CBC_ReedSolomonGF256(0x012D);
- DataMatrixField->Init();
-}
-
-void CBC_ReedSolomonGF256::Finalize() {
- delete QRCodeField;
- QRCodeField = nullptr;
- delete DataMatrixField;
- DataMatrixField = nullptr;
-}
-
-CBC_ReedSolomonGF256::CBC_ReedSolomonGF256(int32_t primitive) {
- int32_t x = 1;
- for (int32_t j = 0; j < 256; j++) {
- m_expTable[j] = x;
- x <<= 1;
- if (x >= 0x100) {
- x ^= primitive;
- }
- }
- for (int32_t i = 0; i < 255; i++) {
- m_logTable[m_expTable[i]] = i;
- }
- m_logTable[0] = 0;
-}
-
-void CBC_ReedSolomonGF256::Init() {
- m_zero = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 0);
- m_one = pdfium::MakeUnique<CBC_ReedSolomonGF256Poly>(this, 1);
-}
-
-CBC_ReedSolomonGF256::~CBC_ReedSolomonGF256() {}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetZero() const {
- return m_zero.get();
-}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::GetOne() const {
- return m_one.get();
-}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
- int32_t degree,
- int32_t coefficient,
- int32_t& e) {
- if (degree < 0) {
- e = BCExceptionDegreeIsNegative;
- return nullptr;
- }
- if (coefficient == 0) {
- CBC_ReedSolomonGF256Poly* temp = m_zero->Clone(e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
- }
- std::vector<int32_t> coefficients(degree + 1);
- coefficients[0] = coefficient;
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(this, &coefficients, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-
-int32_t CBC_ReedSolomonGF256::AddOrSubtract(int32_t a, int32_t b) {
- return a ^ b;
-}
-
-int32_t CBC_ReedSolomonGF256::Exp(int32_t a) {
- return m_expTable[a];
-}
-
-int32_t CBC_ReedSolomonGF256::Log(int32_t a, int32_t& e) {
- if (a == 0) {
- e = BCExceptionAIsZero;
- return 0;
- }
- return m_logTable[a];
-}
-
-int32_t CBC_ReedSolomonGF256::Inverse(int32_t a, int32_t& e) {
- if (a == 0) {
- e = BCExceptionAIsZero;
- return 0;
- }
- return m_expTable[255 - m_logTable[a]];
-}
-
-int32_t CBC_ReedSolomonGF256::Multiply(int32_t a, int32_t b) {
- if (a == 0 || b == 0) {
- return 0;
- }
- if (a == 1) {
- return b;
- }
- if (b == 1) {
- return a;
- }
- return m_expTable[(m_logTable[a] + m_logTable[b]) % 255];
-}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
deleted file mode 100644
index 16f1ad17f7..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_basic.h"
-#include "xfa/fxbarcode/utils.h"
-
-class CBC_ReedSolomonGF256Poly;
-
-class CBC_ReedSolomonGF256 {
- public:
- explicit CBC_ReedSolomonGF256(int32_t primitive);
- virtual ~CBC_ReedSolomonGF256();
-
- static void Initialize();
- static void Finalize();
-
- CBC_ReedSolomonGF256Poly* GetZero() const;
- CBC_ReedSolomonGF256Poly* GetOne() const;
- CBC_ReedSolomonGF256Poly* BuildMonomial(int32_t degree,
- int32_t coefficient,
- int32_t& e);
- static int32_t AddOrSubtract(int32_t a, int32_t b);
- int32_t Exp(int32_t a);
- int32_t Log(int32_t a, int32_t& e);
- int32_t Inverse(int32_t a, int32_t& e);
- int32_t Multiply(int32_t a, int32_t b);
- virtual void Init();
-
- static CBC_ReedSolomonGF256* QRCodeField;
- static CBC_ReedSolomonGF256* DataMatrixField;
-
- private:
- int32_t m_expTable[256];
- int32_t m_logTable[256];
- std::unique_ptr<CBC_ReedSolomonGF256Poly> m_zero;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> m_one;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256_H_
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
deleted file mode 100644
index e4ee30b586..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-// Original code is licensed as follows:
-/*
- * Copyright 2007 ZXing authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-#include <memory>
-#include <utility>
-
-#include "third_party/base/stl_util.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-
-CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
- int32_t coefficients) {
- if (!field)
- return;
-
- m_field = field;
- m_coefficients.push_back(coefficients);
-}
-
-CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() {
- m_field = nullptr;
-}
-
-void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field,
- std::vector<int32_t>* coefficients,
- int32_t& e) {
- if (!coefficients || coefficients->empty()) {
- e = BCExceptionCoefficientsSizeIsNull;
- return;
- }
- m_field = field;
- size_t coefficientsLength = coefficients->size();
- if (coefficientsLength > 1 && coefficients->front() == 0) {
- size_t firstNonZero = 1;
- while (firstNonZero < coefficientsLength &&
- (*coefficients)[firstNonZero] == 0) {
- firstNonZero++;
- }
- if (firstNonZero == coefficientsLength) {
- m_coefficients = *(m_field->GetZero()->GetCoefficients());
- } else {
- m_coefficients.resize(coefficientsLength - firstNonZero);
- for (size_t i = firstNonZero, j = 0; i < coefficientsLength; i++, j++)
- m_coefficients[j] = (*coefficients)[i];
- }
- } else {
- m_coefficients = *coefficients;
- }
-}
-
-std::vector<int32_t>* CBC_ReedSolomonGF256Poly::GetCoefficients() {
- return &m_coefficients;
-}
-
-int32_t CBC_ReedSolomonGF256Poly::GetDegree() {
- return pdfium::CollectionSize<int32_t>(m_coefficients) - 1;
-}
-
-bool CBC_ReedSolomonGF256Poly::IsZero() {
- return m_coefficients.front() == 0;
-}
-
-int32_t CBC_ReedSolomonGF256Poly::GetCoefficients(int32_t degree) {
- return m_coefficients[m_coefficients.size() - 1 - degree];
-}
-
-int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) {
- if (a == 0) {
- return GetCoefficients(0);
- }
- size_t size = m_coefficients.size();
- if (a == 1) {
- int32_t result = 0;
- for (size_t i = 0; i < size; i++)
- result = CBC_ReedSolomonGF256::AddOrSubtract(result, m_coefficients[i]);
- return result;
- }
- int32_t result = m_coefficients[0];
- for (size_t j = 1; j < size; j++) {
- result = CBC_ReedSolomonGF256::AddOrSubtract(m_field->Multiply(a, result),
- m_coefficients[j]);
- }
- return result;
-}
-
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Clone(int32_t& e) {
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &m_coefficients, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e) {
- if (IsZero())
- return other->Clone(e);
- if (other->IsZero())
- return Clone(e);
-
- std::vector<int32_t> smallerCoefficients = m_coefficients;
- std::vector<int32_t> largerCoefficients = *(other->GetCoefficients());
- if (smallerCoefficients.size() > largerCoefficients.size()) {
- std::swap(smallerCoefficients, largerCoefficients);
- }
- std::vector<int32_t> sumDiff(largerCoefficients.size());
- size_t lengthDiff = largerCoefficients.size() - smallerCoefficients.size();
- for (size_t i = 0; i < lengthDiff; i++) {
- sumDiff[i] = largerCoefficients[i];
- }
- for (size_t j = lengthDiff; j < largerCoefficients.size(); j++) {
- sumDiff[j] = CBC_ReedSolomonGF256::AddOrSubtract(
- smallerCoefficients[j - lengthDiff], largerCoefficients[j]);
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &sumDiff, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e) {
- if (IsZero() || other->IsZero())
- return m_field->GetZero()->Clone(e);
-
- std::vector<int32_t> aCoefficients = m_coefficients;
- std::vector<int32_t> bCoefficients = *(other->GetCoefficients());
- size_t aLength = aCoefficients.size();
- size_t bLength = bCoefficients.size();
- std::vector<int32_t> product(aLength + bLength - 1);
- for (size_t i = 0; i < aLength; i++) {
- int32_t aCoeff = m_coefficients[i];
- for (size_t j = 0; j < bLength; j++) {
- product[i + j] = CBC_ReedSolomonGF256::AddOrSubtract(
- product[i + j],
- m_field->Multiply(aCoeff, (*other->GetCoefficients())[j]));
- }
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &product, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
- int32_t& e) {
- if (scalar == 0)
- return m_field->GetZero()->Clone(e);
- if (scalar == 1)
- return Clone(e);
-
- size_t size = m_coefficients.size();
- std::vector<int32_t> product(size);
- for (size_t i = 0; i < size; i++) {
- product[i] = m_field->Multiply(m_coefficients[i], scalar);
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &product, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
- int32_t degree,
- int32_t coefficient,
- int32_t& e) {
- if (degree < 0) {
- e = BCExceptionDegreeIsNegative;
- return nullptr;
- }
- if (coefficient == 0)
- return m_field->GetZero()->Clone(e);
-
- size_t size = m_coefficients.size();
- std::vector<int32_t> product(size + degree);
- for (size_t i = 0; i < size; i++) {
- product[i] = m_field->Multiply(m_coefficients[i], coefficient);
- }
- CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
- temp->Init(m_field, &product, e);
- if (e != BCExceptionNO)
- return nullptr;
- return temp;
-}
-
-std::vector<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e) {
- if (other->IsZero()) {
- e = BCExceptionDivideByZero;
- return nullptr;
- }
- std::unique_ptr<CBC_ReedSolomonGF256Poly> quotient(
- m_field->GetZero()->Clone(e));
- if (e != BCExceptionNO)
- return nullptr;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> remainder(Clone(e));
- if (e != BCExceptionNO)
- return nullptr;
- int32_t denominatorLeadingTerm = other->GetCoefficients(other->GetDegree());
- int32_t inverseDenominatorLeadingTeam =
- m_field->Inverse(denominatorLeadingTerm, e);
- if (e != BCExceptionNO)
- return nullptr;
- while (remainder->GetDegree() >= other->GetDegree() && !remainder->IsZero()) {
- int32_t degreeDifference = remainder->GetDegree() - other->GetDegree();
- int32_t scale =
- m_field->Multiply(remainder->GetCoefficients((remainder->GetDegree())),
- inverseDenominatorLeadingTeam);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> term(
- other->MultiplyByMonomial(degreeDifference, scale, e));
- if (e != BCExceptionNO)
- return nullptr;
- std::unique_ptr<CBC_ReedSolomonGF256Poly> iteratorQuotient(
- m_field->BuildMonomial(degreeDifference, scale, e));
- if (e != BCExceptionNO)
- return nullptr;
- quotient.reset(quotient->AddOrSubtract(iteratorQuotient.get(), e));
- if (e != BCExceptionNO)
- return nullptr;
- remainder.reset(remainder->AddOrSubtract(term.get(), e));
- if (e != BCExceptionNO)
- return nullptr;
- }
- std::vector<CBC_ReedSolomonGF256Poly*>* tempPtrA =
- new std::vector<CBC_ReedSolomonGF256Poly*>();
- tempPtrA->push_back(quotient.release());
- tempPtrA->push_back(remainder.release());
- return tempPtrA;
-}
-
-CBC_ReedSolomonGF256Poly::~CBC_ReedSolomonGF256Poly() {}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
deleted file mode 100644
index 6fc7509399..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
-
-#include <vector>
-
-#include "core/fxcrt/fx_basic.h"
-
-class CBC_ReedSolomonGF256;
-
-class CBC_ReedSolomonGF256Poly final {
- public:
- CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field, int32_t coefficients);
- CBC_ReedSolomonGF256Poly();
- ~CBC_ReedSolomonGF256Poly();
- void Init(CBC_ReedSolomonGF256* field,
- std::vector<int32_t>* coefficients,
- int32_t& e);
-
- int32_t GetCoefficients(int32_t degree);
- std::vector<int32_t>* GetCoefficients();
- int32_t GetDegree();
- bool IsZero();
- int32_t EvaluateAt(int32_t a);
- CBC_ReedSolomonGF256Poly* AddOrSubtract(CBC_ReedSolomonGF256Poly* other,
- int32_t& e);
- CBC_ReedSolomonGF256Poly* Multiply(CBC_ReedSolomonGF256Poly* other,
- int32_t& e);
- CBC_ReedSolomonGF256Poly* Multiply(int32_t scalar, int32_t& e);
- CBC_ReedSolomonGF256Poly* MultiplyByMonomial(int32_t degree,
- int32_t coefficient,
- int32_t& e);
- std::vector<CBC_ReedSolomonGF256Poly*>* Divide(
- CBC_ReedSolomonGF256Poly* other,
- int32_t& e);
-
- CBC_ReedSolomonGF256Poly* Clone(int32_t& e);
-
- private:
- CBC_ReedSolomonGF256* m_field;
- std::vector<int32_t> m_coefficients;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_