Compare commits
367 Commits
version.2.
...
version.2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8030b4d6df | ||
|
|
bcbca6e8cc | ||
|
|
7134a8eb26 | ||
|
|
cf77ede84c | ||
|
|
45313a8dfa | ||
|
|
b08135e7c1 | ||
|
|
4bac8488df | ||
|
|
de04302c15 | ||
|
|
997758f91c | ||
|
|
763214f7c0 | ||
|
|
77e8dad503 | ||
|
|
1758445a75 | ||
|
|
7a77a8047d | ||
|
|
d8767cbcb7 | ||
|
|
7924d3a456 | ||
|
|
ec84bafcd8 | ||
|
|
08c09b74cf | ||
|
|
7aece5e8e7 | ||
|
|
8d93eae64a | ||
|
|
9a3d660d1b | ||
|
|
7199d9b5d3 | ||
|
|
d19a4ab676 | ||
|
|
f105cb5471 | ||
|
|
4db4198722 | ||
|
|
616a3345c4 | ||
|
|
1f8d84a562 | ||
|
|
a54d757a3e | ||
|
|
b5eb374fb9 | ||
|
|
f1d69068c7 | ||
|
|
ee130e2306 | ||
|
|
9ba6bc6042 | ||
|
|
5e1a0fad08 | ||
|
|
c05118dc49 | ||
|
|
1adf89d5d2 | ||
|
|
666f71b2a1 | ||
|
|
2b7d5b18f3 | ||
|
|
18d5d25cb6 | ||
|
|
492d8ab7d9 | ||
|
|
2b93727bea | ||
|
|
18c5be69e9 | ||
|
|
5a70e97f51 | ||
|
|
f4707da97a | ||
|
|
51ab074d50 | ||
|
|
6d9e8a5a63 | ||
|
|
008de86533 | ||
|
|
ae49fd1aa9 | ||
|
|
79d18f7fd0 | ||
|
|
99d1859a44 | ||
|
|
866cd28ad4 | ||
|
|
71a9f498b5 | ||
|
|
b607da8ae9 | ||
|
|
a43d206b93 | ||
|
|
15863e7170 | ||
|
|
5e91877636 | ||
|
|
7e1d012161 | ||
|
|
de74605777 | ||
|
|
e8abf1fb25 | ||
|
|
b7fe7d25e1 | ||
|
|
138a65d6c1 | ||
|
|
9d0bdf69e5 | ||
|
|
9194dfb94b | ||
|
|
b7ebf54a29 | ||
|
|
3a80b72ac8 | ||
|
|
3e33012bd9 | ||
|
|
fd3f7ca2bb | ||
|
|
6e22c4f68a | ||
|
|
565ef29ae3 | ||
|
|
68398b2a5a | ||
|
|
5624e4a25f | ||
|
|
92e07f3b74 | ||
|
|
8447f0a323 | ||
|
|
f0a2fdd508 | ||
|
|
320784659d | ||
|
|
51ab8cd67d | ||
|
|
237253d83b | ||
|
|
fe100fb490 | ||
|
|
c7b646e23a | ||
|
|
41add6882b | ||
|
|
dd0d2c2f0a | ||
|
|
d38e32c036 | ||
|
|
73315c2edc | ||
|
|
6b51d11d08 | ||
|
|
59270c39a7 | ||
|
|
db82cf7778 | ||
|
|
ddb1d57766 | ||
|
|
5dd770746b | ||
|
|
fa436eb368 | ||
|
|
fcc658f106 | ||
|
|
2e7b8fb9a1 | ||
|
|
1778e2576e | ||
|
|
73c9e85642 | ||
|
|
76557d2eb3 | ||
|
|
9095c7361e | ||
|
|
c02c1432e8 | ||
|
|
8411ed4f80 | ||
|
|
4de95f320f | ||
|
|
aea18173d1 | ||
|
|
856fc0652f | ||
|
|
b01c1240cf | ||
|
|
836ec05920 | ||
|
|
9a52b30c3d | ||
|
|
76af73bc72 | ||
|
|
f7bc0b49cb | ||
|
|
9155e98911 | ||
|
|
7aee50de97 | ||
|
|
24966ffbda | ||
|
|
666ef53fd2 | ||
|
|
e02ba05034 | ||
|
|
b478912910 | ||
|
|
2001932c56 | ||
|
|
f54de95802 | ||
|
|
fa1c2454e6 | ||
|
|
6b94237679 | ||
|
|
aedff8a000 | ||
|
|
a0aa8dd851 | ||
|
|
440ef4873b | ||
|
|
ffad2fbe55 | ||
|
|
cc1354ebfa | ||
|
|
581d2ba8b4 | ||
|
|
61348b20b4 | ||
|
|
e619e06078 | ||
|
|
4f84d1693a | ||
|
|
71d244a5b6 | ||
|
|
f9a0f869e3 | ||
|
|
33c472d734 | ||
|
|
a8eb122c1f | ||
|
|
956b1a7697 | ||
|
|
472ce19183 | ||
|
|
740924fa61 | ||
|
|
01b4bb5447 | ||
|
|
ee3b02932a | ||
|
|
2a07d3d26b | ||
|
|
e238148d42 | ||
|
|
9d21695476 | ||
|
|
22d11a9ccb | ||
|
|
fc9248ea2b | ||
|
|
c302979738 | ||
|
|
e4d077bc98 | ||
|
|
76cd9b7f72 | ||
|
|
e71431ec78 | ||
|
|
7b335eb635 | ||
|
|
c0c086388b | ||
|
|
048c8302fe | ||
|
|
a7b051b172 | ||
|
|
5f7ad58f48 | ||
|
|
016b9fc052 | ||
|
|
99b40e8257 | ||
|
|
a734e447b5 | ||
|
|
37128c34a9 | ||
|
|
f5630ab88e | ||
|
|
6790587db8 | ||
|
|
445f696dc6 | ||
|
|
dd5c3a9c8e | ||
|
|
0f45e38b52 | ||
|
|
93bc3cb628 | ||
|
|
79faedfb9b | ||
|
|
17d9caae83 | ||
|
|
eea18e856e | ||
|
|
7e64eb5414 | ||
|
|
8a959bb1f4 | ||
|
|
8d3ef0729c | ||
|
|
275680bdb7 | ||
|
|
4d5d1f0f66 | ||
|
|
1ef677f264 | ||
|
|
07193e2a34 | ||
|
|
f7da94610d | ||
|
|
872368d25c | ||
|
|
36320b4bf4 | ||
|
|
7185faa857 | ||
|
|
0c80fcff2a | ||
|
|
51caff5dcf | ||
|
|
d643ff5dbc | ||
|
|
44ca89eff7 | ||
|
|
7afad19c77 | ||
|
|
765c4ab4f4 | ||
|
|
24eca792ff | ||
|
|
b1b17ee264 | ||
|
|
74600cfb14 | ||
|
|
171ec1583d | ||
|
|
80c5106015 | ||
|
|
e92fe4c1a4 | ||
|
|
11f402b44a | ||
|
|
18049fe3e0 | ||
|
|
b330c10492 | ||
|
|
25255c4ed1 | ||
|
|
16febebd28 | ||
|
|
339952c2af | ||
|
|
75715635e8 | ||
|
|
9863d8d1d2 | ||
|
|
3ecccb7410 | ||
|
|
3c7a7a1675 | ||
|
|
d14c475de7 | ||
|
|
a68a3feb60 | ||
|
|
43382a9b9c | ||
|
|
a149502c01 | ||
|
|
decace60da | ||
|
|
2c876b6765 | ||
|
|
6d0785a78f | ||
|
|
ec593a2549 | ||
|
|
978de6fb97 | ||
|
|
c53e2960a0 | ||
|
|
cf91ebf278 | ||
|
|
fd5f21af00 | ||
|
|
1b93cb8c0a | ||
|
|
a9e6268766 | ||
|
|
fc855084a0 | ||
|
|
b7bccf86c3 | ||
|
|
6ee2a51edc | ||
|
|
d2dc1597fe | ||
|
|
82647e79c7 | ||
|
|
ecbebe2847 | ||
|
|
816db977fd | ||
|
|
cbe77e2412 | ||
|
|
1eb67ca49d | ||
|
|
7a89d731f7 | ||
|
|
65503dad73 | ||
|
|
a347262468 | ||
|
|
6a6fa7027a | ||
|
|
86cdc91180 | ||
|
|
094465a710 | ||
|
|
6ae56f302e | ||
|
|
ad895fadb1 | ||
|
|
7c120281c7 | ||
|
|
8a4095b405 | ||
|
|
a7cc5b6a5d | ||
|
|
ac1dfd4662 | ||
|
|
abf2f7f05e | ||
|
|
1c209d711e | ||
|
|
91f521ef92 | ||
|
|
9ac3ae1270 | ||
|
|
d74579aa38 | ||
|
|
6deb1a83b5 | ||
|
|
6f3a7ef3c8 | ||
|
|
9f3687f917 | ||
|
|
5e77c4e936 | ||
|
|
97c376e06d | ||
|
|
8f4d674442 | ||
|
|
7f277fea94 | ||
|
|
52440cc2e6 | ||
|
|
3fe9243e1c | ||
|
|
05dae25a22 | ||
|
|
23ea270881 | ||
|
|
7247543da3 | ||
|
|
37a8d2acc1 | ||
|
|
4a7ba87d99 | ||
|
|
51e3764519 | ||
|
|
533d92aa8e | ||
|
|
19887b7b8c | ||
|
|
005e75bdc3 | ||
|
|
5f3470fcd0 | ||
|
|
adb237cfa8 | ||
|
|
29a29d6210 | ||
|
|
3a155ceda6 | ||
|
|
7195a23a9d | ||
|
|
0ae6ff8018 | ||
|
|
241769dc2f | ||
|
|
4a39ee9bbc | ||
|
|
1dedf7f0cd | ||
|
|
70ede09310 | ||
|
|
3da30304fc | ||
|
|
820c04c679 | ||
|
|
9d848e3f5e | ||
|
|
d5f71c2e1d | ||
|
|
36a7d23273 | ||
|
|
c4317177f3 | ||
|
|
e231a84b2f | ||
|
|
b56fb96b1b | ||
|
|
163c7e3460 | ||
|
|
4c1023dac6 | ||
|
|
563d238fa0 | ||
|
|
9021776963 | ||
|
|
18771f1b6a | ||
|
|
ed2af11102 | ||
|
|
7dd65e84e6 | ||
|
|
e260ec6e9d | ||
|
|
7ce3f3c1a6 | ||
|
|
a466755bbb | ||
|
|
901c9d8ae0 | ||
|
|
6145c82804 | ||
|
|
876c02206d | ||
|
|
3ca312033f | ||
|
|
1378475573 | ||
|
|
00b049866b | ||
|
|
d847e477f0 | ||
|
|
c55e164e87 | ||
|
|
531cd5dd14 | ||
|
|
ff0a9f763e | ||
|
|
228e0a3d79 | ||
|
|
f38e29d00a | ||
|
|
963283d7d0 | ||
|
|
c91044a4a7 | ||
|
|
f42c26adbd | ||
|
|
9efad43509 | ||
|
|
33d8f08964 | ||
|
|
e826e9281e | ||
|
|
780120c9a2 | ||
|
|
d6c0c85125 | ||
|
|
c81fb397bb | ||
|
|
caf4e46e06 | ||
|
|
ff1a30d80a | ||
|
|
d143f49a66 | ||
|
|
58698b789a | ||
|
|
ee3f2ffa19 | ||
|
|
c59124dfe2 | ||
|
|
7b14cf8558 | ||
|
|
05f796d2fa | ||
|
|
bd8c91b37d | ||
|
|
7294cdef3e | ||
|
|
4d7b6374c8 | ||
|
|
5855da5a15 | ||
|
|
34fd493512 | ||
|
|
da4bd9b110 | ||
|
|
7fbf6df09e | ||
|
|
68415d040f | ||
|
|
8ee74f6bff | ||
|
|
bf0fa4089f | ||
|
|
07ae149955 | ||
|
|
ecb93d97a5 | ||
|
|
f769d5e27f | ||
|
|
1e414c8f37 | ||
|
|
07e6994be1 | ||
|
|
0abf4f8fbb | ||
|
|
a13e4a77e0 | ||
|
|
6de2271e2a | ||
|
|
021e255282 | ||
|
|
92b1e038c1 | ||
|
|
a8c33ae219 | ||
|
|
e7bc30b409 | ||
|
|
efaefa21fc | ||
|
|
42bd417acf | ||
|
|
af58e8e8f9 | ||
|
|
4bf4a7668e | ||
|
|
c03ca9c73c | ||
|
|
d5884afcf3 | ||
|
|
a2aeafe85b | ||
|
|
0109b39f58 | ||
|
|
752e978d56 | ||
|
|
8b36a11f2b | ||
|
|
ccd448d626 | ||
|
|
44fb38949b | ||
|
|
ad1532ed57 | ||
|
|
caaec3bb05 | ||
|
|
df47fae287 | ||
|
|
b65bf48369 | ||
|
|
4c02acb728 | ||
|
|
8c9151c86b | ||
|
|
c075742bc8 | ||
|
|
b42cf317d6 | ||
|
|
f5429e4ce8 | ||
|
|
82dad8e629 | ||
|
|
59aa37fe2b | ||
|
|
0adb43f06e | ||
|
|
87e09a09da | ||
|
|
ba630816bc | ||
|
|
863fdafcd5 | ||
|
|
be5e6941bf | ||
|
|
7980115412 | ||
|
|
cab86a0deb | ||
|
|
be3a1da14a | ||
|
|
650c587875 | ||
|
|
d29c5760bd | ||
|
|
ee9d777d69 | ||
|
|
59582bafa3 | ||
|
|
1ad85ac9ee | ||
|
|
999a84c77a | ||
|
|
48e0d167aa | ||
|
|
f14da66ce5 |
6
AUTHORS
6
AUTHORS
@@ -3,10 +3,10 @@ See also the files THANKS and CHANGES
|
||||
|
||||
David Janssens designed and implemented the first version of OpenJPEG.
|
||||
Kaori Hagihara designed and implemented the first version of OpenJPIP.
|
||||
Jerome Fimes implemented the alpha version of OpenJPEG v2.
|
||||
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
|
||||
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.
|
||||
Micka<EFBFBD>l Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
|
||||
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
|
||||
Yannick Verschueren,
|
||||
Herve Drolon,
|
||||
Francois-Olivier Devaux,
|
||||
|
||||
107
CMakeLists.txt
107
CMakeLists.txt
@@ -29,7 +29,7 @@ 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_MINOR 1)
|
||||
set(OPENJPEG_VERSION_BUILD 0)
|
||||
set(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
@@ -47,11 +47,13 @@ set(PACKAGE_VERSION
|
||||
# 1.5 | 5
|
||||
# 1.5.1 | 5
|
||||
# 2.0 | 6
|
||||
# 2.0.1 | 6
|
||||
# 2.1 | 7
|
||||
# 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)
|
||||
SET(OPENJPEG_SOVERSION 7)
|
||||
endif(NOT OPENJPEG_SOVERSION)
|
||||
set(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
@@ -93,6 +95,8 @@ endif()
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Install directories
|
||||
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
|
||||
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
|
||||
|
||||
string(TOLOWER ${PROJECT_NAME} projectname)
|
||||
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
|
||||
@@ -117,6 +121,7 @@ if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
|
||||
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
|
||||
if(BUILD_DOC)
|
||||
if(NOT OPENJPEG_INSTALL_MAN_DIR)
|
||||
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
|
||||
endif()
|
||||
@@ -124,6 +129,7 @@ endif()
|
||||
if(NOT OPENJPEG_INSTALL_DOC_DIR)
|
||||
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT OPENJPEG_INSTALL_JNI_DIR)
|
||||
if(WIN32)
|
||||
@@ -181,19 +187,31 @@ endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_config.h generation (1/2)
|
||||
|
||||
# Check if some include files are provided by the system
|
||||
include(EnsureFileInclude)
|
||||
# These files are mandatory
|
||||
ensure_file_include("string.h" HAVE_STRING_H YES)
|
||||
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
|
||||
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
|
||||
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
|
||||
ensure_file_include("math.h" HAVE_MATH_H YES)
|
||||
ensure_file_include("float.h" HAVE_FLOAT_H YES)
|
||||
ensure_file_include("time.h" HAVE_TIME_H YES)
|
||||
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
|
||||
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
|
||||
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
|
||||
|
||||
# For the following files, we provide an alternative, they are not mandatory
|
||||
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
|
||||
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
|
||||
|
||||
# why check this one ? for openjpip ?
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
|
||||
CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||
CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
|
||||
CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H)
|
||||
CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H)
|
||||
CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H)
|
||||
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
|
||||
# ssize_t
|
||||
include(CheckTypeSize)
|
||||
CHECK_TYPE_SIZE(ssize_t SSIZE_T)
|
||||
|
||||
# Enable Large file support
|
||||
include(TestLargeFiles)
|
||||
@@ -201,7 +219,15 @@ OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Library
|
||||
add_subdirectory(src)
|
||||
if(BUILD_JPIP_SERVER)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(FCGI REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
message(FATAL_ERROR "Only pthread are supported")
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(src/lib)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build Applications
|
||||
@@ -235,10 +261,15 @@ configure_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config.h
|
||||
@ONLY
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/opj_config_private.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/lib/openjp2/opj_config_private.h
|
||||
@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)
|
||||
# build documentation in doc subdir:
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
@@ -255,9 +286,8 @@ if(BUILD_TESTING)
|
||||
# They could be found via svn on the OpenJPEG google code project
|
||||
# svn checkout http://openjpeg.googlecode.com/svn/data (about 70 Mo)
|
||||
find_path(OPJ_DATA_ROOT README-OPJ-Data
|
||||
PATHS
|
||||
$ENV{OPJ_DATA_ROOT}
|
||||
${CMAKE_SOURCE_DIR}/../data
|
||||
PATHS $ENV{OPJ_DATA_ROOT} ${CMAKE_SOURCE_DIR}/../data
|
||||
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
|
||||
)
|
||||
|
||||
# Add repository where to find tests
|
||||
@@ -281,9 +311,54 @@ install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# install CHANGES and LICENSE
|
||||
if(BUILD_DOC)
|
||||
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
|
||||
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
endif()
|
||||
|
||||
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
|
||||
endif()
|
||||
|
||||
include (cmake/OpenJPEGCPack.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# pkgconfig support
|
||||
# enabled by default on Unix, disabled by default on other platforms
|
||||
if(UNIX)
|
||||
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" ON)
|
||||
else()
|
||||
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" OFF)
|
||||
endif()
|
||||
if(BUILD_PKGCONFIG_FILES)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
#
|
||||
if(BUILD_JPWL)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpwl/libopenjpwl.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpwl.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
#
|
||||
if(BUILD_JPIP)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpip/libopenjpip.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
#
|
||||
if(BUILD_JP3D)
|
||||
# install in lib and not share (see multi-arch note above)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp3d/libopenjp3d.pc.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc @ONLY)
|
||||
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp3d.pc DESTINATION
|
||||
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
11
LICENSE
11
LICENSE
@@ -1,7 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2012, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2012, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2012, Antonin Descampe
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2003-2009, Francois-Olivier Devaux
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
|
||||
40
NEWS
40
NEWS
@@ -2,6 +2,46 @@
|
||||
OpenJPEG NEWS - user visible changes
|
||||
====================================
|
||||
|
||||
Changes from OpenJPEG 2.0.0 to OpenJPEG 2.1.0
|
||||
----------------------------------------------
|
||||
|
||||
New Features:
|
||||
|
||||
* Digital Cinema profiles have been fixed and updated
|
||||
* New option to disable MCT if needed
|
||||
* extended RAW support: it is now possible to input raw images
|
||||
with subsampled color components (422, 420, etc)
|
||||
* New way to deal with profiles
|
||||
|
||||
API/ABI modifications: (see abi_compat_report in dev-utils/scripts)
|
||||
|
||||
* Removed deprecated functions
|
||||
- opj_stream_create_default_file_stream(FILE*,...)
|
||||
- opj_stream_create_file_stream(FILE*,...)
|
||||
- opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data)
|
||||
* Added
|
||||
- opj_stream_create_default_file_stream(char*,...)
|
||||
- opj_stream_create_file_stream(char*,...)
|
||||
- opj_stream_destroy(opj_stream_t*)
|
||||
- opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data,
|
||||
... opj_stream_free_user_data_fn p_function)
|
||||
- JPEG 2000 profiles and Part-2 extensions defined through '#define'
|
||||
* Changed
|
||||
- 'alpha' field added to 'opj_image_comp' structure
|
||||
- 'OPJ_CLRSPC_EYCC' added to enum COLOR_SPACE
|
||||
- 'OPJ_CLRSPC_CMYK' added to enum COLOR_SPACE
|
||||
- 'OPJ_CODEC_JPP' and 'OPJ_CODEC_JPX' added to CODEC_FORMAT
|
||||
(not yet used in use)
|
||||
- 'max_cs_size' and 'rsiz' fields added to opj_cparameters_t
|
||||
|
||||
Misc:
|
||||
|
||||
* OpenJPEG is now officialy conformant with JPEG 2000 Part-1
|
||||
and will soon become official reference software at the
|
||||
JPEG committee.
|
||||
* Huge amount of bug fixes. See CHANGES for details.
|
||||
|
||||
|
||||
Changes from OpenJPEG 1.5.x to OpenJPEG 2.0.0
|
||||
----------------------------------------------
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
|
||||
|
||||
# Suppress warning caused by intentional messages about deprecation
|
||||
".*warning,.* is deprecated"
|
||||
# java also warns about deprecated API
|
||||
".*java.*deprecation"
|
||||
".*deprecation.*"
|
||||
# supress warnings caused by 3rd party libs:
|
||||
".*thirdparty.*"
|
||||
"libtiff.*has no symbols"
|
||||
|
||||
26
cmake/EnsureFileInclude.cmake
Normal file
26
cmake/EnsureFileInclude.cmake
Normal file
@@ -0,0 +1,26 @@
|
||||
# Ensure that an include file is provided by the system
|
||||
# Add the check about the mandatory status to the check_include_file macro
|
||||
# provided by cmake
|
||||
|
||||
include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
|
||||
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
CHECK_INCLUDE_FILE(${INCLUDE_FILENAME} ${VARIABLE_NAME})
|
||||
|
||||
#message(WARNING "INCLUDE_FILENAME=${INCLUDE_FILENAME} \n"
|
||||
# "VARIABLE_NAME=${VARIABLE_NAME} \n"
|
||||
# "VARIABLE_NAME_VALUE=${${VARIABLE_NAME}} \n"
|
||||
# "MANDATORY_STATUS=${MANDATORY_STATUS}")
|
||||
|
||||
if (NOT ${${VARIABLE_NAME}})
|
||||
if (${MANDATORY_STATUS})
|
||||
message(FATAL_ERROR "The file ${INCLUDE_FILENAME} is mandatory but not found on your system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
@@ -1,9 +1,9 @@
|
||||
#
|
||||
# this module looks for KAKADu
|
||||
# this module looks for KAKADU
|
||||
# http://www.kakadusoftware.com/
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
# Copyright (c) 2006-2014 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
@@ -14,6 +14,11 @@ find_program(KDU_EXPAND_EXECUTABLE
|
||||
kdu_expand
|
||||
)
|
||||
|
||||
find_program(KDU_COMPRESS_EXECUTABLE
|
||||
kdu_compress
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
KDU_EXPAND_EXECUTABLE
|
||||
KDU_COMPRESS_EXECUTABLE
|
||||
)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Cause a compile-time error if off_t is smaller than 64 bits */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
/* Cause a compile-time error if off_t is smaller than 64 bits */
|
||||
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
|
||||
int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# _LARGE_FILES
|
||||
# _LARGEFILE_SOURCE
|
||||
# _FILE_OFFSET_BITS 64
|
||||
# HAVE_FSEEKO
|
||||
# OPJ_HAVE_FSEEKO
|
||||
#
|
||||
# However, it is YOUR job to make sure these defines are set in a #cmakedefine so they
|
||||
# end up in a config.h file that is included in your source if necessary!
|
||||
@@ -113,10 +113,10 @@ macro(OPJ_TEST_LARGE_FILES VARIABLE)
|
||||
endif()
|
||||
|
||||
if(FSEEKO_COMPILE_OK)
|
||||
set(HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||
set(OPJ_HAVE_FSEEKO ON CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||
else()
|
||||
message(STATUS "Checking for fseeko/ftello - not found")
|
||||
set(HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||
set(OPJ_HAVE_FSEEKO OFF CACHE INTERNAL "Result of test for fseeko/ftello")
|
||||
endif()
|
||||
|
||||
if(FILE64_OK AND FSEEKO_COMPILE_OK)
|
||||
|
||||
@@ -145,7 +145,7 @@ HTML_STYLESHEET =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
GENERATE_DOCSET = NO
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -203,9 +203,9 @@ Options usable only if the library has been compiled with \fB-DUSE_JPWL\fR
|
||||
.B opj_compress -i \fRlena.raw \fB-o \fRlena.j2k \fB-F \fR512,512,3,8,u
|
||||
.P
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
.br
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
.br
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
.br
|
||||
|
||||
@@ -91,9 +91,9 @@ Set the maximum number of quality layers to decode. If there are less quality la
|
||||
.P
|
||||
'\".SH BUGS
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
.br
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
.br
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
.br
|
||||
|
||||
@@ -313,9 +313,9 @@ typedef struct opj_cparameters
|
||||
'\".SH OPTIONS
|
||||
'\".SH BUGS
|
||||
.SH AUTHORS
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
|
||||
Copyright (c) 2001-2003, David Janssens
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
# required dep for server:
|
||||
if(BUILD_JPIP_SERVER)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(FCGI REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
message(FATAL_ERROR "Only pthread are supported")
|
||||
endif()
|
||||
endif()
|
||||
#if(BUILD_JPIP_SERVER)
|
||||
# find_package(CURL REQUIRED)
|
||||
# find_package(FCGI REQUIRED)
|
||||
# find_package(Threads REQUIRED)
|
||||
# if(NOT CMAKE_USE_PTHREADS_INIT)
|
||||
# message(FATAL_ERROR "Only pthread are supported")
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
add_subdirectory(lib)
|
||||
#add_subdirectory(lib)
|
||||
#add_subdirectory(bin)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
# opj_apps_config.h generation
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_apps_config.h.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opj_apps_config.h
|
||||
@ONLY
|
||||
)
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -33,15 +39,16 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "color.h"
|
||||
|
||||
#ifdef HAVE_LIBLCMS2
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
#include <lcms2.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
|
||||
@@ -86,19 +93,19 @@ static void sycc444_to_rgb(opj_image_t *img)
|
||||
const int *y, *cb, *cr;
|
||||
int maxw, maxh, max, i, offset, upb;
|
||||
|
||||
i = img->comps[0].prec;
|
||||
i = (int)img->comps[0].prec;
|
||||
offset = 1<<(i - 1); upb = (1<<i)-1;
|
||||
|
||||
maxw = img->comps[0].w; maxh = img->comps[0].h;
|
||||
maxw = (int)img->comps[0].w; maxh = (int)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
cb = img->comps[1].data;
|
||||
cr = img->comps[2].data;
|
||||
|
||||
d0 = r = (int*)malloc(sizeof(int) * max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * max);
|
||||
d0 = r = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
@@ -119,19 +126,19 @@ static void sycc422_to_rgb(opj_image_t *img)
|
||||
int maxw, maxh, max, offset, upb;
|
||||
int i, j;
|
||||
|
||||
i = img->comps[0].prec;
|
||||
i = (int)img->comps[0].prec;
|
||||
offset = 1<<(i - 1); upb = (1<<i)-1;
|
||||
|
||||
maxw = img->comps[0].w; maxh = img->comps[0].h;
|
||||
maxw = (int)img->comps[0].w; maxh = (int)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
cb = img->comps[1].data;
|
||||
cr = img->comps[2].data;
|
||||
|
||||
d0 = r = (int*)malloc(sizeof(int) * max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * max);
|
||||
d0 = r = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i=0; i < maxh; ++i)
|
||||
{
|
||||
@@ -150,8 +157,13 @@ static void sycc422_to_rgb(opj_image_t *img)
|
||||
free(img->comps[1].data); img->comps[1].data = d1;
|
||||
free(img->comps[2].data); img->comps[2].data = d2;
|
||||
|
||||
#if defined(USE_JPWL) || defined(USE_MJ2)
|
||||
img->comps[1].w = maxw; img->comps[1].h = maxh;
|
||||
img->comps[2].w = maxw; img->comps[2].h = maxh;
|
||||
#else
|
||||
img->comps[1].w = (OPJ_UINT32)maxw; img->comps[1].h = (OPJ_UINT32)maxh;
|
||||
img->comps[2].w = (OPJ_UINT32)maxw; img->comps[2].h = (OPJ_UINT32)maxh;
|
||||
#endif
|
||||
img->comps[1].dx = img->comps[0].dx;
|
||||
img->comps[2].dx = img->comps[0].dx;
|
||||
img->comps[1].dy = img->comps[0].dy;
|
||||
@@ -166,19 +178,19 @@ static void sycc420_to_rgb(opj_image_t *img)
|
||||
int maxw, maxh, max, offset, upb;
|
||||
int i, j;
|
||||
|
||||
i = img->comps[0].prec;
|
||||
i = (int)img->comps[0].prec;
|
||||
offset = 1<<(i - 1); upb = (1<<i)-1;
|
||||
|
||||
maxw = img->comps[0].w; maxh = img->comps[0].h;
|
||||
maxw = (int)img->comps[0].w; maxh = (int)img->comps[0].h;
|
||||
max = maxw * maxh;
|
||||
|
||||
y = img->comps[0].data;
|
||||
cb = img->comps[1].data;
|
||||
cr = img->comps[2].data;
|
||||
|
||||
d0 = r = (int*)malloc(sizeof(int) * max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * max);
|
||||
d0 = r = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d1 = g = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
d2 = b = (int*)malloc(sizeof(int) * (size_t)max);
|
||||
|
||||
for(i=0; i < maxh; i += 2)
|
||||
{
|
||||
@@ -209,8 +221,13 @@ static void sycc420_to_rgb(opj_image_t *img)
|
||||
free(img->comps[1].data); img->comps[1].data = d1;
|
||||
free(img->comps[2].data); img->comps[2].data = d2;
|
||||
|
||||
#if defined(USE_JPWL) || defined(USE_MJ2)
|
||||
img->comps[1].w = maxw; img->comps[1].h = maxh;
|
||||
img->comps[2].w = maxw; img->comps[2].h = maxh;
|
||||
#else
|
||||
img->comps[1].w = (OPJ_UINT32)maxw; img->comps[1].h = (OPJ_UINT32)maxh;
|
||||
img->comps[2].w = (OPJ_UINT32)maxw; img->comps[2].h = (OPJ_UINT32)maxh;
|
||||
#endif
|
||||
img->comps[1].dx = img->comps[0].dx;
|
||||
img->comps[2].dx = img->comps[0].dx;
|
||||
img->comps[1].dy = img->comps[0].dy;
|
||||
@@ -265,8 +282,8 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
|
||||
}/* color_sycc_to_rgb() */
|
||||
|
||||
#if defined(HAVE_LIBLCMS2) || defined(HAVE_LIBLCMS1)
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#if defined(OPJ_HAVE_LIBLCMS2) || defined(OPJ_HAVE_LIBLCMS1)
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
/* Bob Friesenhahn proposed:*/
|
||||
#define cmsSigXYZData icSigXYZData
|
||||
#define cmsSigLabData icSigLabData
|
||||
@@ -280,8 +297,9 @@ void color_sycc_to_rgb(opj_image_t *img)
|
||||
#define cmsColorSpaceSignature icColorSpaceSignature
|
||||
#define cmsGetHeaderRenderingIntent cmsTakeRenderingIntent
|
||||
|
||||
#endif /* HAVE_LIBLCMS1 */
|
||||
#endif /* OPJ_HAVE_LIBLCMS1 */
|
||||
|
||||
/*#define DEBUG_PROFILE*/
|
||||
void color_apply_icc_profile(opj_image_t *image)
|
||||
{
|
||||
cmsHPROFILE in_prof, out_prof;
|
||||
@@ -294,6 +312,11 @@ void color_apply_icc_profile(opj_image_t *image)
|
||||
|
||||
in_prof =
|
||||
cmsOpenProfileFromMem(image->icc_profile_buf, image->icc_profile_len);
|
||||
#ifdef DEBUG_PROFILE
|
||||
FILE *icm = fopen("debug.icm","wb");
|
||||
fwrite( image->icc_profile_buf,1, image->icc_profile_len,icm);
|
||||
fclose(icm);
|
||||
#endif
|
||||
|
||||
if(in_prof == NULL) return;
|
||||
|
||||
@@ -302,14 +325,23 @@ void color_apply_icc_profile(opj_image_t *image)
|
||||
intent = cmsGetHeaderRenderingIntent(in_prof);
|
||||
|
||||
|
||||
max_w = image->comps[0].w; max_h = image->comps[0].h;
|
||||
prec = image->comps[0].prec;
|
||||
max_w = (int)image->comps[0].w;
|
||||
max_h = (int)image->comps[0].h;
|
||||
prec = (int)image->comps[0].prec;
|
||||
oldspace = image->color_space;
|
||||
|
||||
if(out_space == cmsSigRgbData) /* enumCS 16 */
|
||||
{
|
||||
if( prec <= 8 )
|
||||
{
|
||||
in_type = TYPE_RGB_8;
|
||||
out_type = TYPE_RGB_8;
|
||||
}
|
||||
else
|
||||
{
|
||||
in_type = TYPE_RGB_16;
|
||||
out_type = TYPE_RGB_16;
|
||||
}
|
||||
out_prof = cmsCreate_sRGBProfile();
|
||||
image->color_space = OPJ_CLRSPC_SRGB;
|
||||
}
|
||||
@@ -360,12 +392,15 @@ out_space,
|
||||
|
||||
in_type,out_type
|
||||
);
|
||||
#else
|
||||
(void)prec;
|
||||
(void)in_space;
|
||||
#endif /* DEBUG_PROFILE */
|
||||
|
||||
transform = cmsCreateTransform(in_prof, in_type,
|
||||
out_prof, out_type, intent, 0);
|
||||
|
||||
#ifdef HAVE_LIBLCMS2
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
/* Possible for: LCMS_VERSION >= 2000 :*/
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
@@ -378,7 +413,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
"ICC Profile ignored.\n",__FILE__,__LINE__);
|
||||
#endif
|
||||
image->color_space = oldspace;
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
#endif
|
||||
@@ -387,8 +422,44 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
|
||||
if(image->numcomps > 2)/* RGB, RGBA */
|
||||
{
|
||||
if( prec <= 8 )
|
||||
{
|
||||
unsigned char *inbuf, *outbuf, *in, *out;
|
||||
max = max_w * max_h;
|
||||
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned char);
|
||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
*in++ = (unsigned char)*r++;
|
||||
*in++ = (unsigned char)*g++;
|
||||
*in++ = (unsigned char)*b++;
|
||||
}
|
||||
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
b = image->comps[2].data;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
*r++ = (int)*out++;
|
||||
*g++ = (int)*out++;
|
||||
*b++ = (int)*out++;
|
||||
}
|
||||
free(inbuf); free(outbuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short *inbuf, *outbuf, *in, *out;
|
||||
max = max_w * max_h; nr_samples = max * 3 * sizeof(unsigned short);
|
||||
max = max_w * max_h;
|
||||
nr_samples = (cmsUInt32Number)max * 3 * (cmsUInt32Number)sizeof(unsigned short);
|
||||
in = inbuf = (unsigned short*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned short*)malloc(nr_samples);
|
||||
|
||||
@@ -403,7 +474,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
*in++ = (unsigned short)*b++;
|
||||
}
|
||||
|
||||
cmsDoTransform(transform, inbuf, outbuf, max);
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
@@ -416,12 +487,13 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
*b++ = (int)*out++;
|
||||
}
|
||||
free(inbuf); free(outbuf);
|
||||
}
|
||||
}
|
||||
else /* GRAY, GRAYA */
|
||||
{
|
||||
unsigned char *in, *inbuf, *out, *outbuf;
|
||||
|
||||
max = max_w * max_h; nr_samples = max * 3 * sizeof(unsigned char);
|
||||
max = max_w * max_h;
|
||||
nr_samples = (cmsUInt32Number)max * 3 * sizeof(unsigned char);
|
||||
in = inbuf = (unsigned char*)malloc(nr_samples);
|
||||
out = outbuf = (unsigned char*)malloc(nr_samples);
|
||||
|
||||
@@ -434,8 +506,8 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
image->comps[1] = image->comps[0];
|
||||
image->comps[2] = image->comps[0];
|
||||
|
||||
image->comps[1].data = (int*)calloc(max, sizeof(int));
|
||||
image->comps[2].data = (int*)calloc(max, sizeof(int));
|
||||
image->comps[1].data = (int*)calloc((size_t)max, sizeof(int));
|
||||
image->comps[2].data = (int*)calloc((size_t)max, sizeof(int));
|
||||
|
||||
image->numcomps += 2;
|
||||
|
||||
@@ -445,7 +517,7 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
{
|
||||
*in++ = (unsigned char)*r++;
|
||||
}
|
||||
cmsDoTransform(transform, inbuf, outbuf, max);
|
||||
cmsDoTransform(transform, inbuf, outbuf, (cmsUInt32Number)max);
|
||||
|
||||
r = image->comps[0].data;
|
||||
g = image->comps[1].data;
|
||||
@@ -461,11 +533,11 @@ fprintf(stderr,"%s:%d:color_apply_icc_profile\n\tcmsCreateTransform failed. "
|
||||
|
||||
cmsDeleteTransform(transform);
|
||||
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
cmsCloseProfile(in_prof);
|
||||
cmsCloseProfile(out_prof);
|
||||
#endif
|
||||
}/* color_apply_icc_profile() */
|
||||
|
||||
#endif /* HAVE_LIBLCMS2 || HAVE_LIBLCMS1 */
|
||||
#endif /* OPJ_HAVE_LIBLCMS2 || OPJ_HAVE_LIBLCMS1 */
|
||||
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -41,9 +47,9 @@
|
||||
#define BMP_DFMT 12
|
||||
#define YUV_DFMT 13
|
||||
#define TIF_DFMT 14
|
||||
#define RAW_DFMT 15
|
||||
#define RAW_DFMT 15 /* MSB / Big Endian */
|
||||
#define TGA_DFMT 16
|
||||
#define PNG_DFMT 17
|
||||
#define RAWL_DFMT 18
|
||||
#define RAWL_DFMT 18 /* LSB / Little Endian */
|
||||
|
||||
#endif /* _OPJ_FORMAT_DEFS_H_ */
|
||||
|
||||
15
src/bin/common/opj_apps_config.h.cmake.in
Normal file
15
src/bin/common/opj_apps_config.h.cmake.in
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "opj_config_private.h"
|
||||
|
||||
/* create opj_apps_config.h for CMake */
|
||||
|
||||
#cmakedefine OPJ_HAVE_LIBPNG @HAVE_LIBPNG@
|
||||
#cmakedefine OPJ_HAVE_PNG_H @HAVE_PNG_H@
|
||||
#cmakedefine OPJ_HAVE_LIBTIFF @HAVE_LIBTIFF@
|
||||
#cmakedefine OPJ_HAVE_TIFF_H @HAVE_TIFF_H@
|
||||
|
||||
#cmakedefine OPJ_HAVE_LIBLCMS1
|
||||
#cmakedefine OPJ_HAVE_LIBLCMS2
|
||||
#cmakedefine OPJ_HAVE_LCMS1_H
|
||||
#cmakedefine OPJ_HAVE_LCMS2_H
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 3-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
@@ -10,11 +15,7 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
|
||||
@@ -11,6 +11,7 @@ set(common_SRCS
|
||||
# Headers file are located here:
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||
${LCMS_INCLUDE_DIRNAME}
|
||||
@@ -51,6 +52,7 @@ foreach(exe opj_decompress opj_compress opj_dump)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
if(BUILD_DOC)
|
||||
# Install man pages
|
||||
install(
|
||||
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_compress.1
|
||||
@@ -58,3 +60,4 @@ install(
|
||||
${OPENJPEG_SOURCE_DIR}/doc/man/man1/opj_dump.1
|
||||
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
|
||||
#
|
||||
endif()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -31,6 +37,16 @@
|
||||
#ifndef __J2K_CONVERT_H
|
||||
#define __J2K_CONVERT_H
|
||||
|
||||
/**@name RAW component encoding parameters */
|
||||
/*@{*/
|
||||
typedef struct raw_comp_cparameters {
|
||||
/** subsampling in X direction */
|
||||
int dx;
|
||||
/** subsampling in Y direction */
|
||||
int dy;
|
||||
/*@}*/
|
||||
} raw_comp_cparameters_t;
|
||||
|
||||
/**@name RAW image encoding parameters */
|
||||
/*@{*/
|
||||
typedef struct raw_cparameters {
|
||||
@@ -38,12 +54,14 @@ typedef struct raw_cparameters {
|
||||
int rawWidth;
|
||||
/** height of the raw image */
|
||||
int rawHeight;
|
||||
/** components of the raw image */
|
||||
/** number of components of the raw image */
|
||||
int rawComp;
|
||||
/** bit depth of the raw image */
|
||||
int rawBitDepth;
|
||||
/** signed/unsigned raw image */
|
||||
OPJ_BOOL rawSigned;
|
||||
/** bit depth of the raw image */
|
||||
int rawBitDepth;
|
||||
/** signed/unsigned raw image */
|
||||
OPJ_BOOL rawSigned;
|
||||
/** raw components parameters */
|
||||
raw_comp_cparameters_t *rawComps;
|
||||
/*@}*/
|
||||
} raw_cparameters_t;
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -31,7 +37,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -57,10 +63,10 @@
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
#ifdef HAVE_LIBLCMS2
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
#include <lcms2.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
#include "color.h"
|
||||
@@ -100,31 +106,25 @@ int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsi
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
static void decode_help_display(void) {
|
||||
fprintf(stdout,"HELP for opj_decompress\n----\n\n");
|
||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||
fprintf(stdout,"\nThis is the opj_decompress utility from the OpenJPEG project.\n"
|
||||
"It decompresses JPEG 2000 codestreams to various image formats.\n"
|
||||
"It has been compiled against openjp2 library v%s.\n\n",opj_version());
|
||||
|
||||
/* UniPG>> */
|
||||
fprintf(stdout,"List of parameters for the JPEG 2000 "
|
||||
#ifdef USE_JPWL
|
||||
"+ JPWL "
|
||||
#endif /* USE_JPWL */
|
||||
"decoder:\n");
|
||||
/* <<UniPG */
|
||||
fprintf(stdout,"Parameters:\n");
|
||||
fprintf(stdout,"-----------\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout," -ImgDir \n");
|
||||
fprintf(stdout," -ImgDir <directory> \n");
|
||||
fprintf(stdout," Image file Directory path \n");
|
||||
fprintf(stdout," -OutFor \n");
|
||||
fprintf(stdout," -OutFor <PBM|PGM|PPM|PNM|PAM|PGX|PNG|BMP|TIF|RAW|RAWL|TGA>\n");
|
||||
fprintf(stdout," REQUIRED only if -ImgDir is used\n");
|
||||
fprintf(stdout," Need to specify only format without filename <BMP> \n");
|
||||
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA formats\n");
|
||||
fprintf(stdout," Output format for decompressed images.\n");
|
||||
fprintf(stdout," -i <compressed file>\n");
|
||||
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
|
||||
fprintf(stdout," REQUIRED only if an Input image directory is 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 <decompressed file>\n");
|
||||
fprintf(stdout," REQUIRED\n");
|
||||
fprintf(stdout," Currently accepts PGM, PPM, PNM, PGX, PNG, BMP, TIF, RAW and TGA files\n");
|
||||
fprintf(stdout," Currently accepts formats specified above (see OutFor option)\n");
|
||||
fprintf(stdout," Binary data is written to the file (not ascii). If a PGX\n");
|
||||
fprintf(stdout," filename is given, there will be as many output files as there are\n");
|
||||
fprintf(stdout," components: an indice starting from 0 will then be appended to the\n");
|
||||
@@ -222,7 +222,7 @@ int get_file_format(const char *filename) {
|
||||
if (ext == NULL)
|
||||
return -1;
|
||||
ext++;
|
||||
if(ext) {
|
||||
if(*ext) {
|
||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||
if(strcasecmp(ext, extension[i]) == 0) {
|
||||
return format[i];
|
||||
@@ -271,7 +271,7 @@ static int infile_format(const char *fname)
|
||||
const char *s, *magic_s;
|
||||
int ext_format, magic_format;
|
||||
unsigned char buf[12];
|
||||
unsigned int l_nb_read;
|
||||
OPJ_SIZE_T l_nb_read;
|
||||
|
||||
reader = fopen(fname, "rb");
|
||||
|
||||
@@ -325,7 +325,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
int totlen, c;
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||
{"OutFor",REQ_ARG, NULL ,'O'}
|
||||
};
|
||||
|
||||
const char optlist[] = "i:o:r:l:x:d:t:"
|
||||
@@ -335,7 +335,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
"W:"
|
||||
#endif /* USE_JPWL */
|
||||
/* <<UniPG */
|
||||
"h" ;
|
||||
"h" ;
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
do {
|
||||
@@ -361,7 +361,8 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
return 1;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"!! Unrecognized format for infile: %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
|
||||
"[ERROR] Unknown input file format: %s \n"
|
||||
" Known file formats are *.j2k, *.jp2, *.jpc or *.jpt\n",
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
@@ -447,7 +448,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'r': /* reduce option */
|
||||
{
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_reduce);
|
||||
sscanf(opj_optarg, "%ud", ¶meters->cp_reduce);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -456,7 +457,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 'l': /* layering option */
|
||||
{
|
||||
sscanf(opj_optarg, "%d", ¶meters->cp_layer);
|
||||
sscanf(opj_optarg, "%ud", ¶meters->cp_layer);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -466,10 +467,10 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
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;
|
||||
@@ -481,7 +482,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
case 'd': /* Input decode ROI */
|
||||
{
|
||||
int size_optarg = (int)strlen(opj_optarg) + 1;
|
||||
char *ROI_values = (char*) malloc(size_optarg);
|
||||
char *ROI_values = (char*) malloc((size_t)size_optarg);
|
||||
ROI_values[0] = '\0';
|
||||
strncpy(ROI_values, opj_optarg, strlen(opj_optarg));
|
||||
ROI_values[strlen(opj_optarg)] = '\0';
|
||||
@@ -496,7 +497,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
case 't': /* Input tile index */
|
||||
{
|
||||
sscanf(opj_optarg, "%d", ¶meters->tile_index);
|
||||
sscanf(opj_optarg, "%ud", ¶meters->tile_index);
|
||||
parameters->nb_tile_to_decode = 1;
|
||||
}
|
||||
break;
|
||||
@@ -583,31 +584,33 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "[WARNING] An invalid option has been ignored.\n");
|
||||
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");
|
||||
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");
|
||||
fprintf(stderr, "[ERROR] When -ImgDir is used, -OutFor <FORMAT> must be used.\n");
|
||||
fprintf(stderr, "Only one format allowed.\n"
|
||||
"Valid format are 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");
|
||||
fprintf(stderr, "[ERROR] options -ImgDir and -o cannot be used together.\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||
fprintf(stderr, "Example: %s -i image.j2k -o image.pgm\n",argv[0]);
|
||||
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||
fprintf(stderr, "[ERROR] Required parameters are missing\n"
|
||||
"Example: %s -i image.j2k -o image.pgm\n",argv[0]);
|
||||
fprintf(stderr, " Help: %s -h\n",argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -639,8 +642,8 @@ int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsi
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
else{
|
||||
*DA_x0 = values[0]; *DA_y0 = values[1];
|
||||
*DA_x1 = values[2]; *DA_y1 = values[3];
|
||||
*DA_x0 = (OPJ_UINT32)values[0]; *DA_y0 = (OPJ_UINT32)values[1];
|
||||
*DA_x1 = (OPJ_UINT32)values[2]; *DA_y1 = (OPJ_UINT32)values[3];
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -676,8 +679,6 @@ static void info_callback(const char *msg, void *client_data) {
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *fsrc = NULL;
|
||||
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
opj_image_t* image = NULL;
|
||||
opj_stream_t *l_stream = NULL; /* Stream */
|
||||
@@ -689,6 +690,7 @@ int main(int argc, char **argv)
|
||||
OPJ_INT32 num_images, imageno;
|
||||
img_fol_t img_fol;
|
||||
dircnt_t *dirptr = NULL;
|
||||
int failed = 0;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
@@ -711,8 +713,8 @@ int main(int argc, char **argv)
|
||||
|
||||
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*));
|
||||
dirptr->filename_buf = (char*)malloc((size_t)num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
|
||||
dirptr->filename = (char**) malloc((size_t)num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename_buf){
|
||||
return EXIT_FAILURE;
|
||||
@@ -746,16 +748,10 @@ int main(int argc, char **argv)
|
||||
|
||||
/* 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 EXIT_FAILURE;
|
||||
}
|
||||
|
||||
l_stream = opj_stream_create_default_file_stream(fsrc,1);
|
||||
l_stream = opj_stream_create_default_file_stream(parameters.infile,1);
|
||||
if (!l_stream){
|
||||
fclose(fsrc);
|
||||
fprintf(stderr, "ERROR -> failed to create the stream from the file\n");
|
||||
fprintf(stderr, "ERROR -> failed to create the stream from the file %s\n", parameters.infile);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -794,9 +790,8 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Setup the decoder decoding parameters using user parameters */
|
||||
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||
fprintf(stderr, "ERROR -> j2k_dump: failed to setup the decoder\n");
|
||||
fprintf(stderr, "ERROR -> opj_compress: failed to setup the decoder\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -806,7 +801,6 @@ int main(int argc, char **argv)
|
||||
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||
fprintf(stderr, "ERROR -> opj_decompress: failed to read the header\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
return EXIT_FAILURE;
|
||||
@@ -814,13 +808,12 @@ int main(int argc, char **argv)
|
||||
|
||||
if (!parameters.nb_tile_to_decode) {
|
||||
/* Optional if you want decode the entire image */
|
||||
if (!opj_set_decode_area(l_codec, image, parameters.DA_x0,
|
||||
parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)){
|
||||
if (!opj_set_decode_area(l_codec, image, (OPJ_INT32)parameters.DA_x0,
|
||||
(OPJ_INT32)parameters.DA_y0, (OPJ_INT32)parameters.DA_x1, (OPJ_INT32)parameters.DA_y1)){
|
||||
fprintf(stderr, "ERROR -> opj_decompress: failed to set the decoded area\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -830,7 +823,6 @@ int main(int argc, char **argv)
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
@@ -842,7 +834,6 @@ int main(int argc, char **argv)
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
}*/
|
||||
|
||||
@@ -851,7 +842,6 @@ int main(int argc, char **argv)
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_image_destroy(image);
|
||||
fclose(fsrc);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
fprintf(stdout, "tile %d is decoded!\n\n", parameters.tile_index);
|
||||
@@ -859,14 +849,20 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Close the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
fclose(fsrc);
|
||||
|
||||
if(image->color_space == OPJ_CLRSPC_SYCC){
|
||||
color_sycc_to_rgb(image); /* FIXME */
|
||||
}
|
||||
|
||||
if( image->color_space != OPJ_CLRSPC_SYCC
|
||||
&& image->numcomps == 3 && image->comps[0].dx == image->comps[0].dy
|
||||
&& image->comps[1].dx != 1 )
|
||||
image->color_space = OPJ_CLRSPC_SYCC;
|
||||
else if (image->numcomps <= 2)
|
||||
image->color_space = OPJ_CLRSPC_GRAY;
|
||||
|
||||
if(image->icc_profile_buf) {
|
||||
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
|
||||
#if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
|
||||
color_apply_icc_profile(image); /* FIXME */
|
||||
#endif
|
||||
free(image->icc_profile_buf);
|
||||
@@ -878,81 +874,90 @@ int main(int argc, char **argv)
|
||||
switch (parameters.cod_format) {
|
||||
case PXM_DFMT: /* PNM PGM PPM */
|
||||
if (imagetopnm(image, parameters.outfile)) {
|
||||
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
|
||||
case PGX_DFMT: /* PGX */
|
||||
if(imagetopgx(image, parameters.outfile)){
|
||||
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
|
||||
case BMP_DFMT: /* BMP */
|
||||
if(imagetobmp(image, parameters.outfile)){
|
||||
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#ifdef OPJ_HAVE_LIBTIFF
|
||||
case TIF_DFMT: /* TIFF */
|
||||
if(imagetotif(image, parameters.outfile)){
|
||||
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
#endif /* OPJ_HAVE_LIBTIFF */
|
||||
case RAW_DFMT: /* RAW */
|
||||
if(imagetoraw(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
|
||||
case RAWL_DFMT: /* RAWL */
|
||||
if(imagetorawl(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating rawl file. Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Error generating rawl file. Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
|
||||
case TGA_DFMT: /* TGA */
|
||||
if(imagetotga(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating tga file. Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Error generating tga file. Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LIBPNG
|
||||
#ifdef OPJ_HAVE_LIBPNG
|
||||
case PNG_DFMT: /* PNG */
|
||||
if(imagetopng(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating png file. Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Error generating png file. Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
fprintf(stdout,"[INFO] Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBPNG */
|
||||
#endif /* OPJ_HAVE_LIBPNG */
|
||||
/* Can happen if output file is TIFF or PNG
|
||||
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
|
||||
* and OPJ_HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
|
||||
*/
|
||||
default:
|
||||
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
|
||||
fprintf(stderr,"[ERROR] Outfile %s not generated\n",parameters.outfile);
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
/* free remaining structures */
|
||||
@@ -967,8 +972,9 @@ int main(int argc, char **argv)
|
||||
/* destroy the codestream index */
|
||||
opj_destroy_cstr_index(&cstr_index);
|
||||
|
||||
if(failed) remove(parameters.outfile);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
/*end main*/
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2010, Mathieu Malaterre, GDCM
|
||||
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
@@ -71,34 +76,29 @@ typedef struct img_folder{
|
||||
/** Enable Cod Format for output*/
|
||||
char set_out_format;
|
||||
|
||||
int flag;
|
||||
}img_fol_t;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Declarations */
|
||||
int get_num_images(char *imgdirpath);
|
||||
int load_images(dircnt_t *dirptr, char *imgdirpath);
|
||||
int get_file_format(const char *filename);
|
||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters);
|
||||
static int get_num_images(char *imgdirpath);
|
||||
static int load_images(dircnt_t *dirptr, char *imgdirpath);
|
||||
static int get_file_format(const char *filename);
|
||||
static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters);
|
||||
static int infile_format(const char *fname);
|
||||
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol);
|
||||
int parse_DA_values( char* inArg, unsigned int *DA_x0, unsigned int *DA_y0, unsigned int *DA_x1, unsigned int *DA_y1);
|
||||
static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
static void decode_help_display(void) {
|
||||
fprintf(stdout,"HELP for opj_dump\n----\n\n");
|
||||
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||
fprintf(stdout,"\nThis is the opj_dump utility from the OpenJPEG project.\n"
|
||||
"It dumps JPEG 2000 codestream info to stdout or a given file.\n"
|
||||
"It has been compiled against openjp2 library v%s.\n\n",opj_version());
|
||||
|
||||
/* 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,"Parameters:\n");
|
||||
fprintf(stdout,"-----------\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout," -ImgDir <directory>\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");
|
||||
@@ -108,15 +108,15 @@ static void decode_help_display(void) {
|
||||
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," -v "); /* FIXME WIP_MSD */
|
||||
fprintf(stdout," -v "); /* FIXME WIP_MSD */
|
||||
fprintf(stdout," OPTIONAL\n");
|
||||
fprintf(stdout," Activate or not the verbose mode (display info and warning message)\n");
|
||||
fprintf(stdout," By default verbose mode is off.\n");
|
||||
fprintf(stdout," Enable informative messages\n");
|
||||
fprintf(stdout," By default verbose mode is off.\n");
|
||||
fprintf(stdout,"\n");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int get_num_images(char *imgdirpath){
|
||||
static int get_num_images(char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int num_images = 0;
|
||||
@@ -138,7 +138,7 @@ int get_num_images(char *imgdirpath){
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
static int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
DIR *dir;
|
||||
struct dirent* content;
|
||||
int i = 0;
|
||||
@@ -164,7 +164,7 @@ int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int get_file_format(const char *filename) {
|
||||
static int get_file_format(const 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 };
|
||||
@@ -184,7 +184,7 @@ int get_file_format(const char *filename) {
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
||||
static char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
||||
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
||||
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||
|
||||
@@ -221,7 +221,7 @@ static int infile_format(const char *fname)
|
||||
const char *s, *magic_s;
|
||||
int ext_format, magic_format;
|
||||
unsigned char buf[12];
|
||||
unsigned int l_nb_read;
|
||||
size_t l_nb_read;
|
||||
|
||||
reader = fopen(fname, "rb");
|
||||
|
||||
@@ -269,12 +269,12 @@ static int infile_format(const char *fname)
|
||||
* Parse the command line
|
||||
*/
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||
static int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||
int totlen, c;
|
||||
opj_option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'}
|
||||
};
|
||||
const char optlist[] = "i:o:hv";
|
||||
const char optlist[] = "i:o:f:hv";
|
||||
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
@@ -293,12 +293,13 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
case JP2_CFMT:
|
||||
break;
|
||||
case JPT_CFMT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
|
||||
infile);
|
||||
return 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr,
|
||||
"[ERROR] Unknown input file format: %s \n"
|
||||
" Known file formats are *.j2k, *.jp2, *.jpc or *.jpt\n",
|
||||
infile);
|
||||
return 1;
|
||||
}
|
||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||
}
|
||||
@@ -314,6 +315,10 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
case 'f': /* flag */
|
||||
img_fol->flag = atoi(opj_optarg);
|
||||
break;
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
case 'h': /* display an help description */
|
||||
decode_help_display();
|
||||
@@ -331,38 +336,40 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
case 'v': /* Verbose mode */
|
||||
case 'v': /* Verbose mode */
|
||||
{
|
||||
parameters->m_verbose = 1;
|
||||
parameters->m_verbose = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
/* ----------------------------------------------------- */
|
||||
default:
|
||||
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, opj_optarg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fprintf(stderr, "[WARNING] An invalid option has been ignored.\n");
|
||||
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");
|
||||
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");
|
||||
fprintf(stderr, "[ERROR] When -ImgDir is used, -OutFor <FORMAT> must be used.\n");
|
||||
fprintf(stderr, "Only one format allowed.\n"
|
||||
"Valid format are 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");
|
||||
fprintf(stderr, "[ERROR] options -ImgDir and -o cannot be used together\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
if(parameters->infile[0] == 0) {
|
||||
fprintf(stderr, "[ERROR] Required parameter is missing\n");
|
||||
fprintf(stderr, "Example: %s -i image.j2k\n",argv[0]);
|
||||
fprintf(stderr, " Try: %s -h\n",argv[0]);
|
||||
fprintf(stderr, " Help: %s -h\n",argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -401,7 +408,7 @@ static void info_callback(const char *msg, void *client_data) {
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *fsrc = NULL, *fout = NULL;
|
||||
FILE *fout = NULL;
|
||||
|
||||
opj_dparameters_t parameters; /* Decompression parameters */
|
||||
opj_image_t* image = NULL; /* Image structure */
|
||||
@@ -425,6 +432,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Initialize img_fol */
|
||||
memset(&img_fol,0,sizeof(img_fol_t));
|
||||
img_fol.flag = OPJ_IMG_INFO | OPJ_J2K_MH_INFO | OPJ_J2K_MH_IND;
|
||||
|
||||
/* Parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||
@@ -438,8 +446,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
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*));
|
||||
dirptr->filename_buf = (char*)malloc((size_t)num_images*OPJ_PATH_LEN*sizeof(char)); /* Stores at max 10 image file names*/
|
||||
dirptr->filename = (char**) malloc((size_t)num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename_buf){
|
||||
return EXIT_FAILURE;
|
||||
@@ -486,16 +494,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* 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 EXIT_FAILURE;
|
||||
}
|
||||
|
||||
l_stream = opj_stream_create_default_file_stream(fsrc,1);
|
||||
l_stream = opj_stream_create_default_file_stream(parameters.infile,1);
|
||||
if (!l_stream){
|
||||
fclose(fsrc);
|
||||
fprintf(stderr, "ERROR -> failed to create the stream from the file\n");
|
||||
fprintf(stderr, "ERROR -> failed to create the stream from the file %s\n",parameters.infile);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -536,7 +538,6 @@ int main(int argc, char *argv[])
|
||||
if ( !opj_setup_decoder(l_codec, ¶meters) ){
|
||||
fprintf(stderr, "ERROR -> opj_dump: failed to setup the decoder\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
fclose(fout);
|
||||
return EXIT_FAILURE;
|
||||
@@ -546,14 +547,13 @@ int main(int argc, char *argv[])
|
||||
if(! opj_read_header(l_stream, l_codec, &image)){
|
||||
fprintf(stderr, "ERROR -> opj_dump: failed to read the header\n");
|
||||
opj_stream_destroy(l_stream);
|
||||
fclose(fsrc);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
fclose(fout);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
opj_dump_codec(l_codec, OPJ_IMG_INFO | OPJ_J2K_MH_INFO | OPJ_J2K_MH_IND, fout );
|
||||
opj_dump_codec(l_codec, img_fol.flag, fout );
|
||||
|
||||
cstr_info = opj_get_cstr_info(l_codec);
|
||||
|
||||
@@ -561,7 +561,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* close the byte stream */
|
||||
opj_stream_destroy(l_stream);
|
||||
fclose(fsrc);
|
||||
|
||||
/* free remaining structures */
|
||||
if (l_codec) {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
|
||||
|
||||
@@ -488,7 +488,7 @@ int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters)
|
||||
|
||||
case 's': /* subsampling factor */
|
||||
{
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->subsampling_dx, ¶meters->subsampling_dy, ¶meters->subsampling_dz) != 2) {
|
||||
if (sscanf(opj_optarg, "%d,%d,%d", ¶meters->subsampling_dx, ¶meters->subsampling_dy, ¶meters->subsampling_dz) != 3) {
|
||||
fprintf(stdout, "[ERROR] '-s' sub-sampling argument error ! [-s dx,dy,dz]\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -518,7 +518,8 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout, "[RESULT] Volume: %d x %d x %d (x %d bpv)\n ",
|
||||
(volume->comps[0].w >> volume->comps[0].factor[0]),
|
||||
(volume->comps[0].h >> volume->comps[0].factor[1]),
|
||||
(volume->comps[0].l >> volume->comps[0].factor[2]),volume->comps[0].prec);
|
||||
(volume->comps[0].l >> volume->comps[0].factor[2]),
|
||||
volume->comps[0].prec);
|
||||
|
||||
if(original){
|
||||
psnr = calc_PSNR(original,volume);
|
||||
|
||||
@@ -23,7 +23,7 @@ if(BUILD_JPIP_SERVER)
|
||||
|
||||
# Build executable
|
||||
add_executable(opj_server ${OPJ_SERVER_SRCS})
|
||||
target_link_libraries(opj_server openjpip_server)
|
||||
target_link_libraries(opj_server ${FCGI_LIBRARIES} openjpip_server)
|
||||
set_property(
|
||||
TARGET opj_server
|
||||
APPEND PROPERTY
|
||||
@@ -59,6 +59,14 @@ endforeach()
|
||||
# Build the two java clients:
|
||||
find_package(Java 1.5 COMPONENTS Development) # javac, jar
|
||||
|
||||
# User can override this:
|
||||
if(NOT DEFINED JAVA_SOURCE_VERSION)
|
||||
set(JAVA_SOURCE_VERSION 1.5)
|
||||
endif()
|
||||
if(NOT DEFINED JAVA_TARGET_VERSION)
|
||||
set(JAVA_TARGET_VERSION 1.5)
|
||||
endif()
|
||||
|
||||
# Only build the java viewer if dev is found:
|
||||
if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
|
||||
set(jflags $ENV{JFLAGS})
|
||||
@@ -97,6 +105,7 @@ if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
|
||||
add_custom_command(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
|
||||
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
|
||||
-classpath ${APACHE_XERCES_JAR}
|
||||
${java2_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes2
|
||||
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
|
||||
@@ -127,6 +136,7 @@ if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
|
||||
add_custom_command(
|
||||
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
|
||||
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
|
||||
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
|
||||
${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1
|
||||
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt -C
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: opj_dec_server.c 54 2011-05-10 13:22:47Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: addXMLinJP2.c 46 2011-02-17 14:50:55Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: test_index.c 46 2011-02-17 14:50:55Z kaori $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -42,28 +42,21 @@
|
||||
* or
|
||||
* % ./jpip_to_jp2 input.jpp output.jp2
|
||||
*/
|
||||
static int jpip_to_jp2(int argc,char *argv[])
|
||||
static int jpip_to_jp2(char *argv[])
|
||||
{
|
||||
jpip_dec_param_t *dec;
|
||||
|
||||
if( argc < 3){
|
||||
fprintf( stderr, "Too few arguments:\n");
|
||||
fprintf( stderr, " - input jpt or jpp file\n");
|
||||
fprintf( stderr, " - output jp2 file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
dec = init_jpipdecoder( OPJ_TRUE);
|
||||
|
||||
if(!( fread_jpip( argv[1], dec)))
|
||||
return -1;
|
||||
return 1;
|
||||
|
||||
decode_jpip( dec);
|
||||
|
||||
if(!(fwrite_jp2k( argv[2], dec)))
|
||||
return -1;
|
||||
return 1;
|
||||
|
||||
output_log( OPJ_TRUE, OPJ_FALSE, OPJ_TRUE, dec);
|
||||
/* output_log( OPJ_TRUE, OPJ_FALSE, OPJ_TRUE, dec); */
|
||||
|
||||
destroy_jpipdecoder( &dec);
|
||||
|
||||
@@ -81,26 +74,19 @@ static int jpip_to_jp2(int argc,char *argv[])
|
||||
* or
|
||||
* % ./jpip_to_j2k input.jpp output.j2k
|
||||
*/
|
||||
static int jpip_to_j2k(int argc,char *argv[])
|
||||
static int jpip_to_j2k(char *argv[])
|
||||
{
|
||||
jpip_dec_param_t *dec;
|
||||
|
||||
if( argc < 3){
|
||||
fprintf( stderr, "Too few arguments:\n");
|
||||
fprintf( stderr, " - input jpt or jpp file\n");
|
||||
fprintf( stderr, " - output j2k file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
dec = init_jpipdecoder( OPJ_FALSE);
|
||||
|
||||
if(!( fread_jpip( argv[1], dec)))
|
||||
return -1;
|
||||
return 1;
|
||||
|
||||
decode_jpip( dec);
|
||||
|
||||
if(!( fwrite_jp2k( argv[2], dec)))
|
||||
return -1;
|
||||
if(!(fwrite_jp2k( argv[2], dec)))
|
||||
return 1;
|
||||
|
||||
/* output_log( OPJ_TRUE, OPJ_FALSE, OPJ_FALSE, dec); */
|
||||
|
||||
@@ -111,6 +97,28 @@ static int jpip_to_j2k(int argc,char *argv[])
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
/* MM: FIXME */
|
||||
return jpip_to_jp2(argc,argv);
|
||||
char *ext;
|
||||
if( argc < 3){
|
||||
fprintf( stderr, "Too few arguments:\n");
|
||||
fprintf( stderr, " - input jpt or jpp file\n");
|
||||
fprintf( stderr, " - output j2k file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
ext = strrchr( argv[2], '.' );
|
||||
if( ext )
|
||||
{
|
||||
/* strcasecmp ? */
|
||||
if( strcmp(ext, ".jp2" ) == 0 )
|
||||
{
|
||||
return jpip_to_jp2(argv);
|
||||
}
|
||||
if( strcmp(ext, ".j2k" ) == 0 )
|
||||
{
|
||||
return jpip_to_j2k(argv);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( stderr, "Invalid file extension for output file: %s\n", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: opj_server.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
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* Copyright (c) 2011, Lucian Corlaciu, GSoC
|
||||
* All rights reserved.
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "fcgi_stdio.h"
|
||||
#include "openjpip.h"
|
||||
|
||||
#ifndef QUIT_SIGNAL
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $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) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -11,6 +11,7 @@ set(common_SRCS
|
||||
# Headers file are located here:
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||
${LCMS_INCLUDE_DIRNAME}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* All rights reserved.
|
||||
@@ -29,21 +35,21 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#ifdef OPJ_HAVE_LIBTIFF
|
||||
#include <tiffio.h>
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
#endif /* OPJ_HAVE_LIBTIFF */
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
#ifdef OPJ_HAVE_LIBPNG
|
||||
#include <zlib.h>
|
||||
#include <png.h>
|
||||
#endif /* HAVE_LIBPNG */
|
||||
#endif /* OPJ_HAVE_LIBPNG */
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "convert.h"
|
||||
@@ -94,7 +100,7 @@ struct tga_header
|
||||
|
||||
static unsigned short get_ushort(unsigned short val) {
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef OPJ_BIG_ENDIAN
|
||||
return( ((val & 0xff) << 8) + (val >> 8) );
|
||||
#else
|
||||
return( val );
|
||||
@@ -179,7 +185,7 @@ static int tga_readheader(FILE *fp, unsigned int *bits_per_pixel,
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if WORDS_BIGENDIAN == 1
|
||||
#ifdef OPJ_BIG_ENDIAN
|
||||
|
||||
static inline int16_t swap16(int16_t x)
|
||||
{
|
||||
@@ -226,7 +232,7 @@ static int tga_writeheader(FILE *fp, int bits_per_pixel, int width, int height,
|
||||
image_w = (unsigned short)width;
|
||||
image_h = (unsigned short) height;
|
||||
|
||||
#if WORDS_BIGENDIAN == 0
|
||||
#ifndef OPJ_BIG_ENDIAN
|
||||
if(fwrite(&image_w, 2, 1, fp) != 1) goto fails;
|
||||
if(fwrite(&image_h, 2, 1, fp) != 1) goto fails;
|
||||
#else
|
||||
@@ -2074,7 +2080,7 @@ int imagetopnm(opj_image_t * image, const char *outfile)
|
||||
return 0;
|
||||
}/* imagetopnm() */
|
||||
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#ifdef OPJ_HAVE_LIBTIFF
|
||||
/* -->> -->> -->> -->>
|
||||
|
||||
TIFF IMAGE FORMAT
|
||||
@@ -2781,7 +2787,7 @@ opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters)
|
||||
|
||||
}/* tiftoimage() */
|
||||
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
#endif /* OPJ_HAVE_LIBTIFF */
|
||||
|
||||
/* -->> -->> -->> -->>
|
||||
|
||||
@@ -3027,7 +3033,7 @@ int imagetoraw(opj_image_t * image, const char *outfile)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBPNG
|
||||
#ifdef OPJ_HAVE_LIBPNG
|
||||
|
||||
#define PNG_MAGIC "\x89PNG\x0d\x0a\x1a\x0a"
|
||||
#define MAGIC_SIZE 8
|
||||
@@ -3560,4 +3566,4 @@ fin:
|
||||
|
||||
return fails;
|
||||
}/* imagetopng() */
|
||||
#endif /* HAVE_LIBPNG */
|
||||
#endif /* OPJ_HAVE_LIBPNG */
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* All rights reserved.
|
||||
@@ -49,7 +55,7 @@
|
||||
#include <strings.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
@@ -1627,7 +1633,7 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#ifdef OPJ_HAVE_LIBTIFF
|
||||
case TIF_DFMT:
|
||||
image = tiftoimage(parameters.infile, ¶meters);
|
||||
if (!image) {
|
||||
@@ -1635,7 +1641,7 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
#endif /* OPJ_HAVE_LIBTIFF */
|
||||
case RAW_DFMT:
|
||||
image = rawtoimage(parameters.infile, ¶meters, &raw_cp);
|
||||
if (!image) {
|
||||
@@ -1651,7 +1657,7 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LIBPNG
|
||||
#ifdef OPJ_HAVE_LIBPNG
|
||||
case PNG_DFMT:
|
||||
image = pngtoimage(parameters.infile, ¶meters);
|
||||
if (!image) {
|
||||
@@ -1659,10 +1665,10 @@ int main(int argc, char **argv) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBPNG */
|
||||
#endif /* OPJ_HAVE_LIBPNG */
|
||||
}
|
||||
/* Can happen if input file is TIFF or PNG
|
||||
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
|
||||
* and OPJ_HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
|
||||
*/
|
||||
if( !image)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* All rights reserved.
|
||||
@@ -49,16 +55,16 @@
|
||||
#define _strnicmp strncasecmp
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "opj_getopt.h"
|
||||
#include "convert.h"
|
||||
#include "index.h"
|
||||
|
||||
#ifdef HAVE_LIBLCMS2
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
#include <lcms2.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
#include "color.h"
|
||||
@@ -753,7 +759,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
if(image->icc_profile_buf)
|
||||
{
|
||||
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
|
||||
#if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
|
||||
color_apply_icc_profile(image);
|
||||
#endif
|
||||
|
||||
@@ -790,7 +796,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#ifdef OPJ_HAVE_LIBTIFF
|
||||
case TIF_DFMT: /* TIFF */
|
||||
if(imagetotif(image, parameters.outfile)){
|
||||
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||
@@ -799,7 +805,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBTIFF */
|
||||
#endif /* OPJ_HAVE_LIBTIFF */
|
||||
case RAW_DFMT: /* RAW */
|
||||
if(imagetoraw(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
||||
@@ -817,7 +823,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#ifdef HAVE_LIBPNG
|
||||
#ifdef OPJ_HAVE_LIBPNG
|
||||
case PNG_DFMT: /* PNG */
|
||||
if(imagetopng(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating png file. Outfile %s not generated\n",parameters.outfile);
|
||||
@@ -826,9 +832,9 @@ int main(int argc, char **argv) {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_LIBPNG */
|
||||
#endif /* OPJ_HAVE_LIBPNG */
|
||||
/* Can happen if output file is TIFF or PNG
|
||||
* and HAVE_LIBTIF or HAVE_LIBPNG is undefined
|
||||
* and OPJ_HAVE_LIBTIF or OPJ_HAVE_LIBPNG is undefined
|
||||
*/
|
||||
default:
|
||||
fprintf(stderr,"Outfile %s not generated\n",parameters.outfile);
|
||||
|
||||
@@ -13,6 +13,7 @@ endif()
|
||||
# Headers file are located here:
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_BINARY_DIR}/src/bin/common # opj_apps_config.h
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openmj2
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common
|
||||
${LCMS_INCLUDE_DIRNAME}
|
||||
@@ -31,6 +32,10 @@ foreach(exe
|
||||
${MJ2_SRCS}
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin/common/color.c
|
||||
)
|
||||
set_property(
|
||||
TARGET ${exe}
|
||||
APPEND PROPERTY COMPILE_DEFINITIONS USE_MJ2
|
||||
)
|
||||
target_link_libraries(${exe} ${LCMS_LIBNAME} openmj2)
|
||||
|
||||
if(UNIX)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "j2k_lib.h"
|
||||
#include "cio.h"
|
||||
@@ -61,13 +61,6 @@ static 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) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[INFO] %s", msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_apps_config.h"
|
||||
#include "openjpeg.h"
|
||||
#include "j2k_lib.h"
|
||||
#include "cio.h"
|
||||
@@ -38,10 +38,10 @@
|
||||
#include "mj2.h"
|
||||
#include "mj2_convert.h"
|
||||
|
||||
#ifdef HAVE_LIBLCMS2
|
||||
#ifdef OPJ_HAVE_LIBLCMS2
|
||||
#include <lcms2.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBLCMS1
|
||||
#ifdef OPJ_HAVE_LIBLCMS1
|
||||
#include <lcms.h>
|
||||
#endif
|
||||
#include "color.h"
|
||||
@@ -61,13 +61,6 @@ static 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) {
|
||||
FILE *stream = (FILE*)client_data;
|
||||
fprintf(stream, "[INFO] %s", msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@@ -188,7 +181,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if(img->icc_profile_buf)
|
||||
{
|
||||
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
|
||||
#if defined(OPJ_HAVE_LIBLCMS1) || defined(OPJ_HAVE_LIBLCMS2)
|
||||
color_apply_icc_profile(img);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,7 @@ include_directories(
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib
|
||||
${OPENJPEG_SOURCE_DIR}/src/bin
|
||||
${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
|
||||
)
|
||||
|
||||
# original flags:
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'<27> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'<27> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita'<27> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita' degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universita degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2014, 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
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -5,7 +5,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h
|
||||
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers)
|
||||
|
||||
include_directories(
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
|
||||
${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
|
||||
)
|
||||
# Defines the source code for the library
|
||||
set(OPENJPEG_SRCS
|
||||
@@ -68,10 +68,12 @@ install(FILES openjpeg.h opj_stdint.h
|
||||
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
|
||||
)
|
||||
|
||||
if(BUILD_DOC)
|
||||
# install man page of the library
|
||||
install(
|
||||
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3
|
||||
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
|
||||
endif()
|
||||
|
||||
# internal utilities to generate t1_luts.h (part of the jp2 lib)
|
||||
# no need to install:
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -146,17 +152,17 @@ void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len) {
|
||||
}
|
||||
|
||||
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n) {
|
||||
OPJ_INT32 i;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
OPJ_UINT32 i;
|
||||
for (i = n - 1; i < n; i--) {
|
||||
opj_bio_putbit(bio, (v >> i) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n) {
|
||||
OPJ_INT32 i;
|
||||
OPJ_UINT32 i;
|
||||
OPJ_UINT32 v;
|
||||
v = 0;
|
||||
for (i = n - 1; i >= 0; i--) {
|
||||
for (i = n - 1; i < n; i--) {
|
||||
v += opj_bio_getbit(bio) << i;
|
||||
}
|
||||
return v;
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: cidx_manager.c 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
@@ -79,25 +79,25 @@ int opj_write_cidx( int offset, opj_stream_private_t *cio, opj_codestream_info_t
|
||||
opj_write_manf( i, num_box, box, cio,p_manager);
|
||||
|
||||
num_box = 0;
|
||||
box[num_box].length = opj_write_mainmhix( offset, cstr_info, cio,p_manager);
|
||||
box[num_box].length = (OPJ_UINT32)opj_write_mainmhix( offset, cstr_info, cio,p_manager);
|
||||
box[num_box].type = JPIP_MHIX;
|
||||
num_box++;
|
||||
|
||||
box[num_box].length = opj_write_tpix( offset, cstr_info, j2klen, cio,p_manager);
|
||||
box[num_box].length = (OPJ_UINT32)opj_write_tpix( offset, cstr_info, j2klen, cio,p_manager);
|
||||
box[num_box].type = JPIP_TPIX;
|
||||
num_box++;
|
||||
|
||||
box[num_box].length = opj_write_thix( offset, cstr_info, cio, p_manager);
|
||||
box[num_box].length = (OPJ_UINT32)opj_write_thix( offset, cstr_info, cio, p_manager);
|
||||
box[num_box].type = JPIP_THIX;
|
||||
num_box++;
|
||||
|
||||
EPHused = opj_check_EPHuse( offset, cstr_info.marker, cstr_info.marknum, cio,p_manager);
|
||||
|
||||
box[num_box].length = opj_write_ppix( offset, cstr_info, EPHused, j2klen, cio,p_manager);
|
||||
box[num_box].length = (OPJ_UINT32)opj_write_ppix( offset, cstr_info, EPHused, j2klen, cio,p_manager);
|
||||
box[num_box].type = JPIP_PPIX;
|
||||
num_box++;
|
||||
|
||||
box[num_box].length = opj_write_phix( offset, cstr_info, EPHused, j2klen, cio,p_manager);
|
||||
box[num_box].length = (OPJ_UINT32)opj_write_phix( offset, cstr_info, EPHused, j2klen, cio,p_manager);
|
||||
box[num_box].type = JPIP_PHIX;
|
||||
num_box++;
|
||||
|
||||
@@ -110,7 +110,7 @@ int opj_write_cidx( int offset, opj_stream_private_t *cio, opj_codestream_info_t
|
||||
|
||||
opj_free( box);
|
||||
|
||||
return len;
|
||||
return (int)len;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ void opj_write_cptr(int coff, int clen, opj_stream_private_t *cio,
|
||||
opj_write_bytes( l_data_header, JPIP_CPTR, 4); /* T */
|
||||
opj_write_bytes( l_data_header+4, 0, 2); /* DR A PRECISER !! */
|
||||
opj_write_bytes( l_data_header+6, 0, 2); /* CONT */
|
||||
opj_write_bytes( l_data_header+8, coff, 8); /* COFF A PRECISER !! */
|
||||
opj_write_bytes( l_data_header+16, clen, 8); /* CLEN */
|
||||
opj_write_bytes( l_data_header+8, (OPJ_UINT32)coff, 8); /* COFF A PRECISER !! */
|
||||
opj_write_bytes( l_data_header+16, (OPJ_UINT32)clen, 8); /* CLEN */
|
||||
opj_stream_write_data(cio,l_data_header,3*8,p_manager);
|
||||
|
||||
len = (OPJ_UINT32) (opj_stream_tell(cio) - lenp);
|
||||
@@ -179,7 +179,7 @@ int opj_write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_stream_pr
|
||||
opj_event_mgr_t * p_manager )
|
||||
{
|
||||
OPJ_BYTE l_data_header [8];
|
||||
int i;
|
||||
OPJ_UINT32 i;
|
||||
OPJ_UINT32 len;
|
||||
OPJ_OFF_T lenp;
|
||||
|
||||
@@ -188,16 +188,16 @@ int opj_write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_stream_pr
|
||||
opj_write_bytes(l_data_header,JPIP_MHIX,4); /* MHIX */
|
||||
opj_stream_write_data(cio,l_data_header,4,p_manager);
|
||||
|
||||
opj_write_bytes(l_data_header, cstr_info.main_head_end-cstr_info.main_head_start+1, 8); /* TLEN */
|
||||
opj_write_bytes(l_data_header, (OPJ_UINT32)(cstr_info.main_head_end-cstr_info.main_head_start+1), 8); /* TLEN */
|
||||
opj_stream_write_data(cio,l_data_header,8,p_manager);
|
||||
|
||||
for(i = 1; i < cstr_info.marknum; i++){ /* Marker restricted to 1 apparition, skip SOC marker */
|
||||
for(i = 1; i < (OPJ_UINT32)cstr_info.marknum; i++){ /* Marker restricted to 1 apparition, skip SOC marker */
|
||||
opj_write_bytes( l_data_header, cstr_info.marker[i].type, 2);
|
||||
opj_write_bytes( l_data_header+2, 0, 2);
|
||||
opj_stream_write_data(cio,l_data_header,4,p_manager);
|
||||
opj_write_bytes( l_data_header,(OPJ_UINT32) (cstr_info.marker[i].pos-coff), 8);
|
||||
opj_stream_write_data(cio,l_data_header,8,p_manager);
|
||||
opj_write_bytes( l_data_header, cstr_info.marker[i].len, 2);
|
||||
opj_write_bytes( l_data_header, (OPJ_UINT32)cstr_info.marker[i].len, 2);
|
||||
opj_stream_write_data(cio,l_data_header,2,p_manager);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ int opj_write_mainmhix( int coff, opj_codestream_info_t cstr_info, opj_stream_pr
|
||||
opj_stream_write_data(cio,l_data_header,4,p_manager);
|
||||
opj_stream_seek(cio, lenp+len,p_manager);
|
||||
|
||||
return len;
|
||||
return (int)len;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_check_EPHuse( int coff, opj_marker_info_t *markers, int marknum, opj_stream_private_t *cio,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: cidx_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -189,6 +195,9 @@ void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream)
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
|
||||
if (l_stream) {
|
||||
if (l_stream->m_free_user_data_fn) {
|
||||
l_stream->m_free_user_data_fn(l_stream->m_user_data);
|
||||
}
|
||||
opj_free(l_stream->m_stored_data);
|
||||
l_stream->m_stored_data = 00;
|
||||
opj_free(l_stream);
|
||||
@@ -238,15 +247,20 @@ void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, opj_strea
|
||||
l_stream->m_skip_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_user_data(opj_stream_t* p_stream, void * p_data)
|
||||
void OPJ_CALLCONV opj_stream_set_user_data(opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
if (!l_stream)
|
||||
return;
|
||||
l_stream->m_user_data = p_data;
|
||||
l_stream->m_free_user_data_fn = p_function;
|
||||
}
|
||||
|
||||
void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT64 data_length)
|
||||
{
|
||||
opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream;
|
||||
if (!l_stream)
|
||||
return;
|
||||
l_stream->m_user_data_length = data_length;
|
||||
}
|
||||
|
||||
@@ -503,7 +517,6 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
|
||||
if (! l_is_written) {
|
||||
p_stream->m_status |= opj_stream_e_error;
|
||||
p_stream->m_bytes_in_buffer = 0;
|
||||
p_stream->m_current_data = p_stream->m_current_data;
|
||||
return (OPJ_OFF_T) -1;
|
||||
}
|
||||
/* then skip */
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -43,7 +49,7 @@ The functions in CIO.C have for goal to realize a byte input / output process.
|
||||
/** @defgroup CIO CIO - byte input-output stream */
|
||||
/*@{*/
|
||||
|
||||
#include "opj_config.h"
|
||||
#include "opj_config_private.h"
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
@@ -85,6 +91,13 @@ typedef struct opj_stream_private
|
||||
*/
|
||||
void * m_user_data;
|
||||
|
||||
/**
|
||||
* Pointer to function to free m_user_data (NULL at initialization)
|
||||
* when destroying the stream. If pointer is NULL the function is not
|
||||
* called and the m_user_data is not freed (even if non-NULL).
|
||||
*/
|
||||
opj_stream_free_user_data_fn m_free_user_data_fn;
|
||||
|
||||
/**
|
||||
* User data length
|
||||
*/
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2007, Jonathan Ballard <dzonatas@dzonux.net>
|
||||
* Copyright (c) 2007, Callum Lerwick <seg@haxxed.com>
|
||||
@@ -389,23 +395,20 @@ INLINE OPJ_BOOL opj_dwt_encode_procedure(opj_tcd_tilecomp_t * tilec,void (*p_fun
|
||||
|
||||
OPJ_INT32 rw; /* width of the resolution level computed */
|
||||
OPJ_INT32 rh; /* height of the resolution level computed */
|
||||
OPJ_INT32 l_data_size;
|
||||
OPJ_UINT32 l_data_size;
|
||||
|
||||
opj_tcd_resolution_t * l_cur_res = 0;
|
||||
opj_tcd_resolution_t * l_last_res = 0;
|
||||
|
||||
w = tilec->x1-tilec->x0;
|
||||
l = tilec->numresolutions-1;
|
||||
l = (OPJ_INT32)tilec->numresolutions-1;
|
||||
a = tilec->data;
|
||||
|
||||
l_cur_res = tilec->resolutions + l;
|
||||
l_last_res = l_cur_res - 1;
|
||||
|
||||
rw = l_cur_res->x1 - l_cur_res->x0;
|
||||
rh = l_cur_res->y1 - l_cur_res->y0;
|
||||
|
||||
l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * sizeof(OPJ_INT32);
|
||||
bj = (OPJ_INT32*)opj_malloc(l_data_size);
|
||||
l_data_size = opj_dwt_max_resolution( tilec->resolutions,tilec->numresolutions) * (OPJ_UINT32)sizeof(OPJ_INT32);
|
||||
bj = (OPJ_INT32*)opj_malloc((size_t)l_data_size);
|
||||
if (! bj) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
@@ -531,7 +534,7 @@ void opj_dwt_calc_explicit_stepsizes(opj_tccp_t * tccp, OPJ_UINT32 prec) {
|
||||
OPJ_FLOAT64 norm = opj_dwt_norms_real[orient][level];
|
||||
stepsize = (1 << (gain)) / norm;
|
||||
}
|
||||
opj_dwt_encode_stepsize((OPJ_INT32) floor(stepsize * 8192.0), prec + gain, &tccp->stepsizes[bandno]);
|
||||
opj_dwt_encode_stepsize((OPJ_INT32) floor(stepsize * 8192.0), (OPJ_INT32)(prec + gain), &tccp->stepsizes[bandno]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,9 +546,9 @@ OPJ_UINT32 opj_dwt_max_resolution(opj_tcd_resolution_t* restrict r, OPJ_UINT32 i
|
||||
OPJ_UINT32 w;
|
||||
while( --i ) {
|
||||
++r;
|
||||
if( mr < ( w = r->x1 - r->x0 ) )
|
||||
if( mr < ( w = (OPJ_UINT32)(r->x1 - r->x0) ) )
|
||||
mr = w ;
|
||||
if( mr < ( w = r->y1 - r->y0 ) )
|
||||
if( mr < ( w = (OPJ_UINT32)(r->y1 - r->y0) ) )
|
||||
mr = w ;
|
||||
}
|
||||
return mr ;
|
||||
@@ -560,10 +563,10 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
|
||||
|
||||
opj_tcd_resolution_t* tr = tilec->resolutions;
|
||||
|
||||
OPJ_UINT32 rw = tr->x1 - tr->x0; /* width of the resolution level computed */
|
||||
OPJ_UINT32 rh = tr->y1 - tr->y0; /* height of the resolution level computed */
|
||||
OPJ_UINT32 rw = (OPJ_UINT32)(tr->x1 - tr->x0); /* width of the resolution level computed */
|
||||
OPJ_UINT32 rh = (OPJ_UINT32)(tr->y1 - tr->y0); /* height of the resolution level computed */
|
||||
|
||||
OPJ_UINT32 w = tilec->x1 - tilec->x0;
|
||||
OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0);
|
||||
|
||||
h.mem = (OPJ_INT32*)
|
||||
opj_aligned_malloc(opj_dwt_max_resolution(tr, numres) * sizeof(OPJ_INT32));
|
||||
@@ -578,13 +581,13 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
|
||||
OPJ_UINT32 j;
|
||||
|
||||
++tr;
|
||||
h.sn = rw;
|
||||
v.sn = rh;
|
||||
h.sn = (OPJ_INT32)rw;
|
||||
v.sn = (OPJ_INT32)rh;
|
||||
|
||||
rw = tr->x1 - tr->x0;
|
||||
rh = tr->y1 - tr->y0;
|
||||
rw = (OPJ_UINT32)(tr->x1 - tr->x0);
|
||||
rh = (OPJ_UINT32)(tr->y1 - tr->y0);
|
||||
|
||||
h.dn = rw - h.sn;
|
||||
h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
|
||||
h.cas = tr->x0 % 2;
|
||||
|
||||
for(j = 0; j < rh; ++j) {
|
||||
@@ -593,12 +596,12 @@ OPJ_BOOL opj_dwt_decode_tile(opj_tcd_tilecomp_t* tilec, OPJ_UINT32 numres, DWT1D
|
||||
memcpy(&tiledp[j*w], h.mem, rw * sizeof(OPJ_INT32));
|
||||
}
|
||||
|
||||
v.dn = rh - v.sn;
|
||||
v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
|
||||
v.cas = tr->y0 % 2;
|
||||
|
||||
for(j = 0; j < rw; ++j){
|
||||
OPJ_UINT32 k;
|
||||
opj_dwt_interleave_v(&v, &tiledp[j], w);
|
||||
opj_dwt_interleave_v(&v, &tiledp[j], (OPJ_INT32)w);
|
||||
(dwt_1D)(&v);
|
||||
for(k = 0; k < rh; ++k) {
|
||||
tiledp[k * w + j] = v.mem[k];
|
||||
@@ -657,14 +660,14 @@ void opj_v4dwt_interleave_v(opj_v4dwt_t* restrict v , OPJ_FLOAT32* restrict a ,
|
||||
OPJ_INT32 i;
|
||||
|
||||
for(i = 0; i < v->sn; ++i){
|
||||
memcpy(&bi[i*2], &a[i*x], nb_elts_read * sizeof(OPJ_FLOAT32));
|
||||
memcpy(&bi[i*2], &a[i*x], (size_t)nb_elts_read * sizeof(OPJ_FLOAT32));
|
||||
}
|
||||
|
||||
a += v->sn * x;
|
||||
bi = v->wavelet + 1 - v->cas;
|
||||
|
||||
for(i = 0; i < v->dn; ++i){
|
||||
memcpy(&bi[i*2], &a[i*x], nb_elts_read * sizeof(OPJ_FLOAT32));
|
||||
memcpy(&bi[i*2], &a[i*x], (size_t)nb_elts_read * sizeof(OPJ_FLOAT32));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -833,40 +836,40 @@ OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numr
|
||||
|
||||
opj_tcd_resolution_t* res = tilec->resolutions;
|
||||
|
||||
OPJ_UINT32 rw = res->x1 - res->x0; /* width of the resolution level computed */
|
||||
OPJ_UINT32 rh = res->y1 - res->y0; /* height of the resolution level computed */
|
||||
OPJ_UINT32 rw = (OPJ_UINT32)(res->x1 - res->x0); /* width of the resolution level computed */
|
||||
OPJ_UINT32 rh = (OPJ_UINT32)(res->y1 - res->y0); /* height of the resolution level computed */
|
||||
|
||||
OPJ_UINT32 w = tilec->x1 - tilec->x0;
|
||||
OPJ_UINT32 w = (OPJ_UINT32)(tilec->x1 - tilec->x0);
|
||||
|
||||
h.wavelet = (opj_v4_t*) opj_aligned_malloc((opj_dwt_max_resolution(res, numres)+5) * sizeof(opj_v4_t));
|
||||
v.wavelet = h.wavelet;
|
||||
|
||||
while( --numres) {
|
||||
OPJ_FLOAT32 * restrict aj = (OPJ_FLOAT32*) tilec->data;
|
||||
OPJ_UINT32 bufsize = (tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0);
|
||||
OPJ_UINT32 bufsize = (OPJ_UINT32)((tilec->x1 - tilec->x0) * (tilec->y1 - tilec->y0));
|
||||
OPJ_INT32 j;
|
||||
|
||||
h.sn = rw;
|
||||
v.sn = rh;
|
||||
h.sn = (OPJ_INT32)rw;
|
||||
v.sn = (OPJ_INT32)rh;
|
||||
|
||||
++res;
|
||||
|
||||
rw = res->x1 - res->x0; /* width of the resolution level computed */
|
||||
rh = res->y1 - res->y0; /* height of the resolution level computed */
|
||||
rw = (OPJ_UINT32)(res->x1 - res->x0); /* width of the resolution level computed */
|
||||
rh = (OPJ_UINT32)(res->y1 - res->y0); /* height of the resolution level computed */
|
||||
|
||||
h.dn = rw - h.sn;
|
||||
h.dn = (OPJ_INT32)(rw - (OPJ_UINT32)h.sn);
|
||||
h.cas = res->x0 % 2;
|
||||
|
||||
for(j = rh; j > 3; j -= 4) {
|
||||
for(j = (OPJ_INT32)rh; j > 3; j -= 4) {
|
||||
OPJ_INT32 k;
|
||||
opj_v4dwt_interleave_h(&h, aj, w, bufsize);
|
||||
opj_v4dwt_interleave_h(&h, aj, (OPJ_INT32)w, (OPJ_INT32)bufsize);
|
||||
opj_v4dwt_decode(&h);
|
||||
|
||||
for(k = rw; --k >= 0;){
|
||||
aj[k ] = h.wavelet[k].f[0];
|
||||
aj[k+w ] = h.wavelet[k].f[1];
|
||||
aj[k+w*2] = h.wavelet[k].f[2];
|
||||
aj[k+w*3] = h.wavelet[k].f[3];
|
||||
for(k = (OPJ_INT32)rw; --k >= 0;){
|
||||
aj[k ] = h.wavelet[k].f[0];
|
||||
aj[k+(OPJ_INT32)w ] = h.wavelet[k].f[1];
|
||||
aj[k+(OPJ_INT32)w*2] = h.wavelet[k].f[2];
|
||||
aj[k+(OPJ_INT32)w*3] = h.wavelet[k].f[3];
|
||||
}
|
||||
|
||||
aj += w*4;
|
||||
@@ -876,25 +879,25 @@ OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numr
|
||||
if (rh & 0x03) {
|
||||
OPJ_INT32 k;
|
||||
j = rh & 0x03;
|
||||
opj_v4dwt_interleave_h(&h, aj, w, bufsize);
|
||||
opj_v4dwt_interleave_h(&h, aj, (OPJ_INT32)w, (OPJ_INT32)bufsize);
|
||||
opj_v4dwt_decode(&h);
|
||||
for(k = rw; --k >= 0;){
|
||||
for(k = (OPJ_INT32)rw; --k >= 0;){
|
||||
switch(j) {
|
||||
case 3: aj[k+w*2] = h.wavelet[k].f[2];
|
||||
case 2: aj[k+w ] = h.wavelet[k].f[1];
|
||||
case 1: aj[k ] = h.wavelet[k].f[0];
|
||||
case 3: aj[k+(OPJ_INT32)w*2] = h.wavelet[k].f[2];
|
||||
case 2: aj[k+(OPJ_INT32)w ] = h.wavelet[k].f[1];
|
||||
case 1: aj[k ] = h.wavelet[k].f[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
v.dn = rh - v.sn;
|
||||
v.dn = (OPJ_INT32)(rh - (OPJ_UINT32)v.sn);
|
||||
v.cas = res->y0 % 2;
|
||||
|
||||
aj = (OPJ_FLOAT32*) tilec->data;
|
||||
for(j = rw; j > 3; j -= 4){
|
||||
for(j = (OPJ_INT32)rw; j > 3; j -= 4){
|
||||
OPJ_UINT32 k;
|
||||
|
||||
opj_v4dwt_interleave_v(&v, aj, w, 4);
|
||||
opj_v4dwt_interleave_v(&v, aj, (OPJ_INT32)w, 4);
|
||||
opj_v4dwt_decode(&v);
|
||||
|
||||
for(k = 0; k < rh; ++k){
|
||||
@@ -908,11 +911,11 @@ OPJ_BOOL opj_dwt_decode_real(opj_tcd_tilecomp_t* restrict tilec, OPJ_UINT32 numr
|
||||
|
||||
j = rw & 0x03;
|
||||
|
||||
opj_v4dwt_interleave_v(&v, aj, w, j);
|
||||
opj_v4dwt_interleave_v(&v, aj, (OPJ_INT32)w, j);
|
||||
opj_v4dwt_decode(&v);
|
||||
|
||||
for(k = 0; k < rh; ++k){
|
||||
memcpy(&aj[k*w], &v.wavelet[k], j * sizeof(OPJ_FLOAT32));
|
||||
memcpy(&aj[k*w], &v.wavelet[k], (size_t)j * sizeof(OPJ_FLOAT32));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -118,7 +123,7 @@ OPJ_BOOL opj_event_msg(opj_event_mgr_t* p_event_mgr, OPJ_INT32 event_type, const
|
||||
str_length = (strlen(fmt) > OPJ_MSG_SIZE) ? OPJ_MSG_SIZE : strlen(fmt);
|
||||
(void)str_length;
|
||||
/* parse the format string and put the result in 'message' */
|
||||
vsprintf(message, fmt, arg); /* UniPG */
|
||||
vsnprintf(message, OPJ_MSG_SIZE, fmt, arg); /* UniPG */
|
||||
/* deinitialize the optional parameter list */
|
||||
va_end(arg);
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -40,7 +45,7 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa
|
||||
image->color_space = clrspc;
|
||||
image->numcomps = numcmpts;
|
||||
/* allocate memory for the per-component information */
|
||||
image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(opj_image_comp_t));
|
||||
image->comps = (opj_image_comp_t*)opj_calloc(1,image->numcomps * sizeof(opj_image_comp_t));
|
||||
if(!image->comps) {
|
||||
fprintf(stderr,"Unable to allocate memory for image.\n");
|
||||
opj_image_destroy(image);
|
||||
@@ -106,23 +111,23 @@ void opj_image_comp_header_update(opj_image_t * p_image_header, const struct opj
|
||||
OPJ_INT32 l_comp_x0, l_comp_y0, l_comp_x1, l_comp_y1;
|
||||
opj_image_comp_t* l_img_comp = NULL;
|
||||
|
||||
l_x0 = opj_int_max(p_cp->tx0 , p_image_header->x0);
|
||||
l_y0 = opj_int_max(p_cp->ty0 , p_image_header->y0);
|
||||
l_x1 = opj_int_min(p_cp->tx0 + p_cp->tw * p_cp->tdx, p_image_header->x1);
|
||||
l_y1 = opj_int_min(p_cp->ty0 + p_cp->th * p_cp->tdy, p_image_header->y1);
|
||||
l_x0 = opj_int_max((OPJ_INT32)p_cp->tx0 , (OPJ_INT32)p_image_header->x0);
|
||||
l_y0 = opj_int_max((OPJ_INT32)p_cp->ty0 , (OPJ_INT32)p_image_header->y0);
|
||||
l_x1 = opj_int_min((OPJ_INT32)(p_cp->tx0 + p_cp->tw * p_cp->tdx), (OPJ_INT32)p_image_header->x1);
|
||||
l_y1 = opj_int_min((OPJ_INT32)(p_cp->ty0 + p_cp->th * p_cp->tdy), (OPJ_INT32)p_image_header->y1);
|
||||
|
||||
l_img_comp = p_image_header->comps;
|
||||
for (i = 0; i < p_image_header->numcomps; ++i) {
|
||||
l_comp_x0 = opj_int_ceildiv(l_x0, l_img_comp->dx);
|
||||
l_comp_y0 = opj_int_ceildiv(l_y0, l_img_comp->dy);
|
||||
l_comp_x1 = opj_int_ceildiv(l_x1, l_img_comp->dx);
|
||||
l_comp_y1 = opj_int_ceildiv(l_y1, l_img_comp->dy);
|
||||
l_width = opj_int_ceildivpow2(l_comp_x1 - l_comp_x0, l_img_comp->factor);
|
||||
l_height = opj_int_ceildivpow2(l_comp_y1 - l_comp_y0, l_img_comp->factor);
|
||||
l_comp_x0 = opj_int_ceildiv(l_x0, (OPJ_INT32)l_img_comp->dx);
|
||||
l_comp_y0 = opj_int_ceildiv(l_y0, (OPJ_INT32)l_img_comp->dy);
|
||||
l_comp_x1 = opj_int_ceildiv(l_x1, (OPJ_INT32)l_img_comp->dx);
|
||||
l_comp_y1 = opj_int_ceildiv(l_y1, (OPJ_INT32)l_img_comp->dy);
|
||||
l_width = (OPJ_UINT32)opj_int_ceildivpow2(l_comp_x1 - l_comp_x0, (OPJ_INT32)l_img_comp->factor);
|
||||
l_height = (OPJ_UINT32)opj_int_ceildivpow2(l_comp_y1 - l_comp_y0, (OPJ_INT32)l_img_comp->factor);
|
||||
l_img_comp->w = l_width;
|
||||
l_img_comp->h = l_height;
|
||||
l_img_comp->x0 = l_comp_x0/*l_x0*/;
|
||||
l_img_comp->y0 = l_comp_y0/*l_y0*/;
|
||||
l_img_comp->x0 = (OPJ_UINT32)l_comp_x0/*l_x0*/;
|
||||
l_img_comp->y0 = (OPJ_UINT32)l_comp_y0/*l_y0*/;
|
||||
++l_img_comp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* $Id: indexbox_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
|
||||
*
|
||||
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2011, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* All rights reserved.
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -67,8 +72,8 @@ OPJ_BOOL opj_matrix_inversion_f(OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_UINT32 nb_compo)
|
||||
{
|
||||
OPJ_BYTE * l_data = 00;
|
||||
OPJ_UINT32 l_permutation_size = nb_compo * sizeof(OPJ_UINT32);
|
||||
OPJ_UINT32 l_swap_size = nb_compo * sizeof(OPJ_FLOAT32);
|
||||
OPJ_UINT32 l_permutation_size = nb_compo * (OPJ_UINT32)sizeof(OPJ_UINT32);
|
||||
OPJ_UINT32 l_swap_size = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
|
||||
OPJ_UINT32 l_total_size = l_permutation_size + 3 * l_swap_size;
|
||||
OPJ_UINT32 * lPermutations = 00;
|
||||
OPJ_FLOAT32 * l_double_data = 00;
|
||||
@@ -109,7 +114,7 @@ OPJ_BOOL opj_lupDecompose(OPJ_FLOAT32 * matrix,OPJ_UINT32 * permutations,
|
||||
OPJ_UINT32 i,j,k;
|
||||
OPJ_FLOAT32 p;
|
||||
OPJ_UINT32 lLastColum = nb_compo - 1;
|
||||
OPJ_UINT32 lSwapSize = nb_compo * sizeof(OPJ_FLOAT32);
|
||||
OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
|
||||
OPJ_FLOAT32 * lTmpMatrix = matrix;
|
||||
OPJ_FLOAT32 * lColumnMatrix,* lDestMatrix;
|
||||
OPJ_UINT32 offset = 1;
|
||||
@@ -250,7 +255,7 @@ void opj_lupSolve (OPJ_FLOAT32 * pResult,
|
||||
lTmpMatrix = lLineMatrix;
|
||||
u = *(lTmpMatrix++);
|
||||
lCurrentPtr = lDestPtr--;
|
||||
for (j = k + 1; j < nb_compo; ++j) {
|
||||
for (j = (OPJ_UINT32)(k + 1); j < nb_compo; ++j) {
|
||||
/* sum += matrix[k][j] * x[j] */
|
||||
sum += (*(lTmpMatrix++)) * (*(lCurrentPtr++));
|
||||
}
|
||||
@@ -272,7 +277,7 @@ void opj_lupInvert (OPJ_FLOAT32 * pSrcMatrix,
|
||||
OPJ_UINT32 j,i;
|
||||
OPJ_FLOAT32 * lCurrentPtr;
|
||||
OPJ_FLOAT32 * lLineMatrix = pDestMatrix;
|
||||
OPJ_UINT32 lSwapSize = nb_compo * sizeof(OPJ_FLOAT32);
|
||||
OPJ_UINT32 lSwapSize = nb_compo * (OPJ_UINT32)sizeof(OPJ_FLOAT32);
|
||||
|
||||
for (j = 0; j < nb_compo; ++j) {
|
||||
lCurrentPtr = lLineMatrix++;
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
/*
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||
* Copyright (c) 2008, Jerome Fimes, Communications & Systemes <jerome.fimes@c-s.fr>
|
||||
@@ -59,6 +65,8 @@ The functions in J2K.C have for goal to read/write the several parts of the code
|
||||
#define J2K_CCP_QNTSTY_SIQNT 1
|
||||
#define J2K_CCP_QNTSTY_SEQNT 2
|
||||
|
||||
#define OPJ_J2K_DEFAULT_CBLK_DATA_SIZE 8192
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
#define J2K_MS_SOC 0xff4f /**< SOC marker value */
|
||||
@@ -296,8 +304,6 @@ typedef struct opj_tcp
|
||||
|
||||
typedef struct opj_encoding_param
|
||||
{
|
||||
/** Digital cinema profile*/
|
||||
OPJ_CINEMA_MODE m_cinema;
|
||||
/** Maximum rate for each component. If == 0, component size limitation is not considered */
|
||||
OPJ_UINT32 m_max_comp_size;
|
||||
/** Position of tile part flag in progression order*/
|
||||
@@ -335,7 +341,7 @@ typedef struct opj_cp
|
||||
/** Size of the image in bits*/
|
||||
/*int img_size;*/
|
||||
/** Rsiz*/
|
||||
OPJ_RSIZ_CAPABILITIES rsiz;
|
||||
OPJ_UINT16 rsiz;
|
||||
/** XTOsiz */
|
||||
OPJ_UINT32 tx0; /* MSD see norm */
|
||||
/** YTOsiz */
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2001-2003, David Janssens
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* Copyright (c) 2003-2014, Antonin Descampe
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2010-2011, Kaori Hagihara
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -428,12 +434,10 @@ static void opj_jp2_setup_decoding_validation (opj_jp2_t *jp2);
|
||||
static void opj_jp2_setup_header_reading (opj_jp2_t *jp2);
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
OPJ_BOOL opj_jp2_read_boxhdr(opj_jp2_box_t *box,
|
||||
OPJ_UINT32 * p_number_bytes_read,
|
||||
opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager
|
||||
)
|
||||
OPJ_UINT32 * p_number_bytes_read,
|
||||
opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager )
|
||||
{
|
||||
/* read header from file */
|
||||
OPJ_BYTE l_data_header [8];
|
||||
@@ -444,7 +448,7 @@ static void opj_jp2_setup_header_reading (opj_jp2_t *jp2);
|
||||
assert(p_number_bytes_read != 00);
|
||||
assert(p_manager != 00);
|
||||
|
||||
*p_number_bytes_read = opj_stream_read_data(cio,l_data_header,8,p_manager);
|
||||
*p_number_bytes_read = (OPJ_UINT32)opj_stream_read_data(cio,l_data_header,8,p_manager);
|
||||
if (*p_number_bytes_read != 8) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
@@ -452,13 +456,21 @@ static void opj_jp2_setup_header_reading (opj_jp2_t *jp2);
|
||||
/* process read data */
|
||||
opj_read_bytes(l_data_header,&(box->length), 4);
|
||||
opj_read_bytes(l_data_header+4,&(box->type), 4);
|
||||
|
||||
if(box->length == 0)/* last box */
|
||||
{
|
||||
const OPJ_OFF_T bleft = opj_stream_get_number_byte_left(cio);
|
||||
box->length = (OPJ_UINT32)bleft;
|
||||
assert( (OPJ_OFF_T)box->length == bleft );
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
/* do we have a "special very large box ?" */
|
||||
/* read then the XLBox */
|
||||
if (box->length == 1) {
|
||||
OPJ_UINT32 l_xl_part_size;
|
||||
|
||||
OPJ_UINT32 l_nb_bytes_read = opj_stream_read_data(cio,l_data_header,8,p_manager);
|
||||
OPJ_UINT32 l_nb_bytes_read = (OPJ_UINT32)opj_stream_read_data(cio,l_data_header,8,p_manager);
|
||||
if (l_nb_bytes_read != 8) {
|
||||
if (l_nb_bytes_read > 0) {
|
||||
*p_number_bytes_read += l_nb_bytes_read;
|
||||
@@ -467,14 +479,15 @@ static void opj_jp2_setup_header_reading (opj_jp2_t *jp2);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
*p_number_bytes_read = 16;
|
||||
opj_read_bytes(l_data_header,&l_xl_part_size, 4);
|
||||
if (l_xl_part_size != 0) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
opj_read_bytes(l_data_header,&(box->length), 4);
|
||||
opj_read_bytes(l_data_header+4,&(box->length), 4);
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -607,7 +620,7 @@ OPJ_BYTE * opj_jp2_write_bpcc( opj_jp2_t *jp2,
|
||||
{
|
||||
OPJ_UINT32 i;
|
||||
/* room for 8 bytes for box and 1 byte for each component */
|
||||
OPJ_INT32 l_bpcc_size = 8 + jp2->numcomps;
|
||||
OPJ_UINT32 l_bpcc_size = 8 + jp2->numcomps;
|
||||
OPJ_BYTE * l_bpcc_data,* l_current_bpcc_ptr;
|
||||
|
||||
/* preconditions */
|
||||
@@ -682,13 +695,15 @@ OPJ_BYTE * opj_jp2_write_colr( opj_jp2_t *jp2,
|
||||
/* preconditions */
|
||||
assert(jp2 != 00);
|
||||
assert(p_nb_bytes_written != 00);
|
||||
assert(jp2->meth == 1 || jp2->meth == 2);
|
||||
|
||||
switch (jp2->meth) {
|
||||
switch (jp2->meth) {
|
||||
case 1 :
|
||||
l_colr_size += 4;
|
||||
l_colr_size += 4; /* EnumCS */
|
||||
break;
|
||||
case 2 :
|
||||
++l_colr_size;
|
||||
assert(jp2->color.icc_profile_len); /* ICC profile */
|
||||
l_colr_size += jp2->color.icc_profile_len;
|
||||
break;
|
||||
default :
|
||||
return 00;
|
||||
@@ -717,11 +732,16 @@ OPJ_BYTE * opj_jp2_write_colr( opj_jp2_t *jp2,
|
||||
opj_write_bytes(l_current_colr_ptr, jp2->approx,1); /* APPROX */
|
||||
++l_current_colr_ptr;
|
||||
|
||||
if (jp2->meth == 1) {
|
||||
opj_write_bytes(l_current_colr_ptr, jp2->enumcs,4); /* EnumCS */
|
||||
}
|
||||
else {
|
||||
opj_write_bytes(l_current_colr_ptr, 0, 1); /* PROFILE (??) */
|
||||
if (jp2->meth == 1) { /* Meth value is restricted to 1 or 2 (Table I.9 of part 1) */
|
||||
opj_write_bytes(l_current_colr_ptr, jp2->enumcs,4); } /* EnumCS */
|
||||
else {
|
||||
if (jp2->meth == 2) { /* ICC profile */
|
||||
OPJ_UINT32 i;
|
||||
for(i = 0; i < jp2->color.icc_profile_len; ++i) {
|
||||
opj_write_bytes(l_current_colr_ptr, jp2->color.icc_profile_buf[i], 1);
|
||||
++l_current_colr_ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*p_nb_bytes_written = l_colr_size;
|
||||
@@ -740,6 +760,85 @@ void opj_jp2_free_pclr(opj_jp2_color_t *color)
|
||||
opj_free(color->jp2_pclr); color->jp2_pclr = NULL;
|
||||
}
|
||||
|
||||
static OPJ_BOOL opj_jp2_check_color(opj_image_t *image, opj_jp2_color_t *color, opj_event_mgr_t *p_manager)
|
||||
{
|
||||
OPJ_UINT16 i;
|
||||
|
||||
/* testcase 4149.pdf.SIGSEGV.cf7.3501 */
|
||||
if (color->jp2_cdef) {
|
||||
opj_jp2_cdef_info_t *info = color->jp2_cdef->info;
|
||||
OPJ_UINT16 n = color->jp2_cdef->n;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
if (info[i].cn >= image->numcomps) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].cn, image->numcomps);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (info[i].asoc > 0 && (OPJ_UINT32)(info[i].asoc - 1) >= image->numcomps) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", info[i].asoc - 1, image->numcomps);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* testcases 451.pdf.SIGSEGV.f4c.3723, 451.pdf.SIGSEGV.5b5.3723 and
|
||||
66ea31acbb0f23a2bbc91f64d69a03f5_signal_sigsegv_13937c0_7030_5725.pdf */
|
||||
if (color->jp2_pclr && color->jp2_pclr->cmap) {
|
||||
OPJ_UINT16 nr_channels = color->jp2_pclr->nr_channels;
|
||||
opj_jp2_cmap_comp_t *cmap = color->jp2_pclr->cmap;
|
||||
OPJ_BOOL *pcol_usage, is_sane = OPJ_TRUE;
|
||||
|
||||
/* verify that all original components match an existing one */
|
||||
for (i = 0; i < nr_channels; i++) {
|
||||
if (cmap[i].cmp >= image->numcomps) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid component index %d (>= %d).\n", cmap[i].cmp, image->numcomps);
|
||||
is_sane = OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
pcol_usage = opj_calloc(nr_channels, sizeof(OPJ_BOOL));
|
||||
if (!pcol_usage) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Unexpected OOM.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* verify that no component is targeted more than once */
|
||||
for (i = 0; i < nr_channels; i++) {
|
||||
OPJ_UINT16 pcol = cmap[i].pcol;
|
||||
assert(cmap[i].mtyp == 0 || cmap[i].mtyp == 1);
|
||||
if (pcol >= nr_channels) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Invalid component/palette index for direct mapping %d.\n", pcol);
|
||||
is_sane = OPJ_FALSE;
|
||||
}
|
||||
else if (pcol_usage[pcol] && cmap[i].mtyp == 1) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Component %d is mapped twice.\n", pcol);
|
||||
is_sane = OPJ_FALSE;
|
||||
}
|
||||
else if (cmap[i].mtyp == 0 && cmap[i].pcol != 0) {
|
||||
/* I.5.3.5 PCOL: If the value of the MTYP field for this channel is 0, then
|
||||
* the value of this field shall be 0. */
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Direct use at #%d however pcol=%d.\n", i, pcol);
|
||||
is_sane = OPJ_FALSE;
|
||||
}
|
||||
else
|
||||
pcol_usage[pcol] = OPJ_TRUE;
|
||||
}
|
||||
/* verify that all components are targeted at least once */
|
||||
for (i = 0; i < nr_channels; i++) {
|
||||
if (!pcol_usage[i] && cmap[i].mtyp != 0) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Component %d doesn't have a mapping.\n", i);
|
||||
is_sane = OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
opj_free(pcol_usage);
|
||||
if (!is_sane) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
/* file9.jp2 */
|
||||
void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color)
|
||||
{
|
||||
opj_image_comp_t *old_comps, *new_comps;
|
||||
@@ -764,40 +863,52 @@ void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color)
|
||||
for(i = 0; i < nr_channels; ++i) {
|
||||
pcol = cmap[i].pcol; cmp = cmap[i].cmp;
|
||||
|
||||
new_comps[pcol] = old_comps[cmp];
|
||||
|
||||
/* Direct use */
|
||||
if(cmap[i].mtyp == 0){
|
||||
old_comps[cmp].data = NULL; continue;
|
||||
}
|
||||
if(cmap[i].mtyp == 0){
|
||||
assert( pcol == 0 );
|
||||
new_comps[i] = old_comps[cmp];
|
||||
} else {
|
||||
assert( i == pcol );
|
||||
new_comps[pcol] = old_comps[cmp];
|
||||
}
|
||||
|
||||
/* Palette mapping: */
|
||||
new_comps[pcol].data = (OPJ_INT32*)
|
||||
new_comps[i].data = (OPJ_INT32*)
|
||||
opj_malloc(old_comps[cmp].w * old_comps[cmp].h * sizeof(OPJ_INT32));
|
||||
new_comps[pcol].prec = channel_size[i];
|
||||
new_comps[pcol].sgnd = channel_sign[i];
|
||||
new_comps[i].prec = channel_size[i];
|
||||
new_comps[i].sgnd = channel_sign[i];
|
||||
}
|
||||
|
||||
top_k = color->jp2_pclr->nr_entries - 1;
|
||||
|
||||
for(i = 0; i < nr_channels; ++i) {
|
||||
/* Direct use: */
|
||||
if(cmap[i].mtyp == 0) continue;
|
||||
|
||||
/* Palette mapping: */
|
||||
cmp = cmap[i].cmp; pcol = cmap[i].pcol;
|
||||
src = old_comps[cmp].data;
|
||||
dst = new_comps[pcol].data;
|
||||
assert( src );
|
||||
max = new_comps[pcol].w * new_comps[pcol].h;
|
||||
|
||||
for(j = 0; j < max; ++j)
|
||||
{
|
||||
/* The index */
|
||||
if((k = src[j]) < 0) k = 0; else if(k > top_k) k = top_k;
|
||||
/* Direct use: */
|
||||
if(cmap[i].mtyp == 0) {
|
||||
assert( cmp == 0 );
|
||||
dst = new_comps[i].data;
|
||||
assert( dst );
|
||||
for(j = 0; j < max; ++j) {
|
||||
dst[j] = src[j];
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert( i == pcol );
|
||||
dst = new_comps[pcol].data;
|
||||
assert( dst );
|
||||
for(j = 0; j < max; ++j) {
|
||||
/* The index */
|
||||
if((k = src[j]) < 0) k = 0; else if(k > top_k) k = top_k;
|
||||
|
||||
/* The colour */
|
||||
dst[j] = entries[k * nr_channels + pcol];
|
||||
}
|
||||
/* The colour */
|
||||
dst[j] = (OPJ_INT32)entries[k * nr_channels + pcol];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
max = image->numcomps;
|
||||
@@ -825,6 +936,7 @@ OPJ_BOOL opj_jp2_read_pclr( opj_jp2_t *jp2,
|
||||
OPJ_UINT16 nr_entries,nr_channels;
|
||||
OPJ_UINT16 i, j;
|
||||
OPJ_UINT32 l_value;
|
||||
OPJ_BYTE *orig_header_data = p_pclr_header_data;
|
||||
|
||||
/* preconditions */
|
||||
assert(p_pclr_header_data != 00);
|
||||
@@ -835,6 +947,9 @@ OPJ_BOOL opj_jp2_read_pclr( opj_jp2_t *jp2,
|
||||
if(jp2->color.jp2_pclr)
|
||||
return OPJ_FALSE;
|
||||
|
||||
if (p_pclr_header_size < 3)
|
||||
return OPJ_FALSE;
|
||||
|
||||
opj_read_bytes(p_pclr_header_data, &l_value , 2); /* NE */
|
||||
p_pclr_header_data += 2;
|
||||
nr_entries = (OPJ_UINT16) l_value;
|
||||
@@ -843,7 +958,10 @@ OPJ_BOOL opj_jp2_read_pclr( opj_jp2_t *jp2,
|
||||
++p_pclr_header_data;
|
||||
nr_channels = (OPJ_UINT16) l_value;
|
||||
|
||||
entries = (OPJ_UINT32*) opj_malloc(nr_channels * nr_entries * sizeof(OPJ_UINT32));
|
||||
if (p_pclr_header_size < 3 + (OPJ_UINT32)nr_channels || nr_channels == 0 || nr_entries >= (OPJ_UINT32)-1 / nr_channels)
|
||||
return OPJ_FALSE;
|
||||
|
||||
entries = (OPJ_UINT32*) opj_malloc((size_t)nr_channels * nr_entries * sizeof(OPJ_UINT32));
|
||||
if (!entries)
|
||||
return OPJ_FALSE;
|
||||
channel_size = (OPJ_BYTE*) opj_malloc(nr_channels);
|
||||
@@ -882,13 +1000,18 @@ OPJ_BOOL opj_jp2_read_pclr( opj_jp2_t *jp2,
|
||||
opj_read_bytes(p_pclr_header_data, &l_value , 1); /* Bi */
|
||||
++p_pclr_header_data;
|
||||
|
||||
channel_size[i] = (l_value & 0x7f) + 1;
|
||||
channel_sign[i] = (l_value & 0x80)? 1 : 0;
|
||||
channel_size[i] = (OPJ_BYTE)((l_value & 0x7f) + 1);
|
||||
channel_sign[i] = (l_value & 0x80) ? 1 : 0;
|
||||
}
|
||||
|
||||
for(j = 0; j < nr_entries; ++j) {
|
||||
for(i = 0; i < nr_channels; ++i) {
|
||||
OPJ_INT32 bytes_to_read = (channel_size[i]+7)>>3;
|
||||
OPJ_UINT32 bytes_to_read = (OPJ_UINT32)((channel_size[i]+7)>>3);
|
||||
|
||||
if (bytes_to_read > sizeof(OPJ_UINT32))
|
||||
bytes_to_read = sizeof(OPJ_UINT32);
|
||||
if ((ptrdiff_t)p_pclr_header_size < p_pclr_header_data - orig_header_data + (ptrdiff_t)bytes_to_read)
|
||||
return OPJ_FALSE;
|
||||
|
||||
opj_read_bytes(p_pclr_header_data, &l_value , bytes_to_read); /* Cji */
|
||||
p_pclr_header_data += bytes_to_read;
|
||||
@@ -931,6 +1054,11 @@ OPJ_BOOL opj_jp2_read_cmap( opj_jp2_t * jp2,
|
||||
}
|
||||
|
||||
nr_channels = jp2->color.jp2_pclr->nr_channels;
|
||||
if (p_cmap_header_size < (OPJ_UINT32)nr_channels * 4) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CMAP box.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
cmap = (opj_jp2_cmap_comp_t*) opj_malloc(nr_channels * sizeof(opj_jp2_cmap_comp_t));
|
||||
if (!cmap)
|
||||
return OPJ_FALSE;
|
||||
@@ -963,13 +1091,24 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
|
||||
info = color->jp2_cdef->info;
|
||||
n = color->jp2_cdef->n;
|
||||
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
/* WATCH: acn = asoc - 1 ! */
|
||||
if((asoc = info[i].asoc) == 0) continue;
|
||||
for(i = 0; i < n; ++i)
|
||||
{
|
||||
/* WATCH: acn = asoc - 1 ! */
|
||||
asoc = info[i].asoc;
|
||||
if(asoc == 0 || asoc == 65535)
|
||||
{
|
||||
if (i < image->numcomps)
|
||||
image->comps[i].alpha = info[i].typ;
|
||||
continue;
|
||||
}
|
||||
|
||||
cn = info[i].cn;
|
||||
acn = asoc - 1;
|
||||
cn = info[i].cn;
|
||||
acn = (OPJ_UINT16)(asoc - 1);
|
||||
if( cn >= image->numcomps || acn >= image->numcomps )
|
||||
{
|
||||
fprintf(stderr, "cn=%d, acn=%d, numcomps=%d\n", cn, acn, image->numcomps);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(cn != acn)
|
||||
{
|
||||
@@ -979,9 +1118,11 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color)
|
||||
memcpy(&image->comps[cn], &image->comps[acn], sizeof(opj_image_comp_t));
|
||||
memcpy(&image->comps[acn], &saved, sizeof(opj_image_comp_t));
|
||||
|
||||
info[i].asoc = cn + 1;
|
||||
info[acn].asoc = info[acn].cn + 1;
|
||||
info[i].asoc = (OPJ_UINT16)(cn + 1);
|
||||
info[acn].asoc = (OPJ_UINT16)(info[acn].cn + 1);
|
||||
}
|
||||
|
||||
image->comps[cn].alpha = info[i].typ;
|
||||
}
|
||||
|
||||
if(color->jp2_cdef->info) opj_free(color->jp2_cdef->info);
|
||||
@@ -1010,6 +1151,11 @@ OPJ_BOOL opj_jp2_read_cdef( opj_jp2_t * jp2,
|
||||
* inside a JP2 Header box.'*/
|
||||
if(jp2->color.jp2_cdef) return OPJ_FALSE;
|
||||
|
||||
if (p_cdef_header_size < 2) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CDEF box.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
opj_read_bytes(p_cdef_header_data,&l_value ,2); /* N */
|
||||
p_cdef_header_data+= 2;
|
||||
|
||||
@@ -1018,6 +1164,11 @@ OPJ_BOOL opj_jp2_read_cdef( opj_jp2_t * jp2,
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (p_cdef_header_size < 2 + (OPJ_UINT32)(OPJ_UINT16)l_value * 6) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Insufficient data for CDEF box.\n");
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
cdef_info = (opj_jp2_cdef_info_t*) opj_malloc(l_value * sizeof(opj_jp2_cdef_info_t));
|
||||
if (!cdef_info)
|
||||
return OPJ_FALSE;
|
||||
@@ -1085,26 +1236,32 @@ OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2,
|
||||
++p_colr_header_data;
|
||||
|
||||
if (jp2->meth == 1) {
|
||||
if (p_colr_header_size != 7) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Bad BPCC header box (bad size)\n");
|
||||
if (p_colr_header_size < 7) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Bad COLR header box (bad size: %d)\n", p_colr_header_size);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
if (p_colr_header_size > 7) {
|
||||
/* testcase Altona_Technical_v20_x4.pdf */
|
||||
opj_event_msg(p_manager, EVT_WARNING, "Bad COLR header box (bad size: %d)\n", p_colr_header_size);
|
||||
}
|
||||
|
||||
opj_read_bytes(p_colr_header_data,&jp2->enumcs ,4); /* EnumCS */
|
||||
|
||||
jp2->color.jp2_has_colr = 1;
|
||||
}
|
||||
else if (jp2->meth == 2) {
|
||||
/* ICC profile */
|
||||
OPJ_INT32 it_icc_value = 0;
|
||||
OPJ_INT32 icc_len = p_colr_header_size - 3;
|
||||
OPJ_INT32 icc_len = (OPJ_INT32)p_colr_header_size - 3;
|
||||
|
||||
jp2->color.icc_profile_len = icc_len;
|
||||
jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_malloc(icc_len);
|
||||
jp2->color.icc_profile_len = (OPJ_UINT32)icc_len;
|
||||
jp2->color.icc_profile_buf = (OPJ_BYTE*) opj_malloc((size_t)icc_len);
|
||||
if (!jp2->color.icc_profile_buf)
|
||||
{
|
||||
jp2->color.icc_profile_len = 0;
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
memset(jp2->color.icc_profile_buf, 0, icc_len * sizeof(OPJ_BYTE));
|
||||
memset(jp2->color.icc_profile_buf, 0, (size_t)icc_len * sizeof(OPJ_BYTE));
|
||||
|
||||
for (it_icc_value = 0; it_icc_value < icc_len; ++it_icc_value)
|
||||
{
|
||||
@@ -1112,14 +1269,17 @@ OPJ_BOOL opj_jp2_read_colr( opj_jp2_t *jp2,
|
||||
++p_colr_header_data;
|
||||
jp2->color.icc_profile_buf[it_icc_value] = (OPJ_BYTE) l_value;
|
||||
}
|
||||
|
||||
|
||||
jp2->color.jp2_has_colr = 1;
|
||||
}
|
||||
else
|
||||
opj_event_msg(p_manager, EVT_INFO, "COLR BOX meth value is not a regular value (%d), so we will skip the fields following the approx field.\n", jp2->meth);
|
||||
|
||||
jp2->color.jp2_has_colr = 1;
|
||||
|
||||
return OPJ_TRUE;
|
||||
else if (jp2->meth > 2)
|
||||
{
|
||||
/* ISO/IEC 15444-1:2004 (E), Table I.9 <20> Legal METH values:
|
||||
conforming JP2 reader shall ignore the entire Colour Specification box.*/
|
||||
opj_event_msg(p_manager, EVT_INFO, "COLR BOX meth value is not a regular value (%d), "
|
||||
"so we will ignore the entire Colour Specification box. \n", jp2->meth);
|
||||
}
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||
@@ -1137,6 +1297,9 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||
}
|
||||
|
||||
if (!jp2->ignore_pclr_cmap_cdef){
|
||||
if (!opj_jp2_check_color(p_image, &(jp2->color), p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* Set Image Color Space */
|
||||
if (jp2->enumcs == 16)
|
||||
@@ -1145,6 +1308,8 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
||||
p_image->color_space = OPJ_CLRSPC_GRAY;
|
||||
else if (jp2->enumcs == 18)
|
||||
p_image->color_space = OPJ_CLRSPC_SYCC;
|
||||
else if (jp2->enumcs == 24)
|
||||
p_image->color_space = OPJ_CLRSPC_EYCC;
|
||||
else
|
||||
p_image->color_space = OPJ_CLRSPC_UNKNOWN;
|
||||
|
||||
@@ -1181,7 +1346,7 @@ OPJ_BOOL opj_jp2_write_jp2h(opj_jp2_t *jp2,
|
||||
|
||||
OPJ_INT32 i, l_nb_pass;
|
||||
/* size of data for super box*/
|
||||
OPJ_INT32 l_jp2h_size = 8;
|
||||
OPJ_UINT32 l_jp2h_size = 8;
|
||||
OPJ_BOOL l_result = OPJ_TRUE;
|
||||
|
||||
/* to store the data of the super box */
|
||||
@@ -1408,7 +1573,8 @@ void opj_jp2_setup_encoder( opj_jp2_t *jp2,
|
||||
opj_event_mgr_t * p_manager)
|
||||
{
|
||||
OPJ_UINT32 i;
|
||||
OPJ_INT32 depth_0, sign;
|
||||
OPJ_UINT32 depth_0;
|
||||
OPJ_UINT32 sign;
|
||||
|
||||
if(!jp2 || !parameters || !image)
|
||||
return;
|
||||
@@ -1457,7 +1623,7 @@ void opj_jp2_setup_encoder( opj_jp2_t *jp2,
|
||||
sign = image->comps[0].sgnd;
|
||||
jp2->bpc = depth_0 + (sign << 7);
|
||||
for (i = 1; i < image->numcomps; i++) {
|
||||
OPJ_INT32 depth = image->comps[i].prec - 1;
|
||||
OPJ_UINT32 depth = image->comps[i].prec - 1;
|
||||
sign = image->comps[i].sgnd;
|
||||
if (depth_0 != depth)
|
||||
jp2->bpc = 255;
|
||||
@@ -1472,21 +1638,21 @@ void opj_jp2_setup_encoder( opj_jp2_t *jp2,
|
||||
}
|
||||
|
||||
/* Colour Specification box */
|
||||
if ((image->numcomps == 1 || image->numcomps == 3) && (jp2->bpc != 255)) {
|
||||
jp2->meth = 1; /* METH: Enumerated colourspace */
|
||||
} else {
|
||||
jp2->meth = 2; /* METH: Restricted ICC profile */
|
||||
}
|
||||
if (jp2->meth == 1) {
|
||||
if (image->color_space == 1)
|
||||
jp2->enumcs = 16; /* sRGB as defined by IEC 61966-2-1 */
|
||||
else if (image->color_space == 2)
|
||||
jp2->enumcs = 17; /* greyscale */
|
||||
else if (image->color_space == 3)
|
||||
jp2->enumcs = 18; /* YUV */
|
||||
} else {
|
||||
jp2->enumcs = 0; /* PROFILE (??) */
|
||||
}
|
||||
if(image->icc_profile_len) {
|
||||
jp2->meth = 2;
|
||||
jp2->enumcs = 0;
|
||||
}
|
||||
else {
|
||||
jp2->meth = 1;
|
||||
if (image->color_space == 1)
|
||||
jp2->enumcs = 16; /* sRGB as defined by IEC 61966-2-1 */
|
||||
else if (image->color_space == 2)
|
||||
jp2->enumcs = 17; /* greyscale */
|
||||
else if (image->color_space == 3)
|
||||
jp2->enumcs = 18; /* YUV */
|
||||
}
|
||||
|
||||
|
||||
jp2->precedence = 0; /* PRECEDENCE */
|
||||
jp2->approx = 0; /* APPROX */
|
||||
|
||||
@@ -1668,6 +1834,12 @@ OPJ_BOOL opj_jp2_read_header_procedure( opj_jp2_t *jp2,
|
||||
opj_free(l_current_data);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
/* testcase 1851.pdf.SIGSEGV.ce9.948 */
|
||||
else if (box.length < l_nb_bytes_read) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "invalid box size %d (%x)\n", box.length, box.type);
|
||||
opj_free(l_current_data);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
l_current_handler = opj_jp2_find_handler(box.type);
|
||||
l_current_data_size = box.length - l_nb_bytes_read;
|
||||
@@ -1675,7 +1847,7 @@ OPJ_BOOL opj_jp2_read_header_procedure( opj_jp2_t *jp2,
|
||||
if (l_current_handler != 00) {
|
||||
if (l_current_data_size > l_last_data_size) {
|
||||
OPJ_BYTE* new_current_data = (OPJ_BYTE*)opj_realloc(l_current_data,l_current_data_size);
|
||||
if (!l_current_data){
|
||||
if (!new_current_data) {
|
||||
opj_free(l_current_data);
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to handle jpeg2000 box\n");
|
||||
return OPJ_FALSE;
|
||||
@@ -1684,7 +1856,7 @@ OPJ_BOOL opj_jp2_read_header_procedure( opj_jp2_t *jp2,
|
||||
l_last_data_size = l_current_data_size;
|
||||
}
|
||||
|
||||
l_nb_bytes_read = opj_stream_read_data(stream,l_current_data,l_current_data_size,p_manager);
|
||||
l_nb_bytes_read = (OPJ_UINT32)opj_stream_read_data(stream,l_current_data,l_current_data_size,p_manager);
|
||||
if (l_nb_bytes_read != l_current_data_size) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Problem with reading JPEG2000 box, stream error\n");
|
||||
opj_free(l_current_data);
|
||||
@@ -2057,11 +2229,11 @@ OPJ_BOOL opj_jp2_read_boxhdr_char( opj_jp2_box_t *box,
|
||||
/* process read data */
|
||||
opj_read_bytes(p_data, &l_value, 4);
|
||||
p_data += 4;
|
||||
box->length = (OPJ_INT32)(l_value);
|
||||
box->length = (OPJ_UINT32)(l_value);
|
||||
|
||||
opj_read_bytes(p_data, &l_value, 4);
|
||||
p_data += 4;
|
||||
box->type = (OPJ_INT32)(l_value);
|
||||
box->type = (OPJ_UINT32)(l_value);
|
||||
|
||||
*p_number_bytes_read = 8;
|
||||
|
||||
@@ -2086,7 +2258,7 @@ OPJ_BOOL opj_jp2_read_boxhdr_char( opj_jp2_box_t *box,
|
||||
|
||||
opj_read_bytes(p_data, &l_value, 4);
|
||||
*p_number_bytes_read += 4;
|
||||
box->length = (OPJ_INT32)(l_value);
|
||||
box->length = (OPJ_UINT32)(l_value);
|
||||
|
||||
if (box->length == 0) {
|
||||
opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box of undefined sizes\n");
|
||||
@@ -2317,6 +2489,10 @@ OPJ_BOOL opj_jp2_get_tile( opj_jp2_t *p_jp2,
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
if (!opj_jp2_check_color(p_image, &(p_jp2->color), p_manager)) {
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
|
||||
/* Set Image Color Space */
|
||||
if (p_jp2->enumcs == 16)
|
||||
p_image->color_space = OPJ_CLRSPC_SRGB;
|
||||
@@ -2544,6 +2720,7 @@ static OPJ_BOOL opj_jpip_write_cidx(opj_jp2_t *jp2,
|
||||
return OPJ_TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void write_prxy( int offset_jp2c, int length_jp2c, int offset_idx, int length_idx, opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager )
|
||||
{
|
||||
@@ -2576,8 +2753,10 @@ static void write_prxy( int offset_jp2c, int length_jp2c, int offset_idx, int le
|
||||
opj_stream_write_data(cio,l_data_header,4,p_manager);
|
||||
opj_stream_seek(cio, lenp+len,p_manager);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
static int write_fidx( int offset_jp2c, int length_jp2c, int offset_idx, int length_idx, opj_stream_private_t *cio,
|
||||
opj_event_mgr_t * p_manager )
|
||||
{
|
||||
@@ -2599,4 +2778,5 @@ static int write_fidx( int offset_jp2c, int length_jp2c, int offset_idx, int len
|
||||
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
#endif /* USE_JPIP */
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* The copyright in this software is being made available under the 2-clauses
|
||||
* BSD License, included below. This software may be subject to other third
|
||||
* party and contributor rights, including patent rights, and no such rights
|
||||
* are granted under this license.
|
||||
*
|
||||
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2014, Professor Benoit Macq
|
||||
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||
* Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
|
||||
* Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR
|
||||
* Copyright (c) 2012, CS Systemes d'Information, France
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user