Merge lp:~dpm/qreator/qreator-touch-with-plugin into lp:qreator

Proposed by David Planella
Status: Superseded
Proposed branch: lp:~dpm/qreator/qreator-touch-with-plugin
Merge into: lp:qreator
Diff against target: 27501 lines (+26303/-0) (has conflicts)
228 files modified
.bzrignore (+7/-0)
3rdParty/CMakeLists.txt (+1/-0)
3rdParty/lib.pro (+2/-0)
3rdParty/zxing/BarcodeFormat.cpp (+37/-0)
3rdParty/zxing/BarcodeFormat.h (+44/-0)
3rdParty/zxing/Binarizer.cpp (+37/-0)
3rdParty/zxing/Binarizer.h (+46/-0)
3rdParty/zxing/BinaryBitmap.cpp (+67/-0)
3rdParty/zxing/BinaryBitmap.h (+57/-0)
3rdParty/zxing/CMakeLists.txt (+110/-0)
3rdParty/zxing/DecodeHints.cpp (+120/-0)
3rdParty/zxing/DecodeHints.h (+72/-0)
3rdParty/zxing/Exception.cpp (+40/-0)
3rdParty/zxing/Exception.h (+40/-0)
3rdParty/zxing/FormatException.cpp (+35/-0)
3rdParty/zxing/FormatException.h (+35/-0)
3rdParty/zxing/LuminanceSource.cpp (+80/-0)
3rdParty/zxing/LuminanceSource.h (+52/-0)
3rdParty/zxing/MultiFormatReader.cpp (+106/-0)
3rdParty/zxing/MultiFormatReader.h (+49/-0)
3rdParty/zxing/NotFoundException.cpp (+28/-0)
3rdParty/zxing/NotFoundException.h (+33/-0)
3rdParty/zxing/Reader.cpp (+31/-0)
3rdParty/zxing/Reader.h (+40/-0)
3rdParty/zxing/ReaderException.cpp (+35/-0)
3rdParty/zxing/ReaderException.h (+35/-0)
3rdParty/zxing/Result.cpp (+64/-0)
3rdParty/zxing/Result.h (+54/-0)
3rdParty/zxing/ResultPoint.cpp (+100/-0)
3rdParty/zxing/ResultPoint.h (+54/-0)
3rdParty/zxing/ResultPointCallback.cpp (+26/-0)
3rdParty/zxing/ResultPointCallback.h (+39/-0)
3rdParty/zxing/aztec/AztecDetectorResult.cpp (+45/-0)
3rdParty/zxing/aztec/AztecDetectorResult.h (+42/-0)
3rdParty/zxing/aztec/AztecReader.cpp (+64/-0)
3rdParty/zxing/aztec/AztecReader.h (+49/-0)
3rdParty/zxing/aztec/decoder/AztecDecoder.cpp (+496/-0)
3rdParty/zxing/aztec/decoder/Decoder.h (+63/-0)
3rdParty/zxing/aztec/detector/AztecDetector.cpp (+541/-0)
3rdParty/zxing/aztec/detector/Detector.h (+87/-0)
3rdParty/zxing/common/Array.cpp (+22/-0)
3rdParty/zxing/common/Array.h (+208/-0)
3rdParty/zxing/common/BitArray.cpp (+127/-0)
3rdParty/zxing/common/BitArray.h (+70/-0)
3rdParty/zxing/common/BitMatrix.cpp (+157/-0)
3rdParty/zxing/common/BitMatrix.h (+87/-0)
3rdParty/zxing/common/BitSource.cpp (+74/-0)
3rdParty/zxing/common/BitSource.h (+70/-0)
3rdParty/zxing/common/CharacterSetECI.cpp (+104/-0)
3rdParty/zxing/common/CharacterSetECI.h (+53/-0)
3rdParty/zxing/common/Counted.cpp (+32/-0)
3rdParty/zxing/common/Counted.h (+202/-0)
3rdParty/zxing/common/DecoderResult.cpp (+46/-0)
3rdParty/zxing/common/DecoderResult.h (+51/-0)
3rdParty/zxing/common/DetectorResult.cpp (+38/-0)
3rdParty/zxing/common/DetectorResult.h (+43/-0)
3rdParty/zxing/common/EdgeDetector.cpp (+191/-0)
3rdParty/zxing/common/EdgeDetector.h (+38/-0)
3rdParty/zxing/common/GlobalHistogramBinarizer.cpp (+209/-0)
3rdParty/zxing/common/GlobalHistogramBinarizer.h (+47/-0)
3rdParty/zxing/common/GreyscaleLuminanceSource.cpp (+70/-0)
3rdParty/zxing/common/GreyscaleLuminanceSource.h (+62/-0)
3rdParty/zxing/common/GreyscaleRotatedLuminanceSource.cpp (+65/-0)
3rdParty/zxing/common/GreyscaleRotatedLuminanceSource.h (+60/-0)
3rdParty/zxing/common/GridSampler.cpp (+122/-0)
3rdParty/zxing/common/GridSampler.h (+45/-0)
3rdParty/zxing/common/HybridBinarizer.cpp (+221/-0)
3rdParty/zxing/common/HybridBinarizer.h (+68/-0)
3rdParty/zxing/common/IllegalArgumentException.cpp (+31/-0)
3rdParty/zxing/common/IllegalArgumentException.h (+33/-0)
3rdParty/zxing/common/PerspectiveTransform.cpp (+107/-0)
3rdParty/zxing/common/PerspectiveTransform.h (+49/-0)
3rdParty/zxing/common/Point.h (+47/-0)
3rdParty/zxing/common/Str.cpp (+38/-0)
3rdParty/zxing/common/Str.h (+40/-0)
3rdParty/zxing/common/StringUtils.cpp (+198/-0)
3rdParty/zxing/common/StringUtils.h (+52/-0)
3rdParty/zxing/common/detector/MonochromeRectangleDetector.cpp (+171/-0)
3rdParty/zxing/common/detector/MonochromeRectangleDetector.h (+60/-0)
3rdParty/zxing/common/detector/WhiteRectangleDetector.cpp (+336/-0)
3rdParty/zxing/common/detector/WhiteRectangleDetector.h (+61/-0)
3rdParty/zxing/common/reedsolomon/GenericGF.cpp (+147/-0)
3rdParty/zxing/common/reedsolomon/GenericGF.h (+78/-0)
3rdParty/zxing/common/reedsolomon/GenericGFPoly.cpp (+215/-0)
3rdParty/zxing/common/reedsolomon/GenericGFPoly.h (+54/-0)
3rdParty/zxing/common/reedsolomon/ReedSolomonDecoder.cpp (+199/-0)
3rdParty/zxing/common/reedsolomon/ReedSolomonDecoder.h (+48/-0)
3rdParty/zxing/common/reedsolomon/ReedSolomonException.cpp (+30/-0)
3rdParty/zxing/common/reedsolomon/ReedSolomonException.h (+33/-0)
3rdParty/zxing/datamatrix/DataMatrixReader.cpp (+84/-0)
3rdParty/zxing/datamatrix/DataMatrixReader.h (+45/-0)
3rdParty/zxing/datamatrix/DataMatrixVersion.cpp (+199/-0)
3rdParty/zxing/datamatrix/Version.h (+87/-0)
3rdParty/zxing/datamatrix/decoder/BitMatrixParser.h (+59/-0)
3rdParty/zxing/datamatrix/decoder/DataBlock.h (+49/-0)
3rdParty/zxing/datamatrix/decoder/DataMatrixBitMatrixParser.cpp (+361/-0)
3rdParty/zxing/datamatrix/decoder/DataMatrixDataBlock.cpp (+113/-0)
3rdParty/zxing/datamatrix/decoder/DataMatrixDecodedBitStreamParser.cpp (+417/-0)
3rdParty/zxing/datamatrix/decoder/DataMatrixDecoder.cpp (+94/-0)
3rdParty/zxing/datamatrix/decoder/DecodedBitStreamParser.h (+104/-0)
3rdParty/zxing/datamatrix/decoder/Decoder.h (+49/-0)
3rdParty/zxing/datamatrix/detector/CornerPoint.h (+43/-0)
3rdParty/zxing/datamatrix/detector/DataMatrixCornerPoint.cpp (+46/-0)
3rdParty/zxing/datamatrix/detector/DataMatrixDetector.cpp (+434/-0)
3rdParty/zxing/datamatrix/detector/DataMatrixDetectorException.cpp (+23/-0)
3rdParty/zxing/datamatrix/detector/DataMatrixMonochromeRectangleDetector.cpp (+172/-0)
3rdParty/zxing/datamatrix/detector/Detector.h (+94/-0)
3rdParty/zxing/datamatrix/detector/DetectorException.h (+23/-0)
3rdParty/zxing/datamatrix/detector/MonochromeRectangleDetector.h (+61/-0)
3rdParty/zxing/multi/ByQuadrantReader.cpp (+71/-0)
3rdParty/zxing/multi/ByQuadrantReader.h (+40/-0)
3rdParty/zxing/multi/GenericMultipleBarcodeReader.cpp (+128/-0)
3rdParty/zxing/multi/GenericMultipleBarcodeReader.h (+47/-0)
3rdParty/zxing/multi/MultipleBarcodeReader.cpp (+29/-0)
3rdParty/zxing/multi/MultipleBarcodeReader.h (+39/-0)
3rdParty/zxing/multi/qrcode/QRCodeMultiReader.cpp (+57/-0)
3rdParty/zxing/multi/qrcode/QRCodeMultiReader.h (+34/-0)
3rdParty/zxing/multi/qrcode/detector/MultiDetector.cpp (+46/-0)
3rdParty/zxing/multi/qrcode/detector/MultiDetector.h (+35/-0)
3rdParty/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp (+230/-0)
3rdParty/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h (+45/-0)
3rdParty/zxing/oned/Code128Reader.cpp (+490/-0)
3rdParty/zxing/oned/Code128Reader.h (+60/-0)
3rdParty/zxing/oned/Code39Reader.cpp (+348/-0)
3rdParty/zxing/oned/Code39Reader.h (+58/-0)
3rdParty/zxing/oned/EAN13Reader.cpp (+99/-0)
3rdParty/zxing/oned/EAN13Reader.h (+44/-0)
3rdParty/zxing/oned/EAN8Reader.cpp (+72/-0)
3rdParty/zxing/oned/EAN8Reader.h (+41/-0)
3rdParty/zxing/oned/ITFReader.cpp (+367/-0)
3rdParty/zxing/oned/ITFReader.h (+53/-0)
3rdParty/zxing/oned/MultiFormatOneDReader.cpp (+66/-0)
3rdParty/zxing/oned/MultiFormatOneDReader.h (+38/-0)
3rdParty/zxing/oned/MultiFormatUPCEANReader.cpp (+87/-0)
3rdParty/zxing/oned/MultiFormatUPCEANReader.h (+38/-0)
3rdParty/zxing/oned/OneDReader.cpp (+207/-0)
3rdParty/zxing/oned/OneDReader.h (+50/-0)
3rdParty/zxing/oned/OneDResultPoint.cpp (+28/-0)
3rdParty/zxing/oned/OneDResultPoint.h (+35/-0)
3rdParty/zxing/oned/UPCAReader.cpp (+65/-0)
3rdParty/zxing/oned/UPCAReader.h (+49/-0)
3rdParty/zxing/oned/UPCEANReader.cpp (+311/-0)
3rdParty/zxing/oned/UPCEANReader.h (+75/-0)
3rdParty/zxing/oned/UPCEReader.cpp (+147/-0)
3rdParty/zxing/oned/UPCEReader.h (+44/-0)
3rdParty/zxing/qrcode/ErrorCorrectionLevel.h (+52/-0)
3rdParty/zxing/qrcode/FormatInformation.h (+54/-0)
3rdParty/zxing/qrcode/QRCodeReader.cpp (+86/-0)
3rdParty/zxing/qrcode/QRCodeReader.h (+47/-0)
3rdParty/zxing/qrcode/QRErrorCorrectionLevel.cpp (+65/-0)
3rdParty/zxing/qrcode/QRFormatInformation.cpp (+118/-0)
3rdParty/zxing/qrcode/QRVersion.cpp (+557/-0)
3rdParty/zxing/qrcode/Version.h (+85/-0)
3rdParty/zxing/qrcode/decoder/BitMatrixParser.h (+56/-0)
3rdParty/zxing/qrcode/decoder/DataBlock.h (+50/-0)
3rdParty/zxing/qrcode/decoder/DataMask.h (+50/-0)
3rdParty/zxing/qrcode/decoder/DecodedBitStreamParser.h (+72/-0)
3rdParty/zxing/qrcode/decoder/Decoder.h (+46/-0)
3rdParty/zxing/qrcode/decoder/Mode.h (+58/-0)
3rdParty/zxing/qrcode/decoder/QRBitMatrixParser.cpp (+186/-0)
3rdParty/zxing/qrcode/decoder/QRDataBlock.cpp (+118/-0)
3rdParty/zxing/qrcode/decoder/QRDataMask.cpp (+159/-0)
3rdParty/zxing/qrcode/decoder/QRDecodedBitStreamParser.cpp (+416/-0)
3rdParty/zxing/qrcode/decoder/QRDecoder.cpp (+102/-0)
3rdParty/zxing/qrcode/decoder/QRMode.cpp (+86/-0)
3rdParty/zxing/qrcode/detector/AlignmentPattern.h (+45/-0)
3rdParty/zxing/qrcode/detector/AlignmentPatternFinder.h (+68/-0)
3rdParty/zxing/qrcode/detector/Detector.h (+66/-0)
3rdParty/zxing/qrcode/detector/FinderPattern.h (+47/-0)
3rdParty/zxing/qrcode/detector/FinderPatternFinder.h (+71/-0)
3rdParty/zxing/qrcode/detector/FinderPatternInfo.h (+47/-0)
3rdParty/zxing/qrcode/detector/QRAlignmentPattern.cpp (+51/-0)
3rdParty/zxing/qrcode/detector/QRAlignmentPatternFinder.cpp (+209/-0)
3rdParty/zxing/qrcode/detector/QRDetector.cpp (+298/-0)
3rdParty/zxing/qrcode/detector/QREdgeDetector.cpp (+168/-0)
3rdParty/zxing/qrcode/detector/QREdgeDetector.h (+48/-0)
3rdParty/zxing/qrcode/detector/QRFinderPattern.cpp (+71/-0)
3rdParty/zxing/qrcode/detector/QRFinderPatternFinder.cpp (+541/-0)
3rdParty/zxing/qrcode/detector/QRFinderPatternInfo.cpp (+41/-0)
3rdParty/zxing/zxing.pro (+199/-0)
CMakeLists.txt (+43/-0)
COPYING (+674/-0)
com.ubuntu.developer.dplanella.qreator.desktop (+11/-0)
debian/changelog (+5/-0)
debian/compat (+1/-0)
debian/control (+25/-0)
debian/copyright (+48/-0)
debian/qreator-touch.install (+5/-0)
debian/rules (+20/-0)
debian/source/format (+1/-0)
manifest.json (+15/-0)
qreator.json (+9/-0)
src/CMakeLists.txt (+2/-0)
src/app/CMakeLists.txt (+25/-0)
src/app/app.pro (+29/-0)
src/app/camerahelper.cpp (+65/-0)
src/app/camerahelper.h (+42/-0)
src/app/main.cpp (+64/-0)
src/app/qml/components/Decoder.qml (+83/-0)
src/app/qml/components/DeviceOrientation.qml (+37/-0)
src/app/qml/js/jsqrcode-combined.js (+3748/-0)
src/app/qml/js/qrcode.js (+1814/-0)
src/app/qml/qrcodes/QrCodeText.qml (+36/-0)
src/app/qml/qrcodes/QrCodeUrl.qml (+35/-0)
src/app/qml/qrcodes/QrCodeWifi.qml (+87/-0)
src/app/qml/qreator.qml (+64/-0)
src/app/qml/ui/CreatorPage.qml (+41/-0)
src/app/qml/ui/HistoryPage.qml (+9/-0)
src/app/qml/ui/QrCodeCanvas.qml (+77/-0)
src/app/qml/ui/QrCodeDialog.qml (+48/-0)
src/app/qml/ui/QrCodeToolbar.qml (+38/-0)
src/app/qml/ui/ScannerPage.qml (+200/-0)
src/app/qml/ui/UploadImageDialog.qml (+37/-0)
src/app/qml/ui/qreator-touch (+2/-0)
src/plugin/CMakeLists.txt (+6/-0)
src/plugin/plugin.pro (+2/-0)
src/plugin/qzxing/CMakeLists.txt (+34/-0)
src/plugin/qzxing/CameraImageWrapper.cpp (+146/-0)
src/plugin/qzxing/CameraImageWrapper.h (+47/-0)
src/plugin/qzxing/plugins.qmltypes (+84/-0)
src/plugin/qzxing/qmldir (+3/-0)
src/plugin/qzxing/qzxing.cpp (+124/-0)
src/plugin/qzxing/qzxing.h (+79/-0)
src/plugin/qzxing/qzxing.pro (+51/-0)
src/plugin/qzxing/qzxing_global.h (+12/-0)
src/plugin/qzxing/qzxing_plugin.cpp (+17/-0)
src/plugin/qzxing/qzxing_plugin.h (+21/-0)
src/src.pro (+2/-0)
Conflict adding file .bzrignore.  Moved existing file to .bzrignore.moved.
Conflict adding file COPYING.  Moved existing file to COPYING.moved.
Conflict adding file debian.  Moved existing file to debian.moved.
Conflict adding file po.  Moved existing file to po.moved.
To merge this branch: bzr merge lp:~dpm/qreator/qreator-touch-with-plugin
Reviewer Review Type Date Requested Status
Qreator Hackers Pending
Review via email: mp+219100@code.launchpad.net

This proposal has been superseded by a proposal from 2014-05-10.

Commit message

Initial merge of the QZXing plugin into the app's code.

Description of the change

Initial merge of the QZXing plugin into the app's code, and conversion to CMake. Now the app and the plugin can be built and distributed together in a click package. The .deb packaging will still generate 2 independent packages, but it will probably require some more fixes.

To post a comment you must log in.

Unmerged revisions

45. By David Planella

Fixed tabs/pages navigation

44. By David Planella

Removed old project files no longer needed for the cmake build

43. By David Planella

Initial conversion to CMake

42. By David Planella

Disable automatic orientation for now

41. By David Planella

Some more source tree layout reorg for the QML files

40. By David Planella

Improved video output, it now displays full-screen

39. By David Planella

Temporarily removed cropping on capturing image

38. By David Planella

Slight reorg of QML files

37. By David Planella

Removed hardcoded desktop file name on the script to run on device

36. By David Planella

