Compare commits
311 Commits
arelease
...
version.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42ad5bb05a | ||
|
|
aec1d7592c | ||
|
|
21f2cab710 | ||
|
|
ea9335ff48 | ||
|
|
adc1aacb60 | ||
|
|
814bab6900 | ||
|
|
1f55aaf4a6 | ||
|
|
8be8111008 | ||
|
|
1bec8fe082 | ||
|
|
7d06d7fb5d | ||
|
|
e0ee9becb4 | ||
|
|
0afa3c70bc | ||
|
|
38137b033a | ||
|
|
1200dd871a | ||
|
|
f3170bf64e | ||
|
|
7c9dc11e33 | ||
|
|
848214e789 | ||
|
|
e5240301c7 | ||
|
|
2bd0f7b8c4 | ||
|
|
fbc9a5edcb | ||
|
|
110b54c7c6 | ||
|
|
dbd132dca8 | ||
|
|
0930d9886b | ||
|
|
dd18811600 | ||
|
|
24146a96cf | ||
|
|
7dd3a5bf22 | ||
|
|
9ba672366e | ||
|
|
a1fe5809a4 | ||
|
|
5a3c1ffe7d | ||
|
|
144e1ff4e6 | ||
|
|
3f36196dfd | ||
|
|
f7c9b01800 | ||
|
|
6045158ce6 | ||
|
|
694a173adb | ||
|
|
8bc6da2ffa | ||
|
|
78003a016a | ||
|
|
9e5d0b1a40 | ||
|
|
219dd65bef | ||
|
|
ba423fe3d0 | ||
|
|
e2a54d9ac6 | ||
|
|
44ab0ccf01 | ||
|
|
192e46c32f | ||
|
|
e5c5d1064e | ||
|
|
2fb6da8d85 | ||
|
|
fd680a1cf0 | ||
|
|
313c772f4a | ||
|
|
0781b7d441 | ||
|
|
e6ce7958f2 | ||
|
|
d268ea7d6a | ||
|
|
0eaafe93ac | ||
|
|
8a75823eea | ||
|
|
e841b13166 | ||
|
|
7cb2194c8e | ||
|
|
eac141b69a | ||
|
|
d084ff59f2 | ||
|
|
dcc6f679bc | ||
|
|
3f5e8eb92b | ||
|
|
16879e20ec | ||
|
|
b700cd9101 | ||
|
|
a6d7377213 | ||
|
|
d48feb45fc | ||
|
|
b5c8558934 | ||
|
|
521b9bef33 | ||
|
|
ed3aec55fd | ||
|
|
ef560f19a3 | ||
|
|
6b9d244449 | ||
|
|
16dc670030 | ||
|
|
acd2187a43 | ||
|
|
b8445ebec0 | ||
|
|
4b75a2784c | ||
|
|
2b3947e8a8 | ||
|
|
1c43ca006d | ||
|
|
bc145d8dc8 | ||
|
|
76ee6b8441 | ||
|
|
3adfd18602 | ||
|
|
9e42842bb5 | ||
|
|
a8591daa68 | ||
|
|
265de2ed0d | ||
|
|
36007b6a76 | ||
|
|
34661c5aea | ||
|
|
d53edb5ea7 | ||
|
|
16fbba79ec | ||
|
|
fb4ad9c507 | ||
|
|
9eaaf55f7a | ||
|
|
dc069254c3 | ||
|
|
b97f88bf7e | ||
|
|
2c03b73dff | ||
|
|
6cc148e226 | ||
|
|
f9d76c0be9 | ||
|
|
bcf7032b8b | ||
|
|
0ace960ea5 | ||
|
|
b420c330b2 | ||
|
|
7fd2ae9786 | ||
|
|
3d2f2b4048 | ||
|
|
9fc6e4f4bd | ||
|
|
07fa11a94c | ||
|
|
36c6e4abb9 | ||
|
|
15949d43d1 | ||
|
|
696cd710df | ||
|
|
2d416a8017 | ||
|
|
b565431251 | ||
|
|
480021bc33 | ||
|
|
af448b94a1 | ||
|
|
4bd7195ea6 | ||
|
|
331d3e523d | ||
|
|
b5aee428ba | ||
|
|
3386c7765a | ||
|
|
97a3327f99 | ||
|
|
173ccf70d4 | ||
|
|
7860407cb5 | ||
|
|
4d6bd49719 | ||
|
|
9aa9170110 | ||
|
|
4b3aabebd2 | ||
|
|
1093244d43 | ||
|
|
0577ed8e6e | ||
|
|
4f87b9abd1 | ||
|
|
abe8e93c21 | ||
|
|
f222743e19 | ||
|
|
190b4b7c9e | ||
|
|
d55af7fe7e | ||
|
|
817681fb98 | ||
|
|
f0721df1d9 | ||
|
|
76d29b8df1 | ||
|
|
2f9aae7671 | ||
|
|
0108506433 | ||
|
|
b883da435b | ||
|
|
6a4572a56f | ||
|
|
fba75d93c4 | ||
|
|
c2b399b363 | ||
|
|
786ec27a05 | ||
|
|
2a505f73c4 | ||
|
|
e318641bfa | ||
|
|
6566009e89 | ||
|
|
a350bdc1c4 | ||
|
|
23eeec8769 | ||
|
|
f31d963a64 | ||
|
|
5e0948c142 | ||
|
|
73ada6ce7f | ||
|
|
48311061c1 | ||
|
|
39ad332cee | ||
|
|
90a4692c48 | ||
|
|
fe720be147 | ||
|
|
8d7b0c9c05 | ||
|
|
33b5757921 | ||
|
|
355b88c15d | ||
|
|
74c1b3637e | ||
|
|
9ffd9e6619 | ||
|
|
1460d23294 | ||
|
|
75cf4f0906 | ||
|
|
85c327861a | ||
|
|
c5c3ca370e | ||
|
|
72de930d08 | ||
|
|
8a662fa4b1 | ||
|
|
7546f19b51 | ||
|
|
55fb4d0b67 | ||
|
|
61e353d652 | ||
|
|
5ff45287ea | ||
|
|
6b27c32ee8 | ||
|
|
44869986ca | ||
|
|
2f75846baf | ||
|
|
ec2b3b3b3f | ||
|
|
b9b72f1951 | ||
|
|
ebeb57d7d3 | ||
|
|
e6aae96217 | ||
|
|
511d342a94 | ||
|
|
a1ec600b42 | ||
|
|
06185ea2d1 | ||
|
|
fc42b3ec84 | ||
|
|
5432a70c79 | ||
|
|
d02b01dc85 | ||
|
|
cc3e813786 | ||
|
|
d280fdef70 | ||
|
|
40fd335947 | ||
|
|
6a52f1a9df | ||
|
|
197b0505cb | ||
|
|
f8d899c4f1 | ||
|
|
d5ecae07ad | ||
|
|
8f9f70f922 | ||
|
|
69dcece31a | ||
|
|
34c8a555fa | ||
|
|
fe33ebe83c | ||
|
|
237bb54678 | ||
|
|
95bc884365 | ||
|
|
e45e87cfb7 | ||
|
|
2dc3ca544d | ||
|
|
4fb43c8af0 | ||
|
|
a5d33c992d | ||
|
|
dbd4b4945b | ||
|
|
17704c6e2f | ||
|
|
a35e8df118 | ||
|
|
d9c1214282 | ||
|
|
0674edc2ca | ||
|
|
f335cb0e0b | ||
|
|
c447f6e6bc | ||
|
|
884c8429fc | ||
|
|
5cf0326dcb | ||
|
|
59835a580e | ||
|
|
08f7bfbb5f | ||
|
|
f61cda9b7d | ||
|
|
76016d509b | ||
|
|
4458ef921c | ||
|
|
c9ac67cd05 | ||
|
|
cff5df73d9 | ||
|
|
e398154212 | ||
|
|
0ea26e7ba6 | ||
|
|
8f3bd54c3d | ||
|
|
18a9bcb882 | ||
|
|
7ee36c3a4c | ||
|
|
7f8f47566f | ||
|
|
d6a523e091 | ||
|
|
ac634b1639 | ||
|
|
a0513798bb | ||
|
|
8f4d6bbeba | ||
|
|
cd98a4f740 | ||
|
|
e25e7e767e | ||
|
|
de75303c38 | ||
|
|
32ba9920db | ||
|
|
7ae6a670fa | ||
|
|
cf4f8be5f0 | ||
|
|
ec1b970a32 | ||
|
|
ee6d0cfba9 | ||
|
|
789f6f8e7a | ||
|
|
3d2a52cd82 | ||
|
|
384068ce8c | ||
|
|
7e518596e0 | ||
|
|
f9eb8f93c2 | ||
|
|
d54925f777 | ||
|
|
eae26f958e | ||
|
|
ee7c2c28f1 | ||
|
|
8a2e6ecd8b | ||
|
|
1b0a585256 | ||
|
|
29b6a4307a | ||
|
|
ad4857df94 | ||
|
|
a73e37301a | ||
|
|
255e296113 | ||
|
|
e4696a445d | ||
|
|
81f688433d | ||
|
|
0130af0ff4 | ||
|
|
2cbcbb25b0 | ||
|
|
5197135a0a | ||
|
|
4c67811f65 | ||
|
|
8e8afafae6 | ||
|
|
370cfc43a2 | ||
|
|
d101633cfa | ||
|
|
128bcc4f62 | ||
|
|
050737bea0 | ||
|
|
63e17a19eb | ||
|
|
61e85ded8b | ||
|
|
1cc9fa6815 | ||
|
|
7bdb0331a6 | ||
|
|
623f1d96cf | ||
|
|
1de9535b8c | ||
|
|
68ebc572fc | ||
|
|
5f44ec7d01 | ||
|
|
10aee43cbc | ||
|
|
7e2e09e2a9 | ||
|
|
86ce4d4c18 | ||
|
|
361edd25b7 | ||
|
|
85691a02a6 | ||
|
|
1f96f0e92a | ||
|
|
34a6c13a2d | ||
|
|
542f06007c | ||
|
|
fdbca0fc9d | ||
|
|
632902d7e3 | ||
|
|
9310f1b4a9 | ||
|
|
ed0a46eff5 | ||
|
|
8323900f73 | ||
|
|
c83ae7397d | ||
|
|
3b1bee0eec | ||
|
|
ba1cf545df | ||
|
|
bfb2f9f58b | ||
|
|
13b8ecfe44 | ||
|
|
9e9e188ebf | ||
|
|
5034581e69 | ||
|
|
85ec5eccf7 | ||
|
|
9c8fcc3616 | ||
|
|
7976b61c89 | ||
|
|
43a6b92345 | ||
|
|
f25acae0bc | ||
|
|
9225f53d62 | ||
|
|
eb1b017ec7 | ||
|
|
0ddef9b2db | ||
|
|
1bdb07cefe | ||
|
|
0a879e2207 | ||
|
|
f3c3eab744 | ||
|
|
08209f1d23 | ||
|
|
3ec116ae08 | ||
|
|
3b600a986c | ||
|
|
0d4a38f3a5 | ||
|
|
2410db2ae7 | ||
|
|
e1278bc691 | ||
|
|
899439a906 | ||
|
|
02e3a4ec77 | ||
|
|
7250ce0668 | ||
|
|
2ebe5f2c92 | ||
|
|
3c730a804b | ||
|
|
313975debf | ||
|
|
0abe8e1997 | ||
|
|
bc5c5115cb | ||
|
|
61ac18531a | ||
|
|
0ee21bdbfe | ||
|
|
d116ca5d10 | ||
|
|
26a630dad2 | ||
|
|
2c2730280e | ||
|
|
2e2ba14c53 | ||
|
|
9fa68ca811 | ||
|
|
d38080aa00 | ||
|
|
aa6c1d28ad | ||
|
|
ba4fd784f5 | ||
|
|
3d67d80d49 | ||
|
|
25e97927f9 |
77
CMakeLists.txt
Normal file
77
CMakeLists.txt
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org)
|
||||||
|
# Written by Mathieu Malaterre
|
||||||
|
|
||||||
|
# This CMake project will by default create a library called openjpeg
|
||||||
|
# But if you want to use this project within your own (CMake) project
|
||||||
|
# you will eventually like to prefix the library to avoid linking confusion
|
||||||
|
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
|
||||||
|
# e.g.:
|
||||||
|
# SET(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
|
||||||
|
PROJECT(OPENJPEG C)
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.2)
|
||||||
|
|
||||||
|
IF(NOT OPENJPEG_NAMESPACE)
|
||||||
|
SET(OPENJPEG_NAMESPACE "OPENJPEG")
|
||||||
|
SET(OPENJPEG_STANDALONE 1)
|
||||||
|
ENDIF(NOT OPENJPEG_NAMESPACE)
|
||||||
|
# In all cases:
|
||||||
|
STRING(TOLOWER ${OPENJPEG_NAMESPACE} OPENJPEG_LIBRARY_NAME)
|
||||||
|
|
||||||
|
PROJECT(${JPEG_NAMESPACE} C)
|
||||||
|
|
||||||
|
# Do full dependency headers.
|
||||||
|
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# OPENJPEG version number, usefull for packaging and doxygen doc:
|
||||||
|
SET(OPENJPEG_MAJOR_VERSION 1)
|
||||||
|
SET(OPENJPEG_MINOR_VERSION 0)
|
||||||
|
SET(OPENJPEG_BUILD_VERSION 0)
|
||||||
|
SET(OPENJPEG_VERSION
|
||||||
|
"${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}")
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# OpenJPEG build configuration options.
|
||||||
|
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG with shared libraries." OFF)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# For the codec...
|
||||||
|
OPTION(BUILD_EXAMPLES "Build the Examples (codec...)." OFF)
|
||||||
|
|
||||||
|
|
||||||
|
# configure name mangling to allow multiple libraries to coexist
|
||||||
|
# peacefully
|
||||||
|
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
|
SET(MANGLE_PREFIX ${OPENJPEG_LIBRARY_NAME})
|
||||||
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/openjpeg_mangle.h
|
||||||
|
@ONLY IMMEDIATE)
|
||||||
|
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/openjpeg_mangle.h.in)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Always build the library
|
||||||
|
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
SUBDIRS(
|
||||||
|
libopenjpeg
|
||||||
|
)
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Build example only if requested
|
||||||
|
IF(BUILD_EXAMPLES)
|
||||||
|
SUBDIRS(codec)
|
||||||
|
ENDIF(BUILD_EXAMPLES)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# For openjpeg team if they ever want Dart+CMake
|
||||||
|
IF(OPJ_STANDALONE)
|
||||||
|
INCLUDE(Dart)
|
||||||
|
MARK_AS_ADVANCED(BUILD_TESTING DART_ROOT TCL_TCLSH)
|
||||||
|
IF(BUILD_TESTING)
|
||||||
|
ENABLE_TESTING()
|
||||||
|
SET(BUILDNAME "OpenJPEG-${CMAKE_SYSTEM}-${CMAKE_C_COMPILER}" CACHE STRING "Name of build on the dashboard")
|
||||||
|
MARK_AS_ADVANCED(BUILDNAME)
|
||||||
|
ENDIF(BUILD_TESTING)
|
||||||
|
ENDIF(OPJ_STANDALONE)
|
||||||
|
|
||||||
|
# TODO, technically we should add tests, e.g:
|
||||||
|
# http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
||||||
|
|
||||||
39
CVSROOT/checkCtrlM
Executable file
39
CVSROOT/checkCtrlM
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# checkCtrlM checks source code for explicit ctrl-M's
|
||||||
|
# checks only files with the following extensions: .c, .cxx, .txx, .html, .htm
|
||||||
|
# exits with 0, if all commited files pass the test.
|
||||||
|
# exits with 1, if any one of the tests fails
|
||||||
|
#
|
||||||
|
# checkCtrlM can be run as a cvs commitinfo command.
|
||||||
|
# The following commitinfo line (without the #) will run the script
|
||||||
|
# ALL $CVSROOT/CVSROOT/checkCtrlM
|
||||||
|
#
|
||||||
|
failed=0
|
||||||
|
#
|
||||||
|
# skip the first arg, the directory
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
for file in "$@"; do
|
||||||
|
#
|
||||||
|
# select files with extentions .txx, .cxx, .h, .html, .htm, .c, .txt, .cmake
|
||||||
|
match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]html\$\|\[\.\]htm\$\|\[\.\]c\$\|\[\.\]txt\$\|\[\.\]cmake\$`
|
||||||
|
if [ "x$match" != "x" ] ; then
|
||||||
|
count=`grep -n
|
||||||
|
\$ /dev/null $file|wc -c`
|
||||||
|
results=`expr $count \| 0`
|
||||||
|
if [ "$results" != "0" ]; then
|
||||||
|
echo "=========================================================="
|
||||||
|
if [ $results -lt 200 ]; then
|
||||||
|
grep -n
|
||||||
|
\$ /dev/null $file
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "$file has ^M's. They must be removed before you can commit."
|
||||||
|
echo "The problem count was $results"
|
||||||
|
echo "=========================================================="
|
||||||
|
failed=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
exit $failed
|
||||||
32
CVSROOT/checkTabs
Executable file
32
CVSROOT/checkTabs
Executable file
@@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/tcsh
|
||||||
|
#
|
||||||
|
# checkTabs checks source code for explicit TABS
|
||||||
|
# checks only files with the following extensions: .c, .cxx, .txx,
|
||||||
|
# exits with 0, if all commited files pass the test.
|
||||||
|
# exits with 1, if any one of the tests fails
|
||||||
|
#
|
||||||
|
# checkTabs can be run as a cvs commitinfo command.
|
||||||
|
# The following commitinfo line (without the #) will run the script
|
||||||
|
# ALL $CVSROOT/CVSROOT/checkTabs
|
||||||
|
#
|
||||||
|
set failed=0
|
||||||
|
#
|
||||||
|
# skip the first arg, the directory
|
||||||
|
foreach file ( $argv[2-] )
|
||||||
|
#
|
||||||
|
# select files with extentions .txx, .cxx, .h, .html, .htm
|
||||||
|
set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]cpp\$\|\[\.\]htm\$\|\[\.\]html\$\|\[\.\]c\$\|\[\.\]mm\$\|\[\.\]h.in\$\|\[\.\]hxx.in\$\|CMakeLists.txt\$\|\[\.\]cmake\$\|\[\.\]cmake.in\$`
|
||||||
|
if ( $match == "" ) continue;
|
||||||
|
set count=`grep -n " " /dev/null $file|wc -c`
|
||||||
|
set results=`expr $count \| 0`
|
||||||
|
if ( "$results" != "0" ) then
|
||||||
|
echo "=========================================================="
|
||||||
|
grep -n " " /dev/null $file
|
||||||
|
echo ""
|
||||||
|
echo "$file has explicit TABSs."
|
||||||
|
echo "They must be converted to SPACES(2 per TAB) before you can commit."
|
||||||
|
echo "=========================================================="
|
||||||
|
set failed=1
|
||||||
|
endif
|
||||||
|
end
|
||||||
|
exit $failed
|
||||||
15
CVSROOT/checkoutlist
Normal file
15
CVSROOT/checkoutlist
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# The "checkoutlist" file is used to support additional version controlled
|
||||||
|
# administrative files in $CVSROOT/CVSROOT, such as template files.
|
||||||
|
#
|
||||||
|
# The first entry on a line is a filename which will be checked out from
|
||||||
|
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
|
||||||
|
# The remainder of the line is an error message to use if the file cannot
|
||||||
|
# be checked out.
|
||||||
|
#
|
||||||
|
# File format:
|
||||||
|
#
|
||||||
|
# [<whitespace>]<filename><whitespace><error message><end-of-line>
|
||||||
|
#
|
||||||
|
# comment lines begin with '#'
|
||||||
|
checkCtrlM cannot check out checkCtrlM
|
||||||
|
checkTabs cannot check out checkTabs
|
||||||
18
CVSROOT/commitinfo
Normal file
18
CVSROOT/commitinfo
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# The "commitinfo" file is used to control pre-commit checks.
|
||||||
|
# The filter on the right is invoked with the repository and a list
|
||||||
|
# of files to check. A non-zero exit of the filter program will
|
||||||
|
# cause the commit to be aborted.
|
||||||
|
#
|
||||||
|
# The first entry on a line is a regular expression which is tested
|
||||||
|
# against the directory that the change is being committed to, relative
|
||||||
|
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||||
|
# of the line is the name of the filter to run.
|
||||||
|
#
|
||||||
|
# If the repository name does not match any of the regular expressions in this
|
||||||
|
# file, the "DEFAULT" line is used, if it is specified.
|
||||||
|
#
|
||||||
|
# If the name "ALL" appears as a regular expression it is always used
|
||||||
|
# in addition to the first matching regex or "DEFAULT".
|
||||||
|
|
||||||
|
ALL $CVSROOT/CVSROOT/checkCtrlM %r/%p %s
|
||||||
|
# ALL $CVSROOT/CVSROOT/checkTabs %r/%p %s
|
||||||
14
CVSROOT/config
Normal file
14
CVSROOT/config
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Set this to "no" if pserver shouldn't check system users/passwords
|
||||||
|
#SystemAuth=no
|
||||||
|
|
||||||
|
# Put CVS lock files in this directory rather than directly in the repository.
|
||||||
|
#LockDir=/var/lock/cvs
|
||||||
|
|
||||||
|
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
|
||||||
|
# level of the new working directory when using the `cvs checkout'
|
||||||
|
# command.
|
||||||
|
#TopLevelAdmin=no
|
||||||
|
|
||||||
|
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
|
||||||
|
# history file, or a subset as needed (ie `TMAR' logs all write operations)
|
||||||
|
#LogHistory=TOFEWGCMAR
|
||||||
23
CVSROOT/cvswrappers
Normal file
23
CVSROOT/cvswrappers
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# This file affects handling of files based on their names.
|
||||||
|
#
|
||||||
|
# The -t/-f options allow one to treat directories of files
|
||||||
|
# as a single file, or to transform a file in other ways on
|
||||||
|
# its way in and out of CVS.
|
||||||
|
#
|
||||||
|
# The -m option specifies whether CVS attempts to merge files.
|
||||||
|
#
|
||||||
|
# The -k option specifies keyword expansion (e.g. -kb for binary).
|
||||||
|
#
|
||||||
|
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
|
||||||
|
#
|
||||||
|
# wildcard [option value][option value]...
|
||||||
|
#
|
||||||
|
# where option is one of
|
||||||
|
# -f from cvs filter value: path to filter
|
||||||
|
# -t to cvs filter value: path to filter
|
||||||
|
# -m update methodology value: MERGE or COPY
|
||||||
|
# -k expansion mode value: b, o, kkv, &c
|
||||||
|
#
|
||||||
|
# and value is a single-quote delimited value.
|
||||||
|
# For example:
|
||||||
|
#*.gif -k 'b'
|
||||||
21
CVSROOT/editinfo
Normal file
21
CVSROOT/editinfo
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# The "editinfo" file is used to allow verification of logging
|
||||||
|
# information. It works best when a template (as specified in the
|
||||||
|
# rcsinfo file) is provided for the logging procedure. Given a
|
||||||
|
# template with locations for, a bug-id number, a list of people who
|
||||||
|
# reviewed the code before it can be checked in, and an external
|
||||||
|
# process to catalog the differences that were code reviewed, the
|
||||||
|
# following test can be applied to the code:
|
||||||
|
#
|
||||||
|
# Making sure that the entered bug-id number is correct.
|
||||||
|
# Validating that the code that was reviewed is indeed the code being
|
||||||
|
# checked in (using the bug-id number or a seperate review
|
||||||
|
# number to identify this particular code set.).
|
||||||
|
#
|
||||||
|
# If any of the above test failed, then the commit would be aborted.
|
||||||
|
#
|
||||||
|
# Actions such as mailing a copy of the report to each reviewer are
|
||||||
|
# better handled by an entry in the loginfo file.
|
||||||
|
#
|
||||||
|
# One thing that should be noted is the the ALL keyword is not
|
||||||
|
# supported. There can be only one entry that matches a given
|
||||||
|
# repository.
|
||||||
26
CVSROOT/loginfo
Normal file
26
CVSROOT/loginfo
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# The "loginfo" file controls where "cvs commit" log information
|
||||||
|
# is sent. The first entry on a line is a regular expression which must match
|
||||||
|
# the directory that the change is being made to, relative to the
|
||||||
|
# $CVSROOT. If a match is found, then the remainder of the line is a filter
|
||||||
|
# program that should expect log information on its standard input.
|
||||||
|
#
|
||||||
|
# If the repository name does not match any of the regular expressions in this
|
||||||
|
# file, the "DEFAULT" line is used, if it is specified.
|
||||||
|
#
|
||||||
|
# If the name ALL appears as a regular expression it is always used
|
||||||
|
# in addition to the first matching regex or DEFAULT.
|
||||||
|
#
|
||||||
|
# You may specify a format string as part of the
|
||||||
|
# filter. The string is composed of a `%' followed
|
||||||
|
# by a single format character, or followed by a set of format
|
||||||
|
# characters surrounded by `{' and `}' as separators. The format
|
||||||
|
# characters are:
|
||||||
|
#
|
||||||
|
# s = file name
|
||||||
|
# V = old version number (pre-checkin)
|
||||||
|
# v = new version number (post-checkin)
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||||
|
# or
|
||||||
|
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||||
29
CVSROOT/modules
Normal file
29
CVSROOT/modules
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Three different line formats are valid:
|
||||||
|
# key -a aliases...
|
||||||
|
# key [options] directory
|
||||||
|
# key [options] directory files...
|
||||||
|
#
|
||||||
|
# Where "options" are composed of:
|
||||||
|
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
||||||
|
# -o prog Run "prog" on "cvs checkout" of module.
|
||||||
|
# -e prog Run "prog" on "cvs export" of module.
|
||||||
|
# -t prog Run "prog" on "cvs rtag" of module.
|
||||||
|
# -u prog Run "prog" on "cvs update" of module.
|
||||||
|
# -d dir Place module in directory "dir" instead of module name.
|
||||||
|
# -l Top-level directory only -- do not recurse.
|
||||||
|
#
|
||||||
|
# NOTE: If you change any of the "Run" options above, you'll have to
|
||||||
|
# release and re-checkout any working directories of these modules.
|
||||||
|
#
|
||||||
|
# And "directory" is a path to a directory relative to $CVSROOT.
|
||||||
|
#
|
||||||
|
# The "-a" option specifies an alias. An alias is interpreted as if
|
||||||
|
# everything on the right of the "-a" had been typed on the command line.
|
||||||
|
#
|
||||||
|
# You can encode a module within a module by using the special '&'
|
||||||
|
# character to interpose another module into the current module. This
|
||||||
|
# can be useful for creating a module that consists of many directories
|
||||||
|
# spread out over the entire source repository.
|
||||||
|
|
||||||
|
opj-base -l -d . .
|
||||||
|
openjpeg -a opj-base libopenjpeg codec doc
|
||||||
12
CVSROOT/notify
Normal file
12
CVSROOT/notify
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# The "notify" file controls where notifications from watches set by
|
||||||
|
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
|
||||||
|
# a regular expression which is tested against the directory that the
|
||||||
|
# change is being made to, relative to the $CVSROOT. If it matches,
|
||||||
|
# then the remainder of the line is a filter program that should contain
|
||||||
|
# one occurrence of %s for the user to notify, and information on its
|
||||||
|
# standard input.
|
||||||
|
#
|
||||||
|
# "ALL" or "DEFAULT" can be used in place of the regular expression.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#ALL mail %s -s "CVS notification"
|
||||||
13
CVSROOT/rcsinfo
Normal file
13
CVSROOT/rcsinfo
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# The "rcsinfo" file is used to control templates with which the editor
|
||||||
|
# is invoked on commit and import.
|
||||||
|
#
|
||||||
|
# The first entry on a line is a regular expression which is tested
|
||||||
|
# against the directory that the change is being made to, relative to the
|
||||||
|
# $CVSROOT. For the first match that is found, then the remainder of the
|
||||||
|
# line is the name of the file that contains the template.
|
||||||
|
#
|
||||||
|
# If the repository name does not match any of the regular expressions in this
|
||||||
|
# file, the "DEFAULT" line is used, if it is specified.
|
||||||
|
#
|
||||||
|
# If the name "ALL" appears as a regular expression it is always used
|
||||||
|
# in addition to the first matching regex or "DEFAULT".
|
||||||
20
CVSROOT/taginfo
Normal file
20
CVSROOT/taginfo
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# The "taginfo" file is used to control pre-tag checks.
|
||||||
|
# The filter on the right is invoked with the following arguments:
|
||||||
|
#
|
||||||
|
# $1 -- tagname
|
||||||
|
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
|
||||||
|
# $3 -- repository
|
||||||
|
# $4-> file revision [file revision ...]
|
||||||
|
#
|
||||||
|
# A non-zero exit of the filter program will cause the tag to be aborted.
|
||||||
|
#
|
||||||
|
# The first entry on a line is a regular expression which is tested
|
||||||
|
# against the directory that the change is being committed to, relative
|
||||||
|
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||||
|
# of the line is the name of the filter to run.
|
||||||
|
#
|
||||||
|
# If the repository name does not match any of the regular expressions in this
|
||||||
|
# file, the "DEFAULT" line is used, if it is specified.
|
||||||
|
#
|
||||||
|
# If the name "ALL" appears as a regular expression it is always used
|
||||||
|
# in addition to the first matching regex or "DEFAULT".
|
||||||
21
CVSROOT/verifymsg
Normal file
21
CVSROOT/verifymsg
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# The "verifymsg" file is used to allow verification of logging
|
||||||
|
# information. It works best when a template (as specified in the
|
||||||
|
# rcsinfo file) is provided for the logging procedure. Given a
|
||||||
|
# template with locations for, a bug-id number, a list of people who
|
||||||
|
# reviewed the code before it can be checked in, and an external
|
||||||
|
# process to catalog the differences that were code reviewed, the
|
||||||
|
# following test can be applied to the code:
|
||||||
|
#
|
||||||
|
# Making sure that the entered bug-id number is correct.
|
||||||
|
# Validating that the code that was reviewed is indeed the code being
|
||||||
|
# checked in (using the bug-id number or a seperate review
|
||||||
|
# number to identify this particular code set.).
|
||||||
|
#
|
||||||
|
# If any of the above test failed, then the commit would be aborted.
|
||||||
|
#
|
||||||
|
# Actions such as mailing a copy of the report to each reviewer are
|
||||||
|
# better handled by an entry in the loginfo file.
|
||||||
|
#
|
||||||
|
# One thing that should be noted is the the ALL keyword is not
|
||||||
|
# supported. There can be only one entry that matches a given
|
||||||
|
# repository.
|
||||||
256
ChangeLog
Normal file
256
ChangeLog
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
What's New for OpenJPEG
|
||||||
|
|
||||||
|
* : fixed
|
||||||
|
- : removed
|
||||||
|
! : changed
|
||||||
|
+ : added
|
||||||
|
|
||||||
|
----------------------
|
||||||
|
MAY 4, 2007
|
||||||
|
VERSION 1.2.0 RELEASED
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
May 4, 2007
|
||||||
|
* [FOD] Bugs corrected in decoding of command line (getopt.c), in the handling of 16 bit files (t1.c and tcd.c) and the calculation of elapsed time for multiple tiles parts (tcd.c and tdc.h).
|
||||||
|
|
||||||
|
June 2, 2007
|
||||||
|
+ [GB] OPJViewer opens now BMP, PNG, GIF, PNM, TIFF (with wxWidgets internals); added an encoder settings tab, for future integration with "save file as..." in JPEG 2000 format
|
||||||
|
|
||||||
|
May 31, 2007
|
||||||
|
* [FOD] Fixed the handling of 16bit TIFF files for cinema compression. Modified "convert.c"
|
||||||
|
* [FOD] Fixed the parameters used for cinema compression (9-7 transform used instead of 5-3). Modified "image_to_j2k.c"
|
||||||
|
|
||||||
|
May 24, 2007
|
||||||
|
* [FOD] Bug fixed by Sylvain Munaut. Change in the reading of the POC marker. Since COD/COC can be anywhere in the header, the decoder cannot always know while decoding the POC marker the value of numlayers and numresolution.
|
||||||
|
|
||||||
|
May 23, 2007
|
||||||
|
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This makes the t1 data arrays dynamic, which greatly reduces cache thrashing. Also, some minor cleanup to prevent unnecessary casts"
|
||||||
|
|
||||||
|
May 22, 2007
|
||||||
|
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "Some formatting cleanups, so that the long function definitions and calls fit on screen. Use of prefix increment which is theoretically faster, in practice any sane compiler can optimize a postfix increment but its best not to count on such things. Consolidation of some redundant calculations in the inner loops, which becomes very useful in the future autovectorize patch."
|
||||||
|
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This changes the flag code in t1 to use a flag_t type, which can then be changed to reduce RAM usage. It is now typedef to a short."
|
||||||
|
! [FOD] Patch suggested by Callum Lerwick <seg@haxxed.com>: "This patch makes the t1 LUTs static. I actually intend this as a prelude to possibly eliminating some or all of the LUTs entirely."
|
||||||
|
|
||||||
|
May 11, 2007
|
||||||
|
- [FOD] JP3D library Binaries removed from SVN.
|
||||||
|
! [FOD] MJ2 codec updated from LibOpenJPEG version 0.97 to LibOpenJPEG version 1. Hence, the MJ2 codec will now take advantage of all the improvements and optimizations done on the LibOpenJPEG library.
|
||||||
|
! [FOD] Possibility to choose to apply MCT (multiple component transform) enabled, and new decoding_limit: DECODE_ALL_BUT_PACKETS (openjpeg.h)
|
||||||
|
|
||||||
|
April 26, 2007
|
||||||
|
+ [gdcm] Add basic steps on how to use CMake for building examples (README.cmake)
|
||||||
|
|
||||||
|
April 25, 2007
|
||||||
|
+ [FOD] Modification of the openjpeg.h file to avoid and ABI break with v1.1, removed the dangerous #IFDEF JPWL and added tcp_mct in cparameters.
|
||||||
|
|
||||||
|
April 23, 2007
|
||||||
|
+ [GB] Enable/disable image decoding in OPJViewer
|
||||||
|
|
||||||
|
April 12,2007
|
||||||
|
* [Parvatha] Fixed Error in tiftoimage(). Modification in convert.c.
|
||||||
|
|
||||||
|
April 10,2007
|
||||||
|
+ [Parvatha] Accepting "j2c" as format for Encoding and Decoding. Modification in image_to_j2k.c.
|
||||||
|
* [Parvatha] Modified imagetotif() to read images with signed data. Modification in convert.c.
|
||||||
|
|
||||||
|
April 5, 2007
|
||||||
|
! [FOD] fix.h optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> !
|
||||||
|
! [FOD] dwt.c optimized. Thanks a lot to Dzonatas <dzonatas at dzonux.net> !
|
||||||
|
! [FOD] t1.c optimized. Thanks a lot to Callum Lerwick <seg at haxxed.com> !
|
||||||
|
|
||||||
|
April 4,2007
|
||||||
|
+ [Parvatha] Digital cinema compliance for 4K chosen by "-cinema4K" option. Modification in image_to_j2k.c.
|
||||||
|
+ [Parvatha] Bit rate limitation for each color component. Modification in image_to_j2k.c, t2.c.
|
||||||
|
* [Parvatha] Modified and tested Progression order change "-POC" option. Modification in image_to_j2k.c, j2k.c, pi.c.
|
||||||
|
+ [Parvatha] Function j2k_check_poc_val() to check for possible loss of packets in case of wrong POC declaration. Modification in j2k.c.
|
||||||
|
+ [Parvatha] Structure T2_MODE. This tells if the t2_encode_packets() is called during Threshold calculation or in Final pass. Modification in j2k.h, tcd.c
|
||||||
|
|
||||||
|
March 30, 2007
|
||||||
|
* [GB] OPJViewer should now work under Linux, at least with not big j2k files. Tested under Suse 10.1 64 bit.
|
||||||
|
|
||||||
|
March 29, 2007
|
||||||
|
* [Parvatha] Enable accepting file names with `-<2D> symbol .Modification getopt.c
|
||||||
|
* [Parvatha] Rsiz profile name generation to be STD_RSIZ for profiles which are not DCI compliant.Modification in image_to_j2k.c
|
||||||
|
! [Parvatha] renamed convert_progression_order to j2k_convert_progression_order. Modification j2k.c
|
||||||
|
* [Parvatha] Calculation of number of tile part in each tile in j2k_calculate_tp. Modification j2k.c
|
||||||
|
! [Parvatha] j2k_setup_encoder to set bit rate limitation for digital cinema compliance with quality option. Modification in j2k.c
|
||||||
|
* [Parvatha] Equation to check multiple tile precincts. Modification pi.c
|
||||||
|
! [Parvatha] array size generation of pi->include in pi_initialise_encode().Modification in pi.c
|
||||||
|
* [Parvatha] modification in pi_create_encode for tile part generation.Modification in pi.c
|
||||||
|
+ [Parvatha] In tcd_rateallocate a variable stable_threshold which holds the valid threshold value. This is used to avoid error in case of a wrong threshold value in the last iteration. Modification in tcd.c.
|
||||||
|
|
||||||
|
March 28, 2007
|
||||||
|
* [FOD] Fixed an historical bug in t1.c that leaded to the inclusion of useless 0xFF in the codestream. Thanks to Sylvain, Pascal and Parvatha !
|
||||||
|
|
||||||
|
March 27, 2007
|
||||||
|
+ [GB] Improved parsing in OPJViewer, as well some minor aesthetic modifications; support for image rendering with bit depths lower than 8 bits; can display an arbitrary frame of an MJ2 file (only in B/W, though); can reload a file; better resizing capabilities
|
||||||
|
* [GB] Following to Herv<72>'s suggestions, all the exit() calls, added by JPWL strict checking in t2.c and j2k.c, have been substituted with (object free'ing + opj_evt_message(EVT_ERROR) + return)
|
||||||
|
+ [GB] Added linking to TIFF library in the JPWL VC6 workspaces
|
||||||
|
|
||||||
|
March 23, 2007
|
||||||
|
* [antonin] Fixed Makefile.osx and changed Readme.osx accordingly
|
||||||
|
|
||||||
|
March 21, 2007
|
||||||
|
* [Parvatha] Fixed j2k_prog_order_list[]. Modifications in j2k.c.
|
||||||
|
* [Parvatha] Fixed t1_decode_cblks. Modifications in t1.c.
|
||||||
|
|
||||||
|
March 20, 2007
|
||||||
|
+ [Parvatha] Added feature for generation of tile parts. Modifications in image_to_j2k.c, openjpeg.c, j2k.c, pi.c
|
||||||
|
+ [Parvatha] Added function j2k_write_tlm(),to generate TLM marker for a Digital cinema compliant codestream. Modifications in j2k.c.
|
||||||
|
|
||||||
|
March 14, 2007
|
||||||
|
* [FOD] Fixed linux makefile, with help from David Fries and Guido
|
||||||
|
|
||||||
|
March 7, 2007
|
||||||
|
+ [Parvatha] Added option for Digital cinema profile compliant codestream. This can be chosen by "-cinema2K" or "-cinema4K" for a 2K and 4K compliance respectively. The feature for tileparts has not been implemented in this version. Modification in image_to_j2k.c
|
||||||
|
+ [Parvatha] Added the Digital Cinema profiles (CINEMA2K and CINEMA4K) to the list of profiles recognized in the codestream SIZ marker segment. Modification in openjpeg.h,j2k.c
|
||||||
|
+ [Parvatha] Added feature for constant quality within bitrate defined in Digital cinema standards. Modification in tcd.c
|
||||||
|
! [Parvatha] Modified the method of generation of buffer length. Modification in cio.c
|
||||||
|
|
||||||
|
|
||||||
|
March 1, 2007
|
||||||
|
* [FOD] Modified codec projects (*.dsp) and makefile to include the tiff library (modified codec/image_to_j2k.dsp codec/j2k_to_image.dsp and codec/makefile)
|
||||||
|
+ [GB] Zoom capability and decoder settings dialog in OPJViewer; modified JPWL library .dsp project in order to create a library with embedded JPWL functions
|
||||||
|
|
||||||
|
February 28, 2007
|
||||||
|
+ [Parvatha] Enabled compression of TIF image format to j2k by tifftoimage() and decompression of codestream to TIF image format using imagetotif(). Modifications in image_to_j2k.c, j2k_to_image.c, convert.c, convert.h
|
||||||
|
* [antonin] fixed a bug in context numerotation that prevented the RESET switch to work correctly : mqc_reset_enc in mqc.c
|
||||||
|
* [Fod] Corrected codec Makefile by adding the compilation of "compat/getopt.c"
|
||||||
|
|
||||||
|
February 27, 2007
|
||||||
|
* [Parvatha] Made get_file_format function more robust. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||||
|
|
||||||
|
February 26, 2007
|
||||||
|
+ [Parvatha] Option to read images from a Folder whose path is specified in the Input parameters by "-ImgDir" along with output decod format specified by "-OutFor" . Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||||
|
+ [Parvatha] Enabling use of multi character input parameters in the codec. Modifications in image_to_j2k.c, j2k_to_image.c, getopt.c, getopt.h
|
||||||
|
|
||||||
|
----------------------
|
||||||
|
February 23, 2007
|
||||||
|
VERSION 1.1.1 RELEASED
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
February 23, 2007
|
||||||
|
* [GB] Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c. As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib
|
||||||
|
+ [GB] Linux makefile for the JPWL module; newlines at end of JPWL files
|
||||||
|
|
||||||
|
February 22, 2007
|
||||||
|
+ [FOD] Added the OPJViewer Module (/OPJViewer), developed by Giuseppe Baruffa of the university of Perugia
|
||||||
|
|
||||||
|
February 21, 2007
|
||||||
|
+ [FOD] Algorithmic optimizations in t1.c, thanks to Guido J. !
|
||||||
|
|
||||||
|
February 19, 2007
|
||||||
|
+ [FOD] Added OPJ_LIMIT_DECODING enabling us to limit the decoding to main header (modified openjpeg.c, openjpeg.h, j2k.c and j2k.h)
|
||||||
|
|
||||||
|
February 13, 2007
|
||||||
|
! [FOD] David Fries suggestions. In image_to_j2k and j2k_to_image, strncpy() functions: instead of specifying the path size macro, let the compiler read the length out of the array entry.
|
||||||
|
! [FOD] David Fries suggestions. Makefile modified. -fPIC flag used for 64-bit compilation. Move operation (rather than copy) for the dist library creation, and -p flag added.
|
||||||
|
|
||||||
|
January 31, 2007
|
||||||
|
! [FOD] Extra tokens at the end of #endif directive corrected in openjpeg.c, j2k.c and image_to_j2k.c -> no more warnings in linux compilation
|
||||||
|
! [FOD] Linux Makefile added for the codec
|
||||||
|
|
||||||
|
January 30, 2007
|
||||||
|
! [FOD] Use of OPJ_PATH_LEN (defined as 4096) to be the maximum allowed size for filenames instead of MAX_PATH which is not always defined. This caused some programs using OpenJPEG to crash. Modifications in openjpeg.h j2k_to_image.c and image_to_j2k.c
|
||||||
|
! [FOD] Correction of the syntax usage in MJ2_codec/mj2_to_frames.c
|
||||||
|
|
||||||
|
January 23, 2007
|
||||||
|
! [FOD] Modification in the context numbers, to reflect what has been specified in standard, in libopenjpeg/t1.h
|
||||||
|
|
||||||
|
December 07, 2006
|
||||||
|
+ [Giuseppe Baruffa] Antonin verified that the MacOS build suffered from a missing definition of the "min" macro; I've added this definition (properly #ifndef'ed) into both jpwl.h and rs.h
|
||||||
|
|
||||||
|
December 05, 2006
|
||||||
|
* [Giuseppe Baruffa] Better fix of the TPH EPBs bug in JPWL module
|
||||||
|
* [GB] Fixed the UEP bug in JPWL module; now, during a UEP specification, RS protection or CRC check can be switched off for selected range of packets, and consequently reswitched on without confusing the decoder
|
||||||
|
+ [GB] Added some lines in the help of JPWL_image_to_j2k, specifying that when using error protection on data packets, this must be paired with header protection, i.e. there cannot be packet protection without header protection
|
||||||
|
|
||||||
|
December 04, 2006
|
||||||
|
|
||||||
|
+ [Francois-Olivier Devaux] New tag: version1.0 (includes codec and libopenjpeg directories)
|
||||||
|
Total update of JPWL module
|
||||||
|
- [FOD] removed directories jpwl/decoder, jpwl/encoder, jpwl/decoder_02, jpwl/encoder_02
|
||||||
|
+ [FOD] added in JPWL directory crc.h, jpwl.h, rs.h, crc.c, jpwl.c, jpwl_lib.c, rs.c, JPWL_image_to_j2k.dsp, JPWL_j2k_to_image.dsp, LibOpenJPEG_JPWL.dsp, JPWL_image_to_j2k.dsw, JPWL_j2k_to_image.dsw
|
||||||
|
! [FOD] Modifications of libopenjpeg to integrate JPWL module (in libopenjpeg directory): j2k.c, j2k.h, openjpeg.c, openjpeg.h, opj_includes.g, t2.c
|
||||||
|
! [FOD] Modification of codec to integrate JPWL module (in codec directory): image_to_j2k.c, j2k_to_image.c
|
||||||
|
* [FOD] Corrected incorrect fprintf() formatting in codec/convert.c
|
||||||
|
* [FOD] Code optimization usinq vsprintf() command in libopenjpeg/event.c
|
||||||
|
* [Giuseppe Baruffa] Fixed a bug in TPH EPBs parameters: now, "last in current header" information is correctly signaled
|
||||||
|
|
||||||
|
October 31, 2006
|
||||||
|
* [Antonin] fixed a bug in the computation of the mantissa (mu)
|
||||||
|
+ [Antonin] added the ability to specify the rate as "float" (before : integer)
|
||||||
|
|
||||||
|
August 18, 2006
|
||||||
|
* [Antonin] fixed a bug in j2k_to_image.c, that prevented the -l option to work correctly.
|
||||||
|
|
||||||
|
August 4, 2006
|
||||||
|
* [Antonin] fixed a bug in pi.c, line 473, that appeared when more than 100 precincts were generated in a resolution level.
|
||||||
|
|
||||||
|
July 28, 2006
|
||||||
|
+ [Antonin Descampe] added a readme in /mj2 to warn people that it only works with opj0.97
|
||||||
|
|
||||||
|
July 21, 2006
|
||||||
|
* [Mathieu Malaterre] Install exe and lib and include correctly
|
||||||
|
* [Mathieu Malaterre] Fixed mem leaks and greyscale bmp
|
||||||
|
* [Mathieu Malaterre] Fix pgx name length + random memory access
|
||||||
|
! [Mathieu Malaterre] API is now const
|
||||||
|
|
||||||
|
March 19, 2006
|
||||||
|
* [Antonin] fixed a bug in t1.c that prevented in some cases a true lossless compression (thanks to Don Mimlitch for reporting this bug)
|
||||||
|
|
||||||
|
February 12, 2006
|
||||||
|
- [Herve Drolon] removed unneeded working variables in opj_tcd_t
|
||||||
|
|
||||||
|
February 04, 2006
|
||||||
|
* [galt] fixed a bug in codec/convert.c::imagetobmp
|
||||||
|
|
||||||
|
February 01, 2006
|
||||||
|
! [Herve Drolon] changed function definitions of INT and FIX modules to 'inline'
|
||||||
|
+ [Herve Drolon] added a VERSION resource to the DLL version of OpenJPEG
|
||||||
|
|
||||||
|
January 31, 2006
|
||||||
|
* [Mathieu Malaterre] Fix compilation using default openjpeg.dsw
|
||||||
|
* [Herve Drolon] fixed various minor warnings occuring under icc9 and bcc32
|
||||||
|
- [Mathieu Malaterre] Remove all references to OPJ_EXPORT, no declspec in header file anymore
|
||||||
|
+ [Mathieu Malaterre] Add a def.in file which is a template for Module Definition
|
||||||
|
+ [Herve Drolon] added MSVC project and compiler directives to build a 'standard' WIN32 DLL
|
||||||
|
! [Mathieu Malaterre] Update CMake to match the new shared lib system (no more def file)
|
||||||
|
|
||||||
|
January 27, 2006
|
||||||
|
* [Antonin Descampe] fixed a two initialization problems in t1.c and tcd.c
|
||||||
|
|
||||||
|
January 26, 2006
|
||||||
|
* [Herve Drolon] fixed various minor warnings occuring under gcc
|
||||||
|
* [__david__] fixed a segfault in codec/image_to_j2k.c & codec/j2k_to_image.c
|
||||||
|
* [__david__] fixed help option in codec/j2k_to_image & codec/image_to_j2k
|
||||||
|
|
||||||
|
January 25, 2006
|
||||||
|
! [Mathieu Malaterre] Sync with ITK repository, also add ref to doxygen
|
||||||
|
! [Mathieu Malaterre] Add a lot of comments on the CMake build system
|
||||||
|
! [Mathieu Malaterre] Fix MINGW32 and BORLAND compilation problems.
|
||||||
|
|
||||||
|
January 25, 2006
|
||||||
|
* [Antonin Descampe] fixed a problem in convert.c when multiple comments
|
||||||
|
+ [Antonin Descampe] added cmake files to the project
|
||||||
|
! [Antonin Descampe] fix.c : replaced "WIN32" by "_MSC_VER" for int64
|
||||||
|
+ [Antonin Descampe] added "OPJ_EXPORT" in openjpeg.h to generate shared lib with win32
|
||||||
|
! [Antonin Descampe] removed all CtrlM from files
|
||||||
|
|
||||||
|
January 24, 2006
|
||||||
|
! [Antonin Descampe] event.c : replaced "WIN32" by "_MSC_VER" for i2a
|
||||||
|
|
||||||
|
January 20, 2006
|
||||||
|
* [Antonin Descampe] fixed various minor warnings with gdcm patches
|
||||||
|
|
||||||
|
January 19, 2006
|
||||||
|
* [Herve Drolon] fixed a bug in jp2_read_ihdr (need to allocate jp2->comps)
|
||||||
|
|
||||||
|
January 18, 2006
|
||||||
|
* [Herve Drolon] changed the name of j2k_realloc to opj_realloc
|
||||||
|
* [Herve Drolon] fixed a bug in opj_cio_open when saving 48-bit images (wrong buffer size calculation)
|
||||||
|
|
||||||
|
December 8, 2005
|
||||||
|
* [Antonin Descampe] fixed a bug when specifying a rate '-r' => no distortion info was available in the index
|
||||||
|
* [Antonin Descampe] fixed a bug in t1_getwmsedec (stepsize was divided by 8192)
|
||||||
|
|
||||||
|
December 5, 2005 - 1.1.0
|
||||||
@@ -1,259 +1,273 @@
|
|||||||
# Microsoft Developer Studio Project File - Name="image_to_j2k" - Package Owner=<4>
|
# Microsoft Developer Studio Project File - Name="DllOpenJPEG" - Package Owner=<4>
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
# ** DO NOT EDIT **
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||||
|
|
||||||
CFG=image_to_j2k - Win32 Debug
|
CFG=DllOpenJPEG - Win32 Debug
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
!MESSAGE use the Export Makefile command and run
|
!MESSAGE use the Export Makefile command and run
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "image_to_j2k.mak".
|
!MESSAGE NMAKE /f "DllOpenJPEG.mak".
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE NMAKE /f "image_to_j2k.mak" CFG="image_to_j2k - Win32 Debug"
|
!MESSAGE NMAKE /f "DllOpenJPEG.mak" CFG="DllOpenJPEG - Win32 Debug"
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE Possible choices for configuration are:
|
!MESSAGE Possible choices for configuration are:
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
!MESSAGE "image_to_j2k - Win32 Release" (based on "Win32 (x86) Console Application")
|
!MESSAGE "DllOpenJPEG - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
!MESSAGE "image_to_j2k - Win32 Debug" (based on "Win32 (x86) Console Application")
|
!MESSAGE "DllOpenJPEG - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||||
!MESSAGE
|
!MESSAGE
|
||||||
|
|
||||||
# Begin Project
|
# Begin Project
|
||||||
# PROP AllowPerConfigDependencies 0
|
# PROP AllowPerConfigDependencies 0
|
||||||
# PROP Scc_ProjName ""
|
# PROP Scc_ProjName ""
|
||||||
# PROP Scc_LocalPath ""
|
# PROP Scc_LocalPath ""
|
||||||
CPP=cl.exe
|
CPP=cl.exe
|
||||||
RSC=rc.exe
|
MTL=midl.exe
|
||||||
|
RSC=rc.exe
|
||||||
!IF "$(CFG)" == "image_to_j2k - Win32 Release"
|
|
||||||
|
!IF "$(CFG)" == "DllOpenJPEG - Win32 Release"
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
# PROP BASE Use_MFC 0
|
||||||
# PROP BASE Output_Dir "Release"
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
# PROP BASE Output_Dir "Release"
|
||||||
# PROP BASE Target_Dir ""
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
# PROP Use_MFC 0
|
# PROP BASE Target_Dir ""
|
||||||
# PROP Use_Debug_Libraries 0
|
# PROP Use_MFC 0
|
||||||
# PROP Output_Dir "Release"
|
# PROP Use_Debug_Libraries 0
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Output_Dir "Release"
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Target_Dir ""
|
# PROP Ignore_Export_Lib 0
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
# PROP Target_Dir ""
|
||||||
# ADD CPP /nologo /W1 /GX /O2 /I "../libopenjpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "DONT_HAVE_GETOPT" /FD /c
|
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLLOPENJPEG_EXPORTS" /Yu"stdafx.h" /FD /c
|
||||||
# SUBTRACT CPP /YX
|
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPJ_EXPORTS" /FD /c
|
||||||
# ADD BASE RSC /l 0x80c /d "NDEBUG"
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
# ADD RSC /l 0x80c /i "../libopenjpeg" /d "NDEBUG"
|
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
BSC32=bscmake.exe
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
# ADD BASE BSC32 /nologo
|
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||||
# ADD BSC32 /nologo
|
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||||
LINK32=link.exe
|
BSC32=bscmake.exe
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BASE BSC32 /nologo
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
!ELSEIF "$(CFG)" == "image_to_j2k - Win32 Debug"
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/OpenJPEG.dll"
|
||||||
# PROP BASE Use_MFC 0
|
# Begin Special Build Tool
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
SOURCE="$(InputPath)"
|
||||||
# PROP BASE Output_Dir "Debug"
|
PostBuild_Cmds=if not exist dist mkdir dist copy libopenjpeg\openjpeg.h dist copy Release\OpenJPEG.dll dist copy Release\OpenJPEG.lib dist
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
# End Special Build Tool
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
!ELSEIF "$(CFG)" == "DllOpenJPEG - Win32 Debug"
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "Debug"
|
# PROP BASE Use_MFC 0
|
||||||
# PROP Intermediate_Dir "Debug"
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
# PROP Ignore_Export_Lib 0
|
# PROP BASE Output_Dir "Debug"
|
||||||
# PROP Target_Dir ""
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
# PROP BASE Target_Dir ""
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "_DEBUG" /D "DONT_HAVE_GETOPT" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
|
# PROP Use_MFC 0
|
||||||
# ADD BASE RSC /l 0x80c /d "_DEBUG"
|
# PROP Use_Debug_Libraries 1
|
||||||
# ADD RSC /l 0x80c /d "_DEBUG"
|
# PROP Output_Dir "Debug"
|
||||||
BSC32=bscmake.exe
|
# PROP Intermediate_Dir "Debug"
|
||||||
# ADD BASE BSC32 /nologo
|
# PROP Ignore_Export_Lib 0
|
||||||
# ADD BSC32 /nologo
|
# PROP Target_Dir ""
|
||||||
LINK32=link.exe
|
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLLOPENJPEG_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPJ_EXPORTS" /FD /GZ /c
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
# SUBTRACT CPP /YX /Yc /Yu
|
||||||
|
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
!ENDIF
|
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||||
|
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||||
# Begin Target
|
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
# Name "image_to_j2k - Win32 Release"
|
# ADD BASE BSC32 /nologo
|
||||||
# Name "image_to_j2k - Win32 Debug"
|
# ADD BSC32 /nologo
|
||||||
# Begin Group "Source Files"
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/OpenJPEGd.dll" /pdbtype:sept
|
||||||
# Begin Source File
|
# Begin Special Build Tool
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
SOURCE=..\libopenjpeg\bio.c
|
PostBuild_Cmds=if not exist dist mkdir dist copy libopenjpeg\openjpeg.h dist copy Debug\OpenJPEGd.dll dist copy Debug\OpenJPEGd.lib dist
|
||||||
# End Source File
|
# End Special Build Tool
|
||||||
# Begin Source File
|
|
||||||
|
!ENDIF
|
||||||
SOURCE=..\libopenjpeg\cio.c
|
|
||||||
# End Source File
|
# Begin Target
|
||||||
# Begin Source File
|
|
||||||
|
# Name "DllOpenJPEG - Win32 Release"
|
||||||
SOURCE=.\convert.c
|
# Name "DllOpenJPEG - Win32 Debug"
|
||||||
# End Source File
|
# Begin Group "Source Files"
|
||||||
# Begin Source File
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
SOURCE=..\libopenjpeg\dwt.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\bio.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\fix.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\cio.c
|
||||||
|
# End Source File
|
||||||
SOURCE=.\compat\getopt.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\dwt.c
|
||||||
|
# End Source File
|
||||||
SOURCE=.\image_to_j2k.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\event.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\int.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\image.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\j2k.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\j2k.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\jp2.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\j2k_lib.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\jpt.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\jp2.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\jpw.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\jpt.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\mct.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\mct.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\mqc.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\mqc.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\pi.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\openjpeg.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\raw.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\pi.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\rs.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\raw.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\t1.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\t1.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\t2.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\t2.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\tcd.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\tcd.c
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\tgt.c
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# End Group
|
SOURCE=.\libopenjpeg\tgt.c
|
||||||
# Begin Group "Header Files"
|
# End Source File
|
||||||
|
# End Group
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
# Begin Group "Header Files"
|
||||||
# Begin Source File
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
SOURCE=..\libopenjpeg\bio.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\bio.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\cio.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\cio.h
|
||||||
|
# End Source File
|
||||||
SOURCE=.\convert.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\dwt.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\dwt.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\event.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\fix.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\fix.h
|
||||||
|
# End Source File
|
||||||
SOURCE=.\compat\getopt.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\image.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\int.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\int.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\j2k.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\j2k.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\jp2.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\j2k_lib.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\jpt.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\jp2.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\mct.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\jpt.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\mqc.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\mct.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\openjpeg.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\mqc.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\pi.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\openjpeg.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\raw.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\opj_includes.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\t1.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\pi.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\t2.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\raw.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\tcd.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
SOURCE=.\libopenjpeg\t1.h
|
||||||
|
# End Source File
|
||||||
SOURCE=..\libopenjpeg\tgt.h
|
# Begin Source File
|
||||||
# End Source File
|
|
||||||
# End Group
|
SOURCE=.\libopenjpeg\t2.h
|
||||||
# Begin Group "Resource Files"
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# End Group
|
SOURCE=.\libopenjpeg\tcd.h
|
||||||
# End Target
|
# End Source File
|
||||||
# End Project
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\libopenjpeg\tgt.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\OpenJPEG.rc
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
262
LibOpenJPEG.dsp
Normal file
262
LibOpenJPEG.dsp
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="LibOpenJPEG" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||||
|
|
||||||
|
CFG=LibOpenJPEG - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "LibOpenJPEG.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "LibOpenJPEG.mak" CFG="LibOpenJPEG - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "LibOpenJPEG - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE "LibOpenJPEG - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "LibOpenJPEG - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo
|
||||||
|
# Begin Special Build Tool
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
|
PostBuild_Cmds=if not exist dist mkdir dist copy Release\LibOpenJPEG.lib dist copy libopenjpeg\openjpeg.h dist
|
||||||
|
# End Special Build Tool
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "LibOpenJPEG - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "OPJ_STATIC" /FD /GZ /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LIB32=link.exe -lib
|
||||||
|
# ADD BASE LIB32 /nologo
|
||||||
|
# ADD LIB32 /nologo /out:"Debug\LibOpenJPEGd.lib"
|
||||||
|
# Begin Special Build Tool
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
|
PostBuild_Cmds=if not exist dist mkdir dist copy Debug\LibOpenJPEGd.lib dist copy libopenjpeg\openjpeg.h dist
|
||||||
|
# End Special Build Tool
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "LibOpenJPEG - Win32 Release"
|
||||||
|
# Name "LibOpenJPEG - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\bio.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\cio.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\dwt.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\event.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\image.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\j2k.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\j2k_lib.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\jp2.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\jpt.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\mct.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\mqc.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\openjpeg.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\pi.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\raw.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\t1.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\t2.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\tcd.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\tgt.c
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\bio.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\cio.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\dwt.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\event.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\fix.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\image.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\int.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\j2k.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\j2k_lib.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\jp2.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\jpt.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\mct.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\mqc.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\openjpeg.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\opj_includes.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\pi.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\raw.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\t1.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\libopenjpeg\t1_luts.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\t2.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\tcd.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=libopenjpeg\tgt.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
@@ -1,29 +1,41 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "j2k_to_image"=".\j2k_to_image.dsp" - Package Owner=<4>
|
Project: "DllOpenJPEG"=.\DllOpenJPEG.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Global:
|
Project: "LibOpenJPEG"=.\LibOpenJPEG.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<3>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
78
Makefile
Normal file
78
Makefile
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# Linux makefile for OpenJPEG
|
||||||
|
|
||||||
|
VER_MAJOR = 2
|
||||||
|
VER_MINOR = 1.2.0
|
||||||
|
|
||||||
|
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
|
||||||
|
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
|
||||||
|
INCLUDE = -Ilibopenjpeg
|
||||||
|
|
||||||
|
# General configuration variables:
|
||||||
|
CC = gcc
|
||||||
|
AR = ar
|
||||||
|
|
||||||
|
PREFIX = /usr
|
||||||
|
INSTALL_LIBDIR = $(PREFIX)/lib
|
||||||
|
INSTALL_INCLUDE = $(PREFIX)/include
|
||||||
|
|
||||||
|
# Converts cr/lf to just lf
|
||||||
|
DOS2UNIX = dos2unix
|
||||||
|
|
||||||
|
COMPILERFLAGS = -O3 -fPIC
|
||||||
|
LIBRARIES = -lstdc++
|
||||||
|
|
||||||
|
MODULES = $(SRCS:.c=.o)
|
||||||
|
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
||||||
|
|
||||||
|
TARGET = openjpeg
|
||||||
|
STATICLIB = lib$(TARGET).a
|
||||||
|
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
|
||||||
|
LIBNAME = lib$(TARGET).so.$(VER_MAJOR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
default: all
|
||||||
|
|
||||||
|
all: OpenJPEG
|
||||||
|
|
||||||
|
dist: OpenJPEG
|
||||||
|
install -d dist
|
||||||
|
install -m 644 $(STATICLIB) dist
|
||||||
|
install -m 755 $(SHAREDLIB) dist
|
||||||
|
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
||||||
|
install libopenjpeg/openjpeg.h dist
|
||||||
|
|
||||||
|
dos2unix:
|
||||||
|
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||||
|
|
||||||
|
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(STATICLIB): $(MODULES)
|
||||||
|
$(AR) r $@ $(MODULES)
|
||||||
|
|
||||||
|
$(SHAREDLIB): $(MODULES)
|
||||||
|
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
||||||
|
|
||||||
|
install: OpenJPEG
|
||||||
|
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||||
|
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||||
|
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
||||||
|
install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||||
|
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
||||||
|
install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||||
|
-ldconfig
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
||||||
|
|
||||||
|
osx:
|
||||||
|
make -f Makefile.osx
|
||||||
|
|
||||||
|
osxinstall:
|
||||||
|
make -f Makefile.osx install
|
||||||
|
|
||||||
|
osxclean:
|
||||||
|
make -f Makefile.osx clean
|
||||||
66
Makefile.osx
Normal file
66
Makefile.osx
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
# MacOSX makefile for OpenJPEG
|
||||||
|
|
||||||
|
VER_MAJOR = 1
|
||||||
|
VER_MINOR = 1.1
|
||||||
|
|
||||||
|
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
|
||||||
|
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
|
||||||
|
INCLUDE = -Ilibopenjpeg
|
||||||
|
|
||||||
|
# General configuration variables:
|
||||||
|
CC = gcc
|
||||||
|
LIBTOOLSTAT = libtool
|
||||||
|
LIBTOOLDYN = gcc
|
||||||
|
|
||||||
|
PREFIX = /usr
|
||||||
|
INSTALL_LIBDIR = $(PREFIX)/lib
|
||||||
|
INSTALL_INCLUDE = $(PREFIX)/include
|
||||||
|
|
||||||
|
COMPILERFLAGS = -O3 -fPIC
|
||||||
|
|
||||||
|
MODULES = $(SRCS:.c=.o)
|
||||||
|
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
||||||
|
|
||||||
|
TARGET = openjpeg
|
||||||
|
STATICLIB = lib$(TARGET).a
|
||||||
|
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
|
||||||
|
LIBNAME = lib$(TARGET).dylib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
default: all
|
||||||
|
|
||||||
|
all: OpenJPEG
|
||||||
|
|
||||||
|
dos2unix:
|
||||||
|
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||||
|
|
||||||
|
dist: OpenJPEG
|
||||||
|
install -d dist
|
||||||
|
install -m 644 $(STATICLIB) dist
|
||||||
|
install -m 755 $(SHAREDLIB) dist
|
||||||
|
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
||||||
|
install libopenjpeg/openjpeg.h dist
|
||||||
|
|
||||||
|
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(STATICLIB): $(MODULES)
|
||||||
|
$(LIBTOOLSTAT) -o $@ $(MODULES)
|
||||||
|
|
||||||
|
$(SHAREDLIB): $(MODULES)
|
||||||
|
$(LIBTOOLDYN) -dynamiclib -o $@ $(MODULES)
|
||||||
|
|
||||||
|
install:
|
||||||
|
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||||
|
install -m 644 -o root -g wheel $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||||
|
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
||||||
|
install -m 755 -o root -g wheel $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||||
|
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
||||||
|
install -m 644 -o root -g wheel ./libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
||||||
|
|
||||||
41
OPJViewer/Makefile
Normal file
41
OPJViewer/Makefile
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k
|
||||||
|
|
||||||
|
# General configuration variables:
|
||||||
|
CC = $(shell wx-config-2.8 --cxx)
|
||||||
|
AR = ar
|
||||||
|
|
||||||
|
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL
|
||||||
|
|
||||||
|
OPJV_SRCS = source/imagj2k.cpp source/imagmj2.cpp source/wxj2kparser.cpp source/imagjp2.cpp source/OPJViewer.cpp source/wxjp2parser.cpp
|
||||||
|
|
||||||
|
MODULES = $(OPJV_SRCS:.cpp=.o)
|
||||||
|
|
||||||
|
all: opjviewer lib
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
lib:
|
||||||
|
cd ../jpwl; make
|
||||||
|
|
||||||
|
opjviewer: $(OPJV_SRCS) lib
|
||||||
|
$(CC) $(CFLAGS) -I .. $(OPJV_SRCS) -o OPJViewer -L ../jpwl -lopenjpeg_JPWL -lm -lstdc++ -ltiff $(shell wx-config-2.8 --libs)
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f OPJViewer *.o *.a
|
||||||
|
cd ../libopenjpeg; rm -f *.o
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#.cpp.o :
|
||||||
|
# $(CXX) -g -c `wx-config-2.8 --cxxflags` -I ../.. -D wxUSE_LIBOPENJPEG -D wxHACK_BOOLEAN -o $@ $<
|
||||||
|
|
||||||
|
#all: $(PROGRAM)
|
||||||
|
|
||||||
|
#$(PROGRAM): $(OBJECTS)
|
||||||
|
# $(CXX) -o $(PROGRAM) $(OBJECTS) -lopenjpeg -L ../.. `wx-config-2.8 --libs`
|
||||||
|
|
||||||
|
#clean:
|
||||||
|
# rm -f *.o $(PROGRAM)
|
||||||
193
OPJViewer/OPJViewer.dsp
Normal file
193
OPJViewer/OPJViewer.dsp
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="OPJViewer" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=OPJVIEWER - WIN32 RELEASE
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "OPJViewer.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "OPJViewer.mak" CFG="OPJVIEWER - WIN32 RELEASE"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "OPJViewer - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "OPJViewer - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "OPJViewer - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /FR /FD /c
|
||||||
|
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x409 /i "c:\programmi\wxWidgets-2.8.0\include" /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlib.lib wxregex.lib wxpng.lib wxjpeg.lib wxbase28.lib wxmsw28_core.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib LibOpenJPEG_JPWL.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libcmt.lib" /libpath:"c:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "OPJViewer___Win32_Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "OPJViewer___Win32_Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "d:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x410 /i "d:\programmi\wxWidgets-2.8.0\include" /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib wxzlibd.lib wxregexd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxbase28d.lib wxmsw28d_core.lib wxmsw28d_html.lib wxmsw28d_adv.lib LibOpenJPEG_JPWLd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /pdbtype:sept /libpath:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Debug"
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "OPJViewer - Win32 Release"
|
||||||
|
# Name "OPJViewer - Win32 Debug"
|
||||||
|
# Begin Group "Source Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagj2k.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagjp2.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagjpeg2000.cpp
|
||||||
|
# PROP Exclude_From_Build 1
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagmj2.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJViewer.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\wxj2kparser.cpp
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\wxjp2parser.cpp
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Header Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\about_htm.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagj2k.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagjp2.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\imagmj2.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJViewer.h
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# Begin Group "Resource Files"
|
||||||
|
|
||||||
|
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\icon1.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\icon2.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\icon3.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\icon4.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\icon5.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\opj_logo.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJChild.ico
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJChild16.xpm
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJViewer.ico
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJViewer.rc
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\source\OPJViewer16.xpm
|
||||||
|
# End Source File
|
||||||
|
# End Group
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
44
OPJViewer/OPJViewer.dsw
Normal file
44
OPJViewer/OPJViewer.dsw
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "LibOpenJPEG_JPWL"=..\jpwl\LibOpenJPEG_JPWL.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "OPJViewer"=.\OPJViewer.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name LibOpenJPEG_JPWL
|
||||||
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
44
OPJViewer/OPJViewer.iss
Normal file
44
OPJViewer/OPJViewer.iss
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
; Script generated by the Inno Setup Script Wizard.
|
||||||
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
||||||
|
|
||||||
|
[Setup]
|
||||||
|
AppName=OPJViewer
|
||||||
|
AppVerName=OPJViewer 0.3 alpha
|
||||||
|
AppPublisher=OpenJPEG
|
||||||
|
AppPublisherURL=http://www.openjpeg.org
|
||||||
|
AppSupportURL=http://www.openjpeg.org
|
||||||
|
AppUpdatesURL=http://www.openjpeg.org
|
||||||
|
DefaultDirName={pf}\OPJViewer
|
||||||
|
DefaultGroupName=OPJViewer
|
||||||
|
OutputDir=setup
|
||||||
|
OutputBaseFilename=OPJViewer03alpha_setup
|
||||||
|
Compression=lzma
|
||||||
|
SolidCompression=true
|
||||||
|
InfoBeforeFile=source\readmebefore.txt
|
||||||
|
InfoAfterFile=source\readmeafter.txt
|
||||||
|
LicenseFile=source\license.txt
|
||||||
|
VersionInfoVersion=0.3.0.0
|
||||||
|
VersionInfoCompany=OpenJPEG
|
||||||
|
VersionInfoDescription=JPEG 2000 viewer
|
||||||
|
ShowLanguageDialog=yes
|
||||||
|
SetupIconFile=source\OPJViewer.ico
|
||||||
|
|
||||||
|
[Languages]
|
||||||
|
Name: english; MessagesFile: compiler:Default.isl
|
||||||
|
|
||||||
|
[Tasks]
|
||||||
|
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
|
||||||
|
|
||||||
|
[Files]
|
||||||
|
Source: Release\OPJViewer.exe; DestDir: {app}; Flags: ignoreversion
|
||||||
|
;Source: about\about.htm; DestDir: {app}/about; Flags: ignoreversion
|
||||||
|
;Source: about\opj_logo.png; DestDir: {app}/about; Flags: ignoreversion
|
||||||
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||||
|
|
||||||
|
[Icons]
|
||||||
|
Name: {group}\OPJViewer; Filename: {app}\OPJViewer.exe; WorkingDir: {app}; IconIndex: 0
|
||||||
|
Name: {group}\{cm:UninstallProgram,OPJViewer}; Filename: {uninstallexe}
|
||||||
|
Name: {userdesktop}\OPJViewer; Filename: {app}\OPJViewer.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0
|
||||||
|
|
||||||
|
[Run]
|
||||||
|
Filename: {app}\OPJViewer.exe; Description: {cm:LaunchProgram,OPJViewer}; Flags: nowait postinstall skipifsilent; WorkingDir: {app}
|
||||||
101
OPJViewer/Readme.txt
Normal file
101
OPJViewer/Readme.txt
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
===============================================================================
|
||||||
|
|
||||||
|
JPEG2000 Visualization Software - OPJViewer
|
||||||
|
|
||||||
|
Version 0.1 alpha
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1. Scope
|
||||||
|
=============
|
||||||
|
|
||||||
|
This document describes the installation and use of the OPJViewer in the framework of OpenJPEG library.
|
||||||
|
|
||||||
|
This implementation has been developed using the OpenJPEG library as decoding engine and wxWidgets 2.8.0 as GUI engine.
|
||||||
|
|
||||||
|
If you find some bugs or if you have problems using the viewer, please send an e-mail to jpwl@diei.unipg.it
|
||||||
|
|
||||||
|
2. Installing the viewer
|
||||||
|
==========================
|
||||||
|
|
||||||
|
There are two options available, at the moment:
|
||||||
|
|
||||||
|
a) compile from source code
|
||||||
|
b) download a precompiled binary.
|
||||||
|
|
||||||
|
In order to use option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8.0 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries).
|
||||||
|
|
||||||
|
2.1. Compiling the source code in Windows
|
||||||
|
-------------------------------------------
|
||||||
|
|
||||||
|
The steps required to compile the viewer under windows are:
|
||||||
|
|
||||||
|
a) Download at least the libopenjpeg, jpwl, and opjviewer folders from the SVN trunk.
|
||||||
|
b) Open the OPJViewer.dsw workspace with Visual C++ 6 and activate the "OPJViewer - Win32 Release" configuration.
|
||||||
|
c) In the configuration settings, go to the C++ tab and modify the wxWidgets paths in order to reflect your wx* install configuration (Preprocessor -> Additional include directories): simply update each instance of the two wx paths, do not remove or add them.
|
||||||
|
d) In the configuration settings, go to the Link tab and modify the wxWidgets path in order to reflect your wx* install configuration (Input -> Additional library path): simply update the wx path.
|
||||||
|
e) In the configuration settings, go to the Resources tab and modify the wxWidgets path in order to reflect your wx* install configuration (Additional resource include directories): simply update the wx path.
|
||||||
|
f) Build!
|
||||||
|
g) Run!
|
||||||
|
h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).
|
||||||
|
|
||||||
|
2.2. Compiling the source code in Unix-like systems
|
||||||
|
-----------------------------------------------------
|
||||||
|
|
||||||
|
The porting is possible and under way.
|
||||||
|
|
||||||
|
|
||||||
|
3. General information on the viewer
|
||||||
|
====================================
|
||||||
|
|
||||||
|
This viewer is conceived to open and display information and image content of J2K, JP2,
|
||||||
|
and MJ2 files.
|
||||||
|
The viewer application interface is divided into three main panels:
|
||||||
|
- a browsing pane;
|
||||||
|
- a viewing pane;
|
||||||
|
- a log/peek pane.
|
||||||
|
|
||||||
|
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
||||||
|
|
||||||
|
filename
|
||||||
|
|
|
||||||
|
|_ #000: Marker/Box short name (Hex code)
|
||||||
|
| |
|
||||||
|
| |_ *** Marker/Box long name ***
|
||||||
|
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||||
|
| |_ Additional info, depending on the marker/box type
|
||||||
|
| |_ ...
|
||||||
|
|
|
||||||
|
|_ #001: Marker/Box short name (Hex code)
|
||||||
|
| |
|
||||||
|
| |_ ...
|
||||||
|
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
||||||
|
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
||||||
|
|
||||||
|
|
||||||
|
The log/peek pane is shared among two different subpanels:
|
||||||
|
|
||||||
|
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
||||||
|
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
||||||
|
|
||||||
|
|
||||||
|
4. Known bugs and limitations
|
||||||
|
===============================
|
||||||
|
|
||||||
|
4.1. Bugs
|
||||||
|
-----------
|
||||||
|
|
||||||
|
*
|
||||||
|
|
||||||
|
4.2. Limitations
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* For mj2 files, rendering is only in B/W
|
||||||
36
OPJViewer/about/about.htm
Normal file
36
OPJViewer/about/about.htm
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<html>
|
||||||
|
<body bgcolor="#FFFFFF">
|
||||||
|
<table cellspacing=7 cellpadding=1 border=0 width="100%">
|
||||||
|
<tr>
|
||||||
|
<td rowspan=3 valign=top align=center width=70>
|
||||||
|
<img src="opj_logo.png"><br><br>
|
||||||
|
</td>
|
||||||
|
<td align=center>
|
||||||
|
<font size=+2 color="#000000"><b>OPJViewer v0.2 alpha</b></font><br>
|
||||||
|
<font size=+0 color="#000000"><b>A JPEG 2000 image viewer</b></font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr height=3 valign=center>
|
||||||
|
<td valign=center bgcolor=#cc3300></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align=justify>
|
||||||
|
<center><font size=+0 color="#000000"><a href="http://www.openjpeg.org/">OpenJPEG</a></font></center>
|
||||||
|
<font size=-1 color="#000000">The OpenJPEG library is an open-source JPEG 2000 codec written in C language.
|
||||||
|
In addition to the basic codec, various other features are under development,
|
||||||
|
among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool
|
||||||
|
useful for the JPIP protocol, JPWL-tools for error-resilience, ...</font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan=2 bgcolor="#CC3300" height=3 valign=center></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan=2>
|
||||||
|
<font size=-2 color="#444444">OpenJPEG is © 2002-2007 <a href="http://www.tele.ucl.ac.be/">TELE</a> - <a href="http://www.uclouvain.be/">Universit<EFBFBD> Catholique de Louvain</a></font><br>
|
||||||
|
<font size=-2 color="#444444">OPJViewer is also © 2005-2007 <a href="http://dsplab.diei.unipg.it/">DSPLab</a> - <a href="http://www.unipg.it/">Universit<EFBFBD> degli studi di Perugia</a></font>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
OPJViewer/about/opj_logo.png
Normal file
BIN
OPJViewer/about/opj_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
BIN
OPJViewer/source/OPJChild.ico
Normal file
BIN
OPJViewer/source/OPJChild.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
28
OPJViewer/source/OPJChild16.xpm
Normal file
28
OPJViewer/source/OPJChild16.xpm
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *OPJChild16[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"16 16 6 1",
|
||||||
|
" c black",
|
||||||
|
". c #008000",
|
||||||
|
"X c red",
|
||||||
|
"o c #800080",
|
||||||
|
"O c gray100",
|
||||||
|
"+ c None",
|
||||||
|
/* pixels */
|
||||||
|
"++++++++++++++++",
|
||||||
|
"+OOOOOOOOOOOOOO+",
|
||||||
|
"+OooooooooooooO+",
|
||||||
|
"+OooooooooooooO+",
|
||||||
|
"+OooOOOOOOOOOoO+",
|
||||||
|
"+OooO.......OoO+",
|
||||||
|
"+OooO.......OoO+",
|
||||||
|
"+OooO..OOO..OoO+",
|
||||||
|
"+OooO..OXO..OoO+",
|
||||||
|
"+OooO..OOO..OoO+",
|
||||||
|
"+OooO.......OoO+",
|
||||||
|
"+OooO.......OoO+",
|
||||||
|
"+OooOOOOOOOOOoO+",
|
||||||
|
"+OooooooooooooO+",
|
||||||
|
"+OOOOOOOOOOOOOO+",
|
||||||
|
"++++++++++++++++"
|
||||||
|
};
|
||||||
2969
OPJViewer/source/OPJViewer.cpp
Normal file
2969
OPJViewer/source/OPJViewer.cpp
Normal file
File diff suppressed because it is too large
Load Diff
659
OPJViewer/source/OPJViewer.h
Normal file
659
OPJViewer/source/OPJViewer.h
Normal file
@@ -0,0 +1,659 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: sashtest.h
|
||||||
|
// Purpose: Layout window/sash sample
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 04/01/98
|
||||||
|
// RCS-ID: $Id: sashtest.h,v 1.5 2005/06/02 12:04:24 JS Exp $
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: treectrl.h
|
||||||
|
// Purpose: wxTreeCtrl sample
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 04/01/98
|
||||||
|
// RCS-ID: $Id: treetest.h,v 1.50 2006/11/04 11:26:51 VZ Exp $
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: dialogs.h
|
||||||
|
// Purpose: Common dialogs demo
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by: ABX (2004) - adjustementd for conditional building
|
||||||
|
// Created: 04/01/98
|
||||||
|
// RCS-ID: $Id: dialogs.h,v 1.50 2006/10/08 14:12:59 VZ Exp $
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __OPJ_VIEWER_H__
|
||||||
|
#define __OPJ_VIEWER_H__
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/wx.h"
|
||||||
|
#include "wx/mdi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
#include "wx/laywin.h"
|
||||||
|
#include "wx/treectrl.h"
|
||||||
|
|
||||||
|
#include "icon1.xpm"
|
||||||
|
#include "icon2.xpm"
|
||||||
|
#include "icon3.xpm"
|
||||||
|
#include "icon4.xpm"
|
||||||
|
#include "icon5.xpm"
|
||||||
|
|
||||||
|
#include "wx/filedlg.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
#include <wx/filename.h>
|
||||||
|
#include <wx/busyinfo.h>
|
||||||
|
#include <wx/cmdline.h>
|
||||||
|
#include <wx/file.h>
|
||||||
|
#include "wx/notebook.h"
|
||||||
|
#include <wx/numdlg.h>
|
||||||
|
|
||||||
|
#include "wx/propdlg.h"
|
||||||
|
#include "wx/spinctrl.h"
|
||||||
|
|
||||||
|
#include <wx/dnd.h>
|
||||||
|
#include "wx/wxhtml.h"
|
||||||
|
#include "wx/statline.h"
|
||||||
|
#include <wx/fs_mem.h>
|
||||||
|
|
||||||
|
#include <wx/imaglist.h>
|
||||||
|
|
||||||
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
|
#include "imagj2k.h"
|
||||||
|
#include "imagjp2.h"
|
||||||
|
#include "imagmj2.h"
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
typedef unsigned __int64 int8byte;
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
typedef unsigned long long int8byte;
|
||||||
|
#endif // __WXGTK__
|
||||||
|
|
||||||
|
#define USE_GENERIC_TREECTRL 0
|
||||||
|
#define USE_PENCIL_ON_CANVAS 0
|
||||||
|
|
||||||
|
#if USE_GENERIC_TREECTRL
|
||||||
|
#include "wx/generic/treectlg.h"
|
||||||
|
#ifndef wxTreeCtrl
|
||||||
|
#define wxTreeCtrl wxGenericTreeCtrl
|
||||||
|
#define sm_classwxTreeCtrl sm_classwxGenericTreeCtrl
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPJ_APPLICATION wxT("OPJViewer")
|
||||||
|
#define OPJ_APPLICATION_NAME wxT("OpenJPEG Viewer")
|
||||||
|
#define OPJ_APPLICATION_VERSION wxT("0.3 alpha")
|
||||||
|
#define OPJ_APPLICATION_TITLEBAR OPJ_APPLICATION_NAME wxT(" ") OPJ_APPLICATION_VERSION
|
||||||
|
#define OPJ_APPLICATION_COPYRIGHT wxT("(C) 2007, Giuseppe Baruffa")
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
#define OPJ_APPLICATION_PLATFORM wxT("Windows")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
#define OPJ_APPLICATION_PLATFORM wxT("Linux")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OPJ_CANVAS_BORDER 10
|
||||||
|
#define OPJ_CANVAS_COLOUR *wxWHITE
|
||||||
|
|
||||||
|
class OPJDecoThread;
|
||||||
|
class OPJParseThread;
|
||||||
|
WX_DEFINE_ARRAY_PTR(wxThread *, wxArrayThread);
|
||||||
|
class OPJChildFrame;
|
||||||
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// this is our main application //
|
||||||
|
//////////////////////////////////
|
||||||
|
class OPJViewerApp: public wxApp
|
||||||
|
{
|
||||||
|
// public methods and variables
|
||||||
|
public:
|
||||||
|
|
||||||
|
// class constructor
|
||||||
|
OPJViewerApp() { m_showImages = true; m_showButtons = false; }
|
||||||
|
|
||||||
|
// other methods
|
||||||
|
bool OnInit(void);
|
||||||
|
void SetShowImages(bool show) { m_showImages = show; }
|
||||||
|
bool ShowImages() const { return m_showImages; }
|
||||||
|
void ShowCmdLine(const wxCmdLineParser& parser);
|
||||||
|
|
||||||
|
// all the threads currently alive - as soon as the thread terminates, it's
|
||||||
|
// removed from the array
|
||||||
|
wxArrayThread m_deco_threads, m_parse_threads;
|
||||||
|
|
||||||
|
// crit section protects access to all of the arrays below
|
||||||
|
wxCriticalSection m_deco_critsect, m_parse_critsect;
|
||||||
|
|
||||||
|
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
|
||||||
|
wxSemaphore m_deco_semAllDone, m_parse_semAllDone;
|
||||||
|
|
||||||
|
// the last exiting thread should post to m_semAllDone if this is true
|
||||||
|
// (protected by the same m_critsect)
|
||||||
|
bool m_deco_waitingUntilAllDone, m_parse_waitingUntilAllDone;
|
||||||
|
|
||||||
|
// the list of all filenames written in the command line
|
||||||
|
wxArrayString m_filelist;
|
||||||
|
|
||||||
|
// displaying engine parameters
|
||||||
|
int m_resizemethod;
|
||||||
|
|
||||||
|
// decoding engine parameters
|
||||||
|
bool m_enabledeco;
|
||||||
|
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
bool m_enablejpwl;
|
||||||
|
int m_expcomps, m_maxtiles;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
// private methods and variables
|
||||||
|
private:
|
||||||
|
bool m_showImages, m_showButtons;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_APP(OPJViewerApp)
|
||||||
|
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// this canvas is used to draw the image //
|
||||||
|
///////////////////////////////////////////
|
||||||
|
class OPJCanvas: public wxScrolledWindow
|
||||||
|
{
|
||||||
|
// public methods and variables
|
||||||
|
public:
|
||||||
|
|
||||||
|
// class constructor
|
||||||
|
OPJCanvas(wxFileName fname, wxWindow *parent, const wxPoint& pos, const wxSize& size);
|
||||||
|
|
||||||
|
virtual void OnDraw(wxDC& dc);
|
||||||
|
void OnEvent(wxMouseEvent& event);
|
||||||
|
void WriteText(const wxString& text) {
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif //__WXGTK__
|
||||||
|
wxLogMessage(text);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif //__WXGTK__
|
||||||
|
}
|
||||||
|
OPJDecoThread *CreateDecoThread(void);
|
||||||
|
OPJChildFrame *m_childframe;
|
||||||
|
|
||||||
|
wxBitmap m_image, m_image100;
|
||||||
|
wxFileName m_fname;
|
||||||
|
long m_zooml;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////
|
||||||
|
// the data associated to each tree leaf or node //
|
||||||
|
///////////////////////////////////////////////////
|
||||||
|
class OPJMarkerData : public wxTreeItemData
|
||||||
|
{
|
||||||
|
// public methods and variables
|
||||||
|
public:
|
||||||
|
|
||||||
|
// class constructor
|
||||||
|
OPJMarkerData(const wxString& desc, const wxString& fname = wxT(""), wxFileOffset start = 0, wxFileOffset length = 0) : m_desc(desc), m_filestring(fname) { m_start = start; m_length = length; }
|
||||||
|
|
||||||
|
void ShowInfo(wxTreeCtrl *tree);
|
||||||
|
const wxChar *GetDesc1() const { return m_desc.c_str(); }
|
||||||
|
const wxChar *GetDesc2() const { return m_filestring.c_str(); }
|
||||||
|
wxFileOffset m_start, m_length;
|
||||||
|
|
||||||
|
// private methods and variables
|
||||||
|
private:
|
||||||
|
wxString m_desc;
|
||||||
|
wxString m_filestring;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class OPJMarkerTree : public wxTreeCtrl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TreeCtrlIcon_File,
|
||||||
|
TreeCtrlIcon_FileSelected,
|
||||||
|
TreeCtrlIcon_Folder,
|
||||||
|
TreeCtrlIcon_FolderSelected,
|
||||||
|
TreeCtrlIcon_FolderOpened
|
||||||
|
};
|
||||||
|
|
||||||
|
OPJMarkerTree() { };
|
||||||
|
OPJMarkerTree(wxWindow *parent, OPJChildFrame *subframe, wxFileName fname, wxString name, const wxWindowID id,
|
||||||
|
const wxPoint& pos, const wxSize& size,
|
||||||
|
long style);
|
||||||
|
virtual ~OPJMarkerTree(){};
|
||||||
|
OPJParseThread *CreateParseThread(wxTreeItemId parentid = 0x00, OPJChildFrame *subframe = NULL);
|
||||||
|
void WriteText(const wxString& text) { wxMutexGuiEnter(); wxLogMessage(text); wxMutexGuiLeave(); }
|
||||||
|
|
||||||
|
wxFileName m_fname;
|
||||||
|
wxTextCtrl *m_peektextCtrl;
|
||||||
|
OPJChildFrame *m_childframe;
|
||||||
|
|
||||||
|
/*void OnBeginDrag(wxTreeEvent& event);
|
||||||
|
void OnBeginRDrag(wxTreeEvent& event);
|
||||||
|
void OnEndDrag(wxTreeEvent& event);*/
|
||||||
|
/*void OnBeginLabelEdit(wxTreeEvent& event);
|
||||||
|
void OnEndLabelEdit(wxTreeEvent& event);*/
|
||||||
|
/*void OnDeleteItem(wxTreeEvent& event);*/
|
||||||
|
/*void OnContextMenu(wxContextMenuEvent& event);*/
|
||||||
|
void OnItemMenu(wxTreeEvent& event);
|
||||||
|
/*void OnGetInfo(wxTreeEvent& event);
|
||||||
|
void OnSetInfo(wxTreeEvent& event);*/
|
||||||
|
/*void OnItemExpanded(wxTreeEvent& event);*/
|
||||||
|
void OnItemExpanding(wxTreeEvent& event);
|
||||||
|
/*void OnItemCollapsed(wxTreeEvent& event);
|
||||||
|
void OnItemCollapsing(wxTreeEvent& event);*/
|
||||||
|
void OnSelChanged(wxTreeEvent& event);
|
||||||
|
/*void OnSelChanging(wxTreeEvent& event);*/
|
||||||
|
/*void OnTreeKeyDown(wxTreeEvent& event);*/
|
||||||
|
/*void OnItemActivated(wxTreeEvent& event);*/
|
||||||
|
/*void OnItemRClick(wxTreeEvent& event);*/
|
||||||
|
/*void OnRMouseDown(wxMouseEvent& event);
|
||||||
|
void OnRMouseUp(wxMouseEvent& event);
|
||||||
|
void OnRMouseDClick(wxMouseEvent& event);*/
|
||||||
|
/*void GetItemsRecursively(const wxTreeItemId& idParent,
|
||||||
|
wxTreeItemIdValue cookie = 0);*/
|
||||||
|
|
||||||
|
void CreateImageList(int size = 16);
|
||||||
|
void CreateButtonsImageList(int size = 11);
|
||||||
|
|
||||||
|
/*void AddTestItemsToTree(size_t numChildren, size_t depth);*/
|
||||||
|
/*void DoSortChildren(const wxTreeItemId& item, bool reverse = false)
|
||||||
|
{ m_reverseSort = reverse; wxTreeCtrl::SortChildren(item); }*/
|
||||||
|
/*void DoEnsureVisible() { if (m_lastItem.IsOk()) EnsureVisible(m_lastItem); }*/
|
||||||
|
/*void DoToggleIcon(const wxTreeItemId& item);*/
|
||||||
|
/*void ShowMenu(wxTreeItemId id, const wxPoint& pt);*/
|
||||||
|
|
||||||
|
int ImageSize(void) const { return m_imageSize; }
|
||||||
|
|
||||||
|
void SetLastItem(wxTreeItemId id) { m_lastItem = id; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/*virtual int OnCompareItems(const wxTreeItemId& i1, const wxTreeItemId& i2);*/
|
||||||
|
|
||||||
|
// is this the test item which we use in several event handlers?
|
||||||
|
/*bool IsTestItem(const wxTreeItemId& item)
|
||||||
|
{
|
||||||
|
// the test item is the first child folder
|
||||||
|
return GetItemParent(item) == GetRootItem() && !GetPrevSibling(item);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
private:
|
||||||
|
/*void AddItemsRecursively(const wxTreeItemId& idParent,
|
||||||
|
size_t nChildren,
|
||||||
|
size_t depth,
|
||||||
|
size_t folder);*/
|
||||||
|
|
||||||
|
void LogEvent(const wxChar *name, const wxTreeEvent& event);
|
||||||
|
|
||||||
|
int m_imageSize; // current size of images
|
||||||
|
bool m_reverseSort; // flag for OnCompareItems
|
||||||
|
wxTreeItemId m_lastItem, // for OnEnsureVisible()
|
||||||
|
m_draggedItem; // item being dragged right now
|
||||||
|
|
||||||
|
// NB: due to an ugly wxMSW hack you _must_ use DECLARE_DYNAMIC_CLASS()
|
||||||
|
// if you want your overloaded OnCompareItems() to be called.
|
||||||
|
// OTOH, if you don't want it you may omit the next line - this will
|
||||||
|
// make default (alphabetical) sorting much faster under wxMSW.
|
||||||
|
DECLARE_DYNAMIC_CLASS(OPJMarkerTree)
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// this hash map stores all the trees of currently opened images, with an integer key
|
||||||
|
WX_DECLARE_HASH_MAP(int, OPJMarkerTree*, wxIntegerHash, wxIntegerEqual, OPJMarkerTreeHash);
|
||||||
|
|
||||||
|
// this hash map stores all the children of currently opened images, with an integer key
|
||||||
|
WX_DECLARE_HASH_MAP(int, OPJChildFrame*, wxIntegerHash, wxIntegerEqual, OPJChildFrameHash);
|
||||||
|
|
||||||
|
// Define a new frame
|
||||||
|
class OPJFrame: public wxMDIParentFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
OPJFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||||
|
|
||||||
|
~OPJFrame(void);
|
||||||
|
void OnSize(wxSizeEvent& WXUNUSED(event));
|
||||||
|
void OnAbout(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnFileOpen(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnQuit(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnClose(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnZoom(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnFit(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnToggleBrowser(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnTogglePeeker(wxCommandEvent& WXUNUSED(event));
|
||||||
|
void OnReload(wxCommandEvent& event);
|
||||||
|
void OnSetsEnco(wxCommandEvent& event);
|
||||||
|
void OnSetsDeco(wxCommandEvent& event);
|
||||||
|
void OnSashDrag(wxSashEvent& event);
|
||||||
|
void OpenFiles(wxArrayString paths, wxArrayString filenames);
|
||||||
|
void OnNotebook(wxNotebookEvent& event);
|
||||||
|
void Rescale(int scale, OPJChildFrame *child);
|
||||||
|
|
||||||
|
OPJMarkerTreeHash m_treehash;
|
||||||
|
OPJChildFrameHash m_childhash;
|
||||||
|
wxSashLayoutWindow* markerTreeWindow;
|
||||||
|
wxSashLayoutWindow* loggingWindow;
|
||||||
|
void Resize(int number);
|
||||||
|
wxNotebook *m_bookCtrl;
|
||||||
|
wxNotebook *m_bookCtrlbottom;
|
||||||
|
wxTextCtrl *m_textCtrlbrowse;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void TogStyle(int id, long flag);
|
||||||
|
|
||||||
|
void DoSort(bool reverse = false);
|
||||||
|
|
||||||
|
wxPanel *m_panel;
|
||||||
|
wxTextCtrl *m_textCtrl;
|
||||||
|
|
||||||
|
void DoSetBold(bool bold = true);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxSashLayoutWindow* m_topWindow;
|
||||||
|
wxSashLayoutWindow* m_leftWindow2;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
class OPJChildFrame: public wxMDIChildFrame
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OPJCanvas *m_canvas;
|
||||||
|
OPJChildFrame(OPJFrame *parent, wxFileName fname, int winnumber, const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||||
|
~OPJChildFrame(void);
|
||||||
|
void OnActivate(wxActivateEvent& event);
|
||||||
|
/*void OnQuit(wxCommandEvent& WXUNUSED(event));*/
|
||||||
|
void OnClose(wxCloseEvent& event);
|
||||||
|
void OnGotFocus(wxFocusEvent& event);
|
||||||
|
void OnLostFocus(wxFocusEvent& event);
|
||||||
|
OPJFrame *m_frame;
|
||||||
|
wxFileName m_fname;
|
||||||
|
int m_winnumber;
|
||||||
|
|
||||||
|
unsigned long m_twidth, m_theight, m_tx, m_ty;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// frame and main menu ids
|
||||||
|
enum {
|
||||||
|
OPJFRAME_FILEEXIT = wxID_EXIT,
|
||||||
|
OPJFRAME_HELPABOUT = wxID_ABOUT,
|
||||||
|
OPJFRAME_FILEOPEN,
|
||||||
|
OPJFRAME_FILETOGGLEB,
|
||||||
|
OPJFRAME_FILETOGGLEP,
|
||||||
|
OPJFRAME_VIEWZOOM,
|
||||||
|
OPJFRAME_VIEWFIT,
|
||||||
|
OPJFRAME_VIEWRELOAD,
|
||||||
|
OPJFRAME_FILECLOSE,
|
||||||
|
OPJFRAME_SETSENCO,
|
||||||
|
OPJFRAME_SETSDECO,
|
||||||
|
|
||||||
|
OPJFRAME_BROWSEWIN = 10000,
|
||||||
|
OPJFRAME_LOGWIN
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// menu and control ids
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TreeTest_Quit = wxID_EXIT,
|
||||||
|
TreeTest_About = wxID_ABOUT,
|
||||||
|
TreeTest_TogButtons = wxID_HIGHEST,
|
||||||
|
TreeTest_TogTwist,
|
||||||
|
TreeTest_TogLines,
|
||||||
|
TreeTest_TogEdit,
|
||||||
|
TreeTest_TogHideRoot,
|
||||||
|
TreeTest_TogRootLines,
|
||||||
|
TreeTest_TogBorder,
|
||||||
|
TreeTest_TogFullHighlight,
|
||||||
|
TreeTest_SetFgColour,
|
||||||
|
TreeTest_SetBgColour,
|
||||||
|
TreeTest_ResetStyle,
|
||||||
|
TreeTest_Highlight,
|
||||||
|
TreeTest_Dump,
|
||||||
|
TreeTest_DumpSelected,
|
||||||
|
TreeTest_Count,
|
||||||
|
TreeTest_CountRec,
|
||||||
|
TreeTest_Sort,
|
||||||
|
TreeTest_SortRev,
|
||||||
|
TreeTest_SetBold,
|
||||||
|
TreeTest_ClearBold,
|
||||||
|
TreeTest_Rename,
|
||||||
|
TreeTest_Delete,
|
||||||
|
TreeTest_DeleteChildren,
|
||||||
|
TreeTest_DeleteAll,
|
||||||
|
TreeTest_Recreate,
|
||||||
|
TreeTest_ToggleImages,
|
||||||
|
TreeTest_ToggleButtons,
|
||||||
|
TreeTest_SetImageSize,
|
||||||
|
TreeTest_ToggleSel,
|
||||||
|
TreeTest_CollapseAndReset,
|
||||||
|
TreeTest_EnsureVisible,
|
||||||
|
TreeTest_AddItem,
|
||||||
|
TreeTest_InsertItem,
|
||||||
|
TreeTest_IncIndent,
|
||||||
|
TreeTest_DecIndent,
|
||||||
|
TreeTest_IncSpacing,
|
||||||
|
TreeTest_DecSpacing,
|
||||||
|
TreeTest_ToggleIcon,
|
||||||
|
TreeTest_Select,
|
||||||
|
TreeTest_Unselect,
|
||||||
|
TreeTest_SelectRoot,
|
||||||
|
TreeTest_Ctrl = 1000,
|
||||||
|
BOTTOM_NOTEBOOK_ID,
|
||||||
|
LEFT_NOTEBOOK_ID
|
||||||
|
};
|
||||||
|
|
||||||
|
class OPJDecoThread : public wxThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OPJDecoThread(OPJCanvas *canvas);
|
||||||
|
|
||||||
|
// thread execution starts here
|
||||||
|
virtual void *Entry();
|
||||||
|
|
||||||
|
// called when the thread exits - whether it terminates normally or is
|
||||||
|
// stopped with Delete() (but not when it is Kill()ed!)
|
||||||
|
virtual void OnExit();
|
||||||
|
|
||||||
|
// write something to the text control
|
||||||
|
void WriteText(const wxString& text);
|
||||||
|
|
||||||
|
public:
|
||||||
|
unsigned m_count;
|
||||||
|
OPJCanvas *m_canvas;
|
||||||
|
};
|
||||||
|
|
||||||
|
class OPJParseThread : public wxThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OPJParseThread(OPJMarkerTree *tree, wxTreeItemId parentid = 0x00);
|
||||||
|
|
||||||
|
// thread execution starts here
|
||||||
|
virtual void *Entry();
|
||||||
|
|
||||||
|
// called when the thread exits - whether it terminates normally or is
|
||||||
|
// stopped with Delete() (but not when it is Kill()ed!)
|
||||||
|
virtual void OnExit();
|
||||||
|
|
||||||
|
// write something to the text control
|
||||||
|
void WriteText(const wxString& text);
|
||||||
|
void LoadFile(wxFileName fname);
|
||||||
|
void ParseJ2KFile(wxFile *m_file, wxFileOffset offset, wxFileOffset length, wxTreeItemId parentid);
|
||||||
|
void ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid);
|
||||||
|
|
||||||
|
unsigned m_count;
|
||||||
|
OPJMarkerTree *m_tree;
|
||||||
|
wxTreeItemId m_parentid;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
||||||
|
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
||||||
|
int box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
||||||
|
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Drag and drop files target
|
||||||
|
class OPJDnDFile: public wxFileDropTarget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OPJDnDFile(OPJFrame *pOwner) { m_pOwner = pOwner; }
|
||||||
|
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
|
||||||
|
|
||||||
|
private:
|
||||||
|
OPJFrame *m_pOwner;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Property sheet dialog: encoder
|
||||||
|
class OPJEncoderDialog: public wxPropertySheetDialog
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(OPJEncoderDialog)
|
||||||
|
public:
|
||||||
|
OPJEncoderDialog(wxWindow* parent, int dialogType);
|
||||||
|
~OPJEncoderDialog();
|
||||||
|
|
||||||
|
wxBookCtrlBase* m_settingsNotebook;
|
||||||
|
|
||||||
|
wxPanel* CreateMainSettingsPage(wxWindow* parent);
|
||||||
|
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
|
||||||
|
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
void OnEnableJPWL(wxCommandEvent& event);
|
||||||
|
/* wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
||||||
|
wxCheckBox *m_enablejpwlCheck;*/
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
enum {
|
||||||
|
OPJENCO_ENABLEJPWL = 100,
|
||||||
|
OPJENCO_RATEFACTOR,
|
||||||
|
OPJENCO_QUALITYFACTOR,
|
||||||
|
OPJENCO_RESNUMBER,
|
||||||
|
OPJENCO_CODEBLOCKSIZE,
|
||||||
|
OPJENCO_PRECINCTSIZE,
|
||||||
|
OPJENCO_TILESIZE,
|
||||||
|
OPJENCO_PROGRESSION,
|
||||||
|
OPJENCO_SUBSAMPLING,
|
||||||
|
OPJENCO_ENABLESOP,
|
||||||
|
OPJENCO_ENABLEEPH,
|
||||||
|
OPJENCO_ENABLEBYPASS,
|
||||||
|
OPJENCO_ENABLERESET,
|
||||||
|
OPJENCO_ENABLERESTART,
|
||||||
|
OPJENCO_ENABLEVSC,
|
||||||
|
OPJENCO_ENABLEERTERM,
|
||||||
|
OPJENCO_ENABLESEGMARK,
|
||||||
|
OPJENCO_ROICOMP,
|
||||||
|
OPJENCO_ROISHIFT,
|
||||||
|
OPJENCO_IMORIG,
|
||||||
|
OPJENCO_TILORIG,
|
||||||
|
OPJENCO_ENABLEIRREV,
|
||||||
|
OPJENCO_ENABLEINDEX,
|
||||||
|
OPJENCO_INDEXNAME
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Property sheet dialog: decoder
|
||||||
|
class OPJDecoderDialog: public wxPropertySheetDialog
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(OPJDecoderDialog)
|
||||||
|
public:
|
||||||
|
OPJDecoderDialog(wxWindow* parent, int dialogType);
|
||||||
|
~OPJDecoderDialog();
|
||||||
|
|
||||||
|
wxBookCtrlBase* m_settingsNotebook;
|
||||||
|
wxCheckBox *m_enabledecoCheck;
|
||||||
|
wxSpinCtrl *m_reduceCtrl, *m_layerCtrl, *m_numcompsCtrl;
|
||||||
|
wxRadioBox* m_resizeBox;
|
||||||
|
|
||||||
|
void OnEnableDeco(wxCommandEvent& event);
|
||||||
|
|
||||||
|
wxPanel* CreateMainSettingsPage(wxWindow* parent);
|
||||||
|
wxPanel* CreatePart1SettingsPage(wxWindow* parent);
|
||||||
|
wxPanel* CreatePart3SettingsPage(wxWindow* parent);
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
void OnEnableJPWL(wxCommandEvent& event);
|
||||||
|
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
||||||
|
wxSpinCtrl *m_expcompsCtrl, *m_framenumCtrl, *m_maxtilesCtrl;
|
||||||
|
wxCheckBox *m_enablejpwlCheck;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
enum {
|
||||||
|
OPJDECO_RESMETHOD = 100,
|
||||||
|
OPJDECO_REDUCEFACTOR,
|
||||||
|
OPJDECO_QUALITYLAYERS,
|
||||||
|
OPJDECO_NUMCOMPS,
|
||||||
|
OPJDECO_ENABLEDECO,
|
||||||
|
OPJDECO_ENABLEJPWL,
|
||||||
|
OPJDECO_EXPCOMPS,
|
||||||
|
OPJDECO_MAXTILES,
|
||||||
|
OPJDECO_FRAMENUM
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__OPJ_VIEWER_H__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BIN
OPJViewer/source/OPJViewer.ico
Normal file
BIN
OPJViewer/source/OPJViewer.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
3
OPJViewer/source/OPJViewer.rc
Normal file
3
OPJViewer/source/OPJViewer.rc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
OPJChild16 ICON OPJChild.ico
|
||||||
|
OPJViewer16 ICON OPJViewer.ico
|
||||||
|
#include "wx/msw/wx.rc"
|
||||||
26
OPJViewer/source/OPJViewer16.xpm
Normal file
26
OPJViewer/source/OPJViewer16.xpm
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *OPJViewer16[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"16 16 4 1",
|
||||||
|
" c black",
|
||||||
|
". c #800000",
|
||||||
|
"X c red",
|
||||||
|
"o c None",
|
||||||
|
/* pixels */
|
||||||
|
"oooooooooooooooo",
|
||||||
|
"ooo.XXXXoooooooo",
|
||||||
|
"ooXXoo .Xooooooo",
|
||||||
|
"o..oooo .ooooooo",
|
||||||
|
"oX.oooo ooooooo",
|
||||||
|
"oX.oooo .ooooooo",
|
||||||
|
"oXXoooo .ooooooo",
|
||||||
|
"o.XXoo .oooooooo",
|
||||||
|
"oo.XXXXooooooooo",
|
||||||
|
"ooooooooo.Xo .oo",
|
||||||
|
"ooooooooo X. ooo",
|
||||||
|
"oooooooooo...ooo",
|
||||||
|
"oooooooooo XXooo",
|
||||||
|
"oooooooooo .Xooo",
|
||||||
|
"oooooooooooooooo",
|
||||||
|
"oooooooooooooooo"
|
||||||
|
};
|
||||||
47
OPJViewer/source/about_htm.h
Normal file
47
OPJViewer/source/about_htm.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
wxString htmlaboutpage = wxT(
|
||||||
|
"<html>"
|
||||||
|
"<body bgcolor=#FFFFFF>"
|
||||||
|
"<table cellspacing=7 cellpadding=1 border=0 width=100%>"
|
||||||
|
"<tr>"
|
||||||
|
"<td rowspan=3 valign=top align=center width=70>"
|
||||||
|
"<img src=\"memory:opj_logo.xpm\"><br><br>"
|
||||||
|
"</td>"
|
||||||
|
"<td align=center>"
|
||||||
|
"<font size=+0 color=#000000><b>"
|
||||||
|
OPJ_APPLICATION " " OPJ_APPLICATION_VERSION
|
||||||
|
"</b></font><br>"
|
||||||
|
"<font size=-1 color=#000000><b>A JPEG 2000 image viewer</b></font><br>"
|
||||||
|
"<font size=-2 color=#000000><b>" OPJ_APPLICATION_PLATFORM " version</b></font>"
|
||||||
|
"</td>"
|
||||||
|
"</tr>"
|
||||||
|
"<tr height=3 valign=center>"
|
||||||
|
"<td valign=center bgcolor=#cc3300></td>"
|
||||||
|
"</tr>"
|
||||||
|
"<tr>"
|
||||||
|
"<td align=justify>"
|
||||||
|
"<center><font size=+0 color=#000000><a href=\"http://www.openjpeg.org/\">OpenJPEG</a></font></center>"
|
||||||
|
"<font size=-1 color=#000000>The OpenJPEG library is an open-source JPEG 2000 codec written in C language. "
|
||||||
|
"In addition to the basic codec, various other features are under development.</font><br>"
|
||||||
|
"<font size=-2 color=red>* Build: " wxVERSION_STRING ", " __DATE__ ", " __TIME__ "</font><br>"
|
||||||
|
)
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
wxT("<font size=-2 color=green>- Compiled with JPWL support</font><br>")
|
||||||
|
#endif // USE_JPWL
|
||||||
|
#ifdef USE_JPSEC
|
||||||
|
wxT("<font size=-2 color=green>- Compiled with JPSEC support</font>")
|
||||||
|
#endif // USE_JPSEC
|
||||||
|
wxT("</td>"
|
||||||
|
"</tr>"
|
||||||
|
"<tr>"
|
||||||
|
"<td colspan=2 bgcolor=#CC3300 height=3 valign=center></td>"
|
||||||
|
"</tr>"
|
||||||
|
"<tr>"
|
||||||
|
"<td colspan=2>"
|
||||||
|
"<font size=-2 color=#444444>OpenJPEG is © 2002-2007 <a href=\"http://www.tele.ucl.ac.be/\">TELE</a> - <a href=\"http://www.uclouvain.be/\">Universite' Catholique de Louvain</a></font><br>"
|
||||||
|
"<font size=-2 color=#444444>OPJViewer is also © 2007 <a href=\"http://dsplab.diei.unipg.it/\">DSPLab</a> - <a href=\"http://www.unipg.it/\">Universita' degli studi di Perugia</a></font>"
|
||||||
|
"</td>"
|
||||||
|
"</tr>"
|
||||||
|
"</table>"
|
||||||
|
"</body>"
|
||||||
|
"</html>"
|
||||||
|
);
|
||||||
79
OPJViewer/source/icon1.xpm
Normal file
79
OPJViewer/source/icon1.xpm
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *icon1_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 41 1",
|
||||||
|
"> c #97C4E7",
|
||||||
|
"# c #4381AA",
|
||||||
|
"d c #FFFFFF",
|
||||||
|
"< c #71B2DE",
|
||||||
|
"+ c #538BB1",
|
||||||
|
"& c #D1E5F5",
|
||||||
|
"q c #63B3DE",
|
||||||
|
"6 c #F1F4F7",
|
||||||
|
"* c #CAE1F3",
|
||||||
|
"y c #7AC4E5",
|
||||||
|
"= c #C3DDF1",
|
||||||
|
"X c #74A1BD",
|
||||||
|
"- c #BCD9EF",
|
||||||
|
"5 c #619BC4",
|
||||||
|
"3 c #E6EAF1",
|
||||||
|
"2 c #4B8EBF",
|
||||||
|
"o c #6B97B6",
|
||||||
|
". c #4B82A8",
|
||||||
|
" c None",
|
||||||
|
"w c #54A6D8",
|
||||||
|
"1 c #71A8D1",
|
||||||
|
", c #85BBE2",
|
||||||
|
"t c #EFF6FC",
|
||||||
|
"7 c #DEEDF8",
|
||||||
|
"@ c #4388B4",
|
||||||
|
"a c #F7FBFD",
|
||||||
|
"$ c #D7E0E9",
|
||||||
|
"r c #FAFCFE",
|
||||||
|
"4 c #DAEAF7",
|
||||||
|
"e c #E9F3FA",
|
||||||
|
"0 c #76BAE2",
|
||||||
|
"% c #7FA6C0",
|
||||||
|
"s c #FDFDFE",
|
||||||
|
"O c #5896BE",
|
||||||
|
"p c #B6D5EE",
|
||||||
|
"8 c #87ABC3",
|
||||||
|
": c #A5CCEA",
|
||||||
|
"9 c #E5F0F9",
|
||||||
|
"; c #AFD1EC",
|
||||||
|
"i c #F4F9FD",
|
||||||
|
"u c #8FB0C3",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" .XXXooOO++@#$ ",
|
||||||
|
" %&*=-;:>>,<123 ",
|
||||||
|
" %4&*=-;:>>,1>56 ",
|
||||||
|
" %74&*=-;:>>1*>56 ",
|
||||||
|
" 89700qqqqwq1e*>X ",
|
||||||
|
" 8e974&*=-;:1re*>8 ",
|
||||||
|
" 8te974&*=-;11111# ",
|
||||||
|
" 8tty000qqqqqww>,+ ",
|
||||||
|
" uitte974&*=-p:>>+ ",
|
||||||
|
" uaitte974&*=-p:>O ",
|
||||||
|
" uaayyyy000qqqqp:O ",
|
||||||
|
" uraaitte974&*=-po ",
|
||||||
|
" urraaitte974&*=-o ",
|
||||||
|
" usryyyyyyy000q*=X ",
|
||||||
|
" ussrraaitte974&*X ",
|
||||||
|
" udssrraaitte974&X ",
|
||||||
|
" uddyyyyyyyyyy074% ",
|
||||||
|
" udddssrraaitte97% ",
|
||||||
|
" uddddssrraaitte9% ",
|
||||||
|
" udddddssrraaitte8 ",
|
||||||
|
" uddddddssrraaitt8 ",
|
||||||
|
" uuuuuuuuuuuuuu88u ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
53
OPJViewer/source/icon2.xpm
Normal file
53
OPJViewer/source/icon2.xpm
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *icon2_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 15 1",
|
||||||
|
". c Black",
|
||||||
|
"O c #97C4E7",
|
||||||
|
"$ c #63B3DE",
|
||||||
|
"@ c #CAE1F3",
|
||||||
|
"; c #7AC4E5",
|
||||||
|
"* c #74A1BD",
|
||||||
|
"+ c #619BC4",
|
||||||
|
"o c #4B8EBF",
|
||||||
|
" c None",
|
||||||
|
"% c #54A6D8",
|
||||||
|
"= c #FAFCFE",
|
||||||
|
"& c #E9F3FA",
|
||||||
|
"# c #76BAE2",
|
||||||
|
"X c #C00000",
|
||||||
|
"- c #87ABC3",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ............. ",
|
||||||
|
" .XXXXXXXXXX.o. ",
|
||||||
|
" .XXXXXXXXXX.O+. ",
|
||||||
|
" .XXXXXXXXXX.@O+. ",
|
||||||
|
" .XX##$$$$%$.&@O* ",
|
||||||
|
" .XXXXXXXXXX.=&@O- ",
|
||||||
|
" .XXXXXXXXXX...... ",
|
||||||
|
" .XX;###$$$$$%%XX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XX;;;;###$$$$XX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XX;;;;;;;###$XX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XX;;;;;;;;;;#XX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" .XXXXXXXXXXXXXXX. ",
|
||||||
|
" ................. ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
79
OPJViewer/source/icon3.xpm
Normal file
79
OPJViewer/source/icon3.xpm
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *icon3_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 41 1",
|
||||||
|
"6 c #EDF2FB",
|
||||||
|
"- c #AAC1E8",
|
||||||
|
": c #B9CDED",
|
||||||
|
"X c #295193",
|
||||||
|
", c #C6D6F0",
|
||||||
|
"a c #4A7CCE",
|
||||||
|
"u c #779DDB",
|
||||||
|
"y c #7FA2DD",
|
||||||
|
"$ c #3263B4",
|
||||||
|
"5 c #EAF0FA",
|
||||||
|
". c #2D59A3",
|
||||||
|
"o c #6E96D8",
|
||||||
|
"* c #356AC1",
|
||||||
|
"r c #F7F9FD",
|
||||||
|
"> c #BED0EE",
|
||||||
|
"3 c #E1E9F7",
|
||||||
|
"7 c #F0F5FC",
|
||||||
|
"< c #CBD9F1",
|
||||||
|
"2 c #DAE5F6",
|
||||||
|
"# c #3161B1",
|
||||||
|
" c None",
|
||||||
|
"0 c #FDFEFF",
|
||||||
|
"= c #9FB9E5",
|
||||||
|
"e c #AEC5EA",
|
||||||
|
"t c #89A9DF",
|
||||||
|
"q c #98B5E4",
|
||||||
|
"p c #5584D1",
|
||||||
|
"d c #3A70CA",
|
||||||
|
"@ c #305FAC",
|
||||||
|
"i c #5D89D3",
|
||||||
|
"1 c #D2DFF4",
|
||||||
|
"% c #3366B9",
|
||||||
|
"9 c #FAFCFE",
|
||||||
|
"8 c #F5F8FD",
|
||||||
|
"s c #4075CC",
|
||||||
|
"O c #638ED5",
|
||||||
|
"w c #90AFE2",
|
||||||
|
"& c #3467BC",
|
||||||
|
"+ c #2F5DA9",
|
||||||
|
"; c #B3C8EB",
|
||||||
|
"4 c #E5EDF9",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ......X ",
|
||||||
|
" .oooooO+ ",
|
||||||
|
" .ooooooo. ",
|
||||||
|
" .+@@@##$%%&&&&&****. ",
|
||||||
|
" .=-;:>,<12345678900. ",
|
||||||
|
" .q=-;:>,<1234567890. ",
|
||||||
|
" .wq=-e:>,<12345678r. ",
|
||||||
|
" .twq=-e:>,<12345678. ",
|
||||||
|
" .ytwq=-e:>,<1234567. ",
|
||||||
|
" .uytwq=-e:>,<123456. ",
|
||||||
|
" .ouytwq=-e:>,<12345. ",
|
||||||
|
" .Oouytwq=-e;>,<1234. ",
|
||||||
|
" .iOouytwq=-e;>,<123. ",
|
||||||
|
" .piOouytwq=-e;>,<12. ",
|
||||||
|
" .apiOouytwq=-e;>,<1. ",
|
||||||
|
" .sapiOouytwq=-e;>,<. ",
|
||||||
|
" .dsapiOouytwq=-e;>,. ",
|
||||||
|
" ...................# ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
43
OPJViewer/source/icon4.xpm
Normal file
43
OPJViewer/source/icon4.xpm
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *icon4_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 5 1",
|
||||||
|
". c Black",
|
||||||
|
"o c #8399B4",
|
||||||
|
"X c #8DA0B9",
|
||||||
|
" c None",
|
||||||
|
"O c #800000",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ....... ",
|
||||||
|
" .XXXXXo. ",
|
||||||
|
" .XXXXXXX. ",
|
||||||
|
" .................... ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .OOOOOOOOOOOOOOOOOO. ",
|
||||||
|
" .................... ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
79
OPJViewer/source/icon5.xpm
Normal file
79
OPJViewer/source/icon5.xpm
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *icon5_xpm[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"32 32 41 1",
|
||||||
|
"0 c #AAC1E8",
|
||||||
|
"q c #B9CDED",
|
||||||
|
"X c #295193",
|
||||||
|
"e c #C6D6F0",
|
||||||
|
"a c #4A7CCE",
|
||||||
|
"& c #779DDB",
|
||||||
|
"* c #7FA2DD",
|
||||||
|
"2 c #EAF0FA",
|
||||||
|
"@ c #2D59A3",
|
||||||
|
"o c #6E96D8",
|
||||||
|
"y c #356AC1",
|
||||||
|
"d c #214279",
|
||||||
|
"w c #BED0EE",
|
||||||
|
"= c #85A7DF",
|
||||||
|
"< c #E1E9F7",
|
||||||
|
"3 c #F0F5FC",
|
||||||
|
"s c #CBD9F1",
|
||||||
|
", c #DAE5F6",
|
||||||
|
"7 c #3161B1",
|
||||||
|
" c None",
|
||||||
|
". c #274D8B",
|
||||||
|
"6 c #FDFEFF",
|
||||||
|
"i c #E7EEF9",
|
||||||
|
"9 c #9FB9E5",
|
||||||
|
"- c #89A9DF",
|
||||||
|
"8 c #98B5E4",
|
||||||
|
"$ c #5584D1",
|
||||||
|
"+ c #3569BF",
|
||||||
|
"% c #305FAC",
|
||||||
|
"O c #5D89D3",
|
||||||
|
"> c #D2DFF4",
|
||||||
|
"p c #3366B9",
|
||||||
|
"5 c #FAFCFE",
|
||||||
|
"4 c #F5F8FD",
|
||||||
|
"t c #4075CC",
|
||||||
|
"u c #638ED5",
|
||||||
|
"r c #CEDCF2",
|
||||||
|
"; c #90AFE2",
|
||||||
|
"# c #2F5DA9",
|
||||||
|
": c #B3C8EB",
|
||||||
|
"1 c #E5EDF9",
|
||||||
|
/* pixels */
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ......X ",
|
||||||
|
" XoooooO. ",
|
||||||
|
" Xoooooo+. ",
|
||||||
|
" Xooooooo@XXXXXXXXXX# ",
|
||||||
|
" Xoooooooooooooooooo# ",
|
||||||
|
" Xoooooooooooooooooo# ",
|
||||||
|
" Xoo$################### ",
|
||||||
|
" Xoo%O&*=-;:>,<123445667 ",
|
||||||
|
" XooX890:qwer>,<123445q# ",
|
||||||
|
" Xoty;890:qwer>,<12344# ",
|
||||||
|
" Xo%u-;890:qwer>,<i234# ",
|
||||||
|
" XoX&*-;890:qwer>,<i2r# ",
|
||||||
|
" Xtpo&*-;890:qwer>,<i# ",
|
||||||
|
" X%auo&*-;890:qwer>,<# ",
|
||||||
|
" XX$Ouo&*-;890:qwer>s# ",
|
||||||
|
" d%a$Ouo&*-;890:qwer# ",
|
||||||
|
" d+ta$Ouo&*-;890:qwe# ",
|
||||||
|
" d..................# ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
};
|
||||||
264
OPJViewer/source/imagj2k.cpp
Normal file
264
OPJViewer/source/imagj2k.cpp
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagj2k.cpp
|
||||||
|
// Purpose: wxImage JPEG 2000 codestream handler
|
||||||
|
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||||
|
// RCS-ID: $Id: imagj2k.cpp,v 0.00 2007/02/08 23:59:00 MW Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#include "imagj2k.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/log.h"
|
||||||
|
#include "wx/app.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
#include "wx/bitmap.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/filefn.h"
|
||||||
|
#include "wx/wfstream.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// types
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxJ2KHandler
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxJ2KHandler,wxImageHandler)
|
||||||
|
|
||||||
|
#if wxUSE_STREAMS
|
||||||
|
|
||||||
|
//------------- JPEG 2000 Data Source Manager
|
||||||
|
|
||||||
|
#define J2K_CFMT 0
|
||||||
|
#define JP2_CFMT 1
|
||||||
|
#define JPT_CFMT 2
|
||||||
|
#define MJ2_CFMT 3
|
||||||
|
#define PXM_DFMT 0
|
||||||
|
#define PGX_DFMT 1
|
||||||
|
#define BMP_DFMT 2
|
||||||
|
#define YUV_DFMT 3
|
||||||
|
|
||||||
|
#define MAX_MESSAGE_LEN 200
|
||||||
|
|
||||||
|
/* sample error callback expecting a FILE* client object */
|
||||||
|
void j2k_error_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample warning callback expecting a FILE* client object */
|
||||||
|
void j2k_warning_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample debug callback expecting no client object */
|
||||||
|
void j2k_info_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the j2k codestream
|
||||||
|
bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
||||||
|
{
|
||||||
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
opj_image_t *opjimage = NULL;
|
||||||
|
unsigned char *src = NULL;
|
||||||
|
unsigned char *ptr;
|
||||||
|
int file_length;
|
||||||
|
|
||||||
|
// destroy the image
|
||||||
|
image->Destroy();
|
||||||
|
|
||||||
|
/* handle to a decompressor */
|
||||||
|
opj_dinfo_t* dinfo = NULL;
|
||||||
|
opj_cio_t *cio = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/* configure the event callbacks (not required) */
|
||||||
|
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||||
|
event_mgr.error_handler = j2k_error_callback;
|
||||||
|
event_mgr.warning_handler = j2k_warning_callback;
|
||||||
|
event_mgr.info_handler = j2k_info_callback;
|
||||||
|
|
||||||
|
/* set decoding parameters to default values */
|
||||||
|
opj_set_default_decoder_parameters(¶meters);
|
||||||
|
|
||||||
|
/* prepare parameters */
|
||||||
|
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
||||||
|
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
||||||
|
parameters.decod_format = J2K_CFMT;
|
||||||
|
parameters.cod_format = BMP_DFMT;
|
||||||
|
if (m_reducefactor)
|
||||||
|
parameters.cp_reduce = m_reducefactor;
|
||||||
|
if (m_qualitylayers)
|
||||||
|
parameters.cp_layer = m_qualitylayers;
|
||||||
|
|
||||||
|
/* JPWL only */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
parameters.jpwl_exp_comps = m_expcomps;
|
||||||
|
parameters.jpwl_max_tiles = m_maxtiles;
|
||||||
|
parameters.jpwl_correct = m_enablejpwl;
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
|
/* get a decoder handle */
|
||||||
|
dinfo = opj_create_decompress(CODEC_J2K);
|
||||||
|
|
||||||
|
/* find length of the stream */
|
||||||
|
stream.SeekI(0, wxFromEnd);
|
||||||
|
file_length = (int) stream.TellI();
|
||||||
|
|
||||||
|
/* get data */
|
||||||
|
stream.SeekI(0, wxFromStart);
|
||||||
|
src = (unsigned char *) malloc(file_length);
|
||||||
|
stream.Read(src, file_length);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
|
/* setup the decoder decoding parameters using user parameters */
|
||||||
|
opj_setup_decoder(dinfo, ¶meters);
|
||||||
|
|
||||||
|
/* open a byte stream */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
|
/* decode the stream and fill the image structure */
|
||||||
|
opjimage = opj_decode(dinfo, cio);
|
||||||
|
if (!opjimage) {
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogError(wxT("J2K: failed to decode image!"));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
opj_image_destroy(opjimage);
|
||||||
|
free(src);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* common rendering method */
|
||||||
|
#include "imagjpeg2000.cpp"
|
||||||
|
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("J2K: image loaded."));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
|
||||||
|
/* close openjpeg structs */
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_image_destroy(opjimage);
|
||||||
|
free(src);
|
||||||
|
|
||||||
|
if (!image->Ok())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// save the j2k codestream
|
||||||
|
bool wxJ2KHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||||
|
{
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogError(wxT("J2K: Couldn't save image -> not implemented."));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __VISUALC__
|
||||||
|
#pragma warning(default:4611)
|
||||||
|
#endif /* VC++ */
|
||||||
|
|
||||||
|
// recognize the 0xFF4F JPEG 2000 SOC marker
|
||||||
|
bool wxJ2KHandler::DoCanRead( wxInputStream& stream )
|
||||||
|
{
|
||||||
|
unsigned char hdr[2];
|
||||||
|
|
||||||
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return hdr[0] == 0xFF && hdr[1] == 0x4F;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
101
OPJViewer/source/imagj2k.h
Normal file
101
OPJViewer/source/imagj2k.h
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagj2k.h
|
||||||
|
// Purpose: wxImage JPEG 2000 raw codestream handler
|
||||||
|
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||||
|
// RCS-ID: $Id: imagj2k.h,v 0.0 2007/02/08 23:45:00 VZ Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_IMAGJ2K_H_
|
||||||
|
#define _WX_IMAGJ2K_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxJ2KHandler
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#include "wx/image.h"
|
||||||
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
|
#define wxBITMAP_TYPE_J2K 47
|
||||||
|
|
||||||
|
#define wxIMAGE_OPTION_REDUCEFACTOR wxString(_T("reducefactor"))
|
||||||
|
#define wxIMAGE_OPTION_QUALITYLAYERS wxString(_T("qualitylayers"))
|
||||||
|
#define wxIMAGE_OPTION_MAXCOMPS wxString(_T("maxcomps"))
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
#define wxIMAGE_OPTION_ENABLEJPWL wxString(_T("enablejpwl"))
|
||||||
|
#define wxIMAGE_OPTION_EXPCOMPS wxString(_T("expcomps"))
|
||||||
|
#define wxIMAGE_OPTION_MAXTILES wxString(_T("maxtiles"))
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxJ2KHandler: public wxImageHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline wxJ2KHandler()
|
||||||
|
{
|
||||||
|
m_name = wxT("JPEG 2000 codestream file");
|
||||||
|
m_extension = wxT("j2k");
|
||||||
|
m_type = wxBITMAP_TYPE_J2K;
|
||||||
|
m_mime = wxT("image/j2k");
|
||||||
|
|
||||||
|
m_reducefactor = 0;
|
||||||
|
m_qualitylayers = 0;
|
||||||
|
m_components = 0;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
m_enablejpwl = true;
|
||||||
|
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||||
|
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
}
|
||||||
|
|
||||||
|
// decoding engine parameters
|
||||||
|
int m_reducefactor, m_qualitylayers, m_components;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
bool m_enablejpwl;
|
||||||
|
int m_expcomps, m_maxtiles;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
#if wxUSE_STREAMS
|
||||||
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
|
protected:
|
||||||
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxJ2KHandler)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#endif // _WX_IMAGJ2K_H_
|
||||||
|
|
||||||
278
OPJViewer/source/imagjp2.cpp
Normal file
278
OPJViewer/source/imagjp2.cpp
Normal file
@@ -0,0 +1,278 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagjp2.cpp
|
||||||
|
// Purpose: wxImage JPEG 2000 file format handler
|
||||||
|
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||||
|
// RCS-ID: $Id: imagjp2.cpp,v 0.00 2007/02/08 23:59:00 MW Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#include "imagjp2.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/log.h"
|
||||||
|
#include "wx/app.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
#include "wx/bitmap.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "wx/filefn.h"
|
||||||
|
#include "wx/wfstream.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// types
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxJP2Handler
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxJP2Handler,wxImageHandler)
|
||||||
|
|
||||||
|
#if wxUSE_STREAMS
|
||||||
|
|
||||||
|
//------------- JPEG 2000 Data Source Manager
|
||||||
|
|
||||||
|
#define J2K_CFMT 0
|
||||||
|
#define JP2_CFMT 1
|
||||||
|
#define JPT_CFMT 2
|
||||||
|
#define MJ2_CFMT 3
|
||||||
|
#define PXM_DFMT 0
|
||||||
|
#define PGX_DFMT 1
|
||||||
|
#define BMP_DFMT 2
|
||||||
|
#define YUV_DFMT 3
|
||||||
|
|
||||||
|
#define MAX_MESSAGE_LEN 200
|
||||||
|
|
||||||
|
/* sample error callback expecting a FILE* client object */
|
||||||
|
void jp2_error_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample warning callback expecting a FILE* client object */
|
||||||
|
void jp2_warning_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample debug callback expecting no client object */
|
||||||
|
void jp2_info_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
// load the jp2 file format
|
||||||
|
bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
||||||
|
{
|
||||||
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
opj_image_t *opjimage = NULL;
|
||||||
|
unsigned char *src = NULL;
|
||||||
|
unsigned char *ptr;
|
||||||
|
int file_length;
|
||||||
|
|
||||||
|
// destroy the image
|
||||||
|
image->Destroy();
|
||||||
|
|
||||||
|
/* handle to a decompressor */
|
||||||
|
opj_dinfo_t* dinfo = NULL;
|
||||||
|
opj_cio_t *cio = NULL;
|
||||||
|
|
||||||
|
/* configure the event callbacks (not required) */
|
||||||
|
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||||
|
event_mgr.error_handler = jp2_error_callback;
|
||||||
|
event_mgr.warning_handler = jp2_warning_callback;
|
||||||
|
event_mgr.info_handler = jp2_info_callback;
|
||||||
|
|
||||||
|
/* set decoding parameters to default values */
|
||||||
|
opj_set_default_decoder_parameters(¶meters);
|
||||||
|
|
||||||
|
/* prepare parameters */
|
||||||
|
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
||||||
|
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
||||||
|
parameters.decod_format = JP2_CFMT;
|
||||||
|
parameters.cod_format = BMP_DFMT;
|
||||||
|
if (m_reducefactor)
|
||||||
|
parameters.cp_reduce = m_reducefactor;
|
||||||
|
if (m_qualitylayers)
|
||||||
|
parameters.cp_layer = m_qualitylayers;
|
||||||
|
/*if (n_components)
|
||||||
|
parameters. = n_components;*/
|
||||||
|
|
||||||
|
/* JPWL only */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
parameters.jpwl_exp_comps = m_expcomps;
|
||||||
|
parameters.jpwl_max_tiles = m_maxtiles;
|
||||||
|
parameters.jpwl_correct = m_enablejpwl;
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
|
/* get a decoder handle */
|
||||||
|
dinfo = opj_create_decompress(CODEC_JP2);
|
||||||
|
|
||||||
|
/* find length of the stream */
|
||||||
|
stream.SeekI(0, wxFromEnd);
|
||||||
|
file_length = (int) stream.TellI();
|
||||||
|
|
||||||
|
/* get data */
|
||||||
|
stream.SeekI(0, wxFromStart);
|
||||||
|
src = (unsigned char *) malloc(file_length);
|
||||||
|
stream.Read(src, file_length);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
|
/* setup the decoder decoding parameters using user parameters */
|
||||||
|
opj_setup_decoder(dinfo, ¶meters);
|
||||||
|
|
||||||
|
/* open a byte stream */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
|
/* decode the stream and fill the image structure */
|
||||||
|
opjimage = opj_decode(dinfo, cio);
|
||||||
|
if (!opjimage) {
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogError(wxT("JP2: failed to decode image!"));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
free(src);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* common rendering method */
|
||||||
|
#include "imagjpeg2000.cpp"
|
||||||
|
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("JP2: image loaded."));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
|
||||||
|
/* close openjpeg structs */
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_image_destroy(opjimage);
|
||||||
|
free(src);
|
||||||
|
|
||||||
|
if (!image->Ok())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// save the jp2 file format
|
||||||
|
bool wxJP2Handler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||||
|
{
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogError(wxT("JP2: Couldn't save image -> not implemented."));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __VISUALC__
|
||||||
|
#pragma warning(default:4611)
|
||||||
|
#endif /* VC++ */
|
||||||
|
|
||||||
|
// recognize the JPEG 2000 starting box
|
||||||
|
bool wxJP2Handler::DoCanRead( wxInputStream& stream )
|
||||||
|
{
|
||||||
|
unsigned char hdr[23];
|
||||||
|
|
||||||
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (hdr[0] == 0x00 &&
|
||||||
|
hdr[1] == 0x00 &&
|
||||||
|
hdr[2] == 0x00 &&
|
||||||
|
hdr[3] == 0x0C &&
|
||||||
|
hdr[4] == 0x6A &&
|
||||||
|
hdr[5] == 0x50 &&
|
||||||
|
hdr[6] == 0x20 &&
|
||||||
|
hdr[7] == 0x20 &&
|
||||||
|
hdr[20] == 0x6A &&
|
||||||
|
hdr[21] == 0x70 &&
|
||||||
|
hdr[22] == 0x32);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
92
OPJViewer/source/imagjp2.h
Normal file
92
OPJViewer/source/imagjp2.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagjp2.h
|
||||||
|
// Purpose: wxImage JPEG 2000 file format handler
|
||||||
|
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||||
|
// RCS-ID: $Id: imagjp2.h,v 0.0 2007/02/08 23:45:00 VZ Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_IMAGJP2_H_
|
||||||
|
#define _WX_IMAGJP2_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxJP2Handler
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#include "wx/image.h"
|
||||||
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
|
#define wxBITMAP_TYPE_JP2 48
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxJP2Handler: public wxImageHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline wxJP2Handler()
|
||||||
|
{
|
||||||
|
m_name = wxT("JPEG 2000 file format");
|
||||||
|
m_extension = wxT("jp2");
|
||||||
|
m_type = wxBITMAP_TYPE_JP2;
|
||||||
|
m_mime = wxT("image/jp2");
|
||||||
|
|
||||||
|
m_reducefactor = 0;
|
||||||
|
m_qualitylayers = 0;
|
||||||
|
m_components = 0;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
m_enablejpwl = true;
|
||||||
|
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||||
|
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
}
|
||||||
|
|
||||||
|
// decoding engine parameters
|
||||||
|
int m_reducefactor, m_qualitylayers, m_components;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
bool m_enablejpwl;
|
||||||
|
int m_expcomps, m_maxtiles;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
#if wxUSE_STREAMS
|
||||||
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
|
protected:
|
||||||
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxJP2Handler)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#endif // _WX_IMAGJP2_H_
|
||||||
|
|
||||||
186
OPJViewer/source/imagjpeg2000.cpp
Normal file
186
OPJViewer/source/imagjpeg2000.cpp
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagjpeg2000.cpp
|
||||||
|
// Purpose: wxImage JPEG 2000 imagage rendering common functions
|
||||||
|
// Author: Giuseppe Baruffa
|
||||||
|
// RCS-ID: $Id: imagjpeg2000.cpp,v 0.00 2007/04/27 22:11:00 MW Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
- At this point, we have the structure "opjimage" that is filled with decompressed
|
||||||
|
data, as processed by the OpenJPEG decompression engine
|
||||||
|
|
||||||
|
- We need to fill the class "image" with the proper pixel sample values
|
||||||
|
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
int shiftbpp;
|
||||||
|
int c, tempcomps;
|
||||||
|
|
||||||
|
// check components number
|
||||||
|
if (m_components > opjimage->numcomps)
|
||||||
|
m_components = opjimage->numcomps;
|
||||||
|
|
||||||
|
// check image depth (only on the first one, for now)
|
||||||
|
if (m_components)
|
||||||
|
shiftbpp = opjimage->comps[m_components - 1].prec - 8;
|
||||||
|
else
|
||||||
|
shiftbpp = opjimage->comps[0].prec - 8;
|
||||||
|
|
||||||
|
// prepare image size
|
||||||
|
if (m_components)
|
||||||
|
image->Create(opjimage->comps[m_components - 1].w, opjimage->comps[m_components - 1].h, true);
|
||||||
|
else
|
||||||
|
image->Create(opjimage->comps[0].w, opjimage->comps[0].h, true);
|
||||||
|
|
||||||
|
// access image raw data
|
||||||
|
image->SetMask(false);
|
||||||
|
ptr = image->GetData();
|
||||||
|
|
||||||
|
// workaround for components different from 1 or 3
|
||||||
|
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("JPEG2000: weird number of components"));
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
tempcomps = 1;
|
||||||
|
} else
|
||||||
|
tempcomps = opjimage->numcomps;
|
||||||
|
|
||||||
|
// workaround for subsampled components
|
||||||
|
for (c = 1; c < tempcomps; c++) {
|
||||||
|
if ((opjimage->comps[c].w != opjimage->comps[c - 1].w) || (opjimage->comps[c].h != opjimage->comps[c - 1].h)) {
|
||||||
|
tempcomps = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// workaround for different precision components
|
||||||
|
for (c = 1; c < tempcomps; c++) {
|
||||||
|
if (opjimage->comps[c].bpp != opjimage->comps[c - 1].bpp) {
|
||||||
|
tempcomps = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// only one component selected
|
||||||
|
if (m_components)
|
||||||
|
tempcomps = 1;
|
||||||
|
|
||||||
|
// RGB color picture
|
||||||
|
if (tempcomps == 3) {
|
||||||
|
int row, col;
|
||||||
|
int *r = opjimage->comps[0].data;
|
||||||
|
int *g = opjimage->comps[1].data;
|
||||||
|
int *b = opjimage->comps[2].data;
|
||||||
|
if (shiftbpp > 0) {
|
||||||
|
for (row = 0; row < opjimage->comps[0].h; row++) {
|
||||||
|
for (col = 0; col < opjimage->comps[0].w; col++) {
|
||||||
|
|
||||||
|
*(ptr++) = (*(r++)) >> shiftbpp;
|
||||||
|
*(ptr++) = (*(g++)) >> shiftbpp;
|
||||||
|
*(ptr++) = (*(b++)) >> shiftbpp;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (shiftbpp < 0) {
|
||||||
|
for (row = 0; row < opjimage->comps[0].h; row++) {
|
||||||
|
for (col = 0; col < opjimage->comps[0].w; col++) {
|
||||||
|
|
||||||
|
*(ptr++) = (*(r++)) << -shiftbpp;
|
||||||
|
*(ptr++) = (*(g++)) << -shiftbpp;
|
||||||
|
*(ptr++) = (*(b++)) << -shiftbpp;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for (row = 0; row < opjimage->comps[0].h; row++) {
|
||||||
|
for (col = 0; col < opjimage->comps[0].w; col++) {
|
||||||
|
|
||||||
|
*(ptr++) = *(r++);
|
||||||
|
*(ptr++) = *(g++);
|
||||||
|
*(ptr++) = *(b++);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// B/W picture
|
||||||
|
if (tempcomps == 1) {
|
||||||
|
int row, col;
|
||||||
|
int selcomp;
|
||||||
|
|
||||||
|
if (m_components)
|
||||||
|
selcomp = m_components - 1;
|
||||||
|
else
|
||||||
|
selcomp = 0;
|
||||||
|
|
||||||
|
int *y = opjimage->comps[selcomp].data;
|
||||||
|
if (shiftbpp > 0) {
|
||||||
|
for (row = 0; row < opjimage->comps[selcomp].h; row++) {
|
||||||
|
for (col = 0; col < opjimage->comps[selcomp].w; col++) {
|
||||||
|
|
||||||
|
*(ptr++) = (*(y)) >> shiftbpp;
|
||||||
|
*(ptr++) = (*(y)) >> shiftbpp;
|
||||||
|
*(ptr++) = (*(y++)) >> shiftbpp;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (shiftbpp < 0) {
|
||||||
|
for (row = 0; row < opjimage->comps[selcomp].h; row++) {
|
||||||
|
for (col = 0; col < opjimage->comps[selcomp].w; col++) {
|
||||||
|
|
||||||
|
*(ptr++) = (*(y)) << -shiftbpp;
|
||||||
|
*(ptr++) = (*(y)) << -shiftbpp;
|
||||||
|
*(ptr++) = (*(y++)) << -shiftbpp;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (row = 0; row < opjimage->comps[selcomp].h; row++) {
|
||||||
|
for (col = 0; col < opjimage->comps[selcomp].w; col++) {
|
||||||
|
|
||||||
|
*(ptr++) = *(y);
|
||||||
|
*(ptr++) = *(y);
|
||||||
|
*(ptr++) = *(y++);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
762
OPJViewer/source/imagmj2.cpp
Normal file
762
OPJViewer/source/imagmj2.cpp
Normal file
@@ -0,0 +1,762 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagmj2.cpp
|
||||||
|
// Purpose: wxImage Motion JPEG 2000 file format handler
|
||||||
|
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||||
|
// RCS-ID: $Id: imagmj2.cpp,v 0.00 2007/02/18 23:59:00 MW Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#include "imagmj2.h"
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/log.h"
|
||||||
|
#include "wx/app.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
#include "wx/bitmap.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "wx/filefn.h"
|
||||||
|
#include "wx/wfstream.h"
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// types
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxMJ2Handler
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxMJ2Handler,wxImageHandler)
|
||||||
|
|
||||||
|
#if wxUSE_STREAMS
|
||||||
|
|
||||||
|
//------------- JPEG 2000 Data Source Manager
|
||||||
|
|
||||||
|
#define J2K_CFMT 0
|
||||||
|
#define JP2_CFMT 1
|
||||||
|
#define JPT_CFMT 2
|
||||||
|
#define MJ2_CFMT 3
|
||||||
|
#define PXM_DFMT 0
|
||||||
|
#define PGX_DFMT 1
|
||||||
|
#define BMP_DFMT 2
|
||||||
|
#define YUV_DFMT 3
|
||||||
|
|
||||||
|
#define MAX_MESSAGE_LEN 200
|
||||||
|
|
||||||
|
/* sample error callback expecting a FILE* client object */
|
||||||
|
void mj2_error_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample warning callback expecting a FILE* client object */
|
||||||
|
void mj2_warning_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* sample debug callback expecting no client object */
|
||||||
|
void mj2_info_callback(const char *msg, void *client_data) {
|
||||||
|
int message_len = strlen(msg) - 1;
|
||||||
|
if (msg[message_len] != '\n')
|
||||||
|
message_len = MAX_MESSAGE_LEN;
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||||
|
#ifndef __WXGTK__
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
#endif /* __WXGTK__ */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* macro functions */
|
||||||
|
/* From little endian to big endian, 2 and 4 bytes */
|
||||||
|
#define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8)
|
||||||
|
#define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24)
|
||||||
|
#define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
|
||||||
|
((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \
|
||||||
|
((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \
|
||||||
|
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56)
|
||||||
|
|
||||||
|
/* From codestream to int values */
|
||||||
|
#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \
|
||||||
|
((unsigned long int) (C)[(P) + 1] << 16) + \
|
||||||
|
((unsigned long int) (C)[(P) + 2] << 8) + \
|
||||||
|
((unsigned long int) (C)[(P) + 3] << 0))
|
||||||
|
|
||||||
|
#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \
|
||||||
|
((unsigned long int) (C)[(P) + 1] << 0))
|
||||||
|
|
||||||
|
/* defines */
|
||||||
|
#define SHORT_DESCR_LEN 32
|
||||||
|
#define LONG_DESCR_LEN 256
|
||||||
|
|
||||||
|
/* enumeration for file formats */
|
||||||
|
#define J2FILENUM 4
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
JP2_FILE,
|
||||||
|
J2K_FILE,
|
||||||
|
MJ2_FILE,
|
||||||
|
UNK_FILE
|
||||||
|
|
||||||
|
} my_j2filetype;
|
||||||
|
|
||||||
|
/* enumeration for the box types */
|
||||||
|
#define J2BOXNUM 23
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
FILE_BOX,
|
||||||
|
JP_BOX,
|
||||||
|
FTYP_BOX,
|
||||||
|
JP2H_BOX,
|
||||||
|
IHDR_BOX,
|
||||||
|
COLR_BOX,
|
||||||
|
JP2C_BOX,
|
||||||
|
JP2I_BOX,
|
||||||
|
XML_BOX,
|
||||||
|
UUID_BOX,
|
||||||
|
UINF_BOX,
|
||||||
|
MOOV_BOX,
|
||||||
|
MVHD_BOX,
|
||||||
|
TRAK_BOX,
|
||||||
|
TKHD_BOX,
|
||||||
|
MDIA_BOX,
|
||||||
|
MINF_BOX,
|
||||||
|
STBL_BOX,
|
||||||
|
STSD_BOX,
|
||||||
|
MJP2_BOX,
|
||||||
|
MDAT_BOX,
|
||||||
|
ANY_BOX,
|
||||||
|
UNK_BOX
|
||||||
|
|
||||||
|
} my_j2boxtype;
|
||||||
|
|
||||||
|
/* jp2 family box signatures */
|
||||||
|
#define FILE_SIGN ""
|
||||||
|
#define JP_SIGN "jP\040\040"
|
||||||
|
#define FTYP_SIGN "ftyp"
|
||||||
|
#define JP2H_SIGN "jp2h"
|
||||||
|
#define IHDR_SIGN "ihdr"
|
||||||
|
#define COLR_SIGN "colr"
|
||||||
|
#define JP2C_SIGN "jp2c"
|
||||||
|
#define JP2I_SIGN "jp2i"
|
||||||
|
#define XML_SIGN "xml\040"
|
||||||
|
#define UUID_SIGN "uuid"
|
||||||
|
#define UINF_SIGN "uinf"
|
||||||
|
#define MOOV_SIGN "moov"
|
||||||
|
#define MVHD_SIGN "mvhd"
|
||||||
|
#define TRAK_SIGN "trak"
|
||||||
|
#define TKHD_SIGN "tkhd"
|
||||||
|
#define MDIA_SIGN "mdia"
|
||||||
|
#define MINF_SIGN "minf"
|
||||||
|
#define VMHD_SIGN "vmhd"
|
||||||
|
#define STBL_SIGN "stbl"
|
||||||
|
#define STSD_SIGN "stsd"
|
||||||
|
#define MJP2_SIGN "mjp2"
|
||||||
|
#define MDAT_SIGN "mdat"
|
||||||
|
#define ANY_SIGN ""
|
||||||
|
#define UNK_SIGN ""
|
||||||
|
|
||||||
|
/* the box structure itself */
|
||||||
|
struct my_boxdef {
|
||||||
|
|
||||||
|
char value[5]; /* hexadecimal value/string*/
|
||||||
|
char name[SHORT_DESCR_LEN]; /* short description */
|
||||||
|
char descr[LONG_DESCR_LEN]; /* long description */
|
||||||
|
int sbox; /* is it a superbox? */
|
||||||
|
int req[J2FILENUM]; /* mandatory box */
|
||||||
|
my_j2boxtype ins; /* contained in box... */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* the possible boxes */
|
||||||
|
struct my_boxdef j2box[] =
|
||||||
|
{
|
||||||
|
/* sign */ {FILE_SIGN,
|
||||||
|
/* short */ "placeholder for nothing",
|
||||||
|
/* long */ "Nothing to say",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP_SIGN,
|
||||||
|
/* short */ "JPEG 2000 Signature box",
|
||||||
|
/* long */ "This box uniquely identifies the file as being part of the JPEG 2000 family of files",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {FTYP_SIGN,
|
||||||
|
/* short */ "File Type box",
|
||||||
|
/* long */ "This box specifies file type, version and compatibility information, including specifying if this file "
|
||||||
|
"is a conforming JP2 file or if it can be read by a conforming JP2 reader",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP2H_SIGN,
|
||||||
|
/* short */ "JP2 Header box",
|
||||||
|
/* long */ "This box contains a series of boxes that contain header-type information about the file",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {IHDR_SIGN,
|
||||||
|
/* short */ "Image Header box",
|
||||||
|
/* long */ "This box specifies the size of the image and other related fields",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ JP2H_BOX},
|
||||||
|
|
||||||
|
/* sign */ {COLR_SIGN,
|
||||||
|
/* short */ "Colour Specification box",
|
||||||
|
/* long */ "This box specifies the colourspace of the image",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ JP2H_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP2C_SIGN,
|
||||||
|
/* short */ "Contiguous Codestream box",
|
||||||
|
/* long */ "This box contains the codestream as defined by Annex A",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP2I_SIGN,
|
||||||
|
/* short */ "Intellectual Property box",
|
||||||
|
/* long */ "This box contains intellectual property information about the image",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {XML_SIGN,
|
||||||
|
/* short */ "XML box",
|
||||||
|
/* long */ "This box provides a tool by which vendors can add XML formatted information to a JP2 file",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {UUID_SIGN,
|
||||||
|
/* short */ "UUID box",
|
||||||
|
/* long */ "This box provides a tool by which vendors can add additional information to a file "
|
||||||
|
"without risking conflict with other vendors",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {UINF_SIGN,
|
||||||
|
/* short */ "UUID Info box",
|
||||||
|
/* long */ "This box provides a tool by which a vendor may provide access to additional information associated with a UUID",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MOOV_SIGN,
|
||||||
|
/* short */ "Movie box",
|
||||||
|
/* long */ "This box contains the media data. In video tracks, this box would contain JPEG2000 video frames",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MVHD_SIGN,
|
||||||
|
/* short */ "Movie Header box",
|
||||||
|
/* long */ "This box defines overall information which is media-independent, and relevant to the entire presentation "
|
||||||
|
"considered as a whole",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MOOV_BOX},
|
||||||
|
|
||||||
|
/* sign */ {TRAK_SIGN,
|
||||||
|
/* short */ "Track box",
|
||||||
|
/* long */ "This is a container box for a single track of a presentation. A presentation may consist of one or more tracks",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MOOV_BOX},
|
||||||
|
|
||||||
|
/* sign */ {TKHD_SIGN,
|
||||||
|
/* short */ "Track Header box",
|
||||||
|
/* long */ "This box specifies the characteristics of a single track. Exactly one Track Header Box is contained in a track",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ TRAK_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MDIA_SIGN,
|
||||||
|
/* short */ "Media box",
|
||||||
|
/* long */ "The media declaration container contains all the objects which declare information about the media data "
|
||||||
|
"within a track",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ TRAK_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MINF_SIGN,
|
||||||
|
/* short */ "Media Information box",
|
||||||
|
/* long */ "This box contains all the objects which declare characteristic information of the media in the track",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MDIA_BOX},
|
||||||
|
|
||||||
|
/* sign */ {STBL_SIGN,
|
||||||
|
/* short */ "Sample Table box",
|
||||||
|
/* long */ "The sample table contains all the time and data indexing of the media samples in a track",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {STSD_SIGN,
|
||||||
|
/* short */ "Sample Description box",
|
||||||
|
/* long */ "The sample description table gives detailed information about the coding type used, and any initialization "
|
||||||
|
"information needed for that coding",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MJP2_SIGN,
|
||||||
|
/* short */ "MJP2 Sample Description box",
|
||||||
|
/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization "
|
||||||
|
"information needed for that coding",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MDAT_SIGN,
|
||||||
|
/* short */ "Media Data box",
|
||||||
|
/* long */ "The meta-data for a presentation is stored in the single Movie Box which occurs at the top-level of a file",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {ANY_SIGN,
|
||||||
|
/* short */ "Any box",
|
||||||
|
/* long */ "All the existing boxes",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {UNK_SIGN,
|
||||||
|
/* short */ "Unknown Type box",
|
||||||
|
/* long */ "The signature is not recognised to be that of an existing box",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ ANY_BOX}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* declaration */
|
||||||
|
int
|
||||||
|
my_box_handler_function(my_j2boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
||||||
|
char *scansign, unsigned long int *scanpoint);
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
typedef unsigned __int64 int8byte;
|
||||||
|
#endif // __WXMSW__
|
||||||
|
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
typedef unsigned long long int8byte;
|
||||||
|
#endif // __WXGTK__
|
||||||
|
|
||||||
|
/* internal mini-search for a box signature */
|
||||||
|
int
|
||||||
|
my_jpeg2000parse(wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
||||||
|
char *scansign, unsigned long int *scanpoint)
|
||||||
|
{
|
||||||
|
unsigned long int LBox = 0x00000000;
|
||||||
|
//int LBox_read;
|
||||||
|
char TBox[5] = "\0\0\0\0";
|
||||||
|
//int TBox_read;
|
||||||
|
int8byte XLBox = 0x0000000000000000;
|
||||||
|
//int XLBox_read;
|
||||||
|
unsigned long int box_length = 0;
|
||||||
|
int last_box = 0, box_num = 0;
|
||||||
|
int box_type = ANY_BOX;
|
||||||
|
unsigned char /*onebyte[1], twobytes[2],*/ fourbytes[4];
|
||||||
|
int box_number = 0;
|
||||||
|
|
||||||
|
/* cycle all over the file */
|
||||||
|
box_num = 0;
|
||||||
|
last_box = 0;
|
||||||
|
while (!last_box) {
|
||||||
|
|
||||||
|
/* do not exceed file limit */
|
||||||
|
if (filepoint >= filelimit)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
/* seek on file */
|
||||||
|
if (stream.SeekI(filepoint, wxFromStart) == wxInvalidOffset)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
/* read the mandatory LBox, 4 bytes */
|
||||||
|
if (!stream.Read(fourbytes, 4)) {
|
||||||
|
(wxT("Problem reading LBox from the file (file ended?)"));
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
LBox = STREAM_TO_UINT32(fourbytes, 0);
|
||||||
|
|
||||||
|
/* read the mandatory TBox, 4 bytes */
|
||||||
|
if (!stream.Read(TBox, 4)) {
|
||||||
|
wxLogError(wxT("Problem reading TBox from the file (file ended?)"));
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* look if scansign is got */
|
||||||
|
if ((scansign != NULL) && (memcmp(TBox, scansign, 4) == 0)) {
|
||||||
|
/* hack/exploit */
|
||||||
|
// stop as soon as you find the level-th codebox
|
||||||
|
if (box_number == level) {
|
||||||
|
memcpy(scansign, " ", 4);
|
||||||
|
*scanpoint = filepoint;
|
||||||
|
return (0);
|
||||||
|
} else
|
||||||
|
box_number++;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* determine the box type */
|
||||||
|
for (box_type = JP_BOX; box_type < UNK_BOX; box_type++)
|
||||||
|
if (memcmp(TBox, j2box[box_type].value, 4) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* read the optional XLBox, 8 bytes */
|
||||||
|
if (LBox == 1) {
|
||||||
|
|
||||||
|
if (!stream.Read(&XLBox, 8)) {
|
||||||
|
wxLogError(wxT("Problem reading XLBox from the file (file ended?)"));
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
box_length = (unsigned long int) BYTE_SWAP8(XLBox);
|
||||||
|
|
||||||
|
} else if (LBox == 0x00000000) {
|
||||||
|
|
||||||
|
/* last box in file */
|
||||||
|
last_box = 1;
|
||||||
|
box_length = filelimit - filepoint;
|
||||||
|
|
||||||
|
} else
|
||||||
|
|
||||||
|
box_length = LBox;
|
||||||
|
|
||||||
|
|
||||||
|
/* go deep in the box */
|
||||||
|
my_box_handler_function((my_j2boxtype) box_type, stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length, level,
|
||||||
|
scansign, scanpoint);
|
||||||
|
|
||||||
|
/* if it's a superbox go inside it */
|
||||||
|
if (j2box[box_type].sbox)
|
||||||
|
my_jpeg2000parse(stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length,
|
||||||
|
level, scansign, scanpoint);
|
||||||
|
|
||||||
|
/* increment box number and filepoint*/
|
||||||
|
box_num++;
|
||||||
|
filepoint += box_length;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* all good */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// search first contiguos codestream box in an mj2 file
|
||||||
|
unsigned long int
|
||||||
|
searchjp2c(wxInputStream& stream, unsigned long int fsize, int number)
|
||||||
|
{
|
||||||
|
char scansign[] = "jp2c";
|
||||||
|
unsigned long int scanpoint = 0L;
|
||||||
|
|
||||||
|
wxLogMessage(wxT("MJ2: searching jp2c box... "));
|
||||||
|
|
||||||
|
/* do the parsing */
|
||||||
|
if (my_jpeg2000parse(stream, 0, fsize, number, scansign, &scanpoint) < 0)
|
||||||
|
wxLogMessage(wxT("MJ2: Unrecoverable error during file parsing: stopping"));
|
||||||
|
|
||||||
|
if (strcmp(scansign, " "))
|
||||||
|
wxLogMessage(wxT("MJ2: not found"));
|
||||||
|
else {
|
||||||
|
|
||||||
|
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return (scanpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// search the jp2h box in the file
|
||||||
|
unsigned long int
|
||||||
|
searchjpegheaderbox(wxInputStream& stream, unsigned long int fsize)
|
||||||
|
{
|
||||||
|
char scansign[] = "jp2h";
|
||||||
|
unsigned long int scanpoint = 0L;
|
||||||
|
|
||||||
|
wxLogMessage(wxT("MJ2: searching jp2h box... "));
|
||||||
|
|
||||||
|
/* do the parsing */
|
||||||
|
if (my_jpeg2000parse(stream, 0, fsize, 0, scansign, &scanpoint) < 0)
|
||||||
|
wxLogMessage(wxT("Unrecoverable error during file parsing: stopping"));
|
||||||
|
|
||||||
|
if (strcmp(scansign, " "))
|
||||||
|
wxLogMessage(wxT("MJ2: not found"));
|
||||||
|
else
|
||||||
|
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
|
||||||
|
|
||||||
|
return (scanpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* handling functions */
|
||||||
|
#define ITEM_PER_ROW 10
|
||||||
|
|
||||||
|
/* Box handler function */
|
||||||
|
int
|
||||||
|
my_box_handler_function(my_j2boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
||||||
|
char *scansign, unsigned long int *scanpoint)
|
||||||
|
{
|
||||||
|
switch (boxtype) {
|
||||||
|
|
||||||
|
/* Sample Description box */
|
||||||
|
case (STSD_BOX):
|
||||||
|
my_jpeg2000parse(stream, filepoint + 8, filelimit, level, scansign, scanpoint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* MJP2 Sample Description box */
|
||||||
|
case (MJP2_BOX):
|
||||||
|
my_jpeg2000parse(stream, filepoint + 78, filelimit, level, scansign, scanpoint);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* not yet implemented */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the jP and ftyp parts of the header
|
||||||
|
#define my_jPheadSIZE 32
|
||||||
|
unsigned char my_jPhead[my_jPheadSIZE] = {
|
||||||
|
0x00, 0x00, 0x00, 0x0C, 'j', 'P', ' ', ' ',
|
||||||
|
0x0D, 0x0A, 0x87, 0x0A, 0x00, 0x00, 0x00, 0x14,
|
||||||
|
'f', 't', 'y', 'p', 'j', 'p', '2', ' ',
|
||||||
|
0x00, 0x00, 0x00, 0x00, 'j', 'p', '2', ' '
|
||||||
|
};
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////
|
||||||
|
/////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// load the mj2 file format
|
||||||
|
bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
||||||
|
{
|
||||||
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
opj_image_t *opjimage = NULL;
|
||||||
|
unsigned char *src = NULL;
|
||||||
|
unsigned char *ptr;
|
||||||
|
int file_length, jp2c_point, jp2h_point;
|
||||||
|
unsigned long int jp2hboxlen, jp2cboxlen;
|
||||||
|
|
||||||
|
// destroy the image
|
||||||
|
image->Destroy();
|
||||||
|
|
||||||
|
/* handle to a decompressor */
|
||||||
|
opj_dinfo_t* dinfo = NULL;
|
||||||
|
opj_cio_t *cio = NULL;
|
||||||
|
|
||||||
|
/* configure the event callbacks (not required) */
|
||||||
|
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||||
|
event_mgr.error_handler = mj2_error_callback;
|
||||||
|
event_mgr.warning_handler = mj2_warning_callback;
|
||||||
|
event_mgr.info_handler = mj2_info_callback;
|
||||||
|
|
||||||
|
/* set decoding parameters to default values */
|
||||||
|
opj_set_default_decoder_parameters(¶meters);
|
||||||
|
|
||||||
|
/* prepare parameters */
|
||||||
|
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
||||||
|
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
||||||
|
parameters.decod_format = JP2_CFMT;
|
||||||
|
parameters.cod_format = BMP_DFMT;
|
||||||
|
if (m_reducefactor)
|
||||||
|
parameters.cp_reduce = m_reducefactor;
|
||||||
|
if (m_qualitylayers)
|
||||||
|
parameters.cp_layer = m_qualitylayers;
|
||||||
|
/*if (n_components)
|
||||||
|
parameters. = n_components;*/
|
||||||
|
|
||||||
|
/* JPWL only */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
parameters.jpwl_exp_comps = m_expcomps;
|
||||||
|
parameters.jpwl_max_tiles = m_maxtiles;
|
||||||
|
parameters.jpwl_correct = m_enablejpwl;
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
|
||||||
|
/* get a decoder handle */
|
||||||
|
dinfo = opj_create_decompress(CODEC_JP2);
|
||||||
|
|
||||||
|
/* find length of the stream */
|
||||||
|
stream.SeekI(0, wxFromEnd);
|
||||||
|
file_length = (int) stream.TellI();
|
||||||
|
|
||||||
|
/* search for the first codestream box and the movie header box */
|
||||||
|
jp2c_point = searchjp2c(stream, file_length, m_framenum);
|
||||||
|
jp2h_point = searchjpegheaderbox(stream, file_length);
|
||||||
|
|
||||||
|
// read the jp2h box and store it
|
||||||
|
stream.SeekI(jp2h_point, wxFromStart);
|
||||||
|
stream.Read(&jp2hboxlen, sizeof(unsigned long int));
|
||||||
|
jp2hboxlen = BYTE_SWAP4(jp2hboxlen);
|
||||||
|
|
||||||
|
// read the jp2c box and store it
|
||||||
|
stream.SeekI(jp2c_point, wxFromStart);
|
||||||
|
stream.Read(&jp2cboxlen, sizeof(unsigned long int));
|
||||||
|
jp2cboxlen = BYTE_SWAP4(jp2cboxlen);
|
||||||
|
|
||||||
|
// malloc memory source
|
||||||
|
src = (unsigned char *) malloc(my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
||||||
|
|
||||||
|
// copy the jP and ftyp
|
||||||
|
memcpy(src, my_jPhead, my_jPheadSIZE);
|
||||||
|
|
||||||
|
// copy the jp2h
|
||||||
|
stream.SeekI(jp2h_point, wxFromStart);
|
||||||
|
stream.Read(&src[my_jPheadSIZE], jp2hboxlen);
|
||||||
|
|
||||||
|
// copy the jp2c
|
||||||
|
stream.SeekI(jp2c_point, wxFromStart);
|
||||||
|
stream.Read(&src[my_jPheadSIZE + jp2hboxlen], jp2cboxlen);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
|
/* setup the decoder decoding parameters using user parameters */
|
||||||
|
opj_setup_decoder(dinfo, ¶meters);
|
||||||
|
|
||||||
|
/* open a byte stream */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
||||||
|
|
||||||
|
/* decode the stream and fill the image structure */
|
||||||
|
opjimage = opj_decode(dinfo, cio);
|
||||||
|
if (!opjimage) {
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
wxLogError(wxT("MJ2: failed to decode image!"));
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
free(src);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
/* common rendering method */
|
||||||
|
#include "imagjpeg2000.cpp"
|
||||||
|
|
||||||
|
wxMutexGuiEnter();
|
||||||
|
wxLogMessage(wxT("MJ2: image loaded."));
|
||||||
|
wxMutexGuiLeave();
|
||||||
|
|
||||||
|
/* close openjpeg structs */
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_image_destroy(opjimage);
|
||||||
|
free(src);
|
||||||
|
|
||||||
|
if (!image->Ok())
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// save the mj2 file format
|
||||||
|
bool wxMJ2Handler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||||
|
{
|
||||||
|
wxLogError(wxT("MJ2: Couldn't save movie -> not implemented."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __VISUALC__
|
||||||
|
#pragma warning(default:4611)
|
||||||
|
#endif /* VC++ */
|
||||||
|
|
||||||
|
// recognize the Motion JPEG 2000 starting box
|
||||||
|
bool wxMJ2Handler::DoCanRead( wxInputStream& stream )
|
||||||
|
{
|
||||||
|
unsigned char hdr[24];
|
||||||
|
|
||||||
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (hdr[0] == 0x00 &&
|
||||||
|
hdr[1] == 0x00 &&
|
||||||
|
hdr[2] == 0x00 &&
|
||||||
|
hdr[3] == 0x0C &&
|
||||||
|
hdr[4] == 0x6A &&
|
||||||
|
hdr[5] == 0x50 &&
|
||||||
|
hdr[6] == 0x20 &&
|
||||||
|
hdr[7] == 0x20 &&
|
||||||
|
hdr[20] == 0x6D &&
|
||||||
|
hdr[21] == 0x6A &&
|
||||||
|
hdr[22] == 0x70 &&
|
||||||
|
hdr[23] == 0x32);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
92
OPJViewer/source/imagmj2.h
Normal file
92
OPJViewer/source/imagmj2.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: imagmj2.h
|
||||||
|
// Purpose: wxImage Motion JPEG 2000 file format handler
|
||||||
|
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||||
|
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/02/18 23:45:00 VZ Exp $
|
||||||
|
// Copyright: (c) Giuseppe Baruffa
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_IMAGMJ2_H_
|
||||||
|
#define _WX_IMAGMJ2_H_
|
||||||
|
|
||||||
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxMJ2Handler
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#include "wx/image.h"
|
||||||
|
#include "libopenjpeg/openjpeg.h"
|
||||||
|
|
||||||
|
#define wxBITMAP_TYPE_MJ2 49
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxMJ2Handler: public wxImageHandler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline wxMJ2Handler()
|
||||||
|
{
|
||||||
|
m_name = wxT("Motion JPEG 2000 file format");
|
||||||
|
m_extension = wxT("mj2");
|
||||||
|
m_type = wxBITMAP_TYPE_MJ2;
|
||||||
|
m_mime = wxT("image/mj2");
|
||||||
|
|
||||||
|
m_reducefactor = 0;
|
||||||
|
m_qualitylayers = 0;
|
||||||
|
m_components = 0;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
m_enablejpwl = true;
|
||||||
|
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||||
|
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
}
|
||||||
|
|
||||||
|
// decoding engine parameters
|
||||||
|
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
bool m_enablejpwl;
|
||||||
|
int m_expcomps, m_maxtiles;
|
||||||
|
#endif // USE_JPWL
|
||||||
|
|
||||||
|
#if wxUSE_STREAMS
|
||||||
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
|
protected:
|
||||||
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMJ2Handler)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // wxUSE_LIBOPENJPEG
|
||||||
|
|
||||||
|
#endif // _WX_IMAGMJ2_H_
|
||||||
|
|
||||||
14
OPJViewer/source/license.txt
Normal file
14
OPJViewer/source/license.txt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
|
Copyright (c) 2001-2003, David Janssens
|
||||||
|
Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
|
Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditionsare met:
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
285
OPJViewer/source/opj_logo.xpm
Normal file
285
OPJViewer/source/opj_logo.xpm
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
/* XPM */
|
||||||
|
static char *opj_logo[] = {
|
||||||
|
/* columns rows colors chars-per-pixel */
|
||||||
|
"90 61 218 2",
|
||||||
|
" c #BE3D12",
|
||||||
|
". c #BF461D",
|
||||||
|
"X c #AD5435",
|
||||||
|
"o c #B64925",
|
||||||
|
"O c #B54E2B",
|
||||||
|
"+ c #BC4620",
|
||||||
|
"@ c #BB4B25",
|
||||||
|
"# c #BC4E29",
|
||||||
|
"$ c #B5502F",
|
||||||
|
"% c #BD512C",
|
||||||
|
"& c #B45334",
|
||||||
|
"* c #B35638",
|
||||||
|
"= c #B45B3D",
|
||||||
|
"- c #BB5533",
|
||||||
|
"; c #BE5937",
|
||||||
|
": c #BC5C3D",
|
||||||
|
"> c #9C766A",
|
||||||
|
", c #AD5D42",
|
||||||
|
"< c #B55F41",
|
||||||
|
"1 c #BA5E40",
|
||||||
|
"2 c #A7634D",
|
||||||
|
"3 c #A76C57",
|
||||||
|
"4 c #AA6750",
|
||||||
|
"5 c #AC6B56",
|
||||||
|
"6 c #AA6E5A",
|
||||||
|
"7 c #A4705E",
|
||||||
|
"8 c #B46045",
|
||||||
|
"9 c #B1644B",
|
||||||
|
"0 c #BD6244",
|
||||||
|
"q c #B96448",
|
||||||
|
"w c #BC694D",
|
||||||
|
"e c #B36B53",
|
||||||
|
"r c #B26E58",
|
||||||
|
"t c #BB6C52",
|
||||||
|
"y c #B2725D",
|
||||||
|
"u c #BD7056",
|
||||||
|
"i c #BB745C",
|
||||||
|
"p c #A67566",
|
||||||
|
"a c #A57B6D",
|
||||||
|
"s c #AE7562",
|
||||||
|
"d c #AB7867",
|
||||||
|
"f c #AA7C6C",
|
||||||
|
"g c #A07E73",
|
||||||
|
"h c #AA7F71",
|
||||||
|
"j c #B37661",
|
||||||
|
"k c #B47863",
|
||||||
|
"l c #B27D6B",
|
||||||
|
"z c #BB7863",
|
||||||
|
"x c #BA7E69",
|
||||||
|
"c c #C73605",
|
||||||
|
"v c #C63A0B",
|
||||||
|
"b c #CB3300",
|
||||||
|
"n c #CA3807",
|
||||||
|
"m c #C93A0A",
|
||||||
|
"M c #C43E11",
|
||||||
|
"N c #C93E10",
|
||||||
|
"B c #C44115",
|
||||||
|
"V c #C3441A",
|
||||||
|
"C c #C4481E",
|
||||||
|
"Z c #CA4113",
|
||||||
|
"A c #C94519",
|
||||||
|
"S c #CB481C",
|
||||||
|
"D c #C24A23",
|
||||||
|
"F c #C24F28",
|
||||||
|
"G c #CD4D23",
|
||||||
|
"H c #C4522D",
|
||||||
|
"J c #CB532B",
|
||||||
|
"K c #C25632",
|
||||||
|
"L c #C35936",
|
||||||
|
"P c #C25C3B",
|
||||||
|
"I c #C85630",
|
||||||
|
"U c #CB5933",
|
||||||
|
"Y c #CB5E3A",
|
||||||
|
"T c #D05026",
|
||||||
|
"R c #CC613D",
|
||||||
|
"E c #C26343",
|
||||||
|
"W c #C46748",
|
||||||
|
"Q c #C1694C",
|
||||||
|
"! c #CD6744",
|
||||||
|
"~ c #CA6C4D",
|
||||||
|
"^ c #C37155",
|
||||||
|
"/ c #C4755B",
|
||||||
|
"( c #CB7356",
|
||||||
|
") c #C8765B",
|
||||||
|
"_ c #D06D4C",
|
||||||
|
"` c #D07253",
|
||||||
|
"' c #D47B5E",
|
||||||
|
"] c #C37B63",
|
||||||
|
"[ c #C27E68",
|
||||||
|
"{ c #C97F68",
|
||||||
|
"} c #A68175",
|
||||||
|
"| c #A48479",
|
||||||
|
" . c #AD8172",
|
||||||
|
".. c #AD8578",
|
||||||
|
"X. c #AB897D",
|
||||||
|
"o. c #B1806F",
|
||||||
|
"O. c #BA816F",
|
||||||
|
"+. c #B38373",
|
||||||
|
"@. c #B58778",
|
||||||
|
"#. c #B3897B",
|
||||||
|
"$. c #BA8472",
|
||||||
|
"%. c #BB8C7C",
|
||||||
|
"&. c #C2816B",
|
||||||
|
"*. c #CD846C",
|
||||||
|
"=. c #C38470",
|
||||||
|
"-. c #C38976",
|
||||||
|
";. c #C38D7B",
|
||||||
|
":. c #CC8973",
|
||||||
|
">. c #CF8F7A",
|
||||||
|
",. c #CB907D",
|
||||||
|
"<. c #D1937F",
|
||||||
|
"1. c #948E8C",
|
||||||
|
"2. c #9D8C86",
|
||||||
|
"3. c #9D8F89",
|
||||||
|
"4. c #96908E",
|
||||||
|
"5. c #9C918D",
|
||||||
|
"6. c #949392",
|
||||||
|
"7. c #9B9492",
|
||||||
|
"8. c #9D9997",
|
||||||
|
"9. c #9D9C9C",
|
||||||
|
"0. c #A38B83",
|
||||||
|
"q. c #AA8D83",
|
||||||
|
"w. c #A4918B",
|
||||||
|
"e. c #AC9087",
|
||||||
|
"r. c #AB938C",
|
||||||
|
"t. c #A49590",
|
||||||
|
"y. c #A29996",
|
||||||
|
"u. c #A19D9C",
|
||||||
|
"i. c #AA9790",
|
||||||
|
"p. c #AC9994",
|
||||||
|
"a. c #AC9E99",
|
||||||
|
"s. c #B18D81",
|
||||||
|
"d. c #B59084",
|
||||||
|
"f. c #B49389",
|
||||||
|
"g. c #BA9184",
|
||||||
|
"h. c #B89589",
|
||||||
|
"j. c #BA988D",
|
||||||
|
"k. c #B29B93",
|
||||||
|
"l. c #BC9C92",
|
||||||
|
"z. c #ACA19D",
|
||||||
|
"x. c #B1A19D",
|
||||||
|
"c. c #BCA39B",
|
||||||
|
"v. c #A3A3A3",
|
||||||
|
"b. c #ABA5A3",
|
||||||
|
"n. c #AEA9A7",
|
||||||
|
"m. c #ABABAA",
|
||||||
|
"M. c #B3A5A1",
|
||||||
|
"N. c #B3A9A6",
|
||||||
|
"B. c #B3ADAA",
|
||||||
|
"V. c #B9A6A0",
|
||||||
|
"C. c #B9AAA5",
|
||||||
|
"Z. c #BAADA9",
|
||||||
|
"A. c #B4B0AF",
|
||||||
|
"S. c #BAB0AD",
|
||||||
|
"D. c #B4B3B3",
|
||||||
|
"F. c #BAB5B3",
|
||||||
|
"G. c #BDB8B6",
|
||||||
|
"H. c #BBBBBB",
|
||||||
|
"J. c #C39384",
|
||||||
|
"K. c #C0978A",
|
||||||
|
"L. c #C2998B",
|
||||||
|
"P. c #CA9483",
|
||||||
|
"I. c #CD9A8A",
|
||||||
|
"U. c #C19D92",
|
||||||
|
"Y. c #D69B89",
|
||||||
|
"T. c #DB9680",
|
||||||
|
"R. c #C2A095",
|
||||||
|
"E. c #C4A69C",
|
||||||
|
"W. c #CCA193",
|
||||||
|
"Q. c #C8A599",
|
||||||
|
"!. c #CBA99D",
|
||||||
|
"~. c #C6AEA6",
|
||||||
|
"^. c #CCACA2",
|
||||||
|
"/. c #CBB2AB",
|
||||||
|
"(. c #C3B8B5",
|
||||||
|
"). c #C2BDBC",
|
||||||
|
"_. c #C9B9B3",
|
||||||
|
"`. c #D3ADA0",
|
||||||
|
"'. c #D3B4A9",
|
||||||
|
"]. c #DCB2A4",
|
||||||
|
"[. c #DEB6A8",
|
||||||
|
"{. c #D1BFB9",
|
||||||
|
"}. c #D9BEB5",
|
||||||
|
"|. c #C5C0BE",
|
||||||
|
" X c #CDC0BC",
|
||||||
|
".X c #D2C1BB",
|
||||||
|
"XX c #DDC3BB",
|
||||||
|
"oX c #E0C5BC",
|
||||||
|
"OX c #E0C8BF",
|
||||||
|
"+X c #C2C2C2",
|
||||||
|
"@X c #CBC4C2",
|
||||||
|
"#X c #CDC8C6",
|
||||||
|
"$X c #CCCBCB",
|
||||||
|
"%X c #D2C6C2",
|
||||||
|
"&X c #D1CECD",
|
||||||
|
"*X c #DDC8C1",
|
||||||
|
"=X c #DECFCA",
|
||||||
|
"-X c #D9D1CE",
|
||||||
|
";X c #D3D3D3",
|
||||||
|
":X c #D9D5D4",
|
||||||
|
">X c #DED9D7",
|
||||||
|
",X c #DBDBDB",
|
||||||
|
"<X c #E1CAC3",
|
||||||
|
"1X c #E2CFC8",
|
||||||
|
"2X c #E1D3CE",
|
||||||
|
"3X c #E2D5D0",
|
||||||
|
"4X c #E5D8D3",
|
||||||
|
"5X c #E4DDDB",
|
||||||
|
"6X c #E8DBD6",
|
||||||
|
"7X c #EADEDA",
|
||||||
|
"8X c #E6E0DE",
|
||||||
|
"9X c #EBE0DC",
|
||||||
|
"0X c #E4E4E4",
|
||||||
|
"qX c #E8E2E0",
|
||||||
|
"wX c #EBEBEB",
|
||||||
|
"eX c #F0EAE8",
|
||||||
|
"rX c #F3F3F3",
|
||||||
|
"tX c #FEFEFE",
|
||||||
|
/* pixels */
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXrXrXtXrXrXrXrXrXrXrXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXrXtXrXrXrXwXwXrXwXrXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXrXrXrXwXwX0X0XqX0X0X0X0XwXwXwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXrXtXrXwXwX2X[.[.].].].].].1XwXrXwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXrXrXrXwX0X0XL.J b b b b b b b J '.0X0XwXwXrXrXrXrXrXrXrXrXrXrXtXrXrXrXtXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXtXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXrXrXwX0XXXt m b m B V N b b v >.;X0XwXwXwXwXrXwXwXrXrXrXrXtXrXtXrXrXrXwXrXrXrXrXrXrXrXrXrXrXrXwXrXrXwXrXrXrXtXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXrXrXrX0X,X'.S b b P l.z.M.k.w n b b g.;X,X,X,X0X0X0X0X0XwXwXwXwXwXwXwXwXwX0X0X0XwX0X0XwXwXwXwX0X0X0X0X0X0XwXwXwXwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXrXrXwX0X:XT.m b A ] G.D.D.m.$.m b b $.$X&X.X}.XX>XOX}.oXXX<X0X0XwXwXwX0X2XXXoXXXoXOX5X0XwX0X1XoXXX5X*X}.}.oX<XqXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXrXwX0X,XL.b b D M.H.D.D.D.D.m.L b b W H.Z.# b Y / m b b b Z P.:X:X:X$X:.Z b b b b n :.;X;X;XR b A &.Z b b b b *.wXwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXrXwX0X:X$.b b E B.H.H.D.D.D.D.P b b E H.V.. b U L v v n b b ( #X;X$X~.Y b m N m b b ! {.&X#XI b C R v v n b b ! 0XwXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXwX0X:X!.A b Z F.H.H.H.H.H.D.m.L b b e b.+.b b V k i.r.t n b b s.H.x v b L q.b.p.D b b t F.$.n b M l a.M.y b b A :X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXwX0X:XL.m b D H.).H.+XH.H.H.D.H b b 6 v.j b b - a.A.m.@.m b b h D.< b b w z.b.b.P b b q B.z b b @ B.D.m...v b G :X,XwXwXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXwX0X,X&X/ b b , D.H.+X+X+X+XH.f.B b b 5.8.M b M w.v.v.v.r.D b b h l v b b M V v b b q u.X b n @.v.m.v.j b b Q &X,X0XwXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXwX0X,X$X^ b b , H.H.+X+XH.H.H.s.N b n 7.7.v b B 8.v.v.v.w.M b b g r b b b n n n b b b b e y.O b n X.m.v.n.e b b u &X,X0XrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrX0X,X$X/ b b + F.H.H.H.+XH.d.b b M | 8.> c b @ 9.v.9.u., b b - 3.& b b 7 1.1.4.4.4.6.7.9.w.m b + t.v.m.p.D b b K.;X,X0XwXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXwX0X,X$X-.b b b i D.H.G.H.J.N b b = 9.9.5 c b B 7.9.v.y.b b m f 4.O b b 3 6.6.6.g 9 4 h u.h b b - b.m.m.s.b b N ~.;X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXwX0X,X;XE.G b b I z ] ] ] W n b H l 9.8.9 b b m e 6 r e b b # 0.y.< b b O 6 p 6 < # ; q.v.t b b 0 n.A.A.+.b b H _.;X,XwXwXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXwXwX,X;X#Xf.b b b b b b b b b - a.v.v.w.@ b b v b b b b b @ b.m.v.w.M b b b b b b v ..m.n.A b n g.H.H.H.4 b b [ &X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXwXwX0X:X$XZ.Q H v n b m B H E x n.m.m.q.B b v < . v N + E z m.m.m.b.e - M m v M - t k.D.m.; # - V.H.+XH.s # # K.:X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXwXwX,X,X$X+XG.Z.Z.B.C.S.F.H.H.H.D.D.j b b q v.b.a.n.B.H.H.+X+X+XH.H.D.Z.C.Z.Z.F.H.H.+X+XH.).H.$X&X&X;X$X#X#X:X,X0XwXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXrXwX0X,X;X#X+X+X+XH.H.+X+X+XH.H.H.D.e b n i n.m.D.H.H.+X#X$X$X+X+X+X+XH.H.H.H.+X+X+X$X&X&X&X$X;X;X;X:X;X:X,X,X0XwXwXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXrXrXwXwX,X,X;X;X$X$X$X;X;X&X;X$X#X+XF b v s.H.H.+X$X&X;X;X,X,X,X;X:X;X;X;X;X;X;X:X,X,X,X0X,X0X,X0X0X0X0X0X0X0XwXwXrXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXrXtXrXwXwX0X,X:X;X;X;X;X;X:X;X;X;X$X+XC b B k.+X+X$X$X;X,X,X0X0X0X0X0X;X,X,X,X,X,X,X,X,X0X0X0X0X0X0XwX0X0X0XwXwXrXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXrXrXrXrXwXwXwX0X0X0X0X0X0X0X,X,X:X^.^.!.$X$X;X,X,X0XwXwXwXwXwXwXwXwX0X0X0X0XwXwXwXwXwXwXrXrXwXrXrXrXrXrXrXrXrXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXrXrXrXrXwXwXwXwX0XwXwXwX0X0X,X:X;X$X&X&X;X,X,X0XwXwXwXrXrXrXrXrXwXwXwXwXwXwXwXrXrXrXwXrXrXrXrXrXrXrXrXrXrXtXrXtXtXrXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXrXrXrXrXrXrXrXrXrXwXwXwXwX0X,X0X0X0XwXwXrXrXrXrXrXrXrXrXrXrXrXrXrXrXwXrXrXrXrXrXtXrXrXrXtXrXrXrXrXrXrXrXrXrXtXtXtXrXrXtXtXtXtXrXrXtXrXrXtXrXtXrXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXrXtXtXrXtXrXrXrXrXrXrXwXwXwX0XwX0XwXwXwXrXrXrXtXtXrXrXrXrXrXrXrXrXwXrXwXrXwXwXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXrXtXrXrXtXtXrXrXrXrXrXrXrXrXrXrXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXwXrXrXrXrXrXrXtXrXtXrXrXrXrXrXwXwXwXwXwX0X0XwX0XwXwXwXwXwXwXwXrXwXwXwX0X0X0X0XwX0XwXwXrXrXrXwXrXwXwXwX0XwX0XwXwXwXrXrXrXrXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXrXrXrXrXtXtXrXrXtXrXrXeX7X7X9XwXwXwX5X3X3X3X2X2X2X5X0XwXwXwXwXwX8X3X3X2X2X2X2X2X3X6X6X7XwXwXwXwXwXwX7X1XXXOXOX1X8XwXwXrXrXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXtXtXrXrXrXwXT.T T :.,X,X-X` G G G G G G U _ J.-X,X,X,X[ G G G G G G G G G G _ >XwX0X,X&XI.R N b b b m ! `.5XwXrXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXtXtXrXtXrXrXrXwX0X' b b ] >X,X%XJ b b b b b b b b Q {.:X;X:Xq b b b b b b b b b b Y >X0X,X-X'.^ n b b b b b m *.1XwXwXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrX0X0X%XL b b L.@X+X-.b b M L L L D b b b M V.+X(.N b b D H H H H H U U W.;X&X^.H b b n W -.-.W n b b J &XwXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwXwX0X XF b b U.+X+X[ b b D z z j P v b b N U.H.S.m b m E Q t ^ ) / ) ) /.$X$X;.m b n A %.H.H.J.N b b N .XwXwXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwXwX,X:X!.m b L N.D.m.* b b y v.v.v.v.p.n b M f.m.w b b D u.v.m.m.D.G.H.H.+X).g.b b B j.F.D.D.D.D.l.; F I /.0XwXrXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwX,X:XU.n b E B.A.n.$ b b s v.9.v.v.r.n n M r.b.1 b b D u.v.m.m.D.D.H.H.).H.k b b # M.G.D.D.D.D.Z.t w u _.0XwXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwXwX,X;X$XJ b m h b.v.i.m b M a 5.5.2.p M b c < 8.2.+ b b M o o o o # % j G.H.g.m b A M.D.D.D.B.M.M.M.M.Z.(.:X0XwXrXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXrXwX,X,X&X(.n b M 0.v.v.s b b b b b n b b c b M u.v.g M b b b b b b b b b i G.D.0 b b 8 D.D.H.G.P n b b n b U :X,XwXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXwX0X,X;X$XV.n b M w.v.9.< b b b b b b b b c H r 9.v.a n b * < < w w Q Q g.D.B.: b b r D.D.D.m.C b b b b b ) ;X0XwXrXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrX6XP.=.K.;X#X+Xx n b D v.u.7.. b b M D . D & 2 q.b.b.v.v.< b b X 6.9.9.b.m.D.D.D.D.n.# b b f D.D.D.b.= 1 * N b n !.;X,XwXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXrXrXwX<X~ P x $X+XH.z b b - v.v.3.M b b < r r r k 0.a.m.m.m.v.# b b , 6.9.v.m.D.D.D.H.D.z.O b b s D.D.D.N.f l 9 v b M ~.;X,XwXrXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXrXwX0XY.n b e H.H.V.F b b p b.v.h v b v v.m.A.D.H.+X+X+XH.D.p.b b m p 9.v.m.D.D.H.H.H.D.N.- b b - m.A.D.A.m.a.B b b - (.:X0XwXrXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwXwX0XY.n b ; Z.C.$.A b v 0.m.m.l n b M m.D.D.H.+X#X+X+XH.H.r.b b m < d l l l $.;.J.V.H.B.w b b C @.s.a.k.#.j n b b : ).:X,XwXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwXwX0X'.N b b A B n b n z m.D.B.0 b b 9 H.H.+X$X;X:X;X$X$X+Xl b b b b b b b b b b b s.H.H.B.H b b b n Z Z b b V n b ] $X:X0XwXrXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwX0X,X.XR b b b b b A P d.D.D.C.H b b j H.$X$X;X:X,X,X;X;X+X/ b b b b b b b b b b b a.H.H.D.u G b b b b b B H : v m ;.$X,XwXwXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXwXwX,X:X Xg.j 5 y s.C.H.H.+X+X|.E.Q.Q. X;X;X,X0XwXwX0X0X,X;X/.U.j.h.g.f.h.j.U.U.U.!.$X$X+X+XH.Z.g.y 4 6 l x.D.A.l.~.#X,X0XwXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXwX0X:X$XG.k.e.f.B.H.H.+X$X$X$X#X$X$X;X;X,X0XwXwXwXwX0X0X;X$X+XH.D.D.D.F.H.+X+X#X&X$X;X$X$X+X+XA.r.X.e.a.H.H.H.+X+X;X,X0XwXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwX,X,X$X&X$X$X$X$X;X;X,X,X,X,X,X,X0XwXwXwXrXtXrXrXwXwX0X,X;X$X$X+X$X$X$X;X;X:X,X,X,X,X,X;X$X&X#X#X$X$X$X$X$X;X,X,X0XwXrXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXwXwX0X,X:X;X;X$X;X;X:X,X,X0X0X,X0X0X0XwXwXwXrXrXtXrXrXwXwX0X;X;X$X&X$X$X&X:X,X,X,X,X0X,X,X:X;X;X$X$X$X$X$X;X:X,X,X0XwXwXrXrXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXrXwXwXwX0X0X0X0X0X0XwXwXwXwXwXwXwXwXrXwXrXtXtXrXtXtXrXrXrXwX0X0X0X0X,X,X0X0X0X0XwXwXwXwXwXwX0X0X0X,X,X,X,X0X0XwXwXwXrXtXrXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXwXwX0X0X0X0X0XwXwXwXrXwXrXrXrXrXrXtXrXtXtXtXtXrXrXrXwXwXwX0X0X0X0X0X0X0XwXwXwXwXwXwXwXwXwX0X0X0X0XwXwXwXwXwXrXrXrXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXrXrXrXrXrXrXrXrXrXrXtXtXrXtXtXrXtXtXtXtXtXtXtXrXtXrXtXrXrXrXrXwXwXrXrXrXrXrXrXrXtXrXrXrXrXrXrXrXwXrXrXrXrXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXrXtXrXrXrXrXrXrXtXtXrXtXrXtXrXrXtXtXtXtXtXtXtXtXtXtXtXrXrXrXrXrXrXrXrXrXrXrXtXtXrXtXrXrXtXrXrXrXrXrXrXrXrXtXrXrXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX",
|
||||||
|
"tXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtXtX"
|
||||||
|
};
|
||||||
34
OPJViewer/source/readmeafter.txt
Normal file
34
OPJViewer/source/readmeafter.txt
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
This viewer is conceived to open and display information and image content of J2K, JP2,
|
||||||
|
and MJ2 files.
|
||||||
|
The viewer application interface is divided into three main panels:
|
||||||
|
- a browsing pane;
|
||||||
|
- a viewing pane;
|
||||||
|
- a log/peek pane.
|
||||||
|
|
||||||
|
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
||||||
|
|
||||||
|
filename
|
||||||
|
|
|
||||||
|
|_ #000: Marker/Box short name (Hex code)
|
||||||
|
| |
|
||||||
|
| |_ *** Marker/Box long name ***
|
||||||
|
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||||
|
| |_ Additional info, depending on the marker/box type
|
||||||
|
| |_ ...
|
||||||
|
|
|
||||||
|
|_ #001: Marker/Box short name (Hex code)
|
||||||
|
| |
|
||||||
|
| |_ ...
|
||||||
|
|
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
||||||
|
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
||||||
|
|
||||||
|
|
||||||
|
The log/peek pane is shared among two different subpanels:
|
||||||
|
|
||||||
|
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
||||||
|
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
||||||
|
|
||||||
11
OPJViewer/source/readmebefore.txt
Normal file
11
OPJViewer/source/readmebefore.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
What is OpenJPEG ?
|
||||||
|
==================
|
||||||
|
The OpenJPEG library is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, the new still-image compression standard from the Joint Photographic Experts Group (JPEG). In addition to the basic codec, various other features are under development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats, an indexing tool useful for the JPIP protocol, JPWL-tools for error-resilience, a Java-viewer for j2k-images, ...
|
||||||
|
|
||||||
|
Who can use the library ?
|
||||||
|
=========================
|
||||||
|
Anybody. As the OpenJPEG library is released under the BSD license, anybody can use or modify the library, even for commercial applications. The only restriction is to retain the copyright in the sources or the binaries documentation.
|
||||||
|
|
||||||
|
Who is developing the library ?
|
||||||
|
===============================
|
||||||
|
The library is developed by the Communications and Remote Sensing Lab (TELE), in the Universit<69> Catholique de Louvain (UCL). The JPWL module is developped and maintained by the Digital Signal Processing Lab (DSPLab) of the University of Perugia, Italy (UNIPG). As our purpose is to make OpenJPEG really useful for those interested in the image compression field, any feedback/advices are obviously welcome ! We will do our best to handle them quickly.
|
||||||
1454
OPJViewer/source/wxj2kparser.cpp
Normal file
1454
OPJViewer/source/wxj2kparser.cpp
Normal file
File diff suppressed because it is too large
Load Diff
981
OPJViewer/source/wxjp2parser.cpp
Normal file
981
OPJViewer/source/wxjp2parser.cpp
Normal file
@@ -0,0 +1,981 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include "OPJViewer.h"
|
||||||
|
|
||||||
|
/* defines */
|
||||||
|
#define SHORT_DESCR_LEN 32
|
||||||
|
#define LONG_DESCR_LEN 256
|
||||||
|
|
||||||
|
/* enumeration for file formats */
|
||||||
|
#define J2FILENUM 4
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
JP2_FILE,
|
||||||
|
J2K_FILE,
|
||||||
|
MJ2_FILE,
|
||||||
|
UNK_FILE
|
||||||
|
|
||||||
|
} j2filetype;
|
||||||
|
|
||||||
|
/* enumeration for the box types */
|
||||||
|
#define j22boxNUM 23
|
||||||
|
typedef enum {
|
||||||
|
|
||||||
|
FILE_BOX,
|
||||||
|
JP_BOX,
|
||||||
|
FTYP_BOX,
|
||||||
|
JP2H_BOX,
|
||||||
|
IHDR_BOX,
|
||||||
|
COLR_BOX,
|
||||||
|
JP2C_BOX,
|
||||||
|
JP2I_BOX,
|
||||||
|
XML_BOX,
|
||||||
|
UUID_BOX,
|
||||||
|
UINF_BOX,
|
||||||
|
MOOV_BOX,
|
||||||
|
MVHD_BOX,
|
||||||
|
TRAK_BOX,
|
||||||
|
TKHD_BOX,
|
||||||
|
MDIA_BOX,
|
||||||
|
MINF_BOX,
|
||||||
|
VMHD_BOX,
|
||||||
|
STBL_BOX,
|
||||||
|
STSD_BOX,
|
||||||
|
STSZ_BOX,
|
||||||
|
MJP2_BOX,
|
||||||
|
MDAT_BOX,
|
||||||
|
ANY_BOX,
|
||||||
|
UNK_BOX
|
||||||
|
|
||||||
|
} j22boxtype;
|
||||||
|
|
||||||
|
/* the box structure itself */
|
||||||
|
struct boxdef {
|
||||||
|
|
||||||
|
char value[5]; /* hexadecimal value/string*/
|
||||||
|
char name[SHORT_DESCR_LEN]; /* short description */
|
||||||
|
char descr[LONG_DESCR_LEN]; /* long description */
|
||||||
|
int sbox; /* is it a superbox? */
|
||||||
|
int req[J2FILENUM]; /* mandatory box */
|
||||||
|
j22boxtype ins; /* contained in box... */
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* jp2 family box signatures */
|
||||||
|
#define FILE_SIGN ""
|
||||||
|
#define JP_SIGN "jP\040\040"
|
||||||
|
#define FTYP_SIGN "ftyp"
|
||||||
|
#define JP2H_SIGN "jp2h"
|
||||||
|
#define IHDR_SIGN "ihdr"
|
||||||
|
#define COLR_SIGN "colr"
|
||||||
|
#define JP2C_SIGN "jp2c"
|
||||||
|
#define JP2I_SIGN "jp2i"
|
||||||
|
#define XML_SIGN "xml\040"
|
||||||
|
#define UUID_SIGN "uuid"
|
||||||
|
#define UINF_SIGN "uinf"
|
||||||
|
#define MOOV_SIGN "moov"
|
||||||
|
#define MVHD_SIGN "mvhd"
|
||||||
|
#define TRAK_SIGN "trak"
|
||||||
|
#define TKHD_SIGN "tkhd"
|
||||||
|
#define MDIA_SIGN "mdia"
|
||||||
|
#define MINF_SIGN "minf"
|
||||||
|
#define VMHD_SIGN "vmhd"
|
||||||
|
#define STBL_SIGN "stbl"
|
||||||
|
#define STSD_SIGN "stsd"
|
||||||
|
#define STSZ_SIGN "stsz"
|
||||||
|
#define MJP2_SIGN "mjp2"
|
||||||
|
#define MDAT_SIGN "mdat"
|
||||||
|
#define ANY_SIGN ""
|
||||||
|
#define UNK_SIGN ""
|
||||||
|
|
||||||
|
/* the possible boxes */
|
||||||
|
struct boxdef j22box[] =
|
||||||
|
{
|
||||||
|
/* sign */ {FILE_SIGN,
|
||||||
|
/* short */ "placeholder for nothing",
|
||||||
|
/* long */ "Nothing to say",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP_SIGN,
|
||||||
|
/* short */ "JPEG 2000 Signature box",
|
||||||
|
/* long */ "This box uniquely identifies the file as being part of the JPEG 2000 family of files",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {FTYP_SIGN,
|
||||||
|
/* short */ "File Type box",
|
||||||
|
/* long */ "This box specifies file type, version and compatibility information, including specifying if this file "
|
||||||
|
"is a conforming JP2 file or if it can be read by a conforming JP2 reader",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP2H_SIGN,
|
||||||
|
/* short */ "JP2 Header box",
|
||||||
|
/* long */ "This box contains a series of boxes that contain header-type information about the file",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {IHDR_SIGN,
|
||||||
|
/* short */ "Image Header box",
|
||||||
|
/* long */ "This box specifies the size of the image and other related fields",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ JP2H_BOX},
|
||||||
|
|
||||||
|
/* sign */ {COLR_SIGN,
|
||||||
|
/* short */ "Colour Specification box",
|
||||||
|
/* long */ "This box specifies the colourspace of the image",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ JP2H_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP2C_SIGN,
|
||||||
|
/* short */ "Contiguous Codestream box",
|
||||||
|
/* long */ "This box contains the codestream as defined by Annex A",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {JP2I_SIGN,
|
||||||
|
/* short */ "Intellectual Property box",
|
||||||
|
/* long */ "This box contains intellectual property information about the image",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {XML_SIGN,
|
||||||
|
/* short */ "XML box",
|
||||||
|
/* long */ "This box provides a tool by which vendors can add XML formatted information to a JP2 file",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {UUID_SIGN,
|
||||||
|
/* short */ "UUID box",
|
||||||
|
/* long */ "This box provides a tool by which vendors can add additional information to a file "
|
||||||
|
"without risking conflict with other vendors",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {UINF_SIGN,
|
||||||
|
/* short */ "UUID Info box",
|
||||||
|
/* long */ "This box provides a tool by which a vendor may provide access to additional information associated with a UUID",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MOOV_SIGN,
|
||||||
|
/* short */ "Movie box",
|
||||||
|
/* long */ "This box contains the media data. In video tracks, this box would contain JPEG2000 video frames",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MVHD_SIGN,
|
||||||
|
/* short */ "Movie Header box",
|
||||||
|
/* long */ "This box defines overall information which is media-independent, and relevant to the entire presentation "
|
||||||
|
"considered as a whole",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MOOV_BOX},
|
||||||
|
|
||||||
|
/* sign */ {TRAK_SIGN,
|
||||||
|
/* short */ "Track box",
|
||||||
|
/* long */ "This is a container box for a single track of a presentation. A presentation may consist of one or more tracks",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MOOV_BOX},
|
||||||
|
|
||||||
|
/* sign */ {TKHD_SIGN,
|
||||||
|
/* short */ "Track Header box",
|
||||||
|
/* long */ "This box specifies the characteristics of a single track. Exactly one Track Header Box is contained in a track",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ TRAK_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MDIA_SIGN,
|
||||||
|
/* short */ "Media box",
|
||||||
|
/* long */ "The media declaration container contains all the objects which declare information about the media data "
|
||||||
|
"within a track",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ TRAK_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MINF_SIGN,
|
||||||
|
/* short */ "Media Information box",
|
||||||
|
/* long */ "This box contains all the objects which declare characteristic information of the media in the track",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MDIA_BOX},
|
||||||
|
|
||||||
|
/* sign */ {VMHD_SIGN,
|
||||||
|
/* short */ "Video Media Header box",
|
||||||
|
/* long */ "The video media header contains general presentation information, independent of the coding, for video media",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {STBL_SIGN,
|
||||||
|
/* short */ "Sample Table box",
|
||||||
|
/* long */ "The sample table contains all the time and data indexing of the media samples in a track",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {STSD_SIGN,
|
||||||
|
/* short */ "STSD Sample Description box",
|
||||||
|
/* long */ "The sample description table gives detailed information about the coding type used, and any initialization "
|
||||||
|
"information needed for that coding",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {STSZ_SIGN,
|
||||||
|
/* short */ "Sample Size box",
|
||||||
|
/* long */ "This box contains the sample count and a table giving the size of each sample",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ STBL_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MJP2_SIGN,
|
||||||
|
/* short */ "MJP2 Sample Description box",
|
||||||
|
/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization "
|
||||||
|
"information needed for that coding",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ MINF_BOX},
|
||||||
|
|
||||||
|
/* sign */ {MDAT_SIGN,
|
||||||
|
/* short */ "Media Data box",
|
||||||
|
/* long */ "The meta-data for a presentation is stored in the single Movie Box which occurs at the top-level of a file",
|
||||||
|
/* sbox */ 1,
|
||||||
|
/* req */ {1, 1, 1},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {ANY_SIGN,
|
||||||
|
/* short */ "Any box",
|
||||||
|
/* long */ "All the existing boxes",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ FILE_BOX},
|
||||||
|
|
||||||
|
/* sign */ {UNK_SIGN,
|
||||||
|
/* short */ "Unknown Type box",
|
||||||
|
/* long */ "The signature is not recognised to be that of an existing box",
|
||||||
|
/* sbox */ 0,
|
||||||
|
/* req */ {0, 0, 0},
|
||||||
|
/* ins */ ANY_BOX}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* macro functions */
|
||||||
|
/* From little endian to big endian, 2 and 4 bytes */
|
||||||
|
#define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8)
|
||||||
|
#define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24)
|
||||||
|
#define BYTE_SWAP8(X) (((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
|
||||||
|
((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \
|
||||||
|
((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \
|
||||||
|
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56))
|
||||||
|
|
||||||
|
/* From codestream to int values */
|
||||||
|
#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \
|
||||||
|
((unsigned long int) (C)[(P) + 1] << 16) + \
|
||||||
|
((unsigned long int) (C)[(P) + 2] << 8) + \
|
||||||
|
((unsigned long int) (C)[(P) + 3] << 0))
|
||||||
|
|
||||||
|
#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \
|
||||||
|
((unsigned long int) (C)[(P) + 1] << 0))
|
||||||
|
|
||||||
|
#define OPJREAD_LONG(F,L,N) { \
|
||||||
|
if (F->Read(fourbytes, 4) < 4) { \
|
||||||
|
wxLogMessage(wxT("Problem reading " N " from the file (file ended?)")); \
|
||||||
|
return -1; \
|
||||||
|
}; \
|
||||||
|
L = STREAM_TO_UINT32(fourbytes, 0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
/* handling functions */
|
||||||
|
#define ITEM_PER_ROW 10
|
||||||
|
|
||||||
|
//#define indprint if (0) printf("%.*s", 2 * level + 9, indent), printf
|
||||||
|
char indent[] = " "
|
||||||
|
" "
|
||||||
|
" "
|
||||||
|
" ";
|
||||||
|
|
||||||
|
void indprint(wxString printout, int level)
|
||||||
|
{
|
||||||
|
wxLogMessage(/*wxString::Format(wxT("%.*s"), 2 * level + 9, indent) + */printout);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Box handler function */
|
||||||
|
int OPJParseThread::box_handler_function(int boxtype, wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
||||||
|
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint)
|
||||||
|
{
|
||||||
|
switch ((j22boxtype) boxtype) {
|
||||||
|
|
||||||
|
|
||||||
|
/* JPEG 2000 Signature box */
|
||||||
|
case (JP_BOX): {
|
||||||
|
|
||||||
|
unsigned long int checkdata = 0;
|
||||||
|
fileid->Read(&checkdata, sizeof(unsigned long int));
|
||||||
|
checkdata = BYTE_SWAP4(checkdata);
|
||||||
|
|
||||||
|
// add info
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Check data: %X -> %s"), checkdata, (checkdata == 0x0D0A870A) ? wxT("OK") : wxT("KO")),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
/* JPEG 2000 codestream box */
|
||||||
|
case (JP2C_BOX): {
|
||||||
|
|
||||||
|
// add info
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString(wxT("Codestream")),
|
||||||
|
m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO-CSTREAM"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
|
||||||
|
m_tree->SetItemHasChildren(currid);
|
||||||
|
|
||||||
|
// parse the file
|
||||||
|
//ParseJ2KFile(fileid, filepoint, filelimit, currid);
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* File Type box */
|
||||||
|
case (FTYP_BOX): {
|
||||||
|
|
||||||
|
char BR[4], CL[4];
|
||||||
|
unsigned long int MinV, numCL, i;
|
||||||
|
fileid->Read(BR, sizeof(char) * 4);
|
||||||
|
fileid->Read(&MinV, sizeof(unsigned long int));
|
||||||
|
MinV = BYTE_SWAP4(MinV);
|
||||||
|
numCL = (filelimit - fileid->Tell()) / 4;
|
||||||
|
|
||||||
|
// add info
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxT("Brand/Minor version: ") +
|
||||||
|
wxString::FromAscii(BR).Truncate(4) +
|
||||||
|
wxString::Format(wxT("/%d"), MinV),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Compatibility list")),
|
||||||
|
m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
for (i = 0; i < numCL; i++) {
|
||||||
|
fileid->Read(CL, sizeof(char) * 4);
|
||||||
|
m_tree->AppendItem(currid,
|
||||||
|
wxString::FromAscii(CL).Truncate(4),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* JP2 Header box */
|
||||||
|
case (IHDR_BOX): {
|
||||||
|
|
||||||
|
unsigned long int height, width;
|
||||||
|
unsigned short int nc;
|
||||||
|
unsigned char bpc, C, UnkC, IPR;
|
||||||
|
fileid->Read(&height, sizeof(unsigned long int));
|
||||||
|
height = BYTE_SWAP4(height);
|
||||||
|
fileid->Read(&width, sizeof(unsigned long int));
|
||||||
|
width = BYTE_SWAP4(width);
|
||||||
|
fileid->Read(&nc, sizeof(unsigned short int));
|
||||||
|
nc = BYTE_SWAP2(nc);
|
||||||
|
fileid->Read(&bpc, sizeof(unsigned char));
|
||||||
|
fileid->Read(&C, sizeof(unsigned char));
|
||||||
|
fileid->Read(&UnkC, sizeof(unsigned char));
|
||||||
|
fileid->Read(&IPR, sizeof(unsigned char));
|
||||||
|
|
||||||
|
// add info
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Dimensions: %d x %d x %d @ %d bpc"), width, height, nc, bpc + 1),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Compression type: %d"), C),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Colourspace unknown: %d"), UnkC),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Intellectual Property Rights: %d"), IPR),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Colour Specification box */
|
||||||
|
case (COLR_BOX): {
|
||||||
|
|
||||||
|
unsigned char METH, PREC, APPROX;
|
||||||
|
char methdescr[80], enumcsdescr[80];
|
||||||
|
unsigned long int EnumCS;
|
||||||
|
fileid->Read(&METH, sizeof(unsigned char));
|
||||||
|
switch (METH) {
|
||||||
|
case 1:
|
||||||
|
strcpy(methdescr, "Enumerated Colourspace");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(methdescr, "Restricted ICC profile");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(methdescr, "Unknown");
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
fileid->Read(&PREC, sizeof(unsigned char));
|
||||||
|
fileid->Read(&APPROX, sizeof(unsigned char));
|
||||||
|
if (METH != 2) {
|
||||||
|
fileid->Read(&EnumCS, sizeof(unsigned long int));
|
||||||
|
EnumCS = BYTE_SWAP4(EnumCS);
|
||||||
|
switch (EnumCS) {
|
||||||
|
case 16:
|
||||||
|
strcpy(enumcsdescr, "sRGB");
|
||||||
|
break;
|
||||||
|
case 17:
|
||||||
|
strcpy(enumcsdescr, "greyscale");
|
||||||
|
break;
|
||||||
|
case 18:
|
||||||
|
strcpy(enumcsdescr, "sYCC");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(enumcsdescr, "Unknown");
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// add info
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Specification method: %d ("), METH) +
|
||||||
|
wxString::FromAscii(methdescr) +
|
||||||
|
wxT(")"),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Precedence: %d"), PREC),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Colourspace approximation: %d"), APPROX),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (METH != 2)
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Enumerated colourspace: %d ("), EnumCS) +
|
||||||
|
wxString::FromAscii(enumcsdescr) +
|
||||||
|
wxT(")"),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (METH != 1)
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("ICC profile: there is one")),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Movie Header Box */
|
||||||
|
case (MVHD_BOX): {
|
||||||
|
|
||||||
|
unsigned long int version, rate, matrix[9], next_track_ID;
|
||||||
|
unsigned short int volume;
|
||||||
|
fileid->Read(&version, sizeof(unsigned long int));
|
||||||
|
version = BYTE_SWAP4(version);
|
||||||
|
if (version == 0) {
|
||||||
|
unsigned long int creation_time, modification_time, timescale, duration;
|
||||||
|
fileid->Read(&creation_time, sizeof(unsigned long int));
|
||||||
|
creation_time = BYTE_SWAP4(creation_time);
|
||||||
|
fileid->Read(&modification_time, sizeof(unsigned long int));
|
||||||
|
modification_time = BYTE_SWAP4(modification_time);
|
||||||
|
fileid->Read(×cale, sizeof(unsigned long int));
|
||||||
|
timescale = BYTE_SWAP4(timescale);
|
||||||
|
fileid->Read(&duration, sizeof(unsigned long int));
|
||||||
|
duration = BYTE_SWAP4(duration);
|
||||||
|
const long unix_time = creation_time - 2082844800L;
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Creation time: %u (%.24s)"), creation_time, ctime(&unix_time)),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
const long unix_time1 = modification_time - 2082844800L;
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Modification time: %u (%.24s)"), modification_time, ctime(&unix_time1)),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Timescale: %u (%.6fs)"), timescale, 1.0 / (float) timescale),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Duration: %u (%.3fs)"), duration, (float) duration / (float) timescale),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
int8byte creation_time, modification_time, duration;
|
||||||
|
unsigned long int timescale;
|
||||||
|
fileid->Read(&creation_time, sizeof(int8byte));
|
||||||
|
creation_time = BYTE_SWAP8(creation_time);
|
||||||
|
fileid->Read(&modification_time, sizeof(int8byte));
|
||||||
|
modification_time = BYTE_SWAP8(modification_time);
|
||||||
|
fileid->Read(×cale, sizeof(unsigned long int));
|
||||||
|
timescale = BYTE_SWAP4(timescale);
|
||||||
|
fileid->Read(&duration, sizeof(int8byte));
|
||||||
|
duration = BYTE_SWAP8(duration);
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Creation time: %u"), creation_time),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Modification time: %u"), modification_time),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Timescale: %u"), timescale),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Duration: %u"), duration),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
fileid->Read(&rate, sizeof(unsigned long int));
|
||||||
|
rate = BYTE_SWAP4(rate);
|
||||||
|
fileid->Read(&volume, sizeof(unsigned short int));
|
||||||
|
volume = BYTE_SWAP2(volume);
|
||||||
|
fileid->Seek(6, wxFromCurrent);
|
||||||
|
fileid->Read(&matrix, sizeof(unsigned char) * 9);
|
||||||
|
fileid->Seek(4, wxFromCurrent);
|
||||||
|
fileid->Read(&next_track_ID, sizeof(unsigned long int));
|
||||||
|
next_track_ID = BYTE_SWAP4(next_track_ID);
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Rate: %d (%d.%d)"), rate, rate >> 16, rate & 0x0000FFFF),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Volume: %d (%d.%d)"), volume, volume >> 8, volume & 0x00FF),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Next track ID: %d"), next_track_ID),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
/* Sample Description box */
|
||||||
|
case (STSD_BOX): {
|
||||||
|
|
||||||
|
unsigned long int version, entry_count;
|
||||||
|
fileid->Read(&version, sizeof(unsigned long int));
|
||||||
|
version = BYTE_SWAP4(version);
|
||||||
|
fileid->Read(&entry_count, sizeof(unsigned long int));
|
||||||
|
entry_count = BYTE_SWAP4(entry_count);
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Entry count: %d"), entry_count),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
jpeg2000parse(fileid, filepoint + 8, filelimit, parentid, level + 1, scansign, scanpoint);
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
/* Sample Size box */
|
||||||
|
case (STSZ_BOX): {
|
||||||
|
|
||||||
|
unsigned long int version, sample_size, sample_count, entry_size;
|
||||||
|
|
||||||
|
fileid->Read(&version, sizeof(unsigned long int));
|
||||||
|
version = BYTE_SWAP4(version);
|
||||||
|
|
||||||
|
fileid->Read(&sample_size, sizeof(unsigned long int));
|
||||||
|
sample_size = BYTE_SWAP4(sample_size);
|
||||||
|
|
||||||
|
if (sample_size == 0) {
|
||||||
|
fileid->Read(&sample_count, sizeof(unsigned long int));
|
||||||
|
sample_count = BYTE_SWAP4(sample_count);
|
||||||
|
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Sample count: %d"), sample_count),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxT("Entries size (bytes)"),
|
||||||
|
m_tree->TreeCtrlIcon_Folder, m_tree->TreeCtrlIcon_Folder + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
|
||||||
|
wxString text;
|
||||||
|
for (unsigned int s = 0; s < sample_count; s++) {
|
||||||
|
fileid->Read(&entry_size, sizeof(unsigned long int));
|
||||||
|
entry_size = BYTE_SWAP4(entry_size);
|
||||||
|
|
||||||
|
text << wxString::Format(wxT("%d, "), entry_size);
|
||||||
|
|
||||||
|
if (((s % 10) == (ITEM_PER_ROW - 1)) || (s == (sample_count - 1))) {
|
||||||
|
m_tree->AppendItem(currid,
|
||||||
|
text,
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
text = wxT("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
/* Video Media Header box */
|
||||||
|
case (VMHD_BOX): {
|
||||||
|
|
||||||
|
unsigned long int version;
|
||||||
|
unsigned short int graphicsmode, opcolor[3];
|
||||||
|
char graphicsdescr[100];
|
||||||
|
|
||||||
|
fileid->Read(&version, sizeof(unsigned long int));
|
||||||
|
version = BYTE_SWAP4(version);
|
||||||
|
|
||||||
|
fileid->Read(&graphicsmode, sizeof(unsigned short int));
|
||||||
|
graphicsmode = BYTE_SWAP2(graphicsmode);
|
||||||
|
switch (graphicsmode) {
|
||||||
|
case (0x00):
|
||||||
|
strcpy(graphicsdescr, "copy");
|
||||||
|
break;
|
||||||
|
case (0x24):
|
||||||
|
strcpy(graphicsdescr, "transparent");
|
||||||
|
break;
|
||||||
|
case (0x0100):
|
||||||
|
strcpy(graphicsdescr, "alpha");
|
||||||
|
break;
|
||||||
|
case (0x0101):
|
||||||
|
strcpy(graphicsdescr, "whitealpha");
|
||||||
|
break;
|
||||||
|
case (0x0102):
|
||||||
|
strcpy(graphicsdescr, "blackalpha");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(graphicsdescr, "unknown");
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
fileid->Read(opcolor, 3 * sizeof(unsigned short int));
|
||||||
|
opcolor[0] = BYTE_SWAP2(opcolor[0]);
|
||||||
|
opcolor[1] = BYTE_SWAP2(opcolor[1]);
|
||||||
|
opcolor[2] = BYTE_SWAP2(opcolor[2]);
|
||||||
|
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Composition mode: %d (")) +
|
||||||
|
wxString::FromAscii(graphicsdescr) +
|
||||||
|
wxT(")"),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("OP color: %d %d %d"), opcolor[0], opcolor[1], opcolor[2]),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* MJP2 Sample Description box */
|
||||||
|
case (MJP2_BOX): {
|
||||||
|
|
||||||
|
unsigned short int height, width, depth;
|
||||||
|
unsigned long int horizresolution, vertresolution;
|
||||||
|
char compressor_name[32];
|
||||||
|
fileid->Seek(24, wxFromCurrent);
|
||||||
|
fileid->Read(&width, sizeof(unsigned short int));
|
||||||
|
width = BYTE_SWAP2(width);
|
||||||
|
fileid->Read(&height, sizeof(unsigned short int));
|
||||||
|
height = BYTE_SWAP2(height);
|
||||||
|
fileid->Read(&horizresolution, sizeof(unsigned long int));
|
||||||
|
horizresolution = BYTE_SWAP4(horizresolution);
|
||||||
|
fileid->Read(&vertresolution, sizeof(unsigned long int));
|
||||||
|
vertresolution = BYTE_SWAP4(vertresolution);
|
||||||
|
fileid->Seek(6, wxFromCurrent);
|
||||||
|
fileid->Read(compressor_name, sizeof(char) * 32);
|
||||||
|
fileid->Read(&depth, sizeof(unsigned short int));
|
||||||
|
depth = BYTE_SWAP2(depth);
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Dimensions: %d x %d @ %d bpp"), width, height, depth),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"), m_tree->m_fname.GetFullPath(), filepoint, filelimit)
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Resolution: %d.%d x %d.%d"), horizresolution >> 16, horizresolution & 0x0000FFFF,
|
||||||
|
vertresolution >> 16, vertresolution & 0x0000FFFF),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("Compressor: %.32s"), compressor_name),
|
||||||
|
m_tree->TreeCtrlIcon_File, m_tree->TreeCtrlIcon_File + 1,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
jpeg2000parse(fileid, filepoint + 78, filelimit, parentid, level + 1, scansign, scanpoint);
|
||||||
|
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
/* not yet implemented */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void OPJParseThread::ParseJP2File(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit, wxTreeItemId parentid)
|
||||||
|
{
|
||||||
|
unsigned long int scanpoint;
|
||||||
|
|
||||||
|
jpeg2000parse(fileid, filepoint, filelimit, parentid, 0, NULL, &scanpoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the parsing function itself */
|
||||||
|
/*
|
||||||
|
fileid = fid of the file to scan (you should open it by yourself)
|
||||||
|
filepoint = first byte where to start to scan from (usually 0)
|
||||||
|
filelimit = first byte where to stop to scan from (usually the file size)
|
||||||
|
level = set this to 0
|
||||||
|
scansign = signature to scan for (NULL avoids search, returns " " if successful)
|
||||||
|
scanpoint = point where the scan signature lies
|
||||||
|
*/
|
||||||
|
int OPJParseThread::jpeg2000parse(wxFile *fileid, wxFileOffset filepoint, wxFileOffset filelimit,
|
||||||
|
wxTreeItemId parentid, int level, char *scansign, unsigned long int *scanpoint)
|
||||||
|
{
|
||||||
|
unsigned long int LBox = 0x00000000;
|
||||||
|
//int LBox_read;
|
||||||
|
char TBox[5] = "\0\0\0\0";
|
||||||
|
//int TBox_read;
|
||||||
|
int8byte XLBox = 0x0000000000000000;
|
||||||
|
//int XLBox_read;
|
||||||
|
unsigned long int box_length = 0;
|
||||||
|
int last_box = 0, box_num = 0;
|
||||||
|
int box_type = ANY_BOX;
|
||||||
|
unsigned char /*onebyte[1], twobytes[2],*/ fourbytes[4];
|
||||||
|
|
||||||
|
/* cycle all over the file */
|
||||||
|
box_num = 0;
|
||||||
|
last_box = 0;
|
||||||
|
while (!last_box) {
|
||||||
|
|
||||||
|
/* do not exceed file limit */
|
||||||
|
if (filepoint >= filelimit)
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
/* seek on file */
|
||||||
|
if (fileid->Seek(filepoint, wxFromStart) == wxInvalidOffset)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
/* read the mandatory LBox, 4 bytes */
|
||||||
|
if (fileid->Read(fourbytes, 4) < 4) {
|
||||||
|
WriteText(wxT("Problem reading LBox from the file (file ended?)"));
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
LBox = STREAM_TO_UINT32(fourbytes, 0);
|
||||||
|
|
||||||
|
/* read the mandatory TBox, 4 bytes */
|
||||||
|
if (fileid->Read(TBox, 4) < 4) {
|
||||||
|
WriteText(wxT("Problem reading TBox from the file (file ended?)"));
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* look if scansign is got */
|
||||||
|
if ((scansign != NULL) && (memcmp(TBox, scansign, 4) == 0)) {
|
||||||
|
memcpy(scansign, " ", 4);
|
||||||
|
*scanpoint = filepoint;
|
||||||
|
|
||||||
|
/* hack/exploit */
|
||||||
|
// stop as soon as you find the codebox
|
||||||
|
return (0);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* determine the box type */
|
||||||
|
for (box_type = JP_BOX; box_type < UNK_BOX; box_type++)
|
||||||
|
if (memcmp(TBox, j22box[box_type].value, 4) == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* read the optional XLBox, 8 bytes */
|
||||||
|
if (LBox == 1) {
|
||||||
|
|
||||||
|
if (fileid->Read(&XLBox, 8) < 8) {
|
||||||
|
WriteText(wxT("Problem reading XLBox from the file (file ended?)"));
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
box_length = (unsigned long int) BYTE_SWAP8(XLBox);
|
||||||
|
|
||||||
|
} else if (LBox == 0x00000000) {
|
||||||
|
|
||||||
|
/* last box in file */
|
||||||
|
last_box = 1;
|
||||||
|
box_length = filelimit - filepoint;
|
||||||
|
|
||||||
|
} else
|
||||||
|
|
||||||
|
box_length = LBox;
|
||||||
|
|
||||||
|
/* show box info */
|
||||||
|
|
||||||
|
// append the marker
|
||||||
|
int image, imageSel;
|
||||||
|
image = m_tree->TreeCtrlIcon_Folder;
|
||||||
|
imageSel = image + 1;
|
||||||
|
wxTreeItemId currid = m_tree->AppendItem(parentid,
|
||||||
|
wxString::Format(wxT("%03d: "), box_num) +
|
||||||
|
wxString::FromAscii(TBox) +
|
||||||
|
wxString::Format(wxT(" (0x%04X)"),
|
||||||
|
((unsigned long int) TBox[3]) + ((unsigned long int) TBox[2] << 8) +
|
||||||
|
((unsigned long int) TBox[1] << 16) + ((unsigned long int) TBox[0] << 24)
|
||||||
|
),
|
||||||
|
image, imageSel,
|
||||||
|
new OPJMarkerData(wxT("BOX"), m_tree->m_fname.GetFullPath(), filepoint, filepoint + box_length)
|
||||||
|
);
|
||||||
|
|
||||||
|
// append some info
|
||||||
|
image = m_tree->TreeCtrlIcon_File;
|
||||||
|
imageSel = image + 1;
|
||||||
|
|
||||||
|
// box name
|
||||||
|
wxTreeItemId subcurrid1 = m_tree->AppendItem(currid,
|
||||||
|
wxT("*** ") + wxString::FromAscii(j22box[box_type].name) + wxT(" ***"),
|
||||||
|
image, imageSel,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
m_tree->SetItemFont(subcurrid1, *wxITALIC_FONT);
|
||||||
|
|
||||||
|
// position and length
|
||||||
|
wxTreeItemId subcurrid2 = m_tree->AppendItem(currid,
|
||||||
|
wxLongLong(filepoint).ToString() + wxT(" > ") + wxLongLong(filepoint + box_length - 1).ToString() +
|
||||||
|
wxT(", ") + wxString::Format(wxT("%d + 8 (%d)"), box_length, box_length + 8),
|
||||||
|
image, imageSel,
|
||||||
|
new OPJMarkerData(wxT("INFO"))
|
||||||
|
);
|
||||||
|
|
||||||
|
/* go deep in the box */
|
||||||
|
box_handler_function((int) box_type, fileid, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length,
|
||||||
|
currid, level, scansign, scanpoint);
|
||||||
|
|
||||||
|
/* if it's a superbox go inside it */
|
||||||
|
if (j22box[box_type].sbox)
|
||||||
|
jpeg2000parse(fileid, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length,
|
||||||
|
currid, level + 1, scansign, scanpoint);
|
||||||
|
|
||||||
|
/* increment box number and filepoint*/
|
||||||
|
box_num++;
|
||||||
|
filepoint += box_length;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/* all good */
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
109
OpenJPEG.rc
Normal file
109
OpenJPEG.rc
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
//Microsoft Developer Studio generated resource script.
|
||||||
|
//
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
|
#define APSTUDIO_READONLY_SYMBOLS
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 2 resource.
|
||||||
|
//
|
||||||
|
#include "afxres.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#undef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// French (France) resources
|
||||||
|
|
||||||
|
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
|
||||||
|
#ifdef _WIN32
|
||||||
|
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
|
||||||
|
#pragma code_page(1252)
|
||||||
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#ifndef _MAC
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Version
|
||||||
|
//
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 1,1,0,0
|
||||||
|
PRODUCTVERSION 1,1,0,0
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x2L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "000004b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Comments", "The OpenJPEG library is an open-source JPEG 2000 codec. \0"
|
||||||
|
VALUE "CompanyName", "OpenJPEG\0"
|
||||||
|
VALUE "FileDescription", "OpenJPEG\0"
|
||||||
|
VALUE "FileVersion", "1, 1, 0, 0\0"
|
||||||
|
VALUE "InternalName", "OpenJPEG\0"
|
||||||
|
VALUE "LegalCopyright", "Copyright <20> 2002-2006, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium\0"
|
||||||
|
VALUE "LegalTrademarks", "See http://www.openjpeg.org for details\0"
|
||||||
|
VALUE "OriginalFilename", "OpenJPEG.dll\0"
|
||||||
|
VALUE "PrivateBuild", "\0"
|
||||||
|
VALUE "ProductName", "OpenJPEG\0"
|
||||||
|
VALUE "ProductVersion", "1, 1, 0, 0\0"
|
||||||
|
VALUE "SpecialBuild", "\0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // !_MAC
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// TEXTINCLUDE
|
||||||
|
//
|
||||||
|
|
||||||
|
1 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"resource.h\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
2 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"#include ""afxres.h""\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
3 TEXTINCLUDE DISCARDABLE
|
||||||
|
BEGIN
|
||||||
|
"\r\n"
|
||||||
|
"\0"
|
||||||
|
END
|
||||||
|
|
||||||
|
#endif // APSTUDIO_INVOKED
|
||||||
|
|
||||||
|
#endif // French (France) resources
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef APSTUDIO_INVOKED
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Generated from the TEXTINCLUDE 3 resource.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
#endif // not APSTUDIO_INVOKED
|
||||||
|
|
||||||
9
README.cmake
Normal file
9
README.cmake
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Basic instructions on how to build using CMake (CMake 2.4.5 or newer is required)
|
||||||
|
|
||||||
|
svn co http://www.openjpeg.org/svn/trunk
|
||||||
|
cd trunk
|
||||||
|
mkdir bin
|
||||||
|
cd bin
|
||||||
|
cmake .. -DBUILD_EXAMPLES:BOOL=ON
|
||||||
|
make
|
||||||
|
./codec/j2k_to_image
|
||||||
33
README.linux
Normal file
33
README.linux
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
Release Notes
|
||||||
|
--------------
|
||||||
|
This version of the library has been tested under the following OS:
|
||||||
|
- RedHat Linux 9.0
|
||||||
|
|
||||||
|
You should be able to link progams with the -lopenjpeg option after the library is compiled and installed.
|
||||||
|
You can also statically link with libopenjpeg.a.
|
||||||
|
If you use a really old version of gcc and it chokes on the CRs in the file, you can type 'make dos2unix'
|
||||||
|
to run all of the files through dos2unix which converts CRLF to LF. This no longer appears to be required
|
||||||
|
for RedHat 7.3 or 9.
|
||||||
|
|
||||||
|
Please let us know how this works for you under other Linux distributions or any other *nix.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
Note: You will need to have root privileges in order to install the library in
|
||||||
|
/usr/include and /usr/lib directories.
|
||||||
|
The installation process is as simple as this :
|
||||||
|
1) Enter the OpenJPEG directory
|
||||||
|
2) Build the distribution :
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
3) Clean all files produced during the build process
|
||||||
|
make clean
|
||||||
|
|
||||||
|
Simple codec compilation
|
||||||
|
------------------------
|
||||||
|
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following commands to build an encoder and decoder respectively:
|
||||||
|
|
||||||
|
gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
|
||||||
|
You should add '-L..' to those lines if you did not use the 'install' target (and the 'clean' target neither...).
|
||||||
40
README.msvc
Normal file
40
README.msvc
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
How to compile the library under MS VC++ 6.0
|
||||||
|
--------------------------------------------
|
||||||
|
|
||||||
|
The library comes in two versions :
|
||||||
|
- a static library that can be linked against any C/C++ program
|
||||||
|
- a Dynamic Link Library (Windows DLL) that can be used in any C/C++ program and in most interpreted languages (e.g. VB, C#, ...).
|
||||||
|
|
||||||
|
In order to compile the library version *or* the DLL version, you will have to :
|
||||||
|
|
||||||
|
1) Open the MSVC workspace named LibOpenJPEG.dsw
|
||||||
|
2) Set the choosen target as the active project, that means :
|
||||||
|
a) Go to the Menu 'Build -> Set Active Configuration'
|
||||||
|
b) Choose one of the following configuration :
|
||||||
|
- DllOpenJPEG - Win32 Release => creates a DLL in release mode named OpenJPEG.dll
|
||||||
|
- DllOpenJPEG - Win32 Debug => creates a DLL in debug mode named OpenJPEGd.dll
|
||||||
|
- LibOpenJPEG - Win32 Release => creates a static library in release mode named LibOpenJPEG.lib
|
||||||
|
- LibOpenJPEG - Win32 Debug => creates a static library in debug mode named LibOpenJPEGd.lib
|
||||||
|
3) Build the project : Menu -> Build -> Rebuild All
|
||||||
|
|
||||||
|
The build process will create a directory named 'dist' that will contain all you need in order to use the library.
|
||||||
|
|
||||||
|
Simple codec compilation
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following projects to build an encoder and decoder respectively:
|
||||||
|
- image_to_j2k.dsw
|
||||||
|
- j2k_to_image.dsw
|
||||||
|
|
||||||
|
IMPORTANT NOTE :
|
||||||
|
----------------
|
||||||
|
|
||||||
|
The encoder and decoder samples are configured to use the static version of the library. A link to the LibOpenJPEG static project is included in these projects so that you can build both a codec and the library in a single pass.
|
||||||
|
|
||||||
|
However, you MUST NOTE that in order to use LibOpenJPEG as a static library in your program, you NEED to add the following compiler directive to your project : OPJ_STATIC
|
||||||
|
Look at the menu 'Project -> Settings -> C/C++ tab -> preprocessor definition' to see how this is configured.
|
||||||
|
When using OpenJPEG as a DLL, this compiler directive MUST NOT be used.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
26
README.osx
Normal file
26
README.osx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
Release Notes
|
||||||
|
--------------
|
||||||
|
This version of the library has been tested under OSX 10.3 using gcc 3.3.
|
||||||
|
|
||||||
|
While the makefiles will make a .dylib and a .a, it is recommended to simply staticly link with the .a file.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
Note: You will need to have root privileges in order to install the library in
|
||||||
|
/usr/include and /usr/lib directories.
|
||||||
|
The installation process is as simple as this :
|
||||||
|
1) Enter the OpenJPEG directory
|
||||||
|
2) Build the distribution :
|
||||||
|
make osx
|
||||||
|
make osxinstall
|
||||||
|
3) Clean all files produced during the build process
|
||||||
|
make osxclean
|
||||||
|
|
||||||
|
Simple codec compilation
|
||||||
|
------------------------
|
||||||
|
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following commands to build an encoder and decoder respectively:
|
||||||
|
|
||||||
|
gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
|
||||||
|
You should add '-L..' and to those lines if you did not use the 'install' target (and the 'clean' target neither...).
|
||||||
25
clean.bat
Normal file
25
clean.bat
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
rd Release /s /q
|
||||||
|
rd Debug /s /q
|
||||||
|
rd codec\Debug /s /q
|
||||||
|
rd codec\Release /s /q
|
||||||
|
rd dist /s /q
|
||||||
|
del *.pch /s /q
|
||||||
|
del *.ncb /s /q
|
||||||
|
del *.opt /s /q
|
||||||
|
del *.plg /s /q
|
||||||
|
del *.obj /s /q
|
||||||
|
del *.dll /s /q
|
||||||
|
del *.exe /s /q
|
||||||
|
del *.bsc /s /q
|
||||||
|
del *.bak /s /q
|
||||||
|
del *.pdb /s /q
|
||||||
|
del *.sql /s /q
|
||||||
|
del *.mdb /s /q
|
||||||
|
del *.lib /s /q
|
||||||
|
del *.exp /s /q
|
||||||
|
del *.ilk /s /q
|
||||||
|
del *.idb /s /q
|
||||||
|
del *.aps /s /q
|
||||||
|
del *.suo /s /q /a:h
|
||||||
|
del *.o /s /q
|
||||||
|
|
||||||
53
codec/CMakeLists.txt
Normal file
53
codec/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Build the demo app, small examples
|
||||||
|
|
||||||
|
# First thing define the common source:
|
||||||
|
SET(common_SRCS
|
||||||
|
convert.c
|
||||||
|
)
|
||||||
|
# Then check if getopt is present:
|
||||||
|
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||||
|
SET(DONT_HAVE_GETOPT 1)
|
||||||
|
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
||||||
|
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
||||||
|
# Seems like we need the contrary:
|
||||||
|
IF(CMAKE_HAVE_GETOPT_H)
|
||||||
|
SET(DONT_HAVE_GETOPT 0)
|
||||||
|
ENDIF(CMAKE_HAVE_GETOPT_H)
|
||||||
|
ENDIF(UNIX)
|
||||||
|
|
||||||
|
# If not getopt was found then add it to the lib:
|
||||||
|
IF(DONT_HAVE_GETOPT)
|
||||||
|
ADD_DEFINITIONS(-DDONT_HAVE_GETOPT)
|
||||||
|
SET(common_SRCS
|
||||||
|
${common_SRCS}
|
||||||
|
compat/getopt.c
|
||||||
|
)
|
||||||
|
ENDIF(DONT_HAVE_GETOPT)
|
||||||
|
|
||||||
|
|
||||||
|
# Headers file are located here:
|
||||||
|
INCLUDE_DIRECTORIES(
|
||||||
|
${OPENJPEG_SOURCE_DIR}/libopenjpeg
|
||||||
|
)
|
||||||
|
|
||||||
|
# Do the proper thing when building static...if only there was configured
|
||||||
|
# headers or def files instead
|
||||||
|
IF(NOT BUILD_SHARED_LIBS)
|
||||||
|
ADD_DEFINITIONS(-DOPJ_STATIC)
|
||||||
|
ENDIF(NOT BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
|
FIND_PACKAGE(TIFF REQUIRED)
|
||||||
|
|
||||||
|
# Loop over all executables:
|
||||||
|
FOREACH(exe j2k_to_image image_to_j2k)
|
||||||
|
ADD_EXECUTABLE(${exe} ${exe}.c ${common_SRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} ${OPJ_PREFIX}openjpeg ${TIFF_LIBRARIES})
|
||||||
|
# On unix you need to link to the math library:
|
||||||
|
IF(UNIX)
|
||||||
|
TARGET_LINK_LIBRARIES(${exe} -lm)
|
||||||
|
ENDIF(UNIX)
|
||||||
|
# Install exe
|
||||||
|
INSTALL_TARGETS(/bin/ ${exe})
|
||||||
|
ENDFOREACH(exe)
|
||||||
|
|
||||||
|
|
||||||
14
codec/Makefile
Normal file
14
codec/Makefile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k
|
||||||
|
|
||||||
|
CFLAGS = -O3 -lstdc++ # -g -p -pg
|
||||||
|
|
||||||
|
all: j2k_to_image image_to_j2k
|
||||||
|
|
||||||
|
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
||||||
|
gcc $(CFLAGS) compat/getopt.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
|
||||||
|
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
||||||
|
gcc $(CFLAGS) compat/getopt.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f j2k_to_image image_to_j2k
|
||||||
257
codec/compat/getopt.c
Normal file
257
codec/compat/getopt.c
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1987, 1993, 1994
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* last review : october 29th, 2002 */
|
||||||
|
|
||||||
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
|
||||||
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
int opterr = 1, /* if error message should be printed */
|
||||||
|
optind = 1, /* index into parent argv vector */
|
||||||
|
optopt, /* character checked for validity */
|
||||||
|
optreset; /* reset getopt */
|
||||||
|
const char *optarg; /* argument associated with option */
|
||||||
|
|
||||||
|
typedef struct option
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int has_arg;
|
||||||
|
int *flag;
|
||||||
|
int val;
|
||||||
|
}option_t;
|
||||||
|
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG (int)':'
|
||||||
|
#define EMSG ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int getopt(int nargc, char *const *nargv, const char *ostr) {
|
||||||
|
# define __progname nargv[0]
|
||||||
|
static const char *place = EMSG; /* option letter processing */
|
||||||
|
char *oli; /* option letter list index */
|
||||||
|
|
||||||
|
if (optreset || !*place) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (place[1] && *++place == '-') { /* found "--" */
|
||||||
|
++optind;
|
||||||
|
place = EMSG;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
} /* option letter okay? */
|
||||||
|
if ((optopt = (int) *place++) == (int) ':' ||
|
||||||
|
!(oli = strchr(ostr, optopt))) {
|
||||||
|
/*
|
||||||
|
* if the user didn't specify '-' as an option,
|
||||||
|
* assume it means -1.
|
||||||
|
*/
|
||||||
|
if (optopt == (int) '-')
|
||||||
|
return (-1);
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
if (opterr && *ostr != ':') {
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: illegal option -- %c\n", __progname, optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (*++oli != ':') { /* don't need argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
} else { /* need an argument */
|
||||||
|
if (*place) /* no white space */
|
||||||
|
optarg = place;
|
||||||
|
else if (nargc <= ++optind) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (*ostr == ':')
|
||||||
|
return (BADARG);
|
||||||
|
if (opterr) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"%s: option requires an argument -- %c\n",
|
||||||
|
__progname, optopt);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
} else /* white space */
|
||||||
|
optarg = nargv[optind];
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
return (optopt); /* dump back option letter */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int getopt_long(int argc, char * const argv[], const char *optstring,
|
||||||
|
struct option *longopts, int totlen) {
|
||||||
|
static int lastidx,lastofs;
|
||||||
|
char *tmp;
|
||||||
|
int i,len;
|
||||||
|
char param = 1;
|
||||||
|
|
||||||
|
again:
|
||||||
|
if (optind>argc || !argv[optind] || *argv[optind]!='-')
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (argv[optind][0]=='-' && argv[optind][1]==0) {
|
||||||
|
if(optind >= (argc - 1)){ /* no more input parameters */
|
||||||
|
param = 0;
|
||||||
|
}
|
||||||
|
else{ /* more input parameters */
|
||||||
|
if(argv[optind + 1][0] == '-'){
|
||||||
|
param = 0; /* Missing parameter after '-' */
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
param = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param == 0) {
|
||||||
|
++optind;
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv[optind][0]=='-') { /* long option */
|
||||||
|
char* arg=argv[optind]+1;
|
||||||
|
const struct option* o;
|
||||||
|
o=longopts;
|
||||||
|
len=sizeof(longopts[0]);
|
||||||
|
|
||||||
|
if (param > 1){
|
||||||
|
arg = argv[optind+1];
|
||||||
|
optind++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
arg = argv[optind]+1;
|
||||||
|
|
||||||
|
if(strlen(arg)>1){
|
||||||
|
for (i=0;i<totlen;i=i+len,o++) {
|
||||||
|
if (!strcmp(o->name,arg)) { /* match */
|
||||||
|
if (o->has_arg == 0) {
|
||||||
|
if ((argv[optind+1])&&(!(argv[optind+1][0]=='-'))){
|
||||||
|
fprintf(stderr,"%s: option does not require an argument. Ignoring %s\n",arg,argv[optind+1]);
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
optarg=argv[optind+1];
|
||||||
|
if(optarg){
|
||||||
|
if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||||
|
if (opterr) {
|
||||||
|
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!optarg && o->has_arg==1) { /* no argument there */
|
||||||
|
if (opterr) {
|
||||||
|
fprintf(stderr,"%s: option requires an argument \n",arg);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
++optind;
|
||||||
|
if (o->flag)
|
||||||
|
*(o->flag)=o->val;
|
||||||
|
else
|
||||||
|
return o->val;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}//(end for)String not found in the list
|
||||||
|
fprintf(stderr,"Invalid option %s\n",arg);
|
||||||
|
++optind;
|
||||||
|
return (BADCH);
|
||||||
|
}else{ /*Single character input parameter*/
|
||||||
|
if (*optstring==':') return ':';
|
||||||
|
if (lastidx!=optind) {
|
||||||
|
lastidx=optind; lastofs=0;
|
||||||
|
}
|
||||||
|
optopt=argv[optind][lastofs+1];
|
||||||
|
if ((tmp=strchr(optstring,optopt))) {/*Found input parameter in list*/
|
||||||
|
if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
|
||||||
|
++optind;
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
if (tmp[1]==':') { /* argument expected */
|
||||||
|
if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
|
||||||
|
if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
|
optarg=argv[optind+1];
|
||||||
|
if(optarg){
|
||||||
|
if (optarg[0] == '-'){ /* Has read next input parameter: No arg for current parameter */
|
||||||
|
if (opterr) {
|
||||||
|
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!optarg) { /* missing argument */
|
||||||
|
if (opterr) {
|
||||||
|
fprintf(stderr,"%s: option requires an argument\n",arg);
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++optind;
|
||||||
|
}else {/*Argument not expected*/
|
||||||
|
++lastofs;
|
||||||
|
return optopt;
|
||||||
|
}
|
||||||
|
found:
|
||||||
|
++optind;
|
||||||
|
return optopt;
|
||||||
|
} else { /* not found */
|
||||||
|
fprintf(stderr,"Invalid option %s\n",arg);
|
||||||
|
++optind;
|
||||||
|
return (BADCH);
|
||||||
|
}//end of not found
|
||||||
|
|
||||||
|
}// end of single character
|
||||||
|
}//end '-'
|
||||||
|
fprintf(stderr,"Invalid option %s\n");
|
||||||
|
++optind;
|
||||||
|
return (BADCH);;
|
||||||
|
}//end function
|
||||||
@@ -3,6 +3,18 @@
|
|||||||
#ifndef _GETOPT_H_
|
#ifndef _GETOPT_H_
|
||||||
#define _GETOPT_H_
|
#define _GETOPT_H_
|
||||||
|
|
||||||
|
typedef struct option
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int has_arg;
|
||||||
|
int *flag;
|
||||||
|
int val;
|
||||||
|
}option_t;
|
||||||
|
|
||||||
|
#define NO_ARG 0
|
||||||
|
#define REQ_ARG 1
|
||||||
|
#define OPT_ARG 2
|
||||||
|
|
||||||
extern int opterr;
|
extern int opterr;
|
||||||
extern int optind;
|
extern int optind;
|
||||||
extern int optopt;
|
extern int optopt;
|
||||||
@@ -10,5 +22,8 @@ extern int optreset;
|
|||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
|
||||||
extern int getopt(int nargc, char *const *nargv, const char *ostr);
|
extern int getopt(int nargc, char *const *nargv, const char *ostr);
|
||||||
|
extern int getopt_long(int argc, char * const argv[], const char *optstring,
|
||||||
|
const struct option *longopts, int totlen);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _GETOPT_H_ */
|
#endif /* _GETOPT_H_ */
|
||||||
1438
codec/convert.c
Normal file
1438
codec/convert.c
Normal file
File diff suppressed because it is too large
Load Diff
56
codec/convert.h
Normal file
56
codec/convert.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#ifndef __J2K_CONVERT_H
|
||||||
|
#define __J2K_CONVERT_H
|
||||||
|
|
||||||
|
opj_image_t* bmptoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
|
int imagetobmp(opj_image_t *image, const char *outfile);
|
||||||
|
|
||||||
|
/* TIFF to image conversion*/
|
||||||
|
opj_image_t* tiftoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
|
int imagetotif(opj_image_t *image, const char *outfile);
|
||||||
|
/**
|
||||||
|
Load a single image component encoded in PGX file format
|
||||||
|
@param filename Name of the PGX file to load
|
||||||
|
@param parameters *List ?*
|
||||||
|
@return Returns a greyscale image if successful, returns NULL otherwise
|
||||||
|
*/
|
||||||
|
opj_image_t* pgxtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
|
int imagetopgx(opj_image_t *image, const char *outfile);
|
||||||
|
|
||||||
|
opj_image_t* pnmtoimage(const char *filename, opj_cparameters_t *parameters);
|
||||||
|
|
||||||
|
int imagetopnm(opj_image_t *image, const char *outfile);
|
||||||
|
|
||||||
|
#endif /* __J2K_CONVERT_H */
|
||||||
|
|
||||||
677
codec/dirent.h
Normal file
677
codec/dirent.h
Normal file
@@ -0,0 +1,677 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* uce-dirent.h - operating system independent dirent implementation
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998-2002 Toni Ronkko
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
* a copy of this software and associated documentation files (the
|
||||||
|
* ``Software''), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
* the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
* IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* May 28 1998, Toni Ronkko <tronkko@messi.uku.fi>
|
||||||
|
*
|
||||||
|
* $Id: uce-dirent.h,v 1.7 2002/05/13 10:48:35 tr Exp $
|
||||||
|
*
|
||||||
|
* $Log: uce-dirent.h,v $
|
||||||
|
* Revision 1.7 2002/05/13 10:48:35 tr
|
||||||
|
* embedded some source code directly to the header so that no source
|
||||||
|
* modules need to be included in the MS Visual C project using the
|
||||||
|
* interface, removed all the dependencies to other headers of the `uce'
|
||||||
|
* library so that the header can be made public
|
||||||
|
*
|
||||||
|
* Revision 1.6 2002/04/12 16:22:04 tr
|
||||||
|
* Unified Compiling Environment (UCE) replaced `std' library
|
||||||
|
*
|
||||||
|
* Revision 1.5 2001/07/20 16:33:40 tr
|
||||||
|
* moved to `std' library and re-named defines accordingly
|
||||||
|
*
|
||||||
|
* Revision 1.4 2001/07/10 16:47:18 tronkko
|
||||||
|
* revised comments
|
||||||
|
*
|
||||||
|
* Revision 1.3 2001/01/11 13:16:43 tr
|
||||||
|
* using ``uce-machine.h'' for finding out defines such as `FREEBSD'
|
||||||
|
*
|
||||||
|
* Revision 1.2 2000/10/08 16:00:41 tr
|
||||||
|
* copy of FreeBSD man page
|
||||||
|
*
|
||||||
|
* Revision 1.1 2000/07/10 05:53:16 tr
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
* Revision 1.2 1998/07/19 18:29:14 tr
|
||||||
|
* Added error reporting capabilities and some asserts.
|
||||||
|
*
|
||||||
|
* Revision 1.1 1998/07/04 16:27:51 tr
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* MSVC 1.0 scans automatic dependencies incorrectly when your project
|
||||||
|
* contains this very header. The problem is that MSVC cannot handle
|
||||||
|
* include directives inside #if..#endif block those are never entered.
|
||||||
|
* Since this header ought to compile in many different operating systems,
|
||||||
|
* there had to be several conditional blocks that are compiled only in
|
||||||
|
* operating systems for what they were designed for. MSVC 1.0 cannot
|
||||||
|
* handle inclusion of sys/dir.h in a part that is compiled only in Apollo
|
||||||
|
* operating system. To fix the problem you need to insert DIR.H into
|
||||||
|
* SYSINCL.DAT located in MSVC\BIN directory and restart visual C++.
|
||||||
|
* Consult manuals for more informaton about the problem.
|
||||||
|
*
|
||||||
|
* Since many UNIX systems have dirent.h we assume to have one also.
|
||||||
|
* However, if your UNIX system does not have dirent.h you can download one
|
||||||
|
* for example at: http://ftp.uni-mannheim.de/ftp/GNU/dirent/dirent.tar.gz.
|
||||||
|
* You can also see if you have one of dirent.h, direct.h, dir.h, ndir.h,
|
||||||
|
* sys/dir.h and sys/ndir.h somewhere. Try defining HAVE_DIRENT_H,
|
||||||
|
* HAVE_DIRECT_H, HAVE_DIR_H, HAVE_NDIR_H, HAVE_SYS_DIR_H and
|
||||||
|
* HAVE_SYS_NDIR_H according to the files found.
|
||||||
|
*/
|
||||||
|
#ifndef DIRENT_H
|
||||||
|
#define DIRENT_H
|
||||||
|
#define DIRENT_H_INCLUDED
|
||||||
|
|
||||||
|
/* find out platform */
|
||||||
|
#if defined(MSDOS) /* MS-DOS */
|
||||||
|
#elif defined(__MSDOS__) /* Turbo C/Borland */
|
||||||
|
# define MSDOS
|
||||||
|
#elif defined(__DOS__) /* Watcom */
|
||||||
|
# define MSDOS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WIN32) /* MS-Windows */
|
||||||
|
#elif defined(__NT__) /* Watcom */
|
||||||
|
# define WIN32
|
||||||
|
#elif defined(_WIN32) /* Microsoft */
|
||||||
|
# define WIN32
|
||||||
|
#elif defined(__WIN32__) /* Borland */
|
||||||
|
# define WIN32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See what kind of dirent interface we have unless autoconf has already
|
||||||
|
* determinated that.
|
||||||
|
*/
|
||||||
|
#if !defined(HAVE_DIRENT_H) && !defined(HAVE_DIRECT_H) && !defined(HAVE_SYS_DIR_H) && !defined(HAVE_NDIR_H) && !defined(HAVE_SYS_NDIR_H) && !defined(HAVE_DIR_H)
|
||||||
|
# if defined(_MSC_VER) /* Microsoft C/C++ */
|
||||||
|
/* no dirent.h */
|
||||||
|
# elif defined(__BORLANDC__) /* Borland C/C++ */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# define VOID_CLOSEDIR
|
||||||
|
# elif defined(__TURBOC__) /* Borland Turbo C */
|
||||||
|
/* no dirent.h */
|
||||||
|
# elif defined(__WATCOMC__) /* Watcom C/C++ */
|
||||||
|
# define HAVE_DIRECT_H
|
||||||
|
# elif defined(__apollo) /* Apollo */
|
||||||
|
# define HAVE_SYS_DIR_H
|
||||||
|
# elif defined(__hpux) /* HP-UX */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# elif defined(__alpha) || defined(__alpha__) /* Alpha OSF1 */
|
||||||
|
# error "not implemented"
|
||||||
|
# elif defined(__sgi) /* Silicon Graphics */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# elif defined(sun) || defined(_sun) /* Sun Solaris */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# elif defined(__FreeBSD__) /* FreeBSD */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# elif defined(__linux__) /* Linux */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# elif defined(__GNUC__) /* GNU C/C++ */
|
||||||
|
# define HAVE_DIRENT_H
|
||||||
|
# else
|
||||||
|
# error "not implemented"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* include proper interface headers */
|
||||||
|
#if defined(HAVE_DIRENT_H)
|
||||||
|
# include <dirent.h>
|
||||||
|
# ifdef FREEBSD
|
||||||
|
# define NAMLEN(dp) ((int)((dp)->d_namlen))
|
||||||
|
# else
|
||||||
|
# define NAMLEN(dp) ((int)(strlen((dp)->d_name)))
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#elif defined(HAVE_NDIR_H)
|
||||||
|
# include <ndir.h>
|
||||||
|
# define NAMLEN(dp) ((int)((dp)->d_namlen))
|
||||||
|
|
||||||
|
#elif defined(HAVE_SYS_NDIR_H)
|
||||||
|
# include <sys/ndir.h>
|
||||||
|
# define NAMLEN(dp) ((int)((dp)->d_namlen))
|
||||||
|
|
||||||
|
#elif defined(HAVE_DIRECT_H)
|
||||||
|
# include <direct.h>
|
||||||
|
# define NAMLEN(dp) ((int)((dp)->d_namlen))
|
||||||
|
|
||||||
|
#elif defined(HAVE_DIR_H)
|
||||||
|
# include <dir.h>
|
||||||
|
# define NAMLEN(dp) ((int)((dp)->d_namlen))
|
||||||
|
|
||||||
|
#elif defined(HAVE_SYS_DIR_H)
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/dir.h>
|
||||||
|
# ifndef dirent
|
||||||
|
# define dirent direct
|
||||||
|
# endif
|
||||||
|
# define NAMLEN(dp) ((int)((dp)->d_namlen))
|
||||||
|
|
||||||
|
#elif defined(MSDOS) || defined(WIN32)
|
||||||
|
|
||||||
|
/* figure out type of underlaying directory interface to be used */
|
||||||
|
# if defined(WIN32)
|
||||||
|
# define DIRENT_WIN32_INTERFACE
|
||||||
|
# elif defined(MSDOS)
|
||||||
|
# define DIRENT_MSDOS_INTERFACE
|
||||||
|
# else
|
||||||
|
# error "missing native dirent interface"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*** WIN32 specifics ***/
|
||||||
|
# if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
# include <windows.h>
|
||||||
|
# if !defined(DIRENT_MAXNAMLEN)
|
||||||
|
# define DIRENT_MAXNAMLEN (MAX_PATH)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/*** MS-DOS specifics ***/
|
||||||
|
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||||
|
# include <dos.h>
|
||||||
|
|
||||||
|
/* Borland defines file length macros in dir.h */
|
||||||
|
# if defined(__BORLANDC__)
|
||||||
|
# include <dir.h>
|
||||||
|
# if !defined(DIRENT_MAXNAMLEN)
|
||||||
|
# define DIRENT_MAXNAMLEN ((MAXFILE)+(MAXEXT))
|
||||||
|
# endif
|
||||||
|
# if !defined(_find_t)
|
||||||
|
# define _find_t find_t
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Turbo C defines ffblk structure in dir.h */
|
||||||
|
# elif defined(__TURBOC__)
|
||||||
|
# include <dir.h>
|
||||||
|
# if !defined(DIRENT_MAXNAMLEN)
|
||||||
|
# define DIRENT_MAXNAMLEN ((MAXFILE)+(MAXEXT))
|
||||||
|
# endif
|
||||||
|
# define DIRENT_USE_FFBLK
|
||||||
|
|
||||||
|
/* MSVC */
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
# if !defined(DIRENT_MAXNAMLEN)
|
||||||
|
# define DIRENT_MAXNAMLEN (12)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Watcom */
|
||||||
|
# elif defined(__WATCOMC__)
|
||||||
|
# if !defined(DIRENT_MAXNAMLEN)
|
||||||
|
# if defined(__OS2__) || defined(__NT__)
|
||||||
|
# define DIRENT_MAXNAMLEN (255)
|
||||||
|
# else
|
||||||
|
# define DIRENT_MAXNAMLEN (12)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/*** generic MS-DOS and MS-Windows stuff ***/
|
||||||
|
# if !defined(NAME_MAX) && defined(DIRENT_MAXNAMLEN)
|
||||||
|
# define NAME_MAX DIRENT_MAXNAMLEN
|
||||||
|
# endif
|
||||||
|
# if NAME_MAX < DIRENT_MAXNAMLEN
|
||||||
|
# error "assertion failed: NAME_MAX >= DIRENT_MAXNAMLEN"
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Substitute for real dirent structure. Note that `d_name' field is a
|
||||||
|
* true character array although we have it copied in the implementation
|
||||||
|
* dependent data. We could save some memory if we had declared `d_name'
|
||||||
|
* as a pointer refering the name within implementation dependent data.
|
||||||
|
* We have not done that since some code may rely on sizeof(d_name) to be
|
||||||
|
* something other than four. Besides, directory entries are typically so
|
||||||
|
* small that it takes virtually no time to copy them from place to place.
|
||||||
|
*/
|
||||||
|
typedef struct dirent {
|
||||||
|
char d_name[NAME_MAX + 1];
|
||||||
|
|
||||||
|
/*** Operating system specific part ***/
|
||||||
|
# if defined(DIRENT_WIN32_INTERFACE) /*WIN32*/
|
||||||
|
WIN32_FIND_DATA data;
|
||||||
|
# elif defined(DIRENT_MSDOS_INTERFACE) /*MSDOS*/
|
||||||
|
# if defined(DIRENT_USE_FFBLK)
|
||||||
|
struct ffblk data;
|
||||||
|
# else
|
||||||
|
struct _find_t data;
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
} dirent;
|
||||||
|
|
||||||
|
/* DIR substitute structure containing directory name. The name is
|
||||||
|
* essential for the operation of ``rewinndir'' function. */
|
||||||
|
typedef struct DIR {
|
||||||
|
char *dirname; /* directory being scanned */
|
||||||
|
dirent current; /* current entry */
|
||||||
|
int dirent_filled; /* is current un-processed? */
|
||||||
|
|
||||||
|
/*** Operating system specific part ***/
|
||||||
|
# if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
HANDLE search_handle;
|
||||||
|
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||||
|
# endif
|
||||||
|
} DIR;
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* supply prototypes for dirent functions */
|
||||||
|
static DIR *opendir (const char *dirname);
|
||||||
|
static struct dirent *readdir (DIR *dirp);
|
||||||
|
static int closedir (DIR *dirp);
|
||||||
|
static void rewinddir (DIR *dirp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implement dirent interface as static functions so that the user does not
|
||||||
|
* need to change his project in any way to use dirent function. With this
|
||||||
|
* it is sufficient to include this very header from source modules using
|
||||||
|
* dirent functions and the functions will be pulled in automatically.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* use ffblk instead of _find_t if requested */
|
||||||
|
#if defined(DIRENT_USE_FFBLK)
|
||||||
|
# define _A_ARCH (FA_ARCH)
|
||||||
|
# define _A_HIDDEN (FA_HIDDEN)
|
||||||
|
# define _A_NORMAL (0)
|
||||||
|
# define _A_RDONLY (FA_RDONLY)
|
||||||
|
# define _A_SUBDIR (FA_DIREC)
|
||||||
|
# define _A_SYSTEM (FA_SYSTEM)
|
||||||
|
# define _A_VOLID (FA_LABEL)
|
||||||
|
# define _dos_findnext(dest) findnext(dest)
|
||||||
|
# define _dos_findfirst(name,flags,dest) findfirst(name,dest,flags)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int _initdir (DIR *p);
|
||||||
|
static const char *_getdirname (const struct dirent *dp);
|
||||||
|
static void _setdirname (struct DIR *dirp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* <function name="opendir">
|
||||||
|
* <intro>open directory stream for reading
|
||||||
|
* <syntax>DIR *opendir (const char *dirname);
|
||||||
|
*
|
||||||
|
* <desc>Open named directory stream for read and return pointer to the
|
||||||
|
* internal working area that is used for retrieving individual directory
|
||||||
|
* entries. The internal working area has no fields of your interest.
|
||||||
|
*
|
||||||
|
* <ret>Returns a pointer to the internal working area or NULL in case the
|
||||||
|
* directory stream could not be opened. Global `errno' variable will set
|
||||||
|
* in case of error as follows:
|
||||||
|
*
|
||||||
|
* <table>
|
||||||
|
* [EACESS |Permission denied.
|
||||||
|
* [EMFILE |Too many open files used by the process.
|
||||||
|
* [ENFILE |Too many open files in system.
|
||||||
|
* [ENOENT |Directory does not exist.
|
||||||
|
* [ENOMEM |Insufficient memory.
|
||||||
|
* [ENOTDIR |dirname does not refer to directory. This value is not
|
||||||
|
* reliable on MS-DOS and MS-Windows platforms. Many
|
||||||
|
* implementations return ENOENT even when the name refers to a
|
||||||
|
* file.]
|
||||||
|
* </table>
|
||||||
|
* </function>
|
||||||
|
*/
|
||||||
|
static DIR *opendir(const char *dirname)
|
||||||
|
{
|
||||||
|
DIR *dirp;
|
||||||
|
assert (dirname != NULL);
|
||||||
|
|
||||||
|
dirp = (DIR*)malloc (sizeof (struct DIR));
|
||||||
|
if (dirp != NULL) {
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/* allocate room for directory name */
|
||||||
|
dirp->dirname = (char*) malloc (strlen (dirname) + 1 + strlen ("\\*.*"));
|
||||||
|
if (dirp->dirname == NULL) {
|
||||||
|
/* failed to duplicate directory name. errno set by malloc() */
|
||||||
|
free (dirp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* Copy directory name while appending directory separator and "*.*".
|
||||||
|
* Directory separator is not appended if the name already ends with
|
||||||
|
* drive or directory separator. Directory separator is assumed to be
|
||||||
|
* '/' or '\' and drive separator is assumed to be ':'. */
|
||||||
|
strcpy (dirp->dirname, dirname);
|
||||||
|
p = strchr (dirp->dirname, '\0');
|
||||||
|
if (dirp->dirname < p &&
|
||||||
|
*(p - 1) != '\\' && *(p - 1) != '/' && *(p - 1) != ':')
|
||||||
|
{
|
||||||
|
strcpy (p++, "\\");
|
||||||
|
}
|
||||||
|
# ifdef DIRENT_WIN32_INTERFACE
|
||||||
|
strcpy (p, "*"); /*scan files with and without extension in win32*/
|
||||||
|
# else
|
||||||
|
strcpy (p, "*.*"); /*scan files with and without extension in DOS*/
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* open stream */
|
||||||
|
if (_initdir (dirp) == 0) {
|
||||||
|
/* initialization failed */
|
||||||
|
free (dirp->dirname);
|
||||||
|
free (dirp);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dirp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* <function name="readdir">
|
||||||
|
* <intro>read a directory entry
|
||||||
|
* <syntax>struct dirent *readdir (DIR *dirp);
|
||||||
|
*
|
||||||
|
* <desc>Read individual directory entry and return pointer to a structure
|
||||||
|
* containing the name of the entry. Individual directory entries returned
|
||||||
|
* include normal files, sub-directories, pseudo-directories "." and ".."
|
||||||
|
* and also volume labels, hidden files and system files in MS-DOS and
|
||||||
|
* MS-Windows. You might want to use stat(2) function to determinate which
|
||||||
|
* one are you dealing with. Many dirent implementations already contain
|
||||||
|
* equivalent information in dirent structure but you cannot depend on
|
||||||
|
* this.
|
||||||
|
*
|
||||||
|
* The dirent structure contains several system dependent fields that
|
||||||
|
* generally have no interest to you. The only interesting one is char
|
||||||
|
* d_name[] that is also portable across different systems. The d_name
|
||||||
|
* field contains the name of the directory entry without leading path.
|
||||||
|
* While d_name is portable across different systems the actual storage
|
||||||
|
* capacity of d_name varies from system to system and there is no portable
|
||||||
|
* way to find out it at compile time as different systems define the
|
||||||
|
* capacity of d_name with different macros and some systems do not define
|
||||||
|
* capacity at all (besides actual declaration of the field). If you really
|
||||||
|
* need to find out storage capacity of d_name then you might want to try
|
||||||
|
* NAME_MAX macro. The NAME_MAX is defined in POSIX standard althought
|
||||||
|
* there are many MS-DOS and MS-Windows implementations those do not define
|
||||||
|
* it. There are also systems that declare d_name as "char d_name[1]" and
|
||||||
|
* then allocate suitable amount of memory at run-time. Thanks to Alain
|
||||||
|
* Decamps (Alain.Decamps@advalvas.be) for pointing it out to me.
|
||||||
|
*
|
||||||
|
* This all leads to the fact that it is difficult to allocate space
|
||||||
|
* for the directory names when the very same program is being compiled on
|
||||||
|
* number of operating systems. Therefore I suggest that you always
|
||||||
|
* allocate space for directory names dynamically.
|
||||||
|
*
|
||||||
|
* <ret>
|
||||||
|
* Returns a pointer to a structure containing name of the directory entry
|
||||||
|
* in `d_name' field or NULL if there was an error. In case of an error the
|
||||||
|
* global `errno' variable will set as follows:
|
||||||
|
*
|
||||||
|
* <table>
|
||||||
|
* [EBADF |dir parameter refers to an invalid directory stream. This value
|
||||||
|
* is not set reliably on all implementations.]
|
||||||
|
* </table>
|
||||||
|
* </function>
|
||||||
|
*/
|
||||||
|
static struct dirent *
|
||||||
|
readdir (DIR *dirp)
|
||||||
|
{
|
||||||
|
assert(dirp != NULL);
|
||||||
|
if (dirp == NULL) {
|
||||||
|
errno = EBADF;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||||
|
/* directory stream was opened/rewound incorrectly or it ended normally */
|
||||||
|
errno = EBADF;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (dirp->dirent_filled != 0) {
|
||||||
|
/*
|
||||||
|
* Directory entry has already been retrieved and there is no need to
|
||||||
|
* retrieve a new one. Directory entry will be retrieved in advance
|
||||||
|
* when the user calls readdir function for the first time. This is so
|
||||||
|
* because real dirent has separate functions for opening and reading
|
||||||
|
* the stream whereas Win32 and DOS dirents open the stream
|
||||||
|
* automatically when we retrieve the first file. Therefore, we have to
|
||||||
|
* save the first file when opening the stream and later we have to
|
||||||
|
* return the saved entry when the user tries to read the first entry.
|
||||||
|
*/
|
||||||
|
dirp->dirent_filled = 0;
|
||||||
|
} else {
|
||||||
|
/* fill in entry and return that */
|
||||||
|
#if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
if (FindNextFile (dirp->search_handle, &dirp->current.data) == FALSE) {
|
||||||
|
/* Last file has been processed or an error occured */
|
||||||
|
FindClose (dirp->search_handle);
|
||||||
|
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||||
|
errno = ENOENT;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||||
|
if (_dos_findnext (&dirp->current.data) != 0) {
|
||||||
|
/* _dos_findnext and findnext will set errno to ENOENT when no
|
||||||
|
* more entries could be retrieved. */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
_setdirname (dirp);
|
||||||
|
assert (dirp->dirent_filled == 0);
|
||||||
|
}
|
||||||
|
return &dirp->current;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* <function name="closedir">
|
||||||
|
* <intro>close directory stream.
|
||||||
|
* <syntax>int closedir (DIR *dirp);
|
||||||
|
*
|
||||||
|
* <desc>Close directory stream opened by the `opendir' function. Close of
|
||||||
|
* directory stream invalidates the DIR structure as well as previously read
|
||||||
|
* dirent entry.
|
||||||
|
*
|
||||||
|
* <ret>The function typically returns 0 on success and -1 on failure but
|
||||||
|
* the function may be declared to return void on same systems. At least
|
||||||
|
* Borland C/C++ and some UNIX implementations use void as a return type.
|
||||||
|
* The dirent wrapper tries to define VOID_CLOSEDIR whenever closedir is
|
||||||
|
* known to return nothing. The very same definition is made by the GNU
|
||||||
|
* autoconf if you happen to use it.
|
||||||
|
*
|
||||||
|
* The global `errno' variable will set to EBADF in case of error.
|
||||||
|
* </function>
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
closedir (DIR *dirp)
|
||||||
|
{
|
||||||
|
int retcode = 0;
|
||||||
|
|
||||||
|
/* make sure that dirp points to legal structure */
|
||||||
|
assert (dirp != NULL);
|
||||||
|
if (dirp == NULL) {
|
||||||
|
errno = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free directory name and search handles */
|
||||||
|
if (dirp->dirname != NULL) free (dirp->dirname);
|
||||||
|
|
||||||
|
#if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||||
|
if (FindClose (dirp->search_handle) == FALSE) {
|
||||||
|
/* Unknown error */
|
||||||
|
retcode = -1;
|
||||||
|
errno = EBADF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* clear dirp structure to make sure that it cannot be used anymore*/
|
||||||
|
memset (dirp, 0, sizeof (*dirp));
|
||||||
|
# if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
dirp->search_handle = INVALID_HANDLE_VALUE;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
free (dirp);
|
||||||
|
return retcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* <function name="rewinddir">
|
||||||
|
* <intro>rewind directory stream to the beginning
|
||||||
|
* <syntax>void rewinddir (DIR *dirp);
|
||||||
|
*
|
||||||
|
* <desc>Rewind directory stream to the beginning so that the next call of
|
||||||
|
* readdir() returns the very first directory entry again. However, note
|
||||||
|
* that next call of readdir() may not return the same directory entry as it
|
||||||
|
* did in first time. The directory stream may have been affected by newly
|
||||||
|
* created files.
|
||||||
|
*
|
||||||
|
* Almost every dirent implementation ensure that rewinddir will update
|
||||||
|
* the directory stream to reflect any changes made to the directory entries
|
||||||
|
* since the previous ``opendir'' or ``rewinddir'' call. Keep an eye on
|
||||||
|
* this if your program depends on the feature. I know at least one dirent
|
||||||
|
* implementation where you are required to close and re-open the stream to
|
||||||
|
* see the changes.
|
||||||
|
*
|
||||||
|
* <ret>Returns nothing. If something went wrong while rewinding, you will
|
||||||
|
* notice it later when you try to retrieve the first directory entry.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
rewinddir (DIR *dirp)
|
||||||
|
{
|
||||||
|
/* make sure that dirp is legal */
|
||||||
|
assert (dirp != NULL);
|
||||||
|
if (dirp == NULL) {
|
||||||
|
errno = EBADF;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert (dirp->dirname != NULL);
|
||||||
|
|
||||||
|
/* close previous stream */
|
||||||
|
#if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
if (dirp->search_handle != INVALID_HANDLE_VALUE) {
|
||||||
|
if (FindClose (dirp->search_handle) == FALSE) {
|
||||||
|
/* Unknown error */
|
||||||
|
errno = EBADF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* re-open previous stream */
|
||||||
|
if (_initdir (dirp) == 0) {
|
||||||
|
/* initialization failed but we cannot deal with error. User will notice
|
||||||
|
* error later when she tries to retrieve first directory enty. */
|
||||||
|
/*EMPTY*/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open native directory stream object and retrieve first file.
|
||||||
|
* Be sure to close previous stream before opening new one.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
_initdir (DIR *dirp)
|
||||||
|
{
|
||||||
|
assert (dirp != NULL);
|
||||||
|
assert (dirp->dirname != NULL);
|
||||||
|
dirp->dirent_filled = 0;
|
||||||
|
|
||||||
|
# if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
/* Open stream and retrieve first file */
|
||||||
|
dirp->search_handle = FindFirstFile (dirp->dirname, &dirp->current.data);
|
||||||
|
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
|
||||||
|
/* something went wrong but we don't know what. GetLastError() could
|
||||||
|
* give us more information about the error, but then we should map
|
||||||
|
* the error code into errno. */
|
||||||
|
errno = ENOENT;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# elif defined(DIRENT_MSDOS_INTERFACE)
|
||||||
|
if (_dos_findfirst (dirp->dirname,
|
||||||
|
_A_SUBDIR | _A_RDONLY | _A_ARCH | _A_SYSTEM | _A_HIDDEN,
|
||||||
|
&dirp->current.data) != 0)
|
||||||
|
{
|
||||||
|
/* _dos_findfirst and findfirst will set errno to ENOENT when no
|
||||||
|
* more entries could be retrieved. */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* initialize DIR and it's first entry */
|
||||||
|
_setdirname (dirp);
|
||||||
|
dirp->dirent_filled = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return implementation dependent name of the current directory entry.
|
||||||
|
*/
|
||||||
|
static const char *
|
||||||
|
_getdirname (const struct dirent *dp)
|
||||||
|
{
|
||||||
|
#if defined(DIRENT_WIN32_INTERFACE)
|
||||||
|
return dp->data.cFileName;
|
||||||
|
|
||||||
|
#elif defined(DIRENT_USE_FFBLK)
|
||||||
|
return dp->data.ff_name;
|
||||||
|
|
||||||
|
#else
|
||||||
|
return dp->data.name;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copy name of implementation dependent directory entry to the d_name field.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
_setdirname (struct DIR *dirp) {
|
||||||
|
/* make sure that d_name is long enough */
|
||||||
|
assert (strlen (_getdirname (&dirp->current)) <= NAME_MAX);
|
||||||
|
|
||||||
|
strncpy (dirp->current.d_name,
|
||||||
|
_getdirname (&dirp->current),
|
||||||
|
NAME_MAX);
|
||||||
|
dirp->current.d_name[NAME_MAX] = '\0'; /*char d_name[NAME_MAX+1]*/
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# define NAMLEN(dp) ((int)(strlen((dp)->d_name)))
|
||||||
|
|
||||||
|
#else
|
||||||
|
# error "missing dirent interface"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /*DIRENT_H*/
|
||||||
1656
codec/image_to_j2k.c
Normal file
1656
codec/image_to_j2k.c
Normal file
File diff suppressed because it is too large
Load Diff
110
codec/image_to_j2k.dsp
Normal file
110
codec/image_to_j2k.dsp
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="image_to_j2k" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=image_to_j2k - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "image_to_j2k.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "image_to_j2k.mak" CFG="image_to_j2k - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "image_to_j2k - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "image_to_j2k - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "image_to_j2k - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc"
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "image_to_j2k - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /GZ /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "image_to_j2k - Win32 Release"
|
||||||
|
# Name "image_to_j2k - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\convert.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\convert.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\compat\getopt.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\compat\getopt.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\image_to_j2k.c
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
@@ -1,29 +1,44 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "image_to_j2k"=.\image_to_j2k.dsp - Package Owner=<4>
|
Project: "LibOpenJPEG"=..\LibOpenJPEG.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Global:
|
Project: "image_to_j2k"=.\image_to_j2k.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<3>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name LibOpenJPEG
|
||||||
###############################################################################
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
724
codec/j2k_to_image.c
Normal file
724
codec/j2k_to_image.c
Normal file
@@ -0,0 +1,724 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||||
|
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||||
|
* Copyright (c) 2001-2003, David Janssens
|
||||||
|
* Copyright (c) 2002-2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
|
||||||
|
* Copyright (c) 2005, Herve Drolon, FreeImage Team
|
||||||
|
* Copyright (c) 2006-2007, Parvatha Elangovan
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "openjpeg.h"
|
||||||
|
#include "compat/getopt.h"
|
||||||
|
#include "convert.h"
|
||||||
|
#include "dirent.h"
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
#define stricmp strcasecmp
|
||||||
|
#define strnicmp strncasecmp
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#define J2K_CFMT 0
|
||||||
|
#define JP2_CFMT 1
|
||||||
|
#define JPT_CFMT 2
|
||||||
|
|
||||||
|
#define PXM_DFMT 10
|
||||||
|
#define PGX_DFMT 11
|
||||||
|
#define BMP_DFMT 12
|
||||||
|
#define YUV_DFMT 13
|
||||||
|
#define TIF_DFMT 14
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
typedef struct dircnt{
|
||||||
|
/** Buffer for holding images read from Directory*/
|
||||||
|
char *filename_buf;
|
||||||
|
/** Pointer to the buffer*/
|
||||||
|
char **filename;
|
||||||
|
}dircnt_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct img_folder{
|
||||||
|
/** The directory path of the folder containing input images*/
|
||||||
|
char *imgdirpath;
|
||||||
|
/** Output format*/
|
||||||
|
char *out_format;
|
||||||
|
/** Enable option*/
|
||||||
|
char set_imgdir;
|
||||||
|
/** Enable Cod Format for output*/
|
||||||
|
char set_out_format;
|
||||||
|
|
||||||
|
}img_fol_t;
|
||||||
|
|
||||||
|
void decode_help_display() {
|
||||||
|
fprintf(stdout,"HELP\n----\n\n");
|
||||||
|
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
|
||||||
|
|
||||||
|
/* UniPG>> */
|
||||||
|
fprintf(stdout,"List of parameters for the JPEG 2000 "
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
"+ JPWL "
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
"decoder:\n");
|
||||||
|
/* <<UniPG */
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
fprintf(stdout," -ImgDir \n");
|
||||||
|
fprintf(stdout," Image file Directory path \n");
|
||||||
|
fprintf(stdout," -OutFor \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, BMP format\n");
|
||||||
|
fprintf(stdout," -i <compressed file>\n");
|
||||||
|
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
|
||||||
|
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
|
||||||
|
fprintf(stdout," is identified based on its suffix.\n");
|
||||||
|
fprintf(stdout," -o <decompressed file>\n");
|
||||||
|
fprintf(stdout," REQUIRED\n");
|
||||||
|
fprintf(stdout," Currently accepts PGM-files, PPM-files, PNM-files, PGX-files and\n");
|
||||||
|
fprintf(stdout," BMP-files. 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");
|
||||||
|
fprintf(stdout," output filename, just before the \"pgx\" extension. If a PGM filename\n");
|
||||||
|
fprintf(stdout," is given and there are more than one component, only the first component\n");
|
||||||
|
fprintf(stdout," will be written to the file.\n");
|
||||||
|
fprintf(stdout," -r <reduce factor>\n");
|
||||||
|
fprintf(stdout," Set the number of highest resolution levels to be discarded. The\n");
|
||||||
|
fprintf(stdout," image resolution is effectively divided by 2 to the power of the\n");
|
||||||
|
fprintf(stdout," number of discarded levels. The reduce factor is limited by the\n");
|
||||||
|
fprintf(stdout," smallest total number of decomposition levels among tiles.\n");
|
||||||
|
fprintf(stdout," -l <number of quality layers to decode>\n");
|
||||||
|
fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
|
||||||
|
fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
|
||||||
|
fprintf(stdout," are decoded.\n");
|
||||||
|
/* UniPG>> */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
fprintf(stdout," -W <options>\n");
|
||||||
|
fprintf(stdout," Activates the JPWL correction capability, if the codestream complies.\n");
|
||||||
|
fprintf(stdout," Options can be a comma separated list of <param=val> tokens:\n");
|
||||||
|
fprintf(stdout," c, c=numcomps\n");
|
||||||
|
fprintf(stdout," numcomps is the number of expected components in the codestream\n");
|
||||||
|
fprintf(stdout," (search of first EPB rely upon this, default is %d)\n", JPWL_EXPECTED_COMPONENTS);
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
/* <<UniPG */
|
||||||
|
fprintf(stdout,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int get_num_images(char *imgdirpath){
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent* content;
|
||||||
|
int num_images = 0;
|
||||||
|
|
||||||
|
/*Reading the input images from given input directory*/
|
||||||
|
|
||||||
|
dir= opendir(imgdirpath);
|
||||||
|
if(!dir){
|
||||||
|
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while((content=readdir(dir))!=NULL){
|
||||||
|
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||||
|
continue;
|
||||||
|
num_images++;
|
||||||
|
}
|
||||||
|
return num_images;
|
||||||
|
}
|
||||||
|
|
||||||
|
int load_images(dircnt_t *dirptr, char *imgdirpath){
|
||||||
|
DIR *dir;
|
||||||
|
struct dirent* content;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
/*Reading the input images from given input directory*/
|
||||||
|
|
||||||
|
dir= opendir(imgdirpath);
|
||||||
|
if(!dir){
|
||||||
|
fprintf(stderr,"Could not open Folder %s\n",imgdirpath);
|
||||||
|
return 1;
|
||||||
|
}else {
|
||||||
|
fprintf(stderr,"Folder opened successfully\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
while((content=readdir(dir))!=NULL){
|
||||||
|
if(strcmp(".",content->d_name)==0 || strcmp("..",content->d_name)==0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
strcpy(dirptr->filename[i],content->d_name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_file_format(char *filename) {
|
||||||
|
unsigned int i;
|
||||||
|
static const char *extension[] = {"pgx", "pnm", "pgm", "ppm", "bmp","tif", "j2k", "jp2", "jpt", "j2c" };
|
||||||
|
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT };
|
||||||
|
char * ext = strrchr(filename, '.');
|
||||||
|
if (ext == NULL)
|
||||||
|
return -1;
|
||||||
|
ext++;
|
||||||
|
if(ext) {
|
||||||
|
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||||
|
if(strnicmp(ext, extension[i], 3) == 0) {
|
||||||
|
return format[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
||||||
|
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
||||||
|
|
||||||
|
strcpy(image_filename,dirptr->filename[imageno]);
|
||||||
|
fprintf(stderr,"File Number %d \"%s\"\n",imageno,image_filename);
|
||||||
|
parameters->decod_format = get_file_format(image_filename);
|
||||||
|
if (parameters->decod_format == -1)
|
||||||
|
return 1;
|
||||||
|
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||||
|
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||||
|
|
||||||
|
//Set output file
|
||||||
|
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||||
|
if(img_fol->set_out_format==1){
|
||||||
|
sprintf(outfilename,"%s/%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);
|
||||||
|
strncpy(parameters->outfile, outfilename, sizeof(outfilename));
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol) {
|
||||||
|
/* parse the command line */
|
||||||
|
int totlen;
|
||||||
|
option_t long_option[]={
|
||||||
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
|
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* UniPG>> */
|
||||||
|
const char optlist[] = "i:o:r:l:h"
|
||||||
|
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
"W:"
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
;
|
||||||
|
/* <<UniPG */
|
||||||
|
totlen=sizeof(long_option);
|
||||||
|
img_fol->set_out_format = 0;
|
||||||
|
while (1) {
|
||||||
|
int c = getopt_long(argc, argv,optlist,long_option,totlen);
|
||||||
|
if (c == -1)
|
||||||
|
break;
|
||||||
|
switch (c) {
|
||||||
|
case 'i': /* input file */
|
||||||
|
{
|
||||||
|
char *infile = optarg;
|
||||||
|
parameters->decod_format = get_file_format(infile);
|
||||||
|
switch(parameters->decod_format) {
|
||||||
|
case J2K_CFMT:
|
||||||
|
case JP2_CFMT:
|
||||||
|
case JPT_CFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr,
|
||||||
|
"!! Unrecognized format for infile : %s [accept only *.j2k, *.jp2, *.jpc or *.jpt] !!\n\n",
|
||||||
|
infile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'o': /* output file */
|
||||||
|
{
|
||||||
|
char *outfile = optarg;
|
||||||
|
parameters->cod_format = get_file_format(outfile);
|
||||||
|
switch(parameters->cod_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
case PXM_DFMT:
|
||||||
|
case BMP_DFMT:
|
||||||
|
case TIF_DFMT:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n", outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'O': /* output format */
|
||||||
|
{
|
||||||
|
char outformat[50];
|
||||||
|
char *of = optarg;
|
||||||
|
sprintf(outformat,".%s",of);
|
||||||
|
img_fol->set_out_format = 1;
|
||||||
|
parameters->cod_format = get_file_format(outformat);
|
||||||
|
switch(parameters->cod_format) {
|
||||||
|
case PGX_DFMT:
|
||||||
|
img_fol->out_format = "pgx";
|
||||||
|
break;
|
||||||
|
case PXM_DFMT:
|
||||||
|
img_fol->out_format = "ppm";
|
||||||
|
break;
|
||||||
|
case BMP_DFMT:
|
||||||
|
img_fol->out_format = "bmp";
|
||||||
|
break;
|
||||||
|
case TIF_DFMT:
|
||||||
|
img_fol->out_format = "tif";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx or *.bmp]!! \n");
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
case 'r': /* reduce option */
|
||||||
|
{
|
||||||
|
sscanf(optarg, "%d", ¶meters->cp_reduce);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
case 'l': /* layering option */
|
||||||
|
{
|
||||||
|
sscanf(optarg, "%d", ¶meters->cp_layer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
case 'h': /* display an help description */
|
||||||
|
decode_help_display();
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'y': /* Image Directory path */
|
||||||
|
{
|
||||||
|
img_fol->imgdirpath = (char*)malloc(strlen(optarg) + 1);
|
||||||
|
strcpy(img_fol->imgdirpath,optarg);
|
||||||
|
img_fol->set_imgdir=1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
/* UniPG>> */
|
||||||
|
#ifdef USE_JPWL
|
||||||
|
|
||||||
|
case 'W': /* activate JPWL correction */
|
||||||
|
{
|
||||||
|
char *token = NULL;
|
||||||
|
|
||||||
|
token = strtok(optarg, ",");
|
||||||
|
while(token != NULL) {
|
||||||
|
|
||||||
|
/* search expected number of components */
|
||||||
|
if (*token == 'c') {
|
||||||
|
|
||||||
|
static int compno;
|
||||||
|
|
||||||
|
compno = JPWL_EXPECTED_COMPONENTS; /* predefined no. of components */
|
||||||
|
|
||||||
|
if(sscanf(token, "c=%d", &compno) == 1) {
|
||||||
|
/* Specified */
|
||||||
|
if ((compno < 1) || (compno > 256)) {
|
||||||
|
fprintf(stderr, "ERROR -> invalid number of components c = %d\n", compno);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->jpwl_exp_comps = compno;
|
||||||
|
|
||||||
|
} else if (!strcmp(token, "c")) {
|
||||||
|
/* default */
|
||||||
|
parameters->jpwl_exp_comps = compno; /* auto for default size */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "ERROR -> invalid components specified = %s\n", token);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* search maximum number of tiles */
|
||||||
|
if (*token == 't') {
|
||||||
|
|
||||||
|
static int tileno;
|
||||||
|
|
||||||
|
tileno = JPWL_MAXIMUM_TILES; /* maximum no. of tiles */
|
||||||
|
|
||||||
|
if(sscanf(token, "t=%d", &tileno) == 1) {
|
||||||
|
/* Specified */
|
||||||
|
if ((tileno < 1) || (tileno > JPWL_MAXIMUM_TILES)) {
|
||||||
|
fprintf(stderr, "ERROR -> invalid number of tiles t = %d\n", tileno);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
parameters->jpwl_max_tiles = tileno;
|
||||||
|
|
||||||
|
} else if (!strcmp(token, "t")) {
|
||||||
|
/* default */
|
||||||
|
parameters->jpwl_max_tiles = tileno; /* auto for default size */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "ERROR -> invalid tiles specified = %s\n", token);
|
||||||
|
return 1;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/* next token or bust */
|
||||||
|
token = strtok(NULL, ",");
|
||||||
|
};
|
||||||
|
parameters->jpwl_correct = true;
|
||||||
|
fprintf(stdout, "JPWL correction capability activated\n");
|
||||||
|
fprintf(stdout, "- expecting %d components\n", parameters->jpwl_exp_comps);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* USE_JPWL */
|
||||||
|
/* <<UniPG */
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for possible errors */
|
||||||
|
if(img_fol->set_imgdir==1){
|
||||||
|
if(!(parameters->infile[0]==0)){
|
||||||
|
fprintf(stderr, "Error: options -ImgDir and -i cannot be used together !!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(img_fol->set_out_format == 0){
|
||||||
|
fprintf(stderr, "Error: When -ImgDir is used, -OutFor <FORMAT> must be used !!\n");
|
||||||
|
fprintf(stderr, "Only one format allowed! Valid format PGM, PPM, PNM, PGX,BMP!!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(!((parameters->outfile[0] == 0))){
|
||||||
|
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||||
|
fprintf(stderr, "Error: One of option; -i or -ImgDir must be specified\n");
|
||||||
|
fprintf(stderr, "Error: When using -i; -o must be used\n");
|
||||||
|
fprintf(stderr, "usage: image_to_j2k -i *.j2k/jp2 -o *.pgm/ppm/pnm/pgx/bmp(+ options)\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
sample error callback expecting a FILE* client object
|
||||||
|
*/
|
||||||
|
void error_callback(const char *msg, void *client_data) {
|
||||||
|
FILE *stream = (FILE*)client_data;
|
||||||
|
fprintf(stream, "[ERROR] %s", msg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
sample warning callback expecting a FILE* client object
|
||||||
|
*/
|
||||||
|
void warning_callback(const char *msg, void *client_data) {
|
||||||
|
FILE *stream = (FILE*)client_data;
|
||||||
|
fprintf(stream, "[WARNING] %s", msg);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
sample debug callback expecting no client object
|
||||||
|
*/
|
||||||
|
void info_callback(const char *msg, void *client_data) {
|
||||||
|
(void)client_data;
|
||||||
|
fprintf(stdout, "[INFO] %s", msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
opj_dparameters_t parameters; /* decompression parameters */
|
||||||
|
img_fol_t img_fol;
|
||||||
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
|
opj_image_t *image = NULL;
|
||||||
|
FILE *fsrc = NULL;
|
||||||
|
unsigned char *src = NULL;
|
||||||
|
int file_length;
|
||||||
|
int num_images;
|
||||||
|
int i,imageno;
|
||||||
|
dircnt_t *dirptr;
|
||||||
|
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
||||||
|
opj_cio_t *cio = NULL;
|
||||||
|
|
||||||
|
/* configure the event callbacks (not required) */
|
||||||
|
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||||
|
event_mgr.error_handler = error_callback;
|
||||||
|
event_mgr.warning_handler = warning_callback;
|
||||||
|
event_mgr.info_handler = info_callback;
|
||||||
|
|
||||||
|
/* set decoding parameters to default values */
|
||||||
|
opj_set_default_decoder_parameters(¶meters);
|
||||||
|
|
||||||
|
|
||||||
|
/* parse input and get user encoding parameters */
|
||||||
|
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(img_fol.set_imgdir==1){
|
||||||
|
num_images=get_num_images(img_fol.imgdirpath);
|
||||||
|
|
||||||
|
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||||
|
if(dirptr){
|
||||||
|
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); // Stores at max 10 image file names
|
||||||
|
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||||
|
|
||||||
|
if(!dirptr->filename_buf){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for(i=0;i<num_images;i++){
|
||||||
|
dirptr->filename[i] = dirptr->filename_buf + i*OPJ_PATH_LEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(load_images(dirptr,img_fol.imgdirpath)==1){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (num_images==0){
|
||||||
|
fprintf(stdout,"Folder is empty\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
num_images=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Encoding image one by one*/
|
||||||
|
for(imageno = 0; imageno < num_images ; imageno++)
|
||||||
|
{
|
||||||
|
|
||||||
|
image = NULL;
|
||||||
|
fprintf(stderr,"\n");
|
||||||
|
|
||||||
|
if(img_fol.set_imgdir==1){
|
||||||
|
if (get_next_file(imageno, dirptr,&img_fol, ¶meters)) {
|
||||||
|
fprintf(stderr,"skipping file...\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* read the input file and put it in memory */
|
||||||
|
/* ---------------------------------------- */
|
||||||
|
fsrc = fopen(parameters.infile, "rb");
|
||||||
|
if (!fsrc) {
|
||||||
|
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fseek(fsrc, 0, SEEK_END);
|
||||||
|
file_length = ftell(fsrc);
|
||||||
|
fseek(fsrc, 0, SEEK_SET);
|
||||||
|
src = (unsigned char *) malloc(file_length);
|
||||||
|
fread(src, 1, file_length, fsrc);
|
||||||
|
fclose(fsrc);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* decode the code-stream */
|
||||||
|
/* ---------------------- */
|
||||||
|
|
||||||
|
switch(parameters.decod_format) {
|
||||||
|
case J2K_CFMT:
|
||||||
|
{
|
||||||
|
/* JPEG-2000 codestream */
|
||||||
|
|
||||||
|
/* get a decoder handle */
|
||||||
|
dinfo = opj_create_decompress(CODEC_J2K);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
|
/* setup the decoder decoding parameters using user parameters */
|
||||||
|
opj_setup_decoder(dinfo, ¶meters);
|
||||||
|
|
||||||
|
/* open a byte stream */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
|
/* decode the stream and fill the image structure */
|
||||||
|
image = opj_decode(dinfo, cio);
|
||||||
|
if(!image) {
|
||||||
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JP2_CFMT:
|
||||||
|
{
|
||||||
|
/* JPEG 2000 compressed image data */
|
||||||
|
|
||||||
|
/* get a decoder handle */
|
||||||
|
dinfo = opj_create_decompress(CODEC_JP2);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
|
/* setup the decoder decoding parameters using the current image and user parameters */
|
||||||
|
opj_setup_decoder(dinfo, ¶meters);
|
||||||
|
|
||||||
|
/* open a byte stream */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
|
/* decode the stream and fill the image structure */
|
||||||
|
image = opj_decode(dinfo, cio);
|
||||||
|
if(!image) {
|
||||||
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case JPT_CFMT:
|
||||||
|
{
|
||||||
|
/* JPEG 2000, JPIP */
|
||||||
|
|
||||||
|
/* get a decoder handle */
|
||||||
|
dinfo = opj_create_decompress(CODEC_JPT);
|
||||||
|
|
||||||
|
/* catch events using our callbacks and give a local context */
|
||||||
|
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||||
|
|
||||||
|
/* setup the decoder decoding parameters using user parameters */
|
||||||
|
opj_setup_decoder(dinfo, ¶meters);
|
||||||
|
|
||||||
|
/* open a byte stream */
|
||||||
|
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||||
|
|
||||||
|
/* decode the stream and fill the image structure */
|
||||||
|
image = opj_decode(dinfo, cio);
|
||||||
|
if(!image) {
|
||||||
|
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
opj_cio_close(cio);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the byte stream */
|
||||||
|
opj_cio_close(cio);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "skipping file..\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free the memory containing the code-stream */
|
||||||
|
free(src);
|
||||||
|
src = NULL;
|
||||||
|
|
||||||
|
/* create output image */
|
||||||
|
/* ------------------- */
|
||||||
|
switch (parameters.cod_format) {
|
||||||
|
case PXM_DFMT: /* PNM PGM PPM */
|
||||||
|
if (imagetopnm(image, parameters.outfile)) {
|
||||||
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"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);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"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);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TIF_DFMT: /* TIFF */
|
||||||
|
if(imagetotif(image, parameters.outfile)){
|
||||||
|
fprintf(stdout,"Outfile %s not generated\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stdout,"Generated Outfile %s\n",parameters.outfile);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free remaining structures */
|
||||||
|
if(dinfo) {
|
||||||
|
opj_destroy_decompress(dinfo);
|
||||||
|
}
|
||||||
|
/* free image data structure */
|
||||||
|
opj_image_destroy(image);
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//end main
|
||||||
|
|
||||||
109
codec/j2k_to_image.dsp
Normal file
109
codec/j2k_to_image.dsp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
# Microsoft Developer Studio Project File - Name="j2k_to_image" - Package Owner=<4>
|
||||||
|
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||||
|
# ** DO NOT EDIT **
|
||||||
|
|
||||||
|
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||||
|
|
||||||
|
CFG=j2k_to_image - Win32 Debug
|
||||||
|
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||||
|
!MESSAGE use the Export Makefile command and run
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "j2k_to_image.mak".
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE You can specify a configuration when running NMAKE
|
||||||
|
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE NMAKE /f "j2k_to_image.mak" CFG="j2k_to_image - Win32 Debug"
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE Possible choices for configuration are:
|
||||||
|
!MESSAGE
|
||||||
|
!MESSAGE "j2k_to_image - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE "j2k_to_image - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||||
|
!MESSAGE
|
||||||
|
|
||||||
|
# Begin Project
|
||||||
|
# PROP AllowPerConfigDependencies 0
|
||||||
|
# PROP Scc_ProjName ""
|
||||||
|
# PROP Scc_LocalPath ""
|
||||||
|
CPP=cl.exe
|
||||||
|
RSC=rc.exe
|
||||||
|
|
||||||
|
!IF "$(CFG)" == "j2k_to_image - Win32 Release"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 0
|
||||||
|
# PROP BASE Output_Dir "Release"
|
||||||
|
# PROP BASE Intermediate_Dir "Release"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 0
|
||||||
|
# PROP Output_Dir "Release"
|
||||||
|
# PROP Intermediate_Dir "Release"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||||
|
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../libopenjpeg" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /FD /c
|
||||||
|
# SUBTRACT CPP /YX
|
||||||
|
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||||
|
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"libc"
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ELSEIF "$(CFG)" == "j2k_to_image - Win32 Debug"
|
||||||
|
|
||||||
|
# PROP BASE Use_MFC 0
|
||||||
|
# PROP BASE Use_Debug_Libraries 1
|
||||||
|
# PROP BASE Output_Dir "Debug"
|
||||||
|
# PROP BASE Intermediate_Dir "Debug"
|
||||||
|
# PROP BASE Target_Dir ""
|
||||||
|
# PROP Use_MFC 0
|
||||||
|
# PROP Use_Debug_Libraries 1
|
||||||
|
# PROP Output_Dir "Debug"
|
||||||
|
# PROP Intermediate_Dir "Debug"
|
||||||
|
# PROP Ignore_Export_Lib 0
|
||||||
|
# PROP Target_Dir ""
|
||||||
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||||
|
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../libopenjpeg" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "OPJ_STATIC" /YX /FD /GZ /c
|
||||||
|
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||||
|
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||||
|
BSC32=bscmake.exe
|
||||||
|
# ADD BASE BSC32 /nologo
|
||||||
|
# ADD BSC32 /nologo
|
||||||
|
LINK32=link.exe
|
||||||
|
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||||
|
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept
|
||||||
|
# SUBTRACT LINK32 /pdb:none
|
||||||
|
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
# Begin Target
|
||||||
|
|
||||||
|
# Name "j2k_to_image - Win32 Release"
|
||||||
|
# Name "j2k_to_image - Win32 Debug"
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\convert.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\convert.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\compat\getopt.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\compat\getopt.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\j2k_to_image.c
|
||||||
|
# End Source File
|
||||||
|
# End Target
|
||||||
|
# End Project
|
||||||
@@ -1,29 +1,44 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "image_to_j2k"=.\image_to_j2k.dsp - Package Owner=<4>
|
Project: "LibOpenJPEG"=..\LibOpenJPEG.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<4>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Global:
|
Project: "j2k_to_image"=.\j2k_to_image.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Package=<3>
|
Package=<4>
|
||||||
{{{
|
{{{
|
||||||
}}}
|
Begin Project Dependency
|
||||||
|
Project_Dep_Name LibOpenJPEG
|
||||||
###############################################################################
|
End Project Dependency
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
Global:
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<3>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
233
doc/Doxyfile.dox
Normal file
233
doc/Doxyfile.dox
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
# Doxyfile 1.4.2
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Project related configuration options
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
PROJECT_NAME = OpenJPEG
|
||||||
|
PROJECT_NUMBER =
|
||||||
|
OUTPUT_DIRECTORY = ../
|
||||||
|
CREATE_SUBDIRS = NO
|
||||||
|
OUTPUT_LANGUAGE = English
|
||||||
|
USE_WINDOWS_ENCODING = YES
|
||||||
|
BRIEF_MEMBER_DESC = YES
|
||||||
|
REPEAT_BRIEF = YES
|
||||||
|
ABBREVIATE_BRIEF = "The $name class" \
|
||||||
|
"The $name widget" \
|
||||||
|
"The $name file" \
|
||||||
|
is \
|
||||||
|
provides \
|
||||||
|
specifies \
|
||||||
|
contains \
|
||||||
|
represents \
|
||||||
|
a \
|
||||||
|
an \
|
||||||
|
the
|
||||||
|
ALWAYS_DETAILED_SEC = NO
|
||||||
|
INLINE_INHERITED_MEMB = NO
|
||||||
|
FULL_PATH_NAMES = NO
|
||||||
|
STRIP_FROM_PATH = C://
|
||||||
|
STRIP_FROM_INC_PATH =
|
||||||
|
SHORT_NAMES = NO
|
||||||
|
JAVADOC_AUTOBRIEF = YES
|
||||||
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
DETAILS_AT_TOP = YES
|
||||||
|
INHERIT_DOCS = YES
|
||||||
|
DISTRIBUTE_GROUP_DOC = NO
|
||||||
|
SEPARATE_MEMBER_PAGES = NO
|
||||||
|
TAB_SIZE = 8
|
||||||
|
ALIASES =
|
||||||
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||||
|
OPTIMIZE_OUTPUT_JAVA = NO
|
||||||
|
SUBGROUPING = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Build related configuration options
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
EXTRACT_ALL = YES
|
||||||
|
EXTRACT_PRIVATE = YES
|
||||||
|
EXTRACT_STATIC = YES
|
||||||
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
|
EXTRACT_LOCAL_METHODS = NO
|
||||||
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
|
HIDE_UNDOC_CLASSES = NO
|
||||||
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
|
HIDE_IN_BODY_DOCS = NO
|
||||||
|
INTERNAL_DOCS = NO
|
||||||
|
CASE_SENSE_NAMES = NO
|
||||||
|
HIDE_SCOPE_NAMES = NO
|
||||||
|
SHOW_INCLUDE_FILES = YES
|
||||||
|
INLINE_INFO = YES
|
||||||
|
SORT_MEMBER_DOCS = YES
|
||||||
|
SORT_BRIEF_DOCS = NO
|
||||||
|
SORT_BY_SCOPE_NAME = NO
|
||||||
|
GENERATE_TODOLIST = YES
|
||||||
|
GENERATE_TESTLIST = YES
|
||||||
|
GENERATE_BUGLIST = YES
|
||||||
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
|
ENABLED_SECTIONS =
|
||||||
|
MAX_INITIALIZER_LINES = 30
|
||||||
|
SHOW_USED_FILES = YES
|
||||||
|
SHOW_DIRECTORIES = NO
|
||||||
|
FILE_VERSION_FILTER =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to warning and progress messages
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
QUIET = NO
|
||||||
|
WARNINGS = YES
|
||||||
|
WARN_IF_UNDOCUMENTED = YES
|
||||||
|
WARN_IF_DOC_ERROR = YES
|
||||||
|
WARN_NO_PARAMDOC = NO
|
||||||
|
WARN_FORMAT = "$file:$line: $text"
|
||||||
|
WARN_LOGFILE =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the input files
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
INPUT = ../libopenjpeg \
|
||||||
|
../jpwl
|
||||||
|
FILE_PATTERNS = *.h \
|
||||||
|
*.c
|
||||||
|
RECURSIVE = NO
|
||||||
|
EXCLUDE =
|
||||||
|
EXCLUDE_SYMLINKS = NO
|
||||||
|
EXCLUDE_PATTERNS =
|
||||||
|
EXAMPLE_PATH =
|
||||||
|
EXAMPLE_PATTERNS = *
|
||||||
|
EXAMPLE_RECURSIVE = NO
|
||||||
|
IMAGE_PATH =
|
||||||
|
INPUT_FILTER =
|
||||||
|
FILTER_PATTERNS =
|
||||||
|
FILTER_SOURCE_FILES = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to source browsing
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
SOURCE_BROWSER = NO
|
||||||
|
INLINE_SOURCES = NO
|
||||||
|
STRIP_CODE_COMMENTS = YES
|
||||||
|
REFERENCED_BY_RELATION = YES
|
||||||
|
REFERENCES_RELATION = YES
|
||||||
|
VERBATIM_HEADERS = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the alphabetical class index
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
ALPHABETICAL_INDEX = NO
|
||||||
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
|
IGNORE_PREFIX =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the HTML output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_HTML = YES
|
||||||
|
HTML_OUTPUT = ./html
|
||||||
|
HTML_FILE_EXTENSION = .html
|
||||||
|
HTML_HEADER =
|
||||||
|
HTML_FOOTER =
|
||||||
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
|
GENERATE_HTMLHELP = NO
|
||||||
|
CHM_FILE =
|
||||||
|
HHC_LOCATION =
|
||||||
|
GENERATE_CHI = NO
|
||||||
|
BINARY_TOC = NO
|
||||||
|
TOC_EXPAND = NO
|
||||||
|
DISABLE_INDEX = NO
|
||||||
|
ENUM_VALUES_PER_LINE = 4
|
||||||
|
GENERATE_TREEVIEW = NO
|
||||||
|
TREEVIEW_WIDTH = 250
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the LaTeX output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_LATEX = NO
|
||||||
|
LATEX_OUTPUT = latex
|
||||||
|
LATEX_CMD_NAME = latex
|
||||||
|
MAKEINDEX_CMD_NAME = makeindex
|
||||||
|
COMPACT_LATEX = NO
|
||||||
|
PAPER_TYPE = a4wide
|
||||||
|
EXTRA_PACKAGES =
|
||||||
|
LATEX_HEADER =
|
||||||
|
PDF_HYPERLINKS = NO
|
||||||
|
USE_PDFLATEX = NO
|
||||||
|
LATEX_BATCHMODE = NO
|
||||||
|
LATEX_HIDE_INDICES = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the RTF output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_RTF = NO
|
||||||
|
RTF_OUTPUT = rtf
|
||||||
|
COMPACT_RTF = NO
|
||||||
|
RTF_HYPERLINKS = NO
|
||||||
|
RTF_STYLESHEET_FILE =
|
||||||
|
RTF_EXTENSIONS_FILE =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the man page output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_MAN = NO
|
||||||
|
MAN_OUTPUT = man
|
||||||
|
MAN_EXTENSION = .3
|
||||||
|
MAN_LINKS = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the XML output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_XML = NO
|
||||||
|
XML_OUTPUT = xml
|
||||||
|
XML_SCHEMA =
|
||||||
|
XML_DTD =
|
||||||
|
XML_PROGRAMLISTING = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options for the AutoGen Definitions output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_AUTOGEN_DEF = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the Perl module output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_PERLMOD = NO
|
||||||
|
PERLMOD_LATEX = NO
|
||||||
|
PERLMOD_PRETTY = YES
|
||||||
|
PERLMOD_MAKEVAR_PREFIX =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration options related to the preprocessor
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
ENABLE_PREPROCESSING = YES
|
||||||
|
MACRO_EXPANSION = NO
|
||||||
|
EXPAND_ONLY_PREDEF = NO
|
||||||
|
SEARCH_INCLUDES = YES
|
||||||
|
INCLUDE_PATH =
|
||||||
|
INCLUDE_FILE_PATTERNS =
|
||||||
|
PREDEFINED = USE_JPWL
|
||||||
|
EXPAND_AS_DEFINED =
|
||||||
|
SKIP_FUNCTION_MACROS = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration::additions related to external references
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
TAGFILES =
|
||||||
|
GENERATE_TAGFILE =
|
||||||
|
ALLEXTERNALS = NO
|
||||||
|
EXTERNAL_GROUPS = YES
|
||||||
|
PERL_PATH = /usr/bin/perl
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration options related to the dot tool
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
CLASS_DIAGRAMS = YES
|
||||||
|
HIDE_UNDOC_RELATIONS = YES
|
||||||
|
HAVE_DOT = NO
|
||||||
|
CLASS_GRAPH = YES
|
||||||
|
COLLABORATION_GRAPH = YES
|
||||||
|
GROUP_GRAPHS = YES
|
||||||
|
UML_LOOK = NO
|
||||||
|
TEMPLATE_RELATIONS = NO
|
||||||
|
INCLUDE_GRAPH = YES
|
||||||
|
INCLUDED_BY_GRAPH = YES
|
||||||
|
CALL_GRAPH = NO
|
||||||
|
GRAPHICAL_HIERARCHY = YES
|
||||||
|
DIRECTORY_GRAPH = YES
|
||||||
|
DOT_IMAGE_FORMAT = png
|
||||||
|
DOT_PATH =
|
||||||
|
DOTFILE_DIRS =
|
||||||
|
MAX_DOT_GRAPH_WIDTH = 1024
|
||||||
|
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||||
|
MAX_DOT_GRAPH_DEPTH = 1000
|
||||||
|
DOT_TRANSPARENT = NO
|
||||||
|
DOT_MULTI_TARGETS = NO
|
||||||
|
GENERATE_LEGEND = YES
|
||||||
|
DOT_CLEANUP = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration::additions related to the search engine
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
SEARCHENGINE = NO
|
||||||
23
indexer_JPIP/Makefile
Normal file
23
indexer_JPIP/Makefile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
CC = gcc
|
||||||
|
|
||||||
|
LDFLAGS = -lm
|
||||||
|
CFLAGS = -Wall
|
||||||
|
|
||||||
|
all: index_create
|
||||||
|
|
||||||
|
|
||||||
|
bio.o : bio.c bio.h
|
||||||
|
cio.o : cio.c cio.h
|
||||||
|
int.o : int.c
|
||||||
|
pi.o : pi.c pi.h int.h
|
||||||
|
index_create.o : index_create.c j2k.h cio.h tcd.h int.h
|
||||||
|
t2.o : t2.c t2.h tcd.h bio.h j2k.h pi.h tgt.h int.h cio.h
|
||||||
|
tgt.o : tgt.c bio.h tgt.h
|
||||||
|
tcd.o : tcd.c tcd.h t2.h int.h
|
||||||
|
jpip.o : jpip.c j2k.h cio.h tcd.h int.h
|
||||||
|
jp2.o : jp2.c j2k.h cio.h tcd.h int.h
|
||||||
|
|
||||||
|
index_create : bio.o cio.o int.o pi.o t2.o tgt.o tcd.o index_create.o jpip.o jp2.o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf *.o *.*~ *~ core.*
|
||||||
125
indexer_JPIP/bio.c
Normal file
125
indexer_JPIP/bio.c
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "bio.h"
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
static unsigned char *bio_start, *bio_end, *bio_bp;
|
||||||
|
static unsigned int bio_buf;
|
||||||
|
static int bio_ct;
|
||||||
|
|
||||||
|
extern jmp_buf j2k_error;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of bytes written.
|
||||||
|
/// </summary>
|
||||||
|
int bio_numbytes() {
|
||||||
|
return bio_bp-bio_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Init decoder.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="bp">Input buffer</param>
|
||||||
|
/// <param name="len">Input buffer length</param>
|
||||||
|
void bio_init_dec(unsigned char *bp, int len) {
|
||||||
|
bio_start=bp;
|
||||||
|
bio_end=bp+len;
|
||||||
|
bio_bp=bp;
|
||||||
|
bio_buf=0;
|
||||||
|
bio_ct=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bio_byteout()
|
||||||
|
{
|
||||||
|
bio_buf = (bio_buf << 8) & 0xffff;
|
||||||
|
bio_ct = bio_buf == 0xff00 ? 7 : 8;
|
||||||
|
if (bio_bp >= bio_end)
|
||||||
|
return 1;
|
||||||
|
*bio_bp++ = bio_buf >> 8;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read byte.
|
||||||
|
/// </summary>
|
||||||
|
int bio_bytein() {
|
||||||
|
bio_buf=(bio_buf<<8)&0xffff;
|
||||||
|
bio_ct=bio_buf==0xff00?7:8;
|
||||||
|
if (bio_bp>=bio_end) return 1; //longjmp(j2k_error, 1);
|
||||||
|
bio_buf|=*bio_bp++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read bit.
|
||||||
|
/// </summary>
|
||||||
|
int bio_getbit() {
|
||||||
|
if (bio_ct==0) {
|
||||||
|
bio_bytein();
|
||||||
|
}
|
||||||
|
bio_ct--;
|
||||||
|
return (bio_buf>>bio_ct)&1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read bits.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="n">Number of bits to read</param>
|
||||||
|
int bio_read(int n) {
|
||||||
|
int i, v;
|
||||||
|
v=0;
|
||||||
|
for (i=n-1; i>=0; i--) {
|
||||||
|
v+=bio_getbit()<<i;
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Flush bits.
|
||||||
|
/// </summary>
|
||||||
|
int bio_flush() {
|
||||||
|
bio_ct=0;
|
||||||
|
bio_byteout();
|
||||||
|
if (bio_ct==7) {
|
||||||
|
bio_ct=0;
|
||||||
|
if ( bio_byteout()) return 1;;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// </summary>
|
||||||
|
int bio_inalign() {
|
||||||
|
bio_ct=0;
|
||||||
|
if ((bio_buf&0xff)==0xff) {
|
||||||
|
if( bio_bytein()) return 1;
|
||||||
|
bio_ct=0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,10 +26,13 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __BIO_H
|
||||||
|
#define __BIO_H
|
||||||
|
|
||||||
#ifndef __FIX_H
|
int bio_numbytes();
|
||||||
#define __FIX_H
|
void bio_init_dec(unsigned char *bp, int len);
|
||||||
|
int bio_read(int n);
|
||||||
int fix_mul(int a, int b);
|
int bio_flush();
|
||||||
|
int bio_inalign();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
129
indexer_JPIP/cio.c
Normal file
129
indexer_JPIP/cio.c
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cio.h"
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
static unsigned char *cio_start, *cio_end, *cio_bp;
|
||||||
|
|
||||||
|
extern jmp_buf j2k_error;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of bytes written.
|
||||||
|
/// </summary>
|
||||||
|
int cio_numbytes() {
|
||||||
|
return cio_bp-cio_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get position in byte stream.
|
||||||
|
/// </summary>
|
||||||
|
int cio_tell() {
|
||||||
|
return cio_bp-cio_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set position in byte stream.
|
||||||
|
/// </summary>
|
||||||
|
void cio_seek(int pos) {
|
||||||
|
cio_bp=cio_start+pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of bytes left before the end of the stream.
|
||||||
|
/// </summary>
|
||||||
|
int cio_numbytesleft() {
|
||||||
|
return cio_end-cio_bp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get pointer to the current position in the stream.
|
||||||
|
/// </summary>
|
||||||
|
unsigned char *cio_getbp() {
|
||||||
|
return cio_bp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize byte IO.
|
||||||
|
/// </summary>
|
||||||
|
void cio_init(unsigned char *bp, int len) {
|
||||||
|
cio_start=bp;
|
||||||
|
cio_end=bp+len;
|
||||||
|
cio_bp=bp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write a byte.
|
||||||
|
/// </summary>
|
||||||
|
void cio_byteout(unsigned char v) {
|
||||||
|
if (cio_bp>=cio_end) longjmp(j2k_error, 1);
|
||||||
|
*cio_bp++=v;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read a byte.
|
||||||
|
/// </summary>
|
||||||
|
unsigned char cio_bytein() {
|
||||||
|
if (cio_bp>=cio_end) longjmp(j2k_error, 1);
|
||||||
|
return *cio_bp++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write a byte.
|
||||||
|
/// </summary>
|
||||||
|
//void cio_write(unsigned int v, int n) {
|
||||||
|
void cio_write(long long v, int n) {
|
||||||
|
int i;
|
||||||
|
for (i=n-1; i>=0; i--)
|
||||||
|
{
|
||||||
|
cio_byteout((unsigned char)((v>>(i<<3))&0xff));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read some bytes.
|
||||||
|
/// </summary>
|
||||||
|
/* unsigned int cio_read(int n) { */
|
||||||
|
long long cio_read(int n) {
|
||||||
|
int i;
|
||||||
|
/*unsigned int v;*/
|
||||||
|
long long v;
|
||||||
|
v=0;
|
||||||
|
for (i=n-1; i>=0; i--) {
|
||||||
|
v+=cio_bytein()<<(i<<3);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Write some bytes.
|
||||||
|
/// </summary>
|
||||||
|
void cio_skip(int n) {
|
||||||
|
cio_bp+=n;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,29 +26,19 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __T1_H
|
#ifndef __CIO_H
|
||||||
#define __T1_H
|
#define __CIO_H
|
||||||
|
|
||||||
#include "tcd.h"
|
int cio_tell();
|
||||||
#include "j2k.h"
|
void cio_seek(int pos);
|
||||||
|
int cio_numbytes();
|
||||||
/*
|
int cio_numbytesleft();
|
||||||
* Initialize the look-up tables of the Tier-1 coder/decoder
|
unsigned char *cio_getbp();
|
||||||
*/
|
void cio_init(unsigned char *bp, int len);
|
||||||
void t1_init_luts();
|
/* void cio_write(unsigned int v, int n); */
|
||||||
|
void cio_write(long long v, int n);
|
||||||
/*
|
/* unsigned int cio_read(int n); */
|
||||||
* Encode the code-blocks of a tile
|
long long cio_read(int n);
|
||||||
* tile: the tile to encode
|
void cio_skip(int n);
|
||||||
* tcp: tile coding parameters
|
|
||||||
*/
|
|
||||||
void t1_encode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Decode the code-blocks of a tile
|
|
||||||
* tile: the tile to encode
|
|
||||||
* tcp: tile coding parameters
|
|
||||||
*/
|
|
||||||
void t1_decode_cblks(tcd_tile_t * tile, j2k_tcp_t * tcp);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -26,24 +26,17 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __OPENJPEG_H
|
#include "fix.h"
|
||||||
#define __OPENJPEG_H
|
|
||||||
|
|
||||||
#include <j2k.h>
|
|
||||||
#include <tcd.h>
|
|
||||||
#include <jp2.h>
|
|
||||||
|
|
||||||
#include <bio.h>
|
|
||||||
#include <cio.h>
|
|
||||||
#include <dwt.h>
|
|
||||||
#include <fix.h>
|
|
||||||
#include <int.h>
|
|
||||||
#include <mct.h>
|
|
||||||
#include <mqc.h>
|
|
||||||
#include <pi.h>
|
|
||||||
#include <raw.h>
|
|
||||||
#include <t1.h>
|
|
||||||
#include <t2.h>
|
|
||||||
#include <tgt.h>
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define int64 __int64
|
||||||
|
#else
|
||||||
|
#define int64 long long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Multiply two fixed-precision rational numbers.
|
||||||
|
/// </summary>
|
||||||
|
int fix_mul(int a, int b) {
|
||||||
|
return (int)((int64)a*(int64)b>>13);
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -24,7 +26,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __FIX_H
|
#ifndef __FIX_H
|
||||||
#define __FIX_H
|
#define __FIX_H
|
||||||
|
|
||||||
1218
indexer_JPIP/index_create.c
Normal file
1218
indexer_JPIP/index_create.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
* Copyright (c) 2003, Yannick Verschueren
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -26,50 +26,64 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BIO_H
|
/// <summary>
|
||||||
#define __BIO_H
|
/// Get the minimum of two integers.
|
||||||
|
/// </summary>
|
||||||
|
int int_min(int a, int b) {
|
||||||
|
return a<b?a:b;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/// <summary>
|
||||||
* Number of bytes written.
|
/// Get the maximum of two integers.
|
||||||
*/
|
/// </summary>
|
||||||
int bio_numbytes();
|
int int_max(int a, int b) {
|
||||||
|
return a>b?a:b;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/// <summary>
|
||||||
* Init encoder.
|
/// Clamp an integer inside an interval.
|
||||||
*
|
/// </summary>
|
||||||
* bp : Output buffer
|
int int_clamp(int a, int min, int max) {
|
||||||
* len : Output buffer length
|
if (a<min) return min;
|
||||||
*/
|
if (a>max) return max;
|
||||||
void bio_init_enc(unsigned char *bp, int len);
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/// <summary>
|
||||||
* Init decoder.
|
/// Get absolute value of integer.
|
||||||
*
|
/// </summary>
|
||||||
* bp : Input buffer
|
int int_abs(int a) {
|
||||||
* len : Input buffer length
|
return a<0?-a:a;
|
||||||
*/
|
}
|
||||||
void bio_init_dec(unsigned char *bp, int len);
|
|
||||||
|
|
||||||
/*
|
/// <summary>
|
||||||
* Write bits.
|
/// Divide an integer and round upwards.
|
||||||
*
|
/// </summary>
|
||||||
* v : Value of bits
|
int int_ceildiv(int a, int b) {
|
||||||
* n : Number of bits to write
|
return (a+b-1)/b;
|
||||||
*/
|
}
|
||||||
void bio_write(int v, int n);
|
|
||||||
|
|
||||||
/*
|
/// <summary>
|
||||||
* Read bits.
|
/// Divide an integer by a power of 2 and round upwards.
|
||||||
*
|
/// </summary>
|
||||||
* n : Number of bits to read
|
int int_ceildivpow2(int a, int b) {
|
||||||
*/
|
return (a+(1<<b)-1)>>b;
|
||||||
int bio_read(int n);
|
}
|
||||||
|
|
||||||
/*
|
/// <summary>
|
||||||
* Flush bits. Modified to eliminate longjmp !!
|
/// Divide an integer by a power of 2 and round downwards.
|
||||||
*/
|
/// </summary>
|
||||||
int bio_flush();
|
int int_floordivpow2(int a, int b) {
|
||||||
|
return a>>b;
|
||||||
|
}
|
||||||
|
|
||||||
int bio_inalign(); /* modified to eliminated longjmp !! */
|
/// <summary>
|
||||||
|
/// Get logarithm of an integer and round downwards.
|
||||||
#endif
|
/// </summary>
|
||||||
|
int int_floorlog2(int a) {
|
||||||
|
int l;
|
||||||
|
for (l=0; a>1; l++) {
|
||||||
|
a>>=1;
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
* Copyright (c) 2003, Yannick Verschueren
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -26,25 +26,16 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __OPENJPEG_H
|
#ifndef __INT_H
|
||||||
#define __OPENJPEG_H
|
#define __INT_H
|
||||||
|
|
||||||
#include <j2k.h>
|
int int_min(int a, int b);
|
||||||
#include <tcd.h>
|
int int_max(int a, int b);
|
||||||
#include <jp2.h>
|
int int_clamp(int a, int min, int max);
|
||||||
#include <jpw.h>
|
int int_abs(int a);
|
||||||
|
int int_ceildiv(int a, int b);
|
||||||
#include <bio.h>
|
int int_ceildivpow2(int a, int b);
|
||||||
#include <cio.h>
|
int int_floordivpow2(int a, int b);
|
||||||
#include <dwt.h>
|
int int_floorlog2(int a);
|
||||||
#include <fix.h>
|
|
||||||
#include <int.h>
|
|
||||||
#include <mct.h>
|
|
||||||
#include <mqc.h>
|
|
||||||
#include <pi.h>
|
|
||||||
#include <raw.h>
|
|
||||||
#include <t1.h>
|
|
||||||
#include <t2.h>
|
|
||||||
#include <tgt.h>
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
288
indexer_JPIP/j2k.h
Normal file
288
indexer_JPIP/j2k.h
Normal file
@@ -0,0 +1,288 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define VERSION "0.0.8"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#ifdef LIBJ2K_EXPORTS
|
||||||
|
#define LIBJ2K_API __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define LIBJ2K_API __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define LIBJ2K_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __J2K_H
|
||||||
|
#define __J2K_H
|
||||||
|
|
||||||
|
#define J2K_MAXRLVLS 33
|
||||||
|
#define J2K_MAXBANDS (3*J2K_MAXRLVLS+1)
|
||||||
|
|
||||||
|
#define J2K_CP_CSTY_PRT 0x01
|
||||||
|
#define J2K_CP_CSTY_SOP 0x02
|
||||||
|
#define J2K_CP_CSTY_EPH 0x04
|
||||||
|
#define J2K_CCP_CSTY_PRT 0x01
|
||||||
|
#define J2K_CCP_CBLKSTY_LAZY 0x01
|
||||||
|
#define J2K_CCP_CBLKSTY_RESET 0x02
|
||||||
|
#define J2K_CCP_CBLKSTY_TERMALL 0x04
|
||||||
|
#define J2K_CCP_CBLKSTY_VSC 0x08
|
||||||
|
#define J2K_CCP_CBLKSTY_PTERM 0x10
|
||||||
|
#define J2K_CCP_CBLKSTY_SEGSYM 0x20
|
||||||
|
#define J2K_CCP_QNTSTY_NOQNT 0
|
||||||
|
#define J2K_CCP_QNTSTY_SIQNT 1
|
||||||
|
#define J2K_CCP_QNTSTY_SEQNT 2
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int dx, dy; /* XRsiz, YRsiz */
|
||||||
|
int prec; /* precision */
|
||||||
|
int bpp; /* deapth of image in bits */
|
||||||
|
int sgnd; /* signed */
|
||||||
|
int *data; /* image-component data */
|
||||||
|
} j2k_comp_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int version;
|
||||||
|
int x0, y0; /* XOsiz, YOsiz */
|
||||||
|
int x1, y1; /* Xsiz, Ysiz */
|
||||||
|
int numcomps; /* number of components */
|
||||||
|
int index_on; /* 0 = no index || 1 = index */
|
||||||
|
j2k_comp_t *comps; /* image-components */
|
||||||
|
} j2k_image_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int expn; /* exponent */
|
||||||
|
int mant; /* mantissa */
|
||||||
|
} j2k_stepsize_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int csty; /* coding style */
|
||||||
|
int numresolutions; /* number of resolutions */
|
||||||
|
int cblkw; /* width of code-blocks */
|
||||||
|
int cblkh; /* height of code-blocks */
|
||||||
|
int cblksty; /* code-block coding style */
|
||||||
|
int qmfbid; /* discrete wavelet transform identifier */
|
||||||
|
int qntsty; /* quantisation style */
|
||||||
|
j2k_stepsize_t stepsizes[J2K_MAXBANDS]; /* stepsizes used for quantisation */
|
||||||
|
int numgbits; /* number of guard bits */
|
||||||
|
int roishift; /* Region of Interest shift */
|
||||||
|
int prcw[J2K_MAXRLVLS]; /* Precinct width */
|
||||||
|
int prch[J2K_MAXRLVLS]; /* Precinct height */
|
||||||
|
} j2k_tccp_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int resno0, compno0;
|
||||||
|
int layno1, resno1, compno1;
|
||||||
|
int prg;
|
||||||
|
int tile;
|
||||||
|
char progorder[4];
|
||||||
|
} j2k_poc_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int csty; /* coding style */
|
||||||
|
int prg; /* progression order */
|
||||||
|
int numlayers; /* number of layers */
|
||||||
|
int mct; /* multi-component transform identifier */
|
||||||
|
int rates[100]; /* rates of layers */
|
||||||
|
int numpocs; /* number of progression order changes */
|
||||||
|
int POC; /* Precise if a POC marker has been used O:NO, 1:YES */
|
||||||
|
j2k_poc_t pocs[32]; /* progression order changes */
|
||||||
|
unsigned char *ppt_data; /* packet header store there for futur use in t2_decode_packet */
|
||||||
|
int ppt; /* If ppt == 1 --> there was a PPT marker for the present tile */
|
||||||
|
int ppt_store; /* Use in case of multiple marker PPT (number of info already store) */
|
||||||
|
j2k_tccp_t *tccps; /* tile-component coding parameters */
|
||||||
|
} j2k_tcp_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int tx0, ty0; /* XTOsiz, YTOsiz */
|
||||||
|
int tdx, tdy; /* XTsiz, YTsiz */
|
||||||
|
int tw, th;
|
||||||
|
unsigned char *ppm_data; /* packet header store there for futur use in t2_decode_packet */
|
||||||
|
int ppm; /* If ppm == 1 --> there was a PPM marker for the present tile */
|
||||||
|
int ppm_store; /* Use in case of multiple marker PPM (number of info already store) */
|
||||||
|
int ppm_previous; /* Use in case of multiple marker PPM (case on non-finished previous info) */
|
||||||
|
j2k_tcp_t *tcps; /* tile coding parameters */
|
||||||
|
} j2k_cp_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Packet information : Layer level */
|
||||||
|
typedef struct {
|
||||||
|
int len; /* Length of the body of the packet */
|
||||||
|
int len_header; /* Length of the header of the packet */
|
||||||
|
int offset; /* Offset of the body of the packet */
|
||||||
|
int offset_header; /* Offset of the header of the packet */
|
||||||
|
} info_layer_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Access to packet information : precinct level */
|
||||||
|
typedef struct {
|
||||||
|
info_layer_t *layer;
|
||||||
|
} info_prec_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Access to packet information : resolution level */
|
||||||
|
typedef struct {
|
||||||
|
info_prec_t *prec;
|
||||||
|
} info_reso_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Access to packet information : component level */
|
||||||
|
typedef struct {
|
||||||
|
info_reso_t *reso;
|
||||||
|
} info_compo_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Information about the marker */
|
||||||
|
typedef struct {
|
||||||
|
int type; /* type of marker [SIZ, QCD, POC, PPM, CRG, COD] appearing only once */
|
||||||
|
int start_pos; /* Start position of the marker */
|
||||||
|
int len; /* Length of the marker */
|
||||||
|
} info_marker_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Multiple marker in tile header */
|
||||||
|
typedef struct{
|
||||||
|
info_marker_t *COC; /* COC markers */
|
||||||
|
int num_COC; /* Number of COC marker */
|
||||||
|
int CzCOC; /* Current size of the vector COC */
|
||||||
|
|
||||||
|
info_marker_t *RGN; /* RGN markers */
|
||||||
|
int num_RGN; /* Number of RGN marker */
|
||||||
|
int CzRGN; /* Current size of the vector RGN */
|
||||||
|
|
||||||
|
info_marker_t *QCC; /* QCC markers */
|
||||||
|
int num_QCC; /* Number of QCC marker */
|
||||||
|
int CzQCC; /* Current size of the vector QCC */
|
||||||
|
|
||||||
|
info_marker_t *PLT; /* PLT markers */
|
||||||
|
int num_PLT; /* Number of PLT marker */
|
||||||
|
int CzPLT; /* Current size of the vector PLT */
|
||||||
|
|
||||||
|
info_marker_t *PPT; /* PPT markers */
|
||||||
|
int num_PPT; /* Number of PPT marker */
|
||||||
|
int CzPPT; /* Current size of the vector PPT */
|
||||||
|
|
||||||
|
info_marker_t *COM; /* COM markers */
|
||||||
|
int num_COM; /* Number of COM marker */
|
||||||
|
int CzCOM; /* Current size of the vector COC */
|
||||||
|
} info_marker_mul_tile_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Information about each tile_part for a particulary tile */
|
||||||
|
typedef struct{
|
||||||
|
int start_pos; /* Start position of the tile_part */
|
||||||
|
int length; /* Length of the tile_part header + body */
|
||||||
|
int length_header; /* Length of the header */
|
||||||
|
int end_pos; /* End position of the tile part */
|
||||||
|
int end_header; /* End position of the tile part header */
|
||||||
|
|
||||||
|
int num_reso_AUX; /* Number of resolution level completed */
|
||||||
|
} info_tile_part_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Information about each tile */
|
||||||
|
typedef struct {
|
||||||
|
int num_tile; /* Number of Tile */
|
||||||
|
int pw, ph; /* number of precinct by tile */
|
||||||
|
int num_packet; /* number of packet in the tile */
|
||||||
|
info_compo_t *compo; /* component [packet] */
|
||||||
|
|
||||||
|
info_marker_t *marker; /* information concerning markers inside image [only one apparition] */
|
||||||
|
info_marker_mul_tile_t marker_mul; /* information concerning markers inside image [multiple apparition] */
|
||||||
|
int num_marker; /* number of marker */
|
||||||
|
|
||||||
|
int numparts; /* number of tile_part for this tile */
|
||||||
|
info_tile_part_t *tile_parts; /* Information about each tile_part */
|
||||||
|
int Cztile_parts; /* Current size of the tile_parts vector */
|
||||||
|
} info_tile_t; /* index struct */
|
||||||
|
|
||||||
|
|
||||||
|
/* Multiple marker in main header */
|
||||||
|
typedef struct{
|
||||||
|
info_marker_t *COC; /* COC markers */
|
||||||
|
int num_COC; /* Number of COC marker */
|
||||||
|
int CzCOC; /* Current size of the vector COC */
|
||||||
|
|
||||||
|
info_marker_t *RGN; /* RGN markers */
|
||||||
|
int num_RGN; /* Number of RGN marker */
|
||||||
|
int CzRGN; /* Current size of the vector RGN */
|
||||||
|
|
||||||
|
info_marker_t *QCC; /* QCC markers */
|
||||||
|
int num_QCC; /* Number of QCC marker */
|
||||||
|
int CzQCC; /* Current size of the vector QCC */
|
||||||
|
|
||||||
|
info_marker_t *TLM; /* TLM markers */
|
||||||
|
int num_TLM; /* Number of TLM marker */
|
||||||
|
int CzTLM; /* Current size of the vector TLM */
|
||||||
|
|
||||||
|
info_marker_t *PLM; /* PLM markers */
|
||||||
|
int num_PLM; /* Number of PLM marker */
|
||||||
|
int CzPLM; /* Current size of the vector PLM */
|
||||||
|
|
||||||
|
info_marker_t *PPM; /* PPM markers */
|
||||||
|
int num_PPM; /* Number of PPM marker */
|
||||||
|
int CzPPM; /* Current size of the vector PPM */
|
||||||
|
|
||||||
|
info_marker_t *COM; /* COM markers */
|
||||||
|
int num_COM; /* Number of COM marker */
|
||||||
|
int CzCOM; /* Current size of the vector COM */
|
||||||
|
} info_marker_mul_t; /* index struct */
|
||||||
|
|
||||||
|
|
||||||
|
/* Information about image */
|
||||||
|
typedef struct {
|
||||||
|
int Im_w, Im_h; /* Image width and Height */
|
||||||
|
int Tile_x, Tile_y; /* Number of Tile in X and Y */
|
||||||
|
int tw, th;
|
||||||
|
int pw, ph; /* nombre precinct in X and Y */
|
||||||
|
int pdx, pdy; /* size of precinct in X and Y */
|
||||||
|
|
||||||
|
int Prog; /* progression order */
|
||||||
|
int Comp; /* Component numbers */
|
||||||
|
int Layer; /* number of layer */
|
||||||
|
int Decomposition; /* number of decomposition */
|
||||||
|
|
||||||
|
int Main_head_end; /* Main header position */
|
||||||
|
int codestream_size; /* codestream's size */
|
||||||
|
|
||||||
|
info_marker_t *marker; /* information concerning markers inside image [only one apparition] */
|
||||||
|
info_marker_mul_t marker_mul; /* information concerning markers inside image [multiple apparition] */
|
||||||
|
int num_marker; /* number of marker */
|
||||||
|
|
||||||
|
int num_packet_max; /* Maximum number of packet */
|
||||||
|
|
||||||
|
int num_max_tile_parts; /* Maximum number of tile-part */
|
||||||
|
info_tile_t *tile; /* information concerning tiles inside image */
|
||||||
|
} info_image_t; /* index struct */
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
301
indexer_JPIP/jp2.c
Normal file
301
indexer_JPIP/jp2.c
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "j2k.h"
|
||||||
|
#include "cio.h"
|
||||||
|
#include "tcd.h"
|
||||||
|
#include "int.h"
|
||||||
|
|
||||||
|
#define JPIP_JPIP 0x6a706970
|
||||||
|
|
||||||
|
#define JP2_JP 0x6a502020
|
||||||
|
#define JP2_FTYP 0x66747970
|
||||||
|
#define JP2_JP2H 0x6a703268
|
||||||
|
#define JP2_IHDR 0x69686472
|
||||||
|
#define JP2_COLR 0x636f6c72
|
||||||
|
#define JP2_JP2C 0x6a703263
|
||||||
|
#define JP2_URL 0x75726c20
|
||||||
|
#define JP2_DBTL 0x6474626c
|
||||||
|
#define JP2_BPCC 0x62706363
|
||||||
|
#define JP2 0x6a703220
|
||||||
|
|
||||||
|
|
||||||
|
void jp2_write_url(char *Idx_file)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
sprintf(str, "%s", Idx_file);
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_URL, 4); // DBTL
|
||||||
|
cio_write(0,1); // VERS
|
||||||
|
cio_write(0,3); // FLAG
|
||||||
|
|
||||||
|
for (i=0; i<strlen(str); i++) {
|
||||||
|
cio_write(str[i], 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void jp2_write_dbtl(char *Idx_file)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_DBTL, 4); // DBTL
|
||||||
|
cio_write(1,2); // NDR : Only 1
|
||||||
|
|
||||||
|
jp2_write_url(Idx_file); // URL Box
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
int jp2_write_ihdr(j2k_image_t *j2k_img)
|
||||||
|
{
|
||||||
|
int len, lenp,i;
|
||||||
|
int depth_0,depth, sign, BPC_ok=1;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_IHDR, 4); // IHDR
|
||||||
|
|
||||||
|
cio_write(j2k_img->y1-j2k_img->x0,4); // HEIGHT
|
||||||
|
cio_write(j2k_img->x1-j2k_img->x0,4); // WIDTH
|
||||||
|
cio_write(j2k_img->numcomps,2); // NC
|
||||||
|
|
||||||
|
depth_0=j2k_img->comps[0].prec-1;
|
||||||
|
sign=j2k_img->comps[0].sgnd;
|
||||||
|
|
||||||
|
for(i=1;i<j2k_img->numcomps;i++)
|
||||||
|
{
|
||||||
|
depth=j2k_img->comps[i].prec-1;
|
||||||
|
sign=j2k_img->comps[i].sgnd;
|
||||||
|
if(depth_0!=depth) BPC_ok=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BPC_ok)
|
||||||
|
cio_write(depth_0+(sign<<7),1);
|
||||||
|
else
|
||||||
|
cio_write(255,1);
|
||||||
|
|
||||||
|
cio_write(7,1); // C : Always 7
|
||||||
|
cio_write(1,1); // UnkC, colorspace unknow
|
||||||
|
cio_write(0,1); // IPR, no intellectual property
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
|
||||||
|
return BPC_ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jp2_write_bpcc(j2k_image_t *j2k_img)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_BPCC, 4); // BPCC
|
||||||
|
|
||||||
|
for(i=0;i<j2k_img->numcomps;i++)
|
||||||
|
cio_write(j2k_img->comps[i].prec-1+(j2k_img->comps[i].sgnd<<7),1);
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void jp2_write_colr(int BPC_ok, j2k_image_t *j2k_img)
|
||||||
|
{
|
||||||
|
int len, lenp, meth;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_COLR, 4); // COLR
|
||||||
|
|
||||||
|
if ((j2k_img->numcomps==1 || j2k_img->numcomps==3) && (BPC_ok && j2k_img->comps[0].prec==8))
|
||||||
|
meth=1;
|
||||||
|
else
|
||||||
|
meth=2;
|
||||||
|
|
||||||
|
cio_write(meth,1); // METH
|
||||||
|
cio_write(0,1); // PREC
|
||||||
|
cio_write(0,1); // APPROX
|
||||||
|
|
||||||
|
if (meth==1)
|
||||||
|
cio_write(j2k_img->numcomps>1?16:17,4); // EnumCS
|
||||||
|
|
||||||
|
if (meth==2)
|
||||||
|
cio_write(0,1); // PROFILE (??)
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the JP2H box
|
||||||
|
*
|
||||||
|
* JP2 Header box
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jp2_write_jp2h(j2k_image_t *j2k_img)
|
||||||
|
{
|
||||||
|
int len, lenp, BPC_ok;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_JP2H, 4); /* JP2H */
|
||||||
|
|
||||||
|
BPC_ok=jp2_write_ihdr(j2k_img);
|
||||||
|
|
||||||
|
if (!BPC_ok)
|
||||||
|
jp2_write_bpcc(j2k_img);
|
||||||
|
jp2_write_colr(BPC_ok, j2k_img);
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the FTYP box
|
||||||
|
*
|
||||||
|
* File type box
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jp2_write_ftyp()
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_FTYP, 4); /* FTYP */
|
||||||
|
|
||||||
|
cio_write(JP2,4); /* BR */
|
||||||
|
cio_write(0,4); /* MinV */
|
||||||
|
cio_write(JP2,4); /* CL0 : JP2 */
|
||||||
|
cio_write(JPIP_JPIP,4); /* CL1 : JPIP */
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the FTYP box
|
||||||
|
*
|
||||||
|
* File type box
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jp2_read_ftyp(int length)
|
||||||
|
{
|
||||||
|
int BR, MinV, type, i;
|
||||||
|
|
||||||
|
BR = cio_read(4); /* BR */
|
||||||
|
MinV = cio_read(4); /* MinV */
|
||||||
|
length-=8;
|
||||||
|
|
||||||
|
for (i=length/4;i>0;i--)
|
||||||
|
type = cio_read(4); /* CLi : JP2, JPIP */
|
||||||
|
}
|
||||||
|
|
||||||
|
int jp2_write_jp2c(char *J2K_file)
|
||||||
|
{
|
||||||
|
int len, lenp, totlen, i;
|
||||||
|
FILE *src;
|
||||||
|
char *j2kfile;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_JP2C, 4); // JP2C
|
||||||
|
|
||||||
|
src=fopen(J2K_file, "rb");
|
||||||
|
fseek(src, 0, SEEK_END);
|
||||||
|
totlen=ftell(src);
|
||||||
|
fseek(src, 0, SEEK_SET);
|
||||||
|
|
||||||
|
j2kfile=(char*)malloc(totlen);
|
||||||
|
fread(j2kfile, 1, totlen, src);
|
||||||
|
fclose(src);
|
||||||
|
|
||||||
|
for (i=0;i<totlen;i++)
|
||||||
|
cio_write(j2kfile[i],1);
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
return lenp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void jp2_write_jp()
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4);
|
||||||
|
cio_write(JP2_JP, 4); // JP
|
||||||
|
cio_write(0x0d0a870a,4);
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len,4); // L
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the JP box
|
||||||
|
*
|
||||||
|
* JPEG 2000 signature
|
||||||
|
*
|
||||||
|
* return 1 if error else 0
|
||||||
|
*/
|
||||||
|
int jp2_read_jp()
|
||||||
|
{
|
||||||
|
if (0x0d0a870a!=cio_read(4))
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
|
||||||
* Copyright (c) 2003, Yannick Verschueren
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -25,25 +24,21 @@
|
|||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
#ifndef __JP2_H
|
||||||
|
#define __JP2_H
|
||||||
|
|
||||||
#ifndef __OPENJPEG_H
|
#include "j2k.h"
|
||||||
#define __OPENJPEG_H
|
|
||||||
|
|
||||||
#include <j2k.h>
|
void jp2_write_url(char *Idx_file);
|
||||||
#include <tcd.h>
|
|
||||||
#include <jp2.h>
|
|
||||||
|
|
||||||
#include <bio.h>
|
void jp2_write_dbtl(char *Idx_file);
|
||||||
#include <cio.h>
|
|
||||||
#include <dwt.h>
|
void jp2_write_jp2h(j2k_image_t *j2k_img);
|
||||||
#include <fix.h>
|
|
||||||
#include <int.h>
|
void jp2_write_ftyp();
|
||||||
#include <mct.h>
|
|
||||||
#include <mqc.h>
|
int jp2_write_jp2c(char *J2K_file);
|
||||||
#include <pi.h>
|
|
||||||
#include <raw.h>
|
void jp2_write_jp();
|
||||||
#include <t1.h>
|
|
||||||
#include <t2.h>
|
|
||||||
#include <tgt.h>
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
768
indexer_JPIP/jpip.c
Normal file
768
indexer_JPIP/jpip.c
Normal file
@@ -0,0 +1,768 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "j2k.h"
|
||||||
|
#include "cio.h"
|
||||||
|
#include "tcd.h"
|
||||||
|
#include "int.h"
|
||||||
|
|
||||||
|
#define JPIP_CIDX 0x63696478 /* Codestream index */
|
||||||
|
#define JPIP_CPTR 0x63707472 /* Codestream Finder Box */
|
||||||
|
#define JPIP_MANF 0x6d616e66 /* Manifest Box */
|
||||||
|
#define JPIP_FAIX 0x66616978 /* Fragment array Index box */
|
||||||
|
#define JPIP_MHIX 0x6d686978 /* Main Header Index Table */
|
||||||
|
#define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */
|
||||||
|
#define JPIP_THIX 0x74686978 /* Tile header Index Table box */
|
||||||
|
#define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */
|
||||||
|
#define JPIP_PHIX 0x70686978 /* Packet Header index Table */
|
||||||
|
#define JPIP_FIDX 0x66696478 /* File Index */
|
||||||
|
#define JPIP_FPTR 0x66707472 /* File Finder */
|
||||||
|
#define JPIP_PRXY 0x70727879 /* Proxy boxes */
|
||||||
|
#define JPIP_IPTR 0x69707472 /* Index finder box */
|
||||||
|
#define JPIP_PHLD 0x70686c64 /* Place holder */
|
||||||
|
|
||||||
|
#define JP2C 0x6a703263
|
||||||
|
|
||||||
|
//static info_marker_t marker_jpip[32], marker_local_jpip[32]; /* SIZE to precise ! */
|
||||||
|
//static int num_marker_jpip, num_marker_local_jpip;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the CPTR box
|
||||||
|
*
|
||||||
|
* Codestream finder box (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_write_cptr(int offset, info_image_t img)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_CPTR,4); /* T */
|
||||||
|
cio_write(0,2); /* DR A PRECISER !! */
|
||||||
|
cio_write(0,2); /* CONT */
|
||||||
|
cio_write(offset,8); /* COFF A PRECISER !! */
|
||||||
|
cio_write(img.codestream_size,8); /* CLEN */
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the CPTR box
|
||||||
|
*
|
||||||
|
* Codestream finder box (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_read_cptr()
|
||||||
|
{
|
||||||
|
int DR, CONT;
|
||||||
|
long long Coff, codestream_size;
|
||||||
|
|
||||||
|
DR = cio_read(2); /* DR */
|
||||||
|
CONT = cio_read(2); /* CONT */
|
||||||
|
Coff = cio_read(8); /* COFF */
|
||||||
|
codestream_size = cio_read(8); /* CLEN */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the MANF box
|
||||||
|
*
|
||||||
|
* Manifest box (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_write_manf(int second, int v, info_marker_t *marker)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_MANF,4); /* T */
|
||||||
|
|
||||||
|
if (second) /* Write only during the second pass */
|
||||||
|
{
|
||||||
|
for(i=0;i<v;i++)
|
||||||
|
{
|
||||||
|
cio_write(marker[i].len,4); /* Marker length */
|
||||||
|
cio_write(marker[i].type,4); /* Marker type */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the MANF box
|
||||||
|
*
|
||||||
|
* Manifest box (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_read_manf(int len)
|
||||||
|
{
|
||||||
|
int i, v, marker_len, marker_type;
|
||||||
|
|
||||||
|
v = (len - 8)/ 8;
|
||||||
|
|
||||||
|
for(i=0;i<v;i++)
|
||||||
|
{
|
||||||
|
marker_len = cio_read(4); /* Marker length */
|
||||||
|
marker_type = cio_read(4); /* Marker type */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the MHIX box
|
||||||
|
*
|
||||||
|
* Main Header Index Table (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_mhix(info_image_t img, int status, int tileno)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
info_tile_t *tile;
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_MHIX, 4); /* MHIX */
|
||||||
|
|
||||||
|
if (status) /* MAIN HEADER */
|
||||||
|
{
|
||||||
|
cio_write(img.Main_head_end,8); /* TLEN */
|
||||||
|
|
||||||
|
for(i = 0; i < img.num_marker; i++) /* Marker restricted to 1 apparition */
|
||||||
|
{
|
||||||
|
cio_write(img.marker[i].type, 2);
|
||||||
|
cio_write(0, 2);
|
||||||
|
cio_write(img.marker[i].start_pos, 8);
|
||||||
|
cio_write(img.marker[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Marker NOT restricted to 1 apparition */
|
||||||
|
for(i = img.marker_mul.num_COC - 1; i >= 0; i--) /* COC */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.COC[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.COC[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.COC[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = img.marker_mul.num_RGN - 1; i >= 0; i--) /* RGN */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.RGN[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.RGN[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.RGN[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = img.marker_mul.num_QCC - 1; i >= 0; i--) /* QCC */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.QCC[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.QCC[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.QCC[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = img.marker_mul.num_TLM - 1; i >= 0; i--) /* TLM */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.TLM[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.TLM[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.TLM[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = img.marker_mul.num_PLM - 1; i >= 0; i--) /* PLM */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.PLM[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.PLM[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.PLM[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = img.marker_mul.num_PPM - 1; i >= 0; i--) /* PPM */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.PPM[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.PPM[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.PPM[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = img.marker_mul.num_COM - 1; i >= 0; i--) /* COM */
|
||||||
|
{
|
||||||
|
cio_write(img.marker_mul.COM[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(img.marker_mul.COM[i].start_pos, 8);
|
||||||
|
cio_write(img.marker_mul.COM[i].len, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* TILE HEADER */
|
||||||
|
{
|
||||||
|
tile = &img.tile[tileno];
|
||||||
|
cio_write(tile->tile_parts[0].length_header, 8); /* TLEN */
|
||||||
|
|
||||||
|
for(i = 0; i < tile->num_marker; i++) /* Marker restricted to 1 apparition */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker[i].type, 2);
|
||||||
|
cio_write(0, 2);
|
||||||
|
cio_write(tile->marker[i].start_pos, 8);
|
||||||
|
cio_write(tile->marker[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Marker NOT restricted to 1 apparition */
|
||||||
|
for(i = tile->marker_mul.num_COC - 1; i >= 0; i--) /* COC */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker_mul.COC[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(tile->marker_mul.COC[i].start_pos, 8);
|
||||||
|
cio_write(tile->marker_mul.COC[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = tile->marker_mul.num_RGN - 1; i >= 0; i--) /* RGN */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker_mul.RGN[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(tile->marker_mul.RGN[i].start_pos, 8);
|
||||||
|
cio_write(tile->marker_mul.RGN[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = tile->marker_mul.num_QCC - 1; i >= 0; i--) /* QCC */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker_mul.QCC[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(tile->marker_mul.QCC[i].start_pos, 8);
|
||||||
|
cio_write(tile->marker_mul.QCC[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = tile->marker_mul.num_PLT - 1; i >= 0; i--) /* PLT */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker_mul.PLT[i].type,2);
|
||||||
|
cio_write(i,2);
|
||||||
|
cio_write(tile->marker_mul.PLT[i].start_pos,8);
|
||||||
|
cio_write(tile->marker_mul.PLT[i].len,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = tile->marker_mul.num_PPT - 1; i >= 0; i--) /* PPT */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker_mul.PPT[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(tile->marker_mul.PPT[i].start_pos, 8);
|
||||||
|
cio_write(tile->marker_mul.PPT[i].len, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = tile->marker_mul.num_COM - 1; i >= 0; i--) /* COM */
|
||||||
|
{
|
||||||
|
cio_write(tile->marker_mul.COM[i].type, 2);
|
||||||
|
cio_write(i, 2);
|
||||||
|
cio_write(tile->marker_mul.COM[i].start_pos, 8);
|
||||||
|
cio_write(tile->marker_mul.COM[i].len, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the MHIX box
|
||||||
|
*
|
||||||
|
* Main Header Index Table (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_read_mhix(int len)
|
||||||
|
{
|
||||||
|
int i, v, marker_type, marker_start_pos, marker_len, marker_remains;
|
||||||
|
|
||||||
|
v = (len - 8) / 14;
|
||||||
|
|
||||||
|
for (i=0; i<v ; i++)
|
||||||
|
{
|
||||||
|
marker_type = cio_read(2); /* Type of the marker */
|
||||||
|
marker_remains = cio_read(2); /* Number of same markers following */
|
||||||
|
marker_start_pos = cio_read(2); /* Start position of the marker */
|
||||||
|
marker_len = cio_read(2); /* Length of the marker */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the FAIX box
|
||||||
|
*
|
||||||
|
* Fragment array Index box (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_faix(int v, int compno, info_image_t img, j2k_cp_t *j2k_cp, int version)
|
||||||
|
{
|
||||||
|
int len, lenp, i, j;
|
||||||
|
/*int version = 0;*/
|
||||||
|
int tileno, resno, precno, layno, num_packet=0;
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_FAIX, 4); /* FAIX */
|
||||||
|
cio_write(version,1); /* Version 0 = 4 bytes */
|
||||||
|
|
||||||
|
switch(v)
|
||||||
|
{
|
||||||
|
case 0: /* TPIX */
|
||||||
|
cio_write(img.num_max_tile_parts,(version & 0x01)?8:4); /* NMAX */
|
||||||
|
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
|
||||||
|
for (i = 0; i < img.tw*img.th; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < img.tile[i].numparts ; j++)
|
||||||
|
{
|
||||||
|
cio_write(img.tile[i].tile_parts[j].start_pos,(version & 0x01)?8:4); /* start position */
|
||||||
|
cio_write(img.tile[i].tile_parts[j].length,(version & 0x01)?8:4); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write(img.tile[i].tile_parts[j].num_reso_AUX,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
//cio_write(0,4);
|
||||||
|
}
|
||||||
|
/* PADDING */
|
||||||
|
while (j < img.num_max_tile_parts)
|
||||||
|
{
|
||||||
|
cio_write(0,(version & 0x01)?8:4); /* start position */
|
||||||
|
cio_write(0,(version & 0x01)?8:4); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* case 1: */ /* THIX */
|
||||||
|
/* cio_write(1,(version & 0x01)?8:4); */ /* NMAX */
|
||||||
|
/* cio_write(img.tw*img.th,(version & 0x01)?8:4); */ /* M */
|
||||||
|
/* for (i=0;i<img.tw*img.th;i++) */
|
||||||
|
/* { */
|
||||||
|
/* cio_write(img.tile[i].start_pos,(version & 0x01)?8:4); */ /* start position */
|
||||||
|
/* cio_write(img.tile[i].end_header-img.tile[i].start_pos,(version & 0x01)?8:4); */ /* length */
|
||||||
|
/* if (version & 0x02)*/
|
||||||
|
/* cio_write(0,4); */ /* Aux_i,j : Auxiliary value */
|
||||||
|
/* } */
|
||||||
|
/* break; */
|
||||||
|
|
||||||
|
case 2: /* PPIX NOT FINISHED !! */
|
||||||
|
cio_write(img.num_packet_max,(version & 0x01)?8:4); /* NMAX */
|
||||||
|
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
|
||||||
|
for(tileno=0;tileno<img.tw*img.th;tileno++)
|
||||||
|
{
|
||||||
|
info_tile_t *tile_Idx = &img.tile[tileno];
|
||||||
|
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
|
||||||
|
int correction;
|
||||||
|
|
||||||
|
num_packet=0;
|
||||||
|
|
||||||
|
if(j2k_cp->tcps[tileno].csty&J2K_CP_CSTY_EPH)
|
||||||
|
correction=3;
|
||||||
|
else
|
||||||
|
correction=1;
|
||||||
|
for(resno=0;resno<img.Decomposition+1;resno++)
|
||||||
|
{
|
||||||
|
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
|
||||||
|
for (precno=0;precno<img.tile[tileno].pw*img.tile[tileno].ph;precno++)
|
||||||
|
{
|
||||||
|
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
|
||||||
|
for(layno=0;layno<img.Layer;layno++)
|
||||||
|
{
|
||||||
|
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
|
||||||
|
cio_write(layer_Idx->offset,(version & 0x01)?8:4); /* start position */
|
||||||
|
cio_write((layer_Idx->len_header-correction)?0:layer_Idx->len,(version & 0x01)?8:4); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* PADDING */
|
||||||
|
while (num_packet < img.num_packet_max)
|
||||||
|
{
|
||||||
|
cio_write(0,(version & 0x01)?8:4); /* start position */
|
||||||
|
cio_write(0,(version & 0x01)?8:4); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: /* PHIX NOT FINISHED !! */
|
||||||
|
cio_write(img.num_packet_max,(version & 0x01)?8:4); /* NMAX */
|
||||||
|
cio_write(img.tw*img.th,(version & 0x01)?8:4); /* M */
|
||||||
|
for(tileno=0;tileno<img.tw*img.th;tileno++)
|
||||||
|
{
|
||||||
|
info_tile_t *tile_Idx = &img.tile[tileno];
|
||||||
|
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
|
||||||
|
int correction;
|
||||||
|
|
||||||
|
num_packet = 0;
|
||||||
|
if(j2k_cp->tcps[tileno].csty&J2K_CP_CSTY_EPH)
|
||||||
|
correction=3;
|
||||||
|
else
|
||||||
|
correction=1;
|
||||||
|
for(resno=0;resno<img.Decomposition+1;resno++)
|
||||||
|
{
|
||||||
|
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
|
||||||
|
for (precno=0;precno<img.tile[tileno].pw*img.tile[tileno].ph;precno++)
|
||||||
|
{
|
||||||
|
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
|
||||||
|
for(layno=0;layno<img.Layer;layno++)
|
||||||
|
{
|
||||||
|
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
|
||||||
|
cio_write(layer_Idx->offset_header,(version & 0x01)?8:4); /* start position */
|
||||||
|
cio_write((layer_Idx->len_header-correction)?0:layer_Idx->len_header,(version & 0x01)?8:4); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* PADDING */
|
||||||
|
while (num_packet<img.num_packet_max)
|
||||||
|
{
|
||||||
|
cio_write(0,(version & 0x01)?8:4); /* start position */
|
||||||
|
cio_write(0,(version & 0x01)?8:4); /* length */
|
||||||
|
if (version & 0x02)
|
||||||
|
cio_write(0,4); /* Aux_i,j : Auxiliary value */
|
||||||
|
num_packet++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the TPIX box
|
||||||
|
*
|
||||||
|
* Tile-part Index table box (superbox)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_tpix(info_image_t img, j2k_cp_t *j2k_cp, int version)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_TPIX, 4); /* TPIX */
|
||||||
|
|
||||||
|
jpip_write_faix(0,0,img, j2k_cp, version);
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the THIX box
|
||||||
|
*
|
||||||
|
* Tile header Index table box (superbox)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//int jpip_write_thix(info_image_t img, j2k_cp_t *j2k_cp)
|
||||||
|
// {
|
||||||
|
// int len, lenp;
|
||||||
|
// lenp=cio_tell();
|
||||||
|
// cio_skip(4); /* L [at the end] */
|
||||||
|
// cio_write(JPIP_THIX, 4); /* THIX */
|
||||||
|
|
||||||
|
// jpip_write_faix(1,0,img, j2k_cp);
|
||||||
|
|
||||||
|
// len=cio_tell()-lenp;
|
||||||
|
// cio_seek(lenp);
|
||||||
|
// cio_write(len, 4); /* L */
|
||||||
|
// cio_seek(lenp+len);
|
||||||
|
|
||||||
|
// return len;
|
||||||
|
//}
|
||||||
|
|
||||||
|
int jpip_write_thix(info_image_t img, j2k_cp_t *j2k_cp)
|
||||||
|
{
|
||||||
|
int len, lenp, i;
|
||||||
|
int tileno;
|
||||||
|
info_marker_t *marker;
|
||||||
|
int num_marker_local_jpip;
|
||||||
|
|
||||||
|
marker = (info_marker_t*)calloc(sizeof(info_marker_t), j2k_cp->tw*j2k_cp->th);
|
||||||
|
|
||||||
|
for ( i = 0; i < 2 ; i++ )
|
||||||
|
{
|
||||||
|
if (i) cio_seek(lenp);
|
||||||
|
|
||||||
|
lenp = cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_THIX, 4); /* THIX */
|
||||||
|
jpip_write_manf(i, j2k_cp->tw*j2k_cp->th, marker);
|
||||||
|
num_marker_local_jpip=img.Comp;
|
||||||
|
|
||||||
|
for (tileno = 0; tileno < j2k_cp->tw*j2k_cp->th; tileno++)
|
||||||
|
{
|
||||||
|
marker[tileno].len = jpip_write_mhix(img, 1, tileno);
|
||||||
|
marker[tileno].type = JPIP_MHIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(marker);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Write the PPIX box
|
||||||
|
*
|
||||||
|
* Precinct Packet Index table box (superbox)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_ppix(info_image_t img,j2k_cp_t *j2k_cp)
|
||||||
|
{
|
||||||
|
int len, lenp, compno, i;
|
||||||
|
info_marker_t *marker;
|
||||||
|
int num_marker_local_jpip;
|
||||||
|
marker = (info_marker_t*)calloc(sizeof(info_marker_t), img.Comp);
|
||||||
|
|
||||||
|
for (i=0;i<2;i++)
|
||||||
|
{
|
||||||
|
if (i) cio_seek(lenp);
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_PPIX, 4); /* PPIX */
|
||||||
|
jpip_write_manf(i,img.Comp,marker);
|
||||||
|
num_marker_local_jpip=img.Comp;
|
||||||
|
|
||||||
|
for (compno=0; compno<img.Comp; compno++)
|
||||||
|
{
|
||||||
|
marker[compno].len=jpip_write_faix(2,compno,img, j2k_cp, 0);
|
||||||
|
marker[compno].type=JPIP_FAIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(marker);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the PHIX box
|
||||||
|
*
|
||||||
|
* Packet Header Index table box (superbox)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_phix(info_image_t img, j2k_cp_t *j2k_cp)
|
||||||
|
{
|
||||||
|
int len, lenp=0, compno, i;
|
||||||
|
info_marker_t *marker;
|
||||||
|
|
||||||
|
marker = (info_marker_t*)calloc(sizeof(info_marker_t), img.Comp);
|
||||||
|
|
||||||
|
for (i=0;i<2;i++)
|
||||||
|
{
|
||||||
|
if (i) cio_seek(lenp);
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_PHIX, 4); /* PHIX */
|
||||||
|
|
||||||
|
jpip_write_manf(i,img.Comp,marker);
|
||||||
|
|
||||||
|
for (compno=0; compno<img.Comp; compno++)
|
||||||
|
{
|
||||||
|
marker[compno].len=jpip_write_faix(3,compno,img, j2k_cp, 0);
|
||||||
|
marker[compno].type=JPIP_FAIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(marker);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the CIDX box
|
||||||
|
*
|
||||||
|
* Codestream Index box (superbox)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_cidx(int offset, info_image_t img, j2k_cp_t *j2k_cp, int version)
|
||||||
|
{
|
||||||
|
int len, lenp = 0, i;
|
||||||
|
info_marker_t *marker_jpip;
|
||||||
|
int num_marker_jpip = 0;
|
||||||
|
|
||||||
|
marker_jpip = (info_marker_t*)calloc(sizeof(info_marker_t), 32);
|
||||||
|
|
||||||
|
for (i=0;i<2;i++)
|
||||||
|
{
|
||||||
|
if(i)
|
||||||
|
cio_seek(lenp);
|
||||||
|
|
||||||
|
lenp=cio_tell();
|
||||||
|
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_CIDX, 4); /* CIDX */
|
||||||
|
jpip_write_cptr(offset, img);
|
||||||
|
|
||||||
|
jpip_write_manf(i,num_marker_jpip, marker_jpip);
|
||||||
|
|
||||||
|
num_marker_jpip=0;
|
||||||
|
marker_jpip[num_marker_jpip].len=jpip_write_mhix(img, 0, 0);
|
||||||
|
marker_jpip[num_marker_jpip].type=JPIP_MHIX;
|
||||||
|
num_marker_jpip++;
|
||||||
|
|
||||||
|
marker_jpip[num_marker_jpip].len=jpip_write_tpix(img, j2k_cp, version);
|
||||||
|
marker_jpip[num_marker_jpip].type=JPIP_TPIX;
|
||||||
|
num_marker_jpip++;
|
||||||
|
|
||||||
|
marker_jpip[num_marker_jpip].len=jpip_write_thix(img, j2k_cp);
|
||||||
|
marker_jpip[num_marker_jpip].type=JPIP_THIX;
|
||||||
|
num_marker_jpip++;
|
||||||
|
|
||||||
|
marker_jpip[num_marker_jpip].len=jpip_write_ppix(img, j2k_cp);
|
||||||
|
marker_jpip[num_marker_jpip].type=JPIP_PPIX;
|
||||||
|
num_marker_jpip++;
|
||||||
|
|
||||||
|
marker_jpip[num_marker_jpip].len=jpip_write_phix(img, j2k_cp);
|
||||||
|
marker_jpip[num_marker_jpip].type=JPIP_PHIX;
|
||||||
|
num_marker_jpip++;
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(marker_jpip);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the IPTR box
|
||||||
|
*
|
||||||
|
* Index Finder box
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_write_iptr(int offset, int length)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_IPTR, 4); /* IPTR */
|
||||||
|
|
||||||
|
cio_write(offset,8);
|
||||||
|
cio_write(length,8);
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the PRXY box
|
||||||
|
*
|
||||||
|
* proxy (box)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void jpip_write_prxy(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_PRXY, 4); /* IPTR */
|
||||||
|
|
||||||
|
cio_write(offset_jp2c,8); /* OOFF */
|
||||||
|
cio_write(length_jp2c,4); /* OBH part 1 */
|
||||||
|
cio_write(JP2C,4); /* OBH part 2 */
|
||||||
|
|
||||||
|
cio_write(1,1); /* NI */
|
||||||
|
|
||||||
|
cio_write(offset_idx,8); /* IOFF */
|
||||||
|
cio_write(length_idx,4); /* IBH part 1 */
|
||||||
|
cio_write(JPIP_CIDX,4); /* IBH part 2 */
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write the FIDX box
|
||||||
|
*
|
||||||
|
* File Index (superbox)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int jpip_write_fidx(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx)
|
||||||
|
{
|
||||||
|
int len, lenp;
|
||||||
|
lenp=cio_tell();
|
||||||
|
cio_skip(4); /* L [at the end] */
|
||||||
|
cio_write(JPIP_FIDX, 4); /* IPTR */
|
||||||
|
|
||||||
|
jpip_write_prxy(offset_jp2c, length_jp2c, offset_idx, offset_jp2c);
|
||||||
|
|
||||||
|
len=cio_tell()-lenp;
|
||||||
|
cio_seek(lenp);
|
||||||
|
cio_write(len, 4); /* L */
|
||||||
|
cio_seek(lenp+len);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
|
||||||
* Copyright (c) 2003, Yannick Verschueren
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -26,25 +25,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __OPENJPEG_H
|
#ifndef __JPIP_H
|
||||||
#define __OPENJPEG_H
|
#define __JPIP_H
|
||||||
|
|
||||||
#include <j2k.h>
|
#include "j2k.h"
|
||||||
#include <tcd.h>
|
|
||||||
#include <jp2.h>
|
|
||||||
#include <jpw.h>
|
|
||||||
|
|
||||||
#include <bio.h>
|
// Codestream index box (superbox)
|
||||||
#include <cio.h>
|
int jpip_write_cidx(int offset, info_image_t img, j2k_cp_t *j2k_cp, int version);
|
||||||
#include <dwt.h>
|
|
||||||
#include <fix.h>
|
// Index Finder Box
|
||||||
#include <int.h>
|
void jpip_write_iptr(int offset, int length);
|
||||||
#include <mct.h>
|
|
||||||
#include <mqc.h>
|
// File Index Box
|
||||||
#include <pi.h>
|
int jpip_write_fidx(int offset_jp2c, int length_jp2c, int offset_idx, int length_idx);
|
||||||
#include <raw.h>
|
|
||||||
#include <t1.h>
|
|
||||||
#include <t2.h>
|
|
||||||
#include <tgt.h>
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
465
indexer_JPIP/pi.c
Normal file
465
indexer_JPIP/pi.c
Normal file
@@ -0,0 +1,465 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003-2004, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003-2004, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pi.h"
|
||||||
|
#include "int.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Create a packet iterator. */
|
||||||
|
/* </summary> */
|
||||||
|
pi_iterator_t *pi_create(j2k_image_t * img, j2k_cp_t * cp, int tileno)
|
||||||
|
{
|
||||||
|
int p, q;
|
||||||
|
int compno, resno, pino;
|
||||||
|
int maxres = 0;
|
||||||
|
pi_iterator_t *pi;
|
||||||
|
j2k_tcp_t *tcp;
|
||||||
|
j2k_tccp_t *tccp;
|
||||||
|
|
||||||
|
tcp = &cp->tcps[tileno];
|
||||||
|
pi = (pi_iterator_t *) malloc((tcp->numpocs + 1) * sizeof(pi_iterator_t));
|
||||||
|
|
||||||
|
for (pino = 0; pino < tcp->numpocs + 1; pino++) { /* change */
|
||||||
|
p = tileno % cp->tw;
|
||||||
|
q = tileno / cp->tw;
|
||||||
|
|
||||||
|
pi[pino].tx0 = int_max(cp->tx0 + p * cp->tdx, img->x0);
|
||||||
|
pi[pino].ty0 = int_max(cp->ty0 + q * cp->tdy, img->y0);
|
||||||
|
pi[pino].tx1 = int_min(cp->tx0 + (p + 1) * cp->tdx, img->x1);
|
||||||
|
pi[pino].ty1 = int_min(cp->ty0 + (q + 1) * cp->tdy, img->y1);
|
||||||
|
pi[pino].numcomps = img->numcomps;
|
||||||
|
pi[pino].comps = (pi_comp_t *) malloc(img->numcomps * sizeof(pi_comp_t));
|
||||||
|
|
||||||
|
for (compno = 0; compno < pi->numcomps; compno++) {
|
||||||
|
int tcx0, tcy0, tcx1, tcy1;
|
||||||
|
pi_comp_t *comp = &pi[pino].comps[compno];
|
||||||
|
tccp = &tcp->tccps[compno];
|
||||||
|
comp->dx = img->comps[compno].dx;
|
||||||
|
comp->dy = img->comps[compno].dy;
|
||||||
|
comp->numresolutions = tccp->numresolutions;
|
||||||
|
comp->resolutions =
|
||||||
|
(pi_resolution_t *) malloc(comp->numresolutions *
|
||||||
|
sizeof(pi_resolution_t));
|
||||||
|
tcx0 = int_ceildiv(pi->tx0, comp->dx);
|
||||||
|
tcy0 = int_ceildiv(pi->ty0, comp->dy);
|
||||||
|
tcx1 = int_ceildiv(pi->tx1, comp->dx);
|
||||||
|
tcy1 = int_ceildiv(pi->ty1, comp->dy);
|
||||||
|
if (comp->numresolutions > maxres) {
|
||||||
|
maxres = comp->numresolutions;
|
||||||
|
}
|
||||||
|
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||||
|
int levelno;
|
||||||
|
int rx0, ry0, rx1, ry1;
|
||||||
|
int px0, py0, px1, py1;
|
||||||
|
pi_resolution_t *res = &comp->resolutions[resno];
|
||||||
|
if (tccp->csty & J2K_CCP_CSTY_PRT) {
|
||||||
|
res->pdx = tccp->prcw[resno];
|
||||||
|
res->pdy = tccp->prch[resno];
|
||||||
|
} else {
|
||||||
|
res->pdx = 15;
|
||||||
|
res->pdy = 15;
|
||||||
|
}
|
||||||
|
levelno = comp->numresolutions - 1 - resno;
|
||||||
|
rx0 = int_ceildivpow2(tcx0, levelno);
|
||||||
|
ry0 = int_ceildivpow2(tcy0, levelno);
|
||||||
|
rx1 = int_ceildivpow2(tcx1, levelno);
|
||||||
|
ry1 = int_ceildivpow2(tcy1, levelno);
|
||||||
|
px0 = int_floordivpow2(rx0, res->pdx) << res->pdx;
|
||||||
|
py0 = int_floordivpow2(ry0, res->pdy) << res->pdy;
|
||||||
|
px1 = int_ceildivpow2(rx1, res->pdx) << res->pdx;
|
||||||
|
py1 = int_ceildivpow2(ry1, res->pdy) << res->pdy;
|
||||||
|
res->pw = (px1 - px0) >> res->pdx;
|
||||||
|
res->ph = (py1 - py0) >> res->pdy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tccp = &tcp->tccps[0];
|
||||||
|
pi[pino].step_p=1;
|
||||||
|
pi[pino].step_c=100*pi[pino].step_p;
|
||||||
|
pi[pino].step_r=img->numcomps*pi[pino].step_c;
|
||||||
|
pi[pino].step_l=maxres*pi[pino].step_r;
|
||||||
|
|
||||||
|
if (pino==0)
|
||||||
|
pi[pino].include=(short int*)calloc(img->numcomps*maxres*tcp->numlayers*100,sizeof(short int));
|
||||||
|
else
|
||||||
|
pi[pino].include=pi[pino-1].include;
|
||||||
|
|
||||||
|
/*if (pino == tcp->numpocs) {*/
|
||||||
|
if (tcp->POC == 0) {
|
||||||
|
pi[pino].first = 1;
|
||||||
|
pi[pino].poc.resno0 = 0;
|
||||||
|
pi[pino].poc.compno0 = 0;
|
||||||
|
pi[pino].poc.layno1 = tcp->numlayers;
|
||||||
|
pi[pino].poc.resno1 = maxres;
|
||||||
|
pi[pino].poc.compno1 = img->numcomps;
|
||||||
|
pi[pino].poc.prg = tcp->prg;
|
||||||
|
} else {
|
||||||
|
pi[pino].first = 1;
|
||||||
|
pi[pino].poc.resno0 = tcp->pocs[pino].resno0;
|
||||||
|
pi[pino].poc.compno0 = tcp->pocs[pino].compno0;
|
||||||
|
pi[pino].poc.layno1 = tcp->pocs[pino].layno1;
|
||||||
|
pi[pino].poc.resno1 = tcp->pocs[pino].resno1;
|
||||||
|
pi[pino].poc.compno1 = tcp->pocs[pino].compno1;
|
||||||
|
pi[pino].poc.prg = tcp->pocs[pino].prg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Get next packet in layer=resolution-component-precinct order. */
|
||||||
|
/* </summary> */
|
||||||
|
int pi_next_lrcp(pi_iterator_t * pi)
|
||||||
|
{
|
||||||
|
pi_comp_t *comp;
|
||||||
|
pi_resolution_t *res;
|
||||||
|
|
||||||
|
if (!pi->first) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
goto skip;
|
||||||
|
} else {
|
||||||
|
pi->first = 0;
|
||||||
|
}
|
||||||
|
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||||
|
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1;
|
||||||
|
pi->resno++) {
|
||||||
|
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||||
|
pi->compno++) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
if (pi->resno >= comp->numresolutions) {
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
|
||||||
|
if (!pi->include[pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p]){
|
||||||
|
pi->include[pi->layno * pi->step_l + pi->resno * pi->step_r + pi->compno * pi->step_c + pi->precno * pi->step_p] = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
skip:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Get next packet in resolution-layer-component-precinct order. */
|
||||||
|
/* </summary> */
|
||||||
|
int pi_next_rlcp(pi_iterator_t * pi)
|
||||||
|
{
|
||||||
|
pi_comp_t *comp;
|
||||||
|
pi_resolution_t *res;
|
||||||
|
if (!pi->first) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
goto skip;
|
||||||
|
} else {
|
||||||
|
pi->first = 0;
|
||||||
|
}
|
||||||
|
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
|
||||||
|
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||||
|
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||||
|
pi->compno++) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
if (pi->resno >= comp->numresolutions) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
for (pi->precno = 0; pi->precno < res->pw * res->ph; pi->precno++) {
|
||||||
|
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||||
|
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
skip:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Get next packet in resolution-precinct-component-layer order. */
|
||||||
|
/* </summary> */
|
||||||
|
int pi_next_rpcl(pi_iterator_t * pi)
|
||||||
|
{
|
||||||
|
pi_comp_t *comp;
|
||||||
|
pi_resolution_t *res;
|
||||||
|
if (!pi->first) {
|
||||||
|
goto skip;
|
||||||
|
} else {
|
||||||
|
int compno, resno;
|
||||||
|
pi->first = 0;
|
||||||
|
pi->dx = 0;
|
||||||
|
pi->dy = 0;
|
||||||
|
for (compno = 0; compno < pi->numcomps; compno++) {
|
||||||
|
comp = &pi->comps[compno];
|
||||||
|
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||||
|
int dx, dy;
|
||||||
|
res = &comp->resolutions[resno];
|
||||||
|
dx =
|
||||||
|
comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
|
||||||
|
dy =
|
||||||
|
comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
|
||||||
|
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
|
||||||
|
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (pi->resno = pi->poc.resno0; pi->resno < pi->poc.resno1; pi->resno++) {
|
||||||
|
for (pi->y = pi->ty0; pi->y < pi->ty1;
|
||||||
|
pi->y += pi->dy - (pi->y % pi->dy)) {
|
||||||
|
for (pi->x = pi->tx0; pi->x < pi->tx1;
|
||||||
|
pi->x += pi->dx - (pi->x % pi->dx)) {
|
||||||
|
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||||
|
pi->compno++) {
|
||||||
|
int levelno;
|
||||||
|
int trx0, try0;
|
||||||
|
int rpx, rpy;
|
||||||
|
int prci, prcj;
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
if (pi->resno >= comp->numresolutions) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
levelno = comp->numresolutions - 1 - pi->resno;
|
||||||
|
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
|
||||||
|
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
|
||||||
|
rpx = res->pdx + levelno;
|
||||||
|
rpy = res->pdy + levelno;
|
||||||
|
if (!
|
||||||
|
(pi->x % (comp->dx << rpx) == 0
|
||||||
|
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!
|
||||||
|
(pi->y % (comp->dy << rpy) == 0
|
||||||
|
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
prci =
|
||||||
|
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
|
||||||
|
res->pdx) - int_floordivpow2(trx0, res->pdx);
|
||||||
|
prcj =
|
||||||
|
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
|
||||||
|
res->pdy) - int_floordivpow2(try0, res->pdy);
|
||||||
|
pi->precno = prci + prcj * res->pw;
|
||||||
|
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||||
|
if (!pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||||
|
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
skip:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Get next packet in precinct-component-resolution-layer order. */
|
||||||
|
/* </summary> */
|
||||||
|
int pi_next_pcrl(pi_iterator_t * pi)
|
||||||
|
{
|
||||||
|
pi_comp_t *comp;
|
||||||
|
pi_resolution_t *res;
|
||||||
|
if (!pi->first) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
goto skip;
|
||||||
|
} else {
|
||||||
|
int compno, resno;
|
||||||
|
pi->first = 0;
|
||||||
|
pi->dx = 0;
|
||||||
|
pi->dy = 0;
|
||||||
|
for (compno = 0; compno < pi->numcomps; compno++) {
|
||||||
|
comp = &pi->comps[compno];
|
||||||
|
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||||
|
int dx, dy;
|
||||||
|
res = &comp->resolutions[resno];
|
||||||
|
dx =
|
||||||
|
comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
|
||||||
|
dy =
|
||||||
|
comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
|
||||||
|
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
|
||||||
|
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (pi->y = pi->ty0; pi->y < pi->ty1;
|
||||||
|
pi->y += pi->dy - (pi->y % pi->dy)) {
|
||||||
|
for (pi->x = pi->tx0; pi->x < pi->tx1;
|
||||||
|
pi->x += pi->dx - (pi->x % pi->dx)) {
|
||||||
|
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||||
|
pi->compno++) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
for (pi->resno = pi->poc.resno0;
|
||||||
|
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
|
||||||
|
pi->resno++) {
|
||||||
|
int levelno;
|
||||||
|
int trx0, try0;
|
||||||
|
int rpx, rpy;
|
||||||
|
int prci, prcj;
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
levelno = comp->numresolutions - 1 - pi->resno;
|
||||||
|
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
|
||||||
|
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
|
||||||
|
rpx = res->pdx + levelno;
|
||||||
|
rpy = res->pdy + levelno;
|
||||||
|
if (!
|
||||||
|
(pi->x % (comp->dx << rpx) == 0
|
||||||
|
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!
|
||||||
|
(pi->y % (comp->dy << rpy) == 0
|
||||||
|
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
prci =
|
||||||
|
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
|
||||||
|
res->pdx) - int_floordivpow2(trx0, res->pdx);
|
||||||
|
prcj =
|
||||||
|
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
|
||||||
|
res->pdy) - int_floordivpow2(try0, res->pdy);
|
||||||
|
pi->precno = prci + prcj * res->pw;
|
||||||
|
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||||
|
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||||
|
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
skip:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Get next packet in component-precinct-resolution-layer order. */
|
||||||
|
/* </summary> */
|
||||||
|
int pi_next_cprl(pi_iterator_t * pi)
|
||||||
|
{
|
||||||
|
pi_comp_t *comp;
|
||||||
|
pi_resolution_t *res;
|
||||||
|
if (!pi->first) {
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
goto skip;
|
||||||
|
} else {
|
||||||
|
pi->first = 0;
|
||||||
|
}
|
||||||
|
for (pi->compno = pi->poc.compno0; pi->compno < pi->poc.compno1;
|
||||||
|
pi->compno++) {
|
||||||
|
int resno;
|
||||||
|
comp = &pi->comps[pi->compno];
|
||||||
|
pi->dx = 0;
|
||||||
|
pi->dy = 0;
|
||||||
|
for (resno = 0; resno < comp->numresolutions; resno++) {
|
||||||
|
int dx, dy;
|
||||||
|
res = &comp->resolutions[resno];
|
||||||
|
dx = comp->dx * (1 << (res->pdx + comp->numresolutions - 1 - resno));
|
||||||
|
dy = comp->dy * (1 << (res->pdy + comp->numresolutions - 1 - resno));
|
||||||
|
pi->dx = !pi->dx ? dx : int_min(pi->dx, dx);
|
||||||
|
pi->dy = !pi->dy ? dy : int_min(pi->dy, dy);
|
||||||
|
}
|
||||||
|
for (pi->y = pi->ty0; pi->y < pi->ty1;
|
||||||
|
pi->y += pi->dy - (pi->y % pi->dy)) {
|
||||||
|
for (pi->x = pi->tx0; pi->x < pi->tx1;
|
||||||
|
pi->x += pi->dx - (pi->x % pi->dx)) {
|
||||||
|
for (pi->resno = pi->poc.resno0;
|
||||||
|
pi->resno < int_min(pi->poc.resno1, comp->numresolutions);
|
||||||
|
pi->resno++) {
|
||||||
|
int levelno;
|
||||||
|
int trx0, try0;
|
||||||
|
int rpx, rpy;
|
||||||
|
int prci, prcj;
|
||||||
|
res = &comp->resolutions[pi->resno];
|
||||||
|
levelno = comp->numresolutions - 1 - pi->resno;
|
||||||
|
trx0 = int_ceildiv(pi->tx0, comp->dx << levelno);
|
||||||
|
try0 = int_ceildiv(pi->ty0, comp->dy << levelno);
|
||||||
|
rpx = res->pdx + levelno;
|
||||||
|
rpy = res->pdy + levelno;
|
||||||
|
if (!
|
||||||
|
(pi->x % (comp->dx << rpx) == 0
|
||||||
|
|| (pi->x == pi->tx0 && (trx0 << levelno) % (1 << rpx)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!
|
||||||
|
(pi->y % (comp->dy << rpy) == 0
|
||||||
|
|| (pi->y == pi->ty0 && (try0 << levelno) % (1 << rpx)))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
prci =
|
||||||
|
int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno),
|
||||||
|
res->pdx) - int_floordivpow2(trx0, res->pdx);
|
||||||
|
prcj =
|
||||||
|
int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno),
|
||||||
|
res->pdy) - int_floordivpow2(try0, res->pdy);
|
||||||
|
pi->precno = prci + prcj * res->pw;
|
||||||
|
for (pi->layno = 0; pi->layno < pi->poc.layno1; pi->layno++) {
|
||||||
|
if (! pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p]){
|
||||||
|
pi->include[pi->layno*pi->step_l+pi->resno*pi->step_r+pi->compno*pi->step_c+pi->precno*pi->step_p] = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
skip:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* <summary> */
|
||||||
|
/* Get next packet. */
|
||||||
|
/* </summary> */
|
||||||
|
int pi_next(pi_iterator_t * pi)
|
||||||
|
{
|
||||||
|
switch (pi->poc.prg) {
|
||||||
|
case 0:
|
||||||
|
return pi_next_lrcp(pi);
|
||||||
|
case 1:
|
||||||
|
return pi_next_rlcp(pi);
|
||||||
|
case 2:
|
||||||
|
return pi_next_rpcl(pi);
|
||||||
|
case 3:
|
||||||
|
return pi_next_pcrl(pi);
|
||||||
|
case 4:
|
||||||
|
return pi_next_cprl(pi);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -31,27 +31,27 @@
|
|||||||
#include "tcd.h"
|
#include "tcd.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int pdx, pdy;
|
int pdx, pdy;
|
||||||
int pw, ph;
|
int pw, ph;
|
||||||
} pi_resolution_t;
|
} pi_resolution_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
int numresolutions;
|
int numresolutions;
|
||||||
pi_resolution_t *resolutions;
|
pi_resolution_t *resolutions;
|
||||||
} pi_comp_t;
|
} pi_comp_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
short int *include; /* precise if the packet has been already used (usefull for progression order change) */
|
short int *include;
|
||||||
int step_l, step_r, step_c, step_p; /* different steps (layer, resolution, component, precinct) to localize the packet in the include vector */
|
int step_l, step_r, step_c, step_p;
|
||||||
int compno, resno, precno, layno; /* component, resolution, precinct and layer that indentify the packet */
|
int compno, resno, precno, layno; /* component, resolution, precinct and layer that indentify the packet */
|
||||||
int first; /* 0 if the first packet */
|
int first;
|
||||||
j2k_poc_t poc;
|
j2k_poc_t poc;
|
||||||
int numcomps;
|
int numcomps;
|
||||||
pi_comp_t *comps;
|
pi_comp_t *comps;
|
||||||
int tx0, ty0, tx1, ty1;
|
int tx0, ty0, tx1, ty1;
|
||||||
int x, y, dx, dy;
|
int x, y, dx, dy;
|
||||||
} pi_iterator_t; /* packet iterator */
|
} pi_iterator_t; /* packet iterator */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a packet iterator
|
* Create a packet iterator
|
||||||
389
indexer_JPIP/t2.c
Normal file
389
indexer_JPIP/t2.c
Normal file
@@ -0,0 +1,389 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "t2.h"
|
||||||
|
#include "tcd.h"
|
||||||
|
#include "bio.h"
|
||||||
|
#include "j2k.h"
|
||||||
|
#include "pi.h"
|
||||||
|
#include "tgt.h"
|
||||||
|
#include "int.h"
|
||||||
|
#include "cio.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define RESTART 0x04
|
||||||
|
|
||||||
|
extern jmp_buf j2k_error;
|
||||||
|
|
||||||
|
int t2_getcommacode() {
|
||||||
|
int n;
|
||||||
|
for (n=0; bio_read(1); n++) {}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int t2_getnumpasses()
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
if (!bio_read(1)) return 1;
|
||||||
|
if (!bio_read(1)) return 2;
|
||||||
|
if ((n=bio_read(2))!=3) return 3+n;
|
||||||
|
if ((n=bio_read(5))!=31) return 6+n;
|
||||||
|
return 37+bio_read(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
void t2_init_seg(tcd_seg_t *seg, int cblksty) {
|
||||||
|
seg->numpasses=0;
|
||||||
|
seg->len=0;
|
||||||
|
seg->maxpasses=cblksty&J2K_CCP_CBLKSTY_TERMALL?1:100;
|
||||||
|
}
|
||||||
|
|
||||||
|
int t2_decode_packet(unsigned char *src, int len, tcd_tile_t *tile, j2k_cp_t * cp, j2k_tcp_t *tcp, int compno, int resno, int precno, int layno, info_layer_t *layer_Idx) {
|
||||||
|
int bandno, cblkno;
|
||||||
|
tcd_tilecomp_t *tilec = &tile->comps[compno];
|
||||||
|
tcd_resolution_t *res = &tilec->resolutions[resno];
|
||||||
|
unsigned char *c = src;
|
||||||
|
unsigned char *d = c;
|
||||||
|
int e;
|
||||||
|
int present;
|
||||||
|
|
||||||
|
if (layno == 0) {
|
||||||
|
for (bandno = 0; bandno < res->numbands; bandno++) {
|
||||||
|
tcd_band_t *band = &res->bands[bandno];
|
||||||
|
tcd_precinct_t *prc = &band->precincts[precno];
|
||||||
|
tgt_reset(prc->incltree);
|
||||||
|
tgt_reset(prc->imsbtree);
|
||||||
|
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
|
||||||
|
tcd_cblk_t *cblk = &prc->cblks[cblkno];
|
||||||
|
cblk->numsegs = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* INDEX */
|
||||||
|
layer_Idx->len_header = 0;
|
||||||
|
|
||||||
|
/* When the marker PPT/PPM is used the packet header are store in PPT/PPM marker
|
||||||
|
This part deal with this caracteristic
|
||||||
|
step 1: Read packet header in the saved structure
|
||||||
|
step 2: (futher) return to codestream for decoding */
|
||||||
|
if (cp->ppm == 1) /* PPM */
|
||||||
|
{
|
||||||
|
c = cp->ppm_data;
|
||||||
|
d = c;
|
||||||
|
bio_init_dec(c, 1000);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (tcp->ppt == 1) /* PPT */
|
||||||
|
{
|
||||||
|
c = tcp->ppt_data;
|
||||||
|
d = c;
|
||||||
|
bio_init_dec(c, 1000);
|
||||||
|
} else /* Normal Case */
|
||||||
|
{
|
||||||
|
if (tcp->csty & J2K_CP_CSTY_SOP)
|
||||||
|
{
|
||||||
|
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [1]!!!\n");}
|
||||||
|
c += 6;
|
||||||
|
}
|
||||||
|
bio_init_dec(c, src + len - c);
|
||||||
|
layer_Idx->len_header = -6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
present = bio_read(1);
|
||||||
|
|
||||||
|
if (!present)
|
||||||
|
{
|
||||||
|
bio_inalign();
|
||||||
|
/* Normal case */
|
||||||
|
c += bio_numbytes();
|
||||||
|
if (tcp->csty & J2K_CP_CSTY_EPH)
|
||||||
|
{
|
||||||
|
if ((*c) != 255 || (*(c+1) != 146)) {printf("Error : expected EPH marker [1]!!!\n");}
|
||||||
|
c += 2;
|
||||||
|
}
|
||||||
|
/* INDEX */
|
||||||
|
layer_Idx->len_header += (c-d);
|
||||||
|
|
||||||
|
/* PPT and PPM dealing */
|
||||||
|
if (cp->ppm == 1) /* PPM */
|
||||||
|
{
|
||||||
|
cp->ppm_data = c;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (tcp->ppt == 1) /* PPT */
|
||||||
|
{
|
||||||
|
tcp->ppt_data = c;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return c - src;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (bandno=0; bandno<res->numbands; bandno++) {
|
||||||
|
tcd_band_t *band = &res->bands[bandno];
|
||||||
|
tcd_precinct_t *prc = &band->precincts[precno];
|
||||||
|
for (cblkno = 0; cblkno < prc->cw * prc->ch; cblkno++) {
|
||||||
|
int included, increment, n;
|
||||||
|
tcd_cblk_t *cblk = &prc->cblks[cblkno];
|
||||||
|
tcd_seg_t *seg;
|
||||||
|
if (!cblk->numsegs) {
|
||||||
|
included = tgt_decode(prc->incltree, cblkno, layno+1);
|
||||||
|
} else {
|
||||||
|
included = bio_read(1);
|
||||||
|
}
|
||||||
|
if (!included) {
|
||||||
|
cblk->numnewpasses = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!cblk->numsegs) {
|
||||||
|
int i, numimsbs;
|
||||||
|
for (i = 0; !tgt_decode(prc->imsbtree, cblkno, i); i++) {}
|
||||||
|
numimsbs = i-1;
|
||||||
|
cblk->numbps = band->numbps - numimsbs;
|
||||||
|
cblk->numlenbits = 3;
|
||||||
|
}
|
||||||
|
cblk->numnewpasses = t2_getnumpasses();
|
||||||
|
increment = t2_getcommacode();
|
||||||
|
cblk->numlenbits += increment;
|
||||||
|
if (!cblk->numsegs) {
|
||||||
|
seg = &cblk->segs[0];
|
||||||
|
t2_init_seg(seg, tcp->tccps[compno].cblksty);
|
||||||
|
} else {
|
||||||
|
seg = &cblk->segs[cblk->numsegs - 1];
|
||||||
|
if (seg->numpasses == seg->maxpasses) {
|
||||||
|
t2_init_seg(++seg, tcp->tccps[compno].cblksty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n = cblk->numnewpasses;
|
||||||
|
do {
|
||||||
|
seg->numnewpasses = int_min(seg->maxpasses-seg->numpasses, n);
|
||||||
|
seg->newlen = bio_read(cblk->numlenbits + int_floorlog2(seg->numnewpasses));
|
||||||
|
n -= seg->numnewpasses;
|
||||||
|
if (n > 0) {
|
||||||
|
t2_init_seg(++seg, tcp->tccps[compno].cblksty);
|
||||||
|
}
|
||||||
|
} while (n > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(bio_inalign()) return -999;
|
||||||
|
c += bio_numbytes();
|
||||||
|
|
||||||
|
if (tcp->csty & J2K_CP_CSTY_EPH) { /* EPH marker */
|
||||||
|
if ((*c) != 255 || (*(c+1) != 146)) {printf("Error : expected EPH marker [2]!!!\n"); }
|
||||||
|
c += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* INDEX */
|
||||||
|
layer_Idx->len_header += (c-d);
|
||||||
|
|
||||||
|
/* PPT Step 2 : see above for details */
|
||||||
|
if (cp->ppm == 1)
|
||||||
|
{
|
||||||
|
cp->ppm_data = c; /* Update pointer */
|
||||||
|
|
||||||
|
/* INDEX */
|
||||||
|
layer_Idx->len_header = c-d;
|
||||||
|
|
||||||
|
c = src;
|
||||||
|
d = c;
|
||||||
|
if (tcp->csty & J2K_CP_CSTY_SOP)
|
||||||
|
{
|
||||||
|
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [2] !!!\n"); }
|
||||||
|
c += 6;
|
||||||
|
}
|
||||||
|
bio_init_dec(c, src + len - c);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (tcp->ppt == 1)
|
||||||
|
{
|
||||||
|
tcp->ppt_data = c; /* Update pointer */
|
||||||
|
/* INDEX */
|
||||||
|
layer_Idx->len_header = c-d;
|
||||||
|
|
||||||
|
c = src;
|
||||||
|
d = c;
|
||||||
|
if (tcp->csty & J2K_CP_CSTY_SOP) /* SOP marker */
|
||||||
|
{
|
||||||
|
if ((*c) != 255 || (*(c+1) != 145)) {printf("Error : expected SOP marker [2] !!!\n"); }
|
||||||
|
c += 6;
|
||||||
|
}
|
||||||
|
bio_init_dec(c, src + len - c);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (bandno = 0; bandno < res->numbands; bandno++) {
|
||||||
|
tcd_band_t *band = &res->bands[bandno];
|
||||||
|
tcd_precinct_t *prc = &band->precincts[precno];
|
||||||
|
for (cblkno = 0; cblkno < prc->cw*prc->ch; cblkno++) {
|
||||||
|
tcd_cblk_t *cblk = &prc->cblks[cblkno];
|
||||||
|
tcd_seg_t *seg;
|
||||||
|
if (!cblk->numnewpasses) continue;
|
||||||
|
if (!cblk->numsegs) {
|
||||||
|
seg = &cblk->segs[cblk->numsegs++];
|
||||||
|
cblk->len = 0;
|
||||||
|
} else {
|
||||||
|
seg = &cblk->segs[cblk->numsegs-1];
|
||||||
|
if (seg->numpasses == seg->maxpasses) {
|
||||||
|
seg++;
|
||||||
|
cblk->numsegs++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
if (c + seg->newlen > src + len) return -999;
|
||||||
|
memcpy(cblk->data + cblk->len, c, seg->newlen);
|
||||||
|
if (seg->numpasses == 0) {
|
||||||
|
seg->data = cblk->data + cblk->len;
|
||||||
|
}
|
||||||
|
c += seg->newlen;
|
||||||
|
cblk->len += seg->newlen;
|
||||||
|
seg->len += seg->newlen;
|
||||||
|
seg->numpasses += seg->numnewpasses;
|
||||||
|
cblk->numnewpasses -= seg->numnewpasses;
|
||||||
|
if (cblk->numnewpasses > 0) {
|
||||||
|
seg++;
|
||||||
|
cblk->numsegs++;
|
||||||
|
}
|
||||||
|
} while (cblk->numnewpasses > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* <INDEX> */
|
||||||
|
e = c-d;
|
||||||
|
layer_Idx->len = e;
|
||||||
|
/* </INDEX> */
|
||||||
|
|
||||||
|
return c-src;
|
||||||
|
}
|
||||||
|
|
||||||
|
void t2_init_info_packets(info_image_t *img, j2k_cp_t *cp)
|
||||||
|
{
|
||||||
|
int compno, tileno, resno, precno, layno;
|
||||||
|
|
||||||
|
for(compno = 0; compno < img->Comp; compno++)
|
||||||
|
{
|
||||||
|
for(tileno = 0; tileno < img->tw*img->th; tileno++)
|
||||||
|
{
|
||||||
|
info_tile_t *tile_Idx = &img->tile[tileno];
|
||||||
|
info_compo_t *compo_Idx = &tile_Idx->compo[compno];
|
||||||
|
for(resno = 0; resno < img->Decomposition + 1 ; resno++)
|
||||||
|
{
|
||||||
|
info_reso_t *reso_Idx = &compo_Idx->reso[resno];
|
||||||
|
for (precno = 0; precno < img->tile[tileno].pw * img->tile[tileno].ph; precno++)
|
||||||
|
{
|
||||||
|
info_prec_t *prec_Idx = &reso_Idx->prec[precno];
|
||||||
|
for(layno = 0; layno < img->Layer ; layno++)
|
||||||
|
{
|
||||||
|
info_layer_t *layer_Idx = &prec_Idx->layer[layno];
|
||||||
|
layer_Idx->offset = 0; /* start position */
|
||||||
|
layer_Idx->len_header = 0; /* length */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int t2_decode_packets(unsigned char *src, int len, j2k_image_t *img, j2k_cp_t *cp, int tileno, tcd_tile_t *tile, info_image_t *imgg) {
|
||||||
|
unsigned char *c = src;
|
||||||
|
pi_iterator_t *pi;
|
||||||
|
int pino, compno,e;
|
||||||
|
int partno;
|
||||||
|
info_tile_part_t *tile_part;
|
||||||
|
int position;
|
||||||
|
int length_read;
|
||||||
|
info_tile_t *tile_Idx;
|
||||||
|
info_compo_t *compo_Idx;
|
||||||
|
info_reso_t *reso_Idx;
|
||||||
|
info_prec_t *prec_Idx;
|
||||||
|
info_layer_t *layer_Idx;
|
||||||
|
|
||||||
|
t2_init_info_packets(imgg, cp); /* Initialize the packets information : LEN and OFFSET to 0 */
|
||||||
|
|
||||||
|
tile_Idx = &imgg->tile[tileno];
|
||||||
|
tile_Idx->num_packet = 0;
|
||||||
|
pi = pi_create(img, cp, tileno);
|
||||||
|
partno = 0;
|
||||||
|
tile_part = &tile_Idx->tile_parts[partno];
|
||||||
|
position = tile_part->end_header + 1;
|
||||||
|
length_read = 0;
|
||||||
|
|
||||||
|
for (pino = 0; pino <= cp->tcps[tileno].numpocs; pino++)
|
||||||
|
{
|
||||||
|
while (pi_next(&pi[pino]))
|
||||||
|
{
|
||||||
|
compo_Idx = &tile_Idx->compo[pi[pino].compno];
|
||||||
|
reso_Idx = &compo_Idx->reso[pi[pino].resno];
|
||||||
|
prec_Idx = &reso_Idx->prec[pi[pino].precno];
|
||||||
|
layer_Idx = &prec_Idx->layer[pi[pino].layno];
|
||||||
|
|
||||||
|
layer_Idx->offset = position;
|
||||||
|
layer_Idx->offset_header = position;
|
||||||
|
|
||||||
|
e = t2_decode_packet(c, src+len-c, tile, cp, &cp->tcps[tileno], pi[pino].compno, pi[pino].resno, pi[pino].precno, pi[pino].layno,layer_Idx);
|
||||||
|
if (e == -999)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
c += e;
|
||||||
|
position += e;
|
||||||
|
|
||||||
|
/* Update position in case of multiple tile-parts for a tile >> */
|
||||||
|
length_read += e;
|
||||||
|
if (length_read >= (tile_part->end_pos - tile_part->end_header))
|
||||||
|
{
|
||||||
|
partno++;
|
||||||
|
tile_part = &tile_Idx->tile_parts[partno];
|
||||||
|
position = tile_part->end_header + 1;
|
||||||
|
length_read = 0;
|
||||||
|
}
|
||||||
|
/* << end_update */
|
||||||
|
|
||||||
|
tile_Idx->num_packet++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FREE space memory taken by pi
|
||||||
|
for (compno = 0; compno < pi[pino].numcomps; compno++)
|
||||||
|
{
|
||||||
|
free(pi[pino].comps[compno].resolutions);
|
||||||
|
}
|
||||||
|
free(pi[pino].comps);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(pi[0].include);
|
||||||
|
free(pi);
|
||||||
|
|
||||||
|
if (e==-999)
|
||||||
|
return e;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imgg->num_packet_max=int_max(imgg->num_packet_max,tile_Idx->num_packet);
|
||||||
|
return c-src;
|
||||||
|
}
|
||||||
|
}
|
||||||
46
indexer_JPIP/t2.h
Normal file
46
indexer_JPIP/t2.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __T2_H
|
||||||
|
#define __T2_H
|
||||||
|
|
||||||
|
#include "tcd.h"
|
||||||
|
#include "j2k.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Decode the packets of a tile from a source buffer
|
||||||
|
* src: the source buffer
|
||||||
|
* len: length of the source buffer
|
||||||
|
* img: destination image
|
||||||
|
* cp: image coding parameters
|
||||||
|
* tileno: number that identifies the tile for which to decode the packets
|
||||||
|
* tile: tile for which to decode the packets
|
||||||
|
*/
|
||||||
|
int t2_decode_packets(unsigned char *src, int len, j2k_image_t *img, j2k_cp_t *cp, int tileno, tcd_tile_t *tile, info_image_t *imgg);
|
||||||
|
|
||||||
|
#endif
|
||||||
285
indexer_JPIP/tcd.c
Normal file
285
indexer_JPIP/tcd.c
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tcd.h"
|
||||||
|
#include "int.h"
|
||||||
|
#include "t2.h"
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <float.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
static tcd_image_t tcd_image;
|
||||||
|
|
||||||
|
static j2k_image_t *tcd_img;
|
||||||
|
static j2k_cp_t *tcd_cp;
|
||||||
|
|
||||||
|
extern jmp_buf j2k_error;
|
||||||
|
|
||||||
|
void tcd_init(j2k_image_t *img, j2k_cp_t *cp, info_image_t *imgg) {
|
||||||
|
int tileno, compno, resno, bandno, precno, cblkno;
|
||||||
|
tcd_img=img;
|
||||||
|
tcd_cp=cp;
|
||||||
|
tcd_image.tw=cp->tw;
|
||||||
|
tcd_image.th=cp->th;
|
||||||
|
tcd_image.tiles=(tcd_tile_t*)malloc(cp->tw*cp->th*sizeof(tcd_tile_t));
|
||||||
|
for (tileno=0; tileno<cp->tw*cp->th; tileno++) {
|
||||||
|
j2k_tcp_t *tcp=&cp->tcps[tileno];
|
||||||
|
tcd_tile_t *tile=&tcd_image.tiles[tileno];
|
||||||
|
// cfr p59 ISO/IEC FDIS15444-1 : 2000 (18 august 2000)
|
||||||
|
int p=tileno%cp->tw; // si numerotation matricielle ..
|
||||||
|
int q=tileno/cp->tw; // .. coordonnees de la tile (q,p) q pour ligne et p pour colonne
|
||||||
|
info_tile_t *tile_Idx=&imgg->tile[tileno]; // INDEX
|
||||||
|
|
||||||
|
// 4 borders of the tile rescale on the image if necessary
|
||||||
|
tile->x0=int_max(cp->tx0+p*cp->tdx, img->x0);
|
||||||
|
tile->y0=int_max(cp->ty0+q*cp->tdy, img->y0);
|
||||||
|
tile->x1=int_min(cp->tx0+(p+1)*cp->tdx, img->x1);
|
||||||
|
tile->y1=int_min(cp->ty0+(q+1)*cp->tdy, img->y1);
|
||||||
|
|
||||||
|
tile->numcomps=img->numcomps;
|
||||||
|
tile->comps=(tcd_tilecomp_t*)malloc(img->numcomps*sizeof(tcd_tilecomp_t));
|
||||||
|
tile_Idx->compo=(info_compo_t*)malloc(img->numcomps*sizeof(info_compo_t)); // INDEX
|
||||||
|
for (compno=0; compno<tile->numcomps; compno++) {
|
||||||
|
j2k_tccp_t *tccp=&tcp->tccps[compno];
|
||||||
|
tcd_tilecomp_t *tilec=&tile->comps[compno];
|
||||||
|
info_compo_t *compo_Idx=&tile_Idx->compo[compno]; // INDEX
|
||||||
|
|
||||||
|
// border of each tile component (global)
|
||||||
|
tilec->x0=int_ceildiv(tile->x0, img->comps[compno].dx);
|
||||||
|
tilec->y0=int_ceildiv(tile->y0, img->comps[compno].dy);
|
||||||
|
tilec->x1=int_ceildiv(tile->x1, img->comps[compno].dx);
|
||||||
|
tilec->y1=int_ceildiv(tile->y1, img->comps[compno].dy);
|
||||||
|
|
||||||
|
tilec->data=(int*)malloc(sizeof(int)*(tilec->x1-tilec->x0)*(tilec->y1-tilec->y0));
|
||||||
|
tilec->numresolutions=tccp->numresolutions;
|
||||||
|
tilec->resolutions=(tcd_resolution_t*)malloc(tilec->numresolutions*sizeof(tcd_resolution_t));
|
||||||
|
compo_Idx->reso=(info_reso_t*)malloc(tilec->numresolutions*sizeof(info_reso_t)); // INDEX
|
||||||
|
for (resno=0; resno<tilec->numresolutions; resno++) {
|
||||||
|
int pdx, pdy;
|
||||||
|
int levelno=tilec->numresolutions-1-resno;
|
||||||
|
int tlprcxstart, tlprcystart, brprcxend, brprcyend;
|
||||||
|
int tlcbgxstart, tlcbgystart, brcbgxend, brcbgyend;
|
||||||
|
int cbgwidthexpn, cbgheightexpn;
|
||||||
|
int cblkwidthexpn, cblkheightexpn;
|
||||||
|
tcd_resolution_t *res=&tilec->resolutions[resno];
|
||||||
|
info_reso_t *res_Idx=&compo_Idx->reso[resno]; // INDEX
|
||||||
|
int precno_Idx; // INDEX
|
||||||
|
|
||||||
|
// border for each resolution level (global)
|
||||||
|
res->x0=int_ceildivpow2(tilec->x0, levelno);
|
||||||
|
res->y0=int_ceildivpow2(tilec->y0, levelno);
|
||||||
|
res->x1=int_ceildivpow2(tilec->x1, levelno);
|
||||||
|
res->y1=int_ceildivpow2(tilec->y1, levelno);
|
||||||
|
|
||||||
|
res->numbands=resno==0?1:3;
|
||||||
|
// p. 35, table A-23, ISO/IEC FDIS154444-1 : 2000 (18 august 2000)
|
||||||
|
if (tccp->csty&J2K_CCP_CSTY_PRT) {
|
||||||
|
pdx=tccp->prcw[resno];
|
||||||
|
pdy=tccp->prch[resno];
|
||||||
|
} else {
|
||||||
|
pdx=15;
|
||||||
|
pdy=15;
|
||||||
|
}
|
||||||
|
// p. 64, B.6, ISO/IEC FDIS15444-1 : 2000 (18 august 2000)
|
||||||
|
tlprcxstart=int_floordivpow2(res->x0, pdx)<<pdx;
|
||||||
|
tlprcystart=int_floordivpow2(res->y0, pdy)<<pdy;
|
||||||
|
brprcxend=int_ceildivpow2(res->x1, pdx)<<pdx;
|
||||||
|
brprcyend=int_ceildivpow2(res->y1, pdy)<<pdy;
|
||||||
|
res->pw=(brprcxend-tlprcxstart)>>pdx;
|
||||||
|
res->ph=(brprcyend-tlprcystart)>>pdy;
|
||||||
|
|
||||||
|
// <INDEX>
|
||||||
|
imgg->tile[tileno].pw=res->pw;
|
||||||
|
imgg->tile[tileno].ph=res->ph;
|
||||||
|
|
||||||
|
res_Idx->prec=(info_prec_t*)malloc(res->pw*res->ph*sizeof(info_prec_t));
|
||||||
|
for (precno_Idx=0;precno_Idx<res->pw*res->ph;precno_Idx++)
|
||||||
|
{
|
||||||
|
info_prec_t *prec_Idx = &res_Idx->prec[precno_Idx];
|
||||||
|
prec_Idx->layer=(info_layer_t*)malloc(imgg->Layer*sizeof(info_layer_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
imgg->pw=res->pw; // old parser version
|
||||||
|
imgg->ph=res->ph; // old parser version
|
||||||
|
imgg->pdx=1<<pdx;
|
||||||
|
imgg->pdy=1<<pdy;
|
||||||
|
// </INDEX>
|
||||||
|
|
||||||
|
if (resno==0) {
|
||||||
|
tlcbgxstart=tlprcxstart;
|
||||||
|
tlcbgystart=tlprcystart;
|
||||||
|
brcbgxend=brprcxend;
|
||||||
|
brcbgyend=brprcyend;
|
||||||
|
cbgwidthexpn=pdx;
|
||||||
|
cbgheightexpn=pdy;
|
||||||
|
} else {
|
||||||
|
tlcbgxstart=int_ceildivpow2(tlprcxstart, 1);
|
||||||
|
tlcbgystart=int_ceildivpow2(tlprcystart, 1);
|
||||||
|
brcbgxend=int_ceildivpow2(brprcxend, 1);
|
||||||
|
brcbgyend=int_ceildivpow2(brprcyend, 1);
|
||||||
|
cbgwidthexpn=pdx-1;
|
||||||
|
cbgheightexpn=pdy-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cblkwidthexpn=int_min(tccp->cblkw, cbgwidthexpn);
|
||||||
|
cblkheightexpn=int_min(tccp->cblkh, cbgheightexpn);
|
||||||
|
|
||||||
|
for (bandno=0; bandno<res->numbands; bandno++) {
|
||||||
|
int x0b, y0b;
|
||||||
|
tcd_band_t *band=&res->bands[bandno];
|
||||||
|
band->bandno=resno==0?0:bandno+1;
|
||||||
|
x0b=(band->bandno==1)||(band->bandno==3)?1:0;
|
||||||
|
y0b=(band->bandno==2)||(band->bandno==3)?1:0;
|
||||||
|
|
||||||
|
if (band->bandno==0) {
|
||||||
|
// band border (global)
|
||||||
|
band->x0=int_ceildivpow2(tilec->x0, levelno);
|
||||||
|
band->y0=int_ceildivpow2(tilec->y0, levelno);
|
||||||
|
band->x1=int_ceildivpow2(tilec->x1, levelno);
|
||||||
|
band->y1=int_ceildivpow2(tilec->y1, levelno);
|
||||||
|
} else {
|
||||||
|
// band border (global)
|
||||||
|
band->x0=int_ceildivpow2(tilec->x0-(1<<levelno)*x0b, levelno+1);
|
||||||
|
band->y0=int_ceildivpow2(tilec->y0-(1<<levelno)*y0b, levelno+1);
|
||||||
|
band->x1=int_ceildivpow2(tilec->x1-(1<<levelno)*x0b, levelno+1);
|
||||||
|
band->y1=int_ceildivpow2(tilec->y1-(1<<levelno)*y0b, levelno+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
band->precincts=(tcd_precinct_t*)malloc(res->pw*res->ph*sizeof(tcd_precinct_t));
|
||||||
|
|
||||||
|
for (precno=0; precno<res->pw*res->ph; precno++) {
|
||||||
|
int tlcblkxstart, tlcblkystart, brcblkxend, brcblkyend;
|
||||||
|
int cbgxstart=tlcbgxstart+(precno%res->pw)*(1<<cbgwidthexpn);
|
||||||
|
int cbgystart=tlcbgystart+(precno/res->pw)*(1<<cbgheightexpn);
|
||||||
|
int cbgxend=cbgxstart+(1<<cbgwidthexpn);
|
||||||
|
int cbgyend=cbgystart+(1<<cbgheightexpn);
|
||||||
|
tcd_precinct_t *prc=&band->precincts[precno];
|
||||||
|
// precinct size (global)
|
||||||
|
prc->x0=int_max(cbgxstart, band->x0);
|
||||||
|
prc->y0=int_max(cbgystart, band->y0);
|
||||||
|
prc->x1=int_min(cbgxend, band->x1);
|
||||||
|
prc->y1=int_min(cbgyend, band->y1);
|
||||||
|
|
||||||
|
tlcblkxstart=int_floordivpow2(prc->x0, cblkwidthexpn)<<cblkwidthexpn;
|
||||||
|
tlcblkystart=int_floordivpow2(prc->y0, cblkheightexpn)<<cblkheightexpn;
|
||||||
|
brcblkxend=int_ceildivpow2(prc->x1, cblkwidthexpn)<<cblkwidthexpn;
|
||||||
|
brcblkyend=int_ceildivpow2(prc->y1, cblkheightexpn)<<cblkheightexpn;
|
||||||
|
prc->cw=(brcblkxend-tlcblkxstart)>>cblkwidthexpn;
|
||||||
|
prc->ch=(brcblkyend-tlcblkystart)>>cblkheightexpn;
|
||||||
|
|
||||||
|
prc->cblks=(tcd_cblk_t*)malloc(prc->cw*prc->ch*sizeof(tcd_cblk_t));
|
||||||
|
|
||||||
|
prc->incltree=tgt_create(prc->cw, prc->ch);
|
||||||
|
prc->imsbtree=tgt_create(prc->cw, prc->ch);
|
||||||
|
|
||||||
|
for (cblkno=0; cblkno<prc->cw*prc->ch; cblkno++) {
|
||||||
|
int cblkxstart=tlcblkxstart+(cblkno%prc->cw)*(1<<cblkwidthexpn);
|
||||||
|
int cblkystart=tlcblkystart+(cblkno/prc->cw)*(1<<cblkheightexpn);
|
||||||
|
int cblkxend=cblkxstart+(1<<cblkwidthexpn);
|
||||||
|
int cblkyend=cblkystart+(1<<cblkheightexpn);
|
||||||
|
tcd_cblk_t *cblk=&prc->cblks[cblkno];
|
||||||
|
// code-block size (global)
|
||||||
|
cblk->x0=int_max(cblkxstart, prc->x0);
|
||||||
|
cblk->y0=int_max(cblkystart, prc->y0);
|
||||||
|
cblk->x1=int_min(cblkxend, prc->x1);
|
||||||
|
cblk->y1=int_min(cblkyend, prc->y1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void tcd_free(j2k_image_t *img, j2k_cp_t *cp) {
|
||||||
|
int tileno, compno, resno, bandno, precno;
|
||||||
|
tcd_img=img;
|
||||||
|
tcd_cp=cp;
|
||||||
|
tcd_image.tw=cp->tw;
|
||||||
|
tcd_image.th=cp->th;
|
||||||
|
for (tileno=0; tileno<tcd_image.tw*tcd_image.th; tileno++)
|
||||||
|
{
|
||||||
|
// j2k_tcp_t *tcp=&cp->tcps[curtileno];
|
||||||
|
tcd_tile_t *tile=&tcd_image.tiles[tileno];
|
||||||
|
for (compno=0; compno<tile->numcomps; compno++)
|
||||||
|
{
|
||||||
|
tcd_tilecomp_t *tilec=&tile->comps[compno];
|
||||||
|
for (resno=0; resno<tilec->numresolutions; resno++)
|
||||||
|
{
|
||||||
|
tcd_resolution_t *res=&tilec->resolutions[resno];
|
||||||
|
for (bandno=0; bandno<res->numbands; bandno++)
|
||||||
|
{
|
||||||
|
tcd_band_t *band=&res->bands[bandno];
|
||||||
|
for (precno=0; precno<res->pw*res->ph; precno++)
|
||||||
|
{
|
||||||
|
tcd_precinct_t *prc=&band->precincts[precno];
|
||||||
|
|
||||||
|
if (prc->incltree!=NULL)
|
||||||
|
tgt_destroy(prc->incltree);
|
||||||
|
if (prc->imsbtree!=NULL)
|
||||||
|
tgt_destroy(prc->imsbtree);
|
||||||
|
free(prc->cblks);
|
||||||
|
} // for (precno
|
||||||
|
free(band->precincts);
|
||||||
|
} // for (bandno
|
||||||
|
} // for (resno
|
||||||
|
free(tilec->resolutions);
|
||||||
|
} // for (compno
|
||||||
|
free(tile->comps);
|
||||||
|
} // for (tileno
|
||||||
|
free(tcd_image.tiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int tcd_decode_tile(unsigned char *src, int len, int tileno, info_image_t *imgg) {
|
||||||
|
int l;
|
||||||
|
int eof=0;
|
||||||
|
tcd_tile_t *tile;
|
||||||
|
|
||||||
|
tile = &tcd_image.tiles[tileno];
|
||||||
|
|
||||||
|
l = t2_decode_packets(src, len, tcd_img, tcd_cp, tileno, tile, imgg);
|
||||||
|
|
||||||
|
if (l==-999)
|
||||||
|
{
|
||||||
|
eof=1;
|
||||||
|
fprintf(stderr, "tcd_decode: incomplete bistream\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eof) {
|
||||||
|
longjmp(j2k_error, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
l=1;
|
||||||
|
return l;
|
||||||
|
}
|
||||||
137
indexer_JPIP/tcd.h
Normal file
137
indexer_JPIP/tcd.h
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __TCD_H
|
||||||
|
#define __TCD_H
|
||||||
|
|
||||||
|
#include "j2k.h"
|
||||||
|
#include "tgt.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int numpasses;
|
||||||
|
int len;
|
||||||
|
unsigned char *data;
|
||||||
|
int maxpasses;
|
||||||
|
int numnewpasses;
|
||||||
|
int newlen;
|
||||||
|
} tcd_seg_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int rate;
|
||||||
|
double distortiondec;
|
||||||
|
} tcd_pass_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int numpasses;
|
||||||
|
int len;
|
||||||
|
unsigned char *data;
|
||||||
|
} tcd_layer_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
int numbps;
|
||||||
|
int numlenbits;
|
||||||
|
int len;
|
||||||
|
int numpasses;
|
||||||
|
int numnewpasses;
|
||||||
|
int numsegs;
|
||||||
|
tcd_seg_t segs[100];
|
||||||
|
unsigned char data[8192];
|
||||||
|
int numpassesinlayers;
|
||||||
|
tcd_layer_t layers[100];
|
||||||
|
int totalpasses;
|
||||||
|
tcd_pass_t passes[100];
|
||||||
|
} tcd_cblk_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
int cw, ch;
|
||||||
|
tcd_cblk_t *cblks;
|
||||||
|
tgt_tree_t *incltree;
|
||||||
|
tgt_tree_t *imsbtree;
|
||||||
|
} tcd_precinct_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
int bandno;
|
||||||
|
tcd_precinct_t *precincts;
|
||||||
|
int numbps;
|
||||||
|
int stepsize;
|
||||||
|
} tcd_band_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
int previous_x0, previous_y0, previous_x1, previous_y1; // usefull for the DWT
|
||||||
|
int cas_col, cas_row; // usefull for the DWT
|
||||||
|
int pw, ph;
|
||||||
|
int numbands;
|
||||||
|
tcd_band_t bands[3];
|
||||||
|
} tcd_resolution_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
int previous_row, previous_col; // usefull for the DWT
|
||||||
|
int numresolutions;
|
||||||
|
tcd_resolution_t *resolutions;
|
||||||
|
int *data;
|
||||||
|
} tcd_tilecomp_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int x0, y0, x1, y1;
|
||||||
|
int numcomps;
|
||||||
|
//int PPT;
|
||||||
|
//int len_ppt;
|
||||||
|
tcd_tilecomp_t *comps;
|
||||||
|
} tcd_tile_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int tw, th;
|
||||||
|
tcd_tile_t *tiles;
|
||||||
|
} tcd_image_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the tile coder/decoder
|
||||||
|
* img: raw image
|
||||||
|
* cp: coding parameters
|
||||||
|
* imgg: creation of index file
|
||||||
|
*/
|
||||||
|
|
||||||
|
void tcd_init(j2k_image_t *img, j2k_cp_t *cp, info_image_t *imgg);
|
||||||
|
|
||||||
|
void tcd_free(j2k_image_t *img, j2k_cp_t *cp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Decode a tile from a buffer into a raw image
|
||||||
|
* src: source buffer
|
||||||
|
* len: length of the source buffer
|
||||||
|
* tileno: number that identifies the tile that will be decoded
|
||||||
|
* imgg : Structure for index file
|
||||||
|
*/
|
||||||
|
int tcd_decode_tile(unsigned char *src, int len, int tileno, info_image_t *imgg);
|
||||||
|
|
||||||
|
#endif
|
||||||
170
indexer_JPIP/tgt.c
Normal file
170
indexer_JPIP/tgt.c
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tgt.h"
|
||||||
|
#include "bio.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset tag-tree.
|
||||||
|
/// </summary>
|
||||||
|
void tgt_reset(tgt_tree_t *tree)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i=0; i<tree->numnodes; i++) {
|
||||||
|
tree->nodes[i].value=999;
|
||||||
|
tree->nodes[i].low=0;
|
||||||
|
tree->nodes[i].known=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create tag-tree.
|
||||||
|
/// </summary>
|
||||||
|
tgt_tree_t *tgt_create(int numleafsh, int numleafsv)
|
||||||
|
{
|
||||||
|
int nplh[32];
|
||||||
|
int nplv[32];
|
||||||
|
tgt_node_t *node;
|
||||||
|
tgt_node_t *parentnode;
|
||||||
|
tgt_node_t *parentnode0;
|
||||||
|
tgt_tree_t *tree;
|
||||||
|
int i, j, k;
|
||||||
|
int numlvls;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
tree=(tgt_tree_t*)malloc(sizeof(tgt_tree_t));
|
||||||
|
tree->numleafsh=numleafsh;
|
||||||
|
tree->numleafsv=numleafsv;
|
||||||
|
|
||||||
|
numlvls=0;
|
||||||
|
nplh[0]=numleafsh;
|
||||||
|
nplv[0]=numleafsv;
|
||||||
|
tree->numnodes=0;
|
||||||
|
do {
|
||||||
|
n=nplh[numlvls]*nplv[numlvls];
|
||||||
|
nplh[numlvls+1]=(nplh[numlvls]+1)/2;
|
||||||
|
nplv[numlvls+1]=(nplv[numlvls]+1)/2;
|
||||||
|
tree->numnodes+=n;
|
||||||
|
++numlvls;
|
||||||
|
} while (n>1);
|
||||||
|
|
||||||
|
tree->nodes=(tgt_node_t*)malloc(tree->numnodes*sizeof(tgt_node_t));
|
||||||
|
|
||||||
|
node=tree->nodes;
|
||||||
|
parentnode=&tree->nodes[tree->numleafsh*tree->numleafsv];
|
||||||
|
parentnode0=parentnode;
|
||||||
|
|
||||||
|
for (i=0; i<numlvls-1; ++i) {
|
||||||
|
for (j=0; j<nplv[i]; ++j) {
|
||||||
|
k=nplh[i];
|
||||||
|
while (--k>=0) {
|
||||||
|
node->parent=parentnode;
|
||||||
|
++node;
|
||||||
|
if (--k >= 0) {
|
||||||
|
node->parent=parentnode;
|
||||||
|
++node;
|
||||||
|
}
|
||||||
|
++parentnode;
|
||||||
|
}
|
||||||
|
if ((j&1)||j==nplv[i]-1) {
|
||||||
|
parentnode0=parentnode;
|
||||||
|
} else {
|
||||||
|
parentnode=parentnode0;
|
||||||
|
parentnode0+=nplh[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node->parent=0;
|
||||||
|
|
||||||
|
tgt_reset(tree);
|
||||||
|
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Destroy tag-tree.
|
||||||
|
/// </summary>
|
||||||
|
void tgt_destroy(tgt_tree_t *t) {
|
||||||
|
free(t->nodes);
|
||||||
|
free(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the value of a leaf of the tag-tree.
|
||||||
|
/// </summary>
|
||||||
|
void tgt_setvalue(tgt_tree_t *tree, int leafno, int value) {
|
||||||
|
tgt_node_t *node;
|
||||||
|
node=&tree->nodes[leafno];
|
||||||
|
while (node && node->value>value) {
|
||||||
|
node->value=value;
|
||||||
|
node=node->parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decode the value of a leaf of the tag-tree.
|
||||||
|
/// </summary>
|
||||||
|
int tgt_decode(tgt_tree_t *tree, int leafno, int threshold)
|
||||||
|
{
|
||||||
|
tgt_node_t *stk[31];
|
||||||
|
tgt_node_t **stkptr;
|
||||||
|
tgt_node_t *node;
|
||||||
|
int low;
|
||||||
|
|
||||||
|
stkptr=stk;
|
||||||
|
node=&tree->nodes[leafno];
|
||||||
|
while (node->parent) {
|
||||||
|
*stkptr++=node;
|
||||||
|
node=node->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
low=0;
|
||||||
|
for (;;) {
|
||||||
|
if (low>node->low) {
|
||||||
|
node->low=low;
|
||||||
|
} else {
|
||||||
|
low=node->low;
|
||||||
|
}
|
||||||
|
while (low<threshold && low<node->value) {
|
||||||
|
if (bio_read(1)) {
|
||||||
|
node->value=low;
|
||||||
|
} else {
|
||||||
|
++low;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node->low=low;
|
||||||
|
if (stkptr==stk) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
node=*--stkptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (node->value<threshold)?1:0;
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2002, David Janssens
|
* Copyright (c) 2001-2002, David Janssens
|
||||||
|
* Copyright (c) 2003, Yannick Verschueren
|
||||||
|
* Copyright (c) 2003, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -28,27 +30,19 @@
|
|||||||
#define __TGT_H
|
#define __TGT_H
|
||||||
|
|
||||||
typedef struct tgt_node {
|
typedef struct tgt_node {
|
||||||
struct tgt_node *parent;
|
struct tgt_node *parent;
|
||||||
int value;
|
int value;
|
||||||
int low;
|
int low;
|
||||||
int known;
|
int known;
|
||||||
} tgt_node_t;
|
} tgt_node_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int numleafsh;
|
int numleafsh;
|
||||||
int numleafsv;
|
int numleafsv;
|
||||||
int numnodes;
|
int numnodes;
|
||||||
tgt_node_t *nodes;
|
tgt_node_t *nodes;
|
||||||
} tgt_tree_t;
|
} tgt_tree_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset a tag-tree (set all leaves to 0)
|
|
||||||
* tree: tag-tree to reset
|
|
||||||
*/
|
|
||||||
void tgt_reset(tgt_tree_t * tree);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a tag-tree
|
* Create a tag-tree
|
||||||
* numleafsh: width of the array of leafs of the tree
|
* numleafsh: width of the array of leafs of the tree
|
||||||
@@ -56,11 +50,17 @@ void tgt_reset(tgt_tree_t * tree);
|
|||||||
*/
|
*/
|
||||||
tgt_tree_t *tgt_create(int numleafsh, int numleafsv);
|
tgt_tree_t *tgt_create(int numleafsh, int numleafsv);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset a tag-tree (set all leafs to 0)
|
||||||
|
* tree: tag-tree to reset
|
||||||
|
*/
|
||||||
|
void tgt_reset(tgt_tree_t *tree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destroy a tag-tree, liberating memory
|
* Destroy a tag-tree, liberating memory
|
||||||
* tree: tag-tree to destroy
|
* tree: tag-tree to destroy
|
||||||
*/
|
*/
|
||||||
void tgt_destroy(tgt_tree_t * tree);
|
void tgt_destroy(tgt_tree_t *tree);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the value of a leaf of a tag-tree
|
* Set the value of a leaf of a tag-tree
|
||||||
@@ -68,20 +68,13 @@ void tgt_destroy(tgt_tree_t * tree);
|
|||||||
* leafno: number that identifies the leaf to modify
|
* leafno: number that identifies the leaf to modify
|
||||||
* value: new value of the leaf
|
* value: new value of the leaf
|
||||||
*/
|
*/
|
||||||
void tgt_setvalue(tgt_tree_t * tree, int leafno, int value);
|
void tgt_setvalue(tgt_tree_t *tree, int leafno, int value);
|
||||||
|
|
||||||
/*
|
|
||||||
* Encode the value of a leaf of the tag-tree up to a given threshold
|
|
||||||
* leafno: number that identifies the leaf to encode
|
|
||||||
* threshold: threshold to use when encoding value of the leaf
|
|
||||||
*/
|
|
||||||
void tgt_encode(tgt_tree_t * tree, int leafno, int threshold);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decode the value of a leaf of the tag-tree up to a given threshold
|
* Decode the value of a leaf of the tag-tree up to a given threshold
|
||||||
* leafno: number that identifies the leaf to decode
|
* leafno: number that identifies the leaf to decode
|
||||||
* threshold: threshold to use when decoding value of the leaf
|
* threshold: threshold to use when decoding value of the leaf
|
||||||
*/
|
*/
|
||||||
int tgt_decode(tgt_tree_t * tree, int leafno, int threshold);
|
int tgt_decode(tgt_tree_t *tree, int leafno, int threshold);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
35
j2kviewer/build.xml
Normal file
35
j2kviewer/build.xml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<project name="seb_j2kviewer" default="dist" basedir=".">
|
||||||
|
<description>Seb's J2K viewer</description>
|
||||||
|
<property name="src" location="src" />
|
||||||
|
<property name="build" location="build"/>
|
||||||
|
<property name="dist" location="dist" />
|
||||||
|
|
||||||
|
<target name="init">
|
||||||
|
<tstamp/>
|
||||||
|
<mkdir dir="${build}"/>
|
||||||
|
</target>
|
||||||
|
<target name="compile" depends="init">
|
||||||
|
<javac srcdir="${src}" destdir="${build}"/>
|
||||||
|
</target>
|
||||||
|
<target name="dist" depends="compile">
|
||||||
|
<mkdir dir="${dist}"/>
|
||||||
|
<jar jarfile="${dist}/seb_j2kviewer-${DSTAMP}.jar"
|
||||||
|
basedir="${build}" manifest="${dist}/manifest.txt"/>
|
||||||
|
<exec dir="${dist}" executable="ln">
|
||||||
|
<arg line="-sf seb_j2kviewer-${DSTAMP}.jar seb_j2kviewer.jar"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${build}"/>
|
||||||
|
<delete dir="${dist}"/>
|
||||||
|
</target>
|
||||||
|
<target name="test" depends="dist">
|
||||||
|
<exec executable="appletviewer"><arg line="dist.html"/></exec>
|
||||||
|
</target>
|
||||||
|
<target name="build_test" depends="compile">
|
||||||
|
<exec executable="appletviewer"><arg line="compile.html"/></exec>
|
||||||
|
</target>
|
||||||
|
<target name="build_testj" depends="compile">
|
||||||
|
<exec executable="java"><arg line="-classpath build ImageViewer girl"/></exec>
|
||||||
|
</target>
|
||||||
|
</project>
|
||||||
212
j2kviewer/src/Exec.java
Normal file
212
j2kviewer/src/Exec.java
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
// This appears in Core Web Programming from
|
||||||
|
// Prentice Hall Publishers, and may be freely used
|
||||||
|
// or adapted. 1997 Marty Hall, hall@apl.jhu.edu.
|
||||||
|
|
||||||
|
/** A class that eases the pain of running external
|
||||||
|
* processes from applications.
|
||||||
|
* Lets you run a program three ways:
|
||||||
|
* <OL>
|
||||||
|
* <LI><B>exec</B>: Execute the command, returning
|
||||||
|
* immediately even if the command is still
|
||||||
|
* running. This would be appropriate
|
||||||
|
* for printing a file.
|
||||||
|
* <LI><B>execWait</B>: Execute the command, but
|
||||||
|
* don't return until the command finishes.
|
||||||
|
* This would be appropriate for
|
||||||
|
* sequential commands where the first depends
|
||||||
|
* on the second having finished (e.g.
|
||||||
|
* <CODE>javac</CODE> followed by
|
||||||
|
* <CODE>java</CODE>).
|
||||||
|
* <LI><B>execPrint</B>: Execute the command and
|
||||||
|
* print the output. This would be appropriate
|
||||||
|
* for the UNIX command <CODE>ls</CODE>.
|
||||||
|
* </OL>
|
||||||
|
* Note that the PATH is not taken into account,
|
||||||
|
* so you must specify the <B>full</B> pathname to
|
||||||
|
* the command, and shell builtin commands
|
||||||
|
* will not work. For instance, on Unix the above
|
||||||
|
* three examples might look like:
|
||||||
|
* <OL>
|
||||||
|
* <LI><PRE>Exec.exec("/usr/ucb/lpr Some-File");</PRE>
|
||||||
|
* <LI><PRE>
|
||||||
|
* Exec.execWait("/usr/local/bin/javac Foo.java");
|
||||||
|
* Exec.execWait("/usr/local/bin/java Foo");
|
||||||
|
* </PRE>
|
||||||
|
* <LI><PRE>Exec.execPrint("/usr/bin/ls -al");</PRE>
|
||||||
|
* </OL>
|
||||||
|
*
|
||||||
|
* @author Marty Hall
|
||||||
|
* (<A HREF="mailto:hall@apl.jhu.edu">
|
||||||
|
* hall@apl.jhu.edu</A>)
|
||||||
|
* @version 1.0 1997
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Exec {
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
private static boolean verbose = true;
|
||||||
|
|
||||||
|
/** Determines if the Exec class should print which
|
||||||
|
* commands are being executed, and print error
|
||||||
|
* messages if a problem is found. Default is true.
|
||||||
|
*
|
||||||
|
* @param verboseFlag true: print messages.
|
||||||
|
* false: don't.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static void setVerbose(boolean verboseFlag) {
|
||||||
|
verbose = verboseFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Will Exec print status messages? */
|
||||||
|
|
||||||
|
public static boolean getVerbose() {
|
||||||
|
return(verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
/** Starts a process to execute the command. Returns
|
||||||
|
* immediately, even if the new process is still
|
||||||
|
* running.
|
||||||
|
*
|
||||||
|
* @param command The <B>full</B> pathname of the
|
||||||
|
* command to be executed. No shell builtins
|
||||||
|
* (e.g. "cd") or shell meta-chars (e.g. ">")
|
||||||
|
* allowed.
|
||||||
|
* @return false if a problem is known to occur, but
|
||||||
|
* since this returns immediately, problems
|
||||||
|
* aren't usually found in time.
|
||||||
|
* Returns true otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static boolean exec(String command) {
|
||||||
|
return(exec(command, false, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
/** Starts a process to execute the command. Waits
|
||||||
|
* for the process to finish before returning.
|
||||||
|
*
|
||||||
|
* @param command The <B>full</B> pathname of the
|
||||||
|
* command to be executed. No shell builtins
|
||||||
|
* or shell meta-chars allowed.
|
||||||
|
* @return false if a problem is known to occur,
|
||||||
|
* either due to an exception or from the
|
||||||
|
* subprocess returning a non-zero value.
|
||||||
|
* Returns true otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static boolean execWait(String command) {
|
||||||
|
return(exec(command, false, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
/** Starts a process to execute the command. Prints
|
||||||
|
* all output the command gives.
|
||||||
|
*
|
||||||
|
* @param command The <B>full</B> pathname of the
|
||||||
|
* command to be executed. No shell builtins
|
||||||
|
* or shell meta-chars allowed.
|
||||||
|
* @return false if a problem is known to occur,
|
||||||
|
* either due to an exception or from the
|
||||||
|
* subprocess returning a non-zero value.
|
||||||
|
* Returns true otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static boolean execPrint(String command) {
|
||||||
|
return(exec(command, true, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
// This creates a Process object via
|
||||||
|
// Runtime.getRuntime.exec(). Depending on the
|
||||||
|
// flags, it may call waitFor on the process
|
||||||
|
// to avoid continuing until the process terminates,
|
||||||
|
// or open an input stream from the process to read
|
||||||
|
// the results.
|
||||||
|
|
||||||
|
private static boolean exec(String command,
|
||||||
|
boolean printResults,
|
||||||
|
boolean wait) {
|
||||||
|
if (verbose) {
|
||||||
|
printSeparator();
|
||||||
|
System.out.println("Executing '" + command + "'.");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// Start running command, returning immediately.
|
||||||
|
Process p = Runtime.getRuntime().exec(command);
|
||||||
|
|
||||||
|
// Print the output. Since we read until
|
||||||
|
// there is no more input, this causes us
|
||||||
|
// to wait until the process is completed
|
||||||
|
if(printResults) {
|
||||||
|
BufferedInputStream buffer =
|
||||||
|
new BufferedInputStream(p.getInputStream());
|
||||||
|
DataInputStream commandResult =
|
||||||
|
new DataInputStream(buffer);
|
||||||
|
String s = null;
|
||||||
|
try {
|
||||||
|
while ((s = commandResult.readLine()) != null)
|
||||||
|
System.out.println("Output: " + s);
|
||||||
|
commandResult.close();
|
||||||
|
if (p.exitValue() != 0) {
|
||||||
|
if (verbose)
|
||||||
|
printError(command +
|
||||||
|
" -- p.exitValue() != 0");
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
// Ignore read errors; they mean process is done
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
|
// If you don't print the results, then you
|
||||||
|
// need to call waitFor to stop until the process
|
||||||
|
// is completed
|
||||||
|
} else if (wait) {
|
||||||
|
try {
|
||||||
|
System.out.println(" ");
|
||||||
|
int returnVal = p.waitFor();
|
||||||
|
if (returnVal != 0) {
|
||||||
|
if (verbose)
|
||||||
|
printError(command);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (verbose)
|
||||||
|
printError(command, e);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (verbose)
|
||||||
|
printError(command, e);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
private static void printError(String command,
|
||||||
|
Exception e) {
|
||||||
|
System.out.println("Error doing exec(" +
|
||||||
|
command + "): " + e.getMessage());
|
||||||
|
System.out.println("Did you specify the full " +
|
||||||
|
"pathname?");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void printError(String command) {
|
||||||
|
System.out.println("Error executing '" +
|
||||||
|
command + "'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
private static void printSeparator() {
|
||||||
|
System.out.println
|
||||||
|
("==============================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------
|
||||||
|
}
|
||||||
222
j2kviewer/src/ImageViewer.java
Normal file
222
j2kviewer/src/ImageViewer.java
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.image.*;
|
||||||
|
import java.awt.geom.*;
|
||||||
|
import java.net.URL;
|
||||||
|
import javax.swing.border.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class ImageViewer extends JApplet
|
||||||
|
{
|
||||||
|
private class zoomLevel {
|
||||||
|
int x1, y1, x2, y2, zf;
|
||||||
|
|
||||||
|
zoomLevel() {}
|
||||||
|
zoomLevel(zoomLevel zl)
|
||||||
|
{
|
||||||
|
x1 = zl.x1;
|
||||||
|
y1 = zl.y1;
|
||||||
|
x2 = zl.x2;
|
||||||
|
y2 = zl.y2;
|
||||||
|
zf = zl.zf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BufferedImage bi;
|
||||||
|
private Graphics2D big;
|
||||||
|
private MML myMML;
|
||||||
|
private int iw, ih;
|
||||||
|
private int selected = 0, imgId;
|
||||||
|
private Image img;
|
||||||
|
private PgmImage pgm = new PgmImage();
|
||||||
|
private String cmdline = new String();
|
||||||
|
private static String hostname;
|
||||||
|
private static boolean isApplet = true;
|
||||||
|
private boolean fullRefresh = false;
|
||||||
|
private Point offset = new Point(0,0);
|
||||||
|
private zoomLevel zl = new zoomLevel();
|
||||||
|
private Rectangle rect = new Rectangle();
|
||||||
|
private Stack zoomStack = new Stack();
|
||||||
|
private static String j2kfilename;
|
||||||
|
|
||||||
|
public int getX() { return offset.x; }
|
||||||
|
public int getY() { return offset.y; }
|
||||||
|
public int getWidth() { return iw; }
|
||||||
|
public int getHeight() { return ih; }
|
||||||
|
|
||||||
|
public void destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void zoomIn()
|
||||||
|
{
|
||||||
|
Dimension asz = this.getSize();
|
||||||
|
int maxzf = 3;
|
||||||
|
int coef = 1;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
cmdline =
|
||||||
|
"/bin/sh get.sh " + j2kfilename + " " + iw
|
||||||
|
+ " " + ih + " " + rect.x + " " + rect.y + " "
|
||||||
|
+ rect.width + " " + rect.height;
|
||||||
|
Exec.execPrint(cmdline);
|
||||||
|
|
||||||
|
rect.x = rect.y = rect.width = rect.height = 0;
|
||||||
|
|
||||||
|
img = pgm.open("out.pgm");
|
||||||
|
|
||||||
|
iw = img.getWidth(this);
|
||||||
|
ih = img.getHeight(this);
|
||||||
|
bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
|
||||||
|
big = bi.createGraphics();
|
||||||
|
selected = 0;
|
||||||
|
fullRefresh = true;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void zoomOut()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
String str;
|
||||||
|
int port;
|
||||||
|
|
||||||
|
imgId = 4;
|
||||||
|
if (isApplet && (((hostname = this.getParameter("hostname")) == null)
|
||||||
|
|| hostname.equals("")))
|
||||||
|
hostname = "localhost";
|
||||||
|
if (!isApplet || ((str = this.getParameter("cmdPort")) == null)) {
|
||||||
|
port = 3000;
|
||||||
|
} else {
|
||||||
|
port = new Integer(str).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setSize(512, 512);
|
||||||
|
Dimension asz = this.getSize();
|
||||||
|
zl.x2 = asz.width;
|
||||||
|
zl.y2 = asz.height;
|
||||||
|
|
||||||
|
cmdline =
|
||||||
|
"/bin/sh get.sh " + j2kfilename + " " + asz.width
|
||||||
|
+ " " + asz.height + " " + zl.x1 + " " + zl.y1 + " "
|
||||||
|
+ zl.x2 + " " + zl.y2;
|
||||||
|
Exec.execPrint(cmdline);
|
||||||
|
img = pgm.open("out.pgm");
|
||||||
|
|
||||||
|
iw = img.getWidth(this);
|
||||||
|
ih = img.getHeight(this);
|
||||||
|
|
||||||
|
setBackground(Color.black);
|
||||||
|
bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
|
||||||
|
big = bi.createGraphics();
|
||||||
|
myMML = new MML(this);
|
||||||
|
addMouseListener(myMML);
|
||||||
|
addMouseMotionListener(myMML);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelected(int state)
|
||||||
|
{
|
||||||
|
if (state != selected) {
|
||||||
|
selected = state;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInsideRect(int x, int y)
|
||||||
|
{
|
||||||
|
return rect.contains(x - offset.x, y - offset.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRGeom(int x1, int y1, int x2, int y2)
|
||||||
|
{
|
||||||
|
rect.x = Math.min(x1,x2) - offset.x;
|
||||||
|
rect.y = Math.min(y1,y2) - offset.y;
|
||||||
|
rect.width = Math.abs(x2-x1);
|
||||||
|
rect.height = Math.abs(y2-y1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paint(Graphics g)
|
||||||
|
{
|
||||||
|
Graphics2D g2 = (Graphics2D) g;
|
||||||
|
Dimension asz = this.getSize();
|
||||||
|
|
||||||
|
if (fullRefresh) {
|
||||||
|
g2.clearRect(0, 0, asz.width, asz.height);
|
||||||
|
fullRefresh = false;
|
||||||
|
}
|
||||||
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||||
|
RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
|
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
|
||||||
|
RenderingHints.VALUE_RENDER_QUALITY);
|
||||||
|
big.setColor(Color.black);
|
||||||
|
offset.x = (int) (asz.width - iw) / 2;
|
||||||
|
offset.y = (int) (asz.height - ih) / 2;
|
||||||
|
big.drawImage(img, 0, 0, this);
|
||||||
|
big.setPaint(Color.red);
|
||||||
|
if ((rect.width > 0) && (rect.height > 0))
|
||||||
|
big.draw(rect);
|
||||||
|
if (selected == 1)
|
||||||
|
shadeExt(big, 0, 0, 0, 64);
|
||||||
|
else if (selected == 2) {
|
||||||
|
shadeExt(big, 0, 0, 0, 255);
|
||||||
|
selected = 1;
|
||||||
|
}
|
||||||
|
g2.drawImage(bi, offset.x, offset.y, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shadeRect(Graphics2D g2, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
g2.setPaint(new Color(r, g, b, a));
|
||||||
|
g2.fillRect(rect.x + 1, rect.y + 1, rect.width - 1, rect.height - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shadeExt(Graphics2D g2, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
g2.setPaint(new Color(r, g, b, a));
|
||||||
|
g2.fillRect(0, 0, iw, rect.y); /* _N_ */
|
||||||
|
g2.fillRect(rect.x + rect.width + 1, rect.y,
|
||||||
|
iw - rect.x - rect.width - 1, rect.height + 1); /* E */
|
||||||
|
g2.fillRect(0, rect.y, rect.x, rect.height + 1); /* W */
|
||||||
|
g2.fillRect(0, rect.y + rect.height + 1,
|
||||||
|
iw, ih - rect.y - rect.height - 1); /* _S_ */
|
||||||
|
}
|
||||||
|
|
||||||
|
protected URL getURL(String filename)
|
||||||
|
{
|
||||||
|
URL codeBase = this.getCodeBase();
|
||||||
|
URL url = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
url = new URL(codeBase, filename);
|
||||||
|
} catch (java.net.MalformedURLException e) {
|
||||||
|
System.out.println("Couldn't create image: badly specified URL");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String s[])
|
||||||
|
{
|
||||||
|
if (s.length > 0)
|
||||||
|
j2kfilename = s[0];
|
||||||
|
else
|
||||||
|
j2kfilename = "girl";
|
||||||
|
System.out.println(j2kfilename);
|
||||||
|
isApplet = false;
|
||||||
|
JFrame f = new JFrame("ImageViewer");
|
||||||
|
f.addWindowListener(new WindowAdapter() {
|
||||||
|
public void windowClosing(WindowEvent e) {System.exit(0);}
|
||||||
|
});
|
||||||
|
JApplet applet = new ImageViewer();
|
||||||
|
f.getContentPane().add("Center", applet);
|
||||||
|
applet.init();
|
||||||
|
f.pack();
|
||||||
|
f.setSize(new Dimension(550,550));
|
||||||
|
f.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
85
j2kviewer/src/MML.java
Normal file
85
j2kviewer/src/MML.java
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
class MML implements MouseMotionListener, MouseListener
|
||||||
|
{
|
||||||
|
public void mouseExited(MouseEvent e) {}
|
||||||
|
public void mouseEntered(MouseEvent e) {}
|
||||||
|
public void mouseClicked(MouseEvent e) {}
|
||||||
|
|
||||||
|
private ImageViewer applet;
|
||||||
|
private int x1, y1, x2, y2, zf, btn;
|
||||||
|
private boolean zoomrq;
|
||||||
|
|
||||||
|
public MML(ImageViewer iv)
|
||||||
|
{
|
||||||
|
x1 = y1 = -1;
|
||||||
|
applet = iv;
|
||||||
|
zoomrq = false;
|
||||||
|
zf = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInside(int x, int y)
|
||||||
|
{
|
||||||
|
x -= applet.getX();
|
||||||
|
y -= applet.getY();
|
||||||
|
return (x >= 0) && (x < applet.getWidth())
|
||||||
|
&& (y >= 0) && (y < applet.getHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mousePressed(MouseEvent e)
|
||||||
|
{
|
||||||
|
btn = e.getButton();
|
||||||
|
if (applet.isInsideRect(e.getX(), e.getY())) {
|
||||||
|
applet.setSelected(2);
|
||||||
|
applet.repaint();
|
||||||
|
zoomrq = true;
|
||||||
|
} else {
|
||||||
|
applet.setRGeom(0, 0, 0, 0);
|
||||||
|
applet.setSelected(0);
|
||||||
|
applet.repaint();
|
||||||
|
x1 = y1 = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent e)
|
||||||
|
{
|
||||||
|
if (zoomrq && (e.getButton() == 1)) {
|
||||||
|
applet.zoomIn();
|
||||||
|
zoomrq = false;
|
||||||
|
} else if (e.getButton() == 3) {
|
||||||
|
applet.zoomOut();
|
||||||
|
zoomrq = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseMoved(MouseEvent e)
|
||||||
|
{
|
||||||
|
applet.setSelected(applet.isInsideRect(e.getX(), e.getY()) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseDragged(MouseEvent e)
|
||||||
|
{
|
||||||
|
String str;
|
||||||
|
|
||||||
|
if (btn == 1) {
|
||||||
|
x2 = e.getX();
|
||||||
|
y2 = e.getY();
|
||||||
|
|
||||||
|
applet.setSelected(0);
|
||||||
|
zoomrq = false;
|
||||||
|
|
||||||
|
if (isInside(x2, y2)) {
|
||||||
|
str = "[IN ]";
|
||||||
|
if (x1 == -1) {
|
||||||
|
x1 = x2;
|
||||||
|
y1 = y2;
|
||||||
|
} else {
|
||||||
|
applet.setRGeom(x1, y1, x2, y2);
|
||||||
|
applet.repaint();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str = "[OUT]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user