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>
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>
This simplifies the code for QZXingFilter (revert it to what it was before)
Also added a global include file, to include all QZXing user classes.
Reverts 5627d2fbb549f24cf85afa51947eda6a5418009e, eb6bdb41e984c8e38ecb60561470748d87cfd813, 1bae4983861d779458642dd08feaf946d876e18d & 213c4d684bdcf143bc0bb4b665dd074d0e29cbd6
great improvements of QZXing and QZXingLive performance provided by @milianw from KDAB!
QZXingFilter becomes integral part of QZXing library source code.
closes#5
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.
Do not call detaching QByteArray::data, use constData instead.
Also hoist some constants out of the inner conversion loops and make
more variables const.
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.