Commit Graph

548 Commits

Author SHA1 Message Date
mayeut 8f9cc62b3f Fix division by zero
Fix uclouvain/openjpeg#733
2016-05-08 18:40:12 +02:00
Julien Malik 17a0a8a195 Use lowercase for cmake commands consistenly
Inspired from https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/HowToCreateTheCMakeCaseConversion.txt
This needs vim 7.3 and fails with vim 7.4

This also fixes a number of :
- missing empty line at end of files
- useless space at end of lines
2016-05-02 16:05:41 +02:00
Julien Malik e1e018a8dc Fix UBSan gcc warning for first arg to memset non null 2016-05-02 12:13:24 +02:00
Antonin Descampe 72deb588cb Merge pull request #706 from mayeut/issue135
Fix issue 135
The fix is legal regarding the standard but I did not manage to find out if it covers a bug in opj_t2_read_packet_data or if the file is corrupted
2016-04-30 13:51:01 +02:00
mayeut cd77b6003b Fix some coverity warnings 2016-04-30 12:15:22 +02:00
Matthieu Darbois be42e72d22 Fix warnings (#763) 2016-04-30 01:12:16 +02:00
julienmalik 319fc971fe cppcheck fix for openjp2 (#740) 2016-04-29 23:49:17 +02:00
Matthieu Darbois e166e4a209 Check SSIZ is valid in opj_j2k_read_siz (#762) 2016-04-28 19:20:14 +02:00
Matthieu Darbois 29313eb5f1 Fix unsigned int overflow reported by UBSan (#761)
* Fix unsigned int overflow reported by UBSan

Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with
-fsanitize=undefined,unsigned-integer-overflow

It seems clang/gcc do not allow to disable checking for block of code
other than function or file.
2016-04-28 13:16:43 +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
mayeut 20789fed4e Fix issue 135
dwt_interleave_h.gsr105.jp2 now has the same output as kakadu
issue399 is corrupted. Only the corrupted part changes.

Update known failures for x86 MD5

NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5
2016-04-27 23:15:47 +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
Stefan Weil 2296dc9e68 Remove whitespace and CR at line endings (#678)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-04-26 22:12:11 +02:00
Matthieu Darbois 6f2ac3ee36 Fix negative shift left reported by UBSan (#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-26 22:06:06 +02:00
Matthieu Darbois c559c62853 Do not define __attribute__ in opj_includes.h (#751)
Fix #727
2016-04-23 14:17:31 +02:00
Antonin Descampe e1a93d9e59 Merge pull request #708 from GrokImageCompression/issue_695
issue #695 MQ Encode: ensure that bp pointer never points to uninitialized memory
2016-04-18 10:51:51 +02:00
Julien Malik e7797b97a1 Fix uninitialized variable reported by cppcheck
Also reorder initialization to follow declaration order
2016-04-09 19:02:05 +02:00
Aaron Boxer 0069a2bd2f suppress valgrind error - avoid accessing uninitialized memory in mq encoder 2016-01-30 10:05:46 -05:00
Aaron Boxer e3100f714c issue #695 MQ Encode: ensure that bp pointer never points to uninitialized memory 2016-01-28 19:34:00 -05:00
Antonin Descampe 5c5ae1d51a fixed tile numbering
Fixes #245
2016-01-25 17:30:43 +01:00
Antonin Descampe 3767af52de Merge pull request #648 from stweil/alloc
Fix support of posix_memalloc for Linux
2016-01-23 19:43:09 +01:00
Matthieu Darbois a42d03df79 Merge pull request #551 from mayeut/coc-qcc
Add COC/QCC in main header when needed
2016-01-11 00:23:44 +01:00
Even Rouault 6a1974d40d Add comment explaining bj is not use when l_data_size == 0 2016-01-09 14:30:48 +01:00
Even Rouault 87c0d7dc1e [git/2.1 regression] Fix opj_write_tile() failure when numresolutions=1
When trying the GDAL OpenJPEG driver against openjpeg current master HEAD,
I get failures when trying to create .jp2 files. The driver uses
opj_write_tile() and in some tests numresolutions = 1.

In openjp2/dwt.c:410, l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32);
is called and returns l_data_size = 0. Now in git opj_malloc() has a special case
for 0 to return a NULL pointer whereas previously it relied on system malloc(),
which in my case didn't return NULL.

So only test the pointer value if l_data_size != 0. This makes the GDAL
autotest suite to pass again.
2016-01-08 19:38:45 +01:00
Stefan Weil 9cad6bc1f6 Fix fatal crash on 64 bit Linux
By default, OpenJPEG uses the function memalign to allocate aligned
memory on Linux systems. That function needs malloc.h which was
missing. This results in a compiler warning:

openjpeg/src/lib/openjp2/opj_malloc.c:63:3: warning:
 implicit declaration of function ‘memalign’
 [-Wimplicit-function-declaration]

On hosts where sizeof(int) < sizeof(void *) the return value of memalign
will be truncated which results in an invalid pointer.

That caused "make test" to produce lots of segmentation faults when
running on a 64 bit Linux host.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:09 +01:00
Stefan Weil 79b1c4cc85 Fix whitespace issues in opj_malloc.c
Some lines ended with spaces. Remove them.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 21:40:01 +01:00
Stefan Weil c00ee8bff7 Fix support of posix_memalign for Linux
posix_memalign is only declared conditionally in stdlib.h,
so add one of the possible definitions to get the declaration.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 18:06:45 +01:00
Stefan Weil 99c4f621bd Fix duplicate article in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-01-06 08:55:29 +01:00
Stefan Weil a834ab305f Fix grammar in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-12-31 10:13:26 +01:00
Jakub Wilk 4ddc2627dd Fix typos 2015-11-27 21:38:41 +01:00
mayeut fb4be3894e Fix undefined size jp2 box handling
Update #653
2015-11-07 01:35:43 +01:00
mayeut 38ffbbe42e Fin compiler warnings 2015-11-01 17:08:47 +01:00
Stefan Weil 9f78c68953 Fix typo in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-29 20:37:27 +01:00
mayeut e975ca2832 Merge branch 'master' into coc-qcc 2015-10-21 20:45:50 +02:00
Stephan Mühlstrasser b7a162348d Avoid pointer arithmetic with (void *) pointers. 2015-10-21 09:01:31 +02:00
mayeut d48be27f5a Generic aligned malloc implementation update.
Update #642
2015-10-21 00:09:04 +02:00
Stephan Mühlstrasser eaf55b677c Generic aligned malloc implementation.
Used for platforms where none of posix_memalign(), memalign() and
_aligned_malloc() is available.
2015-10-20 21:34:54 +02:00
Stephan Mühlstrasser a1fc83cc25 Fix HP compiler warning about redeclaration of function (#640)
HP compiler warns:
cc: "dwt.c", line 798: warning 562: Redeclaration of "opj_v4dwt_decode"
with a different storage class specifier: "opj_v4dwt_decode" will have
internal linkage.
cc: "t2.c", line 1341: warning 562: Redeclaration of "opj_t2_init_seg"
with a different storage class specifier: "opj_t2_init_seg" will have
internal linkage.
2015-10-19 12:14:27 +02:00
mayeut 80be580d50 Merge branch 'master' into coc-qcc 2015-10-18 03:23:38 +02:00
Matthieu Darbois 05b3afd28f Merge pull request #636 from uclouvain/opj_malloc-625
Update allocation functions
Fix #625 
Fix #624
Fix #635
2015-10-18 03:14:55 +02:00
mayeut e1122a8f50 Cleanup includes 2015-10-18 02:52:33 +02:00
mayeut f9d47e28b9 Fix _aligned_malloc usage 2015-10-18 02:23:01 +02:00
mayeut 8034ffde8b Fix inconsistent behavior of malloc(0)
Update #635
Update #625
2015-10-17 02:55:09 +02:00
mayeut b3a15954f6 Add missing checks. Fix crash on failed allocation. 2015-10-17 02:16:17 +02:00
mayeut 83249c318f Fixed crash on encoding
Update #624
Update #625
2015-10-17 01:30:23 +02:00
Stephan Mühlstrasser b3c581760f Fix OpenJPEG GitHub issue #633.
"opj_includes.h" must be included before system headers, otherwise
inconsistent definitions of configuration macros lead to build
failures on AIX.
2015-10-15 10:53:33 +02:00
mayeut c8d03fea9b Merge branch 'master' into coc-qcc 2015-10-13 21:57:58 +02:00
Mathieu Malaterre 372fead0d7 Remove the explicit restrict keyword
It would trigger a compiler error on xlc compiler.  Fixes #620
2015-10-13 21:07:11 +02:00
Giuseppe Baruffa 98324bbd6b I do not recall exactly... I would say that the correct version should be
if (!JPWL_ASSUME)
    return false;

meaning that once JPWL_ASSUME=1 the code will pass over such errors and try to decode anyway (just paired with the other JPWL_ASSUME on line 1112).

Fixes #596
2015-10-13 15:20:54 +02:00
Mathieu Malaterre 26dcb7c125 Remove a possible uninitialized variable
Fixes #629
2015-10-12 21:29:12 +02:00
Mathieu Malaterre dd81b5892d minor tweaks to the code 2015-10-12 21:24:10 +02:00
Mathieu Malaterre ab8929262a Fix an issue with parenthesis 2015-10-10 21:03:44 +02:00
Mathieu Malaterre dc869c2985 Add paranoid sentinels 2015-10-10 18:38:08 +02:00
Mathieu Malaterre d753441028 implement a portable aligned realloc 2015-10-10 17:51:29 +02:00
Mathieu Malaterre 2d410fc74b do not use aligned_alloc since it requires c11 2015-10-10 14:54:21 +02:00
Mathieu Malaterre 0dc4914b4e cleanup header file and move to implementation 2015-10-09 22:04:04 +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
mayeut 3259fe2ff8 Merge branch 'master' into coc-qcc 2015-10-08 19:11:52 +02:00
Stephan Mühlstrasser 8414870ca7 Fixed problem that C++ compilation failed because of enum variable.
Replaced usage of an enum typedef for a variable that is used
for bit flags with OPJ_UINT32 type.
2015-10-07 12:28:12 +02:00
mayeut 2dab5fed59 Merge branch 'master' into coc-qcc 2015-10-06 20:55:36 +02:00
Stephan Mühlstrasser d6b51b7041 Added missing casts for return values of opj_malloc()/opj_calloc(). 2015-10-06 15:33:46 +02:00
mayeut db23831d57 Add check for seek support before trying TPsot==TNsot workaround 2015-10-02 22:33:44 +02:00
Stefan Weil 05235963d9 Fix typo in variable name
This makes checks with codespell easier.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-29 05:57:09 +02:00
Stefan Weil 99fc1ab306 Fix typos in comments and string
Most typos were found by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-29 05:55:43 +02:00
mayeut 55dbf8acff Fix resource leak in opj_j2k_create_cstr_index
Fixes #599
2015-09-17 12:46:42 +02:00
mayeut c16c91797f Fix resource leak in opj_j2k_encode
Fixes #598
2015-09-17 12:41:41 +02:00
mayeut a4e93c3b0a fix resource leak in opj_j2k_decode_one_tile
Fixes #597
2015-09-17 12:31:18 +02:00
mayeut 4bb5e24d23 Merge branch 'master' into coc-qcc 2015-09-17 02:12:27 +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 66d890bf22 Merge remote-tracking branch 'uclouvain/master' into coc-qcc 2015-09-08 22:33:07 +02:00
mayeut 940100c28a Fix potential use-after-free in opj_j2k_write_mco function
Fixes #563
2015-09-06 17:24:03 +02:00
mayeut c5dd6035c9 Correct CMake version requirements
Update uclouvain/openjpeg#488
2015-09-01 20:43:43 +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 fa9142b7e4 Fix formatting 2015-08-21 20:15:50 +02:00
Matthieu Darbois 3109759fd7 Merge pull request #559 from szukw000/cmyk-cielab-esycc
Add support for CIELab, EYCC and CMYK
2015-08-21 19:48:31 +02:00
szukw000 238f4419ab Defines three new functions
Declares three new functions
Calls the three new functions
Collects data for CIELab, sets the color_space for EYCC and CMYK
2015-07-30 23:31:12 +00:00
mayeut 60301842c7 Sync coc-qcc branch with master 2015-07-31 01:07:14 +02:00
ak-dxdy 4fc1073809 French comments replaced by English ones 2015-07-31 00:51:08 +02:00
Matthieu Darbois 7c688c3453 Merge pull request #558 from mayeut/remove-printf
Remove printf/fprintf to stdout/stderr throughout openjp2 lib
2015-07-30 23:37:20 +02:00
mayeut 372c887aad Fix typo (that brakes building with '-DBUILD_MJ2:bool=on')
Fixes #556
2015-07-30 23:34:12 +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
Rex Dieter e4735c703d better -ffast-math handling
issue #488

See also
http://public.kitware.com/pipermail/cmake/2015-April/060479.html
2015-07-30 09:54:07 -05:00
mayeut c3d9719cd4 Write COC/QCC in Main Header
Update uclouvain/openjpeg#459
2015-07-29 00:29:49 +02:00
mayeut 2263b6bacc Start support for qcc/coc 2015-07-28 23:58:10 +02:00
mayeut b0035538af Use __emul under msvc x86 for fast 64 = 32 * 32
Update uclouvain/openjpeg#220
2015-07-27 20:12:48 +02:00
mayeut 45ccf501f0 Fix ARM build with Visual Studio 2015-07-26 21:12:36 +02:00
mayeut c423cc84e7 Remove some warnings when building
Update #442
2015-07-26 02:41:39 +02:00
Matthieu Darbois 8c4afeff40 Merge pull request #521 from manisandro/bigendian
Fix opj_write_bytes_BE
Fixes #472 
Fixes #345 
Fixes #518
2015-07-25 15:54:26 +02:00
mayeut b190a91ab5 Remove some warnings when building
Update #442
2015-07-24 23:55:45 +02:00
mayeut a56819eaab Add some missing static keywords
Update uclouvain/openjpeg#243
2015-07-23 07:48:42 +02:00
mayeut 9ac3a1572e Prevent overflow when coding 16 bits images
Update uclouvain/openjpeg#539
2015-07-22 00:10:32 +02:00
Matthieu Darbois 28c6f54798 Merge pull request #533 from mayeut/refactor-read-ppX
Refactor opj_j2k_read_ppm & opj_j2k_read_ppt
Fixes uclouvain/openjpeg#470
Fixes uclouvain/openjpeg#288
Fixes uclouvain/openjpeg#532
2015-07-21 01:26:02 +02:00
mayeut 1bbb607069 Merge remote-tracking branch 'uclouvain/master' into issue-235 2015-07-21 00:20:05 +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
mayeut b88025b38f Add headers to CMake target 2015-07-18 01:50:17 +02:00