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_QRCODE_BC_QRFINDERPATTERNFINDER_H_ | 7 #ifndef XFA_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ |
8 #define XFA_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ | 8 #define XFA_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
11 | 11 |
12 class CBC_CommonBitMatrix; | 12 class CBC_CommonBitMatrix; |
13 class CBC_QRFinderPattern; | 13 class CBC_QRFinderPattern; |
14 class CBC_ResultPoint; | 14 class CBC_ResultPoint; |
15 class CBC_QRFinderPatternInfo; | 15 class CBC_QRFinderPatternInfo; |
16 | 16 |
17 class CBC_QRFinderPatternFinder { | 17 class CBC_QRFinderPatternFinder { |
18 private: | |
19 static const int32_t CENTER_QUORUM; | |
20 static const int32_t MIN_SKIP; | |
21 static const int32_t MAX_MODULES; | |
22 static const int32_t INTEGER_MATH_SHIFT; | |
23 FX_BOOL m_hasSkipped; | |
24 CBC_CommonBitMatrix* m_image; | |
25 CFX_Int32Array m_crossCheckStateCount; | |
26 CFX_PtrArray m_possibleCenters; | |
27 | |
28 public: | 18 public: |
29 CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image); | 19 CBC_QRFinderPatternFinder(CBC_CommonBitMatrix* image); |
30 virtual ~CBC_QRFinderPatternFinder(); | 20 virtual ~CBC_QRFinderPatternFinder(); |
31 int32_t FindRowSkip(); | 21 int32_t FindRowSkip(); |
32 CBC_CommonBitMatrix* GetImage(); | 22 CBC_CommonBitMatrix* GetImage(); |
33 CBC_QRFinderPatternInfo* Find(int32_t hint, int32_t& e); | 23 CBC_QRFinderPatternInfo* Find(int32_t hint, int32_t& e); |
34 | 24 |
35 CFX_Int32Array& GetCrossCheckStateCount(); | 25 CFX_Int32Array& GetCrossCheckStateCount(); |
36 CFX_PtrArray* GetPossibleCenters(); | 26 CFX_ArrayTemplate<CBC_QRFinderPattern*>* GetPossibleCenters(); |
37 CFX_PtrArray* SelectBestpatterns(int32_t& e); | 27 CFX_ArrayTemplate<CBC_QRFinderPattern*>* SelectBestpatterns(int32_t& e); |
38 | 28 |
39 FX_BOOL HandlePossibleCenter(const CFX_Int32Array& stateCount, | 29 FX_BOOL HandlePossibleCenter(const CFX_Int32Array& stateCount, |
40 int32_t i, | 30 int32_t i, |
41 int32_t j); | 31 int32_t j); |
42 FX_BOOL HaveMultiplyConfirmedCenters(); | 32 FX_BOOL HaveMultiplyConfirmedCenters(); |
43 FX_FLOAT CenterFromEnd(const CFX_Int32Array& stateCount, int32_t end); | 33 FX_FLOAT CenterFromEnd(const CFX_Int32Array& stateCount, int32_t end); |
44 FX_FLOAT CrossCheckVertical(int32_t startI, | 34 FX_FLOAT CrossCheckVertical(int32_t startI, |
45 int32_t centerJ, | 35 int32_t centerJ, |
46 int32_t maxCount, | 36 int32_t maxCount, |
47 int32_t originalStateCountTotal); | 37 int32_t originalStateCountTotal); |
48 FX_FLOAT CrossCheckHorizontal(int32_t startJ, | 38 FX_FLOAT CrossCheckHorizontal(int32_t startJ, |
49 int32_t CenterI, | 39 int32_t CenterI, |
50 int32_t maxCOunt, | 40 int32_t maxCOunt, |
51 int32_t originalStateCountTotal); | 41 int32_t originalStateCountTotal); |
52 static void OrderBestPatterns(CFX_PtrArray* patterns); | 42 static void OrderBestPatterns( |
| 43 CFX_ArrayTemplate<CBC_QRFinderPattern*>* patterns); |
53 static FX_BOOL FoundPatternCross(const CFX_Int32Array& stateCount); | 44 static FX_BOOL FoundPatternCross(const CFX_Int32Array& stateCount); |
54 static FX_FLOAT Distance(CBC_ResultPoint* point1, CBC_ResultPoint* point2); | 45 static FX_FLOAT Distance(CBC_ResultPoint* point1, CBC_ResultPoint* point2); |
| 46 |
| 47 private: |
| 48 static const int32_t CENTER_QUORUM; |
| 49 static const int32_t MIN_SKIP; |
| 50 static const int32_t MAX_MODULES; |
| 51 static const int32_t INTEGER_MATH_SHIFT; |
| 52 |
| 53 FX_BOOL m_hasSkipped; |
| 54 CBC_CommonBitMatrix* m_image; |
| 55 CFX_Int32Array m_crossCheckStateCount; |
| 56 CFX_ArrayTemplate<CBC_QRFinderPattern*> m_possibleCenters; |
55 }; | 57 }; |
56 | 58 |
57 #endif // XFA_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ | 59 #endif // XFA_FXBARCODE_QRCODE_BC_QRFINDERPATTERNFINDER_H_ |
OLD | NEW |