zxing_cpp_no_cmake 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.gitmodules +0 -0
- data/CHANGELOG.rdoc +6 -0
- data/Gemfile +3 -0
- data/Manifest.txt +375 -0
- data/README.rdoc +141 -0
- data/Rakefile +28 -0
- data/bin/zxd +87 -0
- data/bin/zxe +53 -0
- data/ext/zxing/extconf.rb +20 -0
- data/ext/zxing/zxing-cpp/.gitignore +2 -0
- data/ext/zxing/zxing-cpp/AUTHORS +115 -0
- data/ext/zxing/zxing-cpp/CMakeLists.txt +89 -0
- data/ext/zxing/zxing-cpp/COPYING +201 -0
- data/ext/zxing/zxing-cpp/NOTICE +65 -0
- data/ext/zxing/zxing-cpp/README.md +45 -0
- data/ext/zxing/zxing-cpp/build/CMakeCache.txt +382 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCCompiler.cmake +76 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeCXXCompiler.cmake +79 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_C.bin +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeDetermineCompilerABI_CXX.bin +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CMakeSystem.cmake +15 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/CMakeCCompilerId.c +665 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdC/a.out +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/CMakeCXXCompilerId.cpp +644 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/3.15.4/CompilerIdCXX/a.out +0 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake +16 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/CMakeOutput.log +447 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile.cmake +125 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/Makefile2 +177 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/TargetDirectories.txt +9 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/cmake.check_cache +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/CXX.includecache +1892 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/DependInfo.cmake +120 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/build.make +1584 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean.cmake +109 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/cmake_clean_target.cmake +3 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.internal +1465 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/depend.make +1465 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/flags.make +10 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/link.txt +2 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/libzxing.dir/progress.make +102 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/progress.marks +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/CXX.includecache +344 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/DependInfo.cmake +33 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/build.make +266 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/cmake_clean.cmake +21 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.internal +103 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/depend.make +103 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/flags.make +10 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/link.txt +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/testrunner.dir/progress.make +14 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/CXX.includecache +378 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/DependInfo.cmake +25 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/build.make +145 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/cmake_clean.cmake +13 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.internal +53 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/depend.make +53 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/flags.make +10 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/link.txt +1 -0
- data/ext/zxing/zxing-cpp/build/CMakeFiles/zxing.dir/progress.make +6 -0
- data/ext/zxing/zxing-cpp/build/Makefile +3706 -0
- data/ext/zxing/zxing-cpp/build/cmake_install.cmake +73 -0
- data/ext/zxing/zxing-cpp/build/libzxing.a +0 -0
- data/ext/zxing/zxing-cpp/build/testrunner +0 -0
- data/ext/zxing/zxing-cpp/build/zxing +0 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.cpp +113 -0
- data/ext/zxing/zxing-cpp/cli/src/ImageReaderSource.h +40 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.cpp +3174 -0
- data/ext/zxing/zxing-cpp/cli/src/jpgd.h +319 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.cpp +6261 -0
- data/ext/zxing/zxing-cpp/cli/src/lodepng.h +1695 -0
- data/ext/zxing/zxing-cpp/cli/src/main.cpp +297 -0
- data/ext/zxing/zxing-cpp/cmake/FindCPPUNIT.cmake +54 -0
- data/ext/zxing/zxing-cpp/cmake/FindIconv.cmake +57 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/.gitignore +6 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.cc +405 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigInteger.hh +215 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.cc +70 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerAlgorithms.hh +25 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerLibrary.hh +8 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.cc +50 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigIntegerUtils.hh +72 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.cc +697 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsigned.hh +418 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.cc +125 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/BigUnsignedInABase.hh +122 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/ChangeLog +146 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/Makefile +73 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/NumberlikeArray.hh +177 -0
- data/ext/zxing/zxing-cpp/core/src/bigint/README +71 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/iconv.h +14 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/stdint.h +247 -0
- data/ext/zxing/zxing-cpp/core/src/win32/zxing/win_iconv.c +2035 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.cpp +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BarcodeFormat.h +60 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.cpp +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Binarizer.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.cpp +70 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/BinaryBitmap.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ChecksumException.h +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.cpp +142 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/DecodeHints.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.cpp +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Exception.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/FormatException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/IllegalStateException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/InvertedLuminanceSource.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.cpp +86 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/LuminanceSource.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.cpp +124 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/MultiFormatReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/NotFoundException.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Reader.h +40 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ReaderException.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/Result.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultIO.cpp +34 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.cpp +108 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPoint.h +55 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.cpp +26 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ResultPointCallback.h +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/ZXing.h +133 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecDetectorResult.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.cpp +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/AztecReader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.cpp +489 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/decoder/Decoder.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.cpp +548 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/aztec/detector/Detector.h +92 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Array.h +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.cpp +155 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArray.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitArrayIO.cpp +31 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.cpp +143 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitMatrix.h +91 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.cpp +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/BitSource.h +74 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.cpp +105 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/CharacterSetECI.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Counted.h +140 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DecoderResult.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.cpp +39 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/DetectorResult.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.cpp +212 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GlobalHistogramBinarizer.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.cpp +80 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleLuminanceSource.h +53 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.cpp +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GreyscaleRotatedLuminanceSource.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.cpp +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/GridSampler.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.cpp +226 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/HybridBinarizer.h +67 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.cpp +27 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/IllegalArgumentException.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/PerspectiveTransform.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Point.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.cpp +61 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/Str.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.cpp +198 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/StringUtils.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/JavaMath.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MathUtils.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.cpp +175 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/MonochromeRectangleDetector.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.cpp +330 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/detector/WhiteRectangleDetector.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.cpp +150 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGF.h +73 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.cpp +218 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/GenericGFPoly.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.cpp +174 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonDecoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/common/reedsolomon/ReedSolomonException.h +33 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.cpp +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/DataMatrixReader.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.cpp +199 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/Version.h +87 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.cpp +361 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/BitMatrixParser.h +59 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.cpp +113 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DataBlock.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.cpp +415 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/DecodedBitStreamParser.h +104 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.cpp +93 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/decoder/Decoder.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.cpp +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/CornerPoint.h +43 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.cpp +447 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/Detector.h +94 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.cpp +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/datamatrix/detector/DetectorException.h +23 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.cpp +75 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/ByQuadrantReader.h +42 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.cpp +137 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/GenericMultipleBarcodeReader.h +51 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.cpp +29 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/MultipleBarcodeReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/QRCodeMultiReader.h +36 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiDetector.h +37 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +236 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.cpp +340 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/CodaBarReader.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.cpp +497 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code128Reader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.cpp +329 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code39Reader.h +63 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.cpp +303 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/Code93Reader.h +58 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.cpp +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN13Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/EAN8Reader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.cpp +337 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/ITFReader.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.cpp +96 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatOneDReader.h +38 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.cpp +110 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/MultiFormatUPCEANReader.h +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.cpp +228 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDReader.h +81 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.cpp +28 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/OneDResultPoint.h +35 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.cpp +70 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCAReader.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.cpp +309 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEANReader.h +88 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.cpp +146 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/oned/UPCEReader.h +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.cpp +170 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/PDF417Reader.h +49 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.cpp +997 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/BitMatrixParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.cpp +563 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/DecodedBitStreamParser.h +84 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/Decoder.h +62 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.cpp +214 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ErrorCorrection.h +71 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.cpp +120 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusGF.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp +284 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/decoder/ec/ModulusPoly.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.cpp +665 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/Detector.h +106 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.cpp +715 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/pdf417/detector/LinesSampler.h +122 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.cpp +65 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/ErrorCorrectionLevel.h +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.cpp +117 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/FormatInformation.h +54 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/QRCodeReader.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.cpp +560 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/Version.h +85 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.cpp +183 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/BitMatrixParser.h +56 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.cpp +118 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataBlock.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.cpp +159 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DataMask.h +50 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.cpp +428 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/DecodedBitStreamParser.h +72 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.cpp +107 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Decoder.h +46 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.cpp +90 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/decoder/Mode.h +57 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPattern.h +45 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.cpp +208 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/AlignmentPatternFinder.h +68 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.cpp +315 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/Detector.h +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPattern.h +48 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.cpp +559 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternFinder.h +76 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.cpp +41 -0
- data/ext/zxing/zxing-cpp/core/src/zxing/qrcode/detector/FinderPatternInfo.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/TestRunner.cpp +30 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.cpp +216 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitArrayTest.h +61 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.cpp +106 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitMatrixTest.h +55 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.cpp +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/BitSourceTest.h +42 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.cpp +58 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/CountedTest.h +46 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.cpp +69 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/PerspectiveTransformTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.cpp +129 -0
- data/ext/zxing/zxing-cpp/core/tests/src/common/reedsolomon/ReedSolomonTest.h +62 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.cpp +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/ErrorCorrectionLevelTest.h +45 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/FormatInformationTest.h +47 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.cpp +88 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/VersionTest.h +49 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.cpp +132 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/DataMaskTest.h +91 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.cpp +52 -0
- data/ext/zxing/zxing-cpp/core/tests/src/qrcode/decoder/ModeTest.h +47 -0
- data/ext/zxing/zxing.cc +224 -0
- data/lib/zxing.rb +50 -0
- data/lib/zxing/.gitignore +2 -0
- data/lib/zxing/aztec.rb +5 -0
- data/lib/zxing/aztec/aztec_reader.rb +14 -0
- data/lib/zxing/bad_image_exception.rb +4 -0
- data/lib/zxing/binarizer.rb +8 -0
- data/lib/zxing/binary_bitmap.rb +15 -0
- data/lib/zxing/checksum_exception.rb +4 -0
- data/lib/zxing/common.rb +7 -0
- data/lib/zxing/common/bit_matrix.rb +9 -0
- data/lib/zxing/common/hybrid_binarizer.rb +17 -0
- data/lib/zxing/common/illegal_argument_exception.rb +4 -0
- data/lib/zxing/datamatrix.rb +5 -0
- data/lib/zxing/datamatrix/data_matrix_reader.rb +14 -0
- data/lib/zxing/decodable.rb +11 -0
- data/lib/zxing/exception.rb +4 -0
- data/lib/zxing/ffi.rb +20 -0
- data/lib/zxing/ffi/aztec.rb +6 -0
- data/lib/zxing/ffi/aztec/aztec_reader.rb +9 -0
- data/lib/zxing/ffi/binarizer.rb +25 -0
- data/lib/zxing/ffi/binary_bitmap.rb +15 -0
- data/lib/zxing/ffi/common.rb +8 -0
- data/lib/zxing/ffi/common/bit_matrix.rb +12 -0
- data/lib/zxing/ffi/common/greyscale_luminance_source.rb +30 -0
- data/lib/zxing/ffi/common/hybrid_binarizer.rb +10 -0
- data/lib/zxing/ffi/datamatrix.rb +6 -0
- data/lib/zxing/ffi/datamatrix/data_matrix_reader.rb +9 -0
- data/lib/zxing/ffi/library.rb +102 -0
- data/lib/zxing/ffi/luminance_source.rb +18 -0
- data/lib/zxing/ffi/multi_format_reader.rb +9 -0
- data/lib/zxing/ffi/oned.rb +6 -0
- data/lib/zxing/ffi/oned/code_39_reader.rb +10 -0
- data/lib/zxing/ffi/qrcode.rb +8 -0
- data/lib/zxing/ffi/qrcode/decoder.rb +10 -0
- data/lib/zxing/ffi/qrcode/detector.rb +10 -0
- data/lib/zxing/ffi/reader.rb +58 -0
- data/lib/zxing/ffi/result.rb +23 -0
- data/lib/zxing/format_exception.rb +4 -0
- data/lib/zxing/illegal_argument_exception.rb +4 -0
- data/lib/zxing/image.rb +15 -0
- data/lib/zxing/luminance_source.rb +18 -0
- data/lib/zxing/multi_format_reader.rb +11 -0
- data/lib/zxing/not_found_exception.rb +4 -0
- data/lib/zxing/oned.rb +5 -0
- data/lib/zxing/oned/code_39_reader.rb +15 -0
- data/lib/zxing/qrcode.rb +8 -0
- data/lib/zxing/qrcode/decoder.rb +14 -0
- data/lib/zxing/qrcode/detector.rb +14 -0
- data/lib/zxing/qrcode/encoder.rb +8 -0
- data/lib/zxing/qrcode/encoder/byte_matrix.rb +18 -0
- data/lib/zxing/qrcode/encoder/encoder.rb +9 -0
- data/lib/zxing/qrcode/encoder/qrcode.rb +18 -0
- data/lib/zxing/reader.rb +8 -0
- data/lib/zxing/reader_exception.rb +4 -0
- data/lib/zxing/reed_solomon_exception.rb +2 -0
- data/lib/zxing/result.rb +18 -0
- data/lib/zxing/rmagick.rb +5 -0
- data/lib/zxing/rmagick/image.rb +109 -0
- data/lib/zxing/version.rb +33 -0
- data/zxing_cpp.gemspec +36 -0
- metadata +515 -0
@@ -0,0 +1,59 @@
|
|
1
|
+
#ifndef __BIT_MATRIX_PARSER_DM_H__
|
2
|
+
#define __BIT_MATRIX_PARSER_DM_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* BitMatrixParser.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Created by Luiz Silva on 09/02/2010.
|
9
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
10
|
+
*
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
* you may not use this file except in compliance with the License.
|
13
|
+
* You may obtain a copy of the License at
|
14
|
+
*
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
* See the License for the specific language governing permissions and
|
21
|
+
* limitations under the License.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <zxing/ReaderException.h>
|
25
|
+
#include <zxing/common/BitMatrix.h>
|
26
|
+
#include <zxing/common/Counted.h>
|
27
|
+
#include <zxing/common/Array.h>
|
28
|
+
#include <zxing/datamatrix/Version.h>
|
29
|
+
|
30
|
+
namespace zxing {
|
31
|
+
namespace datamatrix {
|
32
|
+
|
33
|
+
class BitMatrixParser : public Counted {
|
34
|
+
private:
|
35
|
+
Ref<BitMatrix> bitMatrix_;
|
36
|
+
Ref<Version> parsedVersion_;
|
37
|
+
Ref<BitMatrix> readBitMatrix_;
|
38
|
+
|
39
|
+
int copyBit(size_t x, size_t y, int versionBits);
|
40
|
+
|
41
|
+
public:
|
42
|
+
BitMatrixParser(Ref<BitMatrix> bitMatrix);
|
43
|
+
Ref<Version> readVersion(Ref<BitMatrix> bitMatrix);
|
44
|
+
ArrayRef<char> readCodewords();
|
45
|
+
bool readModule(int row, int column, int numRows, int numColumns);
|
46
|
+
|
47
|
+
private:
|
48
|
+
int readUtah(int row, int column, int numRows, int numColumns);
|
49
|
+
int readCorner1(int numRows, int numColumns);
|
50
|
+
int readCorner2(int numRows, int numColumns);
|
51
|
+
int readCorner3(int numRows, int numColumns);
|
52
|
+
int readCorner4(int numRows, int numColumns);
|
53
|
+
Ref<BitMatrix> extractDataRegion(Ref<BitMatrix> bitMatrix);
|
54
|
+
};
|
55
|
+
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
#endif // __BIT_MATRIX_PARSER_DM_H__
|
@@ -0,0 +1,113 @@
|
|
1
|
+
/*
|
2
|
+
* DataBlock.cpp
|
3
|
+
* zxing
|
4
|
+
*
|
5
|
+
* Created by Luiz Silva on 09/02/2010.
|
6
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
7
|
+
*
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include <zxing/datamatrix/decoder/DataBlock.h>
|
22
|
+
#include <zxing/common/IllegalArgumentException.h>
|
23
|
+
|
24
|
+
namespace zxing {
|
25
|
+
namespace datamatrix {
|
26
|
+
|
27
|
+
using namespace std;
|
28
|
+
|
29
|
+
DataBlock::DataBlock(int numDataCodewords, ArrayRef<char> codewords) :
|
30
|
+
numDataCodewords_(numDataCodewords), codewords_(codewords) {
|
31
|
+
}
|
32
|
+
|
33
|
+
int DataBlock::getNumDataCodewords() {
|
34
|
+
return numDataCodewords_;
|
35
|
+
}
|
36
|
+
|
37
|
+
ArrayRef<char> DataBlock::getCodewords() {
|
38
|
+
return codewords_;
|
39
|
+
}
|
40
|
+
|
41
|
+
std::vector<Ref<DataBlock> > DataBlock::getDataBlocks(ArrayRef<char> rawCodewords, Version *version) {
|
42
|
+
// Figure out the number and size of data blocks used by this version and
|
43
|
+
// error correction level
|
44
|
+
ECBlocks* ecBlocks = version->getECBlocks();
|
45
|
+
|
46
|
+
// First count the total number of data blocks
|
47
|
+
int totalBlocks = 0;
|
48
|
+
vector<ECB*> ecBlockArray = ecBlocks->getECBlocks();
|
49
|
+
for (size_t i = 0; i < ecBlockArray.size(); i++) {
|
50
|
+
totalBlocks += ecBlockArray[i]->getCount();
|
51
|
+
}
|
52
|
+
|
53
|
+
// Now establish DataBlocks of the appropriate size and number of data codewords
|
54
|
+
std::vector<Ref<DataBlock> > result(totalBlocks);
|
55
|
+
int numResultBlocks = 0;
|
56
|
+
for (size_t j = 0; j < ecBlockArray.size(); j++) {
|
57
|
+
ECB *ecBlock = ecBlockArray[j];
|
58
|
+
for (int i = 0; i < ecBlock->getCount(); i++) {
|
59
|
+
int numDataCodewords = ecBlock->getDataCodewords();
|
60
|
+
int numBlockCodewords = ecBlocks->getECCodewords() + numDataCodewords;
|
61
|
+
ArrayRef<char> buffer(numBlockCodewords);
|
62
|
+
Ref<DataBlock> blockRef(new DataBlock(numDataCodewords, buffer));
|
63
|
+
result[numResultBlocks++] = blockRef;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
// All blocks have the same amount of data, except that the last n
|
68
|
+
// (where n may be 0) have 1 more byte. Figure out where these start.
|
69
|
+
int shorterBlocksTotalCodewords = result[0]->codewords_->size();
|
70
|
+
int longerBlocksStartAt = result.size() - 1;
|
71
|
+
while (longerBlocksStartAt >= 0) {
|
72
|
+
int numCodewords = result[longerBlocksStartAt]->codewords_->size();
|
73
|
+
if (numCodewords == shorterBlocksTotalCodewords) {
|
74
|
+
break;
|
75
|
+
}
|
76
|
+
if (numCodewords != shorterBlocksTotalCodewords + 1) {
|
77
|
+
throw IllegalArgumentException("Data block sizes differ by more than 1");
|
78
|
+
}
|
79
|
+
longerBlocksStartAt--;
|
80
|
+
}
|
81
|
+
longerBlocksStartAt++;
|
82
|
+
|
83
|
+
int shorterBlocksNumDataCodewords = shorterBlocksTotalCodewords - ecBlocks->getECCodewords();
|
84
|
+
// The last elements of result may be 1 element longer;
|
85
|
+
// first fill out as many elements as all of them have
|
86
|
+
int rawCodewordsOffset = 0;
|
87
|
+
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
|
88
|
+
for (int j = 0; j < numResultBlocks; j++) {
|
89
|
+
result[j]->codewords_[i] = rawCodewords[rawCodewordsOffset++];
|
90
|
+
}
|
91
|
+
}
|
92
|
+
// Fill out the last data block in the longer ones
|
93
|
+
for (int j = longerBlocksStartAt; j < numResultBlocks; j++) {
|
94
|
+
result[j]->codewords_[shorterBlocksNumDataCodewords] = rawCodewords[rawCodewordsOffset++];
|
95
|
+
}
|
96
|
+
// Now add in error correction blocks
|
97
|
+
int max = result[0]->codewords_->size();
|
98
|
+
for (int i = shorterBlocksNumDataCodewords; i < max; i++) {
|
99
|
+
for (int j = 0; j < numResultBlocks; j++) {
|
100
|
+
int iOffset = j < longerBlocksStartAt ? i : i + 1;
|
101
|
+
result[j]->codewords_[iOffset] = rawCodewords[rawCodewordsOffset++];
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
if (rawCodewordsOffset != rawCodewords->size()) {
|
106
|
+
throw IllegalArgumentException("rawCodewordsOffset != rawCodewords.length");
|
107
|
+
}
|
108
|
+
|
109
|
+
return result;
|
110
|
+
}
|
111
|
+
|
112
|
+
}
|
113
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#ifndef __DATA_BLOCK_DM_H__
|
2
|
+
#define __DATA_BLOCK_DM_H__
|
3
|
+
|
4
|
+
/*
|
5
|
+
* DataBlock.h
|
6
|
+
* zxing
|
7
|
+
*
|
8
|
+
* Created by Luiz Silva on 09/02/2010.
|
9
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
10
|
+
*
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
12
|
+
* you may not use this file except in compliance with the License.
|
13
|
+
* You may obtain a copy of the License at
|
14
|
+
*
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
16
|
+
*
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
20
|
+
* See the License for the specific language governing permissions and
|
21
|
+
* limitations under the License.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#include <vector>
|
25
|
+
#include <zxing/common/Counted.h>
|
26
|
+
#include <zxing/common/Array.h>
|
27
|
+
#include <zxing/datamatrix/Version.h>
|
28
|
+
|
29
|
+
namespace zxing {
|
30
|
+
namespace datamatrix {
|
31
|
+
|
32
|
+
class DataBlock : public Counted {
|
33
|
+
private:
|
34
|
+
int numDataCodewords_;
|
35
|
+
ArrayRef<char> codewords_;
|
36
|
+
|
37
|
+
DataBlock(int numDataCodewords, ArrayRef<char> codewords);
|
38
|
+
|
39
|
+
public:
|
40
|
+
static std::vector<Ref<DataBlock> > getDataBlocks(ArrayRef<char> rawCodewords, Version *version);
|
41
|
+
|
42
|
+
int getNumDataCodewords();
|
43
|
+
ArrayRef<char> getCodewords();
|
44
|
+
};
|
45
|
+
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
#endif // __DATA_BLOCK_DM_H__
|
@@ -0,0 +1,415 @@
|
|
1
|
+
// -*- mode:c++; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
2
|
+
/*
|
3
|
+
* DecodedBitStreamParser.cpp
|
4
|
+
* zxing
|
5
|
+
*
|
6
|
+
* Created by Luiz Silva on 09/02/2010.
|
7
|
+
* Copyright 2010 ZXing authors All rights reserved.
|
8
|
+
*
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
+
* you may not use this file except in compliance with the License.
|
11
|
+
* You may obtain a copy of the License at
|
12
|
+
*
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
14
|
+
*
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
+
* See the License for the specific language governing permissions and
|
19
|
+
* limitations under the License.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <zxing/FormatException.h>
|
23
|
+
#include <zxing/datamatrix/decoder/DecodedBitStreamParser.h>
|
24
|
+
#include <iostream>
|
25
|
+
#include <zxing/common/DecoderResult.h>
|
26
|
+
|
27
|
+
namespace zxing {
|
28
|
+
namespace datamatrix {
|
29
|
+
|
30
|
+
using namespace std;
|
31
|
+
|
32
|
+
const char DecodedBitStreamParser::C40_BASIC_SET_CHARS[] = {
|
33
|
+
'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
34
|
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
35
|
+
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
|
36
|
+
};
|
37
|
+
|
38
|
+
const char DecodedBitStreamParser::C40_SHIFT2_SET_CHARS[] = {
|
39
|
+
'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.',
|
40
|
+
'/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_'
|
41
|
+
};
|
42
|
+
|
43
|
+
const char DecodedBitStreamParser::TEXT_BASIC_SET_CHARS[] = {
|
44
|
+
'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
45
|
+
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
46
|
+
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
|
47
|
+
};
|
48
|
+
|
49
|
+
const char DecodedBitStreamParser::TEXT_SHIFT3_SET_CHARS[] = {
|
50
|
+
'\'', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
|
51
|
+
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', (char) 127
|
52
|
+
};
|
53
|
+
|
54
|
+
Ref<DecoderResult> DecodedBitStreamParser::decode(ArrayRef<char> bytes) {
|
55
|
+
Ref<BitSource> bits(new BitSource(bytes));
|
56
|
+
ostringstream result;
|
57
|
+
ostringstream resultTrailer;
|
58
|
+
vector<char> byteSegments;
|
59
|
+
int mode = ASCII_ENCODE;
|
60
|
+
do {
|
61
|
+
if (mode == ASCII_ENCODE) {
|
62
|
+
mode = decodeAsciiSegment(bits, result, resultTrailer);
|
63
|
+
} else {
|
64
|
+
switch (mode) {
|
65
|
+
case C40_ENCODE:
|
66
|
+
decodeC40Segment(bits, result);
|
67
|
+
break;
|
68
|
+
case TEXT_ENCODE:
|
69
|
+
decodeTextSegment(bits, result);
|
70
|
+
break;
|
71
|
+
case ANSIX12_ENCODE:
|
72
|
+
decodeAnsiX12Segment(bits, result);
|
73
|
+
break;
|
74
|
+
case EDIFACT_ENCODE:
|
75
|
+
decodeEdifactSegment(bits, result);
|
76
|
+
break;
|
77
|
+
case BASE256_ENCODE:
|
78
|
+
decodeBase256Segment(bits, result, byteSegments);
|
79
|
+
break;
|
80
|
+
default:
|
81
|
+
throw FormatException("Unsupported mode indicator");
|
82
|
+
}
|
83
|
+
mode = ASCII_ENCODE;
|
84
|
+
}
|
85
|
+
} while (mode != PAD_ENCODE && bits->available() > 0);
|
86
|
+
|
87
|
+
if (resultTrailer.str().size() > 0) {
|
88
|
+
result << resultTrailer.str();
|
89
|
+
}
|
90
|
+
ArrayRef<char> rawBytes(bytes);
|
91
|
+
Ref<String> text(new String(result.str()));
|
92
|
+
return Ref<DecoderResult>(new DecoderResult(rawBytes, text));
|
93
|
+
}
|
94
|
+
|
95
|
+
int DecodedBitStreamParser::decodeAsciiSegment(Ref<BitSource> bits, ostringstream & result,
|
96
|
+
ostringstream & resultTrailer) {
|
97
|
+
bool upperShift = false;
|
98
|
+
do {
|
99
|
+
int oneByte = bits->readBits(8);
|
100
|
+
if (oneByte == 0) {
|
101
|
+
throw FormatException("Not enough bits to decode");
|
102
|
+
} else if (oneByte <= 128) { // ASCII data (ASCII value + 1)
|
103
|
+
oneByte = upperShift ? (oneByte + 128) : oneByte;
|
104
|
+
// upperShift = false;
|
105
|
+
result << (char) (oneByte - 1);
|
106
|
+
return ASCII_ENCODE;
|
107
|
+
} else if (oneByte == 129) { // Pad
|
108
|
+
return PAD_ENCODE;
|
109
|
+
} else if (oneByte <= 229) { // 2-digit data 00-99 (Numeric Value + 130)
|
110
|
+
int value = oneByte - 130;
|
111
|
+
if (value < 10) { // padd with '0' for single digit values
|
112
|
+
result << '0';
|
113
|
+
}
|
114
|
+
result << value;
|
115
|
+
} else if (oneByte == 230) { // Latch to C40 encodation
|
116
|
+
return C40_ENCODE;
|
117
|
+
} else if (oneByte == 231) { // Latch to Base 256 encodation
|
118
|
+
return BASE256_ENCODE;
|
119
|
+
} else if (oneByte == 232) { // FNC1
|
120
|
+
result << ((char) 29); // translate as ASCII 29
|
121
|
+
} else if (oneByte == 233 || oneByte == 234) {
|
122
|
+
// Structured Append, Reader Programming
|
123
|
+
// Ignore these symbols for now
|
124
|
+
// throw FormatException.getInstance();
|
125
|
+
} else if (oneByte == 235) { // Upper Shift (shift to Extended ASCII)
|
126
|
+
upperShift = true;
|
127
|
+
} else if (oneByte == 236) { // 05 Macro
|
128
|
+
result << ("[)>RS05GS");
|
129
|
+
resultTrailer << ("RSEOT");
|
130
|
+
} else if (oneByte == 237) { // 06 Macro
|
131
|
+
result << ("[)>RS06GS");
|
132
|
+
resultTrailer << ("RSEOT");
|
133
|
+
} else if (oneByte == 238) { // Latch to ANSI X12 encodation
|
134
|
+
return ANSIX12_ENCODE;
|
135
|
+
} else if (oneByte == 239) { // Latch to Text encodation
|
136
|
+
return TEXT_ENCODE;
|
137
|
+
} else if (oneByte == 240) { // Latch to EDIFACT encodation
|
138
|
+
return EDIFACT_ENCODE;
|
139
|
+
} else if (oneByte == 241) { // ECI Character
|
140
|
+
// TODO(bbrown): I think we need to support ECI
|
141
|
+
// throw FormatException.getInstance();
|
142
|
+
// Ignore this symbol for now
|
143
|
+
} else if (oneByte >= 242) { // Not to be used in ASCII encodation
|
144
|
+
// ... but work around encoders that end with 254, latch back to ASCII
|
145
|
+
if (oneByte != 254 || bits->available() != 0) {
|
146
|
+
throw FormatException("Not to be used in ASCII encodation");
|
147
|
+
}
|
148
|
+
}
|
149
|
+
} while (bits->available() > 0);
|
150
|
+
return ASCII_ENCODE;
|
151
|
+
}
|
152
|
+
|
153
|
+
void DecodedBitStreamParser::decodeC40Segment(Ref<BitSource> bits, ostringstream & result) {
|
154
|
+
// Three C40 values are encoded in a 16-bit value as
|
155
|
+
// (1600 * C1) + (40 * C2) + C3 + 1
|
156
|
+
// TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time
|
157
|
+
bool upperShift = false;
|
158
|
+
|
159
|
+
int cValues[3];
|
160
|
+
int shift = 0;
|
161
|
+
do {
|
162
|
+
// If there is only one byte left then it will be encoded as ASCII
|
163
|
+
if (bits->available() == 8) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
int firstByte = bits->readBits(8);
|
167
|
+
if (firstByte == 254) { // Unlatch codeword
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
|
171
|
+
parseTwoBytes(firstByte, bits->readBits(8), cValues);
|
172
|
+
|
173
|
+
for (int i = 0; i < 3; i++) {
|
174
|
+
int cValue = cValues[i];
|
175
|
+
switch (shift) {
|
176
|
+
case 0:
|
177
|
+
if (cValue < 3) {
|
178
|
+
shift = cValue + 1;
|
179
|
+
} else {
|
180
|
+
if (upperShift) {
|
181
|
+
result << (char) (C40_BASIC_SET_CHARS[cValue] + 128);
|
182
|
+
upperShift = false;
|
183
|
+
} else {
|
184
|
+
result << C40_BASIC_SET_CHARS[cValue];
|
185
|
+
}
|
186
|
+
}
|
187
|
+
break;
|
188
|
+
case 1:
|
189
|
+
if (upperShift) {
|
190
|
+
result << (char) (cValue + 128);
|
191
|
+
upperShift = false;
|
192
|
+
} else {
|
193
|
+
result << (char) cValue;
|
194
|
+
}
|
195
|
+
shift = 0;
|
196
|
+
break;
|
197
|
+
case 2:
|
198
|
+
if (cValue < 27) {
|
199
|
+
if (upperShift) {
|
200
|
+
result << (char) (C40_SHIFT2_SET_CHARS[cValue] + 128);
|
201
|
+
upperShift = false;
|
202
|
+
} else {
|
203
|
+
result << C40_SHIFT2_SET_CHARS[cValue];
|
204
|
+
}
|
205
|
+
} else if (cValue == 27) { // FNC1
|
206
|
+
result << ((char) 29); // translate as ASCII 29
|
207
|
+
} else if (cValue == 30) { // Upper Shift
|
208
|
+
upperShift = true;
|
209
|
+
} else {
|
210
|
+
throw FormatException("decodeC40Segment: Upper Shift");
|
211
|
+
}
|
212
|
+
shift = 0;
|
213
|
+
break;
|
214
|
+
case 3:
|
215
|
+
if (upperShift) {
|
216
|
+
result << (char) (cValue + 224);
|
217
|
+
upperShift = false;
|
218
|
+
} else {
|
219
|
+
result << (char) (cValue + 96);
|
220
|
+
}
|
221
|
+
shift = 0;
|
222
|
+
break;
|
223
|
+
default:
|
224
|
+
throw FormatException("decodeC40Segment: no case");
|
225
|
+
}
|
226
|
+
}
|
227
|
+
} while (bits->available() > 0);
|
228
|
+
}
|
229
|
+
|
230
|
+
void DecodedBitStreamParser::decodeTextSegment(Ref<BitSource> bits, ostringstream & result) {
|
231
|
+
// Three Text values are encoded in a 16-bit value as
|
232
|
+
// (1600 * C1) + (40 * C2) + C3 + 1
|
233
|
+
// TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time
|
234
|
+
bool upperShift = false;
|
235
|
+
|
236
|
+
int cValues[3];
|
237
|
+
int shift = 0;
|
238
|
+
do {
|
239
|
+
// If there is only one byte left then it will be encoded as ASCII
|
240
|
+
if (bits->available() == 8) {
|
241
|
+
return;
|
242
|
+
}
|
243
|
+
int firstByte = bits->readBits(8);
|
244
|
+
if (firstByte == 254) { // Unlatch codeword
|
245
|
+
return;
|
246
|
+
}
|
247
|
+
|
248
|
+
parseTwoBytes(firstByte, bits->readBits(8), cValues);
|
249
|
+
|
250
|
+
for (int i = 0; i < 3; i++) {
|
251
|
+
int cValue = cValues[i];
|
252
|
+
switch (shift) {
|
253
|
+
case 0:
|
254
|
+
if (cValue < 3) {
|
255
|
+
shift = cValue + 1;
|
256
|
+
} else {
|
257
|
+
if (upperShift) {
|
258
|
+
result << (char) (TEXT_BASIC_SET_CHARS[cValue] + 128);
|
259
|
+
upperShift = false;
|
260
|
+
} else {
|
261
|
+
result << (TEXT_BASIC_SET_CHARS[cValue]);
|
262
|
+
}
|
263
|
+
}
|
264
|
+
break;
|
265
|
+
case 1:
|
266
|
+
if (upperShift) {
|
267
|
+
result << (char) (cValue + 128);
|
268
|
+
upperShift = false;
|
269
|
+
} else {
|
270
|
+
result << (char) (cValue);
|
271
|
+
}
|
272
|
+
shift = 0;
|
273
|
+
break;
|
274
|
+
case 2:
|
275
|
+
// Shift 2 for Text is the same encoding as C40
|
276
|
+
if (cValue < 27) {
|
277
|
+
if (upperShift) {
|
278
|
+
result << (char) (C40_SHIFT2_SET_CHARS[cValue] + 128);
|
279
|
+
upperShift = false;
|
280
|
+
} else {
|
281
|
+
result << (C40_SHIFT2_SET_CHARS[cValue]);
|
282
|
+
}
|
283
|
+
} else if (cValue == 27) { // FNC1
|
284
|
+
result << ((char) 29); // translate as ASCII 29
|
285
|
+
} else if (cValue == 30) { // Upper Shift
|
286
|
+
upperShift = true;
|
287
|
+
} else {
|
288
|
+
throw FormatException("decodeTextSegment: Upper Shift");
|
289
|
+
}
|
290
|
+
shift = 0;
|
291
|
+
break;
|
292
|
+
case 3:
|
293
|
+
if (upperShift) {
|
294
|
+
result << (char) (TEXT_SHIFT3_SET_CHARS[cValue] + 128);
|
295
|
+
upperShift = false;
|
296
|
+
} else {
|
297
|
+
result << (TEXT_SHIFT3_SET_CHARS[cValue]);
|
298
|
+
}
|
299
|
+
shift = 0;
|
300
|
+
break;
|
301
|
+
default:
|
302
|
+
throw FormatException("decodeTextSegment: no case");
|
303
|
+
}
|
304
|
+
}
|
305
|
+
} while (bits->available() > 0);
|
306
|
+
}
|
307
|
+
|
308
|
+
void DecodedBitStreamParser::decodeAnsiX12Segment(Ref<BitSource> bits, ostringstream & result) {
|
309
|
+
// Three ANSI X12 values are encoded in a 16-bit value as
|
310
|
+
// (1600 * C1) + (40 * C2) + C3 + 1
|
311
|
+
|
312
|
+
int cValues[3];
|
313
|
+
do {
|
314
|
+
// If there is only one byte left then it will be encoded as ASCII
|
315
|
+
if (bits->available() == 8) {
|
316
|
+
return;
|
317
|
+
}
|
318
|
+
int firstByte = bits->readBits(8);
|
319
|
+
if (firstByte == 254) { // Unlatch codeword
|
320
|
+
return;
|
321
|
+
}
|
322
|
+
|
323
|
+
parseTwoBytes(firstByte, bits->readBits(8), cValues);
|
324
|
+
|
325
|
+
for (int i = 0; i < 3; i++) {
|
326
|
+
int cValue = cValues[i];
|
327
|
+
if (cValue == 0) { // X12 segment terminator <CR>
|
328
|
+
result << '\r';
|
329
|
+
} else if (cValue == 1) { // X12 segment separator *
|
330
|
+
result << '*';
|
331
|
+
} else if (cValue == 2) { // X12 sub-element separator >
|
332
|
+
result << '>';
|
333
|
+
} else if (cValue == 3) { // space
|
334
|
+
result << ' ';
|
335
|
+
} else if (cValue < 14) { // 0 - 9
|
336
|
+
result << (char) (cValue + 44);
|
337
|
+
} else if (cValue < 40) { // A - Z
|
338
|
+
result << (char) (cValue + 51);
|
339
|
+
} else {
|
340
|
+
throw FormatException("decodeAnsiX12Segment: no case");
|
341
|
+
}
|
342
|
+
}
|
343
|
+
} while (bits->available() > 0);
|
344
|
+
}
|
345
|
+
|
346
|
+
void DecodedBitStreamParser::parseTwoBytes(int firstByte, int secondByte, int* result) {
|
347
|
+
int fullBitValue = (firstByte << 8) + secondByte - 1;
|
348
|
+
int temp = fullBitValue / 1600;
|
349
|
+
result[0] = temp;
|
350
|
+
fullBitValue -= temp * 1600;
|
351
|
+
temp = fullBitValue / 40;
|
352
|
+
result[1] = temp;
|
353
|
+
result[2] = fullBitValue - temp * 40;
|
354
|
+
}
|
355
|
+
|
356
|
+
void DecodedBitStreamParser::decodeEdifactSegment(Ref<BitSource> bits, ostringstream & result) {
|
357
|
+
do {
|
358
|
+
// If there is only two or less bytes left then it will be encoded as ASCII
|
359
|
+
if (bits->available() <= 16) {
|
360
|
+
return;
|
361
|
+
}
|
362
|
+
|
363
|
+
for (int i = 0; i < 4; i++) {
|
364
|
+
int edifactValue = bits->readBits(6);
|
365
|
+
|
366
|
+
// Check for the unlatch character
|
367
|
+
if (edifactValue == 0x1f) { // 011111
|
368
|
+
// Read rest of byte, which should be 0, and stop
|
369
|
+
int bitsLeft = 8 - bits->getBitOffset();
|
370
|
+
if (bitsLeft != 8) {
|
371
|
+
bits->readBits(bitsLeft);
|
372
|
+
}
|
373
|
+
return;
|
374
|
+
}
|
375
|
+
|
376
|
+
if ((edifactValue & 0x20) == 0) { // no 1 in the leading (6th) bit
|
377
|
+
edifactValue |= 0x40; // Add a leading 01 to the 6 bit binary value
|
378
|
+
}
|
379
|
+
result << (char)(edifactValue);
|
380
|
+
}
|
381
|
+
} while (bits->available() > 0);
|
382
|
+
}
|
383
|
+
|
384
|
+
void DecodedBitStreamParser::decodeBase256Segment(Ref<BitSource> bits, ostringstream& result, vector<char> byteSegments) {
|
385
|
+
// Figure out how long the Base 256 Segment is.
|
386
|
+
int codewordPosition = 1 + bits->getByteOffset(); // position is 1-indexed
|
387
|
+
int d1 = unrandomize255State(bits->readBits(8), codewordPosition++);
|
388
|
+
int count;
|
389
|
+
if (d1 == 0) { // Read the remainder of the symbol
|
390
|
+
count = bits->available() / 8;
|
391
|
+
} else if (d1 < 250) {
|
392
|
+
count = d1;
|
393
|
+
} else {
|
394
|
+
count = 250 * (d1 - 249) + unrandomize255State(bits->readBits(8), codewordPosition++);
|
395
|
+
}
|
396
|
+
|
397
|
+
// We're seeing NegativeArraySizeException errors from users.
|
398
|
+
if (count < 0) {
|
399
|
+
throw FormatException("NegativeArraySizeException");
|
400
|
+
}
|
401
|
+
|
402
|
+
for (int i = 0; i < count; i++) {
|
403
|
+
// Have seen this particular error in the wild, such as at
|
404
|
+
// http://www.bcgen.com/demo/IDAutomationStreamingDataMatrix.aspx?MODE=3&D=Fred&PFMT=3&PT=F&X=0.3&O=0&LM=0.2
|
405
|
+
if (bits->available() < 8) {
|
406
|
+
throw FormatException("byteSegments");
|
407
|
+
}
|
408
|
+
char byte = unrandomize255State(bits->readBits(8), codewordPosition++);
|
409
|
+
byteSegments.push_back(byte);
|
410
|
+
result << byte;
|
411
|
+
}
|
412
|
+
}
|
413
|
+
}
|
414
|
+
}
|
415
|
+
|