Commit Graph

73 Commits

Author SHA1 Message Date
Even Rouault 73d1510d47 Encoder: fix packet writing of empty sub-bands (#891, #892)
There are situations where, given a tile size, at a resolution level,
there are sub-bands with x0==x1 or y0==y1, that consequently don't have any
valid codeblocks, but the other sub-bands may be non-empty.
Given that we recycle the memory from one tile to another one, those
ghost codeblocks might be non-0 and thus candidate for packet inclusion.
2017-06-12 18:37:50 +02:00
Even Rouault 81c5311758 T1: fix BYPASS/LAZY, TERMALL/RESTART and PTERM/ERTERM encoding modes. (#674)
There were a number of defects regarding when and how the termination of
passes had to done and the computation of their rate.
2017-06-09 10:49:03 +02:00
Even Rouault 563bd8499e Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
Even Rouault a43f1bea62 Remove warnings related to empty tag-trees.
Decoding some valid .jp2 files like Sentinel2 datasets leads to warnings like:
No incltree created.
tgt_create tree->numnodes == 0, no tree created.
No imsbtree created.
tgt_create tree->numnodes == 0, no tree created.

Besides that, the image is correctly decoded. So there is no reason to emit
those warnings.
2017-02-13 12:36:45 +01:00
Even Rouault 48c16b2c19 Merge branch 'master' of https://github.com/uclouvain/openjpeg into tier1_optimizations_multithreading_2
Conflicts:
	src/lib/openjp2/t1.c
2016-09-08 10:30:09 +02:00
Matthieu Darbois e078172b1c Add sanity check for tile coordinates (#823)
Coordinates are casted from OPJ_UINT32 to OPJ_INT32
Add sanity check for negative values and upper bound becoming lower
than lower bound.
See also
https://pdfium.googlesource.com/pdfium/+/b6befb2ed2485a3805cddea86dc7574510178ea9
2016-09-08 00:24:15 +02:00
Matthieu Darbois ea320dab8b Add overflow check in opj_tcd_init_tile (#819) 2016-09-06 07:54:29 +02:00
Even Rouault 57b216bb58 Use thread pool for DWT decoding 2016-05-25 21:02:07 +02:00
Even Rouault 5fbb8b2645 Use thread-pool for T1 decoding 2016-05-25 21:02:07 +02:00
Even Rouault d4b7f03cfa Add opj_codec_set_threads() in public API and propagate resulting thread pool to tcd level
By default, only the main thread is used. If opj_codec_set_threads() is not used,
but the OPJ_NUM_THREADS environment variable is set, its value will be
used to initialize the number of threads. The value can be either an integer
number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called,
this function will override the behaviour of the environment variable.
2016-05-25 21:02:07 +02:00
mayeut 8f9cc62b3f Fix division by zero
Fix uclouvain/openjpeg#733
2016-05-08 18:40:12 +02:00
mayeut cd77b6003b Fix some coverity warnings 2016-04-30 12:15:22 +02:00
julienmalik e982d03966 Fix implicit float-to-bool conversions (#752) 2016-04-28 11:52:45 +02:00
Matthieu Darbois 66fd497765 Fix unsigned int overflow reported by UBSan (#759) 2016-04-28 00:18:37 +02:00
Matthieu Darbois e6881e7527 Fix negative shift left reported by UBSan (#758)
Follow-up of #757

This shall have no performance impact on 2’s complement machine where
the compiler replaces the multiplication by power of two (constant) by
a left shift.
Verified at least on MacOS Xcode 7.3, same assembly generated after fix.
2016-04-27 21:56:09 +02:00
mayeut 8034ffde8b Fix inconsistent behavior of malloc(0)
Update #635
Update #625
2015-10-17 02:55:09 +02:00
mayeut 83249c318f Fixed crash on encoding
Update #624
Update #625
2015-10-17 01:30:23 +02:00
Mathieu Malaterre d753441028 implement a portable aligned realloc 2015-10-10 17:51:29 +02:00
mayeut de0a9ed103 Revert "Make sure to allocate on 16bits alignement. Fix issue #624"
This reverts commit 553714a87a.
2015-10-09 21:13:06 +02:00
Mathieu Malaterre 553714a87a Make sure to allocate on 16bits alignement. Fix issue #624 2015-10-09 15:37:09 +02:00
Matthieu Darbois bac2c9e0a3 Change test in opj_tcd_makelayer
Remove float equality test. Such a test has no meaning.
2015-09-11 14:17:30 +02:00
Matthieu Darbois ee0f313848 Update check in opj_tcd_makelayer to be robust to different float precisions 2015-09-10 15:46:51 +02:00
Matthieu Darbois ccdce606f1 Fix threshold calculation
It doesn't change the outcome of the test suite, that's weird...
2015-09-10 15:10:14 +02:00
mayeut 5f02757eef Correct lossless issue on linux x86
Update uclouvain/openjpeg#571
2015-09-10 00:39:23 +02:00
mayeut 38770403d4 Fix some calculations in opj_tcd_init_tile
Fixes #486
Fixes #394
Update #480
Update #388
2015-08-23 11:38:04 +02:00
mayeut 0df90afdf7 Remove printf/fprintf to stdout/stderr throughout openjp2 lib
Update uclouvain/openjpeg#246
2015-07-30 23:26:31 +02:00
mayeut c423cc84e7 Remove some warnings when building
Update #442
2015-07-26 02:41:39 +02:00
mayeut 9ac3a1572e Prevent overflow when coding 16 bits images
Update uclouvain/openjpeg#539
2015-07-22 00:10:32 +02:00
mayeut ae4799ad07 Add some missing static
Still needs to check j2k.c & jp2.c
Update uclouvain/openjpeg#243
2015-07-18 02:39:32 +02:00
Antonin Descampe 2d24b6000d [trunk] added overflow checks (fixes issue 431)
Thanks mdarbois
2015-02-02 16:11:31 +00:00
Antonin Descampe 5d00b719f4 [trunk] fixed a buffer overflow in opj_tcd_init_decode_tile
Update issue 431
2015-01-15 18:16:29 +00:00
Matthieu Darbois 9a21e1eef0 [trunk] removed warnings when building tcd.c (Update issue 442) 2014-12-15 18:48:50 +00:00
Matthieu Darbois e05d2901ec [trunk] Reduce encoder code block memory usage for non 64x64 code block sizes (fixes issue 444) 2014-12-12 21:54:22 +00:00
Antonin Descampe 8d320bbdf8 [trunk] check number of components when getting mct norm (fixes issue 436) 2014-12-09 12:09:08 +00:00
Matthieu Darbois 548aff34f4 [trunk] added check for tile component data size overflow (fixes issue 432) 2014-11-21 21:35:43 +00:00
Matthieu Darbois ae1da37558 [trunk] replace OPJ_MACRO_TCD_ALLOCATE macro by inlined function (fixes issue 433) 2014-11-19 19:08:09 +00:00
Antonin Descampe c3629e37a2 [trunk] significantly reduces memory for single tile RGB encoding (fixes
issue 375)
2014-11-03 14:51:41 +00:00
Antonin Descampe 3e1fad2da4 [trunk] resets resno_decoded for each tile (fixes issue 399) 2014-10-22 13:16:35 +00:00
Antonin Descampe d72940c56b [trunk] resets code-blocks reused for other tiles than the first one (fixes issue 418) 2014-10-22 13:16:12 +00:00
Antonin Descampe 6868ee373e added memory allocation checks (fixes issue 355) 2014-09-19 10:26:35 +00:00
Antonin Descampe 50a205d20f [trunk] improve memory management (fixes issue 359) 2014-09-16 15:48:04 +00:00
Antonin Descampe 7199d9b5d3 [trunk] refactoring of rsiz, profiles, and extensions management 2014-04-17 09:31:37 +00:00
Antonin Descampe d19a4ab676 [trunk] updated copyright and added copyright notice required by ISO, in each file; updated AUTHORS, NEWS 2014-04-03 15:30:57 +00:00
Mathieu Malaterre 3a80b72ac8 [trunk] Add a temporary work around for issue 293
As described in the bug report the default allocation mecanism for codeblock data is too small for those dataset (16bits). We would need a finer (more granular) mecanism to reallocated only on demand. For now this help the two failing tests to pass.
Fixes issue 293
2014-03-14 10:54:08 +00:00
Mathieu Malaterre 2e7b8fb9a1 [trunk] Another final round of fixes for sign conversion warnings.
Fixes issue 256
2014-03-10 16:43:04 +00:00
Mathieu Malaterre cc1354ebfa [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 14:00:47 +00:00
Mathieu Malaterre 1ef677f264 [trunk] Make sure to reject images such as 1336.pdf.asan.47.376.jp2
Fixes issue 267
2014-03-04 10:32:26 +00:00
Mathieu Malaterre 07193e2a34 [trunk] remove more conversion warning in multi-lines macro.
C allow simple tricks such as to find those:
gcc -E tcd.c | sed '/^\#/d' | indent -st -i2 > clean.c
Update issue 256
2014-03-04 09:58:07 +00:00
Mathieu Malaterre 7185faa857 [trunk] Remove warning about conversion.
Update issue 256
2014-03-04 09:19:49 +00:00
Mathieu Malaterre 2c876b6765 [trunk] Remove simple warnings about comments, missing case in switch statement 2014-03-02 10:16:54 +00:00