Commit Graph

234 Commits

Author SHA1 Message Date
Nick Diego Yamane 557a52b17d QZXingFilter: Enforce captureRect validation
captureRect is accessible and modifyable via QML, so that
it can take arbitrary values, what can make QZXingFilter to crash
the application.

This issue was experienced when running code similar to QZXingLive
example on an android device, where captureRect is bound based on
VideoOutput's contentRect and sourceRect, when QML Engine is
calculating layout for the pages it sets temp values to width/height
of elements (including VideoOutput) what causes captureRect to be
set to invalid values for the QZXingFilter's perspective, such
as negative values for x and y.

Signed-off-by: Nick Diego Yamane <nick.diego@gmail.com>
2017-01-19 03:22:33 -04:00
Nick Diego Yamane 2083f7a805 QZXingFilter: Fix crash when destructing QZXingFilter
QZXingFilterRunnable runs QFuture to perform
decoder::decodeImage() and stores it in a
class var of its owner (QZXingFilter), but
when QZXingFilter is destructed it was not canceling
that QFuture, making possible to the QFuture to try to
access filter->decoder->decodeImage() after filter's
are already destructed (dangling pointer).

Issue detected when using QZXingFilter QML Element in
an Page pushed in a StackView. When the page containing the
QZXingFilter is poped from the StackView, (by default) the
filter is unloaded/destructed, what makes the app crash
without this patch.

Signed-off-by: Nick Diego Yamane <nick.diego@gmail.com>
2017-01-19 03:22:33 -04:00
favoritas37 5627d2fbb5 deallocate instance of QZXing on QZXingFilter destruction. update the initialization list to match the declaration order 2017-01-17 16:35:26 +02:00
favoritas37 eb6bdb41e9 revert propert decoder of QZXingFilter that was mistakenly renamed. Allocate an instance of QZXing at the creation of QZXingFilter 2017-01-17 16:13:42 +02:00
favoritas37 54a7fc9d72 added missing includes for QDebug and QFuture. 2017-01-17 13:40:33 +02:00
favoritas37 1bae498386 properly fix compile issue by forward declaring QZXing in QZXingFilter. Had to make decoder variable as pointer in order to avoid the compiler requirement to known the exact size of the class...that had to be forward declared. Properly addresses issue #16 2017-01-17 13:37:20 +02:00
favoritas37 213c4d684b fixes #16. compilation error due to a forgotten include in QZXing.h 2017-01-17 13:16:36 +02:00
Nikolaos Ftylitakis cbaef5e90f Delete gradle.properties
removed unnecessary file
2017-01-16 20:04:22 +02:00
favoritas37 c48d31f523 removed unecessary file 2017-01-16 20:02:13 +02:00
favoritas37 703d79174d Update main readme file to include the latest changes with the dependency control. Added more info for a quick introduction to the library 2017-01-16 19:58:34 +02:00
favoritas37 75eb47e8c5 fine tune the use of QZXing::registerQMLTypes to include the QZXingFilter. Update QZXingLive with the latest changes 2017-01-16 19:57:25 +02:00
favoritas37 905ee3359a make QZXingLive aware of the Android configuration 2017-01-16 19:54:20 +02:00
favoritas37 ac2d636532 Added initial Android files 2017-01-16 19:52:44 +02:00
favoritas37 a3e71ec1e7 created qzxing_qml and qzxing_multimedia qmake CONFIG tags for QZXing.pri to allow the control of dependencies based on the needs. qzxing_qml enables QML specific parts of the library. qzxing_multimedia enables QZXingFilter which requires Qt's multimedia. 2017-01-15 20:36:41 +02:00
Nikolaos Ftylitakis b1eaeb1960 Merge pull request #13 from KDAB/improved_qzxingfilter
great improvements of QZXing and QZXingLive performance provided by @milianw from KDAB!
QZXingFilter becomes integral part of QZXing library source code.

