react-native-nitro-zxing 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/VisionCameraZxing.podspec +48 -0
- package/android/CMakeLists.txt +43 -0
- package/android/build.gradle +150 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/cpp-adapter.cpp +7 -0
- package/android/src/main/java/com/margelo/nitro/camera/zxing/VisionCameraZxingPackage.kt +21 -0
- package/cpp/BarcodeValueTypeClassifier.cpp +70 -0
- package/cpp/BarcodeValueTypeClassifier.hpp +14 -0
- package/cpp/FrameImageView.cpp +75 -0
- package/cpp/FrameImageView.hpp +34 -0
- package/cpp/HybridBarcode.cpp +59 -0
- package/cpp/HybridBarcode.hpp +26 -0
- package/cpp/HybridBarcodeScanner.cpp +121 -0
- package/cpp/HybridBarcodeScanner.hpp +26 -0
- package/cpp/HybridBarcodeScannerFactory.cpp +11 -0
- package/cpp/HybridBarcodeScannerFactory.hpp +14 -0
- package/cpp/ImageDownscaler.cpp +34 -0
- package/cpp/ImageDownscaler.hpp +21 -0
- package/cpp/ZXingDecoder.cpp +189 -0
- package/cpp/ZXingDecoder.hpp +72 -0
- package/cpp/zxing-core/LICENSE +202 -0
- package/cpp/zxing-core/README.md +156 -0
- package/cpp/zxing-core/core/CMakeLists.txt +784 -0
- package/cpp/zxing-core/core/Version.h.in +28 -0
- package/cpp/zxing-core/core/ZXingConfig.cmake.in +9 -0
- package/cpp/zxing-core/core/src/Barcode.cpp +255 -0
- package/cpp/zxing-core/core/src/Barcode.h +191 -0
- package/cpp/zxing-core/core/src/BarcodeData.h +100 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.cpp +286 -0
- package/cpp/zxing-core/core/src/BarcodeFormat.h +272 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.cpp +111 -0
- package/cpp/zxing-core/core/src/BinaryBitmap.h +66 -0
- package/cpp/zxing-core/core/src/BitArray.cpp +38 -0
- package/cpp/zxing-core/core/src/BitArray.h +181 -0
- package/cpp/zxing-core/core/src/BitMatrix.cpp +175 -0
- package/cpp/zxing-core/core/src/BitMatrix.h +199 -0
- package/cpp/zxing-core/core/src/BitMatrixCursor.h +253 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.cpp +101 -0
- package/cpp/zxing-core/core/src/BitMatrixIO.h +21 -0
- package/cpp/zxing-core/core/src/BitSource.cpp +77 -0
- package/cpp/zxing-core/core/src/BitSource.h +72 -0
- package/cpp/zxing-core/core/src/ByteArray.h +42 -0
- package/cpp/zxing-core/core/src/CharacterSet.cpp +78 -0
- package/cpp/zxing-core/core/src/CharacterSet.h +58 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.cpp +312 -0
- package/cpp/zxing-core/core/src/ConcentricFinder.h +156 -0
- package/cpp/zxing-core/core/src/Content.cpp +471 -0
- package/cpp/zxing-core/core/src/Content.h +82 -0
- package/cpp/zxing-core/core/src/ContentType.h +19 -0
- package/cpp/zxing-core/core/src/CreateBarcode.cpp +490 -0
- package/cpp/zxing-core/core/src/CreateBarcode.h +132 -0
- package/cpp/zxing-core/core/src/DecoderResult.h +92 -0
- package/cpp/zxing-core/core/src/DetectorResult.h +44 -0
- package/cpp/zxing-core/core/src/ECI.cpp +81 -0
- package/cpp/zxing-core/core/src/ECI.h +78 -0
- package/cpp/zxing-core/core/src/Error.cpp +29 -0
- package/cpp/zxing-core/core/src/Error.h +79 -0
- package/cpp/zxing-core/core/src/Flags.h +165 -0
- package/cpp/zxing-core/core/src/GTIN.cpp +253 -0
- package/cpp/zxing-core/core/src/GTIN.h +58 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.cpp +197 -0
- package/cpp/zxing-core/core/src/GlobalHistogramBinarizer.h +34 -0
- package/cpp/zxing-core/core/src/GridSampler.cpp +124 -0
- package/cpp/zxing-core/core/src/GridSampler.h +59 -0
- package/cpp/zxing-core/core/src/HRI.cpp +343 -0
- package/cpp/zxing-core/core/src/HRI.h +16 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.cpp +315 -0
- package/cpp/zxing-core/core/src/HybridBinarizer.h +40 -0
- package/cpp/zxing-core/core/src/ImageView.h +168 -0
- package/cpp/zxing-core/core/src/JSON.cpp +154 -0
- package/cpp/zxing-core/core/src/JSON.h +66 -0
- package/cpp/zxing-core/core/src/LocalGrid.cpp +242 -0
- package/cpp/zxing-core/core/src/LocalGrid.h +91 -0
- package/cpp/zxing-core/core/src/LogMatrix.h +105 -0
- package/cpp/zxing-core/core/src/Matrix.h +125 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.cpp +107 -0
- package/cpp/zxing-core/core/src/MultiFormatReader.h +34 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.cpp +111 -0
- package/cpp/zxing-core/core/src/MultiFormatWriter.h +62 -0
- package/cpp/zxing-core/core/src/Pattern.h +472 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.cpp +81 -0
- package/cpp/zxing-core/core/src/PerspectiveTransform.h +47 -0
- package/cpp/zxing-core/core/src/Point.h +185 -0
- package/cpp/zxing-core/core/src/Quadrilateral.h +215 -0
- package/cpp/zxing-core/core/src/Range.h +112 -0
- package/cpp/zxing-core/core/src/ReadBarcode.cpp +335 -0
- package/cpp/zxing-core/core/src/ReadBarcode.h +33 -0
- package/cpp/zxing-core/core/src/Reader.h +32 -0
- package/cpp/zxing-core/core/src/ReaderOptions.h +210 -0
- package/cpp/zxing-core/core/src/ReedSolomon.cpp +100 -0
- package/cpp/zxing-core/core/src/ReedSolomon.h +66 -0
- package/cpp/zxing-core/core/src/RegressionLine.h +161 -0
- package/cpp/zxing-core/core/src/ResultPoint.cpp +20 -0
- package/cpp/zxing-core/core/src/ResultPoint.h +35 -0
- package/cpp/zxing-core/core/src/StdGenerator.h +121 -0
- package/cpp/zxing-core/core/src/StdPrint.h +38 -0
- package/cpp/zxing-core/core/src/StdScope.h +55 -0
- package/cpp/zxing-core/core/src/StructuredAppend.h +19 -0
- package/cpp/zxing-core/core/src/SymbologyIdentifier.h +29 -0
- package/cpp/zxing-core/core/src/TextDecoder.cpp +59 -0
- package/cpp/zxing-core/core/src/TextDecoder.h +23 -0
- package/cpp/zxing-core/core/src/TextEncoder.cpp +75 -0
- package/cpp/zxing-core/core/src/TextEncoder.h +31 -0
- package/cpp/zxing-core/core/src/ThresholdBinarizer.h +58 -0
- package/cpp/zxing-core/core/src/TritMatrix.h +29 -0
- package/cpp/zxing-core/core/src/Utf.cpp +276 -0
- package/cpp/zxing-core/core/src/Utf.h +26 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.cpp +276 -0
- package/cpp/zxing-core/core/src/WhiteRectDetector.h +36 -0
- package/cpp/zxing-core/core/src/WriteBarcode.cpp +213 -0
- package/cpp/zxing-core/core/src/WriteBarcode.h +72 -0
- package/cpp/zxing-core/core/src/ZXAlgorithms.h +353 -0
- package/cpp/zxing-core/core/src/ZXConfig.h +17 -0
- package/cpp/zxing-core/core/src/ZXTestSupport.h +9 -0
- package/cpp/zxing-core/core/src/ZXVersion.h +14 -0
- package/cpp/zxing-core/core/src/ZXingC.cpp +460 -0
- package/cpp/zxing-core/core/src/ZXingC.h +296 -0
- package/cpp/zxing-core/core/src/ZXingCpp.cpp +18 -0
- package/cpp/zxing-core/core/src/ZXingCpp.h +76 -0
- package/cpp/zxing-core/core/src/ZXingQt.h +606 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.cpp +376 -0
- package/cpp/zxing-core/core/src/aztec/AZDecoder.h +20 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.cpp +508 -0
- package/cpp/zxing-core/core/src/aztec/AZDetector.h +25 -0
- package/cpp/zxing-core/core/src/aztec/AZDetectorResult.h +51 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.cpp +318 -0
- package/cpp/zxing-core/core/src/aztec/AZEncoder.h +44 -0
- package/cpp/zxing-core/core/src/aztec/AZEncodingState.h +40 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.cpp +377 -0
- package/cpp/zxing-core/core/src/aztec/AZHighLevelEncoder.h +36 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.cpp +45 -0
- package/cpp/zxing-core/core/src/aztec/AZReader.h +21 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.cpp +44 -0
- package/cpp/zxing-core/core/src/aztec/AZToken.h +39 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.cpp +38 -0
- package/cpp/zxing-core/core/src/aztec/AZWriter.h +55 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.cpp +194 -0
- package/cpp/zxing-core/core/src/datamatrix/DMBitLayout.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.cpp +63 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDataBlock.h +41 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.cpp +457 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDecoder.h +19 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.cpp +1230 -0
- package/cpp/zxing-core/core/src/datamatrix/DMDetector.h +23 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.cpp +137 -0
- package/cpp/zxing-core/core/src/datamatrix/DMECEncoder.h +26 -0
- package/cpp/zxing-core/core/src/datamatrix/DMEncoderContext.h +128 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.cpp +919 -0
- package/cpp/zxing-core/core/src/datamatrix/DMHighLevelEncoder.h +29 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.cpp +40 -0
- package/cpp/zxing-core/core/src/datamatrix/DMReader.h +21 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.cpp +141 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolInfo.h +78 -0
- package/cpp/zxing-core/core/src/datamatrix/DMSymbolShape.h +17 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.cpp +82 -0
- package/cpp/zxing-core/core/src/datamatrix/DMVersion.h +76 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.cpp +114 -0
- package/cpp/zxing-core/core/src/datamatrix/DMWriter.h +62 -0
- package/cpp/zxing-core/core/src/librscpp/README.md +65 -0
- package/cpp/zxing-core/core/src/librscpp/decode.h +258 -0
- package/cpp/zxing-core/core/src/librscpp/encode.h +124 -0
- package/cpp/zxing-core/core/src/librscpp/field.h +158 -0
- package/cpp/zxing-core/core/src/librscpp/poly.h +194 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter.c +1 -0
- package/cpp/zxing-core/core/src/libzint/2of5inter_based.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.c +1 -0
- package/cpp/zxing-core/core/src/libzint/aztec.h +1 -0
- package/cpp/zxing-core/core/src/libzint/big5.h +1 -0
- package/cpp/zxing-core/core/src/libzint/codabar.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.c +1 -0
- package/cpp/zxing-core/core/src/libzint/code128.h +1 -0
- package/cpp/zxing-core/core/src/libzint/common.c +1 -0
- package/cpp/zxing-core/core/src/libzint/common.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.c +1 -0
- package/cpp/zxing-core/core/src/libzint/dmatrix.h +1 -0
- package/cpp/zxing-core/core/src/libzint/dxfilmedge.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.c +1 -0
- package/cpp/zxing-core/core/src/libzint/eci.h +1 -0
- package/cpp/zxing-core/core/src/libzint/eci_sb.h +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.c +1 -0
- package/cpp/zxing-core/core/src/libzint/filemem.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/normal_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/fonts/upcean_woff2.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb18030.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gb2312.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gbk.h +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.c +1 -0
- package/cpp/zxing-core/core/src/libzint/general_field.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.c +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1.h +1 -0
- package/cpp/zxing-core/core/src/libzint/gs1_lint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso3166.h +1 -0
- package/cpp/zxing-core/core/src/libzint/iso4217.h +1 -0
- package/cpp/zxing-core/core/src/libzint/ksx1001.h +1 -0
- package/cpp/zxing-core/core/src/libzint/large.c +1 -0
- package/cpp/zxing-core/core/src/libzint/large.h +1 -0
- package/cpp/zxing-core/core/src/libzint/library.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.c +1 -0
- package/cpp/zxing-core/core/src/libzint/maxicode.h +1 -0
- package/cpp/zxing-core/core/src/libzint/medical.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.c +1 -0
- package/cpp/zxing-core/core/src/libzint/output.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.c +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417.h +1 -0
- package/cpp/zxing-core/core/src/libzint/pdf417_tabs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.c +1 -0
- package/cpp/zxing-core/core/src/libzint/qr.h +1 -0
- package/cpp/zxing-core/core/src/libzint/raster.c +1 -0
- package/cpp/zxing-core/core/src/libzint/raster_font.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.c +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol.h +1 -0
- package/cpp/zxing-core/core/src/libzint/reedsol_logs.h +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.c +1 -0
- package/cpp/zxing-core/core/src/libzint/rss.h +1 -0
- package/cpp/zxing-core/core/src/libzint/sjis.h +1 -0
- package/cpp/zxing-core/core/src/libzint/stubs.c +137 -0
- package/cpp/zxing-core/core/src/libzint/svg.c +1 -0
- package/cpp/zxing-core/core/src/libzint/telepen.c +1 -0
- package/cpp/zxing-core/core/src/libzint/upcean.c +1 -0
- package/cpp/zxing-core/core/src/libzint/vector.c +1 -0
- package/cpp/zxing-core/core/src/libzint/zfiletypes.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zint.h +1 -0
- package/cpp/zxing-core/core/src/libzint/zintconfig.h +1 -0
- package/cpp/zxing-core/core/src/libzueci/README.md +11 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.c +1718 -0
- package/cpp/zxing-core/core/src/libzueci/zueci.h +179 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_big5.h +3884 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_common.h +31 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb18030.h +264 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gb2312.h +2381 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_gbk.h +4047 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_ksx1001.h +2932 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sb.h +1112 -0
- package/cpp/zxing-core/core/src/libzueci/zueci_sjis.h +2286 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.cpp +68 -0
- package/cpp/zxing-core/core/src/maxicode/MCBitMatrixParser.h +30 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.cpp +329 -0
- package/cpp/zxing-core/core/src/maxicode/MCDecoder.h +19 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.cpp +65 -0
- package/cpp/zxing-core/core/src/maxicode/MCReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.cpp +102 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarReader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.cpp +136 -0
- package/cpp/zxing-core/core/src/oned/ODCodabarWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Patterns.h +130 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.cpp +236 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.cpp +261 -0
- package/cpp/zxing-core/core/src/oned/ODCode128Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.cpp +213 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Reader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.cpp +176 -0
- package/cpp/zxing-core/core/src/oned/ODCode39Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Patterns.h +80 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.cpp +112 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Reader.h +21 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.cpp +192 -0
- package/cpp/zxing-core/core/src/oned/ODCode93Writer.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.cpp +246 -0
- package/cpp/zxing-core/core/src/oned/ODDXFilmEdgeReader.h +26 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.cpp +172 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarCommon.h +204 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.cpp +253 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedBitDecoder.h +19 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.cpp +383 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarExpandedReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.cpp +163 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarLimitedReader.h +23 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.cpp +240 -0
- package/cpp/zxing-core/core/src/oned/ODDataBarReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.cpp +62 -0
- package/cpp/zxing-core/core/src/oned/ODEAN13Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.cpp +51 -0
- package/cpp/zxing-core/core/src/oned/ODEAN8Writer.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.cpp +97 -0
- package/cpp/zxing-core/core/src/oned/ODITFReader.h +33 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.cpp +78 -0
- package/cpp/zxing-core/core/src/oned/ODITFWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.cpp +323 -0
- package/cpp/zxing-core/core/src/oned/ODMultiUPCEANReader.h +32 -0
- package/cpp/zxing-core/core/src/oned/ODReader.cpp +259 -0
- package/cpp/zxing-core/core/src/oned/ODReader.h +35 -0
- package/cpp/zxing-core/core/src/oned/ODRowReader.h +222 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.cpp +199 -0
- package/cpp/zxing-core/core/src/oned/ODTelepenReader.h +25 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.cpp +33 -0
- package/cpp/zxing-core/core/src/oned/ODUPCAWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.cpp +80 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEANCommon.h +129 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.cpp +56 -0
- package/cpp/zxing-core/core/src/oned/ODUPCEWriter.h +34 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.cpp +39 -0
- package/cpp/zxing-core/core/src/oned/ODWriterHelper.h +48 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.cpp +796 -0
- package/cpp/zxing-core/core/src/pdf417/MicroPDFReader.h +23 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.cpp +85 -0
- package/cpp/zxing-core/core/src/pdf417/PDF417.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeMetadata.h +53 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.cpp +48 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBarcodeValue.h +38 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.cpp +116 -0
- package/cpp/zxing-core/core/src/pdf417/PDFBoundingBox.h +75 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodeword.h +71 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.cpp +588 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCodewordDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCompaction.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFCustomData.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.cpp +725 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDecoder.h +20 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.cpp +247 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResult.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.cpp +321 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetectionResultColumn.h +83 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.cpp +371 -0
- package/cpp/zxing-core/core/src/pdf417/PDFDetector.h +45 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFEncoder.h +182 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.cpp +570 -0
- package/cpp/zxing-core/core/src/pdf417/PDFHighLevelEncoder.h +32 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.cpp +333 -0
- package/cpp/zxing-core/core/src/pdf417/PDFReader.h +28 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.cpp +559 -0
- package/cpp/zxing-core/core/src/pdf417/PDFScanningDecoder.h +41 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.cpp +170 -0
- package/cpp/zxing-core/core/src/pdf417/PDFWriter.h +74 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.cpp +623 -0
- package/cpp/zxing-core/core/src/pdf417/ZXBigInteger.h +81 -0
- package/cpp/zxing-core/core/src/pdf417/ZXNullable.h +105 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.cpp +294 -0
- package/cpp/zxing-core/core/src/qrcode/QRBitMatrixParser.h +41 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.cpp +95 -0
- package/cpp/zxing-core/core/src/qrcode/QRCodecMode.h +59 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.cpp +93 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataBlock.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QRDataMask.h +50 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.cpp +359 -0
- package/cpp/zxing-core/core/src/qrcode/QRDecoder.h +19 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.cpp +920 -0
- package/cpp/zxing-core/core/src/qrcode/QRDetector.h +45 -0
- package/cpp/zxing-core/core/src/qrcode/QRECB.h +52 -0
- package/cpp/zxing-core/core/src/qrcode/QREncodeResult.h +33 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.cpp +568 -0
- package/cpp/zxing-core/core/src/qrcode/QREncoder.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRErrorCorrectionLevel.h +39 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.cpp +160 -0
- package/cpp/zxing-core/core/src/qrcode/QRFormatInformation.h +61 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.cpp +156 -0
- package/cpp/zxing-core/core/src/qrcode/QRMaskUtil.h +15 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.cpp +318 -0
- package/cpp/zxing-core/core/src/qrcode/QRMatrixUtil.h +25 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.cpp +149 -0
- package/cpp/zxing-core/core/src/qrcode/QRReader.h +21 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.cpp +754 -0
- package/cpp/zxing-core/core/src/qrcode/QRVersion.h +127 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.cpp +51 -0
- package/cpp/zxing-core/core/src/qrcode/QRWriter.h +74 -0
- package/cpp/zxing-core/core/version.rc.in +34 -0
- package/cpp/zxing-core/core/zxing.pc.in +8 -0
- package/cpp/zxing-core/wrappers/ios/README.md +25 -0
- package/cpp/zxing-core/wrappers/ios/Sources/Wrapper/Version.h +29 -0
- package/cpp/zxing-core/zxing-cpp.podspec +45 -0
- package/lib/factory.d.ts +10 -0
- package/lib/factory.js +12 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/specs/Barcode.nitro.d.ts +63 -0
- package/lib/specs/Barcode.nitro.js +1 -0
- package/lib/specs/BarcodeFormat.d.ts +11 -0
- package/lib/specs/BarcodeFormat.js +1 -0
- package/lib/specs/BarcodeScanner.nitro.d.ts +89 -0
- package/lib/specs/BarcodeScanner.nitro.js +1 -0
- package/lib/specs/BarcodeScannerFactory.nitro.d.ts +26 -0
- package/lib/specs/BarcodeScannerFactory.nitro.js +1 -0
- package/lib/specs/BarcodeValueType.d.ts +9 -0
- package/lib/specs/BarcodeValueType.js +1 -0
- package/lib/specs/Point.d.ts +14 -0
- package/lib/specs/Point.js +1 -0
- package/lib/specs/Rect.d.ts +22 -0
- package/lib/specs/Rect.js +1 -0
- package/lib/useBarcodeScanner.d.ts +23 -0
- package/lib/useBarcodeScanner.js +25 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.cmake +83 -0
- package/nitrogen/generated/android/VisionCameraZxing+autolinking.gradle +27 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.cpp +49 -0
- package/nitrogen/generated/android/VisionCameraZxingOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/zxing/VisionCameraZxingOnLoad.kt +35 -0
- package/nitrogen/generated/ios/VisionCameraZxing+autolinking.rb +62 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/VisionCameraZxing-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.mm +35 -0
- package/nitrogen/generated/ios/VisionCameraZxingAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/BarcodeFormat.hpp +124 -0
- package/nitrogen/generated/shared/c++/BarcodeScannerOptions.hpp +85 -0
- package/nitrogen/generated/shared/c++/BarcodeValueType.hpp +120 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeScannerSpec.hpp +74 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridBarcodeSpec.hpp +82 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridZXingBarcodeScannerFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/Point.hpp +87 -0
- package/nitrogen/generated/shared/c++/Rect.hpp +95 -0
- package/nitrogen/generated/shared/c++/TargetBarcodeFormat.hpp +124 -0
- package/package.json +108 -0
- package/react-native.config.js +16 -0
- package/src/factory.ts +26 -0
- package/src/index.ts +9 -0
- package/src/specs/Barcode.nitro.ts +70 -0
- package/src/specs/BarcodeFormat.ts +31 -0
- package/src/specs/BarcodeScanner.nitro.ts +91 -0
- package/src/specs/BarcodeScannerFactory.nitro.ts +27 -0
- package/src/specs/BarcodeValueType.ts +25 -0
- package/src/specs/Point.ts +14 -0
- package/src/specs/Rect.ts +22 -0
- package/src/useBarcodeScanner.ts +36 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Antoine Mérino
|
|
3
|
+
* Copyright 2023 Axel Waggershauser
|
|
4
|
+
*/
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
#include "ODDXFilmEdgeReader.h"
|
|
8
|
+
|
|
9
|
+
#include "BarcodeData.h"
|
|
10
|
+
#include "SymbologyIdentifier.h"
|
|
11
|
+
|
|
12
|
+
#include <cmath>
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <vector>
|
|
15
|
+
|
|
16
|
+
namespace ZXing::OneD {
|
|
17
|
+
|
|
18
|
+
namespace {
|
|
19
|
+
|
|
20
|
+
// Detection is made from center outward.
|
|
21
|
+
// We ensure the clock track is decoded before the data track to avoid false positives.
|
|
22
|
+
// They are two version of a DX Edge codes : with and without frame number.
|
|
23
|
+
// The clock track is longer if the DX code contains the frame number (more recent version)
|
|
24
|
+
constexpr int CLOCK_LENGTH_FN = 31;
|
|
25
|
+
constexpr int CLOCK_LENGTH_NO_FN = 23;
|
|
26
|
+
|
|
27
|
+
// data track length, without the start and stop patterns
|
|
28
|
+
constexpr int DATA_LENGTH_FN = 23;
|
|
29
|
+
constexpr int DATA_LENGTH_NO_FN = 15;
|
|
30
|
+
|
|
31
|
+
constexpr auto CLOCK_PATTERN_FN =
|
|
32
|
+
FixedPattern<25, CLOCK_LENGTH_FN>{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3};
|
|
33
|
+
constexpr auto CLOCK_PATTERN_NO_FN = FixedPattern<17, CLOCK_LENGTH_NO_FN>{5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3};
|
|
34
|
+
constexpr auto DATA_START_PATTERN = FixedPattern<5, 5>{1, 1, 1, 1, 1};
|
|
35
|
+
constexpr auto DATA_STOP_PATTERN = FixedPattern<3, 3>{1, 1, 1};
|
|
36
|
+
|
|
37
|
+
template <int N, int SUM>
|
|
38
|
+
bool IsPattern(PatternView& view, const FixedPattern<N, SUM>& pattern, float minQuietZone)
|
|
39
|
+
{
|
|
40
|
+
view = view.subView(0, N);
|
|
41
|
+
return view.isValid() && IsPattern(view, pattern, view.spaceInFront(), minQuietZone);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
bool DistIsBelowThreshold(PointI a, PointI b, PointI threshold)
|
|
45
|
+
{
|
|
46
|
+
return std::abs(a.x - b.x) <= threshold.x && std::abs(a.y - b.y) <= threshold.y;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// DX Film Edge clock track found on 35mm films.
|
|
50
|
+
struct Clock
|
|
51
|
+
{
|
|
52
|
+
bool hasFrameNr = false; // Clock track (thus data track) with frame number (longer version)
|
|
53
|
+
int rowNumber = 0;
|
|
54
|
+
int xStart = 0; // Beginning of the clock track on the X-axis, in pixels
|
|
55
|
+
int xStop = 0; // End of the clock track on the X-axis, in pixels
|
|
56
|
+
|
|
57
|
+
int dataLength() const { return hasFrameNr ? DATA_LENGTH_FN : DATA_LENGTH_NO_FN; }
|
|
58
|
+
|
|
59
|
+
float moduleSize() const { return float(xStop + 1 - xStart) / (hasFrameNr ? CLOCK_LENGTH_FN : CLOCK_LENGTH_NO_FN); }
|
|
60
|
+
|
|
61
|
+
bool isCloseTo(PointI p, int x) const { return DistIsBelowThreshold(p, {x, rowNumber}, PointI(moduleSize() * PointF{0.5, 4})); }
|
|
62
|
+
|
|
63
|
+
bool isCloseToStart(int x, int y) const { return isCloseTo({x, y}, xStart); }
|
|
64
|
+
bool isCloseToStop(int x, int y) const { return isCloseTo({x, y}, xStop); }
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
struct DXFEState : public RowReader::DecodingState
|
|
68
|
+
{
|
|
69
|
+
int centerRow = 0;
|
|
70
|
+
std::vector<Clock> clocks;
|
|
71
|
+
|
|
72
|
+
// see if we a clock that starts near {x, y}
|
|
73
|
+
Clock* findClock(int x, int y)
|
|
74
|
+
{
|
|
75
|
+
auto i = FindIf(clocks, [start = PointI{x, y}](auto& v) { return v.rowNumber != start.y && v.isCloseToStart(start.x, start.y); });
|
|
76
|
+
return i != clocks.end() ? &(*i) : nullptr;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// add/update clock
|
|
80
|
+
void addClock(const Clock& clock)
|
|
81
|
+
{
|
|
82
|
+
if (Clock* i = findClock(clock.xStart, clock.rowNumber))
|
|
83
|
+
*i = clock;
|
|
84
|
+
else
|
|
85
|
+
clocks.push_back(clock);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
std::optional<Clock> CheckForClock(int rowNumber, PatternView& view)
|
|
90
|
+
{
|
|
91
|
+
Clock clock;
|
|
92
|
+
|
|
93
|
+
if (IsPattern(view, CLOCK_PATTERN_FN, 0.5)) // On FN versions, the decimal number can be really close to the clock
|
|
94
|
+
clock.hasFrameNr = true;
|
|
95
|
+
else if (IsPattern(view, CLOCK_PATTERN_NO_FN, 2.0))
|
|
96
|
+
clock.hasFrameNr = false;
|
|
97
|
+
else
|
|
98
|
+
return {};
|
|
99
|
+
|
|
100
|
+
clock.rowNumber = rowNumber;
|
|
101
|
+
clock.xStart = view.pixelsInFront();
|
|
102
|
+
clock.xStop = view.pixelsTillEnd();
|
|
103
|
+
|
|
104
|
+
return clock;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
} // namespace
|
|
108
|
+
|
|
109
|
+
BarcodeData DXFilmEdgeReader::decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>& state) const
|
|
110
|
+
{
|
|
111
|
+
if (!state) {
|
|
112
|
+
state = std::make_unique<DXFEState>();
|
|
113
|
+
static_cast<DXFEState*>(state.get())->centerRow = rowNumber;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
auto dxState = static_cast<DXFEState*>(state.get());
|
|
117
|
+
|
|
118
|
+
// Only consider rows below the center row of the image
|
|
119
|
+
if (!_opts.tryRotate() && rowNumber < dxState->centerRow - 1)
|
|
120
|
+
return {};
|
|
121
|
+
|
|
122
|
+
// Look for a pattern that is part of both the clock as well as the data track (omitting the first bar)
|
|
123
|
+
constexpr auto Is4x1 = [](const PatternView& view, int spaceInPixel) {
|
|
124
|
+
#if 0
|
|
125
|
+
// Find min/max of 4 consecutive bars/spaces and make sure they are close together.
|
|
126
|
+
auto a = view[1], b = view[2], c = view[3], d = view[4];
|
|
127
|
+
auto m = std::min(std::min(a, b), std::min(c, d));
|
|
128
|
+
auto M = std::max(std::max(a, b), std::max(c, d));
|
|
129
|
+
return M <= m * 4 / 3 + 1 && spaceInPixel > m / 2;
|
|
130
|
+
#else
|
|
131
|
+
// perform a very rough check to see if the 4 bars/spaces are close together
|
|
132
|
+
auto a = view[1], b = view[2], c = view[3], d = view[4];
|
|
133
|
+
auto diff = std::abs(a - b) + std::abs(a - c) + std::abs(a - d);
|
|
134
|
+
return diff < a && spaceInPixel > a / 2;
|
|
135
|
+
#endif
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// 12 is the minimum size of the data track (at least one product class bit + one parity bit)
|
|
139
|
+
next = FindLeftGuard<4>(next, 10, Is4x1);
|
|
140
|
+
if (!next.isValid())
|
|
141
|
+
return {};
|
|
142
|
+
|
|
143
|
+
// Check if the 4x1 pattern is part of a clock track
|
|
144
|
+
if (auto clock = CheckForClock(rowNumber, next)) {
|
|
145
|
+
dxState->addClock(*clock);
|
|
146
|
+
next.skipSymbol();
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Without at least one clock track, we stop here
|
|
151
|
+
if (dxState->clocks.empty())
|
|
152
|
+
return {};
|
|
153
|
+
|
|
154
|
+
constexpr float minDataQuietZone = 0.5;
|
|
155
|
+
|
|
156
|
+
if (!IsPattern(next, DATA_START_PATTERN, minDataQuietZone))
|
|
157
|
+
return {};
|
|
158
|
+
|
|
159
|
+
auto xStart = next.pixelsInFront();
|
|
160
|
+
|
|
161
|
+
// Only consider data tracks that are next to a clock track
|
|
162
|
+
auto clock = dxState->findClock(xStart, rowNumber);
|
|
163
|
+
if (!clock)
|
|
164
|
+
return {};
|
|
165
|
+
|
|
166
|
+
// Make sure the start pattern has the proper size (approx. 5 modules)
|
|
167
|
+
if (std::fabs(next.sum() / clock->moduleSize() - 5) > 1.0 )
|
|
168
|
+
return {};
|
|
169
|
+
|
|
170
|
+
// Skip the data start pattern (black, white, black, white, black)
|
|
171
|
+
// The first signal bar is always white: this is the
|
|
172
|
+
// separation between the start pattern and the product number
|
|
173
|
+
next.skipSymbol();
|
|
174
|
+
|
|
175
|
+
// Read the data bits
|
|
176
|
+
BitArray dataBits;
|
|
177
|
+
while (next.isValid(1) && dataBits.size() < clock->dataLength()) {
|
|
178
|
+
|
|
179
|
+
// Max no. of modules is 20 spaces (with "96-0/0")
|
|
180
|
+
if (int modules = std::lround(next[0] / clock->moduleSize()); modules >= 1 && modules <= 20)
|
|
181
|
+
// even index means we are at a bar, otherwise at a space
|
|
182
|
+
dataBits.appendBits(next.index() % 2 == 0 ? 0xFFFFFFFF : 0x0, modules);
|
|
183
|
+
else
|
|
184
|
+
return {};
|
|
185
|
+
|
|
186
|
+
next.shift(1);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Check the data track length
|
|
190
|
+
if (dataBits.size() != clock->dataLength())
|
|
191
|
+
return {};
|
|
192
|
+
|
|
193
|
+
next = next.subView(0, DATA_STOP_PATTERN.size());
|
|
194
|
+
|
|
195
|
+
// Check there is the Stop pattern at the end of the data track
|
|
196
|
+
if (!IsRightGuard(next, DATA_STOP_PATTERN, minDataQuietZone))
|
|
197
|
+
return {};
|
|
198
|
+
|
|
199
|
+
// The following bits are always white (=false), they are separators.
|
|
200
|
+
if (dataBits.get(0) || dataBits.get(8) || (clock->hasFrameNr ? (dataBits.get(20) || dataBits.get(22)) : dataBits.get(14)))
|
|
201
|
+
return {};
|
|
202
|
+
|
|
203
|
+
// Check the parity bit
|
|
204
|
+
auto signalSum = Reduce(dataBits.begin(), dataBits.end() - 2, 0);
|
|
205
|
+
auto parityBit = *(dataBits.end() - 2);
|
|
206
|
+
if (signalSum % 2 != (int)parityBit)
|
|
207
|
+
return {};
|
|
208
|
+
|
|
209
|
+
// Compute the DX 1 number (product number)
|
|
210
|
+
auto productNumber = ToInt(dataBits, 1, 7);
|
|
211
|
+
if (!productNumber)
|
|
212
|
+
return {};
|
|
213
|
+
|
|
214
|
+
// Compute the DX 2 number (generation number)
|
|
215
|
+
auto generationNumber = ToInt(dataBits, 9, 4);
|
|
216
|
+
|
|
217
|
+
// Generate the textual representation.
|
|
218
|
+
// Eg: 115-10/11A means: DX1 = 115, DX2 = 10, Frame number = 11A
|
|
219
|
+
std::string txt;
|
|
220
|
+
txt.reserve(10);
|
|
221
|
+
txt = std::to_string(productNumber) + "-" + std::to_string(generationNumber);
|
|
222
|
+
if (clock->hasFrameNr) {
|
|
223
|
+
auto frameNr = ToInt(dataBits, 13, 6);
|
|
224
|
+
txt += "/" + std::to_string(frameNr);
|
|
225
|
+
if (dataBits.get(19))
|
|
226
|
+
txt += "A";
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
auto xStop = next.pixelsTillEnd();
|
|
230
|
+
|
|
231
|
+
// The found data track must end near the clock track
|
|
232
|
+
if (!clock->isCloseToStop(xStop, rowNumber))
|
|
233
|
+
return {};
|
|
234
|
+
|
|
235
|
+
// Update the clock coordinates with the latest corresponding data track
|
|
236
|
+
// This may improve signal detection for next row iterations
|
|
237
|
+
clock->xStart = xStart;
|
|
238
|
+
clock->xStop = xStop;
|
|
239
|
+
|
|
240
|
+
// ISO/IEC 15424:2008(E) specifies 'X' as 'other barcode' that can be used by the decoder manufacturer as he sees fit.
|
|
241
|
+
SymbologyIdentifier si {'X', 'F'};
|
|
242
|
+
|
|
243
|
+
return LinearBarcode(BarcodeFormat::DXFilmEdge, txt, rowNumber, xStart, xStop, si);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Antoine Mérino
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "ODRowReader.h"
|
|
9
|
+
|
|
10
|
+
namespace ZXing::OneD {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* <p>Implements decoding of the DX Edge Film code format, a type of barcode found on 35mm films.</p>
|
|
14
|
+
*
|
|
15
|
+
* <p>See <a href="https://en.wikipedia.org/wiki/DX_encoding">https://en.wikipedia.org/wiki/DX_encoding</a></p>
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class DXFilmEdgeReader : public RowReader
|
|
19
|
+
{
|
|
20
|
+
public:
|
|
21
|
+
using RowReader::RowReader;
|
|
22
|
+
|
|
23
|
+
BarcodeData decodePattern(int rowNumber, PatternView& next, std::unique_ptr<DecodingState>&) const override;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} // namespace ZXing::OneD
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#include "ODDataBarCommon.h"
|
|
7
|
+
|
|
8
|
+
#include <cmath>
|
|
9
|
+
|
|
10
|
+
namespace ZXing::OneD::DataBar {
|
|
11
|
+
|
|
12
|
+
static int combins(int n, int r)
|
|
13
|
+
{
|
|
14
|
+
int maxDenom;
|
|
15
|
+
int minDenom;
|
|
16
|
+
if (n - r > r) {
|
|
17
|
+
minDenom = r;
|
|
18
|
+
maxDenom = n - r;
|
|
19
|
+
} else {
|
|
20
|
+
minDenom = n - r;
|
|
21
|
+
maxDenom = r;
|
|
22
|
+
}
|
|
23
|
+
int val = 1;
|
|
24
|
+
int j = 1;
|
|
25
|
+
for (int i = n; i > maxDenom; i--) {
|
|
26
|
+
val *= i;
|
|
27
|
+
if (j <= minDenom) {
|
|
28
|
+
val /= j;
|
|
29
|
+
j++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
while (j <= minDenom) {
|
|
33
|
+
val /= j;
|
|
34
|
+
j++;
|
|
35
|
+
}
|
|
36
|
+
return val;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
int GetValue(ArrayView<int> widths, int maxWidth, bool noNarrow)
|
|
40
|
+
{
|
|
41
|
+
int elements = Size(widths);
|
|
42
|
+
int n = Reduce(widths);
|
|
43
|
+
int val = 0;
|
|
44
|
+
int narrowMask = 0;
|
|
45
|
+
for (int bar = 0; bar < elements - 1; bar++) {
|
|
46
|
+
int elmWidth;
|
|
47
|
+
for (elmWidth = 1, narrowMask |= 1 << bar; elmWidth < widths[bar]; elmWidth++, narrowMask &= ~(1 << bar)) {
|
|
48
|
+
int subVal = combins(n - elmWidth - 1, elements - bar - 2);
|
|
49
|
+
if (noNarrow && (narrowMask == 0) && (n - elmWidth - (elements - bar - 1) >= elements - bar - 1)) {
|
|
50
|
+
subVal -= combins(n - elmWidth - (elements - bar), elements - bar - 2);
|
|
51
|
+
}
|
|
52
|
+
if (elements - bar - 1 > 1) {
|
|
53
|
+
int lessVal = 0;
|
|
54
|
+
for (int mxwElement = n - elmWidth - (elements - bar - 2); mxwElement > maxWidth; mxwElement--) {
|
|
55
|
+
lessVal += combins(n - elmWidth - mxwElement - 1, elements - bar - 3);
|
|
56
|
+
}
|
|
57
|
+
subVal -= lessVal * (elements - 1 - bar);
|
|
58
|
+
} else if (n - elmWidth > maxWidth) {
|
|
59
|
+
subVal--;
|
|
60
|
+
}
|
|
61
|
+
val += subVal;
|
|
62
|
+
}
|
|
63
|
+
n -= elmWidth;
|
|
64
|
+
}
|
|
65
|
+
return val;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
using Array4F = std::array<float, 4>;
|
|
69
|
+
|
|
70
|
+
bool ReadDataCharacterRaw(const PatternView& view, int numModules, bool reversed, Array4I& oddPattern,
|
|
71
|
+
Array4I& evnPattern)
|
|
72
|
+
{
|
|
73
|
+
#if 1
|
|
74
|
+
auto pattern = NormalizedPatternFromE2E<8>(view, numModules, reversed);
|
|
75
|
+
OddEven<Array4I&> res = {oddPattern, evnPattern};
|
|
76
|
+
|
|
77
|
+
for (int i = 0; i < Size(pattern); ++i)
|
|
78
|
+
res[i % 2][i / 2] = pattern[i];
|
|
79
|
+
|
|
80
|
+
#else
|
|
81
|
+
OddEven<Array4I&> res = {oddPattern, evnPattern};
|
|
82
|
+
OddEven<Array4F> rem;
|
|
83
|
+
|
|
84
|
+
float moduleSize = static_cast<float>(view.sum(8)) / numModules;
|
|
85
|
+
auto* iter = view.data() + reversed * 7;
|
|
86
|
+
int inc = reversed ? -1 : 1;
|
|
87
|
+
|
|
88
|
+
for (int i = 0; i < 8; ++i, iter += inc) {
|
|
89
|
+
float v = *iter / moduleSize;
|
|
90
|
+
res[i % 2][i / 2] = int(v + .5f);
|
|
91
|
+
rem[i % 2][i / 2] = v - res[i % 2][i / 2];
|
|
92
|
+
}
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
// DataBarExpanded data character is 17 modules wide
|
|
96
|
+
// DataBar outer data character is 16 modules wide
|
|
97
|
+
// DataBar inner data character is 15 modules wide
|
|
98
|
+
|
|
99
|
+
int minSum = 4; // each data character has 4 bars and 4 spaces
|
|
100
|
+
int maxSum = numModules - minSum;
|
|
101
|
+
int oddSum = Reduce(res.odd);
|
|
102
|
+
int evnSum = Reduce(res.evn);
|
|
103
|
+
|
|
104
|
+
int sumErr = oddSum + evnSum - numModules;
|
|
105
|
+
// sum < min -> negative error; sum > max -> positive error
|
|
106
|
+
int oddSumErr = std::min(0, oddSum - (minSum + (numModules == 15))) + std::max(0, oddSum - maxSum);
|
|
107
|
+
int evnSumErr = std::min(0, evnSum - minSum) + std::max(0, evnSum - (maxSum - (numModules == 15)));
|
|
108
|
+
|
|
109
|
+
int oddParityErr = (oddSum & 1) == (numModules > 15);
|
|
110
|
+
int evnParityErr = (evnSum & 1) == (numModules < 17);
|
|
111
|
+
|
|
112
|
+
#if 0
|
|
113
|
+
// the 'signal improving' strategy of trying to fix off-by-one errors in the sum or parity leads to a massively
|
|
114
|
+
// increased likelihood of false positives / misreads especially with expanded codes that are composed of many
|
|
115
|
+
// pairs. the combinatorial explosion of possible pair combinations (see FindValidSequence) results in many possible
|
|
116
|
+
// sequences with valid checksums. It can slightly lower the minimum required resolution to detect something at all
|
|
117
|
+
// but the introduced error rate is clearly not worth it.
|
|
118
|
+
|
|
119
|
+
if ((sumErr == 0 && oddParityErr != evnParityErr) || (std::abs(sumErr) == 1 && oddParityErr == evnParityErr) ||
|
|
120
|
+
std::abs(sumErr) > 1 || std::abs(oddSumErr) > 1 || std::abs(evnSumErr) > 1)
|
|
121
|
+
return {};
|
|
122
|
+
|
|
123
|
+
if (sumErr == -1) {
|
|
124
|
+
oddParityErr *= -1;
|
|
125
|
+
evnParityErr *= -1;
|
|
126
|
+
} else if (sumErr == 0 && oddParityErr != 0) {
|
|
127
|
+
// both parity errors are 1 -> flip one of them
|
|
128
|
+
(oddSum < evnSum ? oddParityErr : evnParityErr) *= -1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// check if parity and sum errors have opposite signs
|
|
132
|
+
if (oddParityErr * oddSumErr < 0 || evnParityErr * evnSumErr < 0)
|
|
133
|
+
return {};
|
|
134
|
+
|
|
135
|
+
// apparently the spec calls numbers at even indices 'odd'!?!
|
|
136
|
+
constexpr int odd = 0, evn = 1;
|
|
137
|
+
for (int i : {odd, evn}) {
|
|
138
|
+
int err = i == odd ? (oddSumErr | oddParityErr) : (evnSumErr | evnParityErr);
|
|
139
|
+
int mi = err < 0 ? std::max_element(rem[i].begin(), rem[i].end()) - rem[i].begin()
|
|
140
|
+
: std::min_element(rem[i].begin(), rem[i].end()) - rem[i].begin();
|
|
141
|
+
res[i][mi] -= err;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return true;
|
|
145
|
+
#else
|
|
146
|
+
// instead, we ignore any character that is not exactly fitting the requirements
|
|
147
|
+
return !(sumErr || oddSumErr || evnSumErr || oddParityErr || evnParityErr);
|
|
148
|
+
#endif
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static bool IsStacked(const Pair& first, const Pair& last)
|
|
152
|
+
{
|
|
153
|
+
// check if we see two halfes that are far away from each other in y or overlapping in x
|
|
154
|
+
return std::abs(first.y - last.y) > (first.xStop - first.xStart) || last.xStart < (first.xStart + first.xStop) / 2;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
Position EstimatePosition(const Pair& first, const Pair& last)
|
|
158
|
+
{
|
|
159
|
+
if (!IsStacked(first, last))
|
|
160
|
+
return Line((first.y + last.y) / 2, first.xStart, last.xStop);
|
|
161
|
+
else
|
|
162
|
+
return Position{{first.xStart, first.y}, {first.xStop, first.y}, {last.xStop, last.y}, {last.xStart, last.y}};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
int EstimateLineCount(const Pair& first, const Pair& last)
|
|
166
|
+
{
|
|
167
|
+
// see ODReader.cpp 'lineCount++' and Barcode::operator==() for the -2 here
|
|
168
|
+
// TODO: this is a bit of a hack... implement a proper Pair clustering
|
|
169
|
+
return std::max(0, std::min(first.count, last.count) - 2) + IsStacked(first, last);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
} // namespace ZXing::OneD::DataBar
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Axel Waggershauser
|
|
3
|
+
*/
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "ODRowReader.h"
|
|
9
|
+
#include "Range.h"
|
|
10
|
+
#include "Pattern.h"
|
|
11
|
+
|
|
12
|
+
#include <array>
|
|
13
|
+
#include <cmath>
|
|
14
|
+
#include <numeric>
|
|
15
|
+
|
|
16
|
+
namespace ZXing::OneD::DataBar {
|
|
17
|
+
|
|
18
|
+
inline bool IsFinder(int a, int b, int c, int d, int e)
|
|
19
|
+
{
|
|
20
|
+
// a,b,c,d,e, g | sum(a..e) = 15
|
|
21
|
+
// ------------
|
|
22
|
+
// 1,1,2
|
|
23
|
+
// | | |,1,1, 1
|
|
24
|
+
// 3,8,9
|
|
25
|
+
|
|
26
|
+
// use only pairs of bar+space to limit effect of poor threshold:
|
|
27
|
+
// b+c can be 10, 11 or 12 modules, d+e is always 2
|
|
28
|
+
int w = 2 * (b + c), n = d + e;
|
|
29
|
+
// the offsets (5 and 2) are there to reduce quantization effects for small module sizes
|
|
30
|
+
// TODO: review after switch to sub-pixel bar width calculation
|
|
31
|
+
bool x = (w + 5 > 9 * n) &&
|
|
32
|
+
(w - 5 < 13 * n) &&
|
|
33
|
+
// (b < 5 + 9 * d) &&
|
|
34
|
+
// (c < 5 + 10 * e) &&
|
|
35
|
+
(a < 2 + 4 * e) &&
|
|
36
|
+
(4 * a > n);
|
|
37
|
+
#if defined(PRINT_DEBUG) && 0
|
|
38
|
+
printf("[");
|
|
39
|
+
for (bool v :
|
|
40
|
+
{w + 5 > 9 * n,
|
|
41
|
+
w - 5 < 13 * n,
|
|
42
|
+
// b < 5 + 9 * d,
|
|
43
|
+
// c < 5 + 10 * e,
|
|
44
|
+
a < 2 + 4 * e,
|
|
45
|
+
4 * a > n})
|
|
46
|
+
printf(" %d", v);
|
|
47
|
+
printf("]"); fflush(stdout);
|
|
48
|
+
#endif
|
|
49
|
+
return x;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
inline PatternView Finder(const PatternView& view)
|
|
53
|
+
{
|
|
54
|
+
return view.subView(8, 5);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
inline PatternView LeftChar(const PatternView& view)
|
|
58
|
+
{
|
|
59
|
+
return view.subView(0, 8);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
inline PatternView RightChar(const PatternView& view)
|
|
63
|
+
{
|
|
64
|
+
return view.subView(13, 8);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
inline float ModSizeFinder(const PatternView& view)
|
|
68
|
+
{
|
|
69
|
+
return Finder(view).sum() / 15.f;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
inline bool IsGuard(int a, int b)
|
|
73
|
+
{
|
|
74
|
+
// printf(" (%d, %d)", a, b);
|
|
75
|
+
return a > b * 3 / 4 - 2 && a < b * 5 / 4 + 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
inline bool IsCharacter(const PatternView& view, int modules, float modSizeRef)
|
|
79
|
+
{
|
|
80
|
+
float err = std::abs(float(view.sum()) / modules / modSizeRef - 1);
|
|
81
|
+
return err < 0.1f;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
struct Character
|
|
85
|
+
{
|
|
86
|
+
int value = -1, checksum = 0;
|
|
87
|
+
|
|
88
|
+
operator bool() const noexcept { return value != -1; }
|
|
89
|
+
bool operator==(const Character& o) const noexcept { return value == o.value && checksum == o.checksum; }
|
|
90
|
+
bool operator!=(const Character& o) const { return !(*this == o); }
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
struct Pair
|
|
94
|
+
{
|
|
95
|
+
Character left, right;
|
|
96
|
+
int finder = 0, xStart = -1, xStop = 1, y = -1, count = 1;
|
|
97
|
+
|
|
98
|
+
operator bool() const noexcept { return finder != 0; }
|
|
99
|
+
bool operator==(const Pair& o) const noexcept { return finder == o.finder && left == o.left && right == o.right; }
|
|
100
|
+
bool operator!=(const Pair& o) const noexcept { return !(*this == o); }
|
|
101
|
+
int center() const { return std::midpoint(xStart, xStop); }
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
struct PairHash
|
|
105
|
+
{
|
|
106
|
+
std::size_t operator()(const Pair& p) const noexcept
|
|
107
|
+
{
|
|
108
|
+
return p.left.value ^ p.left.checksum ^ p.right.value ^ p.right.checksum ^ p.finder;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
constexpr int FULL_PAIR_SIZE = 8 + 5 + 8;
|
|
113
|
+
constexpr int HALF_PAIR_SIZE = 8 + 5 + 2; // half has to be followed by a guard pattern
|
|
114
|
+
|
|
115
|
+
template<size_t E2E_LEN, size_t N>
|
|
116
|
+
int ParseFinderPattern(const PatternView& view, bool reversed, const std::array<Pattern<E2E_LEN>, N>& e2ePatterns)
|
|
117
|
+
{
|
|
118
|
+
static_assert(E2E_LEN == 3);
|
|
119
|
+
const auto e2e = NormalizedE2EPattern<5, E2E_LEN>(view, 15, reversed);
|
|
120
|
+
|
|
121
|
+
int best_i = -1, best_e = 3;
|
|
122
|
+
for (int i = 0; i < Size(e2ePatterns); ++i) {
|
|
123
|
+
int e = 0;
|
|
124
|
+
for (int j = 0; j < 3; ++j)
|
|
125
|
+
e += std::abs(static_cast<int>(e2ePatterns[i][j]) - e2e[j]);
|
|
126
|
+
if (e < best_e) {
|
|
127
|
+
best_e = e;
|
|
128
|
+
best_i = i;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
int i = best_e <= 1 ? 1 + best_i : 0;
|
|
132
|
+
return reversed ? -i : i;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
template <typename T>
|
|
136
|
+
struct OddEven
|
|
137
|
+
{
|
|
138
|
+
T odd = {}, evn = {};
|
|
139
|
+
T& operator[](int i) { return i & 1 ? evn : odd; }
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
using Array4I = std::array<int, 4>;
|
|
143
|
+
|
|
144
|
+
// elements() determines the element widths of an (n,k) character.
|
|
145
|
+
// for DataBar: LEN=8, mods=15/16
|
|
146
|
+
// for DataBarExpanded: LEN=8, mods=17
|
|
147
|
+
// for DataBarLimited: LEN=14, mods=26/18
|
|
148
|
+
template <int LEN>
|
|
149
|
+
std::array<int, LEN> NormalizedPatternFromE2E(const PatternView& view, int mods, bool reversed = false)
|
|
150
|
+
{
|
|
151
|
+
// To disambiguate the edge-to-edge measurements, it is defined that either the odd or the even-numbered
|
|
152
|
+
// elements contain at least 1 element that is 1 module wide. (Note: even-numbered elements - 2nd, 4th, 6th, etc., have odd
|
|
153
|
+
// indexes).
|
|
154
|
+
// The reference decoding algorithm in Annex G of ISO/IEC 24724:2011 is distinguishing between DataBarExpanded on one side
|
|
155
|
+
// and all other variants on the other. That seems to contradict the rest of the specification. For details see
|
|
156
|
+
// https://github.com/zxing-cpp/zxing-cpp/issues/935.
|
|
157
|
+
// Turns out the true distinction is to be made as follows:
|
|
158
|
+
// min-even-is-one: DataBarLimited, DataBar outside character
|
|
159
|
+
// min-odd-is-one: DataBarExpanded, DataBar inside character
|
|
160
|
+
bool minOddIsOne = mods == 15 || mods == 17;
|
|
161
|
+
const auto e2e = NormalizedE2EPattern<LEN, LEN - 2>(view, mods, reversed);
|
|
162
|
+
std::array<int, LEN> widths;
|
|
163
|
+
|
|
164
|
+
// derive element widths from normalized edge-to-similar-edge measurements
|
|
165
|
+
int barSum = widths[0] = minOddIsOne ? 8 : 1; // first assume 1st bar is 1 / 8
|
|
166
|
+
for (int i = 0; i < Size(e2e); i++) {
|
|
167
|
+
widths[i + 1] = e2e[i] - widths[i];
|
|
168
|
+
barSum += widths[i + 1];
|
|
169
|
+
}
|
|
170
|
+
widths.back() = mods - barSum; // last even element makes mods modules
|
|
171
|
+
|
|
172
|
+
// int minEven = widths[1];
|
|
173
|
+
// for (int i = 3; i < Size(widths); i += 2)
|
|
174
|
+
// minEven = std::min(minEven, widths[i]);
|
|
175
|
+
OddEven<int> min = {widths[0], widths[1]};
|
|
176
|
+
for (int i = 2; i < Size(widths); i++)
|
|
177
|
+
min[i] = std::min(min[i], widths[i]);
|
|
178
|
+
|
|
179
|
+
if (minOddIsOne && min[0] > 1) {
|
|
180
|
+
// minimum odd width is too big, readjust so minimum odd is 1
|
|
181
|
+
for (int i = 0; i < Size(widths); i += 2) {
|
|
182
|
+
widths[i] -= min[0] - 1;
|
|
183
|
+
widths[i + 1] += min[0] - 1;
|
|
184
|
+
}
|
|
185
|
+
} else if (!minOddIsOne && min[1] > 1) {
|
|
186
|
+
// minimum even width is too big, readjust so minimum even is 1
|
|
187
|
+
for (int i = 0; i < Size(widths); i += 2) {
|
|
188
|
+
widths[i] += min[1] - 1;
|
|
189
|
+
widths[i + 1] -= min[1] - 1;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return widths;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
bool ReadDataCharacterRaw(const PatternView& view, int numModules, bool reversed, Array4I& oddPattern,
|
|
197
|
+
Array4I& evnPattern);
|
|
198
|
+
|
|
199
|
+
int GetValue(ArrayView<int> widths, int maxWidth, bool noNarrow);
|
|
200
|
+
|
|
201
|
+
Position EstimatePosition(const Pair& first, const Pair& last);
|
|
202
|
+
int EstimateLineCount(const Pair& first, const Pair& last);
|
|
203
|
+
|
|
204
|
+
} // namespace ZXing::OneD::DataBar
|