OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 // Original code is licensed as follows: | 6 // Original code is licensed as follows: |
7 /* | 7 /* |
8 * Copyright 2007 ZXing authors | 8 * Copyright 2007 ZXing authors |
9 * | 9 * |
10 * Licensed under the Apache License, Version 2.0 (the "License"); | 10 * Licensed under the Apache License, Version 2.0 (the "License"); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 190 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
191 } | 191 } |
192 return result.release(); | 192 return result.release(); |
193 } | 193 } |
194 CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes( | 194 CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes( |
195 CBC_ReedSolomonGF256Poly* errorEvaluator, | 195 CBC_ReedSolomonGF256Poly* errorEvaluator, |
196 CFX_Int32Array* errorLocations, | 196 CFX_Int32Array* errorLocations, |
197 FX_BOOL dataMatrix, | 197 FX_BOOL dataMatrix, |
198 int32_t& e) { | 198 int32_t& e) { |
199 int32_t s = errorLocations->GetSize(); | 199 int32_t s = errorLocations->GetSize(); |
200 CFX_Int32Array* temp = new CFX_Int32Array; | 200 CFX_Int32Array* tempArray = new CFX_Int32Array; |
201 temp->SetSize(s); | 201 tempArray->SetSize(s); |
202 std::unique_ptr<CFX_Int32Array> result(temp); | 202 std::unique_ptr<CFX_Int32Array> result(tempArray); |
203 for (int32_t i = 0; i < s; i++) { | 203 for (int32_t i = 0; i < s; i++) { |
204 int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e); | 204 int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e); |
205 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 205 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
206 int32_t denominator = 1; | 206 int32_t denominator = 1; |
207 for (int32_t j = 0; j < s; j++) { | 207 for (int32_t j = 0; j < s; j++) { |
208 if (i != j) { | 208 if (i != j) { |
209 denominator = m_field->Multiply( | 209 denominator = m_field->Multiply( |
210 denominator, CBC_ReedSolomonGF256::AddOrSubtract( | 210 denominator, CBC_ReedSolomonGF256::AddOrSubtract( |
211 1, m_field->Multiply(errorLocations->operator[](j), | 211 1, m_field->Multiply(errorLocations->operator[](j), |
212 xiInverse))); | 212 xiInverse))); |
213 } | 213 } |
214 } | 214 } |
215 int32_t temp = m_field->Inverse(denominator, temp); | 215 int32_t temp = m_field->Inverse(denominator, e); |
216 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 216 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); |
217 (*result)[i] = | 217 (*result)[i] = |
218 m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp); | 218 m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp); |
219 } | 219 } |
220 return result.release(); | 220 return result.release(); |
221 } | 221 } |
OLD | NEW |