| 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 | 6 |
| 7 #ifndef XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ | 7 #ifndef XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ |
| 8 #define XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ | 8 #define XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ |
| 9 | 9 |
| 10 #include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeValue.h" |
| 11 |
| 10 class CBC_CommonDecoderResult; | 12 class CBC_CommonDecoderResult; |
| 11 class CBC_CommonBitMatrix; | 13 class CBC_CommonBitMatrix; |
| 12 class CBC_Codeword; | 14 class CBC_Codeword; |
| 13 class CBC_BoundingBox; | 15 class CBC_BoundingBox; |
| 14 class CBC_ResultPoint; | 16 class CBC_ResultPoint; |
| 15 class CBC_BarcodeMetadata; | 17 class CBC_BarcodeMetadata; |
| 16 class CBC_DetectionResult; | 18 class CBC_DetectionResult; |
| 17 class CBC_DetectionResultRowIndicatorColumn; | 19 class CBC_DetectionResultRowIndicatorColumn; |
| 18 | 20 |
| 19 class CBC_PDF417ScanningDecoder { | 21 class CBC_PDF417ScanningDecoder { |
| 20 public: | 22 public: |
| 21 CBC_PDF417ScanningDecoder(); | 23 CBC_PDF417ScanningDecoder(); |
| 22 virtual ~CBC_PDF417ScanningDecoder(); | 24 virtual ~CBC_PDF417ScanningDecoder(); |
| 23 static void Initialize(); | 25 static void Initialize(); |
| 24 static void Finalize(); | 26 static void Finalize(); |
| 25 static CBC_CommonDecoderResult* decode(CBC_CommonBitMatrix* image, | 27 static CBC_CommonDecoderResult* decode(CBC_CommonBitMatrix* image, |
| 26 CBC_ResultPoint* imageTopLeft, | 28 CBC_ResultPoint* imageTopLeft, |
| 27 CBC_ResultPoint* imageBottomLeft, | 29 CBC_ResultPoint* imageBottomLeft, |
| 28 CBC_ResultPoint* imageTopRight, | 30 CBC_ResultPoint* imageTopRight, |
| 29 CBC_ResultPoint* imageBottomRight, | 31 CBC_ResultPoint* imageBottomRight, |
| 30 int32_t minCodewordWidth, | 32 int32_t minCodewordWidth, |
| 31 int32_t maxCodewordWidth, | 33 int32_t maxCodewordWidth, |
| 32 int32_t& e); | 34 int32_t& e); |
| 33 static CFX_ByteString toString(CFX_PtrArray* barcodeMatrix); | 35 static CFX_ByteString toString(CBC_BarcodeValueArrayArray* barcodeMatrix); |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 static int32_t CODEWORD_SKEW_SIZE; | 38 static int32_t CODEWORD_SKEW_SIZE; |
| 37 static int32_t MAX_ERRORS; | 39 static int32_t MAX_ERRORS; |
| 38 static int32_t MAX_EC_CODEWORDS; | 40 static int32_t MAX_EC_CODEWORDS; |
| 39 static CBC_PDF417ECErrorCorrection* errorCorrection; | 41 static CBC_PDF417ECErrorCorrection* errorCorrection; |
| 40 static CBC_DetectionResult* merge( | 42 static CBC_DetectionResult* merge( |
| 41 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, | 43 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, |
| 42 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, | 44 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, |
| 43 int32_t& e); | 45 int32_t& e); |
| 44 static CBC_BoundingBox* adjustBoundingBox( | 46 static CBC_BoundingBox* adjustBoundingBox( |
| 45 CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, | 47 CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, |
| 46 int32_t& e); | 48 int32_t& e); |
| 47 static int32_t getMax(CFX_Int32Array& values); | 49 static int32_t getMax(CFX_Int32Array& values); |
| 48 static CBC_BarcodeMetadata* getBarcodeMetadata( | 50 static CBC_BarcodeMetadata* getBarcodeMetadata( |
| 49 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, | 51 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, |
| 50 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn); | 52 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn); |
| 51 static CBC_DetectionResultRowIndicatorColumn* getRowIndicatorColumn( | 53 static CBC_DetectionResultRowIndicatorColumn* getRowIndicatorColumn( |
| 52 CBC_CommonBitMatrix* image, | 54 CBC_CommonBitMatrix* image, |
| 53 CBC_BoundingBox* boundingBox, | 55 CBC_BoundingBox* boundingBox, |
| 54 CBC_ResultPoint startPoint, | 56 CBC_ResultPoint startPoint, |
| 55 FX_BOOL leftToRight, | 57 FX_BOOL leftToRight, |
| 56 int32_t minCodewordWidth, | 58 int32_t minCodewordWidth, |
| 57 int32_t maxCodewordWidth); | 59 int32_t maxCodewordWidth); |
| 58 static void adjustCodewordCount(CBC_DetectionResult* detectionResult, | 60 static void adjustCodewordCount(CBC_DetectionResult* detectionResult, |
| 59 CFX_PtrArray* barcodeMatrix, | 61 CBC_BarcodeValueArrayArray* barcodeMatrix, |
| 60 int32_t& e); | 62 int32_t& e); |
| 61 static CBC_CommonDecoderResult* createDecoderResult( | 63 static CBC_CommonDecoderResult* createDecoderResult( |
| 62 CBC_DetectionResult* detectionResult, | 64 CBC_DetectionResult* detectionResult, |
| 63 int32_t& e); | 65 int32_t& e); |
| 64 static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues( | 66 static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues( |
| 65 int32_t ecLevel, | 67 int32_t ecLevel, |
| 66 CFX_Int32Array& codewords, | 68 CFX_Int32Array& codewords, |
| 67 CFX_Int32Array& erasureArray, | 69 CFX_Int32Array& erasureArray, |
| 68 CFX_Int32Array& ambiguousIndexes, | 70 CFX_Int32Array& ambiguousIndexes, |
| 69 CFX_PtrArray& ambiguousIndexValues, | 71 CFX_ArrayTemplate<CFX_Int32Array*>& ambiguousIndexValues, |
| 70 int32_t& e); | 72 int32_t& e); |
| 71 static CFX_PtrArray* createBarcodeMatrix( | 73 static CBC_BarcodeValueArrayArray* createBarcodeMatrix( |
| 72 CBC_DetectionResult* detectionResult); | 74 CBC_DetectionResult* detectionResult); |
| 73 static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, | 75 static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, |
| 74 int32_t barcodeColumn); | 76 int32_t barcodeColumn); |
| 75 static int32_t getStartColumn(CBC_DetectionResult* detectionResult, | 77 static int32_t getStartColumn(CBC_DetectionResult* detectionResult, |
| 76 int32_t barcodeColumn, | 78 int32_t barcodeColumn, |
| 77 int32_t imageRow, | 79 int32_t imageRow, |
| 78 FX_BOOL leftToRight); | 80 FX_BOOL leftToRight); |
| 79 static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, | 81 static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, |
| 80 int32_t minColumn, | 82 int32_t minColumn, |
| 81 int32_t maxColumn, | 83 int32_t maxColumn, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 110 int32_t& e); | 112 int32_t& e); |
| 111 static void verifyCodewordCount(CFX_Int32Array& codewords, | 113 static void verifyCodewordCount(CFX_Int32Array& codewords, |
| 112 int32_t numECCodewords, | 114 int32_t numECCodewords, |
| 113 int32_t& e); | 115 int32_t& e); |
| 114 static CFX_Int32Array* getBitCountForCodeword(int32_t codeword); | 116 static CFX_Int32Array* getBitCountForCodeword(int32_t codeword); |
| 115 static int32_t getCodewordBucketNumber(int32_t codeword); | 117 static int32_t getCodewordBucketNumber(int32_t codeword); |
| 116 static int32_t getCodewordBucketNumber(CFX_Int32Array& moduleBitCount); | 118 static int32_t getCodewordBucketNumber(CFX_Int32Array& moduleBitCount); |
| 117 }; | 119 }; |
| 118 | 120 |
| 119 #endif // XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ | 121 #endif // XFA_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ |
| OLD | NEW |