Compare commits
316 Commits
opj-v1-bra
...
version.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9586bc669c | ||
|
|
78dc93512b | ||
|
|
6778ef6a25 | ||
|
|
20eb15b760 | ||
|
|
8c71728242 | ||
|
|
4140dfdea8 | ||
|
|
259f629a46 | ||
|
|
c302efcf86 | ||
|
|
e0b5b08f9a | ||
|
|
dac95eff3a | ||
|
|
4f4de7070e | ||
|
|
78d1820881 | ||
|
|
de73cfeec1 | ||
|
|
49044ae2a8 | ||
|
|
6e0162a8a6 | ||
|
|
910af7edec | ||
|
|
69cd4f9211 | ||
|
|
6fc2b56847 | ||
|
|
773bd89130 | ||
|
|
5d356d6fcb | ||
|
|
a2f90ab2cb | ||
|
|
a05a9aa4ed | ||
|
|
af2be2d456 | ||
|
|
96dba34ddc | ||
|
|
6aad1208b2 | ||
|
|
d2be8c5d21 | ||
|
|
b42f76cb7f | ||
|
|
07163be7ed | ||
|
|
4e672cc1e9 | ||
|
|
ced9a50367 | ||
|
|
a1683bd7c2 | ||
|
|
f968a70e22 | ||
|
|
2fe6bac6eb | ||
|
|
15243144c4 | ||
|
|
c0c69d1c36 | ||
|
|
d9d62a77ee | ||
|
|
15488c94d2 | ||
|
|
75175b715c | ||
|
|
46831582b2 | ||
|
|
e55d5e29e0 | ||
|
|
c02f145cd1 | ||
|
|
6280b5ad8d | ||
|
|
7720188fa7 | ||
|
|
20f9f96719 | ||
|
|
4776f48477 | ||
|
|
c2f32bb485 | ||
|
|
bba708462d | ||
|
|
4935eaf773 | ||
|
|
bad9a71e77 | ||
|
|
a74a41b932 | ||
|
|
6b5bbc2645 | ||
|
|
8b5f815925 | ||
|
|
abce31e706 | ||
|
|
8062f74deb | ||
|
|
b8fecbbc99 | ||
|
|
cd8896968d | ||
|
|
b94bc0dbe2 | ||
|
|
083d4c2361 | ||
|
|
6c5a066b20 | ||
|
|
835bf5357f | ||
|
|
8a279881d4 | ||
|
|
6da56bb11a | ||
|
|
8cd13f3a55 | ||
|
|
eeca4a220c | ||
|
|
e17dcf58c9 | ||
|
|
39ac7c479f | ||
|
|
401e9cbb5c | ||
|
|
5dbf771bb9 | ||
|
|
ce9d5083ef | ||
|
|
baa7e32f9c | ||
|
|
097496a9f0 | ||
|
|
6b649f3bf6 | ||
|
|
65f8ae765e | ||
|
|
3aba3e203b | ||
|
|
95cf10e979 | ||
|
|
3a643798bd | ||
|
|
875591f664 | ||
|
|
4e8aea6b5a | ||
|
|
5379ec5715 | ||
|
|
b431cb0a41 | ||
|
|
dfbab28b4d | ||
|
|
3819c1b5f4 | ||
|
|
b09cd38b08 | ||
|
|
da453218a4 | ||
|
|
e0795464c1 | ||
|
|
fab8de59d3 | ||
|
|
dcf78f14f6 | ||
|
|
d1a1653f2a | ||
|
|
5a817eba3d | ||
|
|
ce5bbefff0 | ||
|
|
a5d96e54b9 | ||
|
|
2dddf54f8b | ||
|
|
992409c00c | ||
|
|
ee9c46d350 | ||
|
|
87a1081f7c | ||
|
|
83332e13ad | ||
|
|
675f34fabd | ||
|
|
0c7b21c46f | ||
|
|
590ba6d460 | ||
|
|
6f314ae48e | ||
|
|
24ab49a363 | ||
|
|
ecb36f02c8 | ||
|
|
8c9fd1b351 | ||
|
|
dd999a2840 | ||
|
|
b3b2ee0925 | ||
|
|
58cfcaff9f | ||
|
|
c1c2d24b16 | ||
|
|
cefa643823 | ||
|
|
64e37e2a66 | ||
|
|
545680cdb4 | ||
|
|
23cab09e07 | ||
|
|
8336ace29a | ||
|
|
a794ee233d | ||
|
|
a39e4a2a82 | ||
|
|
b267239603 | ||
|
|
54e4e8f809 | ||
|
|
8fc06de0c5 | ||
|
|
9a5ab44e35 | ||
|
|
4d76145884 | ||
|
|
bdf1343f62 | ||
|
|
52f5452d4d | ||
|
|
a9b7c7b0b4 | ||
|
|
07521a5dc2 | ||
|
|
d1bb3ed1f2 | ||
|
|
6c6cd79820 | ||
|
|
7b6ae8810d | ||
|
|
699f172e6c | ||
|
|
5fbf79e730 | ||
|
|
aa28216f9b | ||
|
|
e449cb706f | ||
|
|
a85c5151ce | ||
|
|
ed58a22d2e | ||
|
|
3408787101 | ||
|
|
948dfd50c0 | ||
|
|
46da9f2294 | ||
|
|
995b145f09 | ||
|
|
451a41064e | ||
|
|
c6b02b10fe | ||
|
|
36b66a8796 | ||
|
|
f1e441596e | ||
|
|
d5fa5605c4 | ||
|
|
427b2427d4 | ||
|
|
09522e65af | ||
|
|
19cfaac52e | ||
|
|
21c38214ef | ||
|
|
577fdbc8a5 | ||
|
|
f93aed8031 | ||
|
|
326c58b4e1 | ||
|
|
ec0c69af7a | ||
|
|
21509a3955 | ||
|
|
5b2ca9caf6 | ||
|
|
529006f136 | ||
|
|
7d96e7c1c0 | ||
|
|
e2948acd92 | ||
|
|
6dc8635e28 | ||
|
|
7d0a419c87 | ||
|
|
0ea0e8b915 | ||
|
|
8e53bad7fb | ||
|
|
9c51a37dbf | ||
|
|
aa00142949 | ||
|
|
87b05f2885 | ||
|
|
baf01b98fd | ||
|
|
6dd7da0e05 | ||
|
|
4949b593be | ||
|
|
0ed7aa7c1b | ||
|
|
02b906f6ad | ||
|
|
6a03e3a438 | ||
|
|
ec33653961 | ||
|
|
133426ddfe | ||
|
|
aab317eb8c | ||
|
|
f3f86e1eb7 | ||
|
|
040c9a68b6 | ||
|
|
2b746a71cb | ||
|
|
ba01e855a3 | ||
|
|
d3c1a49246 | ||
|
|
85bbc6def8 | ||
|
|
5bd5d894eb | ||
|
|
452403d393 | ||
|
|
fc268dff90 | ||
|
|
180dd26df1 | ||
|
|
d27bc19d71 | ||
|
|
b7b72bbf97 | ||
|
|
e1340fe087 | ||
|
|
32e80bc4a7 | ||
|
|
8d18c77a7d | ||
|
|
f492f0a3d6 | ||
|
|
6b43ba091e | ||
|
|
5dfadb2eb1 | ||
|
|
30944454de | ||
|
|
0e7529c272 | ||
|
|
c9986d1b78 | ||
|
|
4bc00a40ca | ||
|
|
80f69364b0 | ||
|
|
2e3900780d | ||
|
|
d530d35024 | ||
|
|
e96f7a5f50 | ||
|
|
79ce6ccce5 | ||
|
|
b7e489c901 | ||
|
|
dbd60c1469 | ||
|
|
007409e2af | ||
|
|
b82b6cbd05 | ||
|
|
f26b96dd5c | ||
|
|
7e6c287d78 | ||
|
|
6b1e9d1b4e | ||
|
|
d88dfc3472 | ||
|
|
64f08e216b | ||
|
|
c9ae2a5fbc | ||
|
|
51ae8b7926 | ||
|
|
3280dc344f | ||
|
|
0b7e0166a7 | ||
|
|
5fe8eed4da | ||
|
|
9d4d3b2cd0 | ||
|
|
02d9f43802 | ||
|
|
00b479cb79 | ||
|
|
6219ad32b0 | ||
|
|
a3a161660a | ||
|
|
2643f79069 | ||
|
|
fba8f701c4 | ||
|
|
4bcd3a1e42 | ||
|
|
594148ae83 | ||
|
|
2a2f169b27 | ||
|
|
e576aa9f06 | ||
|
|
c469e1339f | ||
|
|
abf9809c22 | ||
|
|
3ebdd674d8 | ||
|
|
a13abdaf65 | ||
|
|
72867bc692 | ||
|
|
b081ff2813 | ||
|
|
9d1bd03be4 | ||
|
|
82e539d333 | ||
|
|
548a49bb7f | ||
|
|
dc9a8b03aa | ||
|
|
c6e0b71633 | ||
|
|
0c350f4908 | ||
|
|
01749cb8a2 | ||
|
|
49f1a5ff54 | ||
|
|
ff1f022d47 | ||
|
|
3459199eba | ||
|
|
544e8c9de0 | ||
|
|
735b40989d | ||
|
|
09f2926cd5 | ||
|
|
238b767917 | ||
|
|
49a0f0db8f | ||
|
|
6a1530e4b1 | ||
|
|
8d8841c84f | ||
|
|
1dc6eddf1c | ||
|
|
c1510793e3 | ||
|
|
d728868263 | ||
|
|
8a2af121a4 | ||
|
|
9e60c2f8e9 | ||
|
|
d35f647aaa | ||
|
|
adbccc2e56 | ||
|
|
642d09f5cb | ||
|
|
d1cb786dd8 | ||
|
|
182e4b1882 | ||
|
|
73106fe839 | ||
|
|
40b4ecfaec | ||
|
|
fb82b6d7d9 | ||
|
|
5d6ac5ea72 | ||
|
|
3d06f03072 | ||
|
|
5213675ba8 | ||
|
|
9a89e2f162 | ||
|
|
e89eb575ac | ||
|
|
d15f01b6e3 | ||
|
|
9ec5e8cf9a | ||
|
|
4c9acc22b8 | ||
|
|
6adb5f5070 | ||
|
|
d1d662768d | ||
|
|
4091882dfb | ||
|
|
61e0ed6a96 | ||
|
|
9c7899372b | ||
|
|
a098921d34 | ||
|
|
8ed4cb1a1e | ||
|
|
721904bc26 | ||
|
|
2724f85cad | ||
|
|
e3e2dc1f6e | ||
|
|
4f329cbb45 | ||
|
|
0e8995aa7e | ||
|
|
7812030886 | ||
|
|
6fb9794200 | ||
|
|
9e419fdaf7 | ||
|
|
e634cd0d62 | ||
|
|
676f8f189f | ||
|
|
40b989ce00 | ||
|
|
df44837b07 | ||
|
|
16998b4b6d | ||
|
|
f57c4fd0c2 | ||
|
|
5743cca5f8 | ||
|
|
e716a316f6 | ||
|
|
c2b0a8101b | ||
|
|
f88a57e5d7 | ||
|
|
1776120dba | ||
|
|
f4601aff8b | ||
|
|
14799e25c6 | ||
|
|
eea61ee5e4 | ||
|
|
ff6d246efd | ||
|
|
a7f08e9b36 | ||
|
|
3e1d8d6aef | ||
|
|
fda0cada0e | ||
|
|
06363c01e4 | ||
|
|
ec398229b1 | ||
|
|
a19c8a4ea3 | ||
|
|
f8de2fc8eb | ||
|
|
0380840348 | ||
|
|
9cd5752e38 | ||
|
|
65f7f8dc50 | ||
|
|
a58987d082 | ||
|
|
0f101066f2 | ||
|
|
cbe26cbb88 | ||
|
|
36c8d85f43 | ||
|
|
f753a1c36c | ||
|
|
c0ea54e518 | ||
|
|
d2bfeaa5e2 | ||
|
|
025bc9fbe1 | ||
|
|
acccedbbb7 | ||
|
|
6106e48397 |
13
AUTHORS
Normal file
13
AUTHORS
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Authors of OpenJPEG
|
||||||
|
See also the files THANKS and CHANGES
|
||||||
|
|
||||||
|
David Janssens designed and implemented the first version of OpenJPEG.
|
||||||
|
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||||
|
Jerome Fimes implemented the alpha version of OpenJPEG v2.
|
||||||
|
Giuseppe Baruffa added the JPWL functionalities.
|
||||||
|
Yannick Verschueren,
|
||||||
|
Herve Drolon,
|
||||||
|
Francois-Olivier Devaux,
|
||||||
|
Antonin Descampe
|
||||||
|
improved the libraries and utilities.
|
||||||
|
|
||||||
@@ -1,21 +1,34 @@
|
|||||||
|
#----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# For further details regarding this file,
|
# For further details regarding this file,
|
||||||
# see http://www.vtk.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
# see http://www.cmake.org/Wiki/CMake_Testing_With_CTest#Customizing_CTest
|
||||||
#
|
#
|
||||||
|
# and
|
||||||
|
# http://www.kitware.com/blog/home/post/27
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
||||||
SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 50)
|
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||||
|
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||||
|
|
||||||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||||
|
|
||||||
# Exclude files from the Testing directories
|
# Exclude files from the Testing directories
|
||||||
".*/Testing/.*"
|
".*/tests/.*"
|
||||||
)
|
|
||||||
|
# Exclude files from the ThirdParty Utilities directories
|
||||||
|
".*/thirdparty/.*"
|
||||||
|
)
|
||||||
|
|
||||||
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||||
|
|
||||||
# Suppress warning caused by intentional messages about deprecation
|
# Suppress warning caused by intentional messages about deprecation
|
||||||
".*warning,.* is deprecated"
|
".*warning,.* is deprecated"
|
||||||
)
|
# supress warnings caused by 3rd party libs:
|
||||||
|
".*thirdparty.*"
|
||||||
|
"libtiff.*has no symbols"
|
||||||
|
"libpng.*has no symbols"
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
# 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)
|
|
||||||
|
|
||||||
20
CMake/FindFCGI.cmake
Normal file
20
CMake/FindFCGI.cmake
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Look for the header file.
|
||||||
|
FIND_PATH(FCGI_INCLUDE_DIR NAMES fastcgi.h)
|
||||||
|
|
||||||
|
# Look for the library.
|
||||||
|
FIND_LIBRARY(FCGI_LIBRARY NAMES fcgi)
|
||||||
|
|
||||||
|
# Handle the QUIETLY and REQUIRED arguments and set FCGI_FOUND to TRUE if all listed variables are TRUE.
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FCGI DEFAULT_MSG FCGI_LIBRARY FCGI_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# Copy the results to the output variables.
|
||||||
|
IF(FCGI_FOUND)
|
||||||
|
SET(FCGI_LIBRARIES ${FCGI_LIBRARY})
|
||||||
|
SET(FCGI_INCLUDE_DIRS ${FCGI_INCLUDE_DIR})
|
||||||
|
ELSE(FCGI_FOUND)
|
||||||
|
SET(FCGI_LIBRARIES)
|
||||||
|
SET(FCGI_INCLUDE_DIRS)
|
||||||
|
ENDIF(FCGI_FOUND)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(FCGI_INCLUDE_DIR FCGI_LIBRARY)
|
||||||
19
CMake/FindKAKADU.cmake
Normal file
19
CMake/FindKAKADU.cmake
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# this module looks for KAKADu
|
||||||
|
# http://www.kakadusoftware.com/
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
FIND_PROGRAM(KDU_EXPAND_EXECUTABLE
|
||||||
|
kdu_expand
|
||||||
|
)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
KDU_EXPAND_EXECUTABLE
|
||||||
|
)
|
||||||
@@ -1,24 +1,31 @@
|
|||||||
# - Find LCMS library
|
# - Find LCMS library
|
||||||
# Find the native LCMS includes and library
|
# Find the native LCMS includes and library
|
||||||
# This module defines
|
# Once done this will define
|
||||||
# LCMS_INCLUDE_DIR, where to find tiff.h, etc.
|
#
|
||||||
# LCMS_LIBRARIES, libraries to link against to use LCMS.
|
# LCMS_INCLUDE_DIR - Where to find lcms.h, etc.
|
||||||
# LCMS_FOUND, If false, do not try to use LCMS.
|
# LCMS_LIBRARIES - Libraries to link against to use LCMS.
|
||||||
|
# LCMS_FOUND - If false, do not try to use LCMS.
|
||||||
|
#
|
||||||
# also defined, but not for general use are
|
# also defined, but not for general use are
|
||||||
# LCMS_LIBRARY, where to find the LCMS library.
|
# LCMS_LIBRARY, where to find the LCMS library.
|
||||||
#
|
|
||||||
|
#=============================================================================
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
FIND_PATH(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
FIND_PATH(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||||
#
|
|
||||||
SET(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
|
SET(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
|
||||||
|
|
||||||
FIND_LIBRARY(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
FIND_LIBRARY(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
||||||
#
|
|
||||||
|
MARK_AS_ADVANCED(LCMS_INCLUDE_DIR LCMS_LIBRARY)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
|
||||||
#
|
|
||||||
IF(LCMS_FOUND)
|
IF(LCMS_FOUND)
|
||||||
|
SET( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
||||||
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
||||||
ENDIF(LCMS_FOUND)
|
ENDIF(LCMS_FOUND)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(LCMS_INCLUDE_DIR LCMS_LIBRARY)
|
|
||||||
@@ -1,23 +1,31 @@
|
|||||||
# - Find LCMS2 library
|
# - Find LCMS2 library
|
||||||
# Find the native LCMS2 includes and library
|
# Find the native LCMS2 includes and library
|
||||||
# This module defines
|
# Once done this will define
|
||||||
# LCMS2_INCLUDE_DIR, where to find tiff.h, etc.
|
|
||||||
# LCMS2_LIBRARIES, libraries to link against to use LCMS2.
|
|
||||||
# LCMS2_FOUND, If false, do not try to use LCMS2.
|
|
||||||
# also defined, but not for general use are
|
|
||||||
# LCMS2_LIBRARY, where to find the LCMS2 library.
|
|
||||||
#
|
#
|
||||||
|
# LCMS2_INCLUDE_DIR - Where to find lcms2.h, etc.
|
||||||
|
# LCMS2_LIBRARIES - Libraries to link against to use LCMS2.
|
||||||
|
# LCMS2_FOUND - If false, do not try to use LCMS2.
|
||||||
|
#
|
||||||
|
# also defined, but not for general use are
|
||||||
|
# LCMS2_LIBRARY - Where to find the LCMS2 library.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
FIND_PATH(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
FIND_PATH(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||||
|
|
||||||
SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
|
SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
|
||||||
|
|
||||||
FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
|
||||||
#
|
|
||||||
IF(LCMS2_FOUND)
|
IF(LCMS2_FOUND)
|
||||||
|
SET( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
||||||
SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
||||||
ENDIF(LCMS2_FOUND)
|
ENDIF(LCMS2_FOUND)
|
||||||
#
|
|
||||||
MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
|
||||||
9
CMake/JPIPTestDriver.cmake
Normal file
9
CMake/JPIPTestDriver.cmake
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# JPIP test driver
|
||||||
|
#message(STATUS "${D_URL}")
|
||||||
|
file(DOWNLOAD
|
||||||
|
"${D_URL}"
|
||||||
|
"${D_FILE}"
|
||||||
|
LOG log
|
||||||
|
EXPECTED_MD5 "${EXPECTED_MD5}"
|
||||||
|
)
|
||||||
|
message(STATUS "LOG: ${log}")
|
||||||
70
CMake/OpenJPEGCPack.cmake
Normal file
70
CMake/OpenJPEGCPack.cmake
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
# package bundler
|
||||||
|
if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||||
|
if(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||||
|
set(CMAKE_INSTALL_MFC_LIBRARIES 0)
|
||||||
|
set(CMAKE_INSTALL_DEBUG_LIBRARIES 0)
|
||||||
|
if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
|
||||||
|
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||||
|
endif()
|
||||||
|
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
|
||||||
|
endif(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||||
|
|
||||||
|
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
|
||||||
|
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${OPJ_PACKAGE_DESCRIPTION_SUMMARY})
|
||||||
|
set(CPACK_PACKAGE_VENDOR "OpenJPEG Team")
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" COPYONLY
|
||||||
|
)
|
||||||
|
# For PackageMaker on MacOSX it is important to have a file extension:
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR "${OPENJPEG_VERSION_MAJOR}")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR "${OPENJPEG_VERSION_MINOR}")
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH "${OPENJPEG_VERSION_BUILD}")
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||||
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "openjpeg-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||||
|
|
||||||
|
# Make this explicit here, rather than accepting the CPack default value,
|
||||||
|
# so we can refer to it:
|
||||||
|
SET(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
|
||||||
|
|
||||||
|
IF(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||||
|
# make sure package is not Cygwin-unknown, for Cygwin just
|
||||||
|
# cygwin is good for the system name
|
||||||
|
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||||
|
SET(CPACK_SYSTEM_NAME Cygwin)
|
||||||
|
ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||||
|
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||||
|
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||||
|
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||||
|
IF(CMAKE_CL_64)
|
||||||
|
SET(CPACK_SYSTEM_NAME win64-x64)
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
|
SET(CPACK_SYSTEM_NAME win32-x86)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
|
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||||
|
|
||||||
|
IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||||
|
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
|
||||||
|
# default to source package - system, on cygwin system is not
|
||||||
|
# needed
|
||||||
|
IF(CYGWIN)
|
||||||
|
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||||
|
ELSE(CYGWIN)
|
||||||
|
SET(CPACK_PACKAGE_FILE_NAME
|
||||||
|
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
|
||||||
|
ENDIF(CYGWIN)
|
||||||
|
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||||
|
|
||||||
|
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||||
|
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||||
|
SET(CPACK_BUNDLE_PLIST
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||||
|
#include(BundleUtilities)
|
||||||
|
|
||||||
|
include(CPack)
|
||||||
|
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||||
@@ -11,22 +11,28 @@ SET(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
|
|||||||
SET(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
SET(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
||||||
|
|
||||||
# The libraries.
|
# The libraries.
|
||||||
SET(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARIES@")
|
SET(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
|
||||||
|
|
||||||
# The CMake macros dir.
|
# The CMake macros dir.
|
||||||
SET(OPENJPEG_CMAKE_DIR "@OPENJPEG_CMAKE_DIR_CONFIG@")
|
SET(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
|
||||||
|
|
||||||
# The configuration options.
|
# The configuration options.
|
||||||
SET(OPENJPEG_BUILD_SHARED_LIBS "@OPENJPEG_BUILD_SHARED_LIBS@")
|
SET(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
|
||||||
|
|
||||||
# The "use" file.
|
# The "use" file.
|
||||||
SET(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
|
SET(OPENJPEG_USE_FILE "@OPENJPEG_USE_FILE_CONFIG@")
|
||||||
|
|
||||||
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
# The following is inspired from:
|
||||||
|
# http://www.cmake.org/Wiki/CMake/Tutorials/Packaging#Packaging_and_Exporting
|
||||||
|
# However the following is difficult to handle:
|
||||||
|
# get_filename_component(myproj_INCLUDE_DIRS "${SELF_DIR}/../../include/myproj" ABSOLUTE)
|
||||||
|
# it asssumes a non multi-arch system, where 'include' is located '../include' from lib
|
||||||
|
# therefore we need to take into account the number of subdirs in OPENJPEG_INSTALL_LIB_DIR
|
||||||
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||||
# This is an install tree
|
# This is an install tree
|
||||||
include(${SELF_DIR}/OpenJPEGTargets.cmake)
|
include(${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||||
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/@relative_parent@/@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
||||||
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
||||||
|
|
||||||
else(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
else(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||||
|
|||||||
231
CMakeLists.txt
231
CMakeLists.txt
@@ -28,17 +28,42 @@ 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 4)
|
SET(OPENJPEG_VERSION_MINOR 5)
|
||||||
SET(OPENJPEG_VERSION_BUILD 0)
|
SET(OPENJPEG_VERSION_BUILD 2)
|
||||||
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
|
SET(PACKAGE_VERSION
|
||||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||||
|
|
||||||
|
# Because autotools does not support X.Y notation for SOVERSION, we have to use
|
||||||
|
# two numerorations, one for the openjpeg version and one for openjpeg soversion
|
||||||
|
# version | soversion
|
||||||
|
# 1.0 | 0
|
||||||
|
# 1.1 | 1
|
||||||
|
# 1.2 | 2
|
||||||
|
# 1.3 | 3
|
||||||
|
# 1.4 | 4
|
||||||
|
# 1.5 | 5
|
||||||
|
# 1.5.1 | 5
|
||||||
|
# 2.0 | 6
|
||||||
|
# above is the recommendation by the OPJ team. If you really need to override this default,
|
||||||
|
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
|
||||||
|
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
|
||||||
|
if(NOT OPENJPEG_SOVERSION)
|
||||||
|
SET(OPENJPEG_SOVERSION 5)
|
||||||
|
endif(NOT OPENJPEG_SOVERSION)
|
||||||
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}"
|
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# Path to additional CMake modules
|
||||||
|
SET(CMAKE_MODULE_PATH
|
||||||
|
${CMAKE_SOURCE_DIR}/CMake
|
||||||
|
${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||||
# warnings
|
# warnings
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
@@ -79,12 +104,28 @@ IF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
|||||||
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
|
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||||
|
|
||||||
|
# The following will compute the amount of parent dir to go
|
||||||
|
# from include to lib. it works nicely with
|
||||||
|
# OPENJPEG_INSTALL_LIB_DIR=lib
|
||||||
|
# OPENJPEG_INSTALL_LIB_DIR=lib/
|
||||||
|
# OPENJPEG_INSTALL_LIB_DIR=/lib
|
||||||
|
# OPENJPEG_INSTALL_LIB_DIR=lib/gnu-linux-x64
|
||||||
|
STRING(REPLACE "/" ";" relative_to_lib ${OPENJPEG_INSTALL_LIB_DIR})
|
||||||
|
set(relative_parent "..")
|
||||||
|
foreach( elem ${relative_to_lib})
|
||||||
|
set( relative_parent "${relative_parent}/.." )
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||||
|
SET(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||||
|
ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||||
SET(OPENJPEG_INSTALL_DATA_DIR "share/${OPENJPEG_INSTALL_SUBDIR}")
|
SET(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||||
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/")
|
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||||
@@ -95,18 +136,25 @@ IF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
|||||||
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||||
|
|
||||||
|
if(NOT OPENJPEG_INSTALL_JNI_DIR)
|
||||||
|
if(WIN32)
|
||||||
|
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
|
||||||
|
else()
|
||||||
|
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||||
SET(OPENJPEG_INSTALL_PACKAGE_DIR ${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}
|
# We could install *.cmake files in share/ however those files contains
|
||||||
CACHE INTERNAL "")
|
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
|
||||||
|
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
|
||||||
|
SET(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||||
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Test for some required system information.
|
# Big endian test:
|
||||||
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake)
|
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||||
|
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# Test for getopt being available in this system
|
|
||||||
INCLUDE (${OPENJPEG_SOURCE_DIR}/CMake/CheckHaveGetopt.cmake )
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Setup file for setting custom ctest vars
|
# Setup file for setting custom ctest vars
|
||||||
@@ -130,15 +178,21 @@ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
|||||||
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||||
@ONLY IMMEDIATE)
|
@ONLY)
|
||||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# pkgconfig support
|
# pkgconfig support
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
|
IF(UNIX)
|
||||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION ${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
# install in lib and not share (see multi-arch note above)
|
||||||
INSTALL( CODE
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake
|
||||||
"EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink \"libopenjpeg1.pc\" \"\$ENV{DESTDIR}${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg.pc\")")
|
${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
|
||||||
|
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION
|
||||||
|
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||||
|
INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||||
|
\"libopenjpeg1.pc\"
|
||||||
|
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_SHARE_DIR}/pkgconfig/libopenjpeg.pc\")")
|
||||||
|
ENDIF(UNIX)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Compiler specific flags:
|
# Compiler specific flags:
|
||||||
@@ -150,64 +204,18 @@ IF(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# opj_config.h generation
|
# opj_config.h generation (1/2)
|
||||||
FIND_FILE(HAVE_STRINGS_H_FOUND strings.h)
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||||
IF(NOT HAVE_STRINGS_H_FOUND STREQUAL "HAVE_STRINGS_H_FOUND-NOTFOUND")
|
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||||
FIND_FILE(HAVE_STRINGS_H strings.h)
|
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||||
SET(HAS_STRINGS_H 1)
|
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||||
ENDIF()
|
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||||
FIND_FILE(HAVE_INTTYPES_H_FOUND inttypes.h)
|
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
||||||
IF(NOT HAVE_INTTYPES_H_FOUND STREQUAL "HAVE_INTTYPES_H_FOUND-NOTFOUND")
|
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
|
||||||
FIND_FILE(HAVE_INTTYPES_H inttypes.h)
|
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||||
SET(HAS_INTTYPES_H 1)
|
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||||
ENDIF()
|
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||||
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()
|
|
||||||
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_configh.cmake.in"
|
|
||||||
"${OPENJPEG_BINARY_DIR}/opj_config.h"
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
|
||||||
# CDash+CMake : to be updated
|
|
||||||
OPTION(BUILD_TESTING "Build the tests." OFF)
|
|
||||||
IF(BUILD_TESTING)
|
|
||||||
ENABLE_TESTING()
|
|
||||||
INCLUDE(CTest)
|
|
||||||
ENDIF(BUILD_TESTING)
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build Library
|
# Build Library
|
||||||
@@ -218,28 +226,63 @@ ADD_SUBDIRECTORY(libopenjpeg)
|
|||||||
# Build Applications
|
# Build Applications
|
||||||
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
|
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
|
||||||
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||||
ADD_SUBDIRECTORY(applications)
|
OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||||
|
OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
||||||
|
IF(BUILD_JPIP)
|
||||||
|
OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
||||||
|
ENDIF(BUILD_JPIP)
|
||||||
|
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||||
|
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||||
|
OPTION(USE_SYSTEM_GETOPT "Prefer system installed getopt()" OFF)
|
||||||
|
MARK_AS_ADVANCED(USE_SYSTEM_GETOPT)
|
||||||
|
MARK_AS_ADVANCED(BUILD_VIEWER)
|
||||||
|
MARK_AS_ADVANCED(BUILD_JAVA)
|
||||||
|
|
||||||
|
IF(BUILD_CODEC OR BUILD_MJ2)
|
||||||
|
# OFF: It will only build 3rd party libs if they are not found on the system
|
||||||
|
# ON: 3rd party libs will ALWAYS be build, and used
|
||||||
|
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||||
|
ADD_SUBDIRECTORY(thirdparty)
|
||||||
|
ADD_SUBDIRECTORY(applications)
|
||||||
|
ENDIF (BUILD_CODEC OR BUILD_MJ2)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build JPWL-flavoured library and executables
|
# opj_config.h generation (2/2)
|
||||||
OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
CONFIGURE_FILE("${OPENJPEG_SOURCE_DIR}/opj_config.h.cmake.in"
|
||||||
|
"${OPENJPEG_BINARY_DIR}/opj_config.h"
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
||||||
ADD_SUBDIRECTORY(doc)
|
OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||||
|
IF(BUILD_DOC)
|
||||||
|
ADD_SUBDIRECTORY(doc)
|
||||||
|
ENDIF(BUILD_DOC)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Tests data
|
# Buld Testing
|
||||||
|
OPTION(BUILD_TESTING "Build the tests." OFF)
|
||||||
IF(BUILD_TESTING)
|
IF(BUILD_TESTING)
|
||||||
# Adding test with dataset from:
|
IF(BUILD_CODEC)
|
||||||
# http://www.openjpeg.org/conformance/j2kp4files_v1_5.zip
|
ENABLE_TESTING()
|
||||||
# -> wget http://www.openjpeg.org/conformance/j2kp4files_v1_5.zip
|
INCLUDE(CTest)
|
||||||
# http://www.jpeg.org/jpeg2000guide/testimages/testimages.html
|
|
||||||
# Adding JPEG2000_CONFORMANCE_DATA_ROOT
|
# Search openjpeg data needed for the tests
|
||||||
FIND_PATH(JPEG2000_CONFORMANCE_DATA_ROOT testimages.html
|
# They could be found via svn on the OpenJPEG google code project
|
||||||
${OPENJPEG_SOURCE_DIR}/../jpeg2000testimages
|
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||||
$ENV{JPEG2000_CONFORMANCE_DATA_ROOT}
|
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
||||||
)
|
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
|
||||||
|
${CMAKE_SOURCE_DIR}/../../data
|
||||||
|
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add repository where to find tests
|
||||||
|
ADD_SUBDIRECTORY(tests)
|
||||||
|
|
||||||
|
ELSE(BUILD_CODEC)
|
||||||
|
message(FATAL_ERROR "You need build codec to run the tests")
|
||||||
|
ENDIF(BUILD_CODEC)
|
||||||
ENDIF(BUILD_TESTING)
|
ENDIF(BUILD_TESTING)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@@ -255,7 +298,9 @@ INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# install CHANGES and LICENSE
|
# install CHANGES and LICENSE
|
||||||
INSTALL(
|
IF(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||||
FILES CHANGES
|
INSTALL(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||||
LICENSE
|
ENDIF(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||||
DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
INSTALL(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||||
|
|
||||||
|
INCLUDE (CMake/OpenJPEGCPack.cmake)
|
||||||
|
|||||||
54
INSTALL
54
INSTALL
@@ -5,7 +5,11 @@ How to build and install openjpeg binaries
|
|||||||
UNIX/LINUX similar systems
|
UNIX/LINUX similar systems
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
1) Using configure tools
|
1) Using autotools
|
||||||
|
|
||||||
|
It is highly recommended that pkg-config is installed. If needed, you have to
|
||||||
|
properly set the environment variable PKG_CONFIG_PATH so that the .pc files
|
||||||
|
are found.
|
||||||
|
|
||||||
To build from top-level directory, you can simply type:
|
To build from top-level directory, you can simply type:
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
@@ -33,12 +37,26 @@ To build doc (requires 'doxygen' to be found on your system):
|
|||||||
Main './configure' options (type './configure --help' for more details)
|
Main './configure' options (type './configure --help' for more details)
|
||||||
'--enable-mj2'
|
'--enable-mj2'
|
||||||
'--enable-jpwl'
|
'--enable-jpwl'
|
||||||
|
'--enable-jpip'
|
||||||
'--prefix=/path/to/install/directory' (example : '--prefix=$PWD/installed')
|
'--prefix=/path/to/install/directory' (example : '--prefix=$PWD/installed')
|
||||||
'--enable-debug' (default : disabled)
|
'--enable-debug' (default : disabled)
|
||||||
|
|
||||||
You can also specify your own CFLAGS and LDFLAGS with (for example):
|
You can also specify your own CFLAGS and LDFLAGS with (for example):
|
||||||
CFLAGS="-O3 -pipe" LDFLAGS="-Wl,-s" ./configure
|
CFLAGS="-O3 -pipe" LDFLAGS="-Wl,-s" ./configure
|
||||||
|
|
||||||
|
The (optional) dependencies of some binaries are libpng, libtiff, libcms 1 or 2
|
||||||
|
and FastCGI. Only libtiff and FastCGI have no .pc file. There should be some
|
||||||
|
automatic detection if they are installed in /usr, /usr/local or /opt/local.
|
||||||
|
Otherwise, you can tune their detection (as well as for libpng and libcms1 or 2
|
||||||
|
too) with the environment variables:
|
||||||
|
|
||||||
|
TIFF_CFLAGS
|
||||||
|
TIFF_LIBS
|
||||||
|
FCGI_CFLAGS
|
||||||
|
FCGI_LIBS
|
||||||
|
|
||||||
|
See './configure --help' output for more details.
|
||||||
|
|
||||||
|
|
||||||
2) Using cmake (see www.cmake.org)
|
2) Using cmake (see www.cmake.org)
|
||||||
|
|
||||||
@@ -48,12 +66,13 @@ Type:
|
|||||||
|
|
||||||
If you are root:
|
If you are root:
|
||||||
make install
|
make install
|
||||||
make clean
|
|
||||||
|
|
||||||
else:
|
else if you have sudo power:
|
||||||
sudo make install
|
sudo make install
|
||||||
make clean
|
|
||||||
|
else
|
||||||
|
DESTDIR=$HOME/local make install
|
||||||
|
|
||||||
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||||
(A 'html' directory is generated in the 'doc' directory)
|
(A 'html' directory is generated in the 'doc' directory)
|
||||||
make doc
|
make doc
|
||||||
@@ -61,30 +80,21 @@ To build the Doxygen documentation (Doxygen needs to be found on the system):
|
|||||||
Binaries are located in the 'bin' directory.
|
Binaries are located in the 'bin' directory.
|
||||||
|
|
||||||
Main available cmake flags:
|
Main available cmake flags:
|
||||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path'
|
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path', or use DESTDIR env variable (see above)
|
||||||
* To build the shared libraries and links the executables against it: '-DBUILD_SHARED_LIBS:bool=on' (default: 'ON')
|
* 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.
|
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 CODEC executables: '-DBUILD_CODEC:bool=on' (default: 'ON')
|
||||||
* To build the MJ2 executables: '-DBUILD_MJ2:bool=on' (default: 'OFF')
|
* 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 JPWL executables and JPWL library: '-DBUILD_JPWL:bool=on' (default: 'OFF')
|
||||||
|
* To build the JPIP library and utilities: '-DBUILD_JPIP:bool=on' (default: 'OFF')
|
||||||
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
|
* 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
|
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory'
|
||||||
make
|
make
|
||||||
make Experimental
|
make Experimental
|
||||||
Note : JPEG2000 test files are available here : http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
Note : JPEG2000 test files are available with 'svn checkout http://openjpeg.googlecode.com/svn/data' (about 70 Mo).
|
||||||
|
If '-DOPJ_DATA_ROOT:PATH' option is omitted, test files will be automatically searched in '${CMAKE_SOURCE_DIR}/../data',
|
||||||
3) Manually using Makefile.nix:
|
corresponding to the location of the data directory when compiling from the trunk (and assuming the data directory has
|
||||||
- Manually edit the config.nix file
|
been checked out of course).
|
||||||
- Manually create an opj_config.h file from opj_config.h.in.user
|
|
||||||
and edit this opj_config.h
|
|
||||||
- Then : (if 'WITH_JPWL' is 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 'WITH_JPWL' is not defined in config.nix
|
|
||||||
and you want to clean/compile/install/uninstall JPWL:
|
|
||||||
call the respective target in the respective directory.
|
|
||||||
|
|
||||||
MACOSX
|
MACOSX
|
||||||
------
|
------
|
||||||
@@ -98,7 +108,7 @@ If it does not work, try adding the following flag to the cmake command :
|
|||||||
WINDOWS
|
WINDOWS
|
||||||
-------
|
-------
|
||||||
|
|
||||||
If you're using cygwin or MinGW, the same procedures as for Unix can be used.
|
If you're using cygwin or MinGW+MSYS, the same procedures as for Unix can be used.
|
||||||
|
|
||||||
Otherwise you can use cmake to generate project files for the IDE you are using (VC2010, etc).
|
Otherwise you can use cmake to generate project files for the IDE you are using (VC2010, etc).
|
||||||
Type 'cmake --help' for available generators on your platform.
|
Type 'cmake --help' for available generators on your platform.
|
||||||
|
|||||||
13
LICENSE
13
LICENSE
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
* Copyright (c) 2002-2012, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
* Copyright (c) 2002-2012, Professor Benoit Macq
|
||||||
* Copyright (c) 2001-2003, David Janssens
|
* Copyright (c) 2003-2012, Antonin Descampe
|
||||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
* Copyright (c) 2003-2009, Francois-Olivier Devaux
|
||||||
* 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) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -27,4 +28,4 @@
|
|||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|||||||
32
Makefile.am
32
Makefile.am
@@ -1,4 +1,4 @@
|
|||||||
DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpwl=yes --enable-mj2=yes
|
DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpip-server=yes --enable-jpwl=yes --enable-mj2=yes
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
@@ -7,6 +7,10 @@ SUBDIRS = libopenjpeg applications doc
|
|||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libopenjpeg1.pc
|
pkgconfig_DATA = libopenjpeg1.pc
|
||||||
|
|
||||||
|
if WANT_JPWL
|
||||||
|
pkgconfig_DATA += libopenjpeg-jpwl.pc
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = \
|
MAINTAINERCLEANFILES = \
|
||||||
Makefile.in \
|
Makefile.in \
|
||||||
@@ -22,20 +26,25 @@ ltmain.sh \
|
|||||||
missing
|
missing
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
CMake/CheckHaveGetopt.cmake \
|
CMake/CTestCustom.cmake.in \
|
||||||
|
CMake/FindFCGI.cmake \
|
||||||
|
CMake/FindLCMS2.cmake \
|
||||||
|
CMake/FindLCMS.cmake \
|
||||||
CMake/OpenJPEGConfig.cmake.in \
|
CMake/OpenJPEGConfig.cmake.in \
|
||||||
testing/CTestCustom.cmake.in \
|
|
||||||
testing/CTestConfig.cmake \
|
|
||||||
CMakeLists.txt \
|
CMakeLists.txt \
|
||||||
LICENSE \
|
CTestConfig.cmake \
|
||||||
|
AUTHORS \
|
||||||
CHANGES \
|
CHANGES \
|
||||||
README \
|
|
||||||
INSTALL \
|
INSTALL \
|
||||||
|
LICENSE \
|
||||||
|
NEWS \
|
||||||
|
README \
|
||||||
|
THANKS \
|
||||||
bootstrap.sh \
|
bootstrap.sh \
|
||||||
libopenjpeg1.pc.cmake \
|
libopenjpeg1.pc.cmake \
|
||||||
libopenjpeg1.pc.in \
|
libopenjpeg1.pc.in \
|
||||||
opj_configh.cmake.in \
|
libopenjpeg-jpwl.pc.in \
|
||||||
opj_config.h.in.user \
|
opj_config.h.cmake.in \
|
||||||
m4/opj_check_lib.m4 \
|
m4/opj_check_lib.m4 \
|
||||||
m4/opj_doxygen.m4 \
|
m4/opj_doxygen.m4 \
|
||||||
m4/pkg.m4
|
m4/pkg.m4
|
||||||
@@ -49,9 +58,16 @@ doc:
|
|||||||
@cd doc && make doc
|
@cd doc && make doc
|
||||||
|
|
||||||
install-data-hook:
|
install-data-hook:
|
||||||
|
if HAVE_WIN32
|
||||||
|
$(LN_S) -f libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||||
|
else
|
||||||
$(LN_S) -nf libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
$(LN_S) -nf libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||||
|
endif
|
||||||
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt
|
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt
|
||||||
@echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt
|
@echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt
|
||||||
|
if WANT_JPWL
|
||||||
|
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg-jpwl.pc" >> $(top_builddir)/report.txt
|
||||||
|
endif
|
||||||
@cat $(top_builddir)/report.txt
|
@cat $(top_builddir)/report.txt
|
||||||
@rm $(top_builddir)/report.txt
|
@rm $(top_builddir)/report.txt
|
||||||
|
|
||||||
|
|||||||
183
Makefile.nix
183
Makefile.nix
@@ -1,183 +0,0 @@
|
|||||||
#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
|
|
||||||
25
NEWS
Normal file
25
NEWS
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
OpenJPEG NEWS - user visible changes
|
||||||
|
====================================
|
||||||
|
|
||||||
|
Changes from OpenJPEG 1.5.2 to OpenJPEG 1.5.1
|
||||||
|
----------------------------------------------
|
||||||
|
|
||||||
|
Security:
|
||||||
|
|
||||||
|
* Fixes: CVE-2013-4289 CVE-2013-4290
|
||||||
|
* Fixes: CVE-2013-1447 CVE-2013-6045 CVE-2013-6052 CVE-2013-6054 CVE-2013-6053 CVE-2013-6887
|
||||||
|
|
||||||
|
New Features:
|
||||||
|
|
||||||
|
* Compile Java with source/target specific java version
|
||||||
|
* Do not set SONAME for Java module, fix linking (missing math lib)
|
||||||
|
* Support some BMP/RGB8 files
|
||||||
|
* Fix compilation on ARM
|
||||||
|
|
||||||
|
Misc:
|
||||||
|
|
||||||
|
* Remove BSD-4 license from getopt copy, since upstream switched to BSD-3
|
||||||
|
* Support compilation against system installed getopt
|
||||||
|
* Fix Big Endian checking (autotools)
|
||||||
|
* Huge amount of bug fixes. See CHANGES for details.
|
||||||
10
README
10
README
@@ -13,11 +13,13 @@ Details on folders hierarchy:
|
|||||||
* JavaOpenJPEG: java jni to use openjpeg in a java program
|
* JavaOpenJPEG: java jni to use openjpeg in a java program
|
||||||
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
|
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
|
||||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be build only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||||
* doc: doxygen documentation setup file and man pages
|
* doc: doxygen documentation setup file and man pages
|
||||||
* testing: all files required to test the library and executables (obsolete)
|
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in 'http://openjpeg.googlecode.com/svn/data' folder.
|
||||||
* CMake: cmake related files
|
* CMake: cmake related files
|
||||||
* m4: autotools related files
|
* m4: autotools related files
|
||||||
|
|
||||||
see LICENSE for license and copyright information
|
see LICENSE for license and copyright information.
|
||||||
see INSTALL for installation procedures.
|
see INSTALL for installation procedures.
|
||||||
|
see NEWS for user visible changes in successive releases.
|
||||||
|
see CHANGES for per-revision changes.
|
||||||
|
|||||||
33
THANKS
Normal file
33
THANKS
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
OpenJPEG THANKS file
|
||||||
|
|
||||||
|
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
|
||||||
|
or submitting actual code. Here is a list of these people. Help me keep
|
||||||
|
it complete and exempt of errors.
|
||||||
|
|
||||||
|
Mathieu Malaterre
|
||||||
|
Winfried Szukalski
|
||||||
|
Vincent Torri
|
||||||
|
Bob Friesenhahn
|
||||||
|
Callum Lerwick
|
||||||
|
Dzonatas Sol
|
||||||
|
Mickaël Savinaud
|
||||||
|
Julien Malik
|
||||||
|
Jerôme Fimes
|
||||||
|
Herve Drolon
|
||||||
|
Yannick Verschueren
|
||||||
|
Sebastien Lugan
|
||||||
|
Kaori Hagihara
|
||||||
|
Peter Wimmer
|
||||||
|
Francois-Olivier Devaux
|
||||||
|
Antonin Descampe
|
||||||
|
David Janssens
|
||||||
|
Pr. Benoit Macq
|
||||||
|
Luis Ibanez
|
||||||
|
Ben Boeckel
|
||||||
|
Vincent Nicolas
|
||||||
|
Glenn Pearson
|
||||||
|
Giuseppe Baruffa
|
||||||
|
Arnaud Maye
|
||||||
|
Rex Dieter
|
||||||
|
David Burken
|
||||||
|
Parvatha Elangovan
|
||||||
@@ -1,130 +1,22 @@
|
|||||||
IF(BUILD_CODEC OR BUILD_MJ2)
|
# Build the each application if it needed
|
||||||
#
|
|
||||||
#
|
|
||||||
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)
|
|
||||||
SET(CMAKE_LIBRARY_PATH /usr/lib /usr/local/lib /opt/lib /opt/local/lib)
|
|
||||||
ENDIF()
|
|
||||||
#
|
|
||||||
FIND_PACKAGE(ZLIB)
|
|
||||||
#
|
|
||||||
IF(ZLIB_LIBRARY STREQUAL "ZLIB_LIBRARY-NOTFOUND")
|
|
||||||
SET(ZLIB_FOUND 0)
|
|
||||||
ENDIF(ZLIB_LIBRARY STREQUAL "ZLIB_LIBRARY-NOTFOUND")
|
|
||||||
#
|
|
||||||
IF(ZLIB_FOUND)
|
|
||||||
SET(HAVE_ZLIB_H 1)
|
|
||||||
SET(HABE_LIBZ 1)
|
|
||||||
SET(Z_LIBNAME ${ZLIB_LIBRARIES})
|
|
||||||
SET(Z_INCLUDE_DIRNAME ${ZLIB_INCLUDE_DIR})
|
|
||||||
ENDIF(ZLIB_FOUND)
|
|
||||||
#
|
|
||||||
FIND_PACKAGE(PNG)
|
|
||||||
#
|
|
||||||
IF(PNG_LIBRARY STREQUAL "PNG_LIBRARY-NOTFOUND")
|
|
||||||
SET(PNG_FOUND 0)
|
|
||||||
ENDIF(PNG_LIBRARY STREQUAL "PNG_LIBRARY-NOTFOUND")
|
|
||||||
#
|
|
||||||
IF(PNG_FOUND)
|
|
||||||
SET(HAVE_PNG_H 1)
|
|
||||||
SET(HAVE_LIBPNG 1)
|
|
||||||
SET(PNG_LIBNAME ${PNG_LIBRARIES})
|
|
||||||
SET(PNG_INCLUDE_DIRNAME ${PNG_INCLUDE_DIR})
|
|
||||||
ENDIF(PNG_FOUND)
|
|
||||||
#
|
|
||||||
FIND_PACKAGE(TIFF)
|
|
||||||
#
|
|
||||||
IF(TIFF_LIBRARY STREQUAL "TIFF_LIBRARY-NOTFOUND")
|
|
||||||
SET(TIFF_FOUND 0)
|
|
||||||
ENDIF(TIFF_LIBRARY STREQUAL "TIFF_LIBRARY-NOTFOUND")
|
|
||||||
#
|
|
||||||
IF(TIFF_FOUND)
|
|
||||||
SET(HAVE_TIFF_H 1)
|
|
||||||
SET(HAVE_LIBTIFF 1)
|
|
||||||
SET(TIFF_LIBNAME ${TIFF_LIBRARIES})
|
|
||||||
SET(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR})
|
|
||||||
ENDIF(TIFF_FOUND)
|
|
||||||
#
|
|
||||||
SET(LCMS12_MISSING 1)
|
|
||||||
INCLUDE(${OPENJPEG_SOURCE_DIR}/thirdparty/FindLCMS2.cmake OPTIONAL)
|
|
||||||
#
|
|
||||||
IF(LCMS2_FOUND)
|
|
||||||
SET(LCMS12_MISSING 0)
|
|
||||||
SET(HAVE_LCMS2_H 1)
|
|
||||||
SET(HAVE_LIBLCMS2 1)
|
|
||||||
SET(LCMS_LIBNAME ${LCMS2_LIBRARY})
|
|
||||||
SET(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIR})
|
|
||||||
ENDIF(LCMS2_FOUND)
|
|
||||||
#
|
|
||||||
IF(NOT LCMS2_FOUND)
|
|
||||||
INCLUDE(${OPENJPEG_SOURCE_DIR}/thirdparty/FindLCMS.cmake OPTIONAL)
|
|
||||||
#
|
|
||||||
IF(LCMS_FOUND)
|
|
||||||
SET(LCMS12_MISSING 0)
|
|
||||||
SET(HAVE_LCMS1_H 1)
|
|
||||||
SET(HAVE_LIBLCMS1 1)
|
|
||||||
SET(LCMS_LIBNAME ${LCMS_LIBRARY} )
|
|
||||||
SET(LCMS_INCLUDE_DIRNAME ${LCMS_INCLUDE_DIR})
|
|
||||||
ENDIF(LCMS_FOUND)
|
|
||||||
ENDIF(NOT LCMS2_FOUND)
|
|
||||||
#-------------------------------------------------------------
|
|
||||||
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables" ON)
|
|
||||||
#
|
|
||||||
IF(NOT ZLIB_FOUND OR NOT PNG_FOUND OR NOT TIFF_FOUND OR LCMS12_MISSING)
|
|
||||||
IF(BUILD_THIRDPARTY)
|
|
||||||
SET(HAVE_ZLIB_H 1)
|
|
||||||
SET(HAVE_LIBZ 1)
|
|
||||||
SET(HAVE_PNG_H 1)
|
|
||||||
SET(HAVE_LIBPNG 1)
|
|
||||||
SET(HAVE_TIFF_H 1)
|
|
||||||
SET(HAVE_LIBTIFF 1)
|
|
||||||
SET(HAVE_LCMS2_H 1)
|
|
||||||
SET(HAVE_LIBLCMS2 1)
|
|
||||||
#
|
|
||||||
#ADD_SUBDIRECTORY(${OPENJPEG_SOURCE_DIR}/thirdparty)
|
|
||||||
#
|
|
||||||
LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/thirdparty/lib)
|
|
||||||
#
|
|
||||||
IF(NOT ZLIB_FOUND)
|
|
||||||
INCLUDE_DIRECTORIES(${OPENJPEG_SOURCE_DIR}/thirdparty/include)
|
|
||||||
SET(ZLIB_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/include)
|
|
||||||
SET(Z_LIBNAME z)
|
|
||||||
SET(ZLIB_FOUND 1)
|
|
||||||
ENDIF(NOT ZLIB_FOUND)
|
|
||||||
#
|
|
||||||
IF(NOT PNG_FOUND)
|
|
||||||
SET(PNG_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libpng)
|
|
||||||
SET(PNG_LIBNAME png)
|
|
||||||
SET(PNG_FOUND 1)
|
|
||||||
ENDIF(NOT PNG_FOUND)
|
|
||||||
#
|
|
||||||
IF(NOT LCMS_FOUND AND NOT LCMS2_FOUND)
|
|
||||||
SET(LCMS_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/liblcms2/include)
|
|
||||||
SET(LCMS_LIBNAME lcms2)
|
|
||||||
SET(LCMS2_FOUND 1)
|
|
||||||
ENDIF(NOT LCMS_FOUND AND NOT LCMS2_FOUND)
|
|
||||||
#
|
|
||||||
IF(NOT TIFF_FOUND)
|
|
||||||
SET(TIFF_INCLUDE_DIRNAME ${OPENJPEG_SOURCE_DIR}/thirdparty/libtiff)
|
|
||||||
SET(TIFF_LIBNAME tiff)
|
|
||||||
SET(TIFF_FOUND 1)
|
|
||||||
ENDIF(NOT TIFF_FOUND)
|
|
||||||
#
|
|
||||||
ENDIF(BUILD_THIRDPARTY)
|
|
||||||
ENDIF(NOT ZLIB_FOUND OR NOT PNG_FOUND OR NOT TIFF_FOUND OR LCMS12_MISSING)
|
|
||||||
#
|
|
||||||
ENDIF(BUILD_CODEC OR BUILD_MJ2)
|
|
||||||
#
|
|
||||||
IF(BUILD_CODEC)
|
IF(BUILD_CODEC)
|
||||||
ADD_SUBDIRECTORY(codec)
|
ADD_SUBDIRECTORY(codec)
|
||||||
ENDIF(BUILD_CODEC)
|
ENDIF(BUILD_CODEC)
|
||||||
#
|
|
||||||
IF(BUILD_MJ2)
|
IF(BUILD_MJ2)
|
||||||
ADD_SUBDIRECTORY(mj2)
|
ADD_SUBDIRECTORY(mj2)
|
||||||
ENDIF(BUILD_MJ2)
|
ENDIF(BUILD_MJ2)
|
||||||
#
|
|
||||||
|
# Client & Server:
|
||||||
|
IF(BUILD_JPIP)
|
||||||
|
ADD_SUBDIRECTORY(jpip)
|
||||||
|
ENDIF(BUILD_JPIP)
|
||||||
|
|
||||||
|
IF(BUILD_VIEWER)
|
||||||
|
ADD_SUBDIRECTORY(OPJViewer)
|
||||||
|
ENDIF(BUILD_VIEWER)
|
||||||
|
|
||||||
|
IF(BUILD_JAVA)
|
||||||
|
ADD_SUBDIRECTORY(JavaOpenJPEG)
|
||||||
|
ENDIF(BUILD_JAVA)
|
||||||
|
|||||||
@@ -1,40 +1,68 @@
|
|||||||
#JavaOpenJPEG/CMakeLists.txt
|
#JavaOpenJPEG/CMakeLists.txt
|
||||||
|
|
||||||
# First thing define the common source:
|
# First thing define the common source:
|
||||||
SET(common_SRCS
|
SET(openjpegjni_SRCS
|
||||||
../codec/convert.c
|
JavaOpenJPEGDecoder.c
|
||||||
../codec/index.c
|
JavaOpenJPEG.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/codec/index.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/codec/convert.c
|
||||||
|
#${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
)
|
)
|
||||||
|
|
||||||
# If not getopt was found then add it to the lib:
|
# JNI binding:
|
||||||
IF(DONT_HAVE_GETOPT)
|
find_package(JNI REQUIRED)
|
||||||
SET(common_SRCS
|
include_directories(${JNI_INCLUDE_DIRS})
|
||||||
${common_SRCS}
|
|
||||||
../common/getopt.c
|
|
||||||
)
|
|
||||||
ENDIF(DONT_HAVE_GETOPT)
|
|
||||||
|
|
||||||
|
# required header file:
|
||||||
# Headers file are located here:
|
include_directories(
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||||
${LCMS_INCLUDE_DIR}
|
${OPENJPEG_SOURCE_DIR}/applications/common
|
||||||
${PNG_INCLUDE_DIR}
|
${OPENJPEG_SOURCE_DIR}/applications/codec
|
||||||
${ZLIB_INCLUDE_DIR}
|
|
||||||
${TIFF_INCLUDE_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Loop over all executables:
|
add_library(openjpegjni MODULE
|
||||||
FOREACH(exe j2k_to_image image_to_j2k)
|
${openjpegjni_SRCS}
|
||||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
)
|
||||||
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES}
|
# Java module should not have a SONAME:
|
||||||
${PNG_LIBRARIES} ${ZLIB_LIBRARY} ${LCMS_LIB})
|
set_property(TARGET openjpegjni PROPERTY NO_SONAME 1)
|
||||||
# On unix you need to link to the math library:
|
|
||||||
IF(UNIX)
|
|
||||||
TARGET_LINK_LIBRARIES(${exe} -lm)
|
|
||||||
ENDIF(UNIX)
|
|
||||||
# Install exe
|
|
||||||
INSTALL_TARGETS(/bin/ ${exe})
|
|
||||||
ENDFOREACH(exe)
|
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(openjpegjni ${OPENJPEG_LIBRARY_NAME})
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
target_link_libraries(openjpegjni m)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
INSTALL(TARGETS openjpegjni
|
||||||
|
EXPORT OpenJPEGTargets
|
||||||
|
LIBRARY DESTINATION ${OPENJPEG_INSTALL_JNI_DIR} COMPONENT Libraries
|
||||||
|
)
|
||||||
|
|
||||||
|
# build jar:
|
||||||
|
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
|
||||||
|
|
||||||
|
# build dep list:
|
||||||
|
file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
|
||||||
|
|
||||||
|
# make sure target javac dir exists:
|
||||||
|
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
|
||||||
|
# Build java
|
||||||
|
ADD_CUSTOM_COMMAND(
|
||||||
|
OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||||
|
COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
|
||||||
|
${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes
|
||||||
|
COMMAND ${Java_JAR_EXECUTABLE} cvf ${LIBRARY_OUTPUT_PATH}/openjpeg.jar org
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes
|
||||||
|
DEPENDS ${java_srcs}
|
||||||
|
COMMENT "javac *.java; jar cvf -> openjpeg.jar"
|
||||||
|
)
|
||||||
|
|
||||||
|
# name the target
|
||||||
|
ADD_CUSTOM_TARGET(OpenJPEGJavaJar ALL
|
||||||
|
DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||||
|
COMMENT "building openjpeg.jar"
|
||||||
|
)
|
||||||
|
|
||||||
|
INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
||||||
|
)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "getopt.h"
|
#include "opj_getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
extern int get_file_format(char *filename);
|
extern int get_file_format(char *filename);
|
||||||
extern void error_callback(const char *msg, void *client_data);
|
extern void error_callback(const char *msg, void *client_data);
|
||||||
extern warning_callback(const char *msg, void *client_data);
|
extern void warning_callback(const char *msg, void *client_data);
|
||||||
extern void info_callback(const char *msg, void *client_data);
|
extern void info_callback(const char *msg, void *client_data);
|
||||||
|
|
||||||
typedef struct callback_variables {
|
typedef struct callback_variables {
|
||||||
@@ -204,6 +204,8 @@ void encode_help_display() {
|
|||||||
fprintf(stdout," Indicate multiple modes by adding their values. \n");
|
fprintf(stdout," Indicate multiple modes by adding their values. \n");
|
||||||
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
|
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-TP : devide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
|
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n");
|
fprintf(stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n");
|
||||||
@@ -216,6 +218,9 @@ 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,"-jpip : write jpip codestream index box in JP2 output file\n");
|
||||||
|
fprintf(stdout," NOTICE: currently supports only RPCL order\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");
|
||||||
@@ -344,10 +349,11 @@ OPJ_PROG_ORDER give_progression(char progression[4]) {
|
|||||||
return PROG_UNKNOWN;
|
return PROG_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/// <summary>
|
* <summary>
|
||||||
/// Get logarithm of an integer and round downwards.
|
* Get logarithm of an integer and round downwards.
|
||||||
/// </summary>
|
* </summary>
|
||||||
|
*/
|
||||||
int int_floorlog2(int a) {
|
int int_floorlog2(int a) {
|
||||||
int l;
|
int l;
|
||||||
for (l=0; a>1; l++) {
|
for (l=0; a>1; l++) {
|
||||||
@@ -375,7 +381,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cinema_parameters(opj_cparameters_t *parameters){
|
void cinema_parameters(opj_cparameters_t *parameters){
|
||||||
parameters->tile_size_on = false;
|
parameters->tile_size_on = OPJ_FALSE;
|
||||||
parameters->cp_tdx=1;
|
parameters->cp_tdx=1;
|
||||||
parameters->cp_tdy=1;
|
parameters->cp_tdy=1;
|
||||||
|
|
||||||
@@ -489,24 +495,25 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------ */
|
||||||
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
int parse_cmdline_encoder(int argc, char * const argv[], opj_cparameters_t *parameters,
|
||||||
img_fol_t *img_fol, char *indexfilename) {
|
img_fol_t *img_fol, char *indexfilename) {
|
||||||
int i, j,totlen;
|
int i, j,totlen;
|
||||||
option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"cinema2K",REQ_ARG, NULL ,'w'},
|
{"cinema2K",REQ_ARG, NULL ,'w'},
|
||||||
{"cinema4K",NO_ARG, NULL ,'y'},
|
{"cinema4K",NO_ARG, NULL ,'y'},
|
||||||
{"ImgDir",REQ_ARG, NULL ,'z'},
|
{"ImgDir",REQ_ARG, NULL ,'z'},
|
||||||
{"TP",REQ_ARG, NULL ,'v'},
|
{"TP",REQ_ARG, NULL ,'u'},
|
||||||
{"SOP",NO_ARG, NULL ,'S'},
|
{"SOP",NO_ARG, NULL ,'S'},
|
||||||
{"EPH",NO_ARG, NULL ,'E'},
|
{"EPH",NO_ARG, NULL ,'E'},
|
||||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
{"POC",REQ_ARG, NULL ,'P'},
|
{"POC",REQ_ARG, NULL ,'P'},
|
||||||
{"ROI",REQ_ARG, NULL ,'R'},
|
{"ROI",REQ_ARG, NULL ,'R'},
|
||||||
|
{"jpip",NO_ARG, NULL, 'J'}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
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:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:J"
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
"W:"
|
"W:"
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
@@ -523,7 +530,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
reset_options_reading();
|
reset_options_reading();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt_long(argc, argv, optlist,long_option,totlen);
|
int c = opj_getopt_long(argc, argv, optlist,long_option,totlen);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
@@ -532,7 +539,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'o': /* output file */
|
case 'o': /* output file */
|
||||||
{
|
{
|
||||||
char *outfile = optarg;
|
char *outfile = opj_optarg;
|
||||||
parameters->cod_format = get_file_format(outfile);
|
parameters->cod_format = get_file_format(outfile);
|
||||||
switch(parameters->cod_format) {
|
switch(parameters->cod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
@@ -550,14 +557,14 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'O': /* output format */
|
case 'O': /* output format */
|
||||||
{
|
{
|
||||||
char outformat[50];
|
char outformat[50];
|
||||||
char *of = optarg;
|
char *of = opj_optarg;
|
||||||
sprintf(outformat,".%s",of);
|
sprintf(outformat,".%s",of);
|
||||||
img_fol->set_out_format = 1;
|
img_fol->set_out_format = 1;
|
||||||
parameters->cod_format = get_file_format(outformat);
|
parameters->cod_format = get_file_format(outformat);
|
||||||
switch(parameters->cod_format) {
|
switch(parameters->cod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
case JP2_CFMT:
|
case JP2_CFMT:
|
||||||
img_fol->out_format = optarg;
|
img_fol->out_format = opj_optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n");
|
fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n");
|
||||||
@@ -572,7 +579,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 = opj_optarg;
|
||||||
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 != ',') {
|
||||||
@@ -590,7 +597,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'q': /* add fixed_quality */
|
case 'q': /* add fixed_quality */
|
||||||
{
|
{
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
||||||
parameters->tcp_numlayers++;
|
parameters->tcp_numlayers++;
|
||||||
while (*s && *s != ',') {
|
while (*s && *s != ',') {
|
||||||
@@ -612,7 +619,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
int *row = NULL, *col = NULL;
|
int *row = NULL, *col = NULL;
|
||||||
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
||||||
|
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
sscanf(s, "%d", &numlayers);
|
sscanf(s, "%d", &numlayers);
|
||||||
s++;
|
s++;
|
||||||
if (numlayers > 9)
|
if (numlayers > 9)
|
||||||
@@ -622,6 +629,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
numresolution = parameters->numresolution;
|
numresolution = parameters->numresolution;
|
||||||
matrix_width = numresolution * 3;
|
matrix_width = numresolution * 3;
|
||||||
parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int));
|
parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int));
|
||||||
|
if(parameters->cp_matrice == NULL) return 1;
|
||||||
|
|
||||||
s = s + 2;
|
s = s + 2;
|
||||||
|
|
||||||
for (i = 0; i < numlayers; i++) {
|
for (i = 0; i < numlayers; i++) {
|
||||||
@@ -656,8 +665,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 't': /* tiles */
|
case 't': /* tiles */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
sscanf(opj_optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||||
parameters->tile_size_on = true;
|
parameters->tile_size_on = OPJ_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -665,7 +674,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'n': /* resolution */
|
case 'n': /* resolution */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d", ¶meters->numresolution);
|
sscanf(opj_optarg, "%d", ¶meters->numresolution);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -675,7 +684,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
char sep;
|
char sep;
|
||||||
int res_spec = 0;
|
int res_spec = 0;
|
||||||
|
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
do {
|
do {
|
||||||
sep = 0;
|
sep = 0;
|
||||||
sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec],
|
sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec],
|
||||||
@@ -694,7 +703,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'b': /* code-block dimension */
|
case 'b': /* code-block dimension */
|
||||||
{
|
{
|
||||||
int cblockw_init = 0, cblockh_init = 0;
|
int cblockw_init = 0, cblockh_init = 0;
|
||||||
sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
||||||
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -711,7 +720,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'x': /* creation of index file */
|
case 'x': /* creation of index file */
|
||||||
{
|
{
|
||||||
char *index = optarg;
|
char *index = opj_optarg;
|
||||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -722,7 +731,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
{
|
{
|
||||||
char progression[4];
|
char progression[4];
|
||||||
|
|
||||||
strncpy(progression, optarg, 4);
|
strncpy(progression, opj_optarg, 4);
|
||||||
parameters->prog_order = give_progression(progression);
|
parameters->prog_order = give_progression(progression);
|
||||||
if (parameters->prog_order == -1) {
|
if (parameters->prog_order == -1) {
|
||||||
fprintf(stderr, "Unrecognized progression order "
|
fprintf(stderr, "Unrecognized progression order "
|
||||||
@@ -736,7 +745,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 's': /* subsampling factor */
|
case 's': /* subsampling factor */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "%d,%d", ¶meters->subsampling_dx,
|
if (sscanf(opj_optarg, "%d,%d", ¶meters->subsampling_dx,
|
||||||
¶meters->subsampling_dy) != 2) {
|
¶meters->subsampling_dy) != 2) {
|
||||||
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -748,7 +757,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'd': /* coordonnate of the reference grid */
|
case 'd': /* coordonnate of the reference grid */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "%d,%d", ¶meters->image_offset_x0,
|
if (sscanf(opj_optarg, "%d,%d", ¶meters->image_offset_x0,
|
||||||
¶meters->image_offset_y0) != 2) {
|
¶meters->image_offset_y0) != 2) {
|
||||||
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
||||||
"error !! [-d x0,y0]\n");
|
"error !! [-d x0,y0]\n");
|
||||||
@@ -770,7 +779,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||||
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||||
|
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
POC = parameters->POC;
|
POC = parameters->POC;
|
||||||
|
|
||||||
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,
|
||||||
@@ -812,7 +821,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'M': /* Mode switch pas tous au point !! */
|
case 'M': /* Mode switch pas tous au point !! */
|
||||||
{
|
{
|
||||||
int value = 0;
|
int value = 0;
|
||||||
if (sscanf(optarg, "%d", &value) == 1) {
|
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||||
for (i = 0; i <= 5; i++) {
|
for (i = 0; i <= 5; i++) {
|
||||||
int cache = value & (1 << i);
|
int cache = value & (1 << i);
|
||||||
if (cache)
|
if (cache)
|
||||||
@@ -826,7 +835,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'R': /* ROI */
|
case 'R': /* ROI */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
if (sscanf(opj_optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
||||||
¶meters->roi_shift) != 2) {
|
¶meters->roi_shift) != 2) {
|
||||||
fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n");
|
fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -838,7 +847,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'T': /* Tile offset */
|
case 'T': /* Tile offset */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
if (sscanf(opj_optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
||||||
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -849,9 +858,12 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'C': /* add a comment */
|
case 'C': /* add a comment */
|
||||||
{
|
{
|
||||||
parameters->cp_comment = (char*)malloc(strlen(optarg) + 1);
|
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
|
|
||||||
|
if(parameters->cp_comment == NULL) return 1;
|
||||||
|
|
||||||
if(parameters->cp_comment) {
|
if(parameters->cp_comment) {
|
||||||
strcpy(parameters->cp_comment, optarg);
|
strcpy(parameters->cp_comment, opj_optarg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -867,9 +879,9 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'v': /* Tile part generation*/
|
case 'u': /* Tile part generation*/
|
||||||
{
|
{
|
||||||
parameters->tp_flag = optarg[0];
|
parameters->tp_flag = opj_optarg[0];
|
||||||
parameters->tp_on = 1;
|
parameters->tp_on = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -878,8 +890,11 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'z': /* Image Directory path */
|
case 'z': /* Image Directory path */
|
||||||
{
|
{
|
||||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
strcpy(img_fol->imgdirpath,optarg);
|
|
||||||
|
if(img_fol->imgdirpath == NULL) return 1;
|
||||||
|
|
||||||
|
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||||
img_fol->set_imgdir=1;
|
img_fol->set_imgdir=1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -889,7 +904,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'w': /* Digital Cinema 2K profile compliance*/
|
case 'w': /* Digital Cinema 2K profile compliance*/
|
||||||
{
|
{
|
||||||
int fps=0;
|
int fps=0;
|
||||||
sscanf(optarg,"%d",&fps);
|
sscanf(opj_optarg,"%d",&fps);
|
||||||
if(fps == 24){
|
if(fps == 24){
|
||||||
parameters->cp_cinema = CINEMA2K_24;
|
parameters->cp_cinema = CINEMA2K_24;
|
||||||
}else if(fps == 48 ){
|
}else if(fps == 48 ){
|
||||||
@@ -933,7 +948,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
/* search for different protection methods */
|
/* search for different protection methods */
|
||||||
|
|
||||||
/* break the option in comma points and parse the result */
|
/* break the option in comma points and parse the result */
|
||||||
token = strtok(optarg, ",");
|
token = strtok(opj_optarg, ",");
|
||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
|
|
||||||
/* search header error protection method */
|
/* search header error protection method */
|
||||||
@@ -1238,7 +1253,13 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
break;
|
break;
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'J': /* jpip on */
|
||||||
|
{
|
||||||
|
parameters->jpip_on = OPJ_TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1340,7 +1361,7 @@ char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the size of the index buffer, in number of bytes*/
|
/* Compute the size of the index buffer, in number of bytes*/
|
||||||
*buffer_size =
|
*buffer_size =
|
||||||
1 /* version */
|
1 /* version */
|
||||||
+ (10 /* image_w until decomposition */
|
+ (10 /* image_w until decomposition */
|
||||||
@@ -1349,18 +1370,18 @@ char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer
|
|||||||
+ cstr_info->tw * cstr_info->th * 4 /* tile info, without distorsion info */
|
+ cstr_info->tw * cstr_info->th * 4 /* tile info, without distorsion info */
|
||||||
+ cstr_info->tw*cstr_info->th * cstr_info->numlayers * (cstr_info->numdecompos[0] + 1) * cstr_info->numcomps * prec_max *8
|
+ cstr_info->tw*cstr_info->th * cstr_info->numlayers * (cstr_info->numdecompos[0] + 1) * cstr_info->numcomps * prec_max *8
|
||||||
) * sizeof(int);
|
) * sizeof(int);
|
||||||
//printf("C: index buffer size = %d bytes\n", *buffer_size);
|
/*printf("C: index buffer size = %d bytes\n", *buffer_size); */
|
||||||
buffer = (char*) malloc(*buffer_size);
|
buffer = (char*) malloc(*buffer_size);
|
||||||
|
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
//opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size);
|
/* opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size); */
|
||||||
fprintf(stderr, "failed to allocate index buffer for writing %d int\n", *buffer_size);
|
fprintf(stderr, "failed to allocate index buffer for writing %d int\n", *buffer_size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[0] = 1; // Version stored on a byte
|
buffer[0] = 1; /* Version stored on a byte */
|
||||||
buffer++;
|
buffer++;
|
||||||
// Remaining informations are stored on a int.
|
/* Remaining informations are stored on a int. */
|
||||||
((int*)buffer)[buffer_pos++] = cstr_info->image_w;
|
((int*)buffer)[buffer_pos++] = cstr_info->image_w;
|
||||||
((int*)buffer)[buffer_pos++] = cstr_info->image_h;
|
((int*)buffer)[buffer_pos++] = cstr_info->image_h;
|
||||||
((int*)buffer)[buffer_pos++] = cstr_info->prog;
|
((int*)buffer)[buffer_pos++] = cstr_info->prog;
|
||||||
@@ -1585,7 +1606,7 @@ char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer
|
|||||||
} /* tileno */
|
} /* tileno */
|
||||||
|
|
||||||
if (buffer_pos > *buffer_size) {
|
if (buffer_pos > *buffer_size) {
|
||||||
//opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);
|
/* opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size); */
|
||||||
fprintf(stderr, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);
|
fprintf(stderr, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1616,9 +1637,9 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
jbyte *jbBody;
|
jbyte *jbBody;
|
||||||
jshort *jsBody;
|
jshort *jsBody;
|
||||||
jint *jiBody;
|
jint *jiBody;
|
||||||
boolean isCopy;
|
jboolean isCopy;
|
||||||
|
|
||||||
// Image width, height and depth
|
/* Image width, height and depth */
|
||||||
fid = (*env)->GetFieldID(env, cls,"width", "I");
|
fid = (*env)->GetFieldID(env, cls,"width", "I");
|
||||||
ji = (*env)->GetIntField(env, obj, fid);
|
ji = (*env)->GetIntField(env, obj, fid);
|
||||||
w = ji;
|
w = ji;
|
||||||
@@ -1631,7 +1652,7 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
ji = (*env)->GetIntField(env, obj, fid);
|
ji = (*env)->GetIntField(env, obj, fid);
|
||||||
depth = ji;
|
depth = ji;
|
||||||
|
|
||||||
// Read the image
|
/* Read the image */
|
||||||
if (depth <=16) {
|
if (depth <=16) {
|
||||||
numcomps = 1;
|
numcomps = 1;
|
||||||
color_space = CLRSPC_GRAY;
|
color_space = CLRSPC_GRAY;
|
||||||
@@ -1646,8 +1667,10 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
cmptparm[0].y0 = parameters->image_offset_y0;
|
cmptparm[0].y0 = parameters->image_offset_y0;
|
||||||
cmptparm[0].w = !cmptparm[0].x0 ? (w - 1) * parameters->subsampling_dx + 1 : cmptparm[0].x0 + (w - 1) * parameters->subsampling_dx + 1;
|
cmptparm[0].w = !cmptparm[0].x0 ? (w - 1) * parameters->subsampling_dx + 1 : cmptparm[0].x0 + (w - 1) * parameters->subsampling_dx + 1;
|
||||||
cmptparm[0].h = !cmptparm[0].y0 ? (h - 1) * parameters->subsampling_dy + 1 : cmptparm[0].y0 + (h - 1) * parameters->subsampling_dy + 1;
|
cmptparm[0].h = !cmptparm[0].y0 ? (h - 1) * parameters->subsampling_dy + 1 : cmptparm[0].y0 + (h - 1) * parameters->subsampling_dy + 1;
|
||||||
// Java types are always signed but we use them as unsigned types (shift of the negative part of
|
/* Java types are always signed but we use them as unsigned types
|
||||||
// the pixels of the images in Telemis before entering the encoder).
|
* (shift of the negative part of the pixels of the images in
|
||||||
|
* Telemis before entering the encoder).
|
||||||
|
*/
|
||||||
cmptparm[0].sgnd = 0;
|
cmptparm[0].sgnd = 0;
|
||||||
if (depth<=16)
|
if (depth<=16)
|
||||||
cmptparm[0].prec=depth;
|
cmptparm[0].prec=depth;
|
||||||
@@ -1693,12 +1716,12 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
comp = &image->comps[compno];
|
comp = &image->comps[compno];
|
||||||
max = -100000;
|
max = -100000;
|
||||||
if (depth == 8) {
|
if (depth == 8) {
|
||||||
fid = (*env)->GetFieldID(env, cls,"image8", "[B"); // byteArray []
|
fid = (*env)->GetFieldID(env, cls,"image8", "[B");/* byteArray []*/
|
||||||
jba = (*env)->GetObjectField(env, obj, fid);
|
jba = (*env)->GetObjectField(env, obj, fid);
|
||||||
len = (*env)->GetArrayLength(env, jba);
|
len = (*env)->GetArrayLength(env, jba);
|
||||||
|
|
||||||
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, &isCopy);
|
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, &isCopy);
|
||||||
//printf("C: before transfering 8 bpp image\n");
|
/* printf("C: before transfering 8 bpp image\n"); */
|
||||||
if (comp->sgnd) {
|
if (comp->sgnd) {
|
||||||
for(i=0; i< len;i++) {
|
for(i=0; i< len;i++) {
|
||||||
comp->data[i] = (char) jbBody[i];
|
comp->data[i] = (char) jbBody[i];
|
||||||
@@ -1712,13 +1735,14 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
}
|
}
|
||||||
(*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0);
|
(*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0);
|
||||||
} else if(depth == 16) {
|
} else if(depth == 16) {
|
||||||
fid = (*env)->GetFieldID(env, cls,"image16", "[S"); // shortArray []
|
fid = (*env)->GetFieldID(env, cls,"image16", "[S");/*shortArray []*/
|
||||||
jsa = (*env)->GetObjectField(env, obj, fid);
|
jsa = (*env)->GetObjectField(env, obj, fid);
|
||||||
len = (*env)->GetArrayLength(env, jsa);
|
len = (*env)->GetArrayLength(env, jsa);
|
||||||
|
|
||||||
jsBody = (*env)->GetPrimitiveArrayCritical(env, jsa, &isCopy);
|
jsBody = (*env)->GetPrimitiveArrayCritical(env, jsa, &isCopy);
|
||||||
//printf("C: before transfering 16 bpp image\n");
|
/*printf("C: before transfering 16 bpp image\n"); */
|
||||||
if (comp->sgnd) { // Special behaviour to deal with signed elements ??
|
if (comp->sgnd) {
|
||||||
|
/* Special behaviour to deal with signed elements ?? */
|
||||||
comp->data[i] = (short) jsBody[i];
|
comp->data[i] = (short) jsBody[i];
|
||||||
for(i=0; i< len;i++) {
|
for(i=0; i< len;i++) {
|
||||||
if (comp->data[i] > max) max = comp->data[i];
|
if (comp->data[i] > max) max = comp->data[i];
|
||||||
@@ -1731,14 +1755,15 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
}
|
}
|
||||||
(*env)->ReleasePrimitiveArrayCritical(env, jsa, jsBody, 0);
|
(*env)->ReleasePrimitiveArrayCritical(env, jsa, jsBody, 0);
|
||||||
} else if (depth == 24) {
|
} else if (depth == 24) {
|
||||||
fid = (*env)->GetFieldID(env, cls,"image24", "[I"); // intArray []
|
fid = (*env)->GetFieldID(env, cls,"image24", "[I");/* intArray []*/
|
||||||
jia = (*env)->GetObjectField(env, obj, fid);
|
jia = (*env)->GetObjectField(env, obj, fid);
|
||||||
len = (*env)->GetArrayLength(env, jia);
|
len = (*env)->GetArrayLength(env, jia);
|
||||||
shift = compno*8;
|
shift = compno*8;
|
||||||
|
|
||||||
jiBody = (*env)->GetPrimitiveArrayCritical(env, jia, &isCopy);
|
jiBody = (*env)->GetPrimitiveArrayCritical(env, jia, &isCopy);
|
||||||
//printf("C: before transfering 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd);
|
/*printf("C: before transfering 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd);*/
|
||||||
if (comp->sgnd) { // Special behaviour to deal with signed elements ?? XXXXX
|
if (comp->sgnd) {
|
||||||
|
/* Special behaviour to deal with signed elements ?? XXXXX */
|
||||||
for(i=0; i< len;i++) {
|
for(i=0; i< len;i++) {
|
||||||
comp->data[i] = ( ((int) jiBody[i]) & (0xFF << shift) ) >> shift;
|
comp->data[i] = ( ((int) jiBody[i]) & (0xFF << shift) ) >> shift;
|
||||||
if (comp->data[i] > max) max = comp->data[i];
|
if (comp->data[i] > max) max = comp->data[i];
|
||||||
@@ -1753,7 +1778,7 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
}
|
}
|
||||||
comp->bpp = int_floorlog2(max)+1;
|
comp->bpp = int_floorlog2(max)+1;
|
||||||
comp->prec = comp->bpp;
|
comp->prec = comp->bpp;
|
||||||
//printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp);
|
/*printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp);*/
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
@@ -1763,20 +1788,20 @@ opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj,
|
|||||||
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
|
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
|
||||||
JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
|
JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
|
||||||
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
|
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
|
||||||
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
const char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
||||||
bool bSuccess;
|
opj_bool bSuccess;
|
||||||
opj_cparameters_t parameters; /* compression parameters */
|
opj_cparameters_t parameters; /* compression parameters */
|
||||||
img_fol_t img_fol;
|
img_fol_t img_fol;
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
opj_image_t *image = NULL;
|
opj_image_t *image = NULL;
|
||||||
int i,j,num_images;
|
int i,j,num_images;
|
||||||
int imageno;
|
int imageno;
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||||
|
|
||||||
int* compressed_index = NULL;
|
int* compressed_index = NULL;
|
||||||
int compressed_index_size=-1;
|
int compressed_index_size=-1;
|
||||||
// ==> Access variables to the Java member variables
|
/* ==> Access variables to the Java member variables */
|
||||||
jsize arraySize;
|
jsize arraySize;
|
||||||
jclass cls;
|
jclass cls;
|
||||||
jobject object;
|
jobject object;
|
||||||
@@ -1785,18 +1810,20 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
jbyteArray jba;
|
jbyteArray jba;
|
||||||
jbyte *jbBody;
|
jbyte *jbBody;
|
||||||
callback_variables_t msgErrorCallback_vars;
|
callback_variables_t msgErrorCallback_vars;
|
||||||
// <== access variable to the Java member variables.
|
/* <== access variable to the Java member variables. */
|
||||||
|
jlong retval = -1;
|
||||||
// For the encoding and storage into the file
|
/* For the encoding and storage into the file */
|
||||||
opj_cinfo_t* cinfo;
|
opj_cinfo_t* cinfo;
|
||||||
int codestream_length;
|
int codestream_length = -1;
|
||||||
opj_cio_t *cio = NULL;
|
opj_cio_t *cio = NULL;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
|
|
||||||
// JNI reference to the calling class
|
/* JNI reference to the calling class */
|
||||||
cls = (*env)->GetObjectClass(env, obj);
|
cls = (*env)->GetObjectClass(env, obj);
|
||||||
|
|
||||||
// Pointers to be able to call a Java method for all the info and error messages
|
/* Pointers to be able to call a Java method
|
||||||
|
* for all the info and error messages
|
||||||
|
*/
|
||||||
msgErrorCallback_vars.env = env;
|
msgErrorCallback_vars.env = env;
|
||||||
msgErrorCallback_vars.jobj = &obj;
|
msgErrorCallback_vars.jobj = &obj;
|
||||||
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
||||||
@@ -1804,8 +1831,11 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
|
|
||||||
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
||||||
argc = (int) arraySize +1;
|
argc = (int) arraySize +1;
|
||||||
argv = malloc(argc*sizeof(char*));
|
argv = (const char **)malloc(argc*sizeof(char*));
|
||||||
argv[0] = "ProgramName.exe"; // The program name: useless
|
|
||||||
|
if(argv == NULL) return -1;
|
||||||
|
|
||||||
|
argv[0] = "ProgramName.exe";/* The program name: useless */
|
||||||
j=0;
|
j=0;
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++) {
|
||||||
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
||||||
@@ -1829,23 +1859,21 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
/* set encoding parameters to default values */
|
/* set encoding parameters to default values */
|
||||||
opj_set_default_encoder_parameters(¶meters);
|
opj_set_default_encoder_parameters(¶meters);
|
||||||
parameters.cod_format = J2K_CFMT;
|
parameters.cod_format = J2K_CFMT;
|
||||||
//parameters.index_on = 1;
|
/* parameters.index_on = 1; */
|
||||||
|
|
||||||
/* Initialize indexfilename and img_fol */
|
/* Initialize indexfilename and img_fol */
|
||||||
*indexfilename = 0;
|
*indexfilename = 0;
|
||||||
memset(&img_fol,0,sizeof(img_fol_t));
|
memset(&img_fol,0,sizeof(img_fol_t));
|
||||||
|
|
||||||
/* parse input and get user encoding parameters */
|
/* parse input and get user encoding parameters */
|
||||||
if (parse_cmdline_encoder(argc, argv, ¶meters,&img_fol, indexfilename) == 1) {
|
j = parse_cmdline_encoder(argc, (char *const*)argv, ¶meters,&img_fol, indexfilename);
|
||||||
// Release the Java arguments array
|
|
||||||
for (i=1; i<argc; i++)
|
|
||||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the Java arguments array
|
/* Release the Java arguments array */
|
||||||
for (i=1; i<argc; i++)
|
for (i=1; i<argc; i++)
|
||||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
(*env)->ReleaseStringUTFChars(env,
|
||||||
|
(*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||||
|
|
||||||
|
if(j == 1) goto fin; /* failure */
|
||||||
|
|
||||||
if (parameters.cp_cinema){
|
if (parameters.cp_cinema){
|
||||||
cinema_parameters(¶meters);
|
cinema_parameters(¶meters);
|
||||||
@@ -1860,9 +1888,15 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
parameters.cp_comment = (char*)malloc(clen+strlen(version)+11);
|
parameters.cp_comment = (char*)malloc(clen+strlen(version)+11);
|
||||||
|
|
||||||
|
if(parameters.cp_comment == NULL) goto fin;
|
||||||
|
|
||||||
sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version);
|
sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version);
|
||||||
#else
|
#else
|
||||||
parameters.cp_comment = (char*)malloc(clen+strlen(version)+1);
|
parameters.cp_comment = (char*)malloc(clen+strlen(version)+1);
|
||||||
|
|
||||||
|
if(parameters.cp_comment == NULL) goto fin;
|
||||||
|
|
||||||
sprintf(parameters.cp_comment,"%s%s", comment, version);
|
sprintf(parameters.cp_comment,"%s%s", comment, version);
|
||||||
#endif
|
#endif
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
@@ -1879,10 +1913,10 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
|
|
||||||
image = loadImage(¶meters, env, obj, cls);
|
image = loadImage(¶meters, env, obj, cls);
|
||||||
//printf("C: after load image: image = %d\n", image);
|
/* printf("C: after load image: image = %d\n", image); */
|
||||||
if (!image) {
|
if (!image) {
|
||||||
fprintf(stderr, "Unable to load image\n");
|
fprintf(stderr, "Unable to load image\n");
|
||||||
return -1;
|
goto fin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decide if MCT should be used */
|
/* Decide if MCT should be used */
|
||||||
@@ -1898,7 +1932,7 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
if (parameters.cod_format == J2K_CFMT) { /* J2K format output */
|
if (parameters.cod_format == J2K_CFMT) { /* J2K format output */
|
||||||
cinfo = opj_create_compress(CODEC_J2K);
|
cinfo = opj_create_compress(CODEC_J2K);
|
||||||
} else { /* JP2 format output */
|
} else { /* JP2 format output */
|
||||||
cinfo = opj_create_compress(CODEC_JP2);
|
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, &msgErrorCallback_vars);
|
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, &msgErrorCallback_vars);
|
||||||
@@ -1916,7 +1950,7 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
if (!bSuccess) {
|
if (!bSuccess) {
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
fprintf(stderr, "failed to encode image\n");
|
fprintf(stderr, "failed to encode image\n");
|
||||||
return -1;
|
goto fin;
|
||||||
}
|
}
|
||||||
codestream_length = cio_tell(cio);
|
codestream_length = cio_tell(cio);
|
||||||
|
|
||||||
@@ -1928,7 +1962,8 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compressed_index = create_index_into_byte_array(&cstr_info, &compressed_index_size);
|
compressed_index = (int*)
|
||||||
|
create_index_into_byte_array(&cstr_info, &compressed_index_size);
|
||||||
/* Allocates the Java compressedIndex byte[] and sends this index into the Java object */
|
/* Allocates the Java compressedIndex byte[] and sends this index into the Java object */
|
||||||
fid = (*env)->GetFieldID(env, cls,"compressedIndex", "[B");
|
fid = (*env)->GetFieldID(env, cls,"compressedIndex", "[B");
|
||||||
jba = (*env)->NewByteArray(env, compressed_index_size+1);
|
jba = (*env)->NewByteArray(env, compressed_index_size+1);
|
||||||
@@ -1943,14 +1978,14 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
f = fopen(parameters.outfile, "wb");
|
f = fopen(parameters.outfile, "wb");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fprintf(stderr, "failed to open [%s] for writing\n", parameters.outfile);
|
fprintf(stderr, "failed to open [%s] for writing\n", parameters.outfile);
|
||||||
return -1;
|
goto fin;
|
||||||
}
|
}
|
||||||
fwrite(cio->buffer, 1, codestream_length, f);
|
fwrite(cio->buffer, 1, codestream_length, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
fprintf(stdout,"Generated outfile [%s]\n",parameters.outfile);
|
fprintf(stdout,"Generated outfile [%s]\n",parameters.outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the generated codestream to the Java pre-allocated compressedStream byte[] */
|
/* Write the generated codestream to the Java pre-allocated compressedStream byte[] */
|
||||||
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
||||||
jba = (*env)->GetObjectField(env, obj, fid);
|
jba = (*env)->GetObjectField(env, obj, fid);
|
||||||
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, 0);
|
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, 0);
|
||||||
@@ -1972,5 +2007,10 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
|||||||
if(parameters.cp_comment) free(parameters.cp_comment);
|
if(parameters.cp_comment) free(parameters.cp_comment);
|
||||||
if(parameters.cp_matrice) free(parameters.cp_matrice);
|
if(parameters.cp_matrice) free(parameters.cp_matrice);
|
||||||
|
|
||||||
return codestream_length;
|
retval = codestream_length;
|
||||||
|
|
||||||
|
fin:
|
||||||
|
free(argv);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "getopt.h"
|
#include "opj_getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
|
#include "org_openJpeg_OpenJPEGJavaDecoder.h"
|
||||||
@@ -203,10 +203,10 @@ int get_file_format(char *filename) {
|
|||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
int parse_cmdline_decoder(int argc, char * const argv[], opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
int totlen;
|
int totlen;
|
||||||
option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
};
|
};
|
||||||
@@ -229,13 +229,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
reset_options_reading();
|
reset_options_reading();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int c = getopt_long(argc, argv,optlist,long_option,totlen);
|
int c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i': /* input file */
|
case 'i': /* input file */
|
||||||
{
|
{
|
||||||
char *infile = optarg;
|
char *infile = opj_optarg;
|
||||||
parameters->decod_format = get_file_format(infile);
|
parameters->decod_format = get_file_format(infile);
|
||||||
switch(parameters->decod_format) {
|
switch(parameters->decod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
@@ -256,7 +256,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'o': /* output file */
|
case 'o': /* output file */
|
||||||
{
|
{
|
||||||
char *outfile = optarg;
|
char *outfile = opj_optarg;
|
||||||
parameters->cod_format = get_file_format(outfile);
|
parameters->cod_format = get_file_format(outfile);
|
||||||
switch(parameters->cod_format) {
|
switch(parameters->cod_format) {
|
||||||
case PGX_DFMT:
|
case PGX_DFMT:
|
||||||
@@ -279,7 +279,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
case 'O': /* output format */
|
case 'O': /* output format */
|
||||||
{
|
{
|
||||||
char outformat[50];
|
char outformat[50];
|
||||||
char *of = optarg;
|
char *of = opj_optarg;
|
||||||
sprintf(outformat,".%s",of);
|
sprintf(outformat,".%s",of);
|
||||||
img_fol->set_out_format = 1;
|
img_fol->set_out_format = 1;
|
||||||
parameters->cod_format = get_file_format(outformat);
|
parameters->cod_format = get_file_format(outformat);
|
||||||
@@ -315,7 +315,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'r': /* reduce option */
|
case 'r': /* reduce option */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d", ¶meters->cp_reduce);
|
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'l': /* layering option */
|
case 'l': /* layering option */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d", ¶meters->cp_layer);
|
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -338,8 +338,11 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'y': /* Image Directory path */
|
case 'y': /* Image Directory path */
|
||||||
{
|
{
|
||||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
strcpy(img_fol->imgdirpath,optarg);
|
|
||||||
|
if(img_fol->imgdirpath == NULL) return 1;
|
||||||
|
|
||||||
|
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||||
img_fol->set_imgdir=1;
|
img_fol->set_imgdir=1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -351,7 +354,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
{
|
{
|
||||||
char *token = NULL;
|
char *token = NULL;
|
||||||
|
|
||||||
token = strtok(optarg, ",");
|
token = strtok(opj_optarg, ",");
|
||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
|
|
||||||
/* search expected number of components */
|
/* search expected number of components */
|
||||||
@@ -418,7 +421,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +429,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
/* No check for possible errors before the -i and -o options are of course not mandatory*/
|
/* No check for possible errors before the -i and -o options are of course not mandatory*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}/* parse_cmdline_decoder() */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@@ -488,12 +491,13 @@ void info_callback(const char *msg, void *client_data) {
|
|||||||
(*env)->DeleteLocalRef(env, jbuffer);
|
(*env)->DeleteLocalRef(env, jbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FAILS -1
|
||||||
|
#define OK 0
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
|
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
|
||||||
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
|
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
|
||||||
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
|
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
|
||||||
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
const char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
||||||
opj_dparameters_t parameters; /* decompression parameters */
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
img_fol_t img_fol;
|
img_fol_t img_fol;
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
@@ -508,7 +512,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
int w,h;
|
int w,h;
|
||||||
long min_value, max_value;
|
long min_value, max_value;
|
||||||
short tempS; unsigned char tempUC, tempUC1, tempUC2;
|
short tempS; unsigned char tempUC, tempUC1, tempUC2;
|
||||||
// ==> Access variables to the Java member variables
|
/* ==> Access variables to the Java member variables */
|
||||||
jsize arraySize;
|
jsize arraySize;
|
||||||
jclass cls;
|
jclass cls;
|
||||||
jobject object;
|
jobject object;
|
||||||
@@ -521,8 +525,9 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
jshort *jsBody, *ptrSBody;
|
jshort *jsBody, *ptrSBody;
|
||||||
jint *jiBody, *ptrIBody;
|
jint *jiBody, *ptrIBody;
|
||||||
callback_variables_t msgErrorCallback_vars;
|
callback_variables_t msgErrorCallback_vars;
|
||||||
// <=== access variable to Java member variables */
|
/* <=== access variable to Java member variables */
|
||||||
int *ptr, *ptr1, *ptr2; // <== To transfer the decoded image to Java
|
int *ptr, *ptr1, *ptr2;/* <== To transfer the decoded image to Java */
|
||||||
|
jint retval = FAILS;
|
||||||
|
|
||||||
/* configure the event callbacks */
|
/* configure the event callbacks */
|
||||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||||
@@ -530,20 +535,26 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
event_mgr.warning_handler = warning_callback;
|
event_mgr.warning_handler = warning_callback;
|
||||||
event_mgr.info_handler = info_callback;
|
event_mgr.info_handler = info_callback;
|
||||||
|
|
||||||
// JNI reference to the calling class
|
/* JNI reference to the calling class */
|
||||||
cls = (*env)->GetObjectClass(env, obj);
|
cls = (*env)->GetObjectClass(env, obj);
|
||||||
|
|
||||||
// Pointers to be able to call a Java method for all the info and error messages
|
/* Pointers to be able to call a Java method
|
||||||
|
* for all the info and error messages
|
||||||
|
*/
|
||||||
msgErrorCallback_vars.env = env;
|
msgErrorCallback_vars.env = env;
|
||||||
msgErrorCallback_vars.jobj = &obj;
|
msgErrorCallback_vars.jobj = &obj;
|
||||||
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
||||||
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
|
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
|
||||||
|
|
||||||
// Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.
|
/* Get the String[] containing the parameters */
|
||||||
|
|
||||||
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
||||||
argc = (int) arraySize +1;
|
argc = (int) arraySize +1;
|
||||||
argv = malloc(argc*sizeof(char*));
|
argv = (const char **)malloc(argc*sizeof(char*));
|
||||||
argv[0] = "ProgramName.exe"; // The program name: useless
|
|
||||||
|
if(argv == NULL) return FAILS;
|
||||||
|
|
||||||
|
argv[0] = "ProgramName.exe";/* The program name: useless */
|
||||||
j=0;
|
j=0;
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++) {
|
||||||
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
||||||
@@ -561,19 +572,18 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
parameters.decod_format = J2K_CFMT;
|
parameters.decod_format = J2K_CFMT;
|
||||||
|
|
||||||
/* parse input and get user encoding parameters */
|
/* parse input and get user encoding parameters */
|
||||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
j = parse_cmdline_decoder(argc, (char * const*)argv, ¶meters,&img_fol);
|
||||||
// Release the Java arguments array
|
|
||||||
for (i=1; i<argc; i++)
|
/* Release the Java arguments array */
|
||||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// Release the Java arguments array
|
|
||||||
for (i=1; i<argc; i++)
|
for (i=1; i<argc; i++)
|
||||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
(*env)->ReleaseStringUTFChars(env,
|
||||||
|
(*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||||
|
|
||||||
|
if(j == 1) goto fin; /* failure */
|
||||||
|
|
||||||
num_images=1;
|
num_images=1;
|
||||||
|
|
||||||
// Get additional information from the Java object variables
|
/* Get additional information from the Java object variables */
|
||||||
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
|
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
|
||||||
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
|
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
|
||||||
|
|
||||||
@@ -587,22 +597,25 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
Implemented for debug purpose. */
|
Implemented for debug purpose. */
|
||||||
/* -------------------------------------------------------------- */
|
/* -------------------------------------------------------------- */
|
||||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||||
//printf("C: opening [%s]\n", parameters.infile);
|
/* printf("C: opening [%s]\n", parameters.infile); */
|
||||||
fsrc = fopen(parameters.infile, "rb");
|
fsrc = fopen(parameters.infile, "rb");
|
||||||
if (!fsrc) {
|
if (!fsrc) {
|
||||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||||
return 1;
|
goto fin;
|
||||||
}
|
}
|
||||||
fseek(fsrc, 0, SEEK_END);
|
fseek(fsrc, 0, SEEK_END);
|
||||||
file_length = ftell(fsrc);
|
file_length = ftell(fsrc);
|
||||||
fseek(fsrc, 0, SEEK_SET);
|
fseek(fsrc, 0, SEEK_SET);
|
||||||
src = (unsigned char *) malloc(file_length);
|
src = (unsigned char *) malloc(file_length);
|
||||||
|
|
||||||
|
if(src == NULL) goto fin;
|
||||||
|
|
||||||
fread(src, 1, file_length, fsrc);
|
fread(src, 1, file_length, fsrc);
|
||||||
fclose(fsrc);
|
fclose(fsrc);
|
||||||
//printf("C: %d bytes read from file\n",file_length);
|
/* printf("C: %d bytes read from file\n",file_length); */
|
||||||
} else {
|
} else {
|
||||||
// Preparing the transfer of the codestream from Java to C
|
/* Preparing the transfer of the codestream from Java to C */
|
||||||
//printf("C: before transfering codestream\n");
|
/* printf("C: before transfering codestream\n"); */
|
||||||
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
||||||
jba = (*env)->GetObjectField(env, obj, fid);
|
jba = (*env)->GetObjectField(env, obj, fid);
|
||||||
file_length = (*env)->GetArrayLength(env, jba);
|
file_length = (*env)->GetArrayLength(env, jba);
|
||||||
@@ -636,7 +649,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
return 1;
|
goto fin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close the byte stream */
|
||||||
@@ -666,7 +679,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
return 1;
|
goto fin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close the byte stream */
|
||||||
@@ -697,7 +710,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
return 1;
|
goto fin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close the byte stream */
|
||||||
@@ -752,17 +765,21 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========= Return the image to the Java structure ===============
|
/* ========= Return the image to the Java structure =============== */
|
||||||
#ifdef CHECK_THRESHOLDS
|
#ifdef CHECK_THRESHOLDS
|
||||||
printf("C: checking thresholds\n");
|
printf("C: checking thresholds\n");
|
||||||
#endif
|
#endif
|
||||||
// First compute the real with and height, in function of the resolutions decoded.
|
/* First compute the real with and height,
|
||||||
//wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
* in function of the resolutions decoded.
|
||||||
//hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
*/
|
||||||
|
/*---
|
||||||
|
wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||||
|
hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||||
|
---*/
|
||||||
w = image->comps[0].w;
|
w = image->comps[0].w;
|
||||||
h = image->comps[0].h;
|
h = image->comps[0].h;
|
||||||
|
|
||||||
if (image->numcomps==3) { // 3 components color image
|
if (image->numcomps==3) { /* 3 components color image */
|
||||||
ptr = image->comps[0].data;
|
ptr = image->comps[0].data;
|
||||||
ptr1 = image->comps[1].data;
|
ptr1 = image->comps[1].data;
|
||||||
ptr2 = image->comps[2].data;
|
ptr2 = image->comps[2].data;
|
||||||
@@ -775,7 +792,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
max_value = 255;
|
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);
|
||||||
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
|
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
|
||||||
@@ -804,7 +821,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
}
|
}
|
||||||
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
|
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
|
||||||
|
|
||||||
} else { // 1 component 8 or 16 bpp image
|
} else { /* 1 component 8 or 16 bpp image */
|
||||||
ptr = image->comps[0].data;
|
ptr = image->comps[0].data;
|
||||||
printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
|
printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
|
||||||
if (image->comps[0].prec<=8) {
|
if (image->comps[0].prec<=8) {
|
||||||
@@ -821,7 +838,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
max_value = 255;
|
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]);
|
||||||
#ifdef CHECK_THRESHOLDS
|
#ifdef CHECK_THRESHOLDS
|
||||||
@@ -877,7 +894,12 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
|||||||
opj_image_destroy(image);
|
opj_image_destroy(image);
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1; /* OK */
|
retval = OK;
|
||||||
}
|
|
||||||
//end main
|
fin:
|
||||||
|
free(argv);
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
/* end main MAIN */
|
||||||
|
|
||||||
|
|||||||
@@ -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) ../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
|
|
||||||
gcc $(CFLAGS) ../common/getopt.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
|
|
||||||
@@ -1,278 +0,0 @@
|
|||||||
/*
|
|
||||||
* @(#)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_ */
|
|
||||||
@@ -1,237 +0,0 @@
|
|||||||
/*
|
|
||||||
* @(#)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 */
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,642 +0,0 @@
|
|||||||
/*
|
|
||||||
* @(#)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_ */
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* @(#)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_ */
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
* @(#)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_ */
|
|
||||||
Binary file not shown.
@@ -6,7 +6,7 @@ if WANT_MJ2
|
|||||||
SUBDIRS += mj2
|
SUBDIRS += mj2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if WANT_JPIP
|
if WANT_JPIP_CODE
|
||||||
SUBDIRS += jpip
|
SUBDIRS += jpip
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -15,5 +15,5 @@ CMakeLists.txt \
|
|||||||
common/color.c \
|
common/color.c \
|
||||||
common/color.h \
|
common/color.h \
|
||||||
common/format_defs.h \
|
common/format_defs.h \
|
||||||
common/getopt.c \
|
common/opj_getopt.c \
|
||||||
common/getopt.h
|
common/opj_getopt.h
|
||||||
|
|||||||
25
applications/OPJViewer/CMakeLists.txt
Normal file
25
applications/OPJViewer/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
PROJECT(viewer CXX)
|
||||||
|
|
||||||
|
FIND_PACKAGE(wxWidgets REQUIRED)
|
||||||
|
INCLUDE(${wxWidgets_USE_FILE})
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
|
)
|
||||||
|
|
||||||
|
# original flags:
|
||||||
|
# -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT -DOPJ_INICONFIG -DUSE_JPSEC -DOPJ_MANYFORMATS
|
||||||
|
ADD_DEFINITIONS(-DwxUSE_LIBOPENJPEG -DOPENJPEG_VERSION="1.5.0")
|
||||||
|
SET(OPJV_SRCS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/imagjpeg2000.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/wxj2kparser.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJViewer.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/wxjp2parser.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJDialogs.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJThreads.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/source/OPJAbout.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../codec/index.c
|
||||||
|
)
|
||||||
|
ADD_EXECUTABLE(opjviewer ${OPJV_SRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(opjviewer ${wxWidgets_LIBRARIES} openjpeg)
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
# Makefile for OPJViewer
|
|
||||||
|
|
||||||
# General configuration variables:
|
|
||||||
CC = $(shell wx-config-2.8 --cxx)
|
|
||||||
AR = ar
|
|
||||||
|
|
||||||
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/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)
|
|
||||||
|
|
||||||
all: opjviewer lib
|
|
||||||
|
|
||||||
.cpp.o:
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
lib:
|
|
||||||
cd ../jpwl; make
|
|
||||||
|
|
||||||
opjviewer: $(OPJV_SRCS) lib
|
|
||||||
$(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:
|
|
||||||
rm -f OPJViewer *.o *.a
|
|
||||||
cd ../libopenjpeg; rm -f *.o
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#.cpp.o :
|
|
||||||
# $(CXX) -g -c `wx-config-2.8 --cxxflags` -I ../.. -D wxUSE_LIBOPENJPEG -D wxHACK_BOOLEAN -o $@ $<
|
|
||||||
|
|
||||||
#all: $(PROGRAM)
|
|
||||||
|
|
||||||
#$(PROGRAM): $(OBJECTS)
|
|
||||||
# $(CXX) -o $(PROGRAM) $(OBJECTS) -lopenjpeg -L ../.. `wx-config-2.8 --libs`
|
|
||||||
|
|
||||||
#clean:
|
|
||||||
# rm -f *.o $(PROGRAM)
|
|
||||||
@@ -1,290 +0,0 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="OPJViewer" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
|
||||||
|
|
||||||
CFG=OPJVIEWER - WIN32 RELEASE
|
|
||||||
!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 "OPJViewer.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 "OPJViewer.mak" CFG="OPJVIEWER - WIN32 RELEASE"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "OPJViewer - Win32 Release" (based on "Win32 (x86) Console Application")
|
|
||||||
!MESSAGE "OPJViewer - 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)" == "OPJViewer - 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 Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# 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 "$(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 RSC /l 0x409 /i "$(WXWIN28)\include" /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 /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 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 /nodefaultlib
|
|
||||||
# Begin Special Build Tool
|
|
||||||
SOURCE="$(InputPath)"
|
|
||||||
PostBuild_Desc=Update build number
|
|
||||||
PostBuild_Cmds=buildupdate.bat
|
|
||||||
# End Special Build Tool
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "OPJViewer___Win32_Debug"
|
|
||||||
# PROP BASE Intermediate_Dir "OPJViewer___Win32_Debug"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "Debug"
|
|
||||||
# PROP Intermediate_Dir "Debug"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# 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 /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 RSC /l 0x410 /i "$(WXWIN28)\include" /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 /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 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
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "OPJViewer - Win32 Release"
|
|
||||||
# Name "OPJViewer - Win32 Debug"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagjpeg2000.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagmxf.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\codec\index.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJAbout.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJDialogs.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJThreads.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJViewer.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wxj2kparser.cpp
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wxjp2parser.cpp
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\about_htm.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\build.h
|
|
||||||
# PROP Exclude_From_Build 1
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagjpeg2000.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\imagmxf.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\codec\index.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJViewer.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"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\blank.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\bullseye.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\cdrom.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\computer.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\cross.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\drive.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\file1.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\floppy.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\folder1.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\folder2.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\hand.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\icon1.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\icon2.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\icon3.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\icon4.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\icon5.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\magnif1.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\opj_logo.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJChild.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJChild16.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJViewer.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJViewer.rc
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\OPJViewer16.xpm
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\pbrush.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\pencil.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\pntleft.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\pntright.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\removble.ico
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\rightarr.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\roller.cur
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\source\wx\msw\std.ico
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "LibOpenJPEG_JPWL"=..\jpwl\LibOpenJPEG_JPWL.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "OPJViewer"=.\OPJViewer.dsp - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
Begin Project Dependency
|
|
||||||
Project_Dep_Name LibOpenJPEG_JPWL
|
|
||||||
End Project Dependency
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "mxflib"="..\..\..\..\mxflib-1.0.0\build\msvc\mxflib.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
@@ -1,48 +1,48 @@
|
|||||||
; Script generated by the Inno Setup Script Wizard.
|
; Script generated by the Inno Setup Script Wizard.
|
||||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppName=OPJViewer
|
AppName=OPJViewer
|
||||||
AppVerName=OPJViewer 0.4 beta
|
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
|
||||||
AppUpdatesURL=http://www.openjpeg.org
|
AppUpdatesURL=http://www.openjpeg.org
|
||||||
DefaultDirName={pf}\OPJViewer
|
DefaultDirName={pf}\OPJViewer
|
||||||
DefaultGroupName=OPJViewer
|
DefaultGroupName=OPJViewer
|
||||||
OutputDir=setup
|
OutputDir=setup
|
||||||
OutputBaseFilename=OPJViewer04beta_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.4.0.0
|
VersionInfoVersion=0.4.0.0
|
||||||
VersionInfoCompany=OpenJPEG
|
VersionInfoCompany=OpenJPEG
|
||||||
VersionInfoDescription=JPEG 2000 viewer
|
VersionInfoDescription=JPEG 2000 viewer
|
||||||
ShowLanguageDialog=yes
|
ShowLanguageDialog=yes
|
||||||
SetupIconFile=source\OPJViewer.ico
|
SetupIconFile=source\OPJViewer.ico
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: english; MessagesFile: compiler:Default.isl
|
Name: english; MessagesFile: compiler:Default.isl
|
||||||
|
|
||||||
[Tasks]
|
[Tasks]
|
||||||
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
|
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
|
||||||
|
|
||||||
[Files]
|
[Files]
|
||||||
Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
|
Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
|
||||||
;Source: about\about.htm; DestDir: {app}/about; Flags: ignoreversion
|
;Source: about\about.htm; DestDir: {app}/about; Flags: ignoreversion
|
||||||
;Source: about\opj_logo.png; DestDir: {app}/about; Flags: ignoreversion
|
;Source: about\opj_logo.png; DestDir: {app}/about; Flags: ignoreversion
|
||||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0
|
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0
|
||||||
Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe}
|
Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe}
|
||||||
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0
|
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}
|
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}
|
||||||
|
|
||||||
[Registry]
|
[Registry]
|
||||||
Root: HKCU; Subkey: Software\OpenJPEG; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
|
Root: HKCU; Subkey: Software\OpenJPEG; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
|
||||||
Root: HKCU; Subkey: Software\OpenJPEG\OPJViewer; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
|
Root: HKCU; Subkey: Software\OpenJPEG\OPJViewer; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
|
||||||
|
|||||||
@@ -1,100 +1,100 @@
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
JPEG2000 Visualization Software - OPJViewer
|
JPEG2000 Visualization Software - OPJViewer
|
||||||
|
|
||||||
Version 0.4 beta
|
Version 0.4 beta
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|
||||||
|
|
||||||
1. Scope
|
1. Scope
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This document describes the installation and use of the OPJViewer in the framework of OpenJPEG library.
|
This document describes the installation and use of the OPJViewer in the framework of OpenJPEG library.
|
||||||
|
|
||||||
This implementation has been developed using the OpenJPEG library as decoding engine and wxWidgets 2.8 as GUI engine.
|
This implementation has been developed using the OpenJPEG library as decoding engine and wxWidgets 2.8 as GUI engine.
|
||||||
|
|
||||||
If you find some bugs or if you have problems using the viewer, please send an e-mail to jpwl@diei.unipg.it
|
If you find some bugs or if you have problems using the viewer, please send an e-mail to jpwl@diei.unipg.it
|
||||||
|
|
||||||
2. Installing the viewer
|
2. Installing the viewer
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
There are two options available, at the moment:
|
There are two options available, at the moment:
|
||||||
|
|
||||||
a) compile from source code
|
a) compile from source code
|
||||||
b) download a precompiled binary.
|
b) download a precompiled binary.
|
||||||
|
|
||||||
In order to use option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries).
|
In order to use option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries).
|
||||||
|
|
||||||
2.1. Compiling the source code in Windows
|
2.1. Compiling the source code in Windows
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
The steps required to compile the viewer under windows are:
|
The steps required to compile the viewer under windows are:
|
||||||
|
|
||||||
a) Download at least the libopenjpeg, jpwl, and opjviewer folders from the SVN trunk.
|
a) Download at least the libopenjpeg, jpwl, and opjviewer folders from the SVN trunk.
|
||||||
b) Open the OPJViewer.dsw workspace with Visual C++ 6 and activate the "OPJViewer - Win32 Release" configuration.
|
b) Open the OPJViewer.dsw workspace with Visual C++ 6 and activate the "OPJViewer - Win32 Release" configuration.
|
||||||
c) In the configuration settings, go to the C++ tab and modify the wxWidgets paths in order to reflect your wx* install configuration (Preprocessor -> Additional include directories): simply update each instance of the two wx paths, do not remove or add them.
|
c) In the configuration settings, go to the C++ tab and modify the wxWidgets paths in order to reflect your wx* install configuration (Preprocessor -> Additional include directories): simply update each instance of the two wx paths, do not remove or add them.
|
||||||
d) In the configuration settings, go to the Link tab and modify the wxWidgets path in order to reflect your wx* install configuration (Input -> Additional library path): simply update the wx path.
|
d) In the configuration settings, go to the Link tab and modify the wxWidgets path in order to reflect your wx* install configuration (Input -> Additional library path): simply update the wx path.
|
||||||
e) In the configuration settings, go to the Resources tab and modify the wxWidgets path in order to reflect your wx* install configuration (Additional resource include directories): simply update the wx path.
|
e) In the configuration settings, go to the Resources tab and modify the wxWidgets path in order to reflect your wx* install configuration (Additional resource include directories): simply update the wx path.
|
||||||
f) Build!
|
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
|
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.
|
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
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
|
||||||
The porting is possible and under way.
|
The porting is possible and under way.
|
||||||
|
|
||||||
|
|
||||||
3. General information on the viewer
|
3. General information on the viewer
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
This viewer is conceived to open and display information and image content of J2K, JP2, and MJ2 files.
|
This viewer is conceived to open and display information and image content of J2K, JP2, and MJ2 files.
|
||||||
The viewer application interface is divided into three main panels:
|
The viewer application interface is divided into three main panels:
|
||||||
- a browsing pane;
|
- a browsing pane;
|
||||||
- a viewing pane;
|
- a viewing pane;
|
||||||
- a log/peek pane.
|
- a log/peek pane.
|
||||||
|
|
||||||
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
||||||
|
|
||||||
filename
|
filename
|
||||||
|
|
|
|
||||||
|_ #000: Marker/Box short name (Hex code)
|
|_ #000: Marker/Box short name (Hex code)
|
||||||
| |
|
| |
|
||||||
| |_ *** Marker/Box long name ***
|
| |_ *** Marker/Box long name ***
|
||||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||||
| |_ Additional info, depending on the marker/box type
|
| |_ Additional info, depending on the marker/box type
|
||||||
| |_ ...
|
| |_ ...
|
||||||
|
|
|
|
||||||
|_ #001: Marker/Box short name (Hex code)
|
|_ #001: Marker/Box short name (Hex code)
|
||||||
| |
|
| |
|
||||||
| |_ ...
|
| |_ ...
|
||||||
|
|
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
||||||
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
||||||
|
|
||||||
|
|
||||||
The log/peek pane is shared among two different subpanels:
|
The log/peek pane is shared among two different subpanels:
|
||||||
|
|
||||||
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
||||||
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
||||||
|
|
||||||
|
|
||||||
4. Known bugs and limitations
|
4. Known bugs and limitations
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
4.1. Bugs
|
4.1. Bugs
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
4.2. Limitations
|
4.2. Limitations
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
* For mj2 files, rendering is only in B/W
|
* For mj2 files, rendering is only in B/W
|
||||||
|
|||||||
@@ -1,36 +1,36 @@
|
|||||||
<html>
|
<html>
|
||||||
<body bgcolor="#FFFFFF">
|
<body bgcolor="#FFFFFF">
|
||||||
<table cellspacing=7 cellpadding=1 border=0 width="100%">
|
<table cellspacing=7 cellpadding=1 border=0 width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan=3 valign=top align=center width=70>
|
<td rowspan=3 valign=top align=center width=70>
|
||||||
<img src="opj_logo.png"><br><br>
|
<img src="opj_logo.png"><br><br>
|
||||||
</td>
|
</td>
|
||||||
<td align=center>
|
<td align=center>
|
||||||
<font size=+2 color="#000000"><b>OPJViewer v0.2 alpha</b></font><br>
|
<font size=+2 color="#000000"><b>OPJViewer v0.2 alpha</b></font><br>
|
||||||
<font size=+0 color="#000000"><b>A JPEG 2000 image viewer</b></font>
|
<font size=+0 color="#000000"><b>A JPEG 2000 image viewer</b></font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr height=3 valign=center>
|
<tr height=3 valign=center>
|
||||||
<td valign=center bgcolor=#cc3300></td>
|
<td valign=center bgcolor=#cc3300></td>
|
||||||
</tr>
|
</tr>
|
||||||
<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.
|
<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,
|
In addition to the basic codec, various other features are under development,
|
||||||
among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool
|
among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool
|
||||||
useful for the JPIP protocol, JPWL-tools for error-resilience, ...</font>
|
useful for the JPIP protocol, JPWL-tools for error-resilience, ...</font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=2 bgcolor="#CC3300" height=3 valign=center></td>
|
<td colspan=2 bgcolor="#CC3300" height=3 valign=center></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/">Universit<EFBFBD> Catholique de Louvain</a></font><br>
|
<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/">Universit<EFBFBD> Catholique de Louvain</a></font><br>
|
||||||
<font size=-2 color="#444444">OPJViewer is also © 2005-2007 <a href="http://dsplab.diei.unipg.it/">DSPLab</a> - <a href="http://www.unipg.it/">Universit<EFBFBD> degli studi di Perugia</a></font>
|
<font size=-2 color="#444444">OPJViewer is also © 2005-2007 <a href="http://dsplab.diei.unipg.it/">DSPLab</a> - <a href="http://www.unipg.it/">Universit<EFBFBD> degli studi di Perugia</a></font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
::== buildupdate.bat
|
|
||||||
@echo off
|
|
||||||
setLocal EnableDelayedExpansion
|
|
||||||
|
|
||||||
for /f "tokens=2,* delims=^(^) " %%a in ('find /v "" ^< .\source\build.h') do (
|
|
||||||
rem echo %%a
|
|
||||||
set /A M = %%a + 1
|
|
||||||
echo Build %%a done^!
|
|
||||||
echo wxT^("!M!"^) > buildtemp283746825t347
|
|
||||||
)
|
|
||||||
|
|
||||||
if exist buildtemp283746825t347 move /Y buildtemp283746825t347 .\source\build.h
|
|
||||||
if exist buildtemp283746825t347 del /F /Q buildtemp283746825t347
|
|
||||||
|
|
||||||
::==
|
|
||||||
@@ -1,87 +1,87 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'<27> degli studi di Perugia (UPG), Italy
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'<27> degli studi di Perugia (UPG), Italy
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
#include "mxflib/mxflib.h"
|
#include "mxflib/mxflib.h"
|
||||||
#endif // USE_MXF
|
#endif // USE_MXF
|
||||||
|
|
||||||
#include "OPJViewer.h"
|
#include "OPJViewer.h"
|
||||||
|
|
||||||
// about window for the frame
|
// about window for the frame
|
||||||
void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
#ifdef OPJ_HTMLABOUT
|
#ifdef OPJ_HTMLABOUT
|
||||||
#include "about_htm.h"
|
#include "about_htm.h"
|
||||||
#include "opj_logo.xpm"
|
#include "opj_logo.xpm"
|
||||||
|
|
||||||
wxBoxSizer *topsizer;
|
wxBoxSizer *topsizer;
|
||||||
wxHtmlWindow *html;
|
wxHtmlWindow *html;
|
||||||
wxDialog dlg(this, wxID_ANY, wxString(_("About")));
|
wxDialog dlg(this, wxID_ANY, wxString(_("About")));
|
||||||
|
|
||||||
wxMemoryFSHandler::AddFile(wxT("opj_logo.xpm"), wxBitmap(opj_logo), wxBITMAP_TYPE_XPM);
|
wxMemoryFSHandler::AddFile(wxT("opj_logo.xpm"), wxBitmap(opj_logo), wxBITMAP_TYPE_XPM);
|
||||||
|
|
||||||
topsizer = new wxBoxSizer(wxVERTICAL);
|
topsizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(320, 250), wxHW_SCROLLBAR_NEVER);
|
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(320, 250), wxHW_SCROLLBAR_NEVER);
|
||||||
html->SetBorders(0);
|
html->SetBorders(0);
|
||||||
//html->LoadPage(wxT("about/about.htm"));
|
//html->LoadPage(wxT("about/about.htm"));
|
||||||
//html->SetPage("<html><body>Hello, world!</body></html>");
|
//html->SetPage("<html><body>Hello, world!</body></html>");
|
||||||
html->SetPage(htmlaboutpage);
|
html->SetPage(htmlaboutpage);
|
||||||
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
|
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
|
||||||
html->GetInternalRepresentation()->GetHeight());
|
html->GetInternalRepresentation()->GetHeight());
|
||||||
|
|
||||||
topsizer->Add(html, 1, wxALL, 10);
|
topsizer->Add(html, 1, wxALL, 10);
|
||||||
|
|
||||||
topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||||
|
|
||||||
wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK"));
|
wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK"));
|
||||||
bu1->SetDefault();
|
bu1->SetDefault();
|
||||||
|
|
||||||
topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
|
topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
|
||||||
|
|
||||||
dlg.SetSizer(topsizer);
|
dlg.SetSizer(topsizer);
|
||||||
topsizer->Fit(&dlg);
|
topsizer->Fit(&dlg);
|
||||||
|
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
wxMessageBox(wxString::Format(OPJ_APPLICATION_TITLEBAR
|
wxMessageBox(wxString::Format(OPJ_APPLICATION_TITLEBAR
|
||||||
wxT("\n\n")
|
wxT("\n\n")
|
||||||
wxT("Built with %s and OpenJPEG ")
|
wxT("Built with %s and OpenJPEG ")
|
||||||
wxT(OPENJPEG_VERSION)
|
wxT(OPENJPEG_VERSION)
|
||||||
wxT("\non ") wxT(__DATE__) wxT(", ") wxT(__TIME__)
|
wxT("\non ") wxT(__DATE__) wxT(", ") wxT(__TIME__)
|
||||||
wxT("\nRunning under %s\n\n")
|
wxT("\nRunning under %s\n\n")
|
||||||
OPJ_APPLICATION_COPYRIGHT,
|
OPJ_APPLICATION_COPYRIGHT,
|
||||||
wxVERSION_STRING,
|
wxVERSION_STRING,
|
||||||
wxGetOsDescription().c_str()),
|
wxGetOsDescription().c_str()),
|
||||||
wxT("About ") OPJ_APPLICATION_NAME,
|
wxT("About ") OPJ_APPLICATION_NAME,
|
||||||
wxOK | wxICON_INFORMATION,
|
wxOK | wxICON_INFORMATION,
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *OPJChild16[] = {
|
static char *OPJChild16[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 6 1",
|
"16 16 6 1",
|
||||||
" c black",
|
" c black",
|
||||||
". c #008000",
|
". c #008000",
|
||||||
"X c red",
|
"X c red",
|
||||||
"o c #800080",
|
"o c #800080",
|
||||||
"O c gray100",
|
"O c gray100",
|
||||||
"+ c None",
|
"+ c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"++++++++++++++++",
|
"++++++++++++++++",
|
||||||
"+OOOOOOOOOOOOOO+",
|
"+OOOOOOOOOOOOOO+",
|
||||||
"+OooooooooooooO+",
|
"+OooooooooooooO+",
|
||||||
"+OooooooooooooO+",
|
"+OooooooooooooO+",
|
||||||
"+OooOOOOOOOOOoO+",
|
"+OooOOOOOOOOOoO+",
|
||||||
"+OooO.......OoO+",
|
"+OooO.......OoO+",
|
||||||
"+OooO.......OoO+",
|
"+OooO.......OoO+",
|
||||||
"+OooO..OOO..OoO+",
|
"+OooO..OOO..OoO+",
|
||||||
"+OooO..OXO..OoO+",
|
"+OooO..OXO..OoO+",
|
||||||
"+OooO..OOO..OoO+",
|
"+OooO..OOO..OoO+",
|
||||||
"+OooO.......OoO+",
|
"+OooO.......OoO+",
|
||||||
"+OooO.......OoO+",
|
"+OooO.......OoO+",
|
||||||
"+OooOOOOOOOOOoO+",
|
"+OooOOOOOOOOOoO+",
|
||||||
"+OooooooooooooO+",
|
"+OooooooooooooO+",
|
||||||
"+OOOOOOOOOOOOOO+",
|
"+OOOOOOOOOOOOOO+",
|
||||||
"++++++++++++++++"
|
"++++++++++++++++"
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
|||||||
OPJChild16 ICON OPJChild.ico
|
OPJChild16 ICON OPJChild.ico
|
||||||
OPJViewer16 ICON OPJViewer.ico
|
OPJViewer16 ICON OPJViewer.ico
|
||||||
#include "wx/msw/wx.rc"
|
#include "wx/msw/wx.rc"
|
||||||
@@ -1,26 +1,26 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *OPJViewer16[] = {
|
static char *OPJViewer16[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"16 16 4 1",
|
"16 16 4 1",
|
||||||
" c black",
|
" c black",
|
||||||
". c #800000",
|
". c #800000",
|
||||||
"X c red",
|
"X c red",
|
||||||
"o c None",
|
"o c None",
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"oooooooooooooooo",
|
"oooooooooooooooo",
|
||||||
"ooo.XXXXoooooooo",
|
"ooo.XXXXoooooooo",
|
||||||
"ooXXoo .Xooooooo",
|
"ooXXoo .Xooooooo",
|
||||||
"o..oooo .ooooooo",
|
"o..oooo .ooooooo",
|
||||||
"oX.oooo ooooooo",
|
"oX.oooo ooooooo",
|
||||||
"oX.oooo .ooooooo",
|
"oX.oooo .ooooooo",
|
||||||
"oXXoooo .ooooooo",
|
"oXXoooo .ooooooo",
|
||||||
"o.XXoo .oooooooo",
|
"o.XXoo .oooooooo",
|
||||||
"oo.XXXXooooooooo",
|
"oo.XXXXooooooooo",
|
||||||
"ooooooooo.Xo .oo",
|
"ooooooooo.Xo .oo",
|
||||||
"ooooooooo X. ooo",
|
"ooooooooo X. ooo",
|
||||||
"oooooooooo...ooo",
|
"oooooooooo...ooo",
|
||||||
"oooooooooo XXooo",
|
"oooooooooo XXooo",
|
||||||
"oooooooooo .Xooo",
|
"oooooooooo .Xooo",
|
||||||
"oooooooooooooooo",
|
"oooooooooooooooo",
|
||||||
"oooooooooooooooo"
|
"oooooooooooooooo"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,54 +1,54 @@
|
|||||||
wxString htmlaboutpage = wxT(
|
wxString htmlaboutpage = wxT(
|
||||||
"<html>"
|
"<html>"
|
||||||
"<body bgcolor=#FFFFFF>"
|
"<body bgcolor=#FFFFFF>"
|
||||||
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
|
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
|
||||||
"<tr>"
|
"<tr>"
|
||||||
"<td rowspan=3 valign=top align=center width=70>"
|
"<td rowspan=3 valign=top align=center width=70>"
|
||||||
"<img src=\"memory:opj_logo.xpm\"><br><br>"
|
"<img src=\"memory:opj_logo.xpm\"><br><br>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"<td align=center>"
|
"<td align=center>"
|
||||||
"<font size=+0 color=#000000><b>"
|
"<font size=+0 color=#000000><b>"
|
||||||
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
||||||
"</b></font><br>"
|
"</b></font><br>"
|
||||||
"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
|
"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
|
||||||
"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
|
"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
|
||||||
"</td>"
|
"</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"<tr height=3 valign=center>"
|
"<tr height=3 valign=center>"
|
||||||
"<td valign=center bgcolor=#cc3300></td>"
|
"<td valign=center bgcolor=#cc3300></td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"<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>"
|
||||||
"<p><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></p><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 " (")
|
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
wxT("<font size=-2 color=green>JPWL</font> ")
|
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>JPSEC</font> ")
|
wxT("<font size=-2 color=green>JPSEC</font> ")
|
||||||
#endif // USE_JPSEC
|
#endif // USE_JPSEC
|
||||||
wxT(")</font><br>")
|
wxT(")</font><br>")
|
||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
|
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
|
||||||
#endif // USE_MXF
|
#endif // USE_MXF
|
||||||
wxT("</td>"
|
wxT("</td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"<tr>"
|
"<tr>"
|
||||||
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
|
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
|
||||||
"</tr>"
|
"</tr>"
|
||||||
"<tr>"
|
"<tr>"
|
||||||
"<td colspan=2>"
|
"<td colspan=2>"
|
||||||
"<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>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 © 2007-2008 <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>"
|
||||||
"</body>"
|
"</body>"
|
||||||
"</html>"
|
"</html>"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
wxT("491")
|
wxT("491")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *icon1_xpm[] = {
|
static const char *icon1_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"32 32 41 1",
|
"32 32 41 1",
|
||||||
"> c #97C4E7",
|
"> c #97C4E7",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *icon2_xpm[] = {
|
static const char *icon2_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"32 32 15 1",
|
"32 32 15 1",
|
||||||
". c Black",
|
". c Black",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *icon3_xpm[] = {
|
static const char *icon3_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"32 32 41 1",
|
"32 32 41 1",
|
||||||
"6 c #EDF2FB",
|
"6 c #EDF2FB",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *icon4_xpm[] = {
|
static const char *icon4_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"32 32 5 1",
|
"32 32 5 1",
|
||||||
". c Black",
|
". c Black",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *icon5_xpm[] = {
|
static const char *icon5_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"32 32 41 1",
|
"32 32 41 1",
|
||||||
"0 c #AAC1E8",
|
"0 c #AAC1E8",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,177 +1,177 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: imagalljpeg2000.h
|
// Name: imagalljpeg2000.h
|
||||||
// Purpose: wxImage JPEG 2000 family file format 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: imagalljpeg2000.h,v 0.0 2008/01/31 11:22: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_IMAGJPEG2000_H_
|
#ifndef _WX_IMAGJPEG2000_H_
|
||||||
#define _WX_IMAGJPEG2000_H_
|
#define _WX_IMAGJPEG2000_H_
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxJPEG2000Handler
|
// wxJPEG2000Handler
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_LIBOPENJPEG
|
#if wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "libopenjpeg/openjpeg.h"
|
#include "libopenjpeg/openjpeg.h"
|
||||||
#include "codec/index.h"
|
#include "codec/index.h"
|
||||||
|
|
||||||
#define wxBITMAP_TYPE_JPEG2000 50
|
#define wxBITMAP_TYPE_JPEG2000 50
|
||||||
|
|
||||||
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
|
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline wxJPEG2000Handler()
|
inline wxJPEG2000Handler()
|
||||||
{
|
{
|
||||||
m_name = wxT("JPEG 2000 family file format");
|
m_name = wxT("JPEG 2000 family file format");
|
||||||
m_extension = wxT("mj2");
|
m_extension = wxT("mj2");
|
||||||
m_type = wxBITMAP_TYPE_JPEG2000;
|
m_type = wxBITMAP_TYPE_JPEG2000;
|
||||||
m_mime = wxT("image/mj2");
|
m_mime = wxT("image/mj2");
|
||||||
|
|
||||||
/* decoding */
|
/* decoding */
|
||||||
m_reducefactor = 0;
|
m_reducefactor = 0;
|
||||||
m_qualitylayers = 0;
|
m_qualitylayers = 0;
|
||||||
m_components = 0;
|
m_components = 0;
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
m_enablejpwl = true;
|
m_enablejpwl = true;
|
||||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
|
|
||||||
/* encoding */
|
/* encoding */
|
||||||
m_subsampling = wxT("1,1");
|
m_subsampling = wxT("1,1");
|
||||||
m_origin = wxT("0,0");
|
m_origin = wxT("0,0");
|
||||||
m_rates = wxT("20,10,5");
|
m_rates = wxT("20,10,5");
|
||||||
m_quality = wxT("30,35,40");
|
m_quality = wxT("30,35,40");
|
||||||
m_enablequality = false;
|
m_enablequality = false;
|
||||||
m_multicomp = false;
|
m_multicomp = false;
|
||||||
m_irreversible = false;
|
m_irreversible = false;
|
||||||
m_resolutions = 6;
|
m_resolutions = 6;
|
||||||
m_progression = 0;
|
m_progression = 0;
|
||||||
m_cbsize = wxT("32,32");
|
m_cbsize = wxT("32,32");
|
||||||
m_prsize = wxT("[128,128],[128,128]");
|
m_prsize = wxT("[128,128],[128,128]");
|
||||||
m_tsize = wxT("");
|
m_tsize = wxT("");
|
||||||
m_torigin = wxT("0,0");
|
m_torigin = wxT("0,0");
|
||||||
/*m_progression
|
/*m_progression
|
||||||
m_resilience*/
|
m_resilience*/
|
||||||
m_enablesop = false;
|
m_enablesop = false;
|
||||||
m_enableeph = false;
|
m_enableeph = false;
|
||||||
m_enablereset = false;
|
m_enablereset = false;
|
||||||
m_enablesegmark = false;
|
m_enablesegmark = false;
|
||||||
m_enablevsc = false;
|
m_enablevsc = false;
|
||||||
m_enablerestart = false;
|
m_enablerestart = false;
|
||||||
m_enableerterm = false;
|
m_enableerterm = false;
|
||||||
m_enablebypass = false;
|
m_enablebypass = false;
|
||||||
/*m_roicompo
|
/*m_roicompo
|
||||||
m_roiup
|
m_roiup
|
||||||
m_indexfname*/
|
m_indexfname*/
|
||||||
m_enableidx = false;
|
m_enableidx = false;
|
||||||
m_index = wxT("index.txt");
|
m_index = wxT("index.txt");
|
||||||
m_enablepoc = false;
|
m_enablepoc = false;
|
||||||
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
|
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
|
||||||
m_enablecomm = true;
|
m_enablecomm = true;
|
||||||
|
|
||||||
#if defined __WXMSW__
|
#if defined __WXMSW__
|
||||||
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
|
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
|
||||||
#elif defined __WXGTK__
|
#elif defined __WXGTK__
|
||||||
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
|
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
|
||||||
#else
|
#else
|
||||||
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
|
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||||
#else
|
#else
|
||||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// decoding engine parameters
|
// decoding engine parameters
|
||||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
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;
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
|
|
||||||
// encoding engine parameters
|
// encoding engine parameters
|
||||||
wxString m_subsampling;
|
wxString m_subsampling;
|
||||||
wxString m_origin;
|
wxString m_origin;
|
||||||
wxString m_rates;
|
wxString m_rates;
|
||||||
wxString m_quality;
|
wxString m_quality;
|
||||||
bool m_enablequality;
|
bool m_enablequality;
|
||||||
bool m_multicomp;
|
bool m_multicomp;
|
||||||
bool m_irreversible;
|
bool m_irreversible;
|
||||||
int m_resolutions;
|
int m_resolutions;
|
||||||
int m_progression;
|
int m_progression;
|
||||||
wxString m_cbsize;
|
wxString m_cbsize;
|
||||||
wxString m_prsize;
|
wxString m_prsize;
|
||||||
wxString m_tsize;
|
wxString m_tsize;
|
||||||
wxString m_torigin;
|
wxString m_torigin;
|
||||||
/*m_progression
|
/*m_progression
|
||||||
m_resilience*/
|
m_resilience*/
|
||||||
bool m_enablesop;
|
bool m_enablesop;
|
||||||
bool m_enableeph;
|
bool m_enableeph;
|
||||||
bool m_enablebypass;
|
bool m_enablebypass;
|
||||||
bool m_enableerterm;
|
bool m_enableerterm;
|
||||||
bool m_enablerestart;
|
bool m_enablerestart;
|
||||||
bool m_enablereset;
|
bool m_enablereset;
|
||||||
bool m_enablesegmark;
|
bool m_enablesegmark;
|
||||||
bool m_enablevsc;
|
bool m_enablevsc;
|
||||||
/*m_roicompo
|
/*m_roicompo
|
||||||
m_roiup
|
m_roiup
|
||||||
m_indexfname*/
|
m_indexfname*/
|
||||||
bool m_enableidx;
|
bool m_enableidx;
|
||||||
wxString m_index;
|
wxString m_index;
|
||||||
bool m_enablecomm;
|
bool m_enablecomm;
|
||||||
wxString m_comment;
|
wxString m_comment;
|
||||||
bool m_enablepoc;
|
bool m_enablepoc;
|
||||||
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(wxJPEG2000Handler)
|
DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
#endif // _WX_IMAGJPEG2000_H_
|
#endif // _WX_IMAGJPEG2000_H_
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,99 +1,99 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: imagmxf.h
|
// Name: imagmxf.h
|
||||||
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
|
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
|
||||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||||
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/11/19 17:00:00 VZ Exp $
|
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/11/19 17:00:00 VZ Exp $
|
||||||
// Copyright: (c) Giuseppe Baruffa
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_IMAGMXF_H_
|
#ifndef _WX_IMAGMXF_H_
|
||||||
#define _WX_IMAGMXF_H_
|
#define _WX_IMAGMXF_H_
|
||||||
|
|
||||||
#ifdef USE_MXF
|
#ifdef USE_MXF
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxMXFHandler
|
// wxMXFHandler
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_LIBOPENJPEG
|
#if wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
#include "libopenjpeg/openjpeg.h"
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
#define wxBITMAP_TYPE_MXF 51
|
#define wxBITMAP_TYPE_MXF 51
|
||||||
|
|
||||||
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline wxMXFHandler()
|
inline wxMXFHandler()
|
||||||
{
|
{
|
||||||
m_name = wxT("MXF JPEG 2000 file format");
|
m_name = wxT("MXF JPEG 2000 file format");
|
||||||
m_extension = wxT("mxf");
|
m_extension = wxT("mxf");
|
||||||
m_type = wxBITMAP_TYPE_MXF;
|
m_type = wxBITMAP_TYPE_MXF;
|
||||||
m_mime = wxT("image/mxf");
|
m_mime = wxT("image/mxf");
|
||||||
|
|
||||||
m_reducefactor = 0;
|
m_reducefactor = 0;
|
||||||
m_qualitylayers = 0;
|
m_qualitylayers = 0;
|
||||||
m_components = 0;
|
m_components = 0;
|
||||||
m_filename = wxT("");
|
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;
|
||||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
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;
|
||||||
#endif // USE_JPWL
|
#endif // USE_JPWL
|
||||||
|
|
||||||
#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:
|
||||||
DECLARE_DYNAMIC_CLASS(wxMXFHandler)
|
DECLARE_DYNAMIC_CLASS(wxMXFHandler)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_LIBOPENJPEG
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
#endif // USE_MXF
|
#endif // USE_MXF
|
||||||
|
|
||||||
#endif // _WX_IMAGMXF_H_
|
#endif // _WX_IMAGMXF_H_
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
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) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met:
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met:
|
||||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
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.
|
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.
|
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.
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
This viewer is conceived to open and display information and image content of J2K, JP2,
|
This viewer is conceived to open and display information and image content of J2K, JP2,
|
||||||
and MJ2 files.
|
and MJ2 files.
|
||||||
The viewer application interface is divided into three main panels:
|
The viewer application interface is divided into three main panels:
|
||||||
- a browsing pane;
|
- a browsing pane;
|
||||||
- a viewing pane;
|
- a viewing pane;
|
||||||
- a log/peek pane.
|
- a log/peek pane.
|
||||||
|
|
||||||
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
||||||
|
|
||||||
filename
|
filename
|
||||||
|
|
|
|
||||||
|_ #000: Marker/Box short name (Hex code)
|
|_ #000: Marker/Box short name (Hex code)
|
||||||
| |
|
| |
|
||||||
| |_ *** Marker/Box long name ***
|
| |_ *** Marker/Box long name ***
|
||||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||||
| |_ Additional info, depending on the marker/box type
|
| |_ Additional info, depending on the marker/box type
|
||||||
| |_ ...
|
| |_ ...
|
||||||
|
|
|
|
||||||
|_ #001: Marker/Box short name (Hex code)
|
|_ #001: Marker/Box short name (Hex code)
|
||||||
| |
|
| |
|
||||||
| |_ ...
|
| |_ ...
|
||||||
|
|
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
||||||
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
||||||
|
|
||||||
|
|
||||||
The log/peek pane is shared among two different subpanels:
|
The log/peek pane is shared among two different subpanels:
|
||||||
|
|
||||||
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
||||||
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
What is OpenJPEG ?
|
What is OpenJPEG ?
|
||||||
==================
|
==================
|
||||||
The OpenJPEG library is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, the new still-image compression standard from the Joint Photographic Experts Group (JPEG). In addition to the basic codec, various other features are under development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool useful for the JPIP protocol, JPWL-tools for error-resilience, a Java-viewer for j2k-images, ...
|
The OpenJPEG library is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, the new still-image compression standard from the Joint Photographic Experts Group (JPEG). In addition to the basic codec, various other features are under development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool useful for the JPIP protocol, JPWL-tools for error-resilience, a Java-viewer for j2k-images, ...
|
||||||
|
|
||||||
Who can use the library ?
|
Who can use the library ?
|
||||||
=========================
|
=========================
|
||||||
Anybody. As the OpenJPEG library is released under the BSD license, anybody can use or modify the library, even for commercial applications. The only restriction is to retain the copyright in the sources or the binaries documentation.
|
Anybody. As the OpenJPEG library is released under the BSD license, anybody can use or modify the library, even for commercial applications. The only restriction is to retain the copyright in the sources or the binaries documentation.
|
||||||
|
|
||||||
Who is developing the library ?
|
Who is developing the library ?
|
||||||
===============================
|
===============================
|
||||||
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Universit<69> Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Universit<69> Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,16 @@
|
|||||||
# 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}/applications/common/color.c
|
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
||||||
)
|
|
||||||
|
|
||||||
# If not getopt was found then add it to the lib:
|
|
||||||
IF(DONT_HAVE_GETOPT)
|
|
||||||
SET(common_SRCS
|
|
||||||
${common_SRCS}
|
|
||||||
${OPENJPEG_SOURCE_DIR}/applications/common/getopt.c
|
|
||||||
)
|
)
|
||||||
ENDIF(DONT_HAVE_GETOPT)
|
if(NOT USE_SYSTEM_GETOPT)
|
||||||
|
list(APPEND common_SRCS
|
||||||
|
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Headers file are located here:
|
# Headers file are located here:
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
@@ -37,15 +34,15 @@ ENDIF(WIN32)
|
|||||||
FOREACH(exe j2k_to_image image_to_j2k j2k_dump)
|
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} ${OPENJPEG_LIBRARY_NAME}
|
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}
|
||||||
${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
|
||||||
|
)
|
||||||
|
# To support universal exe:
|
||||||
|
IF(ZLIB_FOUND AND APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} z)
|
||||||
|
ELSe(ZLIB_FOUND AND APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} ${Z_LIBNAME})
|
||||||
|
ENDIF(ZLIB_FOUND AND APPLE)
|
||||||
|
|
||||||
IF(LCMS_FOUND OR LCMS2_FOUND)
|
|
||||||
TARGET_LINK_LIBRARIES(${exe} ${LCMS_LIBNAME})
|
|
||||||
ENDIF(LCMS_FOUND OR LCMS2_FOUND)
|
|
||||||
|
|
||||||
ADD_TEST(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
|
|
||||||
# calling those exe without option will make them fail always:
|
|
||||||
SET_TESTS_PROPERTIES(${exe} PROPERTIES WILL_FAIL TRUE)
|
|
||||||
# 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} m)
|
TARGET_LINK_LIBRARIES(${exe} m)
|
||||||
@@ -77,7 +74,14 @@ IF(BUILD_JPWL)
|
|||||||
)
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
|
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
|
||||||
${LCMS_LIBNAME} ${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||||
|
|
||||||
|
# To support universal exe:
|
||||||
|
IF(ZLIB_FOUND AND APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image z)
|
||||||
|
ELSe(ZLIB_FOUND AND APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${Z_LIBNAME})
|
||||||
|
ENDIF(ZLIB_FOUND AND APPLE)
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
|
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
|
||||||
@@ -94,7 +98,14 @@ IF(BUILD_JPWL)
|
|||||||
)
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL
|
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL
|
||||||
${LCMS_LIBNAME} ${Z_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||||
|
|
||||||
|
# To support universal exe:
|
||||||
|
IF(ZLIB_FOUND AND APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k z)
|
||||||
|
ELSe(ZLIB_FOUND AND APPLE)
|
||||||
|
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${Z_LIBNAME})
|
||||||
|
ENDIF(ZLIB_FOUND AND APPLE)
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
|
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
|
||||||
@@ -104,39 +115,3 @@ IF(BUILD_JPWL)
|
|||||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||||
)
|
)
|
||||||
ENDIF(BUILD_JPWL)
|
ENDIF(BUILD_JPWL)
|
||||||
|
|
||||||
if(BUILD_TESTING)
|
|
||||||
# Do testing here, once we know the examples are being built:
|
|
||||||
FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
|
|
||||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2k"
|
|
||||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2c"
|
|
||||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.jp2"
|
|
||||||
)
|
|
||||||
|
|
||||||
foreach(filename ${OPENJPEG_DATA_IMAGES_GLOB})
|
|
||||||
get_filename_component(filename_temp ${filename} NAME)
|
|
||||||
get_filename_component(filename_ext ${filename} EXT)
|
|
||||||
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})
|
|
||||||
endforeach(codec_type)
|
|
||||||
foreach(codec_type ppm bmp tif tga png)
|
|
||||||
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})
|
|
||||||
SET_TESTS_PROPERTIES(i2j-${filename_temp}-${codec_type} PROPERTIES DEPENDS j2i-${filename_temp}-${codec_type})
|
|
||||||
#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)
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ j2k_to_image_CFLAGS =
|
|||||||
j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||||
j2k_to_image_SOURCES = \
|
j2k_to_image_SOURCES = \
|
||||||
../common/color.c \
|
../common/color.c \
|
||||||
../common/getopt.c \
|
../common/opj_getopt.c \
|
||||||
convert.c \
|
convert.c \
|
||||||
index.c \
|
index.c \
|
||||||
j2k_to_image.c \
|
j2k_to_image.c \
|
||||||
@@ -41,7 +41,7 @@ image_to_j2k_CPPFLAGS = \
|
|||||||
image_to_j2k_CFLAGS =
|
image_to_j2k_CFLAGS =
|
||||||
image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||||
image_to_j2k_SOURCES = \
|
image_to_j2k_SOURCES = \
|
||||||
../common/getopt.c \
|
../common/opj_getopt.c \
|
||||||
convert.c \
|
convert.c \
|
||||||
index.c \
|
index.c \
|
||||||
image_to_j2k.c \
|
image_to_j2k.c \
|
||||||
@@ -60,10 +60,10 @@ j2k_dump_CPPFLAGS = \
|
|||||||
j2k_dump_CFLAGS =
|
j2k_dump_CFLAGS =
|
||||||
j2k_dump_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
j2k_dump_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
||||||
j2k_dump_SOURCES = \
|
j2k_dump_SOURCES = \
|
||||||
../common/getopt.c \
|
../common/opj_getopt.c \
|
||||||
index.c \
|
index.c \
|
||||||
j2k_dump.c \
|
j2k_dump.c \
|
||||||
../common/getopt.h \
|
../common/opj_getopt.h \
|
||||||
index.h
|
index.h
|
||||||
|
|
||||||
JPWL_j2k_to_image_CPPFLAGS = \
|
JPWL_j2k_to_image_CPPFLAGS = \
|
||||||
@@ -78,10 +78,10 @@ JPWL_j2k_to_image_CPPFLAGS = \
|
|||||||
@LCMS1_CFLAGS@ \
|
@LCMS1_CFLAGS@ \
|
||||||
@LCMS2_CFLAGS@
|
@LCMS2_CFLAGS@
|
||||||
JPWL_j2k_to_image_CFLAGS =
|
JPWL_j2k_to_image_CFLAGS =
|
||||||
JPWL_j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@
|
JPWL_j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||||
JPWL_j2k_to_image_SOURCES = \
|
JPWL_j2k_to_image_SOURCES = \
|
||||||
../common/color.c \
|
../common/color.c \
|
||||||
../common/getopt.c \
|
../common/opj_getopt.c \
|
||||||
index.c \
|
index.c \
|
||||||
convert.c \
|
convert.c \
|
||||||
j2k_to_image.c
|
j2k_to_image.c
|
||||||
@@ -96,10 +96,10 @@ JPWL_image_to_j2k_CPPFLAGS = \
|
|||||||
@TIFF_CFLAGS@ \
|
@TIFF_CFLAGS@ \
|
||||||
@PNG_CFLAGS@
|
@PNG_CFLAGS@
|
||||||
JPWL_image_to_j2k_CFLAGS =
|
JPWL_image_to_j2k_CFLAGS =
|
||||||
JPWL_image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @TIFF_LIBS@ @PNG_LIBS@
|
JPWL_image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||||
|
|
||||||
JPWL_image_to_j2k_SOURCES = \
|
JPWL_image_to_j2k_SOURCES = \
|
||||||
..//common/getopt.c \
|
../common/opj_getopt.c \
|
||||||
index.c \
|
index.c \
|
||||||
convert.c \
|
convert.c \
|
||||||
image_to_j2k.c
|
image_to_j2k.c
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
#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
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
#include "opj_config.h"
|
#include "opj_config.h"
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "getopt.h"
|
#include "opj_getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ typedef struct img_folder{
|
|||||||
float *rates;
|
float *rates;
|
||||||
}img_fol_t;
|
}img_fol_t;
|
||||||
|
|
||||||
void encode_help_display() {
|
static void encode_help_display(void) {
|
||||||
fprintf(stdout,"HELP for image_to_j2k\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");
|
||||||
|
|
||||||
@@ -193,6 +193,8 @@ void encode_help_display() {
|
|||||||
fprintf(stdout," Indicate multiple modes by adding their values. \n");
|
fprintf(stdout," Indicate multiple modes by adding their values. \n");
|
||||||
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
|
fprintf(stdout," ex: RESTART(4) + RESET(2) + SEGMARK(32) = -M 38\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-TP : devide packets of every tile into tile-parts (-TP R) [R, L, C]\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
|
fprintf(stdout,"-x : create an index file *.Idx (-x index_name.Idx) \n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
fprintf(stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n");
|
fprintf(stdout,"-ROI : c=%%d,U=%%d : quantization indices upshifted \n");
|
||||||
@@ -209,6 +211,9 @@ void encode_help_display() {
|
|||||||
fprintf(stdout," -F rawWidth,rawHeight,rawComp,rawBitDepth,s/u (Signed/Unsigned)\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," Example: -i lena.raw -o lena.j2k -F 512,512,3,8,u\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"-jpip : write jpip codestream index box in JP2 output file\n");
|
||||||
|
fprintf(stdout," NOTICE: currently supports only RPCL order\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");
|
||||||
@@ -316,7 +321,7 @@ void encode_help_display() {
|
|||||||
fprintf(stdout,"TotalDisto\n\n");
|
fprintf(stdout,"TotalDisto\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
OPJ_PROG_ORDER give_progression(char progression[4]) {
|
static OPJ_PROG_ORDER give_progression(char progression[4]) {
|
||||||
if(strncmp(progression, "LRCP", 4) == 0) {
|
if(strncmp(progression, "LRCP", 4) == 0) {
|
||||||
return LRCP;
|
return LRCP;
|
||||||
}
|
}
|
||||||
@@ -336,7 +341,7 @@ OPJ_PROG_ORDER give_progression(char progression[4]) {
|
|||||||
return PROG_UNKNOWN;
|
return PROG_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_num_images(char *imgdirpath){
|
static int get_num_images(char *imgdirpath){
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent* content;
|
struct dirent* content;
|
||||||
int num_images = 0;
|
int num_images = 0;
|
||||||
@@ -355,10 +360,11 @@ int get_num_images(char *imgdirpath){
|
|||||||
continue;
|
continue;
|
||||||
num_images++;
|
num_images++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return num_images;
|
return num_images;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent* content;
|
struct dirent* content;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -380,10 +386,11 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
|
|||||||
strcpy(dirptr->filename[i],content->d_name);
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_file_format(char *filename) {
|
static int get_file_format(char *filename) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
static const char *extension[] = {
|
static const char *extension[] = {
|
||||||
"pgx", "pnm", "pgm", "ppm", "pbm", "pam", "bmp", "tif", "raw", "tga", "png", "j2k", "jp2", "j2c", "jpc"
|
"pgx", "pnm", "pgm", "ppm", "pbm", "pam", "bmp", "tif", "raw", "tga", "png", "j2k", "jp2", "j2c", "jpc"
|
||||||
@@ -403,14 +410,13 @@ int get_file_format(char *filename) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * get_file_name(char *name){
|
static char * get_file_name(char *name){
|
||||||
char *fname;
|
char *fname;
|
||||||
fname= (char*)malloc(OPJ_PATH_LEN*sizeof(char));
|
|
||||||
fname= strtok(name,".");
|
fname= strtok(name,".");
|
||||||
return fname;
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparameters_t *parameters){
|
static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparameters_t *parameters){
|
||||||
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
char 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]="";
|
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||||
|
|
||||||
@@ -422,7 +428,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparamet
|
|||||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||||
|
|
||||||
//Set output file
|
/*Set output file*/
|
||||||
strcpy(temp_ofname,get_file_name(image_filename));
|
strcpy(temp_ofname,get_file_name(image_filename));
|
||||||
while((temp_p = strtok(NULL,".")) != NULL){
|
while((temp_p = strtok(NULL,".")) != NULL){
|
||||||
strcat(temp_ofname,temp1);
|
strcat(temp_ofname,temp1);
|
||||||
@@ -453,7 +459,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cinema_parameters(opj_cparameters_t *parameters){
|
static void cinema_parameters(opj_cparameters_t *parameters){
|
||||||
parameters->tile_size_on = OPJ_FALSE;
|
parameters->tile_size_on = OPJ_FALSE;
|
||||||
parameters->cp_tdx=1;
|
parameters->cp_tdx=1;
|
||||||
parameters->cp_tdy=1;
|
parameters->cp_tdy=1;
|
||||||
@@ -486,7 +492,7 @@ void cinema_parameters(opj_cparameters_t *parameters){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
|
static 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;
|
||||||
|
|
||||||
@@ -571,40 +577,46 @@ void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||||
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
|
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
|
||||||
int i, j,totlen;
|
int i, j, totlen, c;
|
||||||
option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"cinema2K",REQ_ARG, NULL ,'w'},
|
{"cinema2K",REQ_ARG, NULL ,'w'},
|
||||||
{"cinema4K",NO_ARG, NULL ,'y'},
|
{"cinema4K",NO_ARG, NULL ,'y'},
|
||||||
{"ImgDir",REQ_ARG, NULL ,'z'},
|
{"ImgDir",REQ_ARG, NULL ,'z'},
|
||||||
{"TP",REQ_ARG, NULL ,'v'},
|
{"TP",REQ_ARG, NULL ,'u'},
|
||||||
{"SOP",NO_ARG, NULL ,'S'},
|
{"SOP",NO_ARG, NULL ,'S'},
|
||||||
{"EPH",NO_ARG, NULL ,'E'},
|
{"EPH",NO_ARG, NULL ,'E'},
|
||||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
{"POC",REQ_ARG, NULL ,'P'},
|
{"POC",REQ_ARG, NULL ,'P'},
|
||||||
{"ROI",REQ_ARG, NULL ,'R'},
|
{"ROI",REQ_ARG, NULL ,'R'},
|
||||||
|
{"jpip",NO_ARG, NULL, 'J'},
|
||||||
|
{0,0,0,0} /* GNU getopt_long requirement */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
const char optlist[] = "i:o:r: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:u:J"
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
"W:"
|
"W:"
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
"h";
|
"h";
|
||||||
|
|
||||||
totlen=sizeof(long_option);
|
totlen=sizeof(long_option)-1;
|
||||||
img_fol->set_out_format=0;
|
img_fol->set_out_format=0;
|
||||||
raw_cp->rawWidth = 0;
|
raw_cp->rawWidth = 0;
|
||||||
|
|
||||||
while (1) {
|
do{
|
||||||
int c = getopt_long(argc, argv, optlist,long_option,totlen);
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
c = opj_getopt_long(argc, argv, optlist,long_option,0);
|
||||||
|
#else
|
||||||
|
c = opj_getopt_long(argc, argv, optlist,long_option,totlen);
|
||||||
|
#endif
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i': /* input file */
|
case 'i': /* input file */
|
||||||
{
|
{
|
||||||
char *infile = optarg;
|
char *infile = opj_optarg;
|
||||||
parameters->decod_format = get_file_format(infile);
|
parameters->decod_format = get_file_format(infile);
|
||||||
switch(parameters->decod_format) {
|
switch(parameters->decod_format) {
|
||||||
case PGX_DFMT:
|
case PGX_DFMT:
|
||||||
@@ -630,7 +642,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'o': /* output file */
|
case 'o': /* output file */
|
||||||
{
|
{
|
||||||
char *outfile = optarg;
|
char *outfile = opj_optarg;
|
||||||
parameters->cod_format = get_file_format(outfile);
|
parameters->cod_format = get_file_format(outfile);
|
||||||
switch(parameters->cod_format) {
|
switch(parameters->cod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
@@ -648,14 +660,14 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'O': /* output format */
|
case 'O': /* output format */
|
||||||
{
|
{
|
||||||
char outformat[50];
|
char outformat[50];
|
||||||
char *of = optarg;
|
char *of = opj_optarg;
|
||||||
sprintf(outformat,".%s",of);
|
sprintf(outformat,".%s",of);
|
||||||
img_fol->set_out_format = 1;
|
img_fol->set_out_format = 1;
|
||||||
parameters->cod_format = get_file_format(outformat);
|
parameters->cod_format = get_file_format(outformat);
|
||||||
switch(parameters->cod_format) {
|
switch(parameters->cod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
case JP2_CFMT:
|
case JP2_CFMT:
|
||||||
img_fol->out_format = optarg;
|
img_fol->out_format = opj_optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n");
|
fprintf(stderr, "Unknown output format image [only j2k, j2c, jp2]!! \n");
|
||||||
@@ -670,7 +682,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 = opj_optarg;
|
||||||
parameters->tcp_numlayers = 0;
|
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++;
|
||||||
@@ -691,7 +703,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;
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
if (sscanf(s, "%d,%d,%d,%d,%c", &raw_cp->rawWidth, &raw_cp->rawHeight, &raw_cp->rawComp, &raw_cp->rawBitDepth, &signo) == 5) {
|
if (sscanf(s, "%d,%d,%d,%d,%c", &raw_cp->rawWidth, &raw_cp->rawHeight, &raw_cp->rawComp, &raw_cp->rawBitDepth, &signo) == 5) {
|
||||||
if (signo == 's') {
|
if (signo == 's') {
|
||||||
raw_cp->rawSigned = OPJ_TRUE;
|
raw_cp->rawSigned = OPJ_TRUE;
|
||||||
@@ -724,7 +736,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'q': /* add fixed_quality */
|
case 'q': /* add fixed_quality */
|
||||||
{
|
{
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
while (sscanf(s, "%f", ¶meters->tcp_distoratio[parameters->tcp_numlayers]) == 1) {
|
||||||
parameters->tcp_numlayers++;
|
parameters->tcp_numlayers++;
|
||||||
while (*s && *s != ',') {
|
while (*s && *s != ',') {
|
||||||
@@ -746,7 +758,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
int *row = NULL, *col = NULL;
|
int *row = NULL, *col = NULL;
|
||||||
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
int numlayers = 0, numresolution = 0, matrix_width = 0;
|
||||||
|
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
sscanf(s, "%d", &numlayers);
|
sscanf(s, "%d", &numlayers);
|
||||||
s++;
|
s++;
|
||||||
if (numlayers > 9)
|
if (numlayers > 9)
|
||||||
@@ -790,7 +802,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 't': /* tiles */
|
case 't': /* tiles */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
sscanf(opj_optarg, "%d,%d", ¶meters->cp_tdx, ¶meters->cp_tdy);
|
||||||
parameters->tile_size_on = OPJ_TRUE;
|
parameters->tile_size_on = OPJ_TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -799,7 +811,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'n': /* resolution */
|
case 'n': /* resolution */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d", ¶meters->numresolution);
|
sscanf(opj_optarg, "%d", ¶meters->numresolution);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -809,7 +821,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
char sep;
|
char sep;
|
||||||
int res_spec = 0;
|
int res_spec = 0;
|
||||||
|
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
do {
|
do {
|
||||||
sep = 0;
|
sep = 0;
|
||||||
sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec],
|
sscanf(s, "[%d,%d]%c", ¶meters->prcw_init[res_spec],
|
||||||
@@ -828,7 +840,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'b': /* code-block dimension */
|
case 'b': /* code-block dimension */
|
||||||
{
|
{
|
||||||
int cblockw_init = 0, cblockh_init = 0;
|
int cblockw_init = 0, cblockh_init = 0;
|
||||||
sscanf(optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
sscanf(opj_optarg, "%d,%d", &cblockw_init, &cblockh_init);
|
||||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024
|
||||||
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
|| cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@@ -845,7 +857,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'x': /* creation of index file */
|
case 'x': /* creation of index file */
|
||||||
{
|
{
|
||||||
char *index = optarg;
|
char *index = opj_optarg;
|
||||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -856,7 +868,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
{
|
{
|
||||||
char progression[4];
|
char progression[4];
|
||||||
|
|
||||||
strncpy(progression, optarg, 4);
|
strncpy(progression, opj_optarg, 4);
|
||||||
parameters->prog_order = give_progression(progression);
|
parameters->prog_order = give_progression(progression);
|
||||||
if (parameters->prog_order == -1) {
|
if (parameters->prog_order == -1) {
|
||||||
fprintf(stderr, "Unrecognized progression order "
|
fprintf(stderr, "Unrecognized progression order "
|
||||||
@@ -870,7 +882,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 's': /* subsampling factor */
|
case 's': /* subsampling factor */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "%d,%d", ¶meters->subsampling_dx,
|
if (sscanf(opj_optarg, "%d,%d", ¶meters->subsampling_dx,
|
||||||
¶meters->subsampling_dy) != 2) {
|
¶meters->subsampling_dy) != 2) {
|
||||||
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
fprintf(stderr, "'-s' sub-sampling argument error ! [-s dx,dy]\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -882,7 +894,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'd': /* coordonnate of the reference grid */
|
case 'd': /* coordonnate of the reference grid */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "%d,%d", ¶meters->image_offset_x0,
|
if (sscanf(opj_optarg, "%d,%d", ¶meters->image_offset_x0,
|
||||||
¶meters->image_offset_y0) != 2) {
|
¶meters->image_offset_y0) != 2) {
|
||||||
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
fprintf(stderr, "-d 'coordonnate of the reference grid' argument "
|
||||||
"error !! [-d x0,y0]\n");
|
"error !! [-d x0,y0]\n");
|
||||||
@@ -904,7 +916,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
int numpocs = 0; /* number of progression order change (POC) default 0 */
|
||||||
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
opj_poc_t *POC = NULL; /* POC : used in case of Progression order change */
|
||||||
|
|
||||||
char *s = optarg;
|
char *s = opj_optarg;
|
||||||
POC = parameters->POC;
|
POC = parameters->POC;
|
||||||
|
|
||||||
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,
|
||||||
@@ -946,7 +958,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'M': /* Mode switch pas tous au point !! */
|
case 'M': /* Mode switch pas tous au point !! */
|
||||||
{
|
{
|
||||||
int value = 0;
|
int value = 0;
|
||||||
if (sscanf(optarg, "%d", &value) == 1) {
|
if (sscanf(opj_optarg, "%d", &value) == 1) {
|
||||||
for (i = 0; i <= 5; i++) {
|
for (i = 0; i <= 5; i++) {
|
||||||
int cache = value & (1 << i);
|
int cache = value & (1 << i);
|
||||||
if (cache)
|
if (cache)
|
||||||
@@ -960,7 +972,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'R': /* ROI */
|
case 'R': /* ROI */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
if (sscanf(opj_optarg, "c=%d,U=%d", ¶meters->roi_compno,
|
||||||
¶meters->roi_shift) != 2) {
|
¶meters->roi_shift) != 2) {
|
||||||
fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n");
|
fprintf(stderr, "ROI error !! [-ROI c='compno',U='shift']\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -972,7 +984,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'T': /* Tile offset */
|
case 'T': /* Tile offset */
|
||||||
{
|
{
|
||||||
if (sscanf(optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
if (sscanf(opj_optarg, "%d,%d", ¶meters->cp_tx0, ¶meters->cp_ty0) != 2) {
|
||||||
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
fprintf(stderr, "-T 'tile offset' argument error !! [-T X0,Y0]");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -983,9 +995,9 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'C': /* add a comment */
|
case 'C': /* add a comment */
|
||||||
{
|
{
|
||||||
parameters->cp_comment = (char*)malloc(strlen(optarg) + 1);
|
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
if(parameters->cp_comment) {
|
if(parameters->cp_comment) {
|
||||||
strcpy(parameters->cp_comment, optarg);
|
strcpy(parameters->cp_comment, opj_optarg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1001,9 +1013,9 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
case 'v': /* Tile part generation*/
|
case 'u': /* Tile part generation*/
|
||||||
{
|
{
|
||||||
parameters->tp_flag = optarg[0];
|
parameters->tp_flag = opj_optarg[0];
|
||||||
parameters->tp_on = 1;
|
parameters->tp_on = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1012,8 +1024,8 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
|
|
||||||
case 'z': /* Image Directory path */
|
case 'z': /* Image Directory path */
|
||||||
{
|
{
|
||||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
strcpy(img_fol->imgdirpath,optarg);
|
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||||
img_fol->set_imgdir=1;
|
img_fol->set_imgdir=1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1023,7 +1035,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
case 'w': /* Digital Cinema 2K profile compliance*/
|
case 'w': /* Digital Cinema 2K profile compliance*/
|
||||||
{
|
{
|
||||||
int fps=0;
|
int fps=0;
|
||||||
sscanf(optarg,"%d",&fps);
|
sscanf(opj_optarg,"%d",&fps);
|
||||||
if(fps == 24){
|
if(fps == 24){
|
||||||
parameters->cp_cinema = CINEMA2K_24;
|
parameters->cp_cinema = CINEMA2K_24;
|
||||||
}else if(fps == 48 ){
|
}else if(fps == 48 ){
|
||||||
@@ -1067,7 +1079,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
/* search for different protection methods */
|
/* search for different protection methods */
|
||||||
|
|
||||||
/* break the option in comma points and parse the result */
|
/* break the option in comma points and parse the result */
|
||||||
token = strtok(optarg, ",");
|
token = strtok(opj_optarg, ",");
|
||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
|
|
||||||
/* search header error protection method */
|
/* search header error protection method */
|
||||||
@@ -1369,14 +1381,21 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
break;
|
break;
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'J': /* jpip on */
|
||||||
|
{
|
||||||
|
parameters->jpip_on = OPJ_TRUE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
/* ------------------------------------------------------ */
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "ERROR -> Command line not valid\n");
|
fprintf(stderr, "ERROR -> Command line not valid\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}while(c != -1);
|
||||||
|
|
||||||
/* check for possible errors */
|
/* check for possible errors */
|
||||||
if (parameters->cp_cinema){
|
if (parameters->cp_cinema){
|
||||||
@@ -1453,21 +1472,21 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
|||||||
/**
|
/**
|
||||||
sample error callback expecting a FILE* client object
|
sample error callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
void error_callback(const char *msg, void *client_data) {
|
static void error_callback(const char *msg, void *client_data) {
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[ERROR] %s", msg);
|
fprintf(stream, "[ERROR] %s", msg);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
sample warning callback expecting a FILE* client object
|
sample warning callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
void warning_callback(const char *msg, void *client_data) {
|
static void warning_callback(const char *msg, void *client_data) {
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[WARNING] %s", msg);
|
fprintf(stream, "[WARNING] %s", msg);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
sample debug callback expecting a FILE* client object
|
sample debug callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
void info_callback(const char *msg, void *client_data) {
|
static void info_callback(const char *msg, void *client_data) {
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[INFO] %s", msg);
|
fprintf(stream, "[INFO] %s", msg);
|
||||||
}
|
}
|
||||||
@@ -1482,7 +1501,7 @@ int main(int argc, char **argv) {
|
|||||||
opj_image_t *image = NULL;
|
opj_image_t *image = NULL;
|
||||||
int i,num_images;
|
int i,num_images;
|
||||||
int imageno;
|
int imageno;
|
||||||
dircnt_t *dirptr;
|
dircnt_t *dirptr = NULL;
|
||||||
raw_cparameters_t raw_cp;
|
raw_cparameters_t raw_cp;
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||||
@@ -1537,7 +1556,7 @@ int main(int argc, char **argv) {
|
|||||||
num_images=get_num_images(img_fol.imgdirpath);
|
num_images=get_num_images(img_fol.imgdirpath);
|
||||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||||
if(dirptr){
|
if(dirptr){
|
||||||
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); // Stores at max 10 image file names
|
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*));
|
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||||
if(!dirptr->filename_buf){
|
if(!dirptr->filename_buf){
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1668,6 +1687,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (parameters.cod_format == J2K_CFMT) { /* J2K format output */
|
if (parameters.cod_format == J2K_CFMT) { /* J2K format output */
|
||||||
int codestream_length;
|
int codestream_length;
|
||||||
|
size_t res;
|
||||||
opj_cio_t *cio = NULL;
|
opj_cio_t *cio = NULL;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
|
|
||||||
@@ -1685,8 +1705,8 @@ int main(int argc, char **argv) {
|
|||||||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||||
|
|
||||||
/* encode the image */
|
/* encode the image */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
|
bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
|
||||||
else
|
else
|
||||||
bSuccess = opj_encode(cinfo, cio, image, NULL);
|
bSuccess = opj_encode(cinfo, cio, image, NULL);
|
||||||
if (!bSuccess) {
|
if (!bSuccess) {
|
||||||
@@ -1702,7 +1722,11 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stderr, "failed to open %s for writing\n", parameters.outfile);
|
fprintf(stderr, "failed to open %s for writing\n", parameters.outfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fwrite(cio->buffer, 1, codestream_length, f);
|
res = fwrite(cio->buffer, 1, codestream_length, f);
|
||||||
|
if( res < (size_t)codestream_length ) { /* FIXME */
|
||||||
|
fprintf(stderr, "failed to write %d (%s)\n", codestream_length, parameters.outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
fprintf(stderr,"Generated outfile %s\n",parameters.outfile);
|
fprintf(stderr,"Generated outfile %s\n",parameters.outfile);
|
||||||
@@ -1723,11 +1747,13 @@ int main(int argc, char **argv) {
|
|||||||
opj_destroy_cstr_info(&cstr_info);
|
opj_destroy_cstr_info(&cstr_info);
|
||||||
} else { /* JP2 format output */
|
} else { /* JP2 format output */
|
||||||
int codestream_length;
|
int codestream_length;
|
||||||
|
size_t res;
|
||||||
opj_cio_t *cio = NULL;
|
opj_cio_t *cio = NULL;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
|
opj_cinfo_t *cinfo = NULL;
|
||||||
|
|
||||||
/* get a JP2 compressor handle */
|
/* get a JP2 compressor handle */
|
||||||
opj_cinfo_t* cinfo = opj_create_compress(CODEC_JP2);
|
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);
|
||||||
@@ -1740,8 +1766,8 @@ int main(int argc, char **argv) {
|
|||||||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||||
|
|
||||||
/* encode the image */
|
/* encode the image */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename || parameters.jpip_on) /* If need to extract codestream information*/
|
||||||
bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
|
bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
|
||||||
else
|
else
|
||||||
bSuccess = opj_encode(cinfo, cio, image, NULL);
|
bSuccess = opj_encode(cinfo, cio, image, NULL);
|
||||||
if (!bSuccess) {
|
if (!bSuccess) {
|
||||||
@@ -1757,7 +1783,11 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stderr, "failed to open %s for writing\n", parameters.outfile);
|
fprintf(stderr, "failed to open %s for writing\n", parameters.outfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fwrite(cio->buffer, 1, codestream_length, f);
|
res = fwrite(cio->buffer, 1, codestream_length, f);
|
||||||
|
if( res < (size_t)codestream_length ) { /* FIXME */
|
||||||
|
fprintf(stderr, "failed to write %d (%s)\n", codestream_length, parameters.outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
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 */
|
||||||
|
|||||||
@@ -1,391 +1,391 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* 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 <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------------------ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write a structured index to a file
|
Write a structured index to a file
|
||||||
@param cstr_info Codestream information
|
@param cstr_info Codestream information
|
||||||
@param index Index filename
|
@param index Index filename
|
||||||
@return Returns 0 if successful, returns 1 otherwise
|
@return Returns 0 if successful, returns 1 otherwise
|
||||||
*/
|
*/
|
||||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||||
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
||||||
FILE *stream = NULL;
|
FILE *stream = NULL;
|
||||||
double total_disto = 0;
|
double total_disto = 0;
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
int tilepartno;
|
int tilepartno;
|
||||||
char disto_on, numpix_on;
|
char disto_on, numpix_on;
|
||||||
|
|
||||||
#ifdef USE_JPWL
|
#ifdef USE_JPWL
|
||||||
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
|
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
|
|
||||||
if (!cstr_info)
|
if (!cstr_info)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
stream = fopen(index, "w");
|
stream = fopen(index, "w");
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
|
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cstr_info->tile[0].distotile)
|
if (cstr_info->tile[0].distotile)
|
||||||
disto_on = 1;
|
disto_on = 1;
|
||||||
else
|
else
|
||||||
disto_on = 0;
|
disto_on = 0;
|
||||||
|
|
||||||
if (cstr_info->tile[0].numpix)
|
if (cstr_info->tile[0].numpix)
|
||||||
numpix_on = 1;
|
numpix_on = 1;
|
||||||
else
|
else
|
||||||
numpix_on = 0;
|
numpix_on = 0;
|
||||||
|
|
||||||
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
||||||
fprintf(stream, "%d\n", cstr_info->prog);
|
fprintf(stream, "%d\n", cstr_info->prog);
|
||||||
fprintf(stream, "%d %d\n", cstr_info->tile_x, cstr_info->tile_y);
|
fprintf(stream, "%d %d\n", cstr_info->tile_x, cstr_info->tile_y);
|
||||||
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[0]); /* based on component 0 */
|
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] ",
|
||||||
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0 */
|
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0 */
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
fprintf(stream, "%d\n", cstr_info->main_head_end);
|
fprintf(stream, "%d\n", cstr_info->main_head_end);
|
||||||
fprintf(stream, "%d\n", cstr_info->codestream_size);
|
fprintf(stream, "%d\n", cstr_info->codestream_size);
|
||||||
|
|
||||||
fprintf(stream, "\nINFO ON TILES\n");
|
fprintf(stream, "\nINFO ON TILES\n");
|
||||||
fprintf(stream, "tileno start_pos end_hd end_tile nbparts");
|
fprintf(stream, "tileno start_pos end_hd end_tile nbparts");
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream," disto");
|
fprintf(stream," disto");
|
||||||
if (numpix_on)
|
if (numpix_on)
|
||||||
fprintf(stream," nbpix");
|
fprintf(stream," nbpix");
|
||||||
if (disto_on && numpix_on)
|
if (disto_on && numpix_on)
|
||||||
fprintf(stream," disto/nbpix");
|
fprintf(stream," disto/nbpix");
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
|
|
||||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||||
fprintf(stream, "%4d %9d %9d %9d %9d",
|
fprintf(stream, "%4d %9d %9d %9d %9d",
|
||||||
cstr_info->tile[tileno].tileno,
|
cstr_info->tile[tileno].tileno,
|
||||||
cstr_info->tile[tileno].start_pos,
|
cstr_info->tile[tileno].start_pos,
|
||||||
cstr_info->tile[tileno].end_header,
|
cstr_info->tile[tileno].end_header,
|
||||||
cstr_info->tile[tileno].end_pos,
|
cstr_info->tile[tileno].end_pos,
|
||||||
cstr_info->tile[tileno].num_tps);
|
cstr_info->tile[tileno].num_tps);
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile);
|
fprintf(stream," %9e", cstr_info->tile[tileno].distotile);
|
||||||
if (numpix_on)
|
if (numpix_on)
|
||||||
fprintf(stream," %9d", cstr_info->tile[tileno].numpix);
|
fprintf(stream," %9d", cstr_info->tile[tileno].numpix);
|
||||||
if (disto_on && numpix_on)
|
if (disto_on && numpix_on)
|
||||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
|
fprintf(stream," %9e", cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||||
int start_pos, end_ph_pos, end_pos;
|
int start_pos, end_ph_pos, end_pos;
|
||||||
double disto = 0;
|
double disto = 0;
|
||||||
int max_numdecompos = 0;
|
int max_numdecompos = 0;
|
||||||
pack_nb = 0;
|
pack_nb = 0;
|
||||||
|
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
if (max_numdecompos < cstr_info->numdecompos[compno])
|
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||||
max_numdecompos = cstr_info->numdecompos[compno];
|
max_numdecompos = cstr_info->numdecompos[compno];
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||||
fprintf(stream, "part_nb tileno start_pack num_packs start_pos end_tph_pos end_pos\n");
|
fprintf(stream, "part_nb tileno start_pack num_packs start_pos end_tph_pos end_pos\n");
|
||||||
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
||||||
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
|
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
|
||||||
tilepartno, tileno,
|
tilepartno, tileno,
|
||||||
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
|
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
|
||||||
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
|
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
|
||||||
cstr_info->tile[tileno].tp[tilepartno].tp_start_pos,
|
cstr_info->tile[tileno].tp[tilepartno].tp_start_pos,
|
||||||
cstr_info->tile[tileno].tp[tilepartno].tp_end_header,
|
cstr_info->tile[tileno].tp[tilepartno].tp_end_header,
|
||||||
cstr_info->tile[tileno].tp[tilepartno].tp_end_pos
|
cstr_info->tile[tileno].tp[tilepartno].tp_end_pos
|
||||||
);
|
);
|
||||||
|
|
||||||
if (cstr_info->prog == LRCP) { /* LRCP */
|
if (cstr_info->prog == LRCP) { /* LRCP */
|
||||||
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos");
|
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos");
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " disto");
|
fprintf(stream, " disto");
|
||||||
fprintf(stream,"\n");
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max;
|
int prec_max;
|
||||||
if (resno > cstr_info->numdecompos[compno])
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
break;
|
break;
|
||||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
fprintf(stream, "%4d %6d %7d %5d %6d %6d %6d %6d %7d",
|
fprintf(stream, "%4d %6d %7d %5d %6d %6d %6d %6d %7d",
|
||||||
pack_nb, tileno, layno, resno, compno, precno, start_pos, end_ph_pos, end_pos);
|
pack_nb, tileno, layno, resno, compno, precno, start_pos, end_ph_pos, end_pos);
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " %8e", disto);
|
fprintf(stream, " %8e", disto);
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
total_disto += disto;
|
total_disto += disto;
|
||||||
pack_nb++;
|
pack_nb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* LRCP */
|
} /* LRCP */
|
||||||
|
|
||||||
else if (cstr_info->prog == RLCP) { /* RLCP */
|
else if (cstr_info->prog == RLCP) { /* RLCP */
|
||||||
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos\n");
|
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos\n");
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " disto");
|
fprintf(stream, " disto");
|
||||||
fprintf(stream,"\n");
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int prec_max;
|
int prec_max;
|
||||||
if (resno > cstr_info->numdecompos[compno])
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
break;
|
break;
|
||||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < prec_max; precno++) {
|
for (precno = 0; precno < prec_max; precno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
fprintf(stream, "%4d %6d %5d %7d %6d %6d %9d %9d %7d",
|
fprintf(stream, "%4d %6d %5d %7d %6d %6d %9d %9d %7d",
|
||||||
pack_nb, tileno, resno, layno, compno, precno, start_pos, end_ph_pos, end_pos);
|
pack_nb, tileno, resno, layno, compno, precno, start_pos, end_ph_pos, end_pos);
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " %8e", disto);
|
fprintf(stream, " %8e", disto);
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
total_disto += disto;
|
total_disto += disto;
|
||||||
pack_nb++;
|
pack_nb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* RLCP */
|
} /* RLCP */
|
||||||
|
|
||||||
else if (cstr_info->prog == RPCL) { /* RPCL */
|
else if (cstr_info->prog == RPCL) { /* RPCL */
|
||||||
|
|
||||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos");
|
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos");
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " disto");
|
fprintf(stream, " disto");
|
||||||
fprintf(stream,"\n");
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
for (precno = 0; precno < numprec; precno++) {
|
for (precno = 0; precno < numprec; precno++) {
|
||||||
/* I suppose components have same XRsiz, YRsiz */
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
int x1 = x0 + cstr_info->tile_x;
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
if (resno > cstr_info->numdecompos[compno])
|
if (resno > cstr_info->numdecompos[compno])
|
||||||
break;
|
break;
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
if (precno_y*pcy == y ) {
|
if (precno_y*pcy == y ) {
|
||||||
for (x = x0; x < x1; x++) {
|
for (x = x0; x < x1; x++) {
|
||||||
if (precno_x*pcx == x ) {
|
if (precno_x*pcx == x ) {
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
fprintf(stream, "%4d %6d %5d %6d %6d %7d %9d %9d %7d",
|
fprintf(stream, "%4d %6d %5d %6d %6d %7d %9d %9d %7d",
|
||||||
pack_nb, tileno, resno, precno, compno, layno, start_pos, end_ph_pos, end_pos);
|
pack_nb, tileno, resno, precno, compno, layno, start_pos, end_ph_pos, end_pos);
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " %8e", disto);
|
fprintf(stream, " %8e", disto);
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
total_disto += disto;
|
total_disto += disto;
|
||||||
pack_nb++;
|
pack_nb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}/* x = x0..x1 */
|
}/* x = x0..x1 */
|
||||||
}
|
}
|
||||||
} /* y = y0..y1 */
|
} /* y = y0..y1 */
|
||||||
} /* precno */
|
} /* precno */
|
||||||
} /* compno */
|
} /* compno */
|
||||||
} /* resno */
|
} /* resno */
|
||||||
} /* RPCL */
|
} /* RPCL */
|
||||||
|
|
||||||
else if (cstr_info->prog == PCRL) { /* PCRL */
|
else if (cstr_info->prog == PCRL) { /* PCRL */
|
||||||
/* I suppose components have same XRsiz, YRsiz */
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
int x1 = x0 + cstr_info->tile_x;
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
|
||||||
// Count the maximum number of precincts
|
/* Count the maximum number of precincts */
|
||||||
int max_numprec = 0;
|
int max_numprec = 0;
|
||||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
if (numprec > max_numprec)
|
if (numprec > max_numprec)
|
||||||
max_numprec = numprec;
|
max_numprec = numprec;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos");
|
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos");
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " disto");
|
fprintf(stream, " disto");
|
||||||
fprintf(stream,"\n");
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
for (precno = 0; precno < max_numprec; precno++) {
|
for (precno = 0; precno < max_numprec; precno++) {
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
if (precno >= numprec)
|
if (precno >= numprec)
|
||||||
continue;
|
continue;
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
if (precno_y*pcy == y ) {
|
if (precno_y*pcy == y ) {
|
||||||
for (x = x0; x < x1; x++) {
|
for (x = x0; x < x1; x++) {
|
||||||
if (precno_x*pcx == x ) {
|
if (precno_x*pcx == x ) {
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d",
|
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d",
|
||||||
pack_nb, tileno, precno, compno, resno, layno, start_pos, end_ph_pos, end_pos);
|
pack_nb, tileno, precno, compno, resno, layno, start_pos, end_ph_pos, end_pos);
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " %8e", disto);
|
fprintf(stream, " %8e", disto);
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
total_disto += disto;
|
total_disto += disto;
|
||||||
pack_nb++;
|
pack_nb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}/* x = x0..x1 */
|
}/* x = x0..x1 */
|
||||||
}
|
}
|
||||||
} /* y = y0..y1 */
|
} /* y = y0..y1 */
|
||||||
} /* resno */
|
} /* resno */
|
||||||
} /* compno */
|
} /* compno */
|
||||||
} /* precno */
|
} /* precno */
|
||||||
} /* PCRL */
|
} /* PCRL */
|
||||||
|
|
||||||
else { /* CPRL */
|
else { /* CPRL */
|
||||||
// Count the maximum number of precincts
|
/* Count the maximum number of precincts */
|
||||||
int max_numprec = 0;
|
int max_numprec = 0;
|
||||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
if (numprec > max_numprec)
|
if (numprec > max_numprec)
|
||||||
max_numprec = numprec;
|
max_numprec = numprec;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos");
|
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos");
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " disto");
|
fprintf(stream, " disto");
|
||||||
fprintf(stream,"\n");
|
fprintf(stream,"\n");
|
||||||
|
|
||||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||||
/* I suppose components have same XRsiz, YRsiz */
|
/* I suppose components have same XRsiz, YRsiz */
|
||||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||||
int x1 = x0 + cstr_info->tile_x;
|
int x1 = x0 + cstr_info->tile_x;
|
||||||
int y1 = y0 + cstr_info->tile_y;
|
int y1 = y0 + cstr_info->tile_y;
|
||||||
|
|
||||||
for (precno = 0; precno < max_numprec; precno++) {
|
for (precno = 0; precno < max_numprec; precno++) {
|
||||||
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||||
if (precno >= numprec)
|
if (precno >= numprec)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(y = y0; y < y1; y++) {
|
for(y = y0; y < y1; y++) {
|
||||||
if (precno_y*pcy == y ) {
|
if (precno_y*pcy == y ) {
|
||||||
for (x = x0; x < x1; x++) {
|
for (x = x0; x < x1; x++) {
|
||||||
if (precno_x*pcx == x ) {
|
if (precno_x*pcx == x ) {
|
||||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||||
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d",
|
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d",
|
||||||
pack_nb, tileno, compno, precno, resno, layno, start_pos, end_ph_pos, end_pos);
|
pack_nb, tileno, compno, precno, resno, layno, start_pos, end_ph_pos, end_pos);
|
||||||
if (disto_on)
|
if (disto_on)
|
||||||
fprintf(stream, " %8e", disto);
|
fprintf(stream, " %8e", disto);
|
||||||
fprintf(stream, "\n");
|
fprintf(stream, "\n");
|
||||||
total_disto += disto;
|
total_disto += disto;
|
||||||
pack_nb++;
|
pack_nb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}/* x = x0..x1 */
|
}/* x = x0..x1 */
|
||||||
}
|
}
|
||||||
} /* y = y0..y1 */
|
} /* y = y0..y1 */
|
||||||
} /* resno */
|
} /* resno */
|
||||||
} /* precno */
|
} /* precno */
|
||||||
} /* compno */
|
} /* compno */
|
||||||
} /* CPRL */
|
} /* CPRL */
|
||||||
} /* tileno */
|
} /* tileno */
|
||||||
|
|
||||||
if (disto_on) {
|
if (disto_on) {
|
||||||
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
|
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
|
||||||
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
|
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
|
||||||
}
|
}
|
||||||
/* UniPG>> */
|
/* UniPG>> */
|
||||||
/* print the markers' list */
|
/* print the markers' list */
|
||||||
if (cstr_info->marknum) {
|
if (cstr_info->marknum) {
|
||||||
fprintf(stream, "\nMARKER LIST\n");
|
fprintf(stream, "\nMARKER LIST\n");
|
||||||
fprintf(stream, "%d\n", cstr_info->marknum);
|
fprintf(stream, "%d\n", cstr_info->marknum);
|
||||||
fprintf(stream, "type\tstart_pos length\n");
|
fprintf(stream, "type\tstart_pos length\n");
|
||||||
for (x = 0; x < cstr_info->marknum; x++)
|
for (x = 0; x < cstr_info->marknum; x++)
|
||||||
fprintf(stream, "%X\t%9d %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);
|
fprintf(stream, "%X\t%9d %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);
|
||||||
}
|
}
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
fclose(stream);
|
fclose(stream);
|
||||||
|
|
||||||
fprintf(stderr,"Generated index file %s\n", index);
|
fprintf(stderr,"Generated index file %s\n", index);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,49 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __J2K_INDEX_H
|
#ifndef __J2K_INDEX_H
|
||||||
#define __J2K_INDEX_H
|
#define __J2K_INDEX_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Write a structured index to a file
|
Write a structured index to a file
|
||||||
@param cstr_info Codestream information
|
@param cstr_info Codestream information
|
||||||
@param index Index filename
|
@param index Index filename
|
||||||
@return Returns 0 if successful, returns 1 otherwise
|
@return Returns 0 if successful, returns 1 otherwise
|
||||||
*/
|
*/
|
||||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index);
|
int write_index_file(opj_codestream_info_t *cstr_info, char *index);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __J2K_INDEX_H */
|
#endif /* __J2K_INDEX_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 20010, Mathieu Malaterre, GDCM
|
* Copyright (c) 2010, Mathieu Malaterre, GDCM
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "j2k.h"
|
#include "j2k.h"
|
||||||
#include "jp2.h"
|
#include "jp2.h"
|
||||||
#include "getopt.h"
|
#include "opj_getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ typedef struct img_folder{
|
|||||||
|
|
||||||
}img_fol_t;
|
}img_fol_t;
|
||||||
|
|
||||||
void decode_help_display() {
|
void decode_help_display(void) {
|
||||||
fprintf(stdout,"HELP for j2k_dump\n----\n\n");
|
fprintf(stdout,"HELP for j2k_dump\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");
|
||||||
|
|
||||||
@@ -92,6 +92,10 @@ void decode_help_display() {
|
|||||||
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 <output file>\n");
|
||||||
|
fprintf(stdout," OPTIONAL\n");
|
||||||
|
fprintf(stdout," Output file where file info will be dump.\n");
|
||||||
|
fprintf(stdout," By default it will be in the stdout.\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +121,7 @@ int get_num_images(char *imgdirpath){
|
|||||||
continue;
|
continue;
|
||||||
num_images++;
|
num_images++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return num_images;
|
return num_images;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +147,7 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
|
|||||||
strcpy(dirptr->filename[i],content->d_name);
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +182,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
|
|||||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||||
|
|
||||||
//Set output file
|
/*Set output file*/
|
||||||
strcpy(temp_ofname,strtok(image_filename,"."));
|
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||||
while((temp_p = strtok(NULL,".")) != NULL){
|
while((temp_p = strtok(NULL,".")) != NULL){
|
||||||
strcat(temp_ofname,temp1);
|
strcat(temp_ofname,temp1);
|
||||||
@@ -192,22 +198,29 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
|
|||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
int totlen;
|
int totlen, c;
|
||||||
option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
|
{0,0,0,0} /* GNU getopt_long requirement */
|
||||||
};
|
};
|
||||||
|
const char optlist[] = "i:o:h";
|
||||||
|
|
||||||
const char optlist[] = "i:h";
|
OPJ_ARG_NOT_USED(indexfilename);
|
||||||
totlen=sizeof(long_option);
|
|
||||||
|
totlen=sizeof(long_option)-1;
|
||||||
img_fol->set_out_format = 0;
|
img_fol->set_out_format = 0;
|
||||||
while (1) {
|
do {
|
||||||
int c = getopt_long(argc, argv,optlist,long_option,totlen);
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
c = opj_getopt_long(argc, argv,optlist,long_option,0);
|
||||||
|
#else
|
||||||
|
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
|
#endif
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i': /* input file */
|
case 'i': /* input file */
|
||||||
{
|
{
|
||||||
char *infile = optarg;
|
char *infile = opj_optarg;
|
||||||
parameters->decod_format = get_file_format(infile);
|
parameters->decod_format = get_file_format(infile);
|
||||||
switch(parameters->decod_format) {
|
switch(parameters->decod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
@@ -222,6 +235,15 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
}
|
}
|
||||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'o': /* output file */
|
||||||
|
{
|
||||||
|
char *outfile = opj_optarg;
|
||||||
|
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
@@ -234,8 +256,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'y': /* Image Directory path */
|
case 'y': /* Image Directory path */
|
||||||
{
|
{
|
||||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
strcpy(img_fol->imgdirpath,optarg);
|
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||||
img_fol->set_imgdir=1;
|
img_fol->set_imgdir=1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -243,10 +265,10 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}while(c != -1);
|
||||||
|
|
||||||
/* check for possible errors */
|
/* check for possible errors */
|
||||||
if(img_fol->set_imgdir==1){
|
if(img_fol->set_imgdir==1){
|
||||||
@@ -259,12 +281,12 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA!!\n");
|
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA!!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(!((parameters->outfile[0] == 0))){
|
if(!(parameters->outfile[0] == 0)){
|
||||||
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
|
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if((parameters->infile[0] == 0) ) {
|
if( parameters->infile[0] == 0 ) {
|
||||||
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
|
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
|
||||||
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -306,7 +328,7 @@ int main(int argc, char *argv[])
|
|||||||
img_fol_t img_fol;
|
img_fol_t img_fol;
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
opj_image_t *image = NULL;
|
opj_image_t *image = NULL;
|
||||||
FILE *fsrc = NULL;
|
FILE *fsrc = NULL, *fout = NULL;
|
||||||
unsigned char *src = NULL;
|
unsigned char *src = NULL;
|
||||||
int file_length;
|
int file_length;
|
||||||
int num_images;
|
int num_images;
|
||||||
@@ -341,7 +363,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||||
if(dirptr){
|
if(dirptr){
|
||||||
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); // Stores at max 10 image file names
|
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*));
|
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||||
|
|
||||||
if(!dirptr->filename_buf){
|
if(!dirptr->filename_buf){
|
||||||
@@ -362,6 +384,19 @@ int main(int argc, char *argv[])
|
|||||||
num_images=1;
|
num_images=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
if (parameters.outfile[0] != 0)
|
||||||
|
{
|
||||||
|
fout = fopen(parameters.outfile,"w");
|
||||||
|
if (!fout)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fout = stdout;
|
||||||
|
|
||||||
/*Encoding image one by one*/
|
/*Encoding image one by one*/
|
||||||
for(imageno = 0; imageno < num_images ; imageno++)
|
for(imageno = 0; imageno < num_images ; imageno++)
|
||||||
{
|
{
|
||||||
@@ -386,7 +421,14 @@ int main(int argc, char *argv[])
|
|||||||
file_length = ftell(fsrc);
|
file_length = ftell(fsrc);
|
||||||
fseek(fsrc, 0, SEEK_SET);
|
fseek(fsrc, 0, SEEK_SET);
|
||||||
src = (unsigned char *) malloc(file_length);
|
src = (unsigned char *) malloc(file_length);
|
||||||
fread(src, 1, file_length, fsrc);
|
if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
|
||||||
|
{
|
||||||
|
free(src);
|
||||||
|
fclose(fsrc);
|
||||||
|
fclose(fout);
|
||||||
|
fprintf(stderr, "\nERROR: fread return a number of element different from the expected.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
fclose(fsrc);
|
fclose(fsrc);
|
||||||
|
|
||||||
/* decode the code-stream */
|
/* decode the code-stream */
|
||||||
@@ -410,7 +452,7 @@ int main(int argc, char *argv[])
|
|||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
/* decode the stream and fill the image structure */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||||
else
|
else
|
||||||
image = opj_decode(dinfo, cio);
|
image = opj_decode(dinfo, cio);
|
||||||
@@ -418,20 +460,22 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
fclose(fout);
|
||||||
|
free(src);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* dump image */
|
/* dump image */
|
||||||
j2k_dump_image(stdout, image);
|
j2k_dump_image(fout, image);
|
||||||
|
|
||||||
/* dump cp */
|
/* dump cp */
|
||||||
j2k_dump_cp(stdout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
j2k_dump_cp(fout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close 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) {
|
||||||
char bSuccess;
|
opj_bool bSuccess;
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
fprintf(stderr, "Failed to output index file\n");
|
fprintf(stderr, "Failed to output index file\n");
|
||||||
@@ -457,7 +501,7 @@ int main(int argc, char *argv[])
|
|||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
/* decode the stream and fill the image structure */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||||
else
|
else
|
||||||
image = opj_decode(dinfo, cio);
|
image = opj_decode(dinfo, cio);
|
||||||
@@ -465,6 +509,8 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
fclose(fout);
|
||||||
|
free(src);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* dump image */
|
/* dump image */
|
||||||
@@ -472,17 +518,17 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
||||||
}
|
}
|
||||||
j2k_dump_image(stdout, image);
|
j2k_dump_image(fout, image);
|
||||||
|
|
||||||
/* dump cp */
|
/* dump cp */
|
||||||
j2k_dump_cp(stdout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
j2k_dump_cp(fout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close 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) {
|
||||||
char bSuccess;
|
opj_bool bSuccess;
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
fprintf(stderr, "Failed to output index file\n");
|
fprintf(stderr, "Failed to output index file\n");
|
||||||
@@ -508,7 +554,7 @@ int main(int argc, char *argv[])
|
|||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
/* decode the stream and fill the image structure */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||||
else
|
else
|
||||||
image = opj_decode(dinfo, cio);
|
image = opj_decode(dinfo, cio);
|
||||||
@@ -516,6 +562,8 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
fclose(fout);
|
||||||
|
free(src);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,7 +572,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Write the index to disk */
|
/* Write the index to disk */
|
||||||
if (*indexfilename) {
|
if (*indexfilename) {
|
||||||
char bSuccess;
|
opj_bool bSuccess;
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
fprintf(stderr, "Failed to output index file\n");
|
fprintf(stderr, "Failed to output index file\n");
|
||||||
@@ -554,6 +602,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fout);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +618,7 @@ static void j2k_dump_image(FILE *fd, opj_image_t * img) {
|
|||||||
fprintf(fd, " comp %d {\n", compno);
|
fprintf(fd, " comp %d {\n", compno);
|
||||||
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
|
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
|
||||||
fprintf(fd, " prec=%d\n", comp->prec);
|
fprintf(fd, " prec=%d\n", comp->prec);
|
||||||
//fprintf(fd, " bpp=%d\n", comp->bpp);
|
/*fprintf(fd, " bpp=%d\n", comp->bpp);*/
|
||||||
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
||||||
fprintf(fd, " }\n");
|
fprintf(fd, " }\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
#include "opj_config.h"
|
#include "opj_config.h"
|
||||||
#include "openjpeg.h"
|
#include "openjpeg.h"
|
||||||
#include "getopt.h"
|
#include "opj_getopt.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ typedef struct img_folder{
|
|||||||
|
|
||||||
}img_fol_t;
|
}img_fol_t;
|
||||||
|
|
||||||
void decode_help_display() {
|
static void decode_help_display(void) {
|
||||||
fprintf(stdout,"HELP for j2k_to_image\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");
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void decode_help_display() {
|
|||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int get_num_images(char *imgdirpath){
|
static int get_num_images(char *imgdirpath){
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent* content;
|
struct dirent* content;
|
||||||
int num_images = 0;
|
int num_images = 0;
|
||||||
@@ -162,10 +162,11 @@ int get_num_images(char *imgdirpath){
|
|||||||
continue;
|
continue;
|
||||||
num_images++;
|
num_images++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return num_images;
|
return num_images;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent* content;
|
struct dirent* content;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -187,10 +188,11 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
|
|||||||
strcpy(dirptr->filename[i],content->d_name);
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_file_format(char *filename) {
|
static int get_file_format(char *filename) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
|
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 };
|
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 };
|
||||||
@@ -209,7 +211,7 @@ int get_file_format(char *filename) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
static 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 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]="";
|
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||||
|
|
||||||
@@ -221,7 +223,7 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
|
|||||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||||
|
|
||||||
//Set output file
|
/*Set output file*/
|
||||||
strcpy(temp_ofname,strtok(image_filename,"."));
|
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||||
while((temp_p = strtok(NULL,".")) != NULL){
|
while((temp_p = strtok(NULL,".")) != NULL){
|
||||||
strcat(temp_ofname,temp1);
|
strcat(temp_ofname,temp1);
|
||||||
@@ -235,12 +237,13 @@ char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparamet
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||||
/* parse the command line */
|
/* parse the command line */
|
||||||
int totlen;
|
int totlen, c;
|
||||||
option_t long_option[]={
|
opj_option_t long_option[]={
|
||||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
|
{0,0,0,0} /* GNU getopt_long requirement */
|
||||||
};
|
};
|
||||||
|
|
||||||
const char optlist[] = "i:o:r:l:x:"
|
const char optlist[] = "i:o:r:l:x:"
|
||||||
@@ -251,16 +254,20 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
#endif /* USE_JPWL */
|
#endif /* USE_JPWL */
|
||||||
/* <<UniPG */
|
/* <<UniPG */
|
||||||
"h" ;
|
"h" ;
|
||||||
totlen=sizeof(long_option);
|
totlen=sizeof(long_option) - 1;
|
||||||
img_fol->set_out_format = 0;
|
img_fol->set_out_format = 0;
|
||||||
while (1) {
|
do {
|
||||||
int c = getopt_long(argc, argv,optlist,long_option,totlen);
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
c = opj_getopt_long(argc, argv,optlist,long_option,0);
|
||||||
|
#else
|
||||||
|
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
|
#endif
|
||||||
if (c == -1)
|
if (c == -1)
|
||||||
break;
|
break;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i': /* input file */
|
case 'i': /* input file */
|
||||||
{
|
{
|
||||||
char *infile = optarg;
|
char *infile = opj_optarg;
|
||||||
parameters->decod_format = get_file_format(infile);
|
parameters->decod_format = get_file_format(infile);
|
||||||
switch(parameters->decod_format) {
|
switch(parameters->decod_format) {
|
||||||
case J2K_CFMT:
|
case J2K_CFMT:
|
||||||
@@ -281,7 +288,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'o': /* output file */
|
case 'o': /* output file */
|
||||||
{
|
{
|
||||||
char *outfile = optarg;
|
char *outfile = opj_optarg;
|
||||||
parameters->cod_format = get_file_format(outfile);
|
parameters->cod_format = get_file_format(outfile);
|
||||||
switch(parameters->cod_format) {
|
switch(parameters->cod_format) {
|
||||||
case PGX_DFMT:
|
case PGX_DFMT:
|
||||||
@@ -305,7 +312,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
case 'O': /* output format */
|
case 'O': /* output format */
|
||||||
{
|
{
|
||||||
char outformat[50];
|
char outformat[50];
|
||||||
char *of = optarg;
|
char *of = opj_optarg;
|
||||||
sprintf(outformat,".%s",of);
|
sprintf(outformat,".%s",of);
|
||||||
img_fol->set_out_format = 1;
|
img_fol->set_out_format = 1;
|
||||||
parameters->cod_format = get_file_format(outformat);
|
parameters->cod_format = get_file_format(outformat);
|
||||||
@@ -344,7 +351,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'r': /* reduce option */
|
case 'r': /* reduce option */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d", ¶meters->cp_reduce);
|
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -353,7 +360,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'l': /* layering option */
|
case 'l': /* layering option */
|
||||||
{
|
{
|
||||||
sscanf(optarg, "%d", ¶meters->cp_layer);
|
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -367,15 +374,15 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
|
|
||||||
case 'y': /* Image Directory path */
|
case 'y': /* Image Directory path */
|
||||||
{
|
{
|
||||||
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||||
strcpy(img_fol->imgdirpath,optarg);
|
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||||
img_fol->set_imgdir=1;
|
img_fol->set_imgdir=1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
case 'x': /* Creation of index file */
|
case 'x': /* Creation of index file */
|
||||||
{
|
{
|
||||||
char *index = optarg;
|
char *index = opj_optarg;
|
||||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -387,7 +394,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
{
|
{
|
||||||
char *token = NULL;
|
char *token = NULL;
|
||||||
|
|
||||||
token = strtok(optarg, ",");
|
token = strtok(opj_optarg, ",");
|
||||||
while(token != NULL) {
|
while(token != NULL) {
|
||||||
|
|
||||||
/* search expected number of components */
|
/* search expected number of components */
|
||||||
@@ -454,10 +461,10 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}while(c != -1);
|
||||||
|
|
||||||
/* check for possible errors */
|
/* check for possible errors */
|
||||||
if(img_fol->set_imgdir==1){
|
if(img_fol->set_imgdir==1){
|
||||||
@@ -490,21 +497,21 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
|||||||
/**
|
/**
|
||||||
sample error callback expecting a FILE* client object
|
sample error callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
void error_callback(const char *msg, void *client_data) {
|
static void error_callback(const char *msg, void *client_data) {
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[ERROR] %s", msg);
|
fprintf(stream, "[ERROR] %s", msg);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
sample warning callback expecting a FILE* client object
|
sample warning callback expecting a FILE* client object
|
||||||
*/
|
*/
|
||||||
void warning_callback(const char *msg, void *client_data) {
|
static void warning_callback(const char *msg, void *client_data) {
|
||||||
FILE *stream = (FILE*)client_data;
|
FILE *stream = (FILE*)client_data;
|
||||||
fprintf(stream, "[WARNING] %s", msg);
|
fprintf(stream, "[WARNING] %s", msg);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
sample debug callback expecting no client object
|
sample debug callback expecting no client object
|
||||||
*/
|
*/
|
||||||
void info_callback(const char *msg, void *client_data) {
|
static void info_callback(const char *msg, void *client_data) {
|
||||||
(void)client_data;
|
(void)client_data;
|
||||||
fprintf(stdout, "[INFO] %s", msg);
|
fprintf(stdout, "[INFO] %s", msg);
|
||||||
}
|
}
|
||||||
@@ -521,7 +528,7 @@ int main(int argc, char **argv) {
|
|||||||
int file_length;
|
int file_length;
|
||||||
int num_images;
|
int num_images;
|
||||||
int i,imageno;
|
int i,imageno;
|
||||||
dircnt_t *dirptr;
|
dircnt_t *dirptr = NULL;
|
||||||
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
||||||
opj_cio_t *cio = NULL;
|
opj_cio_t *cio = NULL;
|
||||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||||
@@ -551,7 +558,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||||
if(dirptr){
|
if(dirptr){
|
||||||
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); // Stores at max 10 image file names
|
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*));
|
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||||
|
|
||||||
if(!dirptr->filename_buf){
|
if(!dirptr->filename_buf){
|
||||||
@@ -595,7 +602,13 @@ int main(int argc, char **argv) {
|
|||||||
file_length = ftell(fsrc);
|
file_length = ftell(fsrc);
|
||||||
fseek(fsrc, 0, SEEK_SET);
|
fseek(fsrc, 0, SEEK_SET);
|
||||||
src = (unsigned char *) malloc(file_length);
|
src = (unsigned char *) malloc(file_length);
|
||||||
fread(src, 1, file_length, fsrc);
|
if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
|
||||||
|
{
|
||||||
|
free(src);
|
||||||
|
fclose(fsrc);
|
||||||
|
fprintf(stderr, "\nERROR: fread return a number of element different from the expected.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
fclose(fsrc);
|
fclose(fsrc);
|
||||||
|
|
||||||
/* decode the code-stream */
|
/* decode the code-stream */
|
||||||
@@ -619,7 +632,7 @@ int main(int argc, char **argv) {
|
|||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
/* decode the stream and fill the image structure */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||||
else
|
else
|
||||||
image = opj_decode(dinfo, cio);
|
image = opj_decode(dinfo, cio);
|
||||||
@@ -627,6 +640,7 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
free(src);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,7 +649,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Write the index to disk */
|
/* Write the index to disk */
|
||||||
if (*indexfilename) {
|
if (*indexfilename) {
|
||||||
char bSuccess;
|
opj_bool bSuccess;
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
fprintf(stderr, "Failed to output index file\n");
|
fprintf(stderr, "Failed to output index file\n");
|
||||||
@@ -661,7 +675,7 @@ int main(int argc, char **argv) {
|
|||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
/* decode the stream and fill the image structure */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||||
else
|
else
|
||||||
image = opj_decode(dinfo, cio);
|
image = opj_decode(dinfo, cio);
|
||||||
@@ -669,6 +683,7 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
free(src);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,7 +692,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Write the index to disk */
|
/* Write the index to disk */
|
||||||
if (*indexfilename) {
|
if (*indexfilename) {
|
||||||
char bSuccess;
|
opj_bool bSuccess;
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
fprintf(stderr, "Failed to output index file\n");
|
fprintf(stderr, "Failed to output index file\n");
|
||||||
@@ -703,7 +718,7 @@ int main(int argc, char **argv) {
|
|||||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
/* decode the stream and fill the image structure */
|
/* decode the stream and fill the image structure */
|
||||||
if (*indexfilename) // If need to extract codestream information
|
if (*indexfilename) /* If need to extract codestream information*/
|
||||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||||
else
|
else
|
||||||
image = opj_decode(dinfo, cio);
|
image = opj_decode(dinfo, cio);
|
||||||
@@ -711,6 +726,7 @@ int main(int argc, char **argv) {
|
|||||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
opj_destroy_decompress(dinfo);
|
opj_destroy_decompress(dinfo);
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
free(src);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,7 +735,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* Write the index to disk */
|
/* Write the index to disk */
|
||||||
if (*indexfilename) {
|
if (*indexfilename) {
|
||||||
char bSuccess;
|
opj_bool bSuccess;
|
||||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||||
if (bSuccess) {
|
if (bSuccess) {
|
||||||
fprintf(stderr, "Failed to output index file\n");
|
fprintf(stderr, "Failed to output index file\n");
|
||||||
@@ -838,7 +854,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//end main
|
/*end main*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -293,12 +293,14 @@ void color_apply_icc_profile(opj_image_t *image)
|
|||||||
if(in_prof == NULL) return;
|
if(in_prof == NULL) return;
|
||||||
|
|
||||||
in_space = cmsGetPCS(in_prof);
|
in_space = cmsGetPCS(in_prof);
|
||||||
|
(void)in_space;
|
||||||
out_space = cmsGetColorSpace(in_prof);
|
out_space = cmsGetColorSpace(in_prof);
|
||||||
intent = cmsGetHeaderRenderingIntent(in_prof);
|
intent = cmsGetHeaderRenderingIntent(in_prof);
|
||||||
|
|
||||||
|
|
||||||
max_w = image->comps[0].w; max_h = image->comps[0].h;
|
max_w = image->comps[0].w; max_h = image->comps[0].h;
|
||||||
prec = image->comps[0].prec;
|
prec = image->comps[0].prec;
|
||||||
|
(void)prec;
|
||||||
oldspace = image->color_space;
|
oldspace = image->color_space;
|
||||||
|
|
||||||
if(out_space == cmsSigRgbData) /* enumCS 16 */
|
if(out_space == cmsSigRgbData) /* enumCS 16 */
|
||||||
|
|||||||
@@ -45,4 +45,4 @@
|
|||||||
#define TGA_DFMT 16
|
#define TGA_DFMT 16
|
||||||
#define PNG_DFMT 17
|
#define PNG_DFMT 17
|
||||||
|
|
||||||
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
/* last review : october 29th, 2002 */
|
|
||||||
|
|
||||||
#ifndef _GETOPT_H_
|
|
||||||
#define _GETOPT_H_
|
|
||||||
|
|
||||||
typedef struct option
|
|
||||||
{
|
|
||||||
const char *name;
|
|
||||||
int has_arg;
|
|
||||||
int *flag;
|
|
||||||
int val;
|
|
||||||
}option_t;
|
|
||||||
|
|
||||||
#define NO_ARG 0
|
|
||||||
#define REQ_ARG 1
|
|
||||||
#define OPT_ARG 2
|
|
||||||
|
|
||||||
extern int opterr;
|
|
||||||
extern int optind;
|
|
||||||
extern int optopt;
|
|
||||||
extern int optreset;
|
|
||||||
extern char *optarg;
|
|
||||||
|
|
||||||
extern int getopt(int nargc, char *const *nargv, const char *ostr);
|
|
||||||
extern int getopt_long(int argc, char * const argv[], const char *optstring,
|
|
||||||
const struct option *longopts, int totlen);
|
|
||||||
extern void reset_options_reading();
|
|
||||||
|
|
||||||
#endif /* _GETOPT_H_ */
|
|
||||||
@@ -10,11 +10,7 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. Neither the name of the University nor the names of its contributors
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
* may be used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
@@ -34,117 +30,114 @@
|
|||||||
/* last review : october 29th, 2002 */
|
/* last review : october 29th, 2002 */
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
static char sccsid[] = "@(#)opj_getopt.c 8.3 (Berkeley) 4/27/95";
|
||||||
#endif /* LIBC_SCCS and not lint */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "opj_getopt.h"
|
||||||
|
|
||||||
int opterr = 1, /* if error message should be printed */
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
optind = 1, /* index into parent argv vector */
|
#error
|
||||||
optopt, /* character checked for validity */
|
#endif
|
||||||
optreset; /* reset getopt */
|
|
||||||
const char *optarg; /* argument associated with option */
|
|
||||||
|
|
||||||
typedef struct option
|
int opj_opterr = 1, /* if error message should be printed */
|
||||||
{
|
opj_optind = 1, /* index into parent argv vector */
|
||||||
const char *name;
|
opj_optopt, /* character checked for validity */
|
||||||
int has_arg;
|
opj_optreset; /* reset getopt */
|
||||||
int *flag;
|
char *opj_optarg; /* argument associated with option */
|
||||||
int val;
|
|
||||||
}option_t;
|
|
||||||
|
|
||||||
#define BADCH (int)'?'
|
#define BADCH (int)'?'
|
||||||
#define BADARG (int)':'
|
#define BADARG (int)':'
|
||||||
#define EMSG ""
|
static char EMSG[]={""};
|
||||||
|
|
||||||
/* As this class remembers its values from one Java call to the other, reset the values before each use */
|
/* As this class remembers its values from one Java call to the other, reset the values before each use */
|
||||||
void reset_options_reading() {
|
void reset_options_reading(void) {
|
||||||
opterr = 1;
|
opj_opterr = 1;
|
||||||
optind = 1;
|
opj_optind = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* getopt --
|
* getopt --
|
||||||
* Parse argc/argv argument vector.
|
* Parse argc/argv argument vector.
|
||||||
*/
|
*/
|
||||||
int getopt(int nargc, char *const *nargv, const char *ostr) {
|
int opj_getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||||
# define __progname nargv[0]
|
# define __progname nargv[0]
|
||||||
static const char *place = EMSG; /* option letter processing */
|
static char *place = EMSG; /* option letter processing */
|
||||||
char *oli; /* option letter list index */
|
char *oli = NULL; /* option letter list index */
|
||||||
|
|
||||||
if (optreset || !*place) { /* update scanning pointer */
|
if (opj_optreset || !*place) { /* update scanning pointer */
|
||||||
optreset = 0;
|
opj_optreset = 0;
|
||||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
if (opj_optind >= nargc || *(place = nargv[opj_optind]) != '-') {
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
if (place[1] && *++place == '-') { /* found "--" */
|
if (place[1] && *++place == '-') { /* found "--" */
|
||||||
++optind;
|
++opj_optind;
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
} /* option letter okay? */
|
} /* option letter okay? */
|
||||||
if ((optopt = (int) *place++) == (int) ':' ||
|
if ((opj_optopt = (int) *place++) == (int) ':' ||
|
||||||
!(oli = strchr(ostr, optopt))) {
|
!(oli = strchr(ostr, opj_optopt))) {
|
||||||
/*
|
/*
|
||||||
* if the user didn't specify '-' as an option,
|
* if the user didn't specify '-' as an option,
|
||||||
* assume it means -1.
|
* assume it means -1.
|
||||||
*/
|
*/
|
||||||
if (optopt == (int) '-')
|
if (opj_optopt == (int) '-')
|
||||||
return (-1);
|
return (-1);
|
||||||
if (!*place)
|
if (!*place)
|
||||||
++optind;
|
++opj_optind;
|
||||||
if (opterr && *ostr != ':') {
|
if (opj_opterr && *ostr != ':') {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: illegal option -- %c\n", __progname, optopt);
|
"%s: illegal option -- %c\n", __progname, opj_optopt);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*++oli != ':') { /* don't need argument */
|
if (*++oli != ':') { /* don't need argument */
|
||||||
optarg = NULL;
|
opj_optarg = NULL;
|
||||||
if (!*place)
|
if (!*place)
|
||||||
++optind;
|
++opj_optind;
|
||||||
} else { /* need an argument */
|
} else { /* need an argument */
|
||||||
if (*place) /* no white space */
|
if (*place) /* no white space */
|
||||||
optarg = place;
|
opj_optarg = place;
|
||||||
else if (nargc <= ++optind) { /* no arg */
|
else if (nargc <= ++opj_optind) { /* no arg */
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
if (*ostr == ':')
|
if (*ostr == ':')
|
||||||
return (BADARG);
|
return (BADARG);
|
||||||
if (opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: option requires an argument -- %c\n",
|
"%s: option requires an argument -- %c\n",
|
||||||
__progname, optopt);
|
__progname, opj_optopt);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
} else /* white space */
|
} else /* white space */
|
||||||
optarg = nargv[optind];
|
opj_optarg = nargv[opj_optind];
|
||||||
place = EMSG;
|
place = EMSG;
|
||||||
++optind;
|
++opj_optind;
|
||||||
}
|
}
|
||||||
return (optopt); /* dump back option letter */
|
return (opj_optopt); /* dump back option letter */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getopt_long(int argc, char * const argv[], const char *optstring,
|
int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||||
struct option *longopts, int totlen) {
|
const opj_option_t *longopts, int totlen) {
|
||||||
static int lastidx,lastofs;
|
static int lastidx,lastofs;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int i,len;
|
int i,len;
|
||||||
char param = 1;
|
char param = 1;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
if (optind >= argc || !argv[optind] || *argv[optind]!='-')
|
if (opj_optind >= argc || !argv[opj_optind] || *argv[opj_optind]!='-')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (argv[optind][0]=='-' && argv[optind][1]==0) {
|
if (argv[opj_optind][0]=='-' && argv[opj_optind][1]==0) {
|
||||||
if(optind >= (argc - 1)){ /* no more input parameters */
|
if(opj_optind >= (argc - 1)){ /* no more input parameters */
|
||||||
param = 0;
|
param = 0;
|
||||||
}
|
}
|
||||||
else{ /* more input parameters */
|
else{ /* more input parameters */
|
||||||
if(argv[optind + 1][0] == '-'){
|
if(argv[opj_optind + 1][0] == '-'){
|
||||||
param = 0; /* Missing parameter after '-' */
|
param = 0; /* Missing parameter after '-' */
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -154,108 +147,108 @@ again:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (param == 0) {
|
if (param == 0) {
|
||||||
++optind;
|
++opj_optind;
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[optind][0]=='-') { /* long option */
|
if (argv[opj_optind][0]=='-') { /* long option */
|
||||||
char* arg=argv[optind]+1;
|
char* arg=argv[opj_optind]+1;
|
||||||
const struct option* o;
|
const opj_option_t* o;
|
||||||
o=longopts;
|
o=longopts;
|
||||||
len=sizeof(longopts[0]);
|
len=sizeof(longopts[0]);
|
||||||
|
|
||||||
if (param > 1){
|
if (param > 1){
|
||||||
arg = argv[optind+1];
|
arg = argv[opj_optind+1];
|
||||||
optind++;
|
opj_optind++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
arg = argv[optind]+1;
|
arg = argv[opj_optind]+1;
|
||||||
|
|
||||||
if(strlen(arg)>1){
|
if(strlen(arg)>1){
|
||||||
for (i=0;i<totlen;i=i+len,o++) {
|
for (i=0;i<totlen;i=i+len,o++) {
|
||||||
if (!strcmp(o->name,arg)) { /* match */
|
if (!strcmp(o->name,arg)) { /* match */
|
||||||
if (o->has_arg == 0) {
|
if (o->has_arg == 0) {
|
||||||
if ((argv[optind+1])&&(!(argv[optind+1][0]=='-'))){
|
if ((argv[opj_optind+1])&&(!(argv[opj_optind+1][0]=='-'))){
|
||||||
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[optind+1]);
|
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[opj_optind+1]);
|
||||||
++optind;
|
++opj_optind;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
optarg=argv[optind+1];
|
opj_optarg=argv[opj_optind+1];
|
||||||
if(optarg){
|
if(opj_optarg){
|
||||||
if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
if (opj_optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||||
if (opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!optarg && o->has_arg==1) { /* no argument there */
|
if (!opj_optarg && o->has_arg==1) { /* no argument there */
|
||||||
if (opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr,"%s: option requires an argument \n",arg);
|
fprintf(stderr,"%s: option requires an argument \n",arg);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++optind;
|
++opj_optind;
|
||||||
}
|
}
|
||||||
++optind;
|
++opj_optind;
|
||||||
if (o->flag)
|
if (o->flag)
|
||||||
*(o->flag)=o->val;
|
*(o->flag)=o->val;
|
||||||
else
|
else
|
||||||
return o->val;
|
return o->val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}//(end for)String not found in the list
|
}/*(end for)String not found in the list*/
|
||||||
fprintf(stderr,"Invalid option %s\n",arg);
|
fprintf(stderr,"Invalid option %s\n",arg);
|
||||||
++optind;
|
++opj_optind;
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}else{ /*Single character input parameter*/
|
}else{ /*Single character input parameter*/
|
||||||
if (*optstring==':') return ':';
|
if (*optstring==':') return ':';
|
||||||
if (lastidx!=optind) {
|
if (lastidx!=opj_optind) {
|
||||||
lastidx=optind; lastofs=0;
|
lastidx=opj_optind; lastofs=0;
|
||||||
}
|
}
|
||||||
optopt=argv[optind][lastofs+1];
|
opj_optopt=argv[opj_optind][lastofs+1];
|
||||||
if ((tmp=strchr(optstring,optopt))) {/*Found input parameter in list*/
|
if ((tmp=strchr(optstring,opj_optopt))) {/*Found input parameter in list*/
|
||||||
if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
|
if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
|
||||||
++optind;
|
++opj_optind;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
if (tmp[1]==':') { /* argument expected */
|
if (tmp[1]==':') { /* argument expected */
|
||||||
if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
|
if (tmp[2]==':' || argv[opj_optind][lastofs+2]) { /* "-foo", return "oo" as opj_optarg */
|
||||||
if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
|
if (!*(opj_optarg=argv[opj_optind]+lastofs+2)) opj_optarg=0;
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
optarg=argv[optind+1];
|
opj_optarg=argv[opj_optind+1];
|
||||||
if(optarg){
|
if(opj_optarg){
|
||||||
if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
if (opj_optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||||
if (opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!optarg) { /* missing argument */
|
if (!opj_optarg) { /* missing argument */
|
||||||
if (opterr) {
|
if (opj_opterr) {
|
||||||
fprintf(stderr,"%s: option requires an argument\n",arg);
|
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++optind;
|
++opj_optind;
|
||||||
}else {/*Argument not expected*/
|
}else {/*Argument not expected*/
|
||||||
++lastofs;
|
++lastofs;
|
||||||
return optopt;
|
return opj_optopt;
|
||||||
}
|
}
|
||||||
found:
|
found:
|
||||||
++optind;
|
++opj_optind;
|
||||||
return optopt;
|
return opj_optopt;
|
||||||
} else { /* not found */
|
} else { /* not found */
|
||||||
fprintf(stderr,"Invalid option %s\n",arg);
|
fprintf(stderr,"Invalid option %s\n",arg);
|
||||||
++optind;
|
++opj_optind;
|
||||||
return (BADCH);
|
return (BADCH);
|
||||||
}//end of not found
|
}/*end of not found*/
|
||||||
|
|
||||||
}// end of single character
|
}/* end of single character*/
|
||||||
}//end '-'
|
}/*end '-'*/
|
||||||
fprintf(stderr,"Invalid option\n");
|
fprintf(stderr,"Invalid option\n");
|
||||||
++optind;
|
++opj_optind;
|
||||||
return (BADCH);;
|
return (BADCH);;
|
||||||
}//end function
|
}/*end function*/
|
||||||
51
applications/common/opj_getopt.h
Normal file
51
applications/common/opj_getopt.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/* last review : october 29th, 2002 */
|
||||||
|
|
||||||
|
#include "opj_config.h"
|
||||||
|
|
||||||
|
#ifdef USE_SYSTEM_GETOPT
|
||||||
|
#include <getopt.h>
|
||||||
|
|
||||||
|
#define opj_opterr opterr
|
||||||
|
#define opj_optind optind
|
||||||
|
#define opj_optopt optopt
|
||||||
|
#define opj_optreset optreset
|
||||||
|
#define opj_optarg optarg
|
||||||
|
|
||||||
|
typedef struct option opj_option_t;
|
||||||
|
|
||||||
|
#define NO_ARG no_argument
|
||||||
|
#define REQ_ARG required_argument
|
||||||
|
#define OPT_ARG optional_argument
|
||||||
|
|
||||||
|
#define opj_getopt getopt
|
||||||
|
#define opj_getopt_long getopt_long
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifndef _GETOPT_H_
|
||||||
|
#define _GETOPT_H_
|
||||||
|
|
||||||
|
typedef struct opj_option
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
int has_arg;
|
||||||
|
int *flag;
|
||||||
|
int val;
|
||||||
|
} opj_option_t;
|
||||||
|
|
||||||
|
#define NO_ARG 0
|
||||||
|
#define REQ_ARG 1
|
||||||
|
#define OPT_ARG 2
|
||||||
|
|
||||||
|
extern int opj_opterr;
|
||||||
|
extern int opj_optind;
|
||||||
|
extern int opj_optopt;
|
||||||
|
extern int opj_optreset;
|
||||||
|
extern char *opj_optarg;
|
||||||
|
|
||||||
|
extern int opj_getopt(int nargc, char *const *nargv, const char *ostr);
|
||||||
|
extern int opj_getopt_long(int argc, char * const argv[], const char *optstring,
|
||||||
|
const opj_option_t *longopts, int totlen);
|
||||||
|
extern void reset_options_reading(void);
|
||||||
|
|
||||||
|
#endif /* _GETOPT_H_ */
|
||||||
|
#endif /* USE_SYSTEM_GETOPT */
|
||||||
@@ -5,6 +5,97 @@ What's New for OpenJPIP
|
|||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
Feburary 28, 2012
|
||||||
|
+ [kaori] enabled the opj_server to reply the first query consisting with len request from kakadu client
|
||||||
|
|
||||||
|
February 9, 2012
|
||||||
|
* [kaori] fixed Doxygen configuration file to document the utilities
|
||||||
|
+ [kaori] added execution argument to set port number for opj_dec_server, opj_viewer*
|
||||||
|
|
||||||
|
January 26, 2012
|
||||||
|
! [kaori] unapplied auxtrans_manager to the local mode
|
||||||
|
|
||||||
|
December 24, 2011
|
||||||
|
* [kaori] additional modification for the warning
|
||||||
|
|
||||||
|
December 22, 2011
|
||||||
|
* [kaori] fixed auxtrans_manager to enable MAC
|
||||||
|
* [kaori] warnings due to disregarding return value are removed
|
||||||
|
|
||||||
|
November 30, 2011
|
||||||
|
+ [kaori] TCP return (http-tcp) implemented
|
||||||
|
|
||||||
|
November 16, 2011
|
||||||
|
* [kaori] fixed Region of Interest option, and memory leak of opj_dec_server
|
||||||
|
+ [kaori] new feature to target JP2 files from www (libcurl required)
|
||||||
|
* [kaori] fixed opj_server execusion error (instant terminating) with autotool, cmake still need to be fixed
|
||||||
|
|
||||||
|
November 8, 2011
|
||||||
|
! [kaori] updated main page of doxygen
|
||||||
|
|
||||||
|
November 3, 2011
|
||||||
|
* [kaori] solved memory leak of opj_server
|
||||||
|
! [kaori] removed redundant defines
|
||||||
|
|
||||||
|
November 2, 2011
|
||||||
|
* [antonin] additional patches for autotools and cmake
|
||||||
|
|
||||||
|
October 26, 2011
|
||||||
|
* [kaori] additional patches for autotool are applied
|
||||||
|
|
||||||
|
October 25, 2011
|
||||||
|
* [kaori] patches for cmake and autotool are applied
|
||||||
|
* [kaori] fixed client viewer to be compatible with server response header both Content-type and Content-Type
|
||||||
|
|
||||||
|
October 20, 2011
|
||||||
|
+ [added] API style in openJPIP library
|
||||||
|
! [kaori] rearranged directories, applications are all under util/ directory, currently only 'make -f Makefile.nix' works
|
||||||
|
|
||||||
|
October 18, 2011
|
||||||
|
! [kaori] rearranged opj_server, opj_dec_server directory
|
||||||
|
|
||||||
|
October 14, 2011
|
||||||
|
+ [kaori] enable all progression orders
|
||||||
|
|
||||||
|
October 12, 2011
|
||||||
|
+ [kaori] enable layers requests; restricting the number of codesream quality layers
|
||||||
|
|
||||||
|
October 11, 2011
|
||||||
|
+ [antonin] enable JPT-stream request from client viewer option (credit to kaori)
|
||||||
|
|
||||||
|
October 10, 2011
|
||||||
|
- [antonin] removed obsolete indexer utility (credit to kaori)
|
||||||
|
+ [antonin] enabled JPP-stream (credit to kaori)
|
||||||
|
|
||||||
|
September 16, 2011
|
||||||
|
+ [kaori] enabled stateless requests from the opj_viewers
|
||||||
|
|
||||||
|
Septempber 1, 2011
|
||||||
|
* [kaori] changed terminating status of opj_server in debug/non-server mode
|
||||||
|
|
||||||
|
August 27, 2011
|
||||||
|
* [antonin] fixed missing include directory in opj_client/opj_dec_server/CMakeLists.txt
|
||||||
|
|
||||||
|
August 26, 2011
|
||||||
|
* [antonin] fixed cmake and autotools files to reflect recent indexer changes in JPIP
|
||||||
|
! [kaori] indexer using the latest openjpeg library
|
||||||
|
* [antonin] fixed cmake and autotools files to reflect recent changes in JPIP
|
||||||
|
! [kaori] fixed Makefile.nix to load openjpeg library from this archive
|
||||||
|
|
||||||
|
August 25, 2011
|
||||||
|
+ [kaori] added tid request support to JPIP client
|
||||||
|
+ [kaori] added quit JPIP server request
|
||||||
|
|
||||||
|
August 24, 2011
|
||||||
|
+ [kaori] added cachemodel_manager, which had been managed in target_manager previously
|
||||||
|
+ [kaori] added tid request support to JPIP server
|
||||||
|
|
||||||
|
August 16, 2011
|
||||||
|
* [antonin] fixed cmake support for openjpip
|
||||||
|
|
||||||
|
August 12, 2011
|
||||||
|
+ [antonin] added cmake support to openjpip
|
||||||
|
|
||||||
July 6, 2011
|
July 6, 2011
|
||||||
* [antonin] JPIP : fixed autotools to work with recent name changes
|
* [antonin] JPIP : fixed autotools to work with recent name changes
|
||||||
|
|
||||||
|
|||||||
16
applications/jpip/CMakeLists.txt
Normal file
16
applications/jpip/CMakeLists.txt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# required dep for server:
|
||||||
|
IF(BUILD_JPIP_SERVER)
|
||||||
|
FIND_PACKAGE(CURL REQUIRED)
|
||||||
|
FIND_PACKAGE(FCGI REQUIRED)
|
||||||
|
FIND_PACKAGE(Threads REQUIRED)
|
||||||
|
IF(NOT CMAKE_USE_PTHREADS_INIT)
|
||||||
|
MESSAGE(FATAL_ERROR "Only pthread are supported")
|
||||||
|
ENDIF(NOT CMAKE_USE_PTHREADS_INIT)
|
||||||
|
ENDIF(BUILD_JPIP_SERVER)
|
||||||
|
|
||||||
|
# JPIP library:
|
||||||
|
ADD_SUBDIRECTORY(libopenjpip)
|
||||||
|
|
||||||
|
# JPIP binaries:
|
||||||
|
ADD_SUBDIRECTORY(util)
|
||||||
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
SUBDIRS = libopenjpip opj_server opj_client tools
|
SUBDIRS = libopenjpip util
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
default: t_libopenjpip t_opj_server t_opj_dec_server t_tools
|
|
||||||
|
|
||||||
t_libopenjpip:
|
|
||||||
make -C libopenjpip -f Makefile.nix
|
|
||||||
|
|
||||||
t_opj_server:
|
|
||||||
make -C opj_server -f Makefile.nix
|
|
||||||
|
|
||||||
t_opj_dec_server:
|
|
||||||
make -C opj_client/opj_dec_server -f Makefile.nix
|
|
||||||
|
|
||||||
t_tools:
|
|
||||||
make -C tools -f Makefile.nix
|
|
||||||
|
|
||||||
clean:
|
|
||||||
make clean -C libopenjpip -f Makefile.nix
|
|
||||||
make clean -C opj_server -f Makefile.nix
|
|
||||||
make clean -C opj_client/opj_dec_server -f Makefile.nix
|
|
||||||
make clean -C tools -f Makefile.nix
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
========================================================================
|
========================================================================
|
||||||
OpenJPIP software 1.0 ReadMe
|
OpenJPIP software 2.1 ReadMe
|
||||||
|
|
||||||
OpenJPEG:
|
OpenJPEG:
|
||||||
http://www.openjpeg.org
|
http://www.openjpeg.org
|
||||||
@@ -26,13 +26,14 @@ OpenJPIP software is an implementation of JPEG 2000 Part9: Interactivity tools,
|
|||||||
( For more info about JPIP, check the website: http://www.jpeg.org/jpeg2000/j2kpart9.html)
|
( For more info about JPIP, check the website: http://www.jpeg.org/jpeg2000/j2kpart9.html)
|
||||||
The current implementation uses some results from the 2KAN project (http://www.2kan.org).
|
The current implementation uses some results from the 2KAN project (http://www.2kan.org).
|
||||||
|
|
||||||
First Version 1.0 covers:
|
Version 2.1 covers:
|
||||||
- JPT-stream (Tile based) media types
|
- JPT-stream (Tile) and JPP-stream (Precinct) media types
|
||||||
- Session, channels, cache model managements
|
- Session, channels, cache model managements
|
||||||
- JPIP over HTTP
|
- JPIP over HTTP, HTTP requests and TCP return
|
||||||
- Indexing JPEG 2000 files
|
- Indexing JPEG 2000 files
|
||||||
- Embedding XML formatted metadata
|
- Embedding XML formatted metadata
|
||||||
- Region Of Interest (ROI) requests
|
- Region Of Interest (ROI) requests
|
||||||
|
- Access to JP2 files with their URL
|
||||||
|
|
||||||
----------
|
----------
|
||||||
2. License
|
2. License
|
||||||
@@ -46,10 +47,9 @@ Neither the author, nor the university accept any responsibility for any kind of
|
|||||||
3. System requirements
|
3. System requirements
|
||||||
----------
|
----------
|
||||||
|
|
||||||
- OpenJPEG library (currently assumes it is installed on the system => will not use the one built higher in the directory structure)
|
|
||||||
- FastCGI development kit (C libraries) at server (http://www.fastcgi.com)
|
- FastCGI development kit (C libraries) at server (http://www.fastcgi.com)
|
||||||
|
- libcURL library
|
||||||
- Java application launcher at client
|
- Java application launcher at client
|
||||||
- Kakadu software ( http://www.kakadusoftware.com). Currently required to encode jpeg 2000 images with tile-parts. This will be implemented soon in openjpeg, making this requirement obsolete.
|
|
||||||
<Optional>
|
<Optional>
|
||||||
- Xerces2 java XML parser on the client for accessing embedded image metadata (http://xerces.apache.org/xerces2-j)
|
- Xerces2 java XML parser on the client for accessing embedded image metadata (http://xerces.apache.org/xerces2-j)
|
||||||
|
|
||||||
@@ -62,8 +62,6 @@ We tested this software with a virtual server running on the same Linux machine
|
|||||||
A Makefile is available in the same directory as this README file. Simply type 'make' and it will build all the required C-executables.
|
A Makefile is available in the same directory as this README file. Simply type 'make' and it will build all the required C-executables.
|
||||||
Concerning the java-based opj_viewer, simply type 'ant' in the corresponding directory (requires 'ant' utility of course)
|
Concerning the java-based opj_viewer, simply type 'ant' in the corresponding directory (requires 'ant' utility of course)
|
||||||
|
|
||||||
CMake files ar planned to be included ASAP.
|
|
||||||
|
|
||||||
The documentation can be build this way (requires doxygen utility):
|
The documentation can be build this way (requires doxygen utility):
|
||||||
cd doc
|
cd doc
|
||||||
doxygen Doxyfile
|
doxygen Doxyfile
|
||||||
@@ -90,10 +88,15 @@ Server:
|
|||||||
|
|
||||||
2. Launch opj_server from the server terminal:
|
2. Launch opj_server from the server terminal:
|
||||||
% spawn-fcgi -f ./opj_server -p 3000 -n
|
% spawn-fcgi -f ./opj_server -p 3000 -n
|
||||||
|
|
||||||
|
For shutting down JPIP server:
|
||||||
|
%GET http://hostname/myFCGI?quitJPIP
|
||||||
|
Notice, http://hostname/myFCGI is the HTTP server URI (myFCGI refers to opj_server by the server setting)
|
||||||
|
Requst message "quitJPIP" can be changed in Makfile, modify -DQUIT_SIGNAL=\"quitJPIP\"
|
||||||
|
|
||||||
Client:
|
Client:
|
||||||
1. Launch image decoding server, and keep it alive as long as image viewers are open
|
1. Launch image decoding server, and keep it alive as long as image viewers are open
|
||||||
% ./opj_dec_server
|
% ./opj_dec_server [portnumber (50000 by default)]
|
||||||
|
|
||||||
You might prefer to implement this program from another directory since cache files are saved in the working directory.
|
You might prefer to implement this program from another directory since cache files are saved in the working directory.
|
||||||
% mkdir cache
|
% mkdir cache
|
||||||
@@ -101,10 +104,15 @@ Client:
|
|||||||
% ../opj_dec_server
|
% ../opj_dec_server
|
||||||
|
|
||||||
2. Open image viewers (as many as needed)
|
2. Open image viewers (as many as needed)
|
||||||
% java -jar opj_viewer.jar http://hostname/myFCGI JP2_filename.jp2
|
% java -jar opj_viewer.jar http://hostname/myFCGI path/filename.jp2 [hostname] [portnumber] [stateless/session] [jptstream/jppstream] [tcp/udp]
|
||||||
( The arguments
|
( The arguments
|
||||||
- http://hostname/myFCGI is the HTTP server URI (myFCGI refers to opj_server by the server setting)
|
- http://hostname/myFCGI is the HTTP server URI (myFCGI refers to opj_server by the server setting)
|
||||||
- JP2_filename.jp2 is the name of a JP2 file available on the server.)
|
- path/filename.jp2 is the server local path or URL of a JP2 file
|
||||||
|
- host name of opj_dec_server, localhost by default
|
||||||
|
- portnumber of opj_dec_server, 50000 by default
|
||||||
|
- request type stateless for no caching, session (default) for caching
|
||||||
|
- return media type, JPT-stream tile based stream, or JPP-stream (default) precinct based stream
|
||||||
|
- auxiliary return protocol, tcp or udp (udp is not implemented yet), if not given, return data is filled in http chunk
|
||||||
Image viewer GUI instructions:
|
Image viewer GUI instructions:
|
||||||
Scale up request: Enlarge the window
|
Scale up request: Enlarge the window
|
||||||
ROI request: Select a region by mouse click and drag, then click inside the red frame of the selected region
|
ROI request: Select a region by mouse click and drag, then click inside the red frame of the selected region
|
||||||
@@ -114,7 +122,7 @@ Client:
|
|||||||
Open a new window presenting an aligned image with a locally stored image: Click button "Image Registration" (Under Construction)
|
Open a new window presenting an aligned image with a locally stored image: Click button "Image Registration" (Under Construction)
|
||||||
|
|
||||||
3. Quit the image decoding server through the telnet, be sure all image viewers are closed
|
3. Quit the image decoding server through the telnet, be sure all image viewers are closed
|
||||||
% telnet localhost 5000
|
% telnet localhost 50000
|
||||||
quit
|
quit
|
||||||
|
|
||||||
----------
|
----------
|
||||||
@@ -122,12 +130,11 @@ Client:
|
|||||||
----------
|
----------
|
||||||
|
|
||||||
An example to encode a TIF image "copenhague1.tif" at resolution 4780x4050, 8bit/pixel, grayscale.
|
An example to encode a TIF image "copenhague1.tif" at resolution 4780x4050, 8bit/pixel, grayscale.
|
||||||
|
% ./image_to_j2k -i copenhague1.tif -o copenhague1.jp2 -p RPCL -c [64,64] -t 640,480 -jpip -TP R
|
||||||
|
|
||||||
1. J2K encoding using Kakadu with an option which introduces the tile-part flag at each resolution level
|
options
|
||||||
% ./kdu_compress -i copenhague1.tif -o copenhague1.j2k Corder=RPCL ORGtparts=R Stiles={256,256}
|
-jpip : embed index table 'cidx' box into the output JP2 file (obligation for JPIP)
|
||||||
|
-TP R : partition a tile into tile parts of different resolution levels (obligation for JPT-stream)
|
||||||
2. JP2 encoding with embedding indexing data
|
|
||||||
% ./index_create copenhague1.j2k copenhague1.jp2 2
|
|
||||||
|
|
||||||
<Option>
|
<Option>
|
||||||
3. Embed metadata into JP2 file
|
3. Embed metadata into JP2 file
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ WARN_LOGFILE =
|
|||||||
# directories like "/usr/src/myproject". Separate the files or directories
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
# with spaces.
|
# with spaces.
|
||||||
|
|
||||||
INPUT = .. ../libopenjpip ../opj_server ../opj_client/opj_dec_server ../tools ../tools/indexer
|
INPUT = .. ../libopenjpip ../util
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
72
applications/jpip/libopenjpip/CMakeLists.txt
Normal file
72
applications/jpip/libopenjpip/CMakeLists.txt
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||||
|
${FCGI_INCLUDE_DIRS}
|
||||||
|
${CURL_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Defines the source code for the library
|
||||||
|
SET(OPENJPIP_SRCS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/boxheader_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/codestream_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/imgreg_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/marker_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/msgqueue_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/box_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/faixbox_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/index_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/metadata_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/placeholder_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/byte_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/ihdrbox_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/manfbox_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/mhixbox_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/target_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cachemodel_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/j2kheader_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_encoder.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/openjpip.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/query_parser.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/channel_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/session_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jpip_parser.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/sock_manager.c
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(SERVER_SRCS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/auxtrans_manager.c
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(LOCAL_SRCS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cache_manager.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/dec_clientmsg_handler.c
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build the library
|
||||||
|
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME})
|
||||||
|
IF(WIN32)
|
||||||
|
# add Winsock on windows+mingw
|
||||||
|
TARGET_LINK_LIBRARIES(openjpip_local ws2_32)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
# Install library
|
||||||
|
INSTALL(TARGETS openjpip_local
|
||||||
|
EXPORT OpenJPEGTargets
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(BUILD_JPIP_SERVER)
|
||||||
|
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
SET_TARGET_PROPERTIES(openjpip_server
|
||||||
|
PROPERTIES COMPILE_FLAGS "-DSERVER")
|
||||||
|
INSTALL(TARGETS openjpip_server
|
||||||
|
EXPORT OpenJPEGTargets
|
||||||
|
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||||
|
)
|
||||||
|
ENDIF(BUILD_JPIP_SERVER)
|
||||||
@@ -3,9 +3,22 @@ MAINTAINERCLEANFILES = Makefile.in
|
|||||||
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
|
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
|
||||||
includes_HEADERS =
|
includes_HEADERS =
|
||||||
|
|
||||||
lib_LTLIBRARIES = libopenjpip_server.la libopenjpip_local.la
|
lib_LTLIBRARIES =
|
||||||
|
|
||||||
|
if WANT_JPIP
|
||||||
|
lib_LTLIBRARIES += libopenjpip_local.la
|
||||||
|
endif
|
||||||
|
|
||||||
|
if WANT_JPIP_SERVER
|
||||||
|
lib_LTLIBRARIES += libopenjpip_server.la
|
||||||
|
endif
|
||||||
|
|
||||||
JPIP_SRC = \
|
JPIP_SRC = \
|
||||||
|
openjpip.c \
|
||||||
|
query_parser.c \
|
||||||
|
channel_manager.c \
|
||||||
|
session_manager.c \
|
||||||
|
jpip_parser.c \
|
||||||
boxheader_manager.c \
|
boxheader_manager.c \
|
||||||
codestream_manager.c \
|
codestream_manager.c \
|
||||||
imgreg_manager.c \
|
imgreg_manager.c \
|
||||||
@@ -21,6 +34,11 @@ ihdrbox_manager.c \
|
|||||||
manfbox_manager.c \
|
manfbox_manager.c \
|
||||||
mhixbox_manager.c \
|
mhixbox_manager.c \
|
||||||
target_manager.c \
|
target_manager.c \
|
||||||
|
cachemodel_manager.c \
|
||||||
|
j2kheader_manager.c \
|
||||||
|
jp2k_encoder.c \
|
||||||
|
sock_manager.c \
|
||||||
|
openjpip.h \
|
||||||
bool.h \
|
bool.h \
|
||||||
boxheader_manager.h \
|
boxheader_manager.h \
|
||||||
box_manager.h \
|
box_manager.h \
|
||||||
@@ -36,35 +54,73 @@ metadata_manager.h \
|
|||||||
mhixbox_manager.h \
|
mhixbox_manager.h \
|
||||||
msgqueue_manager.h \
|
msgqueue_manager.h \
|
||||||
placeholder_manager.h \
|
placeholder_manager.h \
|
||||||
target_manager.h
|
target_manager.h \
|
||||||
|
cachemodel_manager.h \
|
||||||
|
j2kheader_manager.h \
|
||||||
|
jp2k_encoder.h \
|
||||||
|
query_parser.h \
|
||||||
|
channel_manager.h \
|
||||||
|
session_manager.h \
|
||||||
|
jpip_parser.h \
|
||||||
|
jp2k_decoder.h \
|
||||||
|
sock_manager.h
|
||||||
|
|
||||||
|
SERVER_SRC = auxtrans_manager.c \
|
||||||
|
auxtrans_manager.h
|
||||||
|
|
||||||
|
LOCAL_SRC = jp2k_decoder.c \
|
||||||
|
imgsock_manager.c \
|
||||||
|
jpipstream_manager.c \
|
||||||
|
cache_manager.c \
|
||||||
|
dec_clientmsg_handler.c \
|
||||||
|
imgsock_manager.h \
|
||||||
|
jpipstream_manager.h \
|
||||||
|
cache_manager.h \
|
||||||
|
dec_clientmsg_handler.h
|
||||||
|
|
||||||
libopenjpip_server_la_CPPFLAGS = \
|
libopenjpip_server_la_CPPFLAGS = \
|
||||||
-I. \
|
-I. \
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||||
@FCGI_CFLAGS@ \
|
@FCGI_CFLAGS@ \
|
||||||
|
@LIBCURL_CFLAGS@ \
|
||||||
-DSERVER
|
-DSERVER
|
||||||
libopenjpip_server_la_CFLAGS =
|
libopenjpip_server_la_CFLAGS = @THREAD_CFLAGS@
|
||||||
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ -lm
|
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ @THREAD_LIBS@ -lm
|
||||||
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
||||||
libopenjpip_server_la_SOURCES = $(JPIP_SRC)
|
libopenjpip_server_la_SOURCES = $(JPIP_SRC) $(SERVER_SRC)
|
||||||
|
|
||||||
libopenjpip_local_la_CPPFLAGS = \
|
libopenjpip_local_la_CPPFLAGS = \
|
||||||
-I. \
|
-I. \
|
||||||
|
-I$(top_srcdir)/libopenjpeg \
|
||||||
|
-I$(top_builddir)/libopenjpeg \
|
||||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||||
-I$(top_builddir)/applications/jpip/libopenjpip
|
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||||
libopenjpip_local_la_CFLAGS =
|
@LIBCURL_CFLAGS@
|
||||||
libopenjpip_local_la_LIBADD = -lm
|
libopenjpip_local_la_CFLAGS =
|
||||||
|
libopenjpip_local_la_LIBADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
||||||
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
||||||
libopenjpip_local_la_SOURCES = $(JPIP_SRC)
|
libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC)
|
||||||
|
|
||||||
install-data-hook:
|
install-data-hook:
|
||||||
|
if WANT_JPIP_SERVER
|
||||||
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
|
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
|
||||||
|
if BUILD_SHARED
|
||||||
@( $(call solist_s) ) >> $(top_builddir)/report.txt
|
@( $(call solist_s) ) >> $(top_builddir)/report.txt
|
||||||
|
endif
|
||||||
|
if BUILD_STATIC
|
||||||
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
|
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
if WANT_JPIP
|
||||||
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
|
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
|
||||||
|
if BUILD_SHARED
|
||||||
@( $(call solist_c) ) >> $(top_builddir)/report.txt
|
@( $(call solist_c) ) >> $(top_builddir)/report.txt
|
||||||
|
endif
|
||||||
|
if BUILD_STATIC
|
||||||
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
|
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;)
|
solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;)
|
||||||
get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2)
|
get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
default: local server
|
|
||||||
|
|
||||||
local:
|
|
||||||
make -f comMakefile.mk
|
|
||||||
|
|
||||||
server:
|
|
||||||
rm *.o && make jpipserver=yes -f comMakefile.mk
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.a *.o *~
|
|
||||||
267
applications/jpip/libopenjpip/auxtrans_manager.c
Normal file
267
applications/jpip/libopenjpip/auxtrans_manager.c
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* 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 "auxtrans_manager.h"
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <process.h>
|
||||||
|
#else
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SERVER
|
||||||
|
#include "fcgi_stdio.h"
|
||||||
|
#define logstream FCGI_stdout
|
||||||
|
#else
|
||||||
|
#define FCGI_stdout stdout
|
||||||
|
#define FCGI_stderr stderr
|
||||||
|
#define logstream stderr
|
||||||
|
#endif /*SERVER */
|
||||||
|
|
||||||
|
auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport)
|
||||||
|
{
|
||||||
|
auxtrans_param_t auxtrans;
|
||||||
|
|
||||||
|
auxtrans.tcpauxport = tcp_auxport;
|
||||||
|
auxtrans.udpauxport = udp_auxport;
|
||||||
|
|
||||||
|
if( 49152 <= tcp_auxport && tcp_auxport <= 65535)
|
||||||
|
auxtrans.tcplistensock = open_listeningsocket( tcp_auxport);
|
||||||
|
else
|
||||||
|
auxtrans.tcplistensock = -1;
|
||||||
|
|
||||||
|
auxtrans.udplistensock = -1;
|
||||||
|
/* open listening socket for udp later */
|
||||||
|
|
||||||
|
return auxtrans;
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_aux_transport( auxtrans_param_t auxtrans)
|
||||||
|
{
|
||||||
|
if( auxtrans.tcplistensock != -1)
|
||||||
|
if( close_socket( auxtrans.tcplistensock) != 0)
|
||||||
|
perror("close");
|
||||||
|
|
||||||
|
if( auxtrans.udplistensock != -1)
|
||||||
|
if( close_socket( auxtrans.udplistensock) != 0)
|
||||||
|
perror("close");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!< auxiliary response parameters */
|
||||||
|
typedef struct aux_response_param{
|
||||||
|
char *cid; /*!< channel ID */
|
||||||
|
unsigned char *data; /*!< sending data */
|
||||||
|
int datalen; /*!< length of data */
|
||||||
|
int maxlenPerFrame; /*!< maximum data length to send per frame */
|
||||||
|
SOCKET listensock; /*!< listeing socket */
|
||||||
|
#ifdef _WIN32
|
||||||
|
HANDLE hTh; /*!< thread handle */
|
||||||
|
#endif
|
||||||
|
} aux_response_param_t;
|
||||||
|
|
||||||
|
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame);
|
||||||
|
|
||||||
|
void delete_auxresponse( aux_response_param_t **auxresponse);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsigned __stdcall aux_streaming( void *arg);
|
||||||
|
#else
|
||||||
|
void * aux_streaming( void *arg);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame)
|
||||||
|
{
|
||||||
|
aux_response_param_t *auxresponse;
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsigned int threadId;
|
||||||
|
#else
|
||||||
|
pthread_t thread;
|
||||||
|
int status;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( istcp){
|
||||||
|
if( auxtrans.tcplistensock == -1){
|
||||||
|
fprintf( FCGI_stderr, "Error: error in send_responsedata_on_aux(), tcp listening socket no open\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auxresponse = gene_auxresponse( istcp, auxtrans, cid, data, datalen, maxlenPerFrame);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
auxresponse->hTh = (HANDLE)_beginthreadex( NULL, 0, &aux_streaming, auxresponse, 0, &threadId);
|
||||||
|
if( auxresponse->hTh == 0)
|
||||||
|
fprintf( FCGI_stderr,"ERRO: pthread_create() %s", strerror( (int)auxresponse->hTh));
|
||||||
|
#else
|
||||||
|
status = pthread_create( &thread, NULL, &aux_streaming, auxresponse);
|
||||||
|
if( status != 0)
|
||||||
|
fprintf( FCGI_stderr,"ERROR: pthread_create() %s",strerror(status));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf( FCGI_stderr, "Error: error in send_responsedata_on_aux(), udp not implemented\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame)
|
||||||
|
{
|
||||||
|
aux_response_param_t *auxresponse;
|
||||||
|
|
||||||
|
auxresponse = (aux_response_param_t *)malloc( sizeof(aux_response_param_t));
|
||||||
|
|
||||||
|
auxresponse->cid = strdup( cid);
|
||||||
|
auxresponse->data = data;
|
||||||
|
auxresponse->datalen = datalen;
|
||||||
|
auxresponse->maxlenPerFrame = maxlenPerFrame;
|
||||||
|
auxresponse->listensock = istcp ? auxtrans.tcplistensock : auxtrans.udplistensock;
|
||||||
|
|
||||||
|
return auxresponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
void delete_auxresponse( aux_response_param_t **auxresponse)
|
||||||
|
{
|
||||||
|
free( (*auxresponse)->cid);
|
||||||
|
free( (*auxresponse)->data);
|
||||||
|
free( *auxresponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify cid sent from client
|
||||||
|
*
|
||||||
|
* @param [in] connected_socket file descriptor of the connected socket
|
||||||
|
* @param [in] refcid refenrece channel ID
|
||||||
|
* @param [in] fp file pointer for log of aux stream
|
||||||
|
* @return true if identified, false otherwise
|
||||||
|
*/
|
||||||
|
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
|
||||||
|
|
||||||
|
bool recv_ack( SOCKET connected_socket, void *data);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
unsigned __stdcall aux_streaming( void *arg)
|
||||||
|
#else
|
||||||
|
void * aux_streaming( void *arg)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
SOCKET connected_socket;
|
||||||
|
unsigned char *chunk, *ptr;
|
||||||
|
int maxLenOfBody, remlen, chunklen;
|
||||||
|
const int headlen = 8;
|
||||||
|
|
||||||
|
aux_response_param_t *auxresponse = (aux_response_param_t *)arg;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
CloseHandle( auxresponse->hTh);
|
||||||
|
#else
|
||||||
|
pthread_detach( pthread_self());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
chunk = (unsigned char *)malloc( auxresponse->maxlenPerFrame);
|
||||||
|
maxLenOfBody = auxresponse->maxlenPerFrame - headlen;
|
||||||
|
remlen = auxresponse->datalen;
|
||||||
|
|
||||||
|
while((connected_socket = accept_socket( auxresponse->listensock)) != -1){
|
||||||
|
if( identify_cid( connected_socket, auxresponse->cid, FCGI_stderr)){
|
||||||
|
ptr = auxresponse->data;
|
||||||
|
while( 0 < remlen){
|
||||||
|
memset( chunk, 0, auxresponse->maxlenPerFrame);
|
||||||
|
|
||||||
|
chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
|
||||||
|
chunklen += headlen;
|
||||||
|
|
||||||
|
chunk[0] = (chunklen >> 8) & 0xff;
|
||||||
|
chunk[1] = chunklen & 0xff;
|
||||||
|
|
||||||
|
memcpy( chunk+headlen, ptr, chunklen-headlen);
|
||||||
|
|
||||||
|
do{
|
||||||
|
send_stream( connected_socket, chunk, chunklen);
|
||||||
|
}while( !recv_ack( connected_socket, chunk));
|
||||||
|
|
||||||
|
remlen -= maxLenOfBody;
|
||||||
|
ptr += maxLenOfBody;
|
||||||
|
}
|
||||||
|
if( close_socket( connected_socket) != 0)
|
||||||
|
perror("close");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free( chunk);
|
||||||
|
|
||||||
|
delete_auxresponse( &auxresponse);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
_endthreadex(0);
|
||||||
|
#else
|
||||||
|
pthread_exit(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
|
||||||
|
{
|
||||||
|
char *cid;
|
||||||
|
bool succeed;
|
||||||
|
|
||||||
|
if(!(cid = receive_string( connected_socket))){
|
||||||
|
fprintf( fp, "Error: error in identify_cid(), while receiving cid from client\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
succeed = false;
|
||||||
|
if( strncmp( refcid, cid, strlen( refcid)) == 0)
|
||||||
|
succeed = true;
|
||||||
|
|
||||||
|
free( cid);
|
||||||
|
|
||||||
|
return succeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool recv_ack( SOCKET connected_socket, void *data)
|
||||||
|
{
|
||||||
|
char *header;
|
||||||
|
bool succeed;
|
||||||
|
|
||||||
|
header = receive_stream( connected_socket, 8);
|
||||||
|
|
||||||
|
if( memcmp( header, data, 8) != 0)
|
||||||
|
succeed = false;
|
||||||
|
else
|
||||||
|
succeed = true;
|
||||||
|
|
||||||
|
free( header);
|
||||||
|
|
||||||
|
return succeed;
|
||||||
|
}
|
||||||
72
applications/jpip/libopenjpip/auxtrans_manager.h
Normal file
72
applications/jpip/libopenjpip/auxtrans_manager.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* 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 AUXTRANS_MANAGER_H_
|
||||||
|
# define AUXTRANS_MANAGER_H_
|
||||||
|
|
||||||
|
#include "sock_manager.h"
|
||||||
|
|
||||||
|
/** auxiliary transport setting parameters*/
|
||||||
|
typedef struct auxtrans_param{
|
||||||
|
int tcpauxport; /**< tcp port*/
|
||||||
|
int udpauxport; /**< udp port*/
|
||||||
|
SOCKET tcplistensock; /**< listenning socket for aux tcp (-1 if not open)*/
|
||||||
|
SOCKET udplistensock; /**< listenning socket for aux udp (-1 if not open)*/
|
||||||
|
} auxtrans_param_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize auxiliary transport server of JPIP server
|
||||||
|
*
|
||||||
|
* @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 49152–65535)
|
||||||
|
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152–65535)
|
||||||
|
* @return intialized transport parameters
|
||||||
|
*/
|
||||||
|
auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close auxiliary transport server of JPIP server
|
||||||
|
*
|
||||||
|
* @param[in] auxtrans closing transport server
|
||||||
|
*/
|
||||||
|
void close_aux_transport( auxtrans_param_t auxtrans);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send response data on aux transport
|
||||||
|
*
|
||||||
|
* @param[in] istcp true if tcp, false if udp
|
||||||
|
* @param[in] auxtrans available transport parameters
|
||||||
|
* @param[in] cid channel ID
|
||||||
|
* @param[in] data sending data
|
||||||
|
* @param[in] length length of data
|
||||||
|
* @param[in] maxlenPerFrame maximum data length to send per frame
|
||||||
|
*/
|
||||||
|
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int length, int maxlenPerFrame);
|
||||||
|
|
||||||
|
#endif /* !AUXTRANS_MANAGER_H_ */
|
||||||
@@ -28,11 +28,9 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "box_manager.h"
|
#include "box_manager.h"
|
||||||
|
|
||||||
@@ -43,7 +41,7 @@
|
|||||||
#define FCGI_stdout stdout
|
#define FCGI_stdout stdout
|
||||||
#define FCGI_stderr stderr
|
#define FCGI_stderr stderr
|
||||||
#define logstream stderr
|
#define logstream stderr
|
||||||
#endif //SERVER
|
#endif /*SERVER*/
|
||||||
|
|
||||||
boxlist_param_t * gene_boxlist()
|
boxlist_param_t * gene_boxlist()
|
||||||
{
|
{
|
||||||
@@ -74,7 +72,7 @@ boxlist_param_t * get_boxstructure( int fd, Byte8_t offset, Byte8_t length)
|
|||||||
if( !boxlist)
|
if( !boxlist)
|
||||||
boxlist = gene_boxlist();
|
boxlist = gene_boxlist();
|
||||||
insert_box_into_list( box, boxlist);
|
insert_box_into_list( box, boxlist);
|
||||||
}while( pos < offset+length);
|
}while( pos < (int)(offset+length));
|
||||||
|
|
||||||
return boxlist;
|
return boxlist;
|
||||||
}
|
}
|
||||||
@@ -86,7 +84,7 @@ box_param_t * gene_boxbyOffset( int fd, Byte8_t offset)
|
|||||||
char *boxtype;
|
char *boxtype;
|
||||||
box_param_t *box;
|
box_param_t *box;
|
||||||
|
|
||||||
// read LBox and TBox
|
/* read LBox and TBox*/
|
||||||
if(!(data = fetch_bytes( fd, offset, 8))){
|
if(!(data = fetch_bytes( fd, offset, 8))){
|
||||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %lld)\n", fd, offset);
|
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %lld)\n", fd, offset);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -96,10 +94,10 @@ box_param_t * gene_boxbyOffset( int fd, Byte8_t offset)
|
|||||||
boxlen = (Byte8_t)big4(data);
|
boxlen = (Byte8_t)big4(data);
|
||||||
boxtype = (char *)(data+4);
|
boxtype = (char *)(data+4);
|
||||||
|
|
||||||
// box type constraint
|
/* box type constraint*/
|
||||||
if( !isalpha(boxtype[0]) || !isalpha(boxtype[1]) ||
|
if( !isalpha(boxtype[0]) || !isalpha(boxtype[1]) ||
|
||||||
(!isalnum(boxtype[2])&&!isblank(boxtype[2])) ||
|
(!isalnum(boxtype[2])&&!isspace(boxtype[2])) ||
|
||||||
(!isalpha(boxtype[3])&&!isblank(boxtype[3]))){
|
(!isalpha(boxtype[3])&&!isspace(boxtype[3]))){
|
||||||
free( data);
|
free( data);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -107,7 +105,7 @@ box_param_t * gene_boxbyOffset( int fd, Byte8_t offset)
|
|||||||
if( boxlen == 1){
|
if( boxlen == 1){
|
||||||
Byte_t *data2;
|
Byte_t *data2;
|
||||||
headlen = 16;
|
headlen = 16;
|
||||||
// read XLBox
|
/* read XLBox*/
|
||||||
if((data2 = fetch_bytes( fd, offset+8, 8))){
|
if((data2 = fetch_bytes( fd, offset+8, 8))){
|
||||||
boxlen = big8(data2);
|
boxlen = big8(data2);
|
||||||
free(data2);
|
free(data2);
|
||||||
@@ -135,21 +133,21 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset)
|
|||||||
char *boxtype;
|
char *boxtype;
|
||||||
box_param_t *box;
|
box_param_t *box;
|
||||||
|
|
||||||
// read LBox and TBox
|
/* read LBox and TBox*/
|
||||||
headlen = 8;
|
headlen = 8;
|
||||||
boxlen = (Byte8_t)big4( stream);
|
boxlen = (Byte8_t)big4( stream);
|
||||||
boxtype = (char *)( stream+4);
|
boxtype = (char *)( stream+4);
|
||||||
|
|
||||||
// box type constraint
|
/* box type constraint*/
|
||||||
if( !isalpha(boxtype[0]) || !isalpha(boxtype[1]) ||
|
if( !isalpha(boxtype[0]) || !isalpha(boxtype[1]) ||
|
||||||
(!isalnum(boxtype[2])&&!isblank(boxtype[2])) ||
|
(!isalnum(boxtype[2])&&!isspace(boxtype[2])) ||
|
||||||
(!isalpha(boxtype[3])&&!isblank(boxtype[3]))){
|
(!isalpha(boxtype[3])&&!isspace(boxtype[3]))){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( boxlen == 1){
|
if( boxlen == 1){
|
||||||
headlen = 16;
|
headlen = 16;
|
||||||
boxlen = big8( stream+8); // read XLBox
|
boxlen = big8( stream+8); /* read XLBox*/
|
||||||
}
|
}
|
||||||
box = (box_param_t *)malloc( sizeof( box_param_t));
|
box = (box_param_t *)malloc( sizeof( box_param_t));
|
||||||
box->fd = -1;
|
box->fd = -1;
|
||||||
@@ -163,7 +161,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[])
|
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, const char TBox[])
|
||||||
{
|
{
|
||||||
Byte8_t pos;
|
Byte8_t pos;
|
||||||
Byte_t *data;
|
Byte_t *data;
|
||||||
@@ -172,19 +170,15 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
|
|||||||
box_param_t *foundbox;
|
box_param_t *foundbox;
|
||||||
|
|
||||||
|
|
||||||
if( length==0){ // set the max length
|
if( length==0){ /* set the max length*/
|
||||||
struct stat sb;
|
if( (length = get_filesize( fd) - offset) <= 0)
|
||||||
if( fstat( fd, &sb) == -1){
|
|
||||||
fprintf( FCGI_stdout, "Reason: Target broken (fstat error)\r\n");
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
length = (Byte8_t)sb.st_size - offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = offset;
|
pos = offset;
|
||||||
while( pos < offset+length-7){ // LBox+TBox-1=7
|
while( pos < offset+length-7){ /* LBox+TBox-1=7*/
|
||||||
|
|
||||||
// read LBox and TBox
|
/* read LBox and TBox*/
|
||||||
if((data = fetch_bytes( fd, pos, 8))){
|
if((data = fetch_bytes( fd, pos, 8))){
|
||||||
headlen = 8;
|
headlen = 8;
|
||||||
boxlen = (Byte8_t)big4(data);
|
boxlen = (Byte8_t)big4(data);
|
||||||
@@ -193,7 +187,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
|
|||||||
if( boxlen == 1){
|
if( boxlen == 1){
|
||||||
Byte_t *data2;
|
Byte_t *data2;
|
||||||
headlen = 16;
|
headlen = 16;
|
||||||
// read XLBox
|
/* read XLBox*/
|
||||||
if((data2 = fetch_bytes( fd, pos+8, 8))){
|
if((data2 = fetch_bytes( fd, pos+8, 8))){
|
||||||
boxlen = big8(data2);
|
boxlen = big8(data2);
|
||||||
free(data2);
|
free(data2);
|
||||||
@@ -227,7 +221,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, char TBox[])
|
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, const char TBox[])
|
||||||
{
|
{
|
||||||
Byte8_t pos;
|
Byte8_t pos;
|
||||||
Byte_t *data;
|
Byte_t *data;
|
||||||
@@ -236,22 +230,22 @@ box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t le
|
|||||||
box_param_t *foundbox;
|
box_param_t *foundbox;
|
||||||
|
|
||||||
|
|
||||||
if( length<=0){ // set the max length
|
if( length<=0){ /* set the max length*/
|
||||||
fprintf( FCGI_stderr, "func gene_boxbyTypeinStream(), max length must be more than 0\n");
|
fprintf( FCGI_stderr, "func gene_boxbyTypeinStream(), max length must be more than 0\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = offset;
|
pos = offset;
|
||||||
while( pos < offset+length-7){ // LBox+TBox-1=7
|
while( pos < offset+length-7){ /* LBox+TBox-1=7*/
|
||||||
|
|
||||||
// read LBox and TBox
|
/* read LBox and TBox*/
|
||||||
data = stream + pos;
|
data = stream + pos;
|
||||||
headlen = 8;
|
headlen = 8;
|
||||||
boxlen = (Byte8_t)big4(data);
|
boxlen = (Byte8_t)big4(data);
|
||||||
boxtype = (char *)(data+4);
|
boxtype = (char *)(data+4);
|
||||||
|
|
||||||
if( boxlen == 1){
|
if( boxlen == 1){
|
||||||
// read XLBox
|
/* read XLBox*/
|
||||||
headlen = 16;
|
headlen = 16;
|
||||||
boxlen = big8( data+8);
|
boxlen = big8( data+8);
|
||||||
}
|
}
|
||||||
@@ -278,7 +272,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset)
|
|||||||
return gene_boxbyOffset( superbox->fd, get_DBoxoff( superbox)+offset);
|
return gene_boxbyOffset( superbox->fd, get_DBoxoff( superbox)+offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, char TBox[])
|
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, const char TBox[])
|
||||||
{
|
{
|
||||||
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, get_DBoxlen( superbox)-offset, TBox);
|
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, get_DBoxlen( superbox)-offset, TBox);
|
||||||
}
|
}
|
||||||
@@ -323,7 +317,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset)
|
|||||||
return fetch_8bytebigendian( box->fd, get_DBoxoff( box)+offset);
|
return fetch_8bytebigendian( box->fd, get_DBoxoff( box)+offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
box_param_t * search_box( char type[], boxlist_param_t *boxlist)
|
box_param_t * search_box( const char type[], boxlist_param_t *boxlist)
|
||||||
{
|
{
|
||||||
box_param_t *foundbox;
|
box_param_t *foundbox;
|
||||||
|
|
||||||
|
|||||||
@@ -31,24 +31,23 @@
|
|||||||
#ifndef BOX_MANAGER_H_
|
#ifndef BOX_MANAGER_H_
|
||||||
# define BOX_MANAGER_H_
|
# define BOX_MANAGER_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "byte_manager.h"
|
#include "byte_manager.h"
|
||||||
|
|
||||||
//! box parameters
|
/** box parameters*/
|
||||||
typedef struct box_param{
|
typedef struct box_param{
|
||||||
int fd; //!< file descriptor
|
int fd; /**< file descriptor*/
|
||||||
Byte8_t offset; //!< byte position of the whole Box (LBox) in the file
|
Byte8_t offset; /**< byte position of the whole Box (LBox) in the file*/
|
||||||
Byte_t headlen; //!< header length 8 or 16
|
Byte_t headlen; /**< header length 8 or 16*/
|
||||||
Byte8_t length; //!< length of the whole Box
|
Byte8_t length; /**< length of the whole Box*/
|
||||||
char type[4]; //!< type of information in the DBox
|
char type[4]; /**< type of information in the DBox*/
|
||||||
struct box_param *next; //!< pointer to the next box
|
struct box_param *next; /**< pointer to the next box*/
|
||||||
} box_param_t;
|
} box_param_t;
|
||||||
|
|
||||||
|
|
||||||
//! Box list parameters
|
/** Box list parameters*/
|
||||||
typedef struct boxlist_param{
|
typedef struct boxlist_param{
|
||||||
box_param_t *first; //!< first box pointer of the list
|
box_param_t *first; /**< first box pointer of the list*/
|
||||||
box_param_t *last; //!< last box pointer of the list
|
box_param_t *last; /**< last box pointer of the list*/
|
||||||
} boxlist_param_t;
|
} boxlist_param_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +97,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset);
|
|||||||
* @param[in] TBox Box Type
|
* @param[in] TBox Box Type
|
||||||
* @return pointer to the structure of generate/found box parameters
|
* @return pointer to the structure of generate/found box parameters
|
||||||
*/
|
*/
|
||||||
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[]);
|
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, const char TBox[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate(search) box from code stream
|
* generate(search) box from code stream
|
||||||
@@ -109,7 +108,7 @@ box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[
|
|||||||
* @param[in] TBox Box Type
|
* @param[in] TBox Box Type
|
||||||
* @return pointer to the structure of generate/found box parameters
|
* @return pointer to the structure of generate/found box parameters
|
||||||
*/
|
*/
|
||||||
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, char TBox[]);
|
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, const char TBox[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate child box from JP2 file at the given offset
|
* generate child box from JP2 file at the given offset
|
||||||
@@ -128,7 +127,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset);
|
|||||||
* @param[in] TBox Box Type
|
* @param[in] TBox Box Type
|
||||||
* @return pointer to the structure of generate/found box parameters
|
* @return pointer to the structure of generate/found box parameters
|
||||||
*/
|
*/
|
||||||
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, char TBox[]);
|
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, const char TBox[]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get DBox offset
|
* get DBox offset
|
||||||
@@ -211,7 +210,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset);
|
|||||||
* @param[in] boxlist box list pointer
|
* @param[in] boxlist box list pointer
|
||||||
* @return found box pointer
|
* @return found box pointer
|
||||||
*/
|
*/
|
||||||
box_param_t * search_box( char type[], boxlist_param_t *boxlist);
|
box_param_t * search_box( const char type[], boxlist_param_t *boxlist);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* print box parameters
|
* print box parameters
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
#define FCGI_stdout stdout
|
#define FCGI_stdout stdout
|
||||||
#define FCGI_stderr stderr
|
#define FCGI_stderr stderr
|
||||||
#define logstream stderr
|
#define logstream stderr
|
||||||
#endif //SERVER
|
#endif /*SERVER*/
|
||||||
|
|
||||||
|
|
||||||
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
|
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
|
||||||
@@ -54,10 +55,11 @@ boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
|
|||||||
boxtype = (char *)fetch_bytes( fd, offset+4, 4);
|
boxtype = (char *)fetch_bytes( fd, offset+4, 4);
|
||||||
headlen = 8;
|
headlen = 8;
|
||||||
|
|
||||||
if( boxlen == 1){ // read XLBox
|
if( boxlen == 1){ /* read XLBox */
|
||||||
boxlen = fetch_8bytebigendian( fd, offset+8);
|
boxlen = fetch_8bytebigendian( fd, offset+8);
|
||||||
headlen = 16;
|
headlen = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
boxheader = (boxheader_param_t *)malloc( sizeof( boxheader_param_t));
|
boxheader = (boxheader_param_t *)malloc( sizeof( boxheader_param_t));
|
||||||
boxheader->headlen = headlen;
|
boxheader->headlen = headlen;
|
||||||
boxheader->length = boxlen;
|
boxheader->length = boxlen;
|
||||||
|
|||||||
@@ -34,12 +34,12 @@
|
|||||||
#include "byte_manager.h"
|
#include "byte_manager.h"
|
||||||
#include "box_manager.h"
|
#include "box_manager.h"
|
||||||
|
|
||||||
//! box header parameters
|
/** box header parameters*/
|
||||||
typedef struct boxheader_param{
|
typedef struct boxheader_param{
|
||||||
Byte_t headlen; //!< header length 8 or 16
|
Byte_t headlen; /**< header length 8 or 16*/
|
||||||
Byte8_t length; //!< length of the reference Box
|
Byte8_t length; /**< length of the reference Box*/
|
||||||
char type[4]; //!< type of information in the DBox
|
char type[4]; /**< type of information in the DBox*/
|
||||||
struct boxheader_param *next; //!< pointer to the next header box
|
struct boxheader_param *next; /**< pointer to the next header box*/
|
||||||
} boxheader_param_t;
|
} boxheader_param_t;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,15 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include "byte_manager.h"
|
#include "byte_manager.h"
|
||||||
|
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
@@ -40,7 +46,7 @@
|
|||||||
#define FCGI_stdout stdout
|
#define FCGI_stdout stdout
|
||||||
#define FCGI_stderr stderr
|
#define FCGI_stderr stderr
|
||||||
#define logstream stderr
|
#define logstream stderr
|
||||||
#endif //SERVER
|
#endif /*SERVER*/
|
||||||
|
|
||||||
|
|
||||||
Byte_t * fetch_bytes( int fd, long offset, int size)
|
Byte_t * fetch_bytes( int fd, long offset, int size)
|
||||||
@@ -70,13 +76,13 @@ Byte_t fetch_1byte( int fd, long offset)
|
|||||||
|
|
||||||
if( lseek( fd, offset, SEEK_SET)==-1){
|
if( lseek( fd, offset, SEEK_SET)==-1){
|
||||||
fprintf( FCGI_stdout, "Reason: Target broken (seek error)\r\n");
|
fprintf( FCGI_stdout, "Reason: Target broken (seek error)\r\n");
|
||||||
fprintf( FCGI_stderr, "Error: error in fetch_1byte( %d, %ld)\n", fd, offset);
|
fprintf( FCGI_stderr, "Error: error in fetch_1byte( %d, %lld)\n", fd, offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( read( fd, &code, 1) != 1){
|
if( read( fd, &code, 1) != 1){
|
||||||
fprintf( FCGI_stdout, "Reason: Target broken (read error)\r\n");
|
fprintf( FCGI_stdout, "Reason: Target broken (read error)\r\n");
|
||||||
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld)\n", fd, offset);
|
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %lld)\n", fd, offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
@@ -88,7 +94,7 @@ Byte2_t fetch_2bytebigendian( int fd, long offset)
|
|||||||
Byte2_t code;
|
Byte2_t code;
|
||||||
|
|
||||||
if(!(data = fetch_bytes( fd, offset, 2))){
|
if(!(data = fetch_bytes( fd, offset, 2))){
|
||||||
fprintf( FCGI_stderr, "Error: error in fetch_2bytebigendian( %d, %ld)\n", fd, offset);
|
fprintf( FCGI_stderr, "Error: error in fetch_2bytebigendian( %d, %lld)\n", fd, offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
code = big2(data);
|
code = big2(data);
|
||||||
@@ -103,7 +109,7 @@ Byte4_t fetch_4bytebigendian( int fd, long offset)
|
|||||||
Byte4_t code;
|
Byte4_t code;
|
||||||
|
|
||||||
if(!(data = fetch_bytes( fd, offset, 4))){
|
if(!(data = fetch_bytes( fd, offset, 4))){
|
||||||
fprintf( FCGI_stderr, "Error: error in fetch_4bytebigendian( %d, %ld)\n", fd, offset);
|
fprintf( FCGI_stderr, "Error: error in fetch_4bytebigendian( %d, %lld)\n", fd, offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
code = big4(data);
|
code = big4(data);
|
||||||
@@ -118,7 +124,7 @@ Byte8_t fetch_8bytebigendian( int fd, long offset)
|
|||||||
Byte8_t code;
|
Byte8_t code;
|
||||||
|
|
||||||
if(!(data = fetch_bytes( fd, offset, 8))){
|
if(!(data = fetch_bytes( fd, offset, 8))){
|
||||||
fprintf( FCGI_stderr, "Error: error in fetch_8bytebigendian( %d, %ld)\n", fd, offset);
|
fprintf( FCGI_stderr, "Error: error in fetch_8bytebigendian( %d, %lld)\n", fd, offset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
code = big8(data);
|
code = big8(data);
|
||||||
@@ -144,3 +150,23 @@ Byte8_t big8( Byte_t *buf)
|
|||||||
return (((Byte8_t) big4 (buf)) << 32)
|
return (((Byte8_t) big4 (buf)) << 32)
|
||||||
+ ((Byte8_t) big4 (buf + 4));
|
+ ((Byte8_t) big4 (buf + 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void modify_4Bytecode( Byte4_t code, Byte_t *stream)
|
||||||
|
{
|
||||||
|
*stream = (Byte_t) ((Byte4_t)(code & 0xff000000) >> 24);
|
||||||
|
*(stream+1) = (Byte_t) ((Byte4_t)(code & 0x00ff0000) >> 16);
|
||||||
|
*(stream+2) = (Byte_t) ((Byte4_t)(code & 0x0000ff00) >> 8);
|
||||||
|
*(stream+3) = (Byte_t) (code & 0x000000ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
Byte8_t get_filesize( int fd)
|
||||||
|
{
|
||||||
|
struct stat sb;
|
||||||
|
|
||||||
|
if( fstat( fd, &sb) == -1){
|
||||||
|
fprintf( FCGI_stdout, "Reason: Target broken (fstat error)\r\n");
|
||||||
|
fprintf( FCGI_stderr, "Error: error in get_filesize( %d)\n", fd);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (Byte8_t)sb.st_size;
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,21 +29,29 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BYTE_MANAGER_H_
|
#ifndef BYTE_MANAGER_H_
|
||||||
# define BYTE_MANAGER_H_
|
#define BYTE_MANAGER_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "opj_config.h"
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
//! 1Byte parameter type
|
#include <stdint.h>
|
||||||
typedef unsigned char Byte_t;
|
typedef uint8_t Byte_t;
|
||||||
|
typedef uint16_t Byte2_t;
|
||||||
//! 2Byte parameter type
|
typedef uint32_t Byte4_t;
|
||||||
typedef unsigned short int Byte2_t;
|
typedef uint64_t Byte8_t;
|
||||||
|
#else
|
||||||
//! 4Byte parameter type
|
#if defined(_WIN32)
|
||||||
typedef unsigned int Byte4_t;
|
/** 1Byte parameter type*/
|
||||||
|
typedef unsigned __int8 Byte_t;
|
||||||
//! 8Byte parameter type
|
/** 2Byte parameter type*/
|
||||||
typedef unsigned long long int Byte8_t;
|
typedef unsigned __int16 Byte2_t;
|
||||||
|
/** 4Byte parameter type*/
|
||||||
|
typedef unsigned __int32 Byte4_t;
|
||||||
|
/** 8Byte parameter type*/
|
||||||
|
typedef unsigned __int64 Byte8_t;
|
||||||
|
#else
|
||||||
|
#error unsupported platform
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,5 +126,20 @@ Byte4_t big4( Byte_t *buf);
|
|||||||
*/
|
*/
|
||||||
Byte8_t big8( Byte_t *buf);
|
Byte8_t big8( Byte_t *buf);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* modify 4Byte code in a codestream
|
||||||
|
*
|
||||||
|
* @param[in] code code value
|
||||||
|
* @param[out] stream modifying codestream
|
||||||
|
*/
|
||||||
|
void modify_4Bytecode( Byte4_t code, Byte_t *stream);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get file size
|
||||||
|
*
|
||||||
|
* @param[in] fd file discriptor
|
||||||
|
* @return file size
|
||||||
|
*/
|
||||||
|
Byte8_t get_filesize( int fd);
|
||||||
|
|
||||||
#endif /* !BYTE_MANAGER_H_ */
|
#endif /* !BYTE_MANAGER_H_ */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user