Commit graph

136 commits

Author SHA1 Message Date
Sushrut Shringarputale
ed833132d5 Fix some compile-time issues for better production usability
Fixed up some type coercion and uninitialized variable instances for
better production code usability.
2019-08-20 09:50:39 -07:00
Alexandre Perrin
f700e456b4 define a QUIRC_PIXEL_ALIAS_IMAGE constant to explicit conditional path
Before this patch, the "sizeof dance" was confusing, fix #54.
2019-07-02 09:22:25 +02:00
Daniel Beer
5d71b1853e identify: make otsu() static. 2019-05-02 15:56:35 +12:00
Daniel Beer
0e2dbec426
Merge pull request #55 from claudiofelber/master
Replaced existing threshold function with Otsu threshold algorithm
2019-05-02 15:55:22 +12:00
Claudio Felber
766f79ce7c Use const struct quirc parameter in otsu() function and fix tabs 2019-04-30 18:44:59 +02:00
Claudio Felber
96a5a380fb Remove quirc.row_average and associated code
quirc.row_average was used by the former threshold function and has
become obsolete with the introduction of the Otsu threshold function.
2019-04-30 18:43:57 +02:00
Claudio Felber
97ffaabfb5 Replace existing threshold function with Otsu threshold algorithm 2019-04-30 13:02:11 +02:00
Daniel Beer
307473dbca
Merge pull request #42 from kAworu/master
fix mjpeg_decode_rgb32().
2018-02-01 12:04:11 +13:00
Alexandre Perrin
d283137a60 fix mjpeg_decode_rgb32().
Before this patch the `rgb` pointer was incremented by the "inner" for
loop but never reset to the start of the buffer by the "outer" while
loop.

This bug was introduced by the refactoring in
6158aeb30a.
2018-01-31 15:29:01 +01:00
Daniel Beer
eca042a787 Merge pull request #40 from kAworu/vla-cleanup
Refactoring to remove the use of c99 VLA
2017-06-11 22:30:33 +12:00
Alexandre Perrin
d3780f3e6f Warning comment improvement. 2017-06-11 10:19:31 +02:00
Alexandre Perrin
6158aeb30a mjpeg_decode_rgb32() refactoring.
Use calloc(3) & free(3) instead of c99 VLA.
2017-06-11 10:08:58 +02:00
Alexandre Perrin
90371f36a0 threshold() uses now the row_average member of struct quirc. 2017-06-11 10:08:58 +02:00
Alexandre Perrin
21f6863577 Added a row_average member to struct quirc.
Prep to remove the VLA from threshold()
2017-06-11 10:08:58 +02:00
Daniel Beer
7b26f6e193 Merge pull request #39 from kAworu/quirc_resize.fix
Fix a potential use-after-free on quirc_resize failure.
2017-06-10 14:02:40 +12:00
Alexandre Perrin
971c9d4e8c refactor quirc_resize
So that the given quirc struct is never invalid once we return to the
caller.
2017-06-09 22:12:06 +02:00
Daniel Beer
90e12be081 Merge pull request #38 from kAworu/Wold-style-declaration
Fixes warnings emitted by gcc -Wold-style-declaration
2017-06-08 19:30:05 +12:00
Alexandre Perrin
1f9edb0b84 Fix a potential use-after-free on quirc_resize failure.
Before this patch, in the event of `q->image` reallocation success but
`q->pixels` failure, `q->image` would point to a freed memory.

After this patch, once quirc_resize() returns, `q->image` consistently
point to a memory address that can be freed.

There is still an inconsistency left in the example codepath: `q->{h,w}`
would hold the "old" values, while `q->image` allocated size would be
based in the requested width/height; hence the comment update about the
state of the QR-code recognizer (it should only be passed to
quirc_destroy()).
2017-06-07 19:37:14 +02:00
Alexandre Perrin
a858ec4896 Fixes warnings emitted by gcc -Wold-style-declaration 2017-06-07 10:24:43 +02:00
Daniel Beer
fce4b94bb2 mjpeg: remember to set dinfo.err. 2017-05-31 17:52:55 +12:00
Daniel Beer
ffc2f9b68a dbgutil: fix double-free on error in jpeg_finish_decompress. 2017-05-31 17:52:26 +12:00
Daniel Beer
5174ba77f8 Merge pull request #34 from kAworu/decode_kanji.fix
Fix Kanji decoding.
2017-05-31 08:23:33 +12:00
Alexandre Perrin
2528ea3955 Comment fix
Bad copy-pasta from
http://www.thonky.com/qr-code-tutorial/kanji-mode-encoding
2017-05-30 19:23:42 +02:00
Alexandre Perrin
e16c02e226 Fix Kanji decoding.
Before this patch, Kanji decoding was broken.
2017-05-30 18:52:31 +02:00
Daniel Beer
3c31aa0987 Fix potential leak on allocation failure in quirc_resize(). 2017-05-18 19:29:02 +12:00
Daniel Beer
c4abca0eec Merge pull request #30 from nuxeh/edcragg/fix-last-color-warning
identify: fix warning
2017-05-01 11:13:35 +12:00
Edward Cragg
c50a89276f identify: fix warning
Fix the following warning when compiling with GCC 6:

