Compare commits

..

244 Commits

Author SHA1 Message Date
Mathieu Malaterre
bb230d0b6b [1.5] Add detail for SOVERSION. Increase VERSION number. 2012-09-13 07:58:05 +00:00
Mathieu Malaterre
5be29a0c5a [1.5] Add CHANGES file 2012-09-13 07:54:04 +00:00
Mathieu Malaterre
b953d10ee9 [1.5] Tag the new stable 1.5.1 OpenJPEG release 2012-09-13 07:52:49 +00:00
Mathieu Malaterre
20f9f96719 [1.5] update NEWS file 2012-09-10 11:28:38 +00:00
Mathieu Malaterre
4776f48477 [1.5] Fix Heap-based buffer-overflow when decoding openjpeg image
Thanks to Huzaifa Sidhpurwala of Red Hat Security Response Team for dataset to reproduce the issue.
Fixes issue 170
2012-09-10 11:16:55 +00:00
Mathieu Malaterre
c2f32bb485 [1.5] Fix issue with str_length not being used. Rewrite code to prefer use of vsnprintf to prevent potential buffer overflow. 2012-09-10 09:54:40 +00:00
Mathieu Malaterre
bba708462d [1.5] remove extra trailing semicolon 2012-09-10 09:28:48 +00:00
Mathieu Malaterre
4935eaf773 [1.5] COMP: Fix warnings identified by clang31
openjpeg/libopenjpeg/tcd.c:1884 col 48: warning: comparison of unsigned expressi
on < 0 is always false

openjpeg/applications/codec/j2k_dump.c:362 col 29: warning: equality comparison
with extraneous parentheses

openjpeg/libopenjpeg/jpwl/jpwl_lib.c:680:19: warning: format specifies type 'int
' but the argument has type 'long long' [-Wformat]
    printf("Marker@%d: %X\n", cio_tell(cio) - 2, id);
                   ~^         ~~~~~~~~~~~~~~~~~
                   %lld

openjpeg/applications/jpip/libopenjpip/byte_manager.c:58:63: warning: format spe
cifies type 'long' but the argument has type 'OPJ_OFF_T' (aka 'long long') [-Wfo
rmat]
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %lu)\n", fd, offset
, size);

Author: Hans Johnson <hans-johnson@uiowa.edu>
2012-08-24 08:13:17 +00:00
Mathieu Malaterre
bad9a71e77 [1.5] Import portion of patch from Alex Zimnitsky to fix compilation on FreeBSD 2012-07-29 15:21:39 +00:00
Mathieu Malaterre
a74a41b932 [1.5] Fix compilation issue with Compiler Borland C++ v. 5.5
Fixes issue 154
2012-07-11 15:07:05 +00:00
Mathieu Malaterre
6b5bbc2645 [1.5] Fix r1727 (Issue 156) to compile on compilers where false is not defined. 2012-07-11 15:00:55 +00:00
Mathieu Malaterre
8b5f815925 [1.5] This fixes issues seen on PDF files
Fixes issue 156
2012-07-11 14:54:48 +00:00
Mathieu Malaterre
abce31e706 [1.5] Fix heap buffer overflow
Enforce sanity checks on tile number and tile length, even when the (rather
broken) USE_JPWL code isn't enabled.
2012-07-10 13:08:08 +00:00
Mathieu Malaterre
8062f74deb [1.5] jp2_read_boxhdr() call ignores return value
Fixes issue 91
2012-05-29 17:49:11 +00:00
Mathieu Malaterre
b8fecbbc99 [1.5] Make sure openjpeg/mj2 can be compiled with gcc -std=c89 2012-05-29 17:42:17 +00:00
Mathieu Malaterre
cd8896968d [1.5] This commit hides symptoms of CVE-2009-5030
As explained in issue 5, comment 1. This is an easy fix to avoid memory overrun.
Update issue 5
Update issue 62
2012-05-29 17:21:05 +00:00
Mathieu Malaterre
b94bc0dbe2 [1.5] Applying old patch from r1642, with further modification from winfried. Also enable failing test. Everything seems to be working well now.
Fixes issue 150
2012-05-29 16:21:46 +00:00
Mathieu Malaterre
083d4c2361 [1.5] Import r1669 from trunk over to 1.5 branch 2012-05-29 14:57:25 +00:00
Mathieu Malaterre
6c5a066b20 [1.5] Apply private patch from Alex Macfarlane Smith
This gets rids of a lot memory leaks when used on device with low memory
2012-05-29 14:52:45 +00:00
Mathieu Malaterre
835bf5357f [1.5] The two files in Issue145 have a precision < 8-bit:
therefore 'jp2_read_pclr' must be changed.

