Compare commits
148 Commits
version.1.
...
version.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d22bb4ae3 | ||
|
|
73a6ed7c21 | ||
|
|
56afd80506 | ||
|
|
398b3f08b0 | ||
|
|
1dd92890d7 | ||
|
|
436d2f4bb9 | ||
|
|
0264197f3f | ||
|
|
b487a3521c | ||
|
|
816d914c4e | ||
|
|
c0fd0c8f89 | ||
|
|
ebcda80583 | ||
|
|
407b95e35f | ||
|
|
d08a96e251 | ||
|
|
59d9b97ffe | ||
|
|
cf39198a9a | ||
|
|
02229c7c2d | ||
|
|
1c2ed5cc33 | ||
|
|
efc709578a | ||
|
|
eb5694ca2a | ||
|
|
389166e86e | ||
|
|
2b31495723 | ||
|
|
d5b44a98bc | ||
|
|
0e5551da99 | ||
|
|
3afd3b1afd | ||
|
|
223a39b51e | ||
|
|
8faf300b6e | ||
|
|
5c76f68168 | ||
|
|
ad970dd9df | ||
|
|
161891a06e | ||
|
|
709068ef5b | ||
|
|
2b7f6f82be | ||
|
|
005b1b1a4b | ||
|
|
3eab8f975e | ||
|
|
2a4563a677 | ||
|
|
af32de46a2 | ||
|
|
f35d25c674 | ||
|
|
0dc7f6a2d3 | ||
|
|
bb9232c9d9 | ||
|
|
87cb9efb99 | ||
|
|
4c9a60d4fd | ||
|
|
e36881487d | ||
|
|
56dd722fb4 | ||
|
|
c2f441840f | ||
|
|
a55ea39677 | ||
|
|
fc668f3ec3 | ||
|
|
c515199674 | ||
|
|
b6102e207c | ||
|
|
ddc9a278aa | ||
|
|
e65ef3a24f | ||
|
|
f4b08bacb0 | ||
|
|
ae6cf3da7d | ||
|
|
03133377fa | ||
|
|
106da2f51e | ||
|
|
72b6fdb04b | ||
|
|
453af11e2c | ||
|
|
eeefefd56c | ||
|
|
531c0cf26f | ||
|
|
b7208fb525 | ||
|
|
dc700d5d50 | ||
|
|
00f7af7748 | ||
|
|
9989de4bd0 | ||
|
|
fcbf45ca64 | ||
|
|
509f7a64ea | ||
|
|
e80d147957 | ||
|
|
2cea89dc7d | ||
|
|
1a79adb3a9 | ||
|
|
8dbd92f6c2 | ||
|
|
d22912349b | ||
|
|
26e8f3fd28 | ||
|
|
86864a2f6c | ||
|
|
7c65e4c14b | ||
|
|
a56fbe42a4 | ||
|
|
9427107b94 | ||
|
|
75c589958a | ||
|
|
3e8cad7e39 | ||
|
|
e4c4d146e1 | ||
|
|
34e592341c | ||
|
|
94b9942cd9 | ||
|
|
d5f9ea9fc2 | ||
|
|
f6ed93253b | ||
|
|
3479749499 | ||
|
|
89eafad589 | ||
|
|
8bb5a19905 | ||
|
|
84f77a71e5 | ||
|
|
da0d29e4ab | ||
|
|
f30f4c744e | ||
|
|
6621494d9d | ||
|
|
2374885ac0 | ||
|
|
784cf66dc2 | ||
|
|
6c641471b2 | ||
|
|
18c30c30d6 | ||
|
|
a1b6f1e096 | ||
|
|
a02c683572 | ||
|
|
8ecce4df3d | ||
|
|
9af159c200 | ||
|
|
b96b24ce8c | ||
|
|
fdf04af271 | ||
|
|
203a264f96 | ||
|
|
b5ff4ffedc | ||
|
|
6628a4df45 | ||
|
|
627f484bce | ||
|
|
d03779ee2a | ||
|
|
3e4b0ee509 | ||
|
|
54214fb65f | ||
|
|
3ecae15da2 | ||
|
|
c2da8234d9 | ||
|
|
20d5c4c1a8 | ||
|
|
34c485169e | ||
|
|
cb4702b4c5 | ||
|
|
c1a51d68a6 | ||
|
|
9324bc4cd4 | ||
|
|
449d7bedb6 | ||
|
|
bfd3fe8a4a | ||
|
|
9dbbc6ca13 | ||
|
|
83abf56736 | ||
|
|
a695c8eb51 | ||
|
|
a69db02b7f | ||
|
|
73d8401465 | ||
|
|
4a90f97639 | ||
|
|
4da178b0d8 | ||
|
|
f4bbad8615 | ||
|
|
cebdbda260 | ||
|
|
1d45d7514b | ||
|
|
846bd364be | ||
|
|
295ad6b112 | ||
|
|
f4d394d932 | ||
|
|
65e5ff0fb4 | ||
|
|
2f3dd4916f | ||
|
|
a92cc111a2 | ||
|
|
52296999f6 | ||
|
|
9652def4de | ||
|
|
6d1f3ecc9f | ||
|
|
396cb1e102 | ||
|
|
ac0cc6df62 | ||
|
|
29ea3dde47 | ||
|
|
e21d865440 | ||
|
|
04966097fc | ||
|
|
8c2ae8b03d | ||
|
|
9947453ea8 | ||
|
|
4514e333c6 | ||
|
|
daff186ceb | ||
|
|
8359fbd5e7 | ||
|
|
13209d2565 | ||
|
|
9a6f0596b0 | ||
|
|
901308cbc8 | ||
|
|
ea6d8f5aaf | ||
|
|
4051e87d06 | ||
|
|
4619a94ebf |
@@ -5,6 +5,344 @@ What's New for OpenJPEG
|
|||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
January 2, 2011
|
||||||
|
* [antonin] bug fixes to enable cmake compilation on WIN32 platform
|
||||||
|
- fixed getopt bug in jpwl/CMakeLists.txt
|
||||||
|
- added png, zlib and lcms win32 libraries to libs directory
|
||||||
|
- updated libs/libtiff library
|
||||||
|
- moved j2k_dump_{image,cp} to j2k_dump.c to remain consistent with API interface
|
||||||
|
- changed mj2 cmake compilation method: as long as mj2 binaries do not strictly use the API interface, libopenjpeg source files are directly included in mj2 executables compilation.
|
||||||
|
! [antonin] small update to xcode project
|
||||||
|
|
||||||
|
December 14, 2010
|
||||||
|
! [szukw000] adapted Makefile.am/Makefile.nix to build
|
||||||
|
choice: shared xor static
|
||||||
|
|
||||||
|
December 11, 2010
|
||||||
|
* [antonin] fixed flags when building jp3d with MinGW
|
||||||
|
|
||||||
|
December 10, 2010
|
||||||
|
! [szukw000] changed build choice in configure.ac/Makefile.am/Makefile.nix:
|
||||||
|
shared xor static
|
||||||
|
|
||||||
|
December 9, 2010
|
||||||
|
! [antonin] removed LCMS dependency in jp3d/libjp3dvm/CMakeLists.txt
|
||||||
|
! [antonin] updated xcode project
|
||||||
|
! [antonin] renamed jp3d/libjp3dvm/openjpeg.h => jp3d/libjp3dvm/openjpeg3d.h
|
||||||
|
- [antonin] removed "codec/compat/" directory
|
||||||
|
* [szukw000] updated Makefile.in
|
||||||
|
! [szukw000] removed LCMS dependencies from Makefile.am/Makefile.nix
|
||||||
|
|
||||||
|
December 8, 2010
|
||||||
|
(thanks to Winfried for his help)
|
||||||
|
* [antonin] changed remaining "WIN32" to "_WIN32"
|
||||||
|
! [antonin] libopenjpeg has no more dependency on LCMS lib. Everything concerning color (icc profile, conversion to rgb, etc) has been put outside libopenjpeg and is used in j2k_to_image.c and mj2_to_frames.c.
|
||||||
|
- [antonin] removed 'opj_convert{.c,.h}'
|
||||||
|
+ [antonin] added a directory 'common/' that contains 'getopt{.c,.h}' (previously in 'codec/compat').
|
||||||
|
+ [antonin] added files 'color{.c,.h}' in 'common/' that define the code for icc profile management and sycc_to_rgb conversion
|
||||||
|
+ [antonin] added 'common/format_defs.h' that contains common definitions used in image_to_j2k, j2k_to_image, j2k_dump.
|
||||||
|
|
||||||
|
December 5, 2010
|
||||||
|
! [antonin] revert to previous behaviour for cmake: builds (and links) dynamically by default. Static build only if -DBUILD_SHARED_LIBS is set to OFF.
|
||||||
|
* [antonin] added a definition in getopt.h and an initial value in convert.c
|
||||||
|
|
||||||
|
December 3, 2010
|
||||||
|
* [antonin] workaround for name clash when building static and dynamic on WIN32 (see http://www.vtk.org/Bug/view.php?id=10190 for description)
|
||||||
|
|
||||||
|
November 28, 2010
|
||||||
|
* [antonin] fixed a bug in codec/convert.c that prevented to build executables with WIN32 compiler (thanks winfried)
|
||||||
|
! [antonin] changed cmake behaviour: executables are now always statically linked. When -DBUIL_SHARED_LIBS option is ON (the default), the shared versions of the libraries are also built (but executables remain linked against the static libraries).
|
||||||
|
|
||||||
|
November 25, 2010
|
||||||
|
* [antonin] fix compilation and DLL creation of libopenjpeg with MSYS/MinGW (from vincent.torri, see issue 47 on googlecode)
|
||||||
|
|
||||||
|
November 22, 2010
|
||||||
|
! [antonin] xcode : changed to native architecture build by default
|
||||||
|
* [antonin] reverted 'include "../opj_config.h"' to 'include "opj_config.h"'
|
||||||
|
|
||||||
|
November 17, 2010
|
||||||
|
! [antonin] install man pages by default. install CHANGES and LICENSE
|
||||||
|
! [antonin] minor changes in cmake files (from winfried)
|
||||||
|
|
||||||
|
November 16, 2010
|
||||||
|
! [antonin] minor changes in cmake flags
|
||||||
|
|
||||||
|
November 15, 2010
|
||||||
|
! [antonin] xcode project rewrite.
|
||||||
|
! [antonin] changed imagetopng() function to correctly deal with non-standard bit-depths. Add png support for win32. (from winfried)
|
||||||
|
* [antonin] minor changes in header inclusions
|
||||||
|
* [antonin] complete rewrite of opj_convert.c with correct values (from winfried)
|
||||||
|
|
||||||
|
November 11, 2010
|
||||||
|
- [antonin] removed call to dirent.h in jp3d;
|
||||||
|
|
||||||
|
October 28, 2010
|
||||||
|
* [ben.boeckel] Set the soname and soversion on the jpwl library with CMake
|
||||||
|
+ [ben.boeckel] Install jpwl binaries with CMake
|
||||||
|
|
||||||
|
October 26, 2010
|
||||||
|
* [ben.boeckel] Install symlinks to versioned directory headers when using CMake
|
||||||
|
+ [ben.boeckel] Set the library version on jp3d when using CMake
|
||||||
|
|
||||||
|
October 25, 2010
|
||||||
|
* [ben.boeckel] Fix jp3d version
|
||||||
|
|
||||||
|
October 24, 2010
|
||||||
|
* [antonin] Fixed doxygen data inside source code (from winfried)
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
* [ben.boeckel] Don't install jp3d and libopenjpeg headers to the same place
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
* [ben.boeckel] Install man pages when using CMake
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
! [ben.boeckel] Default to building shared libraries
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
* [antonin] Patch to support the MSVC Win 64 builds (from szekerest)
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
* [antonin] Currently the Visual Studio builds are broken in the SVN. Attached a patch to fix this issue (from szekerest)
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
* [szukw000] replaced 'cp -d' with 'cp -P' for MacOSX
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
* [szukw000] 'jpwl/Makefile.am': added CFLAGS for bin_PROGRAMS
|
||||||
|
|
||||||
|
October 22, 2010
|
||||||
|
+ [szukw000] added 'libopenjpeg.pc.in'
|
||||||
|
! [szukw000] changed 'configure.ac' to create 'libopenjpeg.pc'
|
||||||
|
! [szukw000] changed 'Makefile.am' to [un]install 'libopenjpeg.pc'
|
||||||
|
! [szukw000] changed 'doc/Makefile.am' : 'uninstall-hook' added
|
||||||
|
|
||||||
|
October 20, 2010
|
||||||
|
* [antonin] fixed help display (patch from winfried)
|
||||||
|
|
||||||
|
October 20, 2010
|
||||||
|
* [antonin]
|
||||||
|
fixed paths to png and tiff in CMakeLists.txt (patch from winfried)
|
||||||
|
fixed link to lcms library (patch from winfried)
|
||||||
|
|
||||||
|
October 18, 2010
|
||||||
|
* [antonin] fixed options and help display (patch from winfried)
|
||||||
|
|
||||||
|
October 18, 2010
|
||||||
|
! [szukw000]
|
||||||
|
doc/Makefile.am
|
||||||
|
doc/Makefile.nix
|
||||||
|
jp3d/Makefile.nix
|
||||||
|
jpwl/Makefile.nix
|
||||||
|
Makefile.nix
|
||||||
|
config.nix
|
||||||
|
|
||||||
|
October 17, 2010
|
||||||
|
! [szukw000]
|
||||||
|
configure.ac : 'enable_shared' YES by default
|
||||||
|
doc/Makefile.am :
|
||||||
|
'all-local' and 'install-data-hook' added
|
||||||
|
'with_doxygen' conditional added
|
||||||
|
Makefile.am : 'doc' directory no longer substituted in SUBDIRS
|
||||||
|
|
||||||
|
to link binaries statically: '-static' added to:
|
||||||
|
codec/Makefile.am
|
||||||
|
mj2/Makefile.am
|
||||||
|
jpwl/Makefile.am
|
||||||
|
jp3d/codec/Makefile.am
|
||||||
|
|
||||||
|
mj2/Makefile.am : 'with_libjpwl' removed
|
||||||
|
mj2/Makefile.nix : 'with_libjpwl' removed
|
||||||
|
|
||||||
|
config.nix : 'WITH_JPWL', 'WITH_JP3D' added
|
||||||
|
doc/Makefile.nix : 'clean', 'install', 'uninstall' added
|
||||||
|
Makefile.nix : 'WITH_JPWL', 'WITH_JP3D' added
|
||||||
|
|
||||||
|
INSTALL : topic 3) changed regarding the changes in 'config.nix'
|
||||||
|
|
||||||
|
October 13, 2010
|
||||||
|
! [szukw000]
|
||||||
|
configure.ac
|
||||||
|
bootstrap.sh
|
||||||
|
|
||||||
|
'with_libjpwl' removed from:
|
||||||
|
libopenjpeg/Makefile.am
|
||||||
|
codec/Makefile.am
|
||||||
|
codec/Makefile.nix
|
||||||
|
Makefile.nix
|
||||||
|
|
||||||
|
October 10, 2010
|
||||||
|
* [antonin] Patch from winfried
|
||||||
|
|
||||||
|
1. The jp3d/libjp3dvm/Makefile.am has been changed:
|
||||||
|
|
||||||
|
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/
|
||||||
|
Installing: /usr/local/TEST_CONFIG/include/openjpeg3d-1.3/openjpeg3d.h
|
||||||
|
|
||||||
|
PREFIX/include:
|
||||||
|
|
||||||
|
23 openjpeg.h -> openjpeg-1.4/openjpeg.h
|
||||||
|
27 openjpeg3d.h -> openjpeg3d-1.3/openjpeg3d.h
|
||||||
|
|
||||||
|
28773 openjpeg-1.4/openjpeg.h
|
||||||
|
22158 openjpeg3d-1.3/openjpeg3d.h
|
||||||
|
|
||||||
|
2. The jp3d/Makefile.nix has been changed respectivly.
|
||||||
|
|
||||||
|
3. The mj2/Makefile.nix contained a wrong path to 'compat/'
|
||||||
|
|
||||||
|
4. opj_config.h.in.user contained a comment within a comment.
|
||||||
|
|
||||||
|
5. 'autoreconf' reported that AC_PROG_RANLIB is no longer
|
||||||
|
necessary in 'configure.ac'.
|
||||||
|
|
||||||
|
October 08, 2010
|
||||||
|
* [antonin] fixed a bug in mj2.c that prevented extract_j2k_from_mj2 to build properly. Patch from winfried.
|
||||||
|
|
||||||
|
October 04, 2010
|
||||||
|
+ [antonin] Added files to let people build openjpeg with 'configure' tools
|
||||||
|
+ [antonin] Added makefiles to let people manually build openjpeg on *nix platforms
|
||||||
|
- [antonin] Removed obsolete Makefiles
|
||||||
|
! [antonin] Renamed dirent.h to windirent.h
|
||||||
|
! [antonin] Made optional the PNG, TIFF, and LCMS support in CMake files
|
||||||
|
+ [antonin] Added opj_config* files to configure openjpeg before building it (opj_config.h generated by 'configure', cmake, or manually by the user)
|
||||||
|
! [antonin] Renamed this file from ChangeLog to CHANGES
|
||||||
|
! [antonin] Renamed 'License.txt' to 'LICENSE'
|
||||||
|
! [antonin] Updated README files
|
||||||
|
+ [antonin] Added INSTALL and LICENSE files
|
||||||
|
+ [antonin] Added man pages
|
||||||
|
|
||||||
|
June 22, 2010
|
||||||
|
+ [MM] Apply patch from w. szukalski (sent to list)
|
||||||
|
+ [MM] Also dump the image info as well as cp info.
|
||||||
|
|
||||||
|
June 21, 2010
|
||||||
|
+ [MM] Added a j2k_dump to simply dump the parameter of a J2K file
|
||||||
|
|
||||||
|
May 26, 2010
|
||||||
|
+ [antonin] Added CTestConfig.cmake to the root directory to incorporate the testing dashboard.
|
||||||
|
+ [antonin] MACOSX : Added a "build all" target to the XCode project file.
|
||||||
|
|
||||||
|
April 16, 2010
|
||||||
|
* [antonin] MACOSX : Fixed the XCode project file to link with the PNG library. Library and header should be located in /usr/local/lib/ and /usr/local/include/, respectively. Check http://ethan.tira-thompson.org/Mac_OS_X_Ports.html if it is not the case on your mac.
|
||||||
|
|
||||||
|
April 8, 2010
|
||||||
|
* [FOD] Fixed issue 6 on google code. Variable "pi" not freed or pointed-to in function "pi_create_encode". Thanks to Kent Mein for reporting this.
|
||||||
|
* [FOD] Fixed problem with Borland C++ Builder (Borland C do not have lrintf). Thanks Marek Mauder for this fix.
|
||||||
|
* [FOD] Fixed pi.c bug (issue 15 on google code). Thanks to Anton Lionel for catching this.
|
||||||
|
* [FOD] Fixed MJ2 codec bugs (issues 23-24 on google code). Thanks to Winfried for these patches
|
||||||
|
* [FOD] Fixed JP3D codec file format analyzer. Thanks to Kristóf Ralovich for this patch.
|
||||||
|
! [FOD] Significant optimizations of MCT, DWT, MQ and T1 modules by Peter Wimmer (thanks Peter)
|
||||||
|
|
||||||
|
March 26, 2010
|
||||||
|
+ [FOD] Added support for "jpc" codestreams which are equivalent to "j2c" codestreams. Thanks to Winfried for this patch
|
||||||
|
* [FOD] Added support for PNG image format [Not yet functional under WIN32]. Thanks to Winfried for this patch. See details here http://code.google.com/p/openjpeg/issues/detail?id=16
|
||||||
|
|
||||||
|
March 24, 2010
|
||||||
|
* [FOD] Code improvements using 'g++-4.4.0' to trace the code. Thanks to Winfried for this patch.
|
||||||
|
|
||||||
|
March 7, 2010
|
||||||
|
* [FOD] Fixed small compatibility issues with win32 in codec (moved include <strings.h>)
|
||||||
|
|
||||||
|
March 5, 2010
|
||||||
|
! [FOD] Updated makefiles for v1.4 and v2.0
|
||||||
|
+ [FOD] First import of OPJ_Validate tool
|
||||||
|
|
||||||
|
February 18, 2010
|
||||||
|
* [FOD] JP3D Module. Fixed issue when computing the number of elements in an array that leads to crash (thanks Kristof). Updated JP3D makefiles.
|
||||||
|
|
||||||
|
January 20, 2010
|
||||||
|
! [FOD] Created a new constant in openjpeg.h to differentiate the case when the colorspace is not supported by the library and when it is not specified in the codestream. Suggested by Matteo Italia.
|
||||||
|
|
||||||
|
November 5, 2009
|
||||||
|
* [antonin] fixed MCT check bug in t1_getwmsedec. See http://groups.google.com/group/openjpeg/browse_thread/thread/d9d96dd4ec3e7443 for info.
|
||||||
|
|
||||||
|
November 5, 2009
|
||||||
|
* [antonin] fixed "tiffio" header inclusion to use user version on Win32 system only (otherwise assume its existence in system headers).
|
||||||
|
|
||||||
|
September 10, 2009
|
||||||
|
* [antonin] fixed minor bugs which were triggering warnings at compilation (different signedness, wrong pointer type, etc)
|
||||||
|
|
||||||
|
September 8, 2009
|
||||||
|
* [antonin] openjpeg.c : fixed initialization of parameters->cp_disto_alloc/fixed_quality/fixed_alloc/tcp_numlayers because they were preventing to use the -q and -f options.
|
||||||
|
|
||||||
|
August 31, 2009
|
||||||
|
* [antonin] JavaOpenJpegDecoder.c : fixed a signed/unsigned behaviour when returning form C to JAVA
|
||||||
|
|
||||||
|
August 21, 2008
|
||||||
|
* [antonin] found a bug in tcd.c that was preventing to find the correct threshold in tcd_rateallocate.c for high-precision images. Applied a temporary patch but a better solution should be found.
|
||||||
|
|
||||||
|
August 21, 2008
|
||||||
|
* [antonin] fixed a bug in image_to_j2k.c that was preventing the 'r' option to work properly (everything was compressed lossless regardless of the specified rate).
|
||||||
|
|
||||||
|
August 8, 2008
|
||||||
|
! [FOD] Modified the way raw images with more that 8bpp are read and written
|
||||||
|
|
||||||
|
July 9, 2008
|
||||||
|
+ [Parvatha] Added the default lossless parameter to opj_set_default_encoder_parameters in openjpeg.c.
|
||||||
|
|
||||||
|
June 12, 2008
|
||||||
|
* [antonin] fixed a bug in dirent.h that prevented codec on Linux Alpha Systems to compile correctly. Thanks to RobinC.
|
||||||
|
|
||||||
|
May 22, 2008
|
||||||
|
* [antonin] fixed a bug in j2k.c (j2k_write_sod) that allowed to get negative rates, thanks zhong1985624 for pointing this.
|
||||||
|
|
||||||
|
May 22, 2008
|
||||||
|
* [antonin] additional test to avoid crash due to invalid image size, patch by Christopher Layne
|
||||||
|
|
||||||
|
May 20, 2008
|
||||||
|
* [antonin] memory leak fixed in openjpeg.c (opj_destroy_cstr_info()), patch by Carsten Juttner
|
||||||
|
|
||||||
|
March 12, 2008
|
||||||
|
+ [GB] help line for the -F option in j2k_to_image
|
||||||
|
|
||||||
|
March 4, 2008
|
||||||
|
! [FOD] Changed Java files copyright in JavaOpenJPEG module
|
||||||
|
|
||||||
|
February 28, 2008
|
||||||
|
* [FOD] Fixed openjpeg.c for proper initialization of codec context structures (dinfo in opj_create_compress()
|
||||||
|
and opj_create_decompress(). Bug fix suggested by Andrey V. Kiselev
|
||||||
|
* [FOD] Clean up of opj_aligned_malloc(), to just forgo the use of posix_memalign(),
|
||||||
|
as apparently memalign() is what is working better for everyone. Patch by Callum.
|
||||||
|
|
||||||
|
February 28, 2008
|
||||||
|
- [FOD] Removed the J2KViewer module, which has been replaced by OPJViewer
|
||||||
|
* [FOD] Fixed the error handling of j2k_decode in jp2.c, thanks to Robin Cornelius
|
||||||
|
|
||||||
|
February 11, 2008
|
||||||
|
* [GB] Minor style modifications to comply with c99 compiler flag; removed Microsoft-specific "union-in-struct" syntax; Re-enabled cstr_info struct creation when -W switch is specified
|
||||||
|
! [GB] Changed a number of things in opjviewer (e.g., decoding thread does not execute GUI calls anymore), to have it running under linux --> it is better than before, but still crashes
|
||||||
|
|
||||||
|
February 5, 2008
|
||||||
|
! [Parvatha] In convert.c, corrected imagetobmp() conversion for grayscale. In tcd.c, corrected Rate modification in
|
||||||
|
tcd_init_encode(). Thanks to Jeremy Furtek and Jérôme Fimes.
|
||||||
|
|
||||||
|
January 31, 2008
|
||||||
|
! [GB] In opjviewer, unification of JPEG 2000 family handlers (*.jp2, *.mj2, *.j2k) in a single file
|
||||||
|
|
||||||
|
January 22, 2008
|
||||||
|
! [FOD] In image.c, changed the opj_image_create0() memory allocation from malloc() to calloc() in order
|
||||||
|
to avoid segfaults when freeing the memory allocated for the coding of bad images.
|
||||||
|
Thanks to Christopher Layne for this improvement.
|
||||||
|
|
||||||
|
January 17, 2008
|
||||||
|
+ [antonin] Initial commit of Xcode project directory (XCode 2.5 for macosx)
|
||||||
|
available targets : libopenjpeg (stat and dyn), image_to_j2k, j2k_to_image
|
||||||
|
|
||||||
|
January 16, 2008
|
||||||
|
* [antonin] fixed opj_malloc.h for macosx (bugfix provided by janpeder, thanks)
|
||||||
|
|
||||||
|
January 11, 2008
|
||||||
|
+ [FOD] Added missing files to JavaOpenJPEG project (files from Patrick Piscaglia)
|
||||||
|
|
||||||
|
January 4, 2008
|
||||||
|
* [Parvatha] Patch by Callum Lerwick. Fixed bug during encoding using tile option in tcd.c
|
||||||
|
|
||||||
|
----------------------
|
||||||
|
December 21, 2007
|
||||||
|
VERSION 1.3.0 RELEASED
|
||||||
|
----------------------
|
||||||
|
|
||||||
December 21, 2007
|
December 21, 2007
|
||||||
* [FOD] Bug fixed by David Bruken. Fixed memory allocation issue in opj_malloc.h
|
* [FOD] Bug fixed by David Bruken. Fixed memory allocation issue in opj_malloc.h
|
||||||
! [FOD] Possible errors in pi_create_encode handled
|
! [FOD] Possible errors in pi_create_encode handled
|
||||||
@@ -287,7 +625,7 @@ March 30, 2007
|
|||||||
* [GB] OPJViewer should now work under Linux, at least with not big j2k files. Tested under Suse 10.1 64 bit.
|
* [GB] OPJViewer should now work under Linux, at least with not big j2k files. Tested under Suse 10.1 64 bit.
|
||||||
|
|
||||||
March 29, 2007
|
March 29, 2007
|
||||||
* [Parvatha] Enable accepting file names with `-´ symbol .Modification getopt.c
|
* [Parvatha] Enable accepting file names with `-´ symbol .Modification getopt.c
|
||||||
* [Parvatha] Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
|
* [Parvatha] Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
|
||||||
! [Parvatha] renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
|
! [Parvatha] renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
|
||||||
* [Parvatha] Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
|
* [Parvatha] Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
|
||||||
@@ -304,7 +642,7 @@ March 28, 2007
|
|||||||
March 27, 2007
|
March 27, 2007
|
||||||
+ [GB] Improved parsing in OPJViewer, as well some minor aesthetic modifications; support for image rendering with bit depths lower than 8 bits;
|
+ [GB] Improved parsing in OPJViewer, as well some minor aesthetic modifications; support for image rendering with bit depths lower than 8 bits;
|
||||||
can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better resizing capabilities
|
can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better resizing capabilities
|
||||||
* [GB] Following to Hervé's suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c,
|
* [GB] Following to Hervé's suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c,
|
||||||
have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return)
|
have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return)
|
||||||
+ [GB] Added linking to TIFF library in the JPWL VC6 workspaces
|
+ [GB] Added linking to TIFF library in the JPWL VC6 workspaces
|
||||||
|
|
||||||
21
CMake/CTestCustom.cmake.in
Normal file
21
CMake/CTestCustom.cmake.in
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# For further details regarding this file,
|
||||||
|
# see http://www.vtk.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
||||||
|
#
|
||||||
|
|
||||||
|
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||||
|
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 50)
|
||||||
|
|
||||||
|
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||||
|
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||||
|
|
||||||
|
# Exclude files from the Testing directories
|
||||||
|
".*/Testing/.*"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||||
|
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||||
|
|
||||||
|
# Suppress warning caused by intentional messages about deprecation
|
||||||
|
".*warning,.* is deprecated"
|
||||||
|
)
|
||||||
15
CMake/CheckHaveGetopt.cmake
Normal file
15
CMake/CheckHaveGetopt.cmake
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Check if getopt is present:
|
||||||
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||||
|
SET(DONT_HAVE_GETOPT 1)
|
||||||
|
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
||||||
|
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
||||||
|
# Seems like we need the contrary:
|
||||||
|
IF(CMAKE_HAVE_GETOPT_H)
|
||||||
|
SET(DONT_HAVE_GETOPT 0)
|
||||||
|
ENDIF(CMAKE_HAVE_GETOPT_H)
|
||||||
|
ENDIF(UNIX)
|
||||||
|
|
||||||
|
IF(DONT_HAVE_GETOPT)
|
||||||
|
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
||||||
|
ENDIF(DONT_HAVE_GETOPT)
|
||||||
|
|
||||||
48
CMake/OpenJPEGConfig.cmake.in
Normal file
48
CMake/OpenJPEGConfig.cmake.in
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# 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_LIBRARIES@")
|
||||||
|
|
||||||
|
# The CMake macros dir.
|
||||||
|
SET(OPENJPEG_CMAKE_DIR "@OPENJPEG_CMAKE_DIR_CONFIG@")
|
||||||
|
|
||||||
|
# The configuration options.
|
||||||
|
SET(OPENJPEG_BUILD_SHARED_LIBS "@OPENJPEG_BUILD_SHARED_LIBS@")
|
||||||
|
|
||||||
|
# The "use" file.
|
||||||
|
SET(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
|
||||||
|
|
||||||
|
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||||
|
# This is an install tree
|
||||||
|
include(${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||||
|
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@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)
|
||||||
|
|
||||||
325
CMakeLists.txt
325
CMakeLists.txt
@@ -7,7 +7,11 @@
|
|||||||
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
||||||
# e.g.:
|
# e.g.:
|
||||||
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
|
IF(COMMAND CMAKE_POLICY)
|
||||||
|
CMAKE_POLICY(SET CMP0003 NEW)
|
||||||
|
ENDIF(COMMAND CMAKE_POLICY)
|
||||||
|
|
||||||
IF(NOT OPENJPEG_NAMESPACE)
|
IF(NOT OPENJPEG_NAMESPACE)
|
||||||
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||||
@@ -24,22 +28,105 @@ INCLUDE_REGULAR_EXPRESSION("^.*$")
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||||
SET(OPENJPEG_VERSION_MAJOR 1)
|
SET(OPENJPEG_VERSION_MAJOR 1)
|
||||||
SET(OPENJPEG_VERSION_MINOR 2)
|
SET(OPENJPEG_VERSION_MINOR 4)
|
||||||
SET(OPENJPEG_VERSION_BUILD 0)
|
SET(OPENJPEG_VERSION_BUILD 0)
|
||||||
SET(OPENJPEG_VERSION
|
SET(OPENJPEG_VERSION
|
||||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||||
|
SET(PACKAGE_VERSION
|
||||||
|
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||||
# This setting of SOVERSION assumes that any API change
|
# This setting of SOVERSION assumes that any API change
|
||||||
# will increment either the minor or major version number of openjpeg
|
# will increment either the minor or major version number of openjpeg
|
||||||
SET(OPENJPEG_LIBRARY_PROPERTIES
|
SET(OPENJPEG_LIBRARY_PROPERTIES
|
||||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||||
SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}"
|
SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}"
|
||||||
)
|
)
|
||||||
|
# You will also need to define a value for the following variables:
|
||||||
|
# OPENJPEG_INSTALL_BIN_DIR - binary dir (executables)
|
||||||
|
# OPENJPEG_INSTALL_LIB_DIR - library dir (libs)
|
||||||
|
# OPENJPEG_INSTALL_DATA_DIR - share dir (say, examples, data, etc)
|
||||||
|
# OPENJPEG_INSTALL_INCLUDE_DIR - include dir (headers)
|
||||||
|
|
||||||
|
|
||||||
|
# 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(
|
||||||
|
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
||||||
|
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
||||||
|
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
||||||
|
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||||
|
-D_CRT_SECURE_NO_DEPRECATE
|
||||||
|
-D_CRT_SECURE_NO_DEPRECATE_GLOBALS
|
||||||
|
-D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
|
||||||
|
-D_CRT_TIME_FUNCTIONS_NO_DEPRECATE
|
||||||
|
-D_CRT_VCCLRIT_NO_DEPRECATE
|
||||||
|
-D_SCL_SECURE_NO_DEPRECATE
|
||||||
|
)
|
||||||
|
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||||
|
ENDIF(NOT MINGW)
|
||||||
|
ENDIF(NOT CYGWIN)
|
||||||
|
ENDIF(NOT BORLAND)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Install directories
|
||||||
|
|
||||||
|
STRING(TOLOWER ${PROJECT_NAME} projectname)
|
||||||
|
SET(subdir "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||||
|
|
||||||
|
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(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||||
|
SET(OPENJPEG_INSTALL_DATA_DIR "share/${subdir}")
|
||||||
|
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||||
|
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/")
|
||||||
|
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||||
|
SET(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||||
|
ENDIF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||||
|
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${subdir}")
|
||||||
|
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||||
|
SET(OPENJPEG_INSTALL_PACKAGE_DIR ${OPENJPEG_INSTALL_LIB_DIR}/${subdir}
|
||||||
|
CACHE INTERNAL "")
|
||||||
|
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Test for some required system information.
|
||||||
|
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Test for getopt being available in this system
|
||||||
|
INCLUDE (${PROJECT_SOURCE_DIR}/CMake/CheckHaveGetopt.cmake )
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Setup file for setting custom ctest vars
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/CTestCustom.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# OpenJPEG build configuration options.
|
# OpenJPEG build configuration options.
|
||||||
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG with shared libraries." OFF)
|
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 (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||||
@@ -47,11 +134,6 @@ SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output di
|
|||||||
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||||
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# For the codec...
|
|
||||||
OPTION(BUILD_EXAMPLES "Build the Examples (codec...)." OFF)
|
|
||||||
|
|
||||||
|
|
||||||
# configure name mangling to allow multiple libraries to coexist
|
# configure name mangling to allow multiple libraries to coexist
|
||||||
# peacefully
|
# peacefully
|
||||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
@@ -64,50 +146,62 @@ ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
|||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Always build the library
|
# Always build the library
|
||||||
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
SUBDIRS(
|
SUBDIRS(libopenjpeg)
|
||||||
libopenjpeg
|
|
||||||
mj2
|
|
||||||
# cmake 2.4.5 has poor java support
|
|
||||||
#j2kviewer/src
|
|
||||||
)
|
|
||||||
|
|
||||||
IF(NOT UNIX)
|
|
||||||
SUBDIRS(
|
|
||||||
jpwl
|
|
||||||
jp3d
|
|
||||||
indexer_JPIP
|
|
||||||
)
|
|
||||||
ENDIF(NOT UNIX)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build example only if requested
|
# Build CODEC executables ?
|
||||||
IF(BUILD_EXAMPLES)
|
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
|
||||||
|
IF(BUILD_CODEC)
|
||||||
SUBDIRS(codec)
|
SUBDIRS(codec)
|
||||||
ENDIF(BUILD_EXAMPLES)
|
ENDIF(BUILD_CODEC)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# For the documentation
|
# Build MJ2 executables ?
|
||||||
OPTION(BUILD_DOCUMENTATION "Build the doxygen documentation" OFF)
|
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||||
IF(BUILD_DOCUMENTATION)
|
IF(BUILD_MJ2)
|
||||||
|
SUBDIRS(mj2)
|
||||||
|
ENDIF(BUILD_MJ2)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Build JPWL executables ?
|
||||||
|
OPTION(BUILD_JPWL "Build the JPWL executables" OFF)
|
||||||
|
IF(BUILD_JPWL)
|
||||||
|
SUBDIRS(jpwl)
|
||||||
|
ENDIF(BUILD_JPWL)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Build JP3D executables ?
|
||||||
|
OPTION(BUILD_JP3D "Build the JP3D executables" OFF)
|
||||||
|
IF(BUILD_JP3D)
|
||||||
|
SUBDIRS(jp3d)
|
||||||
|
ENDIF(BUILD_JP3D)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Build INDEXER_JPIP executables ?
|
||||||
|
OPTION(BUILD_INDEXER_JPIP "Build the INDEXER_JPIP executables" OFF)
|
||||||
|
IF(BUILD_INDEXER_JPIP AND NOT UNIX)
|
||||||
|
SUBDIRS(indexer_JPIP)
|
||||||
|
ENDIF(BUILD_INDEXER_JPIP AND NOT UNIX)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Build DOCUMENTATION ?
|
||||||
|
OPTION(BUILD_DOC "Build the doxygen documentation" OFF)
|
||||||
|
IF(BUILD_DOC)
|
||||||
SUBDIRS(doc)
|
SUBDIRS(doc)
|
||||||
ENDIF(BUILD_DOCUMENTATION)
|
ENDIF(BUILD_DOC)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# For openjpeg team if they ever want Dart+CMake
|
# For openjpeg team if they ever want CDash+CMake
|
||||||
IF(OPENJPEG_STANDALONE)
|
OPTION(BUILD_TESTING "Build the tests." OFF)
|
||||||
INCLUDE(Dart)
|
IF(BUILD_TESTING)
|
||||||
MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
|
ENABLE_TESTING()
|
||||||
IF(BUILD_TESTING)
|
INCLUDE(CTest)
|
||||||
ENABLE_TESTING()
|
ENDIF(BUILD_TESTING)
|
||||||
SET(BUILDNAME "OpenJPEG-${CMAKE_SYSTEM}-${CMAKE_C_COMPILER}" CACHE STRING "Name of build on the dashboard")
|
|
||||||
MARK_AS_ADVANCED(BUILDNAME)
|
|
||||||
ENDIF(BUILD_TESTING)
|
|
||||||
ENDIF(OPENJPEG_STANDALONE)
|
|
||||||
|
|
||||||
# Adding test with dataset from:
|
# Adding test with dataset from:
|
||||||
# http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
# http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
||||||
|
# -> wget http://www.crc.ricoh.com/~gormish/jpeg2000conformance/j2kp4files_v1_5.zip
|
||||||
# http://www.jpeg.org/jpeg2000guide/testimages/testimages.html
|
# http://www.jpeg.org/jpeg2000guide/testimages/testimages.html
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Adding JPEG2000_CONFORMANCE_DATA_ROOT
|
# Adding JPEG2000_CONFORMANCE_DATA_ROOT
|
||||||
FIND_PATH(JPEG2000_CONFORMANCE_DATA_ROOT testimages.html
|
FIND_PATH(JPEG2000_CONFORMANCE_DATA_ROOT testimages.html
|
||||||
@@ -119,8 +213,155 @@ FIND_PATH(JPEG2000_CONFORMANCE_DATA_ROOT testimages.html
|
|||||||
# Compiler specific flags:
|
# Compiler specific flags:
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
# For all builds, make sure openjpeg is std99 compliant:
|
# For all builds, make sure openjpeg is std99 compliant:
|
||||||
SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}")
|
# 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:
|
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||||
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
|
# install all targets referenced as OPENJPEGTargets
|
||||||
|
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
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||||
|
)
|
||||||
|
# install CHANGES and LICENSE
|
||||||
|
INSTALL(
|
||||||
|
FILES CHANGES
|
||||||
|
LICENSE
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||||
|
#
|
||||||
|
IF(UNIX OR CYGWIN)
|
||||||
|
SET(CMAKE_INCLUDE_PATH /usr/include /usr/local/include /opt/include
|
||||||
|
/opt/local/include /usr/include/libpng /usr/include/libpng14
|
||||||
|
/usr/include/libpng12 /usr/local/include/libpng
|
||||||
|
/usr/local/include/libpng14 /usr/local/include/libpng12
|
||||||
|
/opt/include/libpng /opt/include/libpng14 /opt/include/libpng12
|
||||||
|
/opt/local/include/libpng /opt/local/include/libpng14
|
||||||
|
/opt/local/include/libpng12 )
|
||||||
|
SET(CMAKE_LIBRARY_PATH /usr/lib /usr/local/lib /opt/lib /opt/local/lib)
|
||||||
|
ELSEIF(WIN32)
|
||||||
|
SET(CMAKE_INCLUDE_PATH ${OPENJPEG_SOURCE_DIR}/libs/libtiff
|
||||||
|
${OPENJPEG_SOURCE_DIR}/libs/png ${OPENJPEG_SOURCE_DIR}/libs/lcms2
|
||||||
|
C:/WINDOWS/system32/user )
|
||||||
|
SET(CMAKE_LIBRARY_PATH ${OPENJPEG_SOURCE_DIR}/libs/libtiff
|
||||||
|
${OPENJPEG_SOURCE_DIR}/libs/png ${OPENJPEG_SOURCE_DIR}/libs/lcms2
|
||||||
|
C:/WINDOWS/system32/user )
|
||||||
|
ENDIF()
|
||||||
|
#
|
||||||
|
FIND_FILE(HAVE_STRINGS_H_FOUND strings.h)
|
||||||
|
IF(NOT HAVE_STRINGS_H_FOUND STREQUAL "HAVE_STRINGS_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_STRINGS_H strings.h)
|
||||||
|
SET(HAS_STRINGS_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_INTTYPES_H_FOUND inttypes.h)
|
||||||
|
IF(NOT HAVE_INTTYPES_H_FOUND STREQUAL "HAVE_INTTYPES_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_INTTYPES_H inttypes.h)
|
||||||
|
SET(HAS_INTTYPES_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_MEMORY_H_FOUND memory.h)
|
||||||
|
IF(NOT HAVE_MEMORY_H_FOUND STREQUAL "HAVE_MEMORY_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_MEMORY_H memory.h)
|
||||||
|
SET(HAS_MEMORY_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_STDINT_H_FOUND stdint.h)
|
||||||
|
IF(NOT HAVE_STDINT_H_FOUND STREQUAL "HAVE_STDINT_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_STDINT_H stdint.h)
|
||||||
|
SET(HAS_STDINT_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_STDLIB_H_FOUND stdlib.h)
|
||||||
|
IF(NOT HAVE_STDLIB_H_FOUND STREQUAL "HAVE_STDLIB_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_STDLIB_H stdlib.h)
|
||||||
|
SET(HAS_STDLIB_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_STRING_H_FOUND string.h)
|
||||||
|
IF(NOT HAVE_STRING_H_FOUND STREQUAL "HAVE_STRING_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_STRING_H string.h)
|
||||||
|
SET(HAS_STRING_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_SYS_STAT_H_FOUND sys/stat.h)
|
||||||
|
IF(NOT HAVE_SYS_STAT_H_FOUND STREQUAL "HAVE_SYS_STAT_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_SYS_STAT_H sys/stat.h)
|
||||||
|
SET(HAS_SYS_STAT_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_SYS_TYPES_H_FOUND sys/types.h)
|
||||||
|
IF(NOT HAVE_SYS_TYPES_H_FOUND STREQUAL "HAVE_SYS_TYPES_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_SYS_TYPES_H sys/types.h)
|
||||||
|
SET(HAS_SYS_TYPES_H 1)
|
||||||
|
ENDIF()
|
||||||
|
FIND_FILE(HAVE_UNISTD_H_FOUND unistd.h)
|
||||||
|
IF(NOT HAVE_UNISTD_H_FOUND STREQUAL "HAVE_UNISTD_H_FOUND-NOTFOUND")
|
||||||
|
FIND_FILE(HAVE_UNISTD_H unistd.h)
|
||||||
|
SET(HAS_UNISTD_H 1)
|
||||||
|
ENDIF()
|
||||||
|
#
|
||||||
|
# Does the system have png library installed ?
|
||||||
|
#
|
||||||
|
FIND_PACKAGE(PNG)
|
||||||
|
#
|
||||||
|
IF(PNG_FOUND)
|
||||||
|
SET(HAVE_PNG_H 1)
|
||||||
|
SET(HAVE_LIBPNG 1)
|
||||||
|
ENDIF()
|
||||||
|
#
|
||||||
|
# Does the system have tiff library installed ?
|
||||||
|
#
|
||||||
|
FIND_PACKAGE(TIFF)
|
||||||
|
#
|
||||||
|
IF(TIFF_FOUND)
|
||||||
|
SET(HAVE_TIFF_H 1)
|
||||||
|
SET(HAVE_LIBTIFF 1)
|
||||||
|
ENDIF()
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Does the system have lcms library installed ?
|
||||||
|
#
|
||||||
|
SET(LCMS_LIB "")
|
||||||
|
FIND_FILE(LCMS2_HEADER_FOUND lcms2.h)
|
||||||
|
#
|
||||||
|
IF(LCMS2_HEADER_FOUND STREQUAL "LCMS2_HEADER_FOUND-NOTFOUND")
|
||||||
|
SET(LCMS2_HEADER_FOUND "")
|
||||||
|
ENDIF()
|
||||||
|
IF(LCMS2_HEADER_FOUND)
|
||||||
|
FIND_PATH(LCMS_INCLUDE_DIR lcms2.h)
|
||||||
|
IF(UNIX OR CYGWIN)
|
||||||
|
FIND_LIBRARY(HAVE_LIBLCMS2 lcms2)
|
||||||
|
ELSE()
|
||||||
|
FIND_LIBRARY(HAVE_LIBLCMS2 lcms2_static.lib)
|
||||||
|
ENDIF()
|
||||||
|
IF(HAVE_LIBLCMS2 STREQUAL "HAVE_LIBLCMS2-NOTFOUND")
|
||||||
|
SET(HAVE_LIBLCMS2 "")
|
||||||
|
ENDIF()
|
||||||
|
IF(HAVE_LIBLCMS2)
|
||||||
|
SET(LCMS_LIB "${HAVE_LIBLCMS2}")
|
||||||
|
SET(HAVE_LCMS2_LIB 1)
|
||||||
|
SET(HAVE_LCMS2_H 1)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
IF(NOT LCMS2_HEADER_FOUND)
|
||||||
|
FIND_FILE(LCMS1_HEADER_FOUND lcms.h)
|
||||||
|
IF(LCMS1_HEADER_FOUND STREQUAL "LCMS1_HEADER_FOUND-NOTFOUND")
|
||||||
|
SET(LCMS1_HEADER_FOUND "")
|
||||||
|
ENDIF()
|
||||||
|
IF(LCMS1_HEADER_FOUND)
|
||||||
|
FIND_PATH(LCMS_INCLUDE_DIR lcms.h)
|
||||||
|
FIND_LIBRARY(HAVE_LIBLCMS1 lcms)
|
||||||
|
IF(HAVE_LIBLCMS1 STREQUAL "HAVE_LIBLCMS1-NOTFOUND")
|
||||||
|
SET(HAVE_LIBLCMS1 "")
|
||||||
|
ENDIF()
|
||||||
|
IF(HAVE_LIBLCMS1)
|
||||||
|
SET(LCMS_LIB "${HAVE_LIBLCMS1}")
|
||||||
|
SET(HAVE_LCMS1_LIB 1)
|
||||||
|
SET(HAVE_LCMS1_H 1)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
#
|
||||||
|
# generate opj_config.h
|
||||||
|
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_configh.cmake.in"
|
||||||
|
"${OPENJPEG_BINARY_DIR}/opj_config.h"
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
7
CTestConfig.cmake
Normal file
7
CTestConfig.cmake
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
set(CTEST_PROJECT_NAME "OPENJPEG")
|
||||||
|
set(CTEST_NIGHTLY_START_TIME "3:00:00 UTC")
|
||||||
|
|
||||||
|
set(CTEST_DROP_METHOD "http")
|
||||||
|
set(CTEST_DROP_SITE "my.cdash.org")
|
||||||
|
set(CTEST_DROP_LOCATION "/submit.php?project=OPENJPEG")
|
||||||
|
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||||
21
CTestCustom.cmake.in
Normal file
21
CTestCustom.cmake.in
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# For further details regarding this file,
|
||||||
|
# see http://www.vtk.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
||||||
|
#
|
||||||
|
|
||||||
|
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||||
|
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 50)
|
||||||
|
|
||||||
|
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||||
|
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||||
|
|
||||||
|
# Exclude files from the Testing directories
|
||||||
|
".*/Testing/.*"
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||||
|
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||||
|
|
||||||
|
# Suppress warning caused by intentional messages about deprecation
|
||||||
|
".*warning,.* is deprecated"
|
||||||
|
)
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# checkCtrlM checks source code for explicit ctrl-M's
|
|
||||||
# checks only files with the following extensions: .c, .cxx, .txx, .html, .htm
|
|
||||||
# exits with 0, if all commited files pass the test.
|
|
||||||
# exits with 1, if any one of the tests fails
|
|
||||||
#
|
|
||||||
# checkCtrlM can be run as a cvs commitinfo command.
|
|
||||||
# The following commitinfo line (without the #) will run the script
|
|
||||||
# ALL $CVSROOT/CVSROOT/checkCtrlM
|
|
||||||
#
|
|
||||||
failed=0
|
|
||||||
#
|
|
||||||
# skip the first arg, the directory
|
|
||||||
shift 1
|
|
||||||
|
|
||||||
for file in "$@"; do
|
|
||||||
#
|
|
||||||
# select files with extentions .txx, .cxx, .h, .html, .htm, .c, .txt, .cmake
|
|
||||||
match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]html\$\|\[\.\]htm\$\|\[\.\]c\$\|\[\.\]txt\$\|\[\.\]cmake\$`
|
|
||||||
if [ "x$match" != "x" ] ; then
|
|
||||||
count=`grep -n
|
|
||||||
\$ /dev/null $file|wc -c`
|
|
||||||
results=`expr $count \| 0`
|
|
||||||
if [ "$results" != "0" ]; then
|
|
||||||
echo "=========================================================="
|
|
||||||
if [ $results -lt 200 ]; then
|
|
||||||
grep -n
|
|
||||||
\$ /dev/null $file
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
echo "$file has ^M's. They must be removed before you can commit."
|
|
||||||
echo "The problem count was $results"
|
|
||||||
echo "=========================================================="
|
|
||||||
failed=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
exit $failed
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/bin/tcsh
|
|
||||||
#
|
|
||||||
# checkTabs checks source code for explicit TABS
|
|
||||||
# checks only files with the following extensions: .c, .cxx, .txx,
|
|
||||||
# exits with 0, if all commited files pass the test.
|
|
||||||
# exits with 1, if any one of the tests fails
|
|
||||||
#
|
|
||||||
# checkTabs can be run as a cvs commitinfo command.
|
|
||||||
# The following commitinfo line (without the #) will run the script
|
|
||||||
# ALL $CVSROOT/CVSROOT/checkTabs
|
|
||||||
#
|
|
||||||
set failed=0
|
|
||||||
#
|
|
||||||
# skip the first arg, the directory
|
|
||||||
foreach file ( $argv[2-] )
|
|
||||||
#
|
|
||||||
# select files with extentions .txx, .cxx, .h, .html, .htm
|
|
||||||
set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]cpp\$\|\[\.\]htm\$\|\[\.\]html\$\|\[\.\]c\$\|\[\.\]mm\$\|\[\.\]h.in\$\|\[\.\]hxx.in\$\|CMakeLists.txt\$\|\[\.\]cmake\$\|\[\.\]cmake.in\$`
|
|
||||||
if ( $match == "" ) continue;
|
|
||||||
set count=`grep -n " " /dev/null $file|wc -c`
|
|
||||||
set results=`expr $count \| 0`
|
|
||||||
if ( "$results" != "0" ) then
|
|
||||||
echo "=========================================================="
|
|
||||||
grep -n " " /dev/null $file
|
|
||||||
echo ""
|
|
||||||
echo "$file has explicit TABSs."
|
|
||||||
echo "They must be converted to SPACES(2 per TAB) before you can commit."
|
|
||||||
echo "=========================================================="
|
|
||||||
set failed=1
|
|
||||||
endif
|
|
||||||
end
|
|
||||||
exit $failed
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
# The "checkoutlist" file is used to support additional version controlled
|
|
||||||
# administrative files in $CVSROOT/CVSROOT, such as template files.
|
|
||||||
#
|
|
||||||
# The first entry on a line is a filename which will be checked out from
|
|
||||||
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
|
|
||||||
# The remainder of the line is an error message to use if the file cannot
|
|
||||||
# be checked out.
|
|
||||||
#
|
|
||||||
# File format:
|
|
||||||
#
|
|
||||||
# [<whitespace>]<filename><whitespace><error message><end-of-line>
|
|
||||||
#
|
|
||||||
# comment lines begin with '#'
|
|
||||||
checkCtrlM cannot check out checkCtrlM
|
|
||||||
checkTabs cannot check out checkTabs
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# The "commitinfo" file is used to control pre-commit checks.
|
|
||||||
# The filter on the right is invoked with the repository and a list
|
|
||||||
# of files to check. A non-zero exit of the filter program will
|
|
||||||
# cause the commit to be aborted.
|
|
||||||
#
|
|
||||||
# The first entry on a line is a regular expression which is tested
|
|
||||||
# against the directory that the change is being committed to, relative
|
|
||||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
|
||||||
# of the line is the name of the filter to run.
|
|
||||||
#
|
|
||||||
# If the repository name does not match any of the regular expressions in this
|
|
||||||
# file, the "DEFAULT" line is used, if it is specified.
|
|
||||||
#
|
|
||||||
# If the name "ALL" appears as a regular expression it is always used
|
|
||||||
# in addition to the first matching regex or "DEFAULT".
|
|
||||||
|
|
||||||
ALL $CVSROOT/CVSROOT/checkCtrlM %r/%p %s
|
|
||||||
# ALL $CVSROOT/CVSROOT/checkTabs %r/%p %s
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# Set this to "no" if pserver shouldn't check system users/passwords
|
|
||||||
#SystemAuth=no
|
|
||||||
|
|
||||||
# Put CVS lock files in this directory rather than directly in the repository.
|
|
||||||
#LockDir=/var/lock/cvs
|
|
||||||
|
|
||||||
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
|
|
||||||
# level of the new working directory when using the `cvs checkout'
|
|
||||||
# command.
|
|
||||||
#TopLevelAdmin=no
|
|
||||||
|
|
||||||
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
|
|
||||||
# history file, or a subset as needed (ie `TMAR' logs all write operations)
|
|
||||||
#LogHistory=TOFEWGCMAR
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# This file affects handling of files based on their names.
|
|
||||||
#
|
|
||||||
# The -t/-f options allow one to treat directories of files
|
|
||||||
# as a single file, or to transform a file in other ways on
|
|
||||||
# its way in and out of CVS.
|
|
||||||
#
|
|
||||||
# The -m option specifies whether CVS attempts to merge files.
|
|
||||||
#
|
|
||||||
# The -k option specifies keyword expansion (e.g. -kb for binary).
|
|
||||||
#
|
|
||||||
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
|
|
||||||
#
|
|
||||||
# wildcard [option value][option value]...
|
|
||||||
#
|
|
||||||
# where option is one of
|
|
||||||
# -f from cvs filter value: path to filter
|
|
||||||
# -t to cvs filter value: path to filter
|
|
||||||
# -m update methodology value: MERGE or COPY
|
|
||||||
# -k expansion mode value: b, o, kkv, &c
|
|
||||||
#
|
|
||||||
# and value is a single-quote delimited value.
|
|
||||||
# For example:
|
|
||||||
#*.gif -k 'b'
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# The "editinfo" file is used to allow verification of logging
|
|
||||||
# information. It works best when a template (as specified in the
|
|
||||||
# rcsinfo file) is provided for the logging procedure. Given a
|
|
||||||
# template with locations for, a bug-id number, a list of people who
|
|
||||||
# reviewed the code before it can be checked in, and an external
|
|
||||||
# process to catalog the differences that were code reviewed, the
|
|
||||||
# following test can be applied to the code:
|
|
||||||
#
|
|
||||||
# Making sure that the entered bug-id number is correct.
|
|
||||||
# Validating that the code that was reviewed is indeed the code being
|
|
||||||
# checked in (using the bug-id number or a seperate review
|
|
||||||
# number to identify this particular code set.).
|
|
||||||
#
|
|
||||||
# If any of the above test failed, then the commit would be aborted.
|
|
||||||
#
|
|
||||||
# Actions such as mailing a copy of the report to each reviewer are
|
|
||||||
# better handled by an entry in the loginfo file.
|
|
||||||
#
|
|
||||||
# One thing that should be noted is the the ALL keyword is not
|
|
||||||
# supported. There can be only one entry that matches a given
|
|
||||||
# repository.
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
# The "loginfo" file controls where "cvs commit" log information
|
|
||||||
# is sent. The first entry on a line is a regular expression which must match
|
|
||||||
# the directory that the change is being made to, relative to the
|
|
||||||
# $CVSROOT. If a match is found, then the remainder of the line is a filter
|
|
||||||
# program that should expect log information on its standard input.
|
|
||||||
#
|
|
||||||
# If the repository name does not match any of the regular expressions in this
|
|
||||||
# file, the "DEFAULT" line is used, if it is specified.
|
|
||||||
#
|
|
||||||
# If the name ALL appears as a regular expression it is always used
|
|
||||||
# in addition to the first matching regex or DEFAULT.
|
|
||||||
#
|
|
||||||
# You may specify a format string as part of the
|
|
||||||
# filter. The string is composed of a `%' followed
|
|
||||||
# by a single format character, or followed by a set of format
|
|
||||||
# characters surrounded by `{' and `}' as separators. The format
|
|
||||||
# characters are:
|
|
||||||
#
|
|
||||||
# s = file name
|
|
||||||
# V = old version number (pre-checkin)
|
|
||||||
# v = new version number (post-checkin)
|
|
||||||
#
|
|
||||||
# For example:
|
|
||||||
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
|
||||||
# or
|
|
||||||
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
# Three different line formats are valid:
|
|
||||||
# key -a aliases...
|
|
||||||
# key [options] directory
|
|
||||||
# key [options] directory files...
|
|
||||||
#
|
|
||||||
# Where "options" are composed of:
|
|
||||||
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
|
||||||
# -o prog Run "prog" on "cvs checkout" of module.
|
|
||||||
# -e prog Run "prog" on "cvs export" of module.
|
|
||||||
# -t prog Run "prog" on "cvs rtag" of module.
|
|
||||||
# -u prog Run "prog" on "cvs update" of module.
|
|
||||||
# -d dir Place module in directory "dir" instead of module name.
|
|
||||||
# -l Top-level directory only -- do not recurse.
|
|
||||||
#
|
|
||||||
# NOTE: If you change any of the "Run" options above, you'll have to
|
|
||||||
# release and re-checkout any working directories of these modules.
|
|
||||||
#
|
|
||||||
# And "directory" is a path to a directory relative to $CVSROOT.
|
|
||||||
#
|
|
||||||
# The "-a" option specifies an alias. An alias is interpreted as if
|
|
||||||
# everything on the right of the "-a" had been typed on the command line.
|
|
||||||
#
|
|
||||||
# You can encode a module within a module by using the special '&'
|
|
||||||
# character to interpose another module into the current module. This
|
|
||||||
# can be useful for creating a module that consists of many directories
|
|
||||||
# spread out over the entire source repository.
|
|
||||||
|
|
||||||
opj-base -l -d . .
|
|
||||||
openjpeg -a opj-base libopenjpeg codec doc
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# The "notify" file controls where notifications from watches set by
|
|
||||||
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
|
|
||||||
# a regular expression which is tested against the directory that the
|
|
||||||
# change is being made to, relative to the $CVSROOT. If it matches,
|
|
||||||
# then the remainder of the line is a filter program that should contain
|
|
||||||
# one occurrence of %s for the user to notify, and information on its
|
|
||||||
# standard input.
|
|
||||||
#
|
|
||||||
# "ALL" or "DEFAULT" can be used in place of the regular expression.
|
|
||||||
#
|
|
||||||
# For example:
|
|
||||||
#ALL mail %s -s "CVS notification"
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# The "rcsinfo" file is used to control templates with which the editor
|
|
||||||
# is invoked on commit and import.
|
|
||||||
#
|
|
||||||
# The first entry on a line is a regular expression which is tested
|
|
||||||
# against the directory that the change is being made to, relative to the
|
|
||||||
# $CVSROOT. For the first match that is found, then the remainder of the
|
|
||||||
# line is the name of the file that contains the template.
|
|
||||||
#
|
|
||||||
# If the repository name does not match any of the regular expressions in this
|
|
||||||
# file, the "DEFAULT" line is used, if it is specified.
|
|
||||||
#
|
|
||||||
# If the name "ALL" appears as a regular expression it is always used
|
|
||||||
# in addition to the first matching regex or "DEFAULT".
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# The "taginfo" file is used to control pre-tag checks.
|
|
||||||
# The filter on the right is invoked with the following arguments:
|
|
||||||
#
|
|
||||||
# $1 -- tagname
|
|
||||||
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
|
|
||||||
# $3 -- repository
|
|
||||||
# $4-> file revision [file revision ...]
|
|
||||||
#
|
|
||||||
# A non-zero exit of the filter program will cause the tag to be aborted.
|
|
||||||
#
|
|
||||||
# The first entry on a line is a regular expression which is tested
|
|
||||||
# against the directory that the change is being committed to, relative
|
|
||||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
|
||||||
# of the line is the name of the filter to run.
|
|
||||||
#
|
|
||||||
# If the repository name does not match any of the regular expressions in this
|
|
||||||
# file, the "DEFAULT" line is used, if it is specified.
|
|
||||||
#
|
|
||||||
# If the name "ALL" appears as a regular expression it is always used
|
|
||||||
# in addition to the first matching regex or "DEFAULT".
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# The "verifymsg" file is used to allow verification of logging
|
|
||||||
# information. It works best when a template (as specified in the
|
|
||||||
# rcsinfo file) is provided for the logging procedure. Given a
|
|
||||||
# template with locations for, a bug-id number, a list of people who
|
|
||||||
# reviewed the code before it can be checked in, and an external
|
|
||||||
# process to catalog the differences that were code reviewed, the
|
|
||||||
# following test can be applied to the code:
|
|
||||||
#
|
|
||||||
# Making sure that the entered bug-id number is correct.
|
|
||||||
# Validating that the code that was reviewed is indeed the code being
|
|
||||||
# checked in (using the bug-id number or a seperate review
|
|
||||||
# number to identify this particular code set.).
|
|
||||||
#
|
|
||||||
# If any of the above test failed, then the commit would be aborted.
|
|
||||||
#
|
|
||||||
# Actions such as mailing a copy of the report to each reviewer are
|
|
||||||
# better handled by an entry in the loginfo file.
|
|
||||||
#
|
|
||||||
# One thing that should be noted is the the ALL keyword is not
|
|
||||||
# supported. There can be only one entry that matches a given
|
|
||||||
# repository.
|
|
||||||
105
INSTALL
Normal file
105
INSTALL
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
|
||||||
|
How to build and install openjpeg binaries
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
UNIX/LINUX similar systems
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
1) Using configure tools
|
||||||
|
|
||||||
|
You can simply type
|
||||||
|
./configure [--prefix=/path]
|
||||||
|
make
|
||||||
|
|
||||||
|
If you are root:
|
||||||
|
make install
|
||||||
|
make clean
|
||||||
|
make distclean
|
||||||
|
|
||||||
|
else:
|
||||||
|
sudo make install
|
||||||
|
make clean
|
||||||
|
make distclean
|
||||||
|
|
||||||
|
Binaries are located in the 'bin' directory.
|
||||||
|
|
||||||
|
If 'configure' does not work on your system please
|
||||||
|
call './bootstrap.sh'.
|
||||||
|
|
||||||
|
If 'configure' does not find a library or header file,
|
||||||
|
or to see available configure options, please try
|
||||||
|
'./configure --help'.
|
||||||
|
|
||||||
|
Note: if Doxygen is found on your system, a target 'docs'
|
||||||
|
will automatically be created in 'doc/Makefile'. To build
|
||||||
|
the documentation (it will create an 'html' directory):
|
||||||
|
cd doc
|
||||||
|
make docs
|
||||||
|
|
||||||
|
2) Using cmake (see www.cmake.org)
|
||||||
|
|
||||||
|
Type:
|
||||||
|
cmake .
|
||||||
|
make
|
||||||
|
|
||||||
|
If you are root:
|
||||||
|
make install
|
||||||
|
make clean
|
||||||
|
|
||||||
|
else:
|
||||||
|
sudo make install
|
||||||
|
make clean
|
||||||
|
|
||||||
|
Binaries are located in the 'bin' directory.
|
||||||
|
|
||||||
|
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')
|
||||||
|
* 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 JP3D executables and JP3D library: '-DBUILD_JP3D:bool=on' (default: 'OFF')
|
||||||
|
* [WIN32 ONLY] To build the INDEXER_JPIP executable: '-DBUILD_INDEXER_JPIP:bool=on' (default: 'OFF')
|
||||||
|
* To build the doxygen documentation: '-DBUILD_DOC: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 -DJPEG2000_CONFORMANCE_DATA_ROOT:PATH=/path/to/your/JPEG2000/test/files
|
||||||
|
make
|
||||||
|
make Experimental
|
||||||
|
Note : JPEG2000 test files are available here : http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
||||||
|
|
||||||
|
3) Manually using Makefile.nix:
|
||||||
|
- Manually edit the config.nix file
|
||||||
|
- Manually create an opj_config.h file from opj_config.h.in.user
|
||||||
|
and edit this opj_config.h
|
||||||
|
- Then : (if 'WITH_JPWL' and/or 'WITH_JP3D' are defined in config.nix)
|
||||||
|
make -f Makefile.nix all
|
||||||
|
make -f Makefile.nix install
|
||||||
|
make -f Makefile.nix clean
|
||||||
|
make -f Makefile.nix uninstall
|
||||||
|
- If neither 'WITH_JPWL' nor 'WITH_JP3D' is defined in config.nix
|
||||||
|
and you want to clean/compile/install/uninstall JPWL/JP3D:
|
||||||
|
call the respective target in the respective directory.
|
||||||
|
|
||||||
|
MACOSX
|
||||||
|
------
|
||||||
|
|
||||||
|
The same building procedures as above will soon be available for MACOSX.
|
||||||
|
The xcode project file has also to be updated.
|
||||||
|
Right now, the CMake procedure is the only one working. Please refer to instructions above.
|
||||||
|
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, the same procedures as for Unix should work. Otherwise:
|
||||||
|
|
||||||
|
1) Using cmake to generate project files
|
||||||
|
|
||||||
|
Use the cmake procedure above with the '-G <generator-name>' flag to generate the project
|
||||||
|
files for the IDE you are using. Type 'cmake --help' for available generators on your platform.
|
||||||
|
|
||||||
|
2) Using the provided project files
|
||||||
|
|
||||||
|
These files are obsolete and will be updated soon.
|
||||||
@@ -1,26 +1,16 @@
|
|||||||
# Build the demo app, small examples
|
#JavaOpenJPEG/CMakeLists.txt
|
||||||
|
|
||||||
# First thing define the common source:
|
# First thing define the common source:
|
||||||
SET(common_SRCS
|
SET(common_SRCS
|
||||||
convert.c
|
../codec/convert.c
|
||||||
|
../codec/index.c
|
||||||
)
|
)
|
||||||
# Then check if getopt is present:
|
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
|
||||||
SET(DONT_HAVE_GETOPT 1)
|
|
||||||
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
|
||||||
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
|
||||||
# Seems like we need the contrary:
|
|
||||||
IF(CMAKE_HAVE_GETOPT_H)
|
|
||||||
SET(DONT_HAVE_GETOPT 0)
|
|
||||||
ENDIF(CMAKE_HAVE_GETOPT_H)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
# If not getopt was found then add it to the lib:
|
# If not getopt was found then add it to the lib:
|
||||||
IF(DONT_HAVE_GETOPT)
|
IF(DONT_HAVE_GETOPT)
|
||||||
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
|
||||||
SET(common_SRCS
|
SET(common_SRCS
|
||||||
${common_SRCS}
|
${common_SRCS}
|
||||||
compat/getopt.c
|
../common/getopt.c
|
||||||
)
|
)
|
||||||
ENDIF(DONT_HAVE_GETOPT)
|
ENDIF(DONT_HAVE_GETOPT)
|
||||||
|
|
||||||
@@ -28,20 +18,17 @@ ENDIF(DONT_HAVE_GETOPT)
|
|||||||
# Headers file are located here:
|
# Headers file are located here:
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||||
|
${LCMS_INCLUDE_DIR}
|
||||||
|
${PNG_INCLUDE_DIR}
|
||||||
|
${ZLIB_INCLUDE_DIR}
|
||||||
|
${TIFF_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Do the proper thing when building static...if only there was configured
|
|
||||||
# headers or def files instead
|
|
||||||
IF(NOT BUILD_SHARED_LIBS)
|
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
|
||||||
ENDIF(NOT BUILD_SHARED_LIBS)
|
|
||||||
|
|
||||||
FIND_PACKAGE(TIFF REQUIRED)
|
|
||||||
|
|
||||||
# Loop over all executables:
|
# Loop over all executables:
|
||||||
FOREACH(exe j2k_to_image image_to_j2k)
|
FOREACH(exe j2k_to_image image_to_j2k)
|
||||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||||
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES})
|
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES}
|
||||||
|
${PNG_LIBRARIES} ${ZLIB_LIBRARY} ${LCMS_LIB})
|
||||||
# On unix you need to link to the math library:
|
# On unix you need to link to the math library:
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(${exe} -lm)
|
TARGET_LINK_LIBRARIES(${exe} -lm)
|
||||||
|
|||||||
@@ -37,32 +37,19 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "compat/getopt.h"
|
#include "getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#include "org_openJpeg_OpenJPEGJavaEncoder.h"
|
#include "org_openJpeg_OpenJPEGJavaEncoder.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#define strnicmp strncasecmp
|
#define strnicmp strncasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
#include "format_defs.h"
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
|
|
||||||
#define PXM_DFMT 10
|
|
||||||
#define PGX_DFMT 11
|
|
||||||
#define BMP_DFMT 12
|
|
||||||
#define YUV_DFMT 13
|
|
||||||
#define TIF_DFMT 14
|
|
||||||
#define RAW_DFMT 15
|
|
||||||
#define TGA_DFMT 16
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
|
||||||
#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/
|
#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/
|
||||||
#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/
|
#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/
|
||||||
#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/
|
#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
EnableIntrinsicFunctions="TRUE"
|
EnableIntrinsicFunctions="TRUE"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
OptimizeForWindowsApplication="TRUE"
|
OptimizeForWindowsApplication="TRUE"
|
||||||
AdditionalIncludeDirectories="C:\users\pp\telemis\working\projects\codecs\OpenJPEG2000\codec;../libopenjpeg;"../../../../3rdparty/windows/java-jni/include";"../../../../3rdparty/windows/java-jni/include/win32""
|
AdditionalIncludeDirectories="../codec;../codec/compat;../libopenjpeg;".\java-jni\include";".\java-jni\include\win32""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPJ_STATIC;CHECK_THRESHOLDS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPJ_STATIC;CHECK_THRESHOLDS"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
|||||||
@@ -37,31 +37,17 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "compat/getopt.h"
|
#include "getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
|
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef _WIN32
|
||||||
#define stricmp strcasecmp
|
#define stricmp strcasecmp
|
||||||
#define strnicmp strncasecmp
|
#define strnicmp strncasecmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
#include "format_defs.h"
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
|
|
||||||
#define PXM_DFMT 10
|
|
||||||
#define PGX_DFMT 11
|
|
||||||
#define BMP_DFMT 12
|
|
||||||
#define YUV_DFMT 13
|
|
||||||
#define TIF_DFMT 14
|
|
||||||
#define RAW_DFMT 15
|
|
||||||
#define TGA_DFMT 16
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
typedef struct callback_variables {
|
typedef struct callback_variables {
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
@@ -782,13 +768,13 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
ptr2 = image->comps[2].data;
|
ptr2 = image->comps[2].data;
|
||||||
#ifdef CHECK_THRESHOLDS
|
#ifdef CHECK_THRESHOLDS
|
||||||
if (image->comps[0].sgnd) {
|
if (image->comps[0].sgnd) {
|
||||||
min_value = 0;
|
|
||||||
max_value = 255;
|
|
||||||
} else {
|
|
||||||
min_value = -128;
|
min_value = -128;
|
||||||
max_value = 127;
|
max_value = 127;
|
||||||
|
} else {
|
||||||
|
min_value = 0;
|
||||||
|
max_value = 255;
|
||||||
}
|
}
|
||||||
#endif
|
#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");
|
fid = (*env)->GetFieldID(env, cls,"image24", "[I");
|
||||||
jia = (*env)->GetObjectField(env, obj, fid);
|
jia = (*env)->GetObjectField(env, obj, fid);
|
||||||
@@ -828,13 +814,13 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
ptrBBody = jbBody;
|
ptrBBody = jbBody;
|
||||||
#ifdef CHECK_THRESHOLDS
|
#ifdef CHECK_THRESHOLDS
|
||||||
if (image->comps[0].sgnd) {
|
if (image->comps[0].sgnd) {
|
||||||
min_value = 0;
|
|
||||||
max_value = 255;
|
|
||||||
} else {
|
|
||||||
min_value = -128;
|
min_value = -128;
|
||||||
max_value = 127;
|
max_value = 127;
|
||||||
|
} else {
|
||||||
|
min_value = 0;
|
||||||
|
max_value = 255;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//printf("C: transfering %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++) {
|
for (i=0; i<w*h; i++) {
|
||||||
tempUC = (unsigned char) (ptr[i]);
|
tempUC = (unsigned char) (ptr[i]);
|
||||||
@@ -855,11 +841,11 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
ptrSBody = jsBody;
|
ptrSBody = jsBody;
|
||||||
#ifdef CHECK_THRESHOLDS
|
#ifdef CHECK_THRESHOLDS
|
||||||
if (image->comps[0].sgnd) {
|
if (image->comps[0].sgnd) {
|
||||||
min_value = 0;
|
|
||||||
max_value = 65535;
|
|
||||||
} else {
|
|
||||||
min_value = -32768;
|
min_value = -32768;
|
||||||
max_value = 32767;
|
max_value = 32767;
|
||||||
|
} else {
|
||||||
|
min_value = 0;
|
||||||
|
max_value = 65535;
|
||||||
}
|
}
|
||||||
printf("C: minValue = %d, maxValue = %d\n", min_value, max_value);
|
printf("C: minValue = %d, maxValue = %d\n", min_value, max_value);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ CFLAGS = -O3 -lstdc++ # -g -p -pg
|
|||||||
all: j2k_to_image image_to_j2k
|
all: j2k_to_image image_to_j2k
|
||||||
|
|
||||||
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
||||||
gcc $(CFLAGS) compat/getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
gcc $(CFLAGS) ../common/getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
|
||||||
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
||||||
gcc $(CFLAGS) compat/getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
gcc $(CFLAGS) ../common/getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f j2k_to_image image_to_j2k
|
rm -f j2k_to_image image_to_j2k
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: $
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
*
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
* Copyright (c) 1999-2007 Telemis SA. All Rights Reserved
|
* Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a.
|
||||||
|
* All rights reserved.
|
||||||
* Author: Patrick Piscaglia, Telemis s.a.
|
*
|
||||||
*/
|
* 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.
|
||||||
|
*/
|
||||||
package org.openJpeg;
|
package org.openJpeg;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|||||||
@@ -1,10 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: $
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
*
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
* Copyright (c) 1999-2007 Telemis SA. All Rights Reserved
|
* Copyright (c) 2002-2007, Patrick Piscaglia, Telemis s.a.
|
||||||
*
|
* All rights reserved.
|
||||||
* Author: Patrick Piscaglia, Telemis s.a.
|
*
|
||||||
*/
|
* 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.
|
||||||
|
*/
|
||||||
package org.openJpeg;
|
package org.openJpeg;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|||||||
278
JavaOpenJPEG/java-jni/include/jawt.h
Normal file
278
JavaOpenJPEG/java-jni/include/jawt.h
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
/*
|
||||||
|
* @(#)jawt.h 1.10 03/12/19
|
||||||
|
*
|
||||||
|
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JAWT_H_
|
||||||
|
#define _JAVASOFT_JAWT_H_
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AWT native interface (new in JDK 1.3)
|
||||||
|
*
|
||||||
|
* The AWT native interface allows a native C or C++ application a means
|
||||||
|
* by which to access native structures in AWT. This is to facilitate moving
|
||||||
|
* legacy C and C++ applications to Java and to target the needs of the
|
||||||
|
* community who, at present, wish to do their own native rendering to canvases
|
||||||
|
* for performance reasons. Standard extensions such as Java3D also require a
|
||||||
|
* means to access the underlying native data structures of AWT.
|
||||||
|
*
|
||||||
|
* There may be future extensions to this API depending on demand.
|
||||||
|
*
|
||||||
|
* A VM does not have to implement this API in order to pass the JCK.
|
||||||
|
* It is recommended, however, that this API is implemented on VMs that support
|
||||||
|
* standard extensions, such as Java3D.
|
||||||
|
*
|
||||||
|
* Since this is a native API, any program which uses it cannot be considered
|
||||||
|
* 100% pure java.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AWT Native Drawing Surface (JAWT_DrawingSurface).
|
||||||
|
*
|
||||||
|
* For each platform, there is a native drawing surface structure. This
|
||||||
|
* platform-specific structure can be found in jawt_md.h. It is recommended
|
||||||
|
* that additional platforms follow the same model. It is also recommended
|
||||||
|
* that VMs on Win32 and Solaris support the existing structures in jawt_md.h.
|
||||||
|
*
|
||||||
|
*******************
|
||||||
|
* EXAMPLE OF USAGE:
|
||||||
|
*******************
|
||||||
|
*
|
||||||
|
* In Win32, a programmer wishes to access the HWND of a canvas to perform
|
||||||
|
* native rendering into it. The programmer has declared the paint() method
|
||||||
|
* for their canvas subclass to be native:
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* MyCanvas.java:
|
||||||
|
*
|
||||||
|
* import java.awt.*;
|
||||||
|
*
|
||||||
|
* public class MyCanvas extends Canvas {
|
||||||
|
*
|
||||||
|
* static {
|
||||||
|
* System.loadLibrary("mylib");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public native void paint(Graphics g);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* myfile.c:
|
||||||
|
*
|
||||||
|
* #include "jawt_md.h"
|
||||||
|
* #include <assert.h>
|
||||||
|
*
|
||||||
|
* JNIEXPORT void JNICALL
|
||||||
|
* Java_MyCanvas_paint(JNIEnv* env, jobject canvas, jobject graphics)
|
||||||
|
* {
|
||||||
|
* JAWT awt;
|
||||||
|
* JAWT_DrawingSurface* ds;
|
||||||
|
* JAWT_DrawingSurfaceInfo* dsi;
|
||||||
|
* JAWT_Win32DrawingSurfaceInfo* dsi_win;
|
||||||
|
* jboolean result;
|
||||||
|
* jint lock;
|
||||||
|
*
|
||||||
|
* // Get the AWT
|
||||||
|
* awt.version = JAWT_VERSION_1_3;
|
||||||
|
* result = JAWT_GetAWT(env, &awt);
|
||||||
|
* assert(result != JNI_FALSE);
|
||||||
|
*
|
||||||
|
* // Get the drawing surface
|
||||||
|
* ds = awt.GetDrawingSurface(env, canvas);
|
||||||
|
* assert(ds != NULL);
|
||||||
|
*
|
||||||
|
* // Lock the drawing surface
|
||||||
|
* lock = ds->Lock(ds);
|
||||||
|
* assert((lock & JAWT_LOCK_ERROR) == 0);
|
||||||
|
*
|
||||||
|
* // Get the drawing surface info
|
||||||
|
* dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||||
|
*
|
||||||
|
* // Get the platform-specific drawing info
|
||||||
|
* dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;
|
||||||
|
*
|
||||||
|
* //////////////////////////////
|
||||||
|
* // !!! DO PAINTING HERE !!! //
|
||||||
|
* //////////////////////////////
|
||||||
|
*
|
||||||
|
* // Free the drawing surface info
|
||||||
|
* ds->FreeDrawingSurfaceInfo(dsi);
|
||||||
|
*
|
||||||
|
* // Unlock the drawing surface
|
||||||
|
* ds->Unlock(ds);
|
||||||
|
*
|
||||||
|
* // Free the drawing surface
|
||||||
|
* awt.FreeDrawingSurface(ds);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_Rectangle
|
||||||
|
* Structure for a native rectangle.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_Rectangle {
|
||||||
|
jint x;
|
||||||
|
jint y;
|
||||||
|
jint width;
|
||||||
|
jint height;
|
||||||
|
} JAWT_Rectangle;
|
||||||
|
|
||||||
|
struct jawt_DrawingSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_DrawingSurfaceInfo
|
||||||
|
* Structure for containing the underlying drawing information of a component.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_DrawingSurfaceInfo {
|
||||||
|
/*
|
||||||
|
* Pointer to the platform-specific information. This can be safely
|
||||||
|
* cast to a JAWT_Win32DrawingSurfaceInfo on Windows or a
|
||||||
|
* JAWT_X11DrawingSurfaceInfo on Solaris. See jawt_md.h for details.
|
||||||
|
*/
|
||||||
|
void* platformInfo;
|
||||||
|
/* Cached pointer to the underlying drawing surface */
|
||||||
|
struct jawt_DrawingSurface* ds;
|
||||||
|
/* Bounding rectangle of the drawing surface */
|
||||||
|
JAWT_Rectangle bounds;
|
||||||
|
/* Number of rectangles in the clip */
|
||||||
|
jint clipSize;
|
||||||
|
/* Clip rectangle array */
|
||||||
|
JAWT_Rectangle* clip;
|
||||||
|
} JAWT_DrawingSurfaceInfo;
|
||||||
|
|
||||||
|
#define JAWT_LOCK_ERROR 0x00000001
|
||||||
|
#define JAWT_LOCK_CLIP_CHANGED 0x00000002
|
||||||
|
#define JAWT_LOCK_BOUNDS_CHANGED 0x00000004
|
||||||
|
#define JAWT_LOCK_SURFACE_CHANGED 0x00000008
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT_DrawingSurface
|
||||||
|
* Structure for containing the underlying drawing information of a component.
|
||||||
|
* All operations on a JAWT_DrawingSurface MUST be performed from the same
|
||||||
|
* thread as the call to GetDrawingSurface.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_DrawingSurface {
|
||||||
|
/*
|
||||||
|
* Cached reference to the Java environment of the calling thread.
|
||||||
|
* If Lock(), Unlock(), GetDrawingSurfaceInfo() or
|
||||||
|
* FreeDrawingSurfaceInfo() are called from a different thread,
|
||||||
|
* this data member should be set before calling those functions.
|
||||||
|
*/
|
||||||
|
JNIEnv* env;
|
||||||
|
/* Cached reference to the target object */
|
||||||
|
jobject target;
|
||||||
|
/*
|
||||||
|
* Lock the surface of the target component for native rendering.
|
||||||
|
* When finished drawing, the surface must be unlocked with
|
||||||
|
* Unlock(). This function returns a bitmask with one or more of the
|
||||||
|
* following values:
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_ERROR - When an error has occurred and the surface could not
|
||||||
|
* be locked.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_CLIP_CHANGED - When the clip region has changed.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_BOUNDS_CHANGED - When the bounds of the surface have changed.
|
||||||
|
*
|
||||||
|
* JAWT_LOCK_SURFACE_CHANGED - When the surface itself has changed
|
||||||
|
*/
|
||||||
|
jint (JNICALL *Lock)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Get the drawing surface info.
|
||||||
|
* The value returned may be cached, but the values may change if
|
||||||
|
* additional calls to Lock() or Unlock() are made.
|
||||||
|
* Lock() must be called before this can return a valid value.
|
||||||
|
* Returns NULL if an error has occurred.
|
||||||
|
* When finished with the returned value, FreeDrawingSurfaceInfo must be
|
||||||
|
* called.
|
||||||
|
*/
|
||||||
|
JAWT_DrawingSurfaceInfo* (JNICALL *GetDrawingSurfaceInfo)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Free the drawing surface info.
|
||||||
|
*/
|
||||||
|
void (JNICALL *FreeDrawingSurfaceInfo)
|
||||||
|
(JAWT_DrawingSurfaceInfo* dsi);
|
||||||
|
/*
|
||||||
|
* Unlock the drawing surface of the target component for native rendering.
|
||||||
|
*/
|
||||||
|
void (JNICALL *Unlock)
|
||||||
|
(struct jawt_DrawingSurface* ds);
|
||||||
|
} JAWT_DrawingSurface;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JAWT
|
||||||
|
* Structure for containing native AWT functions.
|
||||||
|
*/
|
||||||
|
typedef struct jawt {
|
||||||
|
/*
|
||||||
|
* Version of this structure. This must always be set before
|
||||||
|
* calling JAWT_GetAWT()
|
||||||
|
*/
|
||||||
|
jint version;
|
||||||
|
/*
|
||||||
|
* Return a drawing surface from a target jobject. This value
|
||||||
|
* may be cached.
|
||||||
|
* Returns NULL if an error has occurred.
|
||||||
|
* Target must be a java.awt.Component (should be a Canvas
|
||||||
|
* or Window for native rendering).
|
||||||
|
* FreeDrawingSurface() must be called when finished with the
|
||||||
|
* returned JAWT_DrawingSurface.
|
||||||
|
*/
|
||||||
|
JAWT_DrawingSurface* (JNICALL *GetDrawingSurface)
|
||||||
|
(JNIEnv* env, jobject target);
|
||||||
|
/*
|
||||||
|
* Free the drawing surface allocated in GetDrawingSurface.
|
||||||
|
*/
|
||||||
|
void (JNICALL *FreeDrawingSurface)
|
||||||
|
(JAWT_DrawingSurface* ds);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Locks the entire AWT for synchronization purposes
|
||||||
|
*/
|
||||||
|
void (JNICALL *Lock)(JNIEnv* env);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Unlocks the entire AWT for synchronization purposes
|
||||||
|
*/
|
||||||
|
void (JNICALL *Unlock)(JNIEnv* env);
|
||||||
|
/*
|
||||||
|
* Since 1.4
|
||||||
|
* Returns a reference to a java.awt.Component from a native
|
||||||
|
* platform handle. On Windows, this corresponds to an HWND;
|
||||||
|
* on Solaris and Linux, this is a Drawable. For other platforms,
|
||||||
|
* see the appropriate machine-dependent header file for a description.
|
||||||
|
* The reference returned by this function is a local
|
||||||
|
* reference that is only valid in this environment.
|
||||||
|
* This function returns a NULL reference if no component could be
|
||||||
|
* found with matching platform information.
|
||||||
|
*/
|
||||||
|
jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo);
|
||||||
|
|
||||||
|
} JAWT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the AWT native structure. This function returns JNI_FALSE if
|
||||||
|
* an error occurs.
|
||||||
|
*/
|
||||||
|
_JNI_IMPORT_OR_EXPORT_
|
||||||
|
jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt);
|
||||||
|
|
||||||
|
#define JAWT_VERSION_1_3 0x00010003
|
||||||
|
#define JAWT_VERSION_1_4 0x00010004
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JAWT_H_ */
|
||||||
237
JavaOpenJPEG/java-jni/include/jdwpTransport.h
Normal file
237
JavaOpenJPEG/java-jni/include/jdwpTransport.h
Normal file
@@ -0,0 +1,237 @@
|
|||||||
|
/*
|
||||||
|
* @(#)jdwpTransport.h 1.7 03/12/19
|
||||||
|
*
|
||||||
|
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Java Debug Wire Protocol Transport Service Provider Interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef JDWPTRANSPORT_H
|
||||||
|
#define JDWPTRANSPORT_H
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JDWPTRANSPORT_VERSION_1_0 = 0x00010000
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct jdwpTransportNativeInterface_;
|
||||||
|
|
||||||
|
struct _jdwpTransportEnv;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
typedef _jdwpTransportEnv jdwpTransportEnv;
|
||||||
|
#else
|
||||||
|
typedef const struct jdwpTransportNativeInterface_ *jdwpTransportEnv;
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Errors. Universal errors with JVMTI/JVMDI equivalents keep the
|
||||||
|
* values the same.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
JDWPTRANSPORT_ERROR_NONE = 0,
|
||||||
|
JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT = 103,
|
||||||
|
JDWPTRANSPORT_ERROR_OUT_OF_MEMORY = 110,
|
||||||
|
JDWPTRANSPORT_ERROR_INTERNAL = 113,
|
||||||
|
JDWPTRANSPORT_ERROR_ILLEGAL_STATE = 201,
|
||||||
|
JDWPTRANSPORT_ERROR_IO_ERROR = 202,
|
||||||
|
JDWPTRANSPORT_ERROR_TIMEOUT = 203,
|
||||||
|
JDWPTRANSPORT_ERROR_MSG_NOT_AVAILABLE = 204
|
||||||
|
} jdwpTransportError;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure to define capabilities
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
unsigned int can_timeout_attach :1;
|
||||||
|
unsigned int can_timeout_accept :1;
|
||||||
|
unsigned int can_timeout_handshake :1;
|
||||||
|
unsigned int reserved3 :1;
|
||||||
|
unsigned int reserved4 :1;
|
||||||
|
unsigned int reserved5 :1;
|
||||||
|
unsigned int reserved6 :1;
|
||||||
|
unsigned int reserved7 :1;
|
||||||
|
unsigned int reserved8 :1;
|
||||||
|
unsigned int reserved9 :1;
|
||||||
|
unsigned int reserved10 :1;
|
||||||
|
unsigned int reserved11 :1;
|
||||||
|
unsigned int reserved12 :1;
|
||||||
|
unsigned int reserved13 :1;
|
||||||
|
unsigned int reserved14 :1;
|
||||||
|
unsigned int reserved15 :1;
|
||||||
|
} JDWPTransportCapabilities;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structures to define packet layout.
|
||||||
|
*
|
||||||
|
* See: http://java.sun.com/j2se/1.5/docs/guide/jpda/jdwp-spec.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
JDWPTRANSPORT_FLAGS_NONE = 0x0,
|
||||||
|
JDWPTRANSPORT_FLAGS_REPLY = 0x80
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
jint len;
|
||||||
|
jint id;
|
||||||
|
jbyte flags;
|
||||||
|
jbyte cmdSet;
|
||||||
|
jbyte cmd;
|
||||||
|
jbyte *data;
|
||||||
|
} jdwpCmdPacket;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
jint len;
|
||||||
|
jint id;
|
||||||
|
jbyte flags;
|
||||||
|
jshort errorCode;
|
||||||
|
jbyte *data;
|
||||||
|
} jdwpReplyPacket;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
jdwpCmdPacket cmd;
|
||||||
|
jdwpReplyPacket reply;
|
||||||
|
} type;
|
||||||
|
} jdwpPacket;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* JDWP functions called by the transport.
|
||||||
|
*/
|
||||||
|
typedef struct jdwpTransportCallback {
|
||||||
|
void *(*alloc)(jint numBytes); /* Call this for all allocations */
|
||||||
|
void (*free)(void *buffer); /* Call this for all deallocations */
|
||||||
|
} jdwpTransportCallback;
|
||||||
|
|
||||||
|
typedef jint (JNICALL *jdwpTransport_OnLoad_t)(JavaVM *jvm,
|
||||||
|
jdwpTransportCallback *callback,
|
||||||
|
jint version,
|
||||||
|
jdwpTransportEnv** env);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Function Interface */
|
||||||
|
|
||||||
|
struct jdwpTransportNativeInterface_ {
|
||||||
|
/* 1 : RESERVED */
|
||||||
|
void *reserved1;
|
||||||
|
|
||||||
|
/* 2 : Get Capabilities */
|
||||||
|
jdwpTransportError (JNICALL *GetCapabilities)(jdwpTransportEnv* env,
|
||||||
|
JDWPTransportCapabilities *capabilities_ptr);
|
||||||
|
|
||||||
|
/* 3 : Attach */
|
||||||
|
jdwpTransportError (JNICALL *Attach)(jdwpTransportEnv* env,
|
||||||
|
const char* address,
|
||||||
|
jlong attach_timeout,
|
||||||
|
jlong handshake_timeout);
|
||||||
|
|
||||||
|
/* 4: StartListening */
|
||||||
|
jdwpTransportError (JNICALL *StartListening)(jdwpTransportEnv* env,
|
||||||
|
const char* address,
|
||||||
|
char** actual_address);
|
||||||
|
|
||||||
|
/* 5: StopListening */
|
||||||
|
jdwpTransportError (JNICALL *StopListening)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 6: Accept */
|
||||||
|
jdwpTransportError (JNICALL *Accept)(jdwpTransportEnv* env,
|
||||||
|
jlong accept_timeout,
|
||||||
|
jlong handshake_timeout);
|
||||||
|
|
||||||
|
/* 7: IsOpen */
|
||||||
|
jboolean (JNICALL *IsOpen)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 8: Close */
|
||||||
|
jdwpTransportError (JNICALL *Close)(jdwpTransportEnv* env);
|
||||||
|
|
||||||
|
/* 9: ReadPacket */
|
||||||
|
jdwpTransportError (JNICALL *ReadPacket)(jdwpTransportEnv* env,
|
||||||
|
jdwpPacket *pkt);
|
||||||
|
|
||||||
|
/* 10: Write Packet */
|
||||||
|
jdwpTransportError (JNICALL *WritePacket)(jdwpTransportEnv* env,
|
||||||
|
const jdwpPacket* pkt);
|
||||||
|
|
||||||
|
/* 11: GetLastError */
|
||||||
|
jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
|
||||||
|
char** error);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use inlined functions so that C++ code can use syntax such as
|
||||||
|
* env->Attach("mymachine:5000", 10*1000, 0);
|
||||||
|
*
|
||||||
|
* rather than using C's :-
|
||||||
|
*
|
||||||
|
* (*env)->Attach(env, "mymachine:5000", 10*1000, 0);
|
||||||
|
*/
|
||||||
|
struct _jdwpTransportEnv {
|
||||||
|
const struct jdwpTransportNativeInterface_ *functions;
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
jdwpTransportError GetCapabilities(JDWPTransportCapabilities *capabilities_ptr) {
|
||||||
|
return functions->GetCapabilities(this, capabilities_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Attach(const char* address, jlong attach_timeout,
|
||||||
|
jlong handshake_timeout) {
|
||||||
|
return functions->Attach(this, address, attach_timeout, handshake_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError StartListening(const char* address,
|
||||||
|
char** actual_address) {
|
||||||
|
return functions->StartListening(this, address, actual_address);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError StopListening(void) {
|
||||||
|
return functions->StopListening(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Accept(jlong accept_timeout, jlong handshake_timeout) {
|
||||||
|
return functions->Accept(this, accept_timeout, handshake_timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
jboolean IsOpen(void) {
|
||||||
|
return functions->IsOpen(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError Close(void) {
|
||||||
|
return functions->Close(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError ReadPacket(jdwpPacket *pkt) {
|
||||||
|
return functions->ReadPacket(this, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError WritePacket(const jdwpPacket* pkt) {
|
||||||
|
return functions->WritePacket(this, pkt);
|
||||||
|
}
|
||||||
|
|
||||||
|
jdwpTransportError GetLastError(char** error) {
|
||||||
|
return functions->GetLastError(this, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* JDWPTRANSPORT_H */
|
||||||
|
|
||||||
1951
JavaOpenJPEG/java-jni/include/jni.h
Normal file
1951
JavaOpenJPEG/java-jni/include/jni.h
Normal file
File diff suppressed because it is too large
Load Diff
1012
JavaOpenJPEG/java-jni/include/jvmdi.h
Normal file
1012
JavaOpenJPEG/java-jni/include/jvmdi.h
Normal file
File diff suppressed because it is too large
Load Diff
642
JavaOpenJPEG/java-jni/include/jvmpi.h
Normal file
642
JavaOpenJPEG/java-jni/include/jvmpi.h
Normal file
@@ -0,0 +1,642 @@
|
|||||||
|
/*
|
||||||
|
* @(#)jvmpi.h 1.28 03/12/19
|
||||||
|
*
|
||||||
|
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JVMPI_H_
|
||||||
|
#define _JAVASOFT_JVMPI_H_
|
||||||
|
|
||||||
|
#include "jni.h"
|
||||||
|
|
||||||
|
#define JVMPI_VERSION_1 ((jint)0x10000001) /* implied 0 for minor version */
|
||||||
|
#define JVMPI_VERSION_1_1 ((jint)0x10000002)
|
||||||
|
#define JVMPI_VERSION_1_2 ((jint)0x10000003)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
typedef void (*jvmpi_void_function_of_void)(void *);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************
|
||||||
|
* Profiler interface data structures.
|
||||||
|
****************************************************************/
|
||||||
|
/* identifier types. */
|
||||||
|
struct _jobjectID;
|
||||||
|
typedef struct _jobjectID * jobjectID; /* type of object ids */
|
||||||
|
|
||||||
|
/* raw monitors */
|
||||||
|
struct _JVMPI_RawMonitor;
|
||||||
|
typedef struct _JVMPI_RawMonitor * JVMPI_RawMonitor;
|
||||||
|
|
||||||
|
/* call frame */
|
||||||
|
typedef struct {
|
||||||
|
jint lineno; /* line number in the source file */
|
||||||
|
jmethodID method_id; /* method executed in this frame */
|
||||||
|
} JVMPI_CallFrame;
|
||||||
|
|
||||||
|
/* call trace */
|
||||||
|
typedef struct {
|
||||||
|
JNIEnv *env_id; /* Env where trace was recorded */
|
||||||
|
jint num_frames; /* number of frames in this trace */
|
||||||
|
JVMPI_CallFrame *frames; /* frames */
|
||||||
|
} JVMPI_CallTrace;
|
||||||
|
|
||||||
|
/* method */
|
||||||
|
typedef struct {
|
||||||
|
char *method_name; /* name of method */
|
||||||
|
char *method_signature; /* signature of method */
|
||||||
|
jint start_lineno; /* -1 if native, abstract .. */
|
||||||
|
jint end_lineno; /* -1 if native, abstract .. */
|
||||||
|
jmethodID method_id; /* id assigned to this method */
|
||||||
|
} JVMPI_Method;
|
||||||
|
|
||||||
|
/* Field */
|
||||||
|
typedef struct {
|
||||||
|
char *field_name; /* name of field */
|
||||||
|
char *field_signature; /* signature of field */
|
||||||
|
} JVMPI_Field;
|
||||||
|
|
||||||
|
/* line number info for a compiled method */
|
||||||
|
typedef struct {
|
||||||
|
jint offset; /* offset from beginning of method */
|
||||||
|
jint lineno; /* lineno from beginning of src file */
|
||||||
|
} JVMPI_Lineno;
|
||||||
|
|
||||||
|
/* event */
|
||||||
|
typedef struct {
|
||||||
|
jint event_type; /* event_type */
|
||||||
|
JNIEnv *env_id; /* env where this event occured */
|
||||||
|
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
const char *class_name; /* class name */
|
||||||
|
char *source_name; /* name of source file */
|
||||||
|
jint num_interfaces; /* number of interfaces implemented */
|
||||||
|
jint num_methods; /* number of methods in the class */
|
||||||
|
JVMPI_Method *methods; /* methods */
|
||||||
|
jint num_static_fields; /* number of static fields */
|
||||||
|
JVMPI_Field *statics; /* static fields */
|
||||||
|
jint num_instance_fields; /* number of instance fields */
|
||||||
|
JVMPI_Field *instances; /* instance fields */
|
||||||
|
jobjectID class_id; /* id of the class object */
|
||||||
|
} class_load;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jobjectID class_id; /* id of the class object */
|
||||||
|
} class_unload;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
unsigned char *class_data; /* content of class file */
|
||||||
|
jint class_data_len; /* class file length */
|
||||||
|
unsigned char *new_class_data; /* instrumented class file */
|
||||||
|
jint new_class_data_len; /* new class file length */
|
||||||
|
void * (*malloc_f)(unsigned int); /* memory allocation function */
|
||||||
|
} class_load_hook;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jint arena_id;
|
||||||
|
jobjectID class_id; /* id of object class */
|
||||||
|
jint is_array; /* JVMPI_NORMAL_OBJECT, ... */
|
||||||
|
jint size; /* size in number of bytes */
|
||||||
|
jobjectID obj_id; /* id assigned to this object */
|
||||||
|
} obj_alloc;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jobjectID obj_id; /* id of the object */
|
||||||
|
} obj_free;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jint arena_id; /* cur arena id */
|
||||||
|
jobjectID obj_id; /* cur object id */
|
||||||
|
jint new_arena_id; /* new arena id */
|
||||||
|
jobjectID new_obj_id; /* new object id */
|
||||||
|
} obj_move;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jint arena_id; /* id of arena */
|
||||||
|
const char *arena_name; /* name of arena */
|
||||||
|
} new_arena;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jint arena_id; /* id of arena */
|
||||||
|
} delete_arena;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char *thread_name; /* name of thread */
|
||||||
|
char *group_name; /* name of group */
|
||||||
|
char *parent_name; /* name of parent */
|
||||||
|
jobjectID thread_id; /* id of the thread object */
|
||||||
|
JNIEnv *thread_env_id;
|
||||||
|
} thread_start;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int dump_level; /* level of the heap dump info */
|
||||||
|
char *begin; /* where all the root records begin,
|
||||||
|
please see the heap dump buffer
|
||||||
|
format described below */
|
||||||
|
char *end; /* where the object records end. */
|
||||||
|
jint num_traces; /* number of thread traces,
|
||||||
|
0 if dump level = JVMPI_DUMP_LEVEL_0 */
|
||||||
|
JVMPI_CallTrace *traces; /* thread traces collected during
|
||||||
|
heap dump */
|
||||||
|
} heap_dump;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jobjectID obj_id; /* object id */
|
||||||
|
jobject ref_id; /* id assigned to the globalref */
|
||||||
|
} jni_globalref_alloc;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jobject ref_id; /* id of the global ref */
|
||||||
|
} jni_globalref_free;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jmethodID method_id; /* method */
|
||||||
|
} method;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jmethodID method_id; /* id of method */
|
||||||
|
jobjectID obj_id; /* id of target object */
|
||||||
|
} method_entry2;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jmethodID method_id; /* id of compiled method */
|
||||||
|
void *code_addr; /* code start addr. in memory */
|
||||||
|
jint code_size; /* code size */
|
||||||
|
jint lineno_table_size; /* size of lineno table */
|
||||||
|
JVMPI_Lineno *lineno_table; /* lineno info */
|
||||||
|
} compiled_method_load;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jmethodID method_id; /* id of unloaded compiled method */
|
||||||
|
} compiled_method_unload;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jmethodID method_id; /* id of the method the instruction belongs to */
|
||||||
|
jint offset; /* instruction offset in the method's bytecode */
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
jboolean is_true; /* whether true or false branch is taken */
|
||||||
|
} if_info;
|
||||||
|
struct {
|
||||||
|
jint key; /* top stack value used as an index */
|
||||||
|
jint low; /* min value of the index */
|
||||||
|
jint hi; /* max value of the index */
|
||||||
|
} tableswitch_info;
|
||||||
|
struct {
|
||||||
|
jint chosen_pair_index; /* actually chosen pair index (0-based)
|
||||||
|
* if chosen_pair_index == pairs_total then
|
||||||
|
* the 'default' branch is taken
|
||||||
|
*/
|
||||||
|
jint pairs_total; /* total number of lookupswitch pairs */
|
||||||
|
} lookupswitch_info;
|
||||||
|
} u;
|
||||||
|
} instruction;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char *begin; /* beginning of dump buffer,
|
||||||
|
see below for format */
|
||||||
|
char *end; /* end of dump buffer */
|
||||||
|
jint num_traces; /* number of traces */
|
||||||
|
JVMPI_CallTrace *traces; /* traces of all threads */
|
||||||
|
jint *threads_status; /* status of all threads */
|
||||||
|
} monitor_dump;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
const char *name; /* name of raw monitor */
|
||||||
|
JVMPI_RawMonitor id; /* id */
|
||||||
|
} raw_monitor;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jobjectID object; /* Java object */
|
||||||
|
} monitor;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jobjectID object; /* Java object */
|
||||||
|
jlong timeout; /* timeout period */
|
||||||
|
} monitor_wait;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jlong used_objects;
|
||||||
|
jlong used_object_space;
|
||||||
|
jlong total_object_space;
|
||||||
|
} gc_info;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
jint data_len;
|
||||||
|
char *data;
|
||||||
|
} object_dump;
|
||||||
|
} u;
|
||||||
|
} JVMPI_Event;
|
||||||
|
|
||||||
|
/* interface functions */
|
||||||
|
typedef struct {
|
||||||
|
jint version; /* JVMPI version */
|
||||||
|
|
||||||
|
/* ------interface implemented by the profiler------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called by the JVM to notify an event.
|
||||||
|
*/
|
||||||
|
void (*NotifyEvent)(JVMPI_Event *event);
|
||||||
|
|
||||||
|
/* ------interface implemented by the JVM------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called by the profiler to enable/disable/send notification
|
||||||
|
* for a particular event type.
|
||||||
|
*
|
||||||
|
* event_type - event_type
|
||||||
|
* arg - event specific arg
|
||||||
|
*
|
||||||
|
* return JVMPI_NOT_AVAILABLE, JVMPI_SUCCESS or JVMPI_FAIL
|
||||||
|
*/
|
||||||
|
jint (*EnableEvent)(jint event_type, void *arg);
|
||||||
|
jint (*DisableEvent)(jint event_type, void *arg);
|
||||||
|
jint (*RequestEvent)(jint event_type, void *arg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called by the profiler to get a stack
|
||||||
|
* trace from the JVM.
|
||||||
|
*
|
||||||
|
* trace - trace data structure to be filled
|
||||||
|
* depth - maximum depth of the trace.
|
||||||
|
*/
|
||||||
|
void (*GetCallTrace)(JVMPI_CallTrace *trace, jint depth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called by profiler when it wants to exit/stop.
|
||||||
|
*/
|
||||||
|
void (*ProfilerExit)(jint);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility functions provided by the JVM.
|
||||||
|
*/
|
||||||
|
JVMPI_RawMonitor (*RawMonitorCreate)(char *lock_name);
|
||||||
|
void (*RawMonitorEnter)(JVMPI_RawMonitor lock_id);
|
||||||
|
void (*RawMonitorExit)(JVMPI_RawMonitor lock_id);
|
||||||
|
void (*RawMonitorWait)(JVMPI_RawMonitor lock_id, jlong ms);
|
||||||
|
void (*RawMonitorNotifyAll)(JVMPI_RawMonitor lock_id);
|
||||||
|
void (*RawMonitorDestroy)(JVMPI_RawMonitor lock_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called by the profiler to get the current thread's CPU time.
|
||||||
|
*
|
||||||
|
* return time in nanoseconds;
|
||||||
|
*/
|
||||||
|
jlong (*GetCurrentThreadCpuTime)(void);
|
||||||
|
|
||||||
|
void (*SuspendThread)(JNIEnv *env);
|
||||||
|
void (*ResumeThread)(JNIEnv *env);
|
||||||
|
jint (*GetThreadStatus)(JNIEnv *env);
|
||||||
|
jboolean (*ThreadHasRun)(JNIEnv *env);
|
||||||
|
|
||||||
|
/* This function can be called safely only after JVMPI_EVENT_VM_INIT_DONE
|
||||||
|
notification by the JVM. */
|
||||||
|
jint (*CreateSystemThread)(char *name, jint priority, void (*f)(void *));
|
||||||
|
|
||||||
|
/* thread local storage access functions to avoid locking in time
|
||||||
|
critical functions */
|
||||||
|
void (*SetThreadLocalStorage)(JNIEnv *env_id, void *ptr);
|
||||||
|
void * (*GetThreadLocalStorage)(JNIEnv *env_id);
|
||||||
|
|
||||||
|
/* control GC */
|
||||||
|
void (*DisableGC)(void);
|
||||||
|
void (*EnableGC)(void);
|
||||||
|
void (*RunGC)(void);
|
||||||
|
|
||||||
|
jobjectID (*GetThreadObject)(JNIEnv *env);
|
||||||
|
jobjectID (*GetMethodClass)(jmethodID mid);
|
||||||
|
|
||||||
|
/* JNI <-> jobject conversions */
|
||||||
|
jobject (*jobjectID2jobject)(jobjectID jid);
|
||||||
|
jobjectID (*jobject2jobjectID)(jobject jobj);
|
||||||
|
|
||||||
|
void (*SuspendThreadList)
|
||||||
|
(jint reqCount, JNIEnv **reqList, jint *results);
|
||||||
|
void (*ResumeThreadList)
|
||||||
|
(jint reqCount, JNIEnv **reqList, jint *results);
|
||||||
|
} JVMPI_Interface;
|
||||||
|
|
||||||
|
/* type of argument passed to RequestEvent for heap dumps */
|
||||||
|
typedef struct {
|
||||||
|
jint heap_dump_level;
|
||||||
|
} JVMPI_HeapDumpArg;
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Constants and formats used in JVM Profiler Interface.
|
||||||
|
**********************************************************************/
|
||||||
|
/*
|
||||||
|
* Event type constants.
|
||||||
|
*/
|
||||||
|
#define JVMPI_EVENT_METHOD_ENTRY ((jint)1)
|
||||||
|
#define JVMPI_EVENT_METHOD_ENTRY2 ((jint)2)
|
||||||
|
#define JVMPI_EVENT_METHOD_EXIT ((jint)3)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_OBJECT_ALLOC ((jint)4)
|
||||||
|
#define JVMPI_EVENT_OBJECT_FREE ((jint)5)
|
||||||
|
#define JVMPI_EVENT_OBJECT_MOVE ((jint)6)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_COMPILED_METHOD_LOAD ((jint)7)
|
||||||
|
#define JVMPI_EVENT_COMPILED_METHOD_UNLOAD ((jint)8)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_INSTRUCTION_START ((jint)9)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_THREAD_START ((jint)33)
|
||||||
|
#define JVMPI_EVENT_THREAD_END ((jint)34)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_CLASS_LOAD_HOOK ((jint)35)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_HEAP_DUMP ((jint)37)
|
||||||
|
#define JVMPI_EVENT_JNI_GLOBALREF_ALLOC ((jint)38)
|
||||||
|
#define JVMPI_EVENT_JNI_GLOBALREF_FREE ((jint)39)
|
||||||
|
#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC ((jint)40)
|
||||||
|
#define JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE ((jint)41)
|
||||||
|
#define JVMPI_EVENT_CLASS_LOAD ((jint)42)
|
||||||
|
#define JVMPI_EVENT_CLASS_UNLOAD ((jint)43)
|
||||||
|
#define JVMPI_EVENT_DATA_DUMP_REQUEST ((jint)44)
|
||||||
|
#define JVMPI_EVENT_DATA_RESET_REQUEST ((jint)45)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_JVM_INIT_DONE ((jint)46)
|
||||||
|
#define JVMPI_EVENT_JVM_SHUT_DOWN ((jint)47)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_ARENA_NEW ((jint)48)
|
||||||
|
#define JVMPI_EVENT_ARENA_DELETE ((jint)49)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_OBJECT_DUMP ((jint)50)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER ((jint)51)
|
||||||
|
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED ((jint)52)
|
||||||
|
#define JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT ((jint)53)
|
||||||
|
#define JVMPI_EVENT_MONITOR_CONTENDED_ENTER ((jint)54)
|
||||||
|
#define JVMPI_EVENT_MONITOR_CONTENDED_ENTERED ((jint)55)
|
||||||
|
#define JVMPI_EVENT_MONITOR_CONTENDED_EXIT ((jint)56)
|
||||||
|
#define JVMPI_EVENT_MONITOR_WAIT ((jint)57)
|
||||||
|
#define JVMPI_EVENT_MONITOR_WAITED ((jint)58)
|
||||||
|
#define JVMPI_EVENT_MONITOR_DUMP ((jint)59)
|
||||||
|
|
||||||
|
#define JVMPI_EVENT_GC_START ((jint)60)
|
||||||
|
#define JVMPI_EVENT_GC_FINISH ((jint)61)
|
||||||
|
|
||||||
|
#define JVMPI_MAX_EVENT_TYPE_VAL ((jint)61)
|
||||||
|
|
||||||
|
/* old definitions, to be removed */
|
||||||
|
#define JVMPI_EVENT_LOAD_COMPILED_METHOD ((jint)7)
|
||||||
|
#define JVMPI_EVENT_UNLOAD_COMPILED_METHOD ((jint)8)
|
||||||
|
#define JVMPI_EVENT_NEW_ARENA ((jint)48)
|
||||||
|
#define JVMPI_EVENT_DELETE_ARENA ((jint)49)
|
||||||
|
#define JVMPI_EVENT_DUMP_DATA_REQUEST ((jint)44)
|
||||||
|
#define JVMPI_EVENT_RESET_DATA_REQUEST ((jint)45)
|
||||||
|
#define JVMPI_EVENT_OBJ_ALLOC ((jint)4)
|
||||||
|
#define JVMPI_EVENT_OBJ_FREE ((jint)5)
|
||||||
|
#define JVMPI_EVENT_OBJ_MOVE ((jint)6)
|
||||||
|
|
||||||
|
#define JVMPI_REQUESTED_EVENT ((jint)0x10000000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* enabling/disabling event notification.
|
||||||
|
*/
|
||||||
|
/* results */
|
||||||
|
#define JVMPI_SUCCESS ((jint)0)
|
||||||
|
#define JVMPI_NOT_AVAILABLE ((jint)1)
|
||||||
|
#define JVMPI_FAIL ((jint)-1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Thread status
|
||||||
|
*/
|
||||||
|
enum {
|
||||||
|
JVMPI_THREAD_RUNNABLE = 1,
|
||||||
|
JVMPI_THREAD_MONITOR_WAIT,
|
||||||
|
JVMPI_THREAD_CONDVAR_WAIT
|
||||||
|
};
|
||||||
|
|
||||||
|
#define JVMPI_THREAD_SUSPENDED 0x8000
|
||||||
|
#define JVMPI_THREAD_INTERRUPTED 0x4000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Thread priority
|
||||||
|
*/
|
||||||
|
#define JVMPI_MINIMUM_PRIORITY 1
|
||||||
|
#define JVMPI_MAXIMUM_PRIORITY 10
|
||||||
|
#define JVMPI_NORMAL_PRIORITY 5
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Object type constants.
|
||||||
|
*/
|
||||||
|
#define JVMPI_NORMAL_OBJECT ((jint)0)
|
||||||
|
#define JVMPI_CLASS ((jint)2)
|
||||||
|
#define JVMPI_BOOLEAN ((jint)4)
|
||||||
|
#define JVMPI_CHAR ((jint)5)
|
||||||
|
#define JVMPI_FLOAT ((jint)6)
|
||||||
|
#define JVMPI_DOUBLE ((jint)7)
|
||||||
|
#define JVMPI_BYTE ((jint)8)
|
||||||
|
#define JVMPI_SHORT ((jint)9)
|
||||||
|
#define JVMPI_INT ((jint)10)
|
||||||
|
#define JVMPI_LONG ((jint)11)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Monitor dump constants.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define JVMPI_MONITOR_JAVA 0x01
|
||||||
|
#define JVMPI_MONITOR_RAW 0x02
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Heap dump constants.
|
||||||
|
*/
|
||||||
|
#define JVMPI_GC_ROOT_UNKNOWN 0xff
|
||||||
|
#define JVMPI_GC_ROOT_JNI_GLOBAL 0x01
|
||||||
|
#define JVMPI_GC_ROOT_JNI_LOCAL 0x02
|
||||||
|
#define JVMPI_GC_ROOT_JAVA_FRAME 0x03
|
||||||
|
#define JVMPI_GC_ROOT_NATIVE_STACK 0x04
|
||||||
|
#define JVMPI_GC_ROOT_STICKY_CLASS 0x05
|
||||||
|
#define JVMPI_GC_ROOT_THREAD_BLOCK 0x06
|
||||||
|
#define JVMPI_GC_ROOT_MONITOR_USED 0x07
|
||||||
|
#define JVMPI_GC_ROOT_THREAD_OBJ 0x08
|
||||||
|
|
||||||
|
#define JVMPI_GC_CLASS_DUMP 0x20
|
||||||
|
#define JVMPI_GC_INSTANCE_DUMP 0x21
|
||||||
|
#define JVMPI_GC_OBJ_ARRAY_DUMP 0x22
|
||||||
|
#define JVMPI_GC_PRIM_ARRAY_DUMP 0x23
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dump levels
|
||||||
|
*/
|
||||||
|
#define JVMPI_DUMP_LEVEL_0 ((jint)0)
|
||||||
|
#define JVMPI_DUMP_LEVEL_1 ((jint)1)
|
||||||
|
#define JVMPI_DUMP_LEVEL_2 ((jint)2)
|
||||||
|
|
||||||
|
/* Types used in dumps -
|
||||||
|
*
|
||||||
|
* u1: 1 byte
|
||||||
|
* u2: 2 bytes
|
||||||
|
* u4: 4 bytes
|
||||||
|
* u8: 8 bytes
|
||||||
|
*
|
||||||
|
* ty: u1 where:
|
||||||
|
* JVMPI_CLASS: object
|
||||||
|
* JVMPI_BOOLEAN: boolean
|
||||||
|
* JVMPI_CHAR: char
|
||||||
|
* JVMPI_FLOAT: float
|
||||||
|
* JVMPI_DOUBLE: double
|
||||||
|
* JVMPI_BYTE: byte
|
||||||
|
* JVMPI_SHORT: short
|
||||||
|
* JVMPI_INT: int
|
||||||
|
* JVMPI_LONG: long
|
||||||
|
*
|
||||||
|
* vl: values, exact type depends on the type of the value:
|
||||||
|
* JVMPI_BOOLEAN & JVMPI_BYTE: u1
|
||||||
|
* JVMPI_SHORT & JVMPI_CHAR: u2
|
||||||
|
* JVMPI_INT & JVMPI_FLOAT: u4
|
||||||
|
* JVMPI_LONG & JVMPI_DOUBLE: u8
|
||||||
|
* JVMPI_CLASS: jobjectID
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Format of the monitor dump buffer:
|
||||||
|
*
|
||||||
|
* u1 monitor type
|
||||||
|
*
|
||||||
|
* JVMPI_MONITOR_JAVA Java monitor
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
* JNIEnv * owner thread
|
||||||
|
* u4 entry count
|
||||||
|
* u4 # of threads waiting to enter
|
||||||
|
* [JNIEnv *]* threads waiting to enter
|
||||||
|
* u4 # of threads waiting to be notified
|
||||||
|
* [JNIEnv *]* threads waiting to be notified
|
||||||
|
*
|
||||||
|
* JVMPI_MONITOR_RAW raw monitor
|
||||||
|
*
|
||||||
|
* char * name
|
||||||
|
* JVMPI_RawMonitor raw monitor
|
||||||
|
* JNIEnv * owner thread
|
||||||
|
* u4 entry count
|
||||||
|
* u4 # of threads waiting to enter
|
||||||
|
* [JNIEnv *]* threads waiting to enter
|
||||||
|
* u4 # of threads waiting to be notified
|
||||||
|
* [JNIEnv *]* threads waiting to be notified
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Format of the heap dump buffer depends on the dump level
|
||||||
|
* specified in the JVMPI_HeapDumpArg passed to RequestEvent as arg.
|
||||||
|
* The default is JVMPI_DUMP_LEVEL_2.
|
||||||
|
*
|
||||||
|
* JVMPI_DUMP_LEVEL_0:
|
||||||
|
*
|
||||||
|
* u1 object type (JVMPI_CLASS ...)
|
||||||
|
* jobjectID object
|
||||||
|
*
|
||||||
|
* JVMPI_DUMP_LEVEL_1 and JVMPI_DUMP_LEVEL_2 use the following format:
|
||||||
|
* In the case of JVMPI_DUMP_LEVEL_1 the values of primitive fields in object
|
||||||
|
* instance dumps , the values of primitive statics in class dumps and the
|
||||||
|
* values of primitive arrays are excluded. JVMPI_DUMP_LEVEL_2 includes the
|
||||||
|
* primitive values.
|
||||||
|
*
|
||||||
|
* u1 record type
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_UNKNOWN unknown root
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_JNI_GLOBAL JNI global ref root
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
* jobject JNI global reference
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_JNI_LOCAL JNI local ref
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
* JNIEnv * thread
|
||||||
|
* u4 frame # in stack trace (-1 for empty)
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_JAVA_FRAME Java stack frame
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
* JNIEnv * thread
|
||||||
|
* u4 frame # in stack trace (-1 for empty)
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_NATIVE_STACK Native stack
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
* JNIEnv * thread
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_STICKY_CLASS System class
|
||||||
|
*
|
||||||
|
* jobjectID class object
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_THREAD_BLOCK Reference from thread block
|
||||||
|
*
|
||||||
|
* jobjectID thread object
|
||||||
|
* JNIEnv * thread
|
||||||
|
*
|
||||||
|
* JVMPI_GC_ROOT_MONITOR_USED Busy monitor
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
*
|
||||||
|
* JVMPI_GC_CLASS_DUMP dump of a class object
|
||||||
|
*
|
||||||
|
* jobjectID class
|
||||||
|
* jobjectID super
|
||||||
|
* jobjectID class loader
|
||||||
|
* jobjectID signers
|
||||||
|
* jobjectID protection domain
|
||||||
|
* jobjectID class name
|
||||||
|
* void * reserved
|
||||||
|
*
|
||||||
|
* u4 instance size (in bytes)
|
||||||
|
*
|
||||||
|
* [jobjectID]* interfaces
|
||||||
|
*
|
||||||
|
* u2 size of constant pool
|
||||||
|
* [u2, constant pool index,
|
||||||
|
* ty, type,
|
||||||
|
* vl]* value
|
||||||
|
*
|
||||||
|
* [vl]* static field values
|
||||||
|
*
|
||||||
|
* JVMPI_GC_INSTANCE_DUMP dump of a normal object
|
||||||
|
*
|
||||||
|
* jobjectID object
|
||||||
|
* jobjectID class
|
||||||
|
* u4 number of bytes that follow
|
||||||
|
* [vl]* instance field values (class, followed
|
||||||
|
* by super, super's super ...)
|
||||||
|
*
|
||||||
|
* JVMPI_GC_OBJ_ARRAY_DUMP dump of an object array
|
||||||
|
*
|
||||||
|
* jobjectID array object
|
||||||
|
* u4 number of elements
|
||||||
|
* jobjectID element class
|
||||||
|
* [jobjectID]* elements
|
||||||
|
*
|
||||||
|
* JVMPI_GC_PRIM_ARRAY_DUMP dump of a primitive array
|
||||||
|
*
|
||||||
|
* jobjectID array object
|
||||||
|
* u4 number of elements
|
||||||
|
* ty element type
|
||||||
|
* [vl]* elements
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Format of the dump received in JVMPI_EVENT_OBJECT_DUMP:
|
||||||
|
* All the records have JVMPI_DUMP_LEVEL_2 information.
|
||||||
|
*
|
||||||
|
* u1 record type
|
||||||
|
*
|
||||||
|
* followed by a:
|
||||||
|
*
|
||||||
|
* JVMPI_GC_CLASS_DUMP,
|
||||||
|
* JVMPI_GC_INSTANCE_DUMP,
|
||||||
|
* JVMPI_GC_OBJ_ARRAY_DUMP, or
|
||||||
|
* JVMPI_GC_PRIM_ARRAY_DUMP record.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JVMPI_H_ */
|
||||||
2181
JavaOpenJPEG/java-jni/include/jvmti.h
Normal file
2181
JavaOpenJPEG/java-jni/include/jvmti.h
Normal file
File diff suppressed because it is too large
Load Diff
41
JavaOpenJPEG/java-jni/include/win32/jawt_md.h
Normal file
41
JavaOpenJPEG/java-jni/include/win32/jawt_md.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* @(#)jawt_md.h 1.7 03/12/19
|
||||||
|
*
|
||||||
|
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JAWT_MD_H_
|
||||||
|
#define _JAVASOFT_JAWT_MD_H_
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include "jawt.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Win32-specific declarations for AWT native interface.
|
||||||
|
* See notes in jawt.h for an example of use.
|
||||||
|
*/
|
||||||
|
typedef struct jawt_Win32DrawingSurfaceInfo {
|
||||||
|
/* Native window, DDB, or DIB handle */
|
||||||
|
union {
|
||||||
|
HWND hwnd;
|
||||||
|
HBITMAP hbitmap;
|
||||||
|
void* pbits;
|
||||||
|
};
|
||||||
|
/*
|
||||||
|
* This HDC should always be used instead of the HDC returned from
|
||||||
|
* BeginPaint() or any calls to GetDC().
|
||||||
|
*/
|
||||||
|
HDC hdc;
|
||||||
|
HPALETTE hpalette;
|
||||||
|
} JAWT_Win32DrawingSurfaceInfo;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JAWT_MD_H_ */
|
||||||
19
JavaOpenJPEG/java-jni/include/win32/jni_md.h
Normal file
19
JavaOpenJPEG/java-jni/include/win32/jni_md.h
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* @(#)jni_md.h 1.14 03/12/19
|
||||||
|
*
|
||||||
|
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _JAVASOFT_JNI_MD_H_
|
||||||
|
#define _JAVASOFT_JNI_MD_H_
|
||||||
|
|
||||||
|
#define JNIEXPORT __declspec(dllexport)
|
||||||
|
#define JNIIMPORT __declspec(dllimport)
|
||||||
|
#define JNICALL __stdcall
|
||||||
|
|
||||||
|
typedef long jint;
|
||||||
|
typedef __int64 jlong;
|
||||||
|
typedef signed char jbyte;
|
||||||
|
|
||||||
|
#endif /* !_JAVASOFT_JNI_MD_H_ */
|
||||||
BIN
JavaOpenJPEG/java-jni/lib/jvm.lib
Normal file
BIN
JavaOpenJPEG/java-jni/lib/jvm.lib
Normal file
Binary file not shown.
30
LICENSE
Normal file
30
LICENSE
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
78
Makefile
78
Makefile
@@ -1,78 +0,0 @@
|
|||||||
# Linux makefile for OpenJPEG
|
|
||||||
|
|
||||||
VER_MAJOR = 2
|
|
||||||
VER_MINOR = 1.2.0
|
|
||||||
|
|
||||||
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
|
|
||||||
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h ./libopenjpeg/opj_includes.h
|
|
||||||
INCLUDE = -Ilibopenjpeg
|
|
||||||
|
|
||||||
# General configuration variables:
|
|
||||||
CC = gcc
|
|
||||||
AR = ar
|
|
||||||
|
|
||||||
PREFIX = /usr
|
|
||||||
INSTALL_LIBDIR = $(PREFIX)/lib
|
|
||||||
INSTALL_INCLUDE = $(PREFIX)/include
|
|
||||||
|
|
||||||
# Converts cr/lf to just lf
|
|
||||||
DOS2UNIX = dos2unix
|
|
||||||
|
|
||||||
COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
|
|
||||||
LIBRARIES = -lstdc++
|
|
||||||
|
|
||||||
MODULES = $(SRCS:.c=.o)
|
|
||||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
|
||||||
|
|
||||||
TARGET = openjpeg
|
|
||||||
STATICLIB = lib$(TARGET).a
|
|
||||||
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
|
|
||||||
LIBNAME = lib$(TARGET).so.$(VER_MAJOR)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default: all
|
|
||||||
|
|
||||||
all: OpenJPEG
|
|
||||||
|
|
||||||
dist: OpenJPEG
|
|
||||||
install -d dist
|
|
||||||
install -m 644 $(STATICLIB) dist
|
|
||||||
install -m 755 $(SHAREDLIB) dist
|
|
||||||
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
|
||||||
install libopenjpeg/openjpeg.h dist
|
|
||||||
|
|
||||||
dos2unix:
|
|
||||||
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
|
||||||
|
|
||||||
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(STATICLIB): $(MODULES)
|
|
||||||
$(AR) r $@ $(MODULES)
|
|
||||||
|
|
||||||
$(SHAREDLIB): $(MODULES)
|
|
||||||
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
|
||||||
|
|
||||||
install: OpenJPEG
|
|
||||||
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
|
||||||
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
|
||||||
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
|
||||||
install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
|
||||||
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
|
||||||
install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
|
||||||
-ldconfig
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
|
||||||
|
|
||||||
osx:
|
|
||||||
make -f Makefile.osx
|
|
||||||
|
|
||||||
osxinstall:
|
|
||||||
make -f Makefile.osx install
|
|
||||||
|
|
||||||
osxclean:
|
|
||||||
make -f Makefile.osx clean
|
|
||||||
28
Makefile.am
Normal file
28
Makefile.am
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#OpenJPEG top source directory
|
||||||
|
SUBDIRS = libopenjpeg codec mj2 @jpwl_dir@ @jp3d_dir@ doc
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
@rm -rf bin
|
||||||
|
@l='$(SUBDIRS)'; for f in $$l ; do \
|
||||||
|
rm -f $$f/.report.txt ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
distclean-local: clean-local
|
||||||
|
|
||||||
|
pkgconf_dir = /usr/lib/pkgconfig
|
||||||
|
|
||||||
|
install-data-hook:
|
||||||
|
@echo ""
|
||||||
|
@l='$(SUBDIRS)'; for f in $$l ; do \
|
||||||
|
cat $$f/.report.txt ; \
|
||||||
|
done
|
||||||
|
@echo ""
|
||||||
|
@echo "Installing: libopenjpeg1.pc $(pkgconf_dir)"
|
||||||
|
@echo ""
|
||||||
|
@$(INSTALL) -d $(pkgconf_dir)
|
||||||
|
@cp libopenjpeg.pc $(pkgconf_dir)/libopenjpeg1.pc
|
||||||
|
@(cd $(pkgconf_dir) && $(RM) libopenjpeg.pc && \
|
||||||
|
$(LN_S) libopenjpeg1.pc libopenjpeg.pc)
|
||||||
|
|
||||||
|
uninstall-hook:
|
||||||
|
@(cd $(pkgconf_dir) && $(RM) libopenjpeg.pc libopenjpeg1.pc)
|
||||||
776
Makefile.in
Normal file
776
Makefile.in
Normal file
@@ -0,0 +1,776 @@
|
|||||||
|
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||||
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
|
install_sh_PROGRAM = $(install_sh) -c
|
||||||
|
install_sh_SCRIPT = $(install_sh) -c
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = $(program_transform_name)
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
|
host_triplet = @host@
|
||||||
|
target_triplet = @target@
|
||||||
|
subdir = .
|
||||||
|
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||||
|
$(srcdir)/Makefile.in $(srcdir)/libopenjpeg.pc.in \
|
||||||
|
$(srcdir)/opj_config.h.in $(top_srcdir)/configure INSTALL \
|
||||||
|
config.guess config.sub depcomp install-sh ltmain.sh missing
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||||
|
configure.lineno config.status.lineno
|
||||||
|
mkinstalldirs = $(install_sh) -d
|
||||||
|
CONFIG_HEADER = opj_config.h
|
||||||
|
CONFIG_CLEAN_FILES = libopenjpeg.pc
|
||||||
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
|
SOURCES =
|
||||||
|
DIST_SOURCES =
|
||||||
|
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||||
|
html-recursive info-recursive install-data-recursive \
|
||||||
|
install-dvi-recursive install-exec-recursive \
|
||||||
|
install-html-recursive install-info-recursive \
|
||||||
|
install-pdf-recursive install-ps-recursive install-recursive \
|
||||||
|
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||||
|
ps-recursive uninstall-recursive
|
||||||
|
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||||
|
distclean-recursive maintainer-clean-recursive
|
||||||
|
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||||
|
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||||
|
distdir dist dist-all distcheck
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS)
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
distdir = $(PACKAGE)-$(VERSION)
|
||||||
|
top_distdir = $(distdir)
|
||||||
|
am__remove_distdir = \
|
||||||
|
{ test ! -d "$(distdir)" \
|
||||||
|
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||||
|
&& rm -fr "$(distdir)"; }; }
|
||||||
|
am__relativize = \
|
||||||
|
dir0=`pwd`; \
|
||||||
|
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||||
|
sed_rest='s,^[^/]*/*,,'; \
|
||||||
|
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||||
|
sed_butlast='s,/*[^/]*$$,,'; \
|
||||||
|
while test -n "$$dir1"; do \
|
||||||
|
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||||
|
if test "$$first" != "."; then \
|
||||||
|
if test "$$first" = ".."; then \
|
||||||
|
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||||
|
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||||
|
else \
|
||||||
|
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||||
|
if test "$$first2" = "$$first"; then \
|
||||||
|
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||||
|
else \
|
||||||
|
dir2="../$$dir2"; \
|
||||||
|
fi; \
|
||||||
|
dir0="$$dir0"/"$$first"; \
|
||||||
|
fi; \
|
||||||
|
fi; \
|
||||||
|
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||||
|
done; \
|
||||||
|
reldir="$$dir2"
|
||||||
|
DIST_ARCHIVES = $(distdir).tar.gz
|
||||||
|
GZIP_ENV = --best
|
||||||
|
distuninstallcheck_listfiles = find . -type f -print
|
||||||
|
distcleancheck_listfiles = find . -type f -print
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AR = @AR@
|
||||||
|
AS = @AS@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AWK = @AWK@
|
||||||
|
BUILD_NR = @BUILD_NR@
|
||||||
|
CC = @CC@
|
||||||
|
CCDEPMODE = @CCDEPMODE@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CXX = @CXX@
|
||||||
|
CXXCPP = @CXXCPP@
|
||||||
|
CXXDEPMODE = @CXXDEPMODE@
|
||||||
|
CXXFLAGS = @CXXFLAGS@
|
||||||
|
CYGPATH_W = @CYGPATH_W@
|
||||||
|
DEFS = @DEFS@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
DSYMUTIL = @DSYMUTIL@
|
||||||
|
DUMPBIN = @DUMPBIN@
|
||||||
|
ECHO_C = @ECHO_C@
|
||||||
|
ECHO_N = @ECHO_N@
|
||||||
|
ECHO_T = @ECHO_T@
|
||||||
|
EGREP = @EGREP@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
FGREP = @FGREP@
|
||||||
|
GREP = @GREP@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
JP3D_BUILD_NR = @JP3D_BUILD_NR@
|
||||||
|
JP3D_MAJOR_NR = @JP3D_MAJOR_NR@
|
||||||
|
JP3D_MINOR_NR = @JP3D_MINOR_NR@
|
||||||
|
LD = @LD@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
LIBPNG_CONFIG = @LIBPNG_CONFIG@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LIPO = @LIPO@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAJOR_NR = @MAJOR_NR@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MINOR_NR = @MINOR_NR@
|
||||||
|
MKDIR_P = @MKDIR_P@
|
||||||
|
NM = @NM@
|
||||||
|
NMEDIT = @NMEDIT@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
OTOOL = @OTOOL@
|
||||||
|
OTOOL64 = @OTOOL64@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
|
PACKAGE_STRING = @PACKAGE_STRING@
|
||||||
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
|
PACKAGE_URL = @PACKAGE_URL@
|
||||||
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PKGCONFIG = @PKGCONFIG@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
SED = @SED@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
abs_builddir = @abs_builddir@
|
||||||
|
abs_srcdir = @abs_srcdir@
|
||||||
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
|
ac_ct_CC = @ac_ct_CC@
|
||||||
|
ac_ct_CXX = @ac_ct_CXX@
|
||||||
|
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__leading_dot = @am__leading_dot@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
|
bindir = @bindir@
|
||||||
|
build = @build@
|
||||||
|
build_alias = @build_alias@
|
||||||
|
build_cpu = @build_cpu@
|
||||||
|
build_os = @build_os@
|
||||||
|
build_vendor = @build_vendor@
|
||||||
|
builddir = @builddir@
|
||||||
|
datadir = @datadir@
|
||||||
|
datarootdir = @datarootdir@
|
||||||
|
docdir = @docdir@
|
||||||
|
dvidir = @dvidir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
host = @host@
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_cpu = @host_cpu@
|
||||||
|
host_os = @host_os@
|
||||||
|
host_vendor = @host_vendor@
|
||||||
|
htmldir = @htmldir@
|
||||||
|
includedir = @includedir@
|
||||||
|
infodir = @infodir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
jp3d_dir = @jp3d_dir@
|
||||||
|
jpwl_dir = @jpwl_dir@
|
||||||
|
lcms1includes = @lcms1includes@
|
||||||
|
lcms1libs = @lcms1libs@
|
||||||
|
lcms2includes = @lcms2includes@
|
||||||
|
lcms2libs = @lcms2libs@
|
||||||
|
libdir = @libdir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
localedir = @localedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
|
oldincludedir = @oldincludedir@
|
||||||
|
pdfdir = @pdfdir@
|
||||||
|
pngincludes = @pngincludes@
|
||||||
|
pnglibs = @pnglibs@
|
||||||
|
prefix = @prefix@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
psdir = @psdir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
target = @target@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
target_cpu = @target_cpu@
|
||||||
|
target_os = @target_os@
|
||||||
|
target_vendor = @target_vendor@
|
||||||
|
tiffincludes = @tiffincludes@
|
||||||
|
tifflibs = @tifflibs@
|
||||||
|
top_build_prefix = @top_build_prefix@
|
||||||
|
top_builddir = @top_builddir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
with_doxygen = @with_doxygen@
|
||||||
|
|
||||||
|
#OpenJPEG top source directory
|
||||||
|
SUBDIRS = libopenjpeg codec mj2 @jpwl_dir@ @jp3d_dir@ doc
|
||||||
|
pkgconf_dir = /usr/lib/pkgconfig
|
||||||
|
all: opj_config.h
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
am--refresh:
|
||||||
|
@:
|
||||||
|
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
|
||||||
|
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
|
||||||
|
&& exit 0; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
|
||||||
|
$(am__cd) $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --foreign Makefile
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
echo ' $(SHELL) ./config.status'; \
|
||||||
|
$(SHELL) ./config.status;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
$(SHELL) ./config.status --recheck
|
||||||
|
|
||||||
|
$(top_srcdir)/configure: $(am__configure_deps)
|
||||||
|
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||||
|
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||||
|
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||||
|
$(am__aclocal_m4_deps):
|
||||||
|
|
||||||
|
opj_config.h: stamp-h1
|
||||||
|
@if test ! -f $@; then \
|
||||||
|
rm -f stamp-h1; \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||||
|
else :; fi
|
||||||
|
|
||||||
|
stamp-h1: $(srcdir)/opj_config.h.in $(top_builddir)/config.status
|
||||||
|
@rm -f stamp-h1
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status opj_config.h
|
||||||
|
$(srcdir)/opj_config.h.in: $(am__configure_deps)
|
||||||
|
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||||
|
rm -f stamp-h1
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
distclean-hdr:
|
||||||
|
-rm -f opj_config.h stamp-h1
|
||||||
|
libopenjpeg.pc: $(top_builddir)/config.status $(srcdir)/libopenjpeg.pc.in
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
distclean-libtool:
|
||||||
|
-rm -f libtool config.lt
|
||||||
|
|
||||||
|
# This directory's subdirectories are mostly independent; you can cd
|
||||||
|
# into them and run `make' without going through this Makefile.
|
||||||
|
# To change the values of `make' variables: instead of editing Makefiles,
|
||||||
|
# (1) if the variable is set in `config.status', edit `config.status'
|
||||||
|
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||||
|
# (2) otherwise, pass the desired values on the `make' command line.
|
||||||
|
$(RECURSIVE_TARGETS):
|
||||||
|
@fail= failcom='exit 1'; \
|
||||||
|
for f in x $$MAKEFLAGS; do \
|
||||||
|
case $$f in \
|
||||||
|
*=* | --[!k]*);; \
|
||||||
|
*k*) failcom='fail=yes';; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
dot_seen=no; \
|
||||||
|
target=`echo $@ | sed s/-recursive//`; \
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
echo "Making $$target in $$subdir"; \
|
||||||
|
if test "$$subdir" = "."; then \
|
||||||
|
dot_seen=yes; \
|
||||||
|
local_target="$$target-am"; \
|
||||||
|
else \
|
||||||
|
local_target="$$target"; \
|
||||||
|
fi; \
|
||||||
|
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||||
|
|| eval $$failcom; \
|
||||||
|
done; \
|
||||||
|
if test "$$dot_seen" = "no"; then \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||||
|
fi; test -z "$$fail"
|
||||||
|
|
||||||
|
$(RECURSIVE_CLEAN_TARGETS):
|
||||||
|
@fail= failcom='exit 1'; \
|
||||||
|
for f in x $$MAKEFLAGS; do \
|
||||||
|
case $$f in \
|
||||||
|
*=* | --[!k]*);; \
|
||||||
|
*k*) failcom='fail=yes';; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
dot_seen=no; \
|
||||||
|
case "$@" in \
|
||||||
|
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||||
|
*) list='$(SUBDIRS)' ;; \
|
||||||
|
esac; \
|
||||||
|
rev=''; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = "."; then :; else \
|
||||||
|
rev="$$subdir $$rev"; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
|
rev="$$rev ."; \
|
||||||
|
target=`echo $@ | sed s/-recursive//`; \
|
||||||
|
for subdir in $$rev; do \
|
||||||
|
echo "Making $$target in $$subdir"; \
|
||||||
|
if test "$$subdir" = "."; then \
|
||||||
|
local_target="$$target-am"; \
|
||||||
|
else \
|
||||||
|
local_target="$$target"; \
|
||||||
|
fi; \
|
||||||
|
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||||
|
|| eval $$failcom; \
|
||||||
|
done && test -z "$$fail"
|
||||||
|
tags-recursive:
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||||
|
done
|
||||||
|
ctags-recursive:
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||||
|
done
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
mkid -fID $$unique
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
TAGS: tags-recursive $(HEADERS) $(SOURCES) opj_config.h.in $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
set x; \
|
||||||
|
here=`pwd`; \
|
||||||
|
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||||
|
include_option=--etags-include; \
|
||||||
|
empty_fix=.; \
|
||||||
|
else \
|
||||||
|
include_option=--include; \
|
||||||
|
empty_fix=; \
|
||||||
|
fi; \
|
||||||
|
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
test ! -f $$subdir/TAGS || \
|
||||||
|
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||||
|
fi; \
|
||||||
|
done; \
|
||||||
|
list='$(SOURCES) $(HEADERS) opj_config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
shift; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
if test $$# -gt 0; then \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
"$$@" $$unique; \
|
||||||
|
else \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$unique; \
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
ctags: CTAGS
|
||||||
|
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) opj_config.h.in $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
list='$(SOURCES) $(HEADERS) opj_config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
test -z "$(CTAGS_ARGS)$$unique" \
|
||||||
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
|
$$unique
|
||||||
|
|
||||||
|
GTAGS:
|
||||||
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
|
&& $(am__cd) $(top_srcdir) \
|
||||||
|
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
$(am__remove_distdir)
|
||||||
|
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||||
|
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
list='$(DISTFILES)'; \
|
||||||
|
dist_files=`for file in $$list; do echo $$file; done | \
|
||||||
|
sed -e "s|^$$srcdirstrip/||;t" \
|
||||||
|
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||||
|
case $$dist_files in \
|
||||||
|
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||||
|
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||||
|
sort -u` ;; \
|
||||||
|
esac; \
|
||||||
|
for file in $$dist_files; do \
|
||||||
|
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test -d "$(distdir)/$$file"; then \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||||
|
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
else \
|
||||||
|
test -f "$(distdir)/$$file" \
|
||||||
|
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
test -d "$(distdir)/$$subdir" \
|
||||||
|
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||||
|
if test "$$subdir" = .; then :; else \
|
||||||
|
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||||
|
$(am__relativize); \
|
||||||
|
new_distdir=$$reldir; \
|
||||||
|
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||||
|
$(am__relativize); \
|
||||||
|
new_top_distdir=$$reldir; \
|
||||||
|
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||||
|
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||||
|
($(am__cd) $$subdir && \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) \
|
||||||
|
top_distdir="$$new_top_distdir" \
|
||||||
|
distdir="$$new_distdir" \
|
||||||
|
am__remove_distdir=: \
|
||||||
|
am__skip_length_check=: \
|
||||||
|
am__skip_mode_fix=: \
|
||||||
|
distdir) \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
-test -n "$(am__skip_mode_fix)" \
|
||||||
|
|| find "$(distdir)" -type d ! -perm -755 \
|
||||||
|
-exec chmod u+rwx,go+rx {} \; -o \
|
||||||
|
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||||
|
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||||
|
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||||
|
|| chmod -R a+r "$(distdir)"
|
||||||
|
dist-gzip: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-bzip2: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-lzma: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-xz: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-tarZ: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-shar: distdir
|
||||||
|
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist-zip: distdir
|
||||||
|
-rm -f $(distdir).zip
|
||||||
|
zip -rq $(distdir).zip $(distdir)
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
dist dist-all: distdir
|
||||||
|
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||||
|
$(am__remove_distdir)
|
||||||
|
|
||||||
|
# This target untars the dist file and tries a VPATH configuration. Then
|
||||||
|
# it guarantees that the distribution is self-contained by making another
|
||||||
|
# tarfile.
|
||||||
|
distcheck: dist
|
||||||
|
case '$(DIST_ARCHIVES)' in \
|
||||||
|
*.tar.gz*) \
|
||||||
|
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||||
|
*.tar.bz2*) \
|
||||||
|
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||||
|
*.tar.lzma*) \
|
||||||
|
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||||
|
*.tar.xz*) \
|
||||||
|
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||||
|
*.tar.Z*) \
|
||||||
|
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||||
|
*.shar.gz*) \
|
||||||
|
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||||
|
*.zip*) \
|
||||||
|
unzip $(distdir).zip ;;\
|
||||||
|
esac
|
||||||
|
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||||
|
mkdir $(distdir)/_build
|
||||||
|
mkdir $(distdir)/_inst
|
||||||
|
chmod a-w $(distdir)
|
||||||
|
test -d $(distdir)/_build || exit 0; \
|
||||||
|
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||||
|
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||||
|
&& am__cwd=`pwd` \
|
||||||
|
&& $(am__cd) $(distdir)/_build \
|
||||||
|
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||||
|
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||||
|
distuninstallcheck \
|
||||||
|
&& chmod -R a-w "$$dc_install_base" \
|
||||||
|
&& ({ \
|
||||||
|
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||||
|
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||||
|
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||||
|
&& rm -rf "$$dc_destdir" \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||||
|
&& rm -rf $(DIST_ARCHIVES) \
|
||||||
|
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||||
|
&& cd "$$am__cwd" \
|
||||||
|
|| exit 1
|
||||||
|
$(am__remove_distdir)
|
||||||
|
@(echo "$(distdir) archives ready for distribution: "; \
|
||||||
|
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||||
|
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||||
|
distuninstallcheck:
|
||||||
|
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||||
|
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||||
|
|| { echo "ERROR: files left after uninstall:" ; \
|
||||||
|
if test -n "$(DESTDIR)"; then \
|
||||||
|
echo " (check DESTDIR support)"; \
|
||||||
|
fi ; \
|
||||||
|
$(distuninstallcheck_listfiles) ; \
|
||||||
|
exit 1; } >&2
|
||||||
|
distcleancheck: distclean
|
||||||
|
@if test '$(srcdir)' = . ; then \
|
||||||
|
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||||
|
exit 1 ; \
|
||||||
|
fi
|
||||||
|
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||||
|
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||||
|
$(distcleancheck_listfiles) ; \
|
||||||
|
exit 1; } >&2
|
||||||
|
check-am: all-am
|
||||||
|
check: check-recursive
|
||||||
|
all-am: Makefile opj_config.h
|
||||||
|
installdirs: installdirs-recursive
|
||||||
|
installdirs-am:
|
||||||
|
install: install-recursive
|
||||||
|
install-exec: install-exec-recursive
|
||||||
|
install-data: install-data-recursive
|
||||||
|
uninstall: uninstall-recursive
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-recursive
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-recursive
|
||||||
|
|
||||||
|
clean-am: clean-generic clean-libtool clean-local mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-recursive
|
||||||
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-generic distclean-hdr \
|
||||||
|
distclean-libtool distclean-local distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-recursive
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-recursive
|
||||||
|
|
||||||
|
html-am:
|
||||||
|
|
||||||
|
info: info-recursive
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||||
|
install-dvi: install-dvi-recursive
|
||||||
|
|
||||||
|
install-dvi-am:
|
||||||
|
|
||||||
|
install-exec-am:
|
||||||
|
|
||||||
|
install-html: install-html-recursive
|
||||||
|
|
||||||
|
install-html-am:
|
||||||
|
|
||||||
|
install-info: install-info-recursive
|
||||||
|
|
||||||
|
install-info-am:
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
install-pdf: install-pdf-recursive
|
||||||
|
|
||||||
|
install-pdf-am:
|
||||||
|
|
||||||
|
install-ps: install-ps-recursive
|
||||||
|
|
||||||
|
install-ps-am:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-recursive
|
||||||
|
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||||
|
-rm -rf $(top_srcdir)/autom4te.cache
|
||||||
|
-rm -f Makefile
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-recursive
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||||
|
|
||||||
|
pdf: pdf-recursive
|
||||||
|
|
||||||
|
pdf-am:
|
||||||
|
|
||||||
|
ps: ps-recursive
|
||||||
|
|
||||||
|
ps-am:
|
||||||
|
|
||||||
|
uninstall-am:
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
|
||||||
|
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||||
|
ctags-recursive install-am install-data-am install-strip \
|
||||||
|
tags-recursive uninstall-am
|
||||||
|
|
||||||
|
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||||
|
all all-am am--refresh check check-am clean clean-generic \
|
||||||
|
clean-libtool clean-local ctags ctags-recursive dist dist-all \
|
||||||
|
dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \
|
||||||
|
dist-zip distcheck distclean distclean-generic distclean-hdr \
|
||||||
|
distclean-libtool distclean-local distclean-tags \
|
||||||
|
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||||
|
html-am info info-am install install-am install-data \
|
||||||
|
install-data-am install-data-hook install-dvi install-dvi-am \
|
||||||
|
install-exec install-exec-am install-html install-html-am \
|
||||||
|
install-info install-info-am install-man install-pdf \
|
||||||
|
install-pdf-am install-ps install-ps-am install-strip \
|
||||||
|
installcheck installcheck-am installdirs installdirs-am \
|
||||||
|
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||||
|
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||||
|
tags tags-recursive uninstall uninstall-am uninstall-hook
|
||||||
|
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
@rm -rf bin
|
||||||
|
@l='$(SUBDIRS)'; for f in $$l ; do \
|
||||||
|
rm -f $$f/.report.txt ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
distclean-local: clean-local
|
||||||
|
|
||||||
|
install-data-hook:
|
||||||
|
@echo ""
|
||||||
|
@l='$(SUBDIRS)'; for f in $$l ; do \
|
||||||
|
cat $$f/.report.txt ; \
|
||||||
|
done
|
||||||
|
@echo ""
|
||||||
|
@echo "Installing: libopenjpeg1.pc $(pkgconf_dir)"
|
||||||
|
@echo ""
|
||||||
|
@$(INSTALL) -d $(pkgconf_dir)
|
||||||
|
@cp libopenjpeg.pc $(pkgconf_dir)/libopenjpeg1.pc
|
||||||
|
@(cd $(pkgconf_dir) && $(RM) libopenjpeg.pc && \
|
||||||
|
$(LN_S) libopenjpeg1.pc libopenjpeg.pc)
|
||||||
|
|
||||||
|
uninstall-hook:
|
||||||
|
@(cd $(pkgconf_dir) && $(RM) libopenjpeg.pc libopenjpeg1.pc)
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
183
Makefile.nix
Normal file
183
Makefile.nix
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
#top Makefile.nix
|
||||||
|
include config.nix
|
||||||
|
|
||||||
|
TARGET = openjpeg
|
||||||
|
COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
|
||||||
|
|
||||||
|
INCLUDE = -I. -Ilibopenjpeg
|
||||||
|
LIBRARIES = -lstdc++
|
||||||
|
|
||||||
|
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c \
|
||||||
|
./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c \
|
||||||
|
./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c \
|
||||||
|
./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c \
|
||||||
|
./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c \
|
||||||
|
./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c \
|
||||||
|
|
||||||
|
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h \
|
||||||
|
./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h \
|
||||||
|
./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h \
|
||||||
|
./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h \
|
||||||
|
./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h \
|
||||||
|
./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h \
|
||||||
|
./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h \
|
||||||
|
./libopenjpeg/opj_includes.h
|
||||||
|
|
||||||
|
INSTALL_LIBDIR = $(prefix)/lib
|
||||||
|
headerdir = openjpeg-$(MAJOR).$(MINOR)
|
||||||
|
INSTALL_INCLUDE = $(prefix)/include/$(headerdir)
|
||||||
|
|
||||||
|
# Converts cr/lf to just lf
|
||||||
|
DOS2UNIX = dos2unix
|
||||||
|
|
||||||
|
MODULES = $(SRCS:.c=.o)
|
||||||
|
|
||||||
|
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
||||||
|
|
||||||
|
LIBNAME = lib$(TARGET)
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_SHARED),yes)
|
||||||
|
SHAREDLIB = $(LIBNAME).so.$(MAJOR).$(MINOR).$(BUILD)
|
||||||
|
else
|
||||||
|
STATICLIB = $(LIBNAME).a
|
||||||
|
endif
|
||||||
|
|
||||||
|
default: all
|
||||||
|
|
||||||
|
all: OpenJPEG
|
||||||
|
make -C codec -f Makefile.nix all
|
||||||
|
make -C mj2 -f Makefile.nix all
|
||||||
|
ifeq ($(WITH_JPWL),yes)
|
||||||
|
make -C jpwl -f Makefile.nix all
|
||||||
|
endif
|
||||||
|
ifeq ($(WITH_JP3D),yes)
|
||||||
|
make -C jp3d -f Makefile.nix all
|
||||||
|
endif
|
||||||
|
|
||||||
|
dos2unix:
|
||||||
|
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||||
|
|
||||||
|
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
||||||
|
install -d bin
|
||||||
|
ifeq ($(ENABLE_SHARED),yes)
|
||||||
|
install -m 755 $(SHAREDLIB) bin
|
||||||
|
(cd bin && ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR).$(MINOR))
|
||||||
|
(cd bin && ln -sf $(SHAREDLIB) $(LIBNAME).so)
|
||||||
|
else
|
||||||
|
install -m 644 $(STATICLIB) bin
|
||||||
|
endif
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_SHARED),yes)
|
||||||
|
$(SHAREDLIB): $(MODULES)
|
||||||
|
$(CC) -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
||||||
|
else
|
||||||
|
$(STATICLIB): $(MODULES)
|
||||||
|
rm -f $(STATICLIB)
|
||||||
|
$(AR) r $@ $(MODULES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
install: OpenJPEG
|
||||||
|
install -d $(DESTDIR)$(INSTALL_LIBDIR)
|
||||||
|
ifeq ($(ENABLE_SHARED),yes)
|
||||||
|
install -m 755 -o root -g root $(SHAREDLIB) $(DESTDIR)$(INSTALL_LIBDIR)
|
||||||
|
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \
|
||||||
|
ln -sf $(SHAREDLIB) $(LIBNAME).so.$(MAJOR).$(MINOR) )
|
||||||
|
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \
|
||||||
|
ln -sf $(SHAREDLIB) $(LIBNAME).so )
|
||||||
|
else
|
||||||
|
install -m 644 -o root -g root $(STATICLIB) $(DESTDIR)$(INSTALL_LIBDIR)
|
||||||
|
(cd $(DESTDIR)$(INSTALL_LIBDIR) && ranlib $(STATICLIB) )
|
||||||
|
endif
|
||||||
|
install -d $(DESTDIR)$(INSTALL_INCLUDE)
|
||||||
|
install -m 644 -o root -g root libopenjpeg/openjpeg.h \
|
||||||
|
$(DESTDIR)$(INSTALL_INCLUDE)
|
||||||
|
(cd $(DESTDIR)$(prefix)/include && \
|
||||||
|
ln -sf $(headerdir)/openjpeg.h openjpeg.h)
|
||||||
|
make -C codec -f Makefile.nix install
|
||||||
|
make -C mj2 -f Makefile.nix install
|
||||||
|
ifeq ($(WITH_JPWL),yes)
|
||||||
|
make -C jpwl -f Makefile.nix install
|
||||||
|
endif
|
||||||
|
ifeq ($(WITH_JP3D),yes)
|
||||||
|
make -C jp3d -f Makefile.nix install
|
||||||
|
endif
|
||||||
|
$(LDCONFIG)
|
||||||
|
make -C doc -f Makefile.nix install
|
||||||
|
|
||||||
|
ifeq ($(WITH_JPWL),yes)
|
||||||
|
jpwl-all:
|
||||||
|
make -C jpwl -f Makefile.nix all
|
||||||
|
|
||||||
|
jpwl-install: jpwl-all
|
||||||
|
make -C jpwl -f Makefile.nix install
|
||||||
|
$(LDCONFIG)
|
||||||
|
|
||||||
|
jpwl-clean:
|
||||||
|
make -C jpwl -f Makefile.nix clean
|
||||||
|
|
||||||
|
jpwl-uninstall:
|
||||||
|
make -C jpwl -f Makefile.nix uninstall
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_JP3D),yes)
|
||||||
|
jp3d-all:
|
||||||
|
make -C jp3d -f Makefile.nix all
|
||||||
|
|
||||||
|
jp3d-install: jp3d-all
|
||||||
|
make -C jp3d -f Makefile.nix install
|
||||||
|
$(LDCONFIG)
|
||||||
|
|
||||||
|
jp3d-clean:
|
||||||
|
make -C jp3d -f Makefile.nix clean
|
||||||
|
|
||||||
|
jp3d-uninstall:
|
||||||
|
make -C jp3d -f Makefile.nix uninstall
|
||||||
|
endif
|
||||||
|
|
||||||
|
doc-all:
|
||||||
|
make -C doc -f Makefile.nix all
|
||||||
|
|
||||||
|
doc-install: doc-all
|
||||||
|
make -C doc -f Makefile.nix install
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf bin
|
||||||
|
rm -f core u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB)
|
||||||
|
make -C codec -f Makefile.nix clean
|
||||||
|
make -C mj2 -f Makefile.nix clean
|
||||||
|
make -C doc -f Makefile.nix clean
|
||||||
|
ifeq ($(WITH_JPWL),yes)
|
||||||
|
make -C jpwl -f Makefile.nix clean
|
||||||
|
endif
|
||||||
|
ifeq ($(WITH_JP3D),yes)
|
||||||
|
make -C jp3d -f Makefile.nix clean
|
||||||
|
endif
|
||||||
|
|
||||||
|
doc-clean:
|
||||||
|
make -C doc -f Makefile.nix clean
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
ifeq ($(ENABLE_SHARED),yes)
|
||||||
|
(cd $(DESTDIR)$(INSTALL_LIBDIR) && \
|
||||||
|
rm -f $(LIBNAME).so $(LIBNAME).so.$(MAJOR).$(MINOR) $(SHAREDLIB) )
|
||||||
|
else
|
||||||
|
rm -f $(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)
|
||||||
|
endif
|
||||||
|
$(LDCONFIG)
|
||||||
|
rm -f $(DESTDIR)$(prefix)/include/openjpeg.h
|
||||||
|
rm -rf $(DESTDIR)$(INSTALL_INCLUDE)
|
||||||
|
make -C codec -f Makefile.nix uninstall
|
||||||
|
make -C mj2 -f Makefile.nix uninstall
|
||||||
|
make -C doc -f Makefile.nix uninstall
|
||||||
|
ifeq ($(WITH_JPWL),yes)
|
||||||
|
make -C jpwl -f Makefile.nix uninstall
|
||||||
|
endif
|
||||||
|
ifeq ($(WITH_JP3D),yes)
|
||||||
|
make -C jp3d -f Makefile.nix uninstall
|
||||||
|
endif
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -rf bin
|
||||||
66
Makefile.osx
66
Makefile.osx
@@ -1,66 +0,0 @@
|
|||||||
# MacOSX makefile for OpenJPEG
|
|
||||||
|
|
||||||
VER_MAJOR = 2
|
|
||||||
VER_MINOR = 1.2.0
|
|
||||||
|
|
||||||
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
|
|
||||||
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
|
|
||||||
INCLUDE = -Ilibopenjpeg
|
|
||||||
|
|
||||||
# General configuration variables:
|
|
||||||
CC = gcc
|
|
||||||
LIBTOOLSTAT = libtool
|
|
||||||
LIBTOOLDYN = gcc
|
|
||||||
|
|
||||||
PREFIX = /usr
|
|
||||||
INSTALL_LIBDIR = $(PREFIX)/lib
|
|
||||||
INSTALL_INCLUDE = $(PREFIX)/include
|
|
||||||
|
|
||||||
COMPILERFLAGS = -O3 -fPIC
|
|
||||||
|
|
||||||
MODULES = $(SRCS:.c=.o)
|
|
||||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
|
||||||
|
|
||||||
TARGET = openjpeg
|
|
||||||
STATICLIB = lib$(TARGET).a
|
|
||||||
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
|
|
||||||
LIBNAME = lib$(TARGET).dylib
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default: all
|
|
||||||
|
|
||||||
all: OpenJPEG
|
|
||||||
|
|
||||||
dos2unix:
|
|
||||||
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
|
||||||
|
|
||||||
dist: OpenJPEG
|
|
||||||
install -d dist
|
|
||||||
install -m 644 $(STATICLIB) dist
|
|
||||||
install -m 755 $(SHAREDLIB) dist
|
|
||||||
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
|
||||||
install libopenjpeg/openjpeg.h dist
|
|
||||||
|
|
||||||
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(STATICLIB): $(MODULES)
|
|
||||||
$(LIBTOOLSTAT) -o $@ $(MODULES)
|
|
||||||
|
|
||||||
$(SHAREDLIB): $(MODULES)
|
|
||||||
$(LIBTOOLDYN) -dynamiclib -o $@ $(MODULES)
|
|
||||||
|
|
||||||
install:
|
|
||||||
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
|
||||||
install -m 644 -o root -g wheel $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
|
||||||
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
|
||||||
install -m 755 -o root -g wheel $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
|
||||||
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
|
||||||
install -m 644 -o root -g wheel ./libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
|
||||||
|
|
||||||
@@ -4,9 +4,9 @@
|
|||||||
CC = $(shell wx-config-2.8 --cxx)
|
CC = $(shell wx-config-2.8 --cxx)
|
||||||
AR = ar
|
AR = ar
|
||||||
|
|
||||||
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL
|
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL
|
||||||
|
|
||||||
OPJV_SRCS = source/imagj2k.cpp source/imagmj2.cpp source/wxj2kparser.cpp source/imagjp2.cpp source/OPJViewer.cpp source/wxjp2parser.cpp source/OPJViewer.cpp source/OPJThreads.cpp
|
OPJV_SRCS = source/imagjpeg2000.cpp source/wxj2kparser.cpp source/OPJViewer.cpp source/wxjp2parser.cpp source/OPJDialogs.cpp source/OPJThreads.cpp source/OPJAbout.cpp ../codec/index.c
|
||||||
|
|
||||||
MODULES = $(OPJV_SRCS:.cpp=.o)
|
MODULES = $(OPJV_SRCS:.cpp=.o)
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ lib:
|
|||||||
cd ../jpwl; make
|
cd ../jpwl; make
|
||||||
|
|
||||||
opjviewer: $(OPJV_SRCS) lib
|
opjviewer: $(OPJV_SRCS) lib
|
||||||
$(CC) $(CFLAGS) -I .. $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
$(CC) $(CFLAGS) -I .. -I ../codec -I ../libopenjpeg $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ RSC=rc.exe
|
|||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /I "../libopenjpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /D "USE_MXF" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c
|
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "$(WXWIN28)\lib\vc_lib\msw" /I "$(WXWIN28)\include" /I ".." /I "..\libopenjpeg" /I "$(MXFLIB)" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /Zm200 /c
|
||||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /i "d:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
|
# ADD RSC /l 0x409 /i "$(WXWIN28)\include" /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib mxflib.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"$(WXWIN28)\lib\vc_lib" /libpath:"..\jpwl\Release" /libpath:"$(MXFLIB)\build\msvc\Release" /IGNORE:4089
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none /nodefaultlib
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
SOURCE="$(InputPath)"
|
SOURCE="$(InputPath)"
|
||||||
PostBuild_Desc=Update build number
|
PostBuild_Desc=Update build number
|
||||||
@@ -72,15 +72,15 @@ PostBuild_Cmds=buildupdate.bat
|
|||||||
# PROP Ignore_Export_Lib 0
|
# PROP Ignore_Export_Lib 0
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "$(WXWIN28)\INCLUDE" /I "$(WXWIN28)\lib\vc_lib\msw" /I "$(WXWIN28)\include" /I ".." /I "..\libopenjpeg" /I "$(MXFLIB)" /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /D "OPJ_INICONFIG" /D "OPJ_MANYFORMATS" /D "USE_JPSEC" /FR /FD /GZ /Zm200 /c
|
||||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x410 /i "c:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
|
# ADD RSC /l 0x410 /i "$(WXWIN28)\include" /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD BSC32 /nologo
|
# ADD BSC32 /nologo
|
||||||
LINK32=link.exe
|
LINK32=link.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib mxflib.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"$(WXWIN28)\lib\vc_lib" /libpath:"..\jpwl\Debug" /libpath:"$(MXFLIB)\build\msvc\Debug"
|
||||||
# SUBTRACT LINK32 /pdb:none
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
!ENDIF
|
!ENDIF
|
||||||
@@ -94,20 +94,7 @@ LINK32=link.exe
|
|||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\source\imagj2k.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagjp2.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagjpeg2000.cpp
|
SOURCE=.\source\imagjpeg2000.cpp
|
||||||
# PROP Exclude_From_Build 1
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagmj2.cpp
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
@@ -152,27 +139,11 @@ SOURCE=.\source\about_htm.h
|
|||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\source\build.h
|
SOURCE=.\source\build.h
|
||||||
|
|
||||||
!IF "$(CFG)" == "OPJViewer - Win32 Release"
|
|
||||||
|
|
||||||
# PROP Exclude_From_Build 1
|
# PROP Exclude_From_Build 1
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\source\imagj2k.h
|
SOURCE=.\source\imagjpeg2000.h
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagjp2.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagmj2.h
|
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,18 @@ Package=<4>
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "mxflib"="..\..\..\..\mxflib-1.0.0\build\msvc\mxflib.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
Global:
|
Global:
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=OPJViewer
|
AppName=OPJViewer
|
||||||
AppVerName=OPJViewer 0.3 alpha
|
AppVerName=OPJViewer 0.4 beta
|
||||||
AppPublisher=OpenJPEG
|
AppPublisher=OpenJPEG
|
||||||
AppPublisherURL=http://www.openjpeg.org
|
AppPublisherURL=http://www.openjpeg.org
|
||||||
AppSupportURL=http://www.openjpeg.org
|
AppSupportURL=http://www.openjpeg.org
|
||||||
@@ -11,13 +11,13 @@ AppUpdatesURL=http://www.openjpeg.org
|
|||||||
DefaultDirName={pf}\OPJViewer
|
DefaultDirName={pf}\OPJViewer
|
||||||
DefaultGroupName=OPJViewer
|
DefaultGroupName=OPJViewer
|
||||||
OutputDir=setup
|
OutputDir=setup
|
||||||
OutputBaseFilename=OPJViewer03alpha_setup
|
OutputBaseFilename=OPJViewer04beta_setup
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=true
|
SolidCompression=true
|
||||||
InfoBeforeFile=source\readmebefore.txt
|
InfoBeforeFile=source\readmebefore.txt
|
||||||
InfoAfterFile=source\readmeafter.txt
|
InfoAfterFile=source\readmeafter.txt
|
||||||
LicenseFile=source\license.txt
|
LicenseFile=source\license.txt
|
||||||
VersionInfoVersion=0.3.0.0
|
VersionInfoVersion=0.4.0.0
|
||||||
VersionInfoCompany=OpenJPEG
|
VersionInfoCompany=OpenJPEG
|
||||||
VersionInfoDescription=JPEG 2000 viewer
|
VersionInfoDescription=JPEG 2000 viewer
|
||||||
ShowLanguageDialog=yes
|
ShowLanguageDialog=yes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
JPEG2000 Visualization Software - OPJViewer
|
JPEG2000 Visualization Software - OPJViewer
|
||||||
|
|
||||||
Version 0.3 alpha
|
Version 0.4 beta
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
|
|
||||||
@@ -38,6 +38,11 @@ f) Build!
|
|||||||
g) Run!
|
g) Run!
|
||||||
h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).
|
h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).
|
||||||
|
|
||||||
|
2.1.1 Additional libraries
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
Since we are also working on the Digital Cinema JPEG 2000, we are integrating the viewer with the MXF library, which is used to prepare the DCPs for digital movies. You can enable its linking in the code by specifying the USE_MXF preprocessor directive but, remember, the integration is at a very early stage.
|
||||||
|
|
||||||
2.2. Compiling the source code in Unix-like systems
|
2.2. Compiling the source code in Unix-like systems
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
87
OPJViewer/source/OPJAbout.cpp
Normal file
87
OPJViewer/source/OPJAbout.cpp
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'<27> degli studi di Perugia (UPG), Italy
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#ifdef USE_MXF
|
||||||
|
#include "mxflib/mxflib.h"
|
||||||
|
#endif // USE_MXF
|
||||||
|
|
||||||
|
#include "OPJViewer.h"
|
||||||
|
|
||||||
|
// about window for the frame
|
||||||
|
void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
#ifdef OPJ_HTMLABOUT
|
||||||
|
#include "about_htm.h"
|
||||||
|
#include "opj_logo.xpm"
|
||||||
|
|
||||||
|
wxBoxSizer *topsizer;
|
||||||
|
wxHtmlWindow *html;
|
||||||
|
wxDialog dlg(this, wxID_ANY, wxString(_("About")));
|
||||||
|
|
||||||
|
wxMemoryFSHandler::AddFile(wxT("opj_logo.xpm"), wxBitmap(opj_logo), wxBITMAP_TYPE_XPM);
|
||||||
|
|
||||||
|
topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(320, 250), wxHW_SCROLLBAR_NEVER);
|
||||||
|
html->SetBorders(0);
|
||||||
|
//html->LoadPage(wxT("about/about.htm"));
|
||||||
|
//html->SetPage("<html><body>Hello, world!</body></html>");
|
||||||
|
html->SetPage(htmlaboutpage);
|
||||||
|
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
|
||||||
|
html->GetInternalRepresentation()->GetHeight());
|
||||||
|
|
||||||
|
topsizer->Add(html, 1, wxALL, 10);
|
||||||
|
|
||||||
|
topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
|
wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK"));
|
||||||
|
bu1->SetDefault();
|
||||||
|
|
||||||
|
topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
|
||||||
|
|
||||||
|
dlg.SetSizer(topsizer);
|
||||||
|
topsizer->Fit(&dlg);
|
||||||
|
|
||||||
|
dlg.ShowModal();
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
wxMessageBox(wxString::Format(OPJ_APPLICATION_TITLEBAR
|
||||||
|
wxT("\n\n")
|
||||||
|
wxT("Built with %s and OpenJPEG ")
|
||||||
|
wxT(OPENJPEG_VERSION)
|
||||||
|
wxT("\non ") wxT(__DATE__) wxT(", ") wxT(__TIME__)
|
||||||
|
wxT("\nRunning under %s\n\n")
|
||||||
|
OPJ_APPLICATION_COPYRIGHT,
|
||||||
|
wxVERSION_STRING,
|
||||||
|
wxGetOsDescription().c_str()),
|
||||||
|
wxT("About ") OPJ_APPLICATION_NAME,
|
||||||
|
wxOK | wxICON_INFORMATION,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
@@ -86,37 +86,37 @@ void *OPJEncoThread::Entry()
|
|||||||
WriteText(text);
|
WriteText(text);
|
||||||
|
|
||||||
// set handler properties
|
// set handler properties
|
||||||
wxJ2KHandler *j2kkkhandler = (wxJ2KHandler *) wxImage::FindHandler( wxBITMAP_TYPE_J2K);
|
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
||||||
j2kkkhandler->m_subsampling = wxGetApp().m_subsampling;
|
jpeg2000handler->m_subsampling = wxGetApp().m_subsampling;
|
||||||
j2kkkhandler->m_origin = wxGetApp().m_origin;
|
jpeg2000handler->m_origin = wxGetApp().m_origin;
|
||||||
j2kkkhandler->m_rates = wxGetApp().m_rates;
|
jpeg2000handler->m_rates = wxGetApp().m_rates;
|
||||||
j2kkkhandler->m_quality = wxGetApp().m_quality;
|
jpeg2000handler->m_quality = wxGetApp().m_quality;
|
||||||
j2kkkhandler->m_enablequality = wxGetApp().m_enablequality;
|
jpeg2000handler->m_enablequality = wxGetApp().m_enablequality;
|
||||||
j2kkkhandler->m_multicomp = wxGetApp().m_multicomp;
|
jpeg2000handler->m_multicomp = wxGetApp().m_multicomp;
|
||||||
j2kkkhandler->m_irreversible = wxGetApp().m_irreversible;
|
jpeg2000handler->m_irreversible = wxGetApp().m_irreversible;
|
||||||
j2kkkhandler->m_resolutions = wxGetApp().m_resolutions;
|
jpeg2000handler->m_resolutions = wxGetApp().m_resolutions;
|
||||||
j2kkkhandler->m_progression = wxGetApp().m_progression;
|
jpeg2000handler->m_progression = wxGetApp().m_progression;
|
||||||
j2kkkhandler->m_cbsize = wxGetApp().m_cbsize;
|
jpeg2000handler->m_cbsize = wxGetApp().m_cbsize;
|
||||||
j2kkkhandler->m_prsize = wxGetApp().m_prsize;
|
jpeg2000handler->m_prsize = wxGetApp().m_prsize;
|
||||||
j2kkkhandler->m_tsize = wxGetApp().m_tsize;
|
jpeg2000handler->m_tsize = wxGetApp().m_tsize;
|
||||||
j2kkkhandler->m_torigin = wxGetApp().m_torigin;
|
jpeg2000handler->m_torigin = wxGetApp().m_torigin;
|
||||||
j2kkkhandler->m_enablesop = wxGetApp().m_enablesop;
|
jpeg2000handler->m_enablesop = wxGetApp().m_enablesop;
|
||||||
j2kkkhandler->m_enableeph = wxGetApp().m_enableeph;
|
jpeg2000handler->m_enableeph = wxGetApp().m_enableeph;
|
||||||
j2kkkhandler->m_enablebypass = wxGetApp().m_enablebypass;
|
jpeg2000handler->m_enablebypass = wxGetApp().m_enablebypass;
|
||||||
j2kkkhandler->m_enablerestart = wxGetApp().m_enablerestart;
|
jpeg2000handler->m_enablerestart = wxGetApp().m_enablerestart;
|
||||||
j2kkkhandler->m_enablereset = wxGetApp().m_enablereset;
|
jpeg2000handler->m_enablereset = wxGetApp().m_enablereset;
|
||||||
j2kkkhandler->m_enablesegmark = wxGetApp().m_enablesegmark;
|
jpeg2000handler->m_enablesegmark = wxGetApp().m_enablesegmark;
|
||||||
j2kkkhandler->m_enableerterm = wxGetApp().m_enableerterm;
|
jpeg2000handler->m_enableerterm = wxGetApp().m_enableerterm;
|
||||||
j2kkkhandler->m_enablevsc = wxGetApp().m_enablevsc;
|
jpeg2000handler->m_enablevsc = wxGetApp().m_enablevsc;
|
||||||
j2kkkhandler->m_enableidx = wxGetApp().m_enableidx;
|
jpeg2000handler->m_enableidx = wxGetApp().m_enableidx;
|
||||||
j2kkkhandler->m_index = m_canvas->m_savename.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxGetApp().m_index;
|
jpeg2000handler->m_index = m_canvas->m_savename.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxGetApp().m_index;
|
||||||
j2kkkhandler->m_enablecomm = wxGetApp().m_enablecomm;
|
jpeg2000handler->m_enablecomm = wxGetApp().m_enablecomm;
|
||||||
j2kkkhandler->m_comment = wxGetApp().m_comment;
|
jpeg2000handler->m_comment = wxGetApp().m_comment;
|
||||||
j2kkkhandler->m_enablepoc = wxGetApp().m_enablepoc;
|
jpeg2000handler->m_enablepoc = wxGetApp().m_enablepoc;
|
||||||
j2kkkhandler->m_poc = wxGetApp().m_poc;
|
jpeg2000handler->m_poc = wxGetApp().m_poc;
|
||||||
|
|
||||||
// save the file
|
// save the file
|
||||||
if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(), (wxBitmapType) wxBITMAP_TYPE_J2K)) {
|
if (!m_canvas->m_image100.SaveFile(m_canvas->m_savename.GetFullPath(), (wxBitmapType) wxBITMAP_TYPE_JPEG2000)) {
|
||||||
WriteText(wxT("Can't save image"));
|
WriteText(wxT("Can't save image"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,6 @@ void *OPJEncoThread::Entry()
|
|||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
// Decoding thread class
|
// Decoding thread class
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
||||||
: wxThread()
|
: wxThread()
|
||||||
{
|
{
|
||||||
@@ -141,7 +140,15 @@ OPJDecoThread::OPJDecoThread(OPJCanvas *canvas)
|
|||||||
void OPJDecoThread::WriteText(const wxString& text)
|
void OPJDecoThread::WriteText(const wxString& text)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
// we use a fake event and post it for inter-thread gui communication
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||||
|
event.SetInt(-1);
|
||||||
|
msg << text;
|
||||||
|
event.SetString(msg);
|
||||||
|
wxPostEvent(this->m_canvas->m_childframe->m_frame, event);
|
||||||
|
|
||||||
|
/*
|
||||||
// before doing any GUI calls we must ensure that this thread is the only
|
// before doing any GUI calls we must ensure that this thread is the only
|
||||||
// one doing it!
|
// one doing it!
|
||||||
|
|
||||||
@@ -155,6 +162,7 @@ void OPJDecoThread::WriteText(const wxString& text)
|
|||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJDecoThread::OnExit()
|
void OPJDecoThread::OnExit()
|
||||||
@@ -180,66 +188,63 @@ void *OPJDecoThread::Entry()
|
|||||||
|
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
srand(GetId());
|
//srand(GetId());
|
||||||
//int m_countnum = rand() % 9;
|
//int m_countnum = rand() % 9;
|
||||||
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
//text.Printf(wxT("Deco thread 0x%lx started (priority = %u, time = %d)."),
|
||||||
// GetId(), GetPriority(), m_countnum);
|
// GetId(), GetPriority(), m_countnum);
|
||||||
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
|
||||||
|
|
||||||
|
// we have started
|
||||||
|
text.Printf(wxT("Deco thread %d started"), m_canvas->m_childframe->m_winnumber);
|
||||||
WriteText(text);
|
WriteText(text);
|
||||||
|
|
||||||
|
// prepare dummy wximage
|
||||||
wxBitmap bitmap(100, 100);
|
wxBitmap bitmap(100, 100);
|
||||||
wxImage image(100, 100, true); //= bitmap.ConvertToImage();
|
wxImage image(100, 100, true); //= bitmap.ConvertToImage();
|
||||||
image.Destroy();
|
image.Destroy();
|
||||||
|
|
||||||
|
// show image full name
|
||||||
WriteText(m_canvas->m_fname.GetFullPath());
|
WriteText(m_canvas->m_fname.GetFullPath());
|
||||||
|
|
||||||
|
|
||||||
// set handler properties
|
// set handler properties
|
||||||
wxJ2KHandler *j2kkkhandler = (wxJ2KHandler *) wxImage::FindHandler( wxBITMAP_TYPE_J2K);
|
wxJPEG2000Handler *jpeg2000handler = (wxJPEG2000Handler *) wxImage::FindHandler(wxBITMAP_TYPE_JPEG2000);
|
||||||
j2kkkhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
jpeg2000handler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||||
j2kkkhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
jpeg2000handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||||
j2kkkhandler->m_components = wxGetApp().m_components;
|
jpeg2000handler->m_components = wxGetApp().m_components;
|
||||||
|
jpeg2000handler->m_framenum = wxGetApp().m_framenum;
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
j2kkkhandler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
jpeg2000handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||||
j2kkkhandler->m_expcomps = wxGetApp().m_expcomps;
|
jpeg2000handler->m_expcomps = wxGetApp().m_expcomps;
|
||||||
j2kkkhandler->m_maxtiles = wxGetApp().m_maxtiles;
|
jpeg2000handler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
|
|
||||||
wxJP2Handler *jp222handler = (wxJP2Handler *) wxImage::FindHandler( wxBITMAP_TYPE_JP2);
|
#ifdef USE_MXF
|
||||||
jp222handler->m_reducefactor = wxGetApp().m_reducefactor;
|
wxMXFHandler *mxfffhandler = (wxMXFHandler *) wxImage::FindHandler(wxBITMAP_TYPE_MXF);
|
||||||
jp222handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
mxfffhandler->m_reducefactor = wxGetApp().m_reducefactor;
|
||||||
jp222handler->m_components = wxGetApp().m_components;
|
mxfffhandler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
||||||
|
mxfffhandler->m_components = wxGetApp().m_components;
|
||||||
|
mxfffhandler->m_framenum = wxGetApp().m_framenum;
|
||||||
|
mxfffhandler->m_filename = m_canvas->m_fname;
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
jp222handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
mxfffhandler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
||||||
jp222handler->m_expcomps = wxGetApp().m_expcomps;
|
mxfffhandler->m_expcomps = wxGetApp().m_expcomps;
|
||||||
jp222handler->m_maxtiles = wxGetApp().m_maxtiles;
|
mxfffhandler->m_maxtiles = wxGetApp().m_maxtiles;
|
||||||
#endif // USE_JPWL
|
|
||||||
|
|
||||||
wxMJ2Handler *mj222handler = (wxMJ2Handler *) wxImage::FindHandler( wxBITMAP_TYPE_MJ2);
|
|
||||||
mj222handler->m_reducefactor = wxGetApp().m_reducefactor;
|
|
||||||
mj222handler->m_qualitylayers = wxGetApp().m_qualitylayers;
|
|
||||||
mj222handler->m_components = wxGetApp().m_components;
|
|
||||||
mj222handler->m_framenum = wxGetApp().m_framenum;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
mj222handler->m_enablejpwl = wxGetApp().m_enablejpwl;
|
|
||||||
mj222handler->m_expcomps = wxGetApp().m_expcomps;
|
|
||||||
mj222handler->m_maxtiles = wxGetApp().m_maxtiles;
|
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
|
#endif // USE_MXF
|
||||||
|
|
||||||
|
// if decoding is enabled...
|
||||||
if (wxGetApp().m_enabledeco) {
|
if (wxGetApp().m_enabledeco) {
|
||||||
|
|
||||||
// load the file
|
// load the file
|
||||||
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
if (!image.LoadFile(m_canvas->m_fname.GetFullPath(), wxBITMAP_TYPE_ANY, 0)) {
|
||||||
WriteText(wxT("Can't load image"));
|
WriteText(wxT("Can't load image!"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// display a macaron
|
// display a warning
|
||||||
if (!image.Create(300, 5, false)) {
|
if (!image.Create(300, 5, false)) {
|
||||||
WriteText(wxT("Can't create image"));
|
WriteText(wxT("Can't create image!"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,16 +253,22 @@ void *OPJDecoThread::Entry()
|
|||||||
// assign 100% image
|
// assign 100% image
|
||||||
m_canvas->m_image100 = wxBitmap(image);
|
m_canvas->m_image100 = wxBitmap(image);
|
||||||
|
|
||||||
|
// signal the frame to refresh the canvas
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_VIEWFIT);
|
||||||
|
event.SetString(wxT("Fit me"));
|
||||||
|
event.SetInt(m_canvas->m_childframe->m_winnumber);
|
||||||
|
wxPostEvent(m_canvas->m_childframe->m_frame, event);
|
||||||
|
|
||||||
// find a fit-to-width zoom
|
// find a fit-to-width zoom
|
||||||
int zooml, wzooml, hzooml;
|
/*int zooml, wzooml, hzooml;
|
||||||
wxSize clientsize = m_canvas->GetClientSize();
|
wxSize clientsize = m_canvas->GetClientSize();
|
||||||
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + image.GetWidth()));
|
||||||
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + image.GetHeight()));
|
||||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||||
|
|
||||||
// fit to width
|
// fit to width
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
//m_canvas->m_childframe->m_frame->Rescale(zooml, m_canvas->m_childframe);
|
||||||
#endif // __WXGTK__
|
#endif // __WXGTK__
|
||||||
|
|
||||||
//m_canvas->m_image = m_canvas->m_image100;
|
//m_canvas->m_image = m_canvas->m_image100;
|
||||||
@@ -286,8 +297,15 @@ OPJParseThread::OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid)
|
|||||||
void OPJParseThread::WriteText(const wxString& text)
|
void OPJParseThread::WriteText(const wxString& text)
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
// we use a fake event and post it for inter-thread gui communication
|
||||||
|
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, OPJFRAME_THREADLOGMSG);
|
||||||
|
event.SetInt(-1);
|
||||||
|
msg << text;
|
||||||
|
event.SetString(msg);
|
||||||
|
wxPostEvent(this->m_tree->m_childframe->m_frame, event);
|
||||||
|
|
||||||
// before doing any GUI calls we must ensure that this thread is the only
|
/* // before doing any GUI calls we must ensure that this thread is the only
|
||||||
// one doing it!
|
// one doing it!
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
@@ -299,7 +317,7 @@ void OPJParseThread::WriteText(const wxString& text)
|
|||||||
|
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif // __WXGTK
|
#endif // __WXGTK*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJParseThread::OnExit()
|
void OPJParseThread::OnExit()
|
||||||
@@ -570,7 +588,6 @@ void OPJParseThread::LoadFile(wxFileName fname)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this is the root node
|
// this is the root node
|
||||||
if (this->m_parentid)
|
if (this->m_parentid)
|
||||||
m_tree->SetItemText(rootid, wxT("Codestream"));
|
m_tree->SetItemText(rootid, wxT("Codestream"));
|
||||||
|
|||||||
@@ -165,10 +165,6 @@ bool OPJViewerApp::OnInit(void)
|
|||||||
|
|
||||||
wxCmdLineParser parser(cmdLineDesc, argc, wxArgv);
|
wxCmdLineParser parser(cmdLineDesc, argc, wxArgv);
|
||||||
|
|
||||||
/*parser.AddOption(_T("project_name"), _T(""), _T("full path to project file"),
|
|
||||||
wxCMD_LINE_VAL_STRING,
|
|
||||||
wxCMD_LINE_OPTION_MANDATORY | wxCMD_LINE_NEEDS_SEPARATOR);*/
|
|
||||||
|
|
||||||
switch (parser.Parse()) {
|
switch (parser.Parse()) {
|
||||||
case -1:
|
case -1:
|
||||||
wxLogMessage(wxT("Help was given, terminating."));
|
wxLogMessage(wxT("Help was given, terminating."));
|
||||||
@@ -189,14 +185,12 @@ bool OPJViewerApp::OnInit(void)
|
|||||||
#if wxUSE_LIBJPEG
|
#if wxUSE_LIBJPEG
|
||||||
wxImage::AddHandler( new wxJPEGHandler );
|
wxImage::AddHandler( new wxJPEGHandler );
|
||||||
#endif
|
#endif
|
||||||
|
#if wxUSE_LIBOPENJPEG
|
||||||
|
wxImage::AddHandler( new wxJPEG2000Handler );
|
||||||
|
#endif
|
||||||
#if USE_MXF
|
#if USE_MXF
|
||||||
wxImage::AddHandler( new wxMXFHandler );
|
wxImage::AddHandler( new wxMXFHandler );
|
||||||
#endif // USE_MXF
|
#endif // USE_MXF
|
||||||
#if wxUSE_LIBOPENJPEG
|
|
||||||
wxImage::AddHandler( new wxJ2KHandler );
|
|
||||||
wxImage::AddHandler( new wxJP2Handler );
|
|
||||||
wxImage::AddHandler( new wxMJ2Handler );
|
|
||||||
#endif
|
|
||||||
#if OPJ_MANYFORMATS
|
#if OPJ_MANYFORMATS
|
||||||
wxImage::AddHandler( new wxBMPHandler );
|
wxImage::AddHandler( new wxBMPHandler );
|
||||||
wxImage::AddHandler( new wxPNGHandler );
|
wxImage::AddHandler( new wxPNGHandler );
|
||||||
@@ -474,6 +468,8 @@ void OPJViewerApp::ShowCmdLine(const wxCmdLineParser& parser)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OPJFrame events
|
// OPJFrame events
|
||||||
|
|
||||||
|
// Event class for sending text messages between worker and GUI threads
|
||||||
BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
||||||
EVT_MENU(OPJFRAME_HELPABOUT, OPJFrame::OnAbout)
|
EVT_MENU(OPJFRAME_HELPABOUT, OPJFrame::OnAbout)
|
||||||
EVT_MENU(OPJFRAME_FILEOPEN, OPJFrame::OnFileOpen)
|
EVT_MENU(OPJFRAME_FILEOPEN, OPJFrame::OnFileOpen)
|
||||||
@@ -504,6 +500,7 @@ BEGIN_EVENT_TABLE(OPJFrame, wxMDIParentFrame)
|
|||||||
EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco)
|
EVT_MENU(OPJFRAME_SETSDECO, OPJFrame::OnSetsDeco)
|
||||||
EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag)
|
EVT_SASH_DRAGGED_RANGE(OPJFRAME_BROWSEWIN, OPJFRAME_LOGWIN, OPJFrame::OnSashDrag)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(LEFT_NOTEBOOK_ID, OPJFrame::OnNotebook)
|
EVT_NOTEBOOK_PAGE_CHANGED(LEFT_NOTEBOOK_ID, OPJFrame::OnNotebook)
|
||||||
|
EVT_MENU(OPJFRAME_THREADLOGMSG, OPJFrame::OnThreadLogmsg)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// this is the frame constructor
|
// this is the frame constructor
|
||||||
@@ -921,10 +918,21 @@ void OPJFrame::OnClose(wxCommandEvent& WXUNUSED(event))
|
|||||||
currframe->OnClose(e);
|
currframe->OnClose(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJFrame::OnFit(wxCommandEvent& WXUNUSED(event))
|
void OPJFrame::OnFit(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
OPJChildFrame *currchild;
|
||||||
|
wxString eventstring = event.GetString();
|
||||||
|
|
||||||
|
//wxLogMessage(wxT("OnFit:%d:%s"), event.GetInt(), eventstring);
|
||||||
|
|
||||||
// current child
|
// current child
|
||||||
OPJChildFrame *currchild = (OPJChildFrame *) GetActiveChild();
|
if (event.GetInt() >= 1) {
|
||||||
|
currchild = m_childhash[event.GetInt()];
|
||||||
|
} else {
|
||||||
|
currchild = (OPJChildFrame *) GetActiveChild();
|
||||||
|
}
|
||||||
|
|
||||||
|
// problems
|
||||||
if (!currchild)
|
if (!currchild)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -932,14 +940,14 @@ void OPJFrame::OnFit(wxCommandEvent& WXUNUSED(event))
|
|||||||
OPJCanvas *currcanvas = currchild->m_canvas;
|
OPJCanvas *currcanvas = currchild->m_canvas;
|
||||||
|
|
||||||
// find a fit-to-width zoom
|
// find a fit-to-width zoom
|
||||||
int zooml, wzooml, hzooml;
|
/*int zooml, wzooml, hzooml;
|
||||||
wxSize clientsize = currcanvas->GetClientSize();
|
wxSize clientsize = currcanvas->GetClientSize();
|
||||||
wzooml = (int) ceil(100.0 * (double) (clientsize.GetWidth() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetWidth()));
|
wzooml = (int) ceil(100.0 * (double) (clientsize.GetWidth() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetWidth()));
|
||||||
hzooml = (int) ceil(100.0 * (double) (clientsize.GetHeight() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetHeight()));
|
hzooml = (int) ceil(100.0 * (double) (clientsize.GetHeight() - 2 * OPJ_CANVAS_BORDER) / (double) (currcanvas->m_image100.GetHeight()));
|
||||||
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
zooml = wxMin(100, wxMin(wzooml, hzooml));*/
|
||||||
|
|
||||||
// fit to width
|
// fit to width
|
||||||
Rescale(zooml, currchild);
|
Rescale(-1, currchild);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event))
|
void OPJFrame::OnZoom(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -969,7 +977,20 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
|
|||||||
|
|
||||||
// resizing enabled?
|
// resizing enabled?
|
||||||
if (wxGetApp().m_resizemethod == -1) {
|
if (wxGetApp().m_resizemethod == -1) {
|
||||||
|
|
||||||
zooml = 100;
|
zooml = 100;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (zooml < 0) {
|
||||||
|
// find a fit-to-width zoom
|
||||||
|
int wzooml, hzooml;
|
||||||
|
//wxSize clientsize = currframe->m_canvas->GetClientSize();
|
||||||
|
wxSize clientsize = currframe->m_frame->GetActiveChild()->GetClientSize();
|
||||||
|
wzooml = (int) floor(100.0 * (double) clientsize.GetWidth() / (double) (2 * OPJ_CANVAS_BORDER + currframe->m_canvas->m_image100.GetWidth()));
|
||||||
|
hzooml = (int) floor(100.0 * (double) clientsize.GetHeight() / (double) (2 * OPJ_CANVAS_BORDER + currframe->m_canvas->m_image100.GetHeight()));
|
||||||
|
zooml = wxMin(100, wxMin(wzooml, hzooml));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zooml != 100)
|
if (zooml != 100)
|
||||||
@@ -985,6 +1006,8 @@ void OPJFrame::Rescale(int zooml, OPJChildFrame *currframe)
|
|||||||
|
|
||||||
currframe->m_canvas->Refresh();
|
currframe->m_canvas->Refresh();
|
||||||
|
|
||||||
|
wxLogMessage(wxT("Rescale said %d%%"), zooml);
|
||||||
|
|
||||||
// update zoom
|
// update zoom
|
||||||
currframe->m_canvas->m_zooml = zooml;
|
currframe->m_canvas->m_zooml = zooml;
|
||||||
}
|
}
|
||||||
@@ -1192,6 +1215,36 @@ void OPJFrame::OnSashDrag(wxSashEvent& event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPJFrame::OnThreadLogmsg(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
wxLogMessage(wxT("Frame got message from worker thread: %d"), event.GetInt());
|
||||||
|
wxLogMessage(event.GetString());
|
||||||
|
#else
|
||||||
|
int n = event.GetInt();
|
||||||
|
if ( n == -1 )
|
||||||
|
{
|
||||||
|
m_dlgProgress->Destroy();
|
||||||
|
m_dlgProgress = (wxProgressDialog *)NULL;
|
||||||
|
|
||||||
|
// the dialog is aborted because the event came from another thread, so
|
||||||
|
// we may need to wake up the main event loop for the dialog to be
|
||||||
|
// really closed
|
||||||
|
wxWakeUpIdle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !m_dlgProgress->Update(n) )
|
||||||
|
{
|
||||||
|
wxCriticalSectionLocker lock(m_critsectWork);
|
||||||
|
|
||||||
|
m_cancelled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// physically save the file
|
// physically save the file
|
||||||
void OPJFrame::SaveFile(wxArrayString paths, wxArrayString filenames)
|
void OPJFrame::SaveFile(wxArrayString paths, wxArrayString filenames)
|
||||||
{
|
{
|
||||||
@@ -1357,6 +1410,7 @@ void OPJFrame::OnMemoryOpen(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(OPJCanvas, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(OPJCanvas, wxScrolledWindow)
|
||||||
EVT_MOUSE_EVENTS(OPJCanvas::OnEvent)
|
EVT_MOUSE_EVENTS(OPJCanvas::OnEvent)
|
||||||
|
EVT_MENU(OPJCANVAS_THREADSIGNAL, OPJCanvas::OnThreadSignal)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define a constructor for my canvas
|
// Define a constructor for my canvas
|
||||||
@@ -1462,6 +1516,36 @@ void OPJFrame::OnSize(wxSizeEvent& WXUNUSED(event))
|
|||||||
layout.LayoutMDIFrame(this);
|
layout.LayoutMDIFrame(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPJCanvas::OnThreadSignal(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
#if 1
|
||||||
|
wxLogMessage(wxT("Canvas got signal from deco thread: %d"), event.GetInt());
|
||||||
|
wxLogMessage(event.GetString());
|
||||||
|
#else
|
||||||
|
int n = event.GetInt();
|
||||||
|
if ( n == -1 )
|
||||||
|
{
|
||||||
|
m_dlgProgress->Destroy();
|
||||||
|
m_dlgProgress = (wxProgressDialog *)NULL;
|
||||||
|
|
||||||
|
// the dialog is aborted because the event came from another thread, so
|
||||||
|
// we may need to wake up the main event loop for the dialog to be
|
||||||
|
// really closed
|
||||||
|
wxWakeUpIdle();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !m_dlgProgress->Update(n) )
|
||||||
|
{
|
||||||
|
wxCriticalSectionLocker lock(m_critsectWork);
|
||||||
|
|
||||||
|
m_cancelled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Note that OPJFRAME_FILEOPEN and OPJFRAME_HELPABOUT commands get passed
|
// Note that OPJFRAME_FILEOPEN and OPJFRAME_HELPABOUT commands get passed
|
||||||
// to the parent window for processing, so no need to
|
// to the parent window for processing, so no need to
|
||||||
// duplicate event handlers here.
|
// duplicate event handlers here.
|
||||||
|
|||||||
@@ -103,9 +103,10 @@
|
|||||||
|
|
||||||
#include "libopenjpeg/openjpeg.h"
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
#include "imagj2k.h"
|
//#include "imagj2k.h"
|
||||||
#include "imagjp2.h"
|
//#include "imagjp2.h"
|
||||||
#include "imagmj2.h"
|
//#include "imagmj2.h"
|
||||||
|
#include "imagjpeg2000.h"
|
||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
#include "imagmxf.h"
|
#include "imagmxf.h"
|
||||||
#endif // USE_MXF
|
#endif // USE_MXF
|
||||||
@@ -131,9 +132,9 @@ typedef unsigned long long int8byte;
|
|||||||
|
|
||||||
#define OPJ_APPLICATION wxT("OPJViewer")
|
#define OPJ_APPLICATION wxT("OPJViewer")
|
||||||
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
|
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
|
||||||
#define OPJ_APPLICATION_VERSION wxT("0.3 alpha")
|
#define OPJ_APPLICATION_VERSION wxT("0.4 beta")
|
||||||
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
|
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
|
||||||
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa")
|
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007-2008, Giuseppe Baruffa")
|
||||||
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
|
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@@ -268,8 +269,13 @@ class OPJCanvas: public wxScrolledWindow
|
|||||||
wxMutexGuiLeave();
|
wxMutexGuiLeave();
|
||||||
#endif //__WXGTK__
|
#endif //__WXGTK__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnThreadSignal(wxCommandEvent& event);
|
||||||
|
|
||||||
OPJDecoThread *CreateDecoThread(void);
|
OPJDecoThread *CreateDecoThread(void);
|
||||||
OPJEncoThread *CreateEncoThread(void);
|
OPJEncoThread *CreateEncoThread(void);
|
||||||
|
|
||||||
|
|
||||||
OPJChildFrame *m_childframe;
|
OPJChildFrame *m_childframe;
|
||||||
|
|
||||||
wxBitmap m_image, m_image100;
|
wxBitmap m_image, m_image100;
|
||||||
@@ -418,7 +424,7 @@ class OPJFrame: public wxMDIParentFrame
|
|||||||
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnClose(wxCommandEvent& WXUNUSED(event));
|
void OnClose(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnFit(wxCommandEvent& WXUNUSED(event));
|
void OnFit(wxCommandEvent& event);
|
||||||
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
||||||
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
void OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
||||||
@@ -442,6 +448,7 @@ class OPJFrame: public wxMDIParentFrame
|
|||||||
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
||||||
void OnNotebook(wxNotebookEvent& event);
|
void OnNotebook(wxNotebookEvent& event);
|
||||||
void Rescale(int scale, OPJChildFrame *child);
|
void Rescale(int scale, OPJChildFrame *child);
|
||||||
|
void OnThreadLogmsg(wxCommandEvent& event);
|
||||||
|
|
||||||
OPJMarkerTreeHash m_treehash;
|
OPJMarkerTreeHash m_treehash;
|
||||||
OPJChildFrameHash m_childhash;
|
OPJChildFrameHash m_childhash;
|
||||||
@@ -521,7 +528,10 @@ enum {
|
|||||||
|
|
||||||
OPJFRAME_BROWSEWIN = 10000,
|
OPJFRAME_BROWSEWIN = 10000,
|
||||||
OPJFRAME_LOGWIN,
|
OPJFRAME_LOGWIN,
|
||||||
OPJFRAME_TOOLBAR
|
OPJFRAME_TOOLBAR,
|
||||||
|
|
||||||
|
OPJFRAME_THREADLOGMSG,
|
||||||
|
OPJCANVAS_THREADSIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,18 +20,23 @@ OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
|||||||
"<tr>"
|
"<tr>"
|
||||||
"<td align=justify>"
|
"<td align=justify>"
|
||||||
"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
|
"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
|
||||||
"<font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
|
"<p><font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
|
||||||
"In addition to the basic codec, various other features are under development.</font><br>"
|
"In addition to the basic codec, various other features are under development.</font></p><br>"
|
||||||
"<font size=-2 color=red>* Build: ")
|
"<font size=-2 color=red>* Build: ")
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
||||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
|
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
|
||||||
|
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
wxT("<font size=-2 color=green>- Compiled with JPWL support</font><br>")
|
wxT("<font size=-2 color=green>JPWL</font> ")
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
#ifdef USE_JPSEC
|
#ifdef USE_JPSEC
|
||||||
wxT("<font size=-2 color=green>- Compiled with JPSEC support</font>")
|
wxT("<font size=-2 color=green>JPSEC</font> ")
|
||||||
#endif // USE_JPSEC
|
#endif // USE_JPSEC
|
||||||
|
wxT(")</font><br>")
|
||||||
|
#ifdef USE_MXF
|
||||||
|
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
|
||||||
|
#endif // USE_MXF
|
||||||
wxT("</td>"
|
wxT("</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"<tr>"
|
"<tr>"
|
||||||
@@ -39,8 +44,8 @@ wxT("</td>"
|
|||||||
"</tr>"
|
"</tr>"
|
||||||
"<tr>"
|
"<tr>"
|
||||||
"<td colspan=2>"
|
"<td colspan=2>"
|
||||||
"<font size=-2 color=#444444>OpenJPEG is © 2002-2007 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
|
"<font size=-2 color=#444444>OpenJPEG is © 2002-2008 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
|
||||||
"<font size=-2 color=#444444>OPJViewer is also © 2007 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
|
"<font size=-2 color=#444444>OPJViewer is © 2007-2008 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"</table>"
|
"</table>"
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
wxT("404")
|
wxT("491")
|
||||||
|
|||||||
@@ -1,721 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: imagj2k.cpp
|
|
||||||
// Purpose: wxImage JPEG 2000 codestream handler
|
|
||||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
|
||||||
// RCS-ID: $Id: imagj2k.cpp,v 0.00 2007/02/08 23:59:00 MW Exp $
|
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
|
||||||
// Licence: wxWindows licence
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma hdrstop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#include "imagj2k.h"
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/log.h"
|
|
||||||
#include "wx/app.h"
|
|
||||||
#include "wx/intl.h"
|
|
||||||
#include "wx/bitmap.h"
|
|
||||||
#include "wx/module.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/filefn.h"
|
|
||||||
#include "wx/wfstream.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// types
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxJ2KHandler
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxJ2KHandler,wxImageHandler)
|
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
|
||||||
|
|
||||||
//------------- JPEG 2000 Data Source Manager
|
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
#define MJ2_CFMT 3
|
|
||||||
#define PXM_DFMT 0
|
|
||||||
#define PGX_DFMT 1
|
|
||||||
#define BMP_DFMT 2
|
|
||||||
#define YUV_DFMT 3
|
|
||||||
|
|
||||||
#define MAX_MESSAGE_LEN 200
|
|
||||||
|
|
||||||
/* sample error callback expecting a FILE* client object */
|
|
||||||
void j2k_error_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sample warning callback expecting a FILE* client object */
|
|
||||||
void j2k_warning_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sample debug callback expecting no client object */
|
|
||||||
void j2k_info_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the j2k codestream
|
|
||||||
bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
|
||||||
{
|
|
||||||
opj_dparameters_t parameters; /* decompression parameters */
|
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
|
||||||
opj_image_t *opjimage = NULL;
|
|
||||||
unsigned char *src = NULL;
|
|
||||||
unsigned char *ptr;
|
|
||||||
int file_length;
|
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
|
||||||
|
|
||||||
// destroy the image
|
|
||||||
image->Destroy();
|
|
||||||
|
|
||||||
/* handle to a decompressor */
|
|
||||||
opj_dinfo_t* dinfo = NULL;
|
|
||||||
opj_cio_t *cio = NULL;
|
|
||||||
|
|
||||||
|
|
||||||
/* configure the event callbacks (not required) */
|
|
||||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
|
||||||
event_mgr.error_handler = j2k_error_callback;
|
|
||||||
event_mgr.warning_handler = j2k_warning_callback;
|
|
||||||
event_mgr.info_handler = j2k_info_callback;
|
|
||||||
|
|
||||||
/* set decoding parameters to default values */
|
|
||||||
opj_set_default_decoder_parameters(¶meters);
|
|
||||||
|
|
||||||
/* prepare parameters */
|
|
||||||
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
|
||||||
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
|
||||||
parameters.decod_format = J2K_CFMT;
|
|
||||||
parameters.cod_format = BMP_DFMT;
|
|
||||||
if (m_reducefactor)
|
|
||||||
parameters.cp_reduce = m_reducefactor;
|
|
||||||
if (m_qualitylayers)
|
|
||||||
parameters.cp_layer = m_qualitylayers;
|
|
||||||
|
|
||||||
/* JPWL only */
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
parameters.jpwl_exp_comps = m_expcomps;
|
|
||||||
parameters.jpwl_max_tiles = m_maxtiles;
|
|
||||||
parameters.jpwl_correct = m_enablejpwl;
|
|
||||||
#endif /* USE_JPWL */
|
|
||||||
|
|
||||||
/* get a decoder handle */
|
|
||||||
dinfo = opj_create_decompress(CODEC_J2K);
|
|
||||||
|
|
||||||
/* find length of the stream */
|
|
||||||
stream.SeekI(0, wxFromEnd);
|
|
||||||
file_length = (int) stream.TellI();
|
|
||||||
|
|
||||||
/* get data */
|
|
||||||
stream.SeekI(0, wxFromStart);
|
|
||||||
src = (unsigned char *) malloc(file_length);
|
|
||||||
stream.Read(src, file_length);
|
|
||||||
|
|
||||||
/* 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, ¶meters);
|
|
||||||
|
|
||||||
/* open a byte stream */
|
|
||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
|
||||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
|
||||||
if (!opjimage) {
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogError(wxT("J2K: failed to decode image!"));
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
opj_destroy_decompress(dinfo);
|
|
||||||
opj_cio_close(cio);
|
|
||||||
opj_image_destroy(opjimage);
|
|
||||||
free(src);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close the byte stream */
|
|
||||||
opj_cio_close(cio);
|
|
||||||
|
|
||||||
/* common rendering method */
|
|
||||||
#include "imagjpeg2000.cpp"
|
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("J2K: image loaded."));
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
/* close openjpeg structs */
|
|
||||||
opj_destroy_decompress(dinfo);
|
|
||||||
opj_image_destroy(opjimage);
|
|
||||||
free(src);
|
|
||||||
|
|
||||||
if (!image->Ok())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CINEMA_24_CS 1302083 /* Codestream length for 24fps */
|
|
||||||
#define CINEMA_48_CS 651041 /* Codestream length for 48fps */
|
|
||||||
#define COMP_24_CS 1041666 /* Maximum size per color component for 2K & 4K @ 24fps */
|
|
||||||
#define COMP_48_CS 520833 /* Maximum size per color component for 2K @ 48fps */
|
|
||||||
|
|
||||||
// save the j2k codestream
|
|
||||||
bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbose )
|
|
||||||
{
|
|
||||||
opj_cparameters_t parameters; /* compression parameters */
|
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
|
||||||
opj_image_t *oimage = NULL;
|
|
||||||
opj_image_cmptparm_t *cmptparm;
|
|
||||||
opj_cio_t *cio = NULL;
|
|
||||||
opj_codestream_info_t cstr_info;
|
|
||||||
int codestream_length;
|
|
||||||
bool bSuccess;
|
|
||||||
int i;
|
|
||||||
char indexfilename[OPJ_PATH_LEN] = ""; /* index file name */
|
|
||||||
|
|
||||||
/*
|
|
||||||
configure the event callbacks (not required)
|
|
||||||
setting of each callback is optionnal
|
|
||||||
*/
|
|
||||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
|
||||||
event_mgr.error_handler = j2k_error_callback;
|
|
||||||
event_mgr.warning_handler = j2k_warning_callback;
|
|
||||||
event_mgr.info_handler = j2k_info_callback;
|
|
||||||
|
|
||||||
/* set encoding parameters to default values */
|
|
||||||
opj_set_default_encoder_parameters(¶meters);
|
|
||||||
|
|
||||||
/* load parameters */
|
|
||||||
parameters.cp_cinema = OFF;
|
|
||||||
|
|
||||||
/* subsampling */
|
|
||||||
if (sscanf(m_subsampling.ToAscii(), "%d,%d", &(parameters.subsampling_dx), &(parameters.subsampling_dy)) != 2) {
|
|
||||||
wxLogError(wxT("Wrong sub-sampling encoder setting: dx,dy"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* compression rates */
|
|
||||||
if ((m_rates != wxT("")) && (!m_enablequality)) {
|
|
||||||
const char *s1 = m_rates.ToAscii();
|
|
||||||
wxLogMessage(wxT("rates %s"), s1);
|
|
||||||
while (sscanf(s1, "%f", &(parameters.tcp_rates[parameters.tcp_numlayers])) == 1) {
|
|
||||||
parameters.tcp_numlayers++;
|
|
||||||
while (*s1 && *s1 != ',') {
|
|
||||||
s1++;
|
|
||||||
}
|
|
||||||
if (!*s1)
|
|
||||||
break;
|
|
||||||
s1++;
|
|
||||||
}
|
|
||||||
wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers);
|
|
||||||
parameters.cp_disto_alloc = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* image quality, dB */
|
|
||||||
if ((m_quality != wxT("")) && (m_enablequality)) {
|
|
||||||
const char *s2 = m_quality.ToAscii();
|
|
||||||
wxLogMessage(wxT("qualities %s"), s2);
|
|
||||||
while (sscanf(s2, "%f", ¶meters.tcp_distoratio[parameters.tcp_numlayers]) == 1) {
|
|
||||||
parameters.tcp_numlayers++;
|
|
||||||
while (*s2 && *s2 != ',') {
|
|
||||||
s2++;
|
|
||||||
}
|
|
||||||
if (!*s2)
|
|
||||||
break;
|
|
||||||
s2++;
|
|
||||||
}
|
|
||||||
wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers);
|
|
||||||
parameters.cp_fixed_quality = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* image origin */
|
|
||||||
if (sscanf(m_origin.ToAscii(), "%d,%d", ¶meters.image_offset_x0, ¶meters.image_offset_y0) != 2) {
|
|
||||||
wxLogError(wxT("bad coordinate of the image origin: x0,y0"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create comment for codestream */
|
|
||||||
if(m_enablecomm) {
|
|
||||||
parameters.cp_comment = (char *) malloc(strlen(m_comment.ToAscii()) + 1);
|
|
||||||
if(parameters.cp_comment) {
|
|
||||||
strcpy(parameters.cp_comment, m_comment.ToAscii());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
parameters.cp_comment = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* indexing file */
|
|
||||||
if (m_enableidx) {
|
|
||||||
strncpy(indexfilename, m_index.ToAscii(), OPJ_PATH_LEN);
|
|
||||||
wxLogMessage(wxT("index file is %s"), indexfilename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if no rate entered, lossless by default */
|
|
||||||
if (parameters.tcp_numlayers == 0) {
|
|
||||||
parameters.tcp_rates[0] = 0; /* MOD antonin : losslessbug */
|
|
||||||
parameters.tcp_numlayers++;
|
|
||||||
parameters.cp_disto_alloc = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* irreversible transform */
|
|
||||||
parameters.irreversible = (m_irreversible == true) ? 1 : 0;
|
|
||||||
|
|
||||||
/* resolutions */
|
|
||||||
parameters.numresolution = m_resolutions;
|
|
||||||
|
|
||||||
/* codeblocks size */
|
|
||||||
if (m_cbsize != wxT("")) {
|
|
||||||
int cblockw_init = 0, cblockh_init = 0;
|
|
||||||
sscanf(m_cbsize.ToAscii(), "%d,%d", &cblockw_init, &cblockh_init);
|
|
||||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024 || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
|
||||||
wxLogError(wxT("!! Size of code_block error !! Restrictions:\n width*height<=4096\n 4<=width,height<= 1024"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
parameters.cblockw_init = cblockw_init;
|
|
||||||
parameters.cblockh_init = cblockh_init;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* precincts size */
|
|
||||||
if (m_prsize != wxT("")) {
|
|
||||||
char sep;
|
|
||||||
int res_spec = 0;
|
|
||||||
char *s = (char *) m_prsize.c_str();
|
|
||||||
do {
|
|
||||||
sep = 0;
|
|
||||||
sscanf(s, "[%d,%d]%c", ¶meters.prcw_init[res_spec], ¶meters.prch_init[res_spec], &sep);
|
|
||||||
parameters.csty |= 0x01;
|
|
||||||
res_spec++;
|
|
||||||
s = strpbrk(s, "]") + 2;
|
|
||||||
} while (sep == ',');
|
|
||||||
parameters.res_spec = res_spec;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* tiles */
|
|
||||||
if (m_tsize != wxT("")) {
|
|
||||||
sscanf(m_tsize.ToAscii(), "%d,%d", ¶meters.cp_tdx, ¶meters.cp_tdy);
|
|
||||||
parameters.tile_size_on = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* tile origin */
|
|
||||||
if (sscanf(m_torigin.ToAscii(), "%d,%d", ¶meters.cp_tx0, ¶meters.cp_ty0) != 2) {
|
|
||||||
wxLogError(wxT("tile offset setting error: X0,Y0"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* use SOP */
|
|
||||||
if (m_enablesop)
|
|
||||||
parameters.csty |= 0x02;
|
|
||||||
|
|
||||||
/* use EPH */
|
|
||||||
if (m_enableeph)
|
|
||||||
parameters.csty |= 0x04;
|
|
||||||
|
|
||||||
/* multiple component transform */
|
|
||||||
if (m_multicomp)
|
|
||||||
parameters.tcp_mct = 1;
|
|
||||||
else
|
|
||||||
parameters.tcp_mct = 0;
|
|
||||||
|
|
||||||
/* mode switch */
|
|
||||||
parameters.mode = (m_enablebypass ? 1 : 0) + (m_enablereset ? 2 : 0)
|
|
||||||
+ (m_enablerestart ? 4 : 0) + (m_enablevsc ? 8 : 0)
|
|
||||||
+ (m_enableerterm ? 16 : 0) + (m_enablesegmark ? 32 : 0);
|
|
||||||
|
|
||||||
/* progression order */
|
|
||||||
switch (m_progression) {
|
|
||||||
|
|
||||||
/* LRCP */
|
|
||||||
case 0:
|
|
||||||
parameters.prog_order = LRCP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* RLCP */
|
|
||||||
case 1:
|
|
||||||
parameters.prog_order = RLCP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* RPCL */
|
|
||||||
case 2:
|
|
||||||
parameters.prog_order = RPCL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* PCRL */
|
|
||||||
case 3:
|
|
||||||
parameters.prog_order = PCRL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* CPRL */
|
|
||||||
case 4:
|
|
||||||
parameters.prog_order = CPRL;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* DCI2K24 */
|
|
||||||
case 5:
|
|
||||||
parameters.cp_cinema = CINEMA2K_24;
|
|
||||||
parameters.cp_rsiz = CINEMA2K;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* DCI2K48 */
|
|
||||||
case 6:
|
|
||||||
parameters.cp_cinema = CINEMA2K_48;
|
|
||||||
parameters.cp_rsiz = CINEMA2K;
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* DCI4K */
|
|
||||||
case 7:
|
|
||||||
parameters.cp_cinema = CINEMA4K_24;
|
|
||||||
parameters.cp_rsiz = CINEMA4K;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check cinema */
|
|
||||||
if (parameters.cp_cinema) {
|
|
||||||
|
|
||||||
/* set up */
|
|
||||||
parameters.tile_size_on = false;
|
|
||||||
parameters.cp_tdx=1;
|
|
||||||
parameters.cp_tdy=1;
|
|
||||||
|
|
||||||
/*Tile part*/
|
|
||||||
parameters.tp_flag = 'C';
|
|
||||||
parameters.tp_on = 1;
|
|
||||||
|
|
||||||
/*Tile and Image shall be at (0,0)*/
|
|
||||||
parameters.cp_tx0 = 0;
|
|
||||||
parameters.cp_ty0 = 0;
|
|
||||||
parameters.image_offset_x0 = 0;
|
|
||||||
parameters.image_offset_y0 = 0;
|
|
||||||
|
|
||||||
/*Codeblock size= 32*32*/
|
|
||||||
parameters.cblockw_init = 32;
|
|
||||||
parameters.cblockh_init = 32;
|
|
||||||
parameters.csty |= 0x01;
|
|
||||||
|
|
||||||
/*The progression order shall be CPRL*/
|
|
||||||
parameters.prog_order = CPRL;
|
|
||||||
|
|
||||||
/* No ROI */
|
|
||||||
parameters.roi_compno = -1;
|
|
||||||
|
|
||||||
parameters.subsampling_dx = 1;
|
|
||||||
parameters.subsampling_dy = 1;
|
|
||||||
|
|
||||||
/* 9-7 transform */
|
|
||||||
parameters.irreversible = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* convert wx image into opj image */
|
|
||||||
cmptparm = (opj_image_cmptparm_t*) malloc(3 * sizeof(opj_image_cmptparm_t));
|
|
||||||
|
|
||||||
/* initialize opj image components */
|
|
||||||
memset(&cmptparm[0], 0, 3 * sizeof(opj_image_cmptparm_t));
|
|
||||||
for(i = 0; i < 3; i++) {
|
|
||||||
cmptparm[i].prec = 8;
|
|
||||||
cmptparm[i].bpp = 8;
|
|
||||||
cmptparm[i].sgnd = false;
|
|
||||||
cmptparm[i].dx = parameters.subsampling_dx;
|
|
||||||
cmptparm[i].dy = parameters.subsampling_dy;
|
|
||||||
cmptparm[i].w = wimage->GetWidth();
|
|
||||||
cmptparm[i].h = wimage->GetHeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create the image */
|
|
||||||
oimage = opj_image_create(3, &cmptparm[0], CLRSPC_SRGB);
|
|
||||||
if(!oimage) {
|
|
||||||
if (cmptparm)
|
|
||||||
free(cmptparm);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set image offset and reference grid */
|
|
||||||
oimage->x0 = parameters.image_offset_x0;
|
|
||||||
oimage->y0 = parameters.image_offset_y0;
|
|
||||||
oimage->x1 = parameters.image_offset_x0 + (wimage->GetWidth() - 1) * 1 + 1;
|
|
||||||
oimage->y1 = parameters.image_offset_y0 + (wimage->GetHeight() - 1) * 1 + 1;
|
|
||||||
|
|
||||||
/* load image data */
|
|
||||||
unsigned char *value = wimage->GetData();
|
|
||||||
int area = wimage->GetWidth() * wimage->GetHeight();
|
|
||||||
for (i = 0; i < area; i++) {
|
|
||||||
oimage->comps[0].data[i] = *(value++);
|
|
||||||
oimage->comps[1].data[i] = *(value++);
|
|
||||||
oimage->comps[2].data[i] = *(value++);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check cinema again */
|
|
||||||
if (parameters.cp_cinema) {
|
|
||||||
int i;
|
|
||||||
float temp_rate;
|
|
||||||
opj_poc_t *POC = NULL;
|
|
||||||
|
|
||||||
switch (parameters.cp_cinema) {
|
|
||||||
|
|
||||||
case CINEMA2K_24:
|
|
||||||
case CINEMA2K_48:
|
|
||||||
if (parameters.numresolution > 6) {
|
|
||||||
parameters.numresolution = 6;
|
|
||||||
}
|
|
||||||
if (!((oimage->comps[0].w == 2048) | (oimage->comps[0].h == 1080))) {
|
|
||||||
wxLogWarning(wxT("Image coordinates %d x %d is not 2K compliant. JPEG Digital Cinema Profile-3 "
|
|
||||||
"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080"),
|
|
||||||
oimage->comps[0].w, oimage->comps[0].h);
|
|
||||||
parameters.cp_rsiz = STD_RSIZ;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CINEMA4K_24:
|
|
||||||
if (parameters.numresolution < 1) {
|
|
||||||
parameters.numresolution = 1;
|
|
||||||
} else if (parameters.numresolution > 7) {
|
|
||||||
parameters.numresolution = 7;
|
|
||||||
}
|
|
||||||
if (!((oimage->comps[0].w == 4096) | (oimage->comps[0].h == 2160))) {
|
|
||||||
wxLogWarning(wxT("Image coordinates %d x %d is not 4K compliant. JPEG Digital Cinema Profile-4"
|
|
||||||
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160"),
|
|
||||||
oimage->comps[0].w, oimage->comps[0].h);
|
|
||||||
parameters.cp_rsiz = STD_RSIZ;
|
|
||||||
}
|
|
||||||
parameters.POC[0].tile = 1;
|
|
||||||
parameters.POC[0].resno0 = 0;
|
|
||||||
parameters.POC[0].compno0 = 0;
|
|
||||||
parameters.POC[0].layno1 = 1;
|
|
||||||
parameters.POC[0].resno1 = parameters.numresolution - 1;
|
|
||||||
parameters.POC[0].compno1 = 3;
|
|
||||||
parameters.POC[0].prg1 = CPRL;
|
|
||||||
parameters.POC[1].tile = 1;
|
|
||||||
parameters.POC[1].resno0 = parameters.numresolution - 1;
|
|
||||||
parameters.POC[1].compno0 = 0;
|
|
||||||
parameters.POC[1].layno1 = 1;
|
|
||||||
parameters.POC[1].resno1 = parameters.numresolution;
|
|
||||||
parameters.POC[1].compno1 = 3;
|
|
||||||
parameters.POC[1].prg1 = CPRL;
|
|
||||||
parameters.numpocs = 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (parameters.cp_cinema) {
|
|
||||||
case CINEMA2K_24:
|
|
||||||
case CINEMA4K_24:
|
|
||||||
for (i = 0 ; i < parameters.tcp_numlayers; i++) {
|
|
||||||
temp_rate = 0;
|
|
||||||
if (parameters.tcp_rates[i] == 0) {
|
|
||||||
parameters.tcp_rates[0] = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
|
||||||
(CINEMA_24_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
|
||||||
}else{
|
|
||||||
temp_rate = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
|
||||||
(parameters.tcp_rates[i] * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
|
||||||
if (temp_rate > CINEMA_24_CS ) {
|
|
||||||
parameters.tcp_rates[i]= ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
|
||||||
(CINEMA_24_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
|
||||||
} else {
|
|
||||||
/* do nothing */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parameters.max_comp_size = COMP_24_CS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CINEMA2K_48:
|
|
||||||
for (i = 0; i < parameters.tcp_numlayers; i++) {
|
|
||||||
temp_rate = 0 ;
|
|
||||||
if (parameters.tcp_rates[i] == 0) {
|
|
||||||
parameters.tcp_rates[0] = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
|
||||||
(CINEMA_48_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
|
||||||
}else{
|
|
||||||
temp_rate =((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
|
||||||
(parameters.tcp_rates[i] * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
|
||||||
if (temp_rate > CINEMA_48_CS ){
|
|
||||||
parameters.tcp_rates[0]= ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
|
||||||
(CINEMA_48_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
|
||||||
}else{
|
|
||||||
/* do nothing */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parameters.max_comp_size = COMP_48_CS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
parameters.cp_disto_alloc = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get a J2K compressor handle */
|
|
||||||
opj_cinfo_t* cinfo = opj_create_compress(CODEC_J2K);
|
|
||||||
|
|
||||||
/* catch events using our callbacks and give a local context */
|
|
||||||
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
|
|
||||||
|
|
||||||
/* setup the encoder parameters using the current image and user parameters */
|
|
||||||
opj_setup_encoder(cinfo, ¶meters, oimage);
|
|
||||||
|
|
||||||
/* open a byte stream for writing */
|
|
||||||
/* allocate memory for all tiles */
|
|
||||||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
|
||||||
|
|
||||||
/* encode the image */
|
|
||||||
bSuccess = opj_encode_with_info(cinfo, cio, oimage, &cstr_info);
|
|
||||||
if (!bSuccess) {
|
|
||||||
|
|
||||||
opj_cio_close(cio);
|
|
||||||
opj_destroy_compress(cinfo);
|
|
||||||
opj_image_destroy(oimage);
|
|
||||||
if (cmptparm)
|
|
||||||
free(cmptparm);
|
|
||||||
if(parameters.cp_comment)
|
|
||||||
free(parameters.cp_comment);
|
|
||||||
if(parameters.cp_matrice)
|
|
||||||
free(parameters.cp_matrice);
|
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
wxLogError(wxT("failed to encode image"));
|
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
codestream_length = cio_tell(cio);
|
|
||||||
wxLogMessage(wxT("Codestream: %d bytes"), codestream_length);
|
|
||||||
|
|
||||||
/* write the buffer to stream */
|
|
||||||
stream.Write(cio->buffer, codestream_length);
|
|
||||||
|
|
||||||
/* close and free the byte stream */
|
|
||||||
opj_cio_close(cio);
|
|
||||||
|
|
||||||
/* Write the index to disk */
|
|
||||||
if (*indexfilename) {
|
|
||||||
if (write_index_file(&cstr_info, indexfilename)) {
|
|
||||||
wxLogError(wxT("Failed to output index file"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* free remaining compression structures */
|
|
||||||
opj_destroy_compress(cinfo);
|
|
||||||
|
|
||||||
/* free image data */
|
|
||||||
opj_image_destroy(oimage);
|
|
||||||
|
|
||||||
if (cmptparm)
|
|
||||||
free(cmptparm);
|
|
||||||
if(parameters.cp_comment)
|
|
||||||
free(parameters.cp_comment);
|
|
||||||
if(parameters.cp_matrice)
|
|
||||||
free(parameters.cp_matrice);
|
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
wxLogMessage(wxT("J2K: Image encoded!"));
|
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __VISUALC__
|
|
||||||
#pragma warning(default:4611)
|
|
||||||
#endif /* VC++ */
|
|
||||||
|
|
||||||
// recognize the 0xFF4F JPEG 2000 SOC marker
|
|
||||||
bool wxJ2KHandler::DoCanRead( wxInputStream& stream )
|
|
||||||
{
|
|
||||||
unsigned char hdr[2];
|
|
||||||
|
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return hdr[0] == 0xFF && hdr[1] == 0x4F;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_STREAMS
|
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
|
||||||
@@ -1,279 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: imagjp2.cpp
|
|
||||||
// Purpose: wxImage JPEG 2000 file format handler
|
|
||||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
|
||||||
// RCS-ID: $Id: imagjp2.cpp,v 0.00 2007/02/08 23:59:00 MW Exp $
|
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
|
||||||
// Licence: wxWindows licence
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma hdrstop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#include "imagjp2.h"
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/log.h"
|
|
||||||
#include "wx/app.h"
|
|
||||||
#include "wx/intl.h"
|
|
||||||
#include "wx/bitmap.h"
|
|
||||||
#include "wx/module.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "libopenjpeg/openjpeg.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "wx/filefn.h"
|
|
||||||
#include "wx/wfstream.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// types
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxJP2Handler
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxJP2Handler,wxImageHandler)
|
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
|
||||||
|
|
||||||
//------------- JPEG 2000 Data Source Manager
|
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
#define MJ2_CFMT 3
|
|
||||||
#define PXM_DFMT 0
|
|
||||||
#define PGX_DFMT 1
|
|
||||||
#define BMP_DFMT 2
|
|
||||||
#define YUV_DFMT 3
|
|
||||||
|
|
||||||
#define MAX_MESSAGE_LEN 200
|
|
||||||
|
|
||||||
/* sample error callback expecting a FILE* client object */
|
|
||||||
void jp2_error_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sample warning callback expecting a FILE* client object */
|
|
||||||
void jp2_warning_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sample debug callback expecting no client object */
|
|
||||||
void jp2_info_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the jp2 file format
|
|
||||||
bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
|
||||||
{
|
|
||||||
opj_dparameters_t parameters; /* decompression parameters */
|
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
|
||||||
opj_image_t *opjimage = NULL;
|
|
||||||
unsigned char *src = NULL;
|
|
||||||
unsigned char *ptr;
|
|
||||||
int file_length;
|
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
|
||||||
|
|
||||||
// destroy the image
|
|
||||||
image->Destroy();
|
|
||||||
|
|
||||||
/* handle to a decompressor */
|
|
||||||
opj_dinfo_t* dinfo = NULL;
|
|
||||||
opj_cio_t *cio = NULL;
|
|
||||||
|
|
||||||
/* configure the event callbacks (not required) */
|
|
||||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
|
||||||
event_mgr.error_handler = jp2_error_callback;
|
|
||||||
event_mgr.warning_handler = jp2_warning_callback;
|
|
||||||
event_mgr.info_handler = jp2_info_callback;
|
|
||||||
|
|
||||||
/* set decoding parameters to default values */
|
|
||||||
opj_set_default_decoder_parameters(¶meters);
|
|
||||||
|
|
||||||
/* prepare parameters */
|
|
||||||
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
|
||||||
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
|
||||||
parameters.decod_format = JP2_CFMT;
|
|
||||||
parameters.cod_format = BMP_DFMT;
|
|
||||||
if (m_reducefactor)
|
|
||||||
parameters.cp_reduce = m_reducefactor;
|
|
||||||
if (m_qualitylayers)
|
|
||||||
parameters.cp_layer = m_qualitylayers;
|
|
||||||
/*if (n_components)
|
|
||||||
parameters. = n_components;*/
|
|
||||||
|
|
||||||
/* JPWL only */
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
parameters.jpwl_exp_comps = m_expcomps;
|
|
||||||
parameters.jpwl_max_tiles = m_maxtiles;
|
|
||||||
parameters.jpwl_correct = m_enablejpwl;
|
|
||||||
#endif /* USE_JPWL */
|
|
||||||
|
|
||||||
/* get a decoder handle */
|
|
||||||
dinfo = opj_create_decompress(CODEC_JP2);
|
|
||||||
|
|
||||||
/* find length of the stream */
|
|
||||||
stream.SeekI(0, wxFromEnd);
|
|
||||||
file_length = (int) stream.TellI();
|
|
||||||
|
|
||||||
/* get data */
|
|
||||||
stream.SeekI(0, wxFromStart);
|
|
||||||
src = (unsigned char *) malloc(file_length);
|
|
||||||
stream.Read(src, file_length);
|
|
||||||
|
|
||||||
/* 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, ¶meters);
|
|
||||||
|
|
||||||
/* open a byte stream */
|
|
||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
|
||||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
|
||||||
if (!opjimage) {
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogError(wxT("JP2: failed to decode image!"));
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
opj_destroy_decompress(dinfo);
|
|
||||||
opj_cio_close(cio);
|
|
||||||
free(src);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close the byte stream */
|
|
||||||
opj_cio_close(cio);
|
|
||||||
|
|
||||||
/* common rendering method */
|
|
||||||
#include "imagjpeg2000.cpp"
|
|
||||||
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("JP2: image loaded."));
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
/* close openjpeg structs */
|
|
||||||
opj_destroy_decompress(dinfo);
|
|
||||||
opj_image_destroy(opjimage);
|
|
||||||
free(src);
|
|
||||||
|
|
||||||
if (!image->Ok())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// save the jp2 file format
|
|
||||||
bool wxJP2Handler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
|
||||||
{
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogError(wxT("JP2: Couldn't save image -> not implemented."));
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __VISUALC__
|
|
||||||
#pragma warning(default:4611)
|
|
||||||
#endif /* VC++ */
|
|
||||||
|
|
||||||
// recognize the JPEG 2000 starting box
|
|
||||||
bool wxJP2Handler::DoCanRead( wxInputStream& stream )
|
|
||||||
{
|
|
||||||
unsigned char hdr[23];
|
|
||||||
|
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (hdr[0] == 0x00 &&
|
|
||||||
hdr[1] == 0x00 &&
|
|
||||||
hdr[2] == 0x00 &&
|
|
||||||
hdr[3] == 0x0C &&
|
|
||||||
hdr[4] == 0x6A &&
|
|
||||||
hdr[5] == 0x50 &&
|
|
||||||
hdr[6] == 0x20 &&
|
|
||||||
hdr[7] == 0x20 &&
|
|
||||||
hdr[20] == 0x6A &&
|
|
||||||
hdr[21] == 0x70 &&
|
|
||||||
hdr[22] == 0x32);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_STREAMS
|
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: imagjp2.h
|
|
||||||
// Purpose: wxImage JPEG 2000 file format handler
|
|
||||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
|
||||||
// RCS-ID: $Id: imagjp2.h,v 0.0 2007/02/08 23:45:00 VZ Exp $
|
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
|
||||||
// Licence: wxWindows licence
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef _WX_IMAGJP2_H_
|
|
||||||
#define _WX_IMAGJP2_H_
|
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxJP2Handler
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#include "wx/image.h"
|
|
||||||
#include "libopenjpeg/openjpeg.h"
|
|
||||||
|
|
||||||
#define wxBITMAP_TYPE_JP2 48
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxJP2Handler: public wxImageHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
inline wxJP2Handler()
|
|
||||||
{
|
|
||||||
m_name = wxT("JPEG 2000 file format");
|
|
||||||
m_extension = wxT("jp2");
|
|
||||||
m_type = wxBITMAP_TYPE_JP2;
|
|
||||||
m_mime = wxT("image/jp2");
|
|
||||||
|
|
||||||
m_reducefactor = 0;
|
|
||||||
m_qualitylayers = 0;
|
|
||||||
m_components = 0;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
m_enablejpwl = true;
|
|
||||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
|
||||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
|
||||||
#endif // USE_JPWL
|
|
||||||
}
|
|
||||||
|
|
||||||
// decoding engine parameters
|
|
||||||
int m_reducefactor, m_qualitylayers, m_components;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
bool m_enablejpwl;
|
|
||||||
int m_expcomps, m_maxtiles;
|
|
||||||
#endif // USE_JPWL
|
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
|
||||||
protected:
|
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxJP2Handler)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#endif // _WX_IMAGJP2_H_
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -24,21 +24,21 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: imagj2k.h
|
// Name: imagalljpeg2000.h
|
||||||
// Purpose: wxImage JPEG 2000 raw codestream handler
|
// Purpose: wxImage JPEG 2000 family file format handler
|
||||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||||
// RCS-ID: $Id: imagj2k.h,v 0.0 2007/02/08 23:45:00 VZ Exp $
|
// RCS-ID: $Id: imagalljpeg2000.h,v 0.0 2008/01/31 11:22:00 VZ Exp $
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_IMAGJ2K_H_
|
#ifndef _WX_IMAGJPEG2000_H_
|
||||||
#define _WX_IMAGJ2K_H_
|
#define _WX_IMAGJPEG2000_H_
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxJ2KHandler
|
// wxJPEG2000Handler
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_LIBOPENJPEG
|
#if wxUSE_LIBOPENJPEG
|
||||||
@@ -47,26 +47,17 @@
|
|||||||
#include "libopenjpeg/openjpeg.h"
|
#include "libopenjpeg/openjpeg.h"
|
||||||
#include "codec/index.h"
|
#include "codec/index.h"
|
||||||
|
|
||||||
#define wxBITMAP_TYPE_J2K 47
|
#define wxBITMAP_TYPE_JPEG2000 50
|
||||||
|
|
||||||
#define wxIMAGE_OPTION_REDUCEFACTOR wxString(_T("reducefactor"))
|
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
|
||||||
#define wxIMAGE_OPTION_QUALITYLAYERS wxString(_T("qualitylayers"))
|
|
||||||
#define wxIMAGE_OPTION_MAXCOMPS wxString(_T("maxcomps"))
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
#define wxIMAGE_OPTION_ENABLEJPWL wxString(_T("enablejpwl"))
|
|
||||||
#define wxIMAGE_OPTION_EXPCOMPS wxString(_T("expcomps"))
|
|
||||||
#define wxIMAGE_OPTION_MAXTILES wxString(_T("maxtiles"))
|
|
||||||
#endif // USE_JPWL
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxJ2KHandler: public wxImageHandler
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline wxJ2KHandler()
|
inline wxJPEG2000Handler()
|
||||||
{
|
{
|
||||||
m_name = wxT("JPEG 2000 codestream file");
|
m_name = wxT("JPEG 2000 family file format");
|
||||||
m_extension = wxT("j2k");
|
m_extension = wxT("mj2");
|
||||||
m_type = wxBITMAP_TYPE_J2K;
|
m_type = wxBITMAP_TYPE_JPEG2000;
|
||||||
m_mime = wxT("image/j2k");
|
m_mime = wxT("image/mj2");
|
||||||
|
|
||||||
/* decoding */
|
/* decoding */
|
||||||
m_reducefactor = 0;
|
m_reducefactor = 0;
|
||||||
@@ -128,7 +119,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decoding engine parameters
|
// decoding engine parameters
|
||||||
int m_reducefactor, m_qualitylayers, m_components;
|
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
bool m_enablejpwl;
|
bool m_enablejpwl;
|
||||||
int m_expcomps, m_maxtiles;
|
int m_expcomps, m_maxtiles;
|
||||||
@@ -169,18 +160,18 @@ public:
|
|||||||
wxString m_poc;
|
wxString m_poc;
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
|
||||||
protected:
|
protected:
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead(wxInputStream& stream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OPJ_PROG_ORDER give_progression(char progression[4]);
|
OPJ_PROG_ORDER give_progression(char progression[4]);
|
||||||
DECLARE_DYNAMIC_CLASS(wxJ2KHandler)
|
DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
#endif // _WX_IMAGJ2K_H_
|
#endif // _WX_IMAGJPEG2000_H_
|
||||||
|
|
||||||
@@ -1,771 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: imagmj2.cpp
|
|
||||||
// Purpose: wxImage Motion JPEG 2000 file format handler
|
|
||||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
|
||||||
// RCS-ID: $Id: imagmj2.cpp,v 0.00 2007/02/18 23:59:00 MW Exp $
|
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
|
||||||
// Licence: wxWindows licence
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
|
||||||
#include "wx/wxprec.h"
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#pragma hdrstop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#include "imagmj2.h"
|
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
|
||||||
#include "wx/log.h"
|
|
||||||
#include "wx/app.h"
|
|
||||||
#include "wx/intl.h"
|
|
||||||
#include "wx/bitmap.h"
|
|
||||||
#include "wx/module.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "libopenjpeg/openjpeg.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "wx/filefn.h"
|
|
||||||
#include "wx/wfstream.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// types
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxMJ2Handler
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMJ2Handler,wxImageHandler)
|
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
|
||||||
|
|
||||||
//------------- JPEG 2000 Data Source Manager
|
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
#define MJ2_CFMT 3
|
|
||||||
#define PXM_DFMT 0
|
|
||||||
#define PGX_DFMT 1
|
|
||||||
#define BMP_DFMT 2
|
|
||||||
#define YUV_DFMT 3
|
|
||||||
|
|
||||||
#define MAX_MESSAGE_LEN 200
|
|
||||||
|
|
||||||
/* sample error callback expecting a FILE* client object */
|
|
||||||
void mj2_error_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sample warning callback expecting a FILE* client object */
|
|
||||||
void mj2_warning_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sample debug callback expecting no client object */
|
|
||||||
void mj2_info_callback(const char *msg, void *client_data) {
|
|
||||||
int message_len = strlen(msg) - 1;
|
|
||||||
if (msg[message_len] != '\n')
|
|
||||||
message_len = MAX_MESSAGE_LEN;
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
|
||||||
#ifndef __WXGTK__
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
#endif /* __WXGTK__ */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* macro functions */
|
|
||||||
/* From little endian to big endian, 2 and 4 bytes */
|
|
||||||
#define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8)
|
|
||||||
#define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24)
|
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
#define BYTE_SWAP8(X) ((X & 0x00000000000000FFULL) << 56) | ((X & 0x000000000000FF00ULL) << 40) | \
|
|
||||||
((X & 0x0000000000FF0000ULL) << 24) | ((X & 0x00000000FF000000ULL) << 8) | \
|
|
||||||
((X & 0x000000FF00000000ULL) >> 8) | ((X & 0x0000FF0000000000ULL) >> 24) | \
|
|
||||||
((X & 0x00FF000000000000ULL) >> 40) | ((X & 0xFF00000000000000ULL) >> 56)
|
|
||||||
#else
|
|
||||||
#define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
|
|
||||||
((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \
|
|
||||||
((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \
|
|
||||||
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* From codestream to int values */
|
|
||||||
#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \
|
|
||||||
((unsigned long int) (C)[(P) + 1] << 16) + \
|
|
||||||
((unsigned long int) (C)[(P) + 2] << 8) + \
|
|
||||||
((unsigned long int) (C)[(P) + 3] << 0))
|
|
||||||
|
|
||||||
#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \
|
|
||||||
((unsigned long int) (C)[(P) + 1] << 0))
|
|
||||||
|
|
||||||
/* defines */
|
|
||||||
#define SHORT_DESCR_LEN 32
|
|
||||||
#define LONG_DESCR_LEN 256
|
|
||||||
|
|
||||||
/* enumeration for file formats */
|
|
||||||
#define J2FILENUM 4
|
|
||||||
typedef enum {
|
|
||||||
|
|
||||||
JP2_FILE,
|
|
||||||
J2K_FILE,
|
|
||||||
MJ2_FILE,
|
|
||||||
UNK_FILE
|
|
||||||
|
|
||||||
} my_j2filetype;
|
|
||||||
|
|
||||||
/* enumeration for the box types */
|
|
||||||
#define J2BOXNUM 23
|
|
||||||
typedef enum {
|
|
||||||
|
|
||||||
FILE_BOX,
|
|
||||||
JP_BOX,
|
|
||||||
FTYP_BOX,
|
|
||||||
JP2H_BOX,
|
|
||||||
IHDR_BOX,
|
|
||||||
COLR_BOX,
|
|
||||||
JP2C_BOX,
|
|
||||||
JP2I_BOX,
|
|
||||||
XML_BOX,
|
|
||||||
UUID_BOX,
|
|
||||||
UINF_BOX,
|
|
||||||
MOOV_BOX,
|
|
||||||
MVHD_BOX,
|
|
||||||
TRAK_BOX,
|
|
||||||
TKHD_BOX,
|
|
||||||
MDIA_BOX,
|
|
||||||
MINF_BOX,
|
|
||||||
STBL_BOX,
|
|
||||||
STSD_BOX,
|
|
||||||
MJP2_BOX,
|
|
||||||
MDAT_BOX,
|
|
||||||
ANY_BOX,
|
|
||||||
UNK_BOX
|
|
||||||
|
|
||||||
} my_j2boxtype;
|
|
||||||
|
|
||||||
/* jp2 family box signatures */
|
|
||||||
#define FILE_SIGN ""
|
|
||||||
#define JP_SIGN "jP\040\040"
|
|
||||||
#define FTYP_SIGN "ftyp"
|
|
||||||
#define JP2H_SIGN "jp2h"
|
|
||||||
#define IHDR_SIGN "ihdr"
|
|
||||||
#define COLR_SIGN "colr"
|
|
||||||
#define JP2C_SIGN "jp2c"
|
|
||||||
#define JP2I_SIGN "jp2i"
|
|
||||||
#define XML_SIGN "xml\040"
|
|
||||||
#define UUID_SIGN "uuid"
|
|
||||||
#define UINF_SIGN "uinf"
|
|
||||||
#define MOOV_SIGN "moov"
|
|
||||||
#define MVHD_SIGN "mvhd"
|
|
||||||
#define TRAK_SIGN "trak"
|
|
||||||
#define TKHD_SIGN "tkhd"
|
|
||||||
#define MDIA_SIGN "mdia"
|
|
||||||
#define MINF_SIGN "minf"
|
|
||||||
#define VMHD_SIGN "vmhd"
|
|
||||||
#define STBL_SIGN "stbl"
|
|
||||||
#define STSD_SIGN "stsd"
|
|
||||||
#define MJP2_SIGN "mjp2"
|
|
||||||
#define MDAT_SIGN "mdat"
|
|
||||||
#define ANY_SIGN ""
|
|
||||||
#define UNK_SIGN ""
|
|
||||||
|
|
||||||
/* the box structure itself */
|
|
||||||
struct my_boxdef {
|
|
||||||
|
|
||||||
char value[5]; /* hexadecimal value/string*/
|
|
||||||
char name[SHORT_DESCR_LEN]; /* short description */
|
|
||||||
char descr[LONG_DESCR_LEN]; /* long description */
|
|
||||||
int sbox; /* is it a superbox? */
|
|
||||||
int req[J2FILENUM]; /* mandatory box */
|
|
||||||
my_j2boxtype ins; /* contained in box... */
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/* the possible boxes */
|
|
||||||
struct my_boxdef j2box[] =
|
|
||||||
{
|
|
||||||
/* sign */ {FILE_SIGN,
|
|
||||||
/* short */ "placeholder for nothing",
|
|
||||||
/* long */ "Nothing to say",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {JP_SIGN,
|
|
||||||
/* short */ "JPEG 2000 Signature box",
|
|
||||||
/* long */ "This box uniquely identifies the file as being part of the JPEG 2000 family of files",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {FTYP_SIGN,
|
|
||||||
/* short */ "File Type box",
|
|
||||||
/* long */ "This box specifies file type, version and compatibility information, including specifying if this file "
|
|
||||||
"is a conforming JP2 file or if it can be read by a conforming JP2 reader",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {JP2H_SIGN,
|
|
||||||
/* short */ "JP2 Header box",
|
|
||||||
/* long */ "This box contains a series of boxes that contain header-type information about the file",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {IHDR_SIGN,
|
|
||||||
/* short */ "Image Header box",
|
|
||||||
/* long */ "This box specifies the size of the image and other related fields",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ JP2H_BOX},
|
|
||||||
|
|
||||||
/* sign */ {COLR_SIGN,
|
|
||||||
/* short */ "Colour Specification box",
|
|
||||||
/* long */ "This box specifies the colourspace of the image",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ JP2H_BOX},
|
|
||||||
|
|
||||||
/* sign */ {JP2C_SIGN,
|
|
||||||
/* short */ "Contiguous Codestream box",
|
|
||||||
/* long */ "This box contains the codestream as defined by Annex A",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {JP2I_SIGN,
|
|
||||||
/* short */ "Intellectual Property box",
|
|
||||||
/* long */ "This box contains intellectual property information about the image",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {0, 0, 0},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {XML_SIGN,
|
|
||||||
/* short */ "XML box",
|
|
||||||
/* long */ "This box provides a tool by which vendors can add XML formatted information to a JP2 file",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {0, 0, 0},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {UUID_SIGN,
|
|
||||||
/* short */ "UUID box",
|
|
||||||
/* long */ "This box provides a tool by which vendors can add additional information to a file "
|
|
||||||
"without risking conflict with other vendors",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {0, 0, 0},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {UINF_SIGN,
|
|
||||||
/* short */ "UUID Info box",
|
|
||||||
/* long */ "This box provides a tool by which a vendor may provide access to additional information associated with a UUID",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {0, 0, 0},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {MOOV_SIGN,
|
|
||||||
/* short */ "Movie box",
|
|
||||||
/* long */ "This box contains the media data. In video tracks, this box would contain JPEG2000 video frames",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {MVHD_SIGN,
|
|
||||||
/* short */ "Movie Header box",
|
|
||||||
/* long */ "This box defines overall information which is media-independent, and relevant to the entire presentation "
|
|
||||||
"considered as a whole",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ MOOV_BOX},
|
|
||||||
|
|
||||||
/* sign */ {TRAK_SIGN,
|
|
||||||
/* short */ "Track box",
|
|
||||||
/* long */ "This is a container box for a single track of a presentation. A presentation may consist of one or more tracks",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ MOOV_BOX},
|
|
||||||
|
|
||||||
/* sign */ {TKHD_SIGN,
|
|
||||||
/* short */ "Track Header box",
|
|
||||||
/* long */ "This box specifies the characteristics of a single track. Exactly one Track Header Box is contained in a track",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ TRAK_BOX},
|
|
||||||
|
|
||||||
/* sign */ {MDIA_SIGN,
|
|
||||||
/* short */ "Media box",
|
|
||||||
/* long */ "The media declaration container contains all the objects which declare information about the media data "
|
|
||||||
"within a track",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ TRAK_BOX},
|
|
||||||
|
|
||||||
/* sign */ {MINF_SIGN,
|
|
||||||
/* short */ "Media Information box",
|
|
||||||
/* long */ "This box contains all the objects which declare characteristic information of the media in the track",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ MDIA_BOX},
|
|
||||||
|
|
||||||
/* sign */ {STBL_SIGN,
|
|
||||||
/* short */ "Sample Table box",
|
|
||||||
/* long */ "The sample table contains all the time and data indexing of the media samples in a track",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ MINF_BOX},
|
|
||||||
|
|
||||||
/* sign */ {STSD_SIGN,
|
|
||||||
/* short */ "Sample Description box",
|
|
||||||
/* long */ "The sample description table gives detailed information about the coding type used, and any initialization "
|
|
||||||
"information needed for that coding",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ MINF_BOX},
|
|
||||||
|
|
||||||
/* sign */ {MJP2_SIGN,
|
|
||||||
/* short */ "MJP2 Sample Description box",
|
|
||||||
/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization "
|
|
||||||
"information needed for that coding",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ MINF_BOX},
|
|
||||||
|
|
||||||
/* sign */ {MDAT_SIGN,
|
|
||||||
/* short */ "Media Data box",
|
|
||||||
/* long */ "The meta-data for a presentation is stored in the single Movie Box which occurs at the top-level of a file",
|
|
||||||
/* sbox */ 1,
|
|
||||||
/* req */ {1, 1, 1},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {ANY_SIGN,
|
|
||||||
/* short */ "Any box",
|
|
||||||
/* long */ "All the existing boxes",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {0, 0, 0},
|
|
||||||
/* ins */ FILE_BOX},
|
|
||||||
|
|
||||||
/* sign */ {UNK_SIGN,
|
|
||||||
/* short */ "Unknown Type box",
|
|
||||||
/* long */ "The signature is not recognised to be that of an existing box",
|
|
||||||
/* sbox */ 0,
|
|
||||||
/* req */ {0, 0, 0},
|
|
||||||
/* ins */ ANY_BOX}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/* declaration */
|
|
||||||
int
|
|
||||||
my_box_handler_function(my_j2boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
|
||||||
char *scansign, unsigned long int *scanpoint);
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
typedef unsigned __int64 int8byte;
|
|
||||||
#endif // __WXMSW__
|
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
typedef unsigned long long int8byte;
|
|
||||||
#endif // __WXGTK__
|
|
||||||
|
|
||||||
/* internal mini-search for a box signature */
|
|
||||||
int
|
|
||||||
my_jpeg2000parse(wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
|
||||||
char *scansign, unsigned long int *scanpoint)
|
|
||||||
{
|
|
||||||
unsigned long int LBox = 0x00000000;
|
|
||||||
//int LBox_read;
|
|
||||||
char TBox[5] = "\0\0\0\0";
|
|
||||||
//int TBox_read;
|
|
||||||
int8byte XLBox = 0x0000000000000000;
|
|
||||||
//int XLBox_read;
|
|
||||||
unsigned long int box_length = 0;
|
|
||||||
int last_box = 0, box_num = 0;
|
|
||||||
int box_type = ANY_BOX;
|
|
||||||
unsigned char /*onebyte[1], twobytes[2],*/ fourbytes[4];
|
|
||||||
int box_number = 0;
|
|
||||||
|
|
||||||
/* cycle all over the file */
|
|
||||||
box_num = 0;
|
|
||||||
last_box = 0;
|
|
||||||
while (!last_box) {
|
|
||||||
|
|
||||||
/* do not exceed file limit */
|
|
||||||
if (filepoint >= filelimit)
|
|
||||||
return (0);
|
|
||||||
|
|
||||||
/* seek on file */
|
|
||||||
if (stream.SeekI(filepoint, wxFromStart) == wxInvalidOffset)
|
|
||||||
return (-1);
|
|
||||||
|
|
||||||
/* read the mandatory LBox, 4 bytes */
|
|
||||||
if (!stream.Read(fourbytes, 4)) {
|
|
||||||
(wxT("Problem reading LBox from the file (file ended?)"));
|
|
||||||
return -1;
|
|
||||||
};
|
|
||||||
LBox = STREAM_TO_UINT32(fourbytes, 0);
|
|
||||||
|
|
||||||
/* read the mandatory TBox, 4 bytes */
|
|
||||||
if (!stream.Read(TBox, 4)) {
|
|
||||||
wxLogError(wxT("Problem reading TBox from the file (file ended?)"));
|
|
||||||
return -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* look if scansign is got */
|
|
||||||
if ((scansign != NULL) && (memcmp(TBox, scansign, 4) == 0)) {
|
|
||||||
/* hack/exploit */
|
|
||||||
// stop as soon as you find the level-th codebox
|
|
||||||
if (box_number == level) {
|
|
||||||
memcpy(scansign, " ", 4);
|
|
||||||
*scanpoint = filepoint;
|
|
||||||
return (0);
|
|
||||||
} else
|
|
||||||
box_number++;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* determine the box type */
|
|
||||||
for (box_type = JP_BOX; box_type < UNK_BOX; box_type++)
|
|
||||||
if (memcmp(TBox, j2box[box_type].value, 4) == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* read the optional XLBox, 8 bytes */
|
|
||||||
if (LBox == 1) {
|
|
||||||
|
|
||||||
if (!stream.Read(&XLBox, 8)) {
|
|
||||||
wxLogError(wxT("Problem reading XLBox from the file (file ended?)"));
|
|
||||||
return -1;
|
|
||||||
};
|
|
||||||
box_length = (unsigned long int) BYTE_SWAP8(XLBox);
|
|
||||||
|
|
||||||
} else if (LBox == 0x00000000) {
|
|
||||||
|
|
||||||
/* last box in file */
|
|
||||||
last_box = 1;
|
|
||||||
box_length = filelimit - filepoint;
|
|
||||||
|
|
||||||
} else
|
|
||||||
|
|
||||||
box_length = LBox;
|
|
||||||
|
|
||||||
|
|
||||||
/* go deep in the box */
|
|
||||||
my_box_handler_function((my_j2boxtype) box_type, stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length, level,
|
|
||||||
scansign, scanpoint);
|
|
||||||
|
|
||||||
/* if it's a superbox go inside it */
|
|
||||||
if (j2box[box_type].sbox)
|
|
||||||
my_jpeg2000parse(stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length,
|
|
||||||
level, scansign, scanpoint);
|
|
||||||
|
|
||||||
/* increment box number and filepoint*/
|
|
||||||
box_num++;
|
|
||||||
filepoint += box_length;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/* all good */
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// search first contiguos codestream box in an mj2 file
|
|
||||||
unsigned long int
|
|
||||||
searchjp2c(wxInputStream& stream, unsigned long int fsize, int number)
|
|
||||||
{
|
|
||||||
char scansign[] = "jp2c";
|
|
||||||
unsigned long int scanpoint = 0L;
|
|
||||||
|
|
||||||
wxLogMessage(wxT("MJ2: searching jp2c box... "));
|
|
||||||
|
|
||||||
/* do the parsing */
|
|
||||||
if (my_jpeg2000parse(stream, 0, fsize, number, scansign, &scanpoint) < 0)
|
|
||||||
wxLogMessage(wxT("MJ2: Unrecoverable error during file parsing: stopping"));
|
|
||||||
|
|
||||||
if (strcmp(scansign, " "))
|
|
||||||
wxLogMessage(wxT("MJ2: not found"));
|
|
||||||
else {
|
|
||||||
|
|
||||||
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (scanpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
// search the jp2h box in the file
|
|
||||||
unsigned long int
|
|
||||||
searchjpegheaderbox(wxInputStream& stream, unsigned long int fsize)
|
|
||||||
{
|
|
||||||
char scansign[] = "jp2h";
|
|
||||||
unsigned long int scanpoint = 0L;
|
|
||||||
|
|
||||||
wxLogMessage(wxT("MJ2: searching jp2h box... "));
|
|
||||||
|
|
||||||
/* do the parsing */
|
|
||||||
if (my_jpeg2000parse(stream, 0, fsize, 0, scansign, &scanpoint) < 0)
|
|
||||||
wxLogMessage(wxT("Unrecoverable error during file parsing: stopping"));
|
|
||||||
|
|
||||||
if (strcmp(scansign, " "))
|
|
||||||
wxLogMessage(wxT("MJ2: not found"));
|
|
||||||
else
|
|
||||||
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
|
|
||||||
|
|
||||||
return (scanpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* handling functions */
|
|
||||||
#define ITEM_PER_ROW 10
|
|
||||||
|
|
||||||
/* Box handler function */
|
|
||||||
int
|
|
||||||
my_box_handler_function(my_j2boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
|
||||||
char *scansign, unsigned long int *scanpoint)
|
|
||||||
{
|
|
||||||
switch (boxtype) {
|
|
||||||
|
|
||||||
/* Sample Description box */
|
|
||||||
case (STSD_BOX):
|
|
||||||
my_jpeg2000parse(stream, filepoint + 8, filelimit, level, scansign, scanpoint);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* MJP2 Sample Description box */
|
|
||||||
case (MJP2_BOX):
|
|
||||||
my_jpeg2000parse(stream, filepoint + 78, filelimit, level, scansign, scanpoint);
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* not yet implemented */
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the jP and ftyp parts of the header
|
|
||||||
#define my_jPheadSIZE 32
|
|
||||||
unsigned char my_jPhead[my_jPheadSIZE] = {
|
|
||||||
0x00, 0x00, 0x00, 0x0C, 'j', 'P', ' ', ' ',
|
|
||||||
0x0D, 0x0A, 0x87, 0x0A, 0x00, 0x00, 0x00, 0x14,
|
|
||||||
'f', 't', 'y', 'p', 'j', 'p', '2', ' ',
|
|
||||||
0x00, 0x00, 0x00, 0x00, 'j', 'p', '2', ' '
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// load the mj2 file format
|
|
||||||
bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
|
||||||
{
|
|
||||||
opj_dparameters_t parameters; /* decompression parameters */
|
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
|
||||||
opj_image_t *opjimage = NULL;
|
|
||||||
unsigned char *src = NULL;
|
|
||||||
unsigned char *ptr;
|
|
||||||
int file_length, jp2c_point, jp2h_point;
|
|
||||||
unsigned long int jp2hboxlen, jp2cboxlen;
|
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
|
||||||
|
|
||||||
// destroy the image
|
|
||||||
image->Destroy();
|
|
||||||
|
|
||||||
/* handle to a decompressor */
|
|
||||||
opj_dinfo_t* dinfo = NULL;
|
|
||||||
opj_cio_t *cio = NULL;
|
|
||||||
|
|
||||||
/* configure the event callbacks (not required) */
|
|
||||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
|
||||||
event_mgr.error_handler = mj2_error_callback;
|
|
||||||
event_mgr.warning_handler = mj2_warning_callback;
|
|
||||||
event_mgr.info_handler = mj2_info_callback;
|
|
||||||
|
|
||||||
/* set decoding parameters to default values */
|
|
||||||
opj_set_default_decoder_parameters(¶meters);
|
|
||||||
|
|
||||||
/* prepare parameters */
|
|
||||||
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
|
||||||
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
|
||||||
parameters.decod_format = JP2_CFMT;
|
|
||||||
parameters.cod_format = BMP_DFMT;
|
|
||||||
if (m_reducefactor)
|
|
||||||
parameters.cp_reduce = m_reducefactor;
|
|
||||||
if (m_qualitylayers)
|
|
||||||
parameters.cp_layer = m_qualitylayers;
|
|
||||||
/*if (n_components)
|
|
||||||
parameters. = n_components;*/
|
|
||||||
|
|
||||||
/* JPWL only */
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
parameters.jpwl_exp_comps = m_expcomps;
|
|
||||||
parameters.jpwl_max_tiles = m_maxtiles;
|
|
||||||
parameters.jpwl_correct = m_enablejpwl;
|
|
||||||
#endif /* USE_JPWL */
|
|
||||||
|
|
||||||
/* get a decoder handle */
|
|
||||||
dinfo = opj_create_decompress(CODEC_JP2);
|
|
||||||
|
|
||||||
/* find length of the stream */
|
|
||||||
stream.SeekI(0, wxFromEnd);
|
|
||||||
file_length = (int) stream.TellI();
|
|
||||||
|
|
||||||
/* search for the first codestream box and the movie header box */
|
|
||||||
jp2c_point = searchjp2c(stream, file_length, m_framenum);
|
|
||||||
jp2h_point = searchjpegheaderbox(stream, file_length);
|
|
||||||
|
|
||||||
// read the jp2h box and store it
|
|
||||||
stream.SeekI(jp2h_point, wxFromStart);
|
|
||||||
stream.Read(&jp2hboxlen, sizeof(unsigned long int));
|
|
||||||
jp2hboxlen = BYTE_SWAP4(jp2hboxlen);
|
|
||||||
|
|
||||||
// read the jp2c box and store it
|
|
||||||
stream.SeekI(jp2c_point, wxFromStart);
|
|
||||||
stream.Read(&jp2cboxlen, sizeof(unsigned long int));
|
|
||||||
jp2cboxlen = BYTE_SWAP4(jp2cboxlen);
|
|
||||||
|
|
||||||
// malloc memory source
|
|
||||||
src = (unsigned char *) malloc(my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
|
||||||
|
|
||||||
// copy the jP and ftyp
|
|
||||||
memcpy(src, my_jPhead, my_jPheadSIZE);
|
|
||||||
|
|
||||||
// copy the jp2h
|
|
||||||
stream.SeekI(jp2h_point, wxFromStart);
|
|
||||||
stream.Read(&src[my_jPheadSIZE], jp2hboxlen);
|
|
||||||
|
|
||||||
// copy the jp2c
|
|
||||||
stream.SeekI(jp2c_point, wxFromStart);
|
|
||||||
stream.Read(&src[my_jPheadSIZE + jp2hboxlen], jp2cboxlen);
|
|
||||||
|
|
||||||
/* 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, ¶meters);
|
|
||||||
|
|
||||||
/* open a byte stream */
|
|
||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
|
||||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
|
||||||
if (!opjimage) {
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
wxLogError(wxT("MJ2: failed to decode image!"));
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
opj_destroy_decompress(dinfo);
|
|
||||||
opj_cio_close(cio);
|
|
||||||
free(src);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* close the byte stream */
|
|
||||||
opj_cio_close(cio);
|
|
||||||
|
|
||||||
/* common rendering method */
|
|
||||||
#include "imagjpeg2000.cpp"
|
|
||||||
|
|
||||||
wxMutexGuiEnter();
|
|
||||||
wxLogMessage(wxT("MJ2: image loaded."));
|
|
||||||
wxMutexGuiLeave();
|
|
||||||
|
|
||||||
/* close openjpeg structs */
|
|
||||||
opj_destroy_decompress(dinfo);
|
|
||||||
opj_image_destroy(opjimage);
|
|
||||||
free(src);
|
|
||||||
|
|
||||||
if (!image->Ok())
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// save the mj2 file format
|
|
||||||
bool wxMJ2Handler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
|
||||||
{
|
|
||||||
wxLogError(wxT("MJ2: Couldn't save movie -> not implemented."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __VISUALC__
|
|
||||||
#pragma warning(default:4611)
|
|
||||||
#endif /* VC++ */
|
|
||||||
|
|
||||||
// recognize the Motion JPEG 2000 starting box
|
|
||||||
bool wxMJ2Handler::DoCanRead( wxInputStream& stream )
|
|
||||||
{
|
|
||||||
unsigned char hdr[24];
|
|
||||||
|
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (hdr[0] == 0x00 &&
|
|
||||||
hdr[1] == 0x00 &&
|
|
||||||
hdr[2] == 0x00 &&
|
|
||||||
hdr[3] == 0x0C &&
|
|
||||||
hdr[4] == 0x6A &&
|
|
||||||
hdr[5] == 0x50 &&
|
|
||||||
hdr[6] == 0x20 &&
|
|
||||||
hdr[7] == 0x20 &&
|
|
||||||
hdr[20] == 0x6D &&
|
|
||||||
hdr[21] == 0x6A &&
|
|
||||||
hdr[22] == 0x70 &&
|
|
||||||
hdr[23] == 0x32);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // wxUSE_STREAMS
|
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Name: imagmj2.h
|
|
||||||
// Purpose: wxImage Motion JPEG 2000 file format handler
|
|
||||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
|
||||||
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/02/18 23:45:00 VZ Exp $
|
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
|
||||||
// Licence: wxWindows licence
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef _WX_IMAGMJ2_H_
|
|
||||||
#define _WX_IMAGMJ2_H_
|
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxMJ2Handler
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#if wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#include "wx/image.h"
|
|
||||||
#include "libopenjpeg/openjpeg.h"
|
|
||||||
|
|
||||||
#define wxBITMAP_TYPE_MJ2 49
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxMJ2Handler: public wxImageHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
inline wxMJ2Handler()
|
|
||||||
{
|
|
||||||
m_name = wxT("Motion JPEG 2000 file format");
|
|
||||||
m_extension = wxT("mj2");
|
|
||||||
m_type = wxBITMAP_TYPE_MJ2;
|
|
||||||
m_mime = wxT("image/mj2");
|
|
||||||
|
|
||||||
m_reducefactor = 0;
|
|
||||||
m_qualitylayers = 0;
|
|
||||||
m_components = 0;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
m_enablejpwl = true;
|
|
||||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
|
||||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
|
||||||
#endif // USE_JPWL
|
|
||||||
}
|
|
||||||
|
|
||||||
// decoding engine parameters
|
|
||||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
|
||||||
#ifdef USE_JPWL
|
|
||||||
bool m_enablejpwl;
|
|
||||||
int m_expcomps, m_maxtiles;
|
|
||||||
#endif // USE_JPWL
|
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
|
||||||
protected:
|
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMJ2Handler)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
|
||||||
|
|
||||||
#endif // _WX_IMAGMJ2_H_
|
|
||||||
|
|
||||||
@@ -34,6 +34,30 @@
|
|||||||
|
|
||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
|
|
||||||
|
#include "mxflib/mxflib.h"
|
||||||
|
using namespace mxflib;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//! Structure holding information about the essence in each body stream
|
||||||
|
struct EssenceInfo
|
||||||
|
{
|
||||||
|
UMIDPtr PackageID;
|
||||||
|
PackagePtr Package;
|
||||||
|
MDObjectPtr Descriptor;
|
||||||
|
};
|
||||||
|
//! Map of EssenceInfo structures indexed by BodySID
|
||||||
|
typedef std::map<UInt32, EssenceInfo> EssenceInfoMap;
|
||||||
|
|
||||||
|
//! The map of essence info for this file
|
||||||
|
EssenceInfoMap EssenceLookup;
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Build an EssenceInfoMap for the essence in a given file
|
||||||
|
/*! \return True if al OK, else false
|
||||||
|
*/
|
||||||
|
bool BuildEssenceInfo(MXFFilePtr &File, EssenceInfoMap &EssenceLookup);
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
@@ -73,6 +97,81 @@ IMPLEMENT_DYNAMIC_CLASS(wxMXFHandler,wxImageHandler)
|
|||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#define MAX_MESSAGE_LEN 200
|
||||||
|
|
||||||
|
//------------- MXF Manager
|
||||||
|
|
||||||
|
// Debug and error messages
|
||||||
|
|
||||||
|
//! Display a warning message
|
||||||
|
void mxflib::warning(const char *Fmt, ...)
|
||||||
|
{
|
||||||
|
char msg[MAX_MESSAGE_LEN];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, Fmt);
|
||||||
|
_vsnprintf(msg, MAX_MESSAGE_LEN, Fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[WARNING_MXF] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Display an error message
|
||||||
|
void mxflib::error(const char *Fmt, ...)
|
||||||
|
{
|
||||||
|
char msg[MAX_MESSAGE_LEN];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, Fmt);
|
||||||
|
_vsnprintf(msg, MAX_MESSAGE_LEN, Fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[ERROR_MXF] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Display an error message
|
||||||
|
void mxflib::debug(const char *Fmt, ...)
|
||||||
|
{
|
||||||
|
char msg[MAX_MESSAGE_LEN];
|
||||||
|
va_list args;
|
||||||
|
|
||||||
|
va_start(args, Fmt);
|
||||||
|
_vsnprintf(msg, MAX_MESSAGE_LEN, Fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[DEBUG_MXF] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------- JPEG 2000 Data Source Manager
|
//------------- JPEG 2000 Data Source Manager
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
#define J2K_CFMT 0
|
||||||
@@ -84,8 +183,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxMXFHandler,wxImageHandler)
|
|||||||
#define BMP_DFMT 2
|
#define BMP_DFMT 2
|
||||||
#define YUV_DFMT 3
|
#define YUV_DFMT 3
|
||||||
|
|
||||||
#define MAX_MESSAGE_LEN 200
|
|
||||||
|
|
||||||
/* sample error callback expecting a FILE* client object */
|
/* sample error callback expecting a FILE* client object */
|
||||||
void mxf_error_callback(const char *msg, void *client_data) {
|
void mxf_error_callback(const char *msg, void *client_data) {
|
||||||
int message_len = strlen(msg) - 1;
|
int message_len = strlen(msg) - 1;
|
||||||
@@ -142,7 +239,33 @@ bool wxMXFHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
|
|||||||
unsigned char *ptr;
|
unsigned char *ptr;
|
||||||
int file_length, j2k_point, j2k_len;
|
int file_length, j2k_point, j2k_len;
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||||
|
|
||||||
|
// simply display the version of the library
|
||||||
|
wxLogMessage(wxT("Version of MXF: %s "), wxString::FromAscii(LibraryVersion().c_str()));
|
||||||
|
//wxLogMessage(wxT("MXF file name: %s"), m_filename.GetFullPath());
|
||||||
|
|
||||||
|
// open MXF file
|
||||||
|
MXFFilePtr TestFile = new MXFFile;
|
||||||
|
if (! TestFile->Open(m_filename.GetFullPath().c_str(), true))
|
||||||
|
{
|
||||||
|
wxLogError(wxT("Could not find %s"), m_filename.GetFullPath().c_str());
|
||||||
|
return false;
|
||||||
|
} else
|
||||||
|
wxLogMessage(wxT("Found %s"), m_filename.GetFullPath().c_str());
|
||||||
|
|
||||||
|
// Get the size
|
||||||
|
TestFile->SeekEnd();
|
||||||
|
wxLogMessage(wxT("Size is %d bytes"), TestFile->Tell());
|
||||||
|
TestFile->Seek(0);
|
||||||
|
|
||||||
|
// essence information
|
||||||
|
//BuildEssenceInfo(TestFile, EssenceLookup);
|
||||||
|
|
||||||
|
// close MXF file
|
||||||
|
TestFile->Close();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
// destroy the image
|
// destroy the image
|
||||||
image->Destroy();
|
image->Destroy();
|
||||||
|
|
||||||
@@ -266,6 +389,111 @@ bool wxMXFHandler::DoCanRead( wxInputStream& stream )
|
|||||||
hdr[3] == 0x34);
|
hdr[3] == 0x34);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Build an EssenceInfoMap for the essence in a given file
|
||||||
|
/*! \return True if al OK, else false
|
||||||
|
*/
|
||||||
|
bool BuildEssenceInfo(MXFFilePtr &File, EssenceInfoMap &EssenceLookup)
|
||||||
|
{
|
||||||
|
// Empty any old data
|
||||||
|
EssenceLookup.clear();
|
||||||
|
|
||||||
|
// Get the master metadata set (or the header if we must)
|
||||||
|
PartitionPtr MasterPartition = File->ReadMasterPartition();
|
||||||
|
if(!MasterPartition)
|
||||||
|
{
|
||||||
|
File->Seek(0);
|
||||||
|
MasterPartition = File->ReadPartition();
|
||||||
|
warning("File %s does not contain a cloased copy of header metadata - using the open copy in the file header\n", File->Name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!MasterPartition)
|
||||||
|
{
|
||||||
|
error("Could not read header metadata from file %s\n", File->Name.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read and parse the metadata
|
||||||
|
MasterPartition->ReadMetadata();
|
||||||
|
MetadataPtr HMeta = MasterPartition->ParseMetadata();
|
||||||
|
|
||||||
|
if(!HMeta)
|
||||||
|
{
|
||||||
|
error("Could not read header metadata from file %s\n", File->Name.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scan the Essence container data sets to get PackageID to BodySID mapping */
|
||||||
|
MDObjectPtr ECDSet = HMeta[ContentStorage_UL];
|
||||||
|
if(ECDSet) ECDSet = ECDSet->GetLink();
|
||||||
|
if(ECDSet) ECDSet = ECDSet[EssenceContainerDataBatch_UL];
|
||||||
|
if(!ECDSet)
|
||||||
|
{
|
||||||
|
error("Header metadata in file %s does not contain an EssenceContainerData set\n", File->Name.c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MDObject::iterator it = ECDSet->begin();
|
||||||
|
while(it != ECDSet->end())
|
||||||
|
{
|
||||||
|
MDObjectPtr ThisECDSet = (*it).second->GetLink();
|
||||||
|
MDObjectPtr PackageID;
|
||||||
|
if(ThisECDSet) PackageID = ThisECDSet->Child(LinkedPackageUID_UL);
|
||||||
|
if(PackageID)
|
||||||
|
{
|
||||||
|
EssenceInfo NewEI;
|
||||||
|
NewEI.PackageID = new UMID(PackageID->PutData()->Data);
|
||||||
|
|
||||||
|
// Inset the basic essence info - but not if this is external essence (BodySID == 0)
|
||||||
|
UInt32 BodySID = ThisECDSet->GetUInt(BodySID_UL);
|
||||||
|
if(BodySID) EssenceLookup[BodySID] = NewEI;
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now find the other items for the essence lookup map */
|
||||||
|
if(EssenceLookup.size())
|
||||||
|
{
|
||||||
|
PackageList::iterator it = HMeta->Packages.begin();
|
||||||
|
while(it != HMeta->Packages.end())
|
||||||
|
{
|
||||||
|
// Only Source Packages are of interest
|
||||||
|
if((*it)->IsA(SourcePackage_UL))
|
||||||
|
{
|
||||||
|
MDObjectPtr Descriptor = (*it)->Child(Descriptor_UL);
|
||||||
|
if(Descriptor) Descriptor = Descriptor->GetLink();
|
||||||
|
|
||||||
|
if(Descriptor)
|
||||||
|
{
|
||||||
|
MDObjectPtr PackageID = (*it)->Child(PackageUID_UL);
|
||||||
|
if(PackageID)
|
||||||
|
{
|
||||||
|
UMIDPtr TheID = new UMID(PackageID->PutData()->Data);
|
||||||
|
|
||||||
|
/* Now do a lookup in the essence lookup map (it will need to be done the long way here */
|
||||||
|
EssenceInfoMap::iterator EL_it = EssenceLookup.begin();
|
||||||
|
while(EL_it != EssenceLookup.end())
|
||||||
|
{
|
||||||
|
if((*((*EL_it).second.PackageID)) == (*TheID))
|
||||||
|
{
|
||||||
|
// If found, set the missing items and stop searching
|
||||||
|
(*EL_it).second.Package = (*it);
|
||||||
|
(*EL_it).second.Descriptor = Descriptor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
EL_it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
#include "wx/filename.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMXFHandler
|
// wxMXFHandler
|
||||||
@@ -48,7 +49,7 @@
|
|||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "libopenjpeg/openjpeg.h"
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
#define wxBITMAP_TYPE_MXF 50
|
#define wxBITMAP_TYPE_MXF 51
|
||||||
|
|
||||||
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
||||||
{
|
{
|
||||||
@@ -63,6 +64,7 @@ public:
|
|||||||
m_reducefactor = 0;
|
m_reducefactor = 0;
|
||||||
m_qualitylayers = 0;
|
m_qualitylayers = 0;
|
||||||
m_components = 0;
|
m_components = 0;
|
||||||
|
m_filename = wxT("");
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
m_enablejpwl = true;
|
m_enablejpwl = true;
|
||||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||||
@@ -72,6 +74,7 @@ public:
|
|||||||
|
|
||||||
// decoding engine parameters
|
// decoding engine parameters
|
||||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||||
|
wxFileName m_filename;
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
bool m_enablejpwl;
|
bool m_enablejpwl;
|
||||||
int m_expcomps, m_maxtiles;
|
int m_expcomps, m_maxtiles;
|
||||||
|
|||||||
2
OPJ_Validate/Makefile
Normal file
2
OPJ_Validate/Makefile
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
OPJ_Validate_Makee: OPJ_Validate.c md5.c
|
||||||
|
gcc -o OPJ_Validate OPJ_Validate.c md5.c -I.
|
||||||
100
OPJ_Validate/OPJ_Param_File_v0_1.txt
Normal file
100
OPJ_Validate/OPJ_Param_File_v0_1.txt
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#Version 0.1 - February 9th 2007
|
||||||
|
#Usage: OPJ_Validate OpenJPEG_command_line
|
||||||
|
#Example: OPJ_Validate image_to_j2k.exe -i original/Bretagne1.ppm -o original/Bretagne1.j2k -r 200, 50, 10
|
||||||
|
#Attention: don't forget the *.exe extension for the executable file, and check the paths
|
||||||
|
|
||||||
|
image_to_j2k.exe -i original/Bretagne1.ppm -o temp/Bretagne1_0.j2k -r 200,50,10
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1.ppm
|
||||||
|
image_to_j2k.exe -i original/Bretagne2.ppm -o temp/Bretagne2_0.j2k -c [128,128],[128,128],[128,128] -r 100,20,2 -t 640,480 -b 32,32
|
||||||
|
j2k_to_image.exe -i original/Bretagne2.j2k -o temp/Bretagne2.ppm -r 2
|
||||||
|
image_to_j2k.exe -i original/Cevennes1.bmp -o temp/Cevennes1.j2k -r 10
|
||||||
|
j2k_to_image.exe -i original/Cevennes1.j2k -o temp/Cevennes1.bmp -l 2
|
||||||
|
image_to_j2k.exe -i original/Cevennes2.ppm -o temp/Cevennes2.jp2 -r 50
|
||||||
|
j2k_to_image.exe -i original/Cevennes2.jp2 -o temp/Cevennes2.ppm
|
||||||
|
image_to_j2k.exe -i original/Rome.bmp -o temp/Rome.jp2 -q 30,35,50 -p LRCP -n 3
|
||||||
|
j2k_to_image.exe -i original/Rome.jp2 -o temp/Rome.ppm
|
||||||
|
image_to_j2k.exe -i original/Bretagne1.ppm -o temp/Bretagne1_1.j2k -q 30,35,40 -n 2
|
||||||
|
image_to_j2k.exe -i original/Bretagne1.ppm -o temp/Bretagne1_2.j2k -q 30,35,40 -b 16,16 -c [101,101]
|
||||||
|
image_to_j2k.exe -i original/Bretagne2.ppm -o temp/Bretagne2_1.j2k -t 127,127 -p PCRL
|
||||||
|
image_to_j2k.exe -i original/X_4_2K_24_185_CBR_WB_000.tif -o temp/X_4_2K_24_185_CBR_WB_000.j2k -cinema2K 24
|
||||||
|
image_to_j2k.exe -i original/X_5_2K_24_235_CBR_STEM24_000.tif -o temp/X_5_2K_24_235_CBR_STEM24_000.j2k -cinema2K 48
|
||||||
|
image_to_j2k.exe -i original/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o temp/X_6_2K_24_FULL_CBR_CIRCLE_000.j2k -cinema2K 24
|
||||||
|
#<23> remettre
|
||||||
|
#image_to_j2k.exe -i original/X_16_4K_24_185_CBR_WB_000.tif -o temp/X_16_4K_24_185_CBR_WB_000.j2k -cinema4K
|
||||||
|
j2k_to_image.exe -i original/A_4_2K_24_185_CBR_WB_000.j2k -o temp/A_4_2K_24_185_CBR_WB_000.tif
|
||||||
|
j2k_to_image.exe -i original/B_5_2K_24_235_CBR_STEM24_000.j2k -o temp/B_5_2K_24_235_CBR_STEM24_000.tif
|
||||||
|
j2k_to_image.exe -i original/C_6_2K_24_FULL_CBR_CIRCLE_000.j2k -o temp/C_6_2K_24_FULL_CBR_CIRCLE_000.tif
|
||||||
|
#<23> remettre
|
||||||
|
#j2k_to_image.exe -i original/C_18_4K_24_FULL_CBR_CIRCLE_000.j2k -o temp/C_18_4K_24_FULL_CBR_CIRCLE_000.tif
|
||||||
|
j2k_to_image.exe -i original/p0_01.j2k -o temp/p0_01.tif
|
||||||
|
j2k_to_image.exe -i original/p0_02.j2k -o temp/p0_02.tif
|
||||||
|
j2k_to_image.exe -i original/p0_03.j2k -o temp/p0_03.tif
|
||||||
|
j2k_to_image.exe -i original/p0_04.j2k -o temp/p0_04.tif
|
||||||
|
#<23> remettre
|
||||||
|
#j2k_to_image.exe -i original/p0_07.j2k -o temp/p0_07.tif
|
||||||
|
j2k_to_image.exe -i original/p0_08.j2k -o temp/p0_08.tif
|
||||||
|
j2k_to_image.exe -i original/p0_09.j2k -o temp/p0_09.tif
|
||||||
|
j2k_to_image.exe -i original/p0_10.j2k -o temp/p0_10.tif
|
||||||
|
j2k_to_image.exe -i original/p0_11.j2k -o temp/p0_11.tif
|
||||||
|
j2k_to_image.exe -i original/p0_12.j2k -o temp/p0_12.tif
|
||||||
|
j2k_to_image.exe -i original/p0_14.j2k -o temp/p0_14.tif
|
||||||
|
j2k_to_image.exe -i original/p0_15.j2k -o temp/p0_15.tif
|
||||||
|
j2k_to_image.exe -i original/p0_16.j2k -o temp/p0_16.tif
|
||||||
|
j2k_to_image.exe -i original/p1_01.j2k -o temp/p1_01.tif
|
||||||
|
j2k_to_image.exe -i original/p1_02.j2k -o temp/p1_02.tif
|
||||||
|
j2k_to_image.exe -i original/p1_04.j2k -o temp/p1_04.tif
|
||||||
|
j2k_to_image.exe -i original/p1_05.j2k -o temp/p1_05.tif
|
||||||
|
j2k_to_image.exe -i original/p1_06.j2k -o temp/p1_06.tif
|
||||||
|
image_to_j2k.exe -i original/c0p0_01.pgx -o temp/c0p0_01.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_02.pgx -o temp/c0p0_02.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_03r0.pgx -o temp/c0p0_03r0.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_03r1.pgx -o temp/c0p0_03r1.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_04.pgx -o temp/c00_p04.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_05.pgx -o temp/c0p0_05.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_06.pgx -o temp/c0p0_06.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_07.pgx -o temp/c0p0_07.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_08.pgx -o temp/c0p0_08.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_09.pgx -o temp/c0p0_09.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_10.pgx -o temp/c0p0_10.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_11.pgx -o temp/c0p0_11.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_12.pgx -o temp/c0p0_12.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_13.pgx -o temp/c0p0_13.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_14.pgx -o temp/c0p0_14.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_15r0.pgx -o temp/c0p0_15r0.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_15r1.pgx -o temp/c0p0_15r1.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p0_16.pgx -o temp/c0p0_16.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p1_04r0.pgx -o temp/c0p1_04r0.j2k
|
||||||
|
image_to_j2k.exe -i original/c0p1_05.pgx -o temp/c0p1_05.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_01_0.pgx -o temp/c1p0_01_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_02_0.pgx -o temp/c1p0_02_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_03_0.pgx -o temp/c1p0_03_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_04_0.pgx -o temp/c1p0_04_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_05_0.pgx -o temp/c1p0_05_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_06_0.pgx -o temp/c1p0_06_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_07_0.pgx -o temp/c1p0_07_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_08_0.pgx -o temp/c1p0_08_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_09_0.pgx -o temp/c1p0_09_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_10_0.pgx -o temp/c1p0_10_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_11_0.pgx -o temp/c1p0_11_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_12_0.pgx -o temp/c1p0_12_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_13_0.pgx -o temp/c1p0_13_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_14_0.pgx -o temp/c1p0_14_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_15_0.pgx -o temp/c1p0_15_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p0_16_0.pgx -o temp/c1p0_16_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p1_02_0.pgx -o temp/c1p1_02_0.j2k
|
||||||
|
image_to_j2k.exe -i original/c1p1_05_0.pgx -o temp/c1p1_05_0.j2k
|
||||||
|
image_to_j2k.exe -i original/Bretagne2.ppm -o temp/Bretagne2_2.j2k -s 2,2 -SOP
|
||||||
|
image_to_j2k.exe -i original/Bretagne2.ppm -o temp/Bretagne2_3.j2k -EPH -M 38
|
||||||
|
image_to_j2k.exe -i original/Bretagne2.ppm -o temp/Bretagne2_4.j2k -d 150,300 -r 800
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1.bmp
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1r2.bmp -r 2
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1.tga
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1r2.tga -r 2
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1.pnm
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1r2.pnm -r 2
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1r2.ppm -r 2
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1.raw
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1r2.raw -r 2
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1.tif
|
||||||
|
j2k_to_image.exe -i original/Bretagne1.j2k -o temp/Bretagne1r2.tif -r 2
|
||||||
|
j2k_to_image.exe -i original/p0_03.j2k -o p0_03.pgx
|
||||||
244
OPJ_Validate/OPJ_Validate.c
Normal file
244
OPJ_Validate/OPJ_Validate.c
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "md5.h"
|
||||||
|
|
||||||
|
#define OPJ_Bin_Dir "OPJ_Binaries"
|
||||||
|
|
||||||
|
int doprocess(char programme[4096],char command_line[4096]) {
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
int exit=STILL_ACTIVE;
|
||||||
|
STARTUPINFO siStartupInfo;
|
||||||
|
PROCESS_INFORMATION piProcessInfo;
|
||||||
|
|
||||||
|
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
|
||||||
|
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
|
||||||
|
siStartupInfo.cb = sizeof(siStartupInfo);
|
||||||
|
|
||||||
|
if(CreateProcess(programme, // Application name
|
||||||
|
command_line, // Application arguments
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
CREATE_DEFAULT_ERROR_MODE,
|
||||||
|
0,
|
||||||
|
0, // Working directory
|
||||||
|
&siStartupInfo,
|
||||||
|
&piProcessInfo) == FALSE)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
exit=STILL_ACTIVE;
|
||||||
|
while(exit==STILL_ACTIVE) {
|
||||||
|
Sleep(1000);
|
||||||
|
GetExitCodeProcess(piProcessInfo.hProcess,&exit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#else /* !_WIN32 */
|
||||||
|
printf("\n%s\n", command_line);
|
||||||
|
system(command_line);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
char MD5_process(char *input_filename, char *md5_filename) {
|
||||||
|
MD5_CTX mdContext;
|
||||||
|
int bytes;
|
||||||
|
unsigned char data[1024];
|
||||||
|
FILE *input_file, *md5_file;
|
||||||
|
|
||||||
|
input_file = fopen(input_filename, "rb");
|
||||||
|
if (!input_file) {
|
||||||
|
printf("Error opening file %s\n", input_filename);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
md5_file = fopen(md5_filename, "wb");
|
||||||
|
if (!md5_file) {
|
||||||
|
printf("Error opening file %s\n", md5_filename);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
MD5Init (&mdContext);
|
||||||
|
while ((bytes = fread (data, 1, 1024, input_file)) != 0)
|
||||||
|
MD5Update (&mdContext, data, bytes);
|
||||||
|
MD5Final (&mdContext);
|
||||||
|
|
||||||
|
fwrite(mdContext.digest,16,1,md5_file);
|
||||||
|
|
||||||
|
fclose(input_file);
|
||||||
|
fclose(md5_file);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char fcompare(char *input_filename, char *output_filename) {
|
||||||
|
FILE *input_file, *output_file;
|
||||||
|
unsigned char input_buffer[17], output_buffer[17];
|
||||||
|
char comparison;
|
||||||
|
|
||||||
|
input_file = fopen(input_filename, "rb");
|
||||||
|
if (!input_file) {
|
||||||
|
printf("Error opening file %s\n", input_filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
output_file = fopen(output_filename, "rb");
|
||||||
|
if (!output_file) {
|
||||||
|
printf("Error opening file %s\n", output_filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fread(input_buffer,16,1,input_file);
|
||||||
|
fread(output_buffer,16,1,output_file);
|
||||||
|
fclose(input_file);
|
||||||
|
fclose(output_file);
|
||||||
|
input_buffer[16] = 0;
|
||||||
|
output_buffer[16] = 0;
|
||||||
|
|
||||||
|
comparison = strcmp(input_buffer, output_buffer);
|
||||||
|
|
||||||
|
if (comparison)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
FILE *param_file, *md5_file;
|
||||||
|
FILE *report_file;
|
||||||
|
char line[4096];
|
||||||
|
char md5_filename[4096], tempmd5_filename[4096], temp[4096], report_filename[4096];
|
||||||
|
char output_filename[4096];
|
||||||
|
char input_cmdline[4096];
|
||||||
|
char command_line[4096], exefile[4096];
|
||||||
|
int task_counter = 0, word_counter;
|
||||||
|
char bin_dir[4096];
|
||||||
|
unsigned int word_pointer;
|
||||||
|
char ch[4096];
|
||||||
|
char comparison;
|
||||||
|
int num_failed = 0;
|
||||||
|
int num_inexistant = 0;
|
||||||
|
int num_passed = 0;
|
||||||
|
|
||||||
|
if (argc != 3) {
|
||||||
|
printf("Error with command line. \nExpected: OPJ_Validate parameter_filename bin_directory\n Example: OPJ_Validate parameters_01.txt version1.1.a\n\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
param_file = fopen(argv[1],"rb");
|
||||||
|
if (!param_file) {
|
||||||
|
printf("Error opening parameter file %s\n",argv[1]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(bin_dir,"%s/%s",OPJ_Bin_Dir,argv[2]);
|
||||||
|
sprintf(tempmd5_filename,"temp/tempmd5.txt");
|
||||||
|
sprintf(report_filename,"%s/report.txt",bin_dir);
|
||||||
|
report_file = fopen(report_filename, "wb");
|
||||||
|
if (!report_file) {
|
||||||
|
printf("Unable to open report file %s", report_filename);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fgets(line, 4096, param_file) != NULL) {
|
||||||
|
|
||||||
|
if (line[0] != '#' && line[0] != 0x0d) { // If not a comment line
|
||||||
|
sscanf(line, "%s", temp);
|
||||||
|
word_pointer = 0;
|
||||||
|
sprintf(input_cmdline,"");
|
||||||
|
sscanf(line+word_pointer,"%s",ch);
|
||||||
|
sprintf(exefile,"%s/%s",bin_dir,ch);
|
||||||
|
word_counter = 0;
|
||||||
|
while (sscanf(line+word_pointer,"%s",ch) > 0) {
|
||||||
|
if (word_counter == 4)
|
||||||
|
strcpy(output_filename, ch);
|
||||||
|
word_pointer += strlen(ch)+1;
|
||||||
|
sprintf(input_cmdline,"%s%s ",input_cmdline, ch);
|
||||||
|
word_counter++;
|
||||||
|
}
|
||||||
|
sprintf(md5_filename,"%s.md5",output_filename);
|
||||||
|
task_counter++;
|
||||||
|
sprintf(command_line,"%s/%s",bin_dir,input_cmdline);
|
||||||
|
printf("Task %d\nMD5 file: %s\nCommand line: \"%s\"\n",task_counter, md5_filename,command_line);
|
||||||
|
fprintf(report_file,"Task %d\n MD5 file: %s\n Command line: \"%s\"\n",task_counter, md5_filename,command_line);
|
||||||
|
|
||||||
|
if (doprocess(exefile,command_line)) {
|
||||||
|
printf("Error executing: \"%s\" \n", command_line);
|
||||||
|
fprintf(report_file,"Task %d failed because command line is not valid.\n\n", task_counter);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// Check if MD5 reference exists
|
||||||
|
md5_file = fopen(md5_filename,"rb");
|
||||||
|
if (md5_file) {
|
||||||
|
fclose(md5_file);
|
||||||
|
if (MD5_process(output_filename, tempmd5_filename))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
comparison = fcompare(tempmd5_filename, md5_filename);
|
||||||
|
if (comparison == -1)
|
||||||
|
return 1;
|
||||||
|
else if (comparison) {
|
||||||
|
printf("ERROR: %s and %s are different.\nThe codec seems to behave differently.\n\n", tempmd5_filename, md5_filename);
|
||||||
|
fprintf(report_file,"ERROR: %s and %s are different.\nThe codec seems to behave differently.\n\n", tempmd5_filename, md5_filename);
|
||||||
|
num_failed++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("%s and %s are the same.\nTask %d OK\n\n",tempmd5_filename, md5_filename, task_counter);
|
||||||
|
fprintf(report_file," %s and %s are the same.\nTask %d OK\n\n",tempmd5_filename, md5_filename, task_counter);
|
||||||
|
num_passed++;
|
||||||
|
}
|
||||||
|
remove(tempmd5_filename);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (MD5_process(output_filename, md5_filename))
|
||||||
|
return 1;
|
||||||
|
printf("... MD5 of %s was inexistant. It has been created\n\n", output_filename);
|
||||||
|
fprintf(report_file,"MD5 of %s was inexistant. It has been created\n\n", output_filename);
|
||||||
|
num_inexistant++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\nREPORT;\n%d tests num_passed\n%d tests num_failed\n%d MD5 were num_inexistant\n", num_passed, num_failed, num_inexistant);
|
||||||
|
fprintf(report_file,"\nREPORT;\n%d tests num_passed\n%d tests num_failed\n%d MD5 were num_inexistant\n", num_passed, num_failed, num_inexistant);
|
||||||
|
fclose(param_file);
|
||||||
|
fclose(report_file);
|
||||||
|
|
||||||
|
}
|
||||||
108
OPJ_Validate/OPJ_Validate.dsp
Normal file
108
OPJ_Validate/OPJ_Validate.dsp
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="OPJ_Validate" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=OPJ_Validate - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "OPJ_Validate.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "OPJ_Validate.mak" CFG="OPJ_Validate - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "OPJ_Validate - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "OPJ_Validate - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "OPJ_Validate - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD BASE RSC /l 0x80c /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x80c /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "OPJ_Validate - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x80c /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x80c /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "OPJ_Validate - Win32 Release"
|
||||||
|
# Name "OPJ_Validate - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\md5.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\OPJ_Validate.c
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\md5.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
29
OPJ_Validate/OPJ_Validate.dsw
Normal file
29
OPJ_Validate/OPJ_Validate.dsw
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "OPJ_Validate"=".\OPJ_Validate.dsp" - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
8
OPJ_Validate/OPJ_Validate_Candidate_vs_Ref.bat
Normal file
8
OPJ_Validate/OPJ_Validate_Candidate_vs_Ref.bat
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
cd temp
|
||||||
|
erase *.ppm
|
||||||
|
erase *.j2k
|
||||||
|
erase *.bmp
|
||||||
|
erase *.tif
|
||||||
|
erase *.jp2
|
||||||
|
cd ..
|
||||||
|
OPJ_Validate.exe OPJ_Param_File_v0_1.txt testv2
|
||||||
16
OPJ_Validate/OPJ_Validate_Candidate_vs_Ref.sh
Normal file
16
OPJ_Validate/OPJ_Validate_Candidate_vs_Ref.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd temp
|
||||||
|
erase *.ppm
|
||||||
|
erase *.j2k
|
||||||
|
erase *.bmp
|
||||||
|
erase *.tif
|
||||||
|
erase *.jp2
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Type the name of the directory (inside OPJ_Binaries) "
|
||||||
|
echo "containing your executables to compared with reference, followed by [ENTER] (example: rev101):"
|
||||||
|
read compdir
|
||||||
|
|
||||||
|
./OPJ_Validate linux_OPJ_Param_File_v0_1.txt $compdir
|
||||||
|
echo
|
||||||
4
OPJ_Validate/OPJ_Validate_Create_Ref.bat
Normal file
4
OPJ_Validate/OPJ_Validate_Create_Ref.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
cd temp
|
||||||
|
erase *.md5
|
||||||
|
cd ..
|
||||||
|
OPJ_Validate.exe OPJ_Param_File_v0_1.txt rev490
|
||||||
13
OPJ_Validate/OPJ_Validate_Create_Ref.sh
Normal file
13
OPJ_Validate/OPJ_Validate_Create_Ref.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#Create Reference images and hash
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Type the name of the directory (inside OPJ_Binaries) "
|
||||||
|
echo "containing your reference executables, followed by [ENTER] (example: rev100):"
|
||||||
|
read refdir
|
||||||
|
cd temp
|
||||||
|
rm *.md5
|
||||||
|
cd ..
|
||||||
|
./OPJ_Validate linux_OPJ_Param_File_v0_1.txt $refdir
|
||||||
|
echo
|
||||||
|
|
||||||
46
OPJ_Validate/README.txt
Normal file
46
OPJ_Validate/README.txt
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Initialization
|
||||||
|
--------------
|
||||||
|
Download the source images into the /original directory from http://www.openjpeg.org/OPJ_Validate_OriginalImages.7z
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
Usage: OPJ_Validate batch_text_file bin_directory
|
||||||
|
Example: OPJ_Validate OPJ_Param_File_v0_1.txt v1.1.a
|
||||||
|
where OPJ_Param_File_v0_1.txt is a file containing a list of compression and decompression parameters
|
||||||
|
and v1.1.a is a directory inside the directory OPJ_Binaries containing the openjpeg executables (j2k_to_image.exe and image_to_j2k.exe)
|
||||||
|
|
||||||
|
Example with batch file: You consider revision 490 (/rev490) as stable, and would like to compare it a new version, revision 493 (rev493).
|
||||||
|
|
||||||
|
Batch mode
|
||||||
|
----------
|
||||||
|
1) Calculate the reference by running the "OPJ_Validate_Create_Ref rev490" file (.sh or .bat depending on your os)
|
||||||
|
2) Compare the candidate revision with ther reference by running the "OPJ_Validate_Candidate_vs_Ref rev493" file
|
||||||
|
3) The results of the comparison are given at the end of the processing. They are also available in the bin directory OPJ_Binaries/rev493/report.txt
|
||||||
|
|
||||||
|
Manual mode
|
||||||
|
-----------
|
||||||
|
1) Put the j2k_to_image.exe and image_to_j2k.exe binaries of both revisions in the OPJ_Binaries directory (OPJ_Binaries/rev490 and OPJ_Binaries/rev493)
|
||||||
|
2) Start by initializing the validation with revision 490.
|
||||||
|
a) Modify OPJ_Validate_init.bat and set the last line to "OPJ_Validate.exe OPJ_Param_File_v0_1.txt rev490"
|
||||||
|
b) Execute OPJ_Validate_init.bat
|
||||||
|
3) Compare the reference files generated in the previous step with files generated with revision 493
|
||||||
|
a) Modify OPJ_Validate_run.bat and set the last line to "OPJ_Validate.exe OPJ_Param_File_v0_1.txt rev493"
|
||||||
|
b) Execute OPJ_Validate_run.bat
|
||||||
|
4) Read the results in the binaries directory of revision 493 (OPJ_Binaries/rev493/report.txt)
|
||||||
|
Search for the word "ERROR:" in that file.
|
||||||
|
If this word is not present in the report, this means that both codecs of rev490 and rev493 gave the same results.
|
||||||
|
Otherwise, it means that for certain encoding/decoding parameters, the codecs behave differently.
|
||||||
|
|
||||||
|
Example of error
|
||||||
|
Task 17
|
||||||
|
MD5 file: temp/A_4_2K_24_185_CBR_WB_000.tif.md5
|
||||||
|
Command line: "OPJ_Binaries/rev473/j2k_to_image.exe -i original/A_4_2K_24_185_CBR_WB_000.j2k -o temp/A_4_2K_24_185_CBR_WB_000.tif "
|
||||||
|
ERROR: temp/tempmd5.txt and temp/A_4_2K_24_185_CBR_WB_000.tif.md5 are different.
|
||||||
|
The codec seems to behave differently.
|
||||||
|
|
||||||
|
This means that the rev490 and rev493 created two different versions of file A_4_2K_24_185_CBR_WB_000.tif with the command line given above.
|
||||||
|
An error might have been caused by switching to this new revision.
|
||||||
|
|
||||||
|
Warning: Do not take the last line of the report.txt file into account ( Cool. All files passed the tests !) as it is a bug. Search for the word "ERROR:" to detect potential errors.
|
||||||
|
5) If no error is detected, you can commit the changes to the OpenJPEG repository
|
||||||
|
|
||||||
89
OPJ_Validate/linux_OPJ_Param_File_v0_1.txt
Normal file
89
OPJ_Validate/linux_OPJ_Param_File_v0_1.txt
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#OPJ Parameter file
|
||||||
|
#Version 0.1 - February 9th 2007
|
||||||
|
#Usage: OPJ_Validate OpenJPEG_command_line
|
||||||
|
#Example: OPJ_Validate image_to_j2k.exe -i original/Bretagne1.ppm -o original/Bretagne1.j2k -r 200, 50, 10
|
||||||
|
#Attention: don't forget the *.exe extension for the executable file, and check the paths
|
||||||
|
#
|
||||||
|
image_to_j2k -i original/Bretagne1.ppm -o temp/Bretagne1_0.j2k -r 200,50,10
|
||||||
|
j2k_to_image -i original/Bretagne1.j2k -o temp/Bretagne1.ppm
|
||||||
|
image_to_j2k -i original/Bretagne2.ppm -o temp/Bretagne2_0.j2k -c [128,128],[128,128],[128,128] -r 100,20,2 -t 640,480 -b 32,32
|
||||||
|
j2k_to_image -i original/Bretagne2.j2k -o temp/Bretagne2.ppm -r 2
|
||||||
|
image_to_j2k -i original/Cevennes1.bmp -o temp/Cevennes1.j2k -r 10
|
||||||
|
j2k_to_image -i original/Cevennes1.j2k -o temp/Cevennes1.bmp -l 2
|
||||||
|
image_to_j2k -i original/Cevennes2.ppm -o temp/Cevennes2.jp2 -r 50
|
||||||
|
j2k_to_image -i original/Cevennes2.jp2 -o temp/Cevennes2.ppm
|
||||||
|
image_to_j2k -i original/Rome.bmp -o temp/Rome.jp2 -q 30,35,50 -p LRCP -n 3
|
||||||
|
j2k_to_image -i original/Rome.jp2 -o temp/Rome.ppm
|
||||||
|
image_to_j2k -i original/Bretagne1.ppm -o temp/Bretagne1_1.j2k -q 30,35,40 -n 2
|
||||||
|
image_to_j2k -i original/Bretagne1.ppm -o temp/Bretagne1_2.j2k -q 30,35,40 -b 16,16 -c [101,101]
|
||||||
|
image_to_j2k -i original/Bretagne2.ppm -o temp/Bretagne2_1.j2k -t 127,127 -p PCRL
|
||||||
|
image_to_j2k -i original/X_4_2K_24_185_CBR_WB_000.tif -o temp/X_4_2K_24_185_CBR_WB_000.j2k -cinema2K 24
|
||||||
|
image_to_j2k -i original/X_5_2K_24_235_CBR_STEM24_000.tif -o temp/X_5_2K_24_235_CBR_STEM24_000.j2k -cinema2K 48
|
||||||
|
image_to_j2k -i original/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o temp/X_6_2K_24_FULL_CBR_CIRCLE_000.j2k -cinema2K 24
|
||||||
|
#<23> remettre
|
||||||
|
#image_to_j2k -i original/X_16_4K_24_185_CBR_WB_000.tif -o temp/X_16_4K_24_185_CBR_WB_000.j2k -cinema4K
|
||||||
|
j2k_to_image -i original/A_4_2K_24_185_CBR_WB_000.j2k -o temp/A_4_2K_24_185_CBR_WB_000.tif
|
||||||
|
j2k_to_image -i original/B_5_2K_24_235_CBR_STEM24_000.j2k -o temp/B_5_2K_24_235_CBR_STEM24_000.tif
|
||||||
|
j2k_to_image -i original/C_6_2K_24_FULL_CBR_CIRCLE_000.j2k -o temp/C_6_2K_24_FULL_CBR_CIRCLE_000.tif
|
||||||
|
#<23> remettre
|
||||||
|
#j2k_to_image -i original/C_18_4K_24_FULL_CBR_CIRCLE_000.j2k -o temp/C_18_4K_24_FULL_CBR_CIRCLE_000.tif
|
||||||
|
j2k_to_image -i original/p0_01.j2k -o temp/p0_01.tif
|
||||||
|
j2k_to_image -i original/p0_02.j2k -o temp/p0_02.tif
|
||||||
|
j2k_to_image -i original/p0_03.j2k -o temp/p0_03.tif
|
||||||
|
j2k_to_image -i original/p0_04.j2k -o temp/p0_04.tif
|
||||||
|
#a remettre
|
||||||
|
#j2k_to_image -i original/p0_07.j2k -o temp/p0_07.tif
|
||||||
|
j2k_to_image -i original/p0_08.j2k -o temp/p0_08.tif
|
||||||
|
j2k_to_image -i original/p0_09.j2k -o temp/p0_09.tif
|
||||||
|
j2k_to_image -i original/p0_10.j2k -o temp/p0_10.tif
|
||||||
|
j2k_to_image -i original/p0_11.j2k -o temp/p0_11.tif
|
||||||
|
j2k_to_image -i original/p0_12.j2k -o temp/p0_12.tif
|
||||||
|
j2k_to_image -i original/p0_14.j2k -o temp/p0_14.tif
|
||||||
|
j2k_to_image -i original/p0_15.j2k -o temp/p0_15.tif
|
||||||
|
j2k_to_image -i original/p0_16.j2k -o temp/p0_16.tif
|
||||||
|
j2k_to_image -i original/p1_01.j2k -o temp/p1_01.tif
|
||||||
|
j2k_to_image -i original/p1_02.j2k -o temp/p1_02.tif
|
||||||
|
j2k_to_image -i original/p1_04.j2k -o temp/p1_04.tif
|
||||||
|
j2k_to_image -i original/p1_05.j2k -o temp/p1_05.tif
|
||||||
|
j2k_to_image -i original/p1_06.j2k -o temp/p1_06.tif
|
||||||
|
image_to_j2k -i original/c0p0_01.pgx -o temp/c0p0_01.j2k
|
||||||
|
image_to_j2k -i original/c0p0_02.pgx -o temp/c0p0_02.j2k
|
||||||
|
image_to_j2k -i original/c0p0_03r0.pgx -o temp/c0p0_03r0.j2k
|
||||||
|
image_to_j2k -i original/c0p0_03r1.pgx -o temp/c0p0_03r1.j2k
|
||||||
|
image_to_j2k -i original/c0p0_04.pgx -o temp/c00_p04.j2k
|
||||||
|
image_to_j2k -i original/c0p0_05.pgx -o temp/c0p0_05.j2k
|
||||||
|
image_to_j2k -i original/c0p0_06.pgx -o temp/c0p0_06.j2k
|
||||||
|
image_to_j2k -i original/c0p0_07.pgx -o temp/c0p0_07.j2k
|
||||||
|
image_to_j2k -i original/c0p0_08.pgx -o temp/c0p0_08.j2k
|
||||||
|
image_to_j2k -i original/c0p0_09.pgx -o temp/c0p0_09.j2k
|
||||||
|
image_to_j2k -i original/c0p0_10.pgx -o temp/c0p0_10.j2k
|
||||||
|
image_to_j2k -i original/c0p0_11.pgx -o temp/c0p0_11.j2k
|
||||||
|
image_to_j2k -i original/c0p0_12.pgx -o temp/c0p0_12.j2k
|
||||||
|
image_to_j2k -i original/c0p0_13.pgx -o temp/c0p0_13.j2k
|
||||||
|
image_to_j2k -i original/c0p0_14.pgx -o temp/c0p0_14.j2k
|
||||||
|
image_to_j2k -i original/c0p0_15r0.pgx -o temp/c0p0_15r0.j2k
|
||||||
|
image_to_j2k -i original/c0p0_15r1.pgx -o temp/c0p0_15r1.j2k
|
||||||
|
image_to_j2k -i original/c0p0_16.pgx -o temp/c0p0_16.j2k
|
||||||
|
image_to_j2k -i original/c0p1_04r0.pgx -o temp/c0p1_04r0.j2k
|
||||||
|
image_to_j2k -i original/c0p1_05.pgx -o temp/c0p1_05.j2k
|
||||||
|
image_to_j2k -i original/c1p0_01_0.pgx -o temp/c1p0_01_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_02_0.pgx -o temp/c1p0_02_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_03_0.pgx -o temp/c1p0_03_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_04_0.pgx -o temp/c1p0_04_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_05_0.pgx -o temp/c1p0_05_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_06_0.pgx -o temp/c1p0_06_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_07_0.pgx -o temp/c1p0_07_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_08_0.pgx -o temp/c1p0_08_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_09_0.pgx -o temp/c1p0_09_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_10_0.pgx -o temp/c1p0_10_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_11_0.pgx -o temp/c1p0_11_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_12_0.pgx -o temp/c1p0_12_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_13_0.pgx -o temp/c1p0_13_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_14_0.pgx -o temp/c1p0_14_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_15_0.pgx -o temp/c1p0_15_0.j2k
|
||||||
|
image_to_j2k -i original/c1p0_16_0.pgx -o temp/c1p0_16_0.j2k
|
||||||
|
image_to_j2k -i original/c1p1_02_0.pgx -o temp/c1p1_02_0.j2k
|
||||||
|
image_to_j2k -i original/c1p1_05_0.pgx -o temp/c1p1_05_0.j2k
|
||||||
|
image_to_j2k -i original/Bretagne2.ppm -o temp/Bretagne2_2.j2k -s 2,2 -SOP
|
||||||
|
image_to_j2k -i original/Bretagne2.ppm -o temp/Bretagne2_3.j2k -EPH -M 38
|
||||||
|
image_to_j2k -i original/Bretagne2.ppm -o temp/Bretagne2_4.j2k -d 150,300 -r 800
|
||||||
276
OPJ_Validate/md5.c
Normal file
276
OPJ_Validate/md5.c
Normal file
@@ -0,0 +1,276 @@
|
|||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
** md5.c **
|
||||||
|
** RSA Data Security, Inc. MD5 Message Digest Algorithm **
|
||||||
|
** Created: 2/17/90 RLR **
|
||||||
|
** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version **
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
|
||||||
|
** **
|
||||||
|
** License to copy and use this software is granted provided that **
|
||||||
|
** it is identified as the "RSA Data Security, Inc. MD5 Message **
|
||||||
|
** Digest Algorithm" in all material mentioning or referencing this **
|
||||||
|
** software or this function. **
|
||||||
|
** **
|
||||||
|
** License is also granted to make and use derivative works **
|
||||||
|
** provided that such works are identified as "derived from the RSA **
|
||||||
|
** Data Security, Inc. MD5 Message Digest Algorithm" in all **
|
||||||
|
** material mentioning or referencing the derived work. **
|
||||||
|
** **
|
||||||
|
** RSA Data Security, Inc. makes no representations concerning **
|
||||||
|
** either the merchantability of this software or the suitability **
|
||||||
|
** of this software for any particular purpose. It is provided "as **
|
||||||
|
** is" without express or implied warranty of any kind. **
|
||||||
|
** **
|
||||||
|
** These notices must be retained in any copies of any part of this **
|
||||||
|
** documentation and/or software. **
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* -- include the following line if the md5.h header file is separate -- */
|
||||||
|
#include "md5.h"
|
||||||
|
|
||||||
|
/* forward declaration */
|
||||||
|
static void Transform ();
|
||||||
|
|
||||||
|
static unsigned char PADDING[64] = {
|
||||||
|
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
|
};
|
||||||
|
|
||||||
|
/* F, G and H are basic MD5 functions: selection, majority, parity */
|
||||||
|
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
|
||||||
|
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
|
||||||
|
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||||
|
#define I(x, y, z) ((y) ^ ((x) | (~z)))
|
||||||
|
|
||||||
|
/* ROTATE_LEFT rotates x left n bits */
|
||||||
|
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
|
||||||
|
|
||||||
|
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
|
||||||
|
/* Rotation is separate from addition to prevent recomputation */
|
||||||
|
#define FF(a, b, c, d, x, s, ac) \
|
||||||
|
{(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||||
|
(a) = ROTATE_LEFT ((a), (s)); \
|
||||||
|
(a) += (b); \
|
||||||
|
}
|
||||||
|
#define GG(a, b, c, d, x, s, ac) \
|
||||||
|
{(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||||
|
(a) = ROTATE_LEFT ((a), (s)); \
|
||||||
|
(a) += (b); \
|
||||||
|
}
|
||||||
|
#define HH(a, b, c, d, x, s, ac) \
|
||||||
|
{(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||||
|
(a) = ROTATE_LEFT ((a), (s)); \
|
||||||
|
(a) += (b); \
|
||||||
|
}
|
||||||
|
#define II(a, b, c, d, x, s, ac) \
|
||||||
|
{(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
|
||||||
|
(a) = ROTATE_LEFT ((a), (s)); \
|
||||||
|
(a) += (b); \
|
||||||
|
}
|
||||||
|
|
||||||
|
void MD5Init (mdContext)
|
||||||
|
MD5_CTX *mdContext;
|
||||||
|
{
|
||||||
|
mdContext->i[0] = mdContext->i[1] = (UINT4)0;
|
||||||
|
|
||||||
|
/* Load magic initialization constants.
|
||||||
|
*/
|
||||||
|
mdContext->buf[0] = (UINT4)0x67452301;
|
||||||
|
mdContext->buf[1] = (UINT4)0xefcdab89;
|
||||||
|
mdContext->buf[2] = (UINT4)0x98badcfe;
|
||||||
|
mdContext->buf[3] = (UINT4)0x10325476;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MD5Update (mdContext, inBuf, inLen)
|
||||||
|
MD5_CTX *mdContext;
|
||||||
|
unsigned char *inBuf;
|
||||||
|
unsigned int inLen;
|
||||||
|
{
|
||||||
|
UINT4 in[16];
|
||||||
|
int mdi;
|
||||||
|
unsigned int i, ii;
|
||||||
|
|
||||||
|
/* compute number of bytes mod 64 */
|
||||||
|
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
|
||||||
|
|
||||||
|
/* update number of bits */
|
||||||
|
if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0])
|
||||||
|
mdContext->i[1]++;
|
||||||
|
mdContext->i[0] += ((UINT4)inLen << 3);
|
||||||
|
mdContext->i[1] += ((UINT4)inLen >> 29);
|
||||||
|
|
||||||
|
while (inLen--) {
|
||||||
|
/* add new character to buffer, increment mdi */
|
||||||
|
mdContext->in[mdi++] = *inBuf++;
|
||||||
|
|
||||||
|
/* transform if necessary */
|
||||||
|
if (mdi == 0x40) {
|
||||||
|
for (i = 0, ii = 0; i < 16; i++, ii += 4)
|
||||||
|
in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
|
||||||
|
(((UINT4)mdContext->in[ii+2]) << 16) |
|
||||||
|
(((UINT4)mdContext->in[ii+1]) << 8) |
|
||||||
|
((UINT4)mdContext->in[ii]);
|
||||||
|
Transform (mdContext->buf, in);
|
||||||
|
mdi = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MD5Final (mdContext)
|
||||||
|
MD5_CTX *mdContext;
|
||||||
|
{
|
||||||
|
UINT4 in[16];
|
||||||
|
int mdi;
|
||||||
|
unsigned int i, ii;
|
||||||
|
unsigned int padLen;
|
||||||
|
|
||||||
|
/* save number of bits */
|
||||||
|
in[14] = mdContext->i[0];
|
||||||
|
in[15] = mdContext->i[1];
|
||||||
|
|
||||||
|
/* compute number of bytes mod 64 */
|
||||||
|
mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
|
||||||
|
|
||||||
|
/* pad out to 56 mod 64 */
|
||||||
|
padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
|
||||||
|
MD5Update (mdContext, PADDING, padLen);
|
||||||
|
|
||||||
|
/* append length in bits and transform */
|
||||||
|
for (i = 0, ii = 0; i < 14; i++, ii += 4)
|
||||||
|
in[i] = (((UINT4)mdContext->in[ii+3]) << 24) |
|
||||||
|
(((UINT4)mdContext->in[ii+2]) << 16) |
|
||||||
|
(((UINT4)mdContext->in[ii+1]) << 8) |
|
||||||
|
((UINT4)mdContext->in[ii]);
|
||||||
|
Transform (mdContext->buf, in);
|
||||||
|
|
||||||
|
/* store buffer in digest */
|
||||||
|
for (i = 0, ii = 0; i < 4; i++, ii += 4) {
|
||||||
|
mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
|
||||||
|
mdContext->digest[ii+1] =
|
||||||
|
(unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
|
||||||
|
mdContext->digest[ii+2] =
|
||||||
|
(unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
|
||||||
|
mdContext->digest[ii+3] =
|
||||||
|
(unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Basic MD5 step. Transform buf based on in.
|
||||||
|
*/
|
||||||
|
static void Transform (buf, in)
|
||||||
|
UINT4 *buf;
|
||||||
|
UINT4 *in;
|
||||||
|
{
|
||||||
|
UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
|
||||||
|
|
||||||
|
/* Round 1 */
|
||||||
|
#define S11 7
|
||||||
|
#define S12 12
|
||||||
|
#define S13 17
|
||||||
|
#define S14 22
|
||||||
|
FF ( a, b, c, d, in[ 0], S11, 3614090360); /* 1 */
|
||||||
|
FF ( d, a, b, c, in[ 1], S12, 3905402710); /* 2 */
|
||||||
|
FF ( c, d, a, b, in[ 2], S13, 606105819); /* 3 */
|
||||||
|
FF ( b, c, d, a, in[ 3], S14, 3250441966); /* 4 */
|
||||||
|
FF ( a, b, c, d, in[ 4], S11, 4118548399); /* 5 */
|
||||||
|
FF ( d, a, b, c, in[ 5], S12, 1200080426); /* 6 */
|
||||||
|
FF ( c, d, a, b, in[ 6], S13, 2821735955); /* 7 */
|
||||||
|
FF ( b, c, d, a, in[ 7], S14, 4249261313); /* 8 */
|
||||||
|
FF ( a, b, c, d, in[ 8], S11, 1770035416); /* 9 */
|
||||||
|
FF ( d, a, b, c, in[ 9], S12, 2336552879); /* 10 */
|
||||||
|
FF ( c, d, a, b, in[10], S13, 4294925233); /* 11 */
|
||||||
|
FF ( b, c, d, a, in[11], S14, 2304563134); /* 12 */
|
||||||
|
FF ( a, b, c, d, in[12], S11, 1804603682); /* 13 */
|
||||||
|
FF ( d, a, b, c, in[13], S12, 4254626195); /* 14 */
|
||||||
|
FF ( c, d, a, b, in[14], S13, 2792965006); /* 15 */
|
||||||
|
FF ( b, c, d, a, in[15], S14, 1236535329); /* 16 */
|
||||||
|
|
||||||
|
/* Round 2 */
|
||||||
|
#define S21 5
|
||||||
|
#define S22 9
|
||||||
|
#define S23 14
|
||||||
|
#define S24 20
|
||||||
|
GG ( a, b, c, d, in[ 1], S21, 4129170786); /* 17 */
|
||||||
|
GG ( d, a, b, c, in[ 6], S22, 3225465664); /* 18 */
|
||||||
|
GG ( c, d, a, b, in[11], S23, 643717713); /* 19 */
|
||||||
|
GG ( b, c, d, a, in[ 0], S24, 3921069994); /* 20 */
|
||||||
|
GG ( a, b, c, d, in[ 5], S21, 3593408605); /* 21 */
|
||||||
|
GG ( d, a, b, c, in[10], S22, 38016083); /* 22 */
|
||||||
|
GG ( c, d, a, b, in[15], S23, 3634488961); /* 23 */
|
||||||
|
GG ( b, c, d, a, in[ 4], S24, 3889429448); /* 24 */
|
||||||
|
GG ( a, b, c, d, in[ 9], S21, 568446438); /* 25 */
|
||||||
|
GG ( d, a, b, c, in[14], S22, 3275163606); /* 26 */
|
||||||
|
GG ( c, d, a, b, in[ 3], S23, 4107603335); /* 27 */
|
||||||
|
GG ( b, c, d, a, in[ 8], S24, 1163531501); /* 28 */
|
||||||
|
GG ( a, b, c, d, in[13], S21, 2850285829); /* 29 */
|
||||||
|
GG ( d, a, b, c, in[ 2], S22, 4243563512); /* 30 */
|
||||||
|
GG ( c, d, a, b, in[ 7], S23, 1735328473); /* 31 */
|
||||||
|
GG ( b, c, d, a, in[12], S24, 2368359562); /* 32 */
|
||||||
|
|
||||||
|
/* Round 3 */
|
||||||
|
#define S31 4
|
||||||
|
#define S32 11
|
||||||
|
#define S33 16
|
||||||
|
#define S34 23
|
||||||
|
HH ( a, b, c, d, in[ 5], S31, 4294588738); /* 33 */
|
||||||
|
HH ( d, a, b, c, in[ 8], S32, 2272392833); /* 34 */
|
||||||
|
HH ( c, d, a, b, in[11], S33, 1839030562); /* 35 */
|
||||||
|
HH ( b, c, d, a, in[14], S34, 4259657740); /* 36 */
|
||||||
|
HH ( a, b, c, d, in[ 1], S31, 2763975236); /* 37 */
|
||||||
|
HH ( d, a, b, c, in[ 4], S32, 1272893353); /* 38 */
|
||||||
|
HH ( c, d, a, b, in[ 7], S33, 4139469664); /* 39 */
|
||||||
|
HH ( b, c, d, a, in[10], S34, 3200236656); /* 40 */
|
||||||
|
HH ( a, b, c, d, in[13], S31, 681279174); /* 41 */
|
||||||
|
HH ( d, a, b, c, in[ 0], S32, 3936430074); /* 42 */
|
||||||
|
HH ( c, d, a, b, in[ 3], S33, 3572445317); /* 43 */
|
||||||
|
HH ( b, c, d, a, in[ 6], S34, 76029189); /* 44 */
|
||||||
|
HH ( a, b, c, d, in[ 9], S31, 3654602809); /* 45 */
|
||||||
|
HH ( d, a, b, c, in[12], S32, 3873151461); /* 46 */
|
||||||
|
HH ( c, d, a, b, in[15], S33, 530742520); /* 47 */
|
||||||
|
HH ( b, c, d, a, in[ 2], S34, 3299628645); /* 48 */
|
||||||
|
|
||||||
|
/* Round 4 */
|
||||||
|
#define S41 6
|
||||||
|
#define S42 10
|
||||||
|
#define S43 15
|
||||||
|
#define S44 21
|
||||||
|
II ( a, b, c, d, in[ 0], S41, 4096336452); /* 49 */
|
||||||
|
II ( d, a, b, c, in[ 7], S42, 1126891415); /* 50 */
|
||||||
|
II ( c, d, a, b, in[14], S43, 2878612391); /* 51 */
|
||||||
|
II ( b, c, d, a, in[ 5], S44, 4237533241); /* 52 */
|
||||||
|
II ( a, b, c, d, in[12], S41, 1700485571); /* 53 */
|
||||||
|
II ( d, a, b, c, in[ 3], S42, 2399980690); /* 54 */
|
||||||
|
II ( c, d, a, b, in[10], S43, 4293915773); /* 55 */
|
||||||
|
II ( b, c, d, a, in[ 1], S44, 2240044497); /* 56 */
|
||||||
|
II ( a, b, c, d, in[ 8], S41, 1873313359); /* 57 */
|
||||||
|
II ( d, a, b, c, in[15], S42, 4264355552); /* 58 */
|
||||||
|
II ( c, d, a, b, in[ 6], S43, 2734768916); /* 59 */
|
||||||
|
II ( b, c, d, a, in[13], S44, 1309151649); /* 60 */
|
||||||
|
II ( a, b, c, d, in[ 4], S41, 4149444226); /* 61 */
|
||||||
|
II ( d, a, b, c, in[11], S42, 3174756917); /* 62 */
|
||||||
|
II ( c, d, a, b, in[ 2], S43, 718787259); /* 63 */
|
||||||
|
II ( b, c, d, a, in[ 9], S44, 3951481745); /* 64 */
|
||||||
|
|
||||||
|
buf[0] += a;
|
||||||
|
buf[1] += b;
|
||||||
|
buf[2] += c;
|
||||||
|
buf[3] += d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
** End of md5.c **
|
||||||
|
******************************* (cut) ********************************
|
||||||
|
*/
|
||||||
59
OPJ_Validate/md5.h
Normal file
59
OPJ_Validate/md5.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
** md5.h -- Header file for implementation of MD5 **
|
||||||
|
** RSA Data Security, Inc. MD5 Message Digest Algorithm **
|
||||||
|
** Created: 2/17/90 RLR **
|
||||||
|
** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version **
|
||||||
|
** Revised (for MD5): RLR 4/27/91 **
|
||||||
|
** -- G modified to have y&~z instead of y&z **
|
||||||
|
** -- FF, GG, HH modified to add in last register done **
|
||||||
|
** -- Access pattern: round 2 works mod 5, round 3 works mod 3 **
|
||||||
|
** -- distinct additive constant for each step **
|
||||||
|
** -- round 4 added, working mod 7 **
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
|
||||||
|
** **
|
||||||
|
** License to copy and use this software is granted provided that **
|
||||||
|
** it is identified as the "RSA Data Security, Inc. MD5 Message **
|
||||||
|
** Digest Algorithm" in all material mentioning or referencing this **
|
||||||
|
** software or this function. **
|
||||||
|
** **
|
||||||
|
** License is also granted to make and use derivative works **
|
||||||
|
** provided that such works are identified as "derived from the RSA **
|
||||||
|
** Data Security, Inc. MD5 Message Digest Algorithm" in all **
|
||||||
|
** material mentioning or referencing the derived work. **
|
||||||
|
** **
|
||||||
|
** RSA Data Security, Inc. makes no representations concerning **
|
||||||
|
** either the merchantability of this software or the suitability **
|
||||||
|
** of this software for any particular purpose. It is provided "as **
|
||||||
|
** is" without express or implied warranty of any kind. **
|
||||||
|
** **
|
||||||
|
** These notices must be retained in any copies of any part of this **
|
||||||
|
** documentation and/or software. **
|
||||||
|
**********************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* typedef a 32 bit type */
|
||||||
|
typedef unsigned long int UINT4;
|
||||||
|
|
||||||
|
/* Data structure for MD5 (Message Digest) computation */
|
||||||
|
typedef struct {
|
||||||
|
UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
|
||||||
|
UINT4 buf[4]; /* scratch buffer */
|
||||||
|
unsigned char in[64]; /* input buffer */
|
||||||
|
unsigned char digest[16]; /* actual digest after MD5Final call */
|
||||||
|
} MD5_CTX;
|
||||||
|
|
||||||
|
void MD5Init ();
|
||||||
|
void MD5Update ();
|
||||||
|
void MD5Final ();
|
||||||
|
|
||||||
|
/*
|
||||||
|
**********************************************************************
|
||||||
|
** End of md5.h **
|
||||||
|
******************************* (cut) ********************************
|
||||||
|
*/
|
||||||
1
OPJ_Validate/original/README.txt
Normal file
1
OPJ_Validate/original/README.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Download the source images into this directory from http://www.openjpeg.org/OPJ_Validate_OriginalImages.7z
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Basic instructions on how to build using CMake (CMake 2.4.5 or newer is required)
|
|
||||||
|
|
||||||
svn co http://www.openjpeg.org/svn/trunk
|
|
||||||
cd trunk
|
|
||||||
mkdir bin
|
|
||||||
cd bin
|
|
||||||
cmake .. -DBUILD_EXAMPLES:BOOL=ON
|
|
||||||
make
|
|
||||||
./bin/j2k_to_image
|
|
||||||
33
README.linux
33
README.linux
@@ -1,33 +0,0 @@
|
|||||||
Release Notes
|
|
||||||
--------------
|
|
||||||
This version of the library has been tested under the following OS:
|
|
||||||
- RedHat Linux 9.0
|
|
||||||
|
|
||||||
You should be able to link progams with the -lopenjpeg option after the library is compiled and installed.
|
|
||||||
You can also statically link with libopenjpeg.a.
|
|
||||||
If you use a really old version of gcc and it chokes on the CRs in the file, you can type 'make dos2unix'
|
|
||||||
to run all of the files through dos2unix which converts CRLF to LF. This no longer appears to be required
|
|
||||||
for RedHat 7.3 or 9.
|
|
||||||
|
|
||||||
Please let us know how this works for you under other Linux distributions or any other *nix.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
Note: You will need to have root privileges in order to install the library in
|
|
||||||
/usr/include and /usr/lib directories.
|
|
||||||
The installation process is as simple as this :
|
|
||||||
1) Enter the OpenJPEG directory
|
|
||||||
2) Build the distribution :
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
3) Clean all files produced during the build process
|
|
||||||
make clean
|
|
||||||
|
|
||||||
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 use one of the following commands to build an encoder and decoder respectively:
|
|
||||||
|
|
||||||
gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
|
||||||
gcc 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 (and the 'clean' target neither...).
|
|
||||||
26
README.osx
26
README.osx
@@ -1,26 +0,0 @@
|
|||||||
Release Notes
|
|
||||||
--------------
|
|
||||||
This version of the library has been tested under OSX 10.3 using gcc 3.3.
|
|
||||||
|
|
||||||
While the makefiles will make a .dylib and a .a, it is recommended to simply staticly link with the .a file.
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
Note: You will need to have root privileges in order to install the library in
|
|
||||||
/usr/include and /usr/lib directories.
|
|
||||||
The installation process is as simple as this :
|
|
||||||
1) Enter the OpenJPEG directory
|
|
||||||
2) Build the distribution :
|
|
||||||
make osx
|
|
||||||
make osxinstall
|
|
||||||
3) Clean all files produced during the build process
|
|
||||||
make osxclean
|
|
||||||
|
|
||||||
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 use one of the following commands to build an encoder and decoder respectively:
|
|
||||||
|
|
||||||
gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
|
||||||
gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
|
||||||
|
|
||||||
You should add '-L..' and to those lines if you did not use the 'install' target (and the 'clean' target neither...).
|
|
||||||
8984
aclocal.m4
vendored
Normal file
8984
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
bootstrap.sh
Executable file
3
bootstrap.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
autoreconf --install --force
|
||||||
|
|
||||||
@@ -1,48 +1,51 @@
|
|||||||
# Build the demo app, small examples
|
# Build the demo app, small examples
|
||||||
|
|
||||||
# First thing define the common source:
|
# First thing define the common source:
|
||||||
SET(common_SRCS
|
SET(common_SRCS
|
||||||
convert.c
|
convert.c
|
||||||
index.c
|
index.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/common/color.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# Then check if getopt is present:
|
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
|
||||||
SET(DONT_HAVE_GETOPT 1)
|
|
||||||
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
|
||||||
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
|
||||||
# Seems like we need the contrary:
|
|
||||||
IF(CMAKE_HAVE_GETOPT_H)
|
|
||||||
SET(DONT_HAVE_GETOPT 0)
|
|
||||||
ENDIF(CMAKE_HAVE_GETOPT_H)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
|
|
||||||
# If not getopt was found then add it to the lib:
|
# If not getopt was found then add it to the lib:
|
||||||
IF(DONT_HAVE_GETOPT)
|
IF(DONT_HAVE_GETOPT)
|
||||||
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
|
||||||
SET(common_SRCS
|
SET(common_SRCS
|
||||||
${common_SRCS}
|
${common_SRCS}
|
||||||
compat/getopt.c
|
${OPENJPEG_SOURCE_DIR}/common/getopt.c
|
||||||
)
|
)
|
||||||
ENDIF(DONT_HAVE_GETOPT)
|
ENDIF(DONT_HAVE_GETOPT)
|
||||||
|
|
||||||
# Headers file are located here:
|
# Headers file are located here:
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||||
|
${LCMS_INCLUDE_DIR}
|
||||||
|
${OPENJPEG_SOURCE_DIR}/common
|
||||||
)
|
)
|
||||||
|
IF(PNG_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
|
||||||
|
ENDIF(PNG_FOUND)
|
||||||
|
IF(TIFF_FOUND)
|
||||||
|
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
|
||||||
|
ENDIF(TIFF_FOUND)
|
||||||
|
|
||||||
# Do the proper thing when building static...if only there was configured
|
IF(WIN32)
|
||||||
# headers or def files instead
|
IF(BUILD_SHARED_LIBS)
|
||||||
IF(NOT BUILD_SHARED_LIBS)
|
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
||||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
ELSE(BUILD_SHARED_LIBS)
|
||||||
ENDIF(NOT BUILD_SHARED_LIBS)
|
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||||
|
ENDIF(BUILD_SHARED_LIBS)
|
||||||
FIND_PACKAGE(TIFF REQUIRED)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
# Loop over all executables:
|
# Loop over all executables:
|
||||||
FOREACH(exe j2k_to_image image_to_j2k)
|
FOREACH(exe j2k_to_image image_to_j2k j2k_dump)
|
||||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||||
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES})
|
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME} ${LCMS_LIB})
|
||||||
|
IF(PNG_FOUND)
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} ${PNG_LIBRARIES})
|
||||||
|
ENDIF(PNG_FOUND)
|
||||||
|
IF(TIFF_FOUND)
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} ${TIFF_LIBRARIES})
|
||||||
|
ENDIF(TIFF_FOUND)
|
||||||
ADD_TEST(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
|
ADD_TEST(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
|
||||||
# calling those exe without option will make them fail always:
|
# calling those exe without option will make them fail always:
|
||||||
SET_TESTS_PROPERTIES(${exe} PROPERTIES WILL_FAIL TRUE)
|
SET_TESTS_PROPERTIES(${exe} PROPERTIES WILL_FAIL TRUE)
|
||||||
@@ -51,9 +54,21 @@ FOREACH(exe j2k_to_image image_to_j2k)
|
|||||||
TARGET_LINK_LIBRARIES(${exe} m)
|
TARGET_LINK_LIBRARIES(${exe} m)
|
||||||
ENDIF(UNIX)
|
ENDIF(UNIX)
|
||||||
# Install exe
|
# Install exe
|
||||||
INSTALL_TARGETS(/bin/ ${exe})
|
INSTALL(TARGETS ${exe}
|
||||||
|
EXPORT OpenJPEGTargets
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||||
|
)
|
||||||
ENDFOREACH(exe)
|
ENDFOREACH(exe)
|
||||||
|
|
||||||
|
# Install man pages
|
||||||
|
INSTALL(
|
||||||
|
FILES ../doc/man/man1/image_to_j2k.1
|
||||||
|
../doc/man/man1/j2k_dump.1
|
||||||
|
../doc/man/man1/j2k_to_image.1
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
|
||||||
|
#
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
# Do testing here, once we know the examples are being built:
|
# Do testing here, once we know the examples are being built:
|
||||||
FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
|
FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
|
||||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2k"
|
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2k"
|
||||||
@@ -61,8 +76,27 @@ FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
|
|||||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.jp2"
|
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.jp2"
|
||||||
)
|
)
|
||||||
|
|
||||||
FOREACH(filename ${OPENJPEG_DATA_IMAGES_GLOB})
|
foreach(filename ${OPENJPEG_DATA_IMAGES_GLOB})
|
||||||
GET_FILENAME_COMPONENT(filename_temp ${filename} NAME)
|
get_filename_component(filename_temp ${filename} NAME)
|
||||||
ADD_TEST(j2i-${filename_temp} ${EXECUTABLE_OUTPUT_PATH}/j2k_to_image -i ${filename} -o ${filename_temp}.tif)
|
get_filename_component(filename_ext ${filename} EXT)
|
||||||
ENDFOREACH(filename)
|
execute_process(COMMAND ${EXECUTABLE_OUTPUT_PATH}/j2k_dump -i ${filename}
|
||||||
|
OUTPUT_VARIABLE dump_success
|
||||||
|
OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${filename_temp}.dump
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
if(dump_success)
|
||||||
|
file(READ ${CMAKE_CURRENT_BINARY_DIR}/${filename_temp}.dump numcomp_file)
|
||||||
|
string(REGEX REPLACE ".*numcomps=([0-9]+).*" "\\1"
|
||||||
|
numcomps "${numcomp_file}")
|
||||||
|
#message( "found:${output_variable} for ${filename_temp}" )
|
||||||
|
endif()
|
||||||
|
ADD_TEST(dump-${filename_temp} ${EXECUTABLE_OUTPUT_PATH}/j2k_dump -i ${filename})
|
||||||
|
foreach(codec_type ppm pgx bmp tif raw tga png)
|
||||||
|
ADD_TEST(j2i-${filename_temp}-${codec_type} ${EXECUTABLE_OUTPUT_PATH}/j2k_to_image -i ${filename} -o ${filename_temp}.${codec_type})
|
||||||
|
ADD_TEST(i2j-${filename_temp}-${codec_type} ${EXECUTABLE_OUTPUT_PATH}/image_to_j2k -i ${filename_temp}.${codec_type} -o ${filename_temp}.${codec_type}${filename_ext})
|
||||||
|
#if(UNIX)
|
||||||
|
# ADD_TEST(cmp-${filename_temp}-${codec_type} cmp ${filename} ${filename_temp}.${codec_type}${filename_ext})
|
||||||
|
#endif(UNIX)
|
||||||
|
endforeach(codec_type)
|
||||||
|
endforeach(filename)
|
||||||
|
endif(BUILD_TESTING)
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k
|
|
||||||
|
|
||||||
CFLAGS = -O3 -lstdc++ # -g -p -pg
|
|
||||||
|
|
||||||
all: j2k_to_image image_to_j2k
|
|
||||||
|
|
||||||
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
|
||||||
gcc $(CFLAGS) compat/getopt.c index.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
|
||||||
|
|
||||||
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
|
||||||
gcc $(CFLAGS) compat/getopt.c index.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f j2k_to_image image_to_j2k
|
|
||||||
52
codec/Makefile.am
Normal file
52
codec/Makefile.am
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
COMPILERFLAGS = -Wall
|
||||||
|
|
||||||
|
if with_sharedlibs
|
||||||
|
COMPILERFLAGS += -DOPJ_EXPORTS
|
||||||
|
else
|
||||||
|
COMPILERFLAGS += -DOPJ_STATIC
|
||||||
|
endif
|
||||||
|
|
||||||
|
USERLIBS = -lm
|
||||||
|
INCLUDES = -I.. -I. -I../libopenjpeg -I../common
|
||||||
|
|
||||||
|
if with_libtiff
|
||||||
|
INCLUDES += @tiffincludes@
|
||||||
|
USERLIBS += @tifflibs@
|
||||||
|
endif
|
||||||
|
|
||||||
|
if with_libpng
|
||||||
|
INCLUDES += @pngincludes@
|
||||||
|
USERLIBS += @pnglibs@
|
||||||
|
endif
|
||||||
|
|
||||||
|
if with_liblcms2
|
||||||
|
INCLUDES += @lcms2includes@
|
||||||
|
USERLIBS += @lcms2libs@
|
||||||
|
endif
|
||||||
|
|
||||||
|
if with_liblcms1
|
||||||
|
INCLUDES += @lcms1includes@
|
||||||
|
USERLIBS += @lcms1libs@
|
||||||
|
endif
|
||||||
|
|
||||||
|
bin_PROGRAMS = j2k_to_image image_to_j2k j2k_dump
|
||||||
|
|
||||||
|
CFLAGS = $(COMPILERFLAGS) $(INCLUDES)
|
||||||
|
LDADD = $(USERLIBS) ../libopenjpeg/libopenjpeg.la
|
||||||
|
|
||||||
|
j2k_to_image_SOURCES = ../common/getopt.c index.c convert.c \
|
||||||
|
../common/color.c j2k_to_image.c
|
||||||
|
|
||||||
|
image_to_j2k_SOURCES = ../common/getopt.c index.c convert.c image_to_j2k.c
|
||||||
|
|
||||||
|
j2k_dump_SOURCES = ../common/getopt.c index.c j2k_dump.c
|
||||||
|
|
||||||
|
REPBIN=$(bin_PROGRAMS)
|
||||||
|
|
||||||
|
all-local:
|
||||||
|
$(INSTALL) -d ../bin
|
||||||
|
$(INSTALL) $(bin_PROGRAMS) ../bin
|
||||||
|
@echo "" > .report.txt
|
||||||
|
@for f in ${REPBIN} ; do \
|
||||||
|
echo "Installing: ${prefix}/bin/$$f" >> .report.txt ; \
|
||||||
|
done
|
||||||
622
codec/Makefile.in
Normal file
622
codec/Makefile.in
Normal file
@@ -0,0 +1,622 @@
|
|||||||
|
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||||
|
# Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
|
||||||
|
VPATH = @srcdir@
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||||
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
|
install_sh_PROGRAM = $(install_sh) -c
|
||||||
|
install_sh_SCRIPT = $(install_sh) -c
|
||||||
|
INSTALL_HEADER = $(INSTALL_DATA)
|
||||||
|
transform = $(program_transform_name)
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
build_triplet = @build@
|
||||||
|
host_triplet = @host@
|
||||||
|
target_triplet = @target@
|
||||||
|
@with_sharedlibs_TRUE@am__append_1 = -DOPJ_EXPORTS
|
||||||
|
@with_sharedlibs_FALSE@am__append_2 = -DOPJ_STATIC
|
||||||
|
@with_libtiff_TRUE@am__append_3 = @tiffincludes@
|
||||||
|
@with_libtiff_TRUE@am__append_4 = @tifflibs@
|
||||||
|
@with_libpng_TRUE@am__append_5 = @pngincludes@
|
||||||
|
@with_libpng_TRUE@am__append_6 = @pnglibs@
|
||||||
|
@with_liblcms2_TRUE@am__append_7 = @lcms2includes@
|
||||||
|
@with_liblcms2_TRUE@am__append_8 = @lcms2libs@
|
||||||
|
@with_liblcms1_TRUE@am__append_9 = @lcms1includes@
|
||||||
|
@with_liblcms1_TRUE@am__append_10 = @lcms1libs@
|
||||||
|
bin_PROGRAMS = j2k_to_image$(EXEEXT) image_to_j2k$(EXEEXT) \
|
||||||
|
j2k_dump$(EXEEXT)
|
||||||
|
subdir = codec
|
||||||
|
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
|
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||||
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
|
$(ACLOCAL_M4)
|
||||||
|
mkinstalldirs = $(install_sh) -d
|
||||||
|
CONFIG_HEADER = $(top_builddir)/opj_config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
|
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||||
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
am_image_to_j2k_OBJECTS = getopt.$(OBJEXT) index.$(OBJEXT) \
|
||||||
|
convert.$(OBJEXT) image_to_j2k.$(OBJEXT)
|
||||||
|
image_to_j2k_OBJECTS = $(am_image_to_j2k_OBJECTS)
|
||||||
|
image_to_j2k_LDADD = $(LDADD)
|
||||||
|
am__DEPENDENCIES_1 =
|
||||||
|
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||||
|
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||||
|
image_to_j2k_DEPENDENCIES = $(am__DEPENDENCIES_2) \
|
||||||
|
../libopenjpeg/libopenjpeg.la
|
||||||
|
am_j2k_dump_OBJECTS = getopt.$(OBJEXT) index.$(OBJEXT) \
|
||||||
|
j2k_dump.$(OBJEXT)
|
||||||
|
j2k_dump_OBJECTS = $(am_j2k_dump_OBJECTS)
|
||||||
|
j2k_dump_LDADD = $(LDADD)
|
||||||
|
j2k_dump_DEPENDENCIES = $(am__DEPENDENCIES_2) \
|
||||||
|
../libopenjpeg/libopenjpeg.la
|
||||||
|
am_j2k_to_image_OBJECTS = getopt.$(OBJEXT) index.$(OBJEXT) \
|
||||||
|
convert.$(OBJEXT) color.$(OBJEXT) j2k_to_image.$(OBJEXT)
|
||||||
|
j2k_to_image_OBJECTS = $(am_j2k_to_image_OBJECTS)
|
||||||
|
j2k_to_image_LDADD = $(LDADD)
|
||||||
|
j2k_to_image_DEPENDENCIES = $(am__DEPENDENCIES_2) \
|
||||||
|
../libopenjpeg/libopenjpeg.la
|
||||||
|
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||||
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
|
am__depfiles_maybe = depfiles
|
||||||
|
am__mv = mv -f
|
||||||
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||||
|
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||||
|
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||||
|
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||||
|
$(LDFLAGS) -o $@
|
||||||
|
SOURCES = $(image_to_j2k_SOURCES) $(j2k_dump_SOURCES) \
|
||||||
|
$(j2k_to_image_SOURCES)
|
||||||
|
DIST_SOURCES = $(image_to_j2k_SOURCES) $(j2k_dump_SOURCES) \
|
||||||
|
$(j2k_to_image_SOURCES)
|
||||||
|
ETAGS = etags
|
||||||
|
CTAGS = ctags
|
||||||
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AMTAR = @AMTAR@
|
||||||
|
AR = @AR@
|
||||||
|
AS = @AS@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AWK = @AWK@
|
||||||
|
BUILD_NR = @BUILD_NR@
|
||||||
|
CC = @CC@
|
||||||
|
CCDEPMODE = @CCDEPMODE@
|
||||||
|
CFLAGS = $(COMPILERFLAGS) $(INCLUDES)
|
||||||
|
CPP = @CPP@
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CXX = @CXX@
|
||||||
|
CXXCPP = @CXXCPP@
|
||||||
|
CXXDEPMODE = @CXXDEPMODE@
|
||||||
|
CXXFLAGS = @CXXFLAGS@
|
||||||
|
CYGPATH_W = @CYGPATH_W@
|
||||||
|
DEFS = @DEFS@
|
||||||
|
DEPDIR = @DEPDIR@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
DSYMUTIL = @DSYMUTIL@
|
||||||
|
DUMPBIN = @DUMPBIN@
|
||||||
|
ECHO_C = @ECHO_C@
|
||||||
|
ECHO_N = @ECHO_N@
|
||||||
|
ECHO_T = @ECHO_T@
|
||||||
|
EGREP = @EGREP@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
FGREP = @FGREP@
|
||||||
|
GREP = @GREP@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
|
JP3D_BUILD_NR = @JP3D_BUILD_NR@
|
||||||
|
JP3D_MAJOR_NR = @JP3D_MAJOR_NR@
|
||||||
|
JP3D_MINOR_NR = @JP3D_MINOR_NR@
|
||||||
|
LD = @LD@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
LIBPNG_CONFIG = @LIBPNG_CONFIG@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LIPO = @LIPO@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
|
MAJOR_NR = @MAJOR_NR@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
MINOR_NR = @MINOR_NR@
|
||||||
|
MKDIR_P = @MKDIR_P@
|
||||||
|
NM = @NM@
|
||||||
|
NMEDIT = @NMEDIT@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
OBJEXT = @OBJEXT@
|
||||||
|
OTOOL = @OTOOL@
|
||||||
|
OTOOL64 = @OTOOL64@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||||
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
|
PACKAGE_STRING = @PACKAGE_STRING@
|
||||||
|
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||||
|
PACKAGE_URL = @PACKAGE_URL@
|
||||||
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||||
|
PKGCONFIG = @PKGCONFIG@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
SED = @SED@
|
||||||
|
SET_MAKE = @SET_MAKE@
|
||||||
|
SHELL = @SHELL@
|
||||||
|
STRIP = @STRIP@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
abs_builddir = @abs_builddir@
|
||||||
|
abs_srcdir = @abs_srcdir@
|
||||||
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
|
ac_ct_CC = @ac_ct_CC@
|
||||||
|
ac_ct_CXX = @ac_ct_CXX@
|
||||||
|
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
|
am__include = @am__include@
|
||||||
|
am__leading_dot = @am__leading_dot@
|
||||||
|
am__quote = @am__quote@
|
||||||
|
am__tar = @am__tar@
|
||||||
|
am__untar = @am__untar@
|
||||||
|
bindir = @bindir@
|
||||||
|
build = @build@
|
||||||
|
build_alias = @build_alias@
|
||||||
|
build_cpu = @build_cpu@
|
||||||
|
build_os = @build_os@
|
||||||
|
build_vendor = @build_vendor@
|
||||||
|
builddir = @builddir@
|
||||||
|
datadir = @datadir@
|
||||||
|
datarootdir = @datarootdir@
|
||||||
|
docdir = @docdir@
|
||||||
|
dvidir = @dvidir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
host = @host@
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_cpu = @host_cpu@
|
||||||
|
host_os = @host_os@
|
||||||
|
host_vendor = @host_vendor@
|
||||||
|
htmldir = @htmldir@
|
||||||
|
includedir = @includedir@
|
||||||
|
infodir = @infodir@
|
||||||
|
install_sh = @install_sh@
|
||||||
|
jp3d_dir = @jp3d_dir@
|
||||||
|
jpwl_dir = @jpwl_dir@
|
||||||
|
lcms1includes = @lcms1includes@
|
||||||
|
lcms1libs = @lcms1libs@
|
||||||
|
lcms2includes = @lcms2includes@
|
||||||
|
lcms2libs = @lcms2libs@
|
||||||
|
libdir = @libdir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
localedir = @localedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
mandir = @mandir@
|
||||||
|
mkdir_p = @mkdir_p@
|
||||||
|
oldincludedir = @oldincludedir@
|
||||||
|
pdfdir = @pdfdir@
|
||||||
|
pngincludes = @pngincludes@
|
||||||
|
pnglibs = @pnglibs@
|
||||||
|
prefix = @prefix@
|
||||||
|
program_transform_name = @program_transform_name@
|
||||||
|
psdir = @psdir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
target = @target@
|
||||||
|
target_alias = @target_alias@
|
||||||
|
target_cpu = @target_cpu@
|
||||||
|
target_os = @target_os@
|
||||||
|
target_vendor = @target_vendor@
|
||||||
|
tiffincludes = @tiffincludes@
|
||||||
|
tifflibs = @tifflibs@
|
||||||
|
top_build_prefix = @top_build_prefix@
|
||||||
|
top_builddir = @top_builddir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
with_doxygen = @with_doxygen@
|
||||||
|
COMPILERFLAGS = -Wall $(am__append_1) $(am__append_2)
|
||||||
|
USERLIBS = -lm $(am__append_4) $(am__append_6) $(am__append_8) \
|
||||||
|
$(am__append_10)
|
||||||
|
INCLUDES = -I.. -I. -I../libopenjpeg -I../common $(am__append_3) \
|
||||||
|
$(am__append_5) $(am__append_7) $(am__append_9)
|
||||||
|
LDADD = $(USERLIBS) ../libopenjpeg/libopenjpeg.la
|
||||||
|
j2k_to_image_SOURCES = ../common/getopt.c index.c convert.c \
|
||||||
|
../common/color.c j2k_to_image.c
|
||||||
|
|
||||||
|
image_to_j2k_SOURCES = ../common/getopt.c index.c convert.c image_to_j2k.c
|
||||||
|
j2k_dump_SOURCES = ../common/getopt.c index.c j2k_dump.c
|
||||||
|
REPBIN = $(bin_PROGRAMS)
|
||||||
|
all: all-am
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .c .lo .o .obj
|
||||||
|
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||||
|
@for dep in $?; do \
|
||||||
|
case '$(am__configure_deps)' in \
|
||||||
|
*$$dep*) \
|
||||||
|
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||||
|
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign codec/Makefile'; \
|
||||||
|
$(am__cd) $(top_srcdir) && \
|
||||||
|
$(AUTOMAKE) --foreign codec/Makefile
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
|
@case '$?' in \
|
||||||
|
*config.status*) \
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
|
*) \
|
||||||
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||||
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||||
|
esac;
|
||||||
|
|
||||||
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
|
||||||
|
$(top_srcdir)/configure: $(am__configure_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||||
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(am__aclocal_m4_deps):
|
||||||
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||||
|
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||||
|
for p in $$list; do echo "$$p $$p"; done | \
|
||||||
|
sed 's/$(EXEEXT)$$//' | \
|
||||||
|
while read p p1; do if test -f $$p || test -f $$p1; \
|
||||||
|
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||||
|
done | \
|
||||||
|
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||||
|
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||||
|
sed 'N;N;N;s,\n, ,g' | \
|
||||||
|
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||||
|
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||||
|
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||||
|
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||||
|
END { for (d in files) print "f", d, files[d] }' | \
|
||||||
|
while read type dir files; do \
|
||||||
|
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||||
|
test -z "$$files" || { \
|
||||||
|
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||||
|
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||||
|
} \
|
||||||
|
; done
|
||||||
|
|
||||||
|
uninstall-binPROGRAMS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||||
|
files=`for p in $$list; do echo "$$p"; done | \
|
||||||
|
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||||
|
-e 's/$$/$(EXEEXT)/' `; \
|
||||||
|
test -n "$$list" || exit 0; \
|
||||||
|
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||||
|
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||||
|
|
||||||
|
clean-binPROGRAMS:
|
||||||
|
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||||
|
echo " rm -f" $$list; \
|
||||||
|
rm -f $$list || exit $$?; \
|
||||||
|
test -n "$(EXEEXT)" || exit 0; \
|
||||||
|
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||||
|
echo " rm -f" $$list; \
|
||||||
|
rm -f $$list
|
||||||
|
image_to_j2k$(EXEEXT): $(image_to_j2k_OBJECTS) $(image_to_j2k_DEPENDENCIES)
|
||||||
|
@rm -f image_to_j2k$(EXEEXT)
|
||||||
|
$(LINK) $(image_to_j2k_OBJECTS) $(image_to_j2k_LDADD) $(LIBS)
|
||||||
|
j2k_dump$(EXEEXT): $(j2k_dump_OBJECTS) $(j2k_dump_DEPENDENCIES)
|
||||||
|
@rm -f j2k_dump$(EXEEXT)
|
||||||
|
$(LINK) $(j2k_dump_OBJECTS) $(j2k_dump_LDADD) $(LIBS)
|
||||||
|
j2k_to_image$(EXEEXT): $(j2k_to_image_OBJECTS) $(j2k_to_image_DEPENDENCIES)
|
||||||
|
@rm -f j2k_to_image$(EXEEXT)
|
||||||
|
$(LINK) $(j2k_to_image_OBJECTS) $(j2k_to_image_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.$(OBJEXT)
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/color.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convert.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image_to_j2k.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/index.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/j2k_dump.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/j2k_to_image.Po@am__quote@
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.c.obj:
|
||||||
|
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||||
|
|
||||||
|
.c.lo:
|
||||||
|
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||||
|
|
||||||
|
getopt.o: ../common/getopt.c
|
||||||
|
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.o -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.o `test -f '../common/getopt.c' || echo '$(srcdir)/'`../common/getopt.c
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/getopt.c' object='getopt.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.o `test -f '../common/getopt.c' || echo '$(srcdir)/'`../common/getopt.c
|
||||||
|
|
||||||
|
getopt.obj: ../common/getopt.c
|
||||||
|
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getopt.obj -MD -MP -MF $(DEPDIR)/getopt.Tpo -c -o getopt.obj `if test -f '../common/getopt.c'; then $(CYGPATH_W) '../common/getopt.c'; else $(CYGPATH_W) '$(srcdir)/../common/getopt.c'; fi`
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getopt.Tpo $(DEPDIR)/getopt.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/getopt.c' object='getopt.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getopt.obj `if test -f '../common/getopt.c'; then $(CYGPATH_W) '../common/getopt.c'; else $(CYGPATH_W) '$(srcdir)/../common/getopt.c'; fi`
|
||||||
|
|
||||||
|
color.o: ../common/color.c
|
||||||
|
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT color.o -MD -MP -MF $(DEPDIR)/color.Tpo -c -o color.o `test -f '../common/color.c' || echo '$(srcdir)/'`../common/color.c
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/color.Tpo $(DEPDIR)/color.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/color.c' object='color.o' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o color.o `test -f '../common/color.c' || echo '$(srcdir)/'`../common/color.c
|
||||||
|
|
||||||
|
color.obj: ../common/color.c
|
||||||
|
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT color.obj -MD -MP -MF $(DEPDIR)/color.Tpo -c -o color.obj `if test -f '../common/color.c'; then $(CYGPATH_W) '../common/color.c'; else $(CYGPATH_W) '$(srcdir)/../common/color.c'; fi`
|
||||||
|
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/color.Tpo $(DEPDIR)/color.Po
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/color.c' object='color.obj' libtool=no @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o color.obj `if test -f '../common/color.c'; then $(CYGPATH_W) '../common/color.c'; else $(CYGPATH_W) '$(srcdir)/../common/color.c'; fi`
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
mkid -fID $$unique
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
set x; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
shift; \
|
||||||
|
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||||
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
|
if test $$# -gt 0; then \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
"$$@" $$unique; \
|
||||||
|
else \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$unique; \
|
||||||
|
fi; \
|
||||||
|
fi
|
||||||
|
ctags: CTAGS
|
||||||
|
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||||
|
$(TAGS_FILES) $(LISP)
|
||||||
|
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | \
|
||||||
|
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||||
|
test -z "$(CTAGS_ARGS)$$unique" \
|
||||||
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
|
$$unique
|
||||||
|
|
||||||
|
GTAGS:
|
||||||
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
|
&& $(am__cd) $(top_srcdir) \
|
||||||
|
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
|
list='$(DISTFILES)'; \
|
||||||
|
dist_files=`for file in $$list; do echo $$file; done | \
|
||||||
|
sed -e "s|^$$srcdirstrip/||;t" \
|
||||||
|
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||||
|
case $$dist_files in \
|
||||||
|
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||||
|
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||||
|
sort -u` ;; \
|
||||||
|
esac; \
|
||||||
|
for file in $$dist_files; do \
|
||||||
|
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
|
if test -d "$(distdir)/$$file"; then \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||||
|
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
else \
|
||||||
|
test -f "$(distdir)/$$file" \
|
||||||
|
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
all-am: Makefile $(PROGRAMS) all-local
|
||||||
|
installdirs:
|
||||||
|
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||||
|
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||||
|
done
|
||||||
|
install: install-am
|
||||||
|
install-exec: install-exec-am
|
||||||
|
install-data: install-data-am
|
||||||
|
uninstall: uninstall-am
|
||||||
|
|
||||||
|
install-am: all-am
|
||||||
|
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||||
|
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
`test -z '$(STRIP)' || \
|
||||||
|
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
@echo "This command is intended for maintainers to use"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
|
distclean-tags
|
||||||
|
|
||||||
|
dvi: dvi-am
|
||||||
|
|
||||||
|
dvi-am:
|
||||||
|
|
||||||
|
html: html-am
|
||||||
|
|
||||||
|
html-am:
|
||||||
|
|
||||||
|
info: info-am
|
||||||
|
|
||||||
|
info-am:
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
|
||||||
|
install-dvi: install-dvi-am
|
||||||
|
|
||||||
|
install-dvi-am:
|
||||||
|
|
||||||
|
install-exec-am: install-binPROGRAMS
|
||||||
|
|
||||||
|
install-html: install-html-am
|
||||||
|
|
||||||
|
install-html-am:
|
||||||
|
|
||||||
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-info-am:
|
||||||
|
|
||||||
|
install-man:
|
||||||
|
|
||||||
|
install-pdf: install-pdf-am
|
||||||
|
|
||||||
|
install-pdf-am:
|
||||||
|
|
||||||
|
install-ps: install-ps-am
|
||||||
|
|
||||||
|
install-ps-am:
|
||||||
|
|
||||||
|
installcheck-am:
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
-rm -rf ./$(DEPDIR)
|
||||||
|
-rm -f Makefile
|
||||||
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||||
|
mostlyclean-libtool
|
||||||
|
|
||||||
|
pdf: pdf-am
|
||||||
|
|
||||||
|
pdf-am:
|
||||||
|
|
||||||
|
ps: ps-am
|
||||||
|
|
||||||
|
ps-am:
|
||||||
|
|
||||||
|
uninstall-am: uninstall-binPROGRAMS
|
||||||
|
|
||||||
|
.MAKE: install-am install-strip
|
||||||
|
|
||||||
|
.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
|
||||||
|
clean-binPROGRAMS clean-generic clean-libtool ctags distclean \
|
||||||
|
distclean-compile distclean-generic distclean-libtool \
|
||||||
|
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||||
|
install install-am install-binPROGRAMS install-data \
|
||||||
|
install-data-am install-dvi install-dvi-am install-exec \
|
||||||
|
install-exec-am install-html install-html-am install-info \
|
||||||
|
install-info-am install-man install-pdf install-pdf-am \
|
||||||
|
install-ps install-ps-am install-strip installcheck \
|
||||||
|
installcheck-am installdirs maintainer-clean \
|
||||||
|
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||||
|
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||||
|
tags uninstall uninstall-am uninstall-binPROGRAMS
|
||||||
|
|
||||||
|
|
||||||
|
all-local:
|
||||||
|
$(INSTALL) -d ../bin
|
||||||
|
$(INSTALL) $(bin_PROGRAMS) ../bin
|
||||||
|
@echo "" > .report.txt
|
||||||
|
@for f in ${REPBIN} ; do \
|
||||||
|
echo "Installing: ${prefix}/bin/$$f" >> .report.txt ; \
|
||||||
|
done
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
||||||
68
codec/Makefile.nix
Normal file
68
codec/Makefile.nix
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#codec Makefile
|
||||||
|
include ../config.nix
|
||||||
|
|
||||||
|
CFLAGS = -Wall
|
||||||
|
|
||||||
|
INSTALL_BIN = $(prefix)/bin
|
||||||
|
|
||||||
|
INCLUDE = -I.. -I. -I../libopenjpeg -I../common
|
||||||
|
USERLIBS = -lm
|
||||||
|
|
||||||
|
ifeq ($(WITH_TIFF),yes)
|
||||||
|
INCLUDE += $(TIFF_INCLUDE)
|
||||||
|
USERLIBS += $(TIFF_LIB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_PNG),yes)
|
||||||
|
INCLUDE += $(PNG_INCLUDE)
|
||||||
|
USERLIBS += $(PNG_LIB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_LCMS2),yes)
|
||||||
|
INCLUDE += $(LCMS2_INCLUDE)
|
||||||
|
USERLIBS += $(LCMS2_LIB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_LCMS1),yes)
|
||||||
|
INCLUDE += $(LCMS1_INCLUDE)
|
||||||
|
USERLIBS += $(LCMS1_LIB)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CFLAGS += $(INCLUDE) -lstdc++ # -g -p -pg
|
||||||
|
|
||||||
|
all: j2k_to_image image_to_j2k j2k_dump
|
||||||
|
install -d ../bin
|
||||||
|
install j2k_to_image image_to_j2k j2k_dump ../bin
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_SHARED),yes)
|
||||||
|
ELIB = ../libopenjpeg.so.$(MAJOR).$(MINOR).$(BUILD)
|
||||||
|
else
|
||||||
|
ELIB = ../libopenjpeg.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
j2k_to_image: j2k_to_image.c $(ELIB)
|
||||||
|
$(CC) $(CFLAGS) ../common/getopt.c index.c convert.c \
|
||||||
|
../common/color.c j2k_to_image.c \
|
||||||
|
-o j2k_to_image $(ELIB) $(USERLIBS)
|
||||||
|
|
||||||
|
image_to_j2k: image_to_j2k.c $(ELIB)
|
||||||
|
$(CC) $(CFLAGS) ../common/getopt.c index.c convert.c image_to_j2k.c \
|
||||||
|
-o image_to_j2k $(ELIB) $(USERLIBS)
|
||||||
|
|
||||||
|
j2k_dump: j2k_dump.c $(ELIB)
|
||||||
|
$(CC) $(CFLAGS) ../common/getopt.c index.c j2k_dump.c \
|
||||||
|
-o j2k_dump $(ELIB) $(USERLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f j2k_to_image image_to_j2k j2k_dump
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -d $(DESTDIR)$(INSTALL_BIN)
|
||||||
|
install -m 755 -o root -g root j2k_to_image $(DESTDIR)$(INSTALL_BIN)
|
||||||
|
install -m 755 -o root -g root image_to_j2k $(DESTDIR)$(INSTALL_BIN)
|
||||||
|
install -m 755 -o root -g root j2k_dump $(DESTDIR)$(INSTALL_BIN)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f $(DESTDIR)$(INSTALL_BIN)/j2k_to_image
|
||||||
|
rm -f $(DESTDIR)$(INSTALL_BIN)/image_to_j2k
|
||||||
|
rm -f $(DESTDIR)$(INSTALL_BIN)/j2k_dump
|
||||||
8
codec/README
Normal file
8
codec/README
Normal 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.
|
||||||
636
codec/convert.c
636
codec/convert.c
@@ -29,11 +29,29 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
#include "opj_config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "openjpeg.h"
|
|
||||||
|
#ifdef HAVE_LIBTIFF
|
||||||
|
#ifdef _WIN32
|
||||||
#include "../libs/libtiff/tiffio.h"
|
#include "../libs/libtiff/tiffio.h"
|
||||||
|
#else
|
||||||
|
#include <tiffio.h>
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
#endif /* HAVE_LIBTIFF */
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include "../libs/png/png.h"
|
||||||
|
#else
|
||||||
|
#include <png.h>
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
#endif /* HAVE_LIBPNG */
|
||||||
|
|
||||||
|
#include "../libopenjpeg/openjpeg.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -78,28 +96,29 @@ static int int_ceildiv(int a, int b) {
|
|||||||
#pragma pack(push,1) // Pack structure byte aligned
|
#pragma pack(push,1) // Pack structure byte aligned
|
||||||
typedef struct tga_header
|
typedef struct tga_header
|
||||||
{
|
{
|
||||||
uint8 id_length; /* Image id field length */
|
unsigned char id_length; /* Image id field length */
|
||||||
uint8 colour_map_type; /* Colour map type */
|
unsigned char colour_map_type; /* Colour map type */
|
||||||
uint8 image_type; /* Image type */
|
unsigned char image_type; /* Image type */
|
||||||
/*
|
/*
|
||||||
** Colour map specification
|
** Colour map specification
|
||||||
*/
|
*/
|
||||||
uint16 colour_map_index; /* First entry index */
|
unsigned short colour_map_index; /* First entry index */
|
||||||
uint16 colour_map_length; /* Colour map length */
|
unsigned short colour_map_length; /* Colour map length */
|
||||||
uint8 colour_map_entry_size; /* Colour map entry size */
|
unsigned char colour_map_entry_size; /* Colour map entry size */
|
||||||
/*
|
/*
|
||||||
** Image specification
|
** Image specification
|
||||||
*/
|
*/
|
||||||
uint16 x_origin; /* x origin of image */
|
unsigned short x_origin; /* x origin of image */
|
||||||
uint16 y_origin; /* u origin of image */
|
unsigned short y_origin; /* u origin of image */
|
||||||
uint16 image_width; /* Image width */
|
unsigned short image_width; /* Image width */
|
||||||
uint16 image_height; /* Image height */
|
unsigned short image_height; /* Image height */
|
||||||
uint8 pixel_depth; /* Pixel depth */
|
unsigned char pixel_depth; /* Pixel depth */
|
||||||
uint8 image_desc; /* Image descriptor */
|
unsigned char image_desc; /* Image descriptor */
|
||||||
} tga_header;
|
} tga_header;
|
||||||
#pragma pack(pop) // Return to normal structure packing alignment.
|
#pragma pack(pop) // Return to normal structure packing alignment.
|
||||||
|
|
||||||
int tga_readheader(FILE *fp, int *bits_per_pixel, int *width, int *height, int *flip_image)
|
int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||||
|
unsigned int *width, unsigned int *height, int *flip_image)
|
||||||
{
|
{
|
||||||
int palette_size;
|
int palette_size;
|
||||||
tga_header tga ;
|
tga_header tga ;
|
||||||
@@ -108,7 +127,7 @@ int tga_readheader(FILE *fp, int *bits_per_pixel, int *width, int *height, int *
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Read TGA header
|
// Read TGA header
|
||||||
fread((uint8*)&tga, sizeof(tga_header), 1, fp);
|
fread((unsigned char*)&tga, sizeof(tga_header), 1, fp);
|
||||||
|
|
||||||
*bits_per_pixel = tga.pixel_depth;
|
*bits_per_pixel = tga.pixel_depth;
|
||||||
|
|
||||||
@@ -118,7 +137,7 @@ int tga_readheader(FILE *fp, int *bits_per_pixel, int *width, int *height, int *
|
|||||||
// Ignore tga identifier, if present ...
|
// Ignore tga identifier, if present ...
|
||||||
if (tga.id_length)
|
if (tga.id_length)
|
||||||
{
|
{
|
||||||
uint8 *id = (uint8 *) malloc(tga.id_length);
|
unsigned char *id = (unsigned char *) malloc(tga.id_length);
|
||||||
fread(id, tga.id_length, 1, fp);
|
fread(id, tga.id_length, 1, fp);
|
||||||
free(id);
|
free(id);
|
||||||
}
|
}
|
||||||
@@ -145,7 +164,8 @@ int tga_readheader(FILE *fp, int *bits_per_pixel, int *width, int *height, int *
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height, bool flip_image)
|
int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||||
|
bool flip_image)
|
||||||
{
|
{
|
||||||
tga_header tga;
|
tga_header tga;
|
||||||
|
|
||||||
@@ -164,7 +184,7 @@ int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height, bool fl
|
|||||||
tga.image_desc |= 32;
|
tga.image_desc |= 32;
|
||||||
|
|
||||||
// Write TGA header
|
// Write TGA header
|
||||||
fwrite((uint8*)&tga, sizeof(tga_header), 1, fp);
|
fwrite((unsigned char*)&tga, sizeof(tga_header), 1, fp);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -172,8 +192,8 @@ int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height, bool fl
|
|||||||
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
|
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
opj_image_t *image;
|
opj_image_t *image;
|
||||||
uint32 image_width, image_height, pixel_bit_depth;
|
unsigned int image_width, image_height, pixel_bit_depth;
|
||||||
uint32 x, y;
|
unsigned int x, y;
|
||||||
int flip_image=0;
|
int flip_image=0;
|
||||||
opj_image_cmptparm_t cmptparm[4]; /* maximum 4 components */
|
opj_image_cmptparm_t cmptparm[4]; /* maximum 4 components */
|
||||||
int numcomps;
|
int numcomps;
|
||||||
@@ -250,7 +270,7 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
|
|||||||
{
|
{
|
||||||
for (x=0;x<image_width;x++)
|
for (x=0;x<image_width;x++)
|
||||||
{
|
{
|
||||||
uint8 r,g,b;
|
unsigned char r,g,b;
|
||||||
fread(&b, 1, 1, f);
|
fread(&b, 1, 1, f);
|
||||||
fread(&g, 1, 1, f);
|
fread(&g, 1, 1, f);
|
||||||
fread(&r, 1, 1, f);
|
fread(&r, 1, 1, f);
|
||||||
@@ -265,7 +285,7 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) {
|
|||||||
{
|
{
|
||||||
for (x=0;x<image_width;x++)
|
for (x=0;x<image_width;x++)
|
||||||
{
|
{
|
||||||
uint8 r,g,b,a;
|
unsigned char r,g,b,a;
|
||||||
fread(&b, 1, 1, f);
|
fread(&b, 1, 1, f);
|
||||||
fread(&g, 1, 1, f);
|
fread(&g, 1, 1, f);
|
||||||
fread(&r, 1, 1, f);
|
fread(&r, 1, 1, f);
|
||||||
@@ -289,9 +309,9 @@ int imagetotga(opj_image_t * image, const char *outfile) {
|
|||||||
int width, height, bpp, x, y;
|
int width, height, bpp, x, y;
|
||||||
bool write_alpha;
|
bool write_alpha;
|
||||||
int i;
|
int i;
|
||||||
uint32 alpha_channel;
|
unsigned int alpha_channel;
|
||||||
float r,g,b,a;
|
float r,g,b,a;
|
||||||
uint8 value;
|
unsigned char value;
|
||||||
float scale;
|
float scale;
|
||||||
FILE *fdest;
|
FILE *fdest;
|
||||||
|
|
||||||
@@ -326,7 +346,7 @@ int imagetotga(opj_image_t * image, const char *outfile) {
|
|||||||
scale = 255.0f / (float)((1<<image->comps[0].prec)-1);
|
scale = 255.0f / (float)((1<<image->comps[0].prec)-1);
|
||||||
|
|
||||||
for (y=0; y < height; y++) {
|
for (y=0; y < height; y++) {
|
||||||
uint32 index=y*width;
|
unsigned int index=y*width;
|
||||||
|
|
||||||
for (x=0; x < width; x++, index++) {
|
for (x=0; x < width; x++, index++) {
|
||||||
r = (float)(image->comps[0].data[index]);
|
r = (float)(image->comps[0].data[index]);
|
||||||
@@ -341,18 +361,18 @@ int imagetotga(opj_image_t * image, const char *outfile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TGA format writes BGR ...
|
// TGA format writes BGR ...
|
||||||
value = (uint8)(b*scale);
|
value = (unsigned char)(b*scale);
|
||||||
fwrite(&value,1,1,fdest);
|
fwrite(&value,1,1,fdest);
|
||||||
|
|
||||||
value = (uint8)(g*scale);
|
value = (unsigned char)(g*scale);
|
||||||
fwrite(&value,1,1,fdest);
|
fwrite(&value,1,1,fdest);
|
||||||
|
|
||||||
value = (uint8)(r*scale);
|
value = (unsigned char)(r*scale);
|
||||||
fwrite(&value,1,1,fdest);
|
fwrite(&value,1,1,fdest);
|
||||||
|
|
||||||
if (write_alpha) {
|
if (write_alpha) {
|
||||||
a = (float)(image->comps[alpha_channel].data[index]);
|
a = (float)(image->comps[alpha_channel].data[index]);
|
||||||
value = (uint8)(a*scale);
|
value = (unsigned char)(a*scale);
|
||||||
fwrite(&value,1,1,fdest);
|
fwrite(&value,1,1,fdest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -914,7 +934,8 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
|
|||||||
if (image->comps[0].prec > 8) {
|
if (image->comps[0].prec > 8) {
|
||||||
adjustR = image->comps[0].prec - 8;
|
adjustR = image->comps[0].prec - 8;
|
||||||
printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
|
printf("BMP CONVERSION: Truncating component 0 from %d bits to 8 bits\n", image->comps[0].prec);
|
||||||
}
|
}else
|
||||||
|
adjustR = 0;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++) {
|
for (i = 0; i < 256; i++) {
|
||||||
fprintf(fdest, "%c%c%c%c", i, i, i, 0);
|
fprintf(fdest, "%c%c%c%c", i, i, i, 0);
|
||||||
@@ -1393,6 +1414,7 @@ int imagetopnm(opj_image_t * image, const char *outfile) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBTIFF
|
||||||
/* -->> -->> -->> -->>
|
/* -->> -->> -->> -->>
|
||||||
|
|
||||||
TIFF IMAGE FORMAT
|
TIFF IMAGE FORMAT
|
||||||
@@ -1456,9 +1478,9 @@ int imagetotif(opj_image_t * image, const char *outfile) {
|
|||||||
adjust = image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0;
|
adjust = image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0;
|
||||||
for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++) {
|
for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++) {
|
||||||
unsigned char *dat8;
|
unsigned char *dat8;
|
||||||
int i, ssize;
|
tsize_t i, ssize;
|
||||||
ssize = TIFFStripSize(tif);
|
ssize = TIFFStripSize(tif);
|
||||||
dat8 = buf;
|
dat8 = (unsigned char*)buf;
|
||||||
if (image->comps[0].prec == 8){
|
if (image->comps[0].prec == 8){
|
||||||
for (i=0; i<ssize-2; i+=3) { // 8 bits per pixel
|
for (i=0; i<ssize-2; i+=3) { // 8 bits per pixel
|
||||||
int r = 0,g = 0,b = 0;
|
int r = 0,g = 0,b = 0;
|
||||||
@@ -1616,9 +1638,9 @@ int imagetotif(opj_image_t * image, const char *outfile) {
|
|||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TIFFWriteEncodedStrip(tif, strip, buf, strip_size);
|
(void)TIFFWriteEncodedStrip(tif, strip, (void*)buf, strip_size);
|
||||||
}
|
}
|
||||||
_TIFFfree(buf);
|
_TIFFfree((void*)buf);
|
||||||
TIFFClose(tif);
|
TIFFClose(tif);
|
||||||
}else if (image->numcomps == 1){
|
}else if (image->numcomps == 1){
|
||||||
/* -->> -->> -->>
|
/* -->> -->> -->>
|
||||||
@@ -1652,8 +1674,8 @@ int imagetotif(opj_image_t * image, const char *outfile) {
|
|||||||
index = 0;
|
index = 0;
|
||||||
for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++) {
|
for (strip = 0; strip < TIFFNumberOfStrips(tif); strip++) {
|
||||||
unsigned char *dat8;
|
unsigned char *dat8;
|
||||||
int i;
|
tsize_t i;
|
||||||
dat8 = buf;
|
dat8 = (unsigned char*)buf;
|
||||||
if (image->comps[0].prec == 8){
|
if (image->comps[0].prec == 8){
|
||||||
for (i=0; i<TIFFStripSize(tif); i+=1) { // 8 bits per pixel
|
for (i=0; i<TIFFStripSize(tif); i+=1) { // 8 bits per pixel
|
||||||
if(index < imgsize){
|
if(index < imgsize){
|
||||||
@@ -1703,7 +1725,7 @@ int imagetotif(opj_image_t * image, const char *outfile) {
|
|||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TIFFWriteEncodedStrip(tif, strip, buf, strip_size);
|
(void)TIFFWriteEncodedStrip(tif, strip, (void*)buf, strip_size);
|
||||||
}
|
}
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
TIFFClose(tif);
|
TIFFClose(tif);
|
||||||
@@ -1794,7 +1816,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||||||
unsigned char *dat8;
|
unsigned char *dat8;
|
||||||
int i, ssize;
|
int i, ssize;
|
||||||
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
||||||
dat8 = buf;
|
dat8 = (unsigned char*)buf;
|
||||||
|
|
||||||
if (Info.tiBps==12){
|
if (Info.tiBps==12){
|
||||||
for (i=0; i<ssize; i+=9) { /*12 bits per pixel*/
|
for (i=0; i<ssize; i+=9) { /*12 bits per pixel*/
|
||||||
@@ -1890,7 +1912,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||||||
unsigned char *dat8;
|
unsigned char *dat8;
|
||||||
int i, ssize;
|
int i, ssize;
|
||||||
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
||||||
dat8 = buf;
|
dat8 = (unsigned char*)buf;
|
||||||
|
|
||||||
if (Info.tiBps==12){
|
if (Info.tiBps==12){
|
||||||
for (i=0; i<ssize; i+=3) { /* 12 bits per pixel*/
|
for (i=0; i<ssize; i+=3) { /* 12 bits per pixel*/
|
||||||
@@ -1937,6 +1959,8 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
|||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_LIBTIFF */
|
||||||
|
|
||||||
/* -->> -->> -->> -->>
|
/* -->> -->> -->> -->>
|
||||||
|
|
||||||
RAW IMAGE FORMAT
|
RAW IMAGE FORMAT
|
||||||
@@ -2012,19 +2036,30 @@ opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if(raw_cp->rawBitDepth <= 16)
|
||||||
{
|
{
|
||||||
unsigned short value = 0;
|
unsigned short value;
|
||||||
for(compno = 0; compno < numcomps; compno++) {
|
for(compno = 0; compno < numcomps; compno++) {
|
||||||
for (i = 0; i < w * h; i++) {
|
for (i = 0; i < w * h; i++) {
|
||||||
if (!fread(&value, 2, 1, f)) {
|
unsigned char temp;
|
||||||
|
if (!fread(&temp, 1, 1, f)) {
|
||||||
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
value = temp << 8;
|
||||||
|
if (!fread(&temp, 1, 1, f)) {
|
||||||
|
fprintf(stderr,"Error reading raw file. End of file probably reached.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
value += temp;
|
||||||
image->comps[compno].data[i] = raw_cp->rawSigned?(short)value:value;
|
image->comps[compno].data[i] = raw_cp->rawSigned?(short)value:value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr,"OpenJPEG cannot encode raw components with bit depth higher than 16 bits.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (fread(&ch, 1, 1, f)) {
|
if (fread(&ch, 1, 1, f)) {
|
||||||
fprintf(stderr,"Warning. End of raw file not reached... processing anyway\n");
|
fprintf(stderr,"Warning. End of raw file not reached... processing anyway\n");
|
||||||
@@ -2102,8 +2137,12 @@ int imagetoraw(opj_image_t * image, const char *outfile)
|
|||||||
ptr = image->comps[compno].data;
|
ptr = image->comps[compno].data;
|
||||||
for (line = 0; line < h; line++) {
|
for (line = 0; line < h; line++) {
|
||||||
for(row = 0; row < w; row++) {
|
for(row = 0; row < w; row++) {
|
||||||
|
unsigned char temp;
|
||||||
curr = (signed short int) (*ptr & mask);
|
curr = (signed short int) (*ptr & mask);
|
||||||
fwrite(&curr, sizeof(signed short int), 1, rawFile);
|
temp = (unsigned char) (curr >> 8);
|
||||||
|
fwrite(&temp, 1, 1, rawFile);
|
||||||
|
temp = (unsigned char) curr;
|
||||||
|
fwrite(&temp, 1, 1, rawFile);
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2115,8 +2154,12 @@ int imagetoraw(opj_image_t * image, const char *outfile)
|
|||||||
ptr = image->comps[compno].data;
|
ptr = image->comps[compno].data;
|
||||||
for (line = 0; line < h; line++) {
|
for (line = 0; line < h; line++) {
|
||||||
for(row = 0; row < w; row++) {
|
for(row = 0; row < w; row++) {
|
||||||
|
unsigned char temp;
|
||||||
curr = (unsigned short int) (*ptr & mask);
|
curr = (unsigned short int) (*ptr & mask);
|
||||||
fwrite(&curr, sizeof(unsigned short int), 1, rawFile);
|
temp = (unsigned char) (curr >> 8);
|
||||||
|
fwrite(&temp, 1, 1, rawFile);
|
||||||
|
temp = (unsigned char) curr;
|
||||||
|
fwrite(&temp, 1, 1, rawFile);
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2136,3 +2179,508 @@ int imagetoraw(opj_image_t * image, const char *outfile)
|
|||||||
fclose(rawFile);
|
fclose(rawFile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
|
||||||
|
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
|
||||||
|
#define MAGIC_SIZE 8
|
||||||
|
/* PNG allows bits per sample: 1, 2, 4, 8, 16 */
|
||||||
|
|
||||||
|
opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
|
||||||
|
{
|
||||||
|
png_structp png;
|
||||||
|
png_infop info;
|
||||||
|
double gamma, display_exponent;
|
||||||
|
int bit_depth, interlace_type,compression_type, filter_type;
|
||||||
|
int unit;
|
||||||
|
png_uint_32 resx, resy;
|
||||||
|
unsigned int i, j;
|
||||||
|
png_uint_32 width, height;
|
||||||
|
int color_type, has_alpha, is16;
|
||||||
|
unsigned char *s;
|
||||||
|
FILE *reader;
|
||||||
|
unsigned char **rows;
|
||||||
|
/* j2k: */
|
||||||
|
opj_image_t *image;
|
||||||
|
opj_image_cmptparm_t cmptparm[4];
|
||||||
|
int sub_dx, sub_dy;
|
||||||
|
unsigned int nr_comp;
|
||||||
|
int *r, *g, *b, *a;
|
||||||
|
unsigned char sigbuf[8];
|
||||||
|
|
||||||
|
if((reader = fopen(read_idf, "rb")) == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"pngtoimage: can not open %s\n",read_idf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
image = NULL; png = NULL; rows = NULL;
|
||||||
|
|
||||||
|
if(fread(sigbuf, 1, MAGIC_SIZE, reader) != MAGIC_SIZE
|
||||||
|
|| memcmp(sigbuf, PNG_MAGIC, MAGIC_SIZE) != 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"pngtoimage: %s is no valid PNG file\n",read_idf);
|
||||||
|
goto fin;
|
||||||
|
}
|
||||||
|
/* libpng-VERSION/example.c:
|
||||||
|
* PC : screen_gamma = 2.2;
|
||||||
|
* Mac: screen_gamma = 1.7 or 1.0;
|
||||||
|
*/
|
||||||
|
display_exponent = 2.2;
|
||||||
|
|
||||||
|
if((png = png_create_read_struct(PNG_LIBPNG_VER_STRING,
|
||||||
|
NULL, NULL, NULL)) == NULL)
|
||||||
|
goto fin;
|
||||||
|
if((info = png_create_info_struct(png)) == NULL)
|
||||||
|
goto fin;
|
||||||
|
|
||||||
|
if(setjmp(png_jmpbuf(png)))
|
||||||
|
goto fin;
|
||||||
|
|
||||||
|
png_init_io(png, reader);
|
||||||
|
png_set_sig_bytes(png, MAGIC_SIZE);
|
||||||
|
|
||||||
|
png_read_info(png, info);
|
||||||
|
|
||||||
|
if(png_get_IHDR(png, info, &width, &height,
|
||||||
|
&bit_depth, &color_type, &interlace_type,
|
||||||
|
&compression_type, &filter_type) == 0)
|
||||||
|
goto fin;
|
||||||
|
|
||||||
|
/* png_set_expand():
|
||||||
|
* expand paletted images to RGB, expand grayscale images of
|
||||||
|
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks
|
||||||
|
* to alpha channels.
|
||||||
|
*/
|
||||||
|
if(color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
|
png_set_expand(png);
|
||||||
|
else
|
||||||
|
if(color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
|
||||||
|
png_set_expand(png);
|
||||||
|
|
||||||
|
if(png_get_valid(png, info, PNG_INFO_tRNS))
|
||||||
|
png_set_expand(png);
|
||||||
|
|
||||||
|
is16 = (bit_depth == 16);
|
||||||
|
|
||||||
|
/* GRAY => RGB; GRAY_ALPHA => RGBA
|
||||||
|
*/
|
||||||
|
if(color_type == PNG_COLOR_TYPE_GRAY
|
||||||
|
|| color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
|
{
|
||||||
|
png_set_gray_to_rgb(png);
|
||||||
|
color_type =
|
||||||
|
(color_type == PNG_COLOR_TYPE_GRAY? PNG_COLOR_TYPE_RGB:
|
||||||
|
PNG_COLOR_TYPE_RGB_ALPHA);
|
||||||
|
}
|
||||||
|
if( !png_get_gAMA(png, info, &gamma))
|
||||||
|
gamma = 0.45455;
|
||||||
|
|
||||||
|
png_set_gamma(png, display_exponent, gamma);
|
||||||
|
|
||||||
|
png_read_update_info(png, info);
|
||||||
|
|
||||||
|
png_get_pHYs(png, info, &resx, &resy, &unit);
|
||||||
|
|
||||||
|
color_type = png_get_color_type(png, info);
|
||||||
|
|
||||||
|
has_alpha = (color_type == PNG_COLOR_TYPE_RGB_ALPHA);
|
||||||
|
|
||||||
|
nr_comp = 3 + has_alpha;
|
||||||
|
|
||||||
|
bit_depth = png_get_bit_depth(png, info);
|
||||||
|
|
||||||
|
rows = (unsigned char**)calloc(height+1, sizeof(unsigned char*));
|
||||||
|
for(i = 0; i < height; ++i)
|
||||||
|
rows[i] = (unsigned char*)malloc(png_get_rowbytes(png,info));
|
||||||
|
|
||||||
|
png_read_image(png, rows);
|
||||||
|
|
||||||
|
memset(&cmptparm, 0, 4 * sizeof(opj_image_cmptparm_t));
|
||||||
|
|
||||||
|
sub_dx = params->subsampling_dx; sub_dy = params->subsampling_dy;
|
||||||
|
|
||||||
|
for(i = 0; i < nr_comp; ++i)
|
||||||
|
{
|
||||||
|
cmptparm[i].prec = bit_depth;
|
||||||
|
/* bits_per_pixel: 8 or 16 */
|
||||||
|
cmptparm[i].bpp = bit_depth;
|
||||||
|
cmptparm[i].sgnd = 0;
|
||||||
|
cmptparm[i].dx = sub_dx;
|
||||||
|
cmptparm[i].dy = sub_dy;
|
||||||
|
cmptparm[i].w = width;
|
||||||
|
cmptparm[i].h = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
image = opj_image_create(nr_comp, &cmptparm[0], CLRSPC_SRGB);
|
||||||
|
|
||||||
|
if(image == NULL) goto fin;
|
||||||
|
|
||||||
|
image->x0 = params->image_offset_x0;
|
||||||
|
image->y0 = params->image_offset_y0;
|
||||||
|
image->x1 = image->x0 + (width - 1) * sub_dx + 1 + image->x0;
|
||||||
|
image->y1 = image->y0 + (height - 1) * sub_dy + 1 + image->y0;
|
||||||
|
|
||||||
|
r = image->comps[0].data;
|
||||||
|
g = image->comps[1].data;
|
||||||
|
b = image->comps[2].data;
|
||||||
|
a = image->comps[3].data;
|
||||||
|
|
||||||
|
for(i = 0; i < height; ++i)
|
||||||
|
{
|
||||||
|
s = rows[i];
|
||||||
|
|
||||||
|
for(j = 0; j < width; ++j)
|
||||||
|
{
|
||||||
|
if(is16)
|
||||||
|
{
|
||||||
|
*r++ = s[0]<<8|s[1]; s += 2;
|
||||||
|
|
||||||
|
*g++ = s[0]<<8|s[1]; s += 2;
|
||||||
|
|
||||||
|
*b++ = s[0]<<8|s[1]; s += 2;
|
||||||
|
|
||||||
|
if(has_alpha) { *a++ = s[0]<<8|s[1]; s += 2; }
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
*r++ = *s++; *g++ = *s++; *b++ = *s++;
|
||||||
|
|
||||||
|
if(has_alpha) *a++ = *s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fin:
|
||||||
|
if(rows)
|
||||||
|
{
|
||||||
|
for(i = 0; i < height; ++i)
|
||||||
|
free(rows[i]);
|
||||||
|
free(rows);
|
||||||
|
}
|
||||||
|
if(png)
|
||||||
|
png_destroy_read_struct(&png, &info, NULL);
|
||||||
|
|
||||||
|
fclose(reader);
|
||||||
|
|
||||||
|
return image;
|
||||||
|
|
||||||
|
}/* pngtoimage() */
|
||||||
|
|
||||||
|
int imagetopng(opj_image_t * image, const char *write_idf)
|
||||||
|
{
|
||||||
|
FILE *writer;
|
||||||
|
png_structp png;
|
||||||
|
png_infop info;
|
||||||
|
int *red, *green, *blue, *alpha;
|
||||||
|
unsigned char *row_buf, *d;
|
||||||
|
int has_alpha, width, height, nr_comp, color_type;
|
||||||
|
int adjustR, adjustG, adjustB, x, y, fails, is16, force16;
|
||||||
|
int opj_prec, prec, ushift, dshift;
|
||||||
|
unsigned short mask = 0xffff;
|
||||||
|
png_color_8 sig_bit;
|
||||||
|
|
||||||
|
is16 = force16 = ushift = dshift = 0; fails = 1;
|
||||||
|
prec = opj_prec = image->comps[0].prec;
|
||||||
|
|
||||||
|
if(prec > 8 && prec < 16)
|
||||||
|
{
|
||||||
|
prec = 16; force16 = 1;
|
||||||
|
}
|
||||||
|
if(prec != 1 && prec != 2 && prec != 4 && prec != 8 && prec != 16)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"imagetopng: can not create %s"
|
||||||
|
"\n\twrong bit_depth %d\n", write_idf, prec);
|
||||||
|
return fails;
|
||||||
|
}
|
||||||
|
writer = fopen(write_idf, "wb");
|
||||||
|
|
||||||
|
if(writer == NULL) return fails;
|
||||||
|
|
||||||
|
info = NULL; has_alpha = 0;
|
||||||
|
|
||||||
|
/* Create and initialize the png_struct with the desired error handler
|
||||||
|
* functions. If you want to use the default stderr and longjump method,
|
||||||
|
* you can supply NULL for the last three parameters. We also check that
|
||||||
|
* the library version is compatible with the one used at compile time,
|
||||||
|
* in case we are using dynamically linked libraries. REQUIRED.
|
||||||
|
*/
|
||||||
|
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
/*png_voidp user_error_ptr, user_error_fn, user_warning_fn); */
|
||||||
|
|
||||||
|
if(png == NULL) goto fin;
|
||||||
|
|
||||||
|
/* Allocate/initialize the image information data. REQUIRED
|
||||||
|
*/
|
||||||
|
info = png_create_info_struct(png);
|
||||||
|
|
||||||
|
if(info == NULL) goto fin;
|
||||||
|
|
||||||
|
/* Set error handling. REQUIRED if you are not supplying your own
|
||||||
|
* error handling functions in the png_create_write_struct() call.
|
||||||
|
*/
|
||||||
|
if(setjmp(png_jmpbuf(png))) goto fin;
|
||||||
|
|
||||||
|
/* I/O initialization functions is REQUIRED
|
||||||
|
*/
|
||||||
|
png_init_io(png, writer);
|
||||||
|
|
||||||
|
/* Set the image information here. Width and height are up to 2^31,
|
||||||
|
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
|
||||||
|
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
|
||||||
|
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
|
||||||
|
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
|
||||||
|
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
||||||
|
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
|
||||||
|
* REQUIRED
|
||||||
|
*/
|
||||||
|
png_set_compression_level(png, Z_BEST_COMPRESSION);
|
||||||
|
|
||||||
|
if(prec == 16) mask = 0xffff;
|
||||||
|
else
|
||||||
|
if(prec == 8) mask = 0x00ff;
|
||||||
|
else
|
||||||
|
if(prec == 4) mask = 0x000f;
|
||||||
|
else
|
||||||
|
if(prec == 2) mask = 0x0003;
|
||||||
|
else
|
||||||
|
if(prec == 1) mask = 0x0001;
|
||||||
|
|
||||||
|
nr_comp = image->numcomps;
|
||||||
|
|
||||||
|
if(nr_comp >= 3
|
||||||
|
&& image->comps[0].dx == image->comps[1].dx
|
||||||
|
&& image->comps[1].dx == image->comps[2].dx
|
||||||
|
&& image->comps[0].dy == image->comps[1].dy
|
||||||
|
&& image->comps[1].dy == image->comps[2].dy
|
||||||
|
&& image->comps[0].prec == image->comps[1].prec
|
||||||
|
&& image->comps[1].prec == image->comps[2].prec)
|
||||||
|
{
|
||||||
|
int v;
|
||||||
|
|
||||||
|
has_alpha = (nr_comp > 3);
|
||||||
|
|
||||||
|
is16 = (prec == 16);
|
||||||
|
|
||||||
|
width = image->comps[0].w;
|
||||||
|
height = image->comps[0].h;
|
||||||
|
|
||||||
|
red = image->comps[0].data;
|
||||||
|
green = image->comps[1].data;
|
||||||
|
blue = image->comps[2].data;
|
||||||
|
|
||||||
|
sig_bit.red = sig_bit.green = sig_bit.blue = prec;
|
||||||
|
|
||||||
|
if(has_alpha)
|
||||||
|
{
|
||||||
|
sig_bit.alpha = prec;
|
||||||
|
alpha = image->comps[3].data;
|
||||||
|
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sig_bit.alpha = 0; alpha = NULL;
|
||||||
|
color_type = PNG_COLOR_TYPE_RGB;
|
||||||
|
}
|
||||||
|
png_set_sBIT(png, info, &sig_bit);
|
||||||
|
|
||||||
|
png_set_IHDR(png, info, width, height, prec,
|
||||||
|
color_type,
|
||||||
|
PNG_INTERLACE_NONE,
|
||||||
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
|
/*=============================*/
|
||||||
|
png_write_info(png, info);
|
||||||
|
/*=============================*/
|
||||||
|
if(opj_prec < 8)
|
||||||
|
{
|
||||||
|
png_set_packing(png);
|
||||||
|
}
|
||||||
|
if(force16)
|
||||||
|
{
|
||||||
|
ushift = 16 - opj_prec; dshift = opj_prec - ushift;
|
||||||
|
}
|
||||||
|
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||||
|
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
||||||
|
adjustB = (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
|
||||||
|
|
||||||
|
row_buf = (unsigned char*)malloc(width * nr_comp * 2);
|
||||||
|
|
||||||
|
for(y = 0; y < height; ++y)
|
||||||
|
{
|
||||||
|
d = row_buf;
|
||||||
|
|
||||||
|
for(x = 0; x < width; ++x)
|
||||||
|
{
|
||||||
|
if(is16)
|
||||||
|
{
|
||||||
|
/* Network byte order */
|
||||||
|
v = *red + adjustR; ++red;
|
||||||
|
|
||||||
|
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||||
|
|
||||||
|
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
|
||||||
|
|
||||||
|
v = *green + adjustG; ++green;
|
||||||
|
|
||||||
|
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||||
|
|
||||||
|
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
|
||||||
|
|
||||||
|
v = *blue + adjustB; ++blue;
|
||||||
|
|
||||||
|
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||||
|
|
||||||
|
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
|
||||||
|
|
||||||
|
if(has_alpha)
|
||||||
|
{
|
||||||
|
v = *alpha++;
|
||||||
|
|
||||||
|
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||||
|
|
||||||
|
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
*d++ = (unsigned char)((*red + adjustR) & mask); ++red;
|
||||||
|
*d++ = (unsigned char)((*green + adjustG) & mask); ++green;
|
||||||
|
*d++ = (unsigned char)((*blue + adjustB) & mask); ++blue;
|
||||||
|
|
||||||
|
if(has_alpha)
|
||||||
|
{
|
||||||
|
*d++ = (unsigned char)(*alpha & mask); ++alpha;
|
||||||
|
}
|
||||||
|
} /* for(x) */
|
||||||
|
|
||||||
|
png_write_row(png, row_buf);
|
||||||
|
|
||||||
|
} /* for(y) */
|
||||||
|
free(row_buf);
|
||||||
|
|
||||||
|
}/* nr_comp >= 3 */
|
||||||
|
else
|
||||||
|
if(nr_comp == 1 /* GRAY */
|
||||||
|
|| ( nr_comp == 2 /* GRAY_ALPHA */
|
||||||
|
&& image->comps[0].dx == image->comps[1].dx
|
||||||
|
&& image->comps[0].dy == image->comps[1].dy
|
||||||
|
&& image->comps[0].prec == image->comps[1].prec))
|
||||||
|
{
|
||||||
|
int v;
|
||||||
|
|
||||||
|
red = image->comps[0].data;
|
||||||
|
|
||||||
|
if(force16)
|
||||||
|
{
|
||||||
|
ushift = 16 - opj_prec; dshift = opj_prec - ushift;
|
||||||
|
}
|
||||||
|
|
||||||
|
sig_bit.gray = prec;
|
||||||
|
sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 0;
|
||||||
|
alpha = NULL;
|
||||||
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
|
|
||||||
|
if(nr_comp == 2)
|
||||||
|
{
|
||||||
|
has_alpha = 1; sig_bit.alpha = prec;
|
||||||
|
alpha = image->comps[1].data;
|
||||||
|
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||||
|
}
|
||||||
|
width = image->comps[0].w;
|
||||||
|
height = image->comps[0].h;
|
||||||
|
|
||||||
|
png_set_IHDR(png, info, width, height, sig_bit.gray,
|
||||||
|
color_type,
|
||||||
|
PNG_INTERLACE_NONE,
|
||||||
|
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
|
png_set_sBIT(png, info, &sig_bit);
|
||||||
|
/*=============================*/
|
||||||
|
png_write_info(png, info);
|
||||||
|
/*=============================*/
|
||||||
|
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||||
|
|
||||||
|
if(opj_prec < 8)
|
||||||
|
{
|
||||||
|
png_set_packing(png);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prec > 8)
|
||||||
|
{
|
||||||
|
/* Network byte order */
|
||||||
|
|
||||||
|
|
||||||
|
row_buf = (unsigned char*)
|
||||||
|
malloc(width * nr_comp * sizeof(unsigned short));
|
||||||
|
|
||||||
|
for(y = 0; y < height; ++y)
|
||||||
|
{
|
||||||
|
d = row_buf;
|
||||||
|
|
||||||
|
for(x = 0; x < width; ++x)
|
||||||
|
{
|
||||||
|
v = *red + adjustR; ++red;
|
||||||
|
|
||||||
|
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||||
|
|
||||||
|
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)(v & 0xff);
|
||||||
|
|
||||||
|
if(has_alpha)
|
||||||
|
{
|
||||||
|
v = *alpha++;
|
||||||
|
|
||||||
|
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||||
|
|
||||||
|
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)(v & 0xff);
|
||||||
|
}
|
||||||
|
}/* for(x) */
|
||||||
|
png_write_row(png, row_buf);
|
||||||
|
|
||||||
|
} /* for(y) */
|
||||||
|
free(row_buf);
|
||||||
|
}
|
||||||
|
else /* prec <= 8 */
|
||||||
|
{
|
||||||
|
row_buf = (unsigned char*)calloc(width, nr_comp * 2);
|
||||||
|
|
||||||
|
for(y = 0; y < height; ++y)
|
||||||
|
{
|
||||||
|
d = row_buf;
|
||||||
|
|
||||||
|
for(x = 0; x < width; ++x)
|
||||||
|
{
|
||||||
|
*d++ = (unsigned char)((*red + adjustR) & mask); ++red;
|
||||||
|
|
||||||
|
if(has_alpha)
|
||||||
|
{
|
||||||
|
*d++ = (unsigned char)(*alpha & mask); ++alpha;
|
||||||
|
}
|
||||||
|
}/* for(x) */
|
||||||
|
|
||||||
|
png_write_row(png, row_buf);
|
||||||
|
|
||||||
|
} /* for(y) */
|
||||||
|
free(row_buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr,"imagetopng: can not create %s\n",write_idf);
|
||||||
|
goto fin;
|
||||||
|
}
|
||||||
|
png_write_end(png, info);
|
||||||
|
|
||||||
|
fails = 0;
|
||||||
|
|
||||||
|
fin:
|
||||||
|
|
||||||
|
if(png)
|
||||||
|
{
|
||||||
|
png_destroy_write_struct(&png, &info);
|
||||||
|
}
|
||||||
|
fclose(writer);
|
||||||
|
|
||||||
|
if(fails) remove(write_idf);
|
||||||
|
|
||||||
|
return fails;
|
||||||
|
}/* imagetopng() */
|
||||||
|
#endif /* HAVE_LIBPNG */
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ int imagetotga(opj_image_t * image, const char *outfile);
|
|||||||
opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters);
|
opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
int imagetobmp(opj_image_t *image, const char *outfile);
|
int imagetobmp(opj_image_t *image, const char *outfile);
|
||||||
|
|
||||||
/* TIFF to image conversion*/
|
/* TIFF conversion*/
|
||||||
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters);
|
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
int imagetotif(opj_image_t *image, const char *outfile);
|
int imagetotif(opj_image_t *image, const char *outfile);
|
||||||
/**
|
/**
|
||||||
@@ -74,5 +74,9 @@ int imagetopnm(opj_image_t *image, const char *outfile);
|
|||||||
int imagetoraw(opj_image_t * image, const char *outfile);
|
int imagetoraw(opj_image_t * image, const char *outfile);
|
||||||
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
|
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
|
||||||
|
|
||||||
|
/* PNG conversion*/
|
||||||
|
extern int imagetopng(opj_image_t *image, const char *write_idf);
|
||||||
|
extern opj_image_t* pngtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
#endif /* __J2K_CONVERT_H */
|
#endif /* __J2K_CONVERT_H */
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* Copyright (c) 2001-2003, David Janssens
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
@@ -29,37 +29,34 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.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 "openjpeg.h"
|
||||||
#include "compat/getopt.h"
|
#include "getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "dirent.h"
|
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#include "format_defs.h"
|
||||||
#define stricmp strcasecmp
|
|
||||||
#define strnicmp strncasecmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
|
|
||||||
#define PXM_DFMT 10
|
|
||||||
#define PGX_DFMT 11
|
|
||||||
#define BMP_DFMT 12
|
|
||||||
#define YUV_DFMT 13
|
|
||||||
#define TIF_DFMT 14
|
|
||||||
#define RAW_DFMT 15
|
|
||||||
#define TGA_DFMT 16
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
|
||||||
#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/
|
#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/
|
||||||
#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/
|
#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/
|
||||||
#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/
|
#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/
|
||||||
@@ -86,7 +83,7 @@ typedef struct img_folder{
|
|||||||
}img_fol_t;
|
}img_fol_t;
|
||||||
|
|
||||||
void encode_help_display() {
|
void encode_help_display() {
|
||||||
fprintf(stdout,"HELP\n----\n\n");
|
fprintf(stdout,"HELP for image_to_j2k\n----\n\n");
|
||||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||||
|
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
@@ -139,9 +136,9 @@ void encode_help_display() {
|
|||||||
fprintf(stdout,"-OutFor \n");
|
fprintf(stdout,"-OutFor \n");
|
||||||
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
|
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
|
||||||
fprintf(stdout," Need to specify only format without filename <BMP> \n");
|
fprintf(stdout," Need to specify only format without filename <BMP> \n");
|
||||||
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA formats\n");
|
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA formats\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-i : source file (-i source.pnm also *.pgm, *.ppm, *.bmp, *.tif, *.raw, *.tga) \n");
|
fprintf(stdout,"-i : source file (-i source.pnm also *.pgm, *.ppm, *.pgx, *png, *.bmp, *.tif, *.raw, *.tga) \n");
|
||||||
fprintf(stdout," When using this option -o must be used\n");
|
fprintf(stdout," When using this option -o must be used\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-o : destination file (-o dest.j2k or .jp2) \n");
|
fprintf(stdout,"-o : destination file (-o dest.j2k or .jp2) \n");
|
||||||
@@ -151,10 +148,10 @@ void encode_help_display() {
|
|||||||
fprintf(stdout,"-h : display the help information \n ");
|
fprintf(stdout,"-h : display the help information \n ");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-cinema2K : Digital Cinema 2K profile compliant codestream for 2K resolution.(-cinema2k 24 or 48) \n");
|
fprintf(stdout,"-cinema2K : Digital Cinema 2K profile compliant codestream for 2K resolution.(-cinema2k 24 or 48) \n");
|
||||||
fprintf(stdout," Need to specify the frames per second for a 2K resolution. Only 24 or 48 fps is allowed\n");
|
fprintf(stdout," Need to specify the frames per second for a 2K resolution. Only 24 or 48 fps is allowed\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-cinema4K : Digital Cinema 4K profile compliant codestream for 4K resolution \n");
|
fprintf(stdout,"-cinema4K : Digital Cinema 4K profile compliant codestream for 4K resolution \n");
|
||||||
fprintf(stdout," Frames per second not required. Default value is 24fps\n");
|
fprintf(stdout," Frames per second not required. Default value is 24fps\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-r : different compression ratios for successive layers (-r 20,10,5)\n ");
|
fprintf(stdout,"-r : different compression ratios for successive layers (-r 20,10,5)\n ");
|
||||||
fprintf(stdout," - The rate specified for each quality level is the desired \n");
|
fprintf(stdout," - The rate specified for each quality level is the desired \n");
|
||||||
@@ -208,6 +205,10 @@ void encode_help_display() {
|
|||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-I : use the irreversible DWT 9-7 (-I) \n");
|
fprintf(stdout,"-I : use the irreversible DWT 9-7 (-I) \n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-F : characteristics of the raw input image\n");
|
||||||
|
fprintf(stdout," -F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
||||||
|
fprintf(stdout," Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
fprintf(stdout,"-W : adoption of JPWL (Part 11) capabilities (-W params)\n");
|
fprintf(stdout,"-W : adoption of JPWL (Part 11) capabilities (-W params)\n");
|
||||||
@@ -337,7 +338,7 @@ OPJ_PROG_ORDER give_progression(char progression[4]) {
|
|||||||
|
|
||||||
int get_num_images(char *imgdirpath){
|
int get_num_images(char *imgdirpath){
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent* content;
|
struct dirent* content;
|
||||||
int num_images = 0;
|
int num_images = 0;
|
||||||
|
|
||||||
/*Reading the input images from given input directory*/
|
/*Reading the input images from given input directory*/
|
||||||
@@ -359,7 +360,7 @@ int get_num_images(char *imgdirpath){
|
|||||||
|
|
||||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent* content;
|
struct dirent* content;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
/*Reading the input images from given input directory*/
|
/*Reading the input images from given input directory*/
|
||||||
@@ -379,23 +380,23 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
|
|||||||
strcpy(dirptr->filename[i],content->d_name);
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_file_format(char *filename) {
|
int get_file_format(char *filename) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
static const char *extension[] = {
|
static const char *extension[] = {
|
||||||
"pgx", "pnm", "pgm", "ppm", "bmp", "tif", "raw", "tga", "j2k", "jp2", "j2c"
|
"pgx", "pnm", "pgm", "ppm", "bmp", "tif", "raw", "tga", "png", "j2k", "jp2", "j2c", "jpc"
|
||||||
};
|
};
|
||||||
static const int format[] = {
|
static const int format[] = {
|
||||||
PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, J2K_CFMT, JP2_CFMT, J2K_CFMT
|
PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, J2K_CFMT, J2K_CFMT
|
||||||
};
|
};
|
||||||
char * ext = strrchr(filename, '.');
|
char * ext = strrchr(filename, '.');
|
||||||
if (ext == NULL)
|
if (ext == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
ext++;
|
ext++;
|
||||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||||
if(strnicmp(ext, extension[i], 3) == 0) {
|
if(_strnicmp(ext, extension[i], 3) == 0) {
|
||||||
return format[i];
|
return format[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,15 +436,15 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparamet
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
||||||
POC[0].tile = 1;
|
POC[0].tile = 1;
|
||||||
POC[0].resno0 = 0;
|
POC[0].resno0 = 0;
|
||||||
POC[0].compno0 = 0;
|
POC[0].compno0 = 0;
|
||||||
POC[0].layno1 = 1;
|
POC[0].layno1 = 1;
|
||||||
POC[0].resno1 = numres-1;
|
POC[0].resno1 = numres-1;
|
||||||
POC[0].compno1 = 3;
|
POC[0].compno1 = 3;
|
||||||
POC[0].prg1 = CPRL;
|
POC[0].prg1 = CPRL;
|
||||||
POC[1].tile = 1;
|
POC[1].tile = 1;
|
||||||
POC[1].resno0 = numres-1;
|
POC[1].resno0 = numres-1;
|
||||||
POC[1].compno0 = 0;
|
POC[1].compno0 = 0;
|
||||||
POC[1].layno1 = 1;
|
POC[1].layno1 = 1;
|
||||||
POC[1].resno1 = numres;
|
POC[1].resno1 = numres;
|
||||||
@@ -456,7 +457,7 @@ void cinema_parameters(opj_cparameters_t *parameters){
|
|||||||
parameters->tile_size_on = false;
|
parameters->tile_size_on = false;
|
||||||
parameters->cp_tdx=1;
|
parameters->cp_tdx=1;
|
||||||
parameters->cp_tdy=1;
|
parameters->cp_tdy=1;
|
||||||
|
|
||||||
/*Tile part*/
|
/*Tile part*/
|
||||||
parameters->tp_flag = 'C';
|
parameters->tp_flag = 'C';
|
||||||
parameters->tp_on = 1;
|
parameters->tp_on = 1;
|
||||||
@@ -468,7 +469,7 @@ void cinema_parameters(opj_cparameters_t *parameters){
|
|||||||
parameters->image_offset_y0 = 0;
|
parameters->image_offset_y0 = 0;
|
||||||
|
|
||||||
/*Codeblock size= 32*32*/
|
/*Codeblock size= 32*32*/
|
||||||
parameters->cblockw_init = 32;
|
parameters->cblockw_init = 32;
|
||||||
parameters->cblockh_init = 32;
|
parameters->cblockh_init = 32;
|
||||||
parameters->csty |= 0x01;
|
parameters->csty |= 0x01;
|
||||||
|
|
||||||
@@ -488,7 +489,6 @@ void cinema_parameters(opj_cparameters_t *parameters){
|
|||||||
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;
|
int i;
|
||||||
float temp_rate;
|
float temp_rate;
|
||||||
opj_poc_t *POC = NULL;
|
|
||||||
|
|
||||||
switch (parameters->cp_cinema){
|
switch (parameters->cp_cinema){
|
||||||
case CINEMA2K_24:
|
case CINEMA2K_24:
|
||||||
@@ -503,7 +503,7 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
parameters->cp_rsiz = STD_RSIZ;
|
parameters->cp_rsiz = STD_RSIZ;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CINEMA4K_24:
|
case CINEMA4K_24:
|
||||||
if(parameters->numresolution < 1){
|
if(parameters->numresolution < 1){
|
||||||
parameters->numresolution = 1;
|
parameters->numresolution = 1;
|
||||||
@@ -511,13 +511,15 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
parameters->numresolution = 7;
|
parameters->numresolution = 7;
|
||||||
}
|
}
|
||||||
if (!((image->comps[0].w == 4096) | (image->comps[0].h == 2160))){
|
if (!((image->comps[0].w == 4096) | (image->comps[0].h == 2160))){
|
||||||
fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
|
fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
|
||||||
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
|
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
|
||||||
image->comps[0].w,image->comps[0].h);
|
image->comps[0].w,image->comps[0].h);
|
||||||
parameters->cp_rsiz = STD_RSIZ;
|
parameters->cp_rsiz = STD_RSIZ;
|
||||||
}
|
}
|
||||||
parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
|
parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
|
||||||
break;
|
break;
|
||||||
|
default :
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (parameters->cp_cinema){
|
switch (parameters->cp_cinema){
|
||||||
@@ -526,13 +528,13 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
for(i=0 ; i<parameters->tcp_numlayers ; i++){
|
for(i=0 ; i<parameters->tcp_numlayers ; i++){
|
||||||
temp_rate = 0 ;
|
temp_rate = 0 ;
|
||||||
if (img_fol->rates[i]== 0){
|
if (img_fol->rates[i]== 0){
|
||||||
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
||||||
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
||||||
}else{
|
}else{
|
||||||
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
||||||
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
|
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
|
||||||
if (temp_rate > CINEMA_24_CS ){
|
if (temp_rate > CINEMA_24_CS ){
|
||||||
parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
||||||
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
||||||
}else{
|
}else{
|
||||||
parameters->tcp_rates[i]= img_fol->rates[i];
|
parameters->tcp_rates[i]= img_fol->rates[i];
|
||||||
@@ -541,18 +543,18 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
}
|
}
|
||||||
parameters->max_comp_size = COMP_24_CS;
|
parameters->max_comp_size = COMP_24_CS;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CINEMA2K_48:
|
case CINEMA2K_48:
|
||||||
for(i=0 ; i<parameters->tcp_numlayers ; i++){
|
for(i=0 ; i<parameters->tcp_numlayers ; i++){
|
||||||
temp_rate = 0 ;
|
temp_rate = 0 ;
|
||||||
if (img_fol->rates[i]== 0){
|
if (img_fol->rates[i]== 0){
|
||||||
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
||||||
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
||||||
}else{
|
}else{
|
||||||
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
||||||
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
|
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
|
||||||
if (temp_rate > CINEMA_48_CS ){
|
if (temp_rate > CINEMA_48_CS ){
|
||||||
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
|
||||||
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
|
||||||
}else{
|
}else{
|
||||||
parameters->tcp_rates[i]= img_fol->rates[i];
|
parameters->tcp_rates[i]= img_fol->rates[i];
|
||||||
@@ -561,6 +563,8 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
}
|
}
|
||||||
parameters->max_comp_size = COMP_48_CS;
|
parameters->max_comp_size = COMP_48_CS;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
parameters->cp_disto_alloc = 1;
|
parameters->cp_disto_alloc = 1;
|
||||||
}
|
}
|
||||||
@@ -583,11 +587,11 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
const char optlist[] = "i:o:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:"
|
const char optlist[] = "i:o:r:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:"
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
"W:"
|
"W:"
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
;
|
"h";
|
||||||
|
|
||||||
totlen=sizeof(long_option);
|
totlen=sizeof(long_option);
|
||||||
img_fol->set_out_format=0;
|
img_fol->set_out_format=0;
|
||||||
@@ -609,11 +613,12 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case TIF_DFMT:
|
case TIF_DFMT:
|
||||||
case RAW_DFMT:
|
case RAW_DFMT:
|
||||||
case TGA_DFMT:
|
case TGA_DFMT:
|
||||||
|
case PNG_DFMT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"!! Unrecognized format for infile : %s "
|
"!! Unrecognized format for infile : %s "
|
||||||
"[accept only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga] !!\n\n",
|
"[accept only *.pnm, *.pgm, *.ppm, *.pgx, *png, *.bmp, *.tif, *.raw or *.tga] !!\n\n",
|
||||||
infile);
|
infile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -666,6 +671,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'r': /* rates rates/distorsion */
|
case 'r': /* rates rates/distorsion */
|
||||||
{
|
{
|
||||||
char *s = optarg;
|
char *s = optarg;
|
||||||
|
parameters->tcp_numlayers = 0;
|
||||||
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
while (sscanf(s, "%f", ¶meters->tcp_rates[parameters->tcp_numlayers]) == 1) {
|
||||||
parameters->tcp_numlayers++;
|
parameters->tcp_numlayers++;
|
||||||
while (*s && *s != ',') {
|
while (*s && *s != ',') {
|
||||||
@@ -681,7 +687,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
case 'F': /* Raw image format parameters */
|
case 'F': /* Raw image format parameters */
|
||||||
{
|
{
|
||||||
char signo;
|
char signo;
|
||||||
@@ -701,7 +707,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
fprintf(stderr,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
fprintf(stderr,"-F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\n");
|
||||||
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
fprintf(stderr,"Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
fprintf(stderr,"\nError: invalid raw image parameters\n");
|
||||||
@@ -904,7 +910,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile,
|
while (sscanf(s, "T%d=%d,%d,%d,%d,%d,%4s", &POC[numpocs].tile,
|
||||||
&POC[numpocs].resno0, &POC[numpocs].compno0,
|
&POC[numpocs].resno0, &POC[numpocs].compno0,
|
||||||
&POC[numpocs].layno1, &POC[numpocs].resno1,
|
&POC[numpocs].layno1, &POC[numpocs].resno1,
|
||||||
&POC[numpocs].compno1, &POC[numpocs].progorder) == 7) {
|
&POC[numpocs].compno1, POC[numpocs].progorder) == 7) {
|
||||||
POC[numpocs].prg1 = give_progression(POC[numpocs].progorder);
|
POC[numpocs].prg1 = give_progression(POC[numpocs].progorder);
|
||||||
numpocs++;
|
numpocs++;
|
||||||
while (*s && *s != '/') {
|
while (*s && *s != '/') {
|
||||||
@@ -994,16 +1000,16 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'v': /* Tile part generation*/
|
case 'v': /* Tile part generation*/
|
||||||
{
|
{
|
||||||
parameters->tp_flag = optarg[0];
|
parameters->tp_flag = optarg[0];
|
||||||
parameters->tp_on = 1;
|
parameters->tp_on = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'z': /* Image Directory path */
|
case 'z': /* Image Directory path */
|
||||||
{
|
{
|
||||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||||
@@ -1013,7 +1019,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'w': /* Digital Cinema 2K profile compliance*/
|
case 'w': /* Digital Cinema 2K profile compliance*/
|
||||||
{
|
{
|
||||||
int fps=0;
|
int fps=0;
|
||||||
@@ -1028,12 +1034,12 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
}
|
}
|
||||||
fprintf(stdout,"CINEMA 2K compliant codestream\n");
|
fprintf(stdout,"CINEMA 2K compliant codestream\n");
|
||||||
parameters->cp_rsiz = CINEMA2K;
|
parameters->cp_rsiz = CINEMA2K;
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'y': /* Digital Cinema 4K profile compliance*/
|
case 'y': /* Digital Cinema 4K profile compliance*/
|
||||||
{
|
{
|
||||||
parameters->cp_cinema = CINEMA4K_24;
|
parameters->cp_cinema = CINEMA4K_24;
|
||||||
@@ -1041,20 +1047,20 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
parameters->cp_rsiz = CINEMA4K;
|
parameters->cp_rsiz = CINEMA4K;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'W': /* JPWL capabilities switched on */
|
case 'W': /* JPWL capabilities switched on */
|
||||||
{
|
{
|
||||||
char *token = NULL;
|
char *token = NULL;
|
||||||
int hprot, pprot, sens, addr, size, range;
|
int hprot, pprot, sens, addr, size, range;
|
||||||
|
|
||||||
/* we need to enable indexing */
|
/* we need to enable indexing */
|
||||||
if (!indexfilename) {
|
if (!indexfilename || !*indexfilename) {
|
||||||
strncpy(indexfilename, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
|
strncpy(indexfilename, JPWL_PRIVATEINDEX_NAME, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1122,7 +1128,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
/* search packet error protection method */
|
/* search packet error protection method */
|
||||||
if (*token == 'p') {
|
if (*token == 'p') {
|
||||||
|
|
||||||
static int pack = 0, tile = 0, packspec = 0, lastpackno = 0;
|
static int pack = 0, tile = 0, packspec = 0;
|
||||||
|
|
||||||
pprot = 1; /* predefined method */
|
pprot = 1; /* predefined method */
|
||||||
|
|
||||||
@@ -1271,14 +1277,13 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
fprintf(stderr, "ERROR -> invalid sensitivity method selection = %s\n", token);
|
fprintf(stderr, "ERROR -> invalid sensitivity method selection = %s\n", token);
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
parameters->jpwl_sens_size = 2; /* 2 bytes for default size */
|
parameters->jpwl_sens_size = 2; /* 2 bytes for default size */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search addressing size */
|
/* search addressing size */
|
||||||
if (*token == 'a') {
|
if (*token == 'a') {
|
||||||
|
|
||||||
static int tile = 0, tilespec = 0, lasttileno = 0;
|
|
||||||
|
|
||||||
addr = 0; /* predefined: auto */
|
addr = 0; /* predefined: auto */
|
||||||
|
|
||||||
@@ -1298,13 +1303,12 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
fprintf(stderr, "ERROR -> invalid addressing selection = %s\n", token);
|
fprintf(stderr, "ERROR -> invalid addressing selection = %s\n", token);
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search sensitivity size */
|
/* search sensitivity size */
|
||||||
if (*token == 'z') {
|
if (*token == 'z') {
|
||||||
|
|
||||||
static int tile = 0, tilespec = 0, lasttileno = 0;
|
|
||||||
|
|
||||||
size = 1; /* predefined: 1 byte */
|
size = 1; /* predefined: 1 byte */
|
||||||
|
|
||||||
@@ -1324,13 +1328,12 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
fprintf(stderr, "ERROR -> invalid size selection = %s\n", token);
|
fprintf(stderr, "ERROR -> invalid size selection = %s\n", token);
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* search range method */
|
/* search range method */
|
||||||
if (*token == 'g') {
|
if (*token == 'g') {
|
||||||
|
|
||||||
static int tile = 0, tilespec = 0, lasttileno = 0;
|
|
||||||
|
|
||||||
range = 0; /* predefined: 0 (packet) */
|
range = 0; /* predefined: 0 (packet) */
|
||||||
|
|
||||||
@@ -1350,7 +1353,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
fprintf(stderr, "ERROR -> invalid range selection = %s\n", token);
|
fprintf(stderr, "ERROR -> invalid range selection = %s\n", token);
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* next token or bust */
|
/* next token or bust */
|
||||||
@@ -1399,9 +1402,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||||
fprintf(stderr, "Error: One of the options; -i or -ImgDir must be specified\n");
|
fprintf(stderr, "Example: %s -i image.ppm -o image.j2k\n",argv[0]);
|
||||||
fprintf(stderr, "Error: When using -i; -o must be used\n");
|
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||||
fprintf(stderr, "usage: image_to_j2k -i image-file -o j2k/jp2-file (+ options)\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1505,14 +1507,14 @@ int main(int argc, char **argv) {
|
|||||||
if(parse_cmdline_encoder(argc, argv, ¶meters,&img_fol, &raw_cp, indexfilename) == 1) {
|
if(parse_cmdline_encoder(argc, argv, ¶meters,&img_fol, &raw_cp, indexfilename) == 1) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.cp_cinema){
|
if (parameters.cp_cinema){
|
||||||
img_fol.rates = (float*)malloc(parameters.tcp_numlayers * sizeof(float));
|
img_fol.rates = (float*)malloc(parameters.tcp_numlayers * sizeof(float));
|
||||||
for(i=0; i< parameters.tcp_numlayers; i++){
|
for(i=0; i< parameters.tcp_numlayers; i++){
|
||||||
img_fol.rates[i] = parameters.tcp_rates[i];
|
img_fol.rates[i] = parameters.tcp_rates[i];
|
||||||
}
|
}
|
||||||
cinema_parameters(¶meters);
|
cinema_parameters(¶meters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create comment for codestream */
|
/* Create comment for codestream */
|
||||||
if(parameters.cp_comment == NULL) {
|
if(parameters.cp_comment == NULL) {
|
||||||
@@ -1558,7 +1560,7 @@ int main(int argc, char **argv) {
|
|||||||
for(imageno=0;imageno<num_images;imageno++) {
|
for(imageno=0;imageno<num_images;imageno++) {
|
||||||
image = NULL;
|
image = NULL;
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
|
|
||||||
if(img_fol.set_imgdir==1){
|
if(img_fol.set_imgdir==1){
|
||||||
if (get_next_file(imageno, dirptr,&img_fol, ¶meters)) {
|
if (get_next_file(imageno, dirptr,&img_fol, ¶meters)) {
|
||||||
fprintf(stderr,"skipping file...\n");
|
fprintf(stderr,"skipping file...\n");
|
||||||
@@ -1578,9 +1580,11 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
case TGA_DFMT:
|
case TGA_DFMT:
|
||||||
break;
|
break;
|
||||||
|
case PNG_DFMT:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"skipping file...\n");
|
fprintf(stderr,"skipping file...\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decode the source image */
|
/* decode the source image */
|
||||||
@@ -1591,7 +1595,7 @@ int main(int argc, char **argv) {
|
|||||||
image = pgxtoimage(parameters.infile, ¶meters);
|
image = pgxtoimage(parameters.infile, ¶meters);
|
||||||
if (!image) {
|
if (!image) {
|
||||||
fprintf(stderr, "Unable to load pgx file\n");
|
fprintf(stderr, "Unable to load pgx file\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1610,7 +1614,7 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAVE_LIBTIFF
|
||||||
case TIF_DFMT:
|
case TIF_DFMT:
|
||||||
image = tiftoimage(parameters.infile, ¶meters);
|
image = tiftoimage(parameters.infile, ¶meters);
|
||||||
if (!image) {
|
if (!image) {
|
||||||
@@ -1618,7 +1622,7 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif /* HAVE_LIBTIFF */
|
||||||
case RAW_DFMT:
|
case RAW_DFMT:
|
||||||
image = rawtoimage(parameters.infile, ¶meters, &raw_cp);
|
image = rawtoimage(parameters.infile, ¶meters, &raw_cp);
|
||||||
if (!image) {
|
if (!image) {
|
||||||
@@ -1634,7 +1638,24 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAVE_LIBPNG
|
||||||
|
case PNG_DFMT:
|
||||||
|
image = pngtoimage(parameters.infile, ¶meters);
|
||||||
|
if (!image) {
|
||||||
|
fprintf(stderr, "Unable to load png file\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* HAVE_LIBPNG */
|
||||||
}
|
}
|
||||||
|
/* Can happen if input file is TIFF or PNG
|
||||||
|
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
|
||||||
|
*/
|
||||||
|
if( !image)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Unable to load file: got no image\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/* Decide if MCT should be used */
|
/* Decide if MCT should be used */
|
||||||
parameters.tcp_mct = image->numcomps == 3 ? 1 : 0;
|
parameters.tcp_mct = image->numcomps == 3 ? 1 : 0;
|
||||||
|
|
||||||
@@ -1709,7 +1730,7 @@ int main(int argc, char **argv) {
|
|||||||
opj_cinfo_t* cinfo = opj_create_compress(CODEC_JP2);
|
opj_cinfo_t* cinfo = opj_create_compress(CODEC_JP2);
|
||||||
|
|
||||||
/* catch events using our callbacks and give a local context */
|
/* catch events using our callbacks and give a local context */
|
||||||
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
|
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
/* setup the encoder parameters using the current image and using user parameters */
|
/* setup the encoder parameters using the current image and using user parameters */
|
||||||
opj_setup_encoder(cinfo, ¶meters, image);
|
opj_setup_encoder(cinfo, ¶meters, image);
|
||||||
@@ -1741,7 +1762,7 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stderr,"Generated outfile %s\n",parameters.outfile);
|
fprintf(stderr,"Generated outfile %s\n",parameters.outfile);
|
||||||
/* close and free the byte stream */
|
/* close and free the byte stream */
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
|
||||||
/* Write the index to disk */
|
/* Write the index to disk */
|
||||||
if (*indexfilename) {
|
if (*indexfilename) {
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
@@ -1755,7 +1776,7 @@ int main(int argc, char **argv) {
|
|||||||
if (*indexfilename)
|
if (*indexfilename)
|
||||||
opj_destroy_cstr_info(&cstr_info);
|
opj_destroy_cstr_info(&cstr_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free image data */
|
/* free image data */
|
||||||
opj_image_destroy(image);
|
opj_image_destroy(image);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
|||||||
fprintf(stream, "%d %d\n", cstr_info->tw, cstr_info->th);
|
fprintf(stream, "%d %d\n", cstr_info->tw, cstr_info->th);
|
||||||
fprintf(stream, "%d\n", cstr_info->numcomps);
|
fprintf(stream, "%d\n", cstr_info->numcomps);
|
||||||
fprintf(stream, "%d\n", cstr_info->numlayers);
|
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||||
fprintf(stream, "%d\n", cstr_info->numdecompos);
|
fprintf(stream, "%d\n", cstr_info->numdecompos[0]); /* based on component 0 */
|
||||||
|
|
||||||
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||||
fprintf(stream, "[%d,%d] ",
|
fprintf(stream, "[%d,%d] ",
|
||||||
|
|||||||
634
codec/j2k_dump.c
Normal file
634
codec/j2k_dump.c
Normal file
@@ -0,0 +1,634 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 20010, 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 "../libopenjpeg/j2k.h"
|
||||||
|
#include "../libopenjpeg/jp2.h"
|
||||||
|
#include "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() {
|
||||||
|
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,"\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;
|
||||||
|
option_t long_option[]={
|
||||||
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
|
};
|
||||||
|
|
||||||
|
const char optlist[] = "i:h";
|
||||||
|
totlen=sizeof(long_option);
|
||||||
|
img_fol->set_out_format = 0;
|
||||||
|
while (1) {
|
||||||
|
int c = getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
switch (c) {
|
||||||
|
case 'i': /* input file */
|
||||||
|
{
|
||||||
|
char *infile = 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 'h': /* display an help description */
|
||||||
|
decode_help_display();
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'y': /* Image Directory path */
|
||||||
|
{
|
||||||
|
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||||
|
strcpy(img_fol->imgdirpath,optarg);
|
||||||
|
img_fol->set_imgdir=1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
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(¶meters);
|
||||||
|
|
||||||
|
/* 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, ¶meters,&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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*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, ¶meters)) {
|
||||||
|
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);
|
||||||
|
fread(src, 1, file_length, fsrc);
|
||||||
|
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, ¶meters);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* dump image */
|
||||||
|
j2k_dump_image(stdout, image);
|
||||||
|
|
||||||
|
/* dump cp */
|
||||||
|
j2k_dump_cp(stdout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* Write the index to disk */
|
||||||
|
if (*indexfilename) {
|
||||||
|
char 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, ¶meters);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* dump image */
|
||||||
|
if(image->icc_profile_buf)
|
||||||
|
{
|
||||||
|
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
||||||
|
}
|
||||||
|
j2k_dump_image(stdout, image);
|
||||||
|
|
||||||
|
/* dump cp */
|
||||||
|
j2k_dump_cp(stdout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* Write the index to disk */
|
||||||
|
if (*indexfilename) {
|
||||||
|
char 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, ¶meters);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* Write the index to disk */
|
||||||
|
if (*indexfilename) {
|
||||||
|
char 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
@@ -29,37 +29,41 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.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 "openjpeg.h"
|
||||||
#include "compat/getopt.h"
|
#include "getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "dirent.h"
|
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifdef HAVE_LIBLCMS2
|
||||||
#define stricmp strcasecmp
|
#include <lcms2.h>
|
||||||
#define strnicmp strncasecmp
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LIBLCMS1
|
||||||
|
#include <lcms.h>
|
||||||
|
#endif
|
||||||
|
#include "color.h"
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
#include "format_defs.h"
|
||||||
|
|
||||||
#define J2K_CFMT 0
|
|
||||||
#define JP2_CFMT 1
|
|
||||||
#define JPT_CFMT 2
|
|
||||||
|
|
||||||
#define PXM_DFMT 10
|
|
||||||
#define PGX_DFMT 11
|
|
||||||
#define BMP_DFMT 12
|
|
||||||
#define YUV_DFMT 13
|
|
||||||
#define TIF_DFMT 14
|
|
||||||
#define RAW_DFMT 15
|
|
||||||
#define TGA_DFMT 16
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
typedef struct dircnt{
|
typedef struct dircnt{
|
||||||
/** Buffer for holding images read from Directory*/
|
/** Buffer for holding images read from Directory*/
|
||||||
@@ -73,7 +77,7 @@ typedef struct img_folder{
|
|||||||
/** The directory path of the folder containing input images*/
|
/** The directory path of the folder containing input images*/
|
||||||
char *imgdirpath;
|
char *imgdirpath;
|
||||||
/** Output format*/
|
/** Output format*/
|
||||||
char *out_format;
|
const char *out_format;
|
||||||
/** Enable option*/
|
/** Enable option*/
|
||||||
char set_imgdir;
|
char set_imgdir;
|
||||||
/** Enable Cod Format for output*/
|
/** Enable Cod Format for output*/
|
||||||
@@ -82,7 +86,7 @@ typedef struct img_folder{
|
|||||||
}img_fol_t;
|
}img_fol_t;
|
||||||
|
|
||||||
void decode_help_display() {
|
void decode_help_display() {
|
||||||
fprintf(stdout,"HELP\n----\n\n");
|
fprintf(stdout,"HELP for j2k_to_image\n----\n\n");
|
||||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||||
|
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
@@ -99,14 +103,14 @@ void decode_help_display() {
|
|||||||
fprintf(stdout," -OutFor \n");
|
fprintf(stdout," -OutFor \n");
|
||||||
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
|
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
|
||||||
fprintf(stdout," Need to specify only format without filename <BMP> \n");
|
fprintf(stdout," Need to specify only format without filename <BMP> \n");
|
||||||
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA formats\n");
|
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA formats\n");
|
||||||
fprintf(stdout," -i <compressed file>\n");
|
fprintf(stdout," -i <compressed file>\n");
|
||||||
fprintf(stdout," REQUIRED only if an Input image directory not specified\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," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
|
||||||
fprintf(stdout," is identified based on its suffix.\n");
|
fprintf(stdout," is identified based on its suffix.\n");
|
||||||
fprintf(stdout," -o <decompressed file>\n");
|
fprintf(stdout," -o <decompressed file>\n");
|
||||||
fprintf(stdout," REQUIRED\n");
|
fprintf(stdout," REQUIRED\n");
|
||||||
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA files\n");
|
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA files\n");
|
||||||
fprintf(stdout," Binary data is written to the file (not ascii). If a PGX\n");
|
fprintf(stdout," Binary data is written to the file (not ascii). If a PGX\n");
|
||||||
fprintf(stdout," filename is given, there will be as many output files as there are\n");
|
fprintf(stdout," filename is given, there will be as many output files as there are\n");
|
||||||
fprintf(stdout," components: an indice starting from 0 will then be appended to the\n");
|
fprintf(stdout," components: an indice starting from 0 will then be appended to the\n");
|
||||||
@@ -188,15 +192,15 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
|
|||||||
|
|
||||||
int get_file_format(char *filename) {
|
int get_file_format(char *filename) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "j2k", "jp2", "jpt", "j2c" };
|
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, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT };
|
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, '.');
|
char * ext = strrchr(filename, '.');
|
||||||
if (ext == NULL)
|
if (ext == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
ext++;
|
ext++;
|
||||||
if(ext) {
|
if(ext) {
|
||||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||||
if(strnicmp(ext, extension[i], 3) == 0) {
|
if(_strnicmp(ext, extension[i], 3) == 0) {
|
||||||
return format[i];
|
return format[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,14 +243,14 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char optlist[] = "i:o:r:l:hx:"
|
const char optlist[] = "i:o:r:l:x:"
|
||||||
|
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
"W:"
|
"W:"
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
;
|
"h" ;
|
||||||
totlen=sizeof(long_option);
|
totlen=sizeof(long_option);
|
||||||
img_fol->set_out_format = 0;
|
img_fol->set_out_format = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -286,6 +290,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
case TIF_DFMT:
|
case TIF_DFMT:
|
||||||
case RAW_DFMT:
|
case RAW_DFMT:
|
||||||
case TGA_DFMT:
|
case TGA_DFMT:
|
||||||
|
case PNG_DFMT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outfile);
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outfile);
|
||||||
@@ -323,6 +328,9 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
case TGA_DFMT:
|
case TGA_DFMT:
|
||||||
img_fol->out_format = "raw";
|
img_fol->out_format = "raw";
|
||||||
break;
|
break;
|
||||||
|
case PNG_DFMT:
|
||||||
|
img_fol->out_format = "png";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat);
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -468,9 +476,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||||
fprintf(stderr, "Error: One of the options -i or -ImgDir must be specified\n");
|
fprintf(stderr, "Example: %s -i image.j2k -o image.pgm\n",argv[0]);
|
||||||
fprintf(stderr, "Error: When using -i, -o must be used\n");
|
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||||
fprintf(stderr, "usage: image_to_j2k -i *.j2k/jp2/j2c -o *.pgm/ppm/pnm/pgx/bmp/tif/raw/tga(+ options)\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -548,18 +555,18 @@ int main(int argc, char **argv) {
|
|||||||
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||||
|
|
||||||
if(!dirptr->filename_buf){
|
if(!dirptr->filename_buf){
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
for(i=0;i<num_images;i++){
|
for(i=0;i<num_images;i++){
|
||||||
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
|
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
if (num_images==0){
|
if (num_images==0){
|
||||||
fprintf(stdout,"Folder is empty\n");
|
fprintf(stdout,"Folder is empty\n");
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
num_images=1;
|
num_images=1;
|
||||||
@@ -730,6 +737,21 @@ int main(int argc, char **argv) {
|
|||||||
free(src);
|
free(src);
|
||||||
src = NULL;
|
src = NULL;
|
||||||
|
|
||||||
|
if(image->color_space == CLRSPC_SYCC)
|
||||||
|
{
|
||||||
|
color_sycc_to_rgb(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(image->icc_profile_buf)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
|
||||||
|
color_apply_icc_profile(image);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
free(image->icc_profile_buf);
|
||||||
|
image->icc_profile_buf = NULL; image->icc_profile_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* create output image */
|
/* create output image */
|
||||||
/* ------------------- */
|
/* ------------------- */
|
||||||
switch (parameters.cod_format) {
|
switch (parameters.cod_format) {
|
||||||
@@ -759,7 +781,7 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#ifdef HAVE_LIBTIFF
|
||||||
case TIF_DFMT: /* TIFF */
|
case TIF_DFMT: /* TIFF */
|
||||||
if(imagetotif(image, parameters.outfile)){
|
if(imagetotif(image, parameters.outfile)){
|
||||||
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
@@ -768,7 +790,7 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif /* HAVE_LIBTIFF */
|
||||||
case RAW_DFMT: /* RAW */
|
case RAW_DFMT: /* RAW */
|
||||||
if(imagetoraw(image, parameters.outfile)){
|
if(imagetoraw(image, parameters.outfile)){
|
||||||
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
||||||
@@ -786,6 +808,21 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* HAVE_LIBPNG */
|
||||||
|
/* Can happen if output file is TIFF or PNG
|
||||||
|
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free remaining structures */
|
/* free remaining structures */
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
# define HAVE_SYS_DIR_H
|
# define HAVE_SYS_DIR_H
|
||||||
# elif defined(__hpux) /* HP-UX */
|
# elif defined(__hpux) /* HP-UX */
|
||||||
# define HAVE_DIRENT_H
|
# define HAVE_DIRENT_H
|
||||||
# elif defined(__alpha) || defined(__alpha__) /* Alpha OSF1 */
|
# elif (defined(__alpha) || defined(__alpha__)) && !defined(__linux__) /* Alpha OSF1 */
|
||||||
# error "not implemented"
|
# error "not implemented"
|
||||||
# elif defined(__sgi) /* Silicon Graphics */
|
# elif defined(__sgi) /* Silicon Graphics */
|
||||||
# define HAVE_DIRENT_H
|
# define HAVE_DIRENT_H
|
||||||
463
common/color.c
Normal file
463
common/color.c
Normal file
@@ -0,0 +1,463 @@
|
|||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
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 */
|
||||||
|
|
||||||
38
common/color.h
Normal file
38
common/color.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OPJ_COLOR_H_
|
||||||
|
#define _OPJ_COLOR_H_
|
||||||
|
|
||||||
|
extern void color_sycc_to_rgb(opj_image_t *img);
|
||||||
|
extern void color_apply_icc_profile(opj_image_t *image);
|
||||||
|
|
||||||
|
#endif /* _OPJ_COLOR_H_ */
|
||||||
48
common/format_defs.h
Normal file
48
common/format_defs.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OPJ_FORMAT_DEFS_H_
|
||||||
|
#define _OPJ_FORMAT_DEFS_H_
|
||||||
|
|
||||||
|
#define J2K_CFMT 0
|
||||||
|
#define JP2_CFMT 1
|
||||||
|
#define JPT_CFMT 2
|
||||||
|
|
||||||
|
#define PXM_DFMT 10
|
||||||
|
#define PGX_DFMT 11
|
||||||
|
#define BMP_DFMT 12
|
||||||
|
#define YUV_DFMT 13
|
||||||
|
#define TIF_DFMT 14
|
||||||
|
#define RAW_DFMT 15
|
||||||
|
#define TGA_DFMT 16
|
||||||
|
#define PNG_DFMT 17
|
||||||
|
|
||||||
|
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
||||||
@@ -49,7 +49,7 @@ const char *optarg; /* argument associated with option */
|
|||||||
|
|
||||||
typedef struct option
|
typedef struct option
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
int has_arg;
|
int has_arg;
|
||||||
int *flag;
|
int *flag;
|
||||||
int val;
|
int val;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user