| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef XFA_SRC_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ | |
| 8 #define XFA_SRC_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ | |
| 9 | |
| 10 class CBC_CommonDecoderResult; | |
| 11 class CBC_CommonBitMatrix; | |
| 12 class CBC_Codeword; | |
| 13 class CBC_BoundingBox; | |
| 14 class CBC_ResultPoint; | |
| 15 class CBC_BarcodeMetadata; | |
| 16 class CBC_DetectionResult; | |
| 17 class CBC_DetectionResultRowIndicatorColumn; | |
| 18 | |
| 19 class CBC_PDF417ScanningDecoder { | |
| 20 public: | |
| 21 CBC_PDF417ScanningDecoder(); | |
| 22 virtual ~CBC_PDF417ScanningDecoder(); | |
| 23 static void Initialize(); | |
| 24 static void Finalize(); | |
| 25 static CBC_CommonDecoderResult* decode(CBC_CommonBitMatrix* image, | |
| 26 CBC_ResultPoint* imageTopLeft, | |
| 27 CBC_ResultPoint* imageBottomLeft, | |
| 28 CBC_ResultPoint* imageTopRight, | |
| 29 CBC_ResultPoint* imageBottomRight, | |
| 30 int32_t minCodewordWidth, | |
| 31 int32_t maxCodewordWidth, | |
| 32 int32_t& e); | |
| 33 static CFX_ByteString toString(CFX_PtrArray* barcodeMatrix); | |
| 34 | |
| 35 private: | |
| 36 static int32_t CODEWORD_SKEW_SIZE; | |
| 37 static int32_t MAX_ERRORS; | |
| 38 static int32_t MAX_EC_CODEWORDS; | |
| 39 static CBC_PDF417ECErrorCorrection* errorCorrection; | |
| 40 static CBC_DetectionResult* merge( | |
| 41 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, | |
| 42 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, | |
| 43 int32_t& e); | |
| 44 static CBC_BoundingBox* adjustBoundingBox( | |
| 45 CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, | |
| 46 int32_t& e); | |
| 47 static int32_t getMax(CFX_Int32Array& values); | |
| 48 static CBC_BarcodeMetadata* getBarcodeMetadata( | |
| 49 CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, | |
| 50 CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn); | |
| 51 static CBC_DetectionResultRowIndicatorColumn* getRowIndicatorColumn( | |
| 52 CBC_CommonBitMatrix* image, | |
| 53 CBC_BoundingBox* boundingBox, | |
| 54 CBC_ResultPoint startPoint, | |
| 55 FX_BOOL leftToRight, | |
| 56 int32_t minCodewordWidth, | |
| 57 int32_t maxCodewordWidth); | |
| 58 static void adjustCodewordCount(CBC_DetectionResult* detectionResult, | |
| 59 CFX_PtrArray* barcodeMatrix, | |
| 60 int32_t& e); | |
| 61 static CBC_CommonDecoderResult* createDecoderResult( | |
| 62 CBC_DetectionResult* detectionResult, | |
| 63 int32_t& e); | |
| 64 static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues( | |
| 65 int32_t ecLevel, | |
| 66 CFX_Int32Array& codewords, | |
| 67 CFX_Int32Array& erasureArray, | |
| 68 CFX_Int32Array& ambiguousIndexes, | |
| 69 CFX_PtrArray& ambiguousIndexValues, | |
| 70 int32_t& e); | |
| 71 static CFX_PtrArray* createBarcodeMatrix( | |
| 72 CBC_DetectionResult* detectionResult); | |
| 73 static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, | |
| 74 int32_t barcodeColumn); | |
| 75 static int32_t getStartColumn(CBC_DetectionResult* detectionResult, | |
| 76 int32_t barcodeColumn, | |
| 77 int32_t imageRow, | |
| 78 FX_BOOL leftToRight); | |
| 79 static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, | |
| 80 int32_t minColumn, | |
| 81 int32_t maxColumn, | |
| 82 FX_BOOL leftToRight, | |
| 83 int32_t startColumn, | |
| 84 int32_t imageRow, | |
| 85 int32_t minCodewordWidth, | |
| 86 int32_t maxCodewordWidth); | |
| 87 static CFX_Int32Array* getModuleBitCount(CBC_CommonBitMatrix* image, | |
| 88 int32_t minColumn, | |
| 89 int32_t maxColumn, | |
| 90 FX_BOOL leftToRight, | |
| 91 int32_t startColumn, | |
| 92 int32_t imageRow); | |
| 93 static int32_t getNumberOfECCodeWords(int32_t barcodeECLevel); | |
| 94 static int32_t adjustCodewordStartColumn(CBC_CommonBitMatrix* image, | |
| 95 int32_t minColumn, | |
| 96 int32_t maxColumn, | |
| 97 FX_BOOL leftToRight, | |
| 98 int32_t codewordStartColumn, | |
| 99 int32_t imageRow); | |
| 100 static FX_BOOL checkCodewordSkew(int32_t codewordSize, | |
| 101 int32_t minCodewordWidth, | |
| 102 int32_t maxCodewordWidth); | |
| 103 static CBC_CommonDecoderResult* decodeCodewords(CFX_Int32Array& codewords, | |
| 104 int32_t ecLevel, | |
| 105 CFX_Int32Array& erasures, | |
| 106 int32_t& e); | |
| 107 static int32_t correctErrors(CFX_Int32Array& codewords, | |
| 108 CFX_Int32Array& erasures, | |
| 109 int32_t numECCodewords, | |
| 110 int32_t& e); | |
| 111 static void verifyCodewordCount(CFX_Int32Array& codewords, | |
| 112 int32_t numECCodewords, | |
| 113 int32_t& e); | |
| 114 static CFX_Int32Array* getBitCountForCodeword(int32_t codeword); | |
| 115 static int32_t getCodewordBucketNumber(int32_t codeword); | |
| 116 static int32_t getCodewordBucketNumber(CFX_Int32Array& moduleBitCount); | |
| 117 }; | |
| 118 | |
| 119 #endif // XFA_SRC_FXBARCODE_PDF417_BC_PDF417SCANNINGDECODER_H_ | |
| OLD | NEW |