summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/common
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-16 12:29:07 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-16 12:29:07 -0700
commita26153440b46b3b37b7e81435debb296f22769f4 (patch)
tree37b3073d15af7ae2850b5a02be87123feb54a054 /xfa/fxbarcode/common
parent8320ee28f24615d1d619a5db1b7c235ea6f91dde (diff)
downloadpdfium-a26153440b46b3b37b7e81435debb296f22769f4.tar.xz
Remove barcode reading code.
We never read barcodes, we only write them. Remove code related to barcode reading. Review-Url: https://codereview.chromium.org/2071633002
Diffstat (limited to 'xfa/fxbarcode/common')
-rw-r--r--xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp44
-rw-r--r--xfa/fxbarcode/common/BC_CommonCharacterSetECI.h29
-rw-r--r--xfa/fxbarcode/common/BC_CommonDecoderResult.cpp75
-rw-r--r--xfa/fxbarcode/common/BC_CommonDecoderResult.h44
-rw-r--r--xfa/fxbarcode/common/BC_CommonECI.cpp38
-rw-r--r--xfa/fxbarcode/common/BC_CommonECI.h25
-rw-r--r--xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp173
-rw-r--r--xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h37
-rw-r--r--xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp262
-rw-r--r--xfa/fxbarcode/common/BC_WhiteRectangleDetector.h57
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp221
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h37
12 files changed, 0 insertions, 1042 deletions
diff --git a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp b/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp
deleted file mode 100644
index ebc5593bf2..0000000000
--- a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.cpp
+++ /dev/null
@@ -1,44 +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 2008 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/BC_CommonCharacterSetECI.h"
-#include "xfa/fxbarcode/common/BC_CommonECI.h"
-
-void CBC_CommonCharacterSetECI::initialize() {}
-CBC_CommonCharacterSetECI::CBC_CommonCharacterSetECI(
- int32_t value,
- CFX_ByteString encodingName)
- : CBC_CommonECI(value), m_encodingName(encodingName) {}
-CBC_CommonCharacterSetECI::~CBC_CommonCharacterSetECI() {}
-CFX_ByteString CBC_CommonCharacterSetECI::GetEncodingName() {
- return m_encodingName;
-}
-void CBC_CommonCharacterSetECI::AddCharacterSet(int32_t value,
- CFX_ByteString encodingName) {}
-CBC_CommonCharacterSetECI* CBC_CommonCharacterSetECI::GetCharacterSetECIByValue(
- int32_t value) {
- return nullptr;
-}
-CBC_CommonCharacterSetECI* CBC_CommonCharacterSetECI::GetCharacterSetECIByName(
- const CFX_ByteString& name) {
- return nullptr;
-}
diff --git a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h b/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h
deleted file mode 100644
index a2fe0ed2fe..0000000000
--- a/xfa/fxbarcode/common/BC_CommonCharacterSetECI.h
+++ /dev/null
@@ -1,29 +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_BC_COMMONCHARACTERSETECI_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONCHARACTERSETECI_H_
-
-#include "core/fxcrt/include/fx_string.h"
-#include "xfa/fxbarcode/common/BC_CommonECI.h"
-
-class CBC_CommonCharacterSetECI : public CBC_CommonECI {
- public:
- CBC_CommonCharacterSetECI(int32_t value, CFX_ByteString encodingName);
- ~CBC_CommonCharacterSetECI() override;
-
- CFX_ByteString GetEncodingName();
- static void AddCharacterSet(int32_t value, CFX_ByteString encodingName);
- static CBC_CommonCharacterSetECI* GetCharacterSetECIByValue(int32_t value);
- static CBC_CommonCharacterSetECI* GetCharacterSetECIByName(
- const CFX_ByteString& name);
-
- private:
- CFX_ByteString m_encodingName;
- static void initialize();
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONCHARACTERSETECI_H_
diff --git a/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp b/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp
deleted file mode 100644
index ee131e5359..0000000000
--- a/xfa/fxbarcode/common/BC_CommonDecoderResult.cpp
+++ /dev/null
@@ -1,75 +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 "core/fxcrt/include/fx_basic.h"
-#include "xfa/fxbarcode/common/BC_CommonDecoderResult.h"
-#include "xfa/fxbarcode/pdf417/BC_PDF417ResultMetadata.h"
-#include "xfa/fxbarcode/qrcode/BC_QRCoderErrorCorrectionLevel.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_CommonDecoderResult::CBC_CommonDecoderResult() {}
-void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes,
- const CFX_ByteString& text,
- const CFX_Int32Array& byteSegments,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t& e) {
- if (text.IsEmpty()) {
- e = BCExceptionIllegalArgument;
- return;
- }
- m_rawBytes.Copy(rawBytes);
- m_text = text;
- m_byteSegments.Copy(byteSegments);
- m_ecLevel = ecLevel;
- m_other = nullptr;
-}
-void CBC_CommonDecoderResult::Init(const CFX_ByteArray& rawBytes,
- const CFX_ByteString& text,
- const CFX_ByteString& ecLevel,
- int32_t& e) {
- if (text.IsEmpty()) {
- e = BCExceptionIllegalArgument;
- return;
- }
- m_rawBytes.Copy(rawBytes);
- m_text = text;
- m_pdf417ecLevel = ecLevel;
- m_other = nullptr;
-}
-void CBC_CommonDecoderResult::setOther(CBC_PDF417ResultMetadata* other) {
- m_other = other;
-}
-CBC_CommonDecoderResult::~CBC_CommonDecoderResult() {
- delete m_other;
-}
-const CFX_ByteArray& CBC_CommonDecoderResult::GetRawBytes() {
- return m_rawBytes;
-}
-const CFX_Int32Array& CBC_CommonDecoderResult::GetByteSegments() {
- return m_byteSegments;
-}
-const CFX_ByteString& CBC_CommonDecoderResult::GetText() {
- return m_text;
-}
-CBC_QRCoderErrorCorrectionLevel* CBC_CommonDecoderResult::GetECLevel() {
- return m_ecLevel;
-}
diff --git a/xfa/fxbarcode/common/BC_CommonDecoderResult.h b/xfa/fxbarcode/common/BC_CommonDecoderResult.h
deleted file mode 100644
index bcb65df9fa..0000000000
--- a/xfa/fxbarcode/common/BC_CommonDecoderResult.h
+++ /dev/null
@@ -1,44 +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_BC_COMMONDECODERRESULT_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONDECODERRESULT_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-
-class CBC_QRCoderErrorCorrectionLevel;
-class CBC_PDF417ResultMetadata;
-
-class CBC_CommonDecoderResult {
- public:
- CBC_CommonDecoderResult();
- virtual ~CBC_CommonDecoderResult();
-
- const CFX_ByteArray& GetRawBytes();
- const CFX_ByteString& GetText();
- const CFX_Int32Array& GetByteSegments();
- CBC_QRCoderErrorCorrectionLevel* GetECLevel();
- virtual void Init(const CFX_ByteArray& rawBytes,
- const CFX_ByteString& text,
- const CFX_Int32Array& byteSegments,
- CBC_QRCoderErrorCorrectionLevel* ecLevel,
- int32_t& e);
- virtual void Init(const CFX_ByteArray& rawBytes,
- const CFX_ByteString& text,
- const CFX_ByteString& ecLevel,
- int32_t& e);
- void setOther(CBC_PDF417ResultMetadata* other);
-
- private:
- CFX_ByteArray m_rawBytes;
- CFX_ByteString m_text;
- CFX_Int32Array m_byteSegments;
- CBC_QRCoderErrorCorrectionLevel* m_ecLevel;
- CFX_ByteString m_pdf417ecLevel;
- CBC_PDF417ResultMetadata* m_other;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONDECODERRESULT_H_
diff --git a/xfa/fxbarcode/common/BC_CommonECI.cpp b/xfa/fxbarcode/common/BC_CommonECI.cpp
deleted file mode 100644
index 30d21310f4..0000000000
--- a/xfa/fxbarcode/common/BC_CommonECI.cpp
+++ /dev/null
@@ -1,38 +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 2008 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/BC_CommonCharacterSetECI.h"
-#include "xfa/fxbarcode/common/BC_CommonECI.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_CommonECI::CBC_CommonECI(int32_t value) {
- m_value = value;
-}
-CBC_CommonECI::~CBC_CommonECI() {}
-int32_t CBC_CommonECI::GetValue() {
- return m_value;
-}
-CBC_CommonECI* CBC_CommonECI::GetEICByValue(int32_t value, int32_t& e) {
- if (value < 0 || value > 999999)
- e = BCExceptionBadECI;
- return nullptr;
-}
diff --git a/xfa/fxbarcode/common/BC_CommonECI.h b/xfa/fxbarcode/common/BC_CommonECI.h
deleted file mode 100644
index 5bc4c1485c..0000000000
--- a/xfa/fxbarcode/common/BC_CommonECI.h
+++ /dev/null
@@ -1,25 +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_BC_COMMONECI_H_
-#define XFA_FXBARCODE_COMMON_BC_COMMONECI_H_
-
-#include <stdint.h>
-
-class CBC_CommonECI {
- public:
- CBC_CommonECI(int32_t value);
- virtual ~CBC_CommonECI();
-
- virtual int32_t GetValue();
-
- static CBC_CommonECI* GetEICByValue(int32_t value, int32_t& e);
-
- private:
- int32_t m_value;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_COMMONECI_H_
diff --git a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp b/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
deleted file mode 100644
index 53f18cc21b..0000000000
--- a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.cpp
+++ /dev/null
@@ -1,173 +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 2009 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/BC_GlobalHistogramBinarizer.h"
-
-#include <memory>
-
-#include "xfa/fxbarcode/BC_Binarizer.h"
-#include "xfa/fxbarcode/BC_LuminanceSource.h"
-#include "xfa/fxbarcode/common/BC_CommonBitArray.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/utils.h"
-
-const int32_t LUMINANCE_BITS = 5;
-const int32_t LUMINANCE_SHIFT = 8 - LUMINANCE_BITS;
-const int32_t LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
-
-CBC_GlobalHistogramBinarizer::CBC_GlobalHistogramBinarizer(
- CBC_LuminanceSource* source)
- : CBC_Binarizer(source) {}
-CBC_GlobalHistogramBinarizer::~CBC_GlobalHistogramBinarizer() {}
-CBC_CommonBitArray* CBC_GlobalHistogramBinarizer::GetBlackRow(
- int32_t y,
- CBC_CommonBitArray* row,
- int32_t& e) {
- CBC_LuminanceSource* source = GetLuminanceSource();
- int32_t width = source->GetWidth();
- std::unique_ptr<CBC_CommonBitArray> result(new CBC_CommonBitArray(width));
- InitArrays(width);
- CFX_ByteArray* localLuminances = source->GetRow(y, m_luminance, e);
- if (e != BCExceptionNO) {
- return result.release();
- }
- CFX_Int32Array localBuckets;
- localBuckets.Copy(m_buckets);
- int32_t x;
- for (x = 0; x < width; x++) {
- int32_t pixel = (*localLuminances)[x] & 0xff;
- localBuckets[pixel >> LUMINANCE_SHIFT]++;
- }
- int32_t blackPoint = EstimateBlackPoint(localBuckets, e);
- if (e != BCExceptionNO) {
- return result.release();
- }
- int32_t left = (*localLuminances)[0] & 0xff;
- int32_t center = (*localLuminances)[1] & 0xff;
- for (x = 1; x < width - 1; x++) {
- int32_t right = (*localLuminances)[x + 1] & 0xff;
- int32_t luminance = ((center << 2) - left - right) >> 1;
- if (luminance < blackPoint) {
- result->Set(x);
- }
- left = center;
- center = right;
- }
- return result.release();
-}
-CBC_CommonBitMatrix* CBC_GlobalHistogramBinarizer::GetBlackMatrix(int32_t& e) {
- CBC_LuminanceSource* source = GetLuminanceSource();
- int32_t width = source->GetWidth();
- int32_t height = source->GetHeight();
- std::unique_ptr<CBC_CommonBitMatrix> matrix(new CBC_CommonBitMatrix());
- matrix->Init(width, height);
- InitArrays(width);
- CFX_Int32Array localBuckets;
- localBuckets.Copy(m_buckets);
- int32_t y;
- for (y = 1; y < 5; y++) {
- int32_t row = height * y / 5;
- CFX_ByteArray* localLuminances = source->GetRow(row, m_luminance, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- int32_t right = (width << 2) / 5;
- int32_t x;
- for (x = width / 5; x < right; x++) {
- int32_t pixel = (*localLuminances)[x] & 0xff;
- localBuckets[pixel >> LUMINANCE_SHIFT]++;
- }
- }
- int32_t blackPoint = EstimateBlackPoint(localBuckets, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CFX_ByteArray> localLuminances(source->GetMatrix());
- for (y = 0; y < height; y++) {
- int32_t offset = y * width;
- for (int32_t x = 0; x < width; x++) {
- int32_t pixel = (*localLuminances)[offset + x] & 0xff;
- if (pixel < blackPoint) {
- matrix->Set(x, y);
- }
- }
- }
- return matrix.release();
-}
-void CBC_GlobalHistogramBinarizer::InitArrays(int32_t luminanceSize) {
- if (m_luminance.GetSize() < luminanceSize) {
- m_luminance.SetSize(luminanceSize);
- }
- if (m_buckets.GetSize() <= 0) {
- m_buckets.SetSize(LUMINANCE_BUCKETS);
- } else {
- int32_t x;
- for (x = 0; x < LUMINANCE_BUCKETS; x++) {
- m_buckets[x] = 0;
- }
- }
-}
-int32_t CBC_GlobalHistogramBinarizer::EstimateBlackPoint(
- CFX_Int32Array& buckets,
- int32_t& e) {
- int32_t numBuckets = buckets.GetSize();
- int32_t maxBucketCount = 0;
- int32_t firstPeak = 0;
- int32_t firstPeakSize = 0;
- int32_t x;
- for (x = 0; x < numBuckets; x++) {
- if (buckets[x] > firstPeakSize) {
- firstPeak = x;
- firstPeakSize = buckets[x];
- }
- if (buckets[x] > maxBucketCount) {
- maxBucketCount = buckets[x];
- }
- }
- int32_t secondPeak = 0;
- int32_t secondPeakScore = 0;
- for (x = 0; x < numBuckets; x++) {
- int32_t distanceToBiggest = x - firstPeak;
- int32_t score = buckets[x] * distanceToBiggest * distanceToBiggest;
- if (score > secondPeakScore) {
- secondPeak = x;
- secondPeakScore = score;
- }
- }
- if (firstPeak > secondPeak) {
- int32_t temp = firstPeak;
- firstPeak = secondPeak;
- secondPeak = temp;
- }
- if (secondPeak - firstPeak <= numBuckets >> 4) {
- e = BCExceptionRead;
- return 0;
- }
- int32_t bestValley = secondPeak - 1;
- int32_t bestValleyScore = -1;
- for (x = secondPeak - 1; x > firstPeak; x--) {
- int32_t fromFirst = x - firstPeak;
- int32_t score = fromFirst * fromFirst * (secondPeak - x) *
- (maxBucketCount - buckets[x]);
- if (score > bestValleyScore) {
- bestValley = x;
- bestValleyScore = score;
- }
- }
- return bestValley << LUMINANCE_SHIFT;
-}
diff --git a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h b/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h
deleted file mode 100644
index 786e8e0a53..0000000000
--- a/xfa/fxbarcode/common/BC_GlobalHistogramBinarizer.h
+++ /dev/null
@@ -1,37 +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_BC_GLOBALHISTOGRAMBINARIZER_H_
-#define XFA_FXBARCODE_COMMON_BC_GLOBALHISTOGRAMBINARIZER_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-#include "xfa/fxbarcode/BC_Binarizer.h"
-
-class CBC_CommonBitArray;
-class CBC_CommonBitMatrix;
-class CBC_LuminanceSource;
-
-class CBC_GlobalHistogramBinarizer : public CBC_Binarizer {
- public:
- CBC_GlobalHistogramBinarizer(CBC_LuminanceSource* source);
- ~CBC_GlobalHistogramBinarizer() override;
-
- void InitArrays(int32_t luminanceSize);
-
- // CBC_Binarizer
- CBC_CommonBitMatrix* GetBlackMatrix(int32_t& e) override;
- CBC_CommonBitArray* GetBlackRow(int32_t y,
- CBC_CommonBitArray* row,
- int32_t& e) override;
-
- static int32_t EstimateBlackPoint(CFX_Int32Array& buckets, int32_t& e);
-
- private:
- CFX_ByteArray m_luminance;
- CFX_Int32Array m_buckets;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_GLOBALHISTOGRAMBINARIZER_H_
diff --git a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp b/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp
deleted file mode 100644
index 45ffd63858..0000000000
--- a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.cpp
+++ /dev/null
@@ -1,262 +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 2010 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/BC_WhiteRectangleDetector.h"
-
-#include <memory>
-
-#include "xfa/fxbarcode/BC_ResultPoint.h"
-#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
-#include "xfa/fxbarcode/utils.h"
-
-CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(
- CBC_CommonBitMatrix* image) {
- m_image = image;
- m_height = image->GetHeight();
- m_width = image->GetWidth();
- m_leftInit = (m_width - INIT_SIZE) >> 1;
- m_rightInit = (m_width + INIT_SIZE) >> 1;
- m_upInit = (m_height - INIT_SIZE) >> 1;
- m_downInit = (m_height + INIT_SIZE) >> 1;
-}
-void CBC_WhiteRectangleDetector::Init(int32_t& e) {
- if (m_upInit < 0 || m_leftInit < 0 || m_downInit >= m_height ||
- m_rightInit >= m_width) {
- e = BCExceptionNotFound;
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- }
-}
-CBC_WhiteRectangleDetector::CBC_WhiteRectangleDetector(
- CBC_CommonBitMatrix* image,
- int32_t initSize,
- int32_t x,
- int32_t y) {
- m_image = image;
- m_height = image->GetHeight();
- m_width = image->GetWidth();
- int32_t halfsize = initSize >> 1;
- m_leftInit = x - halfsize;
- m_rightInit = x + halfsize;
- m_upInit = y - halfsize;
- m_downInit = y + halfsize;
-}
-
-CBC_WhiteRectangleDetector::~CBC_WhiteRectangleDetector() {}
-
-CFX_ArrayTemplate<CBC_ResultPoint*>* CBC_WhiteRectangleDetector::Detect(
- int32_t& e) {
- int32_t left = m_leftInit;
- int32_t right = m_rightInit;
- int32_t up = m_upInit;
- int32_t down = m_downInit;
- FX_BOOL sizeExceeded = FALSE;
- FX_BOOL aBlackPointFoundOnBorder = TRUE;
- FX_BOOL atLeastOneBlackPointFoundOnBorder = FALSE;
- while (aBlackPointFoundOnBorder) {
- aBlackPointFoundOnBorder = FALSE;
- FX_BOOL rightBorderNotWhite = TRUE;
- while (rightBorderNotWhite && right < m_width) {
- rightBorderNotWhite = ContainsBlackPoint(up, down, right, FALSE);
- if (rightBorderNotWhite) {
- right++;
- aBlackPointFoundOnBorder = TRUE;
- }
- }
- if (right >= m_width) {
- sizeExceeded = TRUE;
- break;
- }
- FX_BOOL bottomBorderNotWhite = TRUE;
- while (bottomBorderNotWhite && down < m_height) {
- bottomBorderNotWhite = ContainsBlackPoint(left, right, down, TRUE);
- if (bottomBorderNotWhite) {
- down++;
- aBlackPointFoundOnBorder = TRUE;
- }
- }
- if (down >= m_height) {
- sizeExceeded = TRUE;
- break;
- }
- FX_BOOL leftBorderNotWhite = TRUE;
- while (leftBorderNotWhite && left >= 0) {
- leftBorderNotWhite = ContainsBlackPoint(up, down, left, FALSE);
- if (leftBorderNotWhite) {
- left--;
- aBlackPointFoundOnBorder = TRUE;
- }
- }
- if (left < 0) {
- sizeExceeded = TRUE;
- break;
- }
- FX_BOOL topBorderNotWhite = TRUE;
- while (topBorderNotWhite && up >= 0) {
- topBorderNotWhite = ContainsBlackPoint(left, right, up, TRUE);
- if (topBorderNotWhite) {
- up--;
- aBlackPointFoundOnBorder = TRUE;
- }
- }
- if (up < 0) {
- sizeExceeded = TRUE;
- break;
- }
- if (aBlackPointFoundOnBorder) {
- atLeastOneBlackPointFoundOnBorder = TRUE;
- }
- }
- if (!sizeExceeded && atLeastOneBlackPointFoundOnBorder) {
- int32_t maxSize = right - left;
- std::unique_ptr<CBC_ResultPoint> z;
- for (int32_t i = 1; i < maxSize; i++) {
- z.reset(GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(down - i),
- (FX_FLOAT)(left + i), (FX_FLOAT)(down)));
- if (z)
- break;
- }
- if (!z.get()) {
- e = BCExceptionNotFound;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- std::unique_ptr<CBC_ResultPoint> t;
- for (int32_t j = 1; j < maxSize; j++) {
- t.reset(GetBlackPointOnSegment((FX_FLOAT)left, (FX_FLOAT)(up + j),
- (FX_FLOAT)(left + j), (FX_FLOAT)up));
- if (t)
- break;
- }
- if (!t.get()) {
- e = BCExceptionNotFound;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- std::unique_ptr<CBC_ResultPoint> x;
- for (int32_t k = 1; k < maxSize; k++) {
- x.reset(GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(up + k),
- (FX_FLOAT)(right - k), (FX_FLOAT)up));
- if (x)
- break;
- }
- if (!x.get()) {
- e = BCExceptionNotFound;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- std::unique_ptr<CBC_ResultPoint> y;
- for (int32_t m = 1; m < maxSize; m++) {
- y.reset(GetBlackPointOnSegment((FX_FLOAT)right, (FX_FLOAT)(down - m),
- (FX_FLOAT)(right - m), (FX_FLOAT)down));
- if (y)
- break;
- }
- if (!y.get()) {
- e = BCExceptionNotFound;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- return CenterEdges(y.get(), z.get(), x.get(), t.get());
- }
-
- e = BCExceptionNotFound;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- return nullptr;
-}
-
-int32_t CBC_WhiteRectangleDetector::Round(FX_FLOAT d) {
- return (int32_t)(d + 0.5f);
-}
-CBC_ResultPoint* CBC_WhiteRectangleDetector::GetBlackPointOnSegment(
- FX_FLOAT aX,
- FX_FLOAT aY,
- FX_FLOAT bX,
- FX_FLOAT bY) {
- int32_t dist = DistanceL2(aX, aY, bX, bY);
- float xStep = (bX - aX) / dist;
- float yStep = (bY - aY) / dist;
- for (int32_t i = 0; i < dist; i++) {
- int32_t x = Round(aX + i * xStep);
- int32_t y = Round(aY + i * yStep);
- if (m_image->Get(x, y)) {
- return new CBC_ResultPoint((FX_FLOAT)x, (FX_FLOAT)y);
- }
- }
- return nullptr;
-}
-int32_t CBC_WhiteRectangleDetector::DistanceL2(FX_FLOAT aX,
- FX_FLOAT aY,
- FX_FLOAT bX,
- FX_FLOAT bY) {
- float xDiff = aX - bX;
- float yDiff = aY - bY;
- return Round((float)sqrt(xDiff * xDiff + yDiff * yDiff));
-}
-
-CFX_ArrayTemplate<CBC_ResultPoint*>* CBC_WhiteRectangleDetector::CenterEdges(
- CBC_ResultPoint* y,
- CBC_ResultPoint* z,
- CBC_ResultPoint* x,
- CBC_ResultPoint* t) const {
- CFX_ArrayTemplate<CBC_ResultPoint*>* result =
- new CFX_ArrayTemplate<CBC_ResultPoint*>();
- result->SetSize(4);
-
- float yi = y->GetX();
- float yj = y->GetY();
- float zi = z->GetX();
- float zj = z->GetY();
- float xi = x->GetX();
- float xj = x->GetY();
- float ti = t->GetX();
- float tj = t->GetY();
-
- if (yi < m_width / 2) {
- (*result)[0] = new CBC_ResultPoint(ti - CORR, tj + CORR);
- (*result)[1] = new CBC_ResultPoint(zi + CORR, zj + CORR);
- (*result)[2] = new CBC_ResultPoint(xi - CORR, xj - CORR);
- (*result)[3] = new CBC_ResultPoint(yi + CORR, yj - CORR);
- return result;
- }
-
- (*result)[0] = new CBC_ResultPoint(ti + CORR, tj + CORR);
- (*result)[1] = new CBC_ResultPoint(zi + CORR, zj - CORR);
- (*result)[2] = new CBC_ResultPoint(xi - CORR, xj + CORR);
- (*result)[3] = new CBC_ResultPoint(yi - CORR, yj - CORR);
- return result;
-}
-
-FX_BOOL CBC_WhiteRectangleDetector::ContainsBlackPoint(int32_t a,
- int32_t b,
- int32_t fixed,
- FX_BOOL horizontal) {
- if (horizontal) {
- for (int32_t x = a; x <= b; x++) {
- if (m_image->Get(x, fixed)) {
- return TRUE;
- }
- }
- } else {
- for (int32_t y = a; y <= b; y++) {
- if (m_image->Get(fixed, y)) {
- return TRUE;
- }
- }
- }
- return FALSE;
-}
diff --git a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h b/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h
deleted file mode 100644
index 427d7b85ca..0000000000
--- a/xfa/fxbarcode/common/BC_WhiteRectangleDetector.h
+++ /dev/null
@@ -1,57 +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_BC_WHITERECTANGLEDETECTOR_H_
-#define XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-
-class CBC_CommonBitMatrix;
-class CBC_ResultPoint;
-
-class CBC_WhiteRectangleDetector {
- public:
- explicit CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image);
- CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image,
- int32_t initSize,
- int32_t x,
- int32_t y);
- virtual ~CBC_WhiteRectangleDetector();
-
- virtual void Init(int32_t& e);
-
- CFX_ArrayTemplate<CBC_ResultPoint*>* Detect(int32_t& e);
-
- private:
- int32_t Round(FX_FLOAT d);
- CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX,
- FX_FLOAT aY,
- FX_FLOAT bX,
- FX_FLOAT bY);
- int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY);
- CFX_ArrayTemplate<CBC_ResultPoint*>* CenterEdges(CBC_ResultPoint* y,
- CBC_ResultPoint* z,
- CBC_ResultPoint* x,
- CBC_ResultPoint* t) const;
-
- FX_BOOL ContainsBlackPoint(int32_t a,
- int32_t b,
- int32_t fixed,
- FX_BOOL horizontal);
-
- static const int32_t INIT_SIZE = 30;
- static const int32_t CORR = 1;
-
- CBC_CommonBitMatrix* m_image;
- int32_t m_height;
- int32_t m_width;
- int32_t m_leftInit;
- int32_t m_rightInit;
- int32_t m_downInit;
- int32_t m_upInit;
-};
-
-#endif // XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
deleted file mode 100644
index 8788afbda8..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
+++ /dev/null
@@ -1,221 +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_ReedSolomonDecoder.h"
-
-#include <memory>
-#include <utility>
-
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
-#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
-
-CBC_ReedSolomonDecoder::CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256* field) {
- m_field = field;
-}
-CBC_ReedSolomonDecoder::~CBC_ReedSolomonDecoder() {}
-void CBC_ReedSolomonDecoder::Decode(CFX_Int32Array* received,
- int32_t twoS,
- int32_t& e) {
- CBC_ReedSolomonGF256Poly poly;
- poly.Init(m_field, received, e);
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- CFX_Int32Array syndromeCoefficients;
- syndromeCoefficients.SetSize(twoS);
- FX_BOOL dataMatrix = FALSE;
- FX_BOOL noError = TRUE;
- for (int32_t i = 0; i < twoS; i++) {
- int32_t eval = poly.EvaluateAt(m_field->Exp(dataMatrix ? i + 1 : i));
- syndromeCoefficients[twoS - 1 - i] = eval;
- if (eval != 0) {
- noError = FALSE;
- }
- }
- if (noError) {
- return;
- }
- CBC_ReedSolomonGF256Poly syndrome;
- syndrome.Init(m_field, &syndromeCoefficients, e);
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> temp(
- m_field->BuildMonomial(twoS, 1, e));
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- std::unique_ptr<CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>> sigmaOmega(
- RunEuclideanAlgorithm(temp.get(), &syndrome, twoS, e));
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> sigma((*sigmaOmega)[0]);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> omega((*sigmaOmega)[1]);
- std::unique_ptr<CFX_Int32Array> errorLocations(
- FindErrorLocations(sigma.get(), e));
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- std::unique_ptr<CFX_Int32Array> errorMagnitudes(
- FindErrorMagnitudes(omega.get(), errorLocations.get(), dataMatrix, e));
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- for (int32_t k = 0; k < errorLocations->GetSize(); k++) {
- int32_t position =
- received->GetSize() - 1 - m_field->Log((*errorLocations)[k], e);
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- if (position < 0) {
- e = BCExceptionBadErrorLocation;
- BC_EXCEPTION_CHECK_ReturnVoid(e);
- }
- (*received)[position] = CBC_ReedSolomonGF256::AddOrSubtract(
- (*received)[position], (*errorMagnitudes)[k]);
- }
-}
-
-CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>*
-CBC_ReedSolomonDecoder::RunEuclideanAlgorithm(CBC_ReedSolomonGF256Poly* a,
- CBC_ReedSolomonGF256Poly* b,
- int32_t R,
- int32_t& e) {
- if (a->GetDegree() < b->GetDegree()) {
- CBC_ReedSolomonGF256Poly* temp = a;
- a = b;
- b = temp;
- }
- std::unique_ptr<CBC_ReedSolomonGF256Poly> rLast(a->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> r(b->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> sLast(m_field->GetOne()->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> s(m_field->GetZero()->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> tLast(m_field->GetZero()->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> t(m_field->GetOne()->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- while (r->GetDegree() >= R / 2) {
- std::unique_ptr<CBC_ReedSolomonGF256Poly> rLastLast = std::move(rLast);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> sLastLast = std::move(sLast);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> tLastlast = std::move(tLast);
- rLast = std::move(r);
- sLast = std::move(s);
- tLast = std::move(t);
- if (rLast->IsZero()) {
- e = BCExceptionR_I_1IsZero;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- r.reset(rLastLast->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> q(m_field->GetZero()->Clone(e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- int32_t denominatorLeadingTerm = rLast->GetCoefficients(rLast->GetDegree());
- int32_t dltInverse = m_field->Inverse(denominatorLeadingTerm, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- while (r->GetDegree() >= rLast->GetDegree() && !(r->IsZero())) {
- int32_t degreeDiff = r->GetDegree() - rLast->GetDegree();
- int32_t scale =
- m_field->Multiply(r->GetCoefficients(r->GetDegree()), dltInverse);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> build(
- m_field->BuildMonomial(degreeDiff, scale, e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- q.reset(q->AddOrSubtract(build.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> multiply(
- rLast->MultiplyByMonomial(degreeDiff, scale, e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- r.reset(r->AddOrSubtract(multiply.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- std::unique_ptr<CBC_ReedSolomonGF256Poly> temp1(
- q->Multiply(sLast.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- s.reset(temp1->AddOrSubtract(sLastLast.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> temp5(
- q->Multiply(tLast.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- t.reset(temp5->AddOrSubtract(tLastlast.get(), e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- int32_t sigmaTildeAtZero = t->GetCoefficients(0);
- if (sigmaTildeAtZero == 0) {
- e = BCExceptionIsZero;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- int32_t inverse = m_field->Inverse(sigmaTildeAtZero, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> sigma(t->Multiply(inverse, e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- std::unique_ptr<CBC_ReedSolomonGF256Poly> omega(r->Multiply(inverse, e));
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* temp =
- new CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>();
- temp->Add(sigma.release());
- temp->Add(omega.release());
- return temp;
-}
-CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorLocations(
- CBC_ReedSolomonGF256Poly* errorLocator,
- int32_t& e) {
- int32_t numErrors = errorLocator->GetDegree();
- if (numErrors == 1) {
- std::unique_ptr<CFX_Int32Array> temp(new CFX_Int32Array);
- temp->Add(errorLocator->GetCoefficients(1));
- return temp.release();
- }
- CFX_Int32Array* tempT = new CFX_Int32Array;
- tempT->SetSize(numErrors);
- std::unique_ptr<CFX_Int32Array> result(tempT);
- int32_t ie = 0;
- for (int32_t i = 1; i < 256 && ie < numErrors; i++) {
- if (errorLocator->EvaluateAt(i) == 0) {
- (*result)[ie] = m_field->Inverse(i, ie);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- ie++;
- }
- }
- if (ie != numErrors) {
- e = BCExceptionDegreeNotMatchRoots;
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- }
- return result.release();
-}
-CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes(
- CBC_ReedSolomonGF256Poly* errorEvaluator,
- CFX_Int32Array* errorLocations,
- FX_BOOL dataMatrix,
- int32_t& e) {
- int32_t s = errorLocations->GetSize();
- CFX_Int32Array* tempArray = new CFX_Int32Array;
- tempArray->SetSize(s);
- std::unique_ptr<CFX_Int32Array> result(tempArray);
- for (int32_t i = 0; i < s; i++) {
- int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- int32_t denominator = 1;
- for (int32_t j = 0; j < s; j++) {
- if (i != j) {
- denominator = m_field->Multiply(
- denominator, CBC_ReedSolomonGF256::AddOrSubtract(
- 1, m_field->Multiply(errorLocations->operator[](j),
- xiInverse)));
- }
- }
- int32_t temp = m_field->Inverse(denominator, e);
- BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
- (*result)[i] =
- m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp);
- }
- return result.release();
-}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h
deleted file mode 100644
index d42af6a27a..0000000000
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.h
+++ /dev/null
@@ -1,37 +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_REEDSOLOMONDECODER_H_
-#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONDECODER_H_
-
-#include "core/fxcrt/include/fx_basic.h"
-
-class CBC_ReedSolomonGF256;
-class CBC_ReedSolomonGF256Poly;
-
-class CBC_ReedSolomonDecoder {
- public:
- CBC_ReedSolomonDecoder(CBC_ReedSolomonGF256* field);
- virtual ~CBC_ReedSolomonDecoder();
-
- void Decode(CFX_Int32Array* received, int32_t twoS, int32_t& e);
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* RunEuclideanAlgorithm(
- CBC_ReedSolomonGF256Poly* a,
- CBC_ReedSolomonGF256Poly* b,
- int32_t R,
- int32_t& e);
- CFX_Int32Array* FindErrorLocations(CBC_ReedSolomonGF256Poly* errorLocator,
- int32_t& e);
- CFX_Int32Array* FindErrorMagnitudes(CBC_ReedSolomonGF256Poly* errorEvaluator,
- CFX_Int32Array* errorLocations,
- FX_BOOL dataMatrix,
- int32_t& e);
-
- private:
- CBC_ReedSolomonGF256* m_field;
-};
-
-#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONDECODER_H_