closes #5
2017-01-14 17:15:31 +02:00
Milian Wolff 594b178501 Make QZXingFilter "official" by moving it out of the example folder
The filter is much more performant than using the QZXing API in an
imparative way for the use-case of live-analyzing video frames in QML.
2017-01-10 13:24:55 +01:00
Milian Wolff 61508f461a Optimize: Return the matrix reference directly instead of copying it.
This removes another copy of frame data, thereby improving the FPS
of the QZXingFilter example noticeably.
2017-01-10 13:17:54 +01:00
Milian Wolff 449a808972 Crop to capture rect directly when converting RGB to grayscale
This improves the performance since we only need to convert the
actually interesting part of the frame, instead of the full frame.
2017-01-10 13:17:54 +01:00
Milian Wolff c882465649 Improve performance of rgb(a) reading, convert directly to greyscale
This again leads to a noticeable performance improvement of the
QZXingFilter example, as we get rid of one full copy of the image
data by converting directly into greyscale, instead of first
converting to RGB and then converting to greyscale.
2017-01-10 13:17:54 +01:00
Milian Wolff 9d378fa2e4 use __builtin_ctz instead of reinventing it in a slower way 2017-01-10 13:17:54 +01:00
Milian Wolff b5e4f06e9f Fix linking on recent Qt for iOS
The qtmn hack is not required anymore.
2017-01-10 13:17:54 +01:00
Milian Wolff 0e10d8aeca Add simple FPS counter to QZXingLive example 2017-01-10 13:17:54 +01:00
Milian Wolff 69e05c1ff1 Add support for NV12 video frames
This was encountered on a recent Android device.
2017-01-10 13:17:54 +01:00
Milian Wolff 75b1a0d355 Further optimize QZXingFilterRunnable::processVideoFrameProbed
Do not call detaching QByteArray::data, use constData instead.
Also hoist some constants out of the inner conversion loops and make
more variables const.
2017-01-10 13:17:54 +01:00
Milian Wolff 3eb5b0b869 Cleanup debug code, save at most 100 images. 2017-01-10 13:17:54 +01:00
Milian Wolff bc2badb5b5 Optimize: reduce memory allocations, convert directly to grayscale
This dramatically improves the performance of the QZXingFilter.
2017-01-10 13:17:54 +01:00
Milian Wolff d112bf4186 Don't try harder by default in the QZXingLive example 2017-01-10 13:17:54 +01:00
Milian Wolff 7937cb84b5 Only try to mirror images when tryHarder is set to true
Additionally, this is only done until a match is found, instead of
always applying mirroring for the 2nd, 3rd and 4th frames.
2017-01-10 13:17:54 +01:00
Milian Wolff cafad4a9c0 Add captureRect functionality
This allows one to only detect within a certain unscaled region
of the input frame. The reduction of pixels scanned leads to
a significant performance win, and the removal of the scaling
improves the quality of the checked image, thereby leading to
higher detection rates.
2017-01-10 13:17:54 +01:00
Milian Wolff a7103d5cac Expand QZXingFilter example code
- allow autofocus and manual focus
- count number of tags matched
- allow configuring the barcode scanner from QML
2017-01-10 13:17:54 +01:00
Milian Wolff eba661a424 Make QZXing's tryHarder, charSet and foundedFormat accessible from QML 2017-01-10 13:17:54 +01:00
Milian Wolff 4c22c65b5e Constify data and put it into the .rodata section 2017-01-10 13:17:54 +01:00
Milian Wolff bb903ca27e Enable all decoders by default
Otherwise this leads to access of uninitialized, when one forgets
to set a custom list of decoders.
2017-01-10 13:17:54 +01:00
Milian Wolff 8cdfdee225 Make test compile on 64bit Linux machines 2017-01-10 13:17:54 +01:00
favoritas37 b68b4c3fed minor edits in QQrDecorder readme file 2016-12-28 15:01:20 +02:00
favoritas37 67eb93253e minor edit in QQrdecoder project readme file. 2016-12-28 14:58:56 +02:00
Nikolaos Ftylitakis db9d8a3441 Update readme.md
Fixed broken relative path to project QZXingLive
2016-12-03 15:57:36 +02:00
favoritas37 79a5396aeb restored folder QQrDecoder to not break external links. Added reference to the updated project. 2016-12-03 15:55:31 +02:00
favoritas37 7ea672e6d1 fixes issues #4 and #9 (dummy commit to add the issue reference to the commit 37ca7a1 ) 2016-12-03 15:46:26 +02:00
favoritas37 d260ac47b2 removed obsoled example project QQrDecoder. Replaced by QZXingLive project 2016-12-03 13:07:45 +02:00
favoritas37 5cd96d1aae Multiple changes in test suite. a) Added tests for ReedSolomonEncoder (current status: failing) b) Added printing of stacktrace upon test missmatch, will work only where supported by backward.hpp code. 2016-12-03 12:48:50 +02:00
favoritas37 588d478b7b updated .gitignore 2016-12-03 12:34:22 +02:00
Nikolaos Ftylitakis 37ca7a13e1 Merge pull request #12 from ChALkeR/patch-2
QZXingFilter: add YUV420P format support
2016-12-03 12:16:01 +02:00
Nikolaos Ftylitakis d2f7748148 Merge pull request #11 from ChALkeR/patch-1
QZXingLive example: remove unused qzxing.h include
2016-12-03 12:15:42 +02:00
Сковорода Никита Андреевич fe1337394e QZXingFilter: add YUV420P format support 2016-12-01 17:22:33 +03:00
Сковорода Никита Андреевич 3adcc83300 QZXingLive example: remove unused qzxing.h include
qzxing.h doesn't exist, and the example works fine without it.
2016-12-01 02:58:00 +03:00
Nikolaos Ftylitakis 46c8ab94f0 Create license.txt
added the license file. The license of the project is the inherited license from zxing project. Apache License 2.0.
2016-11-15 15:28:50 +02:00
favoritas37 9941055ae6 minor refactoring to simplify the code on the construction of ArrayRef instances 2016-10-04 21:08:22 +03:00
favoritas37 505f60c264 fixed the range of the array where the coefficients will be stored at ReedSolomonEncoder 2016-10-04 21:07:39 +03:00
Nikolaos Ftylitakis bd96c910e9 Merge pull request #6 from sergey-platonov/isnan-fix
zxing::isnan for non-msvc compilers was implemented with c99 function,
which is still not fully supported by some compilers (e.g., GCC).
Added an implementation for compilers without c++11 or c99 support. And wrapped
all related code in #if.
2016-10-02 13:55:15 +03:00