mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
ahti333's port of aztec and gfpoly + some fixes + Xcode tweaks for recent ECI updates
git-svn-id: https://zxing.googlecode.com/svn/trunk@2204 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
3b4a8bcd52
commit
2b01d912d3
|
@ -1003,3 +1003,78 @@ Processing: ../core/test/data/blackbox/qrcode-6/7.png ... passed.
|
|||
Processing: ../core/test/data/blackbox/qrcode-6/8.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/qrcode-6/9.png ... passed.
|
||||
***** qrcode-6 finished - 15 of 15 passed **** ***** ******* ***** *********************
|
||||
Processing: ../core/test/data/blackbox/aztec-1/7.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/Historico.gif ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/HistoricoLong.gif ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/abc-19x19C.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/abc-37x37.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/lorem-075x075.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/lorem-105x105.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/lorem-151x151.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/tableShifts.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/tag.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-1/texte.png ... passed.
|
||||
***** aztec-1 finished - 11 of 11 passed **** ***** ******* ***** *********************
|
||||
Processing: ../core/test/data/blackbox/aztec-2/01.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/02.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-2/03.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/04.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/05.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/06.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/07.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/08.png ... FAILED
|
||||
Expected: This is a real world Aztec barcode test.
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/09.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::IllegalArgumentException: Invalid position (ReedSolomonDecoder)
|
||||
Processing: ../core/test/data/blackbox/aztec-2/10.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/11.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::IllegalArgumentException: Invalid position (ReedSolomonDecoder)
|
||||
Processing: ../core/test/data/blackbox/aztec-2/12.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/13.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/14.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/15.png ... FAILED
|
||||
Expected: mailto:zxing@googlegroups.com
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/16.png ... FAILED
|
||||
Expected: http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/17.png ... FAILED
|
||||
Expected: http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/18.png ... passed.
|
||||
Processing: ../core/test/data/blackbox/aztec-2/19.png ... FAILED
|
||||
Expected: http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/20.png ... FAILED
|
||||
Expected: http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/21.png ... FAILED
|
||||
Expected: http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
Processing: ../core/test/data/blackbox/aztec-2/22.png ... FAILED
|
||||
Expected: http://code.google.com/p/zxing/source/browse/trunk/android/src/com/google/zxing/client/android/result/URIResultHandler.java
|
||||
Detected: zxing::ReaderException: No code detected
|
||||
***** aztec-2 finished - 2 of 22 passed **** ***** ******* ***** *********************
|
||||
|
|
|
@ -5,7 +5,7 @@ blackboxpath="../core/test/data/blackbox"
|
|||
if [ "$*" != "" ]; then
|
||||
formats="$*"
|
||||
else
|
||||
formats="ean13 ean8 upce upca qrcode"
|
||||
formats="ean13 ean8 upce upca qrcode aztec"
|
||||
fi
|
||||
|
||||
passed=0;
|
||||
|
|
|
@ -30,7 +30,8 @@ const char *barcodeFormatNames[] = {
|
|||
"EAN_13",
|
||||
"CODE_128",
|
||||
"CODE_39",
|
||||
"ITF"
|
||||
"ITF",
|
||||
"AZTEC"
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
#ifndef __BARCODE_FORMAT_H__
|
||||
#define __BARCODE_FORMAT_H__
|
||||
|
||||
|
@ -22,21 +23,22 @@
|
|||
|
||||
namespace zxing {
|
||||
|
||||
typedef enum BarcodeFormat {
|
||||
BarcodeFormat_None = 0,
|
||||
BarcodeFormat_QR_CODE,
|
||||
BarcodeFormat_DATA_MATRIX,
|
||||
BarcodeFormat_UPC_E,
|
||||
BarcodeFormat_UPC_A,
|
||||
BarcodeFormat_EAN_8,
|
||||
BarcodeFormat_EAN_13,
|
||||
BarcodeFormat_CODE_128,
|
||||
BarcodeFormat_CODE_39,
|
||||
BarcodeFormat_ITF
|
||||
} BarcodeFormat;
|
||||
typedef enum BarcodeFormat {
|
||||
BarcodeFormat_None = 0,
|
||||
BarcodeFormat_QR_CODE,
|
||||
BarcodeFormat_DATA_MATRIX,
|
||||
BarcodeFormat_UPC_E,
|
||||
BarcodeFormat_UPC_A,
|
||||
BarcodeFormat_EAN_8,
|
||||
BarcodeFormat_EAN_13,
|
||||
BarcodeFormat_CODE_128,
|
||||
BarcodeFormat_CODE_39,
|
||||
BarcodeFormat_ITF,
|
||||
BarcodeFormat_AZTEC
|
||||
} BarcodeFormat;
|
||||
|
||||
/* if you update the enum, please update the name in BarcodeFormat.cpp */
|
||||
extern const char *barcodeFormatNames[];
|
||||
/* if you update the enum, please update the name in BarcodeFormat.cpp */
|
||||
extern const char *barcodeFormatNames[];
|
||||
}
|
||||
|
||||
#endif // __BARCODE_FORMAT_H__
|
||||
|
|
|
@ -47,6 +47,7 @@ const DecodeHints DecodeHints::DEFAULT_HINT(
|
|||
BARCODEFORMAT_CODE_39_HINT |
|
||||
BARCODEFORMAT_ITF_HINT |
|
||||
BARCODEFORMAT_DATA_MATRIX_HINT |
|
||||
BARCODEFORMAT_AZTEC_HINT |
|
||||
BARCODEFORMAT_QR_CODE_HINT);
|
||||
|
||||
DecodeHints::DecodeHints() {
|
||||
|
@ -59,6 +60,7 @@ DecodeHints::DecodeHints(DecodeHintType init) {
|
|||
|
||||
void DecodeHints::addFormat(BarcodeFormat toadd) {
|
||||
switch (toadd) {
|
||||
case BarcodeFormat_AZTEC: hints |= BARCODEFORMAT_AZTEC_HINT; break;
|
||||
case BarcodeFormat_QR_CODE: hints |= BARCODEFORMAT_QR_CODE_HINT; break;
|
||||
case BarcodeFormat_DATA_MATRIX: hints |= BARCODEFORMAT_DATA_MATRIX_HINT; break;
|
||||
case BarcodeFormat_UPC_E: hints |= BARCODEFORMAT_UPC_E_HINT; break;
|
||||
|
@ -75,6 +77,7 @@ void DecodeHints::addFormat(BarcodeFormat toadd) {
|
|||
bool DecodeHints::containsFormat(BarcodeFormat tocheck) const {
|
||||
DecodeHintType checkAgainst;
|
||||
switch (tocheck) {
|
||||
case BarcodeFormat_AZTEC: checkAgainst = BARCODEFORMAT_AZTEC_HINT; break;
|
||||
case BarcodeFormat_QR_CODE: checkAgainst = BARCODEFORMAT_QR_CODE_HINT; break;
|
||||
case BarcodeFormat_DATA_MATRIX: checkAgainst = BARCODEFORMAT_DATA_MATRIX_HINT; break;
|
||||
case BarcodeFormat_UPC_E: checkAgainst = BARCODEFORMAT_UPC_E_HINT; break;
|
||||
|
|
|
@ -45,6 +45,7 @@ class DecodeHints {
|
|||
static const DecodeHintType BARCODEFORMAT_CODE_128_HINT = 1 << BarcodeFormat_CODE_128;
|
||||
static const DecodeHintType BARCODEFORMAT_CODE_39_HINT = 1 << BarcodeFormat_CODE_39;
|
||||
static const DecodeHintType BARCODEFORMAT_ITF_HINT = 1 << BarcodeFormat_ITF;
|
||||
static const DecodeHintType BARCODEFORMAT_AZTEC_HINT = 1 << BarcodeFormat_AZTEC;
|
||||
static const DecodeHintType CHARACTER_SET = 1 << 30;
|
||||
static const DecodeHintType TRYHARDER_HINT = 1 << 31;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <zxing/MultiFormatReader.h>
|
||||
#include <zxing/qrcode/QRCodeReader.h>
|
||||
#include <zxing/datamatrix/DataMatrixReader.h>
|
||||
#include <zxing/aztec/AztecReader.h>
|
||||
#include <zxing/oned/MultiFormatUPCEANReader.h>
|
||||
#include <zxing/oned/MultiFormatOneDReader.h>
|
||||
#include <zxing/ReaderException.h>
|
||||
|
@ -70,6 +71,9 @@ namespace zxing {
|
|||
if (hints.containsFormat(BarcodeFormat_DATA_MATRIX)) {
|
||||
readers_.push_back(Ref<Reader>(new zxing::datamatrix::DataMatrixReader()));
|
||||
}
|
||||
if (hints.containsFormat(BarcodeFormat_AZTEC)) {
|
||||
readers_.push_back(Ref<Reader>(new zxing::aztec::AztecReader()));
|
||||
}
|
||||
//TODO: add PDF417 here once PDF417 reader is implemented
|
||||
if (addOneDReader && tryHarder) {
|
||||
readers_.push_back(Ref<Reader>(new zxing::oned::MultiFormatOneDReader(hints)));
|
||||
|
|
45
cpp/core/src/zxing/aztec/AztecDetectorResult.cpp
Normal file
45
cpp/core/src/zxing/aztec/AztecDetectorResult.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* AtztecDetecorResult.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/aztec/AztecDetectorResult.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
AztecDetectorResult::AztecDetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points, bool compact, int nbDatablocks, int nbLayers)
|
||||
: DetectorResult(bits, points),
|
||||
compact_(compact),
|
||||
nbDatablocks_(nbDatablocks),
|
||||
nbLayers_(nbLayers) {
|
||||
};
|
||||
|
||||
bool AztecDetectorResult::isCompact() {
|
||||
return compact_;
|
||||
}
|
||||
|
||||
int AztecDetectorResult::getNBDatablocks() {
|
||||
return nbDatablocks_;
|
||||
}
|
||||
|
||||
int AztecDetectorResult::getNBLayers() {
|
||||
return nbLayers_;
|
||||
}
|
||||
}
|
||||
}
|
42
cpp/core/src/zxing/aztec/AztecDetectorResult.h
Normal file
42
cpp/core/src/zxing/aztec/AztecDetectorResult.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* AtztecDetecorResult.h
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/common/DetectorResult.h>
|
||||
|
||||
#ifndef ZXingWidget_AtztecDetecorResult_h
|
||||
#define ZXingWidget_AtztecDetecorResult_h
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
class AztecDetectorResult : public DetectorResult {
|
||||
private:
|
||||
bool compact_;
|
||||
int nbDatablocks_, nbLayers_;
|
||||
public:
|
||||
AztecDetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points, bool compact, int nbDatablocks, int nbLayers);
|
||||
bool isCompact();
|
||||
int getNBDatablocks();
|
||||
int getNBLayers();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
64
cpp/core/src/zxing/aztec/AztecReader.cpp
Normal file
64
cpp/core/src/zxing/aztec/AztecReader.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* AztecReader.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/aztec/AztecReader.h>
|
||||
#include <zxing/aztec/detector/Detector.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
|
||||
AztecReader::AztecReader() : decoder_() {
|
||||
// nothing
|
||||
};
|
||||
|
||||
Ref<Result> AztecReader::decode(Ref<zxing::BinaryBitmap> image) {
|
||||
Detector detector(image->getBlackMatrix());
|
||||
|
||||
Ref<AztecDetectorResult> detectorResult(detector.detect());
|
||||
|
||||
std::vector<Ref<ResultPoint> > points(detectorResult->getPoints());
|
||||
|
||||
Ref<DecoderResult> decoderResult(decoder_.decode(detectorResult));
|
||||
|
||||
Ref<Result> result(new Result(decoderResult->getText(),
|
||||
decoderResult->getRawBytes(),
|
||||
points,
|
||||
BarcodeFormat_AZTEC));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Ref<Result> AztecReader::decode(Ref<BinaryBitmap> image, DecodeHints) {
|
||||
//cout << "decoding with hints not supported for aztec" << "\n" << flush;
|
||||
return this->decode(image);
|
||||
}
|
||||
|
||||
AztecReader::~AztecReader() {
|
||||
// nothing
|
||||
}
|
||||
|
||||
Decoder& AztecReader::getDecoder() {
|
||||
return decoder_;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
49
cpp/core/src/zxing/aztec/AztecReader.h
Normal file
49
cpp/core/src/zxing/aztec/AztecReader.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* AztecReader.h
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/Reader.h>
|
||||
#include <zxing/aztec/decoder/Decoder.h>
|
||||
#include <zxing/DecodeHints.h>
|
||||
|
||||
#ifndef ZXingWidget_AztecReader_h
|
||||
#define ZXingWidget_AztecReader_h
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
|
||||
class AztecReader : public Reader {
|
||||
private:
|
||||
Decoder decoder_;
|
||||
|
||||
protected:
|
||||
Decoder &getDecoder();
|
||||
|
||||
public:
|
||||
AztecReader();
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image);
|
||||
virtual Ref<Result> decode(Ref<BinaryBitmap> image, DecodeHints hints);
|
||||
virtual ~AztecReader();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
482
cpp/core/src/zxing/aztec/decoder/Decoder.cpp
Normal file
482
cpp/core/src/zxing/aztec/decoder/Decoder.cpp
Normal file
|
@ -0,0 +1,482 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* Decoder.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/aztec/decoder/Decoder.h>
|
||||
#include <iconv.h>
|
||||
#include <iostream>
|
||||
#include <zxing/FormatException.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
||||
#include <zxing/common/reedsolomon/GenericGF.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
||||
using zxing::aztec::Decoder;
|
||||
using zxing::DecoderResult;
|
||||
using zxing::String;
|
||||
using zxing::BitArray;
|
||||
using zxing::BitMatrix;
|
||||
using zxing::Ref;
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
void add(string& result, uint8_t character) {
|
||||
char s[] = { character & 0xff };
|
||||
char* ss = s;
|
||||
size_t sl = sizeof(s);
|
||||
char d[4];
|
||||
char* ds = d;
|
||||
size_t dl = sizeof(d);
|
||||
iconv_t ic = iconv_open("UTF-8", "ISO-8859-1");
|
||||
iconv(ic, &ss, &sl, &ds, &dl);
|
||||
iconv_close(ic);
|
||||
d[sizeof(d)-dl] = 0;
|
||||
result.append(d);
|
||||
}
|
||||
|
||||
const int NB_BITS_COMPACT[] = {
|
||||
0, 104, 240, 408, 608
|
||||
};
|
||||
|
||||
const int NB_BITS[] = {
|
||||
0, 128, 288, 480, 704, 960, 1248, 1568, 1920, 2304, 2720, 3168, 3648, 4160, 4704, 5280, 5888, 6528,
|
||||
7200, 7904, 8640, 9408, 10208, 11040, 11904, 12800, 13728, 14688, 15680, 16704, 17760, 18848, 19968
|
||||
};
|
||||
|
||||
const int NB_DATABLOCK_COMPACT[] = {
|
||||
0, 17, 40, 51, 76
|
||||
};
|
||||
|
||||
const int NB_DATABLOCK[] = {
|
||||
0, 21, 48, 60, 88, 120, 156, 196, 240, 230, 272, 316, 364, 416, 470, 528, 588, 652, 720, 790, 864,
|
||||
940, 1020, 920, 992, 1066, 1144, 1224, 1306, 1392, 1480, 1570, 1664
|
||||
};
|
||||
|
||||
const char* UPPER_TABLE[] = {
|
||||
"CTRL_PS", " ", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
|
||||
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "CTRL_LL", "CTRL_ML", "CTRL_DL", "CTRL_BS"
|
||||
};
|
||||
|
||||
const char* LOWER_TABLE[] = {
|
||||
"CTRL_PS", " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
|
||||
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "CTRL_US", "CTRL_ML", "CTRL_DL", "CTRL_BS"
|
||||
};
|
||||
|
||||
const char* MIXED_TABLE[] = {
|
||||
"CTRL_PS", " ", "\1", "\2", "\3", "\4", "\5", "\6", "\7", "\b", "\t", "\n",
|
||||
"\13", "\f", "\r", "\33", "\34", "\35", "\36", "\37", "@", "\\", "^", "_",
|
||||
"`", "|", "~", "\177", "CTRL_LL", "CTRL_UL", "CTRL_PL", "CTRL_BS"
|
||||
};
|
||||
|
||||
const char* PUNCT_TABLE[] = {
|
||||
"", "\r", "\r\n", ". ", ", ", ": ", "!", "\"", "#", "$", "%", "&", "'", "(", ")",
|
||||
"*", "+", ",", "-", ".", "/", ":", ";", "<", "=", ">", "?", "[", "]", "{", "}", "CTRL_UL"
|
||||
};
|
||||
|
||||
const char* DIGIT_TABLE[] = {
|
||||
"CTRL_PS", " ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ",", ".", "CTRL_UL", "CTRL_US"
|
||||
};
|
||||
}
|
||||
|
||||
Decoder::Table Decoder::getTable(char t) {
|
||||
switch (t) {
|
||||
case 'L':
|
||||
return LOWER;
|
||||
case 'P':
|
||||
return PUNCT;
|
||||
case 'M':
|
||||
return MIXED;
|
||||
case 'D':
|
||||
return DIGIT;
|
||||
case 'B':
|
||||
return BINARY;
|
||||
case 'U':
|
||||
default:
|
||||
return UPPER;
|
||||
}
|
||||
}
|
||||
|
||||
const char* Decoder::getCharacter(zxing::aztec::Decoder::Table table, int code) {
|
||||
switch (table) {
|
||||
case UPPER:
|
||||
return UPPER_TABLE[code];
|
||||
case LOWER:
|
||||
return LOWER_TABLE[code];
|
||||
case MIXED:
|
||||
return MIXED_TABLE[code];
|
||||
case PUNCT:
|
||||
return PUNCT_TABLE[code];
|
||||
case DIGIT:
|
||||
return DIGIT_TABLE[code];
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Decoder::Decoder() {
|
||||
// nothing
|
||||
}
|
||||
|
||||
Ref<DecoderResult> Decoder::decode(Ref<zxing::aztec::AztecDetectorResult> detectorResult) {
|
||||
ddata_ = detectorResult;
|
||||
|
||||
// std::printf("getting bits\n");
|
||||
|
||||
Ref<BitMatrix> matrix = detectorResult->getBits();
|
||||
|
||||
if (!ddata_->isCompact()) {
|
||||
// std::printf("removing lines\n");
|
||||
matrix = removeDashedLines(ddata_->getBits());
|
||||
}
|
||||
|
||||
// std::printf("extracting bits\n");
|
||||
Ref<BitArray> rawbits = extractBits(matrix);
|
||||
|
||||
// std::printf("correcting bits\n");
|
||||
Ref<BitArray> aCorrectedBits = correctBits(rawbits);
|
||||
|
||||
// std::printf("decoding bits\n");
|
||||
Ref<String> result = getEncodedData(aCorrectedBits);
|
||||
|
||||
// std::printf("constructing array\n");
|
||||
ArrayRef<unsigned char> arrayOut(aCorrectedBits->getSize());
|
||||
for (int i = 0; i < aCorrectedBits->count(); i++) {
|
||||
arrayOut[i] = (unsigned char)aCorrectedBits->get(i);
|
||||
}
|
||||
|
||||
// std::printf("returning\n");
|
||||
|
||||
return Ref<DecoderResult>(new DecoderResult(arrayOut, result));
|
||||
}
|
||||
|
||||
Ref<String> Decoder::getEncodedData(Ref<zxing::BitArray> correctedBits) {
|
||||
int endIndex = codewordSize_ * ddata_->getNBDatablocks() - invertedBitCount_;
|
||||
if (endIndex > (int)correctedBits->getSize()) {
|
||||
// std::printf("invalid input\n");
|
||||
throw FormatException("invalid input data");
|
||||
}
|
||||
|
||||
Table lastTable = UPPER;
|
||||
Table table = UPPER;
|
||||
int startIndex = 0;
|
||||
std::string result;
|
||||
bool end = false;
|
||||
bool shift = false;
|
||||
bool switchShift = false;
|
||||
bool binaryShift = false;
|
||||
|
||||
while (!end) {
|
||||
// std::printf("decoooooding\n");
|
||||
|
||||
if (shift) {
|
||||
switchShift = true;
|
||||
} else {
|
||||
lastTable = table;
|
||||
}
|
||||
|
||||
int code;
|
||||
if (binaryShift) {
|
||||
if (endIndex - startIndex < 5) {
|
||||
break;
|
||||
}
|
||||
|
||||
int length = readCode(correctedBits, startIndex, 5);
|
||||
startIndex += 5;
|
||||
if (length == 0) {
|
||||
if (endIndex - startIndex < 11) {
|
||||
break;
|
||||
}
|
||||
|
||||
length = readCode(correctedBits, startIndex, 11) + 31;
|
||||
startIndex += 11;
|
||||
}
|
||||
for (int charCount = 0; charCount < length; charCount++) {
|
||||
if (endIndex - startIndex < 8) {
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
|
||||
code = readCode(correctedBits, startIndex, 8);
|
||||
add(result, code);
|
||||
startIndex += 8;
|
||||
}
|
||||
binaryShift = false;
|
||||
} else {
|
||||
if (table == BINARY) {
|
||||
if (endIndex - startIndex < 8) {
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
code = readCode(correctedBits, startIndex, 8);
|
||||
startIndex += 8;
|
||||
|
||||
add(result, code);
|
||||
} else {
|
||||
int size = 5;
|
||||
|
||||
if (table == DIGIT) {
|
||||
size = 4;
|
||||
}
|
||||
|
||||
if (endIndex - startIndex < size) {
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
|
||||
code = readCode(correctedBits, startIndex, size);
|
||||
startIndex += size;
|
||||
|
||||
const char *str = getCharacter(table, code);
|
||||
std::string string(str);
|
||||
if ((int)string.find("CTRL_") != -1) {
|
||||
table = getTable(str[5]);
|
||||
|
||||
if (str[6] == 'S') {
|
||||
shift = true;
|
||||
if (str[5] == 'B') {
|
||||
binaryShift = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result.append(string);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (switchShift) {
|
||||
table = lastTable;
|
||||
shift = false;
|
||||
switchShift = false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return Ref<String>(new String(result));
|
||||
|
||||
}
|
||||
|
||||
Ref<BitArray> Decoder::correctBits(Ref<zxing::BitArray> rawbits) {
|
||||
//return rawbits;
|
||||
// std::printf("decoding stuff:%d datablocks in %d layers\n", ddata_->getNBDatablocks(), ddata_->getNBLayers());
|
||||
|
||||
Ref<GenericGF> gf = GenericGF::AZTEC_DATA_6;
|
||||
|
||||
if (ddata_->getNBLayers() <= 2) {
|
||||
codewordSize_ = 6;
|
||||
gf = GenericGF::AZTEC_DATA_6;
|
||||
} else if (ddata_->getNBLayers() <= 8) {
|
||||
codewordSize_ = 8;
|
||||
gf = GenericGF::AZTEC_DATA_8;
|
||||
} else if (ddata_->getNBLayers() <= 22) {
|
||||
codewordSize_ = 10;
|
||||
gf = GenericGF::AZTEC_DATA_10;
|
||||
} else {
|
||||
codewordSize_ = 12;
|
||||
gf = GenericGF::AZTEC_DATA_12;
|
||||
}
|
||||
|
||||
int numDataCodewords = ddata_->getNBDatablocks();
|
||||
int numECCodewords;
|
||||
int offset;
|
||||
|
||||
if (ddata_->isCompact()) {
|
||||
offset = NB_BITS_COMPACT[ddata_->getNBLayers()] - numCodewords_ * codewordSize_;
|
||||
numECCodewords = NB_DATABLOCK_COMPACT[ddata_->getNBLayers()] - numDataCodewords;
|
||||
} else {
|
||||
offset = NB_BITS[ddata_->getNBLayers()] - numCodewords_ * codewordSize_;
|
||||
numECCodewords = NB_DATABLOCK[ddata_->getNBLayers()] - numDataCodewords;
|
||||
}
|
||||
|
||||
ArrayRef<int> dataWords(numCodewords_);
|
||||
|
||||
for (int i = 0; i < numCodewords_; i++) {
|
||||
int flag = 1;
|
||||
for (int j = 1; j <= codewordSize_; j++) {
|
||||
if (rawbits->get(codewordSize_ * i + codewordSize_ - j + offset)) {
|
||||
dataWords[i] += flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
}
|
||||
|
||||
try {
|
||||
// std::printf("trying reed solomon, numECCodewords:%d\n", numECCodewords);
|
||||
ReedSolomonDecoder rsDecoder(gf);
|
||||
rsDecoder.decode(dataWords, numECCodewords);
|
||||
} catch (ReedSolomonException rse) {
|
||||
// std::printf("got reed solomon exception:%s, throwing formatexception\n", rse.what());
|
||||
throw FormatException("rs decoding failed");
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// std::printf("illegal argument exception: %s", iae.what());
|
||||
}
|
||||
|
||||
offset = 0;
|
||||
invertedBitCount_ = 0;
|
||||
|
||||
Ref<BitArray> correctedBits(new BitArray(numDataCodewords * codewordSize_));
|
||||
for (int i = 0; i < numDataCodewords; i++) {
|
||||
|
||||
bool seriesColor = false;
|
||||
int seriesCount = 0;
|
||||
int flag = 1 << (codewordSize_ - 1);
|
||||
|
||||
for (int j = 0; j < codewordSize_; j++) {
|
||||
|
||||
bool color = (dataWords[i] & flag) == flag;
|
||||
|
||||
if (seriesCount == codewordSize_ - 1) {
|
||||
|
||||
if (color == seriesColor) {
|
||||
throw FormatException("bit was not inverted");
|
||||
}
|
||||
|
||||
seriesColor = false;
|
||||
seriesCount = 0;
|
||||
offset++;
|
||||
invertedBitCount_++;
|
||||
|
||||
} else {
|
||||
|
||||
if (seriesColor == color) {
|
||||
seriesCount++;
|
||||
} else {
|
||||
seriesCount = 1;
|
||||
seriesColor = color;
|
||||
}
|
||||
|
||||
if (color) correctedBits->set(i * codewordSize_ + j - offset);
|
||||
|
||||
}
|
||||
|
||||
flag = (unsigned int)flag >> 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return correctedBits;
|
||||
}
|
||||
|
||||
Ref<BitArray> Decoder::extractBits(Ref<zxing::BitMatrix> matrix) {
|
||||
std::vector<bool> rawbits;
|
||||
|
||||
if (ddata_->isCompact()) {
|
||||
if (ddata_->getNBLayers() > 5) { //NB_BITS_COMPACT length
|
||||
throw FormatException("data is too long");
|
||||
}
|
||||
rawbits = std::vector<bool>(NB_BITS_COMPACT[ddata_->getNBLayers()]);
|
||||
numCodewords_ = NB_DATABLOCK_COMPACT[ddata_->getNBLayers()];
|
||||
} else {
|
||||
if (ddata_->getNBLayers() > 33) { //NB_BITS length
|
||||
throw FormatException("data is too long");
|
||||
}
|
||||
rawbits = std::vector<bool>(NB_BITS[ddata_->getNBLayers()]);
|
||||
numCodewords_ = NB_DATABLOCK[ddata_->getNBLayers()];
|
||||
}
|
||||
|
||||
int layer = ddata_->getNBLayers();
|
||||
int size = matrix->getHeight();
|
||||
int rawbitsOffset = 0;
|
||||
int matrixOffset = 0;
|
||||
|
||||
|
||||
while (layer != 0) {
|
||||
|
||||
int flip = 0;
|
||||
for (int i = 0; i < 2 * size - 4; i++) {
|
||||
rawbits[rawbitsOffset + i] = matrix->get(matrixOffset + flip, matrixOffset + i / 2);
|
||||
rawbits[rawbitsOffset + 2 * size - 4 + i] = matrix->get(matrixOffset + i / 2, matrixOffset + size - 1 - flip);
|
||||
flip = (flip + 1) % 2;
|
||||
}
|
||||
|
||||
flip = 0;
|
||||
for (int i = 2 * size + 1; i > 5; i--) {
|
||||
rawbits[rawbitsOffset + 4 * size - 8 + (2 * size - i) + 1] =
|
||||
matrix->get(matrixOffset + size - 1 - flip, matrixOffset + i / 2 - 1);
|
||||
rawbits[rawbitsOffset + 6 * size - 12 + (2 * size - i) + 1] =
|
||||
matrix->get(matrixOffset + i / 2 - 1, matrixOffset + flip);
|
||||
flip = (flip + 1) % 2;
|
||||
}
|
||||
|
||||
matrixOffset += 2;
|
||||
rawbitsOffset += 8 * size - 16;
|
||||
layer--;
|
||||
size -= 4;
|
||||
|
||||
}
|
||||
|
||||
Ref<BitArray> returnValue(new BitArray(rawbits.size()));
|
||||
for (int i = 0; i < (int)rawbits.size(); i++) {
|
||||
if (rawbits[i]) returnValue->set(i);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
|
||||
}
|
||||
|
||||
Ref<BitMatrix> Decoder::removeDashedLines(Ref<zxing::BitMatrix> matrix) {
|
||||
int nbDashed = 1 + 2 * ((matrix->getWidth() - 1) / 2 / 16);
|
||||
Ref<BitMatrix> newMatrix(new BitMatrix(matrix->getWidth() - nbDashed, matrix->getHeight() - nbDashed));
|
||||
|
||||
int nx = 0;
|
||||
|
||||
for (int x = 0; x < (int)matrix->getWidth(); x++) {
|
||||
|
||||
if ((matrix->getWidth() / 2 - x) % 16 == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int ny = 0;
|
||||
for (int y = 0; y < (int)matrix->getHeight(); y++) {
|
||||
|
||||
if ((matrix->getWidth() / 2 - y) % 16 == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (matrix->get(x, y)) {
|
||||
newMatrix->set(nx, ny);
|
||||
}
|
||||
ny++;
|
||||
|
||||
}
|
||||
nx++;
|
||||
|
||||
}
|
||||
return newMatrix;
|
||||
}
|
||||
|
||||
int Decoder::readCode(Ref<zxing::BitArray> rawbits, int startIndex, int length) {
|
||||
int res = 0;
|
||||
|
||||
for (int i = startIndex; i < startIndex + length; i++) {
|
||||
res <<= 1;
|
||||
if (rawbits->get(i)) {
|
||||
res ++;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
63
cpp/core/src/zxing/aztec/decoder/Decoder.h
Normal file
63
cpp/core/src/zxing/aztec/decoder/Decoder.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* Decoder.h
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/common/DecoderResult.h>
|
||||
#include <zxing/common/BitMatrix.h>
|
||||
#include <zxing/common/str.h>
|
||||
#include <zxing/aztec/AztecDetectorResult.h>
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
|
||||
class Decoder : public Counted {
|
||||
private:
|
||||
enum Table {
|
||||
UPPER,
|
||||
LOWER,
|
||||
MIXED,
|
||||
DIGIT,
|
||||
PUNCT,
|
||||
BINARY
|
||||
};
|
||||
|
||||
static Table getTable(char t);
|
||||
static const char* getCharacter(Table table, int code);
|
||||
|
||||
int numCodewords_;
|
||||
int codewordSize_;
|
||||
Ref<AztecDetectorResult> ddata_;
|
||||
int invertedBitCount_;
|
||||
|
||||
Ref<String> getEncodedData(Ref<BitArray> correctedBits);
|
||||
Ref<BitArray> correctBits(Ref<BitArray> rawbits);
|
||||
Ref<BitArray> extractBits(Ref<BitMatrix> matrix);
|
||||
static Ref<BitMatrix> removeDashedLines(Ref<BitMatrix> matrix);
|
||||
static int readCode(Ref<BitArray> rawbits, int startIndex, int length);
|
||||
|
||||
|
||||
public:
|
||||
Decoder();
|
||||
Ref<DecoderResult> decode(Ref<AztecDetectorResult> detectorResult);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
554
cpp/core/src/zxing/aztec/detector/Detector.cpp
Normal file
554
cpp/core/src/zxing/aztec/detector/Detector.cpp
Normal file
|
@ -0,0 +1,554 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* Detector.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <zxing/aztec/detector/Detector.h>
|
||||
#include <zxing/common/GridSampler.h>
|
||||
#include <zxing/common/detector/WhiteRectangleDetector.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
||||
#include <zxing/common/reedsolomon/GenericGF.h>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <zxing/NotFoundException.h>
|
||||
|
||||
using zxing::aztec::Detector;
|
||||
using zxing::aztec::Point;
|
||||
using zxing::aztec::AztecDetectorResult;
|
||||
using zxing::Ref;
|
||||
using zxing::ResultPoint;
|
||||
using zxing::BitArray;
|
||||
using zxing::BitMatrix;
|
||||
|
||||
Detector::Detector(Ref<BitMatrix> image):
|
||||
image_(image),
|
||||
nbLayers_(0),
|
||||
nbDataBlocks_(0),
|
||||
nbCenterLayers_(0) {
|
||||
|
||||
}
|
||||
|
||||
// using namespace std;
|
||||
|
||||
Ref<AztecDetectorResult> Detector::detect() {
|
||||
Ref<Point> pCenter = getMatrixCenter();
|
||||
|
||||
std::vector<Ref<Point> > bullEyeCornerPoints = getBullEyeCornerPoints(pCenter);
|
||||
|
||||
extractParameters(bullEyeCornerPoints);
|
||||
|
||||
std::vector<Ref<ResultPoint> > corners = getMatrixCornerPoints(bullEyeCornerPoints);
|
||||
|
||||
Ref<BitMatrix> bits = sampleGrid(image_, corners[shift_%4], corners[(shift_+3)%4], corners[(shift_+2)%4], corners[(shift_+1)%4]);
|
||||
|
||||
// std::printf("------------\ndetected: compact:%s, nbDataBlocks:%d, nbLayers:%d\n------------\n",compact_?"YES":"NO", nbDataBlocks_, nbLayers_);
|
||||
|
||||
return Ref<AztecDetectorResult>(new AztecDetectorResult(bits, corners, compact_, nbDataBlocks_, nbLayers_));
|
||||
}
|
||||
|
||||
void Detector::extractParameters(std::vector<Ref<Point> > bullEyeCornerPoints) {
|
||||
// get the bits around the bull's eye
|
||||
Ref<BitArray> resab = sampleLine(bullEyeCornerPoints[0], bullEyeCornerPoints[1], 2*nbCenterLayers_+1);
|
||||
Ref<BitArray> resbc = sampleLine(bullEyeCornerPoints[1], bullEyeCornerPoints[2], 2*nbCenterLayers_+1);
|
||||
Ref<BitArray> rescd = sampleLine(bullEyeCornerPoints[2], bullEyeCornerPoints[3], 2*nbCenterLayers_+1);
|
||||
Ref<BitArray> resda = sampleLine(bullEyeCornerPoints[3], bullEyeCornerPoints[0], 2*nbCenterLayers_+1);
|
||||
|
||||
// determin the orientation of the matrix
|
||||
if (resab->get(0) && resab->get(2 * nbCenterLayers_)) {
|
||||
shift_ = 0;
|
||||
} else if (resbc->get(0) && resbc->get(2 * nbCenterLayers_)) {
|
||||
shift_ = 1;
|
||||
} else if (rescd->get(0) && rescd->get(2 * nbCenterLayers_)) {
|
||||
shift_ = 2;
|
||||
} else if (resda->get(0) && resda->get(2 * nbCenterLayers_)) {
|
||||
shift_ = 3;
|
||||
} else {
|
||||
// std::printf("could not detemine orientation\n");
|
||||
throw ReaderException("could not determine orientation");
|
||||
}
|
||||
|
||||
//d a
|
||||
//
|
||||
//c b
|
||||
|
||||
//flatten the bits in a single array
|
||||
Ref<BitArray> parameterData(new BitArray(compact_?28:40));
|
||||
Ref<BitArray> shiftedParameterData(new BitArray(compact_?28:40));
|
||||
|
||||
if (compact_) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (resab->get(2+i)) shiftedParameterData->set(i);
|
||||
if (resbc->get(2+i)) shiftedParameterData->set(i+7);
|
||||
if (rescd->get(2+i)) shiftedParameterData->set(i+14);
|
||||
if (resda->get(2+i)) shiftedParameterData->set(i+21);
|
||||
}
|
||||
for (int i = 0; i < 28; i++) {
|
||||
if (shiftedParameterData->get((i+shift_*7)%28)) parameterData->set(i);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (i < 5) {
|
||||
if (resab->get(2+i)) shiftedParameterData->set(i);
|
||||
if (resbc->get(2+i)) shiftedParameterData->set(i+10);
|
||||
if (rescd->get(2+i)) shiftedParameterData->set(i+20);
|
||||
if (resda->get(2+i)) shiftedParameterData->set(i+30);
|
||||
}
|
||||
if (i > 5) {
|
||||
if (resab->get(2+i)) shiftedParameterData->set(i-1);
|
||||
if (resbc->get(2+i)) shiftedParameterData->set(i+10-1);
|
||||
if (rescd->get(2+i)) shiftedParameterData->set(i+20-1);
|
||||
if (resda->get(2+i)) shiftedParameterData->set(i+30-1);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 40; i++) {
|
||||
if (shiftedParameterData->get((i+shift_*10)%40)) parameterData->set(i);
|
||||
}
|
||||
}
|
||||
|
||||
correctParameterData(parameterData, compact_);
|
||||
|
||||
getParameters(parameterData);
|
||||
}
|
||||
|
||||
std::vector<Ref<ResultPoint> > Detector::getMatrixCornerPoints(std::vector<Ref<Point> > bullEyeCornerPoints) {
|
||||
float ratio = (2 * nbLayers_ + (nbLayers_ > 4 ? 1 : 0) + (nbLayers_ - 4) / 8) / (2.0f * nbCenterLayers_);
|
||||
|
||||
int dx = bullEyeCornerPoints[0]->x - bullEyeCornerPoints[2]->x;
|
||||
dx += dx > 0 ? 1 : -1;
|
||||
int dy = bullEyeCornerPoints[0]->y - bullEyeCornerPoints[2]->y;
|
||||
dy += dy > 0 ? 1 : -1;
|
||||
|
||||
int targetcx = ROUND(bullEyeCornerPoints[2]->x - ratio * dx);
|
||||
int targetcy = ROUND(bullEyeCornerPoints[2]->y - ratio * dy);
|
||||
|
||||
int targetax = ROUND(bullEyeCornerPoints[0]->x + ratio * dx);
|
||||
int targetay = ROUND(bullEyeCornerPoints[0]->y + ratio * dy);
|
||||
|
||||
dx = bullEyeCornerPoints[1]->x - bullEyeCornerPoints[3]->x;
|
||||
dx += dx > 0 ? 1 : -1;
|
||||
dy = bullEyeCornerPoints[1]->y - bullEyeCornerPoints[3]->y;
|
||||
dy += dy > 0 ? 1 : -1;
|
||||
|
||||
int targetdx = ROUND(bullEyeCornerPoints[3]->x - ratio * dx);
|
||||
int targetdy = ROUND(bullEyeCornerPoints[3]->y - ratio * dy);
|
||||
int targetbx = ROUND(bullEyeCornerPoints[1]->x + ratio * dx);
|
||||
int targetby = ROUND(bullEyeCornerPoints[1]->y + ratio * dy);
|
||||
|
||||
if (!isValid(targetax, targetay) ||
|
||||
!isValid(targetbx, targetby) ||
|
||||
!isValid(targetcx, targetcy) ||
|
||||
!isValid(targetdx, targetdy)) {
|
||||
throw ReaderException("matrix extends over image bounds");
|
||||
}
|
||||
std::vector<Ref<ResultPoint> > returnValue;
|
||||
returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetax, targetay)));
|
||||
returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetbx, targetby)));
|
||||
returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetcx, targetcy)));
|
||||
returnValue.push_back(Ref<ResultPoint>(new ResultPoint(targetdx, targetdy)));
|
||||
|
||||
return returnValue;
|
||||
|
||||
}
|
||||
|
||||
void Detector::correctParameterData(Ref<zxing::BitArray> parameterData, bool compact) {
|
||||
int numCodewords;
|
||||
int numDataCodewords;
|
||||
|
||||
if (compact) {
|
||||
numCodewords = 7;
|
||||
numDataCodewords = 2;
|
||||
} else {
|
||||
numCodewords = 10;
|
||||
numDataCodewords = 4;
|
||||
}
|
||||
|
||||
int numECCodewords = numCodewords - numDataCodewords;
|
||||
|
||||
ArrayRef<int> parameterWords(new Array<int>(numCodewords));
|
||||
|
||||
int codewordSize = 4;
|
||||
for (int i = 0; i < numCodewords; i++) {
|
||||
int flag = 1;
|
||||
for (int j = 1; j <= codewordSize; j++) {
|
||||
if (parameterData->get(codewordSize*i + codewordSize - j)) {
|
||||
parameterWords[i] += flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// std::printf("parameter data reed solomon\n");
|
||||
ReedSolomonDecoder rsDecoder(GenericGF::AZTEC_PARAM);
|
||||
rsDecoder.decode(parameterWords, numECCodewords);
|
||||
} catch (ReedSolomonException e) {
|
||||
// std::printf("reed solomon decoding failed\n");
|
||||
throw ReaderException("failed to decode parameter data");
|
||||
}
|
||||
|
||||
parameterData->clear();
|
||||
for (int i = 0; i < numDataCodewords; i++) {
|
||||
int flag = 1;
|
||||
for (int j = 1; j <= codewordSize; j++) {
|
||||
if ((parameterWords[i] & flag) == flag) {
|
||||
parameterData->set(i*codewordSize+codewordSize-j);
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Ref<Point> > Detector::getBullEyeCornerPoints(Ref<zxing::aztec::Point> pCenter) {
|
||||
Ref<Point> pina = pCenter;
|
||||
Ref<Point> pinb = pCenter;
|
||||
Ref<Point> pinc = pCenter;
|
||||
Ref<Point> pind = pCenter;
|
||||
|
||||
bool color = true;
|
||||
|
||||
for (nbCenterLayers_ = 1; nbCenterLayers_ < 9; nbCenterLayers_++) {
|
||||
Ref<Point> pouta = getFirstDifferent(pina, color, 1, -1);
|
||||
Ref<Point> poutb = getFirstDifferent(pinb, color, 1, 1);
|
||||
Ref<Point> poutc = getFirstDifferent(pinc, color, -1, 1);
|
||||
Ref<Point> poutd = getFirstDifferent(pind, color, -1, -1);
|
||||
|
||||
//d a
|
||||
//
|
||||
//c b
|
||||
|
||||
if (nbCenterLayers_ > 2) {
|
||||
float q = distance(poutd, pouta) * nbCenterLayers_ / (distance(pind, pina) * (nbCenterLayers_ + 2));
|
||||
if (q < 0.75 || q > 1.25 || !isWhiteOrBlackRectangle(pouta, poutb, poutc, poutd)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pina = pouta;
|
||||
pinb = poutb;
|
||||
pinc = poutc;
|
||||
pind = poutd;
|
||||
|
||||
color = !color;
|
||||
}
|
||||
|
||||
if (nbCenterLayers_ != 5 && nbCenterLayers_ != 7) {
|
||||
throw ReaderException("encountered wrong bullseye ring count");
|
||||
}
|
||||
|
||||
compact_ = nbCenterLayers_ == 5;
|
||||
|
||||
|
||||
|
||||
float ratio = 0.75f*2 / (2*nbCenterLayers_-3);
|
||||
|
||||
int dx = pina->x - pind->x;
|
||||
int dy = pina->y - pinc->y;
|
||||
|
||||
int targetcx = ROUND(pinc->x - ratio * dx);
|
||||
int targetcy = ROUND(pinc->y - ratio * dy);
|
||||
int targetax = ROUND(pina->x + ratio * dx);
|
||||
int targetay = ROUND(pina->y + ratio * dy);
|
||||
|
||||
dx = pinb->x - pind->x;
|
||||
dy = pinb->y - pind->y;
|
||||
|
||||
int targetdx = ROUND(pind->x - ratio * dx);
|
||||
int targetdy = ROUND(pind->y - ratio * dy);
|
||||
int targetbx = ROUND(pinb->x + ratio * dx);
|
||||
int targetby = ROUND(pinb->y + ratio * dy);
|
||||
|
||||
if (!isValid(targetax, targetay) ||
|
||||
!isValid(targetbx, targetby) ||
|
||||
!isValid(targetcx, targetcy) ||
|
||||
!isValid(targetdx, targetdy)) {
|
||||
throw ReaderException("bullseye extends over image bounds");
|
||||
}
|
||||
|
||||
std::vector<Ref<Point> > returnValue;
|
||||
returnValue.push_back(Ref<Point>(new Point(targetax, targetay)));
|
||||
returnValue.push_back(Ref<Point>(new Point(targetbx, targetby)));
|
||||
returnValue.push_back(Ref<Point>(new Point(targetcx, targetcy)));
|
||||
returnValue.push_back(Ref<Point>(new Point(targetdx, targetdy)));
|
||||
|
||||
return returnValue;
|
||||
|
||||
}
|
||||
|
||||
Ref<Point> Detector::getMatrixCenter() {
|
||||
Ref<ResultPoint> pointA, pointB, pointC, pointD;
|
||||
try {
|
||||
|
||||
std::vector<Ref<ResultPoint> > cornerPoints = WhiteRectangleDetector(image_).detect();
|
||||
pointA = cornerPoints[0];
|
||||
pointB = cornerPoints[1];
|
||||
pointC = cornerPoints[2];
|
||||
pointD = cornerPoints[3];
|
||||
|
||||
} catch (NotFoundException e) {
|
||||
|
||||
int cx = image_->getWidth() / 2;
|
||||
int cy = image_->getHeight() / 2;
|
||||
|
||||
pointA = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy-15/2)), false, 1, -1)->toResultPoint();
|
||||
pointB = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy+15/2)), false, 1, 1)->toResultPoint();
|
||||
pointC = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy+15/2)), false, -1, -1)->toResultPoint();
|
||||
pointD = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy-15/2)), false, -1, -1)->toResultPoint();
|
||||
|
||||
}
|
||||
|
||||
int cx = ROUND((pointA->getX() + pointD->getX() + pointB->getX() + pointC->getX()) / 4);
|
||||
int cy = ROUND((pointA->getY() + pointD->getY() + pointB->getY() + pointC->getY()) / 4);
|
||||
|
||||
try {
|
||||
|
||||
std::vector<Ref<ResultPoint> > cornerPoints = WhiteRectangleDetector(image_, 15, cx, cy).detect();
|
||||
pointA = cornerPoints[0];
|
||||
pointB = cornerPoints[1];
|
||||
pointC = cornerPoints[2];
|
||||
pointD = cornerPoints[3];
|
||||
|
||||
} catch (NotFoundException e) {
|
||||
|
||||
pointA = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy-15/2)), false, 1, -1)->toResultPoint();
|
||||
pointB = getFirstDifferent(Ref<Point>(new Point(cx+15/2, cy+15/2)), false, 1, 1)->toResultPoint();
|
||||
pointC = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy+15/2)), false, -1, -1)->toResultPoint();
|
||||
pointD = getFirstDifferent(Ref<Point>(new Point(cx-15/2, cy-15/2)), false, -1, -1)->toResultPoint();
|
||||
|
||||
}
|
||||
|
||||
cx = ROUND((pointA->getX() + pointD->getX() + pointB->getX() + pointC->getX()) / 4);
|
||||
cy = ROUND((pointA->getY() + pointD->getY() + pointB->getY() + pointC->getY()) / 4);
|
||||
|
||||
return Ref<Point>(new Point(cx, cy));
|
||||
|
||||
}
|
||||
|
||||
Ref<BitMatrix> Detector::sampleGrid(Ref<zxing::BitMatrix> image,
|
||||
Ref<zxing::ResultPoint> topLeft,
|
||||
Ref<zxing::ResultPoint> bottomLeft,
|
||||
Ref<zxing::ResultPoint> bottomRight,
|
||||
Ref<zxing::ResultPoint> topRight) {
|
||||
int dimension;
|
||||
if (compact_) {
|
||||
dimension = 4 * nbLayers_+11;
|
||||
} else {
|
||||
if (nbLayers_ <= 4) {
|
||||
dimension = 4 * nbLayers_ + 15;
|
||||
} else {
|
||||
dimension = 4 * nbLayers_ + 2 * ((nbLayers_-4)/8 + 1) + 15;
|
||||
}
|
||||
}
|
||||
|
||||
GridSampler sampler = GridSampler::getInstance();
|
||||
|
||||
return sampler.sampleGrid(image,
|
||||
dimension,
|
||||
0.5f,
|
||||
0.5f,
|
||||
dimension - 0.5f,
|
||||
0.5f,
|
||||
dimension - 0.5f,
|
||||
dimension - 0.5f,
|
||||
0.5f,
|
||||
dimension - 0.5f,
|
||||
topLeft->getX(),
|
||||
topLeft->getY(),
|
||||
topRight->getX(),
|
||||
topRight->getY(),
|
||||
bottomRight->getX(),
|
||||
bottomRight->getY(),
|
||||
bottomLeft->getX(),
|
||||
bottomLeft->getY());
|
||||
}
|
||||
|
||||
void Detector::getParameters(Ref<zxing::BitArray> parameterData) {
|
||||
|
||||
if (false) {
|
||||
printf("getting parameters from: ");
|
||||
for (int i = 0; i < (int)parameterData->getSize(); i++) {
|
||||
if (parameterData->get(i)) {
|
||||
printf("1");
|
||||
} else {
|
||||
printf("0");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
nbLayers_ = 0;
|
||||
nbDataBlocks_ = 0;
|
||||
|
||||
int nbBitsForNbLayers;
|
||||
int nbBitsForNbDatablocks;
|
||||
|
||||
if (compact_) {
|
||||
nbBitsForNbLayers = 2;
|
||||
nbBitsForNbDatablocks = 6;
|
||||
} else {
|
||||
nbBitsForNbLayers = 5;
|
||||
nbBitsForNbDatablocks = 11;
|
||||
}
|
||||
|
||||
for (int i = 0; i < nbBitsForNbLayers; i++) {
|
||||
nbLayers_ <<= 1;
|
||||
if (parameterData->get(i)) {
|
||||
nbLayers_ += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = nbBitsForNbLayers; i < nbBitsForNbLayers + nbBitsForNbDatablocks; i++) {
|
||||
nbDataBlocks_ <<= 1;
|
||||
if (parameterData->get(i)) {
|
||||
nbDataBlocks_ += 1;
|
||||
}
|
||||
}
|
||||
|
||||
nbLayers_ ++;
|
||||
nbDataBlocks_ ++;
|
||||
}
|
||||
|
||||
Ref<BitArray> Detector::sampleLine(Ref<zxing::aztec::Point> p1, Ref<zxing::aztec::Point> p2, int size) {
|
||||
Ref<BitArray> res(new BitArray(size));
|
||||
|
||||
float d = distance(p1, p2);
|
||||
float moduleSize = d / (size-1);
|
||||
float dx = moduleSize * (p2->x - p1->x)/d;
|
||||
float dy = moduleSize * (p2->y - p1->y)/d;
|
||||
|
||||
float px = p1->x;
|
||||
float py = p1->y;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (image_->get(ROUND(px), ROUND(py))) res->set(i);
|
||||
px += dx;
|
||||
py += dy;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool Detector::isWhiteOrBlackRectangle(Ref<zxing::aztec::Point> p1,
|
||||
Ref<zxing::aztec::Point> p2,
|
||||
Ref<zxing::aztec::Point> p3,
|
||||
Ref<zxing::aztec::Point> p4) {
|
||||
int corr = 3;
|
||||
|
||||
p1 = new Point(p1->x - corr, p1->y + corr);
|
||||
p2 = new Point(p2->x - corr, p2->y - corr);
|
||||
p3 = new Point(p3->x + corr, p3->y - corr);
|
||||
p4 = new Point(p4->x + corr, p4->y + corr);
|
||||
|
||||
int cInit = getColor(p4, p1);
|
||||
|
||||
if (cInit == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int c = getColor(p1, p2);
|
||||
|
||||
if (c != cInit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
c = getColor(p2, p3);
|
||||
|
||||
if (c != cInit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
c = getColor(p3, p4);
|
||||
|
||||
if (c != cInit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int Detector::getColor(Ref<zxing::aztec::Point> p1, Ref<zxing::aztec::Point> p2) {
|
||||
float d = distance(p1, p2);
|
||||
|
||||
float dx = (p2->x - p1->x) / d;
|
||||
float dy = (p2->y - p1->y) / d;
|
||||
|
||||
int error = 0;
|
||||
|
||||
float px = p1->x;
|
||||
float py = p1->y;
|
||||
|
||||
bool colorModel = image_->get(p1->x, p1->y);
|
||||
|
||||
for (int i = 0; i < d; i++) {
|
||||
px += dx;
|
||||
py += dy;
|
||||
if (image_->get(ROUND(px), ROUND(py)) != colorModel) {
|
||||
error ++;
|
||||
}
|
||||
}
|
||||
|
||||
float errRatio = (float)error/d;
|
||||
|
||||
|
||||
if (errRatio > 0.1 && errRatio < 0.9) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (errRatio <= 0.1) {
|
||||
return colorModel?1:-1;
|
||||
} else {
|
||||
return colorModel?-1:1;
|
||||
}
|
||||
}
|
||||
|
||||
Ref<Point> Detector::getFirstDifferent(Ref<zxing::aztec::Point> init, bool color, int dx, int dy) {
|
||||
int x = init->x + dx;
|
||||
int y = init->y + dy;
|
||||
|
||||
while (isValid(x, y) && image_->get(x, y) == color) {
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
x -= dx;
|
||||
y -= dy;
|
||||
|
||||
while (isValid(x, y) && image_->get(x, y) == color) {
|
||||
x += dx;
|
||||
}
|
||||
|
||||
x -= dx;
|
||||
|
||||
while (isValid(x, y) && image_->get(x, y) == color) {
|
||||
y += dy;
|
||||
}
|
||||
|
||||
y -= dy;
|
||||
|
||||
return Ref<Point>(new Point(x, y));
|
||||
}
|
||||
|
||||
bool Detector::isValid(int x, int y) {
|
||||
return x >= 0 && x < (int)image_->getWidth() && y > 0 && y < (int)image_->getHeight();
|
||||
}
|
||||
|
||||
float Detector::distance(Ref<zxing::aztec::Point> a, Ref<zxing::aztec::Point> b) {
|
||||
return sqrtf((float)((a->x - b->x) * (a->x - b->x) + (a->y - b->y) * (a->y - b->y)));
|
||||
}
|
87
cpp/core/src/zxing/aztec/detector/Detector.h
Normal file
87
cpp/core/src/zxing/aztec/detector/Detector.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* Detector.h
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 08/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <zxing/common/BitArray.h>
|
||||
#include <zxing/ResultPoint.h>
|
||||
#include <zxing/common/BitMatrix.h>
|
||||
#include <zxing/DecodeHints.h>
|
||||
#include <zxing/aztec/AztecDetectorResult.h>
|
||||
|
||||
#define ROUND(a) ((int)(a + 0.5f))
|
||||
|
||||
namespace zxing {
|
||||
namespace aztec {
|
||||
|
||||
class Point : public Counted {
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
|
||||
Ref<ResultPoint> toResultPoint() {
|
||||
return Ref<ResultPoint>(new ResultPoint(x, y));
|
||||
}
|
||||
|
||||
Point(int ax, int ay):x(ax),y(ay) {};
|
||||
|
||||
};
|
||||
|
||||
class Detector : public Counted {
|
||||
|
||||
private:
|
||||
Ref<BitMatrix> image_;
|
||||
|
||||
bool compact_;
|
||||
int nbLayers_;
|
||||
int nbDataBlocks_;
|
||||
int nbCenterLayers_;
|
||||
int shift_;
|
||||
|
||||
void extractParameters(std::vector<Ref<Point> > bullEyeCornerPoints);
|
||||
std::vector<Ref<ResultPoint> > getMatrixCornerPoints(std::vector<Ref<Point> > bullEyeCornerPoints);
|
||||
static void correctParameterData(Ref<BitArray> parameterData, bool compact);
|
||||
std::vector<Ref<Point> > getBullEyeCornerPoints(Ref<Point> pCenter);
|
||||
Ref<Point> getMatrixCenter();
|
||||
Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image,
|
||||
Ref<ResultPoint> topLeft,
|
||||
Ref<ResultPoint> bottomLeft,
|
||||
Ref<ResultPoint> bottomRight,
|
||||
Ref<ResultPoint> topRight);
|
||||
void getParameters(Ref<BitArray> parameterData);
|
||||
Ref<BitArray> sampleLine(Ref<Point> p1, Ref<Point> p2, int size);
|
||||
bool isWhiteOrBlackRectangle(Ref<Point> p1,
|
||||
Ref<Point> p2,
|
||||
Ref<Point> p3,
|
||||
Ref<Point> p4);
|
||||
int getColor(Ref<Point> p1, Ref<Point> p2);
|
||||
Ref<Point> getFirstDifferent(Ref<Point> init, bool color, int dx, int dy);
|
||||
bool isValid(int x, int y);
|
||||
static float distance(Ref<Point> a, Ref<Point> b);
|
||||
|
||||
public:
|
||||
Detector(Ref<BitMatrix> image);
|
||||
Ref<AztecDetectorResult> detect();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace zxing {
|
||||
|
||||
DetectorResult::DetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points, Ref<PerspectiveTransform> transform) :
|
||||
bits_(bits), points_(points), transform_(transform) {
|
||||
DetectorResult::DetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points) :
|
||||
bits_(bits), points_(points) {
|
||||
}
|
||||
|
||||
Ref<BitMatrix> DetectorResult::getBits() {
|
||||
|
@ -35,8 +35,4 @@ std::vector<Ref<ResultPoint> > DetectorResult::getPoints() {
|
|||
return points_;
|
||||
}
|
||||
|
||||
Ref<PerspectiveTransform> DetectorResult::getTransform() {
|
||||
return transform_;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <zxing/common/Array.h>
|
||||
#include <zxing/common/BitMatrix.h>
|
||||
#include <zxing/ResultPoint.h>
|
||||
#include <zxing/common/PerspectiveTransform.h>
|
||||
|
||||
namespace zxing {
|
||||
|
||||
|
@ -33,13 +32,11 @@ class DetectorResult : public Counted {
|
|||
private:
|
||||
Ref<BitMatrix> bits_;
|
||||
std::vector<Ref<ResultPoint> > points_;
|
||||
Ref<PerspectiveTransform> transform_;
|
||||
|
||||
public:
|
||||
DetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points, Ref<PerspectiveTransform> transform);
|
||||
DetectorResult(Ref<BitMatrix> bits, std::vector<Ref<ResultPoint> > points);
|
||||
Ref<BitMatrix> getBits();
|
||||
std::vector<Ref<ResultPoint> > getPoints();
|
||||
Ref<PerspectiveTransform> getTransform();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,30 @@ int WhiteRectangleDetector::CORR = 1;
|
|||
WhiteRectangleDetector::WhiteRectangleDetector(Ref<BitMatrix> image) : image_(image) {
|
||||
width_ = image->getWidth();
|
||||
height_ = image->getHeight();
|
||||
|
||||
leftInit_ = (width_ - INIT_SIZE) >> 1;
|
||||
rightInit_ = (width_ + INIT_SIZE) >> 1;
|
||||
upInit_ = (height_ - INIT_SIZE) >> 1;
|
||||
downInit_ = (height_ + INIT_SIZE) >> 1;
|
||||
|
||||
if (upInit_ < 0 || leftInit_ < 0 || downInit_ >= height_ || rightInit_ >= width_) {
|
||||
throw NotFoundException("Invalid dimensions WhiteRectangleDetector");
|
||||
}
|
||||
}
|
||||
|
||||
WhiteRectangleDetector::WhiteRectangleDetector(Ref<BitMatrix> image, int initSize, int x, int y) : image_(image) {
|
||||
width_ = image->getWidth();
|
||||
height_ = image->getHeight();
|
||||
|
||||
int halfsize = initSize >> 1;
|
||||
leftInit_ = x - halfsize;
|
||||
rightInit_ = x + halfsize;
|
||||
upInit_ = y - halfsize;
|
||||
downInit_ = y + halfsize;
|
||||
|
||||
if (upInit_ < 0 || leftInit_ < 0 || downInit_ >= height_ || rightInit_ >= width_) {
|
||||
throw NotFoundException("Invalid dimensions WhiteRectangleDetector");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,13 +74,10 @@ WhiteRectangleDetector::WhiteRectangleDetector(Ref<BitMatrix> image) : image_(im
|
|||
* @throws NotFoundException if no Data Matrix Code can be found
|
||||
*/
|
||||
std::vector<Ref<ResultPoint> > WhiteRectangleDetector::detect() {
|
||||
int left = (width_ - INIT_SIZE) >> 1;
|
||||
int right = (width_ + INIT_SIZE) >> 1;
|
||||
int up = (height_ - INIT_SIZE) >> 1;
|
||||
int down = (height_ + INIT_SIZE) >> 1;
|
||||
if (up < 0 || left < 0 || down >= height_ || right >= width_) {
|
||||
throw NotFoundException("Invalid dimensions WhiteRectangleDetector");
|
||||
}
|
||||
int left = leftInit_;
|
||||
int right = rightInit_;
|
||||
int up = upInit_;
|
||||
int down = downInit_;
|
||||
|
||||
bool sizeExceeded = false;
|
||||
bool aBlackPointFoundOnBorder = true;
|
||||
|
|
|
@ -38,9 +38,14 @@ class WhiteRectangleDetector : public Counted {
|
|||
Ref<BitMatrix> image_;
|
||||
int width_;
|
||||
int height_;
|
||||
int leftInit_;
|
||||
int rightInit_;
|
||||
int downInit_;
|
||||
int upInit_;
|
||||
|
||||
public:
|
||||
WhiteRectangleDetector(Ref<BitMatrix> image);
|
||||
WhiteRectangleDetector(Ref<BitMatrix> image, int initSize, int x, int y);
|
||||
std::vector<Ref<ResultPoint> > detect();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
* GF256.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Christian Brunschen on 05/05/2008.
|
||||
* Copyright 2008 Google UK. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <zxing/common/reedsolomon/GF256.h>
|
||||
#include <zxing/common/reedsolomon/GF256Poly.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
#include <zxing/common/Array.h>
|
||||
#include <zxing/common/Counted.h>
|
||||
|
||||
namespace zxing {
|
||||
using namespace std;
|
||||
|
||||
static inline ArrayRef<int> makeArray(int value) {
|
||||
ArrayRef<int> valuesRef(new Array<int> (value, 1));
|
||||
return valuesRef;
|
||||
}
|
||||
|
||||
static inline Ref<GF256Poly> refPoly(GF256 &field, int value) {
|
||||
ArrayRef<int> values(makeArray(value));
|
||||
Ref<GF256Poly> result(new GF256Poly(field, values));
|
||||
return result;
|
||||
}
|
||||
|
||||
GF256::GF256(int primitive) :
|
||||
exp_(256, (const int)0), log_(256, (const int)0), zero_(refPoly(*this, 0)), one_(refPoly(*this, 1)) {
|
||||
int x = 1;
|
||||
for (int i = 0; i < 256; i++) {
|
||||
exp_[i] = x;
|
||||
x <<= 1;
|
||||
if (x >= 0x100) {
|
||||
x ^= primitive;
|
||||
}
|
||||
}
|
||||
|
||||
// log(0) == 0, but should never be used
|
||||
log_[0] = 0;
|
||||
for (int i = 0; i < 255; i++) {
|
||||
log_[exp_[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256::getZero() {
|
||||
return zero_;
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256::getOne() {
|
||||
return one_;
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256::buildMonomial(int degree, int coefficient) {
|
||||
#ifdef DEBUG
|
||||
cout << __FUNCTION__ << "\n";
|
||||
#endif
|
||||
if (degree < 0) {
|
||||
throw IllegalArgumentException("Degree must be non-negative");
|
||||
}
|
||||
if (coefficient == 0) {
|
||||
return zero_;
|
||||
}
|
||||
int nCoefficients = degree + 1;
|
||||
ArrayRef<int> coefficients(new Array<int> (nCoefficients));
|
||||
coefficients[0] = coefficient;
|
||||
Ref<GF256Poly> result(new GF256Poly(*this, coefficients));
|
||||
return result;
|
||||
}
|
||||
|
||||
int GF256::addOrSubtract(int a, int b) {
|
||||
return a ^ b;
|
||||
}
|
||||
|
||||
int GF256::exp(int a) {
|
||||
return exp_[a];
|
||||
}
|
||||
|
||||
int GF256::log(int a) {
|
||||
if (a == 0) {
|
||||
throw IllegalArgumentException("Cannot take the logarithm of 0");
|
||||
}
|
||||
return log_[a];
|
||||
}
|
||||
|
||||
int GF256::inverse(int a) {
|
||||
if (a == 0) {
|
||||
throw IllegalArgumentException("Cannot calculate the inverse of 0");
|
||||
}
|
||||
return exp_[255 - log_[a]];
|
||||
}
|
||||
|
||||
int GF256::multiply(int a, int b) {
|
||||
if (a == 0 || b == 0) {
|
||||
return 0;
|
||||
}
|
||||
int logSum = log_[a] + log_[b];
|
||||
// index is a sped-up alternative to logSum % 255 since sum
|
||||
// is in [0,510]. Thanks to jmsachs for the idea
|
||||
return exp_[(logSum & 0xFF) + (logSum >> 8)];
|
||||
}
|
||||
|
||||
GF256 GF256::QR_CODE_FIELD(0x011D); // x^8 + x^4 + x^3 + x^2 + 1
|
||||
GF256 GF256::DATA_MATRIX_FIELD(0x012D); // x^8 + x^5 + x^3 + x^2 + 1
|
||||
|
||||
ostream& operator<<(ostream& out, const GF256& field) {
|
||||
out << "Field[\nexp=(";
|
||||
out << field.exp_[0];
|
||||
for (int i = 1; i < 256; i++) {
|
||||
out << "," << field.exp_[i];
|
||||
}
|
||||
out << "),\nlog=(";
|
||||
out << field.log_[0];
|
||||
for (int i = 1; i < 256; i++) {
|
||||
out << "," << field.log_[i];
|
||||
}
|
||||
out << ")\n]";
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
#ifndef __GF256_H__
|
||||
#define __GF256_H__
|
||||
|
||||
/*
|
||||
* GF256.h
|
||||
* zxing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <zxing/common/Counted.h>
|
||||
|
||||
namespace zxing {
|
||||
class GF256Poly;
|
||||
|
||||
class GF256 {
|
||||
/**
|
||||
* <p>This class contains utility methods for performing mathematical
|
||||
* operations over the Galois Field GF(256). Operations use a given
|
||||
* primitive polynomial in calculations.</p>
|
||||
*
|
||||
* <p>Throughout this package, elements of GF(256) are represented as an
|
||||
* <code>int</code> for convenience and speed (but at the cost of memory).
|
||||
* Only the bottom 8 bits are really used.</p>
|
||||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
* @author christian.brunschen@gmail.com (Christian Brunschen)
|
||||
*/
|
||||
private:
|
||||
std::vector<int> exp_;
|
||||
std::vector<int> log_;
|
||||
Ref<GF256Poly> zero_;
|
||||
Ref<GF256Poly> one_;
|
||||
|
||||
GF256(int primitive);
|
||||
|
||||
public:
|
||||
Ref<GF256Poly> getZero();
|
||||
Ref<GF256Poly> getOne();
|
||||
Ref<GF256Poly> buildMonomial(int degree, int coefficient);
|
||||
static int addOrSubtract(int a, int b);
|
||||
int exp(int a);
|
||||
int log(int a);
|
||||
int inverse(int a);
|
||||
int multiply(int a, int b);
|
||||
|
||||
static GF256 QR_CODE_FIELD;
|
||||
static GF256 DATA_MATRIX_FIELD;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream& out, const GF256& field);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __GF256_H__
|
|
@ -1,198 +0,0 @@
|
|||
/*
|
||||
* GF256Poly.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Christian Brunschen on 05/05/2008.
|
||||
* Copyright 2008 Google UK. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <zxing/common/reedsolomon/GF256Poly.h>
|
||||
#include <zxing/common/reedsolomon/GF256.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
||||
namespace zxing {
|
||||
using namespace std;
|
||||
|
||||
void GF256Poly::fixCoefficients() {
|
||||
int coefficientsLength = coefficients.size();
|
||||
if (coefficientsLength > 1 && coefficients[0] == 0) {
|
||||
// Leading term must be non-zero for anything except
|
||||
// the constant polynomial "0"
|
||||
int firstNonZero = 1;
|
||||
while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0) {
|
||||
firstNonZero++;
|
||||
}
|
||||
if (firstNonZero == coefficientsLength) {
|
||||
coefficientsLength = field.getZero()->coefficients.size();
|
||||
coefficients.reset(new Array<int> (coefficientsLength));
|
||||
*coefficients = *(field.getZero()->coefficients);
|
||||
} else {
|
||||
ArrayRef<int> c(coefficients);
|
||||
coefficientsLength -= firstNonZero;
|
||||
coefficients.reset(new Array<int> (coefficientsLength));
|
||||
for (int i = 0; i < coefficientsLength; i++) {
|
||||
coefficients[i] = c[i + firstNonZero];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GF256Poly::GF256Poly(GF256 &f, ArrayRef<int> c) :
|
||||
Counted(), field(f), coefficients(c) {
|
||||
fixCoefficients();
|
||||
}
|
||||
|
||||
GF256Poly::~GF256Poly() {
|
||||
|
||||
}
|
||||
|
||||
int GF256Poly::getDegree() {
|
||||
return coefficients.size() - 1;
|
||||
}
|
||||
|
||||
bool GF256Poly::isZero() {
|
||||
return coefficients[0] == 0;
|
||||
}
|
||||
|
||||
int GF256Poly::getCoefficient(int degree) {
|
||||
return coefficients[coefficients.size() - 1 - degree];
|
||||
}
|
||||
|
||||
int GF256Poly::evaluateAt(int a) {
|
||||
if (a == 0) {
|
||||
return getCoefficient(0);
|
||||
}
|
||||
int size = coefficients.size();
|
||||
if (a == 1) {
|
||||
// Just the sum of the coefficients
|
||||
int result = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
result = GF256::addOrSubtract(result, coefficients[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int result = coefficients[0];
|
||||
for (int i = 1; i < size; i++) {
|
||||
result = GF256::addOrSubtract(field.multiply(a, result), coefficients[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256Poly::addOrSubtract(Ref<GF256Poly> b) {
|
||||
if (&field != &b->field) {
|
||||
throw IllegalArgumentException("Fields must be the same");
|
||||
}
|
||||
if (isZero()) {
|
||||
return b;
|
||||
}
|
||||
if (b->isZero()) {
|
||||
return Ref<GF256Poly>(this);
|
||||
}
|
||||
|
||||
ArrayRef<int> largerCoefficients = coefficients;
|
||||
ArrayRef<int> smallerCoefficients = b->coefficients;
|
||||
if (smallerCoefficients.size() > largerCoefficients.size()) {
|
||||
ArrayRef<int> tmp(smallerCoefficients);
|
||||
smallerCoefficients = largerCoefficients;
|
||||
largerCoefficients = tmp;
|
||||
}
|
||||
|
||||
ArrayRef<int> sumDiff(new Array<int> (largerCoefficients.size()));
|
||||
|
||||
unsigned lengthDiff = largerCoefficients.size() - smallerCoefficients.size();
|
||||
for (unsigned i = 0; i < lengthDiff; i++) {
|
||||
sumDiff[i] = largerCoefficients[i];
|
||||
}
|
||||
for (unsigned i = lengthDiff; i < largerCoefficients.size(); i++) {
|
||||
sumDiff[i] = GF256::addOrSubtract(smallerCoefficients[i - lengthDiff], largerCoefficients[i]);
|
||||
}
|
||||
return Ref<GF256Poly>(new GF256Poly(field, sumDiff));
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256Poly::multiply(Ref<GF256Poly> b) {
|
||||
if (&field != &b->field) {
|
||||
throw IllegalArgumentException("Fields must be the same");
|
||||
}
|
||||
if (isZero() || b->isZero()) {
|
||||
return field.getZero();
|
||||
}
|
||||
ArrayRef<int> aCoefficients = coefficients;
|
||||
int aLength = aCoefficients.size();
|
||||
ArrayRef<int> bCoefficients = b->coefficients;
|
||||
int bLength = bCoefficients.size();
|
||||
int productLength = aLength + bLength - 1;
|
||||
ArrayRef<int> product(new Array<int> (productLength));
|
||||
for (int i = 0; i < aLength; i++) {
|
||||
int aCoeff = aCoefficients[i];
|
||||
for (int j = 0; j < bLength; j++) {
|
||||
product[i + j] = GF256::addOrSubtract(product[i + j], field.multiply(aCoeff, bCoefficients[j]));
|
||||
}
|
||||
}
|
||||
|
||||
return Ref<GF256Poly>(new GF256Poly(field, product));
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256Poly::multiply(int scalar) {
|
||||
if (scalar == 0) {
|
||||
return field.getZero();
|
||||
}
|
||||
if (scalar == 1) {
|
||||
return Ref<GF256Poly>(this);
|
||||
}
|
||||
int size = coefficients.size();
|
||||
ArrayRef<int> product(new Array<int> (size));
|
||||
for (int i = 0; i < size; i++) {
|
||||
product[i] = field.multiply(coefficients[i], scalar);
|
||||
}
|
||||
return Ref<GF256Poly>(new GF256Poly(field, product));
|
||||
}
|
||||
|
||||
Ref<GF256Poly> GF256Poly::multiplyByMonomial(int degree, int coefficient) {
|
||||
if (degree < 0) {
|
||||
throw IllegalArgumentException("Degree must be non-negative");
|
||||
}
|
||||
if (coefficient == 0) {
|
||||
return field.getZero();
|
||||
}
|
||||
int size = coefficients.size();
|
||||
ArrayRef<int> product(new Array<int> (size + degree));
|
||||
for (int i = 0; i < size; i++) {
|
||||
product[i] = field.multiply(coefficients[i], coefficient);
|
||||
}
|
||||
return Ref<GF256Poly>(new GF256Poly(field, product));
|
||||
}
|
||||
|
||||
const char *GF256Poly::description() const {
|
||||
ostringstream result;
|
||||
result << *this;
|
||||
return result.str().c_str();
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& out, const GF256Poly& p) {
|
||||
GF256Poly &poly = const_cast<GF256Poly&>(p);
|
||||
out << "Poly[" << poly.coefficients.size() << "]";
|
||||
if (poly.coefficients.size() > 0) {
|
||||
out << "(" << poly.coefficients[0];
|
||||
for (unsigned i = 1; i < poly.coefficients.size(); i++) {
|
||||
out << "," << poly.coefficients[i];
|
||||
}
|
||||
out << ")";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
#ifndef __GF256_POLY_H__
|
||||
#define __GF256_POLY_H__
|
||||
|
||||
/*
|
||||
* GF256Poly.h
|
||||
* zxing
|
||||
*
|
||||
* Copyright 2010 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <zxing/common/Counted.h>
|
||||
#include <zxing/common/Array.h>
|
||||
|
||||
namespace zxing {
|
||||
class GF256;
|
||||
|
||||
class GF256Poly : public Counted {
|
||||
private:
|
||||
GF256 &field;
|
||||
ArrayRef<int> coefficients;
|
||||
void fixCoefficients();
|
||||
public:
|
||||
GF256Poly(GF256 &field, ArrayRef<int> c);
|
||||
~GF256Poly();
|
||||
|
||||
int getDegree();
|
||||
bool isZero();
|
||||
int getCoefficient(int degree);
|
||||
int evaluateAt(int a);
|
||||
Ref<GF256Poly> addOrSubtract(Ref<GF256Poly> other);
|
||||
Ref<GF256Poly> multiply(Ref<GF256Poly> other);
|
||||
Ref<GF256Poly> multiply(int scalar);
|
||||
Ref<GF256Poly> multiplyByMonomial(int degree, int coefficient);
|
||||
const char *description() const;
|
||||
friend std::ostream& operator<<(std::ostream& out, const GF256Poly& poly);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __GF256_POLY_H__
|
153
cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp
Normal file
153
cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp
Normal file
|
@ -0,0 +1,153 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* GenericGF.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 13/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <zxing/common/reedsolomon/GenericGF.h>
|
||||
#include <zxing/common/reedsolomon/GenericGFPoly.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
||||
using zxing::GenericGF;
|
||||
using zxing::GenericGFPoly;
|
||||
using zxing::Ref;
|
||||
|
||||
Ref<GenericGF> GenericGF::QR_CODE_FIELD_256(new GenericGF(0x011D, 256));
|
||||
Ref<GenericGF> GenericGF::DATA_MATRIX_FIELD_256(new GenericGF(0x012D, 256));
|
||||
Ref<GenericGF> GenericGF::AZTEC_PARAM(new GenericGF(0x13, 16));
|
||||
Ref<GenericGF> GenericGF::AZTEC_DATA_6(new GenericGF(0x43, 64));
|
||||
Ref<GenericGF> GenericGF::AZTEC_DATA_8(GenericGF::DATA_MATRIX_FIELD_256);
|
||||
Ref<GenericGF> GenericGF::AZTEC_DATA_10(new GenericGF(0x409, 1024));
|
||||
Ref<GenericGF> GenericGF::AZTEC_DATA_12(new GenericGF(0x1069, 4096));
|
||||
|
||||
|
||||
static int INITIALIZATION_THRESHOLD = 0;
|
||||
|
||||
GenericGF::GenericGF(int primitive, int size)
|
||||
: size_(size), primitive_(primitive), initialized_(false) {
|
||||
if (size <= INITIALIZATION_THRESHOLD) {
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
void GenericGF::initialize() {
|
||||
//expTable_ = std::vector<int>(size_, (const int) 0);
|
||||
//logTable_ = std::vector<int>(size_, (const int) 0);
|
||||
expTable_.resize(size_);
|
||||
logTable_.resize(size_);
|
||||
|
||||
int x = 1;
|
||||
|
||||
for (int i = 0; i < size_; i++) {
|
||||
expTable_[i] = x;
|
||||
x <<= 1; // x = x * 2; we're assuming the generator alpha is 2
|
||||
if (x >= size_) {
|
||||
x ^= primitive_;
|
||||
x &= size_-1;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < size_-1; i++) {
|
||||
logTable_[expTable_[i]] = i;
|
||||
}
|
||||
//logTable_[0] == 0 but this should never be used
|
||||
|
||||
zero_ = Ref<GenericGFPoly>(new GenericGFPoly(Ref<GenericGF>(this), ArrayRef<int>(new Array<int>(1))));
|
||||
zero_->getCoefficients()[0] = 0;
|
||||
one_ = Ref<GenericGFPoly>(new GenericGFPoly(Ref<GenericGF>(this), ArrayRef<int>(new Array<int>(1))));
|
||||
one_->getCoefficients()[0] = 1;
|
||||
|
||||
initialized_ = true;
|
||||
}
|
||||
|
||||
void GenericGF::checkInit() {
|
||||
if (!initialized_) {
|
||||
initialize();
|
||||
}
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGF::getZero() {
|
||||
checkInit();
|
||||
return zero_;
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGF::getOne() {
|
||||
checkInit();
|
||||
return one_;
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGF::buildMonomial(int degree, int coefficient) {
|
||||
checkInit();
|
||||
|
||||
if (degree < 0) {
|
||||
throw IllegalArgumentException("Degree must be non-negative");
|
||||
}
|
||||
if (coefficient == 0) {
|
||||
return zero_;
|
||||
}
|
||||
ArrayRef<int> coefficients(new Array<int>(degree + 1));
|
||||
coefficients[0] = coefficient;
|
||||
|
||||
//return new GenericGFPoly(this, coefficients);
|
||||
return Ref<GenericGFPoly>(new GenericGFPoly(Ref<GenericGF>(this), coefficients));
|
||||
}
|
||||
|
||||
int GenericGF::addOrSubtract(int a, int b) {
|
||||
return a ^ b;
|
||||
}
|
||||
|
||||
int GenericGF::exp(int a) {
|
||||
checkInit();
|
||||
return expTable_[a];
|
||||
}
|
||||
|
||||
int GenericGF::log(int a) {
|
||||
checkInit();
|
||||
if (a == 0) {
|
||||
throw IllegalArgumentException("cannot give log(0)");
|
||||
}
|
||||
return logTable_[a];
|
||||
}
|
||||
|
||||
int GenericGF::inverse(int a) {
|
||||
checkInit();
|
||||
if (a == 0) {
|
||||
throw IllegalArgumentException("Cannot calculate the inverse of 0");
|
||||
}
|
||||
return expTable_[size_ - logTable_[a] - 1];
|
||||
}
|
||||
|
||||
int GenericGF::multiply(int a, int b) {
|
||||
checkInit();
|
||||
|
||||
if (a == 0 || b == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a < 0 || b < 0 || a >= size_ || b >= size_) {
|
||||
a++;
|
||||
}
|
||||
|
||||
int logSum = logTable_[a] + logTable_[b];
|
||||
|
||||
return expTable_[(logSum % size_) + logSum / size_];
|
||||
}
|
||||
|
||||
int GenericGF::getSize() {
|
||||
return size_;
|
||||
}
|
78
cpp/core/src/zxing/common/reedsolomon/GenericGF.h
Normal file
78
cpp/core/src/zxing/common/reedsolomon/GenericGF.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* GenericGF.h
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 13/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GENERICGF_H
|
||||
#define GENERICGF_H
|
||||
|
||||
#include <vector>
|
||||
#include <zxing/common/Counted.h>
|
||||
|
||||
namespace zxing {
|
||||
class GenericGFPoly;
|
||||
|
||||
class GenericGF : public Counted {
|
||||
|
||||
private:
|
||||
std::vector<int> expTable_;
|
||||
std::vector<int> logTable_;
|
||||
Ref<GenericGFPoly> zero_;
|
||||
Ref<GenericGFPoly> one_;
|
||||
int size_;
|
||||
int primitive_;
|
||||
bool initialized_;
|
||||
|
||||
void initialize();
|
||||
void checkInit();
|
||||
|
||||
public:
|
||||
static Ref<GenericGF> AZTEC_DATA_12;
|
||||
static Ref<GenericGF> AZTEC_DATA_10;
|
||||
static Ref<GenericGF> AZTEC_DATA_8;
|
||||
static Ref<GenericGF> AZTEC_DATA_6;
|
||||
static Ref<GenericGF> AZTEC_PARAM;
|
||||
static Ref<GenericGF> QR_CODE_FIELD_256;
|
||||
static Ref<GenericGF> DATA_MATRIX_FIELD_256;
|
||||
|
||||
GenericGF(int primitive, int size);
|
||||
|
||||
Ref<GenericGFPoly> getZero();
|
||||
Ref<GenericGFPoly> getOne();
|
||||
int getSize();
|
||||
Ref<GenericGFPoly> buildMonomial(int degree, int coefficient);
|
||||
|
||||
static int addOrSubtract(int a, int b);
|
||||
int exp(int a);
|
||||
int log(int a);
|
||||
int inverse(int a);
|
||||
int multiply(int a, int b);
|
||||
|
||||
bool operator==(GenericGF other) {
|
||||
return (other.getSize() == this->size_ &&
|
||||
other.primitive_ == this->primitive_);
|
||||
}
|
||||
|
||||
//#warning todo: add print method
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GENERICGF_H
|
||||
|
215
cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp
Normal file
215
cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp
Normal file
|
@ -0,0 +1,215 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* GenericGFPoly.cpp
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 13/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <zxing/common/reedsolomon/GenericGFPoly.h>
|
||||
#include <zxing/common/reedsolomon/GenericGF.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
||||
using zxing::GenericGFPoly;
|
||||
using zxing::ArrayRef;
|
||||
using zxing::Ref;
|
||||
|
||||
GenericGFPoly::GenericGFPoly(Ref<GenericGF> field,
|
||||
ArrayRef<int> coefficients)
|
||||
: field_(field) {
|
||||
if (coefficients.size() == 0) {
|
||||
throw IllegalArgumentException("need coefficients");
|
||||
}
|
||||
int coefficientsLength = coefficients.size();
|
||||
if (coefficientsLength > 1 && coefficients[0] == 0) {
|
||||
// Leading term must be non-zero for anything except the constant polynomial "0"
|
||||
int firstNonZero = 1;
|
||||
while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0) {
|
||||
firstNonZero++;
|
||||
}
|
||||
if (firstNonZero == coefficientsLength) {
|
||||
coefficients_ = field->getZero()->getCoefficients();
|
||||
} else {
|
||||
coefficients_ = ArrayRef<int>(new Array<int>(coefficientsLength-firstNonZero));
|
||||
for (int i = 0; i < (int)coefficients_.size(); i++) {
|
||||
coefficients_[i] = coefficients[i + firstNonZero];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
coefficients_ = coefficients;
|
||||
}
|
||||
}
|
||||
|
||||
ArrayRef<int> GenericGFPoly::getCoefficients() {
|
||||
return coefficients_;
|
||||
}
|
||||
|
||||
int GenericGFPoly::getDegree() {
|
||||
return coefficients_.size() - 1;
|
||||
}
|
||||
|
||||
bool GenericGFPoly::isZero() {
|
||||
return coefficients_[0] == 0;
|
||||
}
|
||||
|
||||
int GenericGFPoly::getCoefficient(int degree) {
|
||||
return coefficients_[coefficients_.size() - 1 - degree];
|
||||
}
|
||||
|
||||
int GenericGFPoly::evaluateAt(int a) {
|
||||
if (a == 0) {
|
||||
// Just return the x^0 coefficient
|
||||
return getCoefficient(0);
|
||||
}
|
||||
|
||||
int size = coefficients_.size();
|
||||
if (a == 1) {
|
||||
// Just the sum of the coefficients
|
||||
int result = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
result = GenericGF::addOrSubtract(result, coefficients_[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int result = coefficients_[0];
|
||||
for (int i = 1; i < size; i++) {
|
||||
result = GenericGF::addOrSubtract(field_->multiply(a, result), coefficients_[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGFPoly::addOrSubtract(Ref<zxing::GenericGFPoly> other) {
|
||||
if (!(field_.object_ == other->field_.object_)) {
|
||||
throw IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
|
||||
}
|
||||
if (isZero()) {
|
||||
return other;
|
||||
}
|
||||
if (other->isZero()) {
|
||||
return Ref<GenericGFPoly>(this);
|
||||
}
|
||||
|
||||
ArrayRef<int> smallerCoefficients = coefficients_;
|
||||
ArrayRef<int> largerCoefficients = other->getCoefficients();
|
||||
if (smallerCoefficients.size() > largerCoefficients.size()) {
|
||||
ArrayRef<int> temp = smallerCoefficients;
|
||||
smallerCoefficients = largerCoefficients;
|
||||
largerCoefficients = temp;
|
||||
}
|
||||
|
||||
ArrayRef<int> sumDiff(new Array<int>(largerCoefficients.size()));
|
||||
int lengthDiff = largerCoefficients.size() - smallerCoefficients.size();
|
||||
// Copy high-order terms only found in higher-degree polynomial's coefficients
|
||||
for (int i = 0; i < lengthDiff; i++) {
|
||||
sumDiff[i] = largerCoefficients[i];
|
||||
}
|
||||
|
||||
for (int i = lengthDiff; i < (int)largerCoefficients.size(); i++) {
|
||||
sumDiff[i] = GenericGF::addOrSubtract(smallerCoefficients[i-lengthDiff],
|
||||
largerCoefficients[i]);
|
||||
}
|
||||
|
||||
return Ref<GenericGFPoly>(new GenericGFPoly(field_, sumDiff));
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGFPoly::multiply(Ref<zxing::GenericGFPoly> other) {
|
||||
if (!(field_.object_ == other->field_.object_)) {
|
||||
throw IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
|
||||
}
|
||||
|
||||
if (isZero() || other->isZero()) {
|
||||
return field_->getZero();
|
||||
}
|
||||
|
||||
ArrayRef<int> aCoefficients = coefficients_;
|
||||
int aLength = aCoefficients.size();
|
||||
|
||||
ArrayRef<int> bCoefficients = other->getCoefficients();
|
||||
int bLength = bCoefficients.size();
|
||||
|
||||
ArrayRef<int> product(new Array<int>(aLength + bLength - 1));
|
||||
for (int i = 0; i < aLength; i++) {
|
||||
int aCoeff = aCoefficients[i];
|
||||
for (int j = 0; j < bLength; j++) {
|
||||
product[i+j] = GenericGF::addOrSubtract(product[i+j],
|
||||
field_->multiply(aCoeff, bCoefficients[j]));
|
||||
}
|
||||
}
|
||||
|
||||
return Ref<GenericGFPoly>(new GenericGFPoly(field_, product));
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGFPoly::multiply(int scalar) {
|
||||
if (scalar == 0) {
|
||||
return field_->getZero();
|
||||
}
|
||||
if (scalar == 1) {
|
||||
return Ref<GenericGFPoly>(this);
|
||||
}
|
||||
int size = coefficients_.size();
|
||||
ArrayRef<int> product(new Array<int>(size));
|
||||
for (int i = 0; i < size; i++) {
|
||||
product[i] = field_->multiply(coefficients_[i], scalar);
|
||||
}
|
||||
return Ref<GenericGFPoly>(new GenericGFPoly(field_, product));
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> GenericGFPoly::multiplyByMonomial(int degree, int coefficient) {
|
||||
if (degree < 0) {
|
||||
throw IllegalArgumentException("degree must not be less then 0");
|
||||
}
|
||||
if (coefficient == 0) {
|
||||
return field_->getZero();
|
||||
}
|
||||
int size = coefficients_.size();
|
||||
ArrayRef<int> product(new Array<int>(size+degree));
|
||||
for (int i = 0; i < size; i++) {
|
||||
product[i] = field_->multiply(coefficients_[i], coefficient);
|
||||
}
|
||||
return Ref<GenericGFPoly>(new GenericGFPoly(field_, product));
|
||||
}
|
||||
|
||||
std::vector<Ref<GenericGFPoly> > GenericGFPoly::divide(Ref<GenericGFPoly> other) {
|
||||
if (!(field_.object_ == other->field_.object_)) {
|
||||
throw IllegalArgumentException("GenericGFPolys do not have same GenericGF field");
|
||||
}
|
||||
if (other->isZero()) {
|
||||
throw IllegalArgumentException("divide by 0");
|
||||
}
|
||||
|
||||
Ref<GenericGFPoly> quotient = field_->getZero();
|
||||
Ref<GenericGFPoly> remainder = Ref<GenericGFPoly>(this);
|
||||
|
||||
int denominatorLeadingTerm = other->getCoefficient(other->getDegree());
|
||||
int inverseDenominatorLeadingTerm = field_->inverse(denominatorLeadingTerm);
|
||||
|
||||
while (remainder->getDegree() >= other->getDegree() && !remainder->isZero()) {
|
||||
int degreeDifference = remainder->getDegree() - other->getDegree();
|
||||
int scale = field_->multiply(remainder->getCoefficient(remainder->getDegree()),
|
||||
inverseDenominatorLeadingTerm);
|
||||
Ref<GenericGFPoly> term = other->multiplyByMonomial(degreeDifference, scale);
|
||||
Ref<GenericGFPoly> iterationQuotiont = field_->buildMonomial(degreeDifference,
|
||||
scale);
|
||||
quotient = quotient->addOrSubtract(iterationQuotiont);
|
||||
remainder = remainder->addOrSubtract(term);
|
||||
}
|
||||
|
||||
std::vector<Ref<GenericGFPoly> > returnValue;
|
||||
returnValue[0] = quotient;
|
||||
returnValue[1] = remainder;
|
||||
return returnValue;
|
||||
}
|
54
cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h
Normal file
54
cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* GenericGFPoly.h
|
||||
* zxing
|
||||
*
|
||||
* Created by Lukas Stabe on 13/02/2012.
|
||||
* Copyright 2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GENERICGFPOLY_H
|
||||
#define GENERICGFPOLY_H
|
||||
|
||||
#include <vector>
|
||||
#include <zxing/common/Array.h>
|
||||
#include <zxing/common/Counted.h>
|
||||
|
||||
namespace zxing {
|
||||
class GenericGF;
|
||||
|
||||
class GenericGFPoly : public Counted {
|
||||
private:
|
||||
Ref<GenericGF> field_;
|
||||
ArrayRef<int> coefficients_;
|
||||
|
||||
public:
|
||||
GenericGFPoly(Ref<GenericGF> field, ArrayRef<int> coefficients);
|
||||
ArrayRef<int> getCoefficients();
|
||||
int getDegree();
|
||||
bool isZero();
|
||||
int getCoefficient(int degree);
|
||||
int evaluateAt(int a);
|
||||
Ref<GenericGFPoly> addOrSubtract(Ref<GenericGFPoly> other);
|
||||
Ref<GenericGFPoly> multiply(Ref<GenericGFPoly> other);
|
||||
Ref<GenericGFPoly> multiply(int scalar);
|
||||
Ref<GenericGFPoly> multiplyByMonomial(int degree, int coefficient);
|
||||
std::vector<Ref<GenericGFPoly> > divide(Ref<GenericGFPoly> other);
|
||||
|
||||
//#warning todo: add print method
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GENERICGFPOLY_H
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include <memory>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
||||
#include <zxing/common/reedsolomon/GF256.h>
|
||||
#include <zxing/common/reedsolomon/GF256Poly.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
||||
|
@ -31,7 +29,7 @@ using namespace std;
|
|||
|
||||
namespace zxing {
|
||||
|
||||
ReedSolomonDecoder::ReedSolomonDecoder(GF256 &fld) :
|
||||
ReedSolomonDecoder::ReedSolomonDecoder(Ref<GenericGF> fld) :
|
||||
field(fld) {
|
||||
}
|
||||
|
||||
|
@ -40,7 +38,7 @@ ReedSolomonDecoder::~ReedSolomonDecoder() {
|
|||
|
||||
void ReedSolomonDecoder::decode(ArrayRef<int> received, int twoS) {
|
||||
|
||||
Ref<GF256Poly> poly(new GF256Poly(field, received));
|
||||
Ref<GenericGFPoly> poly(new GenericGFPoly(field, received));
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -55,10 +53,10 @@ void ReedSolomonDecoder::decode(ArrayRef<int> received, int twoS) {
|
|||
syndromeCoefficients.array_ << "\n";
|
||||
#endif
|
||||
|
||||
bool dataMatrix = (&field == &GF256::DATA_MATRIX_FIELD);
|
||||
bool dataMatrix = (field.object_ == GenericGF::DATA_MATRIX_FIELD_256.object_);
|
||||
bool noError = true;
|
||||
for (int i = 0; i < twoS; i++) {
|
||||
int eval = poly->evaluateAt(field.exp(dataMatrix ? i + 1 : i));
|
||||
int eval = poly->evaluateAt(field->exp(dataMatrix ? i + 1 : i));
|
||||
syndromeCoefficients[syndromeCoefficients->size() - 1 - i] = eval;
|
||||
if (eval != 0) {
|
||||
noError = false;
|
||||
|
@ -68,41 +66,43 @@ void ReedSolomonDecoder::decode(ArrayRef<int> received, int twoS) {
|
|||
return;
|
||||
}
|
||||
|
||||
Ref<GF256Poly> syndrome(new GF256Poly(field, syndromeCoefficients));
|
||||
Ref<GF256Poly> monomial(field.buildMonomial(twoS, 1));
|
||||
vector<Ref<GF256Poly> > sigmaOmega(runEuclideanAlgorithm(monomial, syndrome, twoS));
|
||||
Ref<GenericGFPoly> syndrome(new GenericGFPoly(field, syndromeCoefficients));
|
||||
Ref<GenericGFPoly> monomial = field->buildMonomial(twoS, 1);
|
||||
vector<Ref<GenericGFPoly> > sigmaOmega = runEuclideanAlgorithm(monomial, syndrome, twoS);
|
||||
ArrayRef<int> errorLocations = findErrorLocations(sigmaOmega[0]);
|
||||
ArrayRef<int> errorMagitudes = findErrorMagnitudes(sigmaOmega[1], errorLocations, dataMatrix);
|
||||
for (unsigned i = 0; i < errorLocations->size(); i++) {
|
||||
int position = received->size() - 1 - field.log(errorLocations[i]);
|
||||
int position = received->size() - 1 - field->log(errorLocations[i]);
|
||||
//TODO: check why the position would be invalid
|
||||
if (position < 0 || (size_t)position >= received.size())
|
||||
throw IllegalArgumentException("Invalid position (ReedSolomonDecoder)");
|
||||
received[position] = GF256::addOrSubtract(received[position], errorMagitudes[i]);
|
||||
received[position] = GenericGF::addOrSubtract(received[position], errorMagitudes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
vector<Ref<GF256Poly> > ReedSolomonDecoder::runEuclideanAlgorithm(Ref<GF256Poly> a, Ref<GF256Poly> b, int R) {
|
||||
vector<Ref<GenericGFPoly> > ReedSolomonDecoder::runEuclideanAlgorithm(Ref<GenericGFPoly> a,
|
||||
Ref<GenericGFPoly> b,
|
||||
int R) {
|
||||
// Assume a's degree is >= b's
|
||||
if (a->getDegree() < b->getDegree()) {
|
||||
Ref<GF256Poly> tmp = a;
|
||||
Ref<GenericGFPoly> tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
Ref<GF256Poly> rLast(a);
|
||||
Ref<GF256Poly> r(b);
|
||||
Ref<GF256Poly> sLast(field.getOne());
|
||||
Ref<GF256Poly> s(field.getZero());
|
||||
Ref<GF256Poly> tLast(field.getZero());
|
||||
Ref<GF256Poly> t(field.getOne());
|
||||
Ref<GenericGFPoly> rLast(a);
|
||||
Ref<GenericGFPoly> r(b);
|
||||
Ref<GenericGFPoly> sLast(field->getOne());
|
||||
Ref<GenericGFPoly> s(field->getZero());
|
||||
Ref<GenericGFPoly> tLast(field->getZero());
|
||||
Ref<GenericGFPoly> t(field->getOne());
|
||||
|
||||
|
||||
// Run Euclidean algorithm until r's degree is less than R/2
|
||||
while (r->getDegree() >= R / 2) {
|
||||
Ref<GF256Poly> rLastLast(rLast);
|
||||
Ref<GF256Poly> sLastLast(sLast);
|
||||
Ref<GF256Poly> tLastLast(tLast);
|
||||
Ref<GenericGFPoly> rLastLast(rLast);
|
||||
Ref<GenericGFPoly> sLastLast(sLast);
|
||||
Ref<GenericGFPoly> tLastLast(tLast);
|
||||
rLast = r;
|
||||
sLast = s;
|
||||
tLast = t;
|
||||
|
@ -114,18 +114,19 @@ vector<Ref<GF256Poly> > ReedSolomonDecoder::runEuclideanAlgorithm(Ref<GF256Poly>
|
|||
throw ReedSolomonException("r_{i-1} was zero");
|
||||
}
|
||||
r = rLastLast;
|
||||
Ref<GF256Poly> q(field.getZero());
|
||||
Ref<GenericGFPoly> q(field->getZero());
|
||||
int denominatorLeadingTerm = rLast->getCoefficient(rLast->getDegree());
|
||||
int dltInverse = field.inverse(denominatorLeadingTerm);
|
||||
int dltInverse = field->inverse(denominatorLeadingTerm);
|
||||
while (r->getDegree() >= rLast->getDegree() && !r->isZero()) {
|
||||
int degreeDiff = r->getDegree() - rLast->getDegree();
|
||||
int scale = field.multiply(r->getCoefficient(r->getDegree()), dltInverse);
|
||||
q = q->addOrSubtract(field.buildMonomial(degreeDiff, scale));
|
||||
int scale = field->multiply(r->getCoefficient(r->getDegree()), dltInverse);
|
||||
q = q->addOrSubtract(field->buildMonomial(degreeDiff, scale));
|
||||
r = r->addOrSubtract(rLast->multiplyByMonomial(degreeDiff, scale));
|
||||
}
|
||||
|
||||
s = q->multiply(sLast)->addOrSubtract(sLastLast);
|
||||
t = q->multiply(tLast)->addOrSubtract(tLastLast);
|
||||
|
||||
}
|
||||
|
||||
int sigmaTildeAtZero = t->getCoefficient(0);
|
||||
|
@ -133,9 +134,9 @@ vector<Ref<GF256Poly> > ReedSolomonDecoder::runEuclideanAlgorithm(Ref<GF256Poly>
|
|||
throw ReedSolomonException("sigmaTilde(0) was zero");
|
||||
}
|
||||
|
||||
int inverse = field.inverse(sigmaTildeAtZero);
|
||||
Ref<GF256Poly> sigma(t->multiply(inverse));
|
||||
Ref<GF256Poly> omega(r->multiply(inverse));
|
||||
int inverse = field->inverse(sigmaTildeAtZero);
|
||||
Ref<GenericGFPoly> sigma(t->multiply(inverse));
|
||||
Ref<GenericGFPoly> omega(r->multiply(inverse));
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -145,26 +146,26 @@ vector<Ref<GF256Poly> > ReedSolomonDecoder::runEuclideanAlgorithm(Ref<GF256Poly>
|
|||
cout << "omega = " << *omega << "\n";
|
||||
#endif
|
||||
|
||||
vector<Ref<GF256Poly> > result(2);
|
||||
vector<Ref<GenericGFPoly> > result(2);
|
||||
result[0] = sigma;
|
||||
result[1] = omega;
|
||||
return result;
|
||||
}
|
||||
|
||||
ArrayRef<int> ReedSolomonDecoder::findErrorLocations(Ref<GF256Poly> errorLocator) {
|
||||
ArrayRef<int> ReedSolomonDecoder::findErrorLocations(Ref<GenericGFPoly> errorLocator) {
|
||||
// This is a direct application of Chien's search
|
||||
int numErrors = errorLocator->getDegree();
|
||||
if (numErrors == 1) { // shortcut
|
||||
ArrayRef<int> result(1);
|
||||
ArrayRef<int> result(new Array<int>(1));
|
||||
result[0] = errorLocator->getCoefficient(1);
|
||||
return result;
|
||||
}
|
||||
ArrayRef<int> result(numErrors);
|
||||
ArrayRef<int> result(new Array<int>(numErrors));
|
||||
int e = 0;
|
||||
for (int i = 1; i < 256 && e < numErrors; i++) {
|
||||
for (int i = 1; i < field->getSize() && e < numErrors; i++) {
|
||||
// cout << "errorLocator(" << i << ") == " << errorLocator->evaluateAt(i) << "\n";
|
||||
if (errorLocator->evaluateAt(i) == 0) {
|
||||
result[e] = field.inverse(i);
|
||||
result[e] = field->inverse(i);
|
||||
e++;
|
||||
}
|
||||
}
|
||||
|
@ -174,23 +175,23 @@ ArrayRef<int> ReedSolomonDecoder::findErrorLocations(Ref<GF256Poly> errorLocator
|
|||
return result;
|
||||
}
|
||||
|
||||
ArrayRef<int> ReedSolomonDecoder::findErrorMagnitudes(Ref<GF256Poly> errorEvaluator, ArrayRef<int> errorLocations, bool dataMatrix) {
|
||||
ArrayRef<int> ReedSolomonDecoder::findErrorMagnitudes(Ref<GenericGFPoly> errorEvaluator, ArrayRef<int> errorLocations, bool dataMatrix) {
|
||||
// This is directly applying Forney's Formula
|
||||
int s = errorLocations.size();
|
||||
ArrayRef<int> result(s);
|
||||
ArrayRef<int> result(new Array<int>(s));
|
||||
for (int i = 0; i < s; i++) {
|
||||
int xiInverse = field.inverse(errorLocations[i]);
|
||||
int xiInverse = field->inverse(errorLocations[i]);
|
||||
int denominator = 1;
|
||||
for (int j = 0; j < s; j++) {
|
||||
if (i != j) {
|
||||
denominator = field.multiply(denominator, GF256::addOrSubtract(1, field.multiply(errorLocations[j],
|
||||
denominator = field->multiply(denominator, GenericGF::addOrSubtract(1, field->multiply(errorLocations[j],
|
||||
xiInverse)));
|
||||
}
|
||||
}
|
||||
result[i] = field.multiply(errorEvaluator->evaluateAt(xiInverse), field.inverse(denominator));
|
||||
result[i] = field->multiply(errorEvaluator->evaluateAt(xiInverse), field->inverse(denominator));
|
||||
|
||||
if (dataMatrix) {
|
||||
result[i] = field.multiply(result[i], xiInverse);
|
||||
result[i] = field->multiply(result[i], xiInverse);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -24,22 +24,24 @@
|
|||
#include <vector>
|
||||
#include <zxing/common/Counted.h>
|
||||
#include <zxing/common/Array.h>
|
||||
#include <zxing/common/reedsolomon/GenericGFPoly.h>
|
||||
#include <zxing/common/reedsolomon/GenericGF.h>
|
||||
|
||||
namespace zxing {
|
||||
class GF256;
|
||||
class GF256Poly;
|
||||
class GenericGFPoly;
|
||||
class GenericGF;
|
||||
|
||||
class ReedSolomonDecoder {
|
||||
private:
|
||||
GF256 &field;
|
||||
Ref<GenericGF> field;
|
||||
public:
|
||||
ReedSolomonDecoder(GF256 &fld);
|
||||
ReedSolomonDecoder(Ref<GenericGF> fld);
|
||||
~ReedSolomonDecoder();
|
||||
void decode(ArrayRef<int> received, int twoS);
|
||||
private:
|
||||
std::vector<Ref<GF256Poly> > runEuclideanAlgorithm(Ref<GF256Poly> a, Ref<GF256Poly> b, int R);
|
||||
ArrayRef<int> findErrorLocations(Ref<GF256Poly> errorLocator);
|
||||
ArrayRef<int> findErrorMagnitudes(Ref<GF256Poly> errorEvaluator, ArrayRef<int> errorLocations, bool dataMatrix);
|
||||
std::vector<Ref<GenericGFPoly> > runEuclideanAlgorithm(Ref<GenericGFPoly> a, Ref<GenericGFPoly> b, int R);
|
||||
ArrayRef<int> findErrorLocations(Ref<GenericGFPoly> errorLocator);
|
||||
ArrayRef<int> findErrorMagnitudes(Ref<GenericGFPoly> errorEvaluator, ArrayRef<int> errorLocations, bool dataMatrix);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace datamatrix {
|
|||
using namespace std;
|
||||
|
||||
Decoder::Decoder() :
|
||||
rsDecoder_(GF256::DATA_MATRIX_FIELD) {
|
||||
rsDecoder_(GenericGF::DATA_MATRIX_FIELD_256) {
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
*/
|
||||
|
||||
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
||||
#include <zxing/common/reedsolomon/GF256.h>
|
||||
#include <zxing/common/Counted.h>
|
||||
#include <zxing/common/Array.h>
|
||||
#include <zxing/common/DecoderResult.h>
|
||||
|
|
|
@ -232,7 +232,7 @@ Ref<DetectorResult> Detector::detect() {
|
|||
points[1].reset(bottomLeft);
|
||||
points[2].reset(correctedTopRight);
|
||||
points[3].reset(bottomRight);
|
||||
Ref<DetectorResult> detectorResult(new DetectorResult(bits, points, transform));
|
||||
Ref<DetectorResult> detectorResult(new DetectorResult(bits, points));
|
||||
return detectorResult;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace qrcode {
|
|||
using namespace std;
|
||||
|
||||
Decoder::Decoder() :
|
||||
rsDecoder_(GF256::QR_CODE_FIELD) {
|
||||
rsDecoder_(GenericGF::QR_CODE_FIELD_256) {
|
||||
}
|
||||
|
||||
void Decoder::correctErrors(ArrayRef<unsigned char> codewordBytes, int numDataCodewords) {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
*/
|
||||
|
||||
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
||||
#include <zxing/common/reedsolomon/GF256.h>
|
||||
#include <zxing/common/Counted.h>
|
||||
#include <zxing/common/Array.h>
|
||||
#include <zxing/common/DecoderResult.h>
|
||||
|
|
|
@ -106,7 +106,7 @@ Ref<DetectorResult> Detector::processFinderPatternInfo(Ref<FinderPatternInfo> in
|
|||
points[3].reset(alignmentPattern);
|
||||
}
|
||||
|
||||
Ref<DetectorResult> result(new DetectorResult(bits, points, transform));
|
||||
Ref<DetectorResult> result(new DetectorResult(bits, points));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
*/
|
||||
|
||||
#include "ReedSolomonTest.h"
|
||||
#include <zxing/common/reedsolomon/GF256.h>
|
||||
#include <zxing/common/reedsolomon/GF256Poly.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonDecoder.h>
|
||||
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
||||
#include <zxing/common/IllegalArgumentException.h>
|
||||
|
@ -56,7 +54,7 @@ void ReedSolomonTest::setUp() {
|
|||
qrCodeCorrectable_ =
|
||||
(qrCodeTestWithEc_->size() - qrCodeTest_->size()) / 2;
|
||||
|
||||
qrRSDecoder_ = new ReedSolomonDecoder(GF256::QR_CODE_FIELD);
|
||||
qrRSDecoder_ = new ReedSolomonDecoder(GenericGF::QR_CODE_FIELD_256);
|
||||
}
|
||||
|
||||
void ReedSolomonTest::tearDown() {
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
3B15E78612CE9BF900DC7062 /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B15E78512CE9BF900DC7062 /* Exception.cpp */; };
|
||||
3B1EEEC7144F1F5F0051C6A5 /* FormatException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B1EEEC6144F1F5F0051C6A5 /* FormatException.cpp */; };
|
||||
3B1EEECF144F1FBE0051C6A5 /* CharacterSetECI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B1EEECC144F1FBE0051C6A5 /* CharacterSetECI.cpp */; };
|
||||
3B1EEED0144F1FBE0051C6A5 /* ECI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B1EEECD144F1FBE0051C6A5 /* ECI.cpp */; };
|
||||
3B1EEED1144F1FBE0051C6A5 /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B1EEECE144F1FBE0051C6A5 /* StringUtils.cpp */; };
|
||||
3B2A325212CE9D31001D9945 /* IllegalArgumentException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A325112CE9D31001D9945 /* IllegalArgumentException.cpp */; };
|
||||
3B2A32B012CEA202001D9945 /* HybridBinarizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A32AF12CEA202001D9945 /* HybridBinarizer.cpp */; };
|
||||
|
@ -42,8 +41,6 @@
|
|||
3B2A336E12CEA9B0001D9945 /* DecodedBitStreamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A336D12CEA9B0001D9945 /* DecodedBitStreamParser.cpp */; };
|
||||
3B2A337212CEA9E2001D9945 /* Mode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A337112CEA9E2001D9945 /* Mode.cpp */; };
|
||||
3B2A337612CEAA06001D9945 /* ReedSolomonDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A337512CEAA06001D9945 /* ReedSolomonDecoder.cpp */; };
|
||||
3B2A337A12CEAA20001D9945 /* GF256.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A337912CEAA20001D9945 /* GF256.cpp */; };
|
||||
3B2A337E12CEAA37001D9945 /* GF256Poly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A337D12CEAA37001D9945 /* GF256Poly.cpp */; };
|
||||
3B2A338212CEAA4B001D9945 /* ReedSolomonException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A338112CEAA4B001D9945 /* ReedSolomonException.cpp */; };
|
||||
3B2A338612CEAA63001D9945 /* BitSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A338512CEAA63001D9945 /* BitSource.cpp */; };
|
||||
3B2A338E12CEAA95001D9945 /* DecoderResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B2A338D12CEAA95001D9945 /* DecoderResult.cpp */; };
|
||||
|
@ -53,6 +50,12 @@
|
|||
3BBF0AEE12CBCAFC0061650E /* AlignmentPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BBF0AED12CBCAFC0061650E /* AlignmentPattern.cpp */; };
|
||||
AA747D9F0F9514B9006C5449 /* ios_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* ios_Prefix.pch */; };
|
||||
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
|
||||
E105A8FE14EC34270011473C /* GenericGF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A8FC14EC34270011473C /* GenericGF.cpp */; };
|
||||
E105A8FF14EC34270011473C /* GenericGFPoly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A8FD14EC34270011473C /* GenericGFPoly.cpp */; };
|
||||
E105A90414EC35070011473C /* AztecDetectorResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A90214EC35070011473C /* AztecDetectorResult.cpp */; };
|
||||
E105A90514EC35070011473C /* AztecReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A90314EC35070011473C /* AztecReader.cpp */; };
|
||||
E105A90714EC35110011473C /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A90614EC35110011473C /* Decoder.cpp */; };
|
||||
E105A90914EC35190011473C /* Detector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A90814EC35190011473C /* Detector.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
@ -60,7 +63,6 @@
|
|||
3B15E78512CE9BF900DC7062 /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = core/src/zxing/Exception.cpp; sourceTree = "<group>"; };
|
||||
3B1EEEC6144F1F5F0051C6A5 /* FormatException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FormatException.cpp; path = core/src/zxing/FormatException.cpp; sourceTree = "<group>"; };
|
||||
3B1EEECC144F1FBE0051C6A5 /* CharacterSetECI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterSetECI.cpp; path = core/src/zxing/common/CharacterSetECI.cpp; sourceTree = "<group>"; };
|
||||
3B1EEECD144F1FBE0051C6A5 /* ECI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ECI.cpp; path = core/src/zxing/common/ECI.cpp; sourceTree = "<group>"; };
|
||||
3B1EEECE144F1FBE0051C6A5 /* StringUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringUtils.cpp; path = core/src/zxing/common/StringUtils.cpp; sourceTree = "<group>"; };
|
||||
3B2A325112CE9D31001D9945 /* IllegalArgumentException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IllegalArgumentException.cpp; path = core/src/zxing/common/IllegalArgumentException.cpp; sourceTree = "<group>"; };
|
||||
3B2A32AF12CEA202001D9945 /* HybridBinarizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HybridBinarizer.cpp; path = core/src/zxing/common/HybridBinarizer.cpp; sourceTree = "<group>"; };
|
||||
|
@ -91,8 +93,6 @@
|
|||
3B2A336D12CEA9B0001D9945 /* DecodedBitStreamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DecodedBitStreamParser.cpp; path = core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp; sourceTree = "<group>"; };
|
||||
3B2A337112CEA9E2001D9945 /* Mode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Mode.cpp; path = core/src/zxing/qrcode/decoder/Mode.cpp; sourceTree = "<group>"; };
|
||||
3B2A337512CEAA06001D9945 /* ReedSolomonDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ReedSolomonDecoder.cpp; path = core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp; sourceTree = "<group>"; };
|
||||
3B2A337912CEAA20001D9945 /* GF256.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GF256.cpp; path = core/src/zxing/common/reedsolomon/GF256.cpp; sourceTree = "<group>"; };
|
||||
3B2A337D12CEAA37001D9945 /* GF256Poly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GF256Poly.cpp; path = core/src/zxing/common/reedsolomon/GF256Poly.cpp; sourceTree = "<group>"; };
|
||||
3B2A338112CEAA4B001D9945 /* ReedSolomonException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ReedSolomonException.cpp; path = core/src/zxing/common/reedsolomon/ReedSolomonException.cpp; sourceTree = "<group>"; };
|
||||
3B2A338512CEAA63001D9945 /* BitSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BitSource.cpp; path = core/src/zxing/common/BitSource.cpp; sourceTree = "<group>"; };
|
||||
3B2A338D12CEAA95001D9945 /* DecoderResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DecoderResult.cpp; path = core/src/zxing/common/DecoderResult.cpp; sourceTree = "<group>"; };
|
||||
|
@ -103,6 +103,12 @@
|
|||
AA747D9E0F9514B9006C5449 /* ios_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_Prefix.pch; sourceTree = SOURCE_ROOT; };
|
||||
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
D2AAC07E0554694100DB518D /* libzxing.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libzxing.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E105A8FC14EC34270011473C /* GenericGF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GenericGF.cpp; path = core/src/zxing/common/reedsolomon/GenericGF.cpp; sourceTree = "<group>"; };
|
||||
E105A8FD14EC34270011473C /* GenericGFPoly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GenericGFPoly.cpp; path = core/src/zxing/common/reedsolomon/GenericGFPoly.cpp; sourceTree = "<group>"; };
|
||||
E105A90214EC35070011473C /* AztecDetectorResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AztecDetectorResult.cpp; path = core/src/zxing/aztec/AztecDetectorResult.cpp; sourceTree = "<group>"; };
|
||||
E105A90314EC35070011473C /* AztecReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AztecReader.cpp; path = core/src/zxing/aztec/AztecReader.cpp; sourceTree = "<group>"; };
|
||||
E105A90614EC35110011473C /* Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Decoder.cpp; path = core/src/zxing/aztec/decoder/Decoder.cpp; sourceTree = "<group>"; };
|
||||
E105A90814EC35190011473C /* Detector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Detector.cpp; path = core/src/zxing/aztec/detector/Detector.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -147,40 +153,28 @@
|
|||
08FB77AEFE84172EC02AAC07 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E105A90114EC34E20011473C /* aztec */,
|
||||
E105A90014EC34580011473C /* qrcode */,
|
||||
3B1EEECC144F1FBE0051C6A5 /* CharacterSetECI.cpp */,
|
||||
3B1EEECD144F1FBE0051C6A5 /* ECI.cpp */,
|
||||
3B1EEECE144F1FBE0051C6A5 /* StringUtils.cpp */,
|
||||
3B1EEEC6144F1F5F0051C6A5 /* FormatException.cpp */,
|
||||
3BBCB72312DD10DC00B5936D /* Reader.cpp */,
|
||||
3BBCB71F12DD10BC00B5936D /* QRCodeReader.cpp */,
|
||||
3BBCB71D12DD108300B5936D /* Result.cpp */,
|
||||
3B2A338D12CEAA95001D9945 /* DecoderResult.cpp */,
|
||||
3B2A338512CEAA63001D9945 /* BitSource.cpp */,
|
||||
3B2A338112CEAA4B001D9945 /* ReedSolomonException.cpp */,
|
||||
3B2A337D12CEAA37001D9945 /* GF256Poly.cpp */,
|
||||
3B2A337912CEAA20001D9945 /* GF256.cpp */,
|
||||
3B2A337512CEAA06001D9945 /* ReedSolomonDecoder.cpp */,
|
||||
E105A8FC14EC34270011473C /* GenericGF.cpp */,
|
||||
E105A8FD14EC34270011473C /* GenericGFPoly.cpp */,
|
||||
3B2A337112CEA9E2001D9945 /* Mode.cpp */,
|
||||
3B2A336D12CEA9B0001D9945 /* DecodedBitStreamParser.cpp */,
|
||||
3B2A336912CEA997001D9945 /* DataMask.cpp */,
|
||||
3B2A336512CEA976001D9945 /* Str.cpp */,
|
||||
3B2A336112CEA95C001D9945 /* DataBlock.cpp */,
|
||||
3B2A335D12CEA93D001D9945 /* BitMatrixParser.cpp */,
|
||||
3B2A335912CEA925001D9945 /* Decoder.cpp */,
|
||||
3B2A333212CEA6C2001D9945 /* DetectorResult.cpp */,
|
||||
3B2A332E12CEA696001D9945 /* ErrorCorrectionLevel.cpp */,
|
||||
3B2A332A12CEA67F001D9945 /* FormatInformation.cpp */,
|
||||
3B2A332612CEA664001D9945 /* FinderPattern.cpp */,
|
||||
3B2A332212CEA64F001D9945 /* PerspectiveTransform.cpp */,
|
||||
3B2A331E12CEA638001D9945 /* GridSampler.cpp */,
|
||||
3B2A331A12CEA624001D9945 /* FinderPatternInfo.cpp */,
|
||||
3B2A331612CEA60A001D9945 /* DecodeHints.cpp */,
|
||||
3B2A331212CEA5F3001D9945 /* FinderPatternFinder.cpp */,
|
||||
3B2A330E12CEA5D2001D9945 /* Version.cpp */,
|
||||
3B2A330A12CEA5BF001D9945 /* ReaderException.cpp */,
|
||||
3B2A330612CEA59E001D9945 /* ResultPoint.cpp */,
|
||||
3B2A330212CEA55B001D9945 /* AlignmentPatternFinder.cpp */,
|
||||
3B2A32FE12CEA53A001D9945 /* Detector.cpp */,
|
||||
3B2A32E712CEA43A001D9945 /* BinaryBitmap.cpp */,
|
||||
3B2A32CB12CEA380001D9945 /* BitMatrix.cpp */,
|
||||
3B2A32C512CEA2F9001D9945 /* BitArray.cpp */,
|
||||
|
@ -190,7 +184,6 @@
|
|||
3B2A325112CE9D31001D9945 /* IllegalArgumentException.cpp */,
|
||||
3B15E78512CE9BF900DC7062 /* Exception.cpp */,
|
||||
3B15E73912CE996800DC7062 /* LuminanceSource.cpp */,
|
||||
3BBF0AED12CBCAFC0061650E /* AlignmentPattern.cpp */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
|
@ -203,6 +196,38 @@
|
|||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E105A90014EC34580011473C /* qrcode */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3BBCB71F12DD10BC00B5936D /* QRCodeReader.cpp */,
|
||||
3B2A336912CEA997001D9945 /* DataMask.cpp */,
|
||||
3B2A336112CEA95C001D9945 /* DataBlock.cpp */,
|
||||
3B2A335D12CEA93D001D9945 /* BitMatrixParser.cpp */,
|
||||
3B2A335912CEA925001D9945 /* Decoder.cpp */,
|
||||
3B2A332E12CEA696001D9945 /* ErrorCorrectionLevel.cpp */,
|
||||
3B2A332A12CEA67F001D9945 /* FormatInformation.cpp */,
|
||||
3B2A332612CEA664001D9945 /* FinderPattern.cpp */,
|
||||
3B2A331A12CEA624001D9945 /* FinderPatternInfo.cpp */,
|
||||
3B2A331212CEA5F3001D9945 /* FinderPatternFinder.cpp */,
|
||||
3B2A330E12CEA5D2001D9945 /* Version.cpp */,
|
||||
3B2A330212CEA55B001D9945 /* AlignmentPatternFinder.cpp */,
|
||||
3B2A32FE12CEA53A001D9945 /* Detector.cpp */,
|
||||
3BBF0AED12CBCAFC0061650E /* AlignmentPattern.cpp */,
|
||||
);
|
||||
name = qrcode;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E105A90114EC34E20011473C /* aztec */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E105A90814EC35190011473C /* Detector.cpp */,
|
||||
E105A90614EC35110011473C /* Decoder.cpp */,
|
||||
E105A90214EC35070011473C /* AztecDetectorResult.cpp */,
|
||||
E105A90314EC35070011473C /* AztecReader.cpp */,
|
||||
);
|
||||
name = aztec;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
|
@ -299,8 +324,6 @@
|
|||
3B2A336E12CEA9B0001D9945 /* DecodedBitStreamParser.cpp in Sources */,
|
||||
3B2A337212CEA9E2001D9945 /* Mode.cpp in Sources */,
|
||||
3B2A337612CEAA06001D9945 /* ReedSolomonDecoder.cpp in Sources */,
|
||||
3B2A337A12CEAA20001D9945 /* GF256.cpp in Sources */,
|
||||
3B2A337E12CEAA37001D9945 /* GF256Poly.cpp in Sources */,
|
||||
3B2A338212CEAA4B001D9945 /* ReedSolomonException.cpp in Sources */,
|
||||
3B2A338612CEAA63001D9945 /* BitSource.cpp in Sources */,
|
||||
3B2A338E12CEAA95001D9945 /* DecoderResult.cpp in Sources */,
|
||||
|
@ -309,8 +332,13 @@
|
|||
3BBCB72412DD10DC00B5936D /* Reader.cpp in Sources */,
|
||||
3B1EEEC7144F1F5F0051C6A5 /* FormatException.cpp in Sources */,
|
||||
3B1EEECF144F1FBE0051C6A5 /* CharacterSetECI.cpp in Sources */,
|
||||
3B1EEED0144F1FBE0051C6A5 /* ECI.cpp in Sources */,
|
||||
3B1EEED1144F1FBE0051C6A5 /* StringUtils.cpp in Sources */,
|
||||
E105A8FE14EC34270011473C /* GenericGF.cpp in Sources */,
|
||||
E105A8FF14EC34270011473C /* GenericGFPoly.cpp in Sources */,
|
||||
E105A90414EC35070011473C /* AztecDetectorResult.cpp in Sources */,
|
||||
E105A90514EC35070011473C /* AztecReader.cpp in Sources */,
|
||||
E105A90714EC35110011473C /* Decoder.cpp in Sources */,
|
||||
E105A90914EC35190011473C /* Detector.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -44,10 +44,6 @@
|
|||
3B5B0EC8121C52ED005698F8 /* PerspectiveTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B5B0E33121C52ED005698F8 /* PerspectiveTransform.cpp */; };
|
||||
3B5B0EC9121C52ED005698F8 /* PerspectiveTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B5B0E34121C52ED005698F8 /* PerspectiveTransform.h */; };
|
||||
3B5B0ECA121C52ED005698F8 /* Point.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B5B0E35121C52ED005698F8 /* Point.h */; };
|
||||
3B5B0ECB121C52ED005698F8 /* GF256.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B5B0E37121C52ED005698F8 /* GF256.cpp */; };
|
||||
3B5B0ECC121C52ED005698F8 /* GF256.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B5B0E38121C52ED005698F8 /* GF256.h */; };
|
||||
3B5B0ECD121C52ED005698F8 /* GF256Poly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B5B0E39121C52ED005698F8 /* GF256Poly.cpp */; };
|
||||
3B5B0ECE121C52ED005698F8 /* GF256Poly.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B5B0E3A121C52ED005698F8 /* GF256Poly.h */; };
|
||||
3B5B0ECF121C52ED005698F8 /* ReedSolomonDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B5B0E3B121C52ED005698F8 /* ReedSolomonDecoder.cpp */; };
|
||||
3B5B0ED0121C52ED005698F8 /* ReedSolomonDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B5B0E3C121C52ED005698F8 /* ReedSolomonDecoder.h */; };
|
||||
3B5B0ED1121C52ED005698F8 /* ReedSolomonException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B5B0E3D121C52ED005698F8 /* ReedSolomonException.cpp */; };
|
||||
|
@ -150,10 +146,21 @@
|
|||
3B5B0F32121C52ED005698F8 /* ResultPointCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B5B0EA5121C52ED005698F8 /* ResultPointCallback.h */; };
|
||||
3BB87D4314B54C480078117F /* FormatException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BB87D4214B54C480078117F /* FormatException.cpp */; };
|
||||
3BB87D4714B54C610078117F /* CharacterSetECI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BB87D4414B54C610078117F /* CharacterSetECI.cpp */; };
|
||||
3BB87D4814B54C610078117F /* ECI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BB87D4514B54C610078117F /* ECI.cpp */; };
|
||||
3BB87D4914B54C610078117F /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BB87D4614B54C610078117F /* StringUtils.cpp */; };
|
||||
3BB87D5014B54F1D0078117F /* WhiteRectangleDetector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BB87D4F14B54F1D0078117F /* WhiteRectangleDetector.cpp */; };
|
||||
3BB87D5214B54F3F0078117F /* NotFoundException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BB87D5114B54F3F0078117F /* NotFoundException.cpp */; };
|
||||
E105A91214EC35860011473C /* GenericGF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A90E14EC35860011473C /* GenericGF.cpp */; };
|
||||
E105A91314EC35860011473C /* GenericGF.h in Headers */ = {isa = PBXBuildFile; fileRef = E105A90F14EC35860011473C /* GenericGF.h */; };
|
||||
E105A91414EC35860011473C /* GenericGFPoly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A91014EC35860011473C /* GenericGFPoly.cpp */; };
|
||||
E105A91514EC35860011473C /* GenericGFPoly.h in Headers */ = {isa = PBXBuildFile; fileRef = E105A91114EC35860011473C /* GenericGFPoly.h */; };
|
||||
E105A92114EC35AA0011473C /* AztecDetectorResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A91714EC35AA0011473C /* AztecDetectorResult.cpp */; };
|
||||
E105A92214EC35AA0011473C /* AztecDetectorResult.h in Headers */ = {isa = PBXBuildFile; fileRef = E105A91814EC35AA0011473C /* AztecDetectorResult.h */; };
|
||||
E105A92314EC35AA0011473C /* AztecReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A91914EC35AA0011473C /* AztecReader.cpp */; };
|
||||
E105A92414EC35AA0011473C /* AztecReader.h in Headers */ = {isa = PBXBuildFile; fileRef = E105A91A14EC35AA0011473C /* AztecReader.h */; };
|
||||
E105A92514EC35AA0011473C /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A91C14EC35AA0011473C /* Decoder.cpp */; };
|
||||
E105A92614EC35AA0011473C /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E105A91D14EC35AA0011473C /* Decoder.h */; };
|
||||
E105A92714EC35AA0011473C /* Detector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E105A91F14EC35AA0011473C /* Detector.cpp */; };
|
||||
E105A92814EC35AA0011473C /* Detector.h in Headers */ = {isa = PBXBuildFile; fileRef = E105A92014EC35AA0011473C /* Detector.h */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
@ -195,10 +202,6 @@
|
|||
3B5B0E33121C52ED005698F8 /* PerspectiveTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerspectiveTransform.cpp; sourceTree = "<group>"; };
|
||||
3B5B0E34121C52ED005698F8 /* PerspectiveTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerspectiveTransform.h; sourceTree = "<group>"; };
|
||||
3B5B0E35121C52ED005698F8 /* Point.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Point.h; sourceTree = "<group>"; };
|
||||
3B5B0E37121C52ED005698F8 /* GF256.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GF256.cpp; sourceTree = "<group>"; };
|
||||
3B5B0E38121C52ED005698F8 /* GF256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GF256.h; sourceTree = "<group>"; };
|
||||
3B5B0E39121C52ED005698F8 /* GF256Poly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GF256Poly.cpp; sourceTree = "<group>"; };
|
||||
3B5B0E3A121C52ED005698F8 /* GF256Poly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GF256Poly.h; sourceTree = "<group>"; };
|
||||
3B5B0E3B121C52ED005698F8 /* ReedSolomonDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReedSolomonDecoder.cpp; sourceTree = "<group>"; };
|
||||
3B5B0E3C121C52ED005698F8 /* ReedSolomonDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReedSolomonDecoder.h; sourceTree = "<group>"; };
|
||||
3B5B0E3D121C52ED005698F8 /* ReedSolomonException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReedSolomonException.cpp; sourceTree = "<group>"; };
|
||||
|
@ -301,10 +304,21 @@
|
|||
3B5B0EA5121C52ED005698F8 /* ResultPointCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultPointCallback.h; sourceTree = "<group>"; };
|
||||
3BB87D4214B54C480078117F /* FormatException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatException.cpp; sourceTree = "<group>"; };
|
||||
3BB87D4414B54C610078117F /* CharacterSetECI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterSetECI.cpp; path = common/CharacterSetECI.cpp; sourceTree = "<group>"; };
|
||||
3BB87D4514B54C610078117F /* ECI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ECI.cpp; path = common/ECI.cpp; sourceTree = "<group>"; };
|
||||
3BB87D4614B54C610078117F /* StringUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringUtils.cpp; path = common/StringUtils.cpp; sourceTree = "<group>"; };
|
||||
3BB87D4F14B54F1D0078117F /* WhiteRectangleDetector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WhiteRectangleDetector.cpp; path = common/detector/WhiteRectangleDetector.cpp; sourceTree = "<group>"; };
|
||||
3BB87D5114B54F3F0078117F /* NotFoundException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotFoundException.cpp; sourceTree = "<group>"; };
|
||||
E105A90E14EC35860011473C /* GenericGF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericGF.cpp; sourceTree = "<group>"; };
|
||||
E105A90F14EC35860011473C /* GenericGF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericGF.h; sourceTree = "<group>"; };
|
||||
E105A91014EC35860011473C /* GenericGFPoly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericGFPoly.cpp; sourceTree = "<group>"; };
|
||||
E105A91114EC35860011473C /* GenericGFPoly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericGFPoly.h; sourceTree = "<group>"; };
|
||||
E105A91714EC35AA0011473C /* AztecDetectorResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AztecDetectorResult.cpp; path = aztec/AztecDetectorResult.cpp; sourceTree = "<group>"; };
|
||||
E105A91814EC35AA0011473C /* AztecDetectorResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AztecDetectorResult.h; path = aztec/AztecDetectorResult.h; sourceTree = "<group>"; };
|
||||
E105A91914EC35AA0011473C /* AztecReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AztecReader.cpp; path = aztec/AztecReader.cpp; sourceTree = "<group>"; };
|
||||
E105A91A14EC35AA0011473C /* AztecReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AztecReader.h; path = aztec/AztecReader.h; sourceTree = "<group>"; };
|
||||
E105A91C14EC35AA0011473C /* Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decoder.cpp; sourceTree = "<group>"; };
|
||||
E105A91D14EC35AA0011473C /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; };
|
||||
E105A91F14EC35AA0011473C /* Detector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Detector.cpp; sourceTree = "<group>"; };
|
||||
E105A92014EC35AA0011473C /* Detector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Detector.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -350,8 +364,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0E0F121C52ED005698F8 /* zxing */,
|
||||
3B5B0C8C121C4F61005698F8 /* zxing */,
|
||||
3B5B0B5F121C4EC3005698F8 /* zxing */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
|
@ -377,173 +389,13 @@
|
|||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0B5F121C4EC3005698F8 /* zxing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0B66121C4EC3005698F8 /* common */,
|
||||
3B5B0B91121C4EC3005698F8 /* datamatrix */,
|
||||
3B5B0BAE121C4EC3005698F8 /* oned */,
|
||||
3B5B0BC7121C4EC3005698F8 /* qrcode */,
|
||||
);
|
||||
name = zxing;
|
||||
path = core/src/zxing;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0B66121C4EC3005698F8 /* common */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0B86121C4EC3005698F8 /* reedsolomon */,
|
||||
);
|
||||
path = common;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0B86121C4EC3005698F8 /* reedsolomon */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = reedsolomon;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0B91121C4EC3005698F8 /* datamatrix */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0B94121C4EC3005698F8 /* decoder */,
|
||||
3B5B0B9D121C4EC3005698F8 /* detector */,
|
||||
);
|
||||
path = datamatrix;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0B94121C4EC3005698F8 /* decoder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = decoder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0B9D121C4EC3005698F8 /* detector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0BAE121C4EC3005698F8 /* oned */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = oned;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0BC7121C4EC3005698F8 /* qrcode */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0BC8121C4EC3005698F8 /* decoder */,
|
||||
3B5B0BD5121C4EC3005698F8 /* detector */,
|
||||
);
|
||||
path = qrcode;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0BC8121C4EC3005698F8 /* decoder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = decoder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0BD5121C4EC3005698F8 /* detector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0C8C121C4F61005698F8 /* zxing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0C93121C4F61005698F8 /* common */,
|
||||
3B5B0CBE121C4F61005698F8 /* datamatrix */,
|
||||
3B5B0CDB121C4F61005698F8 /* oned */,
|
||||
3B5B0CF4121C4F61005698F8 /* qrcode */,
|
||||
);
|
||||
name = zxing;
|
||||
path = core/src/zxing;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0C93121C4F61005698F8 /* common */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0CB3121C4F61005698F8 /* reedsolomon */,
|
||||
);
|
||||
path = common;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CB3121C4F61005698F8 /* reedsolomon */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = reedsolomon;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CBE121C4F61005698F8 /* datamatrix */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0CC1121C4F61005698F8 /* decoder */,
|
||||
3B5B0CCA121C4F61005698F8 /* detector */,
|
||||
);
|
||||
path = datamatrix;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CC1121C4F61005698F8 /* decoder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = decoder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CCA121C4F61005698F8 /* detector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CDB121C4F61005698F8 /* oned */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = oned;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CF4121C4F61005698F8 /* qrcode */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0CF5121C4F61005698F8 /* decoder */,
|
||||
3B5B0D02121C4F61005698F8 /* detector */,
|
||||
);
|
||||
path = qrcode;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0CF5121C4F61005698F8 /* decoder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = decoder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0D02121C4F61005698F8 /* detector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B5B0E0F121C52ED005698F8 /* zxing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E105A91614EC35980011473C /* aztec */,
|
||||
3BB87D5114B54F3F0078117F /* NotFoundException.cpp */,
|
||||
3BB87D4F14B54F1D0078117F /* WhiteRectangleDetector.cpp */,
|
||||
3BB87D4414B54C610078117F /* CharacterSetECI.cpp */,
|
||||
3BB87D4514B54C610078117F /* ECI.cpp */,
|
||||
3BB87D4614B54C610078117F /* StringUtils.cpp */,
|
||||
3BB87D4214B54C480078117F /* FormatException.cpp */,
|
||||
3B5B0E10121C52ED005698F8 /* BarcodeFormat.cpp */,
|
||||
|
@ -623,10 +475,10 @@
|
|||
3B5B0E36121C52ED005698F8 /* reedsolomon */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B5B0E37121C52ED005698F8 /* GF256.cpp */,
|
||||
3B5B0E38121C52ED005698F8 /* GF256.h */,
|
||||
3B5B0E39121C52ED005698F8 /* GF256Poly.cpp */,
|
||||
3B5B0E3A121C52ED005698F8 /* GF256Poly.h */,
|
||||
E105A90E14EC35860011473C /* GenericGF.cpp */,
|
||||
E105A90F14EC35860011473C /* GenericGF.h */,
|
||||
E105A91014EC35860011473C /* GenericGFPoly.cpp */,
|
||||
E105A91114EC35860011473C /* GenericGFPoly.h */,
|
||||
3B5B0E3B121C52ED005698F8 /* ReedSolomonDecoder.cpp */,
|
||||
3B5B0E3C121C52ED005698F8 /* ReedSolomonDecoder.h */,
|
||||
3B5B0E3D121C52ED005698F8 /* ReedSolomonException.cpp */,
|
||||
|
@ -764,6 +616,39 @@
|
|||
path = detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E105A91614EC35980011473C /* aztec */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E105A91714EC35AA0011473C /* AztecDetectorResult.cpp */,
|
||||
E105A91814EC35AA0011473C /* AztecDetectorResult.h */,
|
||||
E105A91914EC35AA0011473C /* AztecReader.cpp */,
|
||||
E105A91A14EC35AA0011473C /* AztecReader.h */,
|
||||
E105A91B14EC35AA0011473C /* decoder */,
|
||||
E105A91E14EC35AA0011473C /* detector */,
|
||||
);
|
||||
name = aztec;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E105A91B14EC35AA0011473C /* decoder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E105A91C14EC35AA0011473C /* Decoder.cpp */,
|
||||
E105A91D14EC35AA0011473C /* Decoder.h */,
|
||||
);
|
||||
name = decoder;
|
||||
path = aztec/decoder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E105A91E14EC35AA0011473C /* detector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E105A91F14EC35AA0011473C /* Detector.cpp */,
|
||||
E105A92014EC35AA0011473C /* Detector.h */,
|
||||
);
|
||||
name = detector;
|
||||
path = aztec/detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
|
@ -790,8 +675,6 @@
|
|||
3B5B0EC7121C52ED005698F8 /* IllegalArgumentException.h in Headers */,
|
||||
3B5B0EC9121C52ED005698F8 /* PerspectiveTransform.h in Headers */,
|
||||
3B5B0ECA121C52ED005698F8 /* Point.h in Headers */,
|
||||
3B5B0ECC121C52ED005698F8 /* GF256.h in Headers */,
|
||||
3B5B0ECE121C52ED005698F8 /* GF256Poly.h in Headers */,
|
||||
3B5B0ED0121C52ED005698F8 /* ReedSolomonDecoder.h in Headers */,
|
||||
3B5B0ED2121C52ED005698F8 /* ReedSolomonException.h in Headers */,
|
||||
3B5B0ED4121C52ED005698F8 /* Str.h in Headers */,
|
||||
|
@ -842,6 +725,12 @@
|
|||
3B5B0F2E121C52ED005698F8 /* Result.h in Headers */,
|
||||
3B5B0F30121C52ED005698F8 /* ResultPoint.h in Headers */,
|
||||
3B5B0F32121C52ED005698F8 /* ResultPointCallback.h in Headers */,
|
||||
E105A91314EC35860011473C /* GenericGF.h in Headers */,
|
||||
E105A91514EC35860011473C /* GenericGFPoly.h in Headers */,
|
||||
E105A92214EC35AA0011473C /* AztecDetectorResult.h in Headers */,
|
||||
E105A92414EC35AA0011473C /* AztecReader.h in Headers */,
|
||||
E105A92614EC35AA0011473C /* Decoder.h in Headers */,
|
||||
E105A92814EC35AA0011473C /* Detector.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -910,8 +799,6 @@
|
|||
3B5B0EC4121C52ED005698F8 /* HybridBinarizer.cpp in Sources */,
|
||||
3B5B0EC6121C52ED005698F8 /* IllegalArgumentException.cpp in Sources */,
|
||||
3B5B0EC8121C52ED005698F8 /* PerspectiveTransform.cpp in Sources */,
|
||||
3B5B0ECB121C52ED005698F8 /* GF256.cpp in Sources */,
|
||||
3B5B0ECD121C52ED005698F8 /* GF256Poly.cpp in Sources */,
|
||||
3B5B0ECF121C52ED005698F8 /* ReedSolomonDecoder.cpp in Sources */,
|
||||
3B5B0ED1121C52ED005698F8 /* ReedSolomonException.cpp in Sources */,
|
||||
3B5B0ED3121C52ED005698F8 /* Str.cpp in Sources */,
|
||||
|
@ -964,10 +851,15 @@
|
|||
3B5B0F31121C52ED005698F8 /* ResultPointCallback.cpp in Sources */,
|
||||
3BB87D4314B54C480078117F /* FormatException.cpp in Sources */,
|
||||
3BB87D4714B54C610078117F /* CharacterSetECI.cpp in Sources */,
|
||||
3BB87D4814B54C610078117F /* ECI.cpp in Sources */,
|
||||
3BB87D4914B54C610078117F /* StringUtils.cpp in Sources */,
|
||||
3BB87D5014B54F1D0078117F /* WhiteRectangleDetector.cpp in Sources */,
|
||||
3BB87D5214B54F3F0078117F /* NotFoundException.cpp in Sources */,
|
||||
E105A91214EC35860011473C /* GenericGF.cpp in Sources */,
|
||||
E105A91414EC35860011473C /* GenericGFPoly.cpp in Sources */,
|
||||
E105A92114EC35AA0011473C /* AztecDetectorResult.cpp in Sources */,
|
||||
E105A92314EC35AA0011473C /* AztecReader.cpp in Sources */,
|
||||
E105A92514EC35AA0011473C /* Decoder.cpp in Sources */,
|
||||
E105A92714EC35AA0011473C /* Detector.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -1,13 +1,37 @@
|
|||
//
|
||||
// RootViewController.m
|
||||
// ScanTest
|
||||
//
|
||||
// Created by David Kavanagh on 5/10/10.
|
||||
// Copyright __MyCompanyName__ 2010. All rights reserved.
|
||||
//
|
||||
// -*- Mode: ObjC; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/*
|
||||
* Copyright 2010-2012 ZXing authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "RootViewController.h"
|
||||
|
||||
#ifndef ZXQR
|
||||
#define ZXQR 1
|
||||
#endif
|
||||
|
||||
#if ZXQR
|
||||
#import "QRCodeReader.h"
|
||||
#endif
|
||||
|
||||
#ifndef ZXAZ
|
||||
#define ZXAZ 0
|
||||
#endif
|
||||
|
||||
#if ZXAZ
|
||||
#import "AztecReader.h"
|
||||
#endif
|
||||
|
||||
|
||||
@interface RootViewController()
|
||||
|
@ -30,14 +54,27 @@
|
|||
- (IBAction)scanPressed:(id)sender {
|
||||
|
||||
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO];
|
||||
|
||||
NSMutableSet *readers = [[NSMutableSet alloc ] init];
|
||||
|
||||
#if ZXQR
|
||||
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init];
|
||||
NSSet *readers = [[NSSet alloc ] initWithObjects:qrcodeReader,nil];
|
||||
[readers addObject:qrcodeReader];
|
||||
[qrcodeReader release];
|
||||
#endif
|
||||
|
||||
#if ZXAZ
|
||||
AztecReader *aztecReader = [[AztecReader alloc] init];
|
||||
[readers addObject:aztecReader];
|
||||
[aztecReader release];
|
||||
#endif
|
||||
|
||||
widController.readers = readers;
|
||||
[readers release];
|
||||
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
widController.soundToPlay =
|
||||
[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO];
|
||||
[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO];
|
||||
[self presentModalViewController:widController animated:YES];
|
||||
[widController release];
|
||||
}
|
||||
|
|
15
iphone/ZXingWidget/Classes/AztecReader.h
Normal file
15
iphone/ZXingWidget/Classes/AztecReader.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// AztecReader.h
|
||||
// ZXingWidget
|
||||
//
|
||||
// Created by Lukas Stabe on 08.02.12.
|
||||
// Copyright (c) 2012 EOS UPTRADE GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FormatReader.h"
|
||||
|
||||
@interface AztecReader : FormatReader
|
||||
|
||||
- (id) init;
|
||||
|
||||
@end
|
25
iphone/ZXingWidget/Classes/AztecReader.mm
Normal file
25
iphone/ZXingWidget/Classes/AztecReader.mm
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// AztecReader.m
|
||||
// ZXingWidget
|
||||
//
|
||||
// Created by Lukas Stabe on 08.02.12.
|
||||
// Copyright (c) 2012 EOS UPTRADE GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AztecReader.h"
|
||||
#import <zxing/aztec/AztecReader.h>
|
||||
|
||||
@implementation AztecReader
|
||||
|
||||
- (id)init {
|
||||
zxing::aztec::AztecReader *reader = new zxing::aztec::AztecReader();
|
||||
|
||||
return [super initWithReader:reader];
|
||||
}
|
||||
|
||||
- (zxing::Ref<zxing::Result>)decode:(zxing::Ref<zxing::BinaryBitmap>)grayImage andCallback:(zxing::Ref<zxing::ResultPointCallback>)callback {
|
||||
//NSLog(@"no callbacks supported for aztec");
|
||||
return [self decode:grayImage];
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,3 +1,5 @@
|
|||
// -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
|
||||
#ifndef __CBARCODE_FORMAT_H__
|
||||
#define __CBARCODE_FORMAT_H__
|
||||
|
||||
|
@ -22,16 +24,17 @@
|
|||
|
||||
// This must remain parallel to zxing::BarcodeFormat.
|
||||
typedef enum BarcodeFormat {
|
||||
BarcodeFormat_None = 0,
|
||||
BarcodeFormat_QR_CODE,
|
||||
BarcodeFormat_DATA_MATRIX,
|
||||
BarcodeFormat_UPC_E,
|
||||
BarcodeFormat_UPC_A,
|
||||
BarcodeFormat_EAN_8,
|
||||
BarcodeFormat_EAN_13,
|
||||
BarcodeFormat_CODE_128,
|
||||
BarcodeFormat_CODE_39,
|
||||
BarcodeFormat_ITF
|
||||
BarcodeFormat_None = 0,
|
||||
BarcodeFormat_QR_CODE,
|
||||
BarcodeFormat_DATA_MATRIX,
|
||||
BarcodeFormat_UPC_E,
|
||||
BarcodeFormat_UPC_A,
|
||||
BarcodeFormat_EAN_8,
|
||||
BarcodeFormat_EAN_13,
|
||||
BarcodeFormat_CODE_128,
|
||||
BarcodeFormat_CODE_39,
|
||||
BarcodeFormat_ITF,
|
||||
BarcodeFormat_AZTEC
|
||||
} BarcodeFormat;
|
||||
|
||||
#endif // __CBARCODE_FORMAT_H__
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// -*- Mode: ObjC; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/**
|
||||
* Copyright 2011 Google, Inc.
|
||||
*
|
||||
|
@ -22,28 +23,30 @@ BarcodeFormat CBarcodeFormatConvert(zxing::BarcodeFormat value);
|
|||
// The purpose of this function is to issue a warning when a value is added to
|
||||
// zxing::BarcodeFormat.
|
||||
BarcodeFormat CBarcodeFormatConvert(zxing::BarcodeFormat value) {
|
||||
switch (value) {
|
||||
case zxing::BarcodeFormat_None:
|
||||
return BarcodeFormat_None;
|
||||
case zxing::BarcodeFormat_QR_CODE:
|
||||
return BarcodeFormat_QR_CODE;
|
||||
case zxing::BarcodeFormat_DATA_MATRIX:
|
||||
return BarcodeFormat_DATA_MATRIX;
|
||||
case zxing::BarcodeFormat_UPC_E:
|
||||
return BarcodeFormat_UPC_E;
|
||||
case zxing::BarcodeFormat_UPC_A:
|
||||
return BarcodeFormat_UPC_A;
|
||||
case zxing::BarcodeFormat_EAN_8:
|
||||
return BarcodeFormat_EAN_8;
|
||||
case zxing::BarcodeFormat_EAN_13:
|
||||
return BarcodeFormat_EAN_13;
|
||||
case zxing::BarcodeFormat_CODE_128:
|
||||
return BarcodeFormat_CODE_128;
|
||||
case zxing::BarcodeFormat_CODE_39:
|
||||
return BarcodeFormat_CODE_39;
|
||||
case zxing::BarcodeFormat_ITF:
|
||||
return BarcodeFormat_ITF;
|
||||
}
|
||||
switch (value) {
|
||||
case zxing::BarcodeFormat_None:
|
||||
return BarcodeFormat_None;
|
||||
case zxing::BarcodeFormat_QR_CODE:
|
||||
return BarcodeFormat_QR_CODE;
|
||||
case zxing::BarcodeFormat_DATA_MATRIX:
|
||||
return BarcodeFormat_DATA_MATRIX;
|
||||
case zxing::BarcodeFormat_UPC_E:
|
||||
return BarcodeFormat_UPC_E;
|
||||
case zxing::BarcodeFormat_UPC_A:
|
||||
return BarcodeFormat_UPC_A;
|
||||
case zxing::BarcodeFormat_EAN_8:
|
||||
return BarcodeFormat_EAN_8;
|
||||
case zxing::BarcodeFormat_EAN_13:
|
||||
return BarcodeFormat_EAN_13;
|
||||
case zxing::BarcodeFormat_CODE_128:
|
||||
return BarcodeFormat_CODE_128;
|
||||
case zxing::BarcodeFormat_CODE_39:
|
||||
return BarcodeFormat_CODE_39;
|
||||
case zxing::BarcodeFormat_ITF:
|
||||
return BarcodeFormat_ITF;
|
||||
case zxing::BarcodeFormat_AZTEC:
|
||||
return BarcodeFormat_AZTEC;
|
||||
}
|
||||
|
||||
return BarcodeFormat_None;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
//
|
||||
// Decoder.m
|
||||
// ZXing
|
||||
//
|
||||
// Created by Christian Brunschen on 31/03/2008.
|
||||
//
|
||||
// -*- Mode: ObjC; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/*
|
||||
* Copyright 2008 ZXing authors
|
||||
* Copyright 2008-2012 ZXing authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -36,7 +31,7 @@ class ZXingWidgetControllerCallback : public zxing::ResultPointCallback {
|
|||
private:
|
||||
Decoder* decoder;
|
||||
public:
|
||||
ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
||||
ZXingWidgetControllerCallback(Decoder* _decoder) : decoder(_decoder) {}
|
||||
void foundPossibleResultPoint(ResultPoint const& result) {
|
||||
CGPoint point;
|
||||
point.x = result.getX();
|
||||
|
@ -89,7 +84,7 @@ public:
|
|||
CGSize size = [image size];
|
||||
#ifdef DEBUG
|
||||
NSLog(@"decoding: image is (%.1f x %.1f), cropRect is (%.1f,%.1f)x(%.1f,%.1f)", size.width, size.height,
|
||||
cropRect.origin.x, cropRect.origin.y, cropRect.size.width, cropRect.size.height);
|
||||
cropRect.origin.x, cropRect.origin.y, cropRect.size.width, cropRect.size.height);
|
||||
#endif
|
||||
float scale = fminf(1.0f, fmaxf(SUBSET_SIZE / cropRect.size.width, SUBSET_SIZE / cropRect.size.height));
|
||||
CGPoint offset = CGPointMake(-cropRect.origin.x, -cropRect.origin.y);
|
||||
|
@ -113,9 +108,9 @@ public:
|
|||
CGColorSpaceRef grayColorSpace = CGColorSpaceCreateDeviceGray();
|
||||
|
||||
CGContextRef ctx =
|
||||
CGBitmapContextCreate(subsetData, subsetWidth, subsetHeight,
|
||||
8, subsetBytesPerRow, grayColorSpace,
|
||||
kCGImageAlphaNone);
|
||||
CGBitmapContextCreate(subsetData, subsetWidth, subsetHeight,
|
||||
8, subsetBytesPerRow, grayColorSpace,
|
||||
kCGImageAlphaNone);
|
||||
CGColorSpaceRelease(grayColorSpace);
|
||||
CGContextSetInterpolationQuality(ctx, kCGInterpolationNone);
|
||||
CGContextSetAllowsAntialiasing(ctx, false);
|
||||
|
@ -165,7 +160,7 @@ public:
|
|||
//NSSet *formatReaders = [FormatReader formatReaders];
|
||||
NSSet *formatReaders = self.readers;
|
||||
Ref<LuminanceSource> source
|
||||
(new GreyscaleLuminanceSource(subsetData, subsetBytesPerRow, subsetHeight, 0, 0, subsetWidth, subsetHeight));
|
||||
(new GreyscaleLuminanceSource(subsetData, subsetBytesPerRow, subsetHeight, 0, 0, subsetWidth, subsetHeight));
|
||||
|
||||
Ref<Binarizer> binarizer (new HybridBinarizer(source));
|
||||
source = 0;
|
||||
|
@ -185,15 +180,15 @@ public:
|
|||
NSMutableArray *points = nil;
|
||||
NSString *resultString = nil;
|
||||
try {
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
NSLog(@"decoding gray image");
|
||||
#endif
|
||||
#endif
|
||||
ResultPointCallback* callback_pointer(new ZXingWidgetControllerCallback(self));
|
||||
Ref<ResultPointCallback> callback(callback_pointer);
|
||||
Ref<Result> result([reader decode:grayImage andCallback:callback]);
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
NSLog(@"gray image decoded");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Ref<String> resultText(result->getText());
|
||||
const char *cString = resultText->getText().c_str();
|
||||
|
@ -212,12 +207,12 @@ public:
|
|||
} catch (ReaderException &rex) {
|
||||
#ifdef DEBUG
|
||||
NSLog(@"failed to decode, caught ReaderException '%s'",
|
||||
rex.what());
|
||||
rex.what());
|
||||
#endif
|
||||
} catch (IllegalArgumentException &iex) {
|
||||
#ifdef DEBUG
|
||||
NSLog(@"failed to decode, caught IllegalArgumentException '%s'",
|
||||
iex.what());
|
||||
iex.what());
|
||||
#endif
|
||||
} catch (...) {
|
||||
NSLog(@"Caught unknown exception!");
|
||||
|
@ -240,24 +235,24 @@ public:
|
|||
}
|
||||
#endif
|
||||
|
||||
free(subsetData);
|
||||
self.subsetData = NULL;
|
||||
free(subsetData);
|
||||
self.subsetData = NULL;
|
||||
|
||||
// DONT COMMIT
|
||||
// [decoderResult release];
|
||||
// decoderResult = nil;
|
||||
// DONT COMMIT
|
||||
// [decoderResult release];
|
||||
// decoderResult = nil;
|
||||
|
||||
|
||||
if (decoderResult) {
|
||||
[self performSelectorOnMainThread:@selector(didDecodeImage:)
|
||||
withObject:[decoderResult copy]
|
||||
waitUntilDone:NO];
|
||||
withObject:[decoderResult copy]
|
||||
waitUntilDone:NO];
|
||||
[decoderResult release];
|
||||
returnCode = YES;
|
||||
} else {
|
||||
[self performSelectorOnMainThread:@selector(failedToDecodeImage:)
|
||||
withObject:NSLocalizedString(@"Decoder BarcodeDetectionFailure", @"No barcode detected.")
|
||||
waitUntilDone:NO];
|
||||
withObject:NSLocalizedString(@"Decoder BarcodeDetectionFailure", @"No barcode detected.")
|
||||
waitUntilDone:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,12 +122,24 @@
|
|||
3B117EF1145B220A0035037B /* MonochromeRectangleDetector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B117EEF145B220A0035037B /* MonochromeRectangleDetector.cpp */; };
|
||||
3B117EF2145B220A0035037B /* WhiteRectangleDetector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B117EF0145B220A0035037B /* WhiteRectangleDetector.cpp */; };
|
||||
3B117EF5145B221D0035037B /* NotFoundException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B117EF4145B221D0035037B /* NotFoundException.cpp */; };
|
||||
3B248F7D14EF3A660065F0DA /* GenericGF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F7914EF3A660065F0DA /* GenericGF.cpp */; };
|
||||
3B248F7E14EF3A660065F0DA /* GenericGF.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F7A14EF3A660065F0DA /* GenericGF.h */; };
|
||||
3B248F7F14EF3A660065F0DA /* GenericGFPoly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F7B14EF3A660065F0DA /* GenericGFPoly.cpp */; };
|
||||
3B248F8014EF3A660065F0DA /* GenericGFPoly.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F7C14EF3A660065F0DA /* GenericGFPoly.h */; };
|
||||
3B248F8E14EF3A980065F0DA /* AztecDetectorResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F8414EF3A980065F0DA /* AztecDetectorResult.cpp */; };
|
||||
3B248F8F14EF3A980065F0DA /* AztecDetectorResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F8514EF3A980065F0DA /* AztecDetectorResult.h */; };
|
||||
3B248F9014EF3A980065F0DA /* AztecReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F8614EF3A980065F0DA /* AztecReader.cpp */; };
|
||||
3B248F9114EF3A980065F0DA /* AztecReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F8714EF3A980065F0DA /* AztecReader.h */; };
|
||||
3B248F9214EF3A980065F0DA /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F8914EF3A980065F0DA /* Decoder.cpp */; };
|
||||
3B248F9314EF3A980065F0DA /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F8A14EF3A980065F0DA /* Decoder.h */; };
|
||||
3B248F9414EF3A980065F0DA /* Detector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F8C14EF3A980065F0DA /* Detector.cpp */; };
|
||||
3B248F9514EF3A980065F0DA /* Detector.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F8D14EF3A980065F0DA /* Detector.h */; };
|
||||
3B248F9814EF3AF80065F0DA /* AztecReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B248F9614EF3AF80065F0DA /* AztecReader.h */; };
|
||||
3B248F9914EF3AF80065F0DA /* AztecReader.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3B248F9714EF3AF80065F0DA /* AztecReader.mm */; };
|
||||
3B27C5D8144735CE005157C4 /* FormatException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B27C5D6144735CE005157C4 /* FormatException.cpp */; };
|
||||
3B27C5D9144735CE005157C4 /* FormatException.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B27C5D7144735CE005157C4 /* FormatException.h */; };
|
||||
3B27C5E1144735E6005157C4 /* CharacterSetECI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B27C5DB144735E6005157C4 /* CharacterSetECI.cpp */; };
|
||||
3B27C5E2144735E6005157C4 /* CharacterSetECI.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B27C5DC144735E6005157C4 /* CharacterSetECI.h */; };
|
||||
3B27C5E3144735E6005157C4 /* ECI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B27C5DD144735E6005157C4 /* ECI.cpp */; };
|
||||
3B27C5E4144735E6005157C4 /* ECI.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B27C5DE144735E6005157C4 /* ECI.h */; };
|
||||
3B27C5E5144735E6005157C4 /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B27C5DF144735E6005157C4 /* StringUtils.cpp */; };
|
||||
3B27C5E6144735E6005157C4 /* StringUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B27C5E0144735E6005157C4 /* StringUtils.h */; };
|
||||
3B72D96F12130EF6007CEF32 /* ResultPointCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B72D96D12130EF6007CEF32 /* ResultPointCallback.cpp */; };
|
||||
|
@ -173,10 +185,6 @@
|
|||
E534596111987396000CB77F /* PerspectiveTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E53458D411987396000CB77F /* PerspectiveTransform.cpp */; };
|
||||
E534596211987396000CB77F /* PerspectiveTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = E53458D511987396000CB77F /* PerspectiveTransform.h */; };
|
||||
E534596311987396000CB77F /* Point.h in Headers */ = {isa = PBXBuildFile; fileRef = E53458D611987396000CB77F /* Point.h */; };
|
||||
E534596411987396000CB77F /* GF256.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E53458D811987396000CB77F /* GF256.cpp */; };
|
||||
E534596511987396000CB77F /* GF256.h in Headers */ = {isa = PBXBuildFile; fileRef = E53458D911987396000CB77F /* GF256.h */; };
|
||||
E534596611987396000CB77F /* GF256Poly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E53458DA11987396000CB77F /* GF256Poly.cpp */; };
|
||||
E534596711987396000CB77F /* GF256Poly.h in Headers */ = {isa = PBXBuildFile; fileRef = E53458DB11987396000CB77F /* GF256Poly.h */; };
|
||||
E534596811987396000CB77F /* ReedSolomonDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E53458DC11987396000CB77F /* ReedSolomonDecoder.cpp */; };
|
||||
E534596911987396000CB77F /* ReedSolomonDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = E53458DD11987396000CB77F /* ReedSolomonDecoder.h */; };
|
||||
E534596A11987396000CB77F /* ReedSolomonException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E53458DE11987396000CB77F /* ReedSolomonException.cpp */; };
|
||||
|
@ -404,12 +412,24 @@
|
|||
3B117EEF145B220A0035037B /* MonochromeRectangleDetector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MonochromeRectangleDetector.cpp; path = detector/MonochromeRectangleDetector.cpp; sourceTree = "<group>"; };
|
||||
3B117EF0145B220A0035037B /* WhiteRectangleDetector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WhiteRectangleDetector.cpp; path = detector/WhiteRectangleDetector.cpp; sourceTree = "<group>"; };
|
||||
3B117EF4145B221D0035037B /* NotFoundException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotFoundException.cpp; sourceTree = "<group>"; };
|
||||
3B248F7914EF3A660065F0DA /* GenericGF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericGF.cpp; sourceTree = "<group>"; };
|
||||
3B248F7A14EF3A660065F0DA /* GenericGF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericGF.h; sourceTree = "<group>"; };
|
||||
3B248F7B14EF3A660065F0DA /* GenericGFPoly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericGFPoly.cpp; sourceTree = "<group>"; };
|
||||
3B248F7C14EF3A660065F0DA /* GenericGFPoly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericGFPoly.h; sourceTree = "<group>"; };
|
||||
3B248F8414EF3A980065F0DA /* AztecDetectorResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AztecDetectorResult.cpp; sourceTree = "<group>"; };
|
||||
3B248F8514EF3A980065F0DA /* AztecDetectorResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AztecDetectorResult.h; sourceTree = "<group>"; };
|
||||
3B248F8614EF3A980065F0DA /* AztecReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AztecReader.cpp; sourceTree = "<group>"; };
|
||||
3B248F8714EF3A980065F0DA /* AztecReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AztecReader.h; sourceTree = "<group>"; };
|
||||
3B248F8914EF3A980065F0DA /* Decoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decoder.cpp; sourceTree = "<group>"; };
|
||||
3B248F8A14EF3A980065F0DA /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; };
|
||||
3B248F8C14EF3A980065F0DA /* Detector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Detector.cpp; sourceTree = "<group>"; };
|
||||
3B248F8D14EF3A980065F0DA /* Detector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Detector.h; sourceTree = "<group>"; };
|
||||
3B248F9614EF3AF80065F0DA /* AztecReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AztecReader.h; path = Classes/AztecReader.h; sourceTree = "<group>"; };
|
||||
3B248F9714EF3AF80065F0DA /* AztecReader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AztecReader.mm; path = Classes/AztecReader.mm; sourceTree = "<group>"; };
|
||||
3B27C5D6144735CE005157C4 /* FormatException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormatException.cpp; sourceTree = "<group>"; };
|
||||
3B27C5D7144735CE005157C4 /* FormatException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormatException.h; sourceTree = "<group>"; };
|
||||
3B27C5DB144735E6005157C4 /* CharacterSetECI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CharacterSetECI.cpp; sourceTree = "<group>"; };
|
||||
3B27C5DC144735E6005157C4 /* CharacterSetECI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterSetECI.h; sourceTree = "<group>"; };
|
||||
3B27C5DD144735E6005157C4 /* ECI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ECI.cpp; sourceTree = "<group>"; };
|
||||
3B27C5DE144735E6005157C4 /* ECI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ECI.h; sourceTree = "<group>"; };
|
||||
3B27C5DF144735E6005157C4 /* StringUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringUtils.cpp; sourceTree = "<group>"; };
|
||||
3B27C5E0144735E6005157C4 /* StringUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringUtils.h; sourceTree = "<group>"; };
|
||||
3B72D96D12130EF6007CEF32 /* ResultPointCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResultPointCallback.cpp; sourceTree = "<group>"; };
|
||||
|
@ -456,10 +476,6 @@
|
|||
E53458D411987396000CB77F /* PerspectiveTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PerspectiveTransform.cpp; sourceTree = "<group>"; };
|
||||
E53458D511987396000CB77F /* PerspectiveTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PerspectiveTransform.h; sourceTree = "<group>"; };
|
||||
E53458D611987396000CB77F /* Point.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Point.h; sourceTree = "<group>"; };
|
||||
E53458D811987396000CB77F /* GF256.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GF256.cpp; sourceTree = "<group>"; };
|
||||
E53458D911987396000CB77F /* GF256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GF256.h; sourceTree = "<group>"; };
|
||||
E53458DA11987396000CB77F /* GF256Poly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GF256Poly.cpp; sourceTree = "<group>"; };
|
||||
E53458DB11987396000CB77F /* GF256Poly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GF256Poly.h; sourceTree = "<group>"; };
|
||||
E53458DC11987396000CB77F /* ReedSolomonDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReedSolomonDecoder.cpp; sourceTree = "<group>"; };
|
||||
E53458DD11987396000CB77F /* ReedSolomonDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReedSolomonDecoder.h; sourceTree = "<group>"; };
|
||||
E53458DE11987396000CB77F /* ReedSolomonException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReedSolomonException.cpp; sourceTree = "<group>"; };
|
||||
|
@ -630,6 +646,8 @@
|
|||
08FB77AEFE84172EC02AAC07 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B248F9614EF3AF80065F0DA /* AztecReader.h */,
|
||||
3B248F9714EF3AF80065F0DA /* AztecReader.mm */,
|
||||
1D603E6213E20AF1006F4B51 /* ArrayAndStringCategories.h */,
|
||||
1D603E6313E20AF1006F4B51 /* ArrayAndStringCategories.m */,
|
||||
1DFA090A13CE1A3900599044 /* CBarcodeFormat.h */,
|
||||
|
@ -685,6 +703,37 @@
|
|||
name = "Other Sources";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B248F8314EF3A980065F0DA /* aztec */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B248F8414EF3A980065F0DA /* AztecDetectorResult.cpp */,
|
||||
3B248F8514EF3A980065F0DA /* AztecDetectorResult.h */,
|
||||
3B248F8614EF3A980065F0DA /* AztecReader.cpp */,
|
||||
3B248F8714EF3A980065F0DA /* AztecReader.h */,
|
||||
3B248F8814EF3A980065F0DA /* decoder */,
|
||||
3B248F8B14EF3A980065F0DA /* detector */,
|
||||
);
|
||||
path = aztec;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B248F8814EF3A980065F0DA /* decoder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B248F8914EF3A980065F0DA /* Decoder.cpp */,
|
||||
3B248F8A14EF3A980065F0DA /* Decoder.h */,
|
||||
);
|
||||
path = decoder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3B248F8B14EF3A980065F0DA /* detector */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B248F8C14EF3A980065F0DA /* Detector.cpp */,
|
||||
3B248F8D14EF3A980065F0DA /* Detector.h */,
|
||||
);
|
||||
path = detector;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E53458B311987396000CB77F /* CoreSrc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -697,6 +746,7 @@
|
|||
E53458B411987396000CB77F /* zxing */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3B248F8314EF3A980065F0DA /* aztec */,
|
||||
3B117EF4145B221D0035037B /* NotFoundException.cpp */,
|
||||
3B27C5D6144735CE005157C4 /* FormatException.cpp */,
|
||||
3B27C5D7144735CE005157C4 /* FormatException.h */,
|
||||
|
@ -739,8 +789,6 @@
|
|||
3B117EF0145B220A0035037B /* WhiteRectangleDetector.cpp */,
|
||||
3B27C5DB144735E6005157C4 /* CharacterSetECI.cpp */,
|
||||
3B27C5DC144735E6005157C4 /* CharacterSetECI.h */,
|
||||
3B27C5DD144735E6005157C4 /* ECI.cpp */,
|
||||
3B27C5DE144735E6005157C4 /* ECI.h */,
|
||||
3B27C5DF144735E6005157C4 /* StringUtils.cpp */,
|
||||
3B27C5E0144735E6005157C4 /* StringUtils.h */,
|
||||
3B81AAF6120F0A7E0022E5D4 /* GreyscaleRotatedLuminanceSource.cpp */,
|
||||
|
@ -784,10 +832,10 @@
|
|||
E53458D711987396000CB77F /* reedsolomon */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E53458D811987396000CB77F /* GF256.cpp */,
|
||||
E53458D911987396000CB77F /* GF256.h */,
|
||||
E53458DA11987396000CB77F /* GF256Poly.cpp */,
|
||||
E53458DB11987396000CB77F /* GF256Poly.h */,
|
||||
3B248F7914EF3A660065F0DA /* GenericGF.cpp */,
|
||||
3B248F7A14EF3A660065F0DA /* GenericGF.h */,
|
||||
3B248F7B14EF3A660065F0DA /* GenericGFPoly.cpp */,
|
||||
3B248F7C14EF3A660065F0DA /* GenericGFPoly.h */,
|
||||
E53458DC11987396000CB77F /* ReedSolomonDecoder.cpp */,
|
||||
E53458DD11987396000CB77F /* ReedSolomonDecoder.h */,
|
||||
E53458DE11987396000CB77F /* ReedSolomonException.cpp */,
|
||||
|
@ -1051,8 +1099,6 @@
|
|||
E534595E11987396000CB77F /* IllegalArgumentException.h in Headers */,
|
||||
E534596211987396000CB77F /* PerspectiveTransform.h in Headers */,
|
||||
E534596311987396000CB77F /* Point.h in Headers */,
|
||||
E534596511987396000CB77F /* GF256.h in Headers */,
|
||||
E534596711987396000CB77F /* GF256Poly.h in Headers */,
|
||||
E534596911987396000CB77F /* ReedSolomonDecoder.h in Headers */,
|
||||
E534596B11987396000CB77F /* ReedSolomonException.h in Headers */,
|
||||
E534596D11987396000CB77F /* Str.h in Headers */,
|
||||
|
@ -1157,8 +1203,14 @@
|
|||
1D60412313E36C2D006F4B51 /* ISBNParsedResult.h in Headers */,
|
||||
3B27C5D9144735CE005157C4 /* FormatException.h in Headers */,
|
||||
3B27C5E2144735E6005157C4 /* CharacterSetECI.h in Headers */,
|
||||
3B27C5E4144735E6005157C4 /* ECI.h in Headers */,
|
||||
3B27C5E6144735E6005157C4 /* StringUtils.h in Headers */,
|
||||
3B248F7E14EF3A660065F0DA /* GenericGF.h in Headers */,
|
||||
3B248F8014EF3A660065F0DA /* GenericGFPoly.h in Headers */,
|
||||
3B248F8F14EF3A980065F0DA /* AztecDetectorResult.h in Headers */,
|
||||
3B248F9114EF3A980065F0DA /* AztecReader.h in Headers */,
|
||||
3B248F9314EF3A980065F0DA /* Decoder.h in Headers */,
|
||||
3B248F9514EF3A980065F0DA /* Detector.h in Headers */,
|
||||
3B248F9814EF3AF80065F0DA /* AztecReader.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1291,8 +1343,6 @@
|
|||
E534595B11987396000CB77F /* GridSampler.cpp in Sources */,
|
||||
E534595D11987396000CB77F /* IllegalArgumentException.cpp in Sources */,
|
||||
E534596111987396000CB77F /* PerspectiveTransform.cpp in Sources */,
|
||||
E534596411987396000CB77F /* GF256.cpp in Sources */,
|
||||
E534596611987396000CB77F /* GF256Poly.cpp in Sources */,
|
||||
E534596811987396000CB77F /* ReedSolomonDecoder.cpp in Sources */,
|
||||
E534596A11987396000CB77F /* ReedSolomonException.cpp in Sources */,
|
||||
E534596C11987396000CB77F /* Str.cpp in Sources */,
|
||||
|
@ -1397,11 +1447,17 @@
|
|||
1D60412413E36C2D006F4B51 /* ISBNParsedResult.m in Sources */,
|
||||
3B27C5D8144735CE005157C4 /* FormatException.cpp in Sources */,
|
||||
3B27C5E1144735E6005157C4 /* CharacterSetECI.cpp in Sources */,
|
||||
3B27C5E3144735E6005157C4 /* ECI.cpp in Sources */,
|
||||
3B27C5E5144735E6005157C4 /* StringUtils.cpp in Sources */,
|
||||
3B117EF1145B220A0035037B /* MonochromeRectangleDetector.cpp in Sources */,
|
||||
3B117EF2145B220A0035037B /* WhiteRectangleDetector.cpp in Sources */,
|
||||
3B117EF5145B221D0035037B /* NotFoundException.cpp in Sources */,
|
||||
3B248F7D14EF3A660065F0DA /* GenericGF.cpp in Sources */,
|
||||
3B248F7F14EF3A660065F0DA /* GenericGFPoly.cpp in Sources */,
|
||||
3B248F8E14EF3A980065F0DA /* AztecDetectorResult.cpp in Sources */,
|
||||
3B248F9014EF3A980065F0DA /* AztecReader.cpp in Sources */,
|
||||
3B248F9214EF3A980065F0DA /* Decoder.cpp in Sources */,
|
||||
3B248F9414EF3A980065F0DA /* Detector.cpp in Sources */,
|
||||
3B248F9914EF3AF80065F0DA /* AztecReader.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1426,9 +1482,9 @@
|
|||
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
|
||||
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
|
||||
);
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
INFOPLIST_FILE = "ZXingTests-Info.plist";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
|
@ -1453,8 +1509,8 @@
|
|||
"\"$(SDKROOT)/Developer/Library/Frameworks\"",
|
||||
"\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"",
|
||||
);
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
INFOPLIST_FILE = "ZXingTests-Info.plist";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
|
@ -1477,12 +1533,12 @@
|
|||
COPY_PHASE_STRIP = NO;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
EXPORTED_SYMBOLS_FILE = exportList;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = ZXingWidget_Prefix.pch;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
LD_GENERATE_MAP_FILE = YES;
|
||||
|
@ -1503,11 +1559,11 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = ZXingWidget_Prefix.pch;
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
HEADER_SEARCH_PATHS = ../../cpp/core/src;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
PRODUCT_NAME = ZXingWidget;
|
||||
|
@ -1523,9 +1579,9 @@
|
|||
armv6,
|
||||
armv7,
|
||||
);
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_VERSION = "";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
|
@ -1551,8 +1607,8 @@
|
|||
armv6,
|
||||
armv7,
|
||||
);
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
|
||||
GCC_VERSION = "";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
|
|
Loading…
Reference in a new issue