lib/identify.c: In function ‘quirc_end’:
lib/identify.c:430:6: warning: ‘last_color’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int last_color;
      ^~~~~~~~~~
2017-04-30 10:42:14 +01:00
Daniel Beer
26a182814d Merge pull request #29 from mjbshaw/patch-1
Fix documentation regarding cell_bitmap indexing
2017-04-26 10:28:48 +12:00
Michael Bradshaw
e0a5f5fd3f Fix documentation regarding cell_bitmap indexing 2017-04-25 04:27:17 -07:00
Daniel Beer
84eccbf077 Fix out-of-bounds read in fitness_all(). 2017-03-30 18:05:49 +13:00
Daniel Beer
a5513dc49d Merge pull request #24 from ilgk/gitignore
gitignore: Ignore macOS .DS_Store files.
2017-02-17 10:01:05 +13:00
Daniel Beer
9a299fad73 Merge pull request #25 from ilgk/cpp
quirc.h : Fix C++ function name mangling with extern C.
2017-02-17 09:59:33 +13:00
Philippe Groarke
64a4e58543 quirc.h : Fix C++ function name mangling with extern C. 2017-02-16 14:32:18 -05:00
Philippe Groarke
676d401382 gitignore: Ignore macOS .DS_Store files. 2017-02-16 14:23:24 -05:00
Daniel Beer
59182ef1cd Deinterleave blocks correct.
Use explicit small-block count. Derived value using greedy calculation
wasn't correct in many cases.
2016-12-28 15:37:18 +13:00
Daniel Beer
fccbbce758 version_db.c: fix basic errors. 2016-12-28 14:09:06 +13:00
Daniel Beer
88774dc6cf decode.c: fix count bit-width on alphanumeric payloads. 2016-11-17 11:37:55 +13:00
Daniel Beer
aeb9b88d1a Merge pull request #21 from kAworu/threshold-fix
Avoid division by zero.
2016-10-05 07:48:40 +13:00
Alexandre Perrin
6f0ed74aa2 Comment typo. 2016-10-04 11:13:49 +02:00
Alexandre Perrin
93adbb0b11 Avoid division by zero.
Before this patch, small images (i.e. 7x7 pixels or less) could trigger
SIGFPE because of a (integer) division by zero.
2016-10-04 11:10:55 +02:00
Daniel Beer
87e79e769b Fix Reed-Solomon decoder.
Calculate the correct number of syndromes, and fix calculation of the
error locator polynomial. Many QR codes with logos in the middle should
now work.
2016-09-23 14:34:07 +12:00
Daniel Beer
ab341691c9 Add support for ECI decoding.
ECI values are decoded and stored in the eci field of struct quirc_data.
Constants of the form QUIRC_ECI_* are defined in quirc.h.
2016-09-23 09:50:59 +12:00
Daniel Beer
a8291391ec dbgutil: print unknown data type indicators safely. 2016-09-23 09:40:56 +12:00
Daniel Beer
08fe9f7e0f Fall back to set_strip() on older libpng versions.
Latest Debian release right now packages only 1.2.50.
2016-09-06 08:08:58 +12:00
Daniel Beer
5b26248009 Merge pull request #18 from czarkoff/png
Fix png image handling
2016-08-16 09:36:49 +12:00
Daniel Beer
3ddd39c952 Merge pull request #17 from czarkoff/clock
Consistant typing for test timing variables
2016-08-16 09:35:20 +12:00
Dmitrij D. Czarkoff
8decf20d4f Strip alpha channel from PNG images with tRNS chunk
When PNG transformations are set up, tRNS chunk is converted to alpha channel
early in the process.  Later the decision whether to strip alpha channel or not
is made upon checking (color_type & PNG_COLOR_MASK_ALPHA).  Thus alpha channel
created by tRNS chunk conversion does not get stripped.
2016-08-15 15:39:18 +02:00
Dmitrij D. Czarkoff
2e3e80c1ee Use more accurate bit depth reduction for PNG images 2016-08-15 14:32:17 +02:00
Dmitrij D. Czarkoff
3266bbaf39 Consistant typing for test timing variables 2016-08-15 10:24:01 +02:00
Daniel Beer
b0fc6bfd5f Merge pull request #16 from czarkoff/clock
Use clock_gettime() instead of clock()
2016-08-15 12:26:56 +12:00