Compare commits
154 Commits
version.2.
...
version.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d97b181d3 | ||
|
|
d9b74ea6a8 | ||
|
|
166b42eb54 | ||
|
|
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 | ||
|
|
40b989ce00 | ||
|
|
3e1d8d6aef | ||
|
|
fda0cada0e | ||
|
|
a58987d082 | ||
|
|
0f101066f2 | ||
|
|
cbe26cbb88 | ||
|
|
f753a1c36c | ||
|
|
c0ea54e518 | ||
|
|
c85e1a10cf |
2
AUTHORS
@@ -5,8 +5,6 @@ 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.
|
||||
Micka<EFBFBD>l Savinaud implemented the final OpenJPEG v2 version based on a big merge between 1.5 version and alpha version of v2.
|
||||
Mathieu Malaterre participate to the OpenJPEG v2 version and release the OpenJPEG 1.5 and 1.5.1 version.
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||
SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1000000)
|
||||
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 50)
|
||||
SET(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 2000)
|
||||
|
||||
set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
|
||||
# Exclude files from the Testing directories
|
||||
@@ -22,13 +22,11 @@ set(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
".*/thirdparty/.*"
|
||||
)
|
||||
|
||||
set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
SET(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
${CTEST_CUSTOM_WARNING_EXCEPTION}
|
||||
|
||||
# Suppress warning caused by intentional messages about deprecation
|
||||
".*warning,.* is deprecated"
|
||||
# supress warnings caused by 3rd party libs:
|
||||
".*thirdparty.*"
|
||||
"libtiff.*has no symbols"
|
||||
"libpng.*has no symbols"
|
||||
".*/thirdparty/.*"
|
||||
)
|
||||
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_DIRS FCGI_LIBRARIES)
|
||||
@@ -10,10 +10,10 @@
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
find_program(KDU_EXPAND_EXECUTABLE
|
||||
FIND_PROGRAM(KDU_EXPAND_EXECUTABLE
|
||||
kdu_expand
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
MARK_AS_ADVANCED(
|
||||
KDU_EXPAND_EXECUTABLE
|
||||
)
|
||||
@@ -12,20 +12,20 @@
|
||||
#=============================================================================
|
||||
#=============================================================================
|
||||
|
||||
find_path(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
FIND_PATH(LCMS_INCLUDE_DIR lcms.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
|
||||
set(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
|
||||
SET(LCMS_NAMES ${LCMS_NAMES} lcms liblcms liblcms_static)
|
||||
|
||||
find_library(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
||||
FIND_LIBRARY(LCMS_LIBRARY NAMES ${LCMS_NAMES} )
|
||||
|
||||
mark_as_advanced(LCMS_INCLUDE_DIR LCMS_LIBRARY)
|
||||
MARK_AS_ADVANCED(LCMS_INCLUDE_DIR LCMS_LIBRARY)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS DEFAULT_MSG LCMS_LIBRARY LCMS_INCLUDE_DIR)
|
||||
|
||||
if(LCMS_FOUND)
|
||||
set( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
||||
set( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
||||
endif()
|
||||
IF(LCMS_FOUND)
|
||||
SET( LCMS_INCLUDE_DIRS ${LCMS_INCLUDE_DIR})
|
||||
SET( LCMS_LIBRARIES ${LCMS_LIBRARY} )
|
||||
ENDIF(LCMS_FOUND)
|
||||
@@ -12,20 +12,20 @@
|
||||
#=============================================================================
|
||||
#=============================================================================
|
||||
|
||||
find_path(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
FIND_PATH(LCMS2_INCLUDE_DIR lcms2.h PATHS /usr/include /usr/local/include /opt/include /opt/local/include)
|
||||
|
||||
set(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
|
||||
SET(LCMS2_NAMES ${LCMS2_NAMES} lcms2 liblcms2 liblcms2_static)
|
||||
|
||||
find_library(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
||||
FIND_LIBRARY(LCMS2_LIBRARY NAMES ${LCMS2_NAMES} )
|
||||
|
||||
mark_as_advanced(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
||||
MARK_AS_ADVANCED(LCMS2_INCLUDE_DIR LCMS2_LIBRARY)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
||||
# handle the QUIETLY and REQUIRED arguments and set LCMS2_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LCMS2 DEFAULT_MSG LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
|
||||
|
||||
if(LCMS2_FOUND)
|
||||
set( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
||||
set( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
||||
endif()
|
||||
IF(LCMS2_FOUND)
|
||||
SET( LCMS2_INCLUDE_DIRS ${LCMS2_INCLUDE_DIR})
|
||||
SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
|
||||
ENDIF(LCMS2_FOUND)
|
||||
20
CMake/FindPTHREAD.cmake
Normal file
@@ -0,0 +1,20 @@
|
||||
# Look for the header file.
|
||||
FIND_PATH(PTHREAD_INCLUDE_DIR NAMES pthread.h)
|
||||
|
||||
# Look for the library.
|
||||
FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
|
||||
|
||||
# Handle the QUIETLY and REQUIRED arguments and set PTHREAD_FOUND to TRUE if all listed variables are TRUE.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PTHREAD DEFAULT_MSG PTHREAD_LIBRARY PTHREAD_INCLUDE_DIR)
|
||||
|
||||
# Copy the results to the output variables.
|
||||
IF(PTHREAD_FOUND)
|
||||
SET(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
|
||||
SET(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})
|
||||
ELSE(PTHREAD_FOUND)
|
||||
SET(PTHREAD_LIBRARIES)
|
||||
SET(PTHREAD_INCLUDE_DIRS)
|
||||
ENDIF(PTHREAD_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(PTHREAD_INCLUDE_DIRS PTHREAD_LIBRARIES)
|
||||
@@ -7,7 +7,7 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
|
||||
endif()
|
||||
include(${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake)
|
||||
endif()
|
||||
endif(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||
|
||||
set(OPJ_PACKAGE_DESCRIPTION_SUMMARY "OpenJPEG - OpenJPEG a JPEG 2000 implementation.")
|
||||
set(OPJ_PACKAGE_CONTACT "openjpeg users <openjpeg@googlegroups.com>")
|
||||
@@ -28,45 +28,43 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
|
||||
# Make this explicit here, rather than accepting the CPack default value,
|
||||
# so we can refer to it:
|
||||
set(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
|
||||
SET(CPACK_PACKAGE_NAME "${OPENJPEG_LIBRARY_NAME}")
|
||||
|
||||
if(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||
IF(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||
# make sure package is not Cygwin-unknown, for Cygwin just
|
||||
# cygwin is good for the system name
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
set(CPACK_SYSTEM_NAME Cygwin)
|
||||
else()
|
||||
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
endif()
|
||||
if(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||
if(CMAKE_CL_64)
|
||||
set(CPACK_SYSTEM_NAME win64-x64)
|
||||
else()
|
||||
set(CPACK_SYSTEM_NAME win32-x86)
|
||||
endif()
|
||||
endif()
|
||||
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
SET(CPACK_SYSTEM_NAME Cygwin)
|
||||
ELSE("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
SET(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
|
||||
ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
ENDIF(NOT DEFINED CPACK_SYSTEM_NAME)
|
||||
IF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||
IF(CMAKE_CL_64)
|
||||
SET(CPACK_SYSTEM_NAME win64-x64)
|
||||
ELSE(CMAKE_CL_64)
|
||||
SET(CPACK_SYSTEM_NAME win32-x86)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
ENDIF(${CPACK_SYSTEM_NAME} MATCHES Windows)
|
||||
|
||||
if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||
IF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||
# if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
|
||||
# default to source package - system, on cygwin system is not
|
||||
# default to source package - system, on cygwin system is not
|
||||
# needed
|
||||
if(CYGWIN)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
IF(CYGWIN)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}")
|
||||
ELSE(CYGWIN)
|
||||
SET(CPACK_PACKAGE_FILE_NAME
|
||||
"${CPACK_SOURCE_PACKAGE_FILE_NAME}-${CPACK_SYSTEM_NAME}")
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(CYGWIN)
|
||||
ENDIF(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
|
||||
|
||||
set(CPACK_BUNDLE_NAME "OpenJPEG ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||
if(APPLE)
|
||||
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||
set(CPACK_BUNDLE_PLIST
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||
#include(BundleUtilities)
|
||||
endif()
|
||||
configure_file(${CMAKE_ROOT}/Templates/AppleInfo.plist
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||
SET(CPACK_BUNDLE_PLIST
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj.plist)
|
||||
#include(BundleUtilities)
|
||||
|
||||
include(CPack)
|
||||
endiF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||
@@ -6,21 +6,21 @@
|
||||
# module to load OPENJPEG's settings for an external project.
|
||||
@OPENJPEG_CONFIG_INSTALL_ONLY@
|
||||
# The OPENJPEG version number.
|
||||
set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
|
||||
set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
|
||||
set(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
||||
SET(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
|
||||
SET(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
|
||||
SET(OPENJPEG_BUILD_VERSION "@OPENJPEG_VERSION_BUILD@")
|
||||
|
||||
# The libraries.
|
||||
set(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARY_NAME@")
|
||||
SET(OPENJPEG_LIBRARIES "@OPENJPEG_LIBRARIES@")
|
||||
|
||||
# The CMake macros dir.
|
||||
set(OPENJPEG_CMAKE_DIR "@OPENJPEG_INSTALL_PACKAGE_DIR@")
|
||||
SET(OPENJPEG_CMAKE_DIR "@OPENJPEG_CMAKE_DIR_CONFIG@")
|
||||
|
||||
# The configuration options.
|
||||
set(OPENJPEG_BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@")
|
||||
SET(OPENJPEG_BUILD_SHARED_LIBS "@OPENJPEG_BUILD_SHARED_LIBS@")
|
||||
|
||||
# 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)
|
||||
if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
@@ -29,20 +29,20 @@ if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
get_filename_component(OPENJPEG_INCLUDE_ROOT "${SELF_DIR}/../../@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE)
|
||||
set(OPENJPEG_INCLUDE_DIRS ${OPENJPEG_INCLUDE_ROOT})
|
||||
|
||||
else()
|
||||
else(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
# This is a build tree
|
||||
set( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
|
||||
SET( OPENJPEG_INCLUDE_DIRS @OPENJPEG_INCLUDE_PATH@)
|
||||
|
||||
include(${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
|
||||
else()
|
||||
else(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
message(FATAL_ERROR "ooops")
|
||||
endif()
|
||||
endif()
|
||||
endif(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)
|
||||
endif(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
|
||||
|
||||
set(OPENJPEG_USE_FILE ${SELF_DIR}/UseOPENJPEG.cmake)
|
||||
|
||||
# Backward compatible part:
|
||||
set(OPENJPEG_FOUND TRUE)
|
||||
SET(OPENJPEG_FOUND TRUE)
|
||||
|
||||
289
CMakeLists.txt
@@ -6,73 +6,54 @@
|
||||
# you will eventually like to prefix the library to avoid linking confusion
|
||||
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
||||
# e.g.:
|
||||
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
cmake_minimum_required(VERSION 2.8.2)
|
||||
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||
|
||||
if(COMMAND CMAKE_POLICY)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif()
|
||||
IF(COMMAND CMAKE_POLICY)
|
||||
CMAKE_POLICY(SET CMP0003 NEW)
|
||||
ENDIF(COMMAND CMAKE_POLICY)
|
||||
|
||||
if(NOT OPENJPEG_NAMESPACE)
|
||||
set(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
set(OPENJPEG_STANDALONE 1)
|
||||
endif()
|
||||
IF(NOT OPENJPEG_NAMESPACE)
|
||||
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||
SET(OPENJPEG_STANDALONE 1)
|
||||
ENDIF(NOT OPENJPEG_NAMESPACE)
|
||||
# In all cases:
|
||||
#string(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||
set(OPENJPEG_LIBRARY_NAME openjp2)
|
||||
STRING(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||
|
||||
project(${OPENJPEG_NAMESPACE} C)
|
||||
PROJECT(${OPENJPEG_NAMESPACE} C)
|
||||
|
||||
# Do full dependency headers.
|
||||
include_regular_expression("^.*$")
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
set(OPENJPEG_VERSION_MAJOR 2)
|
||||
set(OPENJPEG_VERSION_MINOR 0)
|
||||
set(OPENJPEG_VERSION_BUILD 0)
|
||||
set(OPENJPEG_VERSION
|
||||
SET(OPENJPEG_VERSION_MAJOR 1)
|
||||
SET(OPENJPEG_VERSION_MINOR 5)
|
||||
SET(OPENJPEG_VERSION_BUILD 0)
|
||||
SET(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
set(PACKAGE_VERSION
|
||||
SET(PACKAGE_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
|
||||
# Because autotools does not support X.Y notation for SOVERSION, we have to use
|
||||
# two numbering, one for the openjpeg version and one for openjpeg soversion
|
||||
# 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 6)
|
||||
endif(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
SET(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJPEG_SOVERSION}"
|
||||
SOVERSION "${OPENJPEG_VERSION_MAJOR}"
|
||||
)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Path to additional CMake modules
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/cmake
|
||||
SET(CMAKE_MODULE_PATH
|
||||
${CMAKE_SOURCE_DIR}/CMake
|
||||
${CMAKE_MODULE_PATH})
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
|
||||
# warnings
|
||||
if(WIN32)
|
||||
if(NOT BORLAND)
|
||||
if(NOT CYGWIN)
|
||||
if(NOT MINGW)
|
||||
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
add_definitions(
|
||||
IF(WIN32)
|
||||
IF(NOT BORLAND)
|
||||
IF(NOT CYGWIN)
|
||||
IF(NOT MINGW)
|
||||
IF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
ADD_DEFINITIONS(
|
||||
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
|
||||
-D_CRT_IS_WCTYPE_NO_DEPRECATE
|
||||
-D_CRT_MANAGED_FP_NO_DEPRECATE
|
||||
@@ -84,104 +65,105 @@ if(WIN32)
|
||||
-D_CRT_VCCLRIT_NO_DEPRECATE
|
||||
-D_SCL_SECURE_NO_DEPRECATE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
|
||||
ENDIF(NOT MINGW)
|
||||
ENDIF(NOT CYGWIN)
|
||||
ENDIF(NOT BORLAND)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Install directories
|
||||
|
||||
string(TOLOWER ${PROJECT_NAME} projectname)
|
||||
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
STRING(TOLOWER ${PROJECT_NAME} projectname)
|
||||
SET(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
set(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
SET(OPENJPEG_INSTALL_BIN_DIR "bin")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_BIN_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
set(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
SET(OPENJPEG_INSTALL_LIB_DIR "lib")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_LIB_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
set(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
SET(OPENJPEG_INSTALL_SHARE_DIR "share")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_SHARE_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
SET(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_DATA_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
SET(OPENJPEG_INSTALL_INCLUDE_DIR "include/")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
SET(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
SET(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_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)
|
||||
# We could install *.cmake files in share/ however those files contains
|
||||
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
|
||||
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
|
||||
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
IF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
SET(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
ENDIF(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Big endian test:
|
||||
include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/TestBigEndian.cmake)
|
||||
TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Setup file for setting custom ctest vars
|
||||
configure_file(
|
||||
${CMAKE_SOURCE_DIR}/cmake/CTestCustom.cmake.in
|
||||
CONFIGURE_FILE(
|
||||
${CMAKE_SOURCE_DIR}/CMake/CTestCustom.cmake.in
|
||||
${CMAKE_BINARY_DIR}/CTestCustom.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OpenJPEG build configuration options.
|
||||
option(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
set (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
set (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
mark_as_advanced(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG shared library and link executables against it." ON)
|
||||
SET (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# configure name mangling to allow multiple libraries to coexist
|
||||
# peacefully
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
set(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||
@ONLY)
|
||||
endif()
|
||||
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
IF(UNIX)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libopenjpeg1.pc.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc @ONLY)
|
||||
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpeg1.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_SHARE_DIR}/pkgconfig )
|
||||
INSTALL( CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
\"libopenjpeg1.pc\"
|
||||
\"\$ENV{DESTDIR}${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig/libopenjpeg.pc\")")
|
||||
ENDIF(UNIX)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags:
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
# For all builds, make sure openjpeg is std99 compliant:
|
||||
# set(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}") # FIXME: this setting prevented us from setting a coverage build.
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
set(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
endif()
|
||||
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (1/2)
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||
@@ -191,99 +173,90 @@ CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
# ssize_t
|
||||
include(CheckTypeSize)
|
||||
CHECK_TYPE_SIZE(ssize_t SSIZE_T)
|
||||
|
||||
# Enable Large file support
|
||||
include(TestLargeFiles)
|
||||
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Library
|
||||
add_subdirectory(src)
|
||||
INCLUDE_DIRECTORIES(BEFORE ${OPENJPEG_BINARY_DIR})
|
||||
ADD_SUBDIRECTORY(libopenjpeg)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Applications
|
||||
option(BUILD_CODEC "Build the CODEC executables" ON)
|
||||
option(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||
option(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||
option(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
||||
if(BUILD_JPIP)
|
||||
option(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
||||
endif()
|
||||
option(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||
option(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||
option(BUILD_JP3D "Build the JP3D comp" OFF)
|
||||
mark_as_advanced(BUILD_VIEWER)
|
||||
mark_as_advanced(BUILD_JAVA)
|
||||
mark_as_advanced(BUILD_JP3D)
|
||||
OPTION(BUILD_CODEC "Build the CODEC executables" ON)
|
||||
OPTION(BUILD_MJ2 "Build the MJ2 executables." OFF)
|
||||
OPTION(BUILD_JPWL "Build the JPWL library and executables" OFF)
|
||||
OPTION(BUILD_JPIP "Build the JPIP library and executables." OFF)
|
||||
IF(BUILD_JPIP)
|
||||
OPTION(BUILD_JPIP_SERVER "Build the JPIP server." OFF)
|
||||
ENDIF(BUILD_JPIP)
|
||||
OPTION(BUILD_VIEWER "Build the OPJViewer executable (C++)" OFF)
|
||||
OPTION(BUILD_JAVA "Build the openjpeg jar (Java)" OFF)
|
||||
MARK_AS_ADVANCED(BUILD_VIEWER)
|
||||
MARK_AS_ADVANCED(BUILD_JAVA)
|
||||
|
||||
if(BUILD_CODEC OR BUILD_MJ2)
|
||||
IF(BUILD_CODEC OR BUILD_MJ2)
|
||||
# OFF: It will only build 3rd party libs if they are not found on the system
|
||||
# ON: 3rd party libs will ALWAYS be build, and used
|
||||
option(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||
add_subdirectory(thirdparty)
|
||||
add_subdirectory(src/bin)
|
||||
endif ()
|
||||
add_subdirectory(wrapping)
|
||||
OPTION(BUILD_THIRDPARTY "Build the thirdparty executables if it is needed" OFF)
|
||||
ADD_SUBDIRECTORY(thirdparty)
|
||||
ADD_SUBDIRECTORY(applications)
|
||||
ENDIF (BUILD_CODEC OR BUILD_MJ2)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (2/2)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
|
||||
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)
|
||||
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
OPTION(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||
IF(BUILD_DOC)
|
||||
ADD_SUBDIRECTORY(doc)
|
||||
ENDIF(BUILD_DOC)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Buld Testing
|
||||
option(BUILD_TESTING "Build the tests." OFF)
|
||||
if(BUILD_TESTING)
|
||||
if(BUILD_CODEC)
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
|
||||
OPTION(BUILD_TESTING "Build the tests." OFF)
|
||||
IF(BUILD_TESTING)
|
||||
IF(BUILD_CODEC)
|
||||
ENABLE_TESTING()
|
||||
INCLUDE(CTest)
|
||||
|
||||
# Search openjpeg data needed for the tests
|
||||
# They could be found via svn on the OpenJPEG google code project
|
||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||
find_path(OPJ_DATA_ROOT README-OPJ-Data
|
||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||
FIND_PATH(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS
|
||||
$ENV{OPJ_DATA_ROOT}
|
||||
${CMAKE_SOURCE_DIR}/../data
|
||||
)
|
||||
|
||||
# Add repository where to find tests
|
||||
add_subdirectory(tests)
|
||||
|
||||
else()
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
|
||||
ELSE(BUILD_CODEC)
|
||||
message(FATAL_ERROR "You need build codec to run the tests")
|
||||
endif()
|
||||
endif()
|
||||
ENDIF(BUILD_CODEC)
|
||||
ENDIF(BUILD_TESTING)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install all targets referenced as OPENJPEGTargets
|
||||
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
configure_file( ${OPENJPEG_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
|
||||
INSTALL(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
|
||||
CONFIGURE_FILE( ${OPENJPEG_SOURCE_DIR}/CMake/OpenJPEGConfig.cmake.in
|
||||
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
@ONLY
|
||||
)
|
||||
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
INSTALL( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install CHANGES and LICENSE
|
||||
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
endif()
|
||||
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
INSTALL(
|
||||
FILES CHANGES
|
||||
LICENSE
|
||||
DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
|
||||
include (cmake/OpenJPEGCPack.cmake)
|
||||
INCLUDE (CMake/OpenJPEGCPack.cmake)
|
||||
|
||||
84
INSTALL
@@ -2,10 +2,63 @@
|
||||
How to build and install openjpeg binaries
|
||||
==========================================
|
||||
|
||||
UNIX/LINUX/MacOSX/Windows systems
|
||||
UNIX/LINUX similar systems
|
||||
--------------------------
|
||||
|
||||
Using cmake (see www.cmake.org)
|
||||
1) Using autotools
|
||||
|
||||
It is highly recommended that pkg-config is installed. If needed, you have to
|
||||
properly set the environment variable PKG_CONFIG_PATH so that the .pc files
|
||||
are found.
|
||||
|
||||
To build from top-level directory, you can simply type:
|
||||
./bootstrap.sh
|
||||
./configure
|
||||
make
|
||||
|
||||
To keep all build files in a separate directory, you can type instead:
|
||||
./bootstrap.sh
|
||||
mkdir build
|
||||
cd build
|
||||
../configure
|
||||
make
|
||||
|
||||
To install:
|
||||
sudo make install
|
||||
|
||||
To clean:
|
||||
make clean
|
||||
make distclean
|
||||
|
||||
To build doc (requires 'doxygen' to be found on your system):
|
||||
(this will create an html directory in TOP_LEVEL/doc)
|
||||
make doc
|
||||
|
||||
Main './configure' options (type './configure --help' for more details)
|
||||
'--enable-mj2'
|
||||
'--enable-jpwl'
|
||||
'--enable-jpip'
|
||||
'--prefix=/path/to/install/directory' (example : '--prefix=$PWD/installed')
|
||||
'--enable-debug' (default : disabled)
|
||||
|
||||
You can also specify your own CFLAGS and LDFLAGS with (for example):
|
||||
CFLAGS="-O3 -pipe" LDFLAGS="-Wl,-s" ./configure
|
||||
|
||||
The (optional) dependencies of some binaries are libpng, libtiff, libcms 1 or 2
|
||||
and FastCGI. Only libtiff and FastCGI have no .pc file. There should be some
|
||||
automatic detection if they are installed in /usr, /usr/local or /opt/local.
|
||||
Otherwise, you can tune their detection (as well as for libpng and libcms1 or 2
|
||||
too) with the environment variables:
|
||||
|
||||
TIFF_CFLAGS
|
||||
TIFF_LIBS
|
||||
FCGI_CFLAGS
|
||||
FCGI_LIBS
|
||||
|
||||
See './configure --help' output for more details.
|
||||
|
||||
|
||||
2) Using cmake (see www.cmake.org)
|
||||
|
||||
Type:
|
||||
cmake .
|
||||
@@ -13,13 +66,12 @@ Type:
|
||||
|
||||
If you are root:
|
||||
make install
|
||||
make clean
|
||||
|
||||
else if you have sudo power:
|
||||
else:
|
||||
sudo make install
|
||||
|
||||
else
|
||||
DESTDIR=$HOME/local make install
|
||||
|
||||
make clean
|
||||
|
||||
To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||
(A 'html' directory is generated in the 'doc' directory)
|
||||
make doc
|
||||
@@ -27,19 +79,13 @@ To build the Doxygen documentation (Doxygen needs to be found on the system):
|
||||
Binaries are located in the 'bin' directory.
|
||||
|
||||
Main available cmake flags:
|
||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path', or use DESTDIR env variable (see above)
|
||||
* To specify the install path: '-DCMAKE_INSTALL_PREFIX=/path'
|
||||
* To build the shared libraries and links the executables against it: '-DBUILD_SHARED_LIBS:bool=on' (default: 'ON')
|
||||
Note: when using this option, static libraries are not built and executables are dynamically linked.
|
||||
* To build the CODEC executables: '-DBUILD_CODEC:bool=on' (default: 'ON')
|
||||
* To build the documentation: '-DBUILD_DOC: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 JPIP library and utilities: '-DBUILD_JPIP:bool=on' (default: 'OFF')
|
||||
** To build the JPIP server: '-DBUILD_JPIP_SERVER:bool=on' (default: 'OFF')
|
||||
* To build the JP3D library and utilities: '-DBUILD_JP3D:bool=on' (default: 'OFF') (experimental)
|
||||
* To build the Java binding: '-DBUILD_JAVA:bool=on' (default: 'OFF') (experimental).
|
||||
** to choose which java implementation, you can set your JAVA_HOME env var.
|
||||
* To build the wxWidgets/C++ viewer: 'BUILD_VIEWER:BOOL=ON' (default OFF) (experimental)
|
||||
* To enable testing (and automatic result upload to http://my.cdash.org/index.php?project=OPENJPEG):
|
||||
cmake . -DBUILD_TESTING:BOOL=ON -DOPJ_DATA_ROOT:PATH='path/to/the/data/directory'
|
||||
make
|
||||
@@ -52,7 +98,7 @@ Main available cmake flags:
|
||||
MACOSX
|
||||
------
|
||||
|
||||
The same building procedures as above work for MACOSX.
|
||||
The same building procedures as above (autotools and cmake) work for MACOSX.
|
||||
The xcode project file can also be used.
|
||||
|
||||
If it does not work, try adding the following flag to the cmake command :
|
||||
@@ -61,9 +107,7 @@ If it does not work, try adding the following flag to the cmake command :
|
||||
WINDOWS
|
||||
-------
|
||||
|
||||
You can use cmake to generate project files for the IDE you are using (VS2010, NMake, etc).
|
||||
If you're using cygwin or MinGW+MSYS, the same procedures as for Unix can be used.
|
||||
|
||||
Otherwise you can use cmake to generate project files for the IDE you are using (VC2010, etc).
|
||||
Type 'cmake --help' for available generators on your platform.
|
||||
|
||||
Make sure to build the third party libs (png, zlib ...):
|
||||
|
||||
'-DBUILD_THIRDPARTY:BOOL=ON'
|
||||
|
||||
3
LICENSE
@@ -6,9 +6,6 @@
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
75
Makefile.am
Normal file
@@ -0,0 +1,75 @@
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-jpip=yes --enable-jpip-server=yes --enable-jpwl=yes --enable-mj2=yes
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = libopenjpeg applications doc
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libopenjpeg1.pc
|
||||
|
||||
if WANT_JPWL
|
||||
pkgconfig_DATA += libopenjpeg-jpwl.pc
|
||||
endif
|
||||
|
||||
|
||||
MAINTAINERCLEANFILES = \
|
||||
Makefile.in \
|
||||
aclocal.m4 \
|
||||
config.guess \
|
||||
opj_config.h.in \
|
||||
opj_config.h.in~ \
|
||||
config.sub \
|
||||
configure \
|
||||
depcomp \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
missing
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMake/CTestCustom.cmake.in \
|
||||
CMake/FindFCGI.cmake \
|
||||
CMake/FindLCMS2.cmake \
|
||||
CMake/FindLCMS.cmake \
|
||||
CMake/OpenJPEGConfig.cmake.in \
|
||||
CMakeLists.txt \
|
||||
CTestConfig.cmake \
|
||||
AUTHORS \
|
||||
CHANGES \
|
||||
INSTALL \
|
||||
LICENSE \
|
||||
NEWS \
|
||||
README \
|
||||
THANKS \
|
||||
bootstrap.sh \
|
||||
libopenjpeg1.pc.cmake \
|
||||
libopenjpeg1.pc.in \
|
||||
libopenjpeg-jpwl.pc.in \
|
||||
opj_config.h.cmake.in \
|
||||
m4/opj_check_lib.m4 \
|
||||
m4/opj_doxygen.m4 \
|
||||
m4/pkg.m4
|
||||
|
||||
.PHONY: doc
|
||||
|
||||
# Documentation
|
||||
|
||||
doc:
|
||||
@echo "entering doc/"
|
||||
@cd doc && make doc
|
||||
|
||||
install-data-hook:
|
||||
if HAVE_WIN32
|
||||
$(LN_S) -f libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
else
|
||||
$(LN_S) -nf libopenjpeg1.pc $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
endif
|
||||
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg1.pc" >> $(top_builddir)/report.txt
|
||||
@echo -e " (LN)\t$(pkgconfigdir)/libopenjpeg.pc" >> $(top_builddir)/report.txt
|
||||
if WANT_JPWL
|
||||
@echo -e " (PC)\t$(pkgconfigdir)/libopenjpeg-jpwl.pc" >> $(top_builddir)/report.txt
|
||||
endif
|
||||
@cat $(top_builddir)/report.txt
|
||||
@rm $(top_builddir)/report.txt
|
||||
|
||||
uninstall-hook:
|
||||
rm -f $(DESTDIR)$(pkgconfigdir)/libopenjpeg.pc
|
||||
25
NEWS
@@ -2,20 +2,33 @@
|
||||
OpenJPEG NEWS - user visible changes
|
||||
====================================
|
||||
|
||||
Changes from OpenJPEG 1.5.x to OpenJPEG 2.0.0
|
||||
Changes from OpenJPEG 1.4.0 to OpenJPEG 1.5.0
|
||||
----------------------------------------------
|
||||
|
||||
New Features:
|
||||
|
||||
* streaming capabilities
|
||||
* merge JP3D
|
||||
* openjpip:
|
||||
- complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
- located in 'applications/jpip'.
|
||||
- see corresponding README for more details.
|
||||
|
||||
API modifications:
|
||||
|
||||
* Use a 64bits capable API
|
||||
* 'bool' type has been replaced by 'opj_bool' type. 'stdbool.h' is no more required.
|
||||
|
||||
Misc:
|
||||
|
||||
* removed autotools build system
|
||||
* folders hierarchies reorganisation
|
||||
* added this NEWS file.
|
||||
* improved cmake and autotools build methods.
|
||||
* removed manual makefiles, VS project files and XCode project files.
|
||||
* added a 'thirdparty' directory to contain all dependencies.
|
||||
- These libraries will be build only if there are not found on the system.
|
||||
- Note that libopenjpeg itself does not have any dependency.
|
||||
* changed the directory hierarchy of the whole project. See README files for details.
|
||||
* tests : a complete test suite has been setup.
|
||||
- both JPEG 2000 conformance tests and non-regressions tests are configured.
|
||||
- results are submitted to the OpenJPEG dashboard (http://my.cdash.org/index.php?project=OPENJPEG)
|
||||
- images are located in 'http://openjpeg.googlecode.com/svn/data' folder.
|
||||
- configuration files and utilities are located in 'tests' folder.
|
||||
* OPJViewer re-activated (need wxWidgets)
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
||||
|
||||
40
README
@@ -4,44 +4,22 @@ OPENJPEG LIBRARY and APPLICATIONS
|
||||
|
||||
Details on folders hierarchy:
|
||||
|
||||
* src
|
||||
* lib
|
||||
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
|
||||
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
|
||||
* openjp3d: JP3D implementation
|
||||
* openmj2: MJ2 implementation
|
||||
* bin: contains all applications that use the openjpeg library
|
||||
* libopenjpeg: contains the sources of the openjpeg library
|
||||
* jpwl: contains the additional sources if you want to build a JPWL-flavoured library.
|
||||
* applications: contains all applications that use the openjpeg library
|
||||
* common: common files to all applications
|
||||
* jp2: a basic codec
|
||||
* codec: a basic codec
|
||||
* mj2: motion jpeg 2000 executables
|
||||
* jpip: OpenJPIP applications (server and dec server)
|
||||
* java: a Java client viewer for JPIP
|
||||
* jp3d: JP3D applications
|
||||
* tcltk: a test tool for JP3D
|
||||
* wx
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* wrapping
|
||||
* java: java jni to use openjpeg in a java program
|
||||
* JavaOpenJPEG: java jni to use openjpeg in a java program
|
||||
* jpip: complete client-server architecture for remote browsing of jpeg 2000 images. See corresponding README for more details.
|
||||
* OPJViewer: gui for displaying j2k files (based on wxWidget)
|
||||
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
|
||||
* doc: doxygen documentation setup file and man pages
|
||||
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in 'http://openjpeg.googlecode.com/svn/data' folder.
|
||||
* cmake: cmake related files
|
||||
* CMake: cmake related files
|
||||
* m4: autotools related files
|
||||
|
||||
see LICENSE for license and copyright information.
|
||||
see INSTALL for installation procedures.
|
||||
see NEWS for user visible changes in successive releases.
|
||||
see CHANGES for per-revision changes.
|
||||
|
||||
----------------
|
||||
API/ABI
|
||||
|
||||
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
|
||||
only exposes a limited subset of its functions. It uses a mecanism of
|
||||
exporting/hiding functions. If you are unsure which functions you can use in
|
||||
your applications, you should compile OpenJPEG using something similar to gcc:
|
||||
-fvisibility=hidden compilation flag.
|
||||
See also: http://gcc.gnu.org/wiki/Visibility
|
||||
|
||||
On windows, MSVC directly supports export/hidding function and as such the only
|
||||
API available is the one supported by OpenJPEG.
|
||||
|
||||
4
THANKS
@@ -4,11 +4,13 @@ Many people have contributed to OpenJPEG by reporting problems, suggesting vario
|
||||
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
|
||||
@@ -29,5 +31,3 @@ Arnaud Maye
|
||||
Rex Dieter
|
||||
David Burken
|
||||
Parvatha Elangovan
|
||||
Hans Johnson
|
||||
Luc Hermitte
|
||||
22
applications/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
# Build the each application if it needed
|
||||
|
||||
IF(BUILD_CODEC)
|
||||
ADD_SUBDIRECTORY(codec)
|
||||
ENDIF(BUILD_CODEC)
|
||||
|
||||
IF(BUILD_MJ2)
|
||||
ADD_SUBDIRECTORY(mj2)
|
||||
ENDIF(BUILD_MJ2)
|
||||
|
||||
# Client & Server:
|
||||
IF(BUILD_JPIP)
|
||||
ADD_SUBDIRECTORY(jpip)
|
||||
ENDIF(BUILD_JPIP)
|
||||
|
||||
IF(BUILD_VIEWER)
|
||||
ADD_SUBDIRECTORY(OPJViewer)
|
||||
ENDIF(BUILD_VIEWER)
|
||||
|
||||
IF(BUILD_JAVA)
|
||||
ADD_SUBDIRECTORY(JavaOpenJPEG)
|
||||
ENDIF(BUILD_JAVA)
|
||||
@@ -1,12 +1,9 @@
|
||||
#JavaOpenJPEG/CMakeLists.txt
|
||||
|
||||
# First thing define the common source:
|
||||
set(openjpegjni_SRCS
|
||||
SET(openjpegjni_SRCS
|
||||
JavaOpenJPEGDecoder.c
|
||||
JavaOpenJPEG.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
|
||||
index.c
|
||||
)
|
||||
|
||||
# JNI binding:
|
||||
@@ -15,36 +12,17 @@ include_directories(${JNI_INCLUDE_DIRS})
|
||||
|
||||
# required header file:
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/jp2
|
||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common
|
||||
${OPENJPEG_SOURCE_DIR}/applications/codec
|
||||
)
|
||||
|
||||
add_library(openjpegjni MODULE
|
||||
${openjpegjni_SRCS}
|
||||
)
|
||||
# Java module should not have a SONAME:
|
||||
set_property(TARGET openjpegjni PROPERTY NO_SONAME 1)
|
||||
|
||||
# FIXME (need to use old API):
|
||||
if(BUILD_MJ2)
|
||||
target_link_libraries(openjpegjni openmj2)
|
||||
endif()
|
||||
target_link_libraries(openjpegjni
|
||||
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME} ${Z_LIBNAME}
|
||||
)
|
||||
if(UNIX)
|
||||
target_link_libraries(openjpegjni m)
|
||||
endif()
|
||||
|
||||
install(TARGETS openjpegjni
|
||||
EXPORT OpenJPEGTargets
|
||||
LIBRARY DESTINATION ${OPENJPEG_INSTALL_JNI_DIR} COMPONENT Libraries
|
||||
)
|
||||
|
||||
# build jar:
|
||||
find_package(Java 1.5 REQUIRED) # javac, jar
|
||||
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar
|
||||
|
||||
# build dep list:
|
||||
file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
|
||||
@@ -52,7 +30,7 @@ file(GLOB java_srcs "java-sources/org/openJpeg/*.java")
|
||||
# make sure target javac dir exists:
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
|
||||
# Build java
|
||||
add_custom_command(
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE} -sourcepath "${CMAKE_CURRENT_SOURCE_DIR}/java-sources"
|
||||
${java_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes
|
||||
@@ -63,11 +41,7 @@ add_custom_command(
|
||||
)
|
||||
|
||||
# name the target
|
||||
add_custom_target(OpenJPEGJavaJar ALL
|
||||
ADD_CUSTOM_TARGET(OpenJPEGJavaJar ALL
|
||||
DEPENDS ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
COMMENT "building openjpeg.jar"
|
||||
)
|
||||
|
||||
install(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
|
||||
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
|
||||
)
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "opj_includes.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
@@ -58,7 +57,7 @@
|
||||
|
||||
extern int get_file_format(char *filename);
|
||||
extern void error_callback(const char *msg, void *client_data);
|
||||
extern void warning_callback(const char *msg, void *client_data);
|
||||
extern warning_callback(const char *msg, void *client_data);
|
||||
extern void info_callback(const char *msg, void *client_data);
|
||||
|
||||
typedef struct callback_variables {
|
||||
@@ -90,7 +89,7 @@ typedef struct img_folder{
|
||||
float *rates;
|
||||
}img_fol_t;
|
||||
|
||||
static void encode_help_display() {
|
||||
void encode_help_display() {
|
||||
fprintf(stdout,"HELP\n----\n\n");
|
||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||
|
||||
@@ -330,7 +329,7 @@ static void encode_help_display() {
|
||||
}
|
||||
|
||||
|
||||
static OPJ_PROG_ORDER give_progression(const char progression[4]) {
|
||||
OPJ_PROG_ORDER give_progression(char progression[4]) {
|
||||
if(strncmp(progression, "LRCP", 4) == 0) {
|
||||
return LRCP;
|
||||
}
|
||||
@@ -350,6 +349,18 @@ static OPJ_PROG_ORDER give_progression(const char progression[4]) {
|
||||
return PROG_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get logarithm of an integer and round downwards.
|
||||
/// </summary>
|
||||
int int_floorlog2(int a) {
|
||||
int l;
|
||||
for (l=0; a>1; l++) {
|
||||
a>>=1;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
||||
POC[0].tile = 1;
|
||||
POC[0].resno0 = 0;
|
||||
@@ -368,7 +379,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
||||
return 2;
|
||||
}
|
||||
|
||||
static void cinema_parameters(opj_cparameters_t *parameters){
|
||||
void cinema_parameters(opj_cparameters_t *parameters){
|
||||
parameters->tile_size_on = OPJ_FALSE;
|
||||
parameters->cp_tdx=1;
|
||||
parameters->cp_tdy=1;
|
||||
@@ -401,7 +412,7 @@ static void cinema_parameters(opj_cparameters_t *parameters){
|
||||
|
||||
}
|
||||
|
||||
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
|
||||
void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
|
||||
int i;
|
||||
float temp_rate;
|
||||
opj_poc_t *POC = NULL;
|
||||
@@ -483,7 +494,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------ */
|
||||
static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
img_fol_t *img_fol, char *indexfilename) {
|
||||
int i, j,totlen;
|
||||
opj_option_t long_option[]={
|
||||
@@ -501,7 +512,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
|
||||
/* parse the command line */
|
||||
/* UniPG>> */
|
||||
const char optlist[] = "i:o:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:"
|
||||
const char optlist[] = "i:o:hr:q:n:b:c:t:p:s:SEM:x:R:d:T:If:P:C:F:u:J"
|
||||
#ifdef USE_JPWL
|
||||
"W:"
|
||||
#endif /* USE_JPWL */
|
||||
@@ -616,7 +627,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
parameters->tcp_numlayers = numlayers;
|
||||
numresolution = parameters->numresolution;
|
||||
matrix_width = numresolution * 3;
|
||||
parameters->cp_matrice = (int *) opj_malloc(numlayers * matrix_width * sizeof(int));
|
||||
parameters->cp_matrice = (int *) malloc(numlayers * matrix_width * sizeof(int));
|
||||
s = s + 2;
|
||||
|
||||
for (i = 0; i < numlayers; i++) {
|
||||
@@ -844,7 +855,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
|
||||
case 'C': /* add a comment */
|
||||
{
|
||||
parameters->cp_comment = (char*)opj_malloc(strlen(opj_optarg) + 1);
|
||||
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
if(parameters->cp_comment) {
|
||||
strcpy(parameters->cp_comment, opj_optarg);
|
||||
}
|
||||
@@ -873,7 +884,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
|
||||
case 'z': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
@@ -1235,6 +1246,10 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
/* <<UniPG */
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
case 'J': /* jpip on */
|
||||
{
|
||||
parameters->jpip_on = OPJ_TRUE;
|
||||
}
|
||||
break;
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
@@ -1324,7 +1339,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
start position in the codestream
|
||||
end position of this packet
|
||||
*/
|
||||
static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer_size) {
|
||||
char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int* buffer_size) {
|
||||
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
||||
char* buffer = NULL;
|
||||
int buffer_pos = 0;
|
||||
@@ -1333,11 +1348,11 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
|
||||
prec_max = 0;
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
for (resno = 0; resno < cstr_info->numdecompos[0] + 1; resno++) {
|
||||
prec_max = int_max(prec_max,cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]);
|
||||
prec_max = max(prec_max,cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Compute the size of the index buffer, in number of bytes*/
|
||||
// Compute the size of the index buffer, in number of bytes*/
|
||||
*buffer_size =
|
||||
1 /* version */
|
||||
+ (10 /* image_w until decomposition */
|
||||
@@ -1346,18 +1361,18 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
|
||||
+ cstr_info->tw * cstr_info->th * 4 /* tile info, without distorsion info */
|
||||
+ cstr_info->tw*cstr_info->th * cstr_info->numlayers * (cstr_info->numdecompos[0] + 1) * cstr_info->numcomps * prec_max *8
|
||||
) * sizeof(int);
|
||||
/*printf("C: index buffer size = %d bytes\n", *buffer_size);*/
|
||||
buffer = (char*) opj_malloc(*buffer_size);
|
||||
//printf("C: index buffer size = %d bytes\n", *buffer_size);
|
||||
buffer = (char*) malloc(*buffer_size);
|
||||
|
||||
if (!buffer) {
|
||||
/*opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size);*/
|
||||
//opj_event_msg(j2k->cinfo, EVT_ERROR, "failed to allocate index buffer for writing %d int\n", *buffer_size);
|
||||
fprintf(stderr, "failed to allocate index buffer for writing %d int\n", *buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
buffer[0] = 1; /* Version stored on a byte*/
|
||||
buffer[0] = 1; // Version stored on a byte
|
||||
buffer++;
|
||||
/* Remaining informations are stored on a int.*/
|
||||
// Remaining informations are stored on a int.
|
||||
((int*)buffer)[buffer_pos++] = cstr_info->image_w;
|
||||
((int*)buffer)[buffer_pos++] = cstr_info->image_h;
|
||||
((int*)buffer)[buffer_pos++] = cstr_info->prog;
|
||||
@@ -1582,7 +1597,7 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
|
||||
} /* tileno */
|
||||
|
||||
if (buffer_pos > *buffer_size) {
|
||||
/*opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);*/
|
||||
//opj_event_msg(j2k->cinfo, EVT_ERROR, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);
|
||||
fprintf(stderr, "index creation: buffer_pos (%d) > buffer_size (%d)!\n", buffer_pos, *buffer_size);
|
||||
return 0;
|
||||
}
|
||||
@@ -1596,7 +1611,7 @@ static char* create_index_into_byte_array(opj_codestream_info_t *cstr_info, int*
|
||||
/* --------------------------------------------------------------------------
|
||||
------------ Get the image byte[] from the Java object -------------------*/
|
||||
|
||||
static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj, jclass cls) {
|
||||
opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobject obj, jclass cls) {
|
||||
int i,max,shift,w,h,depth;
|
||||
opj_image_t * img = NULL;
|
||||
int compno, numcomps;
|
||||
@@ -1615,7 +1630,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
jint *jiBody;
|
||||
jboolean isCopy;
|
||||
|
||||
/* Image width, height and depth*/
|
||||
// Image width, height and depth
|
||||
fid = (*env)->GetFieldID(env, cls,"width", "I");
|
||||
ji = (*env)->GetIntField(env, obj, fid);
|
||||
w = ji;
|
||||
@@ -1628,7 +1643,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
ji = (*env)->GetIntField(env, obj, fid);
|
||||
depth = ji;
|
||||
|
||||
/* Read the image*/
|
||||
// Read the image
|
||||
if (depth <=16) {
|
||||
numcomps = 1;
|
||||
color_space = CLRSPC_GRAY;
|
||||
@@ -1643,8 +1658,8 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
cmptparm[0].y0 = parameters->image_offset_y0;
|
||||
cmptparm[0].w = !cmptparm[0].x0 ? (w - 1) * parameters->subsampling_dx + 1 : cmptparm[0].x0 + (w - 1) * parameters->subsampling_dx + 1;
|
||||
cmptparm[0].h = !cmptparm[0].y0 ? (h - 1) * parameters->subsampling_dy + 1 : cmptparm[0].y0 + (h - 1) * parameters->subsampling_dy + 1;
|
||||
/* Java types are always signed but we use them as unsigned types (shift of the negative part of
|
||||
the pixels of the images in Telemis before entering the encoder).*/
|
||||
// Java types are always signed but we use them as unsigned types (shift of the negative part of
|
||||
// the pixels of the images in Telemis before entering the encoder).
|
||||
cmptparm[0].sgnd = 0;
|
||||
if (depth<=16)
|
||||
cmptparm[0].prec=depth;
|
||||
@@ -1690,12 +1705,12 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
comp = &image->comps[compno];
|
||||
max = -100000;
|
||||
if (depth == 8) {
|
||||
fid = (*env)->GetFieldID(env, cls,"image8", "[B"); /* byteArray []*/
|
||||
fid = (*env)->GetFieldID(env, cls,"image8", "[B"); // byteArray []
|
||||
jba = (*env)->GetObjectField(env, obj, fid);
|
||||
len = (*env)->GetArrayLength(env, jba);
|
||||
|
||||
jbBody = (*env)->GetPrimitiveArrayCritical(env, jba, &isCopy);
|
||||
/*printf("C: before transfering 8 bpp image\n");*/
|
||||
//printf("C: before transfering 8 bpp image\n");
|
||||
if (comp->sgnd) {
|
||||
for(i=0; i< len;i++) {
|
||||
comp->data[i] = (char) jbBody[i];
|
||||
@@ -1709,13 +1724,13 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
}
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0);
|
||||
} else if(depth == 16) {
|
||||
fid = (*env)->GetFieldID(env, cls,"image16", "[S"); /* shortArray []*/
|
||||
fid = (*env)->GetFieldID(env, cls,"image16", "[S"); // shortArray []
|
||||
jsa = (*env)->GetObjectField(env, obj, fid);
|
||||
len = (*env)->GetArrayLength(env, jsa);
|
||||
|
||||
jsBody = (*env)->GetPrimitiveArrayCritical(env, jsa, &isCopy);
|
||||
/*printf("C: before transfering 16 bpp image\n");*/
|
||||
if (comp->sgnd) { /* Special behaviour to deal with signed elements ??*/
|
||||
//printf("C: before transfering 16 bpp image\n");
|
||||
if (comp->sgnd) { // Special behaviour to deal with signed elements ??
|
||||
comp->data[i] = (short) jsBody[i];
|
||||
for(i=0; i< len;i++) {
|
||||
if (comp->data[i] > max) max = comp->data[i];
|
||||
@@ -1728,14 +1743,14 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
}
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jsa, jsBody, 0);
|
||||
} else if (depth == 24) {
|
||||
fid = (*env)->GetFieldID(env, cls,"image24", "[I"); /* intArray []*/
|
||||
fid = (*env)->GetFieldID(env, cls,"image24", "[I"); // intArray []
|
||||
jia = (*env)->GetObjectField(env, obj, fid);
|
||||
len = (*env)->GetArrayLength(env, jia);
|
||||
shift = compno*8;
|
||||
|
||||
jiBody = (*env)->GetPrimitiveArrayCritical(env, jia, &isCopy);
|
||||
/*printf("C: before transfering 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd);*/
|
||||
if (comp->sgnd) { /* Special behaviour to deal with signed elements ?? XXXXX*/
|
||||
//printf("C: before transfering 24 bpp image (component %d, signed = %d)\n", compno, comp->sgnd);
|
||||
if (comp->sgnd) { // Special behaviour to deal with signed elements ?? XXXXX
|
||||
for(i=0; i< len;i++) {
|
||||
comp->data[i] = ( ((int) jiBody[i]) & (0xFF << shift) ) >> shift;
|
||||
if (comp->data[i] > max) max = comp->data[i];
|
||||
@@ -1750,7 +1765,7 @@ static opj_image_t* loadImage(opj_cparameters_t *parameters, JNIEnv *env, jobjec
|
||||
}
|
||||
comp->bpp = int_floorlog2(max)+1;
|
||||
comp->prec = comp->bpp;
|
||||
/*printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp);*/
|
||||
//printf("C: component %d: max %d, real bpp = %d\n", compno, max, comp->bpp);
|
||||
}
|
||||
return image;
|
||||
}
|
||||
@@ -1771,9 +1786,9 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||
|
||||
char* compressed_index = NULL;
|
||||
int* compressed_index = NULL;
|
||||
int compressed_index_size=-1;
|
||||
/* ==> Access variables to the Java member variables*/
|
||||
// ==> Access variables to the Java member variables
|
||||
jsize arraySize;
|
||||
jclass cls;
|
||||
jobject object;
|
||||
@@ -1782,18 +1797,18 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
jbyteArray jba;
|
||||
jbyte *jbBody;
|
||||
callback_variables_t msgErrorCallback_vars;
|
||||
/* <== access variable to the Java member variables.*/
|
||||
// <== access variable to the Java member variables.
|
||||
|
||||
/* For the encoding and storage into the file*/
|
||||
// For the encoding and storage into the file
|
||||
opj_cinfo_t* cinfo;
|
||||
int codestream_length;
|
||||
opj_cio_t *cio = NULL;
|
||||
FILE *f = NULL;
|
||||
|
||||
/* JNI reference to the calling class*/
|
||||
// JNI reference to the calling class
|
||||
cls = (*env)->GetObjectClass(env, obj);
|
||||
|
||||
/* Pointers to be able to call a Java method for all the info and error messages*/
|
||||
// Pointers to be able to call a Java method for all the info and error messages
|
||||
msgErrorCallback_vars.env = env;
|
||||
msgErrorCallback_vars.jobj = &obj;
|
||||
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
||||
@@ -1801,12 +1816,12 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
|
||||
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
||||
argc = (int) arraySize +1;
|
||||
argv = opj_malloc(argc*sizeof(char*));
|
||||
argv[0] = "ProgramName.exe"; /* The program name: useless*/
|
||||
argv = malloc(argc*sizeof(char*));
|
||||
argv[0] = "ProgramName.exe"; // The program name: useless
|
||||
j=0;
|
||||
for (i=1; i<argc; i++) {
|
||||
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
||||
argv[i] = (char*)(*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
}
|
||||
|
||||
/*printf("C: ");
|
||||
@@ -1826,7 +1841,7 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
/* set encoding parameters to default values */
|
||||
opj_set_default_encoder_parameters(¶meters);
|
||||
parameters.cod_format = J2K_CFMT;
|
||||
/*parameters.index_on = 1;*/
|
||||
//parameters.index_on = 1;
|
||||
|
||||
/* Initialize indexfilename and img_fol */
|
||||
*indexfilename = 0;
|
||||
@@ -1834,13 +1849,13 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if (parse_cmdline_encoder(argc, argv, ¶meters,&img_fol, indexfilename) == 1) {
|
||||
/* Release the Java arguments array*/
|
||||
// Release the Java arguments array
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Release the Java arguments array*/
|
||||
// Release the Java arguments array
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
|
||||
@@ -1856,10 +1871,10 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
const char *version = opj_version();
|
||||
/* UniPG>> */
|
||||
#ifdef USE_JPWL
|
||||
parameters.cp_comment = (char*)opj_malloc(clen+strlen(version)+11);
|
||||
parameters.cp_comment = (char*)malloc(clen+strlen(version)+11);
|
||||
sprintf(parameters.cp_comment,"%s%s with JPWL", comment, version);
|
||||
#else
|
||||
parameters.cp_comment = (char*)opj_malloc(clen+strlen(version)+1);
|
||||
parameters.cp_comment = (char*)malloc(clen+strlen(version)+1);
|
||||
sprintf(parameters.cp_comment,"%s%s", comment, version);
|
||||
#endif
|
||||
/* <<UniPG */
|
||||
@@ -1876,7 +1891,7 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
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) {
|
||||
fprintf(stderr, "Unable to load image\n");
|
||||
return -1;
|
||||
@@ -1933,7 +1948,7 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
memcpy(jbBody, compressed_index, compressed_index_size);
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, jba, jbBody, 0);
|
||||
(*env)->SetObjectField(env, obj, fid, jba);
|
||||
opj_free(compressed_index);
|
||||
free(compressed_index);
|
||||
|
||||
/* write the generated codestream to disk ? */
|
||||
if (parameters.outfile[0]!='\0') {
|
||||
@@ -1966,8 +1981,8 @@ JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImag
|
||||
}
|
||||
|
||||
/* free user parameters structure */
|
||||
if(parameters.cp_comment) opj_free(parameters.cp_comment);
|
||||
if(parameters.cp_matrice) opj_free(parameters.cp_matrice);
|
||||
if(parameters.cp_comment) free(parameters.cp_comment);
|
||||
if(parameters.cp_matrice) free(parameters.cp_matrice);
|
||||
|
||||
return codestream_length;
|
||||
}
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "opj_includes.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "dirent.h"
|
||||
@@ -339,7 +338,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)opj_malloc(strlen(opj_optarg) + 1);
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
@@ -509,7 +508,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
int w,h;
|
||||
long min_value, max_value;
|
||||
short tempS; unsigned char tempUC, tempUC1, tempUC2;
|
||||
/* ==> Access variables to the Java member variables*/
|
||||
// ==> Access variables to the Java member variables
|
||||
jsize arraySize;
|
||||
jclass cls;
|
||||
jobject object;
|
||||
@@ -522,8 +521,8 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
jshort *jsBody, *ptrSBody;
|
||||
jint *jiBody, *ptrIBody;
|
||||
callback_variables_t msgErrorCallback_vars;
|
||||
/* <=== access variable to Java member variables */
|
||||
int *ptr, *ptr1, *ptr2; /* <== To transfer the decoded image to Java*/
|
||||
// <=== access variable to Java member variables */
|
||||
int *ptr, *ptr1, *ptr2; // <== To transfer the decoded image to Java
|
||||
|
||||
/* configure the event callbacks */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
@@ -531,24 +530,24 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
event_mgr.warning_handler = warning_callback;
|
||||
event_mgr.info_handler = info_callback;
|
||||
|
||||
/* JNI reference to the calling class*/
|
||||
// JNI reference to the calling class
|
||||
cls = (*env)->GetObjectClass(env, obj);
|
||||
|
||||
/* Pointers to be able to call a Java method for all the info and error messages*/
|
||||
// Pointers to be able to call a Java method for all the info and error messages
|
||||
msgErrorCallback_vars.env = env;
|
||||
msgErrorCallback_vars.jobj = &obj;
|
||||
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
||||
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
|
||||
|
||||
/* Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.*/
|
||||
// Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.
|
||||
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
||||
argc = (int) arraySize +1;
|
||||
argv = opj_malloc(argc*sizeof(char*));
|
||||
argv[0] = "ProgramName.exe"; /* The program name: useless*/
|
||||
argv = malloc(argc*sizeof(char*));
|
||||
argv[0] = "ProgramName.exe"; // The program name: useless
|
||||
j=0;
|
||||
for (i=1; i<argc; i++) {
|
||||
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
||||
argv[i] = (char*)(*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
}
|
||||
|
||||
/*printf("C: decoder params = ");
|
||||
@@ -563,18 +562,18 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||
/* Release the Java arguments array*/
|
||||
// Release the Java arguments array
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
return -1;
|
||||
}
|
||||
/* Release the Java arguments array*/
|
||||
// Release the Java arguments array
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
|
||||
num_images=1;
|
||||
|
||||
/* Get additional information from the Java object variables*/
|
||||
// Get additional information from the Java object variables
|
||||
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
|
||||
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
|
||||
|
||||
@@ -588,7 +587,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
Implemented for debug purpose. */
|
||||
/* -------------------------------------------------------------- */
|
||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||
/*printf("C: opening [%s]\n", parameters.infile);*/
|
||||
//printf("C: opening [%s]\n", parameters.infile);
|
||||
fsrc = fopen(parameters.infile, "rb");
|
||||
if (!fsrc) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||
@@ -597,13 +596,13 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
fseek(fsrc, 0, SEEK_END);
|
||||
file_length = ftell(fsrc);
|
||||
fseek(fsrc, 0, SEEK_SET);
|
||||
src = (unsigned char *) opj_malloc(file_length);
|
||||
src = (unsigned char *) malloc(file_length);
|
||||
fread(src, 1, file_length, fsrc);
|
||||
fclose(fsrc);
|
||||
/*printf("C: %d bytes read from file\n",file_length);*/
|
||||
//printf("C: %d bytes read from file\n",file_length);
|
||||
} else {
|
||||
/* Preparing the transfer of the codestream from Java to C*/
|
||||
/*printf("C: before transfering codestream\n");*/
|
||||
// Preparing the transfer of the codestream from Java to C
|
||||
//printf("C: before transfering codestream\n");
|
||||
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
||||
jba = (*env)->GetObjectField(env, obj, fid);
|
||||
file_length = (*env)->GetArrayLength(env, jba);
|
||||
@@ -713,7 +712,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
|
||||
/* free the memory containing the code-stream */
|
||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||
opj_free(src);
|
||||
free(src);
|
||||
} else {
|
||||
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
|
||||
}
|
||||
@@ -753,17 +752,17 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
|
||||
}
|
||||
|
||||
/* ========= Return the image to the Java structure ===============*/
|
||||
// ========= Return the image to the Java structure ===============
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
printf("C: checking thresholds\n");
|
||||
#endif
|
||||
/* First compute the real with and height, in function of the resolutions decoded.*/
|
||||
/*wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
|
||||
/*hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;*/
|
||||
// First compute the real with and height, in function of the resolutions decoded.
|
||||
//wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||
//hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||
w = image->comps[0].w;
|
||||
h = image->comps[0].h;
|
||||
|
||||
if (image->numcomps==3) { /* 3 components color image*/
|
||||
if (image->numcomps==3) { // 3 components color image
|
||||
ptr = image->comps[0].data;
|
||||
ptr1 = image->comps[1].data;
|
||||
ptr2 = image->comps[2].data;
|
||||
@@ -776,7 +775,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
max_value = 255;
|
||||
}
|
||||
#endif
|
||||
/* Get the pointer to the Java structure where the data must be copied*/
|
||||
// Get the pointer to the Java structure where the data must be copied
|
||||
fid = (*env)->GetFieldID(env, cls,"image24", "[I");
|
||||
jia = (*env)->GetObjectField(env, obj, fid);
|
||||
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
|
||||
@@ -805,7 +804,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
|
||||
|
||||
} else { /* 1 component 8 or 16 bpp image*/
|
||||
} else { // 1 component 8 or 16 bpp image
|
||||
ptr = image->comps[0].data;
|
||||
printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
|
||||
if (image->comps[0].prec<=8) {
|
||||
@@ -822,7 +821,7 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
max_value = 255;
|
||||
}
|
||||
#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++) {
|
||||
tempUC = (unsigned char) (ptr[i]);
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
@@ -880,5 +879,5 @@ JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2Kto
|
||||
}
|
||||
return 1; /* OK */
|
||||
}
|
||||
/*end main*/
|
||||
//end main
|
||||
|
||||
19
applications/Makefile.am
Normal file
@@ -0,0 +1,19 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = codec
|
||||
|
||||
if WANT_MJ2
|
||||
SUBDIRS += mj2
|
||||
endif
|
||||
|
||||
if WANT_JPIP_CODE
|
||||
SUBDIRS += jpip
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
common/color.c \
|
||||
common/color.h \
|
||||
common/format_defs.h \
|
||||
common/opj_getopt.c \
|
||||
common/opj_getopt.h
|
||||
@@ -1,28 +1,25 @@
|
||||
project(viewer CXX)
|
||||
|
||||
find_package(wxWidgets REQUIRED)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
|
||||
)
|
||||
|
||||
# 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
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/jp2/index.c
|
||||
)
|
||||
add_executable(opjviewer ${OPJV_SRCS})
|
||||
target_link_libraries(opjviewer ${wxWidgets_LIBRARIES} openjpeg)
|
||||
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,48 +1,48 @@
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
[Setup]
|
||||
AppName=OPJViewer
|
||||
AppVerName=OPJViewer 0.4 beta
|
||||
AppPublisher=OpenJPEG
|
||||
AppPublisherURL=http://www.openjpeg.org
|
||||
AppSupportURL=http://www.openjpeg.org
|
||||
AppUpdatesURL=http://www.openjpeg.org
|
||||
DefaultDirName={pf}\OPJViewer
|
||||
DefaultGroupName=OPJViewer
|
||||
OutputDir=setup
|
||||
OutputBaseFilename=OPJViewer04beta_setup
|
||||
Compression=lzma
|
||||
SolidCompression=true
|
||||
InfoBeforeFile=source\readmebefore.txt
|
||||
InfoAfterFile=source\readmeafter.txt
|
||||
LicenseFile=source\license.txt
|
||||
VersionInfoVersion=0.4.0.0
|
||||
VersionInfoCompany=OpenJPEG
|
||||
VersionInfoDescription=JPEG 2000 viewer
|
||||
ShowLanguageDialog=yes
|
||||
SetupIconFile=source\OPJViewer.ico
|
||||
|
||||
[Languages]
|
||||
Name: english; MessagesFile: compiler:Default.isl
|
||||
|
||||
[Tasks]
|
||||
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
|
||||
;Source: about\about.htm; 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
|
||||
|
||||
[Icons]
|
||||
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0
|
||||
Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe}
|
||||
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0
|
||||
|
||||
[Run]
|
||||
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}
|
||||
|
||||
[Registry]
|
||||
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:
|
||||
; Script generated by the Inno Setup Script Wizard.
|
||||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||
|
||||
[Setup]
|
||||
AppName=OPJViewer
|
||||
AppVerName=OPJViewer 0.4 beta
|
||||
AppPublisher=OpenJPEG
|
||||
AppPublisherURL=http://www.openjpeg.org
|
||||
AppSupportURL=http://www.openjpeg.org
|
||||
AppUpdatesURL=http://www.openjpeg.org
|
||||
DefaultDirName={pf}\OPJViewer
|
||||
DefaultGroupName=OPJViewer
|
||||
OutputDir=setup
|
||||
OutputBaseFilename=OPJViewer04beta_setup
|
||||
Compression=lzma
|
||||
SolidCompression=true
|
||||
InfoBeforeFile=source\readmebefore.txt
|
||||
InfoAfterFile=source\readmeafter.txt
|
||||
LicenseFile=source\license.txt
|
||||
VersionInfoVersion=0.4.0.0
|
||||
VersionInfoCompany=OpenJPEG
|
||||
VersionInfoDescription=JPEG 2000 viewer
|
||||
ShowLanguageDialog=yes
|
||||
SetupIconFile=source\OPJViewer.ico
|
||||
|
||||
[Languages]
|
||||
Name: english; MessagesFile: compiler:Default.isl
|
||||
|
||||
[Tasks]
|
||||
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
|
||||
|
||||
[Files]
|
||||
Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
|
||||
;Source: about\about.htm; 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
|
||||
|
||||
[Icons]
|
||||
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0
|
||||
Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe}
|
||||
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0
|
||||
|
||||
[Run]
|
||||
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}
|
||||
|
||||
[Registry]
|
||||
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:
|
||||
@@ -1,100 +1,100 @@
|
||||
===============================================================================
|
||||
JPEG2000 Visualization Software - OPJViewer
|
||||
|
||||
Version 0.4 beta
|
||||
===============================================================================
|
||||
|
||||
|
||||
1. Scope
|
||||
=============
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
==========================
|
||||
|
||||
There are two options available, at the moment:
|
||||
|
||||
a) compile from source code
|
||||
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).
|
||||
|
||||
2.1. Compiling the source code in Windows
|
||||
-------------------------------------------
|
||||
|
||||
The steps required to compile the viewer under windows are:
|
||||
|
||||
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.
|
||||
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.
|
||||
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!
|
||||
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).
|
||||
|
||||
2.1.1 Additional libraries
|
||||
----------------------------
|
||||
|
||||
Since we are also working on the Digital Cinema JPEG 2000, we are integrating the viewer with the MXF library, which is used to prepare the DCPs for digital movies. You can enable its linking in the code by specifying the USE_MXF preprocessor directive but, remember, the integration is at a very early stage.
|
||||
|
||||
2.2. Compiling the source code in Unix-like systems
|
||||
-----------------------------------------------------
|
||||
|
||||
The porting is possible and under way.
|
||||
|
||||
|
||||
3. General information on the viewer
|
||||
====================================
|
||||
|
||||
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:
|
||||
- a browsing pane;
|
||||
- a viewing 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:
|
||||
|
||||
filename
|
||||
|
|
||||
|_ #000: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ *** Marker/Box long name ***
|
||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||
| |_ Additional info, depending on the marker/box type
|
||||
| |_ ...
|
||||
|
|
||||
|_ #001: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ ...
|
||||
|
|
||||
...
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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 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.1. Bugs
|
||||
-----------
|
||||
|
||||
*
|
||||
|
||||
4.2. Limitations
|
||||
------------------
|
||||
|
||||
* For mj2 files, rendering is only in B/W
|
||||
===============================================================================
|
||||
JPEG2000 Visualization Software - OPJViewer
|
||||
|
||||
Version 0.4 beta
|
||||
===============================================================================
|
||||
|
||||
|
||||
1. Scope
|
||||
=============
|
||||
|
||||
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.
|
||||
|
||||
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
|
||||
==========================
|
||||
|
||||
There are two options available, at the moment:
|
||||
|
||||
a) compile from source code
|
||||
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).
|
||||
|
||||
2.1. Compiling the source code in Windows
|
||||
-------------------------------------------
|
||||
|
||||
The steps required to compile the viewer under windows are:
|
||||
|
||||
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.
|
||||
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.
|
||||
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!
|
||||
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).
|
||||
|
||||
2.1.1 Additional libraries
|
||||
----------------------------
|
||||
|
||||
Since we are also working on the Digital Cinema JPEG 2000, we are integrating the viewer with the MXF library, which is used to prepare the DCPs for digital movies. You can enable its linking in the code by specifying the USE_MXF preprocessor directive but, remember, the integration is at a very early stage.
|
||||
|
||||
2.2. Compiling the source code in Unix-like systems
|
||||
-----------------------------------------------------
|
||||
|
||||
The porting is possible and under way.
|
||||
|
||||
|
||||
3. General information on the viewer
|
||||
====================================
|
||||
|
||||
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:
|
||||
- a browsing pane;
|
||||
- a viewing 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:
|
||||
|
||||
filename
|
||||
|
|
||||
|_ #000: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ *** Marker/Box long name ***
|
||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||
| |_ Additional info, depending on the marker/box type
|
||||
| |_ ...
|
||||
|
|
||||
|_ #001: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ ...
|
||||
|
|
||||
...
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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 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.1. Bugs
|
||||
-----------
|
||||
|
||||
*
|
||||
|
||||
4.2. Limitations
|
||||
------------------
|
||||
|
||||
* For mj2 files, rendering is only in B/W
|
||||
@@ -1,36 +1,36 @@
|
||||
<html>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<table cellspacing=7 cellpadding=1 border=0 width="100%">
|
||||
<tr>
|
||||
<td rowspan=3 valign=top align=center width=70>
|
||||
<img src="opj_logo.png"><br><br>
|
||||
</td>
|
||||
<td align=center>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height=3 valign=center>
|
||||
<td valign=center bgcolor=#cc3300></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=justify>
|
||||
<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.
|
||||
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, ...</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 bgcolor="#CC3300" height=3 valign=center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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é 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à degli studi di Perugia</a></font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
<html>
|
||||
<body bgcolor="#FFFFFF">
|
||||
<table cellspacing=7 cellpadding=1 border=0 width="100%">
|
||||
<tr>
|
||||
<td rowspan=3 valign=top align=center width=70>
|
||||
<img src="opj_logo.png"><br><br>
|
||||
</td>
|
||||
<td align=center>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr height=3 valign=center>
|
||||
<td valign=center bgcolor=#cc3300></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=justify>
|
||||
<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.
|
||||
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, ...</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 bgcolor="#CC3300" height=3 valign=center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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é 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à degli studi di Perugia</a></font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
@@ -1,87 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifdef USE_MXF
|
||||
#include "mxflib/mxflib.h"
|
||||
#endif // USE_MXF
|
||||
|
||||
#include "OPJViewer.h"
|
||||
|
||||
// about window for the frame
|
||||
void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#ifdef OPJ_HTMLABOUT
|
||||
#include "about_htm.h"
|
||||
#include "opj_logo.xpm"
|
||||
|
||||
wxBoxSizer *topsizer;
|
||||
wxHtmlWindow *html;
|
||||
wxDialog dlg(this, wxID_ANY, wxString(_("About")));
|
||||
|
||||
wxMemoryFSHandler::AddFile(wxT("opj_logo.xpm"), wxBitmap(opj_logo), wxBITMAP_TYPE_XPM);
|
||||
|
||||
topsizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(320, 250), wxHW_SCROLLBAR_NEVER);
|
||||
html->SetBorders(0);
|
||||
//html->LoadPage(wxT("about/about.htm"));
|
||||
//html->SetPage("<html><body>Hello, world!</body></html>");
|
||||
html->SetPage(htmlaboutpage);
|
||||
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
|
||||
html->GetInternalRepresentation()->GetHeight());
|
||||
|
||||
topsizer->Add(html, 1, wxALL, 10);
|
||||
|
||||
topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK"));
|
||||
bu1->SetDefault();
|
||||
|
||||
topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
|
||||
|
||||
dlg.SetSizer(topsizer);
|
||||
topsizer->Fit(&dlg);
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
#else
|
||||
|
||||
wxMessageBox(wxString::Format(OPJ_APPLICATION_TITLEBAR
|
||||
wxT("\n\n")
|
||||
wxT("Built with %s and OpenJPEG ")
|
||||
wxT(OPENJPEG_VERSION)
|
||||
wxT("\non ") wxT(__DATE__) wxT(", ") wxT(__TIME__)
|
||||
wxT("\nRunning under %s\n\n")
|
||||
OPJ_APPLICATION_COPYRIGHT,
|
||||
wxVERSION_STRING,
|
||||
wxGetOsDescription().c_str()),
|
||||
wxT("About ") OPJ_APPLICATION_NAME,
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifdef USE_MXF
|
||||
#include "mxflib/mxflib.h"
|
||||
#endif // USE_MXF
|
||||
|
||||
#include "OPJViewer.h"
|
||||
|
||||
// about window for the frame
|
||||
void OPJFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
#ifdef OPJ_HTMLABOUT
|
||||
#include "about_htm.h"
|
||||
#include "opj_logo.xpm"
|
||||
|
||||
wxBoxSizer *topsizer;
|
||||
wxHtmlWindow *html;
|
||||
wxDialog dlg(this, wxID_ANY, wxString(_("About")));
|
||||
|
||||
wxMemoryFSHandler::AddFile(wxT("opj_logo.xpm"), wxBitmap(opj_logo), wxBITMAP_TYPE_XPM);
|
||||
|
||||
topsizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, wxSize(320, 250), wxHW_SCROLLBAR_NEVER);
|
||||
html->SetBorders(0);
|
||||
//html->LoadPage(wxT("about/about.htm"));
|
||||
//html->SetPage("<html><body>Hello, world!</body></html>");
|
||||
html->SetPage(htmlaboutpage);
|
||||
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
|
||||
html->GetInternalRepresentation()->GetHeight());
|
||||
|
||||
topsizer->Add(html, 1, wxALL, 10);
|
||||
|
||||
topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK"));
|
||||
bu1->SetDefault();
|
||||
|
||||
topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15);
|
||||
|
||||
dlg.SetSizer(topsizer);
|
||||
topsizer->Fit(&dlg);
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
#else
|
||||
|
||||
wxMessageBox(wxString::Format(OPJ_APPLICATION_TITLEBAR
|
||||
wxT("\n\n")
|
||||
wxT("Built with %s and OpenJPEG ")
|
||||
wxT(OPENJPEG_VERSION)
|
||||
wxT("\non ") wxT(__DATE__) wxT(", ") wxT(__TIME__)
|
||||
wxT("\nRunning under %s\n\n")
|
||||
OPJ_APPLICATION_COPYRIGHT,
|
||||
wxVERSION_STRING,
|
||||
wxGetOsDescription().c_str()),
|
||||
wxT("About ") OPJ_APPLICATION_NAME,
|
||||
wxOK | wxICON_INFORMATION,
|
||||
this
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,28 +1,28 @@
|
||||
/* XPM */
|
||||
static char *OPJChild16[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 6 1",
|
||||
" c black",
|
||||
". c #008000",
|
||||
"X c red",
|
||||
"o c #800080",
|
||||
"O c gray100",
|
||||
"+ c None",
|
||||
/* pixels */
|
||||
"++++++++++++++++",
|
||||
"+OOOOOOOOOOOOOO+",
|
||||
"+OooooooooooooO+",
|
||||
"+OooooooooooooO+",
|
||||
"+OooOOOOOOOOOoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooO..OOO..OoO+",
|
||||
"+OooO..OXO..OoO+",
|
||||
"+OooO..OOO..OoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooOOOOOOOOOoO+",
|
||||
"+OooooooooooooO+",
|
||||
"+OOOOOOOOOOOOOO+",
|
||||
"++++++++++++++++"
|
||||
};
|
||||
/* XPM */
|
||||
static char *OPJChild16[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 6 1",
|
||||
" c black",
|
||||
". c #008000",
|
||||
"X c red",
|
||||
"o c #800080",
|
||||
"O c gray100",
|
||||
"+ c None",
|
||||
/* pixels */
|
||||
"++++++++++++++++",
|
||||
"+OOOOOOOOOOOOOO+",
|
||||
"+OooooooooooooO+",
|
||||
"+OooooooooooooO+",
|
||||
"+OooOOOOOOOOOoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooO..OOO..OoO+",
|
||||
"+OooO..OXO..OoO+",
|
||||
"+OooO..OOO..OoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooO.......OoO+",
|
||||
"+OooOOOOOOOOOoO+",
|
||||
"+OooooooooooooO+",
|
||||
"+OOOOOOOOOOOOOO+",
|
||||
"++++++++++++++++"
|
||||
};
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,3 +1,3 @@
|
||||
OPJChild16 ICON OPJChild.ico
|
||||
OPJViewer16 ICON OPJViewer.ico
|
||||
OPJChild16 ICON OPJChild.ico
|
||||
OPJViewer16 ICON OPJViewer.ico
|
||||
#include "wx/msw/wx.rc"
|
||||
@@ -1,26 +1,26 @@
|
||||
/* XPM */
|
||||
static char *OPJViewer16[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 4 1",
|
||||
" c black",
|
||||
". c #800000",
|
||||
"X c red",
|
||||
"o c None",
|
||||
/* pixels */
|
||||
"oooooooooooooooo",
|
||||
"ooo.XXXXoooooooo",
|
||||
"ooXXoo .Xooooooo",
|
||||
"o..oooo .ooooooo",
|
||||
"oX.oooo ooooooo",
|
||||
"oX.oooo .ooooooo",
|
||||
"oXXoooo .ooooooo",
|
||||
"o.XXoo .oooooooo",
|
||||
"oo.XXXXooooooooo",
|
||||
"ooooooooo.Xo .oo",
|
||||
"ooooooooo X. ooo",
|
||||
"oooooooooo...ooo",
|
||||
"oooooooooo XXooo",
|
||||
"oooooooooo .Xooo",
|
||||
"oooooooooooooooo",
|
||||
"oooooooooooooooo"
|
||||
};
|
||||
/* XPM */
|
||||
static char *OPJViewer16[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 4 1",
|
||||
" c black",
|
||||
". c #800000",
|
||||
"X c red",
|
||||
"o c None",
|
||||
/* pixels */
|
||||
"oooooooooooooooo",
|
||||
"ooo.XXXXoooooooo",
|
||||
"ooXXoo .Xooooooo",
|
||||
"o..oooo .ooooooo",
|
||||
"oX.oooo ooooooo",
|
||||
"oX.oooo .ooooooo",
|
||||
"oXXoooo .ooooooo",
|
||||
"o.XXoo .oooooooo",
|
||||
"oo.XXXXooooooooo",
|
||||
"ooooooooo.Xo .oo",
|
||||
"ooooooooo X. ooo",
|
||||
"oooooooooo...ooo",
|
||||
"oooooooooo XXooo",
|
||||
"oooooooooo .Xooo",
|
||||
"oooooooooooooooo",
|
||||
"oooooooooooooooo"
|
||||
};
|
||||
@@ -1,54 +1,54 @@
|
||||
wxString htmlaboutpage = wxT(
|
||||
"<html>"
|
||||
"<body bgcolor=#FFFFFF>"
|
||||
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
|
||||
"<tr>"
|
||||
"<td rowspan=3 valign=top align=center width=70>"
|
||||
"<img src=\"memory:opj_logo.xpm\"><br><br>"
|
||||
"</td>"
|
||||
"<td align=center>"
|
||||
"<font size=+0 color=#000000><b>"
|
||||
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
||||
"</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>"
|
||||
"</td>"
|
||||
"</tr>"
|
||||
"<tr height=3 valign=center>"
|
||||
"<td valign=center bgcolor=#cc3300></td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td align=justify>"
|
||||
"<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. "
|
||||
"In addition to the basic codec, various other features are under development.</font></p><br>"
|
||||
"<font size=-2 color=red>* Build: ")
|
||||
#include "build.h"
|
||||
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
|
||||
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
|
||||
#ifdef USE_JPWL
|
||||
wxT("<font size=-2 color=green>JPWL</font> ")
|
||||
#endif // USE_JPWL
|
||||
#ifdef USE_JPSEC
|
||||
wxT("<font size=-2 color=green>JPSEC</font> ")
|
||||
#endif // USE_JPSEC
|
||||
wxT(")</font><br>")
|
||||
#ifdef USE_MXF
|
||||
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
|
||||
#endif // USE_MXF
|
||||
wxT("</td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<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>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>"
|
||||
"</tr>"
|
||||
"</table>"
|
||||
"</body>"
|
||||
"</html>"
|
||||
);
|
||||
wxString htmlaboutpage = wxT(
|
||||
"<html>"
|
||||
"<body bgcolor=#FFFFFF>"
|
||||
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
|
||||
"<tr>"
|
||||
"<td rowspan=3 valign=top align=center width=70>"
|
||||
"<img src=\"memory:opj_logo.xpm\"><br><br>"
|
||||
"</td>"
|
||||
"<td align=center>"
|
||||
"<font size=+0 color=#000000><b>"
|
||||
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
||||
"</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>"
|
||||
"</td>"
|
||||
"</tr>"
|
||||
"<tr height=3 valign=center>"
|
||||
"<td valign=center bgcolor=#cc3300></td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td align=justify>"
|
||||
"<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. "
|
||||
"In addition to the basic codec, various other features are under development.</font></p><br>"
|
||||
"<font size=-2 color=red>* Build: ")
|
||||
#include "build.h"
|
||||
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</font><br>")
|
||||
wxT("<font size=-2 color=red>* OpenJPEG " OPENJPEG_VERSION " (")
|
||||
#ifdef USE_JPWL
|
||||
wxT("<font size=-2 color=green>JPWL</font> ")
|
||||
#endif // USE_JPWL
|
||||
#ifdef USE_JPSEC
|
||||
wxT("<font size=-2 color=green>JPSEC</font> ")
|
||||
#endif // USE_JPSEC
|
||||
wxT(")</font><br>")
|
||||
#ifdef USE_MXF
|
||||
wxT("<font size=-2 color=red>* MXFLib " MXFLIB_VERSION_MAJOR "." MXFLIB_VERSION_MINOR "." MXFLIB_VERSION_TWEAK " (" MXFLIB_VERSION_BUILD ")</font><br>")
|
||||
#endif // USE_MXF
|
||||
wxT("</td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
|
||||
"</tr>"
|
||||
"<tr>"
|
||||
"<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>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>"
|
||||
"</tr>"
|
||||
"</table>"
|
||||
"</body>"
|
||||
"</html>"
|
||||
);
|
||||
@@ -1 +1 @@
|
||||
wxT("491")
|
||||
wxT("491")
|
||||
@@ -1,177 +1,177 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagalljpeg2000.h
|
||||
// Purpose: wxImage JPEG 2000 family file format handler
|
||||
// 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 $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGJPEG2000_H_
|
||||
#define _WX_IMAGJPEG2000_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxJPEG2000Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "openjp2/openjpeg.h"
|
||||
#include "jp2/index.h"
|
||||
|
||||
#define wxBITMAP_TYPE_JPEG2000 50
|
||||
|
||||
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxJPEG2000Handler()
|
||||
{
|
||||
m_name = wxT("JPEG 2000 family file format");
|
||||
m_extension = wxT("mj2");
|
||||
m_type = wxBITMAP_TYPE_JPEG2000;
|
||||
m_mime = wxT("image/mj2");
|
||||
|
||||
/* decoding */
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
|
||||
/* encoding */
|
||||
m_subsampling = wxT("1,1");
|
||||
m_origin = wxT("0,0");
|
||||
m_rates = wxT("20,10,5");
|
||||
m_quality = wxT("30,35,40");
|
||||
m_enablequality = false;
|
||||
m_multicomp = false;
|
||||
m_irreversible = false;
|
||||
m_resolutions = 6;
|
||||
m_progression = 0;
|
||||
m_cbsize = wxT("32,32");
|
||||
m_prsize = wxT("[128,128],[128,128]");
|
||||
m_tsize = wxT("");
|
||||
m_torigin = wxT("0,0");
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
m_enablesop = false;
|
||||
m_enableeph = false;
|
||||
m_enablereset = false;
|
||||
m_enablesegmark = false;
|
||||
m_enablevsc = false;
|
||||
m_enablerestart = false;
|
||||
m_enableerterm = false;
|
||||
m_enablebypass = false;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
m_enableidx = false;
|
||||
m_index = wxT("index.txt");
|
||||
m_enablepoc = false;
|
||||
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
|
||||
m_enablecomm = true;
|
||||
|
||||
#if defined __WXMSW__
|
||||
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
|
||||
#elif defined __WXGTK__
|
||||
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
|
||||
#else
|
||||
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
|
||||
#endif
|
||||
|
||||
#ifdef USE_JPWL
|
||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||
#else
|
||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling;
|
||||
wxString m_origin;
|
||||
wxString m_rates;
|
||||
wxString m_quality;
|
||||
bool m_enablequality;
|
||||
bool m_multicomp;
|
||||
bool m_irreversible;
|
||||
int m_resolutions;
|
||||
int m_progression;
|
||||
wxString m_cbsize;
|
||||
wxString m_prsize;
|
||||
wxString m_tsize;
|
||||
wxString m_torigin;
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
bool m_enablesop;
|
||||
bool m_enableeph;
|
||||
bool m_enablebypass;
|
||||
bool m_enableerterm;
|
||||
bool m_enablerestart;
|
||||
bool m_enablereset;
|
||||
bool m_enablesegmark;
|
||||
bool m_enablevsc;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
bool m_enableidx;
|
||||
wxString m_index;
|
||||
bool m_enablecomm;
|
||||
wxString m_comment;
|
||||
bool m_enablepoc;
|
||||
wxString m_poc;
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
|
||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
|
||||
protected:
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
#endif
|
||||
|
||||
private:
|
||||
OPJ_PROG_ORDER give_progression(char progression[4]);
|
||||
DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // _WX_IMAGJPEG2000_H_
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagalljpeg2000.h
|
||||
// Purpose: wxImage JPEG 2000 family file format handler
|
||||
// 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 $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGJPEG2000_H_
|
||||
#define _WX_IMAGJPEG2000_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxJPEG2000Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
#include "codec/index.h"
|
||||
|
||||
#define wxBITMAP_TYPE_JPEG2000 50
|
||||
|
||||
class WXDLLEXPORT wxJPEG2000Handler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxJPEG2000Handler()
|
||||
{
|
||||
m_name = wxT("JPEG 2000 family file format");
|
||||
m_extension = wxT("mj2");
|
||||
m_type = wxBITMAP_TYPE_JPEG2000;
|
||||
m_mime = wxT("image/mj2");
|
||||
|
||||
/* decoding */
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
|
||||
/* encoding */
|
||||
m_subsampling = wxT("1,1");
|
||||
m_origin = wxT("0,0");
|
||||
m_rates = wxT("20,10,5");
|
||||
m_quality = wxT("30,35,40");
|
||||
m_enablequality = false;
|
||||
m_multicomp = false;
|
||||
m_irreversible = false;
|
||||
m_resolutions = 6;
|
||||
m_progression = 0;
|
||||
m_cbsize = wxT("32,32");
|
||||
m_prsize = wxT("[128,128],[128,128]");
|
||||
m_tsize = wxT("");
|
||||
m_torigin = wxT("0,0");
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
m_enablesop = false;
|
||||
m_enableeph = false;
|
||||
m_enablereset = false;
|
||||
m_enablesegmark = false;
|
||||
m_enablevsc = false;
|
||||
m_enablerestart = false;
|
||||
m_enableerterm = false;
|
||||
m_enablebypass = false;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
m_enableidx = false;
|
||||
m_index = wxT("index.txt");
|
||||
m_enablepoc = false;
|
||||
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
|
||||
m_enablecomm = true;
|
||||
|
||||
#if defined __WXMSW__
|
||||
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
|
||||
#elif defined __WXGTK__
|
||||
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
|
||||
#else
|
||||
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
|
||||
#endif
|
||||
|
||||
#ifdef USE_JPWL
|
||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||
#else
|
||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling;
|
||||
wxString m_origin;
|
||||
wxString m_rates;
|
||||
wxString m_quality;
|
||||
bool m_enablequality;
|
||||
bool m_multicomp;
|
||||
bool m_irreversible;
|
||||
int m_resolutions;
|
||||
int m_progression;
|
||||
wxString m_cbsize;
|
||||
wxString m_prsize;
|
||||
wxString m_tsize;
|
||||
wxString m_torigin;
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
bool m_enablesop;
|
||||
bool m_enableeph;
|
||||
bool m_enablebypass;
|
||||
bool m_enableerterm;
|
||||
bool m_enablerestart;
|
||||
bool m_enablereset;
|
||||
bool m_enablesegmark;
|
||||
bool m_enablevsc;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
bool m_enableidx;
|
||||
wxString m_index;
|
||||
bool m_enablecomm;
|
||||
wxString m_comment;
|
||||
bool m_enablepoc;
|
||||
wxString m_poc;
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
|
||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
|
||||
protected:
|
||||
virtual bool DoCanRead(wxInputStream& stream);
|
||||
#endif
|
||||
|
||||
private:
|
||||
OPJ_PROG_ORDER give_progression(char progression[4]);
|
||||
DECLARE_DYNAMIC_CLASS(wxJPEG2000Handler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // _WX_IMAGJPEG2000_H_
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagmxf.h
|
||||
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
|
||||
// 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 $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGMXF_H_
|
||||
#define _WX_IMAGMXF_H_
|
||||
|
||||
#ifdef USE_MXF
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMXFHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#define wxBITMAP_TYPE_MXF 51
|
||||
|
||||
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxMXFHandler()
|
||||
{
|
||||
m_name = wxT("MXF JPEG 2000 file format");
|
||||
m_extension = wxT("mxf");
|
||||
m_type = wxBITMAP_TYPE_MXF;
|
||||
m_mime = wxT("image/mxf");
|
||||
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
m_filename = wxT("");
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
wxFileName m_filename;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||
protected:
|
||||
virtual bool DoCanRead( wxInputStream& stream );
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMXFHandler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // USE_MXF
|
||||
|
||||
#endif // _WX_IMAGMXF_H_
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagmxf.h
|
||||
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
|
||||
// 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 $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGMXF_H_
|
||||
#define _WX_IMAGMXF_H_
|
||||
|
||||
#ifdef USE_MXF
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/filename.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMXFHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#define wxBITMAP_TYPE_MXF 51
|
||||
|
||||
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxMXFHandler()
|
||||
{
|
||||
m_name = wxT("MXF JPEG 2000 file format");
|
||||
m_extension = wxT("mxf");
|
||||
m_type = wxBITMAP_TYPE_MXF;
|
||||
m_mime = wxT("image/mxf");
|
||||
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
m_filename = wxT("");
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
wxFileName m_filename;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||
protected:
|
||||
virtual bool DoCanRead( wxInputStream& stream );
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMXFHandler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // USE_MXF
|
||||
|
||||
#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, Professor Benoit Macq
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
Copyright (c) 2002-2003, Yannick Verschueren
|
||||
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without 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.
|
||||
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.
|
||||
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
Copyright (c) 2002-2003, Yannick Verschueren
|
||||
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
Copyright (c) 2007, Digital Signal Processing Laboratory, Università degli studi di Perugia (UPG), Italy
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without 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.
|
||||
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.
|
||||
@@ -1,34 +1,34 @@
|
||||
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:
|
||||
- a browsing pane;
|
||||
- a viewing 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:
|
||||
|
||||
filename
|
||||
|
|
||||
|_ #000: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ *** Marker/Box long name ***
|
||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||
| |_ Additional info, depending on the marker/box type
|
||||
| |_ ...
|
||||
|
|
||||
|_ #001: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ ...
|
||||
|
|
||||
...
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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 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.
|
||||
|
||||
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:
|
||||
- a browsing pane;
|
||||
- a viewing 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:
|
||||
|
||||
filename
|
||||
|
|
||||
|_ #000: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ *** Marker/Box long name ***
|
||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||
| |_ Additional info, depending on the marker/box type
|
||||
| |_ ...
|
||||
|
|
||||
|_ #001: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ ...
|
||||
|
|
||||
...
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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 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 ?
|
||||
==================
|
||||
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 ?
|
||||
=========================
|
||||
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 ?
|
||||
===============================
|
||||
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, ...
|
||||
|
||||
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.
|
||||
|
||||
Who is developing the library ?
|
||||
===============================
|
||||
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Université Catholique de Louvain (UCL). The JPWL module is 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.
|
||||
113
applications/codec/CMakeLists.txt
Normal file
@@ -0,0 +1,113 @@
|
||||
# Build the demo app, small examples
|
||||
|
||||
# First thing define the common source:
|
||||
SET(common_SRCS
|
||||
convert.c
|
||||
index.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/color.c
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common/opj_getopt.c
|
||||
)
|
||||
|
||||
# Headers file are located here:
|
||||
INCLUDE_DIRECTORIES(
|
||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
${LCMS_INCLUDE_DIRNAME}
|
||||
${OPENJPEG_SOURCE_DIR}/applications/common
|
||||
${Z_INCLUDE_DIRNAME}
|
||||
${PNG_INCLUDE_DIRNAME}
|
||||
${TIFF_INCLUDE_DIRNAME}
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS(-DOPJ_EXPORTS)
|
||||
ELSE(BUILD_SHARED_LIBS)
|
||||
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Loop over all executables:
|
||||
FOREACH(exe j2k_to_image image_to_j2k j2k_dump)
|
||||
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||
TARGET_LINK_LIBRARIES(${exe} ${OPENJPEG_LIBRARY_NAME}
|
||||
${PNG_LIBNAME} ${TIFF_LIBNAME} ${LCMS_LIBNAME}
|
||||
)
|
||||
# To support universal exe:
|
||||
IF(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(${exe} z)
|
||||
ELSe(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(${exe} ${Z_LIBNAME})
|
||||
ENDIF(ZLIB_FOUND AND APPLE)
|
||||
|
||||
# On unix you need to link to the math library:
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(${exe} m)
|
||||
ENDIF(UNIX)
|
||||
# Install exe
|
||||
INSTALL(TARGETS ${exe}
|
||||
EXPORT OpenJPEGTargets
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
ENDFOREACH(exe)
|
||||
|
||||
# Install man pages
|
||||
INSTALL(
|
||||
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/image_to_j2k.1
|
||||
${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_dump.1
|
||||
${OPENJPEG_SOURCE_DIR}/doc/man/man1/j2k_to_image.1
|
||||
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
|
||||
#
|
||||
|
||||
IF(BUILD_JPWL)
|
||||
ADD_EXECUTABLE(JPWL_j2k_to_image
|
||||
j2k_to_image.c
|
||||
${common_SRCS}
|
||||
)
|
||||
|
||||
SET_PROPERTY(
|
||||
TARGET JPWL_j2k_to_image
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${OPENJPEG_LIBRARY_NAME}_JPWL
|
||||
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||
|
||||
# To support universal exe:
|
||||
IF(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image z)
|
||||
ELSe(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image ${Z_LIBNAME})
|
||||
ENDIF(ZLIB_FOUND AND APPLE)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(JPWL_j2k_to_image m)
|
||||
ENDIF(UNIX)
|
||||
|
||||
ADD_EXECUTABLE(JPWL_image_to_j2k
|
||||
image_to_j2k.c
|
||||
${common_SRCS}
|
||||
)
|
||||
|
||||
SET_PROPERTY(
|
||||
TARGET JPWL_image_to_j2k
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS USE_JPWL
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${OPENJPEG_LIBRARY_NAME}_JPWL
|
||||
${LCMS_LIBNAME} ${PNG_LIBNAME} ${TIFF_LIBNAME})
|
||||
|
||||
# To support universal exe:
|
||||
IF(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k z)
|
||||
ELSe(ZLIB_FOUND AND APPLE)
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k ${Z_LIBNAME})
|
||||
ENDIF(ZLIB_FOUND AND APPLE)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(JPWL_image_to_j2k m)
|
||||
ENDIF(UNIX)
|
||||
|
||||
INSTALL(TARGETS JPWL_image_to_j2k JPWL_j2k_to_image
|
||||
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
)
|
||||
ENDIF(BUILD_JPWL)
|
||||
118
applications/codec/Makefile.am
Normal file
@@ -0,0 +1,118 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = j2k_to_image image_to_j2k j2k_dump
|
||||
|
||||
if WANT_JPWL
|
||||
bin_PROGRAMS += JPWL_j2k_to_image JPWL_image_to_j2k
|
||||
endif
|
||||
|
||||
j2k_to_image_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/codec \
|
||||
-I$(top_builddir)/applications/codec \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
@PNG_CFLAGS@ \
|
||||
@TIFF_CFLAGS@ \
|
||||
@LCMS1_CFLAGS@ \
|
||||
@LCMS2_CFLAGS@
|
||||
j2k_to_image_CFLAGS =
|
||||
j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
j2k_to_image_SOURCES = \
|
||||
../common/color.c \
|
||||
../common/opj_getopt.c \
|
||||
convert.c \
|
||||
index.c \
|
||||
j2k_to_image.c \
|
||||
../common/color.h
|
||||
|
||||
image_to_j2k_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/codec \
|
||||
-I$(top_builddir)/applications/codec \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
@PNG_CFLAGS@ \
|
||||
@TIFF_CFLAGS@
|
||||
image_to_j2k_CFLAGS =
|
||||
image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la @TIFF_LIBS@ @PNG_LIBS@ -lm
|
||||
image_to_j2k_SOURCES = \
|
||||
../common/opj_getopt.c \
|
||||
convert.c \
|
||||
index.c \
|
||||
image_to_j2k.c \
|
||||
convert.h \
|
||||
../common/format_defs.h \
|
||||
index.h
|
||||
|
||||
j2k_dump_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/codec \
|
||||
-I$(top_builddir)/applications/codec \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg
|
||||
j2k_dump_CFLAGS =
|
||||
j2k_dump_LDADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
||||
j2k_dump_SOURCES = \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
j2k_dump.c \
|
||||
../common/opj_getopt.h \
|
||||
index.h
|
||||
|
||||
JPWL_j2k_to_image_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
-DUSE_JPWL \
|
||||
@TIFF_CFLAGS@ \
|
||||
@PNG_CFLAGS@ \
|
||||
@LCMS1_CFLAGS@ \
|
||||
@LCMS2_CFLAGS@
|
||||
JPWL_j2k_to_image_CFLAGS =
|
||||
JPWL_j2k_to_image_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @LCMS1_LIBS@ @LCMS2_LIBS@ @TIFF_LIBS@ @PNG_LIBS@
|
||||
JPWL_j2k_to_image_SOURCES = \
|
||||
../common/color.c \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
convert.c \
|
||||
j2k_to_image.c
|
||||
|
||||
JPWL_image_to_j2k_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/common \
|
||||
-I$(top_builddir)/applications/common \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
-DUSE_JPWL \
|
||||
@TIFF_CFLAGS@ \
|
||||
@PNG_CFLAGS@
|
||||
JPWL_image_to_j2k_CFLAGS =
|
||||
JPWL_image_to_j2k_LDADD = $(top_builddir)/libopenjpeg/jpwl/libopenjpeg_JPWL.la @TIFF_LIBS@ @PNG_LIBS@
|
||||
|
||||
JPWL_image_to_j2k_SOURCES = \
|
||||
../common/opj_getopt.c \
|
||||
index.c \
|
||||
convert.c \
|
||||
image_to_j2k.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
windirent.h
|
||||
|
||||
install-data-hook:
|
||||
@echo -e " (B)\t$(bindir)/j2k_to_image$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/image_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/j2k_dump$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
if WANT_JPWL
|
||||
@echo -e " (B)\t$(bindir)/JPWL_j2k_to_image$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
@echo -e " (B)\t$(bindir)/JPWL_image_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
|
||||
endif
|
||||
8
applications/codec/README
Normal file
@@ -0,0 +1,8 @@
|
||||
Simple codec compilation
|
||||
------------------------
|
||||
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and either use the provided Makefile or use one of the following commands to build an encoder and decoder respectively:
|
||||
|
||||
gcc index.c convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
gcc index.c convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
You should add '-L..' to those lines if you did not use the 'install' target when building the library.
|
||||
@@ -94,8 +94,8 @@ struct tga_header
|
||||
|
||||
static unsigned short get_ushort(unsigned short val) {
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
return( ((val & 0xff) << 8) + (val >> 8) );
|
||||
#ifdef ORDER_BIGENDIAN
|
||||
return( ((val & 0xff) << 8) + (val >> 8) );
|
||||
#else
|
||||
return( val );
|
||||
#endif
|
||||
@@ -104,7 +104,7 @@ static unsigned short get_ushort(unsigned short val) {
|
||||
|
||||
#define TGA_HEADER_SIZE 18
|
||||
|
||||
static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
unsigned int *width, unsigned int *height, int *flip_image)
|
||||
{
|
||||
int palette_size;
|
||||
@@ -179,17 +179,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if WORDS_BIGENDIAN == 1
|
||||
|
||||
static inline int16_t swap16(int16_t x)
|
||||
{
|
||||
return((((u_int16_t)x & 0x00ffU) << 8) |
|
||||
(((u_int16_t)x & 0xff00U) >> 8));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||
int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||
opj_bool flip_image)
|
||||
{
|
||||
unsigned short image_w, image_h, us0;
|
||||
@@ -226,15 +216,8 @@ static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||
image_w = (unsigned short)width;
|
||||
image_h = (unsigned short) height;
|
||||
|
||||
#if WORDS_BIGENDIAN == 0
|
||||
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
|
||||
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
|
||||
#else
|
||||
image_w = swap16(image_w);
|
||||
image_h = swap16(image_h);
|
||||
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
|
||||
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
|
||||
#endif
|
||||
|
||||
if(fwrite(&pixel_depth, 1, 1, fp) != 1) goto fails;
|
||||
|
||||
@@ -510,7 +493,7 @@ int imagetotga(opj_image_t * image, const char *outfile) {
|
||||
typedef unsigned short int WORD;
|
||||
|
||||
/* DWORD defines a four byte word */
|
||||
typedef unsigned int DWORD;
|
||||
typedef unsigned long int DWORD;
|
||||
|
||||
typedef struct {
|
||||
WORD bfType; /* 'BM' for Bitmap (19776) */
|
||||
@@ -600,7 +583,7 @@ opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
|
||||
if(Info_h.biSize != 40)
|
||||
{
|
||||
fprintf(stderr,"Error, unknown BMP header size %d\n", Info_h.biSize);
|
||||
fprintf(stderr,"Error, unknown BMP header size %ld\n", Info_h.biSize);
|
||||
fclose(IN);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1010,11 +993,7 @@ int imagetobmp(opj_image_t * image, const char *outfile) {
|
||||
FILE *fdest = NULL;
|
||||
int adjustR, adjustG, adjustB;
|
||||
|
||||
if (image->comps[0].prec < 8) {
|
||||
fprintf(stderr, "Unsupported precision: %d\n", image->comps[0].prec);
|
||||
return 1;
|
||||
}
|
||||
if (image->numcomps >= 3 && image->comps[0].dx == image->comps[1].dx
|
||||
if (image->numcomps == 3 && image->comps[0].dx == image->comps[1].dx
|
||||
&& image->comps[1].dx == image->comps[2].dx
|
||||
&& image->comps[0].dy == image->comps[1].dy
|
||||
&& image->comps[1].dy == image->comps[2].dy
|
||||
@@ -1202,7 +1181,7 @@ PGX IMAGE FORMAT
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
|
||||
static unsigned char readuchar(FILE * f)
|
||||
unsigned char readuchar(FILE * f)
|
||||
{
|
||||
unsigned char c1;
|
||||
if ( !fread(&c1, 1, 1, f) )
|
||||
@@ -1213,7 +1192,7 @@ static unsigned char readuchar(FILE * f)
|
||||
return c1;
|
||||
}
|
||||
|
||||
static unsigned short readushort(FILE * f, int bigendian)
|
||||
unsigned short readushort(FILE * f, int bigendian)
|
||||
{
|
||||
unsigned char c1, c2;
|
||||
if ( !fread(&c1, 1, 1, f) )
|
||||
@@ -1232,7 +1211,7 @@ static unsigned short readushort(FILE * f, int bigendian)
|
||||
return (c2 << 8) + c1;
|
||||
}
|
||||
|
||||
static unsigned int readuint(FILE * f, int bigendian)
|
||||
unsigned int readuint(FILE * f, int bigendian)
|
||||
{
|
||||
unsigned char c1, c2, c3, c4;
|
||||
if ( !fread(&c1, 1, 1, f) )
|
||||
@@ -1268,7 +1247,6 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters) {
|
||||
OPJ_COLOR_SPACE color_space;
|
||||
opj_image_cmptparm_t cmptparm; /* maximum of 1 component */
|
||||
opj_image_t * image = NULL;
|
||||
int adjustS, ushift, dshift, force8;
|
||||
|
||||
char endian1,endian2,sign;
|
||||
char signtmp[32];
|
||||
@@ -1325,16 +1303,6 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters) {
|
||||
} else {
|
||||
cmptparm.sgnd = 0;
|
||||
}
|
||||
if(prec < 8)
|
||||
{
|
||||
force8 = 1;
|
||||
ushift = 8 - prec; dshift = prec - ushift;
|
||||
if(cmptparm.sgnd) adjustS = (1<<(prec - 1)); else adjustS = 0;
|
||||
cmptparm.sgnd = 0;
|
||||
prec = 8;
|
||||
}
|
||||
else ushift = dshift = force8 = adjustS = 0;
|
||||
|
||||
cmptparm.prec = prec;
|
||||
cmptparm.bpp = prec;
|
||||
cmptparm.dx = parameters->subsampling_dx;
|
||||
@@ -1358,17 +1326,7 @@ opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters) {
|
||||
|
||||
for (i = 0; i < w * h; i++) {
|
||||
int v;
|
||||
if(force8)
|
||||
{
|
||||
v = readuchar(f) + adjustS;
|
||||
v = (v<<ushift) + (v>>dshift);
|
||||
comp->data[i] = (unsigned char)v;
|
||||
|
||||
if(v > max) max = v;
|
||||
|
||||
continue;
|
||||
}
|
||||
if (comp->prec == 8) {
|
||||
if (comp->prec <= 8) {
|
||||
if (!comp->sgnd) {
|
||||
v = readuchar(f);
|
||||
} else {
|
||||
@@ -2081,6 +2039,16 @@ int imagetopnm(opj_image_t * image, const char *outfile)
|
||||
|
||||
<<-- <<-- <<-- <<-- */
|
||||
|
||||
typedef struct tiff_infoheader{
|
||||
DWORD tiWidth; /* Width of Image in pixel*/
|
||||
DWORD tiHeight; /* Height of Image in pixel */
|
||||
DWORD tiPhoto; /* Photometric */
|
||||
WORD tiBps; /* Bits per sample */
|
||||
WORD tiSf; /* Sample Format */
|
||||
WORD tiSpp; /* Sample per pixel 1-bilevel,gray scale , 2- RGB */
|
||||
WORD tiPC; /* Planar config (1-Interleaved, 2-Planarcomp) */
|
||||
}tiff_infoheader_t;
|
||||
|
||||
int imagetotif(opj_image_t * image, const char *outfile)
|
||||
{
|
||||
int width, height, imgsize;
|
||||
@@ -2452,6 +2420,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
int subsampling_dx = parameters->subsampling_dx;
|
||||
int subsampling_dy = parameters->subsampling_dy;
|
||||
TIFF *tif;
|
||||
tiff_infoheader_t Info;
|
||||
tdata_t buf;
|
||||
tstrip_t strip;
|
||||
tsize_t strip_size;
|
||||
@@ -2461,8 +2430,6 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
opj_image_t *image = NULL;
|
||||
int imgsize = 0;
|
||||
int has_alpha = 0;
|
||||
unsigned short tiBps, tiPhoto, tiSf, tiSpp, tiPC;
|
||||
unsigned int tiWidth, tiHeight;
|
||||
|
||||
tif = TIFFOpen(filename, "r");
|
||||
|
||||
@@ -2471,34 +2438,32 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
fprintf(stderr, "tiftoimage:Failed to open %s for reading\n", filename);
|
||||
return 0;
|
||||
}
|
||||
tiBps = tiPhoto = tiSf = tiSpp = tiPC = 0;
|
||||
tiWidth = tiHeight = 0;
|
||||
|
||||
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &tiWidth);
|
||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &tiHeight);
|
||||
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &tiBps);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &tiSf);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &tiSpp);
|
||||
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &tiPhoto);
|
||||
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &tiPC);
|
||||
w= tiWidth;
|
||||
h= tiHeight;
|
||||
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &Info.tiWidth);
|
||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &Info.tiHeight);
|
||||
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &Info.tiBps);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLEFORMAT, &Info.tiSf);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &Info.tiSpp);
|
||||
Info.tiPhoto = 0;
|
||||
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &Info.tiPhoto);
|
||||
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &Info.tiPC);
|
||||
w= Info.tiWidth;
|
||||
h= Info.tiHeight;
|
||||
|
||||
{
|
||||
unsigned short b = tiBps, p = tiPhoto;
|
||||
int b, p;
|
||||
|
||||
if(tiBps != 8 && tiBps != 16 && tiBps != 12) b = 0;
|
||||
if(tiPhoto != 1 && tiPhoto != 2) p = 0;
|
||||
if((b = Info.tiBps) != 8 && b != 16 && b != 12) b = 0;
|
||||
if((p = Info.tiPhoto) != 1 && p != 2) p = 0;
|
||||
|
||||
if( !b || !p)
|
||||
{
|
||||
if( !b)
|
||||
fprintf(stderr,"imagetotif: Bits=%d, Only 8 and 16 bits"
|
||||
" implemented\n",tiBps);
|
||||
" implemented\n",Info.tiBps);
|
||||
else
|
||||
if( !p)
|
||||
fprintf(stderr,"tiftoimage: Bad color format %d.\n\tOnly RGB(A)"
|
||||
" and GRAY(A) has been implemented\n",(int) tiPhoto);
|
||||
" and GRAY(A) has been implemented\n",(int) Info.tiPhoto);
|
||||
|
||||
fprintf(stderr,"\tAborting\n");
|
||||
TIFFClose(tif);
|
||||
@@ -2506,6 +2471,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
{/* From: tiff-4.0.x/libtiff/tif_getimage.c : */
|
||||
uint16* sampleinfo;
|
||||
uint16 extrasamples;
|
||||
@@ -2520,7 +2486,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
case EXTRASAMPLE_UNSPECIFIED:
|
||||
/* Workaround for some images without correct info about alpha channel
|
||||
*/
|
||||
if(tiSpp > 3)
|
||||
if(Info.tiSpp > 3)
|
||||
has_alpha = 1;
|
||||
break;
|
||||
|
||||
@@ -2530,15 +2496,12 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else /* extrasamples == 0 */
|
||||
if(tiSpp == 4 || tiSpp == 2) has_alpha = 1;
|
||||
}
|
||||
|
||||
/* initialize image components
|
||||
*/
|
||||
memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
|
||||
|
||||
if(tiPhoto == PHOTOMETRIC_RGB) /* RGB(A) */
|
||||
if(Info.tiPhoto == PHOTOMETRIC_RGB) /* RGB(A) */
|
||||
{
|
||||
numcomps = 3 + has_alpha;
|
||||
color_space = CLRSPC_SRGB;
|
||||
@@ -2552,8 +2515,8 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
}
|
||||
else
|
||||
{
|
||||
cmptparm[j].prec = tiBps;
|
||||
cmptparm[j].bpp = tiBps;
|
||||
cmptparm[j].prec = Info.tiBps;
|
||||
cmptparm[j].bpp = Info.tiBps;
|
||||
}
|
||||
cmptparm[j].dx = subsampling_dx;
|
||||
cmptparm[j].dy = subsampling_dy;
|
||||
@@ -2592,7 +2555,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
||||
dat8 = (unsigned char*)buf;
|
||||
|
||||
if(tiBps == 16)
|
||||
if(Info.tiBps == 16)
|
||||
{
|
||||
step = 6 + has_alpha + has_alpha;
|
||||
|
||||
@@ -2625,9 +2588,9 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
else
|
||||
break;
|
||||
}/*for(i = 0)*/
|
||||
}/*if(tiBps == 16)*/
|
||||
}/*if(Info.tiBps == 16)*/
|
||||
else
|
||||
if(tiBps == 8)
|
||||
if(Info.tiBps == 8)
|
||||
{
|
||||
step = 3 + has_alpha;
|
||||
|
||||
@@ -2656,9 +2619,9 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
else
|
||||
break;
|
||||
}/*for(i )*/
|
||||
}/*if( tiBps == 8)*/
|
||||
}/*if( Info.tiBps == 8)*/
|
||||
else
|
||||
if(tiBps == 12)/* CINEMA file */
|
||||
if(Info.tiBps == 12)/* CINEMA file */
|
||||
{
|
||||
step = 9;
|
||||
|
||||
@@ -2689,15 +2652,15 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
return image;
|
||||
}/*RGB(A)*/
|
||||
|
||||
if(tiPhoto == PHOTOMETRIC_MINISBLACK) /* GRAY(A) */
|
||||
if(Info.tiPhoto == PHOTOMETRIC_MINISBLACK) /* GRAY(A) */
|
||||
{
|
||||
numcomps = 1 + has_alpha;
|
||||
color_space = CLRSPC_GRAY;
|
||||
|
||||
for(j = 0; j < numcomps; ++j)
|
||||
{
|
||||
cmptparm[j].prec = tiBps;
|
||||
cmptparm[j].bpp = tiBps;
|
||||
cmptparm[j].prec = Info.tiBps;
|
||||
cmptparm[j].bpp = Info.tiBps;
|
||||
cmptparm[j].dx = subsampling_dx;
|
||||
cmptparm[j].dy = subsampling_dy;
|
||||
cmptparm[j].w = w;
|
||||
@@ -2735,7 +2698,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
ssize = TIFFReadEncodedStrip(tif, strip, buf, strip_size);
|
||||
dat8 = (unsigned char*)buf;
|
||||
|
||||
if(tiBps == 16)
|
||||
if(Info.tiBps == 16)
|
||||
{
|
||||
step = 2 + has_alpha + has_alpha;
|
||||
|
||||
@@ -2753,7 +2716,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
}/*for(i )*/
|
||||
}
|
||||
else
|
||||
if(tiBps == 8)
|
||||
if(Info.tiBps == 8)
|
||||
{
|
||||
step = 1 + has_alpha;
|
||||
|
||||
@@ -3219,27 +3182,18 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
int *red, *green, *blue, *alpha;
|
||||
unsigned char *row_buf, *d;
|
||||
int has_alpha, width, height, nr_comp, color_type;
|
||||
int adjustR, adjustG, adjustB, adjustA, x, y, fails;
|
||||
int prec, ushift, dshift, is16, force16, force8;
|
||||
int adjustR, adjustG, adjustB, x, y, fails, is16, force16;
|
||||
int opj_prec, prec, ushift, dshift;
|
||||
unsigned short mask = 0xffff;
|
||||
png_color_8 sig_bit;
|
||||
|
||||
is16 = force16 = force8 = ushift = dshift = 0; fails = 1;
|
||||
prec = image->comps[0].prec;
|
||||
nr_comp = image->numcomps;
|
||||
is16 = force16 = ushift = dshift = 0; fails = 1;
|
||||
prec = opj_prec = image->comps[0].prec;
|
||||
|
||||
if(prec > 8 && prec < 16)
|
||||
{
|
||||
ushift = 16 - prec; dshift = prec - ushift;
|
||||
prec = 16; force16 = 1;
|
||||
prec = 16; force16 = 1;
|
||||
}
|
||||
else
|
||||
if(prec < 8 && nr_comp > 1)/* GRAY_ALPHA, RGB, RGB_ALPHA */
|
||||
{
|
||||
ushift = 8 - prec; dshift = 8 - ushift;
|
||||
prec = 8; force8 = 1;
|
||||
}
|
||||
|
||||
if(prec != 1 && prec != 2 && prec != 4 && prec != 8 && prec != 16)
|
||||
{
|
||||
fprintf(stderr,"imagetopng: can not create %s"
|
||||
@@ -3287,14 +3241,6 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
|
||||
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE.
|
||||
* REQUIRED
|
||||
*
|
||||
* ERRORS:
|
||||
*
|
||||
* color_type == PNG_COLOR_TYPE_PALETTE && bit_depth > 8
|
||||
* color_type == PNG_COLOR_TYPE_RGB && bit_depth < 8
|
||||
* color_type == PNG_COLOR_TYPE_GRAY_ALPHA && bit_depth < 8
|
||||
* color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8
|
||||
*
|
||||
*/
|
||||
png_set_compression_level(png, Z_BEST_COMPRESSION);
|
||||
|
||||
@@ -3308,6 +3254,8 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
else
|
||||
if(prec == 1) mask = 0x0001;
|
||||
|
||||
nr_comp = image->numcomps;
|
||||
|
||||
if(nr_comp >= 3
|
||||
&& image->comps[0].dx == image->comps[1].dx
|
||||
&& image->comps[1].dx == image->comps[2].dx
|
||||
@@ -3336,13 +3284,11 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
sig_bit.alpha = prec;
|
||||
alpha = image->comps[3].data;
|
||||
color_type = PNG_COLOR_TYPE_RGB_ALPHA;
|
||||
adjustA = (image->comps[3].sgnd ? 1 << (image->comps[3].prec - 1) : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sig_bit.alpha = 0; alpha = NULL;
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
adjustA = 0;
|
||||
}
|
||||
png_set_sBIT(png, info, &sig_bit);
|
||||
|
||||
@@ -3350,12 +3296,17 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
color_type,
|
||||
PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
|
||||
|
||||
/*=============================*/
|
||||
png_write_info(png, info);
|
||||
/*=============================*/
|
||||
if(prec < 8)
|
||||
if(opj_prec < 8)
|
||||
{
|
||||
png_set_packing(png);
|
||||
}
|
||||
if(force16)
|
||||
{
|
||||
ushift = 16 - opj_prec; dshift = opj_prec - ushift;
|
||||
}
|
||||
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||
adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
||||
@@ -3391,40 +3342,21 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
|
||||
if(has_alpha)
|
||||
{
|
||||
v = *alpha + adjustA; ++alpha;
|
||||
v = *alpha++;
|
||||
|
||||
if(force16) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v>>8); *d++ = (unsigned char)v;
|
||||
}
|
||||
continue;
|
||||
}/* if(is16) */
|
||||
|
||||
v = *red + adjustR; ++red;
|
||||
|
||||
if(force8) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v & mask);
|
||||
|
||||
v = *green + adjustG; ++green;
|
||||
|
||||
if(force8) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v & mask);
|
||||
|
||||
v = *blue + adjustB; ++blue;
|
||||
|
||||
if(force8) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v & mask);
|
||||
}
|
||||
*d++ = (unsigned char)((*red + adjustR) & mask); ++red;
|
||||
*d++ = (unsigned char)((*green + adjustG) & mask); ++green;
|
||||
*d++ = (unsigned char)((*blue + adjustB) & mask); ++blue;
|
||||
|
||||
if(has_alpha)
|
||||
{
|
||||
v = *alpha + adjustA; ++alpha;
|
||||
|
||||
if(force8) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v & mask);
|
||||
*d++ = (unsigned char)(*alpha & mask); ++alpha;
|
||||
}
|
||||
} /* for(x) */
|
||||
|
||||
@@ -3445,9 +3377,13 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
|
||||
red = image->comps[0].data;
|
||||
|
||||
if(force16)
|
||||
{
|
||||
ushift = 16 - opj_prec; dshift = opj_prec - ushift;
|
||||
}
|
||||
sig_bit.gray = prec;
|
||||
sig_bit.red = sig_bit.green = sig_bit.blue = sig_bit.alpha = 0;
|
||||
alpha = NULL; adjustA = 0;
|
||||
alpha = NULL;
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
|
||||
if(nr_comp == 2)
|
||||
@@ -3455,7 +3391,6 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
has_alpha = 1; sig_bit.alpha = prec;
|
||||
alpha = image->comps[1].data;
|
||||
color_type = PNG_COLOR_TYPE_GRAY_ALPHA;
|
||||
adjustA = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
|
||||
}
|
||||
width = image->comps[0].w;
|
||||
height = image->comps[0].h;
|
||||
@@ -3471,7 +3406,7 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
/*=============================*/
|
||||
adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
|
||||
|
||||
if(prec < 8)
|
||||
if(opj_prec < 8)
|
||||
{
|
||||
png_set_packing(png);
|
||||
}
|
||||
@@ -3517,19 +3452,11 @@ int imagetopng(opj_image_t * image, const char *write_idf)
|
||||
|
||||
for(x = 0; x < width; ++x)
|
||||
{
|
||||
v = *red + adjustR; ++red;
|
||||
|
||||
if(force8) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v & mask);
|
||||
*d++ = (unsigned char)((*red + adjustR) & mask); ++red;
|
||||
|
||||
if(has_alpha)
|
||||
{
|
||||
v = *alpha + adjustA; ++alpha;
|
||||
|
||||
if(force8) { v = (v<<ushift) + (v>>dshift); }
|
||||
|
||||
*d++ = (unsigned char)(v & mask);
|
||||
*d++ = (unsigned char)(*alpha & mask); ++alpha;
|
||||
}
|
||||
}/* for(x) */
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
#else
|
||||
#include <strings.h>
|
||||
#define _stricmp strcasecmp
|
||||
#define _strnicmp strncasecmp
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
@@ -82,8 +82,8 @@ typedef struct img_folder{
|
||||
float *rates;
|
||||
}img_fol_t;
|
||||
|
||||
static void encode_help_display(void) {
|
||||
fprintf(stdout,"HELP for opj_jpwl_compress\n----\n\n");
|
||||
void encode_help_display(void) {
|
||||
fprintf(stdout,"HELP for image_to_j2k\n----\n\n");
|
||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||
|
||||
/* UniPG>> */
|
||||
@@ -321,7 +321,7 @@ static void encode_help_display(void) {
|
||||
fprintf(stdout,"TotalDisto\n\n");
|
||||
}
|
||||
|
||||
static OPJ_PROG_ORDER give_progression(const char progression[4]) {
|
||||
OPJ_PROG_ORDER give_progression(char progression[4]) {
|
||||
if(strncmp(progression, "LRCP", 4) == 0) {
|
||||
return LRCP;
|
||||
}
|
||||
@@ -341,10 +341,10 @@ static OPJ_PROG_ORDER give_progression(const char progression[4]) {
|
||||
return PROG_UNKNOWN;
|
||||
}
|
||||
|
||||
static unsigned int get_num_images(char *imgdirpath){
|
||||
int get_num_images(char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
unsigned int num_images = 0;
|
||||
int num_images = 0;
|
||||
|
||||
/*Reading the input images from given input directory*/
|
||||
|
||||
@@ -363,7 +363,7 @@ static unsigned int get_num_images(char *imgdirpath){
|
||||
return num_images;
|
||||
}
|
||||
|
||||
static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int i = 0;
|
||||
@@ -388,7 +388,7 @@ static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_file_format(char *filename) {
|
||||
int get_file_format(char *filename) {
|
||||
unsigned int i;
|
||||
static const char *extension[] = {
|
||||
"pgx", "pnm", "pgm", "ppm", "pbm", "pam", "bmp", "tif", "raw", "tga", "png", "j2k", "jp2", "j2c", "jpc"
|
||||
@@ -401,21 +401,21 @@ static int get_file_format(char *filename) {
|
||||
return -1;
|
||||
ext++;
|
||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||
if(strcasecmp(ext, extension[i]) == 0) {
|
||||
if(_strnicmp(ext, extension[i], 3) == 0) {
|
||||
return format[i];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static char * get_file_name(char *name){
|
||||
char * get_file_name(char *name){
|
||||
char *fname;
|
||||
fname= (char*)malloc(OPJ_PATH_LEN*sizeof(char));
|
||||
fname= strtok(name,".");
|
||||
return fname;
|
||||
}
|
||||
|
||||
static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparameters_t *parameters){
|
||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_cparameters_t *parameters){
|
||||
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
||||
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||
|
||||
@@ -458,7 +458,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres){
|
||||
return 2;
|
||||
}
|
||||
|
||||
static void cinema_parameters(opj_cparameters_t *parameters){
|
||||
void cinema_parameters(opj_cparameters_t *parameters){
|
||||
parameters->tile_size_on = OPJ_FALSE;
|
||||
parameters->cp_tdx=1;
|
||||
parameters->cp_tdy=1;
|
||||
@@ -491,7 +491,7 @@ static void cinema_parameters(opj_cparameters_t *parameters){
|
||||
|
||||
}
|
||||
|
||||
static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
|
||||
void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
|
||||
int i;
|
||||
float temp_rate;
|
||||
|
||||
@@ -576,7 +576,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
|
||||
|
||||
/* ------------------------------------------------------------------------------------ */
|
||||
|
||||
static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
|
||||
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
|
||||
int i, j, totlen, c;
|
||||
opj_option_t long_option[]={
|
||||
@@ -1379,7 +1379,7 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
|
||||
case 'J': /* jpip on */
|
||||
{
|
||||
/*parameters->jpip_on = OPJ_TRUE;*/
|
||||
parameters->jpip_on = OPJ_TRUE;
|
||||
}
|
||||
break;
|
||||
/* ------------------------------------------------------ */
|
||||
@@ -1466,21 +1466,21 @@ static int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *param
|
||||
/**
|
||||
sample error callback expecting a FILE* client object
|
||||
*/
|
||||
static void error_callback(const char *msg, void *client_data) {
|
||||
void error_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[ERROR] %s", msg);
|
||||
}
|
||||
/**
|
||||
sample warning callback expecting a FILE* client object
|
||||
*/
|
||||
static void warning_callback(const char *msg, void *client_data) {
|
||||
void warning_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[WARNING] %s", msg);
|
||||
}
|
||||
/**
|
||||
sample debug callback expecting a FILE* client object
|
||||
*/
|
||||
static void info_callback(const char *msg, void *client_data) {
|
||||
void info_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[INFO] %s", msg);
|
||||
}
|
||||
@@ -1760,7 +1760,7 @@ int main(int argc, char **argv) {
|
||||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||
|
||||
/* encode the image */
|
||||
if (*indexfilename /*|| parameters.jpip_on*/) /* If need to extract codestream information*/
|
||||
if (*indexfilename || parameters.jpip_on) /* If need to extract codestream information*/
|
||||
bSuccess = opj_encode_with_info(cinfo, cio, image, &cstr_info);
|
||||
else
|
||||
bSuccess = opj_encode(cinfo, cio, image, NULL);
|
||||
@@ -1,391 +1,391 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "openjpeg.h"
|
||||
#include "index.h"
|
||||
|
||||
/* ------------------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
Write a structured index to a file
|
||||
@param cstr_info Codestream information
|
||||
@param index Index filename
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
||||
FILE *stream = NULL;
|
||||
double total_disto = 0;
|
||||
/* UniPG>> */
|
||||
int tilepartno;
|
||||
char disto_on, numpix_on;
|
||||
|
||||
#ifdef USE_JPWL
|
||||
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
|
||||
return 0;
|
||||
#endif /* USE_JPWL */
|
||||
/* <<UniPG */
|
||||
|
||||
if (!cstr_info)
|
||||
return 1;
|
||||
|
||||
stream = fopen(index, "w");
|
||||
if (!stream) {
|
||||
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cstr_info->tile[0].distotile)
|
||||
disto_on = 1;
|
||||
else
|
||||
disto_on = 0;
|
||||
|
||||
if (cstr_info->tile[0].numpix)
|
||||
numpix_on = 1;
|
||||
else
|
||||
numpix_on = 0;
|
||||
|
||||
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
||||
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->tw, cstr_info->th);
|
||||
fprintf(stream, "%d\n", cstr_info->numcomps);
|
||||
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||
fprintf(stream, "%d\n", cstr_info->numdecompos[0]); /* based on component 0 */
|
||||
|
||||
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||
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 */
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
/* UniPG>> */
|
||||
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||
/* <<UniPG */
|
||||
fprintf(stream, "%d\n", cstr_info->main_head_end);
|
||||
fprintf(stream, "%d\n", cstr_info->codestream_size);
|
||||
|
||||
fprintf(stream, "\nINFO ON TILES\n");
|
||||
fprintf(stream, "tileno start_pos end_hd end_tile nbparts");
|
||||
if (disto_on)
|
||||
fprintf(stream," disto");
|
||||
if (numpix_on)
|
||||
fprintf(stream," nbpix");
|
||||
if (disto_on && numpix_on)
|
||||
fprintf(stream," disto/nbpix");
|
||||
fprintf(stream, "\n");
|
||||
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
fprintf(stream, "%4d %9d %9d %9d %9d",
|
||||
cstr_info->tile[tileno].tileno,
|
||||
cstr_info->tile[tileno].start_pos,
|
||||
cstr_info->tile[tileno].end_header,
|
||||
cstr_info->tile[tileno].end_pos,
|
||||
cstr_info->tile[tileno].num_tps);
|
||||
if (disto_on)
|
||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile);
|
||||
if (numpix_on)
|
||||
fprintf(stream," %9d", cstr_info->tile[tileno].numpix);
|
||||
if (disto_on && numpix_on)
|
||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
int start_pos, end_ph_pos, end_pos;
|
||||
double disto = 0;
|
||||
int max_numdecompos = 0;
|
||||
pack_nb = 0;
|
||||
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||
max_numdecompos = cstr_info->numdecompos[compno];
|
||||
}
|
||||
|
||||
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||
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++)
|
||||
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
|
||||
tilepartno, tileno,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
|
||||
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_pos
|
||||
);
|
||||
|
||||
if (cstr_info->prog == LRCP) { /* LRCP */
|
||||
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max;
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < prec_max; precno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* LRCP */
|
||||
|
||||
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");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max;
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < prec_max; precno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* RLCP */
|
||||
|
||||
else if (cstr_info->prog == RPCL) { /* RPCL */
|
||||
|
||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < numprec; precno++) {
|
||||
/* 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 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 y1 = y0 + cstr_info->tile_y;
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
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 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_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* precno */
|
||||
} /* compno */
|
||||
} /* resno */
|
||||
} /* RPCL */
|
||||
|
||||
else if (cstr_info->prog == PCRL) { /* PCRL */
|
||||
/* 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 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 y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
/* Count the maximum number of precincts */
|
||||
int max_numprec = 0;
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
if (numprec > max_numprec)
|
||||
max_numprec = numprec;
|
||||
}
|
||||
|
||||
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (precno = 0; precno < max_numprec; precno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
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 pcnx = cstr_info->tile[tileno].pw[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 precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (precno >= numprec)
|
||||
continue;
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* resno */
|
||||
} /* compno */
|
||||
} /* precno */
|
||||
} /* PCRL */
|
||||
|
||||
else { /* CPRL */
|
||||
/* Count the maximum number of precincts */
|
||||
int max_numprec = 0;
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
if (numprec > max_numprec)
|
||||
max_numprec = numprec;
|
||||
}
|
||||
|
||||
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
/* 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 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 y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
for (precno = 0; precno < max_numprec; precno++) {
|
||||
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 pcnx = cstr_info->tile[tileno].pw[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 precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (precno >= numprec)
|
||||
continue;
|
||||
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* resno */
|
||||
} /* precno */
|
||||
} /* compno */
|
||||
} /* CPRL */
|
||||
} /* tileno */
|
||||
|
||||
if (disto_on) {
|
||||
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
|
||||
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
|
||||
}
|
||||
/* UniPG>> */
|
||||
/* print the markers' list */
|
||||
if (cstr_info->marknum) {
|
||||
fprintf(stream, "\nMARKER LIST\n");
|
||||
fprintf(stream, "%d\n", cstr_info->marknum);
|
||||
fprintf(stream, "type\tstart_pos length\n");
|
||||
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);
|
||||
}
|
||||
/* <<UniPG */
|
||||
fclose(stream);
|
||||
|
||||
fprintf(stderr,"Generated index file %s\n", index);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "openjpeg.h"
|
||||
#include "index.h"
|
||||
|
||||
/* ------------------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
Write a structured index to a file
|
||||
@param cstr_info Codestream information
|
||||
@param index Index filename
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
||||
FILE *stream = NULL;
|
||||
double total_disto = 0;
|
||||
/* UniPG>> */
|
||||
int tilepartno;
|
||||
char disto_on, numpix_on;
|
||||
|
||||
#ifdef USE_JPWL
|
||||
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
|
||||
return 0;
|
||||
#endif /* USE_JPWL */
|
||||
/* <<UniPG */
|
||||
|
||||
if (!cstr_info)
|
||||
return 1;
|
||||
|
||||
stream = fopen(index, "w");
|
||||
if (!stream) {
|
||||
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cstr_info->tile[0].distotile)
|
||||
disto_on = 1;
|
||||
else
|
||||
disto_on = 0;
|
||||
|
||||
if (cstr_info->tile[0].numpix)
|
||||
numpix_on = 1;
|
||||
else
|
||||
numpix_on = 0;
|
||||
|
||||
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
||||
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->tw, cstr_info->th);
|
||||
fprintf(stream, "%d\n", cstr_info->numcomps);
|
||||
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||
fprintf(stream, "%d\n", cstr_info->numdecompos[0]); /* based on component 0 */
|
||||
|
||||
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||
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 */
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
/* UniPG>> */
|
||||
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||
/* <<UniPG */
|
||||
fprintf(stream, "%d\n", cstr_info->main_head_end);
|
||||
fprintf(stream, "%d\n", cstr_info->codestream_size);
|
||||
|
||||
fprintf(stream, "\nINFO ON TILES\n");
|
||||
fprintf(stream, "tileno start_pos end_hd end_tile nbparts");
|
||||
if (disto_on)
|
||||
fprintf(stream," disto");
|
||||
if (numpix_on)
|
||||
fprintf(stream," nbpix");
|
||||
if (disto_on && numpix_on)
|
||||
fprintf(stream," disto/nbpix");
|
||||
fprintf(stream, "\n");
|
||||
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
fprintf(stream, "%4d %9d %9d %9d %9d",
|
||||
cstr_info->tile[tileno].tileno,
|
||||
cstr_info->tile[tileno].start_pos,
|
||||
cstr_info->tile[tileno].end_header,
|
||||
cstr_info->tile[tileno].end_pos,
|
||||
cstr_info->tile[tileno].num_tps);
|
||||
if (disto_on)
|
||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile);
|
||||
if (numpix_on)
|
||||
fprintf(stream," %9d", cstr_info->tile[tileno].numpix);
|
||||
if (disto_on && numpix_on)
|
||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
int start_pos, end_ph_pos, end_pos;
|
||||
double disto = 0;
|
||||
int max_numdecompos = 0;
|
||||
pack_nb = 0;
|
||||
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||
max_numdecompos = cstr_info->numdecompos[compno];
|
||||
}
|
||||
|
||||
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||
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++)
|
||||
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
|
||||
tilepartno, tileno,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
|
||||
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_pos
|
||||
);
|
||||
|
||||
if (cstr_info->prog == LRCP) { /* LRCP */
|
||||
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max;
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < prec_max; precno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* LRCP */
|
||||
|
||||
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");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max;
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < prec_max; precno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* RLCP */
|
||||
|
||||
else if (cstr_info->prog == RPCL) { /* RPCL */
|
||||
|
||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < numprec; precno++) {
|
||||
/* 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 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 y1 = y0 + cstr_info->tile_y;
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
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 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_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* precno */
|
||||
} /* compno */
|
||||
} /* resno */
|
||||
} /* RPCL */
|
||||
|
||||
else if (cstr_info->prog == PCRL) { /* PCRL */
|
||||
/* 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 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 y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
/* Count the maximum number of precincts */
|
||||
int max_numprec = 0;
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
if (numprec > max_numprec)
|
||||
max_numprec = numprec;
|
||||
}
|
||||
|
||||
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (precno = 0; precno < max_numprec; precno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
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 pcnx = cstr_info->tile[tileno].pw[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 precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (precno >= numprec)
|
||||
continue;
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* resno */
|
||||
} /* compno */
|
||||
} /* precno */
|
||||
} /* PCRL */
|
||||
|
||||
else { /* CPRL */
|
||||
/* Count the maximum number of precincts */
|
||||
int max_numprec = 0;
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
if (numprec > max_numprec)
|
||||
max_numprec = numprec;
|
||||
}
|
||||
|
||||
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
/* 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 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 y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
for (precno = 0; precno < max_numprec; precno++) {
|
||||
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 pcnx = cstr_info->tile[tileno].pw[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 precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (precno >= numprec)
|
||||
continue;
|
||||
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
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_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
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);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* resno */
|
||||
} /* precno */
|
||||
} /* compno */
|
||||
} /* CPRL */
|
||||
} /* tileno */
|
||||
|
||||
if (disto_on) {
|
||||
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
|
||||
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
|
||||
}
|
||||
/* UniPG>> */
|
||||
/* print the markers' list */
|
||||
if (cstr_info->marknum) {
|
||||
fprintf(stream, "\nMARKER LIST\n");
|
||||
fprintf(stream, "%d\n", cstr_info->marknum);
|
||||
fprintf(stream, "type\tstart_pos length\n");
|
||||
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);
|
||||
}
|
||||
/* <<UniPG */
|
||||
fclose(stream);
|
||||
|
||||
fprintf(stderr,"Generated index file %s\n", index);
|
||||
|
||||
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, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __J2K_INDEX_H
|
||||
#define __J2K_INDEX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Write a structured index to a file
|
||||
@param cstr_info Codestream information
|
||||
@param index Index filename
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __J2K_INDEX_H */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __J2K_INDEX_H
|
||||
#define __J2K_INDEX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Write a structured index to a file
|
||||
@param cstr_info Codestream information
|
||||
@param index Index filename
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __J2K_INDEX_H */
|
||||
|
||||
677
applications/codec/j2k_dump.c
Normal file
@@ -0,0 +1,677 @@
|
||||
/*
|
||||
* Copyright (c) 20010, Mathieu Malaterre, GDCM
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "windirent.h"
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#define _stricmp strcasecmp
|
||||
#define _strnicmp strncasecmp
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "j2k.h"
|
||||
#include "jp2.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
#include "format_defs.h"
|
||||
|
||||
typedef struct dircnt{
|
||||
/** Buffer for holding images read from Directory*/
|
||||
char *filename_buf;
|
||||
/** Pointer to the buffer*/
|
||||
char **filename;
|
||||
}dircnt_t;
|
||||
|
||||
|
||||
typedef struct img_folder{
|
||||
/** The directory path of the folder containing input images*/
|
||||
char *imgdirpath;
|
||||
/** Output format*/
|
||||
const char *out_format;
|
||||
/** Enable option*/
|
||||
char set_imgdir;
|
||||
/** Enable Cod Format for output*/
|
||||
char set_out_format;
|
||||
|
||||
}img_fol_t;
|
||||
|
||||
void decode_help_display(void) {
|
||||
fprintf(stdout,"HELP for j2k_dump\n----\n\n");
|
||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||
|
||||
/* UniPG>> */
|
||||
fprintf(stdout,"List of parameters for the JPEG 2000 "
|
||||
#ifdef USE_JPWL
|
||||
"+ JPWL "
|
||||
#endif /* USE_JPWL */
|
||||
"decoder:\n");
|
||||
/* <<UniPG */
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout," -ImgDir \n");
|
||||
fprintf(stdout," Image file Directory path \n");
|
||||
fprintf(stdout," -i <compressed file>\n");
|
||||
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
|
||||
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
|
||||
fprintf(stdout," is identified based on its suffix.\n");
|
||||
fprintf(stdout," -o <output file>\n");
|
||||
fprintf(stdout," OPTIONAL\n");
|
||||
fprintf(stdout," Output file where file info will be dump.\n");
|
||||
fprintf(stdout," By default it will be in the stdout.\n");
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
static void j2k_dump_image(FILE *fd, opj_image_t * img);
|
||||
static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp);
|
||||
|
||||
int get_num_images(char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int num_images = 0;
|
||||
|
||||
/*Reading the input images from given input directory*/
|
||||
|
||||
dir= opendir(imgdirpath);
|
||||
if(!dir){
|
||||
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while((content=readdir(dir))!=NULL){
|
||||
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||
continue;
|
||||
num_images++;
|
||||
}
|
||||
return num_images;
|
||||
}
|
||||
|
||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int i = 0;
|
||||
|
||||
/*Reading the input images from given input directory*/
|
||||
|
||||
dir= opendir(imgdirpath);
|
||||
if(!dir){
|
||||
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||
return 1;
|
||||
}else {
|
||||
fprintf(stderr,"Folder opened successfully\n");
|
||||
}
|
||||
|
||||
while((content=readdir(dir))!=NULL){
|
||||
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||
continue;
|
||||
|
||||
strcpy(dirptr->filename[i],content->d_name);
|
||||
i++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_file_format(char *filename) {
|
||||
unsigned int i;
|
||||
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "raw", "tga", "png", "j2k", "jp2", "jpt", "j2c", "jpc" };
|
||||
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, PNG_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT, J2K_CFMT };
|
||||
char * ext = strrchr(filename, '.');
|
||||
if (ext == NULL)
|
||||
return -1;
|
||||
ext++;
|
||||
if(ext) {
|
||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||
if(_strnicmp(ext, extension[i], 3) == 0) {
|
||||
return format[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
||||
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
||||
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||
|
||||
strcpy(image_filename,dirptr->filename[imageno]);
|
||||
fprintf(stderr,"File Number %d \"%s\"\n",imageno,image_filename);
|
||||
parameters->decod_format = get_file_format(image_filename);
|
||||
if (parameters->decod_format == -1)
|
||||
return 1;
|
||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||
|
||||
/*Set output file*/
|
||||
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||
while((temp_p = strtok(NULL,".")) != NULL){
|
||||
strcat(temp_ofname,temp1);
|
||||
sprintf(temp1,".%s",temp_p);
|
||||
}
|
||||
if(img_fol->set_out_format==1){
|
||||
sprintf(outfilename,"%s/%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);
|
||||
strncpy(parameters->outfile, outfilename, sizeof(outfilename));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||
/* parse the command line */
|
||||
int totlen, c;
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
};
|
||||
const char optlist[] = "i:o:h";
|
||||
|
||||
OPJ_ARG_NOT_USED(indexfilename);
|
||||
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
do {
|
||||
c = opj_getopt_long(argc, argv,optlist,long_option,totlen);
|
||||
if (c == -1)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'i': /* input file */
|
||||
{
|
||||
char *infile = opj_optarg;
|
||||
parameters->decod_format = get_file_format(infile);
|
||||
switch(parameters->decod_format) {
|
||||
case J2K_CFMT:
|
||||
case JP2_CFMT:
|
||||
case JPT_CFMT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||
}
|
||||
break;
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
case 'o': /* output file */
|
||||
{
|
||||
char *outfile = opj_optarg;
|
||||
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||
}
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
case 'h': /* display an help description */
|
||||
decode_help_display();
|
||||
return 1;
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
||||
case 'y': /* Image Directory path */
|
||||
{
|
||||
img_fol->imgdirpath = (char*)malloc(strlen(opj_optarg) + 1);
|
||||
strcpy(img_fol->imgdirpath,opj_optarg);
|
||||
img_fol->set_imgdir=1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
}while(c != -1);
|
||||
|
||||
/* check for possible errors */
|
||||
if(img_fol->set_imgdir==1){
|
||||
if(!(parameters->infile[0]==0)){
|
||||
fprintf(stderr, "Error: options -ImgDir and -i cannot be used together !!\n");
|
||||
return 1;
|
||||
}
|
||||
if(img_fol->set_out_format == 0){
|
||||
fprintf(stderr, "Error: When -ImgDir is used, -OutFor <FORMAT> must be used !!\n");
|
||||
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX, BMP, TIF, RAW and TGA!!\n");
|
||||
return 1;
|
||||
}
|
||||
if(!((parameters->outfile[0] == 0))){
|
||||
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
if((parameters->infile[0] == 0) ) {
|
||||
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
|
||||
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
sample error callback expecting a FILE* client object
|
||||
*/
|
||||
void error_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[ERROR] %s", msg);
|
||||
}
|
||||
/**
|
||||
sample warning callback expecting a FILE* client object
|
||||
*/
|
||||
void warning_callback(const char *msg, void *client_data) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[WARNING] %s", msg);
|
||||
}
|
||||
/**
|
||||
sample debug callback expecting no client object
|
||||
*/
|
||||
void info_callback(const char *msg, void *client_data) {
|
||||
(void)client_data;
|
||||
fprintf(stdout, "[INFO] %s", msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
img_fol_t img_fol;
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
opj_image_t *image = NULL;
|
||||
FILE *fsrc = NULL, *fout = NULL;
|
||||
unsigned char *src = NULL;
|
||||
int file_length;
|
||||
int num_images;
|
||||
int i,imageno;
|
||||
dircnt_t *dirptr = NULL;
|
||||
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
||||
opj_cio_t *cio = NULL;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = error_callback;
|
||||
event_mgr.warning_handler = warning_callback;
|
||||
event_mgr.info_handler = info_callback;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
/* Initialize indexfilename and img_fol */
|
||||
*indexfilename = 0;
|
||||
memset(&img_fol,0,sizeof(img_fol_t));
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol, indexfilename) == 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Initialize reading of directory */
|
||||
if(img_fol.set_imgdir==1){
|
||||
num_images=get_num_images(img_fol.imgdirpath);
|
||||
|
||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||
if(dirptr){
|
||||
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
|
||||
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename_buf){
|
||||
return 1;
|
||||
}
|
||||
for(i=0;i<num_images;i++){
|
||||
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
|
||||
}
|
||||
}
|
||||
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||
return 1;
|
||||
}
|
||||
if (num_images==0){
|
||||
fprintf(stdout,"Folder is empty\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
num_images=1;
|
||||
}
|
||||
|
||||
/* */
|
||||
if (parameters.outfile[0] != 0)
|
||||
{
|
||||
fout = fopen(parameters.outfile,"w");
|
||||
if (!fout)
|
||||
{
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.outfile);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
fout = stdout;
|
||||
|
||||
/*Encoding image one by one*/
|
||||
for(imageno = 0; imageno < num_images ; imageno++)
|
||||
{
|
||||
image = NULL;
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
if(img_fol.set_imgdir==1){
|
||||
if (get_next_file(imageno, dirptr,&img_fol, ¶meters)) {
|
||||
fprintf(stderr,"skipping file...\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* read the input file and put it in memory */
|
||||
/* ---------------------------------------- */
|
||||
fsrc = fopen(parameters.infile, "rb");
|
||||
if (!fsrc) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||
return 1;
|
||||
}
|
||||
fseek(fsrc, 0, SEEK_END);
|
||||
file_length = ftell(fsrc);
|
||||
fseek(fsrc, 0, SEEK_SET);
|
||||
src = (unsigned char *) malloc(file_length);
|
||||
if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
|
||||
{
|
||||
free(src);
|
||||
fclose(fsrc);
|
||||
fclose(fout);
|
||||
fprintf(stderr, "\nERROR: fread return a number of element different from the expected.\n");
|
||||
return 1;
|
||||
}
|
||||
fclose(fsrc);
|
||||
|
||||
/* decode the code-stream */
|
||||
/* ---------------------- */
|
||||
|
||||
switch(parameters.decod_format) {
|
||||
case J2K_CFMT:
|
||||
{
|
||||
/* JPEG-2000 codestream */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_J2K);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) /* If need to extract codestream information*/
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
fclose(fout);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
/* dump image */
|
||||
j2k_dump_image(fout, image);
|
||||
|
||||
/* dump cp */
|
||||
j2k_dump_cp(fout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
opj_bool bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JP2_CFMT:
|
||||
{
|
||||
/* JPEG 2000 compressed image data */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JP2);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using the current image and user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) /* If need to extract codestream information*/
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
fclose(fout);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
/* dump image */
|
||||
if(image->icc_profile_buf)
|
||||
{
|
||||
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
||||
}
|
||||
j2k_dump_image(fout, image);
|
||||
|
||||
/* dump cp */
|
||||
j2k_dump_cp(fout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
opj_bool bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JPT_CFMT:
|
||||
{
|
||||
/* JPEG 2000, JPIP */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JPT);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) /* If need to extract codestream information*/
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
fclose(fout);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
opj_bool bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "skipping file..\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* free the memory containing the code-stream */
|
||||
free(src);
|
||||
src = NULL;
|
||||
|
||||
/* free remaining structures */
|
||||
if(dinfo) {
|
||||
opj_destroy_decompress(dinfo);
|
||||
}
|
||||
/* free codestream information structure */
|
||||
if (*indexfilename)
|
||||
opj_destroy_cstr_info(&cstr_info);
|
||||
/* free image data structure */
|
||||
opj_image_destroy(image);
|
||||
|
||||
}
|
||||
|
||||
fclose(fout);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static void j2k_dump_image(FILE *fd, opj_image_t * img) {
|
||||
int compno;
|
||||
fprintf(fd, "image {\n");
|
||||
fprintf(fd, " x0=%d, y0=%d, x1=%d, y1=%d\n", img->x0, img->y0, img->x1, img->y1);
|
||||
fprintf(fd, " numcomps=%d\n", img->numcomps);
|
||||
for (compno = 0; compno < img->numcomps; compno++) {
|
||||
opj_image_comp_t *comp = &img->comps[compno];
|
||||
fprintf(fd, " comp %d {\n", compno);
|
||||
fprintf(fd, " dx=%d, dy=%d\n", comp->dx, comp->dy);
|
||||
fprintf(fd, " prec=%d\n", comp->prec);
|
||||
/*fprintf(fd, " bpp=%d\n", comp->bpp);*/
|
||||
fprintf(fd, " sgnd=%d\n", comp->sgnd);
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
}
|
||||
|
||||
static void j2k_dump_cp(FILE *fd, opj_image_t * img, opj_cp_t * cp) {
|
||||
int tileno, compno, layno, bandno, resno, numbands;
|
||||
fprintf(fd, "coding parameters {\n");
|
||||
fprintf(fd, " tx0=%d, ty0=%d\n", cp->tx0, cp->ty0);
|
||||
fprintf(fd, " tdx=%d, tdy=%d\n", cp->tdx, cp->tdy);
|
||||
fprintf(fd, " tw=%d, th=%d\n", cp->tw, cp->th);
|
||||
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
|
||||
opj_tcp_t *tcp = &cp->tcps[tileno];
|
||||
fprintf(fd, " tile %d {\n", tileno);
|
||||
fprintf(fd, " csty=%x\n", tcp->csty);
|
||||
fprintf(fd, " prg=%d\n", tcp->prg);
|
||||
fprintf(fd, " numlayers=%d\n", tcp->numlayers);
|
||||
fprintf(fd, " mct=%d\n", tcp->mct);
|
||||
fprintf(fd, " rates=");
|
||||
for (layno = 0; layno < tcp->numlayers; layno++) {
|
||||
fprintf(fd, "%.1f ", tcp->rates[layno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
for (compno = 0; compno < img->numcomps; compno++) {
|
||||
opj_tccp_t *tccp = &tcp->tccps[compno];
|
||||
fprintf(fd, " comp %d {\n", compno);
|
||||
fprintf(fd, " csty=%x\n", tccp->csty);
|
||||
fprintf(fd, " numresolutions=%d\n", tccp->numresolutions);
|
||||
fprintf(fd, " cblkw=%d\n", tccp->cblkw);
|
||||
fprintf(fd, " cblkh=%d\n", tccp->cblkh);
|
||||
fprintf(fd, " cblksty=%x\n", tccp->cblksty);
|
||||
fprintf(fd, " qmfbid=%d\n", tccp->qmfbid);
|
||||
fprintf(fd, " qntsty=%d\n", tccp->qntsty);
|
||||
fprintf(fd, " numgbits=%d\n", tccp->numgbits);
|
||||
fprintf(fd, " roishift=%d\n", tccp->roishift);
|
||||
fprintf(fd, " stepsizes=");
|
||||
numbands = tccp->qntsty == J2K_CCP_QNTSTY_SIQNT ? 1 : tccp->numresolutions * 3 - 2;
|
||||
for (bandno = 0; bandno < numbands; bandno++) {
|
||||
fprintf(fd, "(%d,%d) ", tccp->stepsizes[bandno].mant,
|
||||
tccp->stepsizes[bandno].expn);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
|
||||
if (tccp->csty & J2K_CCP_CSTY_PRT) {
|
||||
fprintf(fd, " prcw=");
|
||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
||||
fprintf(fd, "%d ", tccp->prcw[resno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
fprintf(fd, " prch=");
|
||||
for (resno = 0; resno < tccp->numresolutions; resno++) {
|
||||
fprintf(fd, "%d ", tccp->prch[resno]);
|
||||
}
|
||||
fprintf(fd, "\n");
|
||||
}
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, " }\n");
|
||||
}
|
||||
fprintf(fd, "}\n");
|
||||
}
|
||||
|
||||
@@ -45,13 +45,8 @@
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPJ_USE_LEGACY
|
||||
#define OPJ_CLRSPC_GRAY CLRSPC_GRAY
|
||||
#define OPJ_CLRSPC_SRGB CLRSPC_SRGB
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------------
|
||||
Matrix for sYCC, Amendment 1 to IEC 61966-2-1
|
||||
Matrix für sYCC, Amendment 1 to IEC 61966-2-1
|
||||
|
||||
Y : 0.299 0.587 0.114 :R
|
||||
Cb: -0.1687 -0.3312 0.5 :G
|
||||
@@ -222,7 +217,7 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
{
|
||||
if(img->numcomps < 3)
|
||||
{
|
||||
img->color_space = OPJ_CLRSPC_GRAY;
|
||||
img->color_space = CLRSPC_GRAY;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -261,7 +256,7 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
__FILE__,__LINE__);
|
||||
return;
|
||||
}
|
||||
img->color_space = OPJ_CLRSPC_SRGB;
|
||||
img->color_space = CLRSPC_SRGB;
|
||||
|
||||
}/* color_sycc_to_rgb() */
|
||||
|
||||
@@ -311,7 +306,7 @@ void color_apply_icc_profile(opj_image_t *image)
|
||||
in_type = TYPE_RGB_16;
|
||||
out_type = TYPE_RGB_16;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
image->color_space = OPJ_CLRSPC_SRGB;
|
||||
image->color_space = CLRSPC_SRGB;
|
||||
}
|
||||
else
|
||||
if(out_space == cmsSigGrayData) /* enumCS 17 */
|
||||
@@ -319,7 +314,7 @@ void color_apply_icc_profile(opj_image_t *image)
|
||||
in_type = TYPE_GRAY_8;
|
||||
out_type = TYPE_RGB_8;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
image->color_space = OPJ_CLRSPC_SRGB;
|
||||
image->color_space = CLRSPC_SRGB;
|
||||
}
|
||||
else
|
||||
if(out_space == cmsSigYCbCrData) /* enumCS 18 */
|
||||
@@ -327,7 +322,7 @@ void color_apply_icc_profile(opj_image_t *image)
|
||||
in_type = TYPE_YCbCr_16;
|
||||
out_type = TYPE_RGB_16;
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
image->color_space = OPJ_CLRSPC_SRGB;
|
||||
image->color_space = CLRSPC_SRGB;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -44,6 +44,5 @@
|
||||
#define RAW_DFMT 15
|
||||
#define TGA_DFMT 16
|
||||
#define PNG_DFMT 17
|
||||
#define RAWL_DFMT 18
|
||||
|
||||
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
||||
120
applications/jpip/CHANGES
Normal file
@@ -0,0 +1,120 @@
|
||||
What's New for OpenJPIP
|
||||
|
||||
* : fixed
|
||||
- : removed
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
January 26, 2011
|
||||
! [kaori] unapplied auxtrans_manager to the local mode
|
||||
|
||||
December 24, 2011
|
||||
* [kaori] additional modification for the warning
|
||||
|
||||
December 22, 2011
|
||||
* [kaori] fixed auxtrans_manager to enable MAC
|
||||
* [kaori] warnings due to disregarding return value are removed
|
||||
|
||||
November 30, 2011
|
||||
+ [kaori] TCP return (http-tcp) implemented
|
||||
|
||||
November 16, 2011
|
||||
* [kaori] fixed Region of Interest option, and memory leak of opj_dec_server
|
||||
+ [kaori] new feature to target JP2 files from www (libcurl required)
|
||||
* [kaori] fixed opj_server execusion error (instant terminating) with autotool, cmake still need to be fixed
|
||||
|
||||
November 8, 2011
|
||||
! [kaori] updated main page of doxygen
|
||||
|
||||
November 3, 2011
|
||||
* [kaori] solved memory leak of opj_server
|
||||
! [kaori] removed redundant defines
|
||||
|
||||
November 2, 2011
|
||||
* [antonin] additional patches for autotools and cmake
|
||||
|
||||
October 26, 2011
|
||||
* [kaori] additional patches for autotool are applied
|
||||
|
||||
October 25, 2011
|
||||
* [kaori] patches for cmake and autotool are applied
|
||||
* [kaori] fixed client viewer to be compatible with server response header both Content-type and Content-Type
|
||||
|
||||
October 20, 2011
|
||||
+ [added] API style in openJPIP library
|
||||
! [kaori] rearranged directories, applications are all under util/ directory, currently only 'make -f Makefile.nix' works
|
||||
|
||||
October 18, 2011
|
||||
! [kaori] rearranged opj_server, opj_dec_server directory
|
||||
|
||||
October 14, 2011
|
||||
+ [kaori] enable all progression orders
|
||||
|
||||
October 12, 2011
|
||||
+ [kaori] enable layers requests; restricting the number of codesream quality layers
|
||||
|
||||
October 11, 2011
|
||||
+ [antonin] enable JPT-stream request from client viewer option (credit to kaori)
|
||||
|
||||
October 10, 2011
|
||||
- [antonin] removed obsolete indexer utility (credit to kaori)
|
||||
+ [antonin] enabled JPP-stream (credit to kaori)
|
||||
|
||||
September 16, 2011
|
||||
+ [kaori] enabled stateless requests from the opj_viewers
|
||||
|
||||
Septempber 1, 2011
|
||||
* [kaori] changed terminating status of opj_server in debug/non-server mode
|
||||
|
||||
August 27, 2011
|
||||
* [antonin] fixed missing include directory in opj_client/opj_dec_server/CMakeLists.txt
|
||||
|
||||
August 26, 2011
|
||||
* [antonin] fixed cmake and autotools files to reflect recent indexer changes in JPIP
|
||||
! [kaori] indexer using the latest openjpeg library
|
||||
* [antonin] fixed cmake and autotools files to reflect recent changes in JPIP
|
||||
! [kaori] fixed Makefile.nix to load openjpeg library from this archive
|
||||
|
||||
August 25, 2011
|
||||
+ [kaori] added tid request support to JPIP client
|
||||
+ [kaori] added quit JPIP server request
|
||||
|
||||
August 24, 2011
|
||||
+ [kaori] added cachemodel_manager, which had been managed in target_manager previously
|
||||
+ [kaori] added tid request support to JPIP server
|
||||
|
||||
August 16, 2011
|
||||
* [antonin] fixed cmake support for openjpip
|
||||
|
||||
August 12, 2011
|
||||
+ [antonin] added cmake support to openjpip
|
||||
|
||||
July 6, 2011
|
||||
* [antonin] JPIP : fixed autotools to work with recent name changes
|
||||
|
||||
July 5, 2011
|
||||
! [kaori] changed parameter, file names, message names regarding JPT-stream to JPIP-stream, which handles also JPP-stream
|
||||
|
||||
May 26, 2011
|
||||
! [antonin] changed Makefile to Makefile.nix to avoid having autotools overwrite them.
|
||||
|
||||
May 23, 2011
|
||||
+ [antonin] added autotools for the 'tools' directory
|
||||
+ [antonin] added autotools as a build method for jpip (credit to Vincent Torri)
|
||||
|
||||
May 10, 2011
|
||||
! [kaori] opj_viewer removed the xml functions (for users without Xersus2)
|
||||
+ [kaori] renamed opj_viewer to opj_viewer_xerces ( needs Xersus2)
|
||||
! [kaori] Modification of opj_dec_server to be portable to windows
|
||||
|
||||
May 9, 2011
|
||||
* [kaori] Removal of c99 from the compile option (to be compatible to win platform) and bool definition in libopenjpip/bool.h
|
||||
|
||||
May 9, 2011
|
||||
* [antonin] OpenJPIP: small bug fixes to compile on win platform
|
||||
|
||||
May 8, 2011
|
||||
* [antonin] OpenJPIP: fixed several bugs in opj_server (removal of strsep function, duplication of query string) + some changes to compile opj_server under windows (replacement of strcasecmp(), bzero()).
|
||||
|
||||
April 14, 2011
|
||||
+ [antonin] initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details)
|
||||
13
applications/jpip/CMakeLists.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
# required dep for server:
|
||||
IF(BUILD_JPIP_SERVER)
|
||||
FIND_PACKAGE(CURL REQUIRED)
|
||||
FIND_PACKAGE(FCGI REQUIRED)
|
||||
FIND_PACKAGE(PTHREAD REQUIRED)
|
||||
ENDIF(BUILD_JPIP_SERVER)
|
||||
|
||||
# JPIP library:
|
||||
ADD_SUBDIRECTORY(libopenjpip)
|
||||
|
||||
# JPIP binaries:
|
||||
ADD_SUBDIRECTORY(util)
|
||||
|
||||
3
applications/jpip/Makefile.am
Normal file
@@ -0,0 +1,3 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = libopenjpip util
|
||||
@@ -96,7 +96,7 @@ Server:
|
||||
|
||||
Client:
|
||||
1. Launch image decoding server, and keep it alive as long as image viewers are open
|
||||
% ./opj_dec_server [portnumber (50000 by default)]
|
||||
% ./opj_dec_server
|
||||
|
||||
You might prefer to implement this program from another directory since cache files are saved in the working directory.
|
||||
% mkdir cache
|
||||
@@ -104,12 +104,10 @@ Client:
|
||||
% ../opj_dec_server
|
||||
|
||||
2. Open image viewers (as many as needed)
|
||||
% java -jar opj_viewer.jar http://hostname/myFCGI path/filename.jp2 [hostname] [portnumber] [stateless/session] [jptstream/jppstream] [tcp/udp]
|
||||
% java -jar opj_viewer.jar http://hostname/myFCGI path/filename.jp2 [stateless/session] [jptstream/jppstream] [tcp/udp]
|
||||
( The arguments
|
||||
- http://hostname/myFCGI is the HTTP server URI (myFCGI refers to opj_server by the server setting)
|
||||
- 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
|
||||
@@ -133,7 +131,7 @@ An example to encode a TIF image "copenhague1.tif" at resolution 4780x4050, 8bit
|
||||
% ./image_to_j2k -i copenhague1.tif -o copenhague1.jp2 -p RPCL -c [64,64] -t 640,480 -jpip -TP R
|
||||
|
||||
options
|
||||
-jpip : embed index table 'cidx' box into the output JP2 file (obligation for JPIP)
|
||||
-jpip : embed index table 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)
|
||||
|
||||
<Option>
|
||||
1514
applications/jpip/doc/Doxyfile
Normal file
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
@@ -1,17 +1,14 @@
|
||||
include_regular_expression("^.*$")
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||
|
||||
add_definitions(-DUSE_JPIP)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
|
||||
INCLUDE_DIRECTORIES(
|
||||
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||
${FCGI_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${PTHREAD_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# Defines the source code for the library
|
||||
set(OPENJPIP_SRCS
|
||||
SET(OPENJPIP_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/boxheader_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/codestream_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imgreg_manager.c
|
||||
@@ -38,11 +35,11 @@ set(OPENJPIP_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sock_manager.c
|
||||
)
|
||||
|
||||
set(SERVER_SRCS
|
||||
SET(SERVER_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/auxtrans_manager.c
|
||||
)
|
||||
|
||||
set(LOCAL_SRCS
|
||||
SET(LOCAL_SRCS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
|
||||
@@ -51,37 +48,26 @@ set(LOCAL_SRCS
|
||||
)
|
||||
|
||||
# Build the library
|
||||
if(WIN32)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_definitions(-DOPJ_EXPORTS)
|
||||
else()
|
||||
add_definitions(-DOPJ_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
add_library(openjpip ${OPENJPIP_SRCS} ${LOCAL_SRCS})
|
||||
set_target_properties(openjpip
|
||||
PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
|
||||
target_link_libraries(openjpip ${OPENJPEG_LIBRARY_NAME})
|
||||
if(WIN32)
|
||||
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
|
||||
TARGET_LINK_LIBRARIES(openjpip_local ${OPENJPEG_LIBRARY_NAME})
|
||||
IF(WIN32)
|
||||
# add Winsock on windows+mingw
|
||||
target_link_libraries(openjpip ws2_32)
|
||||
endif()
|
||||
TARGET_LINK_LIBRARIES(openjpip_local ws2_32)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Install library
|
||||
install(TARGETS openjpip
|
||||
INSTALL(TARGETS openjpip_local
|
||||
EXPORT OpenJPEGTargets
|
||||
RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
|
||||
LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||
ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||
)
|
||||
|
||||
if(BUILD_JPIP_SERVER)
|
||||
add_library(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
|
||||
target_link_libraries(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
set_target_properties(openjpip_server
|
||||
IF(BUILD_JPIP_SERVER)
|
||||
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS} ${SERVER_SRCS})
|
||||
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBRARIES} ${CURL_LIBRARIES} ${PTHREAD_LIBRARIES})
|
||||
SET_TARGET_PROPERTIES(openjpip_server
|
||||
PROPERTIES COMPILE_FLAGS "-DSERVER")
|
||||
install(TARGETS openjpip_server
|
||||
INSTALL(TARGETS openjpip_server
|
||||
EXPORT OpenJPEGTargets
|
||||
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
|
||||
)
|
||||
endif()
|
||||
ENDIF(BUILD_JPIP_SERVER)
|
||||
151
applications/jpip/libopenjpip/Makefile.am
Normal file
@@ -0,0 +1,151 @@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
includesdir = $(includedir)/openjpeg-$(MAJOR_NR).$(MINOR_NR)
|
||||
includes_HEADERS =
|
||||
|
||||
lib_LTLIBRARIES =
|
||||
|
||||
if WANT_JPIP
|
||||
lib_LTLIBRARIES += libopenjpip_local.la
|
||||
endif
|
||||
|
||||
if WANT_JPIP_SERVER
|
||||
lib_LTLIBRARIES += libopenjpip_server.la
|
||||
endif
|
||||
|
||||
JPIP_SRC = \
|
||||
openjpip.c \
|
||||
query_parser.c \
|
||||
channel_manager.c \
|
||||
session_manager.c \
|
||||
jpip_parser.c \
|
||||
boxheader_manager.c \
|
||||
codestream_manager.c \
|
||||
imgreg_manager.c \
|
||||
marker_manager.c \
|
||||
msgqueue_manager.c \
|
||||
box_manager.c \
|
||||
faixbox_manager.c \
|
||||
index_manager.c \
|
||||
metadata_manager.c \
|
||||
placeholder_manager.c \
|
||||
byte_manager.c \
|
||||
ihdrbox_manager.c \
|
||||
manfbox_manager.c \
|
||||
mhixbox_manager.c \
|
||||
target_manager.c \
|
||||
cachemodel_manager.c \
|
||||
j2kheader_manager.c \
|
||||
jp2k_encoder.c \
|
||||
sock_manager.c \
|
||||
openjpip.h \
|
||||
bool.h \
|
||||
boxheader_manager.h \
|
||||
box_manager.h \
|
||||
byte_manager.h \
|
||||
codestream_manager.h \
|
||||
faixbox_manager.h \
|
||||
ihdrbox_manager.h \
|
||||
imgreg_manager.h \
|
||||
index_manager.h \
|
||||
manfbox_manager.h \
|
||||
marker_manager.h \
|
||||
metadata_manager.h \
|
||||
mhixbox_manager.h \
|
||||
msgqueue_manager.h \
|
||||
placeholder_manager.h \
|
||||
target_manager.h \
|
||||
cachemodel_manager.h \
|
||||
j2kheader_manager.h \
|
||||
jp2k_encoder.h \
|
||||
query_parser.h \
|
||||
channel_manager.h \
|
||||
session_manager.h \
|
||||
jpip_parser.h \
|
||||
jp2k_decoder.h \
|
||||
sock_manager.h
|
||||
|
||||
SERVER_SRC = auxtrans_manager.c \
|
||||
auxtrans_manager.h
|
||||
|
||||
LOCAL_SRC = jp2k_decoder.c \
|
||||
imgsock_manager.c \
|
||||
jpipstream_manager.c \
|
||||
cache_manager.c \
|
||||
dec_clientmsg_handler.c \
|
||||
imgsock_manager.h \
|
||||
jpipstream_manager.h \
|
||||
cache_manager.h \
|
||||
dec_clientmsg_handler.h
|
||||
|
||||
libopenjpip_server_la_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||
@FCGI_CFLAGS@ \
|
||||
@LIBCURL_CFLAGS@ \
|
||||
-DSERVER
|
||||
libopenjpip_server_la_CFLAGS = @THREAD_CFLAGS@
|
||||
libopenjpip_server_la_LIBADD = @FCGI_LIBS@ @LIBCURL_LIBS@ @THREAD_LIBS@ -lm
|
||||
libopenjpip_server_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
||||
libopenjpip_server_la_SOURCES = $(JPIP_SRC) $(SERVER_SRC)
|
||||
|
||||
libopenjpip_local_la_CPPFLAGS = \
|
||||
-I. \
|
||||
-I$(top_srcdir)/libopenjpeg \
|
||||
-I$(top_builddir)/libopenjpeg \
|
||||
-I$(top_srcdir)/applications/jpip/libopenjpip \
|
||||
-I$(top_builddir)/applications/jpip/libopenjpip \
|
||||
@LIBCURL_CFLAGS@
|
||||
libopenjpip_local_la_CFLAGS =
|
||||
libopenjpip_local_la_LIBADD = $(top_builddir)/libopenjpeg/libopenjpeg.la -lm
|
||||
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
|
||||
libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC)
|
||||
|
||||
install-data-hook:
|
||||
if WANT_JPIP_SERVER
|
||||
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt
|
||||
if BUILD_SHARED
|
||||
@( $(call solist_s) ) >> $(top_builddir)/report.txt
|
||||
endif
|
||||
if BUILD_STATIC
|
||||
@echo -e " (A)\t$(base_s)/$(a_s)" >> $(top_builddir)/report.txt
|
||||
endif
|
||||
endif
|
||||
if WANT_JPIP
|
||||
@echo -e " (LA)\t$(libdir)/libopenjpip_local.la" >> $(top_builddir)/report.txt
|
||||
if BUILD_SHARED
|
||||
@( $(call solist_c) ) >> $(top_builddir)/report.txt
|
||||
endif
|
||||
if BUILD_STATIC
|
||||
@echo -e " (A)\t$(base_c)/$(a_c)" >> $(top_builddir)/report.txt
|
||||
endif
|
||||
endif
|
||||
|
||||
solist_s = $(foreach f, $(dll_s) $(so_s), echo -e ' $(SO_PREFIX)\t$(base_s)/$(f)' ;)
|
||||
get_tok_s = $(shell grep -E "^$(1)=" libopenjpip_server.la | cut -d "'" -f 2)
|
||||
base_s = $(call get_tok_s,libdir)
|
||||
so_s = $(call get_tok_s,library_names)
|
||||
a_s = $(call get_tok_s,old_library)
|
||||
|
||||
solist_c = $(foreach f, $(dll_c) $(so_c), echo -e ' $(SO_PREFIX)\t$(base_c)/$(f)' ;)
|
||||
get_tok_c = $(shell grep -E "^$(1)=" libopenjpip_local.la | cut -d "'" -f 2)
|
||||
base_c = $(call get_tok_c,libdir)
|
||||
so_c = $(call get_tok_c,library_names)
|
||||
a_c = $(call get_tok_c,old_library)
|
||||
|
||||
if HAVE_WIN32
|
||||
SO_PREFIX = (DLL)
|
||||
dll_s = $(call get_tok_s,dlname)
|
||||
dll_c = $(call get_tok_c,dlname)
|
||||
else
|
||||
if HAVE_DARWIN
|
||||
SO_PREFIX = (DY)
|
||||
dll_s =
|
||||
dll_c =
|
||||
else
|
||||
SO_PREFIX = (SO)
|
||||
dll_s =
|
||||
dll_c =
|
||||
endif
|
||||
endif
|
||||
@@ -46,7 +46,7 @@
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif /*SERVER */
|
||||
#endif //SERVER
|
||||
|
||||
auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport)
|
||||
{
|
||||
@@ -56,12 +56,12 @@ auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport)
|
||||
auxtrans.udpauxport = udp_auxport;
|
||||
|
||||
if( 49152 <= tcp_auxport && tcp_auxport <= 65535)
|
||||
auxtrans.tcplistensock = open_listeningsocket( (uint16_t)tcp_auxport);
|
||||
auxtrans.tcplistensock = open_listeningsocket( tcp_auxport);
|
||||
else
|
||||
auxtrans.tcplistensock = -1;
|
||||
|
||||
auxtrans.udplistensock = -1;
|
||||
/* open listening socket for udp later */
|
||||
// open listening socket for udp later
|
||||
|
||||
return auxtrans;
|
||||
}
|
||||
@@ -78,19 +78,19 @@ void close_aux_transport( auxtrans_param_t auxtrans)
|
||||
}
|
||||
|
||||
|
||||
/*!< auxiliary response parameters */
|
||||
//!< auxiliary response parameters
|
||||
typedef struct aux_response_param{
|
||||
char *cid; /*!< channel ID */
|
||||
unsigned char *data; /*!< sending data */
|
||||
OPJ_SIZE_T datalen; /*!< length of data */
|
||||
OPJ_SIZE_T maxlenPerFrame; /*!< maximum data length to send per frame */
|
||||
SOCKET listensock; /*!< listeing socket */
|
||||
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 */
|
||||
HANDLE hTh; //!< thread handle
|
||||
#endif
|
||||
} aux_response_param_t;
|
||||
|
||||
aux_response_param_t * gene_auxresponse( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
|
||||
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame);
|
||||
|
||||
void delete_auxresponse( aux_response_param_t **auxresponse);
|
||||
|
||||
@@ -101,7 +101,7 @@ unsigned __stdcall aux_streaming( void *arg);
|
||||
void * aux_streaming( void *arg);
|
||||
#endif
|
||||
|
||||
void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
|
||||
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame)
|
||||
{
|
||||
aux_response_param_t *auxresponse;
|
||||
#ifdef _WIN32
|
||||
@@ -133,11 +133,11 @@ void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const
|
||||
fprintf( FCGI_stderr, "Error: error in send_responsedata_on_aux(), udp not implemented\n");
|
||||
}
|
||||
|
||||
aux_response_param_t * gene_auxresponse( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
|
||||
aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int datalen, int maxlenPerFrame)
|
||||
{
|
||||
aux_response_param_t *auxresponse;
|
||||
|
||||
auxresponse = (aux_response_param_t *)opj_malloc( sizeof(aux_response_param_t));
|
||||
auxresponse = (aux_response_param_t *)malloc( sizeof(aux_response_param_t));
|
||||
|
||||
auxresponse->cid = strdup( cid);
|
||||
auxresponse->data = data;
|
||||
@@ -150,9 +150,9 @@ aux_response_param_t * gene_auxresponse( OPJ_BOOL istcp, auxtrans_param_t auxtra
|
||||
|
||||
void delete_auxresponse( aux_response_param_t **auxresponse)
|
||||
{
|
||||
opj_free( (*auxresponse)->cid);
|
||||
opj_free( (*auxresponse)->data);
|
||||
opj_free( *auxresponse);
|
||||
free( (*auxresponse)->cid);
|
||||
free( (*auxresponse)->data);
|
||||
free( *auxresponse);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,9 +163,9 @@ void delete_auxresponse( aux_response_param_t **auxresponse)
|
||||
* @param [in] fp file pointer for log of aux stream
|
||||
* @return true if identified, false otherwise
|
||||
*/
|
||||
OPJ_BOOL identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
|
||||
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
|
||||
|
||||
OPJ_BOOL recv_ack( SOCKET connected_socket, void *data);
|
||||
bool recv_ack( SOCKET connected_socket, void *data);
|
||||
|
||||
#ifdef _WIN32
|
||||
unsigned __stdcall aux_streaming( void *arg)
|
||||
@@ -175,8 +175,8 @@ void * aux_streaming( void *arg)
|
||||
{
|
||||
SOCKET connected_socket;
|
||||
unsigned char *chunk, *ptr;
|
||||
OPJ_SIZE_T maxLenOfBody, remlen, chunklen;
|
||||
const OPJ_SIZE_T headlen = 8;
|
||||
int maxLenOfBody, remlen, chunklen;
|
||||
const int headlen = 8;
|
||||
|
||||
aux_response_param_t *auxresponse = (aux_response_param_t *)arg;
|
||||
|
||||
@@ -186,7 +186,7 @@ void * aux_streaming( void *arg)
|
||||
pthread_detach( pthread_self());
|
||||
#endif
|
||||
|
||||
chunk = (unsigned char *)opj_malloc( auxresponse->maxlenPerFrame);
|
||||
chunk = (unsigned char *)malloc( auxresponse->maxlenPerFrame);
|
||||
maxLenOfBody = auxresponse->maxlenPerFrame - headlen;
|
||||
remlen = auxresponse->datalen;
|
||||
|
||||
@@ -194,29 +194,29 @@ void * aux_streaming( void *arg)
|
||||
if( identify_cid( connected_socket, auxresponse->cid, FCGI_stderr)){
|
||||
ptr = auxresponse->data;
|
||||
while( 0 < remlen){
|
||||
memset( chunk, 0, auxresponse->maxlenPerFrame);
|
||||
memset( chunk, 0, auxresponse->maxlenPerFrame);
|
||||
|
||||
chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
|
||||
chunklen += headlen;
|
||||
chunklen = remlen<maxLenOfBody?remlen:maxLenOfBody;
|
||||
chunklen += headlen;
|
||||
|
||||
chunk[0] = (chunklen >> 8) & 0xff;
|
||||
chunk[1] = chunklen & 0xff;
|
||||
|
||||
chunk[0] = (chunklen >> 8) & 0xff;
|
||||
chunk[1] = chunklen & 0xff;
|
||||
memcpy( chunk+headlen, ptr, chunklen-headlen);
|
||||
|
||||
memcpy( chunk+headlen, ptr, chunklen-headlen);
|
||||
do{
|
||||
send_stream( connected_socket, chunk, chunklen);
|
||||
}while( !recv_ack( connected_socket, chunk));
|
||||
|
||||
do{
|
||||
send_stream( connected_socket, chunk, chunklen);
|
||||
}while( !recv_ack( connected_socket, chunk));
|
||||
|
||||
remlen -= maxLenOfBody;
|
||||
ptr += maxLenOfBody;
|
||||
remlen -= maxLenOfBody;
|
||||
ptr += maxLenOfBody;
|
||||
}
|
||||
if( close_socket( connected_socket) != 0)
|
||||
perror("close");
|
||||
perror("close");
|
||||
break;
|
||||
}
|
||||
}
|
||||
opj_free( chunk);
|
||||
free( chunk);
|
||||
|
||||
delete_auxresponse( &auxresponse);
|
||||
|
||||
@@ -230,38 +230,38 @@ void * aux_streaming( void *arg)
|
||||
}
|
||||
|
||||
|
||||
OPJ_BOOL identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
|
||||
bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
|
||||
{
|
||||
char *cid;
|
||||
OPJ_BOOL succeed;
|
||||
bool succeed;
|
||||
|
||||
if(!(cid = receive_string( connected_socket))){
|
||||
fprintf( fp, "Error: error in identify_cid(), while receiving cid from client\n");
|
||||
return OPJ_FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
succeed = OPJ_FALSE;
|
||||
succeed = false;
|
||||
if( strncmp( refcid, cid, strlen( refcid)) == 0)
|
||||
succeed = OPJ_TRUE;
|
||||
succeed = true;
|
||||
|
||||
opj_free( cid);
|
||||
free( cid);
|
||||
|
||||
return succeed;
|
||||
}
|
||||
|
||||
OPJ_BOOL recv_ack( SOCKET connected_socket, void *data)
|
||||
bool recv_ack( SOCKET connected_socket, void *data)
|
||||
{
|
||||
char *header;
|
||||
OPJ_BOOL succeed;
|
||||
bool succeed;
|
||||
|
||||
header = receive_stream( connected_socket, 8);
|
||||
|
||||
if( memcmp( header, data, 8) != 0)
|
||||
succeed = OPJ_FALSE;
|
||||
succeed = false;
|
||||
else
|
||||
succeed = OPJ_TRUE;
|
||||
succeed = true;
|
||||
|
||||
opj_free( header);
|
||||
free( header);
|
||||
|
||||
return succeed;
|
||||
}
|
||||
@@ -32,7 +32,6 @@
|
||||
# define AUXTRANS_MANAGER_H_
|
||||
|
||||
#include "sock_manager.h"
|
||||
#include "opj_includes.h"
|
||||
|
||||
/** auxiliary transport setting parameters*/
|
||||
typedef struct auxtrans_param{
|
||||
@@ -45,8 +44,8 @@ typedef struct auxtrans_param{
|
||||
/**
|
||||
* Initialize auxiliary transport server of JPIP server
|
||||
*
|
||||
* @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 49152-65535)
|
||||
* @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152-65535)
|
||||
* @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 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);
|
||||
@@ -68,6 +67,6 @@ void close_aux_transport( auxtrans_param_t auxtrans);
|
||||
* @param[in] length length of data
|
||||
* @param[in] maxlenPerFrame maximum data length to send per frame
|
||||
*/
|
||||
void send_responsedata_on_aux( OPJ_BOOL istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
|
||||
void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int length, int maxlenPerFrame);
|
||||
|
||||
#endif /* !AUXTRANS_MANAGER_H_ */
|
||||
@@ -1,5 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
* $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
|
||||
@@ -23,21 +27,26 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef OPJ_INTTYPES_H
|
||||
#define OPJ_INTTYPES_H
|
||||
|
||||
#include "opj_config.h"
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#if defined(_WIN32)
|
||||
#define PRId64 "I64d"
|
||||
#define PRIi64 "I64i"
|
||||
#define PRIu64 "I64u"
|
||||
#define PRIx64 "I64x"
|
||||
#else
|
||||
#error unsupported platform
|
||||
#endif
|
||||
#ifndef BOOL_H_
|
||||
# define BOOL_H_
|
||||
|
||||
#ifndef false
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
#endif /* OPJ_INTTYPES_H */
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef true
|
||||
#define true (!false)
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
typedef char bool;
|
||||
|
||||
#endif /* !BOOL_H_ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: box_manager.c 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -32,9 +32,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "box_manager.h"
|
||||
#include "opj_inttypes.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
@@ -45,7 +43,7 @@
|
||||
#define logstream stderr
|
||||
#endif /*SERVER*/
|
||||
|
||||
boxlist_param_t * gene_boxlist(void)
|
||||
boxlist_param_t * gene_boxlist()
|
||||
{
|
||||
boxlist_param_t *boxlist;
|
||||
|
||||
@@ -57,41 +55,38 @@ boxlist_param_t * gene_boxlist(void)
|
||||
return boxlist;
|
||||
}
|
||||
|
||||
boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
|
||||
boxlist_param_t * get_boxstructure( int fd, Byte8_t offset, Byte8_t length)
|
||||
{
|
||||
boxlist_param_t *boxlist;
|
||||
box_param_t *box;
|
||||
OPJ_OFF_T pos;
|
||||
int pos;
|
||||
|
||||
boxlist = NULL;
|
||||
pos = offset;
|
||||
assert( (OPJ_OFF_T)length>=0);
|
||||
do{
|
||||
if(!(box = gene_boxbyOffset( fd, pos)))
|
||||
break;
|
||||
|
||||
assert( (OPJ_OFF_T)box->length >= 0);
|
||||
pos += (OPJ_OFF_T)box->length;
|
||||
pos += box->length;
|
||||
|
||||
if( !boxlist)
|
||||
boxlist = gene_boxlist();
|
||||
insert_box_into_list( box, boxlist);
|
||||
}while( pos < offset+(OPJ_OFF_T)length);
|
||||
}while( pos < (int)(offset+length));
|
||||
|
||||
return boxlist;
|
||||
}
|
||||
|
||||
box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset)
|
||||
box_param_t * gene_boxbyOffset( int fd, Byte8_t offset)
|
||||
{
|
||||
Byte_t *data;
|
||||
Byte8_t boxlen;
|
||||
Byte_t headlen;
|
||||
Byte8_t boxlen, headlen;
|
||||
char *boxtype;
|
||||
box_param_t *box;
|
||||
|
||||
/* read LBox and TBox*/
|
||||
if(!(data = fetch_bytes( fd, offset, 8))){
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %" PRId64 ")\n", fd, offset);
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %lld)\n", fd, offset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -116,7 +111,7 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset)
|
||||
free(data2);
|
||||
}
|
||||
else{
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %" PRId64 ")\n", fd, offset);
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyOffset( %d, %lld)\n", fd, offset);
|
||||
free( data);
|
||||
return NULL;
|
||||
}
|
||||
@@ -132,10 +127,9 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset)
|
||||
return box;
|
||||
}
|
||||
|
||||
box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset)
|
||||
box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset)
|
||||
{
|
||||
Byte8_t boxlen;
|
||||
Byte_t headlen;
|
||||
Byte8_t boxlen, headlen;
|
||||
char *boxtype;
|
||||
box_param_t *box;
|
||||
|
||||
@@ -167,28 +161,22 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset)
|
||||
}
|
||||
|
||||
|
||||
box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
|
||||
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[])
|
||||
{
|
||||
OPJ_OFF_T pos;
|
||||
Byte8_t pos;
|
||||
Byte_t *data;
|
||||
Byte8_t boxlen;
|
||||
Byte_t headlen;
|
||||
Byte8_t boxlen, headlen;
|
||||
char *boxtype;
|
||||
box_param_t *foundbox;
|
||||
|
||||
|
||||
if( length==0){ /* set the max length*/
|
||||
if( get_filesize( fd) <= offset )
|
||||
if( (length = get_filesize( fd) - offset) <= 0)
|
||||
return NULL;
|
||||
assert( get_filesize( fd) > offset );
|
||||
assert( offset >= 0 );
|
||||
length = (OPJ_SIZE_T)(get_filesize( fd) - offset);
|
||||
}
|
||||
|
||||
pos = offset;
|
||||
assert( pos >= 0 );
|
||||
assert( (OPJ_OFF_T)length >= 0 );
|
||||
while( pos < offset+(OPJ_OFF_T)length-7){ /* LBox+TBox-1=7*/
|
||||
while( pos < offset+length-7){ /* LBox+TBox-1=7*/
|
||||
|
||||
/* read LBox and TBox*/
|
||||
if((data = fetch_bytes( fd, pos, 8))){
|
||||
@@ -205,7 +193,7 @@ box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const
|
||||
free(data2);
|
||||
}
|
||||
else{
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %" PRId64 ", %" PRId64 ", %s)\n", fd, offset, length, TBox);
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %lld, %lld, %s)\n", fd, offset, length, TBox);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -223,30 +211,32 @@ box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const
|
||||
free( data);
|
||||
}
|
||||
else{
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %" PRId64 ", %" PRId64 ", %s)\n", fd, offset, length, TBox);
|
||||
fprintf( FCGI_stderr, "Error: error in gene_boxbyType( %d, %lld, %lld, %s)\n", fd, offset, length, TBox);
|
||||
return NULL;
|
||||
}
|
||||
assert( ((Byte8_t)pos+boxlen)>=(Byte8_t)pos);
|
||||
pos+= (OPJ_OFF_T)boxlen;
|
||||
pos+= boxlen;
|
||||
}
|
||||
fprintf( FCGI_stderr, "Error: Box %s not found\n", TBox);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
|
||||
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, char TBox[])
|
||||
{
|
||||
OPJ_OFF_T pos;
|
||||
Byte8_t pos;
|
||||
Byte_t *data;
|
||||
Byte8_t boxlen;
|
||||
Byte_t headlen;
|
||||
Byte8_t boxlen, headlen;
|
||||
char *boxtype;
|
||||
box_param_t *foundbox;
|
||||
|
||||
|
||||
if( length<=0){ /* set the max length*/
|
||||
fprintf( FCGI_stderr, "func gene_boxbyTypeinStream(), max length must be more than 0\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pos = offset;
|
||||
assert( pos >= 0 );
|
||||
assert( (OPJ_OFF_T)length >= 0 );
|
||||
while( pos < offset+(OPJ_OFF_T)(length)-7){ /* LBox+TBox-1=7*/
|
||||
while( pos < offset+length-7){ /* LBox+TBox-1=7*/
|
||||
|
||||
/* read LBox and TBox*/
|
||||
data = stream + pos;
|
||||
@@ -270,39 +260,31 @@ box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE
|
||||
foundbox->next = NULL;
|
||||
return foundbox;
|
||||
}
|
||||
assert( ((Byte8_t)pos+boxlen)>=(Byte8_t)pos);
|
||||
pos+= (OPJ_OFF_T)boxlen;
|
||||
pos+= boxlen;
|
||||
}
|
||||
fprintf( FCGI_stderr, "Error: Box %s not found\n", TBox);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset)
|
||||
box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset)
|
||||
{
|
||||
return gene_boxbyOffset( superbox->fd, get_DBoxoff( superbox)+offset);
|
||||
}
|
||||
|
||||
box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, const char TBox[])
|
||||
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, char TBox[])
|
||||
{
|
||||
OPJ_SIZE_T DBOXlen = get_DBoxlen(superbox);
|
||||
assert( offset >= 0 );
|
||||
if( DBOXlen < (OPJ_SIZE_T)offset )
|
||||
{
|
||||
fprintf( FCGI_stderr, "Error: Impossible happen %lu < %ld\n", DBOXlen, offset);
|
||||
return NULL;
|
||||
}
|
||||
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, DBOXlen-(OPJ_SIZE_T)offset, TBox);
|
||||
return gene_boxbyType( superbox->fd, get_DBoxoff( superbox)+offset, get_DBoxlen( superbox)-offset, TBox);
|
||||
}
|
||||
|
||||
OPJ_OFF_T get_DBoxoff( box_param_t *box)
|
||||
Byte8_t get_DBoxoff( box_param_t *box)
|
||||
{
|
||||
return box->offset+box->headlen;
|
||||
}
|
||||
|
||||
OPJ_SIZE_T get_DBoxlen( box_param_t *box)
|
||||
Byte8_t get_DBoxlen( box_param_t *box)
|
||||
{
|
||||
return box->length - box->headlen;
|
||||
return box->length-box->headlen;
|
||||
}
|
||||
|
||||
Byte_t * fetch_headbytes( box_param_t *box)
|
||||
@@ -310,32 +292,32 @@ Byte_t * fetch_headbytes( box_param_t *box)
|
||||
return fetch_bytes( box->fd, box->offset, box->headlen);
|
||||
}
|
||||
|
||||
Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size)
|
||||
Byte_t * fetch_DBoxbytes( box_param_t *box, long offset, int size)
|
||||
{
|
||||
return fetch_bytes( box->fd, get_DBoxoff( box)+offset, size);
|
||||
}
|
||||
|
||||
Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset)
|
||||
Byte_t fetch_DBox1byte( box_param_t *box, long offset)
|
||||
{
|
||||
return fetch_1byte( box->fd, get_DBoxoff( box)+offset);
|
||||
}
|
||||
|
||||
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset)
|
||||
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, long offset)
|
||||
{
|
||||
return fetch_2bytebigendian( box->fd, get_DBoxoff( box)+offset);
|
||||
}
|
||||
|
||||
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset)
|
||||
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, long offset)
|
||||
{
|
||||
return fetch_4bytebigendian( box->fd, get_DBoxoff( box)+offset);
|
||||
}
|
||||
|
||||
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset)
|
||||
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset)
|
||||
{
|
||||
return fetch_8bytebigendian( box->fd, get_DBoxoff( box)+offset);
|
||||
}
|
||||
|
||||
box_param_t * search_box( const char type[], boxlist_param_t *boxlist)
|
||||
box_param_t * search_box( char type[], boxlist_param_t *boxlist)
|
||||
{
|
||||
box_param_t *foundbox;
|
||||
|
||||
@@ -357,10 +339,9 @@ void print_box( box_param_t *box)
|
||||
{
|
||||
fprintf( logstream, "box info:\n"
|
||||
"\t type: %.4s\n"
|
||||
"\t offset: %" PRId64 " %#" PRIx64 "\n"
|
||||
"\t offset: %lld %#llx\n"
|
||||
"\t header length: %d\n"
|
||||
"\t length: %" PRId64 " %#" PRIx64 "\n", box->type, box->offset,
|
||||
box->offset, box->headlen, box->length, box->length);
|
||||
"\t length: %lld %#llx\n", box->type, box->offset, box->offset, box->headlen, box->length, box->length);
|
||||
}
|
||||
|
||||
void print_allbox( boxlist_param_t *boxlist)
|
||||
@@ -400,7 +381,7 @@ void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist)
|
||||
free( *box);
|
||||
}
|
||||
|
||||
void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist)
|
||||
void delete_box_in_list_by_type( char type[], boxlist_param_t *boxlist)
|
||||
{
|
||||
box_param_t *box;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: box_manager.h 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -36,7 +36,7 @@
|
||||
/** box parameters*/
|
||||
typedef struct box_param{
|
||||
int fd; /**< file descriptor*/
|
||||
OPJ_OFF_T offset; /**< byte position of the whole Box (LBox) in the file*/
|
||||
Byte8_t offset; /**< byte position of the whole Box (LBox) in the file*/
|
||||
Byte_t headlen; /**< header length 8 or 16*/
|
||||
Byte8_t length; /**< length of the whole Box*/
|
||||
char type[4]; /**< type of information in the DBox*/
|
||||
@@ -56,7 +56,7 @@ typedef struct boxlist_param{
|
||||
*
|
||||
* @return pointer to the generated box list
|
||||
*/
|
||||
boxlist_param_t * gene_boxlist(void);
|
||||
boxlist_param_t * gene_boxlist();
|
||||
|
||||
/**
|
||||
* get box structure of JP2 file
|
||||
@@ -66,7 +66,7 @@ boxlist_param_t * gene_boxlist(void);
|
||||
* @param[in] length length of the decomposing region
|
||||
* @return pointer to the generated boxlist
|
||||
*/
|
||||
boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
|
||||
boxlist_param_t * get_boxstructure( int fd, Byte8_t offset, Byte8_t length);
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
|
||||
* @param[in] offset Box offset
|
||||
* @return pointer to the structure of generate box parameters
|
||||
*/
|
||||
box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
|
||||
box_param_t * gene_boxbyOffset( int fd, Byte8_t offset);
|
||||
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
|
||||
* @param[in] offset Box offset of the whole stream
|
||||
* @return pointer to the structure of generate box parameters
|
||||
*/
|
||||
box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset);
|
||||
box_param_t * gene_boxbyOffinStream( Byte_t *stream, Byte8_t offset);
|
||||
|
||||
/**
|
||||
* generate(search) box from JP2 file
|
||||
@@ -97,7 +97,7 @@ box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset);
|
||||
* @param[in] TBox Box Type
|
||||
* @return pointer to the structure of generate/found box parameters
|
||||
*/
|
||||
box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
|
||||
box_param_t * gene_boxbyType( int fd, Byte8_t offset, Byte8_t length, char TBox[]);
|
||||
|
||||
/**
|
||||
* generate(search) box from code stream
|
||||
@@ -108,7 +108,7 @@ box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const
|
||||
* @param[in] TBox Box Type
|
||||
* @return pointer to the structure of generate/found box parameters
|
||||
*/
|
||||
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
|
||||
box_param_t * gene_boxbyTypeinStream( Byte_t *stream, Byte8_t offset, Byte8_t length, char TBox[]);
|
||||
|
||||
/**
|
||||
* generate child box from JP2 file at the given offset
|
||||
@@ -117,7 +117,7 @@ box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE
|
||||
* @param[in] offset offset from DBox first byte of superbox
|
||||
* @return pointer to the structure of generate box parameters
|
||||
*/
|
||||
box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
|
||||
box_param_t * gene_childboxbyOffset( box_param_t *superbox, Byte8_t offset);
|
||||
|
||||
/**
|
||||
* generate(search) box from JP2 file
|
||||
@@ -127,7 +127,7 @@ box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
|
||||
* @param[in] TBox Box Type
|
||||
* @return pointer to the structure of generate/found box parameters
|
||||
*/
|
||||
box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, const char TBox[]);
|
||||
box_param_t * gene_childboxbyType( box_param_t *superbox, Byte8_t offset, char TBox[]);
|
||||
|
||||
/**
|
||||
* get DBox offset
|
||||
@@ -135,7 +135,7 @@ box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, cons
|
||||
* @param[in] box box pointer
|
||||
* @return DBox offset (byte position) in the file
|
||||
*/
|
||||
OPJ_OFF_T get_DBoxoff( box_param_t *box);
|
||||
Byte8_t get_DBoxoff( box_param_t *box);
|
||||
|
||||
|
||||
/**
|
||||
@@ -144,7 +144,7 @@ OPJ_OFF_T get_DBoxoff( box_param_t *box);
|
||||
* @param[in] box box pointer
|
||||
* @return DBox length ( content length)
|
||||
*/
|
||||
OPJ_SIZE_T get_DBoxlen( box_param_t *box);
|
||||
Byte8_t get_DBoxlen( box_param_t *box);
|
||||
|
||||
|
||||
/**
|
||||
@@ -164,7 +164,7 @@ Byte_t * fetch_headbytes( box_param_t *box);
|
||||
* @param[in] size Byte length
|
||||
* @return pointer to the fetched data
|
||||
*/
|
||||
Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
|
||||
Byte_t * fetch_DBoxbytes( box_param_t *box, long offset, int size);
|
||||
|
||||
/**
|
||||
* fetch DBox (Box Contents) 1-byte Byte codes in file stream
|
||||
@@ -173,7 +173,7 @@ Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
|
||||
* @param[in] offset start Byte position in DBox
|
||||
* @return fetched code
|
||||
*/
|
||||
Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
|
||||
Byte_t fetch_DBox1byte( box_param_t *box, long offset);
|
||||
|
||||
/**
|
||||
* fetch DBox (Box Contents) 2-byte big endian Byte codes in file stream
|
||||
@@ -182,7 +182,7 @@ Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
|
||||
* @param[in] offset start Byte position in DBox
|
||||
* @return fetched code
|
||||
*/
|
||||
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
|
||||
Byte2_t fetch_DBox2bytebigendian( box_param_t *box, long offset);
|
||||
|
||||
/**
|
||||
* fetch DBox (Box Contents) 4-byte big endian Byte codes in file stream
|
||||
@@ -191,7 +191,7 @@ Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
|
||||
* @param[in] offset start Byte position in DBox
|
||||
* @return fetched code
|
||||
*/
|
||||
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
|
||||
Byte4_t fetch_DBox4bytebigendian( box_param_t *box, long offset);
|
||||
|
||||
/**
|
||||
* fetch DBox (Box Contents) 8-byte big endian Byte codes in file stream
|
||||
@@ -200,7 +200,7 @@ Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
|
||||
* @param[in] offset start Byte position in DBox
|
||||
* @return fetched code
|
||||
*/
|
||||
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset);
|
||||
Byte8_t fetch_DBox8bytebigendian( box_param_t *box, long offset);
|
||||
|
||||
|
||||
/**
|
||||
@@ -210,7 +210,7 @@ Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset);
|
||||
* @param[in] boxlist box list pointer
|
||||
* @return found box pointer
|
||||
*/
|
||||
box_param_t * search_box( const char type[], boxlist_param_t *boxlist);
|
||||
box_param_t * search_box( char type[], boxlist_param_t *boxlist);
|
||||
|
||||
/**
|
||||
* print box parameters
|
||||
@@ -242,7 +242,7 @@ void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist);
|
||||
* @param[in,out] type box type
|
||||
* @param[in] boxlist box list pointer
|
||||
*/
|
||||
void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist);
|
||||
void delete_box_in_list_by_type( char type[], boxlist_param_t *boxlist);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: boxheader_manager.c 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "boxheader_manager.h"
|
||||
#include "opj_inttypes.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
@@ -42,10 +41,10 @@
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif /*SERVER*/
|
||||
#endif //SERVER
|
||||
|
||||
|
||||
boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset)
|
||||
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset)
|
||||
{
|
||||
Byte8_t boxlen;
|
||||
Byte_t headlen;
|
||||
@@ -56,7 +55,7 @@ boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset)
|
||||
boxtype = (char *)fetch_bytes( fd, offset+4, 4);
|
||||
headlen = 8;
|
||||
|
||||
if( boxlen == 1){ /* read XLBox */
|
||||
if( boxlen == 1){ // read XLBox
|
||||
boxlen = fetch_8bytebigendian( fd, offset+8);
|
||||
headlen = 16;
|
||||
}
|
||||
@@ -71,14 +70,14 @@ boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset)
|
||||
return boxheader;
|
||||
}
|
||||
|
||||
boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset)
|
||||
boxheader_param_t * gene_childboxheader( box_param_t *superbox, Byte8_t offset)
|
||||
{
|
||||
return gene_boxheader( superbox->fd, get_DBoxoff(superbox)+offset);
|
||||
return gene_boxheader( superbox->fd, get_DBoxoff( superbox)+offset);
|
||||
}
|
||||
|
||||
void print_boxheader( boxheader_param_t *boxheader)
|
||||
{
|
||||
fprintf( logstream, "boxheader info:\n"
|
||||
"\t type: %.4s\n"
|
||||
"\t length:%" PRId64 " %#" PRIx64 "\n", boxheader->type, boxheader->length, boxheader->length);
|
||||
"\t length:%lld %#llx\n", boxheader->type, boxheader->length, boxheader->length);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: boxheader_manager.h 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -50,7 +50,7 @@ typedef struct boxheader_param{
|
||||
* @param[in] offset Box offset
|
||||
* @return pointer to the structure of generate box header parameters
|
||||
*/
|
||||
boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset);
|
||||
boxheader_param_t * gene_boxheader( int fd, Byte8_t offset);
|
||||
|
||||
/**
|
||||
* generate a child box header at the given offset
|
||||
@@ -59,7 +59,7 @@ boxheader_param_t * gene_boxheader( int fd, OPJ_OFF_T offset);
|
||||
* @param[in] offset offset from DBox first byte of superbox
|
||||
* @return pointer to the structure of generate box header parameters
|
||||
*/
|
||||
boxheader_param_t * gene_childboxheader( box_param_t *superbox, OPJ_OFF_T offset);
|
||||
boxheader_param_t * gene_childboxheader( box_param_t *superbox, Byte8_t offset);
|
||||
|
||||
/**
|
||||
* print box header parameters
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: byte_manager.c 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -49,28 +49,28 @@
|
||||
#endif /*SERVER*/
|
||||
|
||||
|
||||
Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size)
|
||||
Byte_t * fetch_bytes( int fd, long offset, int size)
|
||||
{
|
||||
Byte_t *data;
|
||||
|
||||
if( lseek( fd, offset, SEEK_SET)==-1){
|
||||
fprintf( FCGI_stdout, "Reason: Target broken (fseek error)\r\n");
|
||||
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %lu)\n", fd, offset, size);
|
||||
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %d)\n", fd, offset, size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (Byte_t *)malloc( size);
|
||||
|
||||
if( (OPJ_SIZE_T)read( fd, data, size) != size){
|
||||
if( read( fd, data, size) != size){
|
||||
free( data);
|
||||
fprintf( FCGI_stdout, "Reason: Target broken (read error)\r\n");
|
||||
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %lu)\n", fd, offset, size);
|
||||
fprintf( FCGI_stderr, "Error: error in fetch_bytes( %d, %ld, %d)\n", fd, offset, size);
|
||||
return NULL;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Byte_t fetch_1byte( int fd, OPJ_OFF_T offset)
|
||||
Byte_t fetch_1byte( int fd, long offset)
|
||||
{
|
||||
Byte_t code;
|
||||
|
||||
@@ -88,7 +88,7 @@ Byte_t fetch_1byte( int fd, OPJ_OFF_T offset)
|
||||
return code;
|
||||
}
|
||||
|
||||
Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset)
|
||||
Byte2_t fetch_2bytebigendian( int fd, long offset)
|
||||
{
|
||||
Byte_t *data;
|
||||
Byte2_t code;
|
||||
@@ -103,7 +103,7 @@ Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset)
|
||||
return code;
|
||||
}
|
||||
|
||||
Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset)
|
||||
Byte4_t fetch_4bytebigendian( int fd, long offset)
|
||||
{
|
||||
Byte_t *data;
|
||||
Byte4_t code;
|
||||
@@ -118,7 +118,7 @@ Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset)
|
||||
return code;
|
||||
}
|
||||
|
||||
Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset)
|
||||
Byte8_t fetch_8bytebigendian( int fd, long offset)
|
||||
{
|
||||
Byte_t *data;
|
||||
Byte8_t code;
|
||||
@@ -136,7 +136,7 @@ Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset)
|
||||
|
||||
Byte2_t big2( Byte_t *buf)
|
||||
{
|
||||
return (Byte2_t)((((Byte2_t) buf[0]) << 8) + ((Byte2_t) buf[1]));
|
||||
return (((Byte2_t) buf[0]) << 8) + ((Byte2_t) buf[1]);
|
||||
}
|
||||
|
||||
Byte4_t big4( Byte_t *buf)
|
||||
@@ -159,7 +159,7 @@ void modify_4Bytecode( Byte4_t code, Byte_t *stream)
|
||||
*(stream+3) = (Byte_t) (code & 0x000000ff);
|
||||
}
|
||||
|
||||
OPJ_OFF_T get_filesize( int fd)
|
||||
Byte8_t get_filesize( int fd)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
@@ -168,5 +168,5 @@ OPJ_OFF_T get_filesize( int fd)
|
||||
fprintf( FCGI_stderr, "Error: error in get_filesize( %d)\n", fd);
|
||||
return 0;
|
||||
}
|
||||
return sb.st_size;
|
||||
return (Byte8_t)sb.st_size;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: byte_manager.h 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -29,14 +29,20 @@
|
||||
*/
|
||||
|
||||
#ifndef BYTE_MANAGER_H_
|
||||
#define BYTE_MANAGER_H_
|
||||
# define BYTE_MANAGER_H_
|
||||
|
||||
/** 1Byte parameter type*/
|
||||
typedef unsigned char Byte_t;
|
||||
|
||||
/** 2Byte parameter type*/
|
||||
typedef unsigned short int Byte2_t;
|
||||
|
||||
/** 4Byte parameter type*/
|
||||
typedef unsigned int Byte4_t;
|
||||
|
||||
/** 8Byte parameter type*/
|
||||
typedef unsigned long long int Byte8_t;
|
||||
|
||||
#include <stddef.h>
|
||||
#include "opj_stdint.h"
|
||||
typedef uint8_t Byte_t;
|
||||
typedef uint16_t Byte2_t;
|
||||
typedef uint32_t Byte4_t;
|
||||
typedef uint64_t Byte8_t;
|
||||
|
||||
/**
|
||||
* fetch bytes of data in file stream
|
||||
@@ -46,7 +52,7 @@ typedef uint64_t Byte8_t;
|
||||
* @param[in] size Byte length
|
||||
* @return pointer to the fetched data
|
||||
*/
|
||||
Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
|
||||
Byte_t * fetch_bytes( int fd, long offset, int size);
|
||||
|
||||
|
||||
/**
|
||||
@@ -56,7 +62,7 @@ Byte_t * fetch_bytes( int fd, OPJ_OFF_T offset, OPJ_SIZE_T size);
|
||||
* @param[in] offset start Byte position
|
||||
* @return fetched codes
|
||||
*/
|
||||
Byte_t fetch_1byte( int fd, OPJ_OFF_T offset);
|
||||
Byte_t fetch_1byte( int fd, long offset);
|
||||
|
||||
/**
|
||||
* fetch a 2-byte big endian Byte codes in file stream
|
||||
@@ -65,7 +71,7 @@ Byte_t fetch_1byte( int fd, OPJ_OFF_T offset);
|
||||
* @param[in] offset start Byte position
|
||||
* @return fetched codes
|
||||
*/
|
||||
Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset);
|
||||
Byte2_t fetch_2bytebigendian( int fd, long offset);
|
||||
|
||||
/**
|
||||
* fetch a 4-byte big endian Byte codes in file stream
|
||||
@@ -74,7 +80,7 @@ Byte2_t fetch_2bytebigendian( int fd, OPJ_OFF_T offset);
|
||||
* @param[in] offset start Byte position
|
||||
* @return fetched codes
|
||||
*/
|
||||
Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset);
|
||||
Byte4_t fetch_4bytebigendian( int fd, long offset);
|
||||
|
||||
/**
|
||||
* fetch a 8-byte big endian Byte codes in file stream
|
||||
@@ -83,7 +89,7 @@ Byte4_t fetch_4bytebigendian( int fd, OPJ_OFF_T offset);
|
||||
* @param[in] offset start Byte position
|
||||
* @return fetched codes
|
||||
*/
|
||||
Byte8_t fetch_8bytebigendian( int fd, OPJ_OFF_T offset);
|
||||
Byte8_t fetch_8bytebigendian( int fd, long offset);
|
||||
|
||||
|
||||
/**
|
||||
@@ -124,6 +130,6 @@ void modify_4Bytecode( Byte4_t code, Byte_t *stream);
|
||||
* @param[in] fd file discriptor
|
||||
* @return file size
|
||||
*/
|
||||
OPJ_OFF_T get_filesize( int fd);
|
||||
Byte8_t get_filesize( int fd);
|
||||
|
||||
#endif /* !BYTE_MANAGER_H_ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: cache_manager.c 53 2011-05-09 16:55:39Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <string.h>
|
||||
#include "cache_manager.h"
|
||||
|
||||
cachelist_param_t * gene_cachelist(void)
|
||||
cachelist_param_t * gene_cachelist()
|
||||
{
|
||||
cachelist_param_t *cachelist;
|
||||
|
||||
@@ -58,7 +58,7 @@ void delete_cachelist(cachelist_param_t **cachelist)
|
||||
free( *cachelist);
|
||||
}
|
||||
|
||||
cache_param_t * gene_cache( const char *targetname, int csn, char *tid, char *cid)
|
||||
cache_param_t * gene_cache( char *targetname, int csn, char *tid, char *cid)
|
||||
{
|
||||
cache_param_t *cache;
|
||||
|
||||
@@ -106,7 +106,7 @@ void insert_cache_into_list( cache_param_t *cache, cachelist_param_t *cachelist)
|
||||
cachelist->last = cache;
|
||||
}
|
||||
|
||||
cache_param_t * search_cache( const char targetname[], cachelist_param_t *cachelist)
|
||||
cache_param_t * search_cache( char targetname[], cachelist_param_t *cachelist)
|
||||
{
|
||||
cache_param_t *foundcache;
|
||||
|
||||
@@ -140,7 +140,7 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelist)
|
||||
cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist)
|
||||
{
|
||||
cache_param_t *foundcache;
|
||||
int i;
|
||||
@@ -159,7 +159,7 @@ cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelis
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelist)
|
||||
cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist)
|
||||
{
|
||||
cache_param_t *foundcache;
|
||||
|
||||
@@ -176,12 +176,12 @@ cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelis
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void add_cachecid( const char *cid, cache_param_t *cache)
|
||||
void add_cachecid( char *cid, cache_param_t *cache)
|
||||
{
|
||||
if( !cid)
|
||||
return;
|
||||
|
||||
if( (cache->cid = realloc( cache->cid, (OPJ_SIZE_T)(cache->numOfcid+1)*sizeof(char *))) == NULL){
|
||||
if( (cache->cid = realloc( cache->cid, (cache->numOfcid+1)*sizeof(char *))) == NULL){
|
||||
fprintf( stderr, "failed to add new cid to cache table in add_cachecid()\n");
|
||||
return;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void add_cachecid( const char *cid, cache_param_t *cache)
|
||||
cache->numOfcid ++;
|
||||
}
|
||||
|
||||
void update_cachetid( const char *tid, cache_param_t *cache)
|
||||
void update_cachetid( char *tid, cache_param_t *cache)
|
||||
{
|
||||
if( !tid)
|
||||
return;
|
||||
@@ -203,9 +203,9 @@ void update_cachetid( const char *tid, cache_param_t *cache)
|
||||
}
|
||||
}
|
||||
|
||||
void remove_cidInCache( const char *cid, cache_param_t *cache);
|
||||
void remove_cidInCache( char *cid, cache_param_t *cache);
|
||||
|
||||
void remove_cachecid( const char *cid, cachelist_param_t *cachelist)
|
||||
void remove_cachecid( char *cid, cachelist_param_t *cachelist)
|
||||
{
|
||||
cache_param_t *cache;
|
||||
|
||||
@@ -213,7 +213,7 @@ void remove_cachecid( const char *cid, cachelist_param_t *cachelist)
|
||||
remove_cidInCache( cid, cache);
|
||||
}
|
||||
|
||||
void remove_cidInCache( const char *cid, cache_param_t *cache)
|
||||
void remove_cidInCache( char *cid, cache_param_t *cache)
|
||||
{
|
||||
int idx = -1;
|
||||
char **tmp;
|
||||
@@ -232,7 +232,7 @@ void remove_cidInCache( const char *cid, cache_param_t *cache)
|
||||
|
||||
tmp = cache->cid;
|
||||
|
||||
cache->cid = (char **)malloc( (OPJ_SIZE_T)(cache->numOfcid-1)*sizeof(char *));
|
||||
cache->cid = (char **)malloc( (cache->numOfcid-1)*sizeof(char *));
|
||||
|
||||
for( i=0, j=0; i<cache->numOfcid; i++){
|
||||
if( i != idx){
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: cache_manager.h 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -58,7 +58,7 @@ typedef struct cachelist_param{
|
||||
*
|
||||
* @return pointer to the generated cache list
|
||||
*/
|
||||
cachelist_param_t * gene_cachelist(void);
|
||||
cachelist_param_t * gene_cachelist();
|
||||
|
||||
/**
|
||||
* delete cache list
|
||||
@@ -76,7 +76,7 @@ void delete_cachelist(cachelist_param_t **cachelist);
|
||||
* @param[in] cid channel identifier
|
||||
* @return pointer to the generated cache
|
||||
*/
|
||||
cache_param_t * gene_cache( const char *targetname, int csn, char *tid, char *cid);
|
||||
cache_param_t * gene_cache( char *targetname, int csn, char *tid, char *cid);
|
||||
|
||||
/**
|
||||
* delete a cache
|
||||
@@ -101,7 +101,7 @@ void insert_cache_into_list( cache_param_t *cache, cachelist_param_t *cachelist)
|
||||
* @param[in] cachelist cache list pointer
|
||||
* @return found cache pointer
|
||||
*/
|
||||
cache_param_t * search_cache( const char targetname[], cachelist_param_t *cachelist);
|
||||
cache_param_t * search_cache( char targetname[], cachelist_param_t *cachelist);
|
||||
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist);
|
||||
* @param[in] cachelist cache list pointer
|
||||
* @return found cache pointer
|
||||
*/
|
||||
cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelist);
|
||||
cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist);
|
||||
|
||||
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ cache_param_t * search_cacheBycid( const char cid[], cachelist_param_t *cachelis
|
||||
* @param[in] cachelist cache list pointer
|
||||
* @return found cache pointer
|
||||
*/
|
||||
cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelist);
|
||||
cache_param_t * search_cacheBytid( char tid[], cachelist_param_t *cachelist);
|
||||
|
||||
/**
|
||||
* add cid into a cache
|
||||
@@ -139,7 +139,7 @@ cache_param_t * search_cacheBytid( const char tid[], cachelist_param_t *cachelis
|
||||
* @param[in] cid channel identifier
|
||||
* @param[in] cache cache pointer
|
||||
*/
|
||||
void add_cachecid( const char *cid, cache_param_t *cache);
|
||||
void add_cachecid( char *cid, cache_param_t *cache);
|
||||
|
||||
|
||||
/**
|
||||
@@ -148,7 +148,7 @@ void add_cachecid( const char *cid, cache_param_t *cache);
|
||||
* @param[in] tid target identifier
|
||||
* @param[in] cache cache pointer
|
||||
*/
|
||||
void update_cachetid( const char *tid, cache_param_t *cache);
|
||||
void update_cachetid( char *tid, cache_param_t *cache);
|
||||
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ void update_cachetid( const char *tid, cache_param_t *cache);
|
||||
* @param[in] cid channel identifier
|
||||
* @param[in] cachelist cachelist pointer
|
||||
*/
|
||||
void remove_cachecid( const char *cid, cachelist_param_t *cachelist);
|
||||
void remove_cachecid( char *cid, cachelist_param_t *cachelist);
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "cachemodel_manager.h"
|
||||
#include "faixbox_manager.h"
|
||||
#include "opj_inttypes.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
@@ -41,14 +40,14 @@
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif /*SERVER*/
|
||||
#endif //SERVER
|
||||
|
||||
|
||||
cachemodellist_param_t * gene_cachemodellist(void)
|
||||
cachemodellist_param_t * gene_cachemodellist()
|
||||
{
|
||||
cachemodellist_param_t *cachemodellist;
|
||||
|
||||
cachemodellist = (cachemodellist_param_t *)opj_malloc( sizeof(cachemodellist_param_t));
|
||||
cachemodellist = (cachemodellist_param_t *)malloc( sizeof(cachemodellist_param_t));
|
||||
|
||||
cachemodellist->first = NULL;
|
||||
cachemodellist->last = NULL;
|
||||
@@ -56,7 +55,7 @@ cachemodellist_param_t * gene_cachemodellist(void)
|
||||
return cachemodellist;
|
||||
}
|
||||
|
||||
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, OPJ_BOOL reqJPP)
|
||||
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, bool reqJPP)
|
||||
{
|
||||
cachemodel_param_t *cachemodel;
|
||||
faixbox_param_t *tilepart;
|
||||
@@ -65,40 +64,40 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
|
||||
Byte8_t numOftiles;
|
||||
int i;
|
||||
|
||||
cachemodel = (cachemodel_param_t *)opj_malloc( sizeof(cachemodel_param_t));
|
||||
cachemodel = (cachemodel_param_t *)malloc( sizeof(cachemodel_param_t));
|
||||
|
||||
refer_target( target, &cachemodel->target);
|
||||
|
||||
if( reqJPP){
|
||||
if( target->jppstream)
|
||||
cachemodel->jppstream = OPJ_TRUE;
|
||||
cachemodel->jppstream = true;
|
||||
else
|
||||
cachemodel->jppstream = OPJ_FALSE;
|
||||
} else{ /* reqJPT */
|
||||
cachemodel->jppstream = false;
|
||||
} else{ // reqJPT
|
||||
if( target->jptstream)
|
||||
cachemodel->jppstream = OPJ_FALSE;
|
||||
cachemodel->jppstream = false;
|
||||
else
|
||||
cachemodel->jppstream = OPJ_TRUE;
|
||||
cachemodel->jppstream = true;
|
||||
}
|
||||
|
||||
cachemodel->mhead_model = OPJ_FALSE;
|
||||
cachemodel->mhead_model = false;
|
||||
|
||||
tilepart = target->codeidx->tilepart;
|
||||
numOftiles = get_m( tilepart);
|
||||
numOfelem = get_nmax( tilepart)*numOftiles;
|
||||
cachemodel->tp_model = (OPJ_BOOL *)opj_calloc( 1, numOfelem*sizeof(OPJ_BOOL));
|
||||
cachemodel->th_model = (OPJ_BOOL *)opj_calloc( 1, numOftiles*sizeof(OPJ_BOOL));
|
||||
cachemodel->pp_model = (OPJ_BOOL **)opj_malloc( target->codeidx->SIZ.Csiz*sizeof(OPJ_BOOL *));
|
||||
cachemodel->tp_model = (bool *)calloc( 1, numOfelem*sizeof(bool));
|
||||
cachemodel->th_model = (bool *)calloc( 1, numOftiles*sizeof(bool));
|
||||
cachemodel->pp_model = (bool **)malloc( target->codeidx->SIZ.Csiz*sizeof(bool *));
|
||||
for( i=0; i<target->codeidx->SIZ.Csiz; i++){
|
||||
precpacket = target->codeidx->precpacket[i];
|
||||
cachemodel->pp_model[i] = (OPJ_BOOL *)opj_calloc( 1, get_nmax(precpacket)*get_m(precpacket)*sizeof(OPJ_BOOL));
|
||||
cachemodel->pp_model[i] = (bool *)calloc( 1, get_nmax(precpacket)*get_m(precpacket)*sizeof(bool));
|
||||
}
|
||||
cachemodel->next = NULL;
|
||||
|
||||
if( cachemodellist){
|
||||
if( cachemodellist->first) /* there are one or more entries */
|
||||
if( cachemodellist->first) // there are one or more entries
|
||||
cachemodellist->last->next = cachemodel;
|
||||
else /* first entry */
|
||||
else // first entry
|
||||
cachemodellist->first = cachemodel;
|
||||
cachemodellist->last = cachemodel;
|
||||
}
|
||||
@@ -113,10 +112,9 @@ cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, ta
|
||||
void print_cachemodel( cachemodel_param_t cachemodel)
|
||||
{
|
||||
target_param_t *target;
|
||||
Byte8_t TPnum; /* num of tile parts in each tile */
|
||||
Byte8_t Pmax; /* max num of packets per tile */
|
||||
Byte8_t i, j, k;
|
||||
int n; /* FIXME: Is this large enough ? */
|
||||
Byte8_t TPnum; // num of tile parts in each tile
|
||||
Byte8_t Pmax; // max num of packets per tile
|
||||
int i, j, k, n;
|
||||
|
||||
target = cachemodel.target;
|
||||
|
||||
@@ -137,9 +135,9 @@ void print_cachemodel( cachemodel_param_t cachemodel)
|
||||
|
||||
fprintf( logstream, "\t tile header and precinct packet model:\n");
|
||||
for( i=0; i<target->codeidx->SIZ.XTnum*target->codeidx->SIZ.YTnum; i++){
|
||||
fprintf( logstream, "\t tile.%" PRIu64 " %d\n", i, cachemodel.th_model[i]);
|
||||
fprintf( logstream, "\t tile.%d %d\n", i, cachemodel.th_model[i]);
|
||||
for( j=0; j<target->codeidx->SIZ.Csiz; j++){
|
||||
fprintf( logstream, "\t compo.%" PRIu64 ": ", j);
|
||||
fprintf( logstream, "\t compo.%d: ", j);
|
||||
Pmax = get_nmax( target->codeidx->precpacket[j]);
|
||||
for( k=0; k<Pmax; k++)
|
||||
fprintf( logstream, "%d", cachemodel.pp_model[j][i*Pmax+k]);
|
||||
@@ -174,7 +172,7 @@ void delete_cachemodellist( cachemodellist_param_t **cachemodellist)
|
||||
delete_cachemodel( &cachemodelPtr);
|
||||
cachemodelPtr=cachemodelNext;
|
||||
}
|
||||
opj_free(*cachemodellist);
|
||||
free(*cachemodellist);
|
||||
}
|
||||
|
||||
void delete_cachemodel( cachemodel_param_t **cachemodel)
|
||||
@@ -183,54 +181,53 @@ void delete_cachemodel( cachemodel_param_t **cachemodel)
|
||||
|
||||
unrefer_target( (*cachemodel)->target);
|
||||
|
||||
opj_free( (*cachemodel)->tp_model);
|
||||
opj_free( (*cachemodel)->th_model);
|
||||
free( (*cachemodel)->tp_model);
|
||||
free( (*cachemodel)->th_model);
|
||||
|
||||
for( i=0; i<(*cachemodel)->target->codeidx->SIZ.Csiz; i++)
|
||||
opj_free( (*cachemodel)->pp_model[i]);
|
||||
opj_free( (*cachemodel)->pp_model);
|
||||
free( (*cachemodel)->pp_model[i]);
|
||||
free( (*cachemodel)->pp_model);
|
||||
|
||||
#ifndef SERVER
|
||||
fprintf( logstream, "local log: cachemodel deleted\n");
|
||||
#endif
|
||||
opj_free( *cachemodel);
|
||||
free( *cachemodel);
|
||||
}
|
||||
|
||||
OPJ_BOOL is_allsent( cachemodel_param_t cachemodel)
|
||||
bool is_allsent( cachemodel_param_t cachemodel)
|
||||
{
|
||||
target_param_t *target;
|
||||
Byte8_t TPnum; /* num of tile parts in each tile */
|
||||
Byte8_t Pmax; /* max num of packets per tile */
|
||||
Byte8_t i, j, k;
|
||||
int n; /* FIXME: is this large enough ? */
|
||||
Byte8_t TPnum; // num of tile parts in each tile
|
||||
Byte8_t Pmax; // max num of packets per tile
|
||||
int i, j, k, n;
|
||||
|
||||
target = cachemodel.target;
|
||||
|
||||
if( !cachemodel.mhead_model)
|
||||
return OPJ_FALSE;
|
||||
return false;
|
||||
|
||||
TPnum = get_nmax( target->codeidx->tilepart);
|
||||
|
||||
if( cachemodel.jppstream){
|
||||
for( i=0; i<target->codeidx->SIZ.XTnum*target->codeidx->SIZ.YTnum; i++){
|
||||
if( !cachemodel.th_model[i])
|
||||
return OPJ_FALSE;
|
||||
return false;
|
||||
|
||||
for( j=0; j<target->codeidx->SIZ.Csiz; j++){
|
||||
Pmax = get_nmax( target->codeidx->precpacket[j]);
|
||||
for( k=0; k<Pmax; k++)
|
||||
if( !cachemodel.pp_model[j][i*Pmax+k])
|
||||
return OPJ_FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
for( i=0, n=0; i<target->codeidx->SIZ.YTnum; i++)
|
||||
for( j=0; j<target->codeidx->SIZ.XTnum; j++)
|
||||
for( k=0; k<TPnum; k++)
|
||||
if( !cachemodel.tp_model[n++])
|
||||
return OPJ_FALSE;
|
||||
return OPJ_TRUE;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -31,16 +31,17 @@
|
||||
#ifndef CACHEMODEL_MANAGER_H_
|
||||
# define CACHEMODEL_MANAGER_H_
|
||||
|
||||
#include "bool.h"
|
||||
#include "target_manager.h"
|
||||
|
||||
/** Cache model parameters*/
|
||||
typedef struct cachemodel_param{
|
||||
target_param_t *target; /**< reference pointer to the target*/
|
||||
OPJ_BOOL jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
|
||||
OPJ_BOOL mhead_model; /**< main header model, if sent, 1, else 0*/
|
||||
OPJ_BOOL *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
|
||||
OPJ_BOOL *th_model; /**< dynamic array pointer of tile header model*/
|
||||
OPJ_BOOL **pp_model; /**< dynamic array pointer of precint packet model*/
|
||||
bool jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
|
||||
bool mhead_model; /**< main header model, if sent, 1, else 0*/
|
||||
bool *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
|
||||
bool *th_model; /**< dynamic array pointer of tile header model*/
|
||||
bool **pp_model; /**< dynamic array pointer of precint packet model*/
|
||||
struct cachemodel_param *next; /**< pointer to the next cache model*/
|
||||
} cachemodel_param_t;
|
||||
|
||||
@@ -56,7 +57,7 @@ typedef struct cachemodellist_param{
|
||||
*
|
||||
* @return pointer to the generated cache model list
|
||||
*/
|
||||
cachemodellist_param_t * gene_cachemodellist(void);
|
||||
cachemodellist_param_t * gene_cachemodellist();
|
||||
|
||||
/**
|
||||
* generate a cache model under a list
|
||||
@@ -66,7 +67,7 @@ cachemodellist_param_t * gene_cachemodellist(void);
|
||||
* @param[in] reqJPP if JPP-stream is desired true, JPT-stream false
|
||||
* @return pointer to the generated cache model
|
||||
*/
|
||||
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, OPJ_BOOL reqJPP);
|
||||
cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, bool reqJPP);
|
||||
|
||||
|
||||
/**
|
||||
@@ -93,7 +94,7 @@ cachemodel_param_t * search_cachemodel( target_param_t *target, cachemodellist_p
|
||||
* @param[in] cachemodel cache model
|
||||
* @return true if sent all, false otherwise
|
||||
*/
|
||||
OPJ_BOOL is_allsent( cachemodel_param_t cachemodel);
|
||||
bool is_allsent( cachemodel_param_t cachemodel);
|
||||
|
||||
|
||||
/**
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: channel_manager.c 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -32,9 +32,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "channel_manager.h"
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf /* Visual Studio */
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
@@ -43,13 +40,13 @@
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif /*SERVER */
|
||||
#endif //SERVER
|
||||
|
||||
channellist_param_t * gene_channellist(void)
|
||||
channellist_param_t * gene_channellist()
|
||||
{
|
||||
channellist_param_t *channellist;
|
||||
|
||||
channellist = (channellist_param_t *)opj_malloc( sizeof(channellist_param_t));
|
||||
channellist = (channellist_param_t *)malloc( sizeof(channellist_param_t));
|
||||
|
||||
channellist->first = NULL;
|
||||
channellist->last = NULL;
|
||||
@@ -60,7 +57,7 @@ channellist_param_t * gene_channellist(void)
|
||||
channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxtrans, cachemodel_param_t *cachemodel, channellist_param_t *channellist)
|
||||
{
|
||||
channel_param_t *channel;
|
||||
const char transport[4][10] = { "non", "http", "http-tcp", "http-udp"};
|
||||
char transport[4][10] = { "non", "http", "http-tcp", "http-udp"};
|
||||
|
||||
if( !cachemodel){
|
||||
fprintf( FCGI_stdout, "Status: 404\r\n");
|
||||
@@ -68,15 +65,15 @@ channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxt
|
||||
return NULL;
|
||||
}
|
||||
|
||||
channel = (channel_param_t *)opj_malloc( sizeof(channel_param_t));
|
||||
channel = (channel_param_t *)malloc( sizeof(channel_param_t));
|
||||
channel->cachemodel = cachemodel;
|
||||
|
||||
/* set channel ID and get present time */
|
||||
// set channel ID and get present time
|
||||
snprintf( channel->cid, MAX_LENOFCID, "%x%x", (unsigned int)time( &channel->start_tm), (unsigned int)rand());
|
||||
|
||||
channel->aux = query_param.cnew;
|
||||
|
||||
/* only tcp implemented for now */
|
||||
// only tcp implemented for now
|
||||
if( channel->aux == udp)
|
||||
channel->aux = tcp;
|
||||
|
||||
@@ -104,9 +101,7 @@ channel_param_t * gene_channel( query_param_t query_param, auxtrans_param_t auxt
|
||||
|
||||
void set_channel_variable_param( query_param_t query_param, channel_param_t *channel)
|
||||
{
|
||||
/* set roi information */
|
||||
(void)query_param;
|
||||
(void)channel;
|
||||
// set roi information
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +125,7 @@ void delete_channel( channel_param_t **channel, channellist_param_t *channellist
|
||||
#ifndef SERVER
|
||||
fprintf( logstream, "local log: channel: %s deleted\n", (*channel)->cid);
|
||||
#endif
|
||||
opj_free(*channel);
|
||||
free(*channel);
|
||||
}
|
||||
|
||||
void delete_channellist( channellist_param_t **channellist)
|
||||
@@ -143,10 +138,10 @@ void delete_channellist( channellist_param_t **channellist)
|
||||
#ifndef SERVER
|
||||
fprintf( logstream, "local log: channel %s deleted!\n", channelPtr->cid);
|
||||
#endif
|
||||
opj_free(channelPtr);
|
||||
free(channelPtr);
|
||||
channelPtr=channelNext;
|
||||
}
|
||||
opj_free( *channellist);
|
||||
free( *channellist);
|
||||
}
|
||||
|
||||
void print_allchannel( channellist_param_t *channellist)
|
||||
@@ -160,7 +155,7 @@ void print_allchannel( channellist_param_t *channellist)
|
||||
}
|
||||
}
|
||||
|
||||
channel_param_t * search_channel( const char cid[], channellist_param_t *channellist)
|
||||
channel_param_t * search_channel( char cid[], channellist_param_t *channellist)
|
||||
{
|
||||
channel_param_t *foundchannel;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: channel_manager.h 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -62,7 +62,7 @@ typedef struct channellist_param{
|
||||
*
|
||||
* @return pointer to the generated channel list
|
||||
*/
|
||||
channellist_param_t * gene_channellist(void);
|
||||
channellist_param_t * gene_channellist();
|
||||
|
||||
|
||||
/**
|
||||
@@ -116,5 +116,5 @@ void print_allchannel( channellist_param_t *channellist);
|
||||
* @param[in] channellist channel list pointer
|
||||
* @return found channel pointer
|
||||
*/
|
||||
channel_param_t * search_channel( const char cid[], channellist_param_t *channellist);
|
||||
channel_param_t * search_channel( char cid[], channellist_param_t *channellist);
|
||||
#endif /* !CHANNEL_MANAGER_H_ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id$
|
||||
* $Id: codestream_manager.c 44 2011-02-15 12:32:29Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "codestream_manager.h"
|
||||
#include "opj_inttypes.h"
|
||||
|
||||
#ifdef SERVER
|
||||
#include "fcgi_stdio.h"
|
||||
@@ -39,9 +38,9 @@
|
||||
#define FCGI_stdout stdout
|
||||
#define FCGI_stderr stderr
|
||||
#define logstream stderr
|
||||
#endif /*SERVER */
|
||||
#endif //SERVER
|
||||
|
||||
codestream_param_t set_codestream( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
|
||||
codestream_param_t set_codestream( int fd, Byte8_t offset, Byte8_t length)
|
||||
{
|
||||
codestream_param_t cs;
|
||||
|
||||
@@ -52,22 +51,22 @@ codestream_param_t set_codestream( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
|
||||
return cs;
|
||||
}
|
||||
|
||||
Byte_t * fetch_codestreambytes( codestream_param_t *cs, OPJ_OFF_T offset, OPJ_SIZE_T size)
|
||||
Byte_t * fetch_codestreambytes( codestream_param_t *cs, long offset, int size)
|
||||
{
|
||||
return fetch_bytes( cs->fd, cs->offset+offset, size);
|
||||
}
|
||||
|
||||
Byte_t fetch_codestream1byte( codestream_param_t *cs, OPJ_OFF_T offset)
|
||||
Byte_t fetch_codestream1byte( codestream_param_t *cs, long offset)
|
||||
{
|
||||
return fetch_1byte( cs->fd, cs->offset+offset);
|
||||
}
|
||||
|
||||
Byte2_t fetch_codestream2bytebigendian( codestream_param_t *cs, OPJ_OFF_T offset)
|
||||
Byte2_t fetch_codestream2bytebigendian( codestream_param_t *cs, long offset)
|
||||
{
|
||||
return fetch_2bytebigendian( cs->fd, cs->offset+offset);
|
||||
}
|
||||
|
||||
Byte4_t fetch_codestream4bytebigendian( codestream_param_t *cs, OPJ_OFF_T offset)
|
||||
Byte4_t fetch_codestream4bytebigendian( codestream_param_t *cs, long offset)
|
||||
{
|
||||
return fetch_4bytebigendian( cs->fd, cs->offset+offset);
|
||||
}
|
||||
@@ -76,6 +75,6 @@ void print_codestream( codestream_param_t cs)
|
||||
{
|
||||
fprintf( logstream, "codestream info:\n"
|
||||
"\t fd: %d\n"
|
||||
"\t offset: %#" PRIx64 "\n"
|
||||
"\t length: %#" PRIx64 "\n", cs.fd, cs.offset, cs.length);
|
||||
"\t offset: %#llx\n"
|
||||
"\t length: %#llx\n", cs.fd, cs.offset, cs.length);
|
||||
}
|
||||