| 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 2013 ZXing authors | 8 * Copyright 2013 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"); |
| 11 * you may not use this file except in compliance with the License. | 11 * you may not use this file except in compliance with the License. |
| 12 * You may obtain a copy of the License at | 12 * You may obtain a copy of the License at |
| 13 * | 13 * |
| 14 * http://www.apache.org/licenses/LICENSE-2.0 | 14 * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 * | 15 * |
| 16 * Unless required by applicable law or agreed to in writing, software | 16 * Unless required by applicable law or agreed to in writing, software |
| 17 * distributed under the License is distributed on an "AS IS" BASIS, | 17 * distributed under the License is distributed on an "AS IS" BASIS, |
| 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 * See the License for the specific language governing permissions and | 19 * See the License for the specific language governing permissions and |
| 20 * limitations under the License. | 20 * limitations under the License. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include <memory> |
| 24 |
| 23 #include "xfa/fxbarcode/BC_DecoderResult.h" | 25 #include "xfa/fxbarcode/BC_DecoderResult.h" |
| 24 #include "xfa/fxbarcode/BC_ResultPoint.h" | 26 #include "xfa/fxbarcode/BC_ResultPoint.h" |
| 25 #include "xfa/fxbarcode/common/BC_CommonBitMatrix.h" | 27 #include "xfa/fxbarcode/common/BC_CommonBitMatrix.h" |
| 26 #include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h" | 28 #include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMetadata.h" |
| 27 #include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h" | 29 #include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h" |
| 28 #include "xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.h" | 30 #include "xfa/fxbarcode/pdf417/BC_PDF417BoundingBox.h" |
| 29 #include "xfa/fxbarcode/pdf417/BC_PDF417Codeword.h" | 31 #include "xfa/fxbarcode/pdf417/BC_PDF417Codeword.h" |
| 30 #include "xfa/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h" | 32 #include "xfa/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h" |
| 31 #include "xfa/fxbarcode/pdf417/BC_PDF417Common.h" | 33 #include "xfa/fxbarcode/pdf417/BC_PDF417Common.h" |
| 32 #include "xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h" | 34 #include "xfa/fxbarcode/pdf417/BC_PDF417DecodedBitStreamParser.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 150 } |
| 149 } | 151 } |
| 150 CBC_CommonDecoderResult* decoderresult = | 152 CBC_CommonDecoderResult* decoderresult = |
| 151 createDecoderResult(detectionResult, e); | 153 createDecoderResult(detectionResult, e); |
| 152 if (e != BCExceptionNO) { | 154 if (e != BCExceptionNO) { |
| 153 delete detectionResult; | 155 delete detectionResult; |
| 154 return NULL; | 156 return NULL; |
| 155 } | 157 } |
| 156 return decoderresult; | 158 return decoderresult; |
| 157 } | 159 } |
| 160 |
| 158 CFX_ByteString CBC_PDF417ScanningDecoder::toString( | 161 CFX_ByteString CBC_PDF417ScanningDecoder::toString( |
| 159 CFX_PtrArray* barcodeMatrix) { | 162 CBC_BarcodeValueArrayArray* barcodeMatrix) { |
| 160 CFX_ByteString result; | 163 CFX_ByteString result; |
| 161 for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) { | 164 for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) { |
| 162 result += row; | 165 result += row; |
| 163 int32_t l = 0; | 166 for (int32_t l = 0; l < barcodeMatrix->GetAt(row)->GetSize(); l++) { |
| 164 for (; l < ((CFX_PtrArray*)barcodeMatrix->GetAt(row))->GetSize(); l++) { | 167 CBC_BarcodeValue* barcodeValue = barcodeMatrix->GetAt(row)->GetAt(l); |
| 165 CBC_BarcodeValue* barcodeValue = | |
| 166 (CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row)) | |
| 167 ->GetAt(l); | |
| 168 if (barcodeValue->getValue()->GetSize() == 0) { | 168 if (barcodeValue->getValue()->GetSize() == 0) { |
| 169 result += ""; | 169 result += ""; |
| 170 } else { | 170 } else { |
| 171 result += barcodeValue->getValue()->GetAt(0); | 171 result += barcodeValue->getValue()->GetAt(0); |
| 172 result += | 172 result += |
| 173 barcodeValue->getConfidence(barcodeValue->getValue()->GetAt(0)); | 173 barcodeValue->getConfidence(barcodeValue->getValue()->GetAt(0)); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 return result; | 177 return result; |
| 178 } | 178 } |
| 179 |
| 179 CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge( | 180 CBC_DetectionResult* CBC_PDF417ScanningDecoder::merge( |
| 180 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, | 181 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, |
| 181 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, | 182 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, |
| 182 int32_t& e) { | 183 int32_t& e) { |
| 183 if (leftRowIndicatorColumn == NULL && rightRowIndicatorColumn == NULL) { | 184 if (leftRowIndicatorColumn == NULL && rightRowIndicatorColumn == NULL) { |
| 184 e = BCExceptionIllegalArgument; | 185 e = BCExceptionIllegalArgument; |
| 185 return NULL; | 186 return NULL; |
| 186 } | 187 } |
| 187 CBC_BarcodeMetadata* barcodeMetadata = | 188 CBC_BarcodeMetadata* barcodeMetadata = |
| 188 getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn); | 189 getBarcodeMetadata(leftRowIndicatorColumn, rightRowIndicatorColumn); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (leftToRight) { | 317 if (leftToRight) { |
| 317 startColumn = codeword->getStartX(); | 318 startColumn = codeword->getStartX(); |
| 318 } else { | 319 } else { |
| 319 startColumn = codeword->getEndX(); | 320 startColumn = codeword->getEndX(); |
| 320 } | 321 } |
| 321 } | 322 } |
| 322 } | 323 } |
| 323 } | 324 } |
| 324 return rowIndicatorColumn; | 325 return rowIndicatorColumn; |
| 325 } | 326 } |
| 327 |
| 326 void CBC_PDF417ScanningDecoder::adjustCodewordCount( | 328 void CBC_PDF417ScanningDecoder::adjustCodewordCount( |
| 327 CBC_DetectionResult* detectionResult, | 329 CBC_DetectionResult* detectionResult, |
| 328 CFX_PtrArray* barcodeMatrix, | 330 CBC_BarcodeValueArrayArray* barcodeMatrix, |
| 329 int32_t& e) { | 331 int32_t& e) { |
| 330 CFX_Int32Array* numberOfCodewords = | 332 std::unique_ptr<CFX_Int32Array> numberOfCodewords( |
| 331 ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1)) | 333 barcodeMatrix->GetAt(0)->GetAt(1)->getValue()); |
| 332 ->getValue(); | |
| 333 int32_t calculatedNumberOfCodewords = | 334 int32_t calculatedNumberOfCodewords = |
| 334 detectionResult->getBarcodeColumnCount() * | 335 detectionResult->getBarcodeColumnCount() * |
| 335 detectionResult->getBarcodeRowCount() - | 336 detectionResult->getBarcodeRowCount() - |
| 336 getNumberOfECCodeWords(detectionResult->getBarcodeECLevel()); | 337 getNumberOfECCodeWords(detectionResult->getBarcodeECLevel()); |
| 337 if (numberOfCodewords->GetSize() == 0) { | 338 if (numberOfCodewords->GetSize() == 0) { |
| 338 if (calculatedNumberOfCodewords < 1 || | 339 if (calculatedNumberOfCodewords < 1 || |
| 339 calculatedNumberOfCodewords > | 340 calculatedNumberOfCodewords > |
| 340 CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE) { | 341 CBC_PDF417Common::MAX_CODEWORDS_IN_BARCODE) { |
| 341 e = BCExceptiontNotFoundInstance; | 342 e = BCExceptiontNotFoundInstance; |
| 342 delete numberOfCodewords; | |
| 343 BC_EXCEPTION_CHECK_ReturnVoid(e); | 343 BC_EXCEPTION_CHECK_ReturnVoid(e); |
| 344 } | 344 } |
| 345 ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1)) | 345 barcodeMatrix->GetAt(0)->GetAt(1)->setValue(calculatedNumberOfCodewords); |
| 346 ->setValue(calculatedNumberOfCodewords); | |
| 347 } else if (numberOfCodewords->GetAt(0) != calculatedNumberOfCodewords) { | 346 } else if (numberOfCodewords->GetAt(0) != calculatedNumberOfCodewords) { |
| 348 ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(0))->GetAt(1)) | 347 barcodeMatrix->GetAt(0)->GetAt(1)->setValue(calculatedNumberOfCodewords); |
| 349 ->setValue(calculatedNumberOfCodewords); | |
| 350 } | 348 } |
| 351 delete numberOfCodewords; | |
| 352 } | 349 } |
| 350 |
| 353 CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult( | 351 CBC_CommonDecoderResult* CBC_PDF417ScanningDecoder::createDecoderResult( |
| 354 CBC_DetectionResult* detectionResult, | 352 CBC_DetectionResult* detectionResult, |
| 355 int32_t& e) { | 353 int32_t& e) { |
| 356 CFX_PtrArray* barcodeMatrix = createBarcodeMatrix(detectionResult); | 354 std::unique_ptr<CBC_BarcodeValueArrayArray> barcodeMatrix( |
| 357 adjustCodewordCount(detectionResult, barcodeMatrix, e); | 355 createBarcodeMatrix(detectionResult)); |
| 356 adjustCodewordCount(detectionResult, barcodeMatrix.get(), e); |
| 358 if (e != BCExceptionNO) { | 357 if (e != BCExceptionNO) { |
| 359 for (int32_t i = 0; i < barcodeMatrix->GetSize(); i++) { | 358 for (int32_t i = 0; i < barcodeMatrix->GetSize(); i++) { |
| 360 CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(i); | 359 CBC_BarcodeValueArray* temp = barcodeMatrix->GetAt(i); |
| 361 for (int32_t j = 0; j < temp->GetSize(); j++) { | 360 for (int32_t j = 0; j < temp->GetSize(); j++) |
| 362 delete (CBC_BarcodeValue*)temp->GetAt(j); | 361 delete temp->GetAt(j); |
| 363 } | |
| 364 temp->RemoveAll(); | |
| 365 delete temp; | 362 delete temp; |
| 366 } | 363 } |
| 367 barcodeMatrix->RemoveAll(); | 364 return nullptr; |
| 368 delete barcodeMatrix; | |
| 369 return NULL; | |
| 370 } | 365 } |
| 371 CFX_Int32Array erasures; | 366 CFX_Int32Array erasures; |
| 372 CFX_Int32Array codewords; | 367 CFX_Int32Array codewords; |
| 373 codewords.SetSize(detectionResult->getBarcodeRowCount() * | 368 codewords.SetSize(detectionResult->getBarcodeRowCount() * |
| 374 detectionResult->getBarcodeColumnCount()); | 369 detectionResult->getBarcodeColumnCount()); |
| 375 CFX_PtrArray ambiguousIndexValuesList; | 370 CFX_ArrayTemplate<CFX_Int32Array*> ambiguousIndexValuesList; |
| 376 CFX_Int32Array ambiguousIndexesList; | 371 CFX_Int32Array ambiguousIndexesList; |
| 377 for (int32_t row = 0; row < detectionResult->getBarcodeRowCount(); row++) { | 372 for (int32_t row = 0; row < detectionResult->getBarcodeRowCount(); row++) { |
| 378 for (int32_t l = 0; l < detectionResult->getBarcodeColumnCount(); l++) { | 373 for (int32_t l = 0; l < detectionResult->getBarcodeColumnCount(); l++) { |
| 379 CFX_Int32Array* values = | 374 CFX_Int32Array* values = |
| 380 ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt(row)) | 375 barcodeMatrix->GetAt(row)->GetAt(l + 1)->getValue(); |
| 381 ->GetAt(l + 1)) | |
| 382 ->getValue(); | |
| 383 int32_t codewordIndex = | 376 int32_t codewordIndex = |
| 384 row * detectionResult->getBarcodeColumnCount() + l; | 377 row * detectionResult->getBarcodeColumnCount() + l; |
| 385 if (values->GetSize() == 0) { | 378 if (values->GetSize() == 0) { |
| 386 erasures.Add(codewordIndex); | 379 erasures.Add(codewordIndex); |
| 387 } else if (values->GetSize() == 1) { | 380 } else if (values->GetSize() == 1) { |
| 388 codewords[codewordIndex] = values->GetAt(0); | 381 codewords[codewordIndex] = values->GetAt(0); |
| 389 } else { | 382 } else { |
| 390 ambiguousIndexesList.Add(codewordIndex); | 383 ambiguousIndexesList.Add(codewordIndex); |
| 391 ambiguousIndexValuesList.Add(values); | 384 ambiguousIndexValuesList.Add(values); |
| 392 } | 385 } |
| 393 } | 386 } |
| 394 } | 387 } |
| 395 CFX_PtrArray ambiguousIndexValues; | 388 CFX_ArrayTemplate<CFX_Int32Array*> ambiguousIndexValues; |
| 396 ambiguousIndexValues.SetSize(ambiguousIndexValuesList.GetSize()); | 389 ambiguousIndexValues.SetSize(ambiguousIndexValuesList.GetSize()); |
| 397 for (int32_t i = 0; i < ambiguousIndexValues.GetSize(); i++) { | 390 for (int32_t i = 0; i < ambiguousIndexValues.GetSize(); i++) { |
| 398 ambiguousIndexValues.SetAt(i, ambiguousIndexValuesList.GetAt(i)); | 391 ambiguousIndexValues.SetAt(i, ambiguousIndexValuesList.GetAt(i)); |
| 399 } | 392 } |
| 400 for (int32_t l = 0; l < barcodeMatrix->GetSize(); l++) { | 393 for (int32_t l = 0; l < barcodeMatrix->GetSize(); l++) { |
| 401 CFX_PtrArray* temp = (CFX_PtrArray*)barcodeMatrix->GetAt(l); | 394 CBC_BarcodeValueArray* temp = barcodeMatrix->GetAt(l); |
| 402 for (int32_t j = 0; j < temp->GetSize(); j++) { | 395 for (int32_t j = 0; j < temp->GetSize(); j++) |
| 403 delete (CBC_BarcodeValue*)temp->GetAt(j); | 396 delete temp->GetAt(j); |
| 404 } | |
| 405 temp->RemoveAll(); | 397 temp->RemoveAll(); |
| 406 delete temp; | 398 delete temp; |
| 407 } | 399 } |
| 408 barcodeMatrix->RemoveAll(); | |
| 409 delete barcodeMatrix; | |
| 410 CBC_CommonDecoderResult* decoderResult = | 400 CBC_CommonDecoderResult* decoderResult = |
| 411 createDecoderResultFromAmbiguousValues( | 401 createDecoderResultFromAmbiguousValues( |
| 412 detectionResult->getBarcodeECLevel(), codewords, erasures, | 402 detectionResult->getBarcodeECLevel(), codewords, erasures, |
| 413 ambiguousIndexesList, ambiguousIndexValues, e); | 403 ambiguousIndexesList, ambiguousIndexValues, e); |
| 414 BC_EXCEPTION_CHECK_ReturnValue(e, NULL); | 404 BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); |
| 415 return decoderResult; | 405 return decoderResult; |
| 416 } | 406 } |
| 407 |
| 417 CBC_CommonDecoderResult* | 408 CBC_CommonDecoderResult* |
| 418 CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues( | 409 CBC_PDF417ScanningDecoder::createDecoderResultFromAmbiguousValues( |
| 419 int32_t ecLevel, | 410 int32_t ecLevel, |
| 420 CFX_Int32Array& codewords, | 411 CFX_Int32Array& codewords, |
| 421 CFX_Int32Array& erasureArray, | 412 CFX_Int32Array& erasureArray, |
| 422 CFX_Int32Array& ambiguousIndexes, | 413 CFX_Int32Array& ambiguousIndexes, |
| 423 CFX_PtrArray& ambiguousIndexValues, | 414 CFX_ArrayTemplate<CFX_Int32Array*>& ambiguousIndexValues, |
| 424 int32_t& e) { | 415 int32_t& e) { |
| 425 CFX_Int32Array ambiguousIndexCount; | 416 CFX_Int32Array ambiguousIndexCount; |
| 426 ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize()); | 417 ambiguousIndexCount.SetSize(ambiguousIndexes.GetSize()); |
| 427 int32_t tries = 100; | 418 int32_t tries = 100; |
| 428 while (tries-- > 0) { | 419 while (tries-- > 0) { |
| 429 for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) { | 420 for (int32_t l = 0; l < ambiguousIndexCount.GetSize(); l++) { |
| 430 codewords[ambiguousIndexes[l]] = | 421 codewords[ambiguousIndexes[l]] = |
| 431 ((CFX_Int32Array*)ambiguousIndexValues.GetAt(l)) | 422 ambiguousIndexValues.GetAt(l)->GetAt(ambiguousIndexCount[l]); |
| 432 ->GetAt(ambiguousIndexCount[l]); | |
| 433 } | 423 } |
| 434 CBC_CommonDecoderResult* decoderResult = | 424 CBC_CommonDecoderResult* decoderResult = |
| 435 decodeCodewords(codewords, ecLevel, erasureArray, e); | 425 decodeCodewords(codewords, ecLevel, erasureArray, e); |
| 436 if (e != BCExceptionNO) { | 426 if (e != BCExceptionNO) { |
| 437 e = BCExceptionNO; | 427 e = BCExceptionNO; |
| 438 continue; | 428 continue; |
| 439 } else { | 429 } else { |
| 440 return decoderResult; | 430 return decoderResult; |
| 441 } | 431 } |
| 442 if (ambiguousIndexCount.GetSize() == 0) { | 432 if (ambiguousIndexCount.GetSize() == 0) { |
| 443 e = BCExceptionChecksumInstance; | 433 e = BCExceptionChecksumInstance; |
| 444 return NULL; | 434 return NULL; |
| 445 } | 435 } |
| 446 for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) { | 436 for (int32_t i = 0; i < ambiguousIndexCount.GetSize(); i++) { |
| 447 if (ambiguousIndexCount[i] < | 437 if (ambiguousIndexCount[i] < |
| 448 ((CFX_Int32Array*)(ambiguousIndexValues.GetAt(i)))->GetSize() - 1) { | 438 ambiguousIndexValues.GetAt(i)->GetSize() - 1) { |
| 449 ambiguousIndexCount[i]++; | 439 ambiguousIndexCount[i]++; |
| 450 break; | 440 break; |
| 451 } else { | 441 } else { |
| 452 ambiguousIndexCount[i] = 0; | 442 ambiguousIndexCount[i] = 0; |
| 453 if (i == ambiguousIndexCount.GetSize() - 1) { | 443 if (i == ambiguousIndexCount.GetSize() - 1) { |
| 454 e = BCExceptionChecksumInstance; | 444 e = BCExceptionChecksumInstance; |
| 455 return NULL; | 445 return NULL; |
| 456 } | 446 } |
| 457 } | 447 } |
| 458 } | 448 } |
| 459 } | 449 } |
| 460 e = BCExceptionChecksumInstance; | 450 e = BCExceptionChecksumInstance; |
| 461 return NULL; | 451 return NULL; |
| 462 } | 452 } |
| 463 CFX_PtrArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix( | 453 CBC_BarcodeValueArrayArray* CBC_PDF417ScanningDecoder::createBarcodeMatrix( |
| 464 CBC_DetectionResult* detectionResult) { | 454 CBC_DetectionResult* detectionResult) { |
| 465 CFX_PtrArray* barcodeMatrix = new CFX_PtrArray; | 455 CBC_BarcodeValueArrayArray* barcodeMatrix = new CBC_BarcodeValueArrayArray; |
| 466 barcodeMatrix->SetSize(detectionResult->getBarcodeRowCount()); | 456 barcodeMatrix->SetSize(detectionResult->getBarcodeRowCount()); |
| 467 CFX_PtrArray* temp = NULL; | |
| 468 int32_t colume = 0; | |
| 469 for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) { | 457 for (int32_t row = 0; row < barcodeMatrix->GetSize(); row++) { |
| 470 temp = new CFX_PtrArray; | 458 CBC_BarcodeValueArray* temp = new CBC_BarcodeValueArray; |
| 471 temp->SetSize(detectionResult->getBarcodeColumnCount() + 2); | 459 temp->SetSize(detectionResult->getBarcodeColumnCount() + 2); |
| 472 for (colume = 0; colume < detectionResult->getBarcodeColumnCount() + 2; | 460 for (int32_t column = 0; |
| 473 colume++) { | 461 column < detectionResult->getBarcodeColumnCount() + 2; column++) { |
| 474 temp->SetAt(colume, new CBC_BarcodeValue()); | 462 temp->SetAt(column, new CBC_BarcodeValue()); |
| 475 } | 463 } |
| 476 barcodeMatrix->SetAt(row, temp); | 464 barcodeMatrix->SetAt(row, temp); |
| 477 } | 465 } |
| 478 colume = -1; | |
| 479 for (int32_t i = 0; | 466 for (int32_t i = 0; |
| 480 i < detectionResult->getDetectionResultColumns().GetSize(); i++) { | 467 i < detectionResult->getDetectionResultColumns().GetSize(); i++) { |
| 481 CBC_DetectionResultColumn* detectionResultColumn = | 468 CBC_DetectionResultColumn* detectionResultColumn = |
| 482 (CBC_DetectionResultColumn*)detectionResult->getDetectionResultColumns() | 469 (CBC_DetectionResultColumn*)detectionResult->getDetectionResultColumns() |
| 483 .GetAt(i); | 470 .GetAt(i); |
| 484 colume++; | |
| 485 if (detectionResultColumn == NULL) { | 471 if (detectionResultColumn == NULL) { |
| 486 continue; | 472 continue; |
| 487 } | 473 } |
| 488 CFX_ArrayTemplate<CBC_Codeword*>* temp = | 474 CFX_ArrayTemplate<CBC_Codeword*>* temp = |
| 489 detectionResultColumn->getCodewords(); | 475 detectionResultColumn->getCodewords(); |
| 490 for (int32_t l = 0; l < temp->GetSize(); l++) { | 476 for (int32_t l = 0; l < temp->GetSize(); l++) { |
| 491 CBC_Codeword* codeword = temp->GetAt(l); | 477 CBC_Codeword* codeword = temp->GetAt(l); |
| 492 if (codeword == NULL || codeword->getRowNumber() == -1) { | 478 if (codeword == NULL || codeword->getRowNumber() == -1) { |
| 493 continue; | 479 continue; |
| 494 } | 480 } |
| 495 ((CBC_BarcodeValue*)((CFX_PtrArray*)barcodeMatrix->GetAt( | 481 barcodeMatrix->GetAt(codeword->getRowNumber()) |
| 496 codeword->getRowNumber())) | 482 ->GetAt(i) |
| 497 ->GetAt(colume)) | |
| 498 ->setValue(codeword->getValue()); | 483 ->setValue(codeword->getValue()); |
| 499 } | 484 } |
| 500 } | 485 } |
| 501 return barcodeMatrix; | 486 return barcodeMatrix; |
| 502 } | 487 } |
| 503 FX_BOOL CBC_PDF417ScanningDecoder::isValidBarcodeColumn( | 488 FX_BOOL CBC_PDF417ScanningDecoder::isValidBarcodeColumn( |
| 504 CBC_DetectionResult* detectionResult, | 489 CBC_DetectionResult* detectionResult, |
| 505 int32_t barcodeColumn) { | 490 int32_t barcodeColumn) { |
| 506 return barcodeColumn >= 0 && | 491 return barcodeColumn >= 0 && |
| 507 barcodeColumn <= detectionResult->getBarcodeColumnCount() + 1; | 492 barcodeColumn <= detectionResult->getBarcodeColumnCount() + 1; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 int32_t result = getCodewordBucketNumber(*array); | 730 int32_t result = getCodewordBucketNumber(*array); |
| 746 delete array; | 731 delete array; |
| 747 return result; | 732 return result; |
| 748 } | 733 } |
| 749 int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber( | 734 int32_t CBC_PDF417ScanningDecoder::getCodewordBucketNumber( |
| 750 CFX_Int32Array& moduleBitCount) { | 735 CFX_Int32Array& moduleBitCount) { |
| 751 return (moduleBitCount.GetAt(0) - moduleBitCount.GetAt(2) + | 736 return (moduleBitCount.GetAt(0) - moduleBitCount.GetAt(2) + |
| 752 moduleBitCount.GetAt(4) - moduleBitCount.GetAt(6) + 9) % | 737 moduleBitCount.GetAt(4) - moduleBitCount.GetAt(6) + 9) % |
| 753 9; | 738 9; |
| 754 } | 739 } |
| OLD | NEW |