j2k_to_image fails to create RGB/RGBA images with a
precision < 8-bit: therefore 'imagetopng' must be
changed.
Update issue 145
2012-05-29 13:54:21 +00:00
Mathieu Malaterre
8a279881d4 [1.5] Fix autotools installation. Thanks to winfried for patch.
Update issue 149
2012-05-29 13:41:54 +00:00
Mathieu Malaterre
6da56bb11a [1.5] Fix compilation on FreeBSD. Thanks to rafael carre (funman@videolan.org) for patch.
Fixes issue 111
2012-05-29 10:19:45 +00:00
Mathieu Malaterre
8cd13f3a55 [1.5] Build fails on AIX
Fixes issue 139
2012-05-21 10:34:35 +00:00
Mathieu Malaterre
eeca4a220c [1.5] Man page syntax fixes. Thanks to vskytta for patch.
Fixes issue 147
2012-05-21 09:25:39 +00:00
Mathieu Malaterre
e17dcf58c9 [1.5] fix compilation warning about lrintf being implicit.
Fixes issue 144
2012-05-21 09:23:06 +00:00
Mathieu Malaterre
39ac7c479f [1.5] Revert r1642, as explained on https://groups.google.com/group/openjpeg/msg/77a67fef94a0309b 2012-04-23 19:26:19 +00:00
Mathieu Malaterre
401e9cbb5c [1.5] Adding test suite for file409752.jp2 2012-04-23 14:01:33 +00:00
Mathieu Malaterre
5dbf771bb9 [1.5] Make it easier to find /data from within 1.5 sub-branch 2012-04-23 14:00:36 +00:00
Mathieu Malaterre
ce9d5083ef [1.5] Integrate patch from winfried posted on the mailing list. See here for more info: https://groups.google.com/group/openjpeg/msg/6488859a0dce77 2012-04-23 13:35:01 +00:00
Mathieu Malaterre
baa7e32f9c [1.5] Integrate patch from winfried posted on the mailing list. See here for more info: https://groups.google.com/group/openjpeg/msg/1bbf7ae7ddee3a51 2012-04-23 13:31:29 +00:00
Mathieu Malaterre
097496a9f0 [1.5] Integrate patch from winfried posted on the mailing list. See here for more info: https://groups.google.com/group/openjpeg/msg/7e30b6e288ad5908 2012-04-23 13:23:38 +00:00
Mathieu Malaterre
6b649f3bf6 [1.5] Need to compile/install tool to embed XML file in JP2 for jpip server 2012-04-20 11:15:48 +00:00
Mathieu Malaterre
65f8ae765e [1.5] jar files are arch independant. We can install them safely in share 2012-04-19 12:40:28 +00:00
Mathieu Malaterre
3aba3e203b [1.5] Add install rules for openjpip client 2012-04-19 12:30:30 +00:00
Mathieu Malaterre
95cf10e979 [1.5] Add missing symbols from getopt into the java glue lib 2012-04-19 10:59:41 +00:00
Mathieu Malaterre
3a643798bd [1.5] resolve missing symbols from convert.c/index.c 2012-04-19 10:57:03 +00:00
Mathieu Malaterre
875591f664 [1.5] Add explicit linking from glue java lib to real openjpeg lib 2012-04-19 10:53:04 +00:00
Mathieu Malaterre
4e8aea6b5a [1.5] install java module 2012-04-19 10:37:31 +00:00
Mathieu Malaterre
5379ec5715 [1.5] Fix computation of relative path from include/ to lib/ 2012-04-19 10:26:48 +00:00
Mathieu Malaterre
b431cb0a41 [1.5] fix compilation warnings on windows box 2012-04-18 14:15:10 +00:00
Mathieu Malaterre
dfbab28b4d [1.5] debian tools detected a missing link to math lib 2012-04-16 13:16:16 +00:00
Mathieu Malaterre
3819c1b5f4 [1.5] Adding some simple unit tests 2012-04-06 13:07:01 +00:00
Mathieu Malaterre
b09cd38b08 [1.5] introduce fix for the SOVERSION regression introduced in 1.5.0 2012-04-05 13:28:54 +00:00
Mathieu Malaterre
da453218a4 [1.5] Remove a simple warning report 2012-03-16 16:43:24 +00:00
Mathieu Malaterre
e0795464c1 [1.5] I think == was meant here. 2012-03-16 16:38:46 +00:00
Mathieu Malaterre
fab8de59d3 [1.5] Remove a warning about undefined snprintf on windows compiler. 2012-03-02 17:13:59 +00:00
Mathieu Malaterre
dcf78f14f6 [1.5] Change the logic in byte_manager.h. Prefer the use of stdint.h when available. Default to compiler specific mecanism otherwise. Remove some c++ comments. Fix signed vs unsigned comparison 2012-03-02 16:51:10 +00:00
Mathieu Malaterre
d1a1653f2a [1.5] Finish import of r963 2012-03-02 15:21:29 +00:00
Mathieu Malaterre
5a817eba3d [1.5] merge r963 from trunk over to branch 1.5 2012-03-02 15:19:44 +00:00
Mathieu Malaterre
ce5bbefff0 [1.5] Convert from DOS eol to UNIX eol 2012-03-02 15:11:45 +00:00
Mathieu Malaterre
a5d96e54b9 [1.5] Set from DOS eol to UNIX eol 2012-03-02 14:34:13 +00:00
Mathieu Malaterre
2dddf54f8b [1.5] Sync with trunk and remove uneeded include headers 2012-03-02 14:14:07 +00:00
Mathieu Malaterre
992409c00c [1.5] Import rev 1053 from trunk over to 1.5 2012-03-02 13:56:45 +00:00
Mathieu Malaterre
ee9c46d350 [1.5] Fix typo in date. 2012-03-02 13:47:00 +00:00
Mathieu Malaterre
87a1081f7c [1.5] Sync with trunk. Remove remainings bits of old Makefile based build system 2012-03-02 10:27:51 +00:00
Mathieu Malaterre
83332e13ad [1.5] Convert from DOS eol to UNIX eol 2012-03-02 09:50:30 +00:00
Mathieu Malaterre
675f34fabd [1.5] Use UNIX eol for source code 2012-03-02 09:33:50 +00:00
Mathieu Malaterre
0c7b21c46f [1.5] Sync with trunk. 2012-03-02 09:27:24 +00:00
Mathieu Malaterre
590ba6d460 [1.5] As discussed on the mailing list. OpenJPEG should be compatible with Multi-Arch distros. Thanks to Rex for report 2012-03-02 09:05:09 +00:00
Mathieu Malaterre
6f314ae48e [1.5] Fix a bunch of comparison between signed and unsigned integer expressions. Some are still left to decide. 2012-03-02 08:44:04 +00:00
Mathieu Malaterre
24ab49a363 [1.5] Fix rev 1474, typo in the spelling. 2012-03-01 20:58:29 +00:00
Mathieu Malaterre
ecb36f02c8 [1.5] Fix a warning about comparison of ulong >= 0. Thanks to winfried for report. 2012-03-01 16:55:54 +00:00
Mathieu Malaterre
8c9fd1b351 [1.5] Apply big-endian patch from winfried: libopenjpeg and WORDS_BIGENDIAN, 2012/02/14 2012-03-01 16:10:27 +00:00
Mathieu Malaterre
dd999a2840 Fix a warning reported on the continuous dashboard for linux. 2012-03-01 16:01:47 +00:00
Mathieu Malaterre
b3b2ee0925 [1.5] j2k_to_image does not support writing image with precision less than 8bits. Simply give up for now. Thanks to winfried for report. Also add static keyword for undeclared function in convert.h 2012-03-01 15:52:30 +00:00
Mathieu Malaterre
58cfcaff9f [1.5] Fix a warning about conversion from const char* to char* 2012-03-01 15:39:44 +00:00
Mathieu Malaterre
c1c2d24b16 [1.5] cmake recommends the use of fullpath. Thanks to winfried for report. 2012-03-01 15:30:49 +00:00
Mathieu Malaterre
cefa643823 [1.5] Fix JPWL's DLL installation. Thanks to winfried for report. 2012-03-01 15:08:18 +00:00
Kaori Hagihara
64e37e2a66 [1.5][JPIP] README modification regarding the JP2 encoding 2012-02-29 10:22:49 +00:00
Rex Dieter
545680cdb4 allow finer-grain control of header location via OPENJPEG_INSTALL_INCLUDE_DIR 2012-02-28 17:52:33 +00:00
Rex Dieter
23cab09e07 fix assumptions that OPENJPEG_INSTALL_*_DIR aren't relative paths 2012-02-28 17:44:49 +00:00
Kaori Hagihara
8336ace29a [1.5][JPIP] enabled the opj_server to reply the first query consisting with len request from kakadu client 2012-02-28 11:15:11 +00:00
Rex Dieter
a794ee233d fix pkgconfig to include -I/usr/include/openjpeg-1.5 in cflags (issue #118) 2012-02-23 14:19:02 +00:00
Mathieu Malaterre
a39e4a2a82 [1.5] allow mecanism to provide JFLAGS 2012-02-17 11:33:31 +00:00
Mathieu Malaterre
b267239603 only install CHANGES when present 2012-02-16 08:09:51 +00:00
Mathieu Malaterre
54e4e8f809 remove a warning about unused variable 2012-02-16 08:07:34 +00:00
Mathieu Malaterre
8fc06de0c5 Hide some warnings generated by 3rd party libs 2012-02-14 11:59:41 +00:00
Mathieu Malaterre
9a5ab44e35 Make the code C90 compliant for VS2010 2012-02-14 11:54:10 +00:00
Mathieu Malaterre
4d76145884 Work around issue with FindJava module 2012-02-14 11:46:53 +00:00
Mathieu Malaterre
bdf1343f62 Use C style comment. 2012-02-13 13:40:55 +00:00
Mathieu Malaterre
52f5452d4d [1.5] Need to include unistd for close() declaration 2012-02-13 13:18:58 +00:00
Mathieu Malaterre
a9b7c7b0b4 By default, openjpip client can still built even without java compiler. Print a message to the user as warning. 2012-02-13 11:41:31 +00:00
Mathieu Malaterre
07521a5dc2 [1.5] Fix typo in CMAKE_USE_PTHREADS vs CMAKE_USE_PTHREADS_INIT 2012-02-13 11:37:38 +00:00
Mathieu Malaterre
d1bb3ed1f2 [1.5] Backport diff from trunk 2012-02-13 11:16:38 +00:00
Mathieu Malaterre
6c6cd79820 [1.5] Remove use of custom PTHREAD module. Prefer cmake's one. 2012-02-13 11:09:30 +00:00
Kaori Hagihara
7b6ae8810d [1.5][JPIP] added execution argument to set port number for opj_dec_server, opj_viewer* 2012-02-10 12:05:51 +00:00
Kaori Hagihara
699f172e6c [1.5][JPIP] fixed Doxygen configuration file to document the utilities 2012-02-10 12:00:03 +00:00
Antonin Descampe
5fbf79e730 [1.5] revert r1399 and r1400 2012-02-10 10:01:43 +00:00
Antonin Descampe
aa28216f9b [1.5] fixed an error in autotools that prevented the build because no CHANGES file anymore 2012-02-10 09:27:08 +00:00
Rex Dieter
e449cb706f make OpenJPEGConfig.cmake provide useful (non-empty) values 2012-02-10 01:26:11 +00:00
Rex Dieter
a85c5151ce make openjpeg.h header symlink to match autotools 2012-02-10 01:25:03 +00:00
Rex Dieter
ed58a22d2e install cmake/pkgconfig bits in LIB_DIR 2012-02-10 01:23:39 +00:00
Antonin Descampe
3408787101 update OpenJPEGCPack.cmake with correct package names 2012-02-07 22:10:09 +00:00
Antonin Descampe
948dfd50c0 [1.5] delete CHANGES file as it will now be automatically generated when releasing the code 2012-02-07 10:34:38 +00:00
Antonin Descampe
46da9f2294 [1.5] revert build documentation behaviour in cmake 2012-02-07 08:08:58 +00:00
Antonin Descampe
995b145f09 [1.5] fixes documentation generation with doxygen 2012-02-06 22:51:07 +00:00
Mathieu Malaterre
451a41064e Make opj 1.5 use port 50000, which is not compatible with trunk. But compatible with itself. 2012-02-06 15:32:59 +00:00
Mathieu Malaterre
c6b02b10fe Re-build the jar files from the source code. 2012-02-06 15:00:04 +00:00
Mathieu Malaterre
36b66a8796 For some reason rev 1103 change the default port number, which breaks openjpip documentation. Revert back to port 5000 2012-02-06 14:11:01 +00:00
Mathieu Malaterre
f1e441596e Fix doc generation 2012-02-06 09:50:16 +00:00
Antonin Descampe
d5fa5605c4 [1.5] update version in configure.ac and NEWS, README, LICENSE files 2012-02-06 09:38:59 +00:00
Mathieu Malaterre
427b2427d4 revert (svn merge -c -1368 ). It does break compilation on windows 2012-02-01 21:45:12 +00:00
Vincent Torri
09522e65af revert commit 1357, it could break linkage 2012-01-31 18:10:20 +00:00
Mathieu Malaterre
19cfaac52e c-string are not writable 2012-01-30 10:33:07 +00:00
Mathieu Malaterre
21c38214ef Fix doc target in cmake 2012-01-30 10:20:22 +00:00
Mathieu Malaterre
577fdbc8a5 Fix for strncasecmp 2012-01-30 09:56:56 +00:00
Mathieu Malaterre
f93aed8031 Fix compilation with close and such 2012-01-30 09:55:05 +00:00
Mathieu Malaterre
326c58b4e1 Remove unistd.h from win32 compilation 2012-01-30 09:51:32 +00:00
Mathieu Malaterre
ec0c69af7a Another fix for snprintf 2012-01-30 09:48:48 +00:00
Mathieu Malaterre
21509a3955 isblank is C99, not isspace 2012-01-30 09:46:36 +00:00
Mathieu Malaterre
5b2ca9caf6 isblank is C99, not isspace 2012-01-30 09:43:10 +00:00
Mathieu Malaterre
529006f136 strncasecmp is C99 2012-01-30 09:37:39 +00:00
Mathieu Malaterre
7d96e7c1c0 declarations after statement (C90) 2012-01-30 09:34:48 +00:00
Mathieu Malaterre
e2948acd92 As explained in the documentation cant be included multiple times. 2012-01-30 09:32:32 +00:00
Mathieu Malaterre
6dc8635e28 Fix snprintf for M$ compilers 2012-01-30 09:29:48 +00:00
Mathieu Malaterre
7d0a419c87 fix declarations 2012-01-30 09:27:35 +00:00
Mathieu Malaterre
0ea0e8b915 declarations after statement (C90) 2012-01-30 09:22:25 +00:00
Mathieu Malaterre
8e53bad7fb Another pass at getting this code to compile on windows 2012-01-30 09:17:57 +00:00
Mathieu Malaterre
9c51a37dbf track all declarations after statement for C90 compilers (VS2005) 2012-01-30 09:08:45 +00:00
Mathieu Malaterre
aa00142949 Fix compilation of C code. Remove warnings. 2012-01-30 08:57:26 +00:00
Mathieu Malaterre
87b05f2885 Fix a couple of warnings 2012-01-30 08:54:42 +00:00
Mathieu Malaterre
baf01b98fd trying to track issue with msgqueue_manager on win32. Use C-style comments 2012-01-30 08:44:05 +00:00
Mathieu Malaterre
6dd7da0e05 Remove unistd.h include 2012-01-30 08:22:24 +00:00
Mathieu Malaterre
4949b593be Remove include of unistd.h. non-existant on win32 2012-01-30 08:17:43 +00:00
Mathieu Malaterre
0ed7aa7c1b missing ws2_32 linking 2012-01-28 15:32:28 +00:00
Vincent Torri
02b906f6ad [1.5] Add zlib check when checking libpng 2012-01-28 10:46:42 +00:00
Vincent Torri
6a03e3a438 [1.5] missing change in a previous commit, no need for an entry in CHANGES 2012-01-27 17:55:06 +00:00
Antonin Descampe
ec33653961 [1.5] fix configure.ac to comply with recent change of PThread dependency 2012-01-26 16:02:08 +00:00
Antonin Descampe
133426ddfe [1.5] remove pthread dependency from jpip client utilities 2012-01-26 15:02:58 +00:00
Vincent Torri
aab317eb8c fix libopenjpip link on Windows 2012-01-25 20:56:07 +00:00
Vincent Torri
f3f86e1eb7 follow latest JPIP changes in the autotools side (pthread dependency, conditional compilation of JPIP server and client) 2012-01-25 19:52:18 +00:00
Antonin Descampe
040c9a68b6 [1.5] remove pthread dependency in JPIP client and tweak thirdparty stuff 2012-01-25 16:30:03 +00:00
Mathieu Malaterre
2b746a71cb Refactor code to split jpip client code from server side. 2012-01-25 09:42:00 +00:00
Antonin Descampe
ba01e855a3 [1.5] fix issue #104 2012-01-23 08:22:23 +00:00
Mathieu Malaterre
d3c1a49246 Remove icns, not required for cpack PackageManager. 2012-01-20 16:14:06 +00:00
Mathieu Malaterre
85bbc6def8 Make r1330 more robust. Display more info. 2012-01-20 14:48:07 +00:00
Mathieu Malaterre
5bd5d894eb Fix: MSVR-11-117 - Vulnerability Report. 2012-01-20 14:43:49 +00:00
Mathieu Malaterre
452403d393 Build conditionally the java binding 2012-01-20 14:08:59 +00:00
Mathieu Malaterre
fc268dff90 remove warnings about const string 2012-01-20 11:20:51 +00:00
Mathieu Malaterre
180dd26df1 Prefer share location over lib one. 2012-01-20 11:05:11 +00:00
Mathieu Malaterre
d27bc19d71 Remove warnings related to 3rd party lib 2012-01-20 10:59:10 +00:00
Mathieu Malaterre
b7b72bbf97 BUG: 4 Apply patch from stefan. 2012-01-11 19:14:50 +00:00
Mathieu Malaterre
e1340fe087 BUG: 26 Fix issue with memory consumption. 2012-01-11 19:03:22 +00:00
Mathieu Malaterre
32e80bc4a7 Fixing the PackageMaker generator 2012-01-11 16:18:26 +00:00
Mathieu Malaterre
8d18c77a7d Add the fno-common flag to work around an issue with ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option 2012-01-11 13:54:11 +00:00
Mathieu Malaterre
f492f0a3d6 Redo the BUILD_THIRDPARTY properly. Remove openjpeg.h symlink. 2012-01-11 13:17:15 +00:00
Mathieu Malaterre
6b43ba091e Fix full path to icns file 2012-01-11 12:46:23 +00:00
Antonin Descampe
5dfadb2eb1 add opj_logo.icns for trunk and 1.5 2012-01-11 12:19:18 +00:00
Mathieu Malaterre
30944454de Add missing plist file 2012-01-11 11:38:39 +00:00
Mathieu Malaterre
0e7529c272 Start playing with bundle generator 2012-01-11 10:18:07 +00:00
Mathieu Malaterre
c9986d1b78 Adding explicitely the new test 2012-01-11 09:04:44 +00:00
Vincent Torri
4bc00a40ca ignore++ 2012-01-01 09:08:01 +00:00
Mathieu Malaterre
80f69364b0 Fix for static libs 2011-12-28 20:10:44 +00:00
Mathieu Malaterre
2e3900780d Install lib in /lib and dll in /bin 2011-12-28 20:09:14 +00:00
Mathieu Malaterre
d530d35024 Do not warn for VCExpress build 2011-12-28 18:07:22 +00:00
Mathieu Malaterre
e96f7a5f50 Remove proprietary stuff from Sun. 2011-12-28 14:43:41 +00:00
Mathieu Malaterre
79ce6ccce5 remove symbolink links 2011-12-28 14:41:41 +00:00
Mathieu Malaterre
b7e489c901 Remove binary jar from source dist. 2011-12-28 14:37:03 +00:00
Mathieu Malaterre
dbd60c1469 Add a dummy test for JPIP 2011-12-27 18:00:04 +00:00
Kaori Hagihara
007409e2af [1.5][JPIP] additional modification for the warning 2011-12-24 13:21:25 +00:00
Mathieu Malaterre
b82b6cbd05 Apply another patch from Kaori, about return value from write/fwrite. Thanks 2011-12-23 08:30:36 +00:00
Mathieu Malaterre
f26b96dd5c Apply patch from Kaori. Thanks. 2011-12-23 08:29:09 +00:00
Mathieu Malaterre
7e6c287d78 Another round of universal fixes 2011-12-21 15:21:53 +00:00
Mathieu Malaterre
6b1e9d1b4e Attempt to fix building of universal exe 2011-12-21 15:19:46 +00:00
Mathieu Malaterre
d88dfc3472 Need to include this file back 2011-12-21 14:46:37 +00:00
Mathieu Malaterre
64f08e216b Remove old module which does not support universal binary 2011-12-21 14:43:16 +00:00
Mathieu Malaterre
c9ae2a5fbc hopefully fix a warning on VS2008 compiler 2011-12-21 10:24:59 +00:00
Mathieu Malaterre
51ae8b7926 minor doc tweak 2011-12-21 10:19:36 +00:00
Mathieu Malaterre
3280dc344f Make sure to append the compile def 2011-12-21 09:53:08 +00:00
Mathieu Malaterre
0b7e0166a7 pc files are for UNIX. 2011-12-21 09:33:51 +00:00
Mathieu Malaterre
5fe8eed4da Remove old visual studio files 2011-12-21 09:30:55 +00:00
Mathieu Malaterre
9d4d3b2cd0 Remove exe bit 2011-12-20 18:38:08 +00:00
Mathieu Malaterre
02d9f43802 Reactivate the opjviewer in cmake 2011-12-20 18:33:45 +00:00
Mathieu Malaterre
00b479cb79 Fix test NR-ENC-Bretagne2.ppm-4-encode on linux. 2011-12-20 17:49:12 +00:00
Mathieu Malaterre
6219ad32b0 Import patch from winfried on mailing list: patch for mj2.c in branch 2011-12-20 17:14:55 +00:00
Mathieu Malaterre
a3a161660a Fix strange line, as reported by lockalsash (gmail.com) 2011-12-20 17:10:30 +00:00
Mathieu Malaterre
2643f79069 Another set of change to remove warnings about c style comments 2011-12-16 11:26:26 +00:00
Mathieu Malaterre
fba8f701c4 Import change from trunk to be able to generate dists. 2011-12-16 11:00:30 +00:00
Mathieu Malaterre
4bcd3a1e42 Fix a warning on MacOSX 2011-12-16 10:44:53 +00:00
Mathieu Malaterre
594148ae83 Hide a warning. Since 1.5 is not large file safe (>32bits) this should be ok 2011-12-16 10:43:10 +00:00
Mathieu Malaterre
2a2f169b27 Remove warning about unused args 2011-12-16 10:40:14 +00:00
Mathieu Malaterre
e576aa9f06 Reorder static inline when extension is found (GNU) 2011-12-16 10:38:18 +00:00
Mathieu Malaterre
c469e1339f Remove some simple warnings about comments 2011-12-16 10:29:30 +00:00
Mathieu Malaterre
abf9809c22 Remove warning about GNU void* extension 2011-12-16 10:18:12 +00:00
Mathieu Malaterre
3ebdd674d8 Fix warning about no newline at end of file 2011-12-16 10:05:06 +00:00
Mathieu Malaterre
a13abdaf65 Sync with trunk 2011-12-12 09:42:44 +00:00
Mathieu Malaterre
72867bc692 Fix a bunch of warnings reported by gcc (unused results from fwrite) 2011-12-12 08:55:44 +00:00
Mathieu Malaterre
b081ff2813 Missing part of import of rev 1148. 2011-12-09 09:22:27 +00:00
Mathieu Malaterre
9d1bd03be4 Import rev 1148 from trunk. 2011-12-08 11:06:53 +00:00
Mathieu Malaterre
82e539d333 Remove more warnings 2011-12-08 09:25:25 +00:00
Mathieu Malaterre
548a49bb7f Remove warnings seen on the dashboard 2011-12-08 09:09:59 +00:00
Mickael Savinaud
dc9a8b03aa [1.5] deactivate tests about class0 files with number of components greater to 1 2011-12-07 08:59:35 +00:00
Kaori Hagihara
c6e0b71633 [1.5][JPIP] TCP return (http-tcp) implemented 2011-11-30 14:54:41 +00:00
Vincent Torri
0c350f4908 fix compilation of libopenjpip (libcurl dependency) with CMake. Credit to Winfried. 2011-11-19 07:16:14 +00:00
Kaori Hagihara
01749cb8a2 [1.5][JPIP] fixed opj_server execusion error (instant terminating) with autotool, cmake still need to be fixed 2011-11-16 20:03:09 +00:00
Vincent Torri
49f1a5ff54 [1.5] libcurl dep, fix 'distcheck' rule. 2011-11-16 19:20:50 +00:00
Kaori Hagihara
ff1f022d47 [1.5][JPIP] new feature to target JP2 files from www (libcurl required) 2011-11-16 16:54:53 +00:00
Kaori Hagihara
3459199eba [1.5][JPIP] added get_filesize() 2011-11-16 16:13:11 +00:00
Kaori Hagihara
544e8c9de0 [1.5][JPIP] fixed Region of Interest option, and memory leak of opj_dec_server 2011-11-16 15:43:01 +00:00
Kaori Hagihara
735b40989d [1.5][JPIP] backport r1042 to branch 1.5 2011-11-08 10:21:24 +00:00
Antonin Descampe
09f2926cd5 [1.5][JPIP] backport r1037 to branch 1.5 2011-11-06 22:03:12 +00:00
Antonin Descampe
238b767917 [1.5] backport r1017, r1030:1032 from trunk + additional fix for cmake and autotools 2011-11-02 00:49:20 +00:00
Antonin Descampe
49a0f0db8f [1.5] backport revisions 996, 997, 1000, 1008-1012 from trunk (JPIP modifications) 2011-11-01 23:28:07 +00:00
Mickael Savinaud
6a1530e4b1 [1.5] remove one obvious memory leak from test functions 2011-10-21 08:57:00 +00:00
Mickael Savinaud
8d8841c84f [1.5] remove obvious memory leak from applications 2011-10-20 16:36:45 +00:00
Mickael Savinaud
1dc6eddf1c backport rev 1013-1014 from trunk 2011-10-19 15:45:03 +00:00
Antonin Descampe
c1510793e3 [1.5] backport r987:990 to branch 1.5 2011-10-11 07:24:58 +00:00
Antonin Descampe
d728868263 [1.5][JPIP]removed obsolete indexer utility 2011-10-10 09:58:37 +00:00
Antonin Descampe
8a2af121a4 [1.5] enabled JPP stream in JPIP (result of GSoC program) 2011-10-10 09:50:18 +00:00
Antonin Descampe
9e60c2f8e9 [1.5] backport r909, r922-925 to branch 1.5 (terminating status of opj_server in debug/non-server mode and stateless requests) 2011-10-10 07:03:28 +00:00
Vincent Torri
d35f647aaa [1.5] add missing file in tarball, no need to change CHANGES 2011-10-10 06:42:27 +00:00
Vincent Torri
adbccc2e56 [1.5] Fix 'distcheck' rule 2011-10-10 06:02:31 +00:00
Mickael Savinaud
642d09f5cb [1.5] enhance non regression test suite generation (and some test names). It is based on a file as encoder previously 2011-10-07 13:00:18 +00:00
Mickael Savinaud
d1cb786dd8 [1.5] add tests about jp2 conformance 2011-10-07 12:45:10 +00:00
Mickael Savinaud
182e4b1882 [1.5] rename opj_configh.cmake.in to opj_config.h.cmake.in and update CMakeLists.txt to be more clear 2011-10-07 12:40:36 +00:00
Mickael Savinaud
73106fe839 [1.5] enhance some new JPIP files with opj_config inclusion and using of opj_free/opj_calloc functions (credit to Julien Malik) 2011-10-06 09:36:22 +00:00
Mickael Savinaud
40b4ecfaec [1.5] enhance html documentation generation with cmake and add a openjpeg mainpage to this doc 2011-10-06 09:04:42 +00:00
Vincent Torri
fb82b6d7d9 [1.5] fix output when --disable-shared or --disable-static is
passed to configure. Minor fix for jpwl compilation.
2011-10-01 04:55:00 +00:00
Antonin Descampe
5d6ac5ea72 BRANCH-1.5: fixed autotools for new indexer option 2011-09-09 18:53:01 +00:00
Antonin Descampe
3d06f03072 BRANCH-1.5:added a new indexer functionality to the library. With the new -jpip option at encoding, the user can now generate a JP2 file including an XML box with the index used when browsing the image with JPIP 2011-09-09 14:52:42 +00:00
Mickael Savinaud
5213675ba8 correct nightly crash on all platform linked to merge operation and missing opj_getopt command 2011-09-02 09:00:58 +00:00
Antonin Descampe
9a89e2f162 backport r898 to r907 in openjpeg-1.5 branch 2011-09-01 12:08:10 +00:00
Antonin Descampe
e89eb575ac backport r895 to openjpeg-1.5 branch 2011-08-27 15:54:52 +00:00
Antonin Descampe
d15f01b6e3 backport r882:893 to openjpeg-1.5 branch 2011-08-27 12:53:38 +00:00
Antonin Descampe
9ec5e8cf9a updated INSTALL files, fixed a bug in CMakeLists.txt that prevented finding the data directory 2011-08-22 10:42:32 +00:00
Antonin Descampe
4c9acc22b8 INSTALL and THANKS files update 2011-08-22 09:59:03 +00:00
Antonin Descampe
6adb5f5070 added NEWS, AUTHORS and THANKS files. Cosmetic changes in autotools files 2011-08-16 13:23:36 +00:00
Antonin Descampe
d1d662768d removed obsolete testing directory and *.nix files 2011-08-16 09:28:37 +00:00
Antonin Descampe
4091882dfb backport r870 to branch openjpeg-1.5 2011-08-16 08:54:54 +00:00
Antonin Descampe
61e0ed6a96 backport r868 to openjpeg-1.5 branch 2011-08-15 13:25:58 +00:00
Antonin Descampe
9c7899372b backport r866 to branch openjpeg-1.5 2011-08-15 13:00:06 +00:00
Antonin Descampe
a098921d34 added cmake support to openjpip 2011-08-12 14:59:28 +00:00
Mickael Savinaud
8ed4cb1a1e Fixed issue #76 (openjpeg-1.5) 2011-08-11 14:27:08 +00:00
Antonin Descampe
721904bc26 minor bug fix in configure.ac (credit to Vincent Torri) 2011-08-11 12:22:31 +00:00
Mickael Savinaud
2724f85cad backport rev[824-834] and rev[837-859] into the openjpeg-1.5 branch 2011-08-11 10:18:02 +00:00
Antonin Descampe
40b989ce00 removed xcode project files (cmake and autotools are now the only supported build methods) 2011-08-09 15:42:42 +00:00
Vincent Torri
3e1d8d6aef Fixed issue #74. 2011-07-23 08:47:24 +00:00
Vincent Torri
fda0cada0e Added libpng 1.5 detection. Dropped libpng 1.0.* explicit detection (we are in 2011 !). Patch by Winfried. 2011-07-23 08:32:09 +00:00
Vincent Torri
a58987d082 put comments after the creation of the branch 2011-07-13 16:39:14 +00:00
Vincent Torri
0f101066f2 * added 'libopenjpeg-jpwl.pc.in'
* fixed substitution in libopenjpeg1.pc.in
 * increase micro version to 99. When released, set minor to 5 and micro to 0
 * added -lm to the linker for libopenjpeg and to the .pc file
 * removed useless LCMS flags from Makefile.am for libopenjpeg
2011-07-13 16:29:22 +00:00
Antonin Descampe
cbe26cbb88 [openjpeg-1.5] JPIP : updated opj_viewer* jar files 2011-07-13 10:52:24 +00:00
Antonin Descampe
f753a1c36c updated CHNAGES files after branch renaming 2011-07-11 17:43:08 +00:00
Antonin Descampe
c0ea54e518 branch opj-v1-branch renamed to openjpeg-1.5 2011-07-11 17:40:09 +00:00
Antonin Descampe
c85e1a10cf opj-v1-branch created 2011-07-10 18:36:17 +00:00
609 changed files with 46971 additions and 136699 deletions

17
.gitignore vendored
View File

@ -1,17 +0,0 @@
# Ignore files and directories made by `cmake .`.
CMakeFiles/
Makefile
cmake_install.cmake
/CMakeCache.txt
/CPackConfig.cmake
/CPackSourceConfig.cmake
/CTestCustom.cmake
/LICENSE.txt
/OpenJPEGConfig.cmake
/libopenjp2.pc
/src/bin/common/opj_apps_config.h
/src/lib/openjp2/opj_config.h
/src/lib/openjp2/opj_config_private.h
# Ignore directories made by `make`.
/bin/

View File

@ -1,93 +0,0 @@
language: c
matrix:
include:
- os: osx
compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_INCLUDE_IF_DEPLOY=1
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release OPJ_NUM_THREADS=2
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
packages:
- gcc-multilib
- os: linux
compiler: gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug
- os: linux
compiler: clang
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Debug OPJ_CI_ASAN=1
- os: linux
compiler: clang-3.8
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
sources:
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
- clang-3.8
- os: linux
compiler: x86_64-w64-mingw32-gcc
env: OPJ_CI_ARCH=x86_64 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
packages:
- gcc-mingw-w64-base
- binutils-mingw-w64-x86-64
- gcc-mingw-w64-x86-64
- gcc-mingw-w64
- os: linux
compiler: x86_64-w64-mingw32-gcc
env: OPJ_CI_ARCH=i386 OPJ_CI_BUILD_CONFIGURATION=Release
addons:
apt:
packages:
- gcc-mingw-w64-base
- binutils-mingw-w64-i686
- gcc-mingw-w64-i686
- gcc-mingw-w64
- os: linux
compiler: gcc-4.8
env: OPJ_CI_ABI_CHECK=1
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- libelf-dev
- elfutils
- texinfo
- exuberant-ctags
install:
- ./tools/travis-ci/install.sh
script:
- ./tools/travis-ci/run.sh
- ./tools/travis-ci/abi-check.sh
before_deploy:
- export OPJ_RELEASE_PKG_FILE=$(ls build/openjpeg-${TRAVIS_TAG}*)
- echo "deploying $OPJ_RELEASE_PKG_FILE to GitHub releases"
deploy:
provider: releases
api_key:
secure: Npi13uOffALCVNwea4p4q8v85Lo/WsRqaeZQcWrAkt8MxRnfvWQtmnuwmHnVB6Cig+T1lVUHrklOaJIApIb6nkGq3CS/9bD8+SCS2NEdAAP/QYWnBi0ubWXVMRyDLypmwRpzLNSZ0xLYGFUl2PjieZYKRcz1dd/J7S+FnXhPtdjXweq0FS63zTcMe7ggjfmzSOWUCEFmMjZPaM0Be+3PweieCO1dxlHuy7ugCkx2S7d+5hNsicIhQmTADjqtJAkHoMhYqu6/yLFxhjO/+f938PATFULdODTvjCsUwdN/ySWi1Oj4uPAntfytZP7H6YrzLh8dS73QCsdkhhDJIgJskHIBSbRyyEVUnOvQgD9VaBVGHtc1KtZQTwc41OUO3BGPHl97s3oX6bqWqo/L53dB3TPHGx+1+2HL/F0zaDZuHhAKMkPwe8LFPMPB/ur65zXMHjnWb2ZTVVdoIvkbQ7nu8ApI60ejxocYBsEyAuC2CPXU2ki4jdEhm0E1hIziWNE9/LTuM17ziQuJ6WpXOSMrfP4o5aVDmLp5ZGBSocrspOksgyI9XogHaO/r+Y6N3exy+giObFfMHkZVUpsKrKmtOJ7TC1Vg5HsYGlWW8RN8dkJV47bUXm9K4sMos9eYMUt/czykPAs+132cogpII3QxXpFZQqZg6SEPVfOiyqQzTUI=
file_glob: true
file: "${OPJ_RELEASE_PKG_FILE}"
skip_cleanup: true
on:
repo: uclouvain/openjpeg
tags: true
condition: "$OPJ_CI_INCLUDE_IF_DEPLOY = 1"

13
AUTHORS Normal file
View File

@ -0,0 +1,13 @@
Authors of OpenJPEG
See also the files THANKS and CHANGES
David Janssens designed and implemented the first version of OpenJPEG.
Kaori Hagihara designed and implemented the first version of OpenJPIP.
Jerome Fimes implemented the alpha version of OpenJPEG v2.
Giuseppe Baruffa added the JPWL functionalities.
Yannick Verschueren,
Herve Drolon,
Francois-Olivier Devaux,
Antonin Descampe
improved the libraries and utilities.

View File

@ -1,21 +0,0 @@
# Authors of OpenJPEG
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
David Janssens designed and implemented the first version of OpenJPEG.
Kaori Hagihara designed and implemented the first version of OpenJPIP.
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
Giuseppe Baruffa added the JPWL functionalities.
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
Yannick Verschueren,
Herve Drolon,
Francois-Olivier Devaux,
Antonin Descampe
improved the libraries and utilities.

View File

@ -1,446 +0,0 @@
# Changelog
## [v2.1.2](https://github.com/uclouvain/openjpeg/releases/v2.1.2) (2016-09-28)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/v2.1.1...v2.1.2)
**Closed issues:**
- null ptr dereference in convert.c:1331 [\#843](https://github.com/uclouvain/openjpeg/issues/843)
- Out-of-Bounds Read in function bmp24toimage of convertbmp.c [\#833](https://github.com/uclouvain/openjpeg/issues/833)
- Disable automatic compilation of t1\_generate\_luts in CMakeLists.txt [\#831](https://github.com/uclouvain/openjpeg/issues/831)
- CVE-2016-7163 Integer overflow in opj\_pi\_create\_decode [\#826](https://github.com/uclouvain/openjpeg/issues/826)
- Security Advisory for OpenJPEG [\#810](https://github.com/uclouvain/openjpeg/issues/810)
- Add dashboard with static lib [\#804](https://github.com/uclouvain/openjpeg/issues/804)
- hidden visibility for the static library / building with -DOPJ\_STATIC against shared lib [\#802](https://github.com/uclouvain/openjpeg/issues/802)
- Optimization when building library from source [\#799](https://github.com/uclouvain/openjpeg/issues/799)
- unsigned int16 on Solaris 11.2/sparc [\#796](https://github.com/uclouvain/openjpeg/issues/796)
- appveyor [\#793](https://github.com/uclouvain/openjpeg/issues/793)
- Please make a new release [\#782](https://github.com/uclouvain/openjpeg/issues/782)
- FFMpeg will not link to 2.1.1 release built as shared library [\#766](https://github.com/uclouvain/openjpeg/issues/766)
- API change since v2: opj\_event\_mgr\_t not available [\#754](https://github.com/uclouvain/openjpeg/issues/754)
- openjpeg.h needs dependencies [\#673](https://github.com/uclouvain/openjpeg/issues/673)
- "master" does not build on ubuntu [\#658](https://github.com/uclouvain/openjpeg/issues/658)
- Package 'openjp2', required by 'libopenjpip', not found [\#594](https://github.com/uclouvain/openjpeg/issues/594)
**Merged pull requests:**
- Fix PNM file reading [\#847](https://github.com/uclouvain/openjpeg/pull/847) ([mayeut](https://github.com/mayeut))
- Fix some issues reported by Coverity Scan [\#846](https://github.com/uclouvain/openjpeg/pull/846) ([stweil](https://github.com/stweil))
- Fix potential out-of-bounds read \(coverity\) [\#844](https://github.com/uclouvain/openjpeg/pull/844) ([stweil](https://github.com/stweil))
- Remove TODO for overflow check [\#842](https://github.com/uclouvain/openjpeg/pull/842) ([mayeut](https://github.com/mayeut))
- Add overflow checks for opj\_aligned\_malloc [\#841](https://github.com/uclouvain/openjpeg/pull/841) ([mayeut](https://github.com/mayeut))
- Flags in T1 shall be unsigned [\#840](https://github.com/uclouvain/openjpeg/pull/840) ([mayeut](https://github.com/mayeut))
- Fix some warnings [\#838](https://github.com/uclouvain/openjpeg/pull/838) ([mayeut](https://github.com/mayeut))
- Fix issue 833. [\#834](https://github.com/uclouvain/openjpeg/pull/834) ([trylab](https://github.com/trylab))
- Add overflow checks for opj\_aligned\_malloc [\#832](https://github.com/uclouvain/openjpeg/pull/832) ([mayeut](https://github.com/mayeut))
- Add test for issue 820 [\#829](https://github.com/uclouvain/openjpeg/pull/829) ([mayeut](https://github.com/mayeut))
- Add test for issue 826 [\#827](https://github.com/uclouvain/openjpeg/pull/827) ([mayeut](https://github.com/mayeut))
- Fix coverity 113065 \(CWE-484\) [\#824](https://github.com/uclouvain/openjpeg/pull/824) ([mayeut](https://github.com/mayeut))
- Add sanity check for tile coordinates [\#823](https://github.com/uclouvain/openjpeg/pull/823) ([mayeut](https://github.com/mayeut))
- Add test for PR 818 [\#822](https://github.com/uclouvain/openjpeg/pull/822) ([mayeut](https://github.com/mayeut))
- Update to libpng 1.6.25 [\#821](https://github.com/uclouvain/openjpeg/pull/821) ([mayeut](https://github.com/mayeut))
- CVE-2016-8332: fix incrementing of "l\_tcp-\>m\_nb\_mcc\_records" in opj\_j2k\_read\_mcc [\#820](https://github.com/uclouvain/openjpeg/pull/820) ([mayeut](https://github.com/mayeut))
- Add overflow check in opj\_tcd\_init\_tile [\#819](https://github.com/uclouvain/openjpeg/pull/819) ([mayeut](https://github.com/mayeut))
- Fix leak & invalid behavior of opj\_jp2\_read\_ihdr [\#818](https://github.com/uclouvain/openjpeg/pull/818) ([mayeut](https://github.com/mayeut))
- Add overflow check in opj\_j2k\_update\_image\_data [\#817](https://github.com/uclouvain/openjpeg/pull/817) ([mayeut](https://github.com/mayeut))
- Change 'restrict' define to 'OPJ\_RESTRICT' [\#816](https://github.com/uclouvain/openjpeg/pull/816) ([mayeut](https://github.com/mayeut))
- Switch to clang 3.8 [\#814](https://github.com/uclouvain/openjpeg/pull/814) ([mayeut](https://github.com/mayeut))
- Fix an integer overflow issue [\#809](https://github.com/uclouvain/openjpeg/pull/809) ([trylab](https://github.com/trylab))
- Update to lcms 2.8 [\#808](https://github.com/uclouvain/openjpeg/pull/808) ([mayeut](https://github.com/mayeut))
- Update to libpng 1.6.24 [\#807](https://github.com/uclouvain/openjpeg/pull/807) ([mayeut](https://github.com/mayeut))
- Reenable clang-3.9 build on travis [\#806](https://github.com/uclouvain/openjpeg/pull/806) ([mayeut](https://github.com/mayeut))
- Bit fields type [\#805](https://github.com/uclouvain/openjpeg/pull/805) ([smuehlst](https://github.com/smuehlst))
- Add compilation test for standalone inclusion of openjpeg.h [\#798](https://github.com/uclouvain/openjpeg/pull/798) ([mayeut](https://github.com/mayeut))
- jpwl: Remove non-portable data type u\_int16\_t \(fix issue \#796\) [\#797](https://github.com/uclouvain/openjpeg/pull/797) ([stweil](https://github.com/stweil))
- Fix dependency for pkg-config \(issue \#594\) [\#795](https://github.com/uclouvain/openjpeg/pull/795) ([stweil](https://github.com/stweil))
- Add .gitignore [\#787](https://github.com/uclouvain/openjpeg/pull/787) ([stweil](https://github.com/stweil))
## [v2.1.1](https://github.com/uclouvain/openjpeg/releases/tag/v2.1.1) (2016-07-05)
[Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.1...v2.1.1)
**Implemented enhancements:**
- opj\_malloc replacement [\#625](https://github.com/uclouvain/openjpeg/issues/625)
- backport "-p" and "-force-rgb" options in 1.5 [\#606](https://github.com/uclouvain/openjpeg/issues/606)
- Use travis-ci matrix build [\#581](https://github.com/uclouvain/openjpeg/issues/581)
- Add Coverity Scan analysis [\#580](https://github.com/uclouvain/openjpeg/issues/580)
- Unnecessary rate distortion calculations [\#479](https://github.com/uclouvain/openjpeg/issues/479)
- Add images from various security issues to test suite [\#415](https://github.com/uclouvain/openjpeg/issues/415)
- Coding speed for 9/7 on 32bits platforms \(x86/ARM\) can be improved with a quick fix [\#220](https://github.com/uclouvain/openjpeg/issues/220)
**Fixed bugs:**
- Out-of-Bounds Access in function opj\_tgt\_reset of tgt.c [\#775](https://github.com/uclouvain/openjpeg/issues/775)
- Heap Buffer Overflow in function color\_cmyk\_to\_rgb of color.c [\#774](https://github.com/uclouvain/openjpeg/issues/774)
- division-by-zero \(SIGFPE\) error in opj\_tcd\_init\_tile function \(line 730 of tcd.c\) [\#733](https://github.com/uclouvain/openjpeg/issues/733)
- Out-Of-Bounds Read in sycc422\_to\_rgb function [\#726](https://github.com/uclouvain/openjpeg/issues/726)
- Heap Corruption in opj\_free function [\#725](https://github.com/uclouvain/openjpeg/issues/725)
- Out-Of-Bounds Read in opj\_tcd\_free\_tile function [\#724](https://github.com/uclouvain/openjpeg/issues/724)
- Cannot handle box of undefined size [\#653](https://github.com/uclouvain/openjpeg/issues/653)
- Compilation fails without platform-supplied aligned malloc [\#642](https://github.com/uclouvain/openjpeg/issues/642)
- HP compiler warns about redeclaration of static function [\#640](https://github.com/uclouvain/openjpeg/issues/640)
- Implementation-defined behavior of malloc causes different behavior on Linux and AIX [\#635](https://github.com/uclouvain/openjpeg/issues/635)
- Build on AIX fails because "opj\_includes.h" is included after system headers [\#633](https://github.com/uclouvain/openjpeg/issues/633)
- Compiling with SSE2 on Linux 32-bit causes crashes in OpenJPEG [\#624](https://github.com/uclouvain/openjpeg/issues/624)
- Build on AIX fails because of "restrict" pointers [\#620](https://github.com/uclouvain/openjpeg/issues/620)
- bug in new tif conversion code [\#609](https://github.com/uclouvain/openjpeg/issues/609)
- bin/jp2/convert.c line 1085 Resource leak [\#607](https://github.com/uclouvain/openjpeg/issues/607)
- bin/jp2/convert.c memory leak [\#601](https://github.com/uclouvain/openjpeg/issues/601)
- Resource leak in opj\_j2k\_create\_cstr\_index in case of failure [\#599](https://github.com/uclouvain/openjpeg/issues/599)
- Resource leak in opj\_j2k\_encode in case of failure [\#598](https://github.com/uclouvain/openjpeg/issues/598)
- Resource leak in opj\_j2k\_decode\_one\_tile in case of failure [\#597](https://github.com/uclouvain/openjpeg/issues/597)
- Resource Leak [\#573](https://github.com/uclouvain/openjpeg/issues/573)
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) [\#571](https://github.com/uclouvain/openjpeg/issues/571)
- Use-after-free in opj\_j2k\_write\_mco [\#563](https://github.com/uclouvain/openjpeg/issues/563)
- openjpeg-master-2015-07-30 failed to compile on LINUX [\#556](https://github.com/uclouvain/openjpeg/issues/556)
- PNG images are always read as RGB\(A\) images [\#536](https://github.com/uclouvain/openjpeg/issues/536)
- g4\_colr.j2c not handled properly [\#532](https://github.com/uclouvain/openjpeg/issues/532)
- Bigendian: opj\_compress + opj\_decompress fails [\#518](https://github.com/uclouvain/openjpeg/issues/518)
- Suspicious code in j2k.c [\#517](https://github.com/uclouvain/openjpeg/issues/517)
- Decode times almost double\(!!\) on Visual Studio 2013, 2015 [\#505](https://github.com/uclouvain/openjpeg/issues/505)
- opj\_data/input/nonregression/issue226.j2k [\#500](https://github.com/uclouvain/openjpeg/issues/500)
- opj\_setup\_encoder always returns true [\#497](https://github.com/uclouvain/openjpeg/issues/497)
- Double free in j2k\_read\_ppm\_v3 parsing \(\(presumably invalid\) image. [\#496](https://github.com/uclouvain/openjpeg/issues/496)
- Invalid write in opj\_j2k\_update\_image\_data [\#495](https://github.com/uclouvain/openjpeg/issues/495)
- Undefined printf format specifier %ud used in code [\#494](https://github.com/uclouvain/openjpeg/issues/494)
- Potential double free on malloc failure in opj\_j2k\_copy\_default\_tcp\_and\_create\_tcp\(\) [\#492](https://github.com/uclouvain/openjpeg/issues/492)
- Do not link with -ffast-math [\#488](https://github.com/uclouvain/openjpeg/issues/488)
- Heap-buffer-overflow in opj\_dwt\_decode [\#486](https://github.com/uclouvain/openjpeg/issues/486)
- opj\_dump fails on Windows 7, 64 bits [\#482](https://github.com/uclouvain/openjpeg/issues/482)
- SIGSEGV in opj\_j2k\_update\_image\_data via pdfium\_test [\#481](https://github.com/uclouvain/openjpeg/issues/481)
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#477](https://github.com/uclouvain/openjpeg/issues/477)
- Invalid image causes write past end of heap buffer [\#476](https://github.com/uclouvain/openjpeg/issues/476)
- Assertion `l\_res-\>x0 \>= 0' fails when parsing invalid images [\#475](https://github.com/uclouvain/openjpeg/issues/475)
- Bug on opj\_write\_bytes\_BE function [\#472](https://github.com/uclouvain/openjpeg/issues/472)
- Refactor j2k\_read\_ppm\_v3 function [\#470](https://github.com/uclouvain/openjpeg/issues/470)
- compression: strange precinct dimensions [\#466](https://github.com/uclouvain/openjpeg/issues/466)
- \(:- Console message in opj\_decompress -:\) [\#465](https://github.com/uclouvain/openjpeg/issues/465)
- opj\_decompress fails to decompress any files [\#463](https://github.com/uclouvain/openjpeg/issues/463)
- bio-\>ct is unnecessarily set to zero in opj\_bio\_flush method [\#461](https://github.com/uclouvain/openjpeg/issues/461)
- Maximal unsigned short is 65535, not 65536 [\#460](https://github.com/uclouvain/openjpeg/issues/460)
- OpenJpeg fails to encode components with different precision properly [\#459](https://github.com/uclouvain/openjpeg/issues/459)
- component precision upscaling isn't correct in opj\_decompress [\#458](https://github.com/uclouvain/openjpeg/issues/458)
- Multiple precision components won't get encoded to jp2 if 1 component is unsigned 1 bit [\#457](https://github.com/uclouvain/openjpeg/issues/457)
- Incorrect code in ../bin/jp2/convert.c, function rawtoimage\_common\(...\) [\#456](https://github.com/uclouvain/openjpeg/issues/456)
- \[OpenJPEG-trunk\] opj\_stream\_get\_number\_byte\_left throws assert [\#455](https://github.com/uclouvain/openjpeg/issues/455)
- NR-DEC-kodak\_2layers\_lrcp.j2c-31-decode-md5 fails randomly when running tests in parallel [\#454](https://github.com/uclouvain/openjpeg/issues/454)
- compare\_raw\_files doesn't report an error on invalid arguments / missing input files [\#453](https://github.com/uclouvain/openjpeg/issues/453)
- Forward discrete wavelet transform: implement periodic symmetric extension at boundaries [\#452](https://github.com/uclouvain/openjpeg/issues/452)
- Bug in tiff reading method in convert.c [\#449](https://github.com/uclouvain/openjpeg/issues/449)
- Image in pdf don't display [\#447](https://github.com/uclouvain/openjpeg/issues/447)
- Multiple issues causing opj\_decompress to segfault [\#446](https://github.com/uclouvain/openjpeg/issues/446)
- opj\_compress: 40% of encode time is spent freeing data [\#445](https://github.com/uclouvain/openjpeg/issues/445)
- Multiple warnings when configuring OpenJPEG on MacOS with CMake 3.x \(trunk\) [\#443](https://github.com/uclouvain/openjpeg/issues/443)
- valgrind memleak found [\#437](https://github.com/uclouvain/openjpeg/issues/437)
- global-buffer-overflow src/lib/openjp2/t1.c:1146 opj\_t1\_getwmsedec [\#436](https://github.com/uclouvain/openjpeg/issues/436)
- Warning introduced on trunk r2923 & r2924 [\#435](https://github.com/uclouvain/openjpeg/issues/435)
- heap-buffer-overflow in opj\_t1\_decode\_cblks [\#432](https://github.com/uclouvain/openjpeg/issues/432)
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#431](https://github.com/uclouvain/openjpeg/issues/431)
- Heap-buffer-overflow in opj\_j2k\_tcp\_destroy [\#430](https://github.com/uclouvain/openjpeg/issues/430)
- Heap-buffer-overflow in opj\_jp2\_apply\_pclr [\#429](https://github.com/uclouvain/openjpeg/issues/429)
- issue412 revisited [\#428](https://github.com/uclouvain/openjpeg/issues/428)
- Image distorted \(sides look cankered\) [\#423](https://github.com/uclouvain/openjpeg/issues/423)
- openjpeg-2.x-trunk-r2918 is broken in color.c [\#422](https://github.com/uclouvain/openjpeg/issues/422)
- Heap-buffer-overflow in opj\_tcd\_init\_decode\_tile [\#420](https://github.com/uclouvain/openjpeg/issues/420)
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#418](https://github.com/uclouvain/openjpeg/issues/418)
- UNKNOWN in opj\_read\_bytes\_LE [\#417](https://github.com/uclouvain/openjpeg/issues/417)
- Transparency problem [\#416](https://github.com/uclouvain/openjpeg/issues/416)
- Image with per channel alpha \(cdef\) does not decode properly [\#414](https://github.com/uclouvain/openjpeg/issues/414)
- OpenJPEG crashes with attached image [\#413](https://github.com/uclouvain/openjpeg/issues/413)
- Palette image with cdef fails to decompress [\#412](https://github.com/uclouvain/openjpeg/issues/412)
- Invalid member values from opj\_read\_header or opj\_decode ? [\#411](https://github.com/uclouvain/openjpeg/issues/411)
- MD5 Checksum hangs under valgrind on MacOS X [\#410](https://github.com/uclouvain/openjpeg/issues/410)
- Heap-buffer-overflow in opj\_tcd\_get\_decoded\_tile\_size [\#408](https://github.com/uclouvain/openjpeg/issues/408)
- C++ style comments in trunk/src/lib/openjp2/j2k.c [\#407](https://github.com/uclouvain/openjpeg/issues/407)
- Backport bugfixes from trunk to 2.1 branch [\#405](https://github.com/uclouvain/openjpeg/issues/405)
- Heap-buffer-overflow in parse\_cmdline\_encoder [\#403](https://github.com/uclouvain/openjpeg/issues/403)
- Heap-buffer-overflow in opj\_v4dwt\_interleave\_h [\#400](https://github.com/uclouvain/openjpeg/issues/400)
- Heap-buffer-overflow in opj\_dwt\_decode [\#399](https://github.com/uclouvain/openjpeg/issues/399)
- Heap-use-after-free in opj\_t1\_decode\_cblks [\#398](https://github.com/uclouvain/openjpeg/issues/398)
- Heap-buffer-overflow in opj\_jp2\_apply\_cdef [\#397](https://github.com/uclouvain/openjpeg/issues/397)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#396](https://github.com/uclouvain/openjpeg/issues/396)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#395](https://github.com/uclouvain/openjpeg/issues/395)
- Heap-buffer-overflow in opj\_dwt\_decode\_1 [\#394](https://github.com/uclouvain/openjpeg/issues/394)
- Heap-double-free in j2k\_read\_ppm\_v3 [\#393](https://github.com/uclouvain/openjpeg/issues/393)
- Security hole in j2k.c [\#392](https://github.com/uclouvain/openjpeg/issues/392)
- Security: double-free in opj\_tcd\_code\_block\_dec\_deallocate [\#391](https://github.com/uclouvain/openjpeg/issues/391)
- check for negative-size params in code [\#390](https://github.com/uclouvain/openjpeg/issues/390)
- Heap-buffer-overflow in opj\_t2\_read\_packet\_header [\#389](https://github.com/uclouvain/openjpeg/issues/389)
- Heap overflow in OpenJpeg 1.5.2 [\#388](https://github.com/uclouvain/openjpeg/issues/388)
- openjpip.so.6 file too short [\#387](https://github.com/uclouvain/openjpeg/issues/387)
- Corrupted JP3D file [\#386](https://github.com/uclouvain/openjpeg/issues/386)
- variable assigned to itself [\#383](https://github.com/uclouvain/openjpeg/issues/383)
- Null pointer dereferencing [\#382](https://github.com/uclouvain/openjpeg/issues/382)
- bad use of case statement [\#381](https://github.com/uclouvain/openjpeg/issues/381)
- Release 2.1 as a Ubuntu package [\#380](https://github.com/uclouvain/openjpeg/issues/380)
- Bug in libopenjpwl.pc [\#374](https://github.com/uclouvain/openjpeg/issues/374)
- inconsistent tile numbering in decode output message [\#370](https://github.com/uclouvain/openjpeg/issues/370)
- error in code block calculations [\#369](https://github.com/uclouvain/openjpeg/issues/369)
- r2872 fails to compile due to "attempt to use poisoned malloc" error in j2k.c [\#368](https://github.com/uclouvain/openjpeg/issues/368)
- OSX build gives libopenjp2.6.dylib with not-absolute install name id [\#367](https://github.com/uclouvain/openjpeg/issues/367)
- opj\_decompress gives error but successfully decompress in OPJ 2.1 [\#366](https://github.com/uclouvain/openjpeg/issues/366)
- pngtoimage\(\) and imagetopng\(\) have wrong byte order for 16-Bit image [\#365](https://github.com/uclouvain/openjpeg/issues/365)
- PDF crash in chrome - part2 \(due to attachment limit\) [\#364](https://github.com/uclouvain/openjpeg/issues/364)
- PDF crash in chrome - part1 [\#363](https://github.com/uclouvain/openjpeg/issues/363)
- PDF crash in chrome - part0 [\#362](https://github.com/uclouvain/openjpeg/issues/362)
- Compilation fails on Windows with mingw32 gcc4.8 [\#361](https://github.com/uclouvain/openjpeg/issues/361)
- security issue [\#360](https://github.com/uclouvain/openjpeg/issues/360)
- improve memory management [\#359](https://github.com/uclouvain/openjpeg/issues/359)
- how to compress a yuv420 raw data using opj\_compress [\#357](https://github.com/uclouvain/openjpeg/issues/357)
- Some memory allocation are not checked [\#355](https://github.com/uclouvain/openjpeg/issues/355)
- Static library symbols shall be marked as hidden [\#354](https://github.com/uclouvain/openjpeg/issues/354)
- opj\_compress rejects valid bmp files [\#353](https://github.com/uclouvain/openjpeg/issues/353)
- opj\_compress crashes when number of resolutions is set to zero [\#352](https://github.com/uclouvain/openjpeg/issues/352)
- Compilation error under Visual Studio 2003 [\#351](https://github.com/uclouvain/openjpeg/issues/351)
- opj\_compress description example error \[Low priority\] [\#350](https://github.com/uclouvain/openjpeg/issues/350)
- opj\_write\_bytes\_BE is wrong in trunk [\#345](https://github.com/uclouvain/openjpeg/issues/345)
- PART1ONLY option in release.sh doesn't work properly [\#332](https://github.com/uclouvain/openjpeg/issues/332)
- openjpeg crash error [\#330](https://github.com/uclouvain/openjpeg/issues/330)
- openjpeg decompress error [\#329](https://github.com/uclouvain/openjpeg/issues/329)
- openjpeg decompress issue [\#326](https://github.com/uclouvain/openjpeg/issues/326)
- limited tif support [\#322](https://github.com/uclouvain/openjpeg/issues/322)
- asoc value of 65536 is allowed [\#321](https://github.com/uclouvain/openjpeg/issues/321)
- opj\_skip\_from\_file error [\#314](https://github.com/uclouvain/openjpeg/issues/314)
- Heavy quota usage in openjpeg [\#309](https://github.com/uclouvain/openjpeg/issues/309)
- Verify -help actually match letter [\#307](https://github.com/uclouvain/openjpeg/issues/307)
- g3\_colr.j2c not handled [\#288](https://github.com/uclouvain/openjpeg/issues/288)
- reopen/fix issue 165 [\#280](https://github.com/uclouvain/openjpeg/issues/280)
- kakadu conformance tests [\#279](https://github.com/uclouvain/openjpeg/issues/279)
- missing break after case statement in opj\_dwt\_decode\_real [\#274](https://github.com/uclouvain/openjpeg/issues/274)
- Run Coverity on trunk [\#270](https://github.com/uclouvain/openjpeg/issues/270)
- NR-ENC-random-issue-0005.tif-12-encode [\#259](https://github.com/uclouvain/openjpeg/issues/259)
- Use new add\_test signature to handle cross compilation [\#258](https://github.com/uclouvain/openjpeg/issues/258)
- Loss decoding quality in 2.0.0 [\#254](https://github.com/uclouvain/openjpeg/issues/254)
- Decompress that worked in 1.5.1 fails in 2.0 [\#252](https://github.com/uclouvain/openjpeg/issues/252)
- Expected endianness with raw input is not documented leading to SEGFAULT [\#251](https://github.com/uclouvain/openjpeg/issues/251)
- OpenJPEG writes to stderr [\#246](https://github.com/uclouvain/openjpeg/issues/246)
- Inconsistent logging of tile index [\#245](https://github.com/uclouvain/openjpeg/issues/245)
- patch for openjpeg-trunk-r2347 and BIG\_ENDIAN [\#242](https://github.com/uclouvain/openjpeg/issues/242)
- CMAP: MTYP == 0 \(direct use\) not handled properly [\#235](https://github.com/uclouvain/openjpeg/issues/235)
- Black Pixel [\#233](https://github.com/uclouvain/openjpeg/issues/233)
- opj\_compress runtime error after fresh Linux install due to apparent failure to execute ldconfig [\#219](https://github.com/uclouvain/openjpeg/issues/219)
- openjp2 debug works, release build does not [\#217](https://github.com/uclouvain/openjpeg/issues/217)
- openjpeg-branch15-r2299 and openjpeg-trunk-r2299 fail to decode a JP2 file [\#212](https://github.com/uclouvain/openjpeg/issues/212)
- openjpeg-trunk issue with Win7 [\#201](https://github.com/uclouvain/openjpeg/issues/201)
- undefined reference to `opj\_version' [\#200](https://github.com/uclouvain/openjpeg/issues/200)
- In tgt.c we used fprintf not the openjpeg message reporter [\#184](https://github.com/uclouvain/openjpeg/issues/184)
- Windows binaries not working under WinXP [\#176](https://github.com/uclouvain/openjpeg/issues/176)
- add ability to use intel ipp \(performance primitive\) within OpenJPEG [\#164](https://github.com/uclouvain/openjpeg/issues/164)
- Migration guide v2 [\#160](https://github.com/uclouvain/openjpeg/issues/160)
- Cannot decompress JPEG2000Aware3.18.7.3Win32\_kdutranscode6.3.1.j2k [\#158](https://github.com/uclouvain/openjpeg/issues/158)
- Cannot decompress JPEG2000Aware3.18.7.3Win32.j2k [\#157](https://github.com/uclouvain/openjpeg/issues/157)
- openjpeg@googlegroups.com has disappeard [\#153](https://github.com/uclouvain/openjpeg/issues/153)
- OpenJPEG 1.5.0 crashes on a ridiculously big file... [\#151](https://github.com/uclouvain/openjpeg/issues/151)
- opj\_image vs free [\#146](https://github.com/uclouvain/openjpeg/issues/146)
- Windows .dll file invalid [\#140](https://github.com/uclouvain/openjpeg/issues/140)
- Problem with second layer of a 2 layer coded LRCP \(with precincts\) [\#135](https://github.com/uclouvain/openjpeg/issues/135)
- version 1.4 crashes when opening PDF file with JPEG2000 images [\#133](https://github.com/uclouvain/openjpeg/issues/133)
- Setup a win64 dashboard [\#132](https://github.com/uclouvain/openjpeg/issues/132)
- J2KP4files/codestreams\_profile0/p0\_13.j2k question jpeg2000 [\#131](https://github.com/uclouvain/openjpeg/issues/131)
- Out of memory: Kill process 11204 \(opj\_server\) score 917 or sacrifice child [\#123](https://github.com/uclouvain/openjpeg/issues/123)
- FILE\* in opj API is unsafe [\#120](https://github.com/uclouvain/openjpeg/issues/120)
- third-party lib order [\#119](https://github.com/uclouvain/openjpeg/issues/119)
- openjpeg-1.5.0-Darwin-powerpc.dmg is huge ! [\#113](https://github.com/uclouvain/openjpeg/issues/113)
- misleading info in JP2 box lead to wrong number of components [\#110](https://github.com/uclouvain/openjpeg/issues/110)
- Image\_to\_j2k says that j2k files is generated but no file is on the HDD [\#109](https://github.com/uclouvain/openjpeg/issues/109)
- Error in openjpegV1.4 on compiling image\_to\_j2k: crash on reading bmp file [\#108](https://github.com/uclouvain/openjpeg/issues/108)
- Update to abi-compliance-checker 1.96 [\#106](https://github.com/uclouvain/openjpeg/issues/106)
- Decode error on the attached JPEG...works in KDU and with JASPER...please help! [\#101](https://github.com/uclouvain/openjpeg/issues/101)
- Mac binaries v1.4 is broken [\#95](https://github.com/uclouvain/openjpeg/issues/95)
- jp2\_read\_boxhdr\(\) has size bug in version 1 [\#92](https://github.com/uclouvain/openjpeg/issues/92)
- Support for Java JAI Imageio [\#90](https://github.com/uclouvain/openjpeg/issues/90)
- encoding test failing [\#86](https://github.com/uclouvain/openjpeg/issues/86)
- source archive on demand [\#85](https://github.com/uclouvain/openjpeg/issues/85)
- CMakeLists.txt and Makefile.am for JPIP are buggy [\#84](https://github.com/uclouvain/openjpeg/issues/84)
- pclr-cmap-cdef [\#82](https://github.com/uclouvain/openjpeg/issues/82)
- Error when compiling openjpeg\_v1\_4\_sources\_r697 [\#79](https://github.com/uclouvain/openjpeg/issues/79)
- J2K codec issue on Windows Mobile [\#77](https://github.com/uclouvain/openjpeg/issues/77)
- image\_to\_j2k.exe crashes on large .bmp file [\#75](https://github.com/uclouvain/openjpeg/issues/75)
- fatal error C1900 building the project on windows [\#65](https://github.com/uclouvain/openjpeg/issues/65)
- same option but different size [\#54](https://github.com/uclouvain/openjpeg/issues/54)
- Missing openjpegConfigure.h [\#38](https://github.com/uclouvain/openjpeg/issues/38)
- Not an issue in openjpeg, but ... [\#37](https://github.com/uclouvain/openjpeg/issues/37)
- OpenJPEG-1.3.0 pclr, cmap and cdef [\#27](https://github.com/uclouvain/openjpeg/issues/27)
- realloc maybe too big \(t2.c\) [\#26](https://github.com/uclouvain/openjpeg/issues/26)
- libopenjpeg/opj\_malloc.h breaks on FreeBSD/Darwin systems [\#20](https://github.com/uclouvain/openjpeg/issues/20)
- image\_to\_j2k not outputting to win32 console properly [\#18](https://github.com/uclouvain/openjpeg/issues/18)
- \[OpenJPEG\] OpenJPEG\_v13: tiled image part 2 [\#17](https://github.com/uclouvain/openjpeg/issues/17)
- JP2 Color Space modification by Matteo Italia [\#13](https://github.com/uclouvain/openjpeg/issues/13)
- Patch submission \( exotic video formats, and a few things \) [\#12](https://github.com/uclouvain/openjpeg/issues/12)
- 16 bits lossy compression [\#10](https://github.com/uclouvain/openjpeg/issues/10)
- pnm file formats not accepting bitdepth greater than 8 bpp [\#8](https://github.com/uclouvain/openjpeg/issues/8)
- Heap corruption in j2k encoder [\#5](https://github.com/uclouvain/openjpeg/issues/5)
- JPWL crash in marker reallocation\(+patch\), segfault while decoding image with main header protection [\#4](https://github.com/uclouvain/openjpeg/issues/4)
- a couple of small errors in libopenjpeg detected by coverity [\#1](https://github.com/uclouvain/openjpeg/issues/1)
**Closed issues:**
- Shared library build broken on ubuntu [\#728](https://github.com/uclouvain/openjpeg/issues/728)
- opj\_includes.h shouldn't define `\_\_attribute\_\_` [\#727](https://github.com/uclouvain/openjpeg/issues/727)
- Possible website problems due to Jekyll upgrade [\#713](https://github.com/uclouvain/openjpeg/issues/713)
- Stable Release? [\#712](https://github.com/uclouvain/openjpeg/issues/712)
- Meta Issue : try to fix some of these critical bugs before thinking about optimizing the library [\#710](https://github.com/uclouvain/openjpeg/issues/710)
- Tiled encoding broken for images with non power of 2 dimensions [\#702](https://github.com/uclouvain/openjpeg/issues/702)
- install\_name \(still\) not set on OS X [\#700](https://github.com/uclouvain/openjpeg/issues/700)
- Add section in wiki describing where one can get test images [\#699](https://github.com/uclouvain/openjpeg/issues/699)
- Make EvenManager into singleton [\#698](https://github.com/uclouvain/openjpeg/issues/698)
- Remove old branches from repo [\#696](https://github.com/uclouvain/openjpeg/issues/696)
- MQ Coder encode: Conditional jump or move depends on uninitialised value\(s\) [\#695](https://github.com/uclouvain/openjpeg/issues/695)
- Can we add these files to our test suite ? [\#688](https://github.com/uclouvain/openjpeg/issues/688)
- -t and -d command line flags for decode are not documented on OpenJPEG website [\#685](https://github.com/uclouvain/openjpeg/issues/685)
- Decoding at the precinct level [\#676](https://github.com/uclouvain/openjpeg/issues/676)
- Support unscaled 10 bit data for 2K cinema @ 48 FPS, as per DCI standard [\#671](https://github.com/uclouvain/openjpeg/issues/671)
- Use parallel jobs in ctest [\#664](https://github.com/uclouvain/openjpeg/issues/664)
- \[Security\]Multiple Memory error [\#663](https://github.com/uclouvain/openjpeg/issues/663)
- lossy encoding a 16 bit TIF file : severe artifiacts in decompressed image [\#660](https://github.com/uclouvain/openjpeg/issues/660)
- opj\_compress and opj\_decompress : get\_next\_file method uses hard-coded unix path separator [\#630](https://github.com/uclouvain/openjpeg/issues/630)
- Uninitialized variable [\#629](https://github.com/uclouvain/openjpeg/issues/629)
- Use of enum variable for bit flags prevents compilation as C++ source [\#619](https://github.com/uclouvain/openjpeg/issues/619)
- Serious problem with quantization during lossy encoding [\#615](https://github.com/uclouvain/openjpeg/issues/615)
- Decompression does not work with sequential data source [\#613](https://github.com/uclouvain/openjpeg/issues/613)
- potential overflow in opj\_tcd\_tile\_t [\#605](https://github.com/uclouvain/openjpeg/issues/605)
- Logical condition [\#596](https://github.com/uclouvain/openjpeg/issues/596)
- file9.jp2 does not dump correctly on 1.5 [\#595](https://github.com/uclouvain/openjpeg/issues/595)
- opj\_compress man page is missing documentation of -jpip option [\#593](https://github.com/uclouvain/openjpeg/issues/593)
- opj\_compress fails to compress lossless on gcc/x86 \(-m32\) in 1.5 branch [\#591](https://github.com/uclouvain/openjpeg/issues/591)
- Example: opj\_compress -i image.j2k -o image.pgm [\#577](https://github.com/uclouvain/openjpeg/issues/577)
- Mismatching delete [\#575](https://github.com/uclouvain/openjpeg/issues/575)
- Compilation fails on Win7 [\#546](https://github.com/uclouvain/openjpeg/issues/546)
- NR-JP2-file5.jp2-compare2base fails with third party libcms [\#540](https://github.com/uclouvain/openjpeg/issues/540)
- CTest spits out an error at the end of the test run [\#516](https://github.com/uclouvain/openjpeg/issues/516)
- opj\_uint\_adds\(\) is questionable [\#515](https://github.com/uclouvain/openjpeg/issues/515)
- Might consider renaming this method: [\#491](https://github.com/uclouvain/openjpeg/issues/491)
- opj\_compress run twice gives different fiile sizes for same file [\#490](https://github.com/uclouvain/openjpeg/issues/490)
- Android Support [\#483](https://github.com/uclouvain/openjpeg/issues/483)
- Add SSE2/SSE41 implementations for mct.c [\#451](https://github.com/uclouvain/openjpeg/issues/451)
- Reduce encoder code block memory usage for non 64x64 code block sizes [\#444](https://github.com/uclouvain/openjpeg/issues/444)
- valgrind "Uninitialized Memory Read" & "Uninitialized Memory Conditional" found [\#438](https://github.com/uclouvain/openjpeg/issues/438)
- No way to debug opj\_tcd\_init\_encode\_tile or opj\_tcd\_init\_decode\_tile [\#433](https://github.com/uclouvain/openjpeg/issues/433)
- Add option to call dsymutil on built binaries [\#409](https://github.com/uclouvain/openjpeg/issues/409)
- Allow opj\_compress and opj\_decompress to read/write images over stdin/stdout [\#379](https://github.com/uclouvain/openjpeg/issues/379)
- reduce memory significantly for single tile RGB encoding [\#375](https://github.com/uclouvain/openjpeg/issues/375)
- Switch code repo to github and start using pull request workflow [\#373](https://github.com/uclouvain/openjpeg/issues/373)
- This is a BigTIFF file. This format not supported [\#125](https://github.com/uclouvain/openjpeg/issues/125)
- Add a test suite to check the convert functions [\#99](https://github.com/uclouvain/openjpeg/issues/99)
- Add build config to the dashboard to verify the autotools build [\#88](https://github.com/uclouvain/openjpeg/issues/88)
**Merged pull requests:**
- Correct abi-check.sh for PR [\#791](https://github.com/uclouvain/openjpeg/pull/791) ([mayeut](https://github.com/mayeut))
- Update tcd.c [\#790](https://github.com/uclouvain/openjpeg/pull/790) ([maddin200](https://github.com/maddin200))
- Update lcms2 [\#773](https://github.com/uclouvain/openjpeg/pull/773) ([mayeut](https://github.com/mayeut))
- Use lowercase for cmake commands consistenly [\#769](https://github.com/uclouvain/openjpeg/pull/769) ([julienmalik](https://github.com/julienmalik))
- Ignore clang's summary warning [\#768](https://github.com/uclouvain/openjpeg/pull/768) ([julienmalik](https://github.com/julienmalik))
- Fix UBSan gcc warning for first arg to memset non null [\#767](https://github.com/uclouvain/openjpeg/pull/767) ([julienmalik](https://github.com/julienmalik))
- Update to libtiff-4.0.6 [\#764](https://github.com/uclouvain/openjpeg/pull/764) ([mayeut](https://github.com/mayeut))
- Fix warnings [\#763](https://github.com/uclouvain/openjpeg/pull/763) ([mayeut](https://github.com/mayeut))
- Check SSIZ is valid in opj\_j2k\_read\_siz [\#762](https://github.com/uclouvain/openjpeg/pull/762) ([mayeut](https://github.com/mayeut))
- Fix unsigned int overflow reported by UBSan [\#761](https://github.com/uclouvain/openjpeg/pull/761) ([mayeut](https://github.com/mayeut))
- Fix unsigned int overflow reported by UBSan [\#759](https://github.com/uclouvain/openjpeg/pull/759) ([mayeut](https://github.com/mayeut))
- Fix negative shift left reported by UBSan [\#758](https://github.com/uclouvain/openjpeg/pull/758) ([mayeut](https://github.com/mayeut))
- Fix negative shift left reported by UBSan [\#757](https://github.com/uclouvain/openjpeg/pull/757) ([mayeut](https://github.com/mayeut))
- Add clang 3.9 build to Travis matrix [\#753](https://github.com/uclouvain/openjpeg/pull/753) ([julienmalik](https://github.com/julienmalik))
- Fix implicit floating bool conversion [\#752](https://github.com/uclouvain/openjpeg/pull/752) ([julienmalik](https://github.com/julienmalik))
- Do not define \_\_attribute\_\_ in opj\_includes.h [\#751](https://github.com/uclouvain/openjpeg/pull/751) ([mayeut](https://github.com/mayeut))
- Allow to read/write 3/5/7/9/11/13/15 bpp TIF files [\#750](https://github.com/uclouvain/openjpeg/pull/750) ([mayeut](https://github.com/mayeut))
- Fix heap-buffer-overflow in color\_esycc\_to\_rgb [\#748](https://github.com/uclouvain/openjpeg/pull/748) ([mayeut](https://github.com/mayeut))
- update libpng to from 1.6.17 to 1.6.21 [\#747](https://github.com/uclouvain/openjpeg/pull/747) ([julienmalik](https://github.com/julienmalik))
- Update cmake & jpylyzer for travis builds [\#746](https://github.com/uclouvain/openjpeg/pull/746) ([julienmalik](https://github.com/julienmalik))
- Fix Out-Of-Bounds Read in sycc42x\_to\_rgb function [\#745](https://github.com/uclouvain/openjpeg/pull/745) ([mayeut](https://github.com/mayeut))
- cppcheck fix for openjp2 [\#740](https://github.com/uclouvain/openjpeg/pull/740) ([julienmalik](https://github.com/julienmalik))
- Fix uninitialized variable reported by cppcheck [\#735](https://github.com/uclouvain/openjpeg/pull/735) ([julienmalik](https://github.com/julienmalik))
- Remove dead code in opj\_dump [\#734](https://github.com/uclouvain/openjpeg/pull/734) ([julienmalik](https://github.com/julienmalik))
- issue \#695 MQ Encode: ensure that bp pointer never points to uninitialized memory [\#708](https://github.com/uclouvain/openjpeg/pull/708) ([boxerab](https://github.com/boxerab))
- Fix issue 135 [\#706](https://github.com/uclouvain/openjpeg/pull/706) ([mayeut](https://github.com/mayeut))
- Fix implementation of opj\_calloc [\#705](https://github.com/uclouvain/openjpeg/pull/705) ([stweil](https://github.com/stweil))
- \[git/2.1 regression\] Fix opj\_write\_tile\(\) failure when numresolutions=1 [\#690](https://github.com/uclouvain/openjpeg/pull/690) ([rouault](https://github.com/rouault))
- Fix fatal crash on 64 bit Linux [\#687](https://github.com/uclouvain/openjpeg/pull/687) ([stweil](https://github.com/stweil))
- \[libtiff\] Add missing include statement for ssize\_t [\#686](https://github.com/uclouvain/openjpeg/pull/686) ([mayeut](https://github.com/mayeut))
- Fix duplicate article in comments [\#684](https://github.com/uclouvain/openjpeg/pull/684) ([stweil](https://github.com/stweil))
- Fix grammar in comment [\#679](https://github.com/uclouvain/openjpeg/pull/679) ([stweil](https://github.com/stweil))
- Remove whitespace and CR at line endings [\#678](https://github.com/uclouvain/openjpeg/pull/678) ([stweil](https://github.com/stweil))
- Fix typos [\#665](https://github.com/uclouvain/openjpeg/pull/665) ([jwilk](https://github.com/jwilk))
- Add missing source for the JPIP library and executables \(issue \#658\) [\#659](https://github.com/uclouvain/openjpeg/pull/659) ([stweil](https://github.com/stweil))
- Fix undefined size jp2 box handling [\#654](https://github.com/uclouvain/openjpeg/pull/654) ([mayeut](https://github.com/mayeut))
- opj\_decompress: Update error message [\#651](https://github.com/uclouvain/openjpeg/pull/651) ([stweil](https://github.com/stweil))
- Fix support of posix\_memalloc for Linux [\#648](https://github.com/uclouvain/openjpeg/pull/648) ([stweil](https://github.com/stweil))
- Fix typo in comments [\#647](https://github.com/uclouvain/openjpeg/pull/647) ([stweil](https://github.com/stweil))
- Avoid pointer arithmetic with \(void \*\) pointers [\#644](https://github.com/uclouvain/openjpeg/pull/644) ([smuehlst](https://github.com/smuehlst))
- Fix HP compiler warning about redeclaration of function \(\#640\) [\#641](https://github.com/uclouvain/openjpeg/pull/641) ([smuehlst](https://github.com/smuehlst))
- Fix format strings and unneeded assignment [\#638](https://github.com/uclouvain/openjpeg/pull/638) ([stweil](https://github.com/stweil))
- Fix repository for JPEG2000 test data [\#637](https://github.com/uclouvain/openjpeg/pull/637) ([stweil](https://github.com/stweil))
- Update allocation functions [\#636](https://github.com/uclouvain/openjpeg/pull/636) ([mayeut](https://github.com/mayeut))
- Fix OpenJPEG GitHub issue \#633. [\#634](https://github.com/uclouvain/openjpeg/pull/634) ([smuehlst](https://github.com/smuehlst))
- travis-ci: Include add ons in matrix [\#632](https://github.com/uclouvain/openjpeg/pull/632) ([mayeut](https://github.com/mayeut))
- Add Appveyor [\#627](https://github.com/uclouvain/openjpeg/pull/627) ([mayeut](https://github.com/mayeut))
- Use Travis-ci to run ABI check [\#626](https://github.com/uclouvain/openjpeg/pull/626) ([mayeut](https://github.com/mayeut))
- Fix warnings for C++ [\#623](https://github.com/uclouvain/openjpeg/pull/623) ([stweil](https://github.com/stweil))
- Fixed problem that C++ compilation failed because of enum variable. [\#622](https://github.com/uclouvain/openjpeg/pull/622) ([smuehlst](https://github.com/smuehlst))
- Added missing casts for return values of opj\_malloc\(\)/opj\_calloc\(\). [\#618](https://github.com/uclouvain/openjpeg/pull/618) ([smuehlst](https://github.com/smuehlst))
- Add check for seek support before trying TPsot==TNsot workaround [\#617](https://github.com/uclouvain/openjpeg/pull/617) ([mayeut](https://github.com/mayeut))
- Fix some typos found by codespell [\#610](https://github.com/uclouvain/openjpeg/pull/610) ([stweil](https://github.com/stweil))
- Correct leak in color\_cielab\_to\_rgb [\#590](https://github.com/uclouvain/openjpeg/pull/590) ([mayeut](https://github.com/mayeut))
- Add Travis-ci build matrix [\#584](https://github.com/uclouvain/openjpeg/pull/584) ([mayeut](https://github.com/mayeut))
- Correct lossless issue on linux x86 [\#579](https://github.com/uclouvain/openjpeg/pull/579) ([mayeut](https://github.com/mayeut))
- Travis-ci update [\#578](https://github.com/uclouvain/openjpeg/pull/578) ([mayeut](https://github.com/mayeut))
- Correct CMake version requirements [\#572](https://github.com/uclouvain/openjpeg/pull/572) ([mayeut](https://github.com/mayeut))
- Add tests for CMYK/esYCC/CIELab [\#567](https://github.com/uclouvain/openjpeg/pull/567) ([mayeut](https://github.com/mayeut))
- Add support for CIELab, EYCC and CMYK [\#559](https://github.com/uclouvain/openjpeg/pull/559) ([szukw000](https://github.com/szukw000))
- Remove printf/fprintf to stdout/stderr throughout openjp2 lib [\#558](https://github.com/uclouvain/openjpeg/pull/558) ([mayeut](https://github.com/mayeut))
- better -ffast-math handling [\#555](https://github.com/uclouvain/openjpeg/pull/555) ([rdieter](https://github.com/rdieter))
- Add jpylyzer tests for JP2 compression [\#552](https://github.com/uclouvain/openjpeg/pull/552) ([mayeut](https://github.com/mayeut))
- Add COC/QCC in main header when needed [\#551](https://github.com/uclouvain/openjpeg/pull/551) ([mayeut](https://github.com/mayeut))
- Use \_\_emul under msvc x86 for fast 64 = 32 \* 32 [\#550](https://github.com/uclouvain/openjpeg/pull/550) ([mayeut](https://github.com/mayeut))
- Update convert for PNG output [\#549](https://github.com/uclouvain/openjpeg/pull/549) ([mayeut](https://github.com/mayeut))
- Remove some warnings when building [\#548](https://github.com/uclouvain/openjpeg/pull/548) ([mayeut](https://github.com/mayeut))
- Switch to libpng-1.6.17 [\#547](https://github.com/uclouvain/openjpeg/pull/547) ([mayeut](https://github.com/mayeut))
- Add some missing static keywords [\#545](https://github.com/uclouvain/openjpeg/pull/545) ([mayeut](https://github.com/mayeut))
- Switch to libcms2 mm2/Little-CMS@0e8234e090d6aab33f90e2eb0296f30aa0705e57 [\#544](https://github.com/uclouvain/openjpeg/pull/544) ([mayeut](https://github.com/mayeut))
- Prevent overflow when coding 16 bits images [\#543](https://github.com/uclouvain/openjpeg/pull/543) ([mayeut](https://github.com/mayeut))
- Switch to libcms2-2.6 [\#542](https://github.com/uclouvain/openjpeg/pull/542) ([mayeut](https://github.com/mayeut))
- Update PNG support [\#538](https://github.com/uclouvain/openjpeg/pull/538) ([mayeut](https://github.com/mayeut))
- Various Minor fixes [\#537](https://github.com/uclouvain/openjpeg/pull/537) ([mayeut](https://github.com/mayeut))
- Update TIFF conversion to support more bit depth. [\#535](https://github.com/uclouvain/openjpeg/pull/535) ([mayeut](https://github.com/mayeut))
- Add checks for odd looking cmap & for cmap outside jp2h box [\#534](https://github.com/uclouvain/openjpeg/pull/534) ([mayeut](https://github.com/mayeut))
- Refactor opj\_j2k\_read\_ppm & opj\_j2k\_read\_ppt [\#533](https://github.com/uclouvain/openjpeg/pull/533) ([mayeut](https://github.com/mayeut))
- Add option to force component splitting in imagetopnm [\#531](https://github.com/uclouvain/openjpeg/pull/531) ([mayeut](https://github.com/mayeut))
- fix Suspicious code in j2k.c \#517 [\#529](https://github.com/uclouvain/openjpeg/pull/529) ([renevanderark](https://github.com/renevanderark))
- Update zlib to version 1.2.8 [\#528](https://github.com/uclouvain/openjpeg/pull/528) ([mayeut](https://github.com/mayeut))
- Fix opj\_write\_bytes\_BE \(\#518\) [\#521](https://github.com/uclouvain/openjpeg/pull/521) ([manisandro](https://github.com/manisandro))
- Correctly decode files with incorrect tile-part header fields \(TPsot==TNsot\) [\#514](https://github.com/uclouvain/openjpeg/pull/514) ([mayeut](https://github.com/mayeut))
- Fixed typos [\#510](https://github.com/uclouvain/openjpeg/pull/510) ([radarhere](https://github.com/radarhere))
- Formatted the readme file [\#507](https://github.com/uclouvain/openjpeg/pull/507) ([htmfilho](https://github.com/htmfilho))
## [version.2.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.1) (2014-04-29)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0.1...version.2.1)
## [version.2.0.1](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0.1) (2014-04-22)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.2...version.2.0.1)
## [version.1.5.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.2) (2014-03-28)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.2.0...version.1.5.2)
## [version.2.0](https://github.com/uclouvain/openjpeg/releases/tag/version.2.0) (2014-03-28)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5.1...version.2.0)
## [version.1.5.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5.1) (2012-09-13)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.5...version.1.5.1)
## [version.1.5](https://github.com/uclouvain/openjpeg/releases/tag/version.1.5) (2012-02-07)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.3...version.1.5)
## [version.1.3](https://github.com/uclouvain/openjpeg/releases/tag/version.1.3) (2011-07-03)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.4...version.1.3)
## [version.1.4](https://github.com/uclouvain/openjpeg/releases/tag/version.1.4) (2011-07-03)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.2...version.1.4)
## [version.1.2](https://github.com/uclouvain/openjpeg/releases/tag/version.1.2) (2007-06-04)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.1...version.1.2)
## [version.1.1](https://github.com/uclouvain/openjpeg/releases/tag/version.1.1) (2007-01-31)
List of fixed issues and enhancements unavailable, see [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) or [Full Changelog](https://github.com/uclouvain/openjpeg/compare/version.1.0...version.1.1)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

425
CHANGES Normal file
View File

@ -0,0 +1,425 @@
2012-09-10 Mathieu Malaterre
* [r1920] NEWS: [1.5] update NEWS file
* [r1919] libopenjpeg/j2k.c: [1.5] Fix Heap-based buffer-overflow
when decoding openjpeg image
Thanks to Huzaifa Sidhpurwala of Red Hat Security Response Team
for dataset to reproduce the issue.
Fixes issue 170
* [r1917] libopenjpeg/event.c: [1.5] Fix issue with str_length not
being used. Rewrite code to prefer use of vsnprintf to prevent
potential buffer overflow.
* [r1914] libopenjpeg/jpwl/crc.c, libopenjpeg/jpwl/jpwl_lib.c:
[1.5] remove extra trailing semicolon
2012-08-24 Mathieu Malaterre
* [r1899] applications/codec/j2k_dump.c,
applications/jpip/libopenjpip/byte_manager.c,
libopenjpeg/jpwl/jpwl_lib.c, libopenjpeg/tcd.c: [1.5] COMP: Fix
warnings identified by clang31
openjpeg/libopenjpeg/tcd.c:1884 col 48: warning: comparison of
unsigned expressi
on < 0 is always false
openjpeg/applications/codec/j2k_dump.c:362 col 29: warning:
equality comparison
with extraneous parentheses
openjpeg/libopenjpeg/jpwl/jpwl_lib.c:680:19: warning: format
specifies type 'int
' but the argument has type 'long long' [-Wformat]
printf("Marker@%d: %X\n", cio_tell(cio) - 2, id);
~^ ~~~~~~~~~~~~~~~~~
%lld
openjpeg/applications/jpip/libopenjpip/byte_manager.c:58:63:
warning: format spe
cifies type 'long' but the argument has type 'OPJ_OFF_T' (aka
'long long') [-Wfo
rmat]
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld,
%lu)\n", fd, offset
, size);
Author: Hans Johnson <hans-johnson@uiowa.edu>
2012-07-29 Mathieu Malaterre
* [r1736] applications/jpip/libopenjpip/sock_manager.c: [1.5]
Import portion of patch from Alex Zimnitsky to fix compilation on
FreeBSD
2012-07-11 Mathieu Malaterre
* [r1733] libopenjpeg/cio.c, libopenjpeg/cio.h: [1.5] Fix
compilation issue with Compiler Borland C++ v. 5.5
Fixes issue 154
* [r1732] libopenjpeg/j2k.c: [1.5] Fix r1727 (Issue 156) to compile
on compilers where false is not defined.
* [r1729] libopenjpeg/j2k.c, libopenjpeg/tcd.c: [1.5] This fixes
issues seen on PDF files
Fixes issue 156
2012-07-10 Mathieu Malaterre
* [r1727] libopenjpeg/j2k.c: [1.5] Fix heap buffer overflow
Enforce sanity checks on tile number and tile length, even when
the (rather
broken) USE_JPWL code isn't enabled.
2012-05-29 Mathieu Malaterre
* [r1705] libopenjpeg/jp2.c: [1.5] jp2_read_boxhdr() call ignores
return value
Fixes issue 91
* [r1704] applications/mj2/frames_to_mj2.c, applications/mj2/mj2.c,
applications/mj2/mj2_convert.c: [1.5] Make sure openjpeg/mj2 can
be compiled with gcc -std=c89
* [r1703] libopenjpeg/tcd.c: [1.5] This commit hides symptoms of
CVE-2009-5030
As explained in issue 5, comment 1. This is an easy fix to avoid
memory overrun.
Update issue 5
Update issue 62
* [r1702] libopenjpeg/j2k.c,
tests/nonregression/test_suite.ctest.in: [1.5] Applying old patch
from r1642, with further modification from winfried. Also enable
failing test. Everything seems to be working well now.
Fixes issue 150
* [r1701] libopenjpeg/tcd.c: [1.5] Import r1669 from trunk over to
1.5 branch
* [r1700] libopenjpeg/j2k.c, libopenjpeg/t1.c, libopenjpeg/t2.c,
libopenjpeg/tcd.c: [1.5] Apply private patch from Alex Macfarlane
Smith
This gets rids of a lot memory leaks when used on device with low
memory
* [r1696] applications/codec/convert.c, libopenjpeg/jp2.c: [1.5]
The two files in Issue145 have a precision < 8-bit:
therefore 'jp2_read_pclr' must be changed.
j2k_to_image fails to create RGB/RGBA images with a
precision < 8-bit: therefore 'imagetopng' must be
changed.
Update issue 145
* [r1694] libopenjpeg-jpwl.pc.in, libopenjpeg/Makefile.am: [1.5]
Fix autotools installation. Thanks to winfried for patch.
Update issue 149
* [r1693] libopenjpeg/opj_malloc.h: [1.5] Fix compilation on
FreeBSD. Thanks to rafael carre (funman@videolan.org) for patch.
Fixes issue 111
2012-05-21 Mathieu Malaterre
* [r1686] libopenjpeg/opj_malloc.h: [1.5] Build fails on AIX
Fixes issue 139
* [r1683] doc/man/man1/image_to_j2k.1, doc/man/man1/j2k_to_image.1,
doc/man/man3/libopenjpeg.3: [1.5] Man page syntax fixes. Thanks
to vskytta for patch.
Fixes issue 147
* [r1682] libopenjpeg/tcd.c: [1.5] fix compilation warning about
lrintf being implicit.
Fixes issue 144
2012-04-23 Mathieu Malaterre
* [r1649] libopenjpeg/j2k.c: [1.5] Revert r1642, as explained on
https://groups.google.com/group/openjpeg/msg/77a67fef94a0309b
* [r1648] tests/nonregression/test_suite.ctest.in: [1.5] Adding
test suite for file409752.jp2
* [r1647] CMakeLists.txt: [1.5] Make it easier to find /data from
within 1.5 sub-branch
* [r1643] applications/JavaOpenJPEG/JavaOpenJPEG.c,
applications/JavaOpenJPEG/JavaOpenJPEGDecoder.c,
applications/codec/convert.c: [1.5] Integrate patch from winfried
posted on the mailing list. See here for more info:
https://groups.google.com/group/openjpeg/msg/6488859a0dce77
* [r1642] libopenjpeg/j2k.c: [1.5] Integrate patch from winfried
posted on the mailing list. See here for more info:
https://groups.google.com/group/openjpeg/msg/1bbf7ae7ddee3a51
* [r1640] applications/mj2/extract_j2k_from_mj2.c,
applications/mj2/frames_to_mj2.c, applications/mj2/mj2.h,
applications/mj2/mj2_to_frames.c,
applications/mj2/wrap_j2k_in_mj2.c, libopenjpeg/openjpeg.h: [1.5]
Integrate patch from winfried posted on the mailing list. See
here for more info:
https://groups.google.com/group/openjpeg/msg/7e30b6e288ad5908
2012-04-20 Mathieu Malaterre
* [r1637] applications/jpip/util/CMakeLists.txt,
applications/jpip/util/addXMLinJP2.c: [1.5] Need to
compile/install tool to embed XML file in JP2 for jpip server
2012-04-19 Mathieu Malaterre
* [r1636] applications/JavaOpenJPEG/CMakeLists.txt,
applications/jpip/util/CMakeLists.txt: [1.5] jar files are arch
independant. We can install them safely in share
* [r1635] applications/jpip/util/CMakeLists.txt: [1.5] Add install
rules for openjpip client
* [r1634] applications/JavaOpenJPEG/CMakeLists.txt: [1.5] Add
missing symbols from getopt into the java glue lib
* [r1633] applications/JavaOpenJPEG/CMakeLists.txt: [1.5] resolve
missing symbols from convert.c/index.c
* [r1632] applications/JavaOpenJPEG/CMakeLists.txt: [1.5] Add
explicit linking from glue java lib to real openjpeg lib
* [r1631] applications/JavaOpenJPEG/CMakeLists.txt: [1.5] install
java module
* [r1630] CMake/OpenJPEGConfig.cmake.in, CMakeLists.txt: [1.5] Fix
computation of relative path from include/ to lib/
2012-04-18 Mathieu Malaterre
* [r1629] CMakeLists.txt, libopenjpeg/jpwl/CMakeLists.txt,
tests/unit/testempty1.c, tests/unit/testempty2.c: [1.5] fix
compilation warnings on windows box
2012-04-16 Mathieu Malaterre
* [r1628] libopenjpeg/jpwl/CMakeLists.txt: [1.5] debian tools
detected a missing link to math lib
2012-04-06 Mathieu Malaterre
* [r1626] tests/CMakeLists.txt, tests/unit,
tests/unit/CMakeLists.txt, tests/unit/testempty1.c,
tests/unit/testempty2.c: [1.5] Adding some simple unit tests
2012-04-05 Mathieu Malaterre
* [r1625] CMakeLists.txt: [1.5] introduce fix for the SOVERSION
regression introduced in 1.5.0
2012-03-16 Mathieu Malaterre
* [r1571] applications/jpip/libopenjpip/j2kheader_manager.c,
applications/jpip/libopenjpip/query_parser.c: [1.5] Remove a
simple warning report
* [r1570] applications/jpip/libopenjpip/query_parser.c: [1.5] I
think == was meant here.
2012-03-02 Mathieu Malaterre
* [r1534] applications/jpip/libopenjpip/channel_manager.c: [1.5]
Remove a warning about undefined snprintf on windows compiler.
* [r1533] applications/jpip/libopenjpip/auxtrans_manager.c,
applications/jpip/libopenjpip/byte_manager.h,
applications/jpip/libopenjpip/channel_manager.c,
applications/jpip/libopenjpip/channel_manager.h,
applications/jpip/libopenjpip/codestream_manager.c,
applications/jpip/libopenjpip/j2kheader_manager.c,
applications/jpip/libopenjpip/jp2k_decoder.c,
applications/jpip/libopenjpip/manfbox_manager.c,
applications/jpip/libopenjpip/marker_manager.c,
applications/jpip/libopenjpip/mhixbox_manager.c,
applications/jpip/libopenjpip/session_manager.c,
applications/jpip/libopenjpip/session_manager.h: [1.5] Change the
logic in byte_manager.h. Prefer the use of stdint.h when
available. Default to compiler specific mecanism otherwise.
Remove some c++ comments. Fix signed vs unsigned comparison
* [r1527] doc/CMakeLists.txt, doc/Doxyfile.dox.cmake.in: [1.5]
Finish import of r963
* [r1526] ., doc/Doxyfile.dox, doc/Doxyfile.dox.cmake.in,
doc/mainpage.dox.cmake[CPY]: [1.5] merge r963 from trunk over to
branch 1.5
* [r1524] tests/nonregression/test_suite.ctest.in: [1.5] Convert
from DOS eol to UNIX eol
* [r1517] libopenjpeg/jpwl/README.txt, libopenjpeg/jpwl/crc.c,
libopenjpeg/jpwl/jpwl.c: [1.5] Set from DOS eol to UNIX eol
* [r1510] libopenjpeg/cidx_manager.c: [1.5] Sync with trunk and
remove uneeded include headers
* [r1506] applications/mj2/extract_j2k_from_mj2.c,
applications/mj2/frames_to_mj2.c, applications/mj2/mj2.c: [1.5]
Import rev 1053 from trunk over to 1.5
* [r1504] applications/codec/j2k_dump.c: [1.5] Fix typo in date.
* [r1496] applications/jpip/libopenjpip/comMakefile.mk[DEL]: [1.5]
Sync with trunk. Remove remainings bits of old Makefile based
build system
* [r1492] applications/codec/index.c, applications/codec/index.h,
applications/codec/windirent.h: [1.5] Convert from DOS eol to
UNIX eol
* [r1488] applications/OPJViewer/CMakeLists.txt,
applications/OPJViewer/OPJViewer.iss,
applications/OPJViewer/Readme.txt,
applications/OPJViewer/about/about.htm,
applications/OPJViewer/source/OPJAbout.cpp,
applications/OPJViewer/source/OPJChild16.xpm,
applications/OPJViewer/source/OPJDialogs.cpp,
applications/OPJViewer/source/OPJThreads.cpp,
applications/OPJViewer/source/OPJViewer.cpp,
applications/OPJViewer/source/OPJViewer.h,
applications/OPJViewer/source/OPJViewer.rc,
applications/OPJViewer/source/OPJViewer16.xpm,
applications/OPJViewer/source/about_htm.h,
applications/OPJViewer/source/build.h,
applications/OPJViewer/source/imagjpeg2000.cpp,
applications/OPJViewer/source/imagjpeg2000.h,
applications/OPJViewer/source/imagmxf.cpp,
applications/OPJViewer/source/imagmxf.h,
applications/OPJViewer/source/license.txt,
applications/OPJViewer/source/readmeafter.txt,
applications/OPJViewer/source/readmebefore.txt,
applications/OPJViewer/source/wxj2kparser.cpp,
applications/OPJViewer/source/wxjp2parser.cpp: [1.5] Use UNIX eol
for source code
* [r1486] INSTALL: [1.5] Sync with trunk.
* [r1482] CMakeLists.txt: [1.5] As discussed on the mailing list.
OpenJPEG should be compatible with Multi-Arch distros. Thanks to
Rex for report
* [r1481] applications/jpip/libopenjpip/box_manager.c,
applications/jpip/libopenjpip/box_manager.h,
applications/jpip/libopenjpip/boxheader_manager.c,
applications/jpip/libopenjpip/byte_manager.h,
applications/jpip/libopenjpip/cachemodel_manager.c,
applications/jpip/libopenjpip/cachemodel_manager.h,
applications/jpip/libopenjpip/imgreg_manager.c,
applications/jpip/libopenjpip/imgreg_manager.h,
applications/jpip/libopenjpip/jp2k_encoder.c,
applications/jpip/libopenjpip/jpip_parser.c,
applications/jpip/libopenjpip/manfbox_manager.c,
applications/jpip/libopenjpip/manfbox_manager.h,
applications/jpip/libopenjpip/metadata_manager.c,
applications/jpip/libopenjpip/metadata_manager.h,
applications/jpip/libopenjpip/placeholder_manager.c,
applications/jpip/libopenjpip/placeholder_manager.h,
applications/jpip/libopenjpip/target_manager.c,
applications/jpip/libopenjpip/target_manager.h,
applications/jpip/util/jpip_to_j2k.c,
applications/jpip/util/opj_server.c: [1.5] Fix a bunch of
comparison between signed and unsigned integer expressions. Some
are still left to decide.
2012-03-01 Mathieu Malaterre
* [r1480] applications/jpip/libopenjpip/openjpip.c: [1.5] Fix rev
1474, typo in the spelling.
* [r1479] libopenjpeg/jpwl/jpwl.c: [1.5] Fix a warning about
comparison of ulong >= 0. Thanks to winfried for report.
* [r1475] applications/codec/convert.c: [1.5] Apply big-endian
patch from winfried: libopenjpeg and WORDS_BIGENDIAN, 2012/02/14
* [r1474] applications/jpip/libopenjpip/openjpip.c: Fix a warning
reported on the continuous dashboard for linux.
* [r1473] applications/codec/convert.c: [1.5] j2k_to_image does not
support writing image with precision less than 8bits. Simply give
up for now. Thanks to winfried for report. Also add static
keyword for undeclared function in convert.h
* [r1472] applications/jpip/libopenjpip/jpipstream_manager.c,
applications/jpip/libopenjpip/jpipstream_manager.h: [1.5] Fix a
warning about conversion from const char* to char*
* [r1471] CMakeLists.txt: [1.5] cmake recommends the use of
fullpath. Thanks to winfried for report.
* [r1468] libopenjpeg/jpwl/CMakeLists.txt: [1.5] Fix JPWL's DLL
installation. Thanks to winfried for report.
2012-02-29 Kaori Hagihara
* [r1467] applications/jpip/README: [1.5][JPIP] README modification
regarding the JP2 encoding
2012-02-28 Rex Dieter
* [r1464] CMakeLists.txt, libopenjpeg/CMakeLists.txt,
libopenjpeg1.pc.cmake: allow finer-grain control of header
location via OPENJPEG_INSTALL_INCLUDE_DIR
* [r1463] CMakeLists.txt, libopenjpeg1.pc.cmake: fix assumptions
that OPENJPEG_INSTALL_*_DIR aren't relative paths
2012-02-28 Kaori Hagihara
* [r1462] applications/jpip/CHANGES,
applications/jpip/libopenjpip/comMakefile.mk,
applications/jpip/libopenjpip/jpip_parser.c,
applications/jpip/libopenjpip/metadata_manager.c,
applications/jpip/libopenjpip/openjpip.c,
applications/jpip/libopenjpip/query_parser.c,
applications/jpip/util/opj_server.c: [1.5][JPIP] enabled the
opj_server to reply the first query consisting with len request
from kakadu client
2012-02-23 Rex Dieter
* [r1460] libopenjpeg1.pc.cmake, libopenjpeg1.pc.in: fix pkgconfig
to include -I/usr/include/openjpeg-1.5 in cflags (issue #118)
2012-02-17 Mathieu Malaterre
* [r1444] applications/jpip/util/CMakeLists.txt: [1.5] allow
mecanism to provide JFLAGS
2012-02-16 Mathieu Malaterre
* [r1437] CMakeLists.txt: only install CHANGES when present
* [r1436] applications/jpip/util/opj_dec_server.c: remove a warning
about unused variable
2012-02-14 Mathieu Malaterre
* [r1435] CMake/CTestCustom.cmake.in: Hide some warnings generated
by 3rd party libs
* [r1434] applications/jpip/util/opj_dec_server.c: Make the code
C90 compliant for VS2010
* [r1433] applications/jpip/util/CMakeLists.txt: Work around issue
with FindJava module
2012-02-13 Mathieu Malaterre
* [r1429] applications/jpip/libopenjpip/sock_manager.c: Use C style
comment.
* [r1424] applications/jpip/libopenjpip/sock_manager.c: [1.5] Need
to include unistd for close() declaration
* [r1423] applications/jpip/util/CMakeLists.txt: By default,
openjpip client can still built even without java compiler. Print
a message to the user as warning.
* [r1422] applications/jpip/CMakeLists.txt: [1.5] Fix typo in
CMAKE_USE_PTHREADS vs CMAKE_USE_PTHREADS_INIT
* [r1420] CMake/FindFCGI.cmake: [1.5] Backport diff from trunk
* [r1419] CMake/FindPTHREAD.cmake[DEL],
applications/jpip/CMakeLists.txt,
applications/jpip/libopenjpip/CMakeLists.txt: [1.5] Remove use of
custom PTHREAD module. Prefer cmake's one.
2012-02-10 Kaori Hagihara
* [r1405] applications/jpip/CHANGES, applications/jpip/README,
applications/jpip/util/opj_dec_server.c,
applications/jpip/util/opj_viewer/src/ImageManager.java,
applications/jpip/util/opj_viewer/src/ImageWindow.java,
applications/jpip/util/opj_viewer/src/ImgdecClient.java,
applications/jpip/util/opj_viewer_xerces/src/ImageWindow.java:
[1.5][JPIP] added execution argument to set port number for
opj_dec_server, opj_viewer*
* [r1404] applications/jpip/CHANGES,
applications/jpip/doc/Doxyfile: [1.5][JPIP] fixed Doxygen
configuration file to document the utilities
2012-02-10 Antonin Descampe
* [r1403] CMakeLists.txt, libopenjpeg/CMakeLists.txt: [1.5] revert
r1399 and r1400
* [r1402] doc/Makefile.am: [1.5] fixed an error in autotools that
prevented the build because no CHANGES file anymore
2012-02-10 Rex Dieter
* [r1401] CMake/OpenJPEGConfig.cmake.in: make OpenJPEGConfig.cmake
provide useful (non-empty) values
* [r1400] libopenjpeg/CMakeLists.txt: make openjpeg.h header
symlink to match autotools
* [r1399] CMakeLists.txt: install cmake/pkgconfig bits in LIB_DIR
2012-02-07 Antonin Descampe
* [r1391] CMake/OpenJPEGCPack.cmake: update OpenJPEGCPack.cmake
with correct package names

View File

@ -8,11 +8,11 @@
#
#----------------------------------------------------------------------
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
# Exclude files from the Testing directories
@ -22,19 +22,13 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
".*/thirdparty/.*"
)
set(CTEST_CUSTOM_WARNING_EXCEPTION
SET(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
# Ignore clang's summary warning, assuming prior text has matched some
# other warning expression:
"[0-9,]+ warnings? generated."
# Suppress warning caused by intentional messages about deprecation
".*warning,.* is deprecated"
# java also warns about deprecated API
".*java.*deprecation"
".*deprecation.*"
# suppress warnings caused by 3rd party libs:
".*thirdparty.*"
# supress warnings caused by 3rd party libs:
".*/thirdparty/.*"
"libtiff.*has no symbols"
"libpng.*has no symbols"
)

20
CMake/FindFCGI.cmake Normal file
View File

@ -0,0 +1,20 @@
# Look for the header file.
FIND_PATH(FCGI_INCLUDE_DIR NAMES fastcgi.h)
# Look for the library.
FIND_LIBRARY(FCGI_LIBRARY NAMES fcgi)
# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
# Copy the results to the output variables.
IF(FCGI_FOUND)
SET(FCGI_LIBRARIES ${FCGI_LIBRARY})
SET(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
ELSE(FCGI_FOUND)
SET(FCGI_LIBRARIES)
SET(FCGI_INCLUDE_DIRS)
ENDIF(FCGI_FOUND)
MARK_AS_ADVANCED(FCGI_INCLUDE_DIR FCGI_LIBRARY)

View File

@ -1,24 +1,19 @@
#
# this module looks for KAKADU
# this module looks for KAKADu
# http://www.kakadusoftware.com/
#
#
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
find_program(KDU_EXPAND_EXECUTABLE
FIND_PROGRAM(KDU_EXPAND_EXECUTABLE
kdu_expand
)
find_program(KDU_COMPRESS_EXECUTABLE
kdu_compress
)
mark_as_advanced(
MARK_AS_ADVANCED(
KDU_EXPAND_EXECUTABLE
KDU_COMPRESS_EXECUTABLE
)

View File

@ -12,20 +12,20 @@
#=============================================================================
#=============================================================================
find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
FIND_PATH(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
SET(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
FIND_LIBRARY(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
MARK_AS_ADVANCED(LCMS_INCLUDE_DIR LCMS_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
if(LCMS_FOUND)
set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
endif()
IF(LCMS_FOUND)
SET( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
ENDIF(LCMS_FOUND)

View File

@ -12,20 +12,20 @@
#=============================================================================
#=============================================================================
find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
FIND_PATH(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
if(LCMS2_FOUND)
set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
endif()
IF(LCMS2_FOUND)
SET( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
ENDIF(LCMS2_FOUND)

View File

@ -7,7 +7,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
endif()
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
endif()
endif(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
@ -28,45 +28,43 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
# Make this explicit here, rather than accepting the CPack default value,
# so we can refer to it:
set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
SET(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
if(NOT DEFINED CPACK_SYSTEM_NAME)
IF(NOT DEFINED CPACK_SYSTEM_NAME)
# make sure package is not Cygwin-unknown, for Cygwin just
# cygwin is good for the system name
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
set(CPACK_SYSTEM_NAME Cygwin)
else()
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
endif()
endif()
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
if(CMAKE_CL_64)
set(CPACK_SYSTEM_NAME win64-x64)
else()
set(CPACK_SYSTEM_NAME win32-x86)
endif()
endif()
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
SET(CPACK_SYSTEM_NAME Cygwin)
ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
IF(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME win64-x64)
ELSE(CMAKE_CL_64)
SET(CPACK_SYSTEM_NAME win32-x86)
ENDIF(CMAKE_CL_64)
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
# default to source package - system, on cygwin system is not
# default to source package - system, on cygwin system is not
# needed
if(CYGWIN)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
else()
set(CPACK_PACKAGE_FILE_NAME
IF(CYGWIN)
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
ELSE(CYGWIN)
SET(CPACK_PACKAGE_FILE_NAME
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
endif()
endif()
ENDIF(CYGWIN)
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
if(APPLE)
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
set(CPACK_BUNDLE_PLIST
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
#include(BundleUtilities)
endif()
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
SET(CPACK_BUNDLE_PLIST
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
#include(BundleUtilities)
include(CPack)
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")

View File

@ -0,0 +1,54 @@
#-----------------------------------------------------------------------------
#
# OPENJPEGConfig.cmake - CMake configuration file for external projects.
#
# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake
# module to load OPENJPEG's settings for an external project.
@OPENJPEG_CONFIG_INSTALL_ONLY@
# The OPENJPEG version number.
SET(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
SET(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
SET(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
# The libraries.
SET(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
# The CMake macros dir.
SET(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
# The configuration options.
SET(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
# The "use" file.
SET(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# The following is inspired from:
# http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Packaging_and_Exporting
# However the following is difficult to handle:
# get_filename_component(myproj_INCLUDE_DIRS "${SELF_DIR}/../../include/myproj" ABSOLUTE)
# it asssumes a non multi-arch system, where 'include' is located '../include' from lib
# therefore we need to take into account the number of subdirs in OPENJPEG_INSTALL_LIB_DIR
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
# This is an install tree
include(${SELF_DIR}/OpenJPEGTargets.cmake)
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/@relative_parent@/@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
else(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
# This is a build tree
SET( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
include(${SELF_DIR}/OpenJPEGExports.cmake)
else(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
message(FATAL_ERROR "ooops")
endif(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
endif(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
# Backward compatible part:
SET(OPENJPEG_FOUND TRUE)

View File

@ -6,41 +6,37 @@
# you will eventually like to prefix the library to avoid linking confusion
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
# e.g.:
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
cmake_minimum_required(VERSION 2.8.2)
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
if (NOT (${CMAKE_VERSION} VERSION_LESS 3.0))
cmake_policy(SET CMP0042 NEW)
endif()
endif()
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
if(NOT OPENJPEG_NAMESPACE)
set(OPENJPEG_NAMESPACE "OPENJPEG")
set(OPENJPEG_STANDALONE 1)
endif()
IF(NOT OPENJPEG_NAMESPACE)
SET(OPENJPEG_NAMESPACE "OPENJPEG")
SET(OPENJPEG_STANDALONE 1)
ENDIF(NOT OPENJPEG_NAMESPACE)
# In all cases:
#string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
set(OPENJPEG_LIBRARY_NAME openjp2)
STRING(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
project(${OPENJPEG_NAMESPACE} C)
PROJECT(${OPENJPEG_NAMESPACE} C)
# Do full dependency headers.
include_regular_expression("^.*$")
INCLUDE_REGULAR_EXPRESSION("^.*$")
#-----------------------------------------------------------------------------
# OPENJPEG version number, useful for packaging and doxygen doc:
set(OPENJPEG_VERSION_MAJOR 2)
set(OPENJPEG_VERSION_MINOR 2)
set(OPENJPEG_VERSION_BUILD 0)
set(OPENJPEG_VERSION
SET(OPENJPEG_VERSION_MAJOR 1)
SET(OPENJPEG_VERSION_MINOR 5)
SET(OPENJPEG_VERSION_BUILD 1)
SET(OPENJPEG_VERSION
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
set(PACKAGE_VERSION
SET(PACKAGE_VERSION
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
# Because autotools does not support X.Y notation for SOVERSION, we have to use
# two numbering, one for the openjpeg version and one for openjpeg soversion
# two numerorations, one for the openjpeg version and one for openjpeg soversion
# version | soversion
# 1.0 | 0
# 1.1 | 1
@ -50,37 +46,32 @@ set(PACKAGE_VERSION
# 1.5 | 5
# 1.5.1 | 5
# 2.0 | 6
# 2.0.1 | 6
# 2.1 | 7
# 2.1.1 | 7
# 2.1.2 | 7
# 2.2.0 | 8
# above is the recommendation by the OPJ team. If you really need to override this default,
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
if(NOT OPENJPEG_SOVERSION)
set(OPENJPEG_SOVERSION 7)
SET(OPENJPEG_SOVERSION 5)
endif(NOT OPENJPEG_SOVERSION)
set(OPENJPEG_LIBRARY_PROPERTIES
SET(OPENJPEG_LIBRARY_PROPERTIES
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
SOVERSION "${OPENJPEG_SOVERSION}"
)
# --------------------------------------------------------------------------
# Path to additional CMake modules
set(CMAKE_MODULE_PATH
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake
SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH})
# --------------------------------------------------------------------------
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
# warnings
if(WIN32)
if(NOT BORLAND)
if(NOT CYGWIN)
if(NOT MINGW)
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
add_definitions(
IF(WIN32)
IF(NOT BORLAND)
IF(NOT CYGWIN)
IF(NOT MINGW)
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
ADD_DEFINITIONS(
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
-D_CRT_IS_WCTYPE_NO_DEPRECATE
-D_CRT_MANAGED_FP_NO_DEPRECATE
@ -92,297 +83,215 @@ if(WIN32)
-D_CRT_VCCLRIT_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
)
endif()
endif()
endif()
endif()
endif()
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
ENDIF(NOT MINGW)
ENDIF(NOT CYGWIN)
ENDIF(NOT BORLAND)
ENDIF(WIN32)
# --------------------------------------------------------------------------
# Install directories
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
string(TOLOWER ${PROJECT_NAME} projectname)
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
STRING(TOLOWER ${PROJECT_NAME} projectname)
SET(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
if(NOT OPENJPEG_INSTALL_BIN_DIR)
set(OPENJPEG_INSTALL_BIN_DIR "bin")
endif()
IF(NOT OPENJPEG_INSTALL_BIN_DIR)
SET(OPENJPEG_INSTALL_BIN_DIR "bin")
ENDIF(NOT OPENJPEG_INSTALL_BIN_DIR)
if(NOT OPENJPEG_INSTALL_LIB_DIR)
set(OPENJPEG_INSTALL_LIB_DIR "lib")
endif()
IF(NOT OPENJPEG_INSTALL_LIB_DIR)
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
set(OPENJPEG_INSTALL_SHARE_DIR "share")
endif()
# The following will compute the amount of parent dir to go
# from include to lib. it works nicely with
# OPENJPEG_INSTALL_LIB_DIR=lib
# OPENJPEG_INSTALL_LIB_DIR=lib/
# OPENJPEG_INSTALL_LIB_DIR=/lib
# OPENJPEG_INSTALL_LIB_DIR=lib/gnu-linux-x64
STRING(REPLACE "/" ";" relative_to_lib ${OPENJPEG_INSTALL_LIB_DIR})
set(relative_parent "..")
foreach( elem ${relative_to_lib})
set( relative_parent "${relative_parent}/.." )
endforeach()
if(NOT OPENJPEG_INSTALL_DATA_DIR)
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
endif()
IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
SET(OPENJPEG_INSTALL_SHARE_DIR "share")
ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
endif()
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
SET(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
if(BUILD_DOC)
if(NOT OPENJPEG_INSTALL_MAN_DIR)
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
endif()
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
if(NOT OPENJPEG_INSTALL_DOC_DIR)
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
endif()
endif()
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
SET(OPENJPEG_INSTALL_MAN_DIR "share/man/")
ENDIF(NOT OPENJPEG_INSTALL_MAN_DIR)
if(NOT OPENJPEG_INSTALL_JNI_DIR)
if(WIN32)
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
else()
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
endif()
endif()
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
# We could install *.cmake files in share/ however those files contains
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if (APPLE)
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}")
option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
endif()
SET(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
#-----------------------------------------------------------------------------
# Big endian test:
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
#-----------------------------------------------------------------------------
# Setup file for setting custom ctest vars
configure_file(
${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/CTestCustom.cmake.in
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/CTestCustom.cmake
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in
${CMAKE_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
#-----------------------------------------------------------------------------
# OpenJPEG build configuration options.
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
SET (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
#-----------------------------------------------------------------------------
# configure name mangling to allow multiple libraries to coexist
# peacefully
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
@ONLY)
endif()
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
#-----------------------------------------------------------------------------
# pkgconfig support
IF(UNIX)
# install in lib and not share (see multi-arch note above)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
\"libopenjpeg1.pc\"
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_SHARE_DIR}/pkgconfig/libopenjpeg.pc\")")
ENDIF(UNIX)
#-----------------------------------------------------------------------------
# Compiler specific flags:
if(CMAKE_COMPILER_IS_GNUCC)
IF(CMAKE_COMPILER_IS_GNUCC)
# For all builds, make sure openjpeg is std99 compliant:
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
# SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
set(OPENJPEG_LIBRARY_COMPILE_OPTIONS ${OPENJPEG_LIBRARY_COMPILE_OPTIONS} "$<$<CONFIG:Release>:-ffast-math>")
endif()
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
#-----------------------------------------------------------------------------
# opj_config.h generation (1/2)
# Check if some include files are provided by the system
include(EnsureFileInclude)
# These files are mandatory
ensure_file_include("string.h" HAVE_STRING_H YES)
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
ensure_file_include("math.h" HAVE_MATH_H YES)
ensure_file_include("float.h" HAVE_FLOAT_H YES)
ensure_file_include("time.h" HAVE_TIME_H YES)
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
# For the following files, we provide an alternative, they are not mandatory
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
# why check this one ? for openjpip ?
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
# Enable Large file support
include(TestLargeFiles)
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
# Allocating Aligned Memory Blocks
include(CheckIncludeFiles)
check_include_files(malloc.h OPJ_HAVE_MALLOC_H)
include(CheckSymbolExists)
# _aligned_alloc https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
check_symbol_exists(_aligned_malloc malloc.h OPJ_HAVE__ALIGNED_MALLOC)
# posix_memalign (needs _POSIX_C_SOURCE >= 200112L on Linux)
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
unset(CMAKE_REQUIRED_DEFINITIONS)
# memalign (obsolete)
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
#-----------------------------------------------------------------------------
# Build Library
if(BUILD_JPIP_SERVER)
find_package(CURL REQUIRED)
find_package(FCGI REQUIRED)
find_package(Threads REQUIRED)
if(NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR "Only pthread are supported")
endif()
endif()
add_subdirectory(src/lib)
option(BUILD_LUTS_GENERATOR "Build utility to generate t1_luts.h" OFF)
INCLUDE_DIRECTORIES(BEFORE ${OPENJPEG_BINARY_DIR})
ADD_SUBDIRECTORY(libopenjpeg)
#-----------------------------------------------------------------------------
# Build Applications
option(BUILD_CODEC "Build the CODEC executables" ON)
option(BUILD_MJ2 "Build the MJ2 executables." OFF)
option(BUILD_JPWL "Build the JPWL library and executables" OFF)
option(BUILD_JPIP "Build the JPIP library and executables." OFF)
if(BUILD_JPIP)
option(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
endif()
option(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
option(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
option(BUILD_JP3D "Build the JP3D comp" OFF)
mark_as_advanced(BUILD_VIEWER)
mark_as_advanced(BUILD_JAVA)
mark_as_advanced(BUILD_JP3D)
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
IF(BUILD_JPIP)
OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
ENDIF(BUILD_JPIP)
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
MARK_AS_ADVANCED(BUILD_VIEWER)
MARK_AS_ADVANCED(BUILD_JAVA)
if(BUILD_CODEC OR BUILD_MJ2)
IF(BUILD_CODEC OR BUILD_MJ2)
# OFF: It will only build 3rd party libs if they are not found on the system
# ON: 3rd party libs will ALWAYS be build, and used
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
add_subdirectory(thirdparty)
add_subdirectory(src/bin)
endif ()
add_subdirectory(wrapping)
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
ADD_SUBDIRECTORY(thirdparty)
ADD_SUBDIRECTORY(applications)
ENDIF (BUILD_CODEC OR BUILD_MJ2)
#-----------------------------------------------------------------------------
# opj_config.h generation (2/2)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
@ONLY
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
"${OPENJPEG_BINARY_DIR}/opj_config.h"
@ONLY
)
#-----------------------------------------------------------------------------
# build documentation in doc subdir:
if(BUILD_DOC)
add_subdirectory(doc)
endif()
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
IF(BUILD_DOC)
ADD_SUBDIRECTORY(doc)
ENDIF(BUILD_DOC)
#-----------------------------------------------------------------------------
# Buld Testing
option(BUILD_TESTING "Build the tests." OFF)
if(BUILD_TESTING)
if(BUILD_CODEC)
enable_testing()
include(CTest)
OPTION(BUILD_TESTING "Build the tests." OFF)
IF(BUILD_TESTING)
IF(BUILD_CODEC)
ENABLE_TESTING()
INCLUDE(CTest)
# Search openjpeg data needed for the tests
# They could be found via git on the OpenJPEG GitHub code project
# git clone https://github.com/uclouvain/openjpeg-data.git
find_path(OPJ_DATA_ROOT README-OPJ-Data
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
# They could be found via svn on the OpenJPEG google code project
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
PATHS
$ENV{OPJ_DATA_ROOT}
${CMAKE_SOURCE_DIR}/../data
${CMAKE_SOURCE_DIR}/../../data
)
# Add repository where to find tests
add_subdirectory(tests)
else()
ADD_SUBDIRECTORY(tests)
ELSE(BUILD_CODEC)
message(FATAL_ERROR "You need build codec to run the tests")
endif()
endif()
ENDIF(BUILD_CODEC)
ENDIF(BUILD_TESTING)
#-----------------------------------------------------------------------------
# install all targets referenced as OPENJPEGTargets
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
INSTALL(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
CONFIGURE_FILE( ${OPENJPEG_SOURCE_DIR}/CMake/OpenJPEGConfig.cmake.in
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
@ONLY
)
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
)
#-----------------------------------------------------------------------------
# install CHANGES and LICENSE
if(BUILD_DOC)
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
IF(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
INSTALL(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
ENDIF(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
INSTALL(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
include (cmake/OpenJPEGCPack.cmake)
#-----------------------------------------------------------------------------
# pkgconfig support
# enabled by default on Unix, disabled by default on other platforms
if(UNIX)
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" ON)
else()
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" OFF)
endif()
if(BUILD_PKGCONFIG_FILES)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
#
if(BUILD_JPWL)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpwl/libopenjpwl.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
#
if(BUILD_JPIP)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpip/libopenjpip.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
#
if(BUILD_JP3D)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp3d/libopenjp3d.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc DESTINATION
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
endif()
#-----------------------------------------------------------------------------
INCLUDE (CMake/OpenJPEGCPack.cmake)

114
INSTALL Normal file
View File

@ -0,0 +1,114 @@
How to build and install openjpeg binaries
==========================================
UNIX/LINUX similar systems
--------------------------
1) Using autotools
It is highly recommended that pkg-config is installed. If needed, you have to
properly set the environment variable PKG_CONFIG_PATH so that the .pc files
are found.
To build from top-level directory, you can simply type:
./bootstrap.sh
./configure
make
To keep all build files in a separate directory, you can type instead:
./bootstrap.sh
mkdir build
cd build
../configure
make
To install:
sudo make install
To clean:
make clean
make distclean
To build doc (requires 'doxygen' to be found on your system):
(this will create an html directory in TOP_LEVEL/doc)
make doc
Main './configure' options (type './configure --help' for more details)
'--enable-mj2'
'--enable-jpwl'
'--enable-jpip'
'--prefix=/path/to/install/directory' (example : '--prefix=$PWD/installed')
'--enable-debug' (default : disabled)
You can also specify your own CFLAGS and LDFLAGS with (for example):
CFLAGS="-O3 -pipe" LDFLAGS="-Wl,-s" ./configure
The (optional) dependencies of some binaries are libpng, libtiff, libcms 1 or 2
and FastCGI. Only libtiff and FastCGI have no .pc file. There should be some
automatic detection if they are installed in /usr, /usr/local or /opt/local.
Otherwise, you can tune their detection (as well as for libpng and libcms1 or 2
too) with the environment variables:
TIFF_CFLAGS
TIFF_LIBS
FCGI_CFLAGS
FCGI_LIBS
See './configure --help' output for more details.
2) Using cmake (see www.cmake.org)
Type:
cmake .
make
If you are root:
make install
else if you have sudo power:
sudo make install
else
DESTDIR=$HOME/local make install
To build the Doxygen documentation (Doxygen needs to be found on the system):
(A 'html' directory is generated in the 'doc' directory)
make doc
Binaries are located in the 'bin' directory.
Main available cmake flags:
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path', or use DESTDIR env variable (see above)
* To build the shared libraries and links the executables against it: '-DBUILD_SHARED_LIBS:bool=on' (default: 'ON')
Note: when using this option, static libraries are not built and executables are dynamically linked.
* To build the CODEC executables: '-DBUILD_CODEC:bool=on' (default: 'ON')
* To build the MJ2 executables: '-DBUILD_MJ2:bool=on' (default: 'OFF')
* To build the JPWL executables and JPWL library: '-DBUILD_JPWL:bool=on' (default: 'OFF')
* To build the JPIP library and utilities: '-DBUILD_JPIP:bool=on' (default: 'OFF')
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory'
make
make Experimental
Note : JPEG2000 test files are available with 'svn checkout http://openjpeg.googlecode.com/svn/data' (about 70 Mo).
If '-DOPJ_DATA_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE_SOURCE_DIR}/../data',
corresponding to the location of the data directory when compiling from the trunk (and assuming the data directory has
been checked out of course).
MACOSX
------
The same building procedures as above (autotools and cmake) work for MACOSX.
The xcode project file can also be used.
If it does not work, try adding the following flag to the cmake command :
'-DCMAKE_OSX_ARCHITECTURES:STRING=i386'
WINDOWS
-------
If you're using cygwin or MinGW+MSYS, the same procedures as for Unix can be used.
Otherwise you can use cmake to generate project files for the IDE you are using (VC2010, etc).
Type 'cmake --help' for available generators on your platform.

View File

@ -1,75 +0,0 @@
# OpenJPEG installation
The build method maintained by OpenJPEG is [CMake](https://cmake.org/).
## UNIX/LINUX - MacOS (terminal) - WINDOWS (cygwin, MinGW)
To build the library, type from source tree directory:
```
mkdir build
cd build
cmake ..
make
```
Binaries are then located in the 'bin' directory.
To install the library, type with root privileges:
```
make install
make clean
```
To build the html documentation, you need doxygen to be installed on your system.
It will create an "html" directory in TOP\_LEVEL/build/doc)
```
make doc
```
Main available cmake flags:
* To specify the install path: '-DCMAKE\_INSTALL\_PREFIX=/path'
* To build the shared libraries and links the executables against it: '-DBUILD\_SHARED\_LIBS:bool=on' (default: 'ON')
> Note: when using this option, static libraries are not built and executables are dynamically linked.
* To build the CODEC executables: '-DBUILD\_CODEC:bool=on' (default: 'ON')
* [OBSOLETE] To build the MJ2 executables: '-DBUILD\_MJ2:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPWL executables and JPWL library: '-DBUILD\_JPWL:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPIP client (java compiler recommended) library and executables: '-DBUILD\_JPIP:bool=on' (default: 'OFF')
* [OBSOLETE] To build the JPIP server (need fcgi) library and executables: '-DBUILD\_JPIP\_SERVER:bool=on' (default: 'OFF')
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
```
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory' -DBUILDNAME:STRING='name_of_the_build'
make
make Experimental
```
Note : test data is available on the following github repo: https://github.com/uclouvain/openjpeg-data
If '-DOPJ\_DATA\_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE\_SOURCE\_DIR}/../data'.
Note 2 : to execute the encoding test suite, kakadu binaries are needed to decode encoded image and compare it to the baseline. Kakadu binaries are freely available for non-commercial purposes at http://www.kakadusoftware.com. kdu\_expand will need to be in your PATH for cmake to find it.
Note 3 : OpenJPEG encoder and decoder (not the library itself !) depends on several libraries: png, tiff, lcms, z. If these libraries are not found on the system, they are automatically built from the versions available in the source tree. You can force the use of these embedded version with BUILD\_THIRDPARTY:BOOL=ON. On a Debian-like system you can also simply install these libraries with:
```
sudo apt-get install liblcms2-dev libtiff-dev libpng-dev libz-dev
```
Note 4 : On MacOS, if it does not work, try adding the following flag to the cmake command :
```
-DCMAKE_OSX_ARCHITECTURES:STRING=i386
```
## MacOS (XCode) - WINDOWS (VisualStudio, etc)
You can use cmake to generate the project files for the IDE you are using (VC2010, XCode, etc).
Type 'cmake --help' for available generators on your platform.
# Using OpenJPEG
To use openjpeg exported cmake file, simply create your application doing:
```
$ cat CMakeLists.txt
find_package(OpenJPEG REQUIRED)
include_directories(${OPENJPEG_INCLUDE_DIRS})
add_executable(myapp myapp.c)
target_link_libraries(myapp ${OPENJPEG_LIBRARIES})
```

14
LICENSE
View File

@ -1,19 +1,11 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2002-2012, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2012, Professor Benoit Macq
* Copyright (c) 2003-2012, Antonin Descampe
* Copyright (c) 2003-2009, Francois-Olivier Devaux
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* Copyright (c) 2012, CS Systemes d'Information, France
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

75
Makefile.am Normal file
View File

@ -0,0 +1,75 @@
DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpip-server=yes --enable-jpwl=yes --enable-mj2=yes
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = libopenjpeg applications doc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libopenjpeg1.pc
if WANT_JPWL
pkgconfig_DATA += libopenjpeg-jpwl.pc
endif
MAINTAINERCLEANFILES = \
Makefile.in \
aclocal.m4 \
config.guess \
opj_config.h.in \
opj_config.h.in~ \
config.sub \
configure \
depcomp \
install-sh \
ltmain.sh \
missing
EXTRA_DIST = \
CMake/CTestCustom.cmake.in \
CMake/FindFCGI.cmake \
CMake/FindLCMS2.cmake \
CMake/FindLCMS.cmake \
CMake/OpenJPEGConfig.cmake.in \
CMakeLists.txt \
CTestConfig.cmake \
AUTHORS \
CHANGES \
INSTALL \
LICENSE \
NEWS \
README \
THANKS \
bootstrap.sh \
libopenjpeg1.pc.cmake \
libopenjpeg1.pc.in \
libopenjpeg-jpwl.pc.in \
opj_config.h.cmake.in \
m4/opj_check_lib.m4 \
m4/opj_doxygen.m4 \
m4/pkg.m4
.PHONY: doc
# Documentation
doc:
@echo "entering doc/"
@cd doc && make doc
install-data-hook:
if HAVE_WIN32
$(LN_S) -f libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
else
$(LN_S) -nf libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
endif
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt
@echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt
if WANT_JPWL
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg-jpwl.pc" >> $(top_builddir)/report.txt
endif
@cat $(top_builddir)/report.txt
@rm $(top_builddir)/report.txt
uninstall-hook:
rm -f $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc

24
NEWS Normal file
View File

@ -0,0 +1,24 @@
OpenJPEG NEWS - user visible changes
====================================
Changes from OpenJPEG 1.5.1 to OpenJPEG 1.5.0
----------------------------------------------
Security:
* Fixes: CVE-2012-3535
* Fixes: CVE-2012-3358
New Features:
* Use a new API scheme and solve the SOVERSIONing in OpenJPEG
* Allow better integration with multi-arch system
* Compile & Install Java bindings (CMake)
* Install required addXMLinJP2 (JPIP)
Misc:
* fix linker error by resolving all symbols (eg. missing -lm)
* fix some man page typos
* Huge amount of bug fixes. See CHANGES for details.

72
NEWS.md
View File

@ -1,72 +0,0 @@
# OpenJPEG NEWS
More details in the [Changelog](https://github.com/uclouvain/openjpeg/blob/master/CHANGELOG.md)
## OpenJPEG 2.1.2
* Bug fixes (including security fixes)
* No API/ABI break compared to v2.1.1
## OpenJPEG 2.1.1
* Huge amount of critical bugfixes
* Speed improvements
* No API/ABI break compared to v2.1
## OpenJPEG 2.1.0
### New Features
* Digital Cinema profiles have been fixed and updated
* New option to disable MCT if needed
* extended RAW support: it is now possible to input raw images
with subsampled color components (422, 420, etc)
* New way to deal with profiles
### API/ABI modifications
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
* Removed deprecated functions
* opj_stream_create_default_file_stream(FILE*,...)
* opj_stream_create_file_stream(FILE*,...)
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
* Added
* opj_stream_create_default_file_stream(char*,...)
* opj_stream_create_file_stream(char*,...)
* opj_stream_destroy(opj_stream_t*)
* opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
... opj_stream_free_user_data_fn p_function)
* JPEG 2000 profiles and Part-2 extensions defined through '#define'
* Changed
* 'alpha' field added to 'opj_image_comp' structure
* 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
* 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
* 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
(not yet used in use)
* 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
### Misc
* OpenJPEG is now officially conformant with JPEG 2000 Part-1
and will soon become official reference software at the
JPEG committee.
* Huge amount of bug fixes. See CHANGES for details.
## OpenJPEG 2.0.0
### New Features
* streaming capabilities
* merge JP3D
### API modifications
(see [here](http://www.openjpeg.org/abi-check/timeline/openjpeg/) for details)
* Use a 64bits capable API
### Misc
* removed autotools build system
* folders hierarchies reorganisation
* Huge amount of bug fixes. See CHANGES for details.

25
README Normal file
View File

@ -0,0 +1,25 @@
OPENJPEG LIBRARY and APPLICATIONS
----------------------------------
Details on folders hierarchy:
* libopenjpeg: contains the sources of the openjpeg library
* jpwl: contains the additional sources if you want to build a JPWL-flavoured library.
* applications: contains all applications that use the openjpeg library
* common: common files to all applications
* codec: a basic codec
* mj2: motion jpeg 2000 executables
* JavaOpenJPEG: java jni to use openjpeg in a java program
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
* OPJViewer: gui for displaying j2k files (based on wxWidget)
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
* doc: doxygen documentation setup file and man pages
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in 'http://openjpeg.googlecode.com/svn/data' folder.
* CMake: cmake related files
* m4: autotools related files
see LICENSE for license and copyright information.
see INSTALL for installation procedures.
see NEWS for user visible changes in successive releases.
see CHANGES for per-revision changes.

View File

@ -1,82 +0,0 @@
# OPENJPEG Library and Applications
## What is OpenJPEG ?
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of [JPEG 2000](http://www.jpeg.org/jpeg2000), a still-image compression standard from the Joint Photographic Experts Group ([JPEG](http://www.jpeg.org)). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a [JPEG 2000 Reference Software](http://www.itu.int/rec/T-REC-T.804-201504-I!Amd2).
## Who can use the code ?
[![badge-license]][link-license]
Anyone. As the OpenJPEG code is released under the [BSD 2-clause "Simplified" License][link-license], anyone can use or modify the code, even for commercial applications. The only restriction is to retain the copyright in the sources or in the binaries documentation. Of course, if you modified the code in a way that might be of interest for other users, you are encouraged to share it (through a [github pull request](https://github.com/uclouvain/openjpeg/pulls) or by filling an [issue](https://github.com/uclouvain/openjpeg/issues)) but this is not a requirement.
## How to install and use OpenJPEG ?
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
## Current Status
[![badge-build]][link-build]
[![badge-msvc-build]][link-msvc-build]
[![badge-coverity]][link-coverity]
## Who are the developers ?
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).
## Details on folders hierarchy
* src
* lib
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
* openjp3d: JP3D implementation
* openmj2: MJ2 implementation
* bin: contains all applications that use the openjpeg library
* common: common files to all applications
* jp2: a basic codec
* mj2: motion jpeg 2000 executables
* jpip: OpenJPIP applications (server and dec server)
* java: a Java client viewer for JPIP
* jp3d: JP3D applications
* tcltk: a test tool for JP3D
* wx
* OPJViewer: gui for displaying j2k files (based on wxWidget)
* wrapping
* java: java jni to use openjpeg in a java program
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
* doc: doxygen documentation setup file and man pages
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in [openjpeg-data](https://github.com/uclouvain/openjpeg-data) repository.
* cmake: cmake related files
See [LICENSE][link-license] for license and copyright information.
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
## API/ABI
An API/ABI timeline is automatically updated [here][link-api-timeline].
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
only exposes a limited subset of its functions. It uses a mechanism of
exporting/hiding functions. If you are unsure which functions you can use in
your applications, you should compile OpenJPEG using something similar to gcc:
`-fvisibility=hidden` compilation flag.
See also: http://gcc.gnu.org/wiki/Visibility
On windows, MSVC directly supports export/hiding function and as such the only
API available is the one supported by OpenJPEG.
[comment-license]: https://img.shields.io/github/license/uclouvain/openjpeg.svg "https://img.shields.io/badge/license-BSD--2--Clause-blue.svg"
[badge-license]: https://img.shields.io/badge/license-BSD--2--Clause-blue.svg "BSD 2-clause "Simplified" License"
[link-license]: https://github.com/uclouvain/openjpeg/blob/master/LICENSE "BSD 2-clause "Simplified" License"
[badge-build]: https://travis-ci.org/uclouvain/openjpeg.svg?branch=master "Build Status"
[link-build]: https://travis-ci.org/uclouvain/openjpeg "Build Status"
[badge-msvc-build]: https://ci.appveyor.com/api/projects/status/github/uclouvain/openjpeg?branch=master&svg=true "Windows Build Status"
[link-msvc-build]: https://ci.appveyor.com/project/detonin/openjpeg/branch/master "Windows Build Status"
[badge-coverity]: https://scan.coverity.com/projects/6383/badge.svg "Coverity Scan Build Status"
[link-coverity]: https://scan.coverity.com/projects/uclouvain-openjpeg "Coverity Scan Build Status"
[link-api-timeline]: http://www.openjpeg.org/abi-check/timeline/openjpeg "OpenJPEG API/ABI timeline"

33
THANKS Normal file
View File

@ -0,0 +1,33 @@
OpenJPEG THANKS file
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
or submitting actual code. Here is a list of these people. Help me keep
it complete and exempt of errors.
Mathieu Malaterre
Winfried Szukalski
Vincent Torri
Bob Friesenhahn
Callum Lerwick
Dzonatas Sol
Mickaël Savinaud
Julien Malik
Jerôme Fimes
Herve Drolon
Yannick Verschueren
Sebastien Lugan
Kaori Hagihara
Peter Wimmer
Francois-Olivier Devaux
Antonin Descampe
David Janssens
Pr. Benoit Macq
Luis Ibanez
Ben Boeckel
Vincent Nicolas
Glenn Pearson
Giuseppe Baruffa
Arnaud Maye
Rex Dieter
David Burken
Parvatha Elangovan

View File

@ -1,39 +0,0 @@
# OpenJPEG THANKS file
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
or submitting actual code. Here is a list of these people. Help me keep
it complete and exempt of errors.
* Giuseppe Baruffa
* Ben Boeckel
* Aaron Boxer
* David Burken
* Matthieu Darbois
* Rex Dieter
* Herve Drolon
* Antonin Descampe
* Francois-Olivier Devaux
* Parvatha Elangovan
* Jerôme Fimes
* Bob Friesenhahn
* Kaori Hagihara
* Luc Hermitte
* Luis Ibanez
* David Janssens
* Hans Johnson
* Callum Lerwick
* Ke Liu (Tencent's Xuanwu LAB)
* Sebastien Lugan
* Benoit Macq
* Mathieu Malaterre
* Julien Malik
* Arnaud Maye
* Vincent Nicolas
* Aleksander Nikolic (Cisco Talos)
* Glenn Pearson
* Even Rouault
* Dzonatas Sol
* Winfried Szukalski
* Vincent Torri
* Yannick Verschueren
* Peter Wimmer

View File

@ -0,0 +1,22 @@
# Build the each application if it needed
IF(BUILD_CODEC)
ADD_SUBDIRECTORY(codec)
ENDIF(BUILD_CODEC)
IF(BUILD_MJ2)
ADD_SUBDIRECTORY(mj2)
ENDIF(BUILD_MJ2)
# Client & Server:
IF(BUILD_JPIP)
ADD_SUBDIRECTORY(jpip)
ENDIF(BUILD_JPIP)
IF(BUILD_VIEWER)
ADD_SUBDIRECTORY(OPJViewer)
ENDIF(BUILD_VIEWER)
IF(BUILD_JAVA)
ADD_SUBDIRECTORY(JavaOpenJPEG)
ENDIF(BUILD_JAVA)

View File

@ -1,12 +1,13 @@
#JavaOpenJPEG/CMakeLists.txt
# First thing define the common source:
set(openjpegjni_SRCS
SET(openjpegjni_SRCS
JavaOpenJPEGDecoder.c
JavaOpenJPEG.c
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
index.c
${OPENJPEG_SOURCE_DIR}/applications/codec/index.c
${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c
#${OPENJPEG_SOURCE_DIR}/applications/common/color.c
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
)
# JNI binding:
@ -15,36 +16,29 @@ include_directories(${JNI_INCLUDE_DIRS})
# required header file:
include_directories(
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
${OPENJPEG_SOURCE_DIR}/src/bin/common
${OPENJPEG_SOURCE_DIR}/src/bin/jp2
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${OPENJPEG_SOURCE_DIR}/applications/common
${OPENJPEG_SOURCE_DIR}/applications/codec
)
add_library(openjpegjni MODULE
${openjpegjni_SRCS}
)
# Java module should not have a SONAME:
set_property(TARGET openjpegjni PROPERTY NO_SONAME 1)
TARGET_LINK_LIBRARIES(openjpegjni ${OPENJPEG_LIBRARY_NAME})
# FIXME (need to use old API):
if(BUILD_MJ2)
target_link_libraries(openjpegjni openmj2)
endif()
target_link_libraries(openjpegjni
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ${Z_LIBNAME}
)
if(UNIX)
target_link_libraries(openjpegjni m)
endif()
IF(WIN32)
SET(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
ELSE()
SET(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
ENDIF()
install(TARGETS openjpegjni
INSTALL(TARGETS openjpegjni
EXPORT OpenJPEGTargets
LIBRARY DESTINATION ${OPENJPEG_INSTALL_JNI_DIR} COMPONENT Libraries
)
# build jar:
find_package(Java 1.5 REQUIRED) # javac, jar
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
# build dep list:
file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
@ -52,7 +46,7 @@ file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
# make sure target javac dir exists:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
# Build java
add_custom_command(
ADD_CUSTOM_COMMAND(
OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes
@ -63,11 +57,11 @@ add_custom_command(
)
# name the target
add_custom_target(OpenJPEGJavaJar ALL
ADD_CUSTOM_TARGET(OpenJPEGJavaJar ALL
DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
COMMENT "building openjpeg.jar"
)
install(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
)

View File

@ -1,10 +1,9 @@
/*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2006-2007, Parvatha Elangovan
* Copyright (c) 2007, Patrick Piscaglia (Telemis)
@ -38,7 +37,6 @@
#include <math.h>
#include "openjpeg.h"
#include "opj_includes.h"
#include "opj_getopt.h"
#include "convert.h"
#include "index.h"
@ -91,7 +89,7 @@ typedef struct img_folder{
float *rates;
}img_fol_t;
static void encode_help_display() {
void encode_help_display() {
fprintf(stdout,"HELP\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
@ -206,7 +204,7 @@ static void encode_help_display() {
fprintf(stdout," Indicate multiple modes by adding their values. \n");
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
fprintf(stdout,"\n");
fprintf(stdout,"-TP : divide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
fprintf(stdout,"-TP : devide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
fprintf(stdout,"\n");
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
fprintf(stdout,"\n");
@ -331,7 +329,7 @@ static void encode_help_display() {
}
static OPJ_PROG_ORDER give_progression(const char progression[4]) {
OPJ_PROG_ORDER give_progression(char progression[4]) {
if(strncmp(progression, "LRCP", 4) == 0) {
return LRCP;
}
@ -351,6 +349,19 @@ static OPJ_PROG_ORDER give_progression(const char progression[4]) {
return PROG_UNKNOWN;
}
/*
* <summary>
* Get logarithm of an integer and round downwards.
* </summary>
*/
int int_floorlog2(int a) {
int l;
for (l=0; a>1; l++) {
a>>=1;
}
return l;
}
static int initialise_4K_poc(opj_poc_t *POC, int numres){
POC[0].tile = 1;
POC[0].resno0 = 0;
@ -369,7 +380,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
return 2;
}
static void cinema_parameters(opj_cparameters_t *parameters){
void cinema_parameters(opj_cparameters_t *parameters){
parameters->tile_size_on = OPJ_FALSE;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
@ -402,7 +413,7 @@ static void cinema_parameters(opj_cparameters_t *parameters){
}
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
int i;
float temp_rate;
opj_poc_t *POC = NULL;
@ -484,7 +495,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
/* ------------------------------------------------------------------------------------ */
static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
int parse_cmdline_encoder(int argc, char * const argv[], opj_cparameters_t *parameters,
img_fol_t *img_fol, char *indexfilename) {
int i, j,totlen;
opj_option_t long_option[]={
@ -502,7 +513,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
/* parse the command line */
/* UniPG>> */
const char optlist[] = "i:o:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:"
const char optlist[] = "i:o:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:J"
#ifdef USE_JPWL
"W:"
#endif /* USE_JPWL */
@ -617,7 +628,9 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
parameters->tcp_numlayers = numlayers;
numresolution = parameters->numresolution;
matrix_width = numresolution * 3;
parameters->cp_matrice = (int *) opj_malloc(numlayers * matrix_width * sizeof(int));
parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int));
if(parameters->cp_matrice == NULL) return 1;
s = s + 2;
for (i = 0; i < numlayers; i++) {
@ -845,7 +858,10 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
case 'C': /* add a comment */
{
parameters->cp_comment = (char*)opj_malloc(strlen(opj_optarg) + 1);
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
if(parameters->cp_comment == NULL) return 1;
if(parameters->cp_comment) {
strcpy(parameters->cp_comment, opj_optarg);
}
@ -874,7 +890,10 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
case 'z': /* Image Directory path */
{
img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
if(img_fol->imgdirpath == NULL) return 1;
strcpy(img_fol->imgdirpath,opj_optarg);
img_fol->set_imgdir=1;
}
@ -1236,6 +1255,10 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
/* <<UniPG */
/* ------------------------------------------------------ */
case 'J': /* jpip on */
{
parameters->jpip_on = OPJ_TRUE;
}
break;
/* ------------------------------------------------------ */
@ -1325,7 +1348,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
start position in the codestream
end position of this packet
*/
static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer_size) {
char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer_size) {
int tileno, compno, layno, resno, precno, pack_nb, x, y;
char* buffer = NULL;
int buffer_pos = 0;
@ -1334,11 +1357,11 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
prec_max = 0;
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
for (resno = 0; resno < cstr_info->numdecompos[0] + 1; resno++) {
prec_max = int_max(prec_max,cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]);
prec_max = max(prec_max,cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]);
}
}
/* Compute the size of the index buffer, in number of bytes*/
/* Compute the size of the index buffer, in number of bytes*/
*buffer_size =
1 /* version */
+ (10 /* image_w until decomposition */
@ -1347,18 +1370,18 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
+ cstr_info->tw * cstr_info->th * 4 /* tile info, without distorsion info */
+ cstr_info->tw*cstr_info->th * cstr_info->numlayers * (cstr_info->numdecompos[0] + 1) * cstr_info->numcomps * prec_max *8
) * sizeof(int);
/*printf("C: index buffer size = %d bytes\n", *buffer_size);*/
buffer = (char*) opj_malloc(*buffer_size);
/*printf("C: index buffer size = %d bytes\n", *buffer_size); */
buffer = (char*) malloc(*buffer_size);
if (!buffer) {
/*opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size);*/
/* opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size); */
fprintf(stderr, "failed to allocate index buffer for writing %d int\n", *buffer_size);
return 0;
}
buffer[0] = 1; /* Version stored on a byte*/
buffer[0] = 1; /* Version stored on a byte */
buffer++;
/* Remaining informations are stored on a int.*/
/* Remaining informations are stored on a int. */
((int*)buffer)[buffer_pos++] = cstr_info->image_w;
((int*)buffer)[buffer_pos++] = cstr_info->image_h;
((int*)buffer)[buffer_pos++] = cstr_info->prog;
@ -1583,7 +1606,7 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
} /* tileno */
if (buffer_pos > *buffer_size) {
/*opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);*/
/* opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size); */
fprintf(stderr, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);
return 0;
}
@ -1597,7 +1620,7 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
/* --------------------------------------------------------------------------
------------ Get the image byte[] from the Java object -------------------*/
static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj, jclass cls) {
opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj, jclass cls) {
int i,max,shift,w,h,depth;
opj_image_t * img = NULL;
int compno, numcomps;
@ -1616,7 +1639,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
jint *jiBody;
jboolean isCopy;
/* Image width, height and depth*/
/* Image width, height and depth */
fid = (*env)->GetFieldID(env, cls,"width", "I");
ji = (*env)->GetIntField(env, obj, fid);
w = ji;
@ -1629,7 +1652,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
ji = (*env)->GetIntField(env, obj, fid);
depth = ji;
/* Read the image*/
/* Read the image */
if (depth <=16) {
numcomps = 1;
color_space = CLRSPC_GRAY;
@ -1644,8 +1667,10 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
cmptparm[0].y0 = parameters->image_offset_y0;
cmptparm[0].w = !cmptparm[0].x0 ? (w - 1) * parameters->subsampling_dx + 1 : cmptparm[0].x0 + (w - 1) * parameters->subsampling_dx + 1;
cmptparm[0].h = !cmptparm[0].y0 ? (h - 1) * parameters->subsampling_dy + 1 : cmptparm[0].y0 + (h - 1) * parameters->subsampling_dy + 1;
/* Java types are always signed but we use them as unsigned types (shift of the negative part of
the pixels of the images in Telemis before entering the encoder).*/
/* Java types are always signed but we use them as unsigned types
* (shift of the negative part of the pixels of the images in
* Telemis before entering the encoder).
*/
cmptparm[0].sgnd = 0;
if (depth<=16)
cmptparm[0].prec=depth;
@ -1691,12 +1716,12 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
comp = &image->comps[compno];
max = -100000;
if (depth == 8) {
fid = (*env)->GetFieldID(env, cls,"image8", "[B"); /* byteArray []*/
fid = (*env)->GetFieldID(env, cls,"image8", "[B");/* byteArray []*/
jba = (*env)->GetObjectField(env, obj, fid);
len = (*env)->GetArrayLength(env, jba);
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, &isCopy);
/*printf("C: before transferring 8 bpp image\n");*/
/* printf("C: before transfering 8 bpp image\n"); */
if (comp->sgnd) {
for(i=0; i< len;i++) {
comp->data[i] = (char) jbBody[i];
@ -1710,13 +1735,14 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
}
(*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0);
} else if(depth == 16) {
fid = (*env)->GetFieldID(env, cls,"image16", "[S"); /* shortArray []*/
fid = (*env)->GetFieldID(env, cls,"image16", "[S");/*shortArray []*/
jsa = (*env)->GetObjectField(env, obj, fid);
len = (*env)->GetArrayLength(env, jsa);
jsBody = (*env)->GetPrimitiveArrayCritical(env, jsa, &isCopy);
/*printf("C: before transferring 16 bpp image\n");*/
if (comp->sgnd) { /* Special behaviour to deal with signed elements ??*/
/*printf("C: before transfering 16 bpp image\n"); */
if (comp->sgnd) {
/* Special behaviour to deal with signed elements ?? */
comp->data[i] = (short) jsBody[i];
for(i=0; i< len;i++) {
if (comp->data[i] > max) max = comp->data[i];
@ -1729,14 +1755,15 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
}
(*env)->ReleasePrimitiveArrayCritical(env, jsa, jsBody, 0);
} else if (depth == 24) {
fid = (*env)->GetFieldID(env, cls,"image24", "[I"); /* intArray []*/
fid = (*env)->GetFieldID(env, cls,"image24", "[I");/* intArray []*/
jia = (*env)->GetObjectField(env, obj, fid);
len = (*env)->GetArrayLength(env, jia);
shift = compno*8;
jiBody = (*env)->GetPrimitiveArrayCritical(env, jia, &isCopy);
/*printf("C: before transferring 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd);*/
if (comp->sgnd) { /* Special behaviour to deal with signed elements ?? XXXXX*/
/*printf("C: before transfering 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd);*/
if (comp->sgnd) {
/* Special behaviour to deal with signed elements ?? XXXXX */
for(i=0; i< len;i++) {
comp->data[i] = ( ((int) jiBody[i]) & (0xFF << shift) ) >> shift;
if (comp->data[i] > max) max = comp->data[i];
@ -1751,7 +1778,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
}
comp->bpp = int_floorlog2(max)+1;
comp->prec = comp->bpp;
/*printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp);*/
/*printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp);*/
}
return image;
}
@ -1761,7 +1788,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
const char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
opj_bool bSuccess;
opj_cparameters_t parameters; /* compression parameters */
img_fol_t img_fol;
@ -1769,12 +1796,12 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
opj_image_t *image = NULL;
int i,j,num_images;
int imageno;
opj_codestream_info_t cstr_info; /* Codestream information structure */
opj_codestream_info_t cstr_info; /* Codestream information structure */
char indexfilename[OPJ_PATH_LEN]; /* index file name */
char* compressed_index = NULL;
int* compressed_index = NULL;
int compressed_index_size=-1;
/* ==> Access variables to the Java member variables*/
/* ==> Access variables to the Java member variables */
jsize arraySize;
jclass cls;
jobject object;
@ -1783,18 +1810,20 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
jbyteArray jba;
jbyte *jbBody;
callback_variables_t msgErrorCallback_vars;
/* <== access variable to the Java member variables.*/
/* For the encoding and storage into the file*/
/* <== access variable to the Java member variables. */
jlong retval = -1;
/* For the encoding and storage into the file */
opj_cinfo_t* cinfo;
int codestream_length;
int codestream_length = -1;
opj_cio_t *cio = NULL;
FILE *f = NULL;
/* JNI reference to the calling class*/
/* JNI reference to the calling class */
cls = (*env)->GetObjectClass(env, obj);
/* Pointers to be able to call a Java method for all the info and error messages*/
/* Pointers to be able to call a Java method
* for all the info and error messages
*/
msgErrorCallback_vars.env = env;
msgErrorCallback_vars.jobj = &obj;
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
@ -1802,12 +1831,15 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
arraySize = (*env)->GetArrayLength(env, javaParameters);
argc = (int) arraySize +1;
argv = opj_malloc(argc*sizeof(char*));
argv[0] = "ProgramName.exe"; /* The program name: useless*/
argv = (const char **)malloc(argc*sizeof(char*));
if(argv == NULL) return -1;
argv[0] = "ProgramName.exe";/* The program name: useless */
j=0;
for (i=1; i<argc; i++) {
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
argv[i] = (char*)(*env)->GetStringUTFChars(env, object, &isCopy);
argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy);
}
/*printf("C: ");
@ -1827,23 +1859,21 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
parameters.cod_format = J2K_CFMT;
/*parameters.index_on = 1;*/
/* parameters.index_on = 1; */
/* Initialize indexfilename and img_fol */
*indexfilename = 0;
memset(&img_fol,0,sizeof(img_fol_t));
/* parse input and get user encoding parameters */
if (parse_cmdline_encoder(argc, argv, &parameters,&img_fol, indexfilename) == 1) {
/* Release the Java arguments array*/
for (i=1; i<argc; i++)
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
return -1;
}
/* parse input and get user encoding parameters */
j = parse_cmdline_encoder(argc, (char *const*)argv, &parameters,&img_fol, indexfilename);
/* Release the Java arguments array*/
/* Release the Java arguments array */
for (i=1; i<argc; i++)
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
(*env)->ReleaseStringUTFChars(env,
(*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
if(j == 1) goto fin; /* failure */
if (parameters.cp_cinema){
cinema_parameters(&parameters);
@ -1857,10 +1887,16 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
const char *version = opj_version();
/* UniPG>> */
#ifdef USE_JPWL
parameters.cp_comment = (char*)opj_malloc(clen+strlen(version)+11);
parameters.cp_comment = (char*)malloc(clen+strlen(version)+11);
if(parameters.cp_comment == NULL) goto fin;
sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version);
#else
parameters.cp_comment = (char*)opj_malloc(clen+strlen(version)+1);
parameters.cp_comment = (char*)malloc(clen+strlen(version)+1);
if(parameters.cp_comment == NULL) goto fin;
sprintf(parameters.cp_comment,"%s%s", comment, version);
#endif
/* <<UniPG */
@ -1877,10 +1913,10 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
fprintf(stderr,"\n");
image = loadImage(&parameters, env, obj, cls);
/*printf("C: after load image: image = %d\n", image);*/
/* printf("C: after load image: image = %d\n", image); */
if (!image) {
fprintf(stderr, "Unable to load image\n");
return -1;
goto fin;
}
/* Decide if MCT should be used */
@ -1914,7 +1950,7 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
if (!bSuccess) {
opj_cio_close(cio);
fprintf(stderr, "failed to encode image\n");
return -1;
goto fin;
}
codestream_length = cio_tell(cio);
@ -1926,7 +1962,8 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
}
}
compressed_index = create_index_into_byte_array(&cstr_info, &compressed_index_size);
compressed_index = (int*)
create_index_into_byte_array(&cstr_info, &compressed_index_size);
/* Allocates the Java compressedIndex byte[] and sends this index into the Java object */
fid = (*env)->GetFieldID(env, cls,"compressedIndex", "[B");
jba = (*env)->NewByteArray(env, compressed_index_size+1);
@ -1934,21 +1971,21 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
memcpy(jbBody, compressed_index, compressed_index_size);
(*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0);
(*env)->SetObjectField(env, obj, fid, jba);
opj_free(compressed_index);
free(compressed_index);
/* write the generated codestream to disk ? */
if (parameters.outfile[0]!='\0') {
f = fopen(parameters.outfile, "wb");
if (!f) {
fprintf(stderr, "failed to open [%s] for writing\n", parameters.outfile);
return -1;
goto fin;
}
fwrite(cio->buffer, 1, codestream_length, f);
fclose(f);
fprintf(stdout,"Generated outfile [%s]\n",parameters.outfile);
}
/* Write the generated codestream to the Java pre-allocated compressedStream byte[] */
/* Write the generated codestream to the Java pre-allocated compressedStream byte[] */
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
jba = (*env)->GetObjectField(env, obj, fid);
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, 0);
@ -1967,8 +2004,13 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
}
/* free user parameters structure */
if(parameters.cp_comment) opj_free(parameters.cp_comment);
if(parameters.cp_matrice) opj_free(parameters.cp_matrice);
if(parameters.cp_comment) free(parameters.cp_comment);
if(parameters.cp_matrice) free(parameters.cp_matrice);
return codestream_length;
retval = codestream_length;
fin:
free(argv);
return retval;
}

View File

@ -1,10 +1,9 @@
/*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2006-2007, Parvatha Elangovan
* Copyright (c) 2007, Patrick Piscaglia (Telemis)
@ -38,7 +37,6 @@
#include <math.h>
#include "openjpeg.h"
#include "opj_includes.h"
#include "opj_getopt.h"
#include "convert.h"
#include "dirent.h"
@ -205,7 +203,7 @@ int get_file_format(char *filename) {
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
int parse_cmdline_decoder(int argc, char * const argv[], opj_dparameters_t *parameters,img_fol_t *img_fol) {
/* parse the command line */
int totlen;
opj_option_t long_option[]={
@ -340,7 +338,10 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
case 'y': /* Image Directory path */
{
img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
if(img_fol->imgdirpath == NULL) return 1;
strcpy(img_fol->imgdirpath,opj_optarg);
img_fol->set_imgdir=1;
}
@ -428,7 +429,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
/* No check for possible errors before the -i and -o options are of course not mandatory*/
return 0;
}
}/* parse_cmdline_decoder() */
/* -------------------------------------------------------------------------- */
@ -490,12 +491,13 @@ void info_callback(const char *msg, void *client_data) {
(*env)->DeleteLocalRef(env, jbuffer);
}
#define FAILS -1
#define OK 0
/* --------------------------------------------------------------------------
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
const char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
opj_dparameters_t parameters; /* decompression parameters */
img_fol_t img_fol;
opj_event_mgr_t event_mgr; /* event manager */
@ -510,7 +512,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
int w,h;
long min_value, max_value;
short tempS; unsigned char tempUC, tempUC1, tempUC2;
/* ==> Access variables to the Java member variables*/
/* ==> Access variables to the Java member variables */
jsize arraySize;
jclass cls;
jobject object;
@ -523,8 +525,9 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
jshort *jsBody, *ptrSBody;
jint *jiBody, *ptrIBody;
callback_variables_t msgErrorCallback_vars;
/* <=== access variable to Java member variables */
int *ptr, *ptr1, *ptr2; /* <== To transfer the decoded image to Java*/
/* <=== access variable to Java member variables */
int *ptr, *ptr1, *ptr2;/* <== To transfer the decoded image to Java */
jint retval = FAILS;
/* configure the event callbacks */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
@ -532,24 +535,30 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* JNI reference to the calling class*/
/* JNI reference to the calling class */
cls = (*env)->GetObjectClass(env, obj);
/* Pointers to be able to call a Java method for all the info and error messages*/
/* Pointers to be able to call a Java method
* for all the info and error messages
*/
msgErrorCallback_vars.env = env;
msgErrorCallback_vars.jobj = &obj;
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
/* Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.*/
/* Get the String[] containing the parameters */
arraySize = (*env)->GetArrayLength(env, javaParameters);
argc = (int) arraySize +1;
argv = opj_malloc(argc*sizeof(char*));
argv[0] = "ProgramName.exe"; /* The program name: useless*/
argv = (const char **)malloc(argc*sizeof(char*));
if(argv == NULL) return FAILS;
argv[0] = "ProgramName.exe";/* The program name: useless */
j=0;
for (i=1; i<argc; i++) {
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
argv[i] = (char*)(*env)->GetStringUTFChars(env, object, &isCopy);
argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy);
}
/*printf("C: decoder params = ");
@ -563,19 +572,18 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
parameters.decod_format = J2K_CFMT;
/* parse input and get user encoding parameters */
if(parse_cmdline_decoder(argc, argv, &parameters,&img_fol) == 1) {
/* Release the Java arguments array*/
for (i=1; i<argc; i++)
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
return -1;
}
/* Release the Java arguments array*/
j = parse_cmdline_decoder(argc, (char * const*)argv, &parameters,&img_fol);
/* Release the Java arguments array */
for (i=1; i<argc; i++)
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
(*env)->ReleaseStringUTFChars(env,
(*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
if(j == 1) goto fin; /* failure */
num_images=1;
/* Get additional information from the Java object variables*/
/* Get additional information from the Java object variables */
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
@ -589,22 +597,25 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
Implemented for debug purpose. */
/* -------------------------------------------------------------- */
if (parameters.infile && parameters.infile[0]!='\0') {
/*printf("C: opening [%s]\n", parameters.infile);*/
/* printf("C: opening [%s]\n", parameters.infile); */
fsrc = fopen(parameters.infile, "rb");
if (!fsrc) {
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
return 1;
goto fin;
}
fseek(fsrc, 0, SEEK_END);
file_length = ftell(fsrc);
fseek(fsrc, 0, SEEK_SET);
src = (unsigned char *) opj_malloc(file_length);
src = (unsigned char *) malloc(file_length);
if(src == NULL) goto fin;
fread(src, 1, file_length, fsrc);
fclose(fsrc);
/*printf("C: %d bytes read from file\n",file_length);*/
/* printf("C: %d bytes read from file\n",file_length); */
} else {
/* Preparing the transfer of the codestream from Java to C*/
/*printf("C: before transferring codestream\n");*/
/* Preparing the transfer of the codestream from Java to C */
/* printf("C: before transfering codestream\n"); */
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
jba = (*env)->GetObjectField(env, obj, fid);
file_length = (*env)->GetArrayLength(env, jba);
@ -638,7 +649,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return 1;
goto fin;
}
/* close the byte stream */
@ -668,7 +679,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return 1;
goto fin;
}
/* close the byte stream */
@ -699,7 +710,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return 1;
goto fin;
}
/* close the byte stream */
@ -714,7 +725,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
/* free the memory containing the code-stream */
if (parameters.infile && parameters.infile[0]!='\0') {
opj_free(src);
free(src);
} else {
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
}
@ -754,17 +765,21 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
}
/* ========= Return the image to the Java structure ===============*/
/* ========= Return the image to the Java structure =============== */
#ifdef CHECK_THRESHOLDS
printf("C: checking thresholds\n");
#endif
/* First compute the real with and height, in function of the resolutions decoded.*/
/*wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
/*hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
/* First compute the real with and height,
* in function of the resolutions decoded.
*/
/*---
wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
---*/
w = image->comps[0].w;
h = image->comps[0].h;
if (image->numcomps==3) { /* 3 components color image*/
if (image->numcomps==3) { /* 3 components color image */
ptr = image->comps[0].data;
ptr1 = image->comps[1].data;
ptr2 = image->comps[2].data;
@ -777,12 +792,12 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
max_value = 255;
}
#endif
/* Get the pointer to the Java structure where the data must be copied*/
/* Get the pointer to the Java structure where the data must be copied */
fid = (*env)->GetFieldID(env, cls,"image24", "[I");
jia = (*env)->GetObjectField(env, obj, fid);
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
ptrIBody = jiBody;
printf("C: transferring image24: %d int to Java pointer=%d\n",image->numcomps*w*h, ptrIBody);
printf("C: transfering image24: %d int to Java pointer=%d\n",image->numcomps*w*h, ptrIBody);
for (i=0; i<w*h; i++) {
tempUC = (unsigned char)(ptr[i]);
@ -806,9 +821,9 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
}
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
} else { /* 1 component 8 or 16 bpp image*/
} else { /* 1 component 8 or 16 bpp image */
ptr = image->comps[0].data;
printf("C: before transferring a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
if (image->comps[0].prec<=8) {
fid = (*env)->GetFieldID(env, cls,"image8", "[B");
jba = (*env)->GetObjectField(env, obj, fid);
@ -823,7 +838,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
max_value = 255;
}
#endif
/*printf("C: transferring %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody);*/
/* printf("C: transfering %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody); */
for (i=0; i<w*h; i++) {
tempUC = (unsigned char) (ptr[i]);
#ifdef CHECK_THRESHOLDS
@ -835,7 +850,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
*(ptrBBody++) = tempUC;
}
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
printf("C: image8 transferred to Java\n");
printf("C: image8 transfered to Java\n");
} else {
fid = (*env)->GetFieldID(env, cls,"image16", "[S");
jsa = (*env)->GetObjectField(env, obj, fid);
@ -851,7 +866,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
}
printf("C: minValue = %d, maxValue = %d\n", min_value, max_value);
#endif
printf("C: transferring %d shorts to Java image16 pointer = %d\n", w*h,ptrSBody);
printf("C: transfering %d shorts to Java image16 pointer = %d\n", w*h,ptrSBody);
for (i=0; i<w*h; i++) {
tempS = (short) (ptr[i]);
#ifdef CHECK_THRESHOLDS
@ -879,7 +894,12 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
opj_image_destroy(image);
}
return 1; /* OK */
}
/*end main*/
retval = OK;
fin:
free(argv);
return retval;
}
/* end main MAIN */

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a.
* All rights reserved.
*

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a.
* All rights reserved.
*

19
applications/Makefile.am Normal file
View File

@ -0,0 +1,19 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = codec
if WANT_MJ2
SUBDIRS += mj2
endif
if WANT_JPIP_CODE
SUBDIRS += jpip
endif
EXTRA_DIST = \
CMakeLists.txt \
common/color.c \
common/color.h \
common/format_defs.h \
common/opj_getopt.c \
common/opj_getopt.h

View File

@ -1,21 +1,17 @@
project(viewer CXX)
PROJECT(viewer CXX)
find_package(wxWidgets REQUIRED)
include(${wxWidgets_USE_FILE})
FIND_PACKAGE(wxWidgets REQUIRED)
INCLUDE(${wxWidgets_USE_FILE})
include_directories(
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}/../..
${CMAKE_CURRENT_SOURCE_DIR}/..
${OPENJPEG_SOURCE_DIR}/src/lib
${OPENJPEG_SOURCE_DIR}/src/bin
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
)
# original flags:
# -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS
add_definitions(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0")
set(OPJV_SRCS
ADD_DEFINITIONS(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0")
SET(OPJV_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/source/imagjpeg2000.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/wxj2kparser.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJViewer.cpp
@ -23,7 +19,7 @@ set(OPJV_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJDialogs.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJThreads.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJAbout.cpp
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/index.c
${CMAKE_CURRENT_SOURCE_DIR}/../codec/index.c
)
add_executable(opjviewer ${OPJV_SRCS})
target_link_libraries(opjviewer ${wxWidgets_LIBRARIES} openjpeg)
ADD_EXECUTABLE(opjviewer ${OPJV_SRCS})
TARGET_LINK_LIBRARIES(opjviewer ${wxWidgets_LIBRARIES} openjpeg)

View File

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'  degli studi di Perugia (UPG), Italy
* All rights reserved.
*

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'  degli studi di Perugia (UPG), Italy
* All rights reserved.
*

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'  degli studi di Perugia (UPG), Italy
* All rights reserved.
*
@ -889,7 +884,7 @@ void OPJMarkerTree::OnSelChanged(wxTreeEvent& event)
m_peektextCtrl->WriteText(text);
delete [] buffer;
delete buffer;
}
/*void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
* All rights reserved.
*

View File

@ -1,10 +1,5 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -106,7 +101,7 @@
#include "wx/toolbar.h"
#include "wx/artprov.h"
#include "openjp2/openjpeg.h"
#include "libopenjpeg/openjpeg.h"
//#include "imagj2k.h"
//#include "imagjp2.h"

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*
@ -56,7 +51,7 @@
#include "wx/module.h"
#endif
#include "openjp2/openjpeg.h"
#include "libopenjpeg/openjpeg.h"
#include "wx/filefn.h"
#include "wx/wfstream.h"

View File

@ -1,10 +1,5 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -49,8 +44,8 @@
#if wxUSE_LIBOPENJPEG
#include "wx/image.h"
#include "openjp2/openjpeg.h"
#include "jp2/index.h"
#include "libopenjpeg/openjpeg.h"
#include "codec/index.h"
#define wxBITMAP_TYPE_JPEG2000 50

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*

View File

@ -1,10 +1,5 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,5 +1,5 @@
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
Copyright (c) 2002-2014, Professor Benoit Macq
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
Copyright (c) 2002-2007, Professor Benoit Macq
Copyright (c) 2001-2003, David Janssens
Copyright (c) 2002-2003, Yannick Verschueren
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe

View File

@ -8,4 +8,4 @@ Anybody. As the OpenJPEG library is released under the BSD license, anybody can
Who is developing the library ?
===============================
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developed and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
* All rights reserved.
*

View File

@ -0,0 +1,113 @@
# Build the demo app, small examples
# First thing define the common source:
SET(common_SRCS
convert.c
index.c
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
)
# Headers file are located here:
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${LCMS_INCLUDE_DIRNAME}
${OPENJPEG_SOURCE_DIR}/applications/common
${Z_INCLUDE_DIRNAME}
${PNG_INCLUDE_DIRNAME}
${TIFF_INCLUDE_DIRNAME}
)
IF(WIN32)
IF(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DOPJ_EXPORTS)
ELSE(BUILD_SHARED_LIBS)
ADD_DEFINITIONS(-DOPJ_STATIC)
ENDIF(BUILD_SHARED_LIBS)
ENDIF(WIN32)
# Loop over all executables:
FOREACH(exe j2k_to_image image_to_j2k j2k_dump)
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
)
# To support universal exe:
IF(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(${exe} z)
ELSe(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(${exe} ${Z_LIBNAME})
ENDIF(ZLIB_FOUND AND APPLE)
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(${exe} m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS ${exe}
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDFOREACH(exe)
# Install man pages
INSTALL(
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/image_to_j2k.1
${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_dump.1
${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_to_image.1
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
#
IF(BUILD_JPWL)
ADD_EXECUTABLE(JPWL_j2k_to_image
j2k_to_image.c
${common_SRCS}
)
SET_PROPERTY(
TARGET JPWL_j2k_to_image
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
)
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
# To support universal exe:
IF(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image z)
ELSe(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${Z_LIBNAME})
ENDIF(ZLIB_FOUND AND APPLE)
IF(UNIX)
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
ENDIF(UNIX)
ADD_EXECUTABLE(JPWL_image_to_j2k
image_to_j2k.c
${common_SRCS}
)
SET_PROPERTY(
TARGET JPWL_image_to_j2k
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
)
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
# To support universal exe:
IF(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k z)
ELSe(ZLIB_FOUND AND APPLE)
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${Z_LIBNAME})
ENDIF(ZLIB_FOUND AND APPLE)
IF(UNIX)
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
ENDIF(UNIX)
INSTALL(TARGETS JPWL_image_to_j2k JPWL_j2k_to_image
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDIF(BUILD_JPWL)

View File

@ -0,0 +1,118 @@
MAINTAINERCLEANFILES = Makefile.in
bin_PROGRAMS = j2k_to_image image_to_j2k j2k_dump
if WANT_JPWL
bin_PROGRAMS += JPWL_j2k_to_image JPWL_image_to_j2k
endif
j2k_to_image_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/codec \
-I$(top_builddir)/applications/codec \
-I$(top_srcdir)/applications/common \
-I$(top_builddir)/applications/common \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
@PNG_CFLAGS@ \
@TIFF_CFLAGS@ \
@LCMS1_CFLAGS@ \
@LCMS2_CFLAGS@
j2k_to_image_CFLAGS =
j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
j2k_to_image_SOURCES = \
../common/color.c \
../common/opj_getopt.c \
convert.c \
index.c \
j2k_to_image.c \
../common/color.h
image_to_j2k_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/codec \
-I$(top_builddir)/applications/codec \
-I$(top_srcdir)/applications/common \
-I$(top_builddir)/applications/common \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
@PNG_CFLAGS@ \
@TIFF_CFLAGS@
image_to_j2k_CFLAGS =
image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @TIFF_LIBS@ @PNG_LIBS@ -lm
image_to_j2k_SOURCES = \
../common/opj_getopt.c \
convert.c \
index.c \
image_to_j2k.c \
convert.h \
../common/format_defs.h \
index.h
j2k_dump_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/codec \
-I$(top_builddir)/applications/codec \
-I$(top_srcdir)/applications/common \
-I$(top_builddir)/applications/common \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg
j2k_dump_CFLAGS =
j2k_dump_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
j2k_dump_SOURCES = \
../common/opj_getopt.c \
index.c \
j2k_dump.c \
../common/opj_getopt.h \
index.h
JPWL_j2k_to_image_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/common \
-I$(top_builddir)/applications/common \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
-DUSE_JPWL \
@TIFF_CFLAGS@ \
@PNG_CFLAGS@ \
@LCMS1_CFLAGS@ \
@LCMS2_CFLAGS@
JPWL_j2k_to_image_CFLAGS =
JPWL_j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@
JPWL_j2k_to_image_SOURCES = \
../common/color.c \
../common/opj_getopt.c \
index.c \
convert.c \
j2k_to_image.c
JPWL_image_to_j2k_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/common \
-I$(top_builddir)/applications/common \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
-DUSE_JPWL \
@TIFF_CFLAGS@ \
@PNG_CFLAGS@
JPWL_image_to_j2k_CFLAGS =
JPWL_image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @TIFF_LIBS@ @PNG_LIBS@
JPWL_image_to_j2k_SOURCES = \
../common/opj_getopt.c \
index.c \
convert.c \
image_to_j2k.c
EXTRA_DIST = \
CMakeLists.txt \
windirent.h
install-data-hook:
@echo -e " (B)\t$(bindir)/j2k_to_image$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/image_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/j2k_dump$(EXEEXT)" >> $(top_builddir)/report.txt
if WANT_JPWL
@echo -e " (B)\t$(bindir)/JPWL_j2k_to_image$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/JPWL_image_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
endif

View File

@ -0,0 +1,8 @@
Simple codec compilation
------------------------
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and either use the provided Makefile or use one of the following commands to build an encoder and decoder respectively:
gcc index.c convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
gcc index.c convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
You should add '-L..' to those lines if you did not use the 'install' target when building the library.

View File

@ -1,15 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2006-2007, Parvatha Elangovan
* All rights reserved.
@ -35,21 +29,21 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "opj_apps_config.h"
#include "opj_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef OPJ_HAVE_LIBTIFF
#ifdef HAVE_LIBTIFF
#include <tiffio.h>
#endif /* OPJ_HAVE_LIBTIFF */
#endif /* HAVE_LIBTIFF */
#ifdef OPJ_HAVE_LIBPNG
#ifdef HAVE_LIBPNG
#include <zlib.h>
#include <png.h>
#endif /* OPJ_HAVE_LIBPNG */
#endif /* HAVE_LIBPNG */
#include "openjpeg.h"
#include "convert.h"
@ -100,7 +94,7 @@ struct tga_header
static unsigned short get_ushort(unsigned short val) {
#ifdef OPJ_BIG_ENDIAN
#ifdef WORDS_BIGENDIAN
return( ((val & 0xff) << 8) + (val >> 8) );
#else
return( val );
@ -185,11 +179,12 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
return 1;
}
#ifdef OPJ_BIG_ENDIAN
#if WORDS_BIGENDIAN == 1
static inline uint16_t swap16(uint16_t x)
static inline int16_t swap16(int16_t x)
{
return(((x & 0x00ffU) << 8) | ((x & 0xff00U) >> 8));
return((((u_int16_t)x & 0x00ffU) << 8) |
(((u_int16_t)x & 0xff00U) >> 8));
}
#endif
@ -231,7 +226,7 @@ static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
image_w = (unsigned short)width;
image_h = (unsigned short) height;
#ifndef OPJ_BIG_ENDIAN
#if WORDS_BIGENDIAN == 0
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
#else
@ -1435,7 +1430,7 @@ int imagetopgx(opj_image_t * image, const char *outfile) {
fprintf(stderr, "ERROR -> failed to open %s for writing\n", name);
return 1;
}
/* don't need name anymore */
/* dont need name anymore */
if( total > 256 ) {
free(name);
}
@ -2079,7 +2074,7 @@ int imagetopnm(opj_image_t * image, const char *outfile)
return 0;
}/* imagetopnm() */
#ifdef OPJ_HAVE_LIBTIFF
#ifdef HAVE_LIBTIFF
/* -->> -->> -->> -->>
TIFF IMAGE FORMAT
@ -2786,7 +2781,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
}/* tiftoimage() */
#endif /* OPJ_HAVE_LIBTIFF */
#endif /* HAVE_LIBTIFF */
/* -->> -->> -->> -->>
@ -2857,7 +2852,6 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
for (i = 0; i < w * h; i++) {
if (!fread(&value, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
fclose(f);
return NULL;
}
image->comps[compno].data[i] = raw_cp->rawSigned?(char)value:value;
@ -2872,13 +2866,11 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
unsigned char temp;
if (!fread(&temp, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
fclose(f);
return NULL;
}
value = temp << 8;
if (!fread(&temp, 1, 1, f)) {
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
fclose(f);
return NULL;
}
value += temp;
@ -2888,7 +2880,6 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
}
else {
fprintf(stderr,"OpenJPEG cannot encode raw components with bit depth higher than 16 bits.\n");
fclose(f);
return NULL;
}
@ -3036,7 +3027,7 @@ int imagetoraw(opj_image_t * image, const char *outfile)
return 0;
}
#ifdef OPJ_HAVE_LIBPNG
#ifdef HAVE_LIBPNG
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
#define MAGIC_SIZE 8
@ -3569,4 +3560,4 @@ fin:
return fails;
}/* imagetopng() */
#endif /* OPJ_HAVE_LIBPNG */
#endif /* HAVE_LIBPNG */

View File

@ -1,15 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*

View File

@ -1,15 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2006-2007, Parvatha Elangovan
* All rights reserved.
@ -49,13 +43,13 @@
#ifdef _WIN32
#include <windows.h>
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#else
#include <strings.h>
#define _stricmp strcasecmp
#define _strnicmp strncasecmp
#endif /* _WIN32 */
#include "opj_apps_config.h"
#include "opj_config.h"
#include "openjpeg.h"
#include "opj_getopt.h"
#include "convert.h"
@ -88,8 +82,8 @@ typedef struct img_folder{
float *rates;
}img_fol_t;
static void encode_help_display(void) {
fprintf(stdout,"HELP for opj_jpwl_compress\n----\n\n");
void encode_help_display(void) {
fprintf(stdout,"HELP for image_to_j2k\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
/* UniPG>> */
@ -199,7 +193,7 @@ static void encode_help_display(void) {
fprintf(stdout," Indicate multiple modes by adding their values. \n");
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
fprintf(stdout,"\n");
fprintf(stdout,"-TP : divide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
fprintf(stdout,"-TP : devide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
fprintf(stdout,"\n");
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
fprintf(stdout,"\n");
@ -327,7 +321,7 @@ static void encode_help_display(void) {
fprintf(stdout,"TotalDisto\n\n");
}
static OPJ_PROG_ORDER give_progression(const char progression[4]) {
OPJ_PROG_ORDER give_progression(char progression[4]) {
if(strncmp(progression, "LRCP", 4) == 0) {
return LRCP;
}
@ -347,10 +341,10 @@ static OPJ_PROG_ORDER give_progression(const char progression[4]) {
return PROG_UNKNOWN;
}
static unsigned int get_num_images(char *imgdirpath){
int get_num_images(char *imgdirpath){
DIR *dir;
struct dirent* content;
unsigned int num_images = 0;
int num_images = 0;
/*Reading the input images from given input directory*/
@ -369,7 +363,7 @@ static unsigned int get_num_images(char *imgdirpath){
return num_images;
}
static int load_images(dircnt_t *dirptr, char *imgdirpath){
int load_images(dircnt_t *dirptr, char *imgdirpath){
DIR *dir;
struct dirent* content;
int i = 0;
@ -394,7 +388,7 @@ static int load_images(dircnt_t *dirptr, char *imgdirpath){
return 0;
}
static int get_file_format(char *filename) {
int get_file_format(char *filename) {
unsigned int i;
static const char *extension[] = {
"pgx", "pnm", "pgm", "ppm", "pbm", "pam", "bmp", "tif", "raw", "tga", "png", "j2k", "jp2", "j2c", "jpc"
@ -407,21 +401,21 @@ static int get_file_format(char *filename) {
return -1;
ext++;
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
if(strcasecmp(ext, extension[i]) == 0) {
if(_strnicmp(ext, extension[i], 3) == 0) {
return format[i];
}
}
return -1;
}
static char * get_file_name(char *name){
char * get_file_name(char *name){
char *fname;
fname= (char*)malloc(OPJ_PATH_LEN*sizeof(char));
fname= strtok(name,".");
return fname;
}
static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparameters_t *parameters){
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparameters_t *parameters){
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN]="";
@ -464,7 +458,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
return 2;
}
static void cinema_parameters(opj_cparameters_t *parameters){
void cinema_parameters(opj_cparameters_t *parameters){
parameters->tile_size_on = OPJ_FALSE;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
@ -497,7 +491,7 @@ static void cinema_parameters(opj_cparameters_t *parameters){
}
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
int i;
float temp_rate;
@ -582,7 +576,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
/* ------------------------------------------------------------------------------------ */
static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
int i, j, totlen, c;
opj_option_t long_option[]={
@ -1385,7 +1379,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
case 'J': /* jpip on */
{
/*parameters->jpip_on = OPJ_TRUE;*/
parameters->jpip_on = OPJ_TRUE;
}
break;
/* ------------------------------------------------------ */
@ -1472,21 +1466,21 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
/**
sample error callback expecting a FILE* client object
*/
static void error_callback(const char *msg, void *client_data) {
void error_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[ERROR] %s", msg);
}
/**
sample warning callback expecting a FILE* client object
*/
static void warning_callback(const char *msg, void *client_data) {
void warning_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[WARNING] %s", msg);
}
/**
sample debug callback expecting a FILE* client object
*/
static void info_callback(const char *msg, void *client_data) {
void info_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[INFO] %s", msg);
}
@ -1633,7 +1627,7 @@ int main(int argc, char **argv) {
return 1;
}
break;
#ifdef OPJ_HAVE_LIBTIFF
#ifdef HAVE_LIBTIFF
case TIF_DFMT:
image = tiftoimage(parameters.infile, &parameters);
if (!image) {
@ -1641,7 +1635,7 @@ int main(int argc, char **argv) {
return 1;
}
break;
#endif /* OPJ_HAVE_LIBTIFF */
#endif /* HAVE_LIBTIFF */
case RAW_DFMT:
image = rawtoimage(parameters.infile, &parameters, &raw_cp);
if (!image) {
@ -1657,7 +1651,7 @@ int main(int argc, char **argv) {
return 1;
}
break;
#ifdef OPJ_HAVE_LIBPNG
#ifdef HAVE_LIBPNG
case PNG_DFMT:
image = pngtoimage(parameters.infile, &parameters);
if (!image) {
@ -1665,10 +1659,10 @@ int main(int argc, char **argv) {
return 1;
}
break;
#endif /* OPJ_HAVE_LIBPNG */
#endif /* HAVE_LIBPNG */
}
/* Can happen if input file is TIFF or PNG
* and OPJ_HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
*/
if( !image)
{
@ -1766,7 +1760,7 @@ int main(int argc, char **argv) {
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
/* encode the image */
if (*indexfilename /*|| parameters.jpip_on*/) /* If need to extract codestream information*/
if (*indexfilename || parameters.jpip_on) /* If need to extract codestream information*/
bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
else
bSuccess = opj_encode(cinfo, cio, image, NULL);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* All rights reserved.
*

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* All rights reserved.
*

View File

@ -0,0 +1,677 @@
/*
* Copyright (c) 2010, Mathieu Malaterre, GDCM
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#ifdef _WIN32
#include "windirent.h"
#else
#include <dirent.h>
#endif /* _WIN32 */
#ifdef _WIN32
#include <windows.h>
#else
#include <strings.h>
#define _stricmp strcasecmp
#define _strnicmp strncasecmp
#endif /* _WIN32 */
#include "opj_config.h"
#include "openjpeg.h"
#include "j2k.h"
#include "jp2.h"
#include "opj_getopt.h"
#include "convert.h"
#include "index.h"
#include "format_defs.h"
typedef struct dircnt{
/** Buffer for holding images read from Directory*/
char *filename_buf;
/** Pointer to the buffer*/
char **filename;
}dircnt_t;
typedef struct img_folder{
/** The directory path of the folder containing input images*/
char *imgdirpath;
/** Output format*/
const char *out_format;
/** Enable option*/
char set_imgdir;
/** Enable Cod Format for output*/
char set_out_format;
}img_fol_t;
void decode_help_display(void) {
fprintf(stdout,"HELP for j2k_dump\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
/* UniPG>> */
fprintf(stdout,"List of parameters for the JPEG 2000 "
#ifdef USE_JPWL
"+ JPWL "
#endif /* USE_JPWL */
"decoder:\n");
/* <<UniPG */
fprintf(stdout,"\n");
fprintf(stdout,"\n");
fprintf(stdout," -ImgDir \n");
fprintf(stdout," Image file Directory path \n");
fprintf(stdout," -i <compressed file>\n");
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
fprintf(stdout," is identified based on its suffix.\n");
fprintf(stdout," -o <output file>\n");
fprintf(stdout," OPTIONAL\n");
fprintf(stdout," Output file where file info will be dump.\n");
fprintf(stdout," By default it will be in the stdout.\n");
fprintf(stdout,"\n");
}
/* -------------------------------------------------------------------------- */
static void j2k_dump_image(FILE *fd, opj_image_t * img);
static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp);
int get_num_images(char *imgdirpath){
DIR *dir;
struct dirent* content;
int num_images = 0;
/*Reading the input images from given input directory*/
dir= opendir(imgdirpath);
if(!dir){
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
return 0;
}
while((content=readdir(dir))!=NULL){
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
continue;
num_images++;
}
return num_images;
}
int load_images(dircnt_t *dirptr, char *imgdirpath){
DIR *dir;
struct dirent* content;
int i = 0;
/*Reading the input images from given input directory*/
dir= opendir(imgdirpath);
if(!dir){
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
return 1;
}else {
fprintf(stderr,"Folder opened successfully\n");
}
while((content=readdir(dir))!=NULL){
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
continue;
strcpy(dirptr->filename[i],content->d_name);
i++;
}
return 0;
}
int get_file_format(char *filename) {
unsigned int i;
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
char * ext = strrchr(filename, '.');
if (ext == NULL)
return -1;
ext++;
if(ext) {
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
if(_strnicmp(ext, extension[i], 3) == 0) {
return format[i];
}
}
}
return -1;
}
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
char *temp_p, temp1[OPJ_PATH_LEN]="";
strcpy(image_filename,dirptr->filename[imageno]);
fprintf(stderr,"File Number %d \"%s\"\n",imageno,image_filename);
parameters->decod_format = get_file_format(image_filename);
if (parameters->decod_format == -1)
return 1;
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
strncpy(parameters->infile, infilename, sizeof(infilename));
/*Set output file*/
strcpy(temp_ofname,strtok(image_filename,"."));
while((temp_p = strtok(NULL,".")) != NULL){
strcat(temp_ofname,temp1);
sprintf(temp1,".%s",temp_p);
}
if(img_fol->set_out_format==1){
sprintf(outfilename,"%s/%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);
strncpy(parameters->outfile, outfilename, sizeof(outfilename));
}
return 0;
}
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
/* parse the command line */
int totlen, c;
opj_option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
};
const char optlist[] = "i:o:h";
OPJ_ARG_NOT_USED(indexfilename);
totlen=sizeof(long_option);
img_fol->set_out_format = 0;
do {
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
case 'i': /* input file */
{
char *infile = opj_optarg;
parameters->decod_format = get_file_format(infile);
switch(parameters->decod_format) {
case J2K_CFMT:
case JP2_CFMT:
case JPT_CFMT:
break;
default:
fprintf(stderr,
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
infile);
return 1;
}
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
}
break;
/* ------------------------------------------------------ */
case 'o': /* output file */
{
char *outfile = opj_optarg;
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
}
break;
/* ----------------------------------------------------- */
case 'h': /* display an help description */
decode_help_display();
return 1;
/* ------------------------------------------------------ */
case 'y': /* Image Directory path */
{
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
strcpy(img_fol->imgdirpath,opj_optarg);
img_fol->set_imgdir=1;
}
break;
/* ----------------------------------------------------- */
default:
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
break;
}
}while(c != -1);
/* check for possible errors */
if(img_fol->set_imgdir==1){
if(!(parameters->infile[0]==0)){
fprintf(stderr, "Error: options -ImgDir and -i cannot be used together !!\n");
return 1;
}
if(img_fol->set_out_format == 0){
fprintf(stderr, "Error: When -ImgDir is used, -OutFor <FORMAT> must be used !!\n");
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA!!\n");
return 1;
}
if(!(parameters->outfile[0] == 0)){
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
return 1;
}
}else{
if( parameters->infile[0] == 0 ) {
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
fprintf(stderr, " Try: %s -h\n",argv[0]);
return 1;
}
}
return 0;
}
/* -------------------------------------------------------------------------- */
/**
sample error callback expecting a FILE* client object
*/
void error_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[ERROR] %s", msg);
}
/**
sample warning callback expecting a FILE* client object
*/
void warning_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[WARNING] %s", msg);
}
/**
sample debug callback expecting no client object
*/
void info_callback(const char *msg, void *client_data) {
(void)client_data;
fprintf(stdout, "[INFO] %s", msg);
}
/* -------------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
opj_dparameters_t parameters; /* decompression parameters */
img_fol_t img_fol;
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL;
FILE *fsrc = NULL, *fout = NULL;
unsigned char *src = NULL;
int file_length;
int num_images;
int i,imageno;
dircnt_t *dirptr = NULL;
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
opj_cio_t *cio = NULL;
opj_codestream_info_t cstr_info; /* Codestream information structure */
char indexfilename[OPJ_PATH_LEN]; /* index file name */
/* configure the event callbacks (not required) */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* set decoding parameters to default values */
opj_set_default_decoder_parameters(&parameters);
/* Initialize indexfilename and img_fol */
*indexfilename = 0;
memset(&img_fol,0,sizeof(img_fol_t));
/* parse input and get user encoding parameters */
if(parse_cmdline_decoder(argc, argv, &parameters,&img_fol, indexfilename) == 1) {
return 1;
}
/* Initialize reading of directory */
if(img_fol.set_imgdir==1){
num_images=get_num_images(img_fol.imgdirpath);
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
if(dirptr){
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
if(!dirptr->filename_buf){
return 1;
}
for(i=0;i<num_images;i++){
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
}
}
if(load_images(dirptr,img_fol.imgdirpath)==1){
return 1;
}
if (num_images==0){
fprintf(stdout,"Folder is empty\n");
return 1;
}
}else{
num_images=1;
}
/* */
if (parameters.outfile[0] != 0)
{
fout = fopen(parameters.outfile,"w");
if (!fout)
{
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.outfile);
return 1;
}
}
else
fout = stdout;
/*Encoding image one by one*/
for(imageno = 0; imageno < num_images ; imageno++)
{
image = NULL;
fprintf(stderr,"\n");
if(img_fol.set_imgdir==1){
if (get_next_file(imageno, dirptr,&img_fol, &parameters)) {
fprintf(stderr,"skipping file...\n");
continue;
}
}
/* read the input file and put it in memory */
/* ---------------------------------------- */
fsrc = fopen(parameters.infile, "rb");
if (!fsrc) {
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
return 1;
}
fseek(fsrc, 0, SEEK_END);
file_length = ftell(fsrc);
fseek(fsrc, 0, SEEK_SET);
src = (unsigned char *) malloc(file_length);
if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
{
free(src);
fclose(fsrc);
fclose(fout);
fprintf(stderr, "\nERROR: fread return a number of element different from the expected.\n");
return 1;
}
fclose(fsrc);
/* decode the code-stream */
/* ---------------------- */
switch(parameters.decod_format) {
case J2K_CFMT:
{
/* JPEG-2000 codestream */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_J2K);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
/* setup the decoder decoding parameters using user parameters */
opj_setup_decoder(dinfo, &parameters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
if (*indexfilename) /* If need to extract codestream information*/
image = opj_decode_with_info(dinfo, cio, &cstr_info);
else
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
fclose(fout);
free(src);
return 1;
}
/* dump image */
j2k_dump_image(fout, image);
/* dump cp */
j2k_dump_cp(fout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
/* close the byte stream */
opj_cio_close(cio);
/* Write the index to disk */
if (*indexfilename) {
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
}
}
}
break;
case JP2_CFMT:
{
/* JPEG 2000 compressed image data */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_JP2);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
/* setup the decoder decoding parameters using the current image and user parameters */
opj_setup_decoder(dinfo, &parameters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
if (*indexfilename) /* If need to extract codestream information*/
image = opj_decode_with_info(dinfo, cio, &cstr_info);
else
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
fclose(fout);
free(src);
return 1;
}
/* dump image */
if(image->icc_profile_buf)
{
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
}
j2k_dump_image(fout, image);
/* dump cp */
j2k_dump_cp(fout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
/* close the byte stream */
opj_cio_close(cio);
/* Write the index to disk */
if (*indexfilename) {
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
}
}
}
break;
case JPT_CFMT:
{
/* JPEG 2000, JPIP */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_JPT);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
/* setup the decoder decoding parameters using user parameters */
opj_setup_decoder(dinfo, &parameters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
/* decode the stream and fill the image structure */
if (*indexfilename) /* If need to extract codestream information*/
image = opj_decode_with_info(dinfo, cio, &cstr_info);
else
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
fclose(fout);
free(src);
return 1;
}
/* close the byte stream */
opj_cio_close(cio);
/* Write the index to disk */
if (*indexfilename) {
opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
}
}
}
break;
default:
fprintf(stderr, "skipping file..\n");
continue;
}
/* free the memory containing the code-stream */
free(src);
src = NULL;
/* free remaining structures */
if(dinfo) {
opj_destroy_decompress(dinfo);
}
/* free codestream information structure */
if (*indexfilename)
opj_destroy_cstr_info(&cstr_info);
/* free image data structure */
opj_image_destroy(image);
}
fclose(fout);
return EXIT_SUCCESS;
}
static void j2k_dump_image(FILE *fd, opj_image_t * img) {
int compno;
fprintf(fd, "image {\n");
fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1);
fprintf(fd, " numcomps=%d\n", img->numcomps);
for (compno = 0; compno < img->numcomps; compno++) {
opj_image_comp_t *comp = &img->comps[compno];
fprintf(fd, " comp %d {\n", compno);
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
fprintf(fd, " prec=%d\n", comp->prec);
/*fprintf(fd, " bpp=%d\n", comp->bpp);*/
fprintf(fd, " sgnd=%d\n", comp->sgnd);
fprintf(fd, " }\n");
}
fprintf(fd, "}\n");
}
static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) {
int tileno, compno, layno, bandno, resno, numbands;
fprintf(fd, "coding parameters {\n");
fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0);
fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy);
fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th);
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
opj_tcp_t *tcp = &cp->tcps[tileno];
fprintf(fd, " tile %d {\n", tileno);
fprintf(fd, " csty=%x\n", tcp->csty);
fprintf(fd, " prg=%d\n", tcp->prg);
fprintf(fd, " numlayers=%d\n", tcp->numlayers);
fprintf(fd, " mct=%d\n", tcp->mct);
fprintf(fd, " rates=");
for (layno = 0; layno < tcp->numlayers; layno++) {
fprintf(fd, "%.1f ", tcp->rates[layno]);
}
fprintf(fd, "\n");
for (compno = 0; compno < img->numcomps; compno++) {
opj_tccp_t *tccp = &tcp->tccps[compno];
fprintf(fd, " comp %d {\n", compno);
fprintf(fd, " csty=%x\n", tccp->csty);
fprintf(fd, " numresolutions=%d\n", tccp->numresolutions);
fprintf(fd, " cblkw=%d\n", tccp->cblkw);
fprintf(fd, " cblkh=%d\n", tccp->cblkh);
fprintf(fd, " cblksty=%x\n", tccp->cblksty);
fprintf(fd, " qmfbid=%d\n", tccp->qmfbid);
fprintf(fd, " qntsty=%d\n", tccp->qntsty);
fprintf(fd, " numgbits=%d\n", tccp->numgbits);
fprintf(fd, " roishift=%d\n", tccp->roishift);
fprintf(fd, " stepsizes=");
numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
for (bandno = 0; bandno < numbands; bandno++) {
fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant,
tccp->stepsizes[bandno].expn);
}
fprintf(fd, "\n");
if (tccp->csty & J2K_CCP_CSTY_PRT) {
fprintf(fd, " prcw=");
for (resno = 0; resno < tccp->numresolutions; resno++) {
fprintf(fd, "%d ", tccp->prcw[resno]);
}
fprintf(fd, "\n");
fprintf(fd, " prch=");
for (resno = 0; resno < tccp->numresolutions; resno++) {
fprintf(fd, "%d ", tccp->prch[resno]);
}
fprintf(fd, "\n");
}
fprintf(fd, " }\n");
}
fprintf(fd, " }\n");
}
fprintf(fd, "}\n");
}

View File

@ -1,15 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* Copyright (c) 2006-2007, Parvatha Elangovan
* All rights reserved.
@ -55,16 +49,16 @@
#define _strnicmp strncasecmp
#endif /* _WIN32 */
#include "opj_apps_config.h"
#include "opj_config.h"
#include "openjpeg.h"
#include "opj_getopt.h"
#include "convert.h"
#include "index.h"
#ifdef OPJ_HAVE_LIBLCMS2
#ifdef HAVE_LIBLCMS2
#include <lcms2.h>
#endif
#ifdef OPJ_HAVE_LIBLCMS1
#ifdef HAVE_LIBLCMS1
#include <lcms.h>
#endif
#include "color.h"
@ -759,7 +753,7 @@ int main(int argc, char **argv) {
if(image->icc_profile_buf)
{
#if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
color_apply_icc_profile(image);
#endif
@ -796,7 +790,7 @@ int main(int argc, char **argv) {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
#ifdef OPJ_HAVE_LIBTIFF
#ifdef HAVE_LIBTIFF
case TIF_DFMT: /* TIFF */
if(imagetotif(image, parameters.outfile)){
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
@ -805,7 +799,7 @@ int main(int argc, char **argv) {
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
}
break;
#endif /* OPJ_HAVE_LIBTIFF */
#endif /* HAVE_LIBTIFF */
case RAW_DFMT: /* RAW */
if(imagetoraw(image, parameters.outfile)){
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
@ -823,7 +817,7 @@ int main(int argc, char **argv) {
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
}
break;
#ifdef OPJ_HAVE_LIBPNG
#ifdef HAVE_LIBPNG
case PNG_DFMT: /* PNG */
if(imagetopng(image, parameters.outfile)){
fprintf(stdout,"Error generating png file. Outfile %s not generated\n",parameters.outfile);
@ -832,9 +826,9 @@ int main(int argc, char **argv) {
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
}
break;
#endif /* OPJ_HAVE_LIBPNG */
#endif /* HAVE_LIBPNG */
/* Can happen if output file is TIFF or PNG
* and OPJ_HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
*/
default:
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);

View File

@ -243,7 +243,7 @@
* Substitute for real dirent structure. Note that `d_name' field is a
* true character array although we have it copied in the implementation
* dependent data. We could save some memory if we had declared `d_name'
* as a pointer referring the name within implementation dependent data.
* as a pointer refering the name within implementation dependent data.
* We have not done that since some code may rely on sizeof(d_name) to be
* something other than four. Besides, directory entries are typically so
* small that it takes virtually no time to copy them from place to place.
@ -411,7 +411,7 @@ static DIR *opendir(const char *dirname)
* capacity of d_name with different macros and some systems do not define
* capacity at all (besides actual declaration of the field). If you really
* need to find out storage capacity of d_name then you might want to try
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard although
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
* there are many MS-DOS and MS-Windows implementations those do not define
* it. There are also systems that declare d_name as "char d_name[1]" and
* then allocate suitable amount of memory at run-time. Thanks to Alain
@ -466,7 +466,7 @@ readdir (DIR *dirp)
/* fill in entry and return that */
#if defined(DIRENT_WIN32_INTERFACE)
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
/* Last file has been processed or an error occurred */
/* Last file has been processed or an error occured */
FindClose (dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
errno = ENOENT;

466
applications/common/color.c Normal file
View File

@ -0,0 +1,466 @@
/*
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "opj_config.h"
#include "openjpeg.h"
#include "color.h"
#ifdef HAVE_LIBLCMS2
#include <lcms2.h>
#endif
#ifdef HAVE_LIBLCMS1
#include <lcms.h>
#endif
/*--------------------------------------------------------
Matrix für sYCC, Amendment 1 to IEC 61966-2-1
Y : 0.299 0.587 0.114 :R
Cb: -0.1687 -0.3312 0.5 :G
Cr: 0.5 -0.4187 -0.0812 :B
Inverse:
R: 1 -3.68213e-05 1.40199 :Y
G: 1.00003 -0.344125 -0.714128 :Cb - 2^(prec - 1)
B: 0.999823 1.77204 -8.04142e-06 :Cr - 2^(prec - 1)
-----------------------------------------------------------*/
static void sycc_to_rgb(int offset, int upb, int y, int cb, int cr,
int *out_r, int *out_g, int *out_b)
{
int r, g, b;
cb -= offset; cr -= offset;
r = y + (int)(1.402 * (float)cr);
if(r < 0) r = 0; else if(r > upb) r = upb; *out_r = r;
g = y - (int)(0.344 * (float)cb + 0.714 * (float)cr);
if(g < 0) g = 0; else if(g > upb) g = upb; *out_g = g;
b = y + (int)(1.772 * (float)cb);
if(b < 0) b = 0; else if(b > upb) b = upb; *out_b = b;
}
static void sycc444_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
int maxw, maxh, max, i, offset, upb;
i = img->comps[0].prec;
offset = 1<<(i - 1); upb = (1<<i)-1;
maxw = img->comps[0].w; maxh = img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * max);
d1 = g = (int*)malloc(sizeof(int) * max);
d2 = b = (int*)malloc(sizeof(int) * max);
for(i = 0; i < max; ++i)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++cb; ++cr; ++r; ++g; ++b;
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
}/* sycc444_to_rgb() */
static void sycc422_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b;
const int *y, *cb, *cr;
int maxw, maxh, max, offset, upb;
int i, j;
i = img->comps[0].prec;
offset = 1<<(i - 1); upb = (1<<i)-1;
maxw = img->comps[0].w; maxh = img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * max);
d1 = g = (int*)malloc(sizeof(int) * max);
d2 = b = (int*)malloc(sizeof(int) * max);
for(i=0; i < maxh; ++i)
{
for(j=0; j < maxw; j += 2)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b; ++cb; ++cr;
}
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
img->comps[1].w = maxw; img->comps[1].h = maxh;
img->comps[2].w = maxw; img->comps[2].h = maxh;
img->comps[1].dx = img->comps[0].dx;
img->comps[2].dx = img->comps[0].dx;
img->comps[1].dy = img->comps[0].dy;
img->comps[2].dy = img->comps[0].dy;
}/* sycc422_to_rgb() */
static void sycc420_to_rgb(opj_image_t *img)
{
int *d0, *d1, *d2, *r, *g, *b, *nr, *ng, *nb;
const int *y, *cb, *cr, *ny;
int maxw, maxh, max, offset, upb;
int i, j;
i = img->comps[0].prec;
offset = 1<<(i - 1); upb = (1<<i)-1;
maxw = img->comps[0].w; maxh = img->comps[0].h;
max = maxw * maxh;
y = img->comps[0].data;
cb = img->comps[1].data;
cr = img->comps[2].data;
d0 = r = (int*)malloc(sizeof(int) * max);
d1 = g = (int*)malloc(sizeof(int) * max);
d2 = b = (int*)malloc(sizeof(int) * max);
for(i=0; i < maxh; i += 2)
{
ny = y + maxw;
nr = r + maxw; ng = g + maxw; nb = b + maxw;
for(j=0; j < maxw; j += 2)
{
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
++y; ++r; ++g; ++b;
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
++ny; ++nr; ++ng; ++nb;
sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
}
y += maxw; r += maxw; g += maxw; b += maxw;
}
free(img->comps[0].data); img->comps[0].data = d0;
free(img->comps[1].data); img->comps[1].data = d1;
free(img->comps[2].data); img->comps[2].data = d2;
img->comps[1].w = maxw; img->comps[1].h = maxh;
img->comps[2].w = maxw; img->comps[2].h = maxh;
img->comps[1].dx = img->comps[0].dx;
img->comps[2].dx = img->comps[0].dx;
img->comps[1].dy = img->comps[0].dy;
img->comps[2].dy = img->comps[0].dy;
}/* sycc420_to_rgb() */
void color_sycc_to_rgb(opj_image_t *img)
{
if(img->numcomps < 3)
{
img->color_space = CLRSPC_GRAY;
return;
}
if((img->comps[0].dx == 1)
&& (img->comps[1].dx == 2)
&& (img->comps[2].dx == 2)
&& (img->comps[0].dy == 1)
&& (img->comps[1].dy == 2)
&& (img->comps[2].dy == 2))/* horizontal and vertical sub-sample */
{
sycc420_to_rgb(img);
}
else
if((img->comps[0].dx == 1)
&& (img->comps[1].dx == 2)
&& (img->comps[2].dx == 2)
&& (img->comps[0].dy == 1)
&& (img->comps[1].dy == 1)
&& (img->comps[2].dy == 1))/* horizontal sub-sample only */
{
sycc422_to_rgb(img);
}
else
if((img->comps[0].dx == 1)
&& (img->comps[1].dx == 1)
&& (img->comps[2].dx == 1)
&& (img->comps[0].dy == 1)
&& (img->comps[1].dy == 1)
&& (img->comps[2].dy == 1))/* no sub-sample */
{
sycc444_to_rgb(img);
}
else
{
fprintf(stderr,"%s:%d:color_sycc_to_rgb\n\tCAN NOT CONVERT\n",
__FILE__,__LINE__);
return;
}
img->color_space = CLRSPC_SRGB;
}/* color_sycc_to_rgb() */
#if defined(HAVE_LIBLCMS2) || defined(HAVE_LIBLCMS1)
#ifdef HAVE_LIBLCMS1
/* Bob Friesenhahn proposed:*/
#define cmsSigXYZData icSigXYZData
#define cmsSigLabData icSigLabData
#define cmsSigCmykData icSigCmykData
#define cmsSigYCbCrData icSigYCbCrData
#define cmsSigLuvData icSigLuvData
#define cmsSigGrayData icSigGrayData
#define cmsSigRgbData icSigRgbData
#define cmsUInt32Number DWORD
#define cmsColorSpaceSignature icColorSpaceSignature
#define cmsGetHeaderRenderingIntent cmsTakeRenderingIntent
#endif /* HAVE_LIBLCMS1 */
void color_apply_icc_profile(opj_image_t *image)
{
cmsHPROFILE in_prof, out_prof;
cmsHTRANSFORM transform;
cmsColorSpaceSignature in_space, out_space;
cmsUInt32Number intent, in_type, out_type, nr_samples;
int *r, *g, *b;
int prec, i, max, max_w, max_h;
OPJ_COLOR_SPACE oldspace;
in_prof =
cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
if(in_prof == NULL) return;
in_space = cmsGetPCS(in_prof);
out_space = cmsGetColorSpace(in_prof);
intent = cmsGetHeaderRenderingIntent(in_prof);
max_w = image->comps[0].w; max_h = image->comps[0].h;
prec = image->comps[0].prec;
oldspace = image->color_space;
if(out_space == cmsSigRgbData) /* enumCS 16 */
{
in_type = TYPE_RGB_16;
out_type = TYPE_RGB_16;
out_prof = cmsCreate_sRGBProfile();
image->color_space = CLRSPC_SRGB;
}
else
if(out_space == cmsSigGrayData) /* enumCS 17 */
{
in_type = TYPE_GRAY_8;
out_type = TYPE_RGB_8;
out_prof = cmsCreate_sRGBProfile();
image->color_space = CLRSPC_SRGB;
}
else
if(out_space == cmsSigYCbCrData) /* enumCS 18 */
{
in_type = TYPE_YCbCr_16;
out_type = TYPE_RGB_16;
out_prof = cmsCreate_sRGBProfile();
image->color_space = CLRSPC_SRGB;
}
else
{
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d: color_apply_icc_profile\n\tICC Profile has unknown "
"output colorspace(%#x)(%c%c%c%c)\n\tICC Profile ignored.\n",
__FILE__,__LINE__,out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff);
#endif
return;
}
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tchannels(%d) prec(%d) w(%d) h(%d)"
"\n\tprofile: in(%p) out(%p)\n",__FILE__,__LINE__,image->numcomps,prec,
max_w,max_h, (void*)in_prof,(void*)out_prof);
fprintf(stderr,"\trender_intent (%u)\n\t"
"color_space: in(%#x)(%c%c%c%c) out:(%#x)(%c%c%c%c)\n\t"
" type: in(%u) out:(%u)\n",
intent,
in_space,
(in_space>>24) & 0xff,(in_space>>16) & 0xff,
(in_space>>8) & 0xff, in_space & 0xff,
out_space,
(out_space>>24) & 0xff,(out_space>>16) & 0xff,
(out_space>>8) & 0xff, out_space & 0xff,
in_type,out_type
);
#endif /* DEBUG_PROFILE */
transform = cmsCreateTransform(in_prof, in_type,
out_prof, out_type, intent, 0);
#ifdef HAVE_LIBLCMS2
/* Possible for: LCMS_VERSION >= 2000 :*/
cmsCloseProfile(in_prof);
cmsCloseProfile(out_prof);
#endif
if(transform == NULL)
{
#ifdef DEBUG_PROFILE
fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
"ICC Profile ignored.\n",__FILE__,__LINE__);
#endif
image->color_space = oldspace;
#ifdef HAVE_LIBLCMS1
cmsCloseProfile(in_prof);
cmsCloseProfile(out_prof);
#endif
return;
}
if(image->numcomps > 2)/* RGB, RGBA */
{
unsigned short *inbuf, *outbuf, *in, *out;
max = max_w * max_h; nr_samples = max * 3 * sizeof(unsigned short);
in = inbuf = (unsigned short*)malloc(nr_samples);
out = outbuf = (unsigned short*)malloc(nr_samples);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
*in++ = (unsigned short)*r++;
*in++ = (unsigned short)*g++;
*in++ = (unsigned short)*b++;
}
cmsDoTransform(transform, inbuf, outbuf, max);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
*r++ = (int)*out++;
*g++ = (int)*out++;
*b++ = (int)*out++;
}
free(inbuf); free(outbuf);
}
else /* GRAY, GRAYA */
{
unsigned char *in, *inbuf, *out, *outbuf;
max = max_w * max_h; nr_samples = max * 3 * sizeof(unsigned char);
in = inbuf = (unsigned char*)malloc(nr_samples);
out = outbuf = (unsigned char*)malloc(nr_samples);
image->comps = (opj_image_comp_t*)
realloc(image->comps, (image->numcomps+2)*sizeof(opj_image_comp_t));
if(image->numcomps == 2)
image->comps[3] = image->comps[1];
image->comps[1] = image->comps[0];
image->comps[2] = image->comps[0];
image->comps[1].data = (int*)calloc(max, sizeof(int));
image->comps[2].data = (int*)calloc(max, sizeof(int));
image->numcomps += 2;
r = image->comps[0].data;
for(i = 0; i < max; ++i)
{
*in++ = (unsigned char)*r++;
}
cmsDoTransform(transform, inbuf, outbuf, max);
r = image->comps[0].data;
g = image->comps[1].data;
b = image->comps[2].data;
for(i = 0; i < max; ++i)
{
*r++ = (int)*out++; *g++ = (int)*out++; *b++ = (int)*out++;
}
free(inbuf); free(outbuf);
}/* if(image->numcomps */
cmsDeleteTransform(transform);
#ifdef HAVE_LIBLCMS1
cmsCloseProfile(in_prof);
cmsCloseProfile(out_prof);
#endif
}/* color_apply_icc_profile() */
#endif /* HAVE_LIBLCMS2 || HAVE_LIBLCMS1 */

View File

@ -1,15 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
@ -40,8 +34,5 @@
extern void color_sycc_to_rgb(opj_image_t *img);
extern void color_apply_icc_profile(opj_image_t *image);
extern void color_cielab_to_rgb(opj_image_t *image);
extern void color_cmyk_to_rgb(opj_image_t *image);
extern void color_esycc_to_rgb(opj_image_t *image);
#endif /* _OPJ_COLOR_H_ */

View File

@ -1,15 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2007, Professor Benoit Macq
* Copyright (c) 2001-2003, David Janssens
* Copyright (c) 2002-2003, Yannick Verschueren
* Copyright (c) 2003-2007, Francois-Olivier Devaux
* Copyright (c) 2003-2014, Antonin Descampe
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
* Copyright (c) 2005, Herve Drolon, FreeImage Team
* All rights reserved.
*
@ -47,9 +41,8 @@
#define BMP_DFMT 12
#define YUV_DFMT 13
#define TIF_DFMT 14
#define RAW_DFMT 15 /* MSB / Big Endian */
#define RAW_DFMT 15
#define TGA_DFMT 16
#define PNG_DFMT 17
#define RAWL_DFMT 18 /* LSB / Little Endian */
#endif /* _OPJ_FORMAT_DEFS_H_ */

View File

@ -1,9 +1,4 @@
/*
* The copyright in this software is being made available under the 3-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@ -15,7 +10,11 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -54,7 +53,7 @@ int opj_opterr = 1, /* if error message should be printed */
static char EMSG[]={""};
/* As this class remembers its values from one Java call to the other, reset the values before each use */
void opj_reset_options_reading(void) {
void reset_options_reading(void) {
opj_opterr = 1;
opj_optind = 1;
}
@ -66,7 +65,7 @@ void opj_reset_options_reading(void) {
int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
# define __progname nargv[0]
static char *place = EMSG; /* option letter processing */
const char *oli = NULL; /* option letter list index */
char *oli = NULL; /* option letter list index */
if (opj_optreset || !*place) { /* update scanning pointer */
opj_optreset = 0;
@ -125,7 +124,7 @@ int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
const opj_option_t *longopts, int totlen) {
static int lastidx,lastofs;
const char *tmp;
char *tmp;
int i,len;
char param = 1;

View File

@ -24,6 +24,6 @@ extern char *opj_optarg;
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
const opj_option_t *longopts, int totlen);
extern void opj_reset_options_reading(void);
extern void reset_options_reading(void);
#endif /* _GETOPT_H_ */

127
applications/jpip/CHANGES Normal file
View File

@ -0,0 +1,127 @@
What's New for OpenJPIP
* : fixed
- : removed
! : changed
+ : added
Feburary 28, 2012
+ [kaori] enabled the opj_server to reply the first query consisting with len request from kakadu client
February 9, 2012
* [kaori] fixed Doxygen configuration file to document the utilities
+ [kaori] added execution argument to set port number for opj_dec_server, opj_viewer*
January 26, 2012
! [kaori] unapplied auxtrans_manager to the local mode
December 24, 2011
* [kaori] additional modification for the warning
December 22, 2011
* [kaori] fixed auxtrans_manager to enable MAC
* [kaori] warnings due to disregarding return value are removed
November 30, 2011
+ [kaori] TCP return (http-tcp) implemented
November 16, 2011
* [kaori] fixed Region of Interest option, and memory leak of opj_dec_server
+ [kaori] new feature to target JP2 files from www (libcurl required)
* [kaori] fixed opj_server execusion error (instant terminating) with autotool, cmake still need to be fixed
November 8, 2011
! [kaori] updated main page of doxygen
November 3, 2011
* [kaori] solved memory leak of opj_server
! [kaori] removed redundant defines
November 2, 2011
* [antonin] additional patches for autotools and cmake
October 26, 2011
* [kaori] additional patches for autotool are applied
October 25, 2011
* [kaori] patches for cmake and autotool are applied
* [kaori] fixed client viewer to be compatible with server response header both Content-type and Content-Type
October 20, 2011
+ [added] API style in openJPIP library
! [kaori] rearranged directories, applications are all under util/ directory, currently only 'make -f Makefile.nix' works
October 18, 2011
! [kaori] rearranged opj_server, opj_dec_server directory
October 14, 2011
+ [kaori] enable all progression orders
October 12, 2011
+ [kaori] enable layers requests; restricting the number of codesream quality layers
October 11, 2011
+ [antonin] enable JPT-stream request from client viewer option (credit to kaori)
October 10, 2011
- [antonin] removed obsolete indexer utility (credit to kaori)
+ [antonin] enabled JPP-stream (credit to kaori)
September 16, 2011
+ [kaori] enabled stateless requests from the opj_viewers
Septempber 1, 2011
* [kaori] changed terminating status of opj_server in debug/non-server mode
August 27, 2011
* [antonin] fixed missing include directory in opj_client/opj_dec_server/CMakeLists.txt
August 26, 2011
* [antonin] fixed cmake and autotools files to reflect recent indexer changes in JPIP
! [kaori] indexer using the latest openjpeg library
* [antonin] fixed cmake and autotools files to reflect recent changes in JPIP
! [kaori] fixed Makefile.nix to load openjpeg library from this archive
August 25, 2011
+ [kaori] added tid request support to JPIP client
+ [kaori] added quit JPIP server request
August 24, 2011
+ [kaori] added cachemodel_manager, which had been managed in target_manager previously
+ [kaori] added tid request support to JPIP server
August 16, 2011
* [antonin] fixed cmake support for openjpip
August 12, 2011
+ [antonin] added cmake support to openjpip
July 6, 2011
* [antonin] JPIP : fixed autotools to work with recent name changes
July 5, 2011
! [kaori] changed parameter, file names, message names regarding JPT-stream to JPIP-stream, which handles also JPP-stream
May 26, 2011
! [antonin] changed Makefile to Makefile.nix to avoid having autotools overwrite them.
May 23, 2011
+ [antonin] added autotools for the 'tools' directory
+ [antonin] added autotools as a build method for jpip (credit to Vincent Torri)
May 10, 2011
! [kaori] opj_viewer removed the xml functions (for users without Xersus2)
+ [kaori] renamed opj_viewer to opj_viewer_xerces ( needs Xersus2)
! [kaori] Modification of opj_dec_server to be portable to windows
May 9, 2011
* [kaori] Removal of c99 from the compile option (to be compatible to win platform) and bool definition in libopenjpip/bool.h
May 9, 2011
* [antonin] OpenJPIP: small bug fixes to compile on win platform
May 8, 2011
* [antonin] OpenJPIP: fixed several bugs in opj_server (removal of strsep function, duplication of query string) + some changes to compile opj_server under windows (replacement of strcasecmp(), bzero()).
April 14, 2011
+ [antonin] initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details)

View File

@ -0,0 +1,16 @@
# required dep for server:
IF(BUILD_JPIP_SERVER)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(FCGI REQUIRED)
FIND_PACKAGE(Threads REQUIRED)
IF(NOT CMAKE_USE_PTHREADS_INIT)
MESSAGE(FATAL_ERROR "Only pthread are supported")
ENDIF(NOT CMAKE_USE_PTHREADS_INIT)
ENDIF(BUILD_JPIP_SERVER)
# JPIP library:
ADD_SUBDIRECTORY(libopenjpip)
# JPIP binaries:
ADD_SUBDIRECTORY(util)

View File

@ -0,0 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = libopenjpip util

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,17 +1,13 @@
include_regular_expression("^.*$")
INCLUDE_REGULAR_EXPRESSION("^.*$")
add_definitions(-DUSE_JPIP)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${FCGI_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
)
# Defines the source code for the library
set(OPENJPIP_SRCS
SET(OPENJPIP_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/boxheader_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/codestream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/imgreg_manager.c
@ -36,14 +32,13 @@ set(OPENJPIP_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/session_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpip_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/sock_manager.c
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2/opj_malloc.c
)
set(SERVER_SRCS
SET(SERVER_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/auxtrans_manager.c
)
set(LOCAL_SRCS
SET(LOCAL_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
@ -52,40 +47,26 @@ set(LOCAL_SRCS
)
# Build the library
if(WIN32)
if(BUILD_SHARED_LIBS)
add_definitions(-DOPJ_EXPORTS)
else()
add_definitions(-DOPJ_STATIC)
endif()
endif()
add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
set_target_properties(openjpip
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
if(${CMAKE_VERSION} VERSION_GREATER "2.8.11")
target_compile_options(openjpip PRIVATE ${OPENJPEG_LIBRARY_COMPILE_OPTIONS})
endif()
target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
if(WIN32)
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME})
IF(WIN32)
# add Winsock on windows+mingw
target_link_libraries(openjpip ws2_32)
endif()
TARGET_LINK_LIBRARIES(openjpip_local ws2_32)
ENDIF(WIN32)
# Install library
install(TARGETS openjpip
INSTALL(TARGETS openjpip_local
EXPORT OpenJPEGTargets
RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
if(BUILD_JPIP_SERVER)
add_library(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
target_link_libraries(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(openjpip_server
IF(BUILD_JPIP_SERVER)
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS})
SET_TARGET_PROPERTIES(openjpip_server
PROPERTIES COMPILE_FLAGS "-DSERVER")
install(TARGETS openjpip_server
INSTALL(TARGETS openjpip_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
endif()
ENDIF(BUILD_JPIP_SERVER)

View File

@ -0,0 +1,151 @@
MAINTAINERCLEANFILES = Makefile.in
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
includes_HEADERS =
lib_LTLIBRARIES =
if WANT_JPIP
lib_LTLIBRARIES += libopenjpip_local.la
endif
if WANT_JPIP_SERVER
lib_LTLIBRARIES += libopenjpip_server.la
endif
JPIP_SRC = \
openjpip.c \
query_parser.c \
channel_manager.c \
session_manager.c \
jpip_parser.c \
boxheader_manager.c \
codestream_manager.c \
imgreg_manager.c \
marker_manager.c \
msgqueue_manager.c \
box_manager.c \
faixbox_manager.c \
index_manager.c \
metadata_manager.c \
placeholder_manager.c \
byte_manager.c \
ihdrbox_manager.c \
manfbox_manager.c \
mhixbox_manager.c \
target_manager.c \
cachemodel_manager.c \
j2kheader_manager.c \
jp2k_encoder.c \
sock_manager.c \
openjpip.h \
bool.h \
boxheader_manager.h \
box_manager.h \
byte_manager.h \
codestream_manager.h \
faixbox_manager.h \
ihdrbox_manager.h \
imgreg_manager.h \
index_manager.h \
manfbox_manager.h \
marker_manager.h \
metadata_manager.h \
mhixbox_manager.h \
msgqueue_manager.h \
placeholder_manager.h \
target_manager.h \
cachemodel_manager.h \
j2kheader_manager.h \
jp2k_encoder.h \
query_parser.h \
channel_manager.h \
session_manager.h \
jpip_parser.h \
jp2k_decoder.h \
sock_manager.h
SERVER_SRC = auxtrans_manager.c \
auxtrans_manager.h
LOCAL_SRC = jp2k_decoder.c \
imgsock_manager.c \
jpipstream_manager.c \
cache_manager.c \
dec_clientmsg_handler.c \
imgsock_manager.h \
jpipstream_manager.h \
cache_manager.h \
dec_clientmsg_handler.h
libopenjpip_server_la_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
@FCGI_CFLAGS@ \
@LIBCURL_CFLAGS@ \
-DSERVER
libopenjpip_server_la_CFLAGS = @THREAD_CFLAGS@
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ @THREAD_LIBS@ -lm
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
libopenjpip_server_la_SOURCES = $(JPIP_SRC) $(SERVER_SRC)
libopenjpip_local_la_CPPFLAGS = \
-I. \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
@LIBCURL_CFLAGS@
libopenjpip_local_la_CFLAGS =
libopenjpip_local_la_LIBADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC)
install-data-hook:
if WANT_JPIP_SERVER
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
if BUILD_SHARED
@( $(call solist_s) ) >> $(top_builddir)/report.txt
endif
if BUILD_STATIC
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
endif
endif
if WANT_JPIP
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
if BUILD_SHARED
@( $(call solist_c) ) >> $(top_builddir)/report.txt
endif
if BUILD_STATIC
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
endif
endif
solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;)
get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2)
base_s = $(call get_tok_s,libdir)
so_s = $(call get_tok_s,library_names)
a_s = $(call get_tok_s,old_library)
solist_c = $(foreach f, $(dll_c) $(so_c), echo -e ' $(SO_PREFIX)\t$(base_c)/$(f)' ;)
get_tok_c = $(shell grep -E "^$(1)=" libopenjpip_local.la | cut -d "'" -f 2)
base_c = $(call get_tok_c,libdir)
so_c = $(call get_tok_c,library_names)
a_c = $(call get_tok_c,old_library)
if HAVE_WIN32
SO_PREFIX = (DLL)
dll_s = $(call get_tok_s,dlname)
dll_c = $(call get_tok_c,dlname)
else
if HAVE_DARWIN
SO_PREFIX = (DY)
dll_s =
dll_c =
else
SO_PREFIX = (SO)
dll_s =
dll_c =
endif
endif

View File

@ -1,8 +1,8 @@
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -56,7 +56,7 @@ auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport)
auxtrans.udpauxport = udp_auxport;
if( 49152 <= tcp_auxport && tcp_auxport <= 65535)
auxtrans.tcplistensock = open_listeningsocket( (uint16_t)tcp_auxport);
auxtrans.tcplistensock = open_listeningsocket( tcp_auxport);
else
auxtrans.tcplistensock = -1;
@ -82,15 +82,15 @@ void close_aux_transport( auxtrans_param_t auxtrans)
typedef struct aux_response_param{
char *cid; /*!< channel ID */
unsigned char *data; /*!< sending data */
OPJ_SIZE_T datalen; /*!< length of data */
OPJ_SIZE_T maxlenPerFrame; /*!< maximum data length to send per frame */
int datalen; /*!< length of data */
int maxlenPerFrame; /*!< maximum data length to send per frame */
SOCKET listensock; /*!< listeing socket */
#ifdef _WIN32
HANDLE hTh; /*!< thread handle */
#endif
} aux_response_param_t;
aux_response_param_t * gene_auxresponse( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame);
void delete_auxresponse( aux_response_param_t **auxresponse);
@ -101,7 +101,7 @@ unsigned __stdcall aux_streaming( void *arg);
void * aux_streaming( void *arg);
#endif
void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame)
{
aux_response_param_t *auxresponse;
#ifdef _WIN32
@ -133,11 +133,11 @@ void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const
fprintf( FCGI_stderr, "Error: error in send_responsedata_on_aux(), udp not implemented\n");
}
aux_response_param_t * gene_auxresponse( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame)
{
aux_response_param_t *auxresponse;
auxresponse = (aux_response_param_t *)opj_malloc( sizeof(aux_response_param_t));
auxresponse = (aux_response_param_t *)malloc( sizeof(aux_response_param_t));
auxresponse->cid = strdup( cid);
auxresponse->data = data;
@ -150,9 +150,9 @@ aux_response_param_t * gene_auxresponse( OPJ_BOOL istcp, auxtrans_param_t auxtra
void delete_auxresponse( aux_response_param_t **auxresponse)
{
opj_free( (*auxresponse)->cid);
opj_free( (*auxresponse)->data);
opj_free( *auxresponse);
free( (*auxresponse)->cid);
free( (*auxresponse)->data);
free( *auxresponse);
}
/**
@ -163,9 +163,9 @@ void delete_auxresponse( aux_response_param_t **auxresponse)
* @param [in] fp file pointer for log of aux stream
* @return true if identified, false otherwise
*/
OPJ_BOOL identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
OPJ_BOOL recv_ack( SOCKET connected_socket, void *data);
bool recv_ack( SOCKET connected_socket, void *data);
#ifdef _WIN32
unsigned __stdcall aux_streaming( void *arg)
@ -175,8 +175,8 @@ void * aux_streaming( void *arg)
{
SOCKET connected_socket;
unsigned char *chunk, *ptr;
OPJ_SIZE_T maxLenOfBody, remlen, chunklen;
const OPJ_SIZE_T headlen = 8;
int maxLenOfBody, remlen, chunklen;
const int headlen = 8;
aux_response_param_t *auxresponse = (aux_response_param_t *)arg;
@ -186,7 +186,7 @@ void * aux_streaming( void *arg)
pthread_detach( pthread_self());
#endif
chunk = (unsigned char *)opj_malloc( auxresponse->maxlenPerFrame);
chunk = (unsigned char *)malloc( auxresponse->maxlenPerFrame);
maxLenOfBody = auxresponse->maxlenPerFrame - headlen;
remlen = auxresponse->datalen;
@ -194,29 +194,29 @@ void * aux_streaming( void *arg)
if( identify_cid( connected_socket, auxresponse->cid, FCGI_stderr)){
ptr = auxresponse->data;
while( 0 < remlen){
memset( chunk, 0, auxresponse->maxlenPerFrame);
memset( chunk, 0, auxresponse->maxlenPerFrame);
chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
chunklen += headlen;
chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
chunklen += headlen;
chunk[0] = (chunklen >> 8) & 0xff;
chunk[1] = chunklen & 0xff;
chunk[0] = (chunklen >> 8) & 0xff;
chunk[1] = chunklen & 0xff;
memcpy( chunk+headlen, ptr, chunklen-headlen);
memcpy( chunk+headlen, ptr, chunklen-headlen);
do{
send_stream( connected_socket, chunk, chunklen);
}while( !recv_ack( connected_socket, chunk));
do{
send_stream( connected_socket, chunk, chunklen);
}while( !recv_ack( connected_socket, chunk));
remlen -= maxLenOfBody;
ptr += maxLenOfBody;
remlen -= maxLenOfBody;
ptr += maxLenOfBody;
}
if( close_socket( connected_socket) != 0)
perror("close");
perror("close");
break;
}
}
opj_free( chunk);
free( chunk);
delete_auxresponse( &auxresponse);
@ -230,38 +230,38 @@ void * aux_streaming( void *arg)
}
OPJ_BOOL identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
{
char *cid;
OPJ_BOOL succeed;
bool succeed;
if(!(cid = receive_string( connected_socket))){
fprintf( fp, "Error: error in identify_cid(), while receiving cid from client\n");
return OPJ_FALSE;
return false;
}
succeed = OPJ_FALSE;
succeed = false;
if( strncmp( refcid, cid, strlen( refcid)) == 0)
succeed = OPJ_TRUE;
succeed = true;
opj_free( cid);
free( cid);
return succeed;
}
OPJ_BOOL recv_ack( SOCKET connected_socket, void *data)
bool recv_ack( SOCKET connected_socket, void *data)
{
char *header;
OPJ_BOOL succeed;
bool succeed;
header = receive_stream( connected_socket, 8);
if( memcmp( header, data, 8) != 0)
succeed = OPJ_FALSE;
succeed = false;
else
succeed = OPJ_TRUE;
succeed = true;
opj_free( header);
free( header);
return succeed;
}

View File

@ -1,8 +1,8 @@
/*
* $Id$
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -32,7 +32,6 @@
# define AUXTRANS_MANAGER_H_
#include "sock_manager.h"
#include "opj_includes.h"
/** auxiliary transport setting parameters*/
typedef struct auxtrans_param{
@ -45,8 +44,8 @@ typedef struct auxtrans_param{
/**
* Initialize auxiliary transport server of JPIP server
*
* @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 49152-65535)
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152-65535)
* @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 4915265535)
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 4915265535)
* @return intialized transport parameters
*/
auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport);
@ -68,6 +67,6 @@ void close_aux_transport( auxtrans_param_t auxtrans);
* @param[in] length length of data
* @param[in] maxlenPerFrame maximum data length to send per frame
*/
void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int length, int maxlenPerFrame);
#endif /* !AUXTRANS_MANAGER_H_ */

View File

@ -1,10 +1,9 @@
/*
* The copyright in this software is being made available under the 2-clauses
* BSD License, included below. This software may be subject to other third
* party and contributor rights, including patent rights, and no such rights
* are granted under this license.
* $Id$
*
* Copyright (c) 2016, Even Rouault
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -29,9 +28,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TLS_KEYS_H
#define TLS_KEYS_H
#define OPJ_TLS_KEY_T1 0
#ifndef BOOL_H_
# define BOOL_H_
#ifndef false
#define false 0
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef true
#define true (!false)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
typedef char bool;
#endif /* !BOOL_H_ */

View File

@ -1,8 +1,8 @@
/*
* $Id$
* $Id: box_manager.c 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -32,9 +32,7 @@
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include "box_manager.h"
#include "opj_inttypes.h"
#ifdef SERVER
#include "fcgi_stdio.h"
@ -45,7 +43,7 @@
#define logstream stderr
#endif /*SERVER*/
boxlist_param_t * gene_boxlist(void)
boxlist_param_t * gene_boxlist()
{
boxlist_param_t *boxlist;
@ -57,41 +55,38 @@ boxlist_param_t * gene_boxlist(void)
return boxlist;
}
boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
boxlist_param_t * get_boxstructure( int fd, Byte8_t offset, Byte8_t length)
{
boxlist_param_t *boxlist;
box_param_t *box;
OPJ_OFF_T pos;
int pos;
boxlist = NULL;
pos = offset;
assert( (OPJ_OFF_T)length>=0);
do{
if(!(box = gene_boxbyOffset( fd, pos)))
break;
assert( (OPJ_OFF_T)box->length >= 0);
pos += (OPJ_OFF_T)box->length;
pos += box->length;
if( !boxlist)
boxlist = gene_boxlist();
insert_box_into_list( box, boxlist);
}while( pos < offset+(OPJ_OFF_T)length);
}while( pos < (int)(offset+length));
return boxlist;
}
box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset)
box_param_t * gene_boxbyOffset( int fd, Byte8_t offset)
{
Byte_t *data;
Byte8_t boxlen;
Byte_t headlen;
Byte8_t boxlen, headlen;
char *boxtype;
box_param_t *box;
/* read LBox and TBox*/
if(!(data = fetch_bytes( fd, offset, 8))){
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %" PRId64 ")\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %lld)\n", fd, offset);
return NULL;
}
@ -116,7 +111,7 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset)
free(data2);
}
else{
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %" PRId64 ")\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %lld)\n", fd, offset);
free( data);
return NULL;
}
@ -132,10 +127,9 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset)
return box;
}
box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset)
box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset)
{
Byte8_t boxlen;
Byte_t headlen;
Byte8_t boxlen, headlen;
char *boxtype;
box_param_t *box;
@ -167,28 +161,22 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset)
}
box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, const char TBox[])
{
OPJ_OFF_T pos;
Byte8_t pos;
Byte_t *data;
Byte8_t boxlen;
Byte_t headlen;
Byte8_t boxlen, headlen;
char *boxtype;
box_param_t *foundbox;
if( length==0){ /* set the max length*/
if( get_filesize( fd) <= offset )
if( (length = get_filesize( fd) - offset) <= 0)
return NULL;
assert( get_filesize( fd) > offset );
assert( offset >= 0 );
length = (OPJ_SIZE_T)(get_filesize( fd) - offset);
}
pos = offset;
assert( pos >= 0 );
assert( (OPJ_OFF_T)length >= 0 );
while( pos < offset+(OPJ_OFF_T)length-7){ /* LBox+TBox-1=7*/
while( pos < offset+length-7){ /* LBox+TBox-1=7*/
/* read LBox and TBox*/
if((data = fetch_bytes( fd, pos, 8))){
@ -205,7 +193,7 @@ box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const
free(data2);
}
else{
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %" PRId64 ", %" PRId64 ", %s)\n", fd, offset, length, TBox);
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %lld, %lld, %s)\n", fd, offset, length, TBox);
return NULL;
}
}
@ -223,30 +211,32 @@ box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const
free( data);
}
else{
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %" PRId64 ", %" PRId64 ", %s)\n", fd, offset, length, TBox);
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %lld, %lld, %s)\n", fd, offset, length, TBox);
return NULL;
}
assert( ((Byte8_t)pos+boxlen)>=(Byte8_t)pos);
pos+= (OPJ_OFF_T)boxlen;
pos+= boxlen;
}
fprintf( FCGI_stderr, "Error: Box %s not found\n", TBox);
return NULL;
}
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, const char TBox[])
{
OPJ_OFF_T pos;
Byte8_t pos;
Byte_t *data;
Byte8_t boxlen;
Byte_t headlen;
Byte8_t boxlen, headlen;
char *boxtype;
box_param_t *foundbox;
if( length<=0){ /* set the max length*/
fprintf( FCGI_stderr, "func gene_boxbyTypeinStream(), max length must be more than 0\n");
return NULL;
}
pos = offset;
assert( pos >= 0 );
assert( (OPJ_OFF_T)length >= 0 );
while( pos < offset+(OPJ_OFF_T)(length)-7){ /* LBox+TBox-1=7*/
while( pos < offset+length-7){ /* LBox+TBox-1=7*/
/* read LBox and TBox*/
data = stream + pos;
@ -270,39 +260,31 @@ box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE
foundbox->next = NULL;
return foundbox;
}
assert( ((Byte8_t)pos+boxlen)>=(Byte8_t)pos);
pos+= (OPJ_OFF_T)boxlen;
pos+= boxlen;
}
fprintf( FCGI_stderr, "Error: Box %s not found\n", TBox);
return NULL;
}
box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset)
box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset)
{
return gene_boxbyOffset( superbox->fd, get_DBoxoff( superbox)+offset);
}
box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, const char TBox[])
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, const char TBox[])
{
OPJ_SIZE_T DBOXlen = get_DBoxlen(superbox);
assert( offset >= 0 );
if( DBOXlen < (OPJ_SIZE_T)offset )
{
fprintf( FCGI_stderr, "Error: Impossible happen %lu < %ld\n", DBOXlen, offset);
return NULL;
}
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, DBOXlen-(OPJ_SIZE_T)offset, TBox);
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, get_DBoxlen( superbox)-offset, TBox);
}
OPJ_OFF_T get_DBoxoff( box_param_t *box)
Byte8_t get_DBoxoff( box_param_t *box)
{
return box->offset+box->headlen;
}
OPJ_SIZE_T get_DBoxlen( box_param_t *box)
Byte8_t get_DBoxlen( box_param_t *box)
{
return box->length - box->headlen;
return box->length-box->headlen;
}
Byte_t * fetch_headbytes( box_param_t *box)
@ -310,27 +292,27 @@ Byte_t * fetch_headbytes( box_param_t *box)
return fetch_bytes( box->fd, box->offset, box->headlen);
}
Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size)
Byte_t * fetch_DBoxbytes( box_param_t *box, long offset, int size)
{
return fetch_bytes( box->fd, get_DBoxoff( box)+offset, size);
}
Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset)
Byte_t fetch_DBox1byte( box_param_t *box, long offset)
{
return fetch_1byte( box->fd, get_DBoxoff( box)+offset);
}
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset)
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, long offset)
{
return fetch_2bytebigendian( box->fd, get_DBoxoff( box)+offset);
}
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset)
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, long offset)
{
return fetch_4bytebigendian( box->fd, get_DBoxoff( box)+offset);
}
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset)
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset)
{
return fetch_8bytebigendian( box->fd, get_DBoxoff( box)+offset);
}
@ -357,10 +339,9 @@ void print_box( box_param_t *box)
{
fprintf( logstream, "box info:\n"
"\t type: %.4s\n"
"\t offset: %" PRId64 " %#" PRIx64 "\n"
"\t offset: %lld %#llx\n"
"\t header length: %d\n"
"\t length: %" PRId64 " %#" PRIx64 "\n", box->type, box->offset,
box->offset, box->headlen, box->length, box->length);
"\t length: %lld %#llx\n", box->type, box->offset, box->offset, box->headlen, box->length, box->length);
}
void print_allbox( boxlist_param_t *boxlist)
@ -400,7 +381,7 @@ void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist)
free( *box);
}
void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist)
void delete_box_in_list_by_type( char type[], boxlist_param_t *boxlist)
{
box_param_t *box;

View File

@ -1,8 +1,8 @@
/*
* $Id$
* $Id: box_manager.h 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -36,7 +36,7 @@
/** box parameters*/
typedef struct box_param{
int fd; /**< file descriptor*/
OPJ_OFF_T offset; /**< byte position of the whole Box (LBox) in the file*/
Byte8_t offset; /**< byte position of the whole Box (LBox) in the file*/
Byte_t headlen; /**< header length 8 or 16*/
Byte8_t length; /**< length of the whole Box*/
char type[4]; /**< type of information in the DBox*/
@ -56,7 +56,7 @@ typedef struct boxlist_param{
*
* @return pointer to the generated box list
*/
boxlist_param_t * gene_boxlist(void);
boxlist_param_t * gene_boxlist();
/**
* get box structure of JP2 file
@ -66,7 +66,7 @@ boxlist_param_t * gene_boxlist(void);
* @param[in] length length of the decomposing region
* @return pointer to the generated boxlist
*/
boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
boxlist_param_t * get_boxstructure( int fd, Byte8_t offset, Byte8_t length);
/**
@ -76,7 +76,7 @@ boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
* @param[in] offset Box offset
* @return pointer to the structure of generate box parameters
*/
box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
box_param_t * gene_boxbyOffset( int fd, Byte8_t offset);
/**
@ -86,7 +86,7 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
* @param[in] offset Box offset of the whole stream
* @return pointer to the structure of generate box parameters
*/
box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset);
box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset);
/**
* generate(search) box from JP2 file
@ -97,7 +97,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset);
* @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters
*/
box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, const char TBox[]);
/**
* generate(search) box from code stream
@ -108,7 +108,7 @@ box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const
* @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters
*/
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, const char TBox[]);
/**
* generate child box from JP2 file at the given offset
@ -117,7 +117,7 @@ box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE
* @param[in] offset offset from DBox first byte of superbox
* @return pointer to the structure of generate box parameters
*/
box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset);
/**
* generate(search) box from JP2 file
@ -127,7 +127,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
* @param[in] TBox Box Type
* @return pointer to the structure of generate/found box parameters
*/
box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, const char TBox[]);
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, const char TBox[]);
/**
* get DBox offset
@ -135,7 +135,7 @@ box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, cons
* @param[in] box box pointer
* @return DBox offset (byte position) in the file
*/
OPJ_OFF_T get_DBoxoff( box_param_t *box);
Byte8_t get_DBoxoff( box_param_t *box);
/**
@ -144,7 +144,7 @@ OPJ_OFF_T get_DBoxoff( box_param_t *box);
* @param[in] box box pointer
* @return DBox length ( content length)
*/
OPJ_SIZE_T get_DBoxlen( box_param_t *box);
Byte8_t get_DBoxlen( box_param_t *box);
/**
@ -164,7 +164,7 @@ Byte_t * fetch_headbytes( box_param_t *box);
* @param[in] size Byte length
* @return pointer to the fetched data
*/
Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
Byte_t * fetch_DBoxbytes( box_param_t *box, long offset, int size);
/**
* fetch DBox (Box Contents) 1-byte Byte codes in file stream
@ -173,7 +173,7 @@ Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
Byte_t fetch_DBox1byte( box_param_t *box, long offset);
/**
* fetch DBox (Box Contents) 2-byte big endian Byte codes in file stream
@ -182,7 +182,7 @@ Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, long offset);
/**
* fetch DBox (Box Contents) 4-byte big endian Byte codes in file stream
@ -191,7 +191,7 @@ Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, long offset);
/**
* fetch DBox (Box Contents) 8-byte big endian Byte codes in file stream
@ -200,7 +200,7 @@ Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
* @param[in] offset start Byte position in DBox
* @return fetched code
*/
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset);
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset);
/**
@ -242,7 +242,7 @@ void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist);
* @param[in,out] type box type
* @param[in] boxlist box list pointer
*/
void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist);
void delete_box_in_list_by_type( char type[], boxlist_param_t *boxlist);
/**

View File

@ -1,8 +1,8 @@
/*
* $Id$
* $Id: boxheader_manager.c 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -33,7 +33,6 @@
#include <string.h>
#include <stdlib.h>
#include "boxheader_manager.h"
#include "opj_inttypes.h"
#ifdef SERVER
#include "fcgi_stdio.h"
@ -45,7 +44,7 @@
#endif /*SERVER*/
boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset)
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
{
Byte8_t boxlen;
Byte_t headlen;
@ -71,14 +70,14 @@ boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset)
return boxheader;
}
boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset)
boxheader_param_t * gene_childboxheader( box_param_t *superbox, Byte8_t offset)
{
return gene_boxheader( superbox->fd, get_DBoxoff(superbox)+offset);
return gene_boxheader( superbox->fd, get_DBoxoff( superbox)+offset);
}
void print_boxheader( boxheader_param_t *boxheader)
{
fprintf( logstream, "boxheader info:\n"
"\t type: %.4s\n"
"\t length:%" PRId64 " %#" PRIx64 "\n", boxheader->type, boxheader->length, boxheader->length);
"\t length:%lld %#llx\n", boxheader->type, boxheader->length, boxheader->length);
}

View File

@ -1,8 +1,8 @@
/*
* $Id$
* $Id: boxheader_manager.h 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -31,7 +31,6 @@
#ifndef BOXHEADER_MANAGER_H_
# define BOXHEADER_MANAGER_H_
#include "openjpeg.h"
#include "byte_manager.h"
#include "box_manager.h"
@ -51,7 +50,7 @@ typedef struct boxheader_param{
* @param[in] offset Box offset
* @return pointer to the structure of generate box header parameters
*/
boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset);
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset);
/**
* generate a child box header at the given offset
@ -60,7 +59,7 @@ boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset);
* @param[in] offset offset from DBox first byte of superbox
* @return pointer to the structure of generate box header parameters
*/
boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset);
boxheader_param_t * gene_childboxheader( box_param_t *superbox, Byte8_t offset);
/**
* print box header parameters

View File

@ -1,8 +1,8 @@
/*
* $Id$
* $Id: byte_manager.c 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -49,52 +49,52 @@
#endif /*SERVER*/
Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size)
Byte_t * fetch_bytes( int fd, long offset, int size)
{
Byte_t *data;
if( lseek( fd, offset, SEEK_SET)==-1){
fprintf( FCGI_stdout, "Reason: Target broken (fseek error)\r\n");
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %lu)\n", fd, offset, size);
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %d)\n", fd, offset, size);
return NULL;
}
data = (Byte_t *)malloc( size);
if( (OPJ_SIZE_T)read( fd, data, size) != size){
if( read( fd, data, size) != size){
free( data);
fprintf( FCGI_stdout, "Reason: Target broken (read error)\r\n");
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %lu)\n", fd, offset, size);
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %d)\n", fd, offset, size);
return NULL;
}
return data;
}
Byte_t fetch_1byte( int fd, OPJ_OFF_T offset)
Byte_t fetch_1byte( int fd, long offset)
{
Byte_t code;
if( lseek( fd, offset, SEEK_SET)==-1){
fprintf( FCGI_stdout, "Reason: Target broken (seek error)\r\n");
fprintf( FCGI_stderr, "Error: error in fetch_1byte( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_1byte( %d, %lld)\n", fd, offset);
return 0;
}
if( read( fd, &code, 1) != 1){
fprintf( FCGI_stdout, "Reason: Target broken (read error)\r\n");
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %lld)\n", fd, offset);
return 0;
}
return code;
}
Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset)
Byte2_t fetch_2bytebigendian( int fd, long offset)
{
Byte_t *data;
Byte2_t code;
if(!(data = fetch_bytes( fd, offset, 2))){
fprintf( FCGI_stderr, "Error: error in fetch_2bytebigendian( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_2bytebigendian( %d, %lld)\n", fd, offset);
return 0;
}
code = big2(data);
@ -103,13 +103,13 @@ Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset)
return code;
}
Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset)
Byte4_t fetch_4bytebigendian( int fd, long offset)
{
Byte_t *data;
Byte4_t code;
if(!(data = fetch_bytes( fd, offset, 4))){
fprintf( FCGI_stderr, "Error: error in fetch_4bytebigendian( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_4bytebigendian( %d, %lld)\n", fd, offset);
return 0;
}
code = big4(data);
@ -118,13 +118,13 @@ Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset)
return code;
}
Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset)
Byte8_t fetch_8bytebigendian( int fd, long offset)
{
Byte_t *data;
Byte8_t code;
if(!(data = fetch_bytes( fd, offset, 8))){
fprintf( FCGI_stderr, "Error: error in fetch_8bytebigendian( %d, %ld)\n", fd, offset);
fprintf( FCGI_stderr, "Error: error in fetch_8bytebigendian( %d, %lld)\n", fd, offset);
return 0;
}
code = big8(data);
@ -136,7 +136,7 @@ Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset)
Byte2_t big2( Byte_t *buf)
{
return (Byte2_t)((((Byte2_t) buf[0]) << 8) + ((Byte2_t) buf[1]));
return (((Byte2_t) buf[0]) << 8) + ((Byte2_t) buf[1]);
}
Byte4_t big4( Byte_t *buf)
@ -159,7 +159,7 @@ void modify_4Bytecode( Byte4_t code, Byte_t *stream)
*(stream+3) = (Byte_t) (code & 0x000000ff);
}
OPJ_OFF_T get_filesize( int fd)
Byte8_t get_filesize( int fd)
{
struct stat sb;
@ -168,5 +168,5 @@ OPJ_OFF_T get_filesize( int fd)
fprintf( FCGI_stderr, "Error: error in get_filesize( %d)\n", fd);
return 0;
}
return sb.st_size;
return (Byte8_t)sb.st_size;
}

View File

@ -1,8 +1,8 @@
/*
* $Id$
* $Id: byte_manager.h 44 2011-02-15 12:32:29Z kaori $
*
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2014, Professor Benoit Macq
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq
* Copyright (c) 2010-2011, Kaori Hagihara
* All rights reserved.
*
@ -31,13 +31,28 @@
#ifndef BYTE_MANAGER_H_
#define BYTE_MANAGER_H_
#include <stddef.h>
#include "openjpeg.h"
#include "opj_stdint.h"
#include "opj_config.h"
#ifdef HAVE_STDINT_H
#include <stdint.h>
typedef uint8_t Byte_t;
typedef uint16_t Byte2_t;
typedef uint32_t Byte4_t;
typedef uint64_t Byte8_t;
#else
#if defined(_WIN32)
/** 1Byte parameter type*/
typedef unsigned __int8 Byte_t;
/** 2Byte parameter type*/
typedef unsigned __int16 Byte2_t;
/** 4Byte parameter type*/
typedef unsigned __int32 Byte4_t;
/** 8Byte parameter type*/
typedef unsigned __int64 Byte8_t;
#else
#error unsupported platform
#endif
#endif
/**
* fetch bytes of data in file stream
@ -47,7 +62,7 @@ typedef uint64_t Byte8_t;
* @param[in] size Byte length
* @return pointer to the fetched data
*/
Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
Byte_t * fetch_bytes( int fd, long offset, int size);
/**
@ -57,7 +72,7 @@ Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte_t fetch_1byte( int fd, OPJ_OFF_T offset);
Byte_t fetch_1byte( int fd, long offset);
/**
* fetch a 2-byte big endian Byte codes in file stream
@ -66,7 +81,7 @@ Byte_t fetch_1byte( int fd, OPJ_OFF_T offset);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset);
Byte2_t fetch_2bytebigendian( int fd, long offset);
/**
* fetch a 4-byte big endian Byte codes in file stream
@ -75,7 +90,7 @@ Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset);
Byte4_t fetch_4bytebigendian( int fd, long offset);
/**
* fetch a 8-byte big endian Byte codes in file stream
@ -84,7 +99,7 @@ Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset);
* @param[in] offset start Byte position
* @return fetched codes
*/
Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset);
Byte8_t fetch_8bytebigendian( int fd, long offset);
/**
@ -125,6 +140,6 @@ void modify_4Bytecode( Byte4_t code, Byte_t *stream);
* @param[in] fd file discriptor
* @return file size
*/
OPJ_OFF_T get_filesize( int fd);
Byte8_t get_filesize( int fd);
#endif /* !BYTE_MANAGER_H_ */

Some files were not shown because too many files have changed in this diff Show More