Reorganized code to include the zxing plugin in the same source tree as the app

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2014-05-10 17:37:18 +0000
4@@ -0,0 +1,7 @@
5+qreator.qmlproject.user
6+qreator-touch.qmlproject.user
7+jsqrcode
8+plugins
9+.excludes
10+qreator.pro.user
11+CMakeLists.txt.user
12
13=== renamed file '.bzrignore' => '.bzrignore.moved'
14=== added directory '3rdParty'
15=== added file '3rdParty/CMakeLists.txt'
16--- 3rdParty/CMakeLists.txt 1970-01-01 00:00:00 +0000
17+++ 3rdParty/CMakeLists.txt 2014-05-10 17:37:18 +0000
18@@ -0,0 +1,1 @@
19+add_subdirectory(zxing)
20
21=== added file '3rdParty/lib.pro'
22--- 3rdParty/lib.pro 1970-01-01 00:00:00 +0000
23+++ 3rdParty/lib.pro 2014-05-10 17:37:18 +0000
24@@ -0,0 +1,2 @@
25+TEMPLATE = subdirs
26+SUBDIRS = zxing
27
28=== added directory '3rdParty/zxing'
29=== added file '3rdParty/zxing/BarcodeFormat.cpp'
30--- 3rdParty/zxing/BarcodeFormat.cpp 1970-01-01 00:00:00 +0000
31+++ 3rdParty/zxing/BarcodeFormat.cpp 2014-05-10 17:37:18 +0000
32@@ -0,0 +1,37 @@
33+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
34+/*
35+ * Created by Christian Brunschen on 13/05/2008.
36+ * Copyright 2008 ZXing authors All rights reserved.
37+ *
38+ * Licensed under the Apache License, Version 2.0 (the "License");
39+ * you may not use this file except in compliance with the License.
40+ * You may obtain a copy of the License at
41+ *
42+ * http://www.apache.org/licenses/LICENSE-2.0
43+ *
44+ * Unless required by applicable law or agreed to in writing, software
45+ * distributed under the License is distributed on an "AS IS" BASIS,
46+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
47+ * See the License for the specific language governing permissions and
48+ * limitations under the License.
49+ */
50+
51+#include <zxing/BarcodeFormat.h>
52+
53+namespace zxing {
54+
55+const char *barcodeFormatNames[] = {
56+ "None",
57+ "QR_CODE",
58+ "DATA_MATRIX",
59+ "UPC_E",
60+ "UPC_A",
61+ "EAN_8",
62+ "EAN_13",
63+ "CODE_128",
64+ "CODE_39",
65+ "ITF",
66+ "AZTEC"
67+};
68+
69+}
70
71=== added file '3rdParty/zxing/BarcodeFormat.h'
72--- 3rdParty/zxing/BarcodeFormat.h 1970-01-01 00:00:00 +0000
73+++ 3rdParty/zxing/BarcodeFormat.h 2014-05-10 17:37:18 +0000
74@@ -0,0 +1,44 @@
75+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
76+#ifndef __BARCODE_FORMAT_H__
77+#define __BARCODE_FORMAT_H__
78+
79+/*
80+ * BarcodeFormat.h
81+ * zxing
82+ *
83+ * Copyright 2010 ZXing authors All rights reserved.
84+ *
85+ * Licensed under the Apache License, Version 2.0 (the "License");
86+ * you may not use this file except in compliance with the License.
87+ * You may obtain a copy of the License at
88+ *
89+ * http://www.apache.org/licenses/LICENSE-2.0
90+ *
91+ * Unless required by applicable law or agreed to in writing, software
92+ * distributed under the License is distributed on an "AS IS" BASIS,
93+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94+ * See the License for the specific language governing permissions and
95+ * limitations under the License.
96+ */
97+
98+namespace zxing {
99+
100+ typedef enum BarcodeFormat {
101+ BarcodeFormat_None = 0,
102+ BarcodeFormat_QR_CODE,
103+ BarcodeFormat_DATA_MATRIX,
104+ BarcodeFormat_UPC_E,
105+ BarcodeFormat_UPC_A,
106+ BarcodeFormat_EAN_8,
107+ BarcodeFormat_EAN_13,
108+ BarcodeFormat_CODE_128,
109+ BarcodeFormat_CODE_39,
110+ BarcodeFormat_ITF,
111+ BarcodeFormat_AZTEC
112+ } BarcodeFormat;
113+
114+ /* if you update the enum, please update the name in BarcodeFormat.cpp */
115+ extern const char *barcodeFormatNames[];
116+}
117+
118+#endif // __BARCODE_FORMAT_H__
119
120=== added file '3rdParty/zxing/Binarizer.cpp'
121--- 3rdParty/zxing/Binarizer.cpp 1970-01-01 00:00:00 +0000
122+++ 3rdParty/zxing/Binarizer.cpp 2014-05-10 17:37:18 +0000
123@@ -0,0 +1,37 @@
124+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
125+/*
126+ * Binarizer.cpp
127+ * zxing
128+ *
129+ * Created by Ralf Kistner on 16/10/2009.
130+ * Copyright 2008 ZXing authors All rights reserved.
131+ * Modified by Lukasz Warchol on 02/02/2010.
132+ *
133+ * Licensed under the Apache License, Version 2.0 (the "License");
134+ * you may not use this file except in compliance with the License.
135+ * You may obtain a copy of the License at
136+ *
137+ * http://www.apache.org/licenses/LICENSE-2.0
138+ *
139+ * Unless required by applicable law or agreed to in writing, software
140+ * distributed under the License is distributed on an "AS IS" BASIS,
141+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
142+ * See the License for the specific language governing permissions and
143+ * limitations under the License.
144+ */
145+
146+#include <zxing/Binarizer.h>
147+
148+namespace zxing {
149+
150+ Binarizer::Binarizer(Ref<LuminanceSource> source) : source_(source) {
151+ }
152+
153+ Binarizer::~Binarizer() {
154+ }
155+
156+ Ref<LuminanceSource> Binarizer::getLuminanceSource() const {
157+ return source_;
158+ }
159+
160+}
161
162=== added file '3rdParty/zxing/Binarizer.h'
163--- 3rdParty/zxing/Binarizer.h 1970-01-01 00:00:00 +0000
164+++ 3rdParty/zxing/Binarizer.h 2014-05-10 17:37:18 +0000
165@@ -0,0 +1,46 @@
166+#ifndef BINARIZER_H_
167+#define BINARIZER_H_
168+
169+/*
170+ * Binarizer.h
171+ * zxing
172+ *
173+ * Copyright 2010 ZXing authors All rights reserved.
174+ *
175+ * Licensed under the Apache License, Version 2.0 (the "License");
176+ * you may not use this file except in compliance with the License.
177+ * You may obtain a copy of the License at
178+ *
179+ * http://www.apache.org/licenses/LICENSE-2.0
180+ *
181+ * Unless required by applicable law or agreed to in writing, software
182+ * distributed under the License is distributed on an "AS IS" BASIS,
183+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184+ * See the License for the specific language governing permissions and
185+ * limitations under the License.
186+ */
187+
188+#include <zxing/LuminanceSource.h>
189+#include <zxing/common/BitArray.h>
190+#include <zxing/common/BitMatrix.h>
191+#include <zxing/common/Counted.h>
192+
193+namespace zxing {
194+
195+class Binarizer : public Counted {
196+ private:
197+ Ref<LuminanceSource> source_;
198+
199+ public:
200+ Binarizer(Ref<LuminanceSource> source);
201+ virtual ~Binarizer();
202+
203+ virtual Ref<BitArray> getBlackRow(int y, Ref<BitArray> row) = 0;
204+ virtual Ref<BitMatrix> getBlackMatrix() = 0;
205+
206+ Ref<LuminanceSource> getLuminanceSource() const ;
207+ virtual Ref<Binarizer> createBinarizer(Ref<LuminanceSource> source) = 0;
208+};
209+
210+}
211+#endif /* BINARIZER_H_ */
212
213=== added file '3rdParty/zxing/BinaryBitmap.cpp'
214--- 3rdParty/zxing/BinaryBitmap.cpp 1970-01-01 00:00:00 +0000
215+++ 3rdParty/zxing/BinaryBitmap.cpp 2014-05-10 17:37:18 +0000
216@@ -0,0 +1,67 @@
217+/*
218+ * BinaryBitmap.cpp
219+ * zxing
220+ *
221+ * Copyright 2010 ZXing authors All rights reserved.
222+ *
223+ * Licensed under the Apache License, Version 2.0 (the "License");
224+ * you may not use this file except in compliance with the License.
225+ * You may obtain a copy of the License at
226+ *
227+ * http://www.apache.org/licenses/LICENSE-2.0
228+ *
229+ * Unless required by applicable law or agreed to in writing, software
230+ * distributed under the License is distributed on an "AS IS" BASIS,
231+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
232+ * See the License for the specific language governing permissions and
233+ * limitations under the License.
234+ */
235+
236+#include <zxing/BinaryBitmap.h>
237+
238+namespace zxing {
239+
240+ BinaryBitmap::BinaryBitmap(Ref<Binarizer> binarizer) : binarizer_(binarizer) {
241+
242+ }
243+
244+ BinaryBitmap::~BinaryBitmap() {
245+ }
246+
247+ Ref<BitArray> BinaryBitmap::getBlackRow(int y, Ref<BitArray> row) {
248+ return binarizer_->getBlackRow(y, row);
249+ }
250+
251+ Ref<BitMatrix> BinaryBitmap::getBlackMatrix() {
252+ return binarizer_->getBlackMatrix();
253+ }
254+
255+ int BinaryBitmap::getWidth() const {
256+ return getLuminanceSource()->getWidth();
257+ }
258+
259+ int BinaryBitmap::getHeight() const {
260+ return getLuminanceSource()->getHeight();
261+ }
262+
263+ Ref<LuminanceSource> BinaryBitmap::getLuminanceSource() const {
264+ return binarizer_->getLuminanceSource();
265+ }
266+
267+
268+ bool BinaryBitmap::isCropSupported() const {
269+ return getLuminanceSource()->isCropSupported();
270+ }
271+
272+ Ref<BinaryBitmap> BinaryBitmap::crop(int left, int top, int width, int height) {
273+ return Ref<BinaryBitmap> (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->crop(left, top, width, height))));
274+ }
275+
276+ bool BinaryBitmap::isRotateSupported() const {
277+ return getLuminanceSource()->isRotateSupported();
278+ }
279+
280+ Ref<BinaryBitmap> BinaryBitmap::rotateCounterClockwise() {
281+ return Ref<BinaryBitmap> (new BinaryBitmap(binarizer_->createBinarizer(getLuminanceSource()->rotateCounterClockwise())));
282+ }
283+}
284
285=== added file '3rdParty/zxing/BinaryBitmap.h'
286--- 3rdParty/zxing/BinaryBitmap.h 1970-01-01 00:00:00 +0000
287+++ 3rdParty/zxing/BinaryBitmap.h 2014-05-10 17:37:18 +0000
288@@ -0,0 +1,57 @@
289+#ifndef __BINARYBITMAP_H__
290+#define __BINARYBITMAP_H__
291+
292+/*
293+ * BinaryBitmap.h
294+ * zxing
295+ *
296+ * Copyright 2010 ZXing authors All rights reserved.
297+ *
298+ * Licensed under the Apache License, Version 2.0 (the "License");
299+ * you may not use this file except in compliance with the License.
300+ * You may obtain a copy of the License at
301+ *
302+ * http://www.apache.org/licenses/LICENSE-2.0
303+ *
304+ * Unless required by applicable law or agreed to in writing, software
305+ * distributed under the License is distributed on an "AS IS" BASIS,
306+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
307+ * See the License for the specific language governing permissions and
308+ * limitations under the License.
309+ */
310+
311+#include <zxing/common/Counted.h>
312+#include <zxing/common/BitMatrix.h>
313+#include <zxing/common/BitArray.h>
314+#include <zxing/Binarizer.h>
315+
316+namespace zxing {
317+
318+ class BinaryBitmap : public Counted {
319+ private:
320+ Ref<Binarizer> binarizer_;
321+ int cached_y_;
322+
323+ public:
324+ BinaryBitmap(Ref<Binarizer> binarizer);
325+ virtual ~BinaryBitmap();
326+
327+ Ref<BitArray> getBlackRow(int y, Ref<BitArray> row);
328+ Ref<BitMatrix> getBlackMatrix();
329+
330+ Ref<LuminanceSource> getLuminanceSource() const;
331+
332+ int getWidth() const;
333+ int getHeight() const;
334+
335+ bool isRotateSupported() const;
336+ Ref<BinaryBitmap> rotateCounterClockwise();
337+
338+ bool isCropSupported() const;
339+ Ref<BinaryBitmap> crop(int left, int top, int width, int height);
340+
341+ };
342+
343+}
344+
345+#endif /* BINARYBITMAP_H_ */
346
347=== added file '3rdParty/zxing/CMakeLists.txt'
348--- 3rdParty/zxing/CMakeLists.txt 1970-01-01 00:00:00 +0000
349+++ 3rdParty/zxing/CMakeLists.txt 2014-05-10 17:37:18 +0000
350@@ -0,0 +1,110 @@
351+include_directories(
352+ ${CMAKE_CURRENT_SOURCE_DIR}/../
353+ /usr/include/qt5/QtCore/
354+ /usr/include/qt5/
355+)
356+
357+#get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
358+
359+add_definitions(
360+ -DNOFMAXL
361+ -DZXING_ICONV_CONST
362+ -DQZXING_LIBRARY
363+ #-DNO_ICONV
364+)
365+
366+#CONFIG += qt staticlib object_parallel_to_source
367+
368+#QMAKE_CXXFLAGS += -std=c++0x -fPIC
369+
370+SET(libzxing_SRCS
371+ ResultPointCallback.cpp
372+ ResultPoint.cpp
373+ Result.cpp
374+ ReaderException.cpp
375+ Reader.cpp
376+ NotFoundException.cpp
377+ MultiFormatReader.cpp
378+ LuminanceSource.cpp
379+ FormatException.cpp
380+ Exception.cpp
381+ DecodeHints.cpp
382+ BinaryBitmap.cpp
383+ Binarizer.cpp
384+ BarcodeFormat.cpp
385+ aztec/AztecReader.cpp
386+ aztec/AztecDetectorResult.cpp
387+ common/StringUtils.cpp
388+ common/Str.cpp
389+ common/PerspectiveTransform.cpp
390+ common/IllegalArgumentException.cpp
391+ common/HybridBinarizer.cpp
392+ common/GridSampler.cpp
393+ common/GreyscaleRotatedLuminanceSource.cpp
394+ common/GreyscaleLuminanceSource.cpp
395+ common/GlobalHistogramBinarizer.cpp
396+ common/EdgeDetector.cpp
397+ common/DetectorResult.cpp
398+ common/DecoderResult.cpp
399+ common/Counted.cpp
400+ common/CharacterSetECI.cpp
401+ common/BitSource.cpp
402+ common/BitMatrix.cpp
403+ common/BitArray.cpp
404+ common/Array.cpp
405+ common/detector/WhiteRectangleDetector.cpp
406+ common/detector/MonochromeRectangleDetector.cpp
407+ common/reedsolomon/ReedSolomonException.cpp
408+ common/reedsolomon/ReedSolomonDecoder.cpp
409+ common/reedsolomon/GenericGFPoly.cpp
410+ common/reedsolomon/GenericGF.cpp
411+ datamatrix/DataMatrixReader.cpp
412+ oned/UPCEReader.cpp
413+ oned/UPCEANReader.cpp
414+ oned/UPCAReader.cpp
415+ oned/OneDResultPoint.cpp
416+ oned/OneDReader.cpp
417+ oned/MultiFormatUPCEANReader.cpp
418+ oned/MultiFormatOneDReader.cpp
419+ oned/ITFReader.cpp
420+ oned/EAN13Reader.cpp
421+ oned/EAN8Reader.cpp
422+ oned/Code128Reader.cpp
423+ oned/Code39Reader.cpp
424+ qrcode/QRCodeReader.cpp
425+ qrcode/detector/QREdgeDetector.cpp
426+ multi/MultipleBarcodeReader.cpp
427+ multi/GenericMultipleBarcodeReader.cpp
428+ multi/ByQuadrantReader.cpp
429+ multi/qrcode/QRCodeMultiReader.cpp
430+ multi/qrcode/detector/MultiFinderPatternFinder.cpp
431+ multi/qrcode/detector/MultiDetector.cpp
432+ aztec/decoder/AztecDecoder.cpp
433+ aztec/detector/AztecDetector.cpp
434+ datamatrix/DataMatrixVersion.cpp
435+ datamatrix/decoder/DataMatrixDecoder.cpp
436+ datamatrix/decoder/DataMatrixBitMatrixParser.cpp
437+ datamatrix/decoder/DataMatrixDataBlock.cpp
438+ datamatrix/decoder/DataMatrixDecodedBitStreamParser.cpp
439+ datamatrix/detector/DataMatrixCornerPoint.cpp
440+ datamatrix/detector/DataMatrixDetector.cpp
441+ datamatrix/detector/DataMatrixDetectorException.cpp
442+ datamatrix/detector/DataMatrixMonochromeRectangleDetector.cpp
443+ qrcode/decoder/QRBitMatrixParser.cpp
444+ qrcode/decoder/QRDataBlock.cpp
445+ qrcode/decoder/QRDataMask.cpp
446+ qrcode/decoder/QRDecodedBitStreamParser.cpp
447+ qrcode/decoder/QRDecoder.cpp
448+ qrcode/decoder/QRMode.cpp
449+ qrcode/detector/QRAlignmentPattern.cpp
450+ qrcode/detector/QRAlignmentPatternFinder.cpp
451+ qrcode/detector/QRDetector.cpp
452+ qrcode/detector/QRFinderPattern.cpp
453+ qrcode/detector/QRFinderPatternFinder.cpp
454+ qrcode/detector/QRFinderPatternInfo.cpp
455+ qrcode/QRVersion.cpp
456+ qrcode/QRFormatInformation.cpp
457+ qrcode/QRErrorCorrectionLevel.cpp
458+)
459+
460+add_library(libzxing ${libzxing_SRCS})
461
462=== added file '3rdParty/zxing/DecodeHints.cpp'
463--- 3rdParty/zxing/DecodeHints.cpp 1970-01-01 00:00:00 +0000
464+++ 3rdParty/zxing/DecodeHints.cpp 2014-05-10 17:37:18 +0000
465@@ -0,0 +1,120 @@
466+/*
467+ * DecodeHintType.cpp
468+ * zxing
469+ *
470+ * Copyright 2010 ZXing authors All rights reserved.
471+ *
472+ * Licensed under the Apache License, Version 2.0 (the "License");
473+ * you may not use this file except in compliance with the License.
474+ * You may obtain a copy of the License at
475+ *
476+ * http://www.apache.org/licenses/LICENSE-2.0
477+ *
478+ * Unless required by applicable law or agreed to in writing, software
479+ * distributed under the License is distributed on an "AS IS" BASIS,
480+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
481+ * See the License for the specific language governing permissions and
482+ * limitations under the License.
483+ */
484+
485+#include <zxing/DecodeHints.h>
486+#include <zxing/common/IllegalArgumentException.h>
487+namespace zxing {
488+
489+const DecodeHintType DecodeHints::CHARACTER_SET;
490+
491+const DecodeHints DecodeHints::PRODUCT_HINT(
492+ BARCODEFORMAT_UPC_E_HINT |
493+ BARCODEFORMAT_UPC_A_HINT |
494+ BARCODEFORMAT_EAN_8_HINT |
495+ BARCODEFORMAT_EAN_13_HINT);
496+
497+const DecodeHints DecodeHints::ONED_HINT(
498+ BARCODEFORMAT_UPC_E_HINT |
499+ BARCODEFORMAT_UPC_A_HINT |
500+ BARCODEFORMAT_EAN_8_HINT |
501+ BARCODEFORMAT_EAN_13_HINT |
502+ BARCODEFORMAT_CODE_128_HINT |
503+ BARCODEFORMAT_CODE_39_HINT |
504+ BARCODEFORMAT_ITF_HINT);
505+
506+const DecodeHints DecodeHints::DEFAULT_HINT(
507+ BARCODEFORMAT_UPC_E_HINT |
508+ BARCODEFORMAT_UPC_A_HINT |
509+ BARCODEFORMAT_EAN_8_HINT |
510+ BARCODEFORMAT_EAN_13_HINT |
511+ BARCODEFORMAT_CODE_128_HINT |
512+ BARCODEFORMAT_CODE_39_HINT |
513+ BARCODEFORMAT_ITF_HINT |
514+ BARCODEFORMAT_DATA_MATRIX_HINT |
515+ BARCODEFORMAT_AZTEC_HINT |
516+ BARCODEFORMAT_QR_CODE_HINT);
517+
518+DecodeHints::DecodeHints() {
519+ hints = 0;
520+}
521+
522+DecodeHints::DecodeHints(DecodeHintType init) {
523+ hints = init;
524+}
525+
526+void DecodeHints::addFormat(BarcodeFormat toadd) {
527+ switch (toadd) {
528+ case BarcodeFormat_AZTEC: hints |= BARCODEFORMAT_AZTEC_HINT; break;
529+ case BarcodeFormat_QR_CODE: hints |= BARCODEFORMAT_QR_CODE_HINT; break;
530+ case BarcodeFormat_DATA_MATRIX: hints |= BARCODEFORMAT_DATA_MATRIX_HINT; break;
531+ case BarcodeFormat_UPC_E: hints |= BARCODEFORMAT_UPC_E_HINT; break;
532+ case BarcodeFormat_UPC_A: hints |= BARCODEFORMAT_UPC_A_HINT; break;
533+ case BarcodeFormat_EAN_8: hints |= BARCODEFORMAT_EAN_8_HINT; break;
534+ case BarcodeFormat_EAN_13: hints |= BARCODEFORMAT_EAN_13_HINT; break;
535+ case BarcodeFormat_CODE_128: hints |= BARCODEFORMAT_CODE_128_HINT; break;
536+ case BarcodeFormat_CODE_39: hints |= BARCODEFORMAT_CODE_39_HINT; break;
537+ case BarcodeFormat_ITF: hints |= BARCODEFORMAT_ITF_HINT; break;
538+ default: throw IllegalArgumentException("Unrecognizd barcode format");
539+ }
540+}
541+
542+bool DecodeHints::containsFormat(BarcodeFormat tocheck) const {
543+ DecodeHintType checkAgainst;
544+ switch (tocheck) {
545+ case BarcodeFormat_AZTEC: checkAgainst = BARCODEFORMAT_AZTEC_HINT; break;
546+ case BarcodeFormat_QR_CODE: checkAgainst = BARCODEFORMAT_QR_CODE_HINT; break;
547+ case BarcodeFormat_DATA_MATRIX: checkAgainst = BARCODEFORMAT_DATA_MATRIX_HINT; break;
548+ case BarcodeFormat_UPC_E: checkAgainst = BARCODEFORMAT_UPC_E_HINT; break;
549+ case BarcodeFormat_UPC_A: checkAgainst = BARCODEFORMAT_UPC_A_HINT; break;
550+ case BarcodeFormat_EAN_8: checkAgainst = BARCODEFORMAT_EAN_8_HINT; break;
551+ case BarcodeFormat_EAN_13: checkAgainst = BARCODEFORMAT_EAN_13_HINT; break;
552+ case BarcodeFormat_CODE_128: checkAgainst = BARCODEFORMAT_CODE_128_HINT; break;
553+ case BarcodeFormat_CODE_39: checkAgainst = BARCODEFORMAT_CODE_39_HINT; break;
554+ case BarcodeFormat_ITF: checkAgainst = BARCODEFORMAT_ITF_HINT; break;
555+ default: throw IllegalArgumentException("Unrecognizd barcode format");
556+ }
557+ return (hints & checkAgainst);
558+}
559+
560+void DecodeHints::setTryHarder(bool toset) {
561+ if (toset) {
562+ hints |= TRYHARDER_HINT;
563+ } else {
564+ hints &= ~TRYHARDER_HINT;
565+ }
566+}
567+
568+bool DecodeHints::getTryHarder() const {
569+ return (hints & TRYHARDER_HINT);
570+}
571+
572+void DecodeHints::setResultPointCallback(Ref<ResultPointCallback> const& _callback) {
573+ callback = _callback;
574+}
575+
576+Ref<ResultPointCallback> DecodeHints::getResultPointCallback() const {
577+ return callback;
578+}
579+
580+DecodeHintType DecodeHints::getCurrentHint()
581+{
582+ return hints;
583+}
584+
585+} /* namespace */
586
587=== added file '3rdParty/zxing/DecodeHints.h'
588--- 3rdParty/zxing/DecodeHints.h 1970-01-01 00:00:00 +0000
589+++ 3rdParty/zxing/DecodeHints.h 2014-05-10 17:37:18 +0000
590@@ -0,0 +1,72 @@
591+#ifndef __DECODEHINTS_H_
592+#define __DECODEHINTS_H_
593+/*
594+ * DecodeHintType.h
595+ * zxing
596+ *
597+ * Copyright 2010 ZXing authors All rights reserved.
598+ *
599+ * Licensed under the Apache License, Version 2.0 (the "License");
600+ * you may not use this file except in compliance with the License.
601+ * You may obtain a copy of the License at
602+ *
603+ * http://www.apache.org/licenses/LICENSE-2.0
604+ *
605+ * Unless required by applicable law or agreed to in writing, software
606+ * distributed under the License is distributed on an "AS IS" BASIS,
607+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
608+ * See the License for the specific language governing permissions and
609+ * limitations under the License.
610+ */
611+
612+#include <zxing/BarcodeFormat.h>
613+#include <zxing/ResultPointCallback.h>
614+
615+namespace zxing {
616+
617+typedef unsigned int DecodeHintType;
618+
619+class DecodeHints {
620+
621+ private:
622+
623+ DecodeHintType hints;
624+
625+ Ref<ResultPointCallback> callback;
626+
627+ public:
628+
629+ static const DecodeHintType BARCODEFORMAT_QR_CODE_HINT = 1 << BarcodeFormat_QR_CODE;
630+ static const DecodeHintType BARCODEFORMAT_DATA_MATRIX_HINT = 1 << BarcodeFormat_DATA_MATRIX;
631+ static const DecodeHintType BARCODEFORMAT_UPC_E_HINT = 1 << BarcodeFormat_UPC_E;
632+ static const DecodeHintType BARCODEFORMAT_UPC_A_HINT = 1 << BarcodeFormat_UPC_A;
633+ static const DecodeHintType BARCODEFORMAT_EAN_8_HINT = 1 << BarcodeFormat_EAN_8;
634+ static const DecodeHintType BARCODEFORMAT_EAN_13_HINT = 1 << BarcodeFormat_EAN_13;
635+ static const DecodeHintType BARCODEFORMAT_CODE_128_HINT = 1 << BarcodeFormat_CODE_128;
636+ static const DecodeHintType BARCODEFORMAT_CODE_39_HINT = 1 << BarcodeFormat_CODE_39;
637+ static const DecodeHintType BARCODEFORMAT_ITF_HINT = 1 << BarcodeFormat_ITF;
638+ static const DecodeHintType BARCODEFORMAT_AZTEC_HINT = 1 << BarcodeFormat_AZTEC;
639+ static const DecodeHintType CHARACTER_SET = 1 << 30;
640+ static const DecodeHintType TRYHARDER_HINT = 1 << 31;
641+
642+ static const DecodeHints PRODUCT_HINT;
643+ static const DecodeHints ONED_HINT;
644+ static const DecodeHints DEFAULT_HINT;
645+
646+ DecodeHints();
647+ DecodeHints(DecodeHintType init);
648+
649+ void addFormat(BarcodeFormat toadd);
650+ bool containsFormat(BarcodeFormat tocheck) const;
651+ void setTryHarder(bool toset);
652+ bool getTryHarder() const;
653+
654+ void setResultPointCallback(Ref<ResultPointCallback> const&);
655+ Ref<ResultPointCallback> getResultPointCallback() const;
656+
657+ DecodeHintType getCurrentHint();
658+};
659+
660+}
661+
662+#endif
663
664=== added file '3rdParty/zxing/Exception.cpp'
665--- 3rdParty/zxing/Exception.cpp 1970-01-01 00:00:00 +0000
666+++ 3rdParty/zxing/Exception.cpp 2014-05-10 17:37:18 +0000
667@@ -0,0 +1,40 @@
668+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
669+/*
670+ * Exception.cpp
671+ * ZXing
672+ *
673+ * Created by Christian Brunschen on 03/06/2008.
674+ * Copyright 2008-2011 ZXing authors All rights reserved.
675+ *
676+ * Licensed under the Apache License, Version 2.0 (the "License");
677+ * you may not use this file except in compliance with the License.
678+ * You may obtain a copy of the License at
679+ *
680+ * http://www.apache.org/licenses/LICENSE-2.0
681+ *
682+ * Unless required by applicable law or agreed to in writing, software
683+ * distributed under the License is distributed on an "AS IS" BASIS,
684+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
685+ * See the License for the specific language governing permissions and
686+ * limitations under the License.
687+
688+ */
689+
690+#include <zxing/Exception.h>
691+
692+namespace zxing {
693+
694+Exception::Exception() {}
695+
696+Exception::Exception(const char *msg) :
697+ message(msg) {
698+}
699+
700+const char* Exception::what() const throw() {
701+ return message.c_str();
702+}
703+
704+Exception::~Exception() throw() {
705+}
706+
707+}
708
709=== added file '3rdParty/zxing/Exception.h'
710--- 3rdParty/zxing/Exception.h 1970-01-01 00:00:00 +0000
711+++ 3rdParty/zxing/Exception.h 2014-05-10 17:37:18 +0000
712@@ -0,0 +1,40 @@
713+#ifndef __EXCEPTION_H__
714+#define __EXCEPTION_H__
715+
716+/*
717+ * Exception.h
718+ * ZXing
719+ *
720+ * Copyright 2010 ZXing authors All rights reserved.
721+ *
722+ * Licensed under the Apache License, Version 2.0 (the "License");
723+ * you may not use this file except in compliance with the License.
724+ * You may obtain a copy of the License at
725+ *
726+ * http://www.apache.org/licenses/LICENSE-2.0
727+ *
728+ * Unless required by applicable law or agreed to in writing, software
729+ * distributed under the License is distributed on an "AS IS" BASIS,
730+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
731+ * See the License for the specific language governing permissions and
732+ * limitations under the License.
733+ */
734+
735+#include <string>
736+#include <exception>
737+
738+namespace zxing {
739+
740+class Exception : public std::exception {
741+private:
742+ std::string message;
743+
744+public:
745+ Exception();
746+ Exception(const char *msg);
747+ virtual const char* what() const throw();
748+ virtual ~Exception() throw();
749+};
750+
751+}
752+#endif // __EXCEPTION_H__
753
754=== added file '3rdParty/zxing/FormatException.cpp'
755--- 3rdParty/zxing/FormatException.cpp 1970-01-01 00:00:00 +0000
756+++ 3rdParty/zxing/FormatException.cpp 2014-05-10 17:37:18 +0000
757@@ -0,0 +1,35 @@
758+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
759+/*
760+ * FormatException.cpp
761+ * zxing
762+ *
763+ * Created by Christian Brunschen on 13/05/2008.
764+ * Copyright 2008 ZXing authors All rights reserved.
765+ *
766+ * Licensed under the Apache License, Version 2.0 (the "License");
767+ * you may not use this file except in compliance with the License.
768+ * You may obtain a copy of the License at
769+ *
770+ * http://www.apache.org/licenses/LICENSE-2.0
771+ *
772+ * Unless required by applicable law or agreed to in writing, software
773+ * distributed under the License is distributed on an "AS IS" BASIS,
774+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
775+ * See the License for the specific language governing permissions and
776+ * limitations under the License.
777+ */
778+
779+#include <zxing/FormatException.h>
780+
781+namespace zxing {
782+
783+FormatException::FormatException() {}
784+
785+FormatException::FormatException(const char *msg) :
786+ ReaderException(msg) {
787+}
788+
789+FormatException::~FormatException() throw() {
790+}
791+
792+}
793
794=== added file '3rdParty/zxing/FormatException.h'
795--- 3rdParty/zxing/FormatException.h 1970-01-01 00:00:00 +0000
796+++ 3rdParty/zxing/FormatException.h 2014-05-10 17:37:18 +0000
797@@ -0,0 +1,35 @@
798+#ifndef __FORMAT_EXCEPTION_H__
799+#define __FORMAT_EXCEPTION_H__
800+
801+/*
802+ * FormatException.h
803+ * zxing
804+ *
805+ * Copyright 2010 ZXing authors All rights reserved.
806+ *
807+ * Licensed under the Apache License, Version 2.0 (the "License");
808+ * you may not use this file except in compliance with the License.
809+ * You may obtain a copy of the License at
810+ *
811+ * http://www.apache.org/licenses/LICENSE-2.0
812+ *
813+ * Unless required by applicable law or agreed to in writing, software
814+ * distributed under the License is distributed on an "AS IS" BASIS,
815+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
816+ * See the License for the specific language governing permissions and
817+ * limitations under the License.
818+ */
819+
820+#include <zxing/ReaderException.h>
821+
822+namespace zxing {
823+
824+class FormatException : public ReaderException {
825+public:
826+ FormatException();
827+ FormatException(const char *msg);
828+ ~FormatException() throw();
829+};
830+
831+}
832+#endif // __FORMAT_EXCEPTION_H__
833
834=== added file '3rdParty/zxing/LuminanceSource.cpp'
835--- 3rdParty/zxing/LuminanceSource.cpp 1970-01-01 00:00:00 +0000
836+++ 3rdParty/zxing/LuminanceSource.cpp 2014-05-10 17:37:18 +0000
837@@ -0,0 +1,80 @@
838+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
839+/*
840+ * LuminanceSource.cpp
841+ * zxing
842+ *
843+ * Copyright 2008 ZXing authors All rights reserved.
844+ *
845+ * Licensed under the Apache License, Version 2.0 (the "License");
846+ * you may not use this file except in compliance with the License.
847+ * You may obtain a copy of the License at
848+ *
849+ * http://www.apache.org/licenses/LICENSE-2.0
850+ *
851+ * Unless required by applicable law or agreed to in writing, software
852+ * distributed under the License is distributed on an "AS IS" BASIS,
853+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
854+ * See the License for the specific language governing permissions and
855+ * limitations under the License.
856+ */
857+
858+#include <sstream>
859+#include <zxing/LuminanceSource.h>
860+#include <zxing/common/IllegalArgumentException.h>
861+
862+namespace zxing {
863+
864+LuminanceSource::LuminanceSource() {
865+}
866+
867+LuminanceSource::~LuminanceSource() {
868+}
869+
870+bool LuminanceSource::isCropSupported() const {
871+ return false;
872+}
873+
874+Ref<LuminanceSource> LuminanceSource::crop(int left, int top, int width, int height) {
875+ (void)left;
876+ (void)top;
877+ (void)width;
878+ (void)height;
879+ throw IllegalArgumentException("This luminance source does not support cropping.");
880+}
881+
882+bool LuminanceSource::isRotateSupported() const {
883+ return false;
884+}
885+
886+Ref<LuminanceSource> LuminanceSource::rotateCounterClockwise() {
887+ throw IllegalArgumentException("This luminance source does not support rotation.");
888+}
889+
890+LuminanceSource::operator std::string() {
891+ unsigned char* row = 0;
892+ std::ostringstream oss;
893+ for (int y = 0; y < getHeight(); y++) {
894+ row = getRow(y, row);
895+ for (int x = 0; x < getWidth(); x++) {
896+ int luminance = row[x] & 0xFF;
897+ char c;
898+ if (luminance < 0x40) {
899+ c = '#';
900+ } else if (luminance < 0x80) {
901+ c = '+';
902+ } else if (luminance < 0xC0) {
903+ c = '.';
904+ } else {
905+ c = ' ';
906+ }
907+ oss << c;
908+ }
909+ oss << '\n';
910+ }
911+ delete [] row;
912+ return oss.str();
913+}
914+
915+
916+
917+}
918
919=== added file '3rdParty/zxing/LuminanceSource.h'
920--- 3rdParty/zxing/LuminanceSource.h 1970-01-01 00:00:00 +0000
921+++ 3rdParty/zxing/LuminanceSource.h 2014-05-10 17:37:18 +0000
922@@ -0,0 +1,52 @@
923+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
924+#ifndef __LUMINANCESOURCE_H__
925+#define __LUMINANCESOURCE_H__
926+/*
927+ * LuminanceSource.h
928+ * zxing
929+ *
930+ * Copyright 2010 ZXing authors All rights reserved.
931+ *
932+ * Licensed under the Apache License, Version 2.0 (the "License");
933+ * you may not use this file except in compliance with the License.
934+ * You may obtain a copy of the License at
935+ *
936+ * http://www.apache.org/licenses/LICENSE-2.0
937+ *
938+ * Unless required by applicable law or agreed to in writing, software
939+ * distributed under the License is distributed on an "AS IS" BASIS,
940+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
941+ * See the License for the specific language governing permissions and
942+ * limitations under the License.
943+ */
944+
945+#include <zxing/common/Counted.h>
946+#include <string.h>
947+
948+namespace zxing {
949+
950+class LuminanceSource : public Counted {
951+public:
952+ LuminanceSource();
953+ virtual ~LuminanceSource();
954+
955+ virtual int getWidth() const = 0;
956+ virtual int getHeight() const = 0;
957+
958+ // Callers take ownership of the returned memory and must call delete [] on it themselves.
959+ virtual unsigned char* getRow(int y, unsigned char* row) = 0;
960+ virtual unsigned char* getMatrix() = 0;
961+
962+ virtual bool isCropSupported() const;
963+ virtual Ref<LuminanceSource> crop(int left, int top, int width, int height);
964+
965+ virtual bool isRotateSupported() const;
966+ virtual Ref<LuminanceSource> rotateCounterClockwise();
967+
968+ operator std::string (); // should be const but don't want to make sure a
969+ // large breaking change right now
970+};
971+
972+}
973+
974+#endif /* LUMINANCESOURCE_H_ */
975
976=== added file '3rdParty/zxing/MultiFormatReader.cpp'
977--- 3rdParty/zxing/MultiFormatReader.cpp 1970-01-01 00:00:00 +0000
978+++ 3rdParty/zxing/MultiFormatReader.cpp 2014-05-10 17:37:18 +0000
979@@ -0,0 +1,106 @@
980+/*
981+ * MultiFormatBarcodeReader.cpp
982+ * ZXing
983+ *
984+ * Created by Lukasz Warchol on 10-01-26.
985+ * Modified by Luiz Silva on 09/02/2010.
986+ * Copyright 2010 ZXing authors All rights reserved.
987+ *
988+ * Licensed under the Apache License, Version 2.0 (the "License");
989+ * you may not use this file except in compliance with the License.
990+ * You may obtain a copy of the License at
991+ *
992+ * http://www.apache.org/licenses/LICENSE-2.0
993+ *
994+ * Unless required by applicable law or agreed to in writing, software
995+ * distributed under the License is distributed on an "AS IS" BASIS,
996+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
997+ * See the License for the specific language governing permissions and
998+ * limitations under the License.
999+ */
1000+
1001+#include <zxing/MultiFormatReader.h>
1002+#include <zxing/qrcode/QRCodeReader.h>
1003+#include <zxing/datamatrix/DataMatrixReader.h>
1004+#include <zxing/aztec/AztecReader.h>
1005+#include <zxing/oned/MultiFormatUPCEANReader.h>
1006+#include <zxing/oned/MultiFormatOneDReader.h>
1007+#include <zxing/ReaderException.h>
1008+
1009+namespace zxing {
1010+ MultiFormatReader::MultiFormatReader() {
1011+
1012+ }
1013+
1014+ Ref<Result> MultiFormatReader::decode(Ref<BinaryBitmap> image) {
1015+ setHints(DecodeHints::DEFAULT_HINT);
1016+ return decodeInternal(image);
1017+ }
1018+
1019+ Ref<Result> MultiFormatReader::decode(Ref<BinaryBitmap> image, DecodeHints hints) {
1020+ setHints(hints);
1021+ return decodeInternal(image);
1022+ }
1023+
1024+ Ref<Result> MultiFormatReader::decodeWithState(Ref<BinaryBitmap> image) {
1025+ // Make sure to set up the default state so we don't crash
1026+ if (readers_.size() == 0) {
1027+ setHints(DecodeHints::DEFAULT_HINT);
1028+ }
1029+ return decodeInternal(image);
1030+ }
1031+
1032+ void MultiFormatReader::setHints(DecodeHints hints) {
1033+ hints_ = hints;
1034+ readers_.clear();
1035+ bool tryHarder = hints.getTryHarder();
1036+
1037+ bool addOneDReader = hints.containsFormat(BarcodeFormat_UPC_E) ||
1038+ hints.containsFormat(BarcodeFormat_UPC_A) ||
1039+ hints.containsFormat(BarcodeFormat_EAN_8) ||
1040+ hints.containsFormat(BarcodeFormat_EAN_13) ||
1041+ hints.containsFormat(BarcodeFormat_CODE_128) ||
1042+ hints.containsFormat(BarcodeFormat_CODE_39) ||
1043+ hints.containsFormat(BarcodeFormat_ITF);
1044+ if (addOneDReader && !tryHarder) {
1045+ readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints)));
1046+ }
1047+ if (hints.containsFormat(BarcodeFormat_QR_CODE)) {
1048+ readers_.push_back(Ref<Reader>(new zxing::qrcode::QRCodeReader()));
1049+ }
1050+ if (hints.containsFormat(BarcodeFormat_DATA_MATRIX)) {
1051+ readers_.push_back(Ref<Reader>(new zxing::datamatrix::DataMatrixReader()));
1052+ }
1053+ if (hints.containsFormat(BarcodeFormat_AZTEC)) {
1054+ readers_.push_back(Ref<Reader>(new zxing::aztec::AztecReader()));
1055+ }
1056+ //TODO: add PDF417 here once PDF417 reader is implemented
1057+ if (addOneDReader && tryHarder) {
1058+ readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints)));
1059+ }
1060+ if (readers_.size() == 0) {
1061+ if (!tryHarder) {
1062+ readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints)));
1063+ }
1064+ readers_.push_back(Ref<Reader>(new zxing::qrcode::QRCodeReader()));
1065+ if (tryHarder) {
1066+ readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints)));
1067+ }
1068+ }
1069+ }
1070+
1071+ Ref<Result> MultiFormatReader::decodeInternal(Ref<BinaryBitmap> image) {
1072+ for (unsigned int i = 0; i < readers_.size(); i++) {
1073+ try {
1074+ return readers_[i]->decode(image, hints_);
1075+ } catch (ReaderException const& re) {
1076+ // continue
1077+ }
1078+ }
1079+ throw ReaderException("No code detected");
1080+ }
1081+
1082+ MultiFormatReader::~MultiFormatReader() {
1083+
1084+ }
1085+}
1086
1087=== added file '3rdParty/zxing/MultiFormatReader.h'
1088--- 3rdParty/zxing/MultiFormatReader.h 1970-01-01 00:00:00 +0000
1089+++ 3rdParty/zxing/MultiFormatReader.h 2014-05-10 17:37:18 +0000
1090@@ -0,0 +1,49 @@
1091+#ifndef __MULTI_FORMAT_READER_H__
1092+#define __MULTI_FORMAT_READER_H__
1093+
1094+/*
1095+ * MultiFormatBarcodeReader.h
1096+ * ZXing
1097+ *
1098+ * Copyright 2010 ZXing authors All rights reserved.
1099+ *
1100+ * Licensed under the Apache License, Version 2.0 (the "License");
1101+ * you may not use this file except in compliance with the License.
1102+ * You may obtain a copy of the License at
1103+ *
1104+ * http://www.apache.org/licenses/LICENSE-2.0
1105+ *
1106+ * Unless required by applicable law or agreed to in writing, software
1107+ * distributed under the License is distributed on an "AS IS" BASIS,
1108+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1109+ * See the License for the specific language governing permissions and
1110+ * limitations under the License.
1111+ */
1112+
1113+
1114+#include <zxing/Reader.h>
1115+#include <zxing/common/BitArray.h>
1116+#include <zxing/Result.h>
1117+#include <zxing/DecodeHints.h>
1118+
1119+namespace zxing {
1120+ class MultiFormatReader : public Reader {
1121+
1122+ private:
1123+ Ref<Result> decodeInternal(Ref<BinaryBitmap> image);
1124+
1125+ std::vector<Ref<Reader> > readers_;
1126+ DecodeHints hints_;
1127+
1128+ public:
1129+ MultiFormatReader();
1130+
1131+ Ref<Result> decode(Ref<BinaryBitmap> image);
1132+ Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
1133+ Ref<Result> decodeWithState(Ref<BinaryBitmap> image);
1134+ void setHints(DecodeHints hints);
1135+ ~MultiFormatReader();
1136+ };
1137+}
1138+
1139+#endif
1140
1141=== added file '3rdParty/zxing/NotFoundException.cpp'
1142--- 3rdParty/zxing/NotFoundException.cpp 1970-01-01 00:00:00 +0000
1143+++ 3rdParty/zxing/NotFoundException.cpp 2014-05-10 17:37:18 +0000
1144@@ -0,0 +1,28 @@
1145+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1146+/*
1147+ * Copyright 20011 ZXing authors
1148+ *
1149+ * Licensed under the Apache License, Version 2.0 (the "License");
1150+ * you may not use this file except in compliance with the License.
1151+ * You may obtain a copy of the License at
1152+ *
1153+ * http://www.apache.org/licenses/LICENSE-2.0
1154+ *
1155+ * Unless required by applicable law or agreed to in writing, software
1156+ * distributed under the License is distributed on an "AS IS" BASIS,
1157+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1158+ * See the License for the specific language governing permissions and
1159+ * limitations under the License.
1160+ */
1161+
1162+#include <zxing/NotFoundException.h>
1163+
1164+namespace zxing {
1165+
1166+ NotFoundException::NotFoundException(const char *msg)
1167+ : ReaderException(msg) {}
1168+
1169+ NotFoundException::~NotFoundException() throw() {
1170+ }
1171+
1172+}
1173
1174=== added file '3rdParty/zxing/NotFoundException.h'
1175--- 3rdParty/zxing/NotFoundException.h 1970-01-01 00:00:00 +0000
1176+++ 3rdParty/zxing/NotFoundException.h 2014-05-10 17:37:18 +0000
1177@@ -0,0 +1,33 @@
1178+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1179+
1180+#ifndef __NOT_FOUND_EXCEPTION_H__
1181+#define __NOT_FOUND_EXCEPTION_H__
1182+
1183+/*
1184+ * Copyright 20011 ZXing authors
1185+ *
1186+ * Licensed under the Apache License, Version 2.0 (the "License");
1187+ * you may not use this file except in compliance with the License.
1188+ * You may obtain a copy of the License at
1189+ *
1190+ * http://www.apache.org/licenses/LICENSE-2.0
1191+ *
1192+ * Unless required by applicable law or agreed to in writing, software
1193+ * distributed under the License is distributed on an "AS IS" BASIS,
1194+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1195+ * See the License for the specific language governing permissions and
1196+ * limitations under the License.
1197+ */
1198+
1199+#include <zxing/ReaderException.h>
1200+
1201+namespace zxing {
1202+
1203+ class NotFoundException : public ReaderException {
1204+ public:
1205+ NotFoundException(const char *msg);
1206+ ~NotFoundException() throw();
1207+ };
1208+
1209+}
1210+#endif // __NOT_FOUND_EXCEPTION_H__
1211
1212=== added file '3rdParty/zxing/Reader.cpp'
1213--- 3rdParty/zxing/Reader.cpp 1970-01-01 00:00:00 +0000
1214+++ 3rdParty/zxing/Reader.cpp 2014-05-10 17:37:18 +0000
1215@@ -0,0 +1,31 @@
1216+/*
1217+ * Reader.cpp
1218+ * zxing
1219+ *
1220+ * Created by Christian Brunschen on 13/05/2008.
1221+ * Copyright 2008 ZXing authors All rights reserved.
1222+ *
1223+ * Licensed under the Apache License, Version 2.0 (the "License");
1224+ * you may not use this file except in compliance with the License.
1225+ * You may obtain a copy of the License at
1226+ *
1227+ * http://www.apache.org/licenses/LICENSE-2.0
1228+ *
1229+ * Unless required by applicable law or agreed to in writing, software
1230+ * distributed under the License is distributed on an "AS IS" BASIS,
1231+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1232+ * See the License for the specific language governing permissions and
1233+ * limitations under the License.
1234+ */
1235+
1236+#include <zxing/Reader.h>
1237+
1238+namespace zxing {
1239+
1240+Reader::~Reader() { }
1241+
1242+Ref<Result> Reader::decode(Ref<BinaryBitmap> image) {
1243+ return decode(image, DecodeHints::DEFAULT_HINT);
1244+}
1245+
1246+}
1247
1248=== added file '3rdParty/zxing/Reader.h'
1249--- 3rdParty/zxing/Reader.h 1970-01-01 00:00:00 +0000
1250+++ 3rdParty/zxing/Reader.h 2014-05-10 17:37:18 +0000
1251@@ -0,0 +1,40 @@
1252+#ifndef __READER_H__
1253+#define __READER_H__
1254+
1255+/*
1256+ * Reader.h
1257+ * zxing
1258+ *
1259+ * Copyright 2010 ZXing authors All rights reserved.
1260+ *
1261+ * Licensed under the Apache License, Version 2.0 (the "License");
1262+ * you may not use this file except in compliance with the License.
1263+ * You may obtain a copy of the License at
1264+ *
1265+ * http://www.apache.org/licenses/LICENSE-2.0
1266+ *
1267+ * Unless required by applicable law or agreed to in writing, software
1268+ * distributed under the License is distributed on an "AS IS" BASIS,
1269+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1270+ * See the License for the specific language governing permissions and
1271+ * limitations under the License.
1272+ */
1273+
1274+#include <zxing/BinaryBitmap.h>
1275+#include <zxing/Result.h>
1276+#include <zxing/DecodeHints.h>
1277+
1278+namespace zxing {
1279+
1280+ class Reader : public Counted {
1281+ protected:
1282+ Reader() {}
1283+ public:
1284+ virtual Ref<Result> decode(Ref<BinaryBitmap> image);
1285+ virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints) = 0;
1286+ virtual ~Reader();
1287+};
1288+
1289+}
1290+
1291+#endif // __READER_H__
1292
1293=== added file '3rdParty/zxing/ReaderException.cpp'
1294--- 3rdParty/zxing/ReaderException.cpp 1970-01-01 00:00:00 +0000
1295+++ 3rdParty/zxing/ReaderException.cpp 2014-05-10 17:37:18 +0000
1296@@ -0,0 +1,35 @@
1297+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1298+/*
1299+ * ReaderException.cpp
1300+ * zxing
1301+ *
1302+ * Created by Christian Brunschen on 13/05/2008.
1303+ * Copyright 2008-2011 ZXing authors All rights reserved.
1304+ *
1305+ * Licensed under the Apache License, Version 2.0 (the "License");
1306+ * you may not use this file except in compliance with the License.
1307+ * You may obtain a copy of the License at
1308+ *
1309+ * http://www.apache.org/licenses/LICENSE-2.0
1310+ *
1311+ * Unless required by applicable law or agreed to in writing, software
1312+ * distributed under the License is distributed on an "AS IS" BASIS,
1313+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1314+ * See the License for the specific language governing permissions and
1315+ * limitations under the License.
1316+ */
1317+
1318+#include <zxing/ReaderException.h>
1319+
1320+namespace zxing {
1321+
1322+ReaderException::ReaderException() {}
1323+
1324+ReaderException::ReaderException(const char *msg) :
1325+ Exception(msg) {
1326+}
1327+
1328+ReaderException::~ReaderException() throw() {
1329+}
1330+
1331+}
1332
1333=== added file '3rdParty/zxing/ReaderException.h'
1334--- 3rdParty/zxing/ReaderException.h 1970-01-01 00:00:00 +0000
1335+++ 3rdParty/zxing/ReaderException.h 2014-05-10 17:37:18 +0000
1336@@ -0,0 +1,35 @@
1337+#ifndef __READER_EXCEPTION_H__
1338+#define __READER_EXCEPTION_H__
1339+
1340+/*
1341+ * ReaderException.h
1342+ * zxing
1343+ *
1344+ * Copyright 2010 ZXing authors All rights reserved.
1345+ *
1346+ * Licensed under the Apache License, Version 2.0 (the "License");
1347+ * you may not use this file except in compliance with the License.
1348+ * You may obtain a copy of the License at
1349+ *
1350+ * http://www.apache.org/licenses/LICENSE-2.0
1351+ *
1352+ * Unless required by applicable law or agreed to in writing, software
1353+ * distributed under the License is distributed on an "AS IS" BASIS,
1354+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1355+ * See the License for the specific language governing permissions and
1356+ * limitations under the License.
1357+ */
1358+
1359+#include <zxing/Exception.h>
1360+
1361+namespace zxing {
1362+
1363+class ReaderException : public Exception {
1364+public:
1365+ ReaderException();
1366+ ReaderException(const char *msg);
1367+ ~ReaderException() throw();
1368+};
1369+
1370+}
1371+#endif // __READER_EXCEPTION_H__
1372
1373=== added file '3rdParty/zxing/Result.cpp'
1374--- 3rdParty/zxing/Result.cpp 1970-01-01 00:00:00 +0000
1375+++ 3rdParty/zxing/Result.cpp 2014-05-10 17:37:18 +0000
1376@@ -0,0 +1,64 @@
1377+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1378+/*
1379+ * Result.cpp
1380+ * zxing
1381+ *
1382+ * Created by Christian Brunschen on 13/05/2008.
1383+ * Copyright 2008 ZXing authors All rights reserved.
1384+ *
1385+ * Licensed under the Apache License, Version 2.0 (the "License");
1386+ * you may not use this file except in compliance with the License.
1387+ * You may obtain a copy of the License at
1388+ *
1389+ * http://www.apache.org/licenses/LICENSE-2.0
1390+ *
1391+ * Unless required by applicable law or agreed to in writing, software
1392+ * distributed under the License is distributed on an "AS IS" BASIS,
1393+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1394+ * See the License for the specific language governing permissions and
1395+ * limitations under the License.
1396+ */
1397+
1398+#include <zxing/Result.h>
1399+
1400+namespace zxing {
1401+using namespace std;
1402+
1403+Result::Result(Ref<String> text, ArrayRef<unsigned char> rawBytes, std::vector<Ref<ResultPoint> > resultPoints,
1404+ BarcodeFormat format) :
1405+ text_(text), rawBytes_(rawBytes), resultPoints_(resultPoints), format_(format) {
1406+}
1407+
1408+Result::~Result() {
1409+}
1410+
1411+Ref<String> Result::getText() {
1412+ return text_;
1413+}
1414+
1415+ArrayRef<unsigned char> Result::getRawBytes() {
1416+ return rawBytes_;
1417+}
1418+
1419+const std::vector<Ref<ResultPoint> >& Result::getResultPoints() const {
1420+ return resultPoints_;
1421+}
1422+
1423+std::vector<Ref<ResultPoint> >& Result::getResultPoints() {
1424+ return resultPoints_;
1425+}
1426+
1427+BarcodeFormat Result::getBarcodeFormat() const {
1428+ return format_;
1429+}
1430+
1431+ostream& operator<<(ostream &out, Result& result) {
1432+ if (result.text_ != 0) {
1433+ out << result.text_->getText();
1434+ } else {
1435+ out << "[" << result.rawBytes_->size() << " bytes]";
1436+ }
1437+ return out;
1438+}
1439+
1440+}
1441
1442=== added file '3rdParty/zxing/Result.h'
1443--- 3rdParty/zxing/Result.h 1970-01-01 00:00:00 +0000
1444+++ 3rdParty/zxing/Result.h 2014-05-10 17:37:18 +0000
1445@@ -0,0 +1,54 @@
1446+#ifndef __RESULT_H__
1447+#define __RESULT_H__
1448+
1449+/*
1450+ * Result.h
1451+ * zxing
1452+ *
1453+ * Copyright 2010 ZXing authors All rights reserved.
1454+ *
1455+ * Licensed under the Apache License, Version 2.0 (the "License");
1456+ * you may not use this file except in compliance with the License.
1457+ * You may obtain a copy of the License at
1458+ *
1459+ * http://www.apache.org/licenses/LICENSE-2.0
1460+ *
1461+ * Unless required by applicable law or agreed to in writing, software
1462+ * distributed under the License is distributed on an "AS IS" BASIS,
1463+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1464+ * See the License for the specific language governing permissions and
1465+ * limitations under the License.
1466+ */
1467+
1468+#include <string>
1469+#include <vector>
1470+#include <zxing/common/Array.h>
1471+#include <zxing/common/Counted.h>
1472+#include <zxing/common/Str.h>
1473+#include <zxing/ResultPoint.h>
1474+#include <zxing/BarcodeFormat.h>
1475+
1476+namespace zxing {
1477+
1478+class Result : public Counted {
1479+private:
1480+ Ref<String> text_;
1481+ ArrayRef<unsigned char> rawBytes_;
1482+ std::vector<Ref<ResultPoint> > resultPoints_;
1483+ BarcodeFormat format_;
1484+
1485+public:
1486+ Result(Ref<String> text, ArrayRef<unsigned char> rawBytes, std::vector<Ref<ResultPoint> > resultPoints,
1487+ BarcodeFormat format);
1488+ ~Result();
1489+ Ref<String> getText();
1490+ ArrayRef<unsigned char> getRawBytes();
1491+ const std::vector<Ref<ResultPoint> >& getResultPoints() const;
1492+ std::vector<Ref<ResultPoint> >& getResultPoints();
1493+ BarcodeFormat getBarcodeFormat() const;
1494+
1495+ friend std::ostream& operator<<(std::ostream &out, Result& result);
1496+};
1497+
1498+}
1499+#endif // __RESULT_H__
1500
1501=== added file '3rdParty/zxing/ResultPoint.cpp'
1502--- 3rdParty/zxing/ResultPoint.cpp 1970-01-01 00:00:00 +0000
1503+++ 3rdParty/zxing/ResultPoint.cpp 2014-05-10 17:37:18 +0000
1504@@ -0,0 +1,100 @@
1505+/*
1506+ * ResultPoint.cpp
1507+ * zxing
1508+ *
1509+ * Created by Christian Brunschen on 13/05/2008.
1510+ * Copyright 2008 ZXing authors All rights reserved.
1511+ *
1512+ * Licensed under the Apache License, Version 2.0 (the "License");
1513+ * you may not use this file except in compliance with the License.
1514+ * You may obtain a copy of the License at
1515+ *
1516+ * http://www.apache.org/licenses/LICENSE-2.0
1517+ *
1518+ * Unless required by applicable law or agreed to in writing, software
1519+ * distributed under the License is distributed on an "AS IS" BASIS,
1520+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1521+ * See the License for the specific language governing permissions and
1522+ * limitations under the License.
1523+ */
1524+
1525+#include <zxing/ResultPoint.h>
1526+#include <math.h>
1527+
1528+namespace zxing {
1529+
1530+ResultPoint::ResultPoint() : posX_(0), posY_(0) {}
1531+
1532+ResultPoint::ResultPoint(float x, float y) : posX_(x), posY_(y) {}
1533+
1534+ResultPoint::~ResultPoint() {}
1535+
1536+float ResultPoint::getX() const {
1537+ return posX_;
1538+}
1539+
1540+float ResultPoint::getY() const {
1541+ return posY_;
1542+}
1543+
1544+bool ResultPoint::equals(Ref<ResultPoint> other) {
1545+ return posX_ == other->getX() && posY_ == other->getY();
1546+}
1547+
1548+/**
1549+ * <p>Orders an array of three ResultPoints in an order [A,B,C] such that AB < AC and
1550+ * BC < AC and the angle between BC and BA is less than 180 degrees.
1551+ */
1552+void ResultPoint::orderBestPatterns(std::vector<Ref<ResultPoint> > &patterns) {
1553+ // Find distances between pattern centers
1554+ float zeroOneDistance = distance(patterns[0]->getX(), patterns[1]->getX(),patterns[0]->getY(), patterns[1]->getY());
1555+ float oneTwoDistance = distance(patterns[1]->getX(), patterns[2]->getX(),patterns[1]->getY(), patterns[2]->getY());
1556+ float zeroTwoDistance = distance(patterns[0]->getX(), patterns[2]->getX(),patterns[0]->getY(), patterns[2]->getY());
1557+
1558+ Ref<ResultPoint> pointA, pointB, pointC;
1559+ // Assume one closest to other two is B; A and C will just be guesses at first
1560+ if (oneTwoDistance >= zeroOneDistance && oneTwoDistance >= zeroTwoDistance) {
1561+ pointB = patterns[0];
1562+ pointA = patterns[1];
1563+ pointC = patterns[2];
1564+ } else if (zeroTwoDistance >= oneTwoDistance && zeroTwoDistance >= zeroOneDistance) {
1565+ pointB = patterns[1];
1566+ pointA = patterns[0];
1567+ pointC = patterns[2];
1568+ } else {
1569+ pointB = patterns[2];
1570+ pointA = patterns[0];
1571+ pointC = patterns[1];
1572+ }
1573+
1574+ // Use cross product to figure out whether A and C are correct or flipped.
1575+ // This asks whether BC x BA has a positive z component, which is the arrangement
1576+ // we want for A, B, C. If it's negative, then we've got it flipped around and
1577+ // should swap A and C.
1578+ if (crossProductZ(pointA, pointB, pointC) < 0.0f) {
1579+ Ref<ResultPoint> temp = pointA;
1580+ pointA = pointC;
1581+ pointC = temp;
1582+ }
1583+
1584+ patterns[0] = pointA;
1585+ patterns[1] = pointB;
1586+ patterns[2] = pointC;
1587+}
1588+
1589+float ResultPoint::distance(Ref<ResultPoint> point1, Ref<ResultPoint> point2) {
1590+ return distance(point1->getX(), point1->getY(), point2->getX(), point2->getY());
1591+}
1592+
1593+float ResultPoint::distance(float x1, float x2, float y1, float y2) {
1594+ float xDiff = x1 - x2;
1595+ float yDiff = y1 - y2;
1596+ return (float) sqrt((double) (xDiff * xDiff + yDiff * yDiff));
1597+}
1598+
1599+float ResultPoint::crossProductZ(Ref<ResultPoint> pointA, Ref<ResultPoint> pointB, Ref<ResultPoint> pointC) {
1600+ float bX = pointB->getX();
1601+ float bY = pointB->getY();
1602+ return ((pointC->getX() - bX) * (pointA->getY() - bY)) - ((pointC->getY() - bY) * (pointA->getX() - bX));
1603+}
1604+}
1605
1606=== added file '3rdParty/zxing/ResultPoint.h'
1607--- 3rdParty/zxing/ResultPoint.h 1970-01-01 00:00:00 +0000
1608+++ 3rdParty/zxing/ResultPoint.h 2014-05-10 17:37:18 +0000
1609@@ -0,0 +1,54 @@
1610+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1611+#ifndef __RESULT_POINT_H__
1612+#define __RESULT_POINT_H__
1613+
1614+/*
1615+ * ResultPoint.h
1616+ * zxing
1617+ *
1618+ * Copyright 2010 ZXing authors All rights reserved.
1619+ *
1620+ * Licensed under the Apache License, Version 2.0 (the "License");
1621+ * you may not use this file except in compliance with the License.
1622+ * You may obtain a copy of the License at
1623+ *
1624+ * http://www.apache.org/licenses/LICENSE-2.0
1625+ *
1626+ * Unless required by applicable law or agreed to in writing, software
1627+ * distributed under the License is distributed on an "AS IS" BASIS,
1628+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1629+ * See the License for the specific language governing permissions and
1630+ * limitations under the License.
1631+ */
1632+
1633+#include <zxing/common/Counted.h>
1634+#include <vector>
1635+
1636+namespace zxing {
1637+
1638+class ResultPoint : public Counted {
1639+protected:
1640+ float posX_;
1641+ float posY_;
1642+
1643+public:
1644+ ResultPoint();
1645+ ResultPoint(float x, float y);
1646+ virtual ~ResultPoint();
1647+
1648+ virtual float getX() const;
1649+ virtual float getY() const;
1650+
1651+ bool equals(Ref<ResultPoint> other);
1652+
1653+ static void orderBestPatterns(std::vector<Ref<ResultPoint> > &patterns);
1654+ static float distance(Ref<ResultPoint> point1, Ref<ResultPoint> point2);
1655+ static float distance(float x1, float x2, float y1, float y2);
1656+
1657+private:
1658+ static float crossProductZ(Ref<ResultPoint> pointA, Ref<ResultPoint> pointB, Ref<ResultPoint> pointC);
1659+};
1660+
1661+}
1662+
1663+#endif // __RESULT_POINT_H__
1664
1665=== added file '3rdParty/zxing/ResultPointCallback.cpp'
1666--- 3rdParty/zxing/ResultPointCallback.cpp 1970-01-01 00:00:00 +0000
1667+++ 3rdParty/zxing/ResultPointCallback.cpp 2014-05-10 17:37:18 +0000
1668@@ -0,0 +1,26 @@
1669+/*
1670+ * ResultPointCallback.cpp
1671+ * zxing
1672+ *
1673+ * Copyright 2010 ZXing authors All rights reserved.
1674+ *
1675+ * Licensed under the Apache License, Version 2.0 (the "License");
1676+ * you may not use this file except in compliance with the License.
1677+ * You may obtain a copy of the License at
1678+ *
1679+ * http://www.apache.org/licenses/LICENSE-2.0
1680+ *
1681+ * Unless required by applicable law or agreed to in writing, software
1682+ * distributed under the License is distributed on an "AS IS" BASIS,
1683+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1684+ * See the License for the specific language governing permissions and
1685+ * limitations under the License.
1686+ */
1687+
1688+#include <zxing/ResultPointCallback.h>
1689+
1690+namespace zxing {
1691+
1692+ResultPointCallback::~ResultPointCallback() {}
1693+
1694+}
1695
1696=== added file '3rdParty/zxing/ResultPointCallback.h'
1697--- 3rdParty/zxing/ResultPointCallback.h 1970-01-01 00:00:00 +0000
1698+++ 3rdParty/zxing/ResultPointCallback.h 2014-05-10 17:37:18 +0000
1699@@ -0,0 +1,39 @@
1700+#ifndef __RESULT_POINT_CALLBACK_H__
1701+#define __RESULT_POINT_CALLBACK_H__
1702+
1703+/*
1704+ * ResultPointCallback.h
1705+ * zxing
1706+ *
1707+ * Copyright 2010 ZXing authors All rights reserved.
1708+ *
1709+ * Licensed under the Apache License, Version 2.0 (the "License");
1710+ * you may not use this file except in compliance with the License.
1711+ * You may obtain a copy of the License at
1712+ *
1713+ * http://www.apache.org/licenses/LICENSE-2.0
1714+ *
1715+ * Unless required by applicable law or agreed to in writing, software
1716+ * distributed under the License is distributed on an "AS IS" BASIS,
1717+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1718+ * See the License for the specific language governing permissions and
1719+ * limitations under the License.
1720+ */
1721+
1722+#include <zxing/common/Counted.h>
1723+
1724+namespace zxing {
1725+
1726+class ResultPoint;
1727+
1728+class ResultPointCallback : public Counted {
1729+protected:
1730+ ResultPointCallback() {}
1731+public:
1732+ virtual void foundPossibleResultPoint(ResultPoint const& point) = 0;
1733+ virtual ~ResultPointCallback();
1734+};
1735+
1736+}
1737+
1738+#endif // __RESULT_POINT_CALLBACK_H__
1739
1740=== added directory '3rdParty/zxing/aztec'
1741=== added file '3rdParty/zxing/aztec/AztecDetectorResult.cpp'
1742--- 3rdParty/zxing/aztec/AztecDetectorResult.cpp 1970-01-01 00:00:00 +0000
1743+++ 3rdParty/zxing/aztec/AztecDetectorResult.cpp 2014-05-10 17:37:18 +0000
1744@@ -0,0 +1,45 @@
1745+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1746+/*
1747+ * AtztecDetecorResult.cpp
1748+ * zxing
1749+ *
1750+ * Created by Lukas Stabe on 08/02/2012.
1751+ * Copyright 2012 ZXing authors All rights reserved.
1752+ *
1753+ * Licensed under the Apache License, Version 2.0 (the "License");
1754+ * you may not use this file except in compliance with the License.
1755+ * You may obtain a copy of the License at
1756+ *
1757+ * http://www.apache.org/licenses/LICENSE-2.0
1758+ *
1759+ * Unless required by applicable law or agreed to in writing, software
1760+ * distributed under the License is distributed on an "AS IS" BASIS,
1761+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1762+ * See the License for the specific language governing permissions and
1763+ * limitations under the License.
1764+ */
1765+
1766+#include <zxing/aztec/AztecDetectorResult.h>
1767+
1768+namespace zxing {
1769+ namespace aztec {
1770+ AztecDetectorResult::AztecDetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points, bool compact, int nbDatablocks, int nbLayers)
1771+ : DetectorResult(bits, points),
1772+ compact_(compact),
1773+ nbDatablocks_(nbDatablocks),
1774+ nbLayers_(nbLayers) {
1775+ }
1776+
1777+ bool AztecDetectorResult::isCompact() {
1778+ return compact_;
1779+ }
1780+
1781+ int AztecDetectorResult::getNBDatablocks() {
1782+ return nbDatablocks_;
1783+ }
1784+
1785+ int AztecDetectorResult::getNBLayers() {
1786+ return nbLayers_;
1787+ }
1788+ }
1789+}
1790
1791=== added file '3rdParty/zxing/aztec/AztecDetectorResult.h'
1792--- 3rdParty/zxing/aztec/AztecDetectorResult.h 1970-01-01 00:00:00 +0000
1793+++ 3rdParty/zxing/aztec/AztecDetectorResult.h 2014-05-10 17:37:18 +0000
1794@@ -0,0 +1,42 @@
1795+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1796+/*
1797+ * AtztecDetecorResult.h
1798+ * zxing
1799+ *
1800+ * Created by Lukas Stabe on 08/02/2012.
1801+ * Copyright 2012 ZXing authors All rights reserved.
1802+ *
1803+ * Licensed under the Apache License, Version 2.0 (the "License");
1804+ * you may not use this file except in compliance with the License.
1805+ * You may obtain a copy of the License at
1806+ *
1807+ * http://www.apache.org/licenses/LICENSE-2.0
1808+ *
1809+ * Unless required by applicable law or agreed to in writing, software
1810+ * distributed under the License is distributed on an "AS IS" BASIS,
1811+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1812+ * See the License for the specific language governing permissions and
1813+ * limitations under the License.
1814+ */
1815+
1816+#include <zxing/common/DetectorResult.h>
1817+
1818+#ifndef ZXingWidget_AtztecDetecorResult_h
1819+#define ZXingWidget_AtztecDetecorResult_h
1820+
1821+namespace zxing {
1822+ namespace aztec {
1823+ class AztecDetectorResult : public DetectorResult {
1824+ private:
1825+ bool compact_;
1826+ int nbDatablocks_, nbLayers_;
1827+ public:
1828+ AztecDetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points, bool compact, int nbDatablocks, int nbLayers);
1829+ bool isCompact();
1830+ int getNBDatablocks();
1831+ int getNBLayers();
1832+ };
1833+ }
1834+}
1835+
1836+#endif
1837
1838=== added file '3rdParty/zxing/aztec/AztecReader.cpp'
1839--- 3rdParty/zxing/aztec/AztecReader.cpp 1970-01-01 00:00:00 +0000
1840+++ 3rdParty/zxing/aztec/AztecReader.cpp 2014-05-10 17:37:18 +0000
1841@@ -0,0 +1,64 @@
1842+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1843+/*
1844+ * AztecReader.cpp
1845+ * zxing
1846+ *
1847+ * Created by Lukas Stabe on 08/02/2012.
1848+ * Copyright 2012 ZXing authors All rights reserved.
1849+ *
1850+ * Licensed under the Apache License, Version 2.0 (the "License");
1851+ * you may not use this file except in compliance with the License.
1852+ * You may obtain a copy of the License at
1853+ *
1854+ * http://www.apache.org/licenses/LICENSE-2.0
1855+ *
1856+ * Unless required by applicable law or agreed to in writing, software
1857+ * distributed under the License is distributed on an "AS IS" BASIS,
1858+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1859+ * See the License for the specific language governing permissions and
1860+ * limitations under the License.
1861+ */
1862+
1863+#include <zxing/aztec/AztecReader.h>
1864+#include <zxing/aztec/detector/Detector.h>
1865+#include <iostream>
1866+
1867+namespace zxing {
1868+ namespace aztec {
1869+
1870+ AztecReader::AztecReader() : decoder_() {
1871+ // nothing
1872+ }
1873+
1874+ Ref<Result> AztecReader::decode(Ref<zxing::BinaryBitmap> image) {
1875+ Detector detector(image->getBlackMatrix());
1876+
1877+ Ref<AztecDetectorResult> detectorResult(detector.detect());
1878+
1879+ std::vector<Ref<ResultPoint> > points(detectorResult->getPoints());
1880+
1881+ Ref<DecoderResult> decoderResult(decoder_.decode(detectorResult));
1882+
1883+ Ref<Result> result(new Result(decoderResult->getText(),
1884+ decoderResult->getRawBytes(),
1885+ points,
1886+ BarcodeFormat_AZTEC));
1887+
1888+ return result;
1889+ }
1890+
1891+ Ref<Result> AztecReader::decode(Ref<BinaryBitmap> image, DecodeHints) {
1892+ //cout << "decoding with hints not supported for aztec" << "\n" << flush;
1893+ return this->decode(image);
1894+ }
1895+
1896+ AztecReader::~AztecReader() {
1897+ // nothing
1898+ }
1899+
1900+ Decoder& AztecReader::getDecoder() {
1901+ return decoder_;
1902+ }
1903+
1904+ }
1905+}
1906
1907=== added file '3rdParty/zxing/aztec/AztecReader.h'
1908--- 3rdParty/zxing/aztec/AztecReader.h 1970-01-01 00:00:00 +0000
1909+++ 3rdParty/zxing/aztec/AztecReader.h 2014-05-10 17:37:18 +0000
1910@@ -0,0 +1,49 @@
1911+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1912+/*
1913+ * AztecReader.h
1914+ * zxing
1915+ *
1916+ * Created by Lukas Stabe on 08/02/2012.
1917+ * Copyright 2012 ZXing authors All rights reserved.
1918+ *
1919+ * Licensed under the Apache License, Version 2.0 (the "License");
1920+ * you may not use this file except in compliance with the License.
1921+ * You may obtain a copy of the License at
1922+ *
1923+ * http://www.apache.org/licenses/LICENSE-2.0
1924+ *
1925+ * Unless required by applicable law or agreed to in writing, software
1926+ * distributed under the License is distributed on an "AS IS" BASIS,
1927+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1928+ * See the License for the specific language governing permissions and
1929+ * limitations under the License.
1930+ */
1931+
1932+#include <zxing/Reader.h>
1933+#include <zxing/aztec/decoder/Decoder.h>
1934+#include <zxing/DecodeHints.h>
1935+
1936+#ifndef ZXingWidget_AztecReader_h
1937+#define ZXingWidget_AztecReader_h
1938+
1939+namespace zxing {
1940+ namespace aztec {
1941+
1942+ class AztecReader : public Reader {
1943+ private:
1944+ Decoder decoder_;
1945+
1946+ protected:
1947+ Decoder &getDecoder();
1948+
1949+ public:
1950+ AztecReader();
1951+ virtual Ref<Result> decode(Ref<BinaryBitmap> image);
1952+ virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
1953+ virtual ~AztecReader();
1954+ };
1955+
1956+ }
1957+}
1958+
1959+#endif
1960
1961=== added directory '3rdParty/zxing/aztec/decoder'
1962=== added file '3rdParty/zxing/aztec/decoder/AztecDecoder.cpp'
1963--- 3rdParty/zxing/aztec/decoder/AztecDecoder.cpp 1970-01-01 00:00:00 +0000
1964+++ 3rdParty/zxing/aztec/decoder/AztecDecoder.cpp 2014-05-10 17:37:18 +0000
1965@@ -0,0 +1,496 @@
1966+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
1967+/*
1968+ * Decoder.cpp
1969+ * zxing
1970+ *
1971+ * Created by Lukas Stabe on 08/02/2012.
1972+ * Copyright 2012 ZXing authors All rights reserved.
1973+ *
1974+ * Licensed under the Apache License, Version 2.0 (the "License");
1975+ * you may not use this file except in compliance with the License.
1976+ * You may obtain a copy of the License at
1977+ *
1978+ * http://www.apache.org/licenses/LICENSE-2.0
1979+ *
1980+ * Unless required by applicable law or agreed to in writing, software
1981+ * distributed under the License is distributed on an "AS IS" BASIS,
1982+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1983+ * See the License for the specific language governing permissions and
1984+ * limitations under the License.
1985+ */
1986+
1987+#include <zxing/aztec/decoder/Decoder.h>
1988+#ifndef NO_ICONV
1989+#include <iconv.h>
1990+#endif
1991+#include <iostream>
1992+#include <zxing/FormatException.h>
1993+#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
1994+#include <zxing/common/reedsolomon/ReedSolomonException.h>
1995+#include <zxing/common/reedsolomon/GenericGF.h>
1996+#include <zxing/common/IllegalArgumentException.h>
1997+
1998+#include <qglobal.h>
1999+
2000+using zxing::aztec::Decoder;
2001+using zxing::DecoderResult;
2002+using zxing::String;
2003+using zxing::BitArray;
2004+using zxing::BitMatrix;
2005+using zxing::Ref;
2006+
2007+using std::string;
2008+
2009+namespace {
2010+ void add(string& result, unsigned char character) {
2011+#ifndef NO_ICONV
2012+ char s[] = { character & 0xff };
2013+ char* ss = s;
2014+ size_t sl = sizeof(s);
2015+ char d[4];
2016+ char* ds = d;
2017+ size_t dl = sizeof(d);
2018+ iconv_t ic = iconv_open("UTF-8", "ISO-8859-1");
2019+
2020+
2021+#if defined(Q_OS_SYMBIAN)
2022+ iconv(ic, (const char**)&ss, &sl, &ds, &dl); // for Symbian and Mingw
2023+#else
2024+ iconv(ic, (char**)&ss, &sl, &ds, &dl); // for Harmattan
2025+#endif
2026+ iconv_close(ic);
2027+ d[sizeof(d)-dl] = 0;
2028+ result.append(d);
2029+#else
2030+ result.push_back(character);
2031+#endif
2032+ }
2033+
2034+ const int NB_BITS_COMPACT[] = {
2035+ 0, 104, 240, 408, 608
2036+ };
2037+
2038+ const int NB_BITS[] = {
2039+ 0, 128, 288, 480, 704, 960, 1248, 1568, 1920, 2304, 2720, 3168, 3648, 4160, 4704, 5280, 5888, 6528,
2040+ 7200, 7904, 8640, 9408, 10208, 11040, 11904, 12800, 13728, 14688, 15680, 16704, 17760, 18848, 19968
2041+ };
2042+
2043+ const int NB_DATABLOCK_COMPACT[] = {
2044+ 0, 17, 40, 51, 76
2045+ };
2046+
2047+ const int NB_DATABLOCK[] = {
2048+ 0, 21, 48, 60, 88, 120, 156, 196, 240, 230, 272, 316, 364, 416, 470, 528, 588, 652, 720, 790, 864,
2049+ 940, 1020, 920, 992, 1066, 1144, 1224, 1306, 1392, 1480, 1570, 1664
2050+ };
2051+
2052+ const char* UPPER_TABLE[] = {
2053+ "CTRL_PS", " ", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
2054+ "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "CTRL_LL", "CTRL_ML", "CTRL_DL", "CTRL_BS"
2055+ };
2056+
2057+ const char* LOWER_TABLE[] = {
2058+ "CTRL_PS", " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
2059+ "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "CTRL_US", "CTRL_ML", "CTRL_DL", "CTRL_BS"
2060+ };
2061+
2062+ const char* MIXED_TABLE[] = {
2063+ "CTRL_PS", " ", "\1", "\2", "\3", "\4", "\5", "\6", "\7", "\b", "\t", "\n",
2064+ "\13", "\f", "\r", "\33", "\34", "\35", "\36", "\37", "@", "\\", "^", "_",
2065+ "`", "|", "~", "\177", "CTRL_LL", "CTRL_UL", "CTRL_PL", "CTRL_BS"
2066+ };
2067+
2068+ const char* PUNCT_TABLE[] = {
2069+ "", "\r", "\r\n", ". ", ", ", ": ", "!", "\"", "#", "$", "%", "&", "'", "(", ")",
2070+ "*", "+", ",", "-", ".", "/", ":", ";", "<", "=", ">", "?", "[", "]", "{", "}", "CTRL_UL"
2071+ };
2072+
2073+ const char* DIGIT_TABLE[] = {
2074+ "CTRL_PS", " ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ",", ".", "CTRL_UL", "CTRL_US"
2075+ };
2076+}
2077+
2078+Decoder::Table Decoder::getTable(char t) {
2079+ switch (t) {
2080+ case 'L':
2081+ return LOWER;
2082+ case 'P':
2083+ return PUNCT;
2084+ case 'M':
2085+ return MIXED;
2086+ case 'D':
2087+ return DIGIT;
2088+ case 'B':
2089+ return BINARY;
2090+ case 'U':
2091+ default:
2092+ return UPPER;
2093+ }
2094+}
2095+
2096+const char* Decoder::getCharacter(zxing::aztec::Decoder::Table table, int code) {
2097+ switch (table) {
2098+ case UPPER:
2099+ return UPPER_TABLE[code];
2100+ case LOWER:
2101+ return LOWER_TABLE[code];
2102+ case MIXED:
2103+ return MIXED_TABLE[code];
2104+ case PUNCT:
2105+ return PUNCT_TABLE[code];
2106+ case DIGIT:
2107+ return DIGIT_TABLE[code];
2108+ default:
2109+ return "";
2110+ }
2111+}
2112+
2113+Decoder::Decoder() {
2114+ // nothing
2115+}
2116+
2117+Ref<DecoderResult> Decoder::decode(Ref<zxing::aztec::AztecDetectorResult> detectorResult) {
2118+ ddata_ = detectorResult;
2119+
2120+ // std::printf("getting bits\n");
2121+
2122+ Ref<BitMatrix> matrix = detectorResult->getBits();
2123+
2124+ if (!ddata_->isCompact()) {
2125+ // std::printf("removing lines\n");
2126+ matrix = removeDashedLines(ddata_->getBits());
2127+ }
2128+
2129+ // std::printf("extracting bits\n");
2130+ Ref<BitArray> rawbits = extractBits(matrix);
2131+
2132+ // std::printf("correcting bits\n");
2133+ Ref<BitArray> aCorrectedBits = correctBits(rawbits);
2134+
2135+ // std::printf("decoding bits\n");
2136+ Ref<String> result = getEncodedData(aCorrectedBits);
2137+
2138+ // std::printf("constructing array\n");
2139+ ArrayRef<unsigned char> arrayOut(aCorrectedBits->getSize());
2140+ for (int i = 0; i < aCorrectedBits->count(); i++) {
2141+ arrayOut[i] = (unsigned char)aCorrectedBits->get(i);
2142+ }
2143+
2144+ // std::printf("returning\n");
2145+
2146+ return Ref<DecoderResult>(new DecoderResult(arrayOut, result));
2147+}
2148+
2149+Ref<String> Decoder::getEncodedData(Ref<zxing::BitArray> correctedBits) {
2150+ int endIndex = codewordSize_ * ddata_->getNBDatablocks() - invertedBitCount_;
2151+ if (endIndex > (int)correctedBits->getSize()) {
2152+ // std::printf("invalid input\n");
2153+ throw FormatException("invalid input data");
2154+ }
2155+
2156+ Table lastTable = UPPER;
2157+ Table table = UPPER;
2158+ int startIndex = 0;
2159+ std::string result;
2160+ bool end = false;
2161+ bool shift = false;
2162+ bool switchShift = false;
2163+ bool binaryShift = false;
2164+
2165+ while (!end) {
2166+ // std::printf("decoooooding\n");
2167+
2168+ if (shift) {
2169+ switchShift = true;
2170+ } else {
2171+ lastTable = table;
2172+ }
2173+
2174+ int code;
2175+ if (binaryShift) {
2176+ if (endIndex - startIndex < 5) {
2177+ break;
2178+ }
2179+
2180+ int length = readCode(correctedBits, startIndex, 5);
2181+ startIndex += 5;
2182+ if (length == 0) {
2183+ if (endIndex - startIndex < 11) {
2184+ break;
2185+ }
2186+
2187+ length = readCode(correctedBits, startIndex, 11) + 31;
2188+ startIndex += 11;
2189+ }
2190+ for (int charCount = 0; charCount < length; charCount++) {
2191+ if (endIndex - startIndex < 8) {
2192+ end = true;
2193+ break;
2194+ }
2195+
2196+ code = readCode(correctedBits, startIndex, 8);
2197+ add(result, code);
2198+ startIndex += 8;
2199+ }
2200+ binaryShift = false;
2201+ } else {
2202+ if (table == BINARY) {
2203+ if (endIndex - startIndex < 8) {
2204+ end = true;
2205+ break;
2206+ }
2207+ code = readCode(correctedBits, startIndex, 8);
2208+ startIndex += 8;
2209+
2210+ add(result, code);
2211+ } else {
2212+ int size = 5;
2213+
2214+ if (table == DIGIT) {
2215+ size = 4;
2216+ }
2217+
2218+ if (endIndex - startIndex < size) {
2219+ end = true;
2220+ break;
2221+ }
2222+
2223+ code = readCode(correctedBits, startIndex, size);
2224+ startIndex += size;
2225+
2226+ const char *str = getCharacter(table, code);
2227+ std::string string(str);
2228+ if ((int)string.find("CTRL_") != -1) {
2229+ table = getTable(str[5]);
2230+
2231+ if (str[6] == 'S') {
2232+ shift = true;
2233+ if (str[5] == 'B') {
2234+ binaryShift = true;
2235+ }
2236+ }
2237+ } else {
2238+ result.append(string);
2239+ }
2240+
2241+ }
2242+ }
2243+
2244+ if (switchShift) {
2245+ table = lastTable;
2246+ shift = false;
2247+ switchShift = false;
2248+ }
2249+
2250+
2251+ }
2252+
2253+ return Ref<String>(new String(result));
2254+
2255+}
2256+
2257+Ref<zxing::BitArray> Decoder::correctBits(Ref<zxing::BitArray> rawbits) {
2258+ //return rawbits;
2259+ // std::printf("decoding stuff:%d datablocks in %d layers\n", ddata_->getNBDatablocks(), ddata_->getNBLayers());
2260+
2261+ Ref<GenericGF> gf = GenericGF::AZTEC_DATA_6;
2262+
2263+ if (ddata_->getNBLayers() <= 2) {
2264+ codewordSize_ = 6;
2265+ gf = GenericGF::AZTEC_DATA_6;
2266+ } else if (ddata_->getNBLayers() <= 8) {
2267+ codewordSize_ = 8;
2268+ gf = GenericGF::AZTEC_DATA_8;
2269+ } else if (ddata_->getNBLayers() <= 22) {
2270+ codewordSize_ = 10;
2271+ gf = GenericGF::AZTEC_DATA_10;
2272+ } else {
2273+ codewordSize_ = 12;
2274+ gf = GenericGF::AZTEC_DATA_12;
2275+ }
2276+
2277+ int numDataCodewords = ddata_->getNBDatablocks();
2278+ int numECCodewords;
2279+ int offset;
2280+
2281+ if (ddata_->isCompact()) {
2282+ offset = NB_BITS_COMPACT[ddata_->getNBLayers()] - numCodewords_ * codewordSize_;
2283+ numECCodewords = NB_DATABLOCK_COMPACT[ddata_->getNBLayers()] - numDataCodewords;
2284+ } else {
2285+ offset = NB_BITS[ddata_->getNBLayers()] - numCodewords_ * codewordSize_;
2286+ numECCodewords = NB_DATABLOCK[ddata_->getNBLayers()] - numDataCodewords;
2287+ }
2288+
2289+ ArrayRef<int> dataWords(numCodewords_);
2290+
2291+ for (int i = 0; i < numCodewords_; i++) {
2292+ int flag = 1;
2293+ for (int j = 1; j <= codewordSize_; j++) {
2294+ if (rawbits->get(codewordSize_ * i + codewordSize_ - j + offset)) {
2295+ dataWords[i] += flag;
2296+ }
2297+ flag <<= 1;
2298+ }
2299+
2300+ //
2301+ //
2302+ //
2303+ }
2304+
2305+ try {
2306+ // std::printf("trying reed solomon, numECCodewords:%d\n", numECCodewords);
2307+ ReedSolomonDecoder rsDecoder(gf);
2308+ rsDecoder.decode(dataWords, numECCodewords);
2309+ } catch (ReedSolomonException& rse) {
2310+ // std::printf("got reed solomon exception:%s, throwing formatexception\n", rse.what());
2311+ throw FormatException("rs decoding failed");
2312+ } catch (IllegalArgumentException& iae) {
2313+ // std::printf("illegal argument exception: %s", iae.what());
2314+ }
2315+
2316+ offset = 0;
2317+ invertedBitCount_ = 0;
2318+
2319+ Ref<BitArray> correctedBits(new BitArray(numDataCodewords * codewordSize_));
2320+ for (int i = 0; i < numDataCodewords; i++) {
2321+
2322+ bool seriesColor = false;
2323+ int seriesCount = 0;
2324+ int flag = 1 << (codewordSize_ - 1);
2325+
2326+ for (int j = 0; j < codewordSize_; j++) {
2327+
2328+ bool color = (dataWords[i] & flag) == flag;
2329+
2330+ if (seriesCount == codewordSize_ - 1) {
2331+
2332+ if (color == seriesColor) {
2333+ throw FormatException("bit was not inverted");
2334+ }
2335+
2336+ seriesColor = false;
2337+ seriesCount = 0;
2338+ offset++;
2339+ invertedBitCount_++;
2340+
2341+ } else {
2342+
2343+ if (seriesColor == color) {
2344+ seriesCount++;
2345+ } else {
2346+ seriesCount = 1;
2347+ seriesColor = color;
2348+ }
2349+
2350+ if (color) correctedBits->set(i * codewordSize_ + j - offset);
2351+
2352+ }
2353+
2354+ flag = (unsigned int)flag >> 1;
2355+
2356+ }
2357+ }
2358+
2359+ return correctedBits;
2360+}
2361+
2362+Ref<BitArray> Decoder::extractBits(Ref<zxing::BitMatrix> matrix) {
2363+ std::vector<bool> rawbits;
2364+
2365+ if (ddata_->isCompact()) {
2366+ if (ddata_->getNBLayers() > 5) { //NB_BITS_COMPACT length
2367+ throw FormatException("data is too long");
2368+ }
2369+ rawbits = std::vector<bool>(NB_BITS_COMPACT[ddata_->getNBLayers()]);
2370+ numCodewords_ = NB_DATABLOCK_COMPACT[ddata_->getNBLayers()];
2371+ } else {
2372+ if (ddata_->getNBLayers() > 33) { //NB_BITS length
2373+ throw FormatException("data is too long");
2374+ }
2375+ rawbits = std::vector<bool>(NB_BITS[ddata_->getNBLayers()]);
2376+ numCodewords_ = NB_DATABLOCK[ddata_->getNBLayers()];
2377+ }
2378+
2379+ int layer = ddata_->getNBLayers();
2380+ int size = matrix->getHeight();
2381+ int rawbitsOffset = 0;
2382+ int matrixOffset = 0;
2383+
2384+
2385+ while (layer != 0) {
2386+
2387+ int flip = 0;
2388+ for (int i = 0; i < 2 * size - 4; i++) {
2389+ rawbits[rawbitsOffset + i] = matrix->get(matrixOffset + flip, matrixOffset + i / 2);
2390+ rawbits[rawbitsOffset + 2 * size - 4 + i] = matrix->get(matrixOffset + i / 2, matrixOffset + size - 1 - flip);
2391+ flip = (flip + 1) % 2;
2392+ }
2393+
2394+ flip = 0;
2395+ for (int i = 2 * size + 1; i > 5; i--) {
2396+ rawbits[rawbitsOffset + 4 * size - 8 + (2 * size - i) + 1] =
2397+ matrix->get(matrixOffset + size - 1 - flip, matrixOffset + i / 2 - 1);
2398+ rawbits[rawbitsOffset + 6 * size - 12 + (2 * size - i) + 1] =
2399+ matrix->get(matrixOffset + i / 2 - 1, matrixOffset + flip);
2400+ flip = (flip + 1) % 2;
2401+ }
2402+
2403+ matrixOffset += 2;
2404+ rawbitsOffset += 8 * size - 16;
2405+ layer--;
2406+ size -= 4;
2407+
2408+ }
2409+
2410+ Ref<BitArray> returnValue(new BitArray(rawbits.size()));
2411+ for (int i = 0; i < (int)rawbits.size(); i++) {
2412+ if (rawbits[i]) returnValue->set(i);
2413+ }
2414+
2415+ return returnValue;
2416+
2417+}
2418+
2419+Ref<BitMatrix> Decoder::removeDashedLines(Ref<zxing::BitMatrix> matrix) {
2420+ int nbDashed = 1 + 2 * ((matrix->getWidth() - 1) / 2 / 16);
2421+ Ref<BitMatrix> newMatrix(new BitMatrix(matrix->getWidth() - nbDashed, matrix->getHeight() - nbDashed));
2422+
2423+ int nx = 0;
2424+
2425+ for (int x = 0; x < (int)matrix->getWidth(); x++) {
2426+
2427+ if ((matrix->getWidth() / 2 - x) % 16 == 0) {
2428+ continue;
2429+ }
2430+
2431+ int ny = 0;
2432+ for (int y = 0; y < (int)matrix->getHeight(); y++) {
2433+
2434+ if ((matrix->getWidth() / 2 - y) % 16 == 0) {
2435+ continue;
2436+ }
2437+
2438+ if (matrix->get(x, y)) {
2439+ newMatrix->set(nx, ny);
2440+ }
2441+ ny++;
2442+
2443+ }
2444+ nx++;
2445+
2446+ }
2447+ return newMatrix;
2448+}
2449+
2450+int Decoder::readCode(Ref<zxing::BitArray> rawbits, int startIndex, int length) {
2451+ int res = 0;
2452+
2453+ for (int i = startIndex; i < startIndex + length; i++) {
2454+ res <<= 1;
2455+ if (rawbits->get(i)) {
2456+ res ++;
2457+ }
2458+ }
2459+
2460+ return res;
2461+}
2462
2463=== added file '3rdParty/zxing/aztec/decoder/Decoder.h'
2464--- 3rdParty/zxing/aztec/decoder/Decoder.h 1970-01-01 00:00:00 +0000
2465+++ 3rdParty/zxing/aztec/decoder/Decoder.h 2014-05-10 17:37:18 +0000
2466@@ -0,0 +1,63 @@
2467+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
2468+/*
2469+ * Decoder.h
2470+ * zxing
2471+ *
2472+ * Created by Lukas Stabe on 08/02/2012.
2473+ * Copyright 2012 ZXing authors All rights reserved.
2474+ *
2475+ * Licensed under the Apache License, Version 2.0 (the "License");
2476+ * you may not use this file except in compliance with the License.
2477+ * You may obtain a copy of the License at
2478+ *
2479+ * http://www.apache.org/licenses/LICENSE-2.0
2480+ *
2481+ * Unless required by applicable law or agreed to in writing, software
2482+ * distributed under the License is distributed on an "AS IS" BASIS,
2483+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2484+ * See the License for the specific language governing permissions and
2485+ * limitations under the License.
2486+ */
2487+
2488+#include <zxing/common/DecoderResult.h>
2489+#include <zxing/common/BitMatrix.h>
2490+#include <zxing/common/Str.h>
2491+#include <zxing/aztec/AztecDetectorResult.h>
2492+
2493+namespace zxing {
2494+ namespace aztec {
2495+
2496+ class Decoder : public Counted {
2497+ private:
2498+ enum Table {
2499+ UPPER,
2500+ LOWER,
2501+ MIXED,
2502+ DIGIT,
2503+ PUNCT,
2504+ BINARY
2505+ };
2506+
2507+ static Table getTable(char t);
2508+ static const char* getCharacter(Table table, int code);
2509+
2510+ int numCodewords_;
2511+ int codewordSize_;
2512+ Ref<AztecDetectorResult> ddata_;
2513+ int invertedBitCount_;
2514+
2515+ Ref<String> getEncodedData(Ref<BitArray> correctedBits);
2516+ Ref<BitArray> correctBits(Ref<BitArray> rawbits);
2517+ Ref<BitArray> extractBits(Ref<BitMatrix> matrix);
2518+ static Ref<BitMatrix> removeDashedLines(Ref<BitMatrix> matrix);
2519+ static int readCode(Ref<BitArray> rawbits, int startIndex, int length);
2520+
2521+
2522+ public:
2523+ Decoder();
2524+ Ref<DecoderResult> decode(Ref<AztecDetectorResult> detectorResult);
2525+ };
2526+
2527+ }
2528+}
2529+
2530
2531=== added directory '3rdParty/zxing/aztec/detector'
2532=== added file '3rdParty/zxing/aztec/detector/AztecDetector.cpp'
2533--- 3rdParty/zxing/aztec/detector/AztecDetector.cpp 1970-01-01 00:00:00 +0000
2534+++ 3rdParty/zxing/aztec/detector/AztecDetector.cpp 2014-05-10 17:37:18 +0000
2535@@ -0,0 +1,541 @@
2536+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
2537+/*
2538+ * Detector.cpp
2539+ * zxing
2540+ *
2541+ * Created by Lukas Stabe on 08/02/2012.
2542+ * Copyright 2012 ZXing authors All rights reserved.
2543+ *
2544+ * Licensed under the Apache License, Version 2.0 (the "License");
2545+ * you may not use this file except in compliance with the License.
2546+ * You may obtain a copy of the License at
2547+ *
2548+ * http://www.apache.org/licenses/LICENSE-2.0
2549+ *
2550+ * Unless required by applicable law or agreed to in writing, software
2551+ * distributed under the License is distributed on an "AS IS" BASIS,
2552+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2553+ * See the License for the specific language governing permissions and
2554+ * limitations under the License.
2555+ */
2556+
2557+#include <zxing/aztec/detector/Detector.h>
2558+#include <zxing/common/GridSampler.h>
2559+#include <zxing/common/detector/WhiteRectangleDetector.h>
2560+#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
2561+#include <zxing/common/reedsolomon/ReedSolomonException.h>
2562+#include <zxing/common/reedsolomon/GenericGF.h>
2563+#include <iostream>
2564+#include <cmath>
2565+#include <zxing/NotFoundException.h>
2566+
2567+using zxing::aztec::Detector;
2568+using zxing::aztec::Point;
2569+using zxing::aztec::AztecDetectorResult;
2570+using zxing::Ref;
2571+using zxing::ResultPoint;
2572+using zxing::BitArray;
2573+using zxing::BitMatrix;
2574+
2575+Detector::Detector(Ref<BitMatrix> image):
2576+ image_(image),
2577+ nbLayers_(0),
2578+ nbDataBlocks_(0),
2579+ nbCenterLayers_(0) {
2580+
2581+}
2582+
2583+// using namespace std;
2584+
2585+Ref<AztecDetectorResult> Detector::detect() {
2586+ Ref<Point> pCenter = getMatrixCenter();
2587+
2588+ std::vector<Ref<Point> > bullEyeCornerPoints = getBullEyeCornerPoints(pCenter);
2589+
2590+ extractParameters(bullEyeCornerPoints);
2591+
2592+ std::vector<Ref<ResultPoint> > corners = getMatrixCornerPoints(bullEyeCornerPoints);
2593+
2594+ Ref<BitMatrix> bits = sampleGrid(image_, corners[shift_%4], corners[(shift_+3)%4], corners[(shift_+2)%4], corners[(shift_+1)%4]);
2595+
2596+ // std::printf("------------\ndetected: compact:%s, nbDataBlocks:%d, nbLayers:%d\n------------\n",compact_?"YES":"NO", nbDataBlocks_, nbLayers_);
2597+
2598+ return Ref<AztecDetectorResult>(new AztecDetectorResult(bits, corners, compact_, nbDataBlocks_, nbLayers_));
2599+}
2600+
2601+void Detector::extractParameters(std::vector<Ref<Point> > bullEyeCornerPoints) {
2602+ // get the bits around the bull's eye
2603+ Ref<BitArray> resab = sampleLine(bullEyeCornerPoints[0], bullEyeCornerPoints[1], 2*nbCenterLayers_+1);
2604+ Ref<BitArray> resbc = sampleLine(bullEyeCornerPoints[1], bullEyeCornerPoints[2], 2*nbCenterLayers_+1);
2605+ Ref<BitArray> rescd = sampleLine(bullEyeCornerPoints[2], bullEyeCornerPoints[3], 2*nbCenterLayers_+1);
2606+ Ref<BitArray> resda = sampleLine(bullEyeCornerPoints[3], bullEyeCornerPoints[0], 2*nbCenterLayers_+1);
2607+
2608+ // determin the orientation of the matrix
2609+ if (resab->get(0) && resab->get(2 * nbCenterLayers_)) {
2610+ shift_ = 0;
2611+ } else if (resbc->get(0) && resbc->get(2 * nbCenterLayers_)) {
2612+ shift_ = 1;
2613+ } else if (rescd->get(0) && rescd->get(2 * nbCenterLayers_)) {
2614+ shift_ = 2;
2615+ } else if (resda->get(0) && resda->get(2 * nbCenterLayers_)) {
2616+ shift_ = 3;
2617+ } else {
2618+ // std::printf("could not detemine orientation\n");
2619+ throw ReaderException("could not determine orientation");
2620+ }
2621+
2622+ //d a
2623+ //
2624+ //c b
2625+
2626+ //flatten the bits in a single array
2627+ Ref<BitArray> parameterData(new BitArray(compact_?28:40));
2628+ Ref<BitArray> shiftedParameterData(new BitArray(compact_?28:40));
2629+
2630+ if (compact_) {
2631+ for (int i = 0; i < 7; i++) {
2632+ if (resab->get(2+i)) shiftedParameterData->set(i);
2633+ if (resbc->get(2+i)) shiftedParameterData->set(i+7);
2634+ if (rescd->get(2+i)) shiftedParameterData->set(i+14);
2635+ if (resda->get(2+i)) shiftedParameterData->set(i+21);
2636+ }
2637+ for (int i = 0; i < 28; i++) {
2638+ if (shiftedParameterData->get((i+shift_*7)%28)) parameterData->set(i);
2639+ }
2640+
2641+ } else {
2642+ for (int i = 0; i < 11; i++) {
2643+ if (i < 5) {
2644+ if (resab->get(2+i)) shiftedParameterData->set(i);
2645+ if (resbc->get(2+i)) shiftedParameterData->set(i+10);
2646+ if (rescd->get(2+i)) shiftedParameterData->set(i+20);
2647+ if (resda->get(2+i)) shiftedParameterData->set(i+30);
2648+ }
2649+ if (i > 5) {
2650+ if (resab->get(2+i)) shiftedParameterData->set(i-1);
2651+ if (resbc->get(2+i)) shiftedParameterData->set(i+10-1);
2652+ if (rescd->get(2+i)) shiftedParameterData->set(i+20-1);
2653+ if (resda->get(2+i)) shiftedParameterData->set(i+30-1);
2654+ }
2655+ }
2656+ for (int i = 0; i < 40; i++) {
2657+ if (shiftedParameterData->get((i+shift_*10)%40)) parameterData->set(i);
2658+ }
2659+ }
2660+
2661+ correctParameterData(parameterData, compact_);
2662+
2663+ getParameters(parameterData);
2664+}
2665+
2666+std::vector<Ref<ResultPoint> > Detector::getMatrixCornerPoints(std::vector<Ref<Point> > bullEyeCornerPoints) {
2667+ float ratio = (2 * nbLayers_ + (nbLayers_ > 4 ? 1 : 0) + (nbLayers_ - 4) / 8) / (2.0f * nbCenterLayers_);
2668+
2669+ int dx = bullEyeCornerPoints[0]->x - bullEyeCornerPoints[2]->x;
2670+ dx += dx > 0 ? 1 : -1;
2671+ int dy = bullEyeCornerPoints[0]->y - bullEyeCornerPoints[2]->y;
2672+ dy += dy > 0 ? 1 : -1;
2673+
2674+ int targetcx = ROUND(bullEyeCornerPoints[2]->x - ratio * dx);
2675+ int targetcy = ROUND(bullEyeCornerPoints[2]->y - ratio * dy);
2676+
2677+ int targetax = ROUND(bullEyeCornerPoints[0]->x + ratio * dx);
2678+ int targetay = ROUND(bullEyeCornerPoints[0]->y + ratio * dy);
2679+
2680+ dx = bullEyeCornerPoints[1]->x - bullEyeCornerPoints[3]->x;
2681+ dx += dx > 0 ? 1 : -1;
2682+ dy = bullEyeCornerPoints[1]->y - bullEyeCornerPoints[3]->y;
2683+ dy += dy > 0 ? 1 : -1;
2684+
2685+ int targetdx = ROUND(bullEyeCornerPoints[3]->x - ratio * dx);
2686+ int targetdy = ROUND(bullEyeCornerPoints[3]->y - ratio * dy);
2687+ int targetbx = ROUND(bullEyeCornerPoints[1]->x + ratio * dx);
2688+ int targetby = ROUND(bullEyeCornerPoints[1]->y + ratio * dy);
2689+
2690+ if (!isValid(targetax, targetay) ||
2691+ !isValid(targetbx, targetby) ||
2692+ !isValid(targetcx, targetcy) ||
2693+ !isValid(targetdx, targetdy)) {
2694+ throw ReaderException("matrix extends over image bounds");
2695+ }
2696+ std::vector<Ref<ResultPoint> > returnValue;
2697+ returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetax, targetay)));
2698+ returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetbx, targetby)));
2699+ returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetcx, targetcy)));
2700+ returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetdx, targetdy)));
2701+
2702+ return returnValue;
2703+
2704+}
2705+
2706+void Detector::correctParameterData(Ref<zxing::BitArray> parameterData, bool compact) {
2707+ int numCodewords;
2708+ int numDataCodewords;
2709+
2710+ if (compact) {
2711+ numCodewords = 7;
2712+ numDataCodewords = 2;
2713+ } else {
2714+ numCodewords = 10;
2715+ numDataCodewords = 4;
2716+ }
2717+
2718+ int numECCodewords = numCodewords - numDataCodewords;
2719+
2720+ ArrayRef<int> parameterWords(new Array<int>(numCodewords));
2721+
2722+ int codewordSize = 4;
2723+ for (int i = 0; i < numCodewords; i++) {
2724+ int flag = 1;
2725+ for (int j = 1; j <= codewordSize; j++) {
2726+ if (parameterData->get(codewordSize*i + codewordSize - j)) {
2727+ parameterWords[i] += flag;
2728+ }
2729+ flag <<= 1;
2730+ }
2731+ }
2732+
2733+ try {
2734+ // std::printf("parameter data reed solomon\n");
2735+ ReedSolomonDecoder rsDecoder(GenericGF::AZTEC_PARAM);
2736+ rsDecoder.decode(parameterWords, numECCodewords);
2737+ } catch (ReedSolomonException& e) {
2738+ // std::printf("reed solomon decoding failed\n");
2739+ throw ReaderException("failed to decode parameter data");
2740+ }
2741+
2742+ parameterData->clear();
2743+ for (int i = 0; i < numDataCodewords; i++) {
2744+ int flag = 1;
2745+ for (int j = 1; j <= codewordSize; j++) {
2746+ if ((parameterWords[i] & flag) == flag) {
2747+ parameterData->set(i*codewordSize+codewordSize-j);
2748+ }
2749+ flag <<= 1;
2750+ }
2751+ }
2752+}
2753+
2754+std::vector<Ref<Point> > Detector::getBullEyeCornerPoints(Ref<zxing::aztec::Point> pCenter) {
2755+ Ref<Point> pina = pCenter;
2756+ Ref<Point> pinb = pCenter;
2757+ Ref<Point> pinc = pCenter;
2758+ Ref<Point> pind = pCenter;
2759+
2760+ bool color = true;
2761+
2762+ for (nbCenterLayers_ = 1; nbCenterLayers_ < 9; nbCenterLayers_++) {
2763+ Ref<Point> pouta = getFirstDifferent(pina, color, 1, -1);
2764+ Ref<Point> poutb = getFirstDifferent(pinb, color, 1, 1);
2765+ Ref<Point> poutc = getFirstDifferent(pinc, color, -1, 1);
2766+ Ref<Point> poutd = getFirstDifferent(pind, color, -1, -1);
2767+
2768+ //d a
2769+ //
2770+ //c b
2771+
2772+ if (nbCenterLayers_ > 2) {
2773+ float q = distance(poutd, pouta) * nbCenterLayers_ / (distance(pind, pina) * (nbCenterLayers_ + 2));
2774+ if (q < 0.75 || q > 1.25 || !isWhiteOrBlackRectangle(pouta, poutb, poutc, poutd)) {
2775+ break;
2776+ }
2777+ }
2778+
2779+ pina = pouta;
2780+ pinb = poutb;
2781+ pinc = poutc;
2782+ pind = poutd;
2783+
2784+ color = !color;
2785+ }
2786+
2787+ if (nbCenterLayers_ != 5 && nbCenterLayers_ != 7) {
2788+ throw ReaderException("encountered wrong bullseye ring count");
2789+ }
2790+
2791+ compact_ = nbCenterLayers_ == 5;
2792+
2793+
2794+
2795+ float ratio = 0.75f*2 / (2*nbCenterLayers_-3);
2796+
2797+ int dx = pina->x - pind->x;
2798+ int dy = pina->y - pinc->y;
2799+
2800+ int targetcx = ROUND(pinc->x - ratio * dx);
2801+ int targetcy = ROUND(pinc->y - ratio * dy);
2802+ int targetax = ROUND(pina->x + ratio * dx);
2803+ int targetay = ROUND(pina->y + ratio * dy);
2804+
2805+ dx = pinb->x - pind->x;
2806+ dy = pinb->y - pind->y;
2807+
2808+ int targetdx = ROUND(pind->x - ratio * dx);
2809+ int targetdy = ROUND(pind->y - ratio * dy);
2810+ int targetbx = ROUND(pinb->x + ratio * dx);
2811+ int targetby = ROUND(pinb->y + ratio * dy);
2812+
2813+ if (!isValid(targetax, targetay) ||
2814+ !isValid(targetbx, targetby) ||
2815+ !isValid(targetcx, targetcy) ||
2816+ !isValid(targetdx, targetdy)) {
2817+ throw ReaderException("bullseye extends over image bounds");
2818+ }
2819+
2820+ std::vector<Ref<Point> > returnValue;
2821+ returnValue.push_back(Ref<Point>(new Point(targetax, targetay)));
2822+ returnValue.push_back(Ref<Point>(new Point(targetbx, targetby)));
2823+ returnValue.push_back(Ref<Point>(new Point(targetcx, targetcy)));
2824+ returnValue.push_back(Ref<Point>(new Point(targetdx, targetdy)));
2825+
2826+ return returnValue;
2827+
2828+}
2829+
2830+Ref<Point> Detector::getMatrixCenter() {
2831+ Ref<ResultPoint> pointA, pointB, pointC, pointD;
2832+ try {
2833+
2834+ std::vector<Ref<ResultPoint> > cornerPoints = WhiteRectangleDetector(image_).detect();
2835+ pointA = cornerPoints[0];
2836+ pointB = cornerPoints[1];
2837+ pointC = cornerPoints[2];
2838+ pointD = cornerPoints[3];
2839+
2840+ } catch (NotFoundException& e) {
2841+
2842+ int cx = image_->getWidth() / 2;
2843+ int cy = image_->getHeight() / 2;
2844+
2845+ pointA = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy-15/2)), false, 1, -1)->toResultPoint();
2846+ pointB = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy+15/2)), false, 1, 1)->toResultPoint();
2847+ pointC = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy+15/2)), false, -1, -1)->toResultPoint();
2848+ pointD = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy-15/2)), false, -1, -1)->toResultPoint();
2849+
2850+ }
2851+
2852+ int cx = ROUND((pointA->getX() + pointD->getX() + pointB->getX() + pointC->getX()) / 4);
2853+ int cy = ROUND((pointA->getY() + pointD->getY() + pointB->getY() + pointC->getY()) / 4);
2854+
2855+ try {
2856+
2857+ std::vector<Ref<ResultPoint> > cornerPoints = WhiteRectangleDetector(image_, 15, cx, cy).detect();
2858+ pointA = cornerPoints[0];
2859+ pointB = cornerPoints[1];
2860+ pointC = cornerPoints[2];
2861+ pointD = cornerPoints[3];
2862+
2863+ } catch (NotFoundException& e) {
2864+
2865+ pointA = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy-15/2)), false, 1, -1)->toResultPoint();
2866+ pointB = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy+15/2)), false, 1, 1)->toResultPoint();
2867+ pointC = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy+15/2)), false, -1, -1)->toResultPoint();
2868+ pointD = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy-15/2)), false, -1, -1)->toResultPoint();
2869+
2870+ }
2871+
2872+ cx = ROUND((pointA->getX() + pointD->getX() + pointB->getX() + pointC->getX()) / 4);
2873+ cy = ROUND((pointA->getY() + pointD->getY() + pointB->getY() + pointC->getY()) / 4);
2874+
2875+ return Ref<Point>(new Point(cx, cy));
2876+
2877+}
2878+
2879+Ref<BitMatrix> Detector::sampleGrid(Ref<zxing::BitMatrix> image,
2880+ Ref<zxing::ResultPoint> topLeft,
2881+ Ref<zxing::ResultPoint> bottomLeft,
2882+ Ref<zxing::ResultPoint> bottomRight,
2883+ Ref<zxing::ResultPoint> topRight) {
2884+ int dimension;
2885+ if (compact_) {
2886+ dimension = 4 * nbLayers_+11;
2887+ } else {
2888+ if (nbLayers_ <= 4) {
2889+ dimension = 4 * nbLayers_ + 15;
2890+ } else {
2891+ dimension = 4 * nbLayers_ + 2 * ((nbLayers_-4)/8 + 1) + 15;
2892+ }
2893+ }
2894+
2895+ GridSampler sampler = GridSampler::getInstance();
2896+
2897+ return sampler.sampleGrid(image,
2898+ dimension,
2899+ 0.5f,
2900+ 0.5f,
2901+ dimension - 0.5f,
2902+ 0.5f,
2903+ dimension - 0.5f,
2904+ dimension - 0.5f,
2905+ 0.5f,
2906+ dimension - 0.5f,
2907+ topLeft->getX(),
2908+ topLeft->getY(),
2909+ topRight->getX(),
2910+ topRight->getY(),
2911+ bottomRight->getX(),
2912+ bottomRight->getY(),
2913+ bottomLeft->getX(),
2914+ bottomLeft->getY());
2915+}
2916+
2917+void Detector::getParameters(Ref<zxing::BitArray> parameterData) {
2918+ nbLayers_ = 0;
2919+ nbDataBlocks_ = 0;
2920+
2921+ int nbBitsForNbLayers;
2922+ int nbBitsForNbDatablocks;
2923+
2924+ if (compact_) {
2925+ nbBitsForNbLayers = 2;
2926+ nbBitsForNbDatablocks = 6;
2927+ } else {
2928+ nbBitsForNbLayers = 5;
2929+ nbBitsForNbDatablocks = 11;
2930+ }
2931+
2932+ for (int i = 0; i < nbBitsForNbLayers; i++) {
2933+ nbLayers_ <<= 1;
2934+ if (parameterData->get(i)) {
2935+ nbLayers_ += 1;
2936+ }
2937+ }
2938+
2939+ for (int i = nbBitsForNbLayers; i < nbBitsForNbLayers + nbBitsForNbDatablocks; i++) {
2940+ nbDataBlocks_ <<= 1;
2941+ if (parameterData->get(i)) {
2942+ nbDataBlocks_ += 1;
2943+ }
2944+ }
2945+
2946+ nbLayers_ ++;
2947+ nbDataBlocks_ ++;
2948+}
2949+
2950+Ref<BitArray> Detector::sampleLine(Ref<zxing::aztec::Point> p1, Ref<zxing::aztec::Point> p2, int size) {
2951+ Ref<BitArray> res(new BitArray(size));
2952+
2953+ float d = distance(p1, p2);
2954+ float moduleSize = d / (size-1);
2955+ float dx = moduleSize * (p2->x - p1->x)/d;
2956+ float dy = moduleSize * (p2->y - p1->y)/d;
2957+
2958+ float px = p1->x;
2959+ float py = p1->y;
2960+
2961+ for (int i = 0; i < size; i++) {
2962+ if (image_->get(ROUND(px), ROUND(py))) res->set(i);
2963+ px += dx;
2964+ py += dy;
2965+ }
2966+
2967+ return res;
2968+}
2969+
2970+bool Detector::isWhiteOrBlackRectangle(Ref<zxing::aztec::Point> p1,
2971+ Ref<zxing::aztec::Point> p2,
2972+ Ref<zxing::aztec::Point> p3,
2973+ Ref<zxing::aztec::Point> p4) {
2974+ int corr = 3;
2975+
2976+ p1 = new Point(p1->x - corr, p1->y + corr);
2977+ p2 = new Point(p2->x - corr, p2->y - corr);
2978+ p3 = new Point(p3->x + corr, p3->y - corr);
2979+ p4 = new Point(p4->x + corr, p4->y + corr);
2980+
2981+ int cInit = getColor(p4, p1);
2982+
2983+ if (cInit == 0) {
2984+ return false;
2985+ }
2986+
2987+ int c = getColor(p1, p2);
2988+
2989+ if (c != cInit) {
2990+ return false;
2991+ }
2992+
2993+ c = getColor(p2, p3);
2994+
2995+ if (c != cInit) {
2996+ return false;
2997+ }
2998+
2999+ c = getColor(p3, p4);
3000+
3001+ if (c != cInit) {
3002+ return false;
3003+ }
3004+
3005+ return true;
3006+}
3007+
3008+int Detector::getColor(Ref<zxing::aztec::Point> p1, Ref<zxing::aztec::Point> p2) {
3009+ float d = distance(p1, p2);
3010+
3011+ float dx = (p2->x - p1->x) / d;
3012+ float dy = (p2->y - p1->y) / d;
3013+
3014+ int error = 0;
3015+
3016+ float px = p1->x;
3017+ float py = p1->y;
3018+
3019+ bool colorModel = image_->get(p1->x, p1->y);
3020+
3021+ for (int i = 0; i < d; i++) {
3022+ px += dx;
3023+ py += dy;
3024+ if (image_->get(ROUND(px), ROUND(py)) != colorModel) {
3025+ error ++;
3026+ }
3027+ }
3028+
3029+ float errRatio = (float)error/d;
3030+
3031+
3032+ if (errRatio > 0.1 && errRatio < 0.9) {
3033+ return 0;
3034+ }
3035+
3036+ if (errRatio <= 0.1) {
3037+ return colorModel?1:-1;
3038+ } else {
3039+ return colorModel?-1:1;
3040+ }
3041+}
3042+
3043+Ref<Point> Detector::getFirstDifferent(Ref<zxing::aztec::Point> init, bool color, int dx, int dy) {
3044+ int x = init->x + dx;
3045+ int y = init->y + dy;
3046+
3047+ while (isValid(x, y) && image_->get(x, y) == color) {
3048+ x += dx;
3049+ y += dy;
3050+ }
3051+
3052+ x -= dx;
3053+ y -= dy;
3054+
3055+ while (isValid(x, y) && image_->get(x, y) == color) {
3056+ x += dx;
3057+ }
3058+
3059+ x -= dx;
3060+
3061+ while (isValid(x, y) && image_->get(x, y) == color) {
3062+ y += dy;
3063+ }
3064+
3065+ y -= dy;
3066+
3067+ return Ref<Point>(new Point(x, y));
3068+}
3069+
3070+bool Detector::isValid(int x, int y) {
3071+ return x >= 0 && x < (int)image_->getWidth() && y > 0 && y < (int)image_->getHeight();
3072+}
3073+
3074+float Detector::distance(Ref<zxing::aztec::Point> a, Ref<zxing::aztec::Point> b) {
3075+ return sqrtf((float)((a->x - b->x) * (a->x - b->x) + (a->y - b->y) * (a->y - b->y)));
3076+}
3077
3078=== added file '3rdParty/zxing/aztec/detector/Detector.h'
3079--- 3rdParty/zxing/aztec/detector/Detector.h 1970-01-01 00:00:00 +0000
3080+++ 3rdParty/zxing/aztec/detector/Detector.h 2014-05-10 17:37:18 +0000
3081@@ -0,0 +1,87 @@
3082+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
3083+/*
3084+ * Detector.h
3085+ * zxing
3086+ *
3087+ * Created by Lukas Stabe on 08/02/2012.
3088+ * Copyright 2012 ZXing authors All rights reserved.
3089+ *
3090+ * Licensed under the Apache License, Version 2.0 (the "License");
3091+ * you may not use this file except in compliance with the License.
3092+ * You may obtain a copy of the License at
3093+ *
3094+ * http://www.apache.org/licenses/LICENSE-2.0
3095+ *
3096+ * Unless required by applicable law or agreed to in writing, software
3097+ * distributed under the License is distributed on an "AS IS" BASIS,
3098+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3099+ * See the License for the specific language governing permissions and
3100+ * limitations under the License.
3101+ */
3102+
3103+
3104+#include <vector>
3105+
3106+#include <zxing/common/BitArray.h>
3107+#include <zxing/ResultPoint.h>
3108+#include <zxing/common/BitMatrix.h>
3109+#include <zxing/DecodeHints.h>
3110+#include <zxing/aztec/AztecDetectorResult.h>
3111+
3112+#define ROUND(a) ((int)(a + 0.5f))
3113+
3114+namespace zxing {
3115+ namespace aztec {
3116+
3117+ class Point : public Counted {
3118+ public:
3119+ int x;
3120+ int y;
3121+
3122+ Ref<ResultPoint> toResultPoint() {
3123+ return Ref<ResultPoint>(new ResultPoint(x, y));
3124+ }
3125+
3126+ Point(int ax, int ay):x(ax),y(ay) {};
3127+
3128+ };
3129+
3130+ class Detector : public Counted {
3131+
3132+ private:
3133+ Ref<BitMatrix> image_;
3134+
3135+ bool compact_;
3136+ int nbLayers_;
3137+ int nbDataBlocks_;
3138+ int nbCenterLayers_;
3139+ int shift_;
3140+
3141+ void extractParameters(std::vector<Ref<Point> > bullEyeCornerPoints);
3142+ std::vector<Ref<ResultPoint> > getMatrixCornerPoints(std::vector<Ref<Point> > bullEyeCornerPoints);
3143+ static void correctParameterData(Ref<BitArray> parameterData, bool compact);
3144+ std::vector<Ref<Point> > getBullEyeCornerPoints(Ref<Point> pCenter);
3145+ Ref<Point> getMatrixCenter();
3146+ Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image,
3147+ Ref<ResultPoint> topLeft,
3148+ Ref<ResultPoint> bottomLeft,
3149+ Ref<ResultPoint> bottomRight,
3150+ Ref<ResultPoint> topRight);
3151+ void getParameters(Ref<BitArray> parameterData);
3152+ Ref<BitArray> sampleLine(Ref<Point> p1, Ref<Point> p2, int size);
3153+ bool isWhiteOrBlackRectangle(Ref<Point> p1,
3154+ Ref<Point> p2,
3155+ Ref<Point> p3,
3156+ Ref<Point> p4);
3157+ int getColor(Ref<Point> p1, Ref<Point> p2);
3158+ Ref<Point> getFirstDifferent(Ref<Point> init, bool color, int dx, int dy);
3159+ bool isValid(int x, int y);
3160+ static float distance(Ref<Point> a, Ref<Point> b);
3161+
3162+ public:
3163+ Detector(Ref<BitMatrix> image);
3164+ Ref<AztecDetectorResult> detect();
3165+ };
3166+
3167+ }
3168+}
3169
3170=== added directory '3rdParty/zxing/common'
3171=== added file '3rdParty/zxing/common/Array.cpp'
3172--- 3rdParty/zxing/common/Array.cpp 1970-01-01 00:00:00 +0000
3173+++ 3rdParty/zxing/common/Array.cpp 2014-05-10 17:37:18 +0000
3174@@ -0,0 +1,22 @@
3175+/*
3176+ * Array.cpp
3177+ * zxing
3178+ *
3179+ * Created by Christian Brunschen on 07/05/2008.
3180+ * Copyright 2008 Google UK. All rights reserved.
3181+ *
3182+ * Licensed under the Apache License, Version 2.0 (the "License");
3183+ * you may not use this file except in compliance with the License.
3184+ * You may obtain a copy of the License at
3185+ *
3186+ * http://www.apache.org/licenses/LICENSE-2.0
3187+ *
3188+ * Unless required by applicable law or agreed to in writing, software
3189+ * distributed under the License is distributed on an "AS IS" BASIS,
3190+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3191+ * See the License for the specific language governing permissions and
3192+ * limitations under the License.
3193+ */
3194+
3195+#include <zxing/common/Array.h>
3196+
3197
3198=== added file '3rdParty/zxing/common/Array.h'
3199--- 3rdParty/zxing/common/Array.h 1970-01-01 00:00:00 +0000
3200+++ 3rdParty/zxing/common/Array.h 2014-05-10 17:37:18 +0000
3201@@ -0,0 +1,208 @@
3202+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
3203+#ifndef __ARRAY_H__
3204+#define __ARRAY_H__
3205+
3206+/*
3207+ * Array.h
3208+ * zxing
3209+ *
3210+ * Copyright 2010 ZXing authors All rights reserved.
3211+ *
3212+ * Licensed under the Apache License, Version 2.0 (the "License");
3213+ * you may not use this file except in compliance with the License.
3214+ * You may obtain a copy of the License at
3215+ *
3216+ * http://www.apache.org/licenses/LICENSE-2.0
3217+ *
3218+ * Unless required by applicable law or agreed to in writing, software
3219+ * distributed under the License is distributed on an "AS IS" BASIS,
3220+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3221+ * See the License for the specific language governing permissions and
3222+ * limitations under the License.
3223+ */
3224+
3225+#include <vector>
3226+
3227+#ifdef DEBUG_COUNTING
3228+#include <iostream>
3229+#include <typeinfo>
3230+#endif
3231+
3232+#include <zxing/common/Counted.h>
3233+
3234+
3235+namespace zxing {
3236+
3237+template<typename T> class Array : public Counted {
3238+protected:
3239+public:
3240+ std::vector<T> values_;
3241+ Array(size_t n) :
3242+ Counted(), values_(n, T()) {
3243+ }
3244+ Array(T *ts, size_t n) :
3245+ Counted(), values_(ts, ts+n) {
3246+ }
3247+ Array(T v, size_t n) :
3248+ Counted(), values_(n, v) {
3249+ }
3250+ Array(std::vector<T> &v) :
3251+ Counted(), values_(v) {
3252+ }
3253+ Array(Array<T> &other) :
3254+ Counted(), values_(other.values_) {
3255+ }
3256+ Array(Array<T> *other) :
3257+ Counted(), values_(other->values_) {
3258+ }
3259+ virtual ~Array() {
3260+ }
3261+ Array<T>& operator=(const Array<T> &other) {
3262+#ifdef DEBUG_COUNTING
3263+ cout << "assigning values from Array " << &other << " to this Array " << this << ", ";
3264+#endif
3265+ values_ = other.values_;
3266+#ifdef DEBUG_COUNTING
3267+ cout << "new size = " << values_.size() << "\n";
3268+#endif
3269+ return *this;
3270+ }
3271+ Array<T>& operator=(const std::vector<T> &array) {
3272+#ifdef DEBUG_COUNTING
3273+ cout << "assigning values from Array " << &array << " to this Array " << this << ", ";
3274+#endif
3275+ values_ = array;
3276+#ifdef DEBUG_COUNTING
3277+ cout << "new size = " << values_.size() << "\n";
3278+#endif
3279+ return *this;
3280+ }
3281+ T operator[](size_t i) const {
3282+ return values_[i];
3283+ }
3284+ T& operator[](size_t i) {
3285+ return values_[i];
3286+ }
3287+ size_t size() const {
3288+ return values_.size();
3289+ }
3290+ std::vector<T> values() const {
3291+ return values_;
3292+ }
3293+ std::vector<T>& values() {
3294+ return values_;
3295+ }
3296+};
3297+
3298+template<typename T> class ArrayRef : public Counted {
3299+private:
3300+public:
3301+ Array<T> *array_;
3302+ ArrayRef() :
3303+ array_(0) {
3304+#ifdef DEBUG_COUNTING
3305+ cout << "instantiating empty ArrayRef " << this << "\n";
3306+#endif
3307+ }
3308+ ArrayRef(size_t n) :
3309+ array_(0) {
3310+#ifdef DEBUG_COUNTING
3311+ cout << "instantiating ArrayRef " << this << "with size " << n << "\n";
3312+#endif
3313+ reset(new Array<T> (n));
3314+ }
3315+ ArrayRef(T *ts, size_t n) :
3316+ array_(0) {
3317+#ifdef DEBUG_COUNTING
3318+ cout << "instantiating ArrayRef " << this << "with " << n << " elements at " << (void *)ts << "\n";
3319+#endif
3320+ reset(new Array<T> (ts, n));
3321+ }
3322+ ArrayRef(Array<T> *a) :
3323+ array_(0) {
3324+#ifdef DEBUG_COUNTING
3325+ cout << "instantiating ArrayRef " << this << " from pointer:\n";
3326+#endif
3327+ reset(a);
3328+ }
3329+ ArrayRef(const Array<T> &a) :
3330+ array_(0) {
3331+#ifdef DEBUG_COUNTING
3332+ cout << "instantiating ArrayRef " << this << " from reference to Array " << (void *)&a << ":\n";
3333+#endif
3334+ reset(const_cast<Array<T> *>(&a));
3335+ }
3336+ ArrayRef(const ArrayRef &other) :
3337+ Counted(), array_(0) {
3338+#ifdef DEBUG_COUNTING
3339+ cout << "instantiating ArrayRef " << this << " from ArrayRef " << &other << ":\n";
3340+#endif
3341+ reset(other.array_);
3342+ }
3343+
3344+ template<class Y>
3345+ ArrayRef(const ArrayRef<Y> &other) :
3346+ array_(0) {
3347+#ifdef DEBUG_COUNTING
3348+ cout << "instantiating ArrayRef " << this << " from ArrayRef " << &other << ":\n";
3349+#endif
3350+ reset(static_cast<const Array<T> *>(other.array_));
3351+ }
3352+
3353+ ~ArrayRef() {
3354+#ifdef DEBUG_COUNTING
3355+ cout << "destroying ArrayRef " << this << " with " << (array_ ? typeid(*array_).name() : "NULL") << " "
3356+ << array_ << "\n";
3357+#endif
3358+ if (array_) {
3359+ array_->release();
3360+ }
3361+ array_ = 0;
3362+ }
3363+
3364+ T operator[](size_t i) const {
3365+ return (*array_)[i];
3366+ }
3367+ T& operator[](size_t i) {
3368+ return (*array_)[i];
3369+ }
3370+ size_t size() const {
3371+ return array_->size();
3372+ }
3373+
3374+ void reset(Array<T> *a) {
3375+#ifdef DEBUG_COUNTING
3376+ cout << "resetting ArrayRef " << this << " from " << (array_ ? typeid(*array_).name() : "NULL") << " "
3377+ << array_ << " to " << (a ? typeid(*a).name() : "NULL") << " " << a << "\n";
3378+#endif
3379+ if (a) {
3380+ a->retain();
3381+ }
3382+ if (array_) {
3383+ array_->release();
3384+ }
3385+ array_ = a;
3386+ }
3387+ void reset(const ArrayRef<T> &other) {
3388+ reset(other.array_);
3389+ }
3390+ ArrayRef<T>& operator=(const ArrayRef<T> &other) {
3391+ reset(other);
3392+ return *this;
3393+ }
3394+ ArrayRef<T>& operator=(Array<T> *a) {
3395+ reset(a);
3396+ return *this;
3397+ }
3398+
3399+ Array<T>& operator*() {
3400+ return *array_;
3401+ }
3402+ Array<T>* operator->() {
3403+ return array_;
3404+ }
3405+};
3406+
3407+} // namespace zxing
3408+
3409+#endif // __ARRAY_H__
3410
3411=== added file '3rdParty/zxing/common/BitArray.cpp'
3412--- 3rdParty/zxing/common/BitArray.cpp 1970-01-01 00:00:00 +0000
3413+++ 3rdParty/zxing/common/BitArray.cpp 2014-05-10 17:37:18 +0000
3414@@ -0,0 +1,127 @@
3415+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
3416+/*
3417+ * Copyright 2010 ZXing authors. All rights reserved.
3418+ *
3419+ * Licensed under the Apache License, Version 2.0 (the "License");
3420+ * you may not use this file except in compliance with the License.
3421+ * You may obtain a copy of the License at
3422+ *
3423+ * http://www.apache.org/licenses/LICENSE-2.0
3424+ *
3425+ * Unless required by applicable law or agreed to in writing, software
3426+ * distributed under the License is distributed on an "AS IS" BASIS,
3427+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3428+ * See the License for the specific language governing permissions and
3429+ * limitations under the License.
3430+ */
3431+
3432+#include <zxing/common/BitArray.h>
3433+
3434+using namespace std;
3435+
3436+namespace zxing {
3437+
3438+
3439+size_t BitArray::wordsForBits(size_t bits) {
3440+ int arraySize = (bits + bitsPerWord_ - 1) >> logBits_;
3441+ return arraySize;
3442+}
3443+
3444+BitArray::BitArray(size_t size) :
3445+ size_(size), bits_(wordsForBits(size), (const unsigned int)0) {
3446+}
3447+
3448+BitArray::~BitArray() {
3449+}
3450+
3451+size_t BitArray::getSize() {
3452+ return size_;
3453+}
3454+
3455+void BitArray::setBulk(size_t i, unsigned int newBits) {
3456+ bits_[i >> logBits_] = newBits;
3457+}
3458+
3459+void BitArray::setRange(int start, int end) {
3460+ if (end < start) {
3461+ throw IllegalArgumentException("invalid call to BitArray::setRange");
3462+ }
3463+ if (end == start) {
3464+ return;
3465+ }
3466+ end--; // will be easier to treat this as the last actually set bit -- inclusive
3467+ int firstInt = start >> 5;
3468+ int lastInt = end >> 5;
3469+ for (int i = firstInt; i <= lastInt; i++) {
3470+ int firstBit = i > firstInt ? 0 : start & 0x1F;
3471+ int lastBit = i < lastInt ? 31 : end & 0x1F;
3472+ int mask;
3473+ if (firstBit == 0 && lastBit == 31) {
3474+ mask = -1;
3475+ } else {
3476+ mask = 0;
3477+ for (int j = firstBit; j <= lastBit; j++) {
3478+ mask |= 1 << j;
3479+ }
3480+ }
3481+ bits_[i] |= mask;
3482+ }
3483+}
3484+
3485+void BitArray::clear() {
3486+ size_t max = bits_.size();
3487+ for (size_t i = 0; i < max; i++) {
3488+ bits_[i] = 0;
3489+ }
3490+}
3491+
3492+bool BitArray::isRange(size_t start, size_t end, bool value) {
3493+ if (end < start) {
3494+ throw IllegalArgumentException("end must be after start");
3495+ }
3496+ if (end == start) {
3497+ return true;
3498+ }
3499+ // treat the 'end' as inclusive, rather than exclusive
3500+ end--;
3501+ size_t firstWord = start >> logBits_;
3502+ size_t lastWord = end >> logBits_;
3503+ for (size_t i = firstWord; i <= lastWord; i++) {
3504+ size_t firstBit = i > firstWord ? 0 : start & bitsMask_;
3505+ size_t lastBit = i < lastWord ? bitsPerWord_ - 1: end & bitsMask_;
3506+ unsigned int mask;
3507+ if (firstBit == 0 && lastBit == bitsPerWord_ - 1) {
3508+ mask = numeric_limits<unsigned int>::max();
3509+ } else {
3510+ mask = 0;
3511+ for (size_t j = firstBit; j <= lastBit; j++) {
3512+ mask |= 1 << j;
3513+ }
3514+ }
3515+ if (value) {
3516+ if ((bits_[i] & mask) != mask) {
3517+ return false;
3518+ }
3519+ } else {
3520+ if ((bits_[i] & mask) != 0) {
3521+ return false;
3522+ }
3523+ }
3524+ }
3525+ return true;
3526+}
3527+
3528+vector<unsigned int>& BitArray::getBitArray() {
3529+ return bits_;
3530+}
3531+
3532+void BitArray::reverse() {
3533+ std::vector<unsigned int> newBits(bits_.size(),(const unsigned int) 0);
3534+ for (size_t i = 0; i < size_; i++) {
3535+ if (get(size_ - i - 1)) {
3536+ newBits[i >> logBits_] |= 1<< (i & bitsMask_);
3537+ }
3538+ }
3539+ bits_ = newBits;
3540+}
3541+}
3542
3543=== added file '3rdParty/zxing/common/BitArray.h'
3544--- 3rdParty/zxing/common/BitArray.h 1970-01-01 00:00:00 +0000
3545+++ 3rdParty/zxing/common/BitArray.h 2014-05-10 17:37:18 +0000
3546@@ -0,0 +1,70 @@
3547+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
3548+#ifndef __BIT_ARRAY_H__
3549+#define __BIT_ARRAY_H__
3550+
3551+/*
3552+ * Copyright 2010 ZXing authors. All rights reserved.
3553+ *
3554+ * Licensed under the Apache License, Version 2.0 (the "License");
3555+ * you may not use this file except in compliance with the License.
3556+ * You may obtain a copy of the License at
3557+ *
3558+ * http://www.apache.org/licenses/LICENSE-2.0
3559+ *
3560+ * Unless required by applicable law or agreed to in writing, software
3561+ * distributed under the License is distributed on an "AS IS" BASIS,
3562+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3563+ * See the License for the specific language governing permissions and
3564+ * limitations under the License.
3565+ */
3566+
3567+#include <zxing/common/Counted.h>
3568+#include <zxing/common/IllegalArgumentException.h>
3569+#include <vector>
3570+#include <limits>
3571+
3572+namespace zxing {
3573+
3574+#define ZX_LOG_DIGITS(digits) \
3575+ ((digits == 8) ? 3 : \
3576+ ((digits == 16) ? 4 : \
3577+ ((digits == 32) ? 5 : \
3578+ ((digits == 64) ? 6 : \
3579+ ((digits == 128) ? 7 : \
3580+ (-1))))))
3581+
3582+class BitArray : public Counted {
3583+private:
3584+ size_t size_;
3585+ std::vector<unsigned int> bits_;
3586+ static const unsigned int bitsPerWord_ =
3587+ std::numeric_limits<unsigned int>::digits;
3588+ static const unsigned int logBits_ = ZX_LOG_DIGITS(bitsPerWord_);
3589+ static const unsigned int bitsMask_ = (1 << logBits_) - 1;
3590+ static size_t wordsForBits(size_t bits);
3591+ explicit BitArray();
3592+
3593+public:
3594+ BitArray(size_t size);
3595+ ~BitArray();
3596+ size_t getSize();
3597+
3598+ bool get(size_t i) {
3599+ return (bits_[i >> logBits_] & (1 << (i & bitsMask_))) != 0;
3600+ }
3601+
3602+ void set(size_t i) {
3603+ bits_[i >> logBits_] |= 1 << (i & bitsMask_);
3604+ }
3605+
3606+ void setBulk(size_t i, unsigned int newBits);
3607+ void setRange(int start, int end);
3608+ void clear();
3609+ bool isRange(size_t start, size_t end, bool value);
3610+ std::vector<unsigned int>& getBitArray();
3611+ void reverse();
3612+};
3613+
3614+}
3615+
3616+#endif // __BIT_ARRAY_H__
3617
3618=== added file '3rdParty/zxing/common/BitMatrix.cpp'
3619--- 3rdParty/zxing/common/BitMatrix.cpp 1970-01-01 00:00:00 +0000
3620+++ 3rdParty/zxing/common/BitMatrix.cpp 2014-05-10 17:37:18 +0000
3621@@ -0,0 +1,157 @@
3622+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
3623+/*
3624+ * Copyright 2010 ZXing authors. All rights reserved.
3625+ *
3626+ * Licensed under the Apache License, Version 2.0 (the "License");
3627+ * you may not use this file except in compliance with the License.
3628+ * You may obtain a copy of the License at
3629+ *
3630+ * http://www.apache.org/licenses/LICENSE-2.0
3631+ *
3632+ * Unless required by applicable law or agreed to in writing, software
3633+ * distributed under the License is distributed on an "AS IS" BASIS,
3634+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3635+ * See the License for the specific language governing permissions and
3636+ * limitations under the License.
3637+ */
3638+
3639+#include <zxing/common/BitMatrix.h>
3640+#include <zxing/common/IllegalArgumentException.h>
3641+
3642+#include <iostream>
3643+#include <sstream>
3644+#include <string>
3645+
3646+using std::ostream;
3647+using std::ostringstream;
3648+
3649+using zxing::BitMatrix;
3650+using zxing::BitArray;
3651+using zxing::Ref;
3652+
3653+namespace {
3654+ size_t wordsForSize(size_t width,
3655+ size_t height,
3656+ unsigned int bitsPerWord,
3657+ unsigned int logBits) {
3658+ size_t bits = width * height;
3659+ int arraySize = (bits + bitsPerWord - 1) >> logBits;
3660+ return arraySize;
3661+ }
3662+}
3663+
3664+BitMatrix::BitMatrix(size_t dimension) :
3665+ width_(dimension), height_(dimension), words_(0), bits_(NULL) {
3666+ words_ = wordsForSize(width_, height_, bitsPerWord, logBits);
3667+ bits_ = new unsigned int[words_];
3668+ clear();
3669+}
3670+
3671+BitMatrix::BitMatrix(size_t width, size_t height) :
3672+ width_(width), height_(height), words_(0), bits_(NULL) {
3673+ words_ = wordsForSize(width_, height_, bitsPerWord, logBits);
3674+ bits_ = new unsigned int[words_];
3675+ clear();
3676+}
3677+
3678+BitMatrix::~BitMatrix() {
3679+ delete[] bits_;
3680+}
3681+
3682+
3683+void BitMatrix::flip(size_t x, size_t y) {
3684+ size_t offset = x + width_ * y;
3685+ bits_[offset >> logBits] ^= 1 << (offset & bitsMask);
3686+}
3687+
3688+void BitMatrix::clear() {
3689+ std::fill(bits_, bits_+words_, 0);
3690+}
3691+
3692+void BitMatrix::setRegion(size_t left, size_t top, size_t width, size_t height) {
3693+ if ((long)top < 0 || (long)left < 0) {
3694+ throw IllegalArgumentException("topI and leftJ must be nonnegative");
3695+ }
3696+ if (height < 1 || width < 1) {
3697+ throw IllegalArgumentException("height and width must be at least 1");
3698+ }
3699+ size_t right = left + width;
3700+ size_t bottom = top + height;
3701+ if (right > width_ || bottom > height_) {
3702+ throw IllegalArgumentException("top + height and left + width must be <= matrix dimension");
3703+ }
3704+ for (size_t y = top; y < bottom; y++) {
3705+ int yOffset = width_ * y;
3706+ for (size_t x = left; x < right; x++) {
3707+ size_t offset = x + yOffset;
3708+ bits_[offset >> logBits] |= 1 << (offset & bitsMask);
3709+ }
3710+ }
3711+}
3712+
3713+Ref<BitArray> BitMatrix::getRow(int y, Ref<BitArray> row) {
3714+ if (row.empty() || row->getSize() < width_) {
3715+ row = new BitArray(width_);
3716+ } else {
3717+ row->clear();
3718+ }
3719+ size_t start = y * width_;
3720+ size_t end = start + width_ - 1; // end is inclusive
3721+ size_t firstWord = start >> logBits;
3722+ size_t lastWord = end >> logBits;
3723+ size_t bitOffset = start & bitsMask;
3724+ for (size_t i = firstWord; i <= lastWord; i++) {
3725+ size_t firstBit = i > firstWord ? 0 : start & bitsMask;
3726+ size_t lastBit = i < lastWord ? bitsPerWord - 1 : end & bitsMask;
3727+ unsigned int mask;
3728+ if (firstBit == 0 && lastBit == logBits) {
3729+ mask = std::numeric_limits<unsigned int>::max();
3730+ } else {
3731+ mask = 0;
3732+ for (size_t j = firstBit; j <= lastBit; j++) {
3733+ mask |= 1 << j;
3734+ }
3735+ }
3736+ row->setBulk((i - firstWord) << logBits, (bits_[i] & mask) >> bitOffset);
3737+ if (firstBit == 0 && bitOffset != 0) {
3738+ unsigned int prevBulk = row->getBitArray()[i - firstWord - 1];
3739+ prevBulk |= (bits_[i] & mask) << (bitsPerWord - bitOffset);
3740+ row->setBulk((i - firstWord - 1) << logBits, prevBulk);
3741+ }
3742+ }
3743+ return row;
3744+}
3745+
3746+size_t BitMatrix::getWidth() const {
3747+ return width_;
3748+}
3749+
3750+size_t BitMatrix::getHeight() const {
3751+ return height_;
3752+}
3753+
3754+size_t BitMatrix::getDimension() const {
3755+ return width_;
3756+}
3757+
3758+unsigned int* BitMatrix::getBits() const {
3759+ return bits_;
3760+}
3761+
3762+namespace zxing {
3763+ ostream& operator<<(ostream &out, const BitMatrix &bm) {
3764+ for (size_t y = 0; y < bm.height_; y++) {
3765+ for (size_t x = 0; x < bm.width_; x++) {
3766+ out << (bm.get(x, y) ? "X " : " ");
3767+ }
3768+ out << "\n";
3769+ }
3770+ return out;
3771+ }
3772+}
3773+
3774+const char* BitMatrix::description() {
3775+ ostringstream out;
3776+ out << *this;
3777+ return out.str().c_str();
3778+}
3779
3780=== added file '3rdParty/zxing/common/BitMatrix.h'
3781--- 3rdParty/zxing/common/BitMatrix.h 1970-01-01 00:00:00 +0000
3782+++ 3rdParty/zxing/common/BitMatrix.h 2014-05-10 17:37:18 +0000
3783@@ -0,0 +1,87 @@
3784+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
3785+#ifndef __BIT_MATRIX_H__
3786+#define __BIT_MATRIX_H__
3787+
3788+/*
3789+ * BitMatrix.h
3790+ * zxing
3791+ *
3792+ * Copyright 2010 ZXing authors All rights reserved.
3793+ *
3794+ * Licensed under the Apache License, Version 2.0 (the "License");
3795+ * you may not use this file except in compliance with the License.
3796+ * You may obtain a copy of the License at
3797+ *
3798+ * http://www.apache.org/licenses/LICENSE-2.0
3799+ *
3800+ * Unless required by applicable law or agreed to in writing, software
3801+ * distributed under the License is distributed on an "AS IS" BASIS,
3802+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3803+ * See the License for the specific language governing permissions and
3804+ * limitations under the License.
3805+ */
3806+
3807+#include <zxing/common/Counted.h>
3808+#include <zxing/common/BitArray.h>
3809+#include <limits>
3810+
3811+namespace zxing {
3812+
3813+class BitMatrix : public Counted {
3814+private:
3815+ size_t width_;
3816+ size_t height_;
3817+ size_t words_;
3818+ unsigned int* bits_;
3819+
3820+#define ZX_LOG_DIGITS(digits) \
3821+ ((digits == 8) ? 3 : \
3822+ ((digits == 16) ? 4 : \
3823+ ((digits == 32) ? 5 : \
3824+ ((digits == 64) ? 6 : \
3825+ ((digits == 128) ? 7 : \
3826+ (-1))))))
3827+
3828+ static const unsigned int bitsPerWord =
3829+ std::numeric_limits<unsigned int>::digits;
3830+ static const unsigned int logBits = ZX_LOG_DIGITS(bitsPerWord);
3831+ static const unsigned int bitsMask = (1 << logBits) - 1;
3832+
3833+public:
3834+ BitMatrix(size_t dimension);
3835+ BitMatrix(size_t width, size_t height);
3836+
3837+ ~BitMatrix();
3838+
3839+ bool get(size_t x, size_t y) const {
3840+ size_t offset = x + width_ * y;
3841+ return ((bits_[offset >> logBits] >> (offset & bitsMask)) & 0x01) != 0;
3842+ }
3843+
3844+ void set(size_t x, size_t y) {
3845+ size_t offset = x + width_ * y;
3846+ bits_[offset >> logBits] |= 1 << (offset & bitsMask);
3847+ }
3848+
3849+ void flip(size_t x, size_t y);
3850+ void clear();
3851+ void setRegion(size_t left, size_t top, size_t width, size_t height);
3852+ Ref<BitArray> getRow(int y, Ref<BitArray> row);
3853+
3854+ size_t getDimension() const;
3855+ size_t getWidth() const;
3856+ size_t getHeight() const;
3857+
3858+ unsigned int* getBits() const;
3859+
3860+ friend std::ostream& operator<<(std::ostream &out, const BitMatrix &bm);
3861+ const char *description();
3862+
3863+private:
3864+ BitMatrix(const BitMatrix&);
3865+ BitMatrix& operator =(const BitMatrix&);
3866+};
3867+
3868+}
3869+
3870+#endif // __BIT_MATRIX_H__
3871
3872=== added file '3rdParty/zxing/common/BitSource.cpp'
3873--- 3rdParty/zxing/common/BitSource.cpp 1970-01-01 00:00:00 +0000
3874+++ 3rdParty/zxing/common/BitSource.cpp 2014-05-10 17:37:18 +0000
3875@@ -0,0 +1,74 @@
3876+/*
3877+ * BitSource.cpp
3878+ * zxing
3879+ *
3880+ * Created by Christian Brunschen on 09/05/2008.
3881+ * Copyright 2008 Google UK. All rights reserved.
3882+ *
3883+ * Licensed under the Apache License, Version 2.0 (the "License");
3884+ * you may not use this file except in compliance with the License.
3885+ * You may obtain a copy of the License at
3886+ *
3887+ * http://www.apache.org/licenses/LICENSE-2.0
3888+ *
3889+ * Unless required by applicable law or agreed to in writing, software
3890+ * distributed under the License is distributed on an "AS IS" BASIS,
3891+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3892+ * See the License for the specific language governing permissions and
3893+ * limitations under the License.
3894+ */
3895+
3896+#include <zxing/common/BitSource.h>
3897+#include <zxing/common/IllegalArgumentException.h>
3898+
3899+namespace zxing {
3900+
3901+int BitSource::readBits(int numBits) {
3902+ if (numBits < 0 || numBits > 32) {
3903+ throw IllegalArgumentException("cannot read <1 or >32 bits");
3904+ } else if (numBits > available()) {
3905+ throw IllegalArgumentException("reading more bits than are available");
3906+ }
3907+
3908+ int result = 0;
3909+
3910+ // First, read remainder from current byte
3911+ if (bitOffset_ > 0) {
3912+ int bitsLeft = 8 - bitOffset_;
3913+ int toRead = numBits < bitsLeft ? numBits : bitsLeft;
3914+ int bitsToNotRead = bitsLeft - toRead;
3915+ int mask = (0xFF >> (8 - toRead)) << bitsToNotRead;
3916+ result = (bytes_[byteOffset_] & mask) >> bitsToNotRead;
3917+ numBits -= toRead;
3918+ bitOffset_ += toRead;
3919+ if (bitOffset_ == 8) {
3920+ bitOffset_ = 0;
3921+ byteOffset_++;
3922+ }
3923+ }
3924+
3925+ // Next read whole bytes
3926+ if (numBits > 0) {
3927+ while (numBits >= 8) {
3928+ result = (result << 8) | (bytes_[byteOffset_] & 0xFF);
3929+ byteOffset_++;
3930+ numBits -= 8;
3931+ }
3932+
3933+
3934+ // Finally read a partial byte
3935+ if (numBits > 0) {
3936+ int bitsToNotRead = 8 - numBits;
3937+ int mask = (0xFF >> bitsToNotRead) << bitsToNotRead;
3938+ result = (result << numBits) | ((bytes_[byteOffset_] & mask) >> bitsToNotRead);
3939+ bitOffset_ += numBits;
3940+ }
3941+ }
3942+
3943+ return result;
3944+}
3945+
3946+int BitSource::available() {
3947+ return 8 * (bytes_.size() - byteOffset_) - bitOffset_;
3948+}
3949+}
3950
3951=== added file '3rdParty/zxing/common/BitSource.h'
3952--- 3rdParty/zxing/common/BitSource.h 1970-01-01 00:00:00 +0000
3953+++ 3rdParty/zxing/common/BitSource.h 2014-05-10 17:37:18 +0000
3954@@ -0,0 +1,70 @@
3955+#ifndef __BIT_SOURCE_H__
3956+#define __BIT_SOURCE_H__
3957+
3958+/*
3959+ * BitSource.h
3960+ * zxing
3961+ *
3962+ * Copyright 2010 ZXing authors All rights reserved.
3963+ *
3964+ * Licensed under the Apache License, Version 2.0 (the "License");
3965+ * you may not use this file except in compliance with the License.
3966+ * You may obtain a copy of the License at
3967+ *
3968+ * http://www.apache.org/licenses/LICENSE-2.0
3969+ *
3970+ * Unless required by applicable law or agreed to in writing, software
3971+ * distributed under the License is distributed on an "AS IS" BASIS,
3972+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3973+ * See the License for the specific language governing permissions and
3974+ * limitations under the License.
3975+ */
3976+
3977+#include <zxing/common/Array.h>
3978+
3979+namespace zxing {
3980+/**
3981+ * <p>This provides an easy abstraction to read bits at a time from a sequence of bytes, where the
3982+ * number of bits read is not often a multiple of 8.</p>
3983+ *
3984+ * <p>This class is not thread-safe.</p>
3985+ *
3986+ * @author srowen@google.com (Sean Owen)
3987+ * @author christian.brunschen@gmail.com (Christian Brunschen)
3988+ */
3989+class BitSource : public Counted {
3990+ typedef unsigned char byte;
3991+private:
3992+ ArrayRef<byte> bytes_;
3993+ int byteOffset_;
3994+ int bitOffset_;
3995+public:
3996+ /**
3997+ * @param bytes bytes from which this will read bits. Bits will be read from the first byte first.
3998+ * Bits are read within a byte from most-significant to least-significant bit.
3999+ */
4000+ BitSource(ArrayRef<byte> &bytes) :
4001+ bytes_(bytes), byteOffset_(0), bitOffset_(0) {
4002+ }
4003+
4004+ int getByteOffset() {
4005+ return byteOffset_;
4006+ }
4007+
4008+ /**
4009+ * @param numBits number of bits to read
4010+ * @return int representing the bits read. The bits will appear as the least-significant
4011+ * bits of the int
4012+ * @throws IllegalArgumentException if numBits isn't in [1,32]
4013+ */
4014+ int readBits(int numBits);
4015+
4016+ /**
4017+ * @return number of bits that can be read successfully
4018+ */
4019+ int available();
4020+};
4021+
4022+}
4023+
4024+#endif // __BIT_SOURCE_H__
4025
4026=== added file '3rdParty/zxing/common/CharacterSetECI.cpp'
4027--- 3rdParty/zxing/common/CharacterSetECI.cpp 1970-01-01 00:00:00 +0000
4028+++ 3rdParty/zxing/common/CharacterSetECI.cpp 2014-05-10 17:37:18 +0000
4029@@ -0,0 +1,104 @@
4030+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
4031+/*
4032+ * Copyright 2008-2011 ZXing authors
4033+ *
4034+ * Licensed under the Apache License, Version 2.0 (the "License");
4035+ * you may not use this file except in compliance with the License.
4036+ * You may obtain a copy of the License at
4037+ *
4038+ * http://www.apache.org/licenses/LICENSE-2.0
4039+ *
4040+ * Unless required by applicable law or agreed to in writing, software
4041+ * distributed under the License is distributed on an "AS IS" BASIS,
4042+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4043+ * See the License for the specific language governing permissions and
4044+ * limitations under the License.
4045+ */
4046+
4047+#include <zxing/common/CharacterSetECI.h>
4048+#include <zxing/common/IllegalArgumentException.h>
4049+#include <zxing/FormatException.h>
4050+
4051+using std::string;
4052+
4053+using zxing::common::CharacterSetECI;
4054+using zxing::IllegalArgumentException;
4055+
4056+std::map<int, CharacterSetECI*> CharacterSetECI::VALUE_TO_ECI;
4057+std::map<std::string, CharacterSetECI*> CharacterSetECI::NAME_TO_ECI;
4058+
4059+const bool CharacterSetECI::inited = CharacterSetECI::init_tables();
4060+
4061+#define ADD_CHARACTER_SET(VALUES, STRINGS) \
4062+ { static int values[] = {VALUES, -1}; \
4063+ static char const* strings[] = {STRINGS, 0}; \
4064+ addCharacterSet(values, strings); }
4065+
4066+#define XC ,
4067+
4068+bool CharacterSetECI::init_tables() {
4069+ ADD_CHARACTER_SET(0 XC 2, "Cp437");
4070+ ADD_CHARACTER_SET(1 XC 3, "ISO8859_1" XC "ISO-8859-1");
4071+ ADD_CHARACTER_SET(4, "ISO8859_2" XC "ISO-8859-2");
4072+ ADD_CHARACTER_SET(5, "ISO8859_3" XC "ISO-8859-3");
4073+ ADD_CHARACTER_SET(6, "ISO8859_4" XC "ISO-8859-4");
4074+ ADD_CHARACTER_SET(7, "ISO8859_5" XC "ISO-8859-5");
4075+ ADD_CHARACTER_SET(8, "ISO8859_6" XC "ISO-8859-6");
4076+ ADD_CHARACTER_SET(9, "ISO8859_7" XC "ISO-8859-7");
4077+ ADD_CHARACTER_SET(10, "ISO8859_8" XC "ISO-8859-8");
4078+ ADD_CHARACTER_SET(11, "ISO8859_9" XC "ISO-8859-9");
4079+ ADD_CHARACTER_SET(12, "ISO8859_10" XC "ISO-8859-10");
4080+ ADD_CHARACTER_SET(13, "ISO8859_11" XC "ISO-8859-11");
4081+ ADD_CHARACTER_SET(15, "ISO8859_13" XC "ISO-8859-13");
4082+ ADD_CHARACTER_SET(16, "ISO8859_14" XC "ISO-8859-14");
4083+ ADD_CHARACTER_SET(17, "ISO8859_15" XC "ISO-8859-15");
4084+ ADD_CHARACTER_SET(18, "ISO8859_16" XC "ISO-8859-16");
4085+ ADD_CHARACTER_SET(20, "SJIS" XC "Shift_JIS");
4086+ ADD_CHARACTER_SET(21, "Cp1250" XC "windows-1250");
4087+ ADD_CHARACTER_SET(22, "Cp1251" XC "windows-1251");
4088+ ADD_CHARACTER_SET(23, "Cp1252" XC "windows-1252");
4089+ ADD_CHARACTER_SET(24, "Cp1256" XC "windows-1256");
4090+ ADD_CHARACTER_SET(25, "UnicodeBigUnmarked" XC "UTF-16BE" XC "UnicodeBig");
4091+ ADD_CHARACTER_SET(26, "UTF8" XC "UTF-8");
4092+ ADD_CHARACTER_SET(27 XC 170, "ASCII" XC "US-ASCII");
4093+ ADD_CHARACTER_SET(28, "Big5");
4094+ ADD_CHARACTER_SET(29, "GB18030" XC "GB2312" XC "EUC_CN" XC "GBK");
4095+ ADD_CHARACTER_SET(30, "EUC_KR" XC "EUC-KR");
4096+ return true;
4097+}
4098+
4099+#undef XC
4100+
4101+CharacterSetECI::CharacterSetECI(int const* values,
4102+ char const* const* names)
4103+ : values_(values), names_(names) {
4104+ for(int const* values = values_; *values != -1; values++) {
4105+ VALUE_TO_ECI[*values] = this;
4106+ }
4107+ for(char const* const* names = names_; *names; names++) {
4108+ NAME_TO_ECI[string(*names)] = this;
4109+ }
4110+}
4111+
4112+char const* CharacterSetECI::name() const {
4113+ return names_[0];
4114+}
4115+
4116+int CharacterSetECI::getValue() const {
4117+ return values_[0];
4118+}
4119+
4120+void CharacterSetECI::addCharacterSet(int const* values, char const* const* names) {
4121+ new CharacterSetECI(values, names);
4122+}
4123+
4124+CharacterSetECI* CharacterSetECI::getCharacterSetECIByValue(int value) {
4125+ if (value < 0 || value >= 900) {
4126+ throw FormatException();
4127+ }
4128+ return VALUE_TO_ECI[value];
4129+}
4130+
4131+CharacterSetECI* CharacterSetECI::getCharacterSetECIByName(string const& name) {
4132+ return NAME_TO_ECI[name];
4133+}
4134
4135=== added file '3rdParty/zxing/common/CharacterSetECI.h'
4136--- 3rdParty/zxing/common/CharacterSetECI.h 1970-01-01 00:00:00 +0000
4137+++ 3rdParty/zxing/common/CharacterSetECI.h 2014-05-10 17:37:18 +0000
4138@@ -0,0 +1,53 @@
4139+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
4140+
4141+#ifndef __CHARACTERSET_ECI__
4142+#define __CHARACTERSET_ECI__
4143+
4144+/*
4145+ * Copyright 2008-2011 ZXing authors
4146+ *
4147+ * Licensed under the Apache License, Version 2.0 (the "License");
4148+ * you may not use this file except in compliance with the License.
4149+ * You may obtain a copy of the License at
4150+ *
4151+ * http://www.apache.org/licenses/LICENSE-2.0
4152+ *
4153+ * Unless required by applicable law or agreed to in writing, software
4154+ * distributed under the License is distributed on an "AS IS" BASIS,
4155+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4156+ * See the License for the specific language governing permissions and
4157+ * limitations under the License.
4158+ */
4159+
4160+#include <map>
4161+#include <zxing/DecodeHints.h>
4162+
4163+namespace zxing {
4164+ namespace common {
4165+ class CharacterSetECI;
4166+ }
4167+}
4168+
4169+class zxing::common::CharacterSetECI {
4170+private:
4171+ static std::map<int, CharacterSetECI*> VALUE_TO_ECI;
4172+ static std::map<std::string, CharacterSetECI*> NAME_TO_ECI;
4173+ static const bool inited;
4174+ static bool init_tables();
4175+
4176+ int const* const values_;
4177+ char const* const* const names_;
4178+
4179+ CharacterSetECI(int const* values, char const* const* names);
4180+
4181+ static void addCharacterSet(int const* value, char const* const* encodingNames);
4182+
4183+public:
4184+ char const* name() const;
4185+ int getValue() const;
4186+
4187+ static CharacterSetECI* getCharacterSetECIByValue(int value);
4188+ static CharacterSetECI* getCharacterSetECIByName(std::string const& name);
4189+};
4190+
4191+#endif
4192
4193=== added file '3rdParty/zxing/common/Counted.cpp'
4194--- 3rdParty/zxing/common/Counted.cpp 1970-01-01 00:00:00 +0000
4195+++ 3rdParty/zxing/common/Counted.cpp 2014-05-10 17:37:18 +0000
4196@@ -0,0 +1,32 @@
4197+/*
4198+ * Counted.cpp
4199+ * zxing
4200+ *
4201+ * Created by Christian Brunschen on 07/05/2008.
4202+ * Copyright 2008 Google UK. All rights reserved.
4203+ *
4204+ * Licensed under the Apache License, Version 2.0 (the "License");
4205+ * you may not use this file except in compliance with the License.
4206+ * You may obtain a copy of the License at
4207+ *
4208+ * http://www.apache.org/licenses/LICENSE-2.0
4209+ *
4210+ * Unless required by applicable law or agreed to in writing, software
4211+ * distributed under the License is distributed on an "AS IS" BASIS,
4212+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4213+ * See the License for the specific language governing permissions and
4214+ * limitations under the License.
4215+ */
4216+
4217+#include <zxing/common/Counted.h>
4218+
4219+namespace zxing {
4220+
4221+using namespace std;
4222+
4223+template<class T>
4224+ostream& operator<<(ostream &out, Ref<T>& ref) {
4225+ out << "Ref(" << (ref.object_ ? (*ref.object_) : "NULL") << ")";
4226+ return out;
4227+}
4228+}
4229
4230=== added file '3rdParty/zxing/common/Counted.h'
4231--- 3rdParty/zxing/common/Counted.h 1970-01-01 00:00:00 +0000
4232+++ 3rdParty/zxing/common/Counted.h 2014-05-10 17:37:18 +0000
4233@@ -0,0 +1,202 @@
4234+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
4235+#ifndef __COUNTED_H__
4236+#define __COUNTED_H__
4237+
4238+/*
4239+ * Copyright 2010 ZXing authors All rights reserved.
4240+ *
4241+ * Licensed under the Apache License, Version 2.0 (the "License");
4242+ * you may not use this file except in compliance with the License.
4243+ * You may obtain a copy of the License at
4244+ *
4245+ * http://www.apache.org/licenses/LICENSE-2.0
4246+ *
4247+ * Unless required by applicable law or agreed to in writing, software
4248+ * distributed under the License is distributed on an "AS IS" BASIS,
4249+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4250+ * See the License for the specific language governing permissions and
4251+ * limitations under the License.
4252+ */
4253+
4254+//#define DEBUG_COUNTING
4255+
4256+#include <iostream>
4257+
4258+#ifdef DEBUG_COUNTING
4259+#include <typeinfo>
4260+#endif
4261+
4262+namespace zxing {
4263+
4264+/* base class for reference-counted objects */
4265+class Counted {
4266+private:
4267+ unsigned int count_;
4268+public:
4269+ Counted() :
4270+ count_(0) {
4271+#ifdef DEBUG_COUNTING
4272+ cout << "instantiating " << typeid(*this).name() << " " << this <<
4273+ " @ " << count_ << "\n";
4274+#endif
4275+ }
4276+ virtual ~Counted() {
4277+ }
4278+ Counted *retain() {
4279+#ifdef DEBUG_COUNTING
4280+ cout << "retaining " << typeid(*this).name() << " " << this <<
4281+ " @ " << count_;
4282+#endif
4283+ count_++;
4284+#ifdef DEBUG_COUNTING
4285+ cout << "->" << count_ << "\n";
4286+#endif
4287+ return this;
4288+ }
4289+ void release() {
4290+#ifdef DEBUG_COUNTING
4291+ cout << "releasing " << typeid(*this).name() << " " << this <<
4292+ " @ " << count_;
4293+#endif
4294+ if (count_ == 0 || count_ == 54321) {
4295+#ifdef DEBUG_COUNTING
4296+ cout << "\nOverreleasing already-deleted object " << this << "!!!\n";
4297+#endif
4298+ throw 4711;
4299+ }
4300+ count_--;
4301+#ifdef DEBUG_COUNTING
4302+ cout << "->" << count_ << "\n";
4303+#endif
4304+ if (count_ == 0) {
4305+#ifdef DEBUG_COUNTING
4306+ cout << "deleting " << typeid(*this).name() << " " << this << "\n";
4307+#endif
4308+ count_ = 0xDEADF001;
4309+ delete this;
4310+ }
4311+ }
4312+
4313+
4314+ /* return the current count for denugging purposes or similar */
4315+ int count() const {
4316+ return count_;
4317+ }
4318+};
4319+
4320+/* counting reference to reference-counted objects */
4321+template<typename T> class Ref {
4322+private:
4323+public:
4324+ T *object_;
4325+ explicit Ref(T *o = 0) :
4326+ object_(0) {
4327+#ifdef DEBUG_COUNTING
4328+ cout << "instantiating Ref " << this << " from pointer" << o << "\n";
4329+#endif
4330+ reset(o);
4331+ }
4332+
4333+ explicit Ref(const T &o) :
4334+ object_(0) {
4335+#ifdef DEBUG_COUNTING
4336+ cout << "instantiating Ref " << this << " from reference\n";
4337+#endif
4338+ reset(const_cast<T *>(&o));
4339+ }
4340+
4341+ Ref(const Ref &other) :
4342+ object_(0) {
4343+#ifdef DEBUG_COUNTING
4344+ cout << "instantiating Ref " << this << " from Ref " << &other << "\n";
4345+#endif
4346+ reset(other.object_);
4347+ }
4348+
4349+ template<class Y>
4350+ Ref(const Ref<Y> &other) :
4351+ object_(0) {
4352+#ifdef DEBUG_COUNTING
4353+ cout << "instantiating Ref " << this << " from reference\n";
4354+#endif
4355+ reset(other.object_);
4356+ }
4357+
4358+ ~Ref() {
4359+#ifdef DEBUG_COUNTING
4360+ cout << "destroying Ref " << this << " with " <<
4361+ (object_ ? typeid(*object_).name() : "NULL") << " " << object_ << "\n";
4362+#endif
4363+ if (object_) {
4364+ object_->release();
4365+ }
4366+ }
4367+
4368+ void reset(T *o) {
4369+#ifdef DEBUG_COUNTING
4370+ cout << "resetting Ref " << this << " from " <<
4371+ (object_ ? typeid(*object_).name() : "NULL") << " " << object_ <<
4372+ " to " << (o ? typeid(*o).name() : "NULL") << " " << o << "\n";
4373+#endif
4374+ if (o) {
4375+ o->retain();
4376+ }
4377+ if (object_ != 0) {
4378+ object_->release();
4379+ }
4380+ object_ = o;
4381+ }
4382+ Ref& operator=(const Ref &other) {
4383+ reset(other.object_);
4384+ return *this;
4385+ }
4386+ template<class Y>
4387+ Ref& operator=(const Ref<Y> &other) {
4388+ reset(other.object_);
4389+ return *this;
4390+ }
4391+ Ref& operator=(T* o) {
4392+ reset(o);
4393+ return *this;
4394+ }
4395+ template<class Y>
4396+ Ref& operator=(Y* o) {
4397+ reset(o);
4398+ return *this;
4399+ }
4400+
4401+ T& operator*() {
4402+ return *object_;
4403+ }
4404+ T* operator->() const {
4405+ return object_;
4406+ }
4407+ operator T*() const {
4408+ return object_;
4409+ }
4410+
4411+ bool operator==(const T* that) {
4412+ return object_ == that;
4413+ }
4414+ bool operator==(const Ref &other) const {
4415+ return object_ == other.object_ || *object_ == *(other.object_);
4416+ }
4417+ template<class Y>
4418+ bool operator==(const Ref<Y> &other) const {
4419+ return object_ == other.object_ || *object_ == *(other.object_);
4420+ }
4421+
4422+ bool operator!=(const T* that) {
4423+ return !(*this == that);
4424+ }
4425+
4426+ bool empty() const {
4427+ return object_ == 0;
4428+ }
4429+
4430+ template<class Y>
4431+ friend std::ostream& operator<<(std::ostream &out, Ref<Y>& ref);
4432+};
4433+}
4434+
4435+#endif // __COUNTED_H__
4436
4437=== added file '3rdParty/zxing/common/DecoderResult.cpp'
4438--- 3rdParty/zxing/common/DecoderResult.cpp 1970-01-01 00:00:00 +0000
4439+++ 3rdParty/zxing/common/DecoderResult.cpp 2014-05-10 17:37:18 +0000
4440@@ -0,0 +1,46 @@
4441+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
4442+/*
4443+ * DecoderResult.cpp
4444+ * zxing
4445+ *
4446+ * Created by Christian Brunschen on 20/05/2008.
4447+ * Copyright 2008-2011 ZXing authors All rights reserved.
4448+ *
4449+ * Licensed under the Apache License, Version 2.0 (the "License");
4450+ * you may not use this file except in compliance with the License.
4451+ * You may obtain a copy of the License at
4452+ *
4453+ * http://www.apache.org/licenses/LICENSE-2.0
4454+ *
4455+ * Unless required by applicable law or agreed to in writing, software
4456+ * distributed under the License is distributed on an "AS IS" BASIS,
4457+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4458+ * See the License for the specific language governing permissions and
4459+ * limitations under the License.
4460+ */
4461+
4462+#include <zxing/common/DecoderResult.h>
4463+
4464+using namespace std;
4465+using namespace zxing;
4466+
4467+DecoderResult::DecoderResult(ArrayRef<unsigned char> rawBytes,
4468+ Ref<String> text,
4469+ ArrayRef< ArrayRef<unsigned char> >& byteSegments,
4470+ string const& ecLevel) :
4471+ rawBytes_(rawBytes),
4472+ text_(text),
4473+ byteSegments_(byteSegments),
4474+ ecLevel_(ecLevel) {}
4475+
4476+DecoderResult::DecoderResult(ArrayRef<unsigned char> rawBytes,
4477+ Ref<String> text)
4478+ : rawBytes_(rawBytes), text_(text) {}
4479+
4480+ArrayRef<unsigned char> DecoderResult::getRawBytes() {
4481+ return rawBytes_;
4482+}
4483+
4484+Ref<String> DecoderResult::getText() {
4485+ return text_;
4486+}
4487
4488=== added file '3rdParty/zxing/common/DecoderResult.h'
4489--- 3rdParty/zxing/common/DecoderResult.h 1970-01-01 00:00:00 +0000
4490+++ 3rdParty/zxing/common/DecoderResult.h 2014-05-10 17:37:18 +0000
4491@@ -0,0 +1,51 @@
4492+#ifndef __DECODER_RESULT_H__
4493+#define __DECODER_RESULT_H__
4494+
4495+/*
4496+ * DecoderResult.h
4497+ * zxing
4498+ *
4499+ * Copyright 2010 ZXing authors All rights reserved.
4500+ *
4501+ * Licensed under the Apache License, Version 2.0 (the "License");
4502+ * you may not use this file except in compliance with the License.
4503+ * You may obtain a copy of the License at
4504+ *
4505+ * http://www.apache.org/licenses/LICENSE-2.0
4506+ *
4507+ * Unless required by applicable law or agreed to in writing, software
4508+ * distributed under the License is distributed on an "AS IS" BASIS,
4509+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4510+ * See the License for the specific language governing permissions and
4511+ * limitations under the License.
4512+ */
4513+
4514+#include <zxing/common/Counted.h>
4515+#include <zxing/common/Array.h>
4516+#include <string>
4517+#include <zxing/common/Str.h>
4518+
4519+namespace zxing {
4520+
4521+class DecoderResult : public Counted {
4522+private:
4523+ ArrayRef<unsigned char> rawBytes_;
4524+ Ref<String> text_;
4525+ ArrayRef< ArrayRef<unsigned char> > byteSegments_;
4526+ std::string ecLevel_;
4527+
4528+public:
4529+ DecoderResult(ArrayRef<unsigned char> rawBytes,
4530+ Ref<String> text,
4531+ ArrayRef< ArrayRef<unsigned char> >& byteSegments,
4532+ std::string const& ecLevel);
4533+
4534+ DecoderResult(ArrayRef<unsigned char> rawBytes, Ref<String> text);
4535+
4536+ ArrayRef<unsigned char> getRawBytes();
4537+ Ref<String> getText();
4538+};
4539+
4540+}
4541+
4542+#endif // __DECODER_RESULT_H__
4543
4544=== added file '3rdParty/zxing/common/DetectorResult.cpp'
4545--- 3rdParty/zxing/common/DetectorResult.cpp 1970-01-01 00:00:00 +0000
4546+++ 3rdParty/zxing/common/DetectorResult.cpp 2014-05-10 17:37:18 +0000
4547@@ -0,0 +1,38 @@
4548+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
4549+/*
4550+ * DetectorResult.cpp
4551+ * zxing
4552+ *
4553+ * Created by Christian Brunschen on 14/05/2008.
4554+ * Copyright 2008 ZXing authors All rights reserved.
4555+ *
4556+ * Licensed under the Apache License, Version 2.0 (the "License");
4557+ * you may not use this file except in compliance with the License.
4558+ * You may obtain a copy of the License at
4559+ *
4560+ * http://www.apache.org/licenses/LICENSE-2.0
4561+ *
4562+ * Unless required by applicable law or agreed to in writing, software
4563+ * distributed under the License is distributed on an "AS IS" BASIS,
4564+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4565+ * See the License for the specific language governing permissions and
4566+ * limitations under the License.
4567+ */
4568+
4569+#include <zxing/common/DetectorResult.h>
4570+
4571+namespace zxing {
4572+
4573+DetectorResult::DetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points) :
4574+ bits_(bits), points_(points) {
4575+}
4576+
4577+Ref<BitMatrix> DetectorResult::getBits() {
4578+ return bits_;
4579+}
4580+
4581+std::vector<Ref<ResultPoint> > DetectorResult::getPoints() {
4582+ return points_;
4583+}
4584+
4585+}
4586
4587=== added file '3rdParty/zxing/common/DetectorResult.h'
4588--- 3rdParty/zxing/common/DetectorResult.h 1970-01-01 00:00:00 +0000
4589+++ 3rdParty/zxing/common/DetectorResult.h 2014-05-10 17:37:18 +0000
4590@@ -0,0 +1,43 @@
4591+#ifndef __DETECTOR_RESULT_H__
4592+#define __DETECTOR_RESULT_H__
4593+
4594+/*
4595+ * DetectorResult.h
4596+ * zxing
4597+ *
4598+ * Copyright 2010 ZXing authors All rights reserved.
4599+ *
4600+ * Licensed under the Apache License, Version 2.0 (the "License");
4601+ * you may not use this file except in compliance with the License.
4602+ * You may obtain a copy of the License at
4603+ *
4604+ * http://www.apache.org/licenses/LICENSE-2.0
4605+ *
4606+ * Unless required by applicable law or agreed to in writing, software
4607+ * distributed under the License is distributed on an "AS IS" BASIS,
4608+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4609+ * See the License for the specific language governing permissions and
4610+ * limitations under the License.
4611+ */
4612+
4613+#include <vector>
4614+#include <zxing/common/Counted.h>
4615+#include <zxing/common/Array.h>
4616+#include <zxing/common/BitMatrix.h>
4617+#include <zxing/ResultPoint.h>
4618+
4619+namespace zxing {
4620+
4621+class DetectorResult : public Counted {
4622+private:
4623+ Ref<BitMatrix> bits_;
4624+ std::vector<Ref<ResultPoint> > points_;
4625+
4626+public:
4627+ DetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points);
4628+ Ref<BitMatrix> getBits();
4629+ std::vector<Ref<ResultPoint> > getPoints();
4630+};
4631+}
4632+
4633+#endif // __DETECTOR_RESULT_H__
4634
4635=== added file '3rdParty/zxing/common/EdgeDetector.cpp'
4636--- 3rdParty/zxing/common/EdgeDetector.cpp 1970-01-01 00:00:00 +0000
4637+++ 3rdParty/zxing/common/EdgeDetector.cpp 2014-05-10 17:37:18 +0000
4638@@ -0,0 +1,191 @@
4639+/*
4640+ * EdgeDetector.cpp
4641+ * zxing
4642+ *
4643+ * Created by Ralf Kistner on 7/12/2009.
4644+ * Copyright 2008 ZXing authors All rights reserved.
4645+ *
4646+ * Licensed under the Apache License, Version 2.0 (the "License");
4647+ * you may not use this file except in compliance with the License.
4648+ * You may obtain a copy of the License at
4649+ *
4650+ * http://www.apache.org/licenses/LICENSE-2.0
4651+ *
4652+ * Unless required by applicable law or agreed to in writing, software
4653+ * distributed under the License is distributed on an "AS IS" BASIS,
4654+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4655+ * See the License for the specific language governing permissions and
4656+ * limitations under the License.
4657+ */
4658+
4659+#include <zxing/common/EdgeDetector.h>
4660+#include <algorithm>
4661+#include <cmath>
4662+
4663+using namespace std;
4664+
4665+namespace zxing {
4666+namespace EdgeDetector {
4667+
4668+void findEdgePoints(std::vector<Point>& points, const BitMatrix& image, Point start, Point end, bool invert, int skip, float deviation) {
4669+ float xdist = end.x - start.x;
4670+ float ydist = end.y - start.y;
4671+ float length = sqrt(xdist * xdist + ydist * ydist);
4672+
4673+
4674+ int var;
4675+
4676+ if (abs(xdist) > abs(ydist)) {
4677+ // Horizontal
4678+ if (xdist < 0)
4679+ skip = -skip;
4680+
4681+ var = int(abs(deviation * length / xdist));
4682+
4683+ float dy = ydist / xdist * skip;
4684+ bool left = (skip < 0) ^ invert;
4685+ int x = int(start.x);
4686+
4687+ int steps = int(xdist / skip);
4688+ for (int i = 0; i < steps; i++) {
4689+ x += skip;
4690+ if (x < 0 || x >= (int)image.getWidth())
4691+ continue; // In case we start off the edge
4692+ int my = int(start.y + dy * i);
4693+ int ey = min(my + var + 1, (int)image.getHeight() - 1);
4694+ int sy = max(my - var, 0);
4695+ for (int y = sy + 1; y < ey; y++) {
4696+ if (left) {
4697+ if (image.get(x, y) && !image.get(x, y + 1)) {
4698+ points.push_back(Point(x, y + 0.5f));
4699+ }
4700+ } else {
4701+ if (!image.get(x, y) && image.get(x, y + 1)) {
4702+ points.push_back(Point(x, y + 0.5f));
4703+ }
4704+ }
4705+ }
4706+ }
4707+ } else {
4708+ // Vertical
4709+ if (ydist < 0)
4710+ skip = -skip;
4711+
4712+ var = int(abs(deviation * length / ydist));
4713+
4714+ float dx = xdist / ydist * skip;
4715+ bool down = (skip > 0) ^ invert;
4716+ int y = int(start.y);
4717+
4718+ int steps = int(ydist / skip);
4719+ for (int i = 0; i < steps; i++) {
4720+ y += skip;
4721+ if (y < 0 || y >= (int)image.getHeight())
4722+ continue; // In case we start off the edge
4723+ int mx = int(start.x + dx * i);
4724+ int ex = min(mx + var + 1, (int)image.getWidth() - 1);
4725+ int sx = max(mx - var, 0);
4726+ for (int x = sx + 1; x < ex; x++) {
4727+ if (down) {
4728+ if (image.get(x, y) && !image.get(x + 1, y)) {
4729+ points.push_back(Point(x + 0.5f, y));
4730+ }
4731+
4732+ } else {
4733+ if (!image.get(x, y) && image.get(x + 1, y)) {
4734+ points.push_back(Point(x + 0.5f, y));
4735+ }
4736+ }
4737+
4738+ }
4739+ }
4740+
4741+ }
4742+}
4743+
4744+Line findLine(const BitMatrix& image, Line estimate, bool invert, int deviation, float threshold, int skip) {
4745+ float t = threshold * threshold;
4746+
4747+ Point start = estimate.start;
4748+ Point end = estimate.end;
4749+
4750+ vector<Point> edges;
4751+ edges.clear();
4752+ findEdgePoints(edges, image, start, end, invert, skip, deviation);
4753+
4754+ int n = edges.size();
4755+
4756+ float xdist = end.x - start.x;
4757+ float ydist = end.y - start.y;
4758+
4759+ bool horizontal = abs(xdist) > abs(ydist);
4760+
4761+ float max = 0;
4762+ Line bestLine(start, end); // prepopulate with the given line, in case we can't find any line for some reason
4763+
4764+ for (int i = -deviation; i < deviation; i++) {
4765+ float x1, y1;
4766+ if (horizontal) {
4767+ y1 = start.y + i;
4768+ x1 = start.x - i * ydist / xdist;
4769+ } else {
4770+ y1 = start.y - i * xdist / ydist;
4771+ x1 = start.x + i;
4772+ }
4773+
4774+ for (int j = -deviation; j < deviation; j++) {
4775+ float x2, y2;
4776+ if (horizontal) {
4777+ y2 = end.y + j;
4778+ x2 = end.x - j * ydist / xdist;
4779+ } else {
4780+ y2 = end.y - j * xdist / ydist;
4781+ x2 = end.x + j;
4782+ }
4783+
4784+ float dx = x1 - x2;
4785+ float dy = y1 - y2;
4786+ float length = sqrt(dx * dx + dy * dy);
4787+
4788+ float score = 0;
4789+
4790+ for(int k = 0; k < n; k++) {
4791+ const Point& edge = edges[k];
4792+ float dist = ((x1 - edge.x) * dy - (y1 - edge.y) * dx) / length;
4793+ // Similar to least squares method
4794+ float s = t - dist * dist;
4795+ if (s > 0)
4796+ score += s;
4797+ }
4798+
4799+ if (score > max) {
4800+ max = score;
4801+ bestLine.start = Point(x1, y1);
4802+ bestLine.end = Point(x2, y2);
4803+ }
4804+ }
4805+ }
4806+
4807+ return bestLine;
4808+}
4809+
4810+Point intersection(Line a, Line b) {
4811+ float dxa = a.start.x - a.end.x;
4812+ float dxb = b.start.x - b.end.x;
4813+ float dya = a.start.y - a.end.y;
4814+ float dyb = b.start.y - b.end.y;
4815+
4816+ float p = a.start.x * a.end.y - a.start.y * a.end.x;
4817+ float q = b.start.x * b.end.y - b.start.y * b.end.x;
4818+ float denom = dxa * dyb - dya * dxb;
4819+ if(denom == 0) // Lines don't intersect
4820+ return Point(INFINITY, INFINITY);
4821+
4822+ float x = (p * dxb - dxa * q) / denom;
4823+ float y = (p * dyb - dya * q) / denom;
4824+
4825+ return Point(x, y);
4826+}
4827+
4828+} // namespace EdgeDetector
4829+} // namespace zxing
4830
4831=== added file '3rdParty/zxing/common/EdgeDetector.h'
4832--- 3rdParty/zxing/common/EdgeDetector.h 1970-01-01 00:00:00 +0000
4833+++ 3rdParty/zxing/common/EdgeDetector.h 2014-05-10 17:37:18 +0000
4834@@ -0,0 +1,38 @@
4835+#ifndef __EDGEDETECTOR_H__
4836+#define __EDGEDETECTOR_H__
4837+/*
4838+ * EdgeDetector.h
4839+ * zxing
4840+ *
4841+ * Copyright 2010 ZXing authors All rights reserved.
4842+ *
4843+ * Licensed under the Apache License, Version 2.0 (the "License");
4844+ * you may not use this file except in compliance with the License.
4845+ * You may obtain a copy of the License at
4846+ *
4847+ * http://www.apache.org/licenses/LICENSE-2.0
4848+ *
4849+ * Unless required by applicable law or agreed to in writing, software
4850+ * distributed under the License is distributed on an "AS IS" BASIS,
4851+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4852+ * See the License for the specific language governing permissions and
4853+ * limitations under the License.
4854+ */
4855+
4856+
4857+
4858+#include <vector>
4859+#include <zxing/common/BitMatrix.h>
4860+#include <zxing/common/Point.h>
4861+
4862+namespace zxing {
4863+namespace EdgeDetector {
4864+
4865+void findEdgePoints(std::vector<Point>& points, const BitMatrix& image, Point start, Point end, bool invert, int skip, float deviation);
4866+Line findLine(const BitMatrix& image, Line estimate, bool invert, int deviation, float threshold, int skip);
4867+
4868+Point intersection(Line a, Line b);
4869+
4870+}
4871+}
4872+#endif /* EDGEDETECTOR_H_ */
4873
4874=== added file '3rdParty/zxing/common/GlobalHistogramBinarizer.cpp'
4875--- 3rdParty/zxing/common/GlobalHistogramBinarizer.cpp 1970-01-01 00:00:00 +0000
4876+++ 3rdParty/zxing/common/GlobalHistogramBinarizer.cpp 2014-05-10 17:37:18 +0000
4877@@ -0,0 +1,209 @@
4878+// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
4879+/*
4880+ * GlobalHistogramBinarizer.cpp
4881+ * zxing
4882+ *
4883+ * Copyright 2010 ZXing authors. All rights reserved.
4884+ *
4885+ * Licensed under the Apache License, Version 2.0 (the "License");
4886+ * you may not use this file except in compliance with the License.
4887+ * You may obtain a copy of the License at
4888+ *
4889+ * http://www.apache.org/licenses/LICENSE-2.0
4890+ *
4891+ * Unless required by applicable law or agreed to in writing, software
4892+ * distributed under the License is distributed on an "AS IS" BASIS,
4893+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4894+ * See the License for the specific language governing permissions and
4895+ * limitations under the License.
4896+ */
4897+
4898+#include <zxing/common/GlobalHistogramBinarizer.h>
4899+#include <zxing/common/IllegalArgumentException.h>
4900+#include <zxing/common/Array.h>
4901+
4902+namespace zxing {
4903+using namespace std;
4904+
4905+const int LUMINANCE_BITS = 5;
4906+const int LUMINANCE_SHIFT = 8 - LUMINANCE_BITS;
4907+const int LUMINANCE_BUCKETS = 1 << LUMINANCE_BITS;
4908+
4909+GlobalHistogramBinarizer::GlobalHistogramBinarizer(Ref<LuminanceSource> source) :
4910+ Binarizer(source), cached_matrix_(NULL), cached_row_(NULL), cached_row_num_(-1) {
4911+
4912+}
4913+
4914+GlobalHistogramBinarizer::~GlobalHistogramBinarizer() {
4915+}
4916+
4917+
4918+Ref<BitArray> GlobalHistogramBinarizer::getBlackRow(int y, Ref<BitArray> row) {
4919+ if (y == cached_row_num_) {
4920+ if (cached_row_ != NULL) {
4921+ return cached_row_;
4922+ } else {
4923+ throw IllegalArgumentException("Too little dynamic range in luminance");
4924+ }
4925+ }
4926+
4927+ vector<int> histogram(LUMINANCE_BUCKETS, 0);
4928+ LuminanceSource& source = *getLuminanceSource();
4929+ int width = source.getWidth();
4930+ if (row == NULL || static_cast<int>(row->getSize()) < width) {
4931+ row = new BitArray(width);
4932+ } else {
4933+ row->clear();
4934+ }
4935+
4936+ //TODO(flyashi): cache this instead of allocating and deleting per row
4937+ unsigned char* row_pixels = NULL;
4938+ try {
4939+ row_pixels = new unsigned char[width];
4940+ row_pixels = source.getRow(y, row_pixels);
4941+ for (int x = 0; x < width; x++) {
4942+ histogram[row_pixels[x] >> LUMINANCE_SHIFT]++;
4943+ }
4944+ int blackPoint = estimate(histogram);
4945+
4946+ BitArray& array = *row;
4947+ int left = row_pixels[0];
4948+ int center = row_pixels[1];
4949+ for (int x = 1; x < width - 1; x++) {
4950+ int right = row_pixels[x + 1];
4951+ // A simple -1 4 -1 box filter with a weight of 2.
4952+ int luminance = ((center << 2) - left - right) >> 1;
4953+ if (luminance < blackPoint) {
4954+ array.set(x);
4955+ }
4956+ left = center;
4957+ center = right;
4958+ }
4959+
4960+ cached_row_ = row;
4961+ cached_row_num_ = y;
4962+ delete [] row_pixels;
4963+ return row;
4964+ } catch (IllegalArgumentException const& iae) {
4965+ // Cache the fact that this row failed.
4966+ cached_row_ = NULL;
4967+ cached_row_num_ = y;
4968+ delete [] row_pixels;
4969+ throw iae;
4970+ }
4971+}
4972+
4973+Ref<BitMatrix> GlobalHistogramBinarizer::getBlackMatrix() {
4974+ if (cached_matrix_ != NULL) {
4975+ return cached_matrix_;
4976+ }
4977+
4978+ // Faster than working with the reference
4979+ LuminanceSource& source = *getLuminanceSource();
4980+ int width = source.getWidth();
4981+ int height = source.getHeight();
4982+ vector<int> histogram(LUMINANCE_BUCKETS, 0);
4983+
4984+ // Quickly calculates the histogram by sampling four rows from the image.
4985+ // This proved to be more robust on the blackbox tests than sampling a
4986+ // diagonal as we used to do.
4987+ ArrayRef<unsigned char> ref (width);
4988+ unsigned char* row = &ref[0];
4989+ for (int y = 1; y < 5; y++) {
4990+ int rownum = height * y / 5;
4991+ int right = (width << 2) / 5;
4992+ row = source.getRow(rownum, row);
4993+ for (int x = width / 5; x < right; x++) {
4994+ histogram[row[x] >> LUMINANCE_SHIFT]++;
4995+ }
4996+ }
4997+
4998+ int blackPoint = estimate(histogram);
4999+
5000+ Ref<BitMatrix> matrix_ref(new BitMatrix(width, height));
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches