Merge to XFA: Use stdint.h types throughout PDFium.
[pdfium.git] / xfa / src / fxbarcode / pdf417 / BC_PDF417ScanningDecoder.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _BC_PDF417SCANNINGDECODER_H_\r
8 #define _BC_PDF417SCANNINGDECODER_H_\r
9 class CBC_CommonDecoderResult;\r
10 class CBC_CommonBitMatrix;\r
11 class CBC_ErrorCorrection;\r
12 class CBC_Codeword;\r
13 class CBC_BoundingBox;\r
14 class CBC_ResultPoint;\r
15 class CBC_BarcodeMetadata;\r
16 class CBC_BarcodeValue;\r
17 class CBC_DetectionResult;\r
18 class CBC_DetectionResultRowIndicatorColumn;\r
19 \r
20 class CBC_PDF417ScanningDecoder\r
21 {\r
22 public:\r
23     CBC_PDF417ScanningDecoder();\r
24     virtual ~CBC_PDF417ScanningDecoder();\r
25     static void Initialize();\r
26     static void Finalize();\r
27     static CBC_CommonDecoderResult* decode(CBC_CommonBitMatrix* image, CBC_ResultPoint* imageTopLeft, CBC_ResultPoint* imageBottomLeft, CBC_ResultPoint* imageTopRight,\r
28                                            CBC_ResultPoint* imageBottomRight, int32_t minCodewordWidth, int32_t maxCodewordWidth, int32_t &e);\r
29     static CFX_ByteString toString(CFX_PtrArray* barcodeMatrix);\r
30 private:\r
31     static int32_t CODEWORD_SKEW_SIZE;\r
32     static int32_t MAX_ERRORS;\r
33     static int32_t MAX_EC_CODEWORDS;\r
34     static CBC_PDF417ECErrorCorrection* errorCorrection;\r
35     static CBC_DetectionResult* merge(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn, int32_t &e);\r
36     static CBC_BoundingBox* adjustBoundingBox(CBC_DetectionResultRowIndicatorColumn* rowIndicatorColumn, int32_t &e);\r
37     static int32_t getMax(CFX_Int32Array& values);\r
38     static CBC_BarcodeMetadata* getBarcodeMetadata(CBC_DetectionResultRowIndicatorColumn* leftRowIndicatorColumn, CBC_DetectionResultRowIndicatorColumn* rightRowIndicatorColumn);\r
39     static CBC_DetectionResultRowIndicatorColumn* getRowIndicatorColumn(CBC_CommonBitMatrix* image, CBC_BoundingBox* boundingBox, CBC_ResultPoint startPoint,\r
40             FX_BOOL leftToRight, int32_t minCodewordWidth, int32_t maxCodewordWidth);\r
41     static void adjustCodewordCount(CBC_DetectionResult* detectionResult, CFX_PtrArray* barcodeMatrix, int32_t &e);\r
42     static CBC_CommonDecoderResult* createDecoderResult(CBC_DetectionResult* detectionResult, int32_t &e);\r
43     static CBC_CommonDecoderResult* createDecoderResultFromAmbiguousValues(int32_t ecLevel, CFX_Int32Array &codewords, CFX_Int32Array &erasureArray, CFX_Int32Array &ambiguousIndexes,\r
44             CFX_PtrArray& ambiguousIndexValues, int32_t &e);\r
45     static CFX_PtrArray* createBarcodeMatrix(CBC_DetectionResult* detectionResult);\r
46     static FX_BOOL isValidBarcodeColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn);\r
47     static int32_t getStartColumn(CBC_DetectionResult* detectionResult, int32_t barcodeColumn, int32_t imageRow, FX_BOOL leftToRight);\r
48     static CBC_Codeword* detectCodeword(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn,\r
49                                         int32_t imageRow, int32_t minCodewordWidth, int32_t maxCodewordWidth);\r
50     static CFX_Int32Array* getModuleBitCount(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t startColumn, int32_t imageRow);\r
51     static int32_t getNumberOfECCodeWords(int32_t barcodeECLevel);\r
52     static int32_t adjustCodewordStartColumn(CBC_CommonBitMatrix* image, int32_t minColumn, int32_t maxColumn, FX_BOOL leftToRight, int32_t codewordStartColumn, int32_t imageRow);\r
53     static FX_BOOL checkCodewordSkew(int32_t codewordSize, int32_t minCodewordWidth, int32_t maxCodewordWidth);\r
54     static CBC_CommonDecoderResult* decodeCodewords(CFX_Int32Array &codewords, int32_t ecLevel, CFX_Int32Array &erasures, int32_t &e);\r
55     static int32_t correctErrors(CFX_Int32Array &codewords, CFX_Int32Array &erasures, int32_t numECCodewords, int32_t &e);\r
56     static void verifyCodewordCount(CFX_Int32Array &codewords, int32_t numECCodewords, int32_t &e);\r
57     static CFX_Int32Array* getBitCountForCodeword(int32_t codeword);\r
58     static int32_t getCodewordBucketNumber(int32_t codeword);\r
59     static int32_t getCodewordBucketNumber(CFX_Int32Array& moduleBitCount);\r
60 };\r
61 #endif\r