Compare commits
5 Commits
version.1.
...
arelease
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
587dd7e025 | ||
|
|
84fa2a5347 | ||
|
|
30dd4e7e52 | ||
|
|
34a4901b8d | ||
|
|
a68ccae30f |
126
CMakeLists.txt
126
CMakeLists.txt
@@ -1,126 +0,0 @@
|
||||
# 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")
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
||||
|
||||
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(${OPENJPEG_NAMESPACE} C)
|
||||
|
||||
# Do full dependency headers.
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OPENJPEG version number, useful for packaging and doxygen doc:
|
||||
SET(OPENJPEG_VERSION_MAJOR 1)
|
||||
SET(OPENJPEG_VERSION_MINOR 2)
|
||||
SET(OPENJPEG_VERSION_BUILD 0)
|
||||
SET(OPENJPEG_VERSION
|
||||
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
|
||||
|
||||
# This setting of SOVERSION assumes that any API change
|
||||
# will increment either the minor or major version number of openjpeg
|
||||
SET(OPENJPEG_LIBRARY_PROPERTIES
|
||||
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
|
||||
SOVERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}"
|
||||
)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# OpenJPEG build configuration options.
|
||||
OPTION(BUILD_SHARED_LIBS "Build OpenJPEG with shared libraries." OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
SET (EXECUTABLE_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
||||
SET (LIBRARY_OUTPUT_PATH ${OPENJPEG_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
|
||||
MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 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
|
||||
mj2
|
||||
# cmake 2.4.5 has poor java support
|
||||
#j2kviewer/src
|
||||
)
|
||||
|
||||
IF(NOT UNIX)
|
||||
SUBDIRS(
|
||||
jpwl
|
||||
jp3d
|
||||
indexer_JPIP
|
||||
)
|
||||
ENDIF(NOT UNIX)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build example only if requested
|
||||
IF(BUILD_EXAMPLES)
|
||||
SUBDIRS(codec)
|
||||
ENDIF(BUILD_EXAMPLES)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# For the documentation
|
||||
OPTION(BUILD_DOCUMENTATION "Build the doxygen documentation" OFF)
|
||||
IF(BUILD_DOCUMENTATION)
|
||||
SUBDIRS(doc)
|
||||
ENDIF(BUILD_DOCUMENTATION)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# For openjpeg team if they ever want Dart+CMake
|
||||
IF(OPENJPEG_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(OPENJPEG_STANDALONE)
|
||||
|
||||
# Adding test with dataset from:
|
||||
# http://www.crc.ricoh.com/~gormish/jpeg2000conformance/
|
||||
# http://www.jpeg.org/jpeg2000guide/testimages/testimages.html
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Adding JPEG2000_CONFORMANCE_DATA_ROOT
|
||||
FIND_PATH(JPEG2000_CONFORMANCE_DATA_ROOT testimages.html
|
||||
${OPENJPEG_SOURCE_DIR}/../jpeg2000testimages
|
||||
$ENV{JPEG2000_CONFORMANCE_DATA_ROOT}
|
||||
)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Compiler specific flags:
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
# For all builds, make sure openjpeg is std99 compliant:
|
||||
SET(CMAKE_C_FLAGS "-Wall -std=c99 ${CMAKE_C_FLAGS}")
|
||||
# Do not use ffast-math for all build, it would produce incorrect results, only set for release:
|
||||
SET(CMAKE_C_FLAGS_RELEASE "-ffast-math ${CMAKE_C_FLAGS_RELEASE}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# checkCtrlM checks source code for explicit ctrl-M's
|
||||
# checks only files with the following extensions: .c, .cxx, .txx, .html, .htm
|
||||
# exits with 0, if all commited files pass the test.
|
||||
# exits with 1, if any one of the tests fails
|
||||
#
|
||||
# checkCtrlM can be run as a cvs commitinfo command.
|
||||
# The following commitinfo line (without the #) will run the script
|
||||
# ALL $CVSROOT/CVSROOT/checkCtrlM
|
||||
#
|
||||
failed=0
|
||||
#
|
||||
# skip the first arg, the directory
|
||||
shift 1
|
||||
|
||||
for file in "$@"; do
|
||||
#
|
||||
# select files with extentions .txx, .cxx, .h, .html, .htm, .c, .txt, .cmake
|
||||
match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]html\$\|\[\.\]htm\$\|\[\.\]c\$\|\[\.\]txt\$\|\[\.\]cmake\$`
|
||||
if [ "x$match" != "x" ] ; then
|
||||
count=`grep -n
|
||||
\$ /dev/null $file|wc -c`
|
||||
results=`expr $count \| 0`
|
||||
if [ "$results" != "0" ]; then
|
||||
echo "=========================================================="
|
||||
if [ $results -lt 200 ]; then
|
||||
grep -n
|
||||
\$ /dev/null $file
|
||||
fi
|
||||
echo ""
|
||||
echo "$file has ^M's. They must be removed before you can commit."
|
||||
echo "The problem count was $results"
|
||||
echo "=========================================================="
|
||||
failed=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
exit $failed
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/tcsh
|
||||
#
|
||||
# checkTabs checks source code for explicit TABS
|
||||
# checks only files with the following extensions: .c, .cxx, .txx,
|
||||
# exits with 0, if all commited files pass the test.
|
||||
# exits with 1, if any one of the tests fails
|
||||
#
|
||||
# checkTabs can be run as a cvs commitinfo command.
|
||||
# The following commitinfo line (without the #) will run the script
|
||||
# ALL $CVSROOT/CVSROOT/checkTabs
|
||||
#
|
||||
set failed=0
|
||||
#
|
||||
# skip the first arg, the directory
|
||||
foreach file ( $argv[2-] )
|
||||
#
|
||||
# select files with extentions .txx, .cxx, .h, .html, .htm
|
||||
set match=`echo $file | egrep \[\.\]txx\$\|\[\.\]cxx\$\|\[\.\]h\$\|\[\.\]cpp\$\|\[\.\]htm\$\|\[\.\]html\$\|\[\.\]c\$\|\[\.\]mm\$\|\[\.\]h.in\$\|\[\.\]hxx.in\$\|CMakeLists.txt\$\|\[\.\]cmake\$\|\[\.\]cmake.in\$`
|
||||
if ( $match == "" ) continue;
|
||||
set count=`grep -n " " /dev/null $file|wc -c`
|
||||
set results=`expr $count \| 0`
|
||||
if ( "$results" != "0" ) then
|
||||
echo "=========================================================="
|
||||
grep -n " " /dev/null $file
|
||||
echo ""
|
||||
echo "$file has explicit TABSs."
|
||||
echo "They must be converted to SPACES(2 per TAB) before you can commit."
|
||||
echo "=========================================================="
|
||||
set failed=1
|
||||
endif
|
||||
end
|
||||
exit $failed
|
||||
@@ -1,15 +0,0 @@
|
||||
# The "checkoutlist" file is used to support additional version controlled
|
||||
# administrative files in $CVSROOT/CVSROOT, such as template files.
|
||||
#
|
||||
# The first entry on a line is a filename which will be checked out from
|
||||
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
|
||||
# The remainder of the line is an error message to use if the file cannot
|
||||
# be checked out.
|
||||
#
|
||||
# File format:
|
||||
#
|
||||
# [<whitespace>]<filename><whitespace><error message><end-of-line>
|
||||
#
|
||||
# comment lines begin with '#'
|
||||
checkCtrlM cannot check out checkCtrlM
|
||||
checkTabs cannot check out checkTabs
|
||||
@@ -1,18 +0,0 @@
|
||||
# The "commitinfo" file is used to control pre-commit checks.
|
||||
# The filter on the right is invoked with the repository and a list
|
||||
# of files to check. A non-zero exit of the filter program will
|
||||
# cause the commit to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
|
||||
ALL $CVSROOT/CVSROOT/checkCtrlM %r/%p %s
|
||||
# ALL $CVSROOT/CVSROOT/checkTabs %r/%p %s
|
||||
@@ -1,14 +0,0 @@
|
||||
# Set this to "no" if pserver shouldn't check system users/passwords
|
||||
#SystemAuth=no
|
||||
|
||||
# Put CVS lock files in this directory rather than directly in the repository.
|
||||
#LockDir=/var/lock/cvs
|
||||
|
||||
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
|
||||
# level of the new working directory when using the `cvs checkout'
|
||||
# command.
|
||||
#TopLevelAdmin=no
|
||||
|
||||
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
|
||||
# history file, or a subset as needed (ie `TMAR' logs all write operations)
|
||||
#LogHistory=TOFEWGCMAR
|
||||
@@ -1,23 +0,0 @@
|
||||
# This file affects handling of files based on their names.
|
||||
#
|
||||
# The -t/-f options allow one to treat directories of files
|
||||
# as a single file, or to transform a file in other ways on
|
||||
# its way in and out of CVS.
|
||||
#
|
||||
# The -m option specifies whether CVS attempts to merge files.
|
||||
#
|
||||
# The -k option specifies keyword expansion (e.g. -kb for binary).
|
||||
#
|
||||
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
|
||||
#
|
||||
# wildcard [option value][option value]...
|
||||
#
|
||||
# where option is one of
|
||||
# -f from cvs filter value: path to filter
|
||||
# -t to cvs filter value: path to filter
|
||||
# -m update methodology value: MERGE or COPY
|
||||
# -k expansion mode value: b, o, kkv, &c
|
||||
#
|
||||
# and value is a single-quote delimited value.
|
||||
# For example:
|
||||
#*.gif -k 'b'
|
||||
@@ -1,21 +0,0 @@
|
||||
# The "editinfo" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
@@ -1,26 +0,0 @@
|
||||
# The "loginfo" file controls where "cvs commit" log information
|
||||
# is sent. The first entry on a line is a regular expression which must match
|
||||
# the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. If a match is found, then the remainder of the line is a filter
|
||||
# program that should expect log information on its standard input.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name ALL appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or DEFAULT.
|
||||
#
|
||||
# You may specify a format string as part of the
|
||||
# filter. The string is composed of a `%' followed
|
||||
# by a single format character, or followed by a set of format
|
||||
# characters surrounded by `{' and `}' as separators. The format
|
||||
# characters are:
|
||||
#
|
||||
# s = file name
|
||||
# V = old version number (pre-checkin)
|
||||
# v = new version number (post-checkin)
|
||||
#
|
||||
# For example:
|
||||
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
# or
|
||||
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
@@ -1,29 +0,0 @@
|
||||
# Three different line formats are valid:
|
||||
# key -a aliases...
|
||||
# key [options] directory
|
||||
# key [options] directory files...
|
||||
#
|
||||
# Where "options" are composed of:
|
||||
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
||||
# -o prog Run "prog" on "cvs checkout" of module.
|
||||
# -e prog Run "prog" on "cvs export" of module.
|
||||
# -t prog Run "prog" on "cvs rtag" of module.
|
||||
# -u prog Run "prog" on "cvs update" of module.
|
||||
# -d dir Place module in directory "dir" instead of module name.
|
||||
# -l Top-level directory only -- do not recurse.
|
||||
#
|
||||
# NOTE: If you change any of the "Run" options above, you'll have to
|
||||
# release and re-checkout any working directories of these modules.
|
||||
#
|
||||
# And "directory" is a path to a directory relative to $CVSROOT.
|
||||
#
|
||||
# The "-a" option specifies an alias. An alias is interpreted as if
|
||||
# everything on the right of the "-a" had been typed on the command line.
|
||||
#
|
||||
# You can encode a module within a module by using the special '&'
|
||||
# character to interpose another module into the current module. This
|
||||
# can be useful for creating a module that consists of many directories
|
||||
# spread out over the entire source repository.
|
||||
|
||||
opj-base -l -d . .
|
||||
openjpeg -a opj-base libopenjpeg codec doc
|
||||
@@ -1,12 +0,0 @@
|
||||
# The "notify" file controls where notifications from watches set by
|
||||
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
|
||||
# a regular expression which is tested against the directory that the
|
||||
# change is being made to, relative to the $CVSROOT. If it matches,
|
||||
# then the remainder of the line is a filter program that should contain
|
||||
# one occurrence of %s for the user to notify, and information on its
|
||||
# standard input.
|
||||
#
|
||||
# "ALL" or "DEFAULT" can be used in place of the regular expression.
|
||||
#
|
||||
# For example:
|
||||
#ALL mail %s -s "CVS notification"
|
||||
@@ -1,13 +0,0 @@
|
||||
# The "rcsinfo" file is used to control templates with which the editor
|
||||
# is invoked on commit and import.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. For the first match that is found, then the remainder of the
|
||||
# line is the name of the file that contains the template.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,20 +0,0 @@
|
||||
# The "taginfo" file is used to control pre-tag checks.
|
||||
# The filter on the right is invoked with the following arguments:
|
||||
#
|
||||
# $1 -- tagname
|
||||
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
|
||||
# $3 -- repository
|
||||
# $4-> file revision [file revision ...]
|
||||
#
|
||||
# A non-zero exit of the filter program will cause the tag to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,21 +0,0 @@
|
||||
# The "verifymsg" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
479
ChangeLog
479
ChangeLog
@@ -1,479 +0,0 @@
|
||||
What's New for OpenJPEG
|
||||
|
||||
* : fixed
|
||||
- : removed
|
||||
! : changed
|
||||
+ : added
|
||||
|
||||
December 21, 2007
|
||||
* [FOD] Bug fixed by David Bruken. Fixed memory allocation issue in opj_malloc.h
|
||||
! [FOD] Possible errors in pi_create_encode handled
|
||||
|
||||
December 19, 2007
|
||||
* [Antonin] changed variables names alpha, beta, gamma, delta in dwt.c to avoid re-declarations on Macosx
|
||||
! [Parvatha] In pi.c, removed the Recursive function pi_check_next_level() and modified the code.
|
||||
* [FOD] Fixed allocation problem in pi.c
|
||||
|
||||
December 19, 2007
|
||||
+ [FOD] In mqc.h, changed MQC_NUMCTXS from 32 to 19 as there are only 19 possible contexts
|
||||
|
||||
December 10, 2007
|
||||
+ [FOD] First import of JAVAOpenJPEG, a Java wrapper of OpenJPEG, developed by Patrick Piscaglia of Telemis (www.telemis.com).
|
||||
Thank you Patrick for this new module !
|
||||
|
||||
November 29, 2007
|
||||
! [GB] Added index.h and index.c in VC6 projects; wrapped index.h in the C++ preprocessor; modified OPJViewer project and some files.
|
||||
|
||||
November 14, 2007
|
||||
+ [FOD] Created the file index.c in the codec directory. This file handles the creation of index files,
|
||||
at encoding and decoding.
|
||||
* [FOD] Fixed bugs during the creation of the index (PCRL progression order)
|
||||
* [FOD] Fixed the maximum number of resolutions a user can discard while decoding.
|
||||
Added an error state in J2K_STATE (j2k.c)
|
||||
|
||||
November 14, 2007
|
||||
! [FOD] - First Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c
|
||||
- Second Patch by Callum Lerwick. This patch rearranges the largest memory allocations so they're allocated as
|
||||
late as possible, and freed as soon as possible. This cuts memory usage by about half on two large test images.
|
||||
- Third Patch by Callum Lerwick. The opj_tcd_cblk array is one of the largest allocations, because it
|
||||
contains a bunch of static buffers. This also makes it a major source of cache thrashing. This patch allocates
|
||||
the buffers from the heap, and dynamically sizes them in the decoder. I have not yet managed to dynamically size
|
||||
them in the encoder, getting the decoder to do it was tricky enough... I also split opj_tcd_cblk_t into separate
|
||||
encode and decode versions. A lot of fields were not used by both, so this cuts its size even further.
|
||||
|
||||
* [FOD] Avoided ABI breakage
|
||||
|
||||
November 13, 2007
|
||||
! [FOD] Patch by Dzonatas and Callum Lerwick.
|
||||
Fp/vectorization patch which basically converts most of the irreversible decode codepath to floating point,
|
||||
eliminating a few rounds of int/fp conversion, resulting in a vast performance improvement,
|
||||
and an increase in accuracy.
|
||||
|
||||
November 8, 2007
|
||||
! [FOD] In t1.c, small change to avoid calling twice t1_getwmsedec()
|
||||
Patches from Callum Lewick:
|
||||
- Basic gcc optimization flags in cmake and makefile match.
|
||||
- Fixed some spelling errors in dwt.c.
|
||||
|
||||
November 5, 2007
|
||||
*+ [GB] Fixed a bug which prevented JPWL from working on multi-tiled images; added some more fields in the interface info structures
|
||||
(keep a list of markers, save start packet number for each tile)
|
||||
|
||||
October 23, 2007
|
||||
* [GB] Improved success for the linux build; OPJViewer shows all the COM contents
|
||||
|
||||
October 18, 2007
|
||||
* [FOD] Changed the ROI parameter in the image_to_j2k codec to make it correspond to the documentation (i.e. -ROI c=0,U=25)
|
||||
* [FOD] Patch from Callum Lewick. Memset patch.
|
||||
The main idea of the patch is that currently opj_malloc clears all allocations, which unnecessarily
|
||||
dirties up the cache and eats bandwidth. This patch makes it no longer do so, and I've painstakingly determined which allocations actually need
|
||||
to be cleared and changed them to use opj_calloc() instead. I previously tried to just get rid of the opj_*alloc wrappers but that
|
||||
idea was nixed, so this time I'm trying it with macros. I also put in a gcc pragma that helps enforce their use. Which got messy. :) It caught a
|
||||
few places they weren't used but it also revealed that the mj2 tools are not very cleanly separated from the library. It includes all the
|
||||
internal headers, but it wasn't using the malloc wrappers. I figured the binaries should be "external" and have minimal knowledge of the
|
||||
internals of the library. I patched them to not include opj_includes.h, and include only the internal headers they actually need. However,
|
||||
they're using the opj_clock() function, which is in with the malloc wrappers. So I decided to move the malloc wrappers to their own header.
|
||||
But mj2.c seems to want to be "internal", so I patched it to use the wrappers. Note that this patch changes the semantics of opj_malloc, it no longer
|
||||
clears the memory it allocates. If you need it to be cleared, you must use opj_calloc instead, or memset it yourself. It is also somewhat
|
||||
invasive, please test it extensively. I've been pounding on it all summer with my test suite, Second Life, and valgrind, and it checks out clean.
|
||||
|
||||
October 12, 2007
|
||||
* [FOD] Changed the way the image structure is allocated when the decoding parameters include some resolutions to discard.
|
||||
This should have a significant impact for the decoding of huge images when some resolutions are discarder (-r parameter)
|
||||
Warning: The output image size is now reduced when discarding resolutions !
|
||||
|
||||
October 10, 2007
|
||||
* [FOD] Patch from Callum Lewick. Clean up of j2klib.h for the aligned malloc stuff.
|
||||
It makes it work right with mingw, as _mm_malloc() isn't a macro, attempts to pave the way to using cmake
|
||||
to check for this stuff and combines a patch from Dana Fagerstrom at Sun that makes it use memalign() on Solaris
|
||||
convert.c: Changed some error comments for TIFF images
|
||||
|
||||
September 27, 2007
|
||||
* [FOD] Patch from Callum Lewick. Fixed dwt.c where an alignment in buffer was problematic under x86_64.
|
||||
|
||||
September 25, 2007
|
||||
* [Mathieu Malaterre] BUG: Fix previous patch from Callum Lerwick. I have no
|
||||
clue what CMAKE_INSTALL_LIBDIR refers too. Bump up cmake 2.2 restriction to
|
||||
cmake 2.4 because of previous patch (not backward compatible). Properly set the SOVERSION in a cross plateform way (yes WIN32 is a platform)
|
||||
|
||||
September 19, 2007
|
||||
* [Parvatha] Fixed issues with generation of SOP marker.
|
||||
|
||||
September 18, 2007
|
||||
* [Parvatha] Fixed issues with Reading and Writing TIF images in convert.c to avoid segmentation fault.
|
||||
* [Parvatha] Fixed issues relating to using user specified rates for CINEMA option for multiple images.
|
||||
|
||||
September 17, 2007
|
||||
* [FOD] Fixed issues with cstr_info when codestream has components with different number of resolutions.
|
||||
! [FOD] OpenJPEG library interface modified to retain compatibility with version 1.2
|
||||
|
||||
September 12, 2007
|
||||
* [FOD] Patch from Callum Lerwick.
|
||||
Fixed the library linking so it links with the soversion properly set.
|
||||
Fixes up the install targets so that it interacts properly with RPM.
|
||||
Install target for MJ2. Sets some necessary and useful CFLAGS if gcc is in use.
|
||||
* [FOD] Updated the MJ2 codec to be compatible with the recent changes in the OpenJPEG library
|
||||
|
||||
September 11, 2007
|
||||
* [GB] JPWL encoding is finalized correctly into the JP2 file format; added an additional structure in opj_codestream_info, to keep a record of the written markers
|
||||
|
||||
September 8, 2007
|
||||
* [GB] Adapted the JPWL and OPJViewer code to new interface; fixed a samll bug in JPWL which created large EPBs even when null protection was specified
|
||||
|
||||
September 7, 2007
|
||||
+ [FOD] Indexes can now be generated when decoding J2K codestreams.
|
||||
* [Mathieu Malaterre] Upon failure, properly return error code (!=0).
|
||||
* [Mathieu Malaterre] CMake: Add cmake code to do testing if user has properly setup a testimages directory
|
||||
|
||||
September 6, 2007
|
||||
+ [Mathieu Malaterre] CMake: start compiling mj2, jpwl and jp3d
|
||||
+ [Mathieu Malaterre] CMake: output all executable/libs into one single directory
|
||||
+ [Mathieu Malaterre] CMake: start compiling index_create
|
||||
+ [Mathieu Malaterre] OpenJPEG.rc update copyright year
|
||||
+ [Mathieu Malaterre] CMake: add Java j2kviewer but do not compile it using cmake since cmake has too poor support for Java. Should create a custom command running ant instead.
|
||||
+ [Mathieu Malaterre] CMake: Add doxygen output
|
||||
+ [GB] One more field in the codestream_info struct for recording the number of packets per tile part; JPWL now distributes the EPBs in all the tile part headers
|
||||
+ [Mathieu Malaterre] CMake: Add very simple tests (simply run command line with no option)
|
||||
* [Mathieu Malaterre] Fix unitialized read in img_fol (we may need a smarter initialize than memset)
|
||||
|
||||
September 4, 2007
|
||||
+ [GB] Added some fields in the codestream_info structure: they are used to record the position of single tile parts.
|
||||
Changed also the write_index function in the codec, to reflect the presence of this new information.
|
||||
|
||||
September 3, 2007
|
||||
+ [GB] Added the knowledge of JPSEC SEC and INSEC markers (you have to compile the JPWL project). Management of these markers is limited to skipping them without crashing:
|
||||
no real security function at this stage. Deprecated USE_JPSEC will be removed next
|
||||
|
||||
August 31, 2007
|
||||
* [GB] Fixed save capabilities in OPJViewer due to recent code upgrade
|
||||
|
||||
August 30, 2007
|
||||
* [FOD] Changed the OpenJPEG library interface to enable users to access information regarding the codestream (also called codestream index).
|
||||
This index is usefull for all applications requiring to have a scalable acces to the codestream (like JPIP applications, ...)
|
||||
Currently, this information is only available when encoding an image.
|
||||
+ [FOD] Added the information regarding the end of packet position in the index
|
||||
|
||||
August 28, 2007
|
||||
* [FOD] Fixed wrong destructors called in openjpeg.c
|
||||
* [FOD] Fixed bug in j2k_decode_jpt_stream
|
||||
|
||||
August 24, 2007
|
||||
* [Parvatha] The end of main header is calculated after TLM and POC marker for Dcinema.
|
||||
|
||||
August 21, 2007
|
||||
+ [FOD] Added support for Visual Studio 2005
|
||||
* [FOD] Robustified MJ2 codecs
|
||||
* [Parvatha] Solved problems with codec reading from image file directory when filename had more than one "." in name
|
||||
* [Callum Lerwick] Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler
|
||||
* [Callum Lerwick] Aligned malloc using Intel's _mm_malloc(). Cleanup on the t1 memory allocation, getting rid of some leftover debug code
|
||||
* [Callum Lerwick] Memory leaks fixed
|
||||
* [Callum Lerwick] Reworks of t1_updateflags to get rid of the shift operation
|
||||
* [Callum Lerwick] mqc_setcurctx moved to the header to allow it to be inlined into the t1.
|
||||
* [Callum Lerwick] Consolidated some calls to mqc_setcurctx.
|
||||
* [Callum Lerwick] Cleaned up t1_generate_luts to output the proper types.
|
||||
* [Callum Lerwick] Replaced the large ctxno_mag lookup table with a small bit of inline-able branchless code
|
||||
* [Callum Lerwick] Moved the orient flipping into the ctxno_zc table.
|
||||
|
||||
August 20, 2007
|
||||
+ [FOD] Added support for the TGA file format in the codec
|
||||
|
||||
August 08, 2007
|
||||
* [Parvatha] Fixed the DCinema filesize allocation. It now includes the SOT marker size
|
||||
|
||||
August 02, 2007
|
||||
+ [GB] Added a basic saving capability to OPJViewer
|
||||
|
||||
July 18, 2007
|
||||
! [FOD] Updated libtiff library version to 3.8.2 (for WIN32)
|
||||
* [FOD] Updated BMP and PxM truncation when decoding J2K files with more than 8 bits
|
||||
|
||||
July 17, 2007
|
||||
* [FOD] Fixed raw option for images with more than three components
|
||||
|
||||
July 17, 2007
|
||||
+ [FOD] Added support for RAW images. This module has been developped by the University of Perugia team. Thanks to them ! [image_to_j2k.c j2k_to_image.c convert.c convert.h]
|
||||
|
||||
July 13, 2007
|
||||
! [FOD] Modified the memory allocation for codestreams containing multiple tiles. The memory is now allocated for each tile indenpendently,
|
||||
leading to an important decrease of the virtual memory needed. [j2k.c tcd.h tcd.c]
|
||||
! [FOD] Modified old comments about the ability to decode mega-images and comments about the disk size necessary to do this. [image_to_j2k.c and frames_to_mj2.c]
|
||||
* [FOD] Added 2000 bytes for the memory allocation in cio.c for the minimum size of headers (useful in case of very small images) [cio.c]
|
||||
|
||||
July 12, 2007
|
||||
* [GB] fixed a bug in JPWL module, which prevented to exploit the full error correction capability of RS codes (e.g. it gave up at 5 errors,
|
||||
even if 6 were correctable); defined a JPWL_MAXIMUM_EPB_ROOM for better customization of the maximum dimension of EPBs (the dimension
|
||||
is pre-calculated on an hypothesis, if it goes beyond 65535 there will be problems, thus we give a little less than the max, let's say 65450)
|
||||
|
||||
July 8, 2007
|
||||
* [ANTONIN] fixed the size of the memory allocation in cio.c (confusion between bits and bytes)
|
||||
|
||||
June 21, 2007
|
||||
* [FOD] Output image color space set when decoding a JP2 file in jp2.c
|
||||
+ [GB] Previous, home, and next frame buttons for exploring MJ2 files in OPJViewer
|
||||
|
||||
June 18, 2007
|
||||
* [GB] Reload image doesn't crash in OPJViewer; more settings saved to registry
|
||||
|
||||
June 16, 2007
|
||||
+ [GB] Possibility to disable parsing in OPJViewer; also, saves common settings to the registry
|
||||
|
||||
June 15, 2007
|
||||
* [FOD] Fixed the generation of index files
|
||||
|
||||
|
||||
----------------------
|
||||
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
|
||||
273
DllOpenJPEG.dsp
273
DllOpenJPEG.dsp
@@ -1,273 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="DllOpenJPEG" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=DllOpenJPEG - 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 "DllOpenJPEG.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 "DllOpenJPEG.mak" CFG="DllOpenJPEG - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "DllOpenJPEG - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "DllOpenJPEG - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "DllOpenJPEG - 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 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DLLOPENJPEG_EXPORTS" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPJ_EXPORTS" /FD /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# 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 /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"
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Cmds=if not exist dist mkdir dist copy libopenjpeg\openjpeg.h dist copy Release\OpenJPEG.dll dist copy Release\OpenJPEG.lib dist
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "DllOpenJPEG - 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 /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 CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPJ_EXPORTS" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# 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 /dll /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 /nologo /dll /debug /machine:I386 /out:"Debug/OpenJPEGd.dll" /pdbtype:sept
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Cmds=if not exist dist mkdir dist copy libopenjpeg\openjpeg.h dist copy Debug\OpenJPEGd.dll dist copy Debug\OpenJPEGd.lib dist
|
||||
# End Special Build Tool
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "DllOpenJPEG - Win32 Release"
|
||||
# Name "DllOpenJPEG - 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\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
|
||||
# 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
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DllOpenJPEG", "DllOpenJPEG.vcproj", "{89AC992C-5E2C-4E6B-A453-61C1DF446216}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{89AC992C-5E2C-4E6B-A453-61C1DF446216}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{89AC992C-5E2C-4E6B-A453-61C1DF446216}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{89AC992C-5E2C-4E6B-A453-61C1DF446216}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{89AC992C-5E2C-4E6B-A453-61C1DF446216}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,670 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="DllOpenJPEG"
|
||||
ProjectGUID="{89AC992C-5E2C-4E6B-A453-61C1DF446216}"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/DllOpenJPEG.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
FavorSizeOrSpeed="1"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OPJ_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/DllOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="Release/OpenJPEG.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\Release/OpenJPEG.pdb"
|
||||
LinkTimeCodeGeneration="0"
|
||||
ImportLibrary=".\Release/OpenJPEG.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/DllOpenJPEG.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="if not exist dist mkdir dist
copy libopenjpeg\openjpeg.h dist
copy Release\OpenJPEG.dll dist
copy Release\OpenJPEG.lib dist
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/DllOpenJPEG.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OPJ_EXPORTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\Debug/DllOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="Debug/OpenJPEGd.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/OpenJPEGd.pdb"
|
||||
ImportLibrary=".\Debug/OpenJPEGd.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Debug/DllOpenJPEG.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="if not exist dist mkdir dist
copy libopenjpeg\openjpeg.h dist
copy Debug\OpenJPEGd.dll dist
copy Debug\OpenJPEGd.lib dist
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="libopenjpeg\bio.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\cio.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\dwt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\event.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\image.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k_lib.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jp2.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jpt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mct.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mqc.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\openjpeg.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\pi.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\raw.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t1.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t2.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tcd.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tgt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="libopenjpeg\bio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\cio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\dwt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\event.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\fix.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\image.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\int.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k_lib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jp2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mqc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\openjpeg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\opj_includes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\pi.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\raw.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tcd.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tgt.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,53 +0,0 @@
|
||||
# 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)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,110 +0,0 @@
|
||||
# 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,276 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="JavaOpenJPEG"
|
||||
ProjectGUID="{9D538724-B030-464C-A419-C80B3BC0D020}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories="C:\users\pp\telemis\working\projects\codecs\OpenJPEG2000\codec;../libopenjpeg;"../../../../3rdparty/windows/java-jni/include";"../../../../3rdparty/windows/java-jni/include/win32""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPJ_STATIC;CHECK_THRESHOLDS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
PrecompiledHeaderFile=".\Release/JavaOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib"
|
||||
OutputFile="../../dlls/win32/JavaOpenJPEG.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
IgnoreDefaultLibraryNames="libc"
|
||||
ProgramDatabaseFile=".\Release/JavaOpenJPEG.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/JavaOpenJPEG.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
GlobalOptimizations="FALSE"
|
||||
InlineFunctionExpansion="0"
|
||||
FavorSizeOrSpeed="0"
|
||||
OptimizeForWindowsApplication="FALSE"
|
||||
AdditionalIncludeDirectories="../libopenjpeg,../../../../3rdparty/windows/java-jni/include,../../../../3rdparty/windows/java-jni/include/win32"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPJ_STATIC"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\Debug/JavaOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib"
|
||||
OutputFile=".\Debug/JavaOpenJPEG.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
IgnoreDefaultLibraryNames="libc"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/JavaOpenJPEG.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/JavaOpenJPEG.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1036"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release64|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories="../libopenjpeg;../../../../3rdparty/windows/java-jni/include;../../../../3rdparty/windows/java-jni/include/win32"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPJ_STATIC"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
PrecompiledHeaderFile=".\Release64/JavaOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Release64/"
|
||||
ObjectFile=".\Release64/"
|
||||
ProgramDataBaseFileName=".\Release64/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/machine:AMD64"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib "C:\Program Files\Microsoft Platform SDK\Lib\AMD64\bufferoverflowu.lib""
|
||||
OutputFile="../../dlls/win32/JavaOpenJPEG.W64.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
IgnoreDefaultLibraryNames="libc"
|
||||
ProgramDatabaseFile=".\Release64/JavaOpenJPEG.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="0"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/JavaOpenJPEG.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="..\codec\convert.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\codec\convert.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\codec\dirent.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\codec\compat\getopt.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\codec\compat\getopt.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\codec\index.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\codec\index.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="JavaOpenJPEG.c">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release64|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\JavaOpenJPEGDecoder.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\org_openJpeg_OpenJPEGJavaDecoder.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\org_openJpeg_OpenJPEGJavaEncoder.h">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,897 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 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
|
||||
* Copyright (c) 2007, Patrick Piscaglia (Telemis)
|
||||
* 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 <jni.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "compat/getopt.h"
|
||||
#include "convert.h"
|
||||
#include "dirent.h"
|
||||
#include "org_openJpeg_OpenJPEGJavaDecoder.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
|
||||
#define RAW_DFMT 15
|
||||
#define TGA_DFMT 16
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
typedef struct callback_variables {
|
||||
JNIEnv *env;
|
||||
/** 'jclass' object used to call a Java method from the C */
|
||||
jobject *jobj;
|
||||
/** 'jclass' object used to call a Java method from the C */
|
||||
jmethodID message_mid;
|
||||
jmethodID error_mid;
|
||||
} callback_variables_t;
|
||||
|
||||
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", "raw", "tga", "j2k", "jp2", "jpt", "j2c" };
|
||||
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT };
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
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:hx:"
|
||||
|
||||
#ifdef USE_JPWL
|
||||
"W:"
|
||||
#endif /* USE_JPWL */
|
||||
;
|
||||
/*for (i=0; i<argc; i++) {
|
||||
printf("[%s]",argv[i]);
|
||||
}
|
||||
printf("\n");*/
|
||||
|
||||
/* <<UniPG */
|
||||
totlen=sizeof(long_option);
|
||||
img_fol->set_out_format = 0;
|
||||
reset_options_reading();
|
||||
|
||||
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:
|
||||
case RAW_DFMT:
|
||||
case TGA_DFMT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \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;
|
||||
case RAW_DFMT:
|
||||
img_fol->out_format = "raw";
|
||||
break;
|
||||
case TGA_DFMT:
|
||||
img_fol->out_format = "raw";
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/* No check for possible errors before the -i and -o options are of course not mandatory*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
error callback returning the message to Java andexpecting a callback_variables_t client object
|
||||
*/
|
||||
void error_callback(const char *msg, void *client_data) {
|
||||
callback_variables_t* vars = (callback_variables_t*) client_data;
|
||||
JNIEnv *env = vars->env;
|
||||
jstring jbuffer;
|
||||
|
||||
jbuffer = (*env)->NewStringUTF(env, msg);
|
||||
(*env)->ExceptionClear(env);
|
||||
(*env)->CallVoidMethod(env, *(vars->jobj), vars->error_mid, jbuffer);
|
||||
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
fprintf(stderr,"C: Exception during call back method\n");
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, jbuffer);
|
||||
}
|
||||
/**
|
||||
warning callback returning the message to Java andexpecting a callback_variables_t client object
|
||||
*/
|
||||
void warning_callback(const char *msg, void *client_data) {
|
||||
callback_variables_t* vars = (callback_variables_t*) client_data;
|
||||
JNIEnv *env = vars->env;
|
||||
jstring jbuffer;
|
||||
|
||||
jbuffer = (*env)->NewStringUTF(env, msg);
|
||||
(*env)->ExceptionClear(env);
|
||||
(*env)->CallVoidMethod(env, *(vars->jobj), vars->message_mid, jbuffer);
|
||||
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
fprintf(stderr,"C: Exception during call back method\n");
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, jbuffer);
|
||||
}
|
||||
/**
|
||||
information callback returning the message to Java andexpecting a callback_variables_t client object
|
||||
*/
|
||||
void info_callback(const char *msg, void *client_data) {
|
||||
callback_variables_t* vars = (callback_variables_t*) client_data;
|
||||
JNIEnv *env = vars->env;
|
||||
jstring jbuffer;
|
||||
|
||||
jbuffer = (*env)->NewStringUTF(env, msg);
|
||||
(*env)->ExceptionClear(env);
|
||||
(*env)->CallVoidMethod(env, *(vars->jobj), vars->message_mid, jbuffer);
|
||||
|
||||
if ((*env)->ExceptionOccurred(env)) {
|
||||
fprintf(stderr,"C: Exception during call back method\n");
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, jbuffer);
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
-------------------- MAIN METHOD, CALLED BY JAVA -----------------------*/
|
||||
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage(JNIEnv *env, jobject obj, jobjectArray javaParameters) {
|
||||
int argc; /* To simulate the command line parameters (taken from the javaParameters variable) and be able to re-use the */
|
||||
char **argv; /* 'parse_cmdline_decoder' method taken from the j2k_to_image project */
|
||||
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,j,imageno;
|
||||
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
|
||||
opj_cio_t *cio = NULL;
|
||||
int w,h;
|
||||
long min_value, max_value;
|
||||
short tempS; unsigned char tempUC, tempUC1, tempUC2;
|
||||
// ==> Access variables to the Java member variables
|
||||
jsize arraySize;
|
||||
jclass cls;
|
||||
jobject object;
|
||||
jboolean isCopy;
|
||||
jfieldID fid;
|
||||
jbyteArray jba;
|
||||
jshortArray jsa;
|
||||
jintArray jia;
|
||||
jbyte *jbBody, *ptrBBody;
|
||||
jshort *jsBody, *ptrSBody;
|
||||
jint *jiBody, *ptrIBody;
|
||||
callback_variables_t msgErrorCallback_vars;
|
||||
// <=== access variable to Java member variables */
|
||||
int *ptr, *ptr1, *ptr2; // <== To transfer the decoded image to Java
|
||||
|
||||
/* configure the event callbacks */
|
||||
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;
|
||||
|
||||
// JNI reference to the calling class
|
||||
cls = (*env)->GetObjectClass(env, obj);
|
||||
|
||||
// Pointers to be able to call a Java method for all the info and error messages
|
||||
msgErrorCallback_vars.env = env;
|
||||
msgErrorCallback_vars.jobj = &obj;
|
||||
msgErrorCallback_vars.message_mid = (*env)->GetMethodID(env, cls, "logMessage", "(Ljava/lang/String;)V");
|
||||
msgErrorCallback_vars.error_mid = (*env)->GetMethodID(env, cls, "logError", "(Ljava/lang/String;)V");
|
||||
|
||||
// Get the String[] containing the parameters, and converts it into a char** to simulate command line arguments.
|
||||
arraySize = (*env)->GetArrayLength(env, javaParameters);
|
||||
argc = (int) arraySize +1;
|
||||
argv = malloc(argc*sizeof(char*));
|
||||
argv[0] = "ProgramName.exe"; // The program name: useless
|
||||
j=0;
|
||||
for (i=1; i<argc; i++) {
|
||||
object = (*env)->GetObjectArrayElement(env, javaParameters, i-1);
|
||||
argv[i] = (*env)->GetStringUTFChars(env, object, &isCopy);
|
||||
}
|
||||
|
||||
/*printf("C: decoder params = ");
|
||||
for (i=0; i<argc; i++) {
|
||||
printf("[%s]",argv[i]);
|
||||
}
|
||||
printf("\n");*/
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
parameters.decod_format = J2K_CFMT;
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol) == 1) {
|
||||
// Release the Java arguments array
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
return -1;
|
||||
}
|
||||
// Release the Java arguments array
|
||||
for (i=1; i<argc; i++)
|
||||
(*env)->ReleaseStringUTFChars(env, (*env)->GetObjectArrayElement(env, javaParameters, i-1), argv[i]);
|
||||
|
||||
num_images=1;
|
||||
|
||||
// Get additional information from the Java object variables
|
||||
fid = (*env)->GetFieldID(env, cls,"skippedResolutions", "I");
|
||||
parameters.cp_reduce = (short) (*env)->GetIntField(env, obj, fid);
|
||||
|
||||
/*Decoding image one by one*/
|
||||
for(imageno = 0; imageno < num_images ; imageno++)
|
||||
{
|
||||
image = NULL;
|
||||
fprintf(stderr,"\n");
|
||||
|
||||
/* read the input file and put it in memory into the 'src' object, if the -i option is given in JavaParameters.
|
||||
Implemented for debug purpose. */
|
||||
/* -------------------------------------------------------------- */
|
||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||
//printf("C: opening [%s]\n", parameters.infile);
|
||||
fsrc = fopen(parameters.infile, "rb");
|
||||
if (!fsrc) {
|
||||
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.infile);
|
||||
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);
|
||||
//printf("C: %d bytes read from file\n",file_length);
|
||||
} else {
|
||||
// Preparing the transfer of the codestream from Java to C
|
||||
//printf("C: before transfering codestream\n");
|
||||
fid = (*env)->GetFieldID(env, cls,"compressedStream", "[B");
|
||||
jba = (*env)->GetObjectField(env, obj, fid);
|
||||
file_length = (*env)->GetArrayLength(env, jba);
|
||||
jbBody = (*env)->GetByteArrayElements(env, jba, &isCopy);
|
||||
src = (unsigned char*)jbBody;
|
||||
}
|
||||
|
||||
/* 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, &msgErrorCallback_vars);
|
||||
|
||||
/* 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, &msgErrorCallback_vars);
|
||||
|
||||
/* 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, &msgErrorCallback_vars);
|
||||
|
||||
/* 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 */
|
||||
if (parameters.infile && parameters.infile[0]!='\0') {
|
||||
free(src);
|
||||
} else {
|
||||
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
|
||||
}
|
||||
src = NULL;
|
||||
|
||||
/* create output image.
|
||||
If the -o parameter is given in the JavaParameters, write the decoded version into a file.
|
||||
Implemented for debug purpose. */
|
||||
/* ---------------------------------- */
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
// ========= Return the image to the Java structure ===============
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
printf("C: checking thresholds\n");
|
||||
#endif
|
||||
// First compute the real with and height, in function of the resolutions decoded.
|
||||
//wr = (image->comps[0].w + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||
//hr = (image->comps[0].h + (1 << image->comps[0].factor) -1) >> image->comps[0].factor;
|
||||
w = image->comps[0].w;
|
||||
h = image->comps[0].h;
|
||||
|
||||
if (image->numcomps==3) { // 3 components color image
|
||||
ptr = image->comps[0].data;
|
||||
ptr1 = image->comps[1].data;
|
||||
ptr2 = image->comps[2].data;
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
if (image->comps[0].sgnd) {
|
||||
min_value = 0;
|
||||
max_value = 255;
|
||||
} else {
|
||||
min_value = -128;
|
||||
max_value = 127;
|
||||
}
|
||||
#endif
|
||||
// Get the pointer to the Java structure where the data must be copied
|
||||
fid = (*env)->GetFieldID(env, cls,"image24", "[I");
|
||||
jia = (*env)->GetObjectField(env, obj, fid);
|
||||
jiBody = (*env)->GetIntArrayElements(env, jia, 0);
|
||||
ptrIBody = jiBody;
|
||||
printf("C: transfering image24: %d int to Java pointer=%d\n",image->numcomps*w*h, ptrIBody);
|
||||
|
||||
for (i=0; i<w*h; i++) {
|
||||
tempUC = (unsigned char)(ptr[i]);
|
||||
tempUC1 = (unsigned char)(ptr1[i]);
|
||||
tempUC2 = (unsigned char)(ptr2[i]);
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
if (tempUC < min_value)
|
||||
tempUC=min_value;
|
||||
else if (tempUC > max_value)
|
||||
tempUC=max_value;
|
||||
if (tempUC1 < min_value)
|
||||
tempUC1=min_value;
|
||||
else if (tempUC1 > max_value)
|
||||
tempUC1=max_value;
|
||||
if (tempUC2 < min_value)
|
||||
tempUC2=min_value;
|
||||
else if (tempUC2 > max_value)
|
||||
tempUC2=max_value;
|
||||
#endif
|
||||
*(ptrIBody++) = (int) ( (tempUC2<<16) + (tempUC1<<8) + tempUC );
|
||||
}
|
||||
(*env)->ReleaseIntArrayElements(env, jia, jiBody, 0);
|
||||
|
||||
} else { // 1 component 8 or 16 bpp image
|
||||
ptr = image->comps[0].data;
|
||||
printf("C: before transfering a %d bpp image to java (length = %d)\n",image->comps[0].prec ,w*h);
|
||||
if (image->comps[0].prec<=8) {
|
||||
fid = (*env)->GetFieldID(env, cls,"image8", "[B");
|
||||
jba = (*env)->GetObjectField(env, obj, fid);
|
||||
jbBody = (*env)->GetByteArrayElements(env, jba, 0);
|
||||
ptrBBody = jbBody;
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
if (image->comps[0].sgnd) {
|
||||
min_value = 0;
|
||||
max_value = 255;
|
||||
} else {
|
||||
min_value = -128;
|
||||
max_value = 127;
|
||||
}
|
||||
#endif
|
||||
//printf("C: transfering %d shorts to Java image8 pointer = %d\n", wr*hr,ptrSBody);
|
||||
for (i=0; i<w*h; i++) {
|
||||
tempUC = (unsigned char) (ptr[i]);
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
if (tempUC<min_value)
|
||||
tempUC = min_value;
|
||||
else if (tempUC > max_value)
|
||||
tempUC = max_value;
|
||||
#endif
|
||||
*(ptrBBody++) = tempUC;
|
||||
}
|
||||
(*env)->ReleaseByteArrayElements(env, jba, jbBody, 0);
|
||||
printf("C: image8 transfered to Java\n");
|
||||
} else {
|
||||
fid = (*env)->GetFieldID(env, cls,"image16", "[S");
|
||||
jsa = (*env)->GetObjectField(env, obj, fid);
|
||||
jsBody = (*env)->GetShortArrayElements(env, jsa, 0);
|
||||
ptrSBody = jsBody;
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
if (image->comps[0].sgnd) {
|
||||
min_value = 0;
|
||||
max_value = 65535;
|
||||
} else {
|
||||
min_value = -32768;
|
||||
max_value = 32767;
|
||||
}
|
||||
printf("C: minValue = %d, maxValue = %d\n", min_value, max_value);
|
||||
#endif
|
||||
printf("C: transfering %d shorts to Java image16 pointer = %d\n", w*h,ptrSBody);
|
||||
for (i=0; i<w*h; i++) {
|
||||
tempS = (short) (ptr[i]);
|
||||
#ifdef CHECK_THRESHOLDS
|
||||
if (tempS<min_value) {
|
||||
printf("C: value %d truncated to %d\n", tempS, min_value);
|
||||
tempS = min_value;
|
||||
} else if (tempS > max_value) {
|
||||
printf("C: value %d truncated to %d\n", tempS, max_value);
|
||||
tempS = max_value;
|
||||
}
|
||||
#endif
|
||||
*(ptrSBody++) = tempS;
|
||||
}
|
||||
(*env)->ReleaseShortArrayElements(env, jsa, jsBody, 0);
|
||||
printf("C: image16 completely filled\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* free remaining structures */
|
||||
if(dinfo) {
|
||||
opj_destroy_decompress(dinfo);
|
||||
}
|
||||
/* free image data structure */
|
||||
opj_image_destroy(image);
|
||||
|
||||
}
|
||||
return 1; /* OK */
|
||||
}
|
||||
//end main
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k
|
||||
|
||||
CFLAGS = -O3 -lstdc++ # -g -p -pg
|
||||
|
||||
all: j2k_to_image image_to_j2k
|
||||
|
||||
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) 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
|
||||
@@ -1,230 +0,0 @@
|
||||
/*
|
||||
* $Id: $
|
||||
*
|
||||
* Copyright (c) 1999-2007 Telemis SA. All Rights Reserved
|
||||
|
||||
* Author: Patrick Piscaglia, Telemis s.a.
|
||||
*/
|
||||
package org.openJpeg;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
/** This class decodes one J2K codestream into an image (width + height + depth + pixels[],
|
||||
* using the OpenJPEG.org library.
|
||||
* To be able to log messages, the called must register a IJavaJ2KDecoderLogger object.
|
||||
*/
|
||||
public class OpenJPEGJavaDecoder {
|
||||
|
||||
public interface IJavaJ2KDecoderLogger {
|
||||
public void logDecoderMessage(String message);
|
||||
public void logDecoderError(String message);
|
||||
}
|
||||
|
||||
private static boolean isInitialized = false;
|
||||
|
||||
// ===== decompression parameters =============>
|
||||
// These value may be changed for each image
|
||||
private String[] decoder_arguments = null;
|
||||
/** number of resolutions decompositions */
|
||||
private int nbResolutions = -1;
|
||||
/** the quality layers */
|
||||
private int[] layers = null;
|
||||
|
||||
/** Contains the 8 bpp version of the image. May NOT be filled together with image16 or image24.<P>
|
||||
* We store in Java the 8 or 16 bpp version of the image while the decoder uses a 32 bpp version, because <UL>
|
||||
* <LI> the storage capacity required is smaller
|
||||
* <LI> the transfer Java <-- C will be faster
|
||||
* <LI> the conversion byte/short ==> int will be done faster by the C
|
||||
* </UL>*/
|
||||
private byte[] image8 = null;
|
||||
/** Contains the 16 bpp version of the image. May NOT be filled together with image8 or image24*/
|
||||
private short[] image16 = null;
|
||||
/** Contains the 24 bpp version of the image. May NOT be filled together with image8 or image16 */
|
||||
private int[] image24 = null;
|
||||
/** Holds the J2K compressed bytecode to decode */
|
||||
private byte compressedStream[] = null;
|
||||
/** Holds the compressed version of the index file, to be used by the decoder */
|
||||
private byte compressedIndex[] = null;
|
||||
/** Width and Height of the image */
|
||||
private int width = -1;
|
||||
private int height = -1;
|
||||
private int depth = -1;
|
||||
/** This parameter is never used in Java but is read by the C library to know the number of resolutions to skip when decoding,
|
||||
* i.e. if there are 5 resolutions and skipped=1 ==> decode until resolution 4. */
|
||||
private int skippedResolutions = 0;
|
||||
|
||||
private Vector<IJavaJ2KDecoderLogger> loggers = new Vector();
|
||||
|
||||
|
||||
public OpenJPEGJavaDecoder(String openJPEGlibraryFullPathAndName, IJavaJ2KDecoderLogger messagesAndErrorsLogger) throws ExceptionInInitializerError
|
||||
{
|
||||
this(openJPEGlibraryFullPathAndName);
|
||||
loggers.addElement(messagesAndErrorsLogger);
|
||||
}
|
||||
|
||||
public OpenJPEGJavaDecoder(String openJPEGlibraryFullPathAndName) throws ExceptionInInitializerError
|
||||
{
|
||||
if (!isInitialized) {
|
||||
try {
|
||||
System.load(openJPEGlibraryFullPathAndName);
|
||||
isInitialized = true;
|
||||
} catch (Throwable t) {
|
||||
throw new ExceptionInInitializerError("OpenJPEG Java Decoder: probably impossible to find the C library");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addLogger(IJavaJ2KDecoderLogger messagesAndErrorsLogger) {
|
||||
loggers.addElement(messagesAndErrorsLogger);
|
||||
}
|
||||
|
||||
public void removeLogger(IJavaJ2KDecoderLogger messagesAndErrorsLogger) {
|
||||
loggers.removeElement(messagesAndErrorsLogger);
|
||||
}
|
||||
|
||||
public int decodeJ2KtoImage() {
|
||||
if ((image16 == null || (image16 != null && image16.length != width*height)) && (depth==-1 || depth==16)) {
|
||||
image16 = new short[width*height];
|
||||
logMessage("OpenJPEGJavaDecoder.decompressImage: image16 length = " + image16.length + " (" + width + " x " + height + ") ");
|
||||
}
|
||||
if ((image8 == null || (image8 != null && image8.length != width*height)) && (depth==-1 || depth==8)) {
|
||||
image8 = new byte[width*height];
|
||||
logMessage("OpenJPEGJavaDecoder.decompressImage: image8 length = " + image8.length + " (" + width + " x " + height + ") ");
|
||||
}
|
||||
if ((image24 == null || (image24 != null && image24.length != width*height)) && (depth==-1 || depth==24)) {
|
||||
image24 = new int[width*height];
|
||||
logMessage("OpenJPEGJavaDecoder.decompressImage: image24 length = " + image24.length + " (" + width + " x " + height + ") ");
|
||||
}
|
||||
|
||||
String[] arguments = new String[0 + (decoder_arguments != null ? decoder_arguments.length : 0)];
|
||||
int offset = 0;
|
||||
if (decoder_arguments != null) {
|
||||
for (int i=0; i<decoder_arguments.length; i++) {
|
||||
arguments[i+offset] = decoder_arguments[i];
|
||||
}
|
||||
}
|
||||
|
||||
return internalDecodeJ2KtoImage(arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode the j2k stream given in the codestream byte[] and fills the image8, image16 or image24 array, according to the bit depth.
|
||||
*/
|
||||
private native int internalDecodeJ2KtoImage(String[] parameters);
|
||||
|
||||
/** Image depth in bpp */
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
/** Image depth in bpp */
|
||||
public void setDepth(int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
/** Image height in pixels */
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/** Image height in pixels */
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
/** Number of resolutions contained in the image */
|
||||
public int getNbResolutions() {
|
||||
return nbResolutions;
|
||||
}
|
||||
|
||||
/** Number of resolutions contained in the image */
|
||||
public void setNbResolutions(int nbResolutions) {
|
||||
this.nbResolutions = nbResolutions;
|
||||
}
|
||||
|
||||
/** Width of the image in pixels */
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/** Width of the image in pixels */
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
/** Contains the decompressed version of the image, if the depth in is [9,16] bpp.
|
||||
* Returns NULL otherwise.
|
||||
*/
|
||||
public short[] getImage16() {
|
||||
return image16;
|
||||
}
|
||||
|
||||
/** Contains the decompressed version of the image, if the depth in is [17,24] bpp and the image is in color.
|
||||
* Returns NULL otherwise.
|
||||
*/
|
||||
public int[] getImage24() {
|
||||
return image24;
|
||||
}
|
||||
|
||||
/** Contains the decompressed version of the image, if the depth in is [1,8] bpp.
|
||||
* Returns NULL otherwise.
|
||||
*/
|
||||
public byte[] getImage8() {
|
||||
return image8;
|
||||
}
|
||||
|
||||
/** Sets the compressed version of the index file for this image.
|
||||
* This index file is used by the decompressor
|
||||
*/
|
||||
public void setCompressedIndex(byte[] compressedIndex) {
|
||||
this.compressedIndex = compressedIndex;
|
||||
}
|
||||
|
||||
/** Sets the codestream to be decoded */
|
||||
public void setCompressedStream(byte[] compressedStream) {
|
||||
this.compressedStream = compressedStream;
|
||||
}
|
||||
|
||||
/** @return the compressed code stream length, or -1 if not defined */
|
||||
public long getCodestreamLength() {
|
||||
if (compressedStream == null)
|
||||
return -1;
|
||||
else return compressedStream.length;
|
||||
}
|
||||
|
||||
/** This method is called either directly or by the C methods */
|
||||
public void logMessage(String message) {
|
||||
for (IJavaJ2KDecoderLogger logger:loggers)
|
||||
logger.logDecoderMessage(message);
|
||||
}
|
||||
|
||||
/** This method is called either directly or by the C methods */
|
||||
public void logError(String error) {
|
||||
for (IJavaJ2KDecoderLogger logger:loggers)
|
||||
logger.logDecoderError(error);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
nbResolutions = -1;
|
||||
layers = null;
|
||||
image8 = null;
|
||||
image16 = null;
|
||||
image24 = null;
|
||||
compressedStream = null;
|
||||
compressedIndex = null;
|
||||
width = -1;
|
||||
height = -1;
|
||||
depth = -1;
|
||||
}
|
||||
|
||||
public void setSkippedResolutions(int numberOfSkippedResolutions) {
|
||||
skippedResolutions = numberOfSkippedResolutions;
|
||||
}
|
||||
|
||||
/** Contains all the decoding arguments other than the input/output file */
|
||||
public void setDecoderArguments(String[] argumentsForTheDecoder) {
|
||||
decoder_arguments = argumentsForTheDecoder;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* $Id: $
|
||||
*
|
||||
* Copyright (c) 1999-2007 Telemis SA. All Rights Reserved
|
||||
*
|
||||
* Author: Patrick Piscaglia, Telemis s.a.
|
||||
*/
|
||||
package org.openJpeg;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
/** This class encodes one image into the J2K format,
|
||||
* using the OpenJPEG.org library.
|
||||
* To be able to log messages, the called must register a IJavaJ2KEncoderLogger object.
|
||||
*/
|
||||
public class OpenJPEGJavaEncoder {
|
||||
|
||||
public interface IJavaJ2KEncoderLogger {
|
||||
public void logEncoderMessage(String message);
|
||||
public void logEncoderError(String message);
|
||||
}
|
||||
|
||||
private static boolean isInitialized = false;
|
||||
|
||||
// ===== Compression parameters =============>
|
||||
// These value may be changed for each image
|
||||
private String[] encoder_arguments = null;
|
||||
/** number of resolutions decompositions */
|
||||
private int nbResolutions = -1;
|
||||
/** the quality layers, expressed as compression rate */
|
||||
private float[] ratioLayers = null;
|
||||
/** the quality layers, expressed as PSNR values. This variable, if defined, has priority over the ratioLayers variable */
|
||||
private float[] psnrLayers = null;
|
||||
|
||||
/** Contains the 8 bpp version of the image. May NOT be filled together with image16 or image24.<P>
|
||||
* We store the 8 or 16 bpp version of the original image while the encoder uses a 32 bpp version, because <UL>
|
||||
* <LI> the storage capacity required is smaller
|
||||
* <LI> the transfer Java --> C will be faster
|
||||
* <LI> the conversion byte/short ==> int will be done faster by the C
|
||||
* </UL>*/
|
||||
private byte[] image8 = null;
|
||||
/** Contains the 16 bpp version of the image. May NOT be filled together with image8 or image24*/
|
||||
private short[] image16 = null;
|
||||
/** Contains the 24 bpp version of the image. May NOT be filled together with image8 or image16 */
|
||||
private int[] image24 = null;
|
||||
/** Holds the result of the compression, i.e. the J2K compressed bytecode */
|
||||
private byte compressedStream[] = null;
|
||||
/** Holds the compressed stream length, which may be smaller than compressedStream.length if this byte[] is pre-allocated */
|
||||
private long compressedStreamLength = -1;
|
||||
/** Holds the compressed version of the index file, returned by the encoder */
|
||||
private byte compressedIndex[] = null;
|
||||
/** Width and Height of the image */
|
||||
private int width = -1;
|
||||
private int height = -1;
|
||||
private int depth = -1;
|
||||
/** Tile size. We suppose the same size for the horizontal and vertical tiles.
|
||||
* If size == -1 ==> no tiling */
|
||||
private int tileSize = -1;
|
||||
// <===== Compression parameters =============
|
||||
|
||||
private Vector<IJavaJ2KEncoderLogger> loggers = new Vector();
|
||||
|
||||
public OpenJPEGJavaEncoder(String openJPEGlibraryFullPathAndName, IJavaJ2KEncoderLogger messagesAndErrorsLogger) throws ExceptionInInitializerError
|
||||
{
|
||||
this(openJPEGlibraryFullPathAndName);
|
||||
loggers.addElement(messagesAndErrorsLogger);
|
||||
}
|
||||
|
||||
public OpenJPEGJavaEncoder(String openJPEGlibraryFullPathAndName) throws ExceptionInInitializerError
|
||||
{
|
||||
if (!isInitialized) {
|
||||
try {
|
||||
String absolutePath = (new File(openJPEGlibraryFullPathAndName)).getCanonicalPath();
|
||||
System.load(absolutePath);
|
||||
isInitialized = true;
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
throw new ExceptionInInitializerError("OpenJPEG Java Encoder: probably impossible to find the C library");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addLogger(IJavaJ2KEncoderLogger messagesAndErrorsLogger) {
|
||||
loggers.addElement(messagesAndErrorsLogger);
|
||||
}
|
||||
|
||||
public void removeLogger(IJavaJ2KEncoderLogger messagesAndErrorsLogger) {
|
||||
loggers.removeElement(messagesAndErrorsLogger);
|
||||
}
|
||||
|
||||
/** This method compresses the given image.<P>
|
||||
* It returns the compressed J2K codestream into the compressedStream byte[].<P>
|
||||
* It also returns the compression index as a compressed form, into the compressedIndex byte[].<P>
|
||||
* One of the image8, image16 or image24 arrays must be correctly initialized and filled.<P>
|
||||
* The width, height and depth variables must be correctly filled.<P>
|
||||
* The nbResolutions, nbLayers and if needed the float[] psnrLayers or ratioLayers must also be filled before calling this method.
|
||||
*/
|
||||
public void encodeImageToJ2K() {
|
||||
// Need to allocate / reallocate the compressed stream buffer ? (size = max possible size = original image size)
|
||||
if (compressedStream== null || (compressedStream.length != width*height*depth/8)) {
|
||||
logMessage("OpenJPEGJavaEncoder.encodeImageToJ2K: (re-)allocating " + (width*height*depth/8) + " bytes for the compressedStream");
|
||||
compressedStream = new byte[width*height*depth/8];
|
||||
}
|
||||
// Arguments =
|
||||
// - number of resolutions "-n 5" : 2
|
||||
// - size of tile "-t 512,512" : 2
|
||||
//
|
||||
// Image width, height, depth and pixels are directly fetched by C from the Java class
|
||||
int nbArgs = 2 + (tileSize == -1 ? 0 : 2) + (encoder_arguments != null ? encoder_arguments.length : 0);
|
||||
if (psnrLayers != null && psnrLayers.length>0 && psnrLayers[0] != 0)
|
||||
// If psnrLayers is defined and doesn't just express "lossless"
|
||||
nbArgs += 2;
|
||||
else if (ratioLayers != null && ratioLayers.length>0 && ratioLayers[0]!=0.0)
|
||||
nbArgs += 2;
|
||||
String[] arguments = new String[nbArgs];
|
||||
int offset = 0;
|
||||
arguments[offset] = "-n"; arguments[offset+1] = "" + nbResolutions; offset += 2;
|
||||
if (tileSize!= -1) {
|
||||
arguments[offset++] = "-t";
|
||||
arguments[offset++] = "" + tileSize + "," + tileSize;
|
||||
}
|
||||
// If PSNR layers are defined, use them to encode the images
|
||||
if (psnrLayers != null && psnrLayers.length>0 && psnrLayers[0]!=-1) {
|
||||
arguments[offset++] = "-q";
|
||||
String s = "";
|
||||
for (int i=0; i<psnrLayers.length; i++)
|
||||
s += psnrLayers[i] + ",";
|
||||
arguments[offset++] = s.substring(0, s.length()-1);
|
||||
} else if (ratioLayers != null && ratioLayers.length>0 && ratioLayers[0]!=0.0) {
|
||||
// Specify quality ratioLayers, as compression ratios
|
||||
arguments[offset++] = "-r";
|
||||
String s = "";
|
||||
for (int i=0; i<ratioLayers.length; i++)
|
||||
s += ratioLayers[i] + ",";
|
||||
arguments[offset++] = s.substring(0, s.length()-1);
|
||||
}
|
||||
if (encoder_arguments != null) {
|
||||
for (int i=0; i<encoder_arguments.length; i++) {
|
||||
arguments[i+offset] = encoder_arguments[i];
|
||||
}
|
||||
}
|
||||
logMessage("Encoder additional arguments = " + arrayToString(arguments));
|
||||
long startTime = (new java.util.Date()).getTime();
|
||||
compressedStreamLength = internalEncodeImageToJ2K(arguments);
|
||||
logMessage("compression time = " + ((new java.util.Date()).getTime() - startTime) + " msec");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills the compressedStream byte[] and the compressedIndex byte[]
|
||||
* @return the codestream length.
|
||||
*/
|
||||
private native long internalEncodeImageToJ2K(String[] parameters);
|
||||
|
||||
/** Image depth in bpp */
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
/** Image depth in bpp */
|
||||
public void setDepth(int depth) {
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
/** Image height in pixels */
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/** Image height in pixels */
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
/** This method must be called in depth in [9,16].
|
||||
* @param an array of shorts, containing width*height values
|
||||
*/
|
||||
public void setImage16(short[] image16) {
|
||||
this.image16 = image16;
|
||||
}
|
||||
|
||||
/** This method must be called in depth in [17,24] for RGB images.
|
||||
* @param an array of int, containing width*height values
|
||||
*/
|
||||
public void setImage24(int[] image24) {
|
||||
this.image24 = image24;
|
||||
}
|
||||
|
||||
/** This method must be called in depth in [1,8].
|
||||
* @param an array of bytes, containing width*height values
|
||||
*/
|
||||
public void setImage8(byte[] image8) {
|
||||
this.image8 = image8;
|
||||
}
|
||||
|
||||
/** Return the ratioLayers, i.e. the compression ratio for each quality layer.
|
||||
* If the last value is 0.0, last layer is lossless compressed.
|
||||
*/
|
||||
public float[] getRatioLayers() {
|
||||
return ratioLayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the quality layers.
|
||||
* At least one level.
|
||||
* Each level is expressed as a compression ratio (float).
|
||||
* If the last value is 0.0, the last layer will be losslessly compressed
|
||||
*/
|
||||
public void setRatioLayers(float[] layers) {
|
||||
this.ratioLayers = layers;
|
||||
}
|
||||
|
||||
/** Return the PSNR Layers, i.e. the target PSNR for each quality layer.
|
||||
* If the last value is -1, last layer is lossless compressed.
|
||||
*/
|
||||
public float[] getPsnrLayers() {
|
||||
return psnrLayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the quality layers.
|
||||
* At least one level.
|
||||
* Each level is expressed as a target PSNR (float).
|
||||
* If the last value is -1, the last layer will be losslessly compressed
|
||||
*/
|
||||
public void setPsnrLayers(float[] layers) {
|
||||
this.psnrLayers = layers;
|
||||
}
|
||||
|
||||
/** Set the number of resolutions that must be created */
|
||||
public void setNbResolutions(int nbResolutions) {
|
||||
this.nbResolutions = nbResolutions;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/** Width of the image, in pixels */
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
/** Return the compressed index file.
|
||||
* Syntax: TODO PP:
|
||||
*/
|
||||
public byte[] getCompressedIndex() {
|
||||
return compressedIndex;
|
||||
}
|
||||
|
||||
public void setCompressedIndex(byte[] index) {
|
||||
compressedIndex = index;
|
||||
}
|
||||
|
||||
public byte[] getCompressedStream() {
|
||||
return compressedStream;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
nbResolutions = -1;
|
||||
ratioLayers = null;
|
||||
psnrLayers = null;
|
||||
image8 = null;
|
||||
image16 = null;
|
||||
image24 = null;
|
||||
compressedStream = null;
|
||||
compressedIndex = null;
|
||||
width = -1;
|
||||
height = -1;
|
||||
depth = -1;
|
||||
}
|
||||
|
||||
public short[] getImage16() {
|
||||
return image16;
|
||||
}
|
||||
|
||||
public int[] getImage24() {
|
||||
return image24;
|
||||
}
|
||||
|
||||
public byte[] getImage8() {
|
||||
return image8;
|
||||
}
|
||||
|
||||
/** Sets the size of the tiles. We assume square tiles */
|
||||
public void setTileSize(int tileSize) {
|
||||
this.tileSize = tileSize;
|
||||
}
|
||||
|
||||
/** Contains all the encoding arguments other than the input/output file, compression ratio, tile size */
|
||||
public void setEncoderArguments(String[] argumentsForTheEncoder) {
|
||||
encoder_arguments = argumentsForTheEncoder;
|
||||
}
|
||||
|
||||
public void logMessage(String message) {
|
||||
for (IJavaJ2KEncoderLogger logger:loggers)
|
||||
logger.logEncoderMessage(message);
|
||||
}
|
||||
|
||||
public void logError(String error) {
|
||||
for (IJavaJ2KEncoderLogger logger:loggers)
|
||||
logger.logEncoderError(error);
|
||||
}
|
||||
|
||||
public long getCompressedStreamLength() {
|
||||
return compressedStreamLength;
|
||||
}
|
||||
|
||||
private String arrayToString(String[] array) {
|
||||
if (array == null)
|
||||
return "NULL";
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i=0; i<array.length; i++)
|
||||
sb.append(array[i]).append(" ");
|
||||
sb.delete(sb.length()-1, sb.length());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_openJpeg_OpenJPEGJavaDecoder */
|
||||
|
||||
#ifndef _Included_org_openJpeg_OpenJPEGJavaDecoder
|
||||
#define _Included_org_openJpeg_OpenJPEGJavaDecoder
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_openJpeg_OpenJPEGJavaDecoder
|
||||
* Method: internalDecodeJ2KtoImage
|
||||
* Signature: ([Ljava/lang/String;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_org_openJpeg_OpenJPEGJavaDecoder_internalDecodeJ2KtoImage
|
||||
(JNIEnv *, jobject, jobjectArray);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_openJpeg_OpenJPEGJavaEncoder */
|
||||
|
||||
#ifndef _Included_org_openJpeg_OpenJPEGJavaEncoder
|
||||
#define _Included_org_openJpeg_OpenJPEGJavaEncoder
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: org_openJpeg_OpenJPEGJavaEncoder
|
||||
* Method: internalEncodeImageToJ2K
|
||||
* Signature: ([Ljava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_openJpeg_OpenJPEGJavaEncoder_internalEncodeImageToJ2K
|
||||
(JNIEnv *, jobject, jobjectArray);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
262
LibOpenJPEG.dsp
262
LibOpenJPEG.dsp
@@ -1,262 +0,0 @@
|
||||
# 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,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "LibOpenJPEG.vcproj", "{6A47DBE3-8F80-4ABE-8688-5F8DC620977C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6A47DBE3-8F80-4ABE-8688-5F8DC620977C}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,642 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="LibOpenJPEG"
|
||||
ProjectGUID="{4F27AA53-4181-4A1A-8238-3931B0A41048}"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;OPJ_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/LibOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile=".\Release\LibOpenJPEG.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/LibOpenJPEG.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="if not exist dist mkdir dist
copy Release\LibOpenJPEG.lib dist
copy libopenjpeg\openjpeg.h dist
"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
InlineFunctionExpansion="0"
|
||||
EnableIntrinsicFunctions="false"
|
||||
FavorSizeOrSpeed="1"
|
||||
WholeProgramOptimization="false"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;OPJ_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\Debug/LibOpenJPEG.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
OutputFile="Debug\LibOpenJPEGd.lib"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Debug/LibOpenJPEG.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="if not exist dist mkdir dist
copy Debug\LibOpenJPEGd.lib dist
copy libopenjpeg\openjpeg.h dist
"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="libopenjpeg\bio.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\cio.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\dwt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\event.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\image.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k_lib.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jp2.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jpt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mct.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mqc.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\openjpeg.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\pi.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\raw.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t1.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t2.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tcd.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tgt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl"
|
||||
>
|
||||
<File
|
||||
RelativePath="libopenjpeg\bio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\cio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\dwt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\event.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\fix.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\image.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\int.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\j2k_lib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jp2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\jpt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\mqc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\openjpeg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\opj_includes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\libopenjpeg\opj_malloc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\pi.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\raw.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t1.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t1_luts.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\t2.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tcd.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="libopenjpeg\tgt.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
78
Makefile
78
Makefile
@@ -1,78 +0,0 @@
|
||||
# Linux makefile for OpenJPEG
|
||||
|
||||
VER_MAJOR = 2
|
||||
VER_MINOR = 1.2.0
|
||||
|
||||
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
|
||||
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_malloc.h ./libopenjpeg/opj_includes.h
|
||||
INCLUDE = -Ilibopenjpeg
|
||||
|
||||
# General configuration variables:
|
||||
CC = gcc
|
||||
AR = ar
|
||||
|
||||
PREFIX = /usr
|
||||
INSTALL_LIBDIR = $(PREFIX)/lib
|
||||
INSTALL_INCLUDE = $(PREFIX)/include
|
||||
|
||||
# Converts cr/lf to just lf
|
||||
DOS2UNIX = dos2unix
|
||||
|
||||
COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
|
||||
LIBRARIES = -lstdc++
|
||||
|
||||
MODULES = $(SRCS:.c=.o)
|
||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
||||
|
||||
TARGET = openjpeg
|
||||
STATICLIB = lib$(TARGET).a
|
||||
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
|
||||
LIBNAME = lib$(TARGET).so.$(VER_MAJOR)
|
||||
|
||||
|
||||
|
||||
default: all
|
||||
|
||||
all: OpenJPEG
|
||||
|
||||
dist: OpenJPEG
|
||||
install -d dist
|
||||
install -m 644 $(STATICLIB) dist
|
||||
install -m 755 $(SHAREDLIB) dist
|
||||
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
||||
install libopenjpeg/openjpeg.h dist
|
||||
|
||||
dos2unix:
|
||||
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||
|
||||
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(STATICLIB): $(MODULES)
|
||||
$(AR) r $@ $(MODULES)
|
||||
|
||||
$(SHAREDLIB): $(MODULES)
|
||||
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
|
||||
|
||||
install: OpenJPEG
|
||||
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
||||
install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
||||
install -m 644 -o root -g root libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||
-ldconfig
|
||||
|
||||
clean:
|
||||
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
||||
|
||||
osx:
|
||||
make -f Makefile.osx
|
||||
|
||||
osxinstall:
|
||||
make -f Makefile.osx install
|
||||
|
||||
osxclean:
|
||||
make -f Makefile.osx clean
|
||||
66
Makefile.osx
66
Makefile.osx
@@ -1,66 +0,0 @@
|
||||
# MacOSX makefile for OpenJPEG
|
||||
|
||||
VER_MAJOR = 2
|
||||
VER_MINOR = 1.2.0
|
||||
|
||||
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c
|
||||
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h
|
||||
INCLUDE = -Ilibopenjpeg
|
||||
|
||||
# General configuration variables:
|
||||
CC = gcc
|
||||
LIBTOOLSTAT = libtool
|
||||
LIBTOOLDYN = gcc
|
||||
|
||||
PREFIX = /usr
|
||||
INSTALL_LIBDIR = $(PREFIX)/lib
|
||||
INSTALL_INCLUDE = $(PREFIX)/include
|
||||
|
||||
COMPILERFLAGS = -O3 -fPIC
|
||||
|
||||
MODULES = $(SRCS:.c=.o)
|
||||
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
|
||||
|
||||
TARGET = openjpeg
|
||||
STATICLIB = lib$(TARGET).a
|
||||
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib
|
||||
LIBNAME = lib$(TARGET).dylib
|
||||
|
||||
|
||||
|
||||
default: all
|
||||
|
||||
all: OpenJPEG
|
||||
|
||||
dos2unix:
|
||||
@$(DOS2UNIX) $(SRCS) $(INCLS)
|
||||
|
||||
dist: OpenJPEG
|
||||
install -d dist
|
||||
install -m 644 $(STATICLIB) dist
|
||||
install -m 755 $(SHAREDLIB) dist
|
||||
ln -sf $(SHAREDLIB) dist/$(LIBNAME)
|
||||
install libopenjpeg/openjpeg.h dist
|
||||
|
||||
OpenJPEG: $(STATICLIB) $(SHAREDLIB)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(STATICLIB): $(MODULES)
|
||||
$(LIBTOOLSTAT) -o $@ $(MODULES)
|
||||
|
||||
$(SHAREDLIB): $(MODULES)
|
||||
$(LIBTOOLDYN) -dynamiclib -o $@ $(MODULES)
|
||||
|
||||
install:
|
||||
install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||
install -m 644 -o root -g wheel $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||
ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
|
||||
install -m 755 -o root -g wheel $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
|
||||
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
|
||||
install -m 644 -o root -g wheel ./libopenjpeg/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
|
||||
|
||||
clean:
|
||||
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# Makefile for OPJViewer
|
||||
|
||||
# General configuration variables:
|
||||
CC = $(shell wx-config-2.8 --cxx)
|
||||
AR = ar
|
||||
|
||||
CFLAGS = -DUSE_JPWL -DwxUSE_LIBOPENJPEG -DwxUSE_GUI=1 -DOPJ_STATIC -DOPJ_HTMLABOUT $(shell wx-config-2.8 --cxxflags) # -g -p -pg -DUSE_JPWL
|
||||
|
||||
OPJV_SRCS = source/imagj2k.cpp source/imagmj2.cpp source/wxj2kparser.cpp source/imagjp2.cpp source/OPJViewer.cpp source/wxjp2parser.cpp source/OPJViewer.cpp source/OPJThreads.cpp
|
||||
|
||||
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)
|
||||
@@ -1,319 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="OPJViewer" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=OPJVIEWER - WIN32 RELEASE
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OPJViewer.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "OPJViewer.mak" CFG="OPJVIEWER - WIN32 RELEASE"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "OPJViewer - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "OPJViewer - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "OPJViewer - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /G6 /MD /W3 /GX /O2 /I "d:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "d:\programmi\wxWidgets-2.8.0\include" /I ".." /I "../libopenjpeg" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "USE_JPSEC" /D "USE_MXF" /D "OPJ_HTMLABOUT" /D "OPJ_MANYFORMATS" /D "OPJ_INICONFIG" /FR /FD /c
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /i "d:\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:"d:\programmi\wxWidgets-2.8.0\lib\vc_lib" /libpath:"..\jpwl\Release" /IGNORE:4089
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
# Begin Special Build Tool
|
||||
SOURCE="$(InputPath)"
|
||||
PostBuild_Desc=Update build number
|
||||
PostBuild_Cmds=buildupdate.bat
|
||||
# End Special Build Tool
|
||||
|
||||
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "OPJViewer___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "OPJViewer___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "c:\Programmi\wxWidgets-2.8.0\INCLUDE" /I "c:\programmi\wxWidgets-2.8.0\lib\vc_lib\msw" /I "c:\programmi\wxWidgets-2.8.0\include" /I ".." /D "_DEBUG" /D "__WXDEBUG__" /D WXDEBUG=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D WINVER=0x400 /D "_MT" /D wxUSE_GUI=1 /D "wxUSE_LIBOPENJPEG" /D "OPJ_STATIC" /D "USE_JPWL" /D "OPJ_HTMLABOUT" /FR /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||
# ADD RSC /l 0x410 /i "c:\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:"c:\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\imagmxf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\codec\index.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJAbout.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJDialogs.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJThreads.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wxj2kparser.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wxjp2parser.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\about_htm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\build.h
|
||||
|
||||
!IF "$(CFG)" == "OPJViewer - Win32 Release"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ELSEIF "$(CFG)" == "OPJViewer - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# 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\imagmxf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\codec\index.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\blank.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\bullseye.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\cdrom.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\computer.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\cross.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\drive.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\file1.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\floppy.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\folder1.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\folder2.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\hand.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon1.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon2.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon3.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon4.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\icon5.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\magnif1.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\opj_logo.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJChild.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJChild16.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\OPJViewer16.xpm
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pbrush.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pencil.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pntleft.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\pntright.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\removble.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\rightarr.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\roller.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\source\wx\msw\std.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,44 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "LibOpenJPEG_JPWL"=..\jpwl\LibOpenJPEG_JPWL.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "OPJViewer"=.\OPJViewer.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name LibOpenJPEG_JPWL
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
; 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}
|
||||
|
||||
[Registry]
|
||||
Root: HKCU; Subkey: Software\OpenJPEG; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
|
||||
Root: HKCU; Subkey: Software\OpenJPEG\OPJViewer; ValueType: none; ValueData: 1; Flags: uninsdeletekey; Tasks: ; Languages:
|
||||
@@ -1,95 +0,0 @@
|
||||
===============================================================================
|
||||
JPEG2000 Visualization Software - OPJViewer
|
||||
|
||||
Version 0.3 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 as GUI engine.
|
||||
|
||||
If you find some bugs or if you have problems using the viewer, please send an e-mail to jpwl@diei.unipg.it
|
||||
|
||||
2. Installing the viewer
|
||||
==========================
|
||||
|
||||
There are two options available, at the moment:
|
||||
|
||||
a) compile from source code
|
||||
b) download a precompiled binary.
|
||||
|
||||
In order to use option a), it is mandatory to have compiled and built the LibOpenJPEG_JPWL library and the wxWidgets 2.8 framework (you have to download it from http://www.wxwidgets.org/ and compile the wx* libraries).
|
||||
|
||||
2.1. Compiling the source code in Windows
|
||||
-------------------------------------------
|
||||
|
||||
The steps required to compile the viewer under windows are:
|
||||
|
||||
a) Download at least the libopenjpeg, jpwl, and opjviewer folders from the SVN trunk.
|
||||
b) Open the OPJViewer.dsw workspace with Visual C++ 6 and activate the "OPJViewer - Win32 Release" configuration.
|
||||
c) In the configuration settings, go to the C++ tab and modify the wxWidgets paths in order to reflect your wx* install configuration (Preprocessor -> Additional include directories): simply update each instance of the two wx paths, do not remove or add them.
|
||||
d) In the configuration settings, go to the Link tab and modify the wxWidgets path in order to reflect your wx* install configuration (Input -> Additional library path): simply update the wx path.
|
||||
e) In the configuration settings, go to the Resources tab and modify the wxWidgets path in order to reflect your wx* install configuration (Additional resource include directories): simply update the wx path.
|
||||
f) Build!
|
||||
g) Run!
|
||||
h) (OPTIONAL) Prepare an installer by compiling the InnoSetup script OPJViewer.iss (you need to download InnoSetup from http://www.jrsoftware.org/isinfo.php).
|
||||
|
||||
2.2. Compiling the source code in Unix-like systems
|
||||
-----------------------------------------------------
|
||||
|
||||
The porting is possible and under way.
|
||||
|
||||
|
||||
3. General information on the viewer
|
||||
====================================
|
||||
|
||||
This viewer is conceived to open and display information and image content of J2K, JP2, and MJ2 files.
|
||||
The viewer application interface is divided into three main panels:
|
||||
- a browsing pane;
|
||||
- a viewing pane;
|
||||
- a log/peek pane.
|
||||
|
||||
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
||||
|
||||
filename
|
||||
|
|
||||
|_ #000: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ *** Marker/Box long name ***
|
||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||
| |_ Additional info, depending on the marker/box type
|
||||
| |_ ...
|
||||
|
|
||||
|_ #001: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ ...
|
||||
|
|
||||
...
|
||||
|
||||
|
||||
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
||||
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
||||
|
||||
|
||||
The log/peek pane is shared among two different subpanels:
|
||||
|
||||
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
||||
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
||||
|
||||
|
||||
4. Known bugs and limitations
|
||||
===============================
|
||||
|
||||
4.1. Bugs
|
||||
-----------
|
||||
|
||||
*
|
||||
|
||||
4.2. Limitations
|
||||
------------------
|
||||
|
||||
* For mj2 files, rendering is only in B/W
|
||||
@@ -1,36 +0,0 @@
|
||||
<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>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.3 KiB |
@@ -1,15 +0,0 @@
|
||||
::== buildupdate.bat
|
||||
@echo off
|
||||
setLocal EnableDelayedExpansion
|
||||
|
||||
for /f "tokens=2,* delims=^(^) " %%a in ('find /v "" ^< .\source\build.h') do (
|
||||
rem echo %%a
|
||||
set /A M = %%a + 1
|
||||
echo Build %%a done^!
|
||||
echo wxT^("!M!"^) > buildtemp283746825t347
|
||||
)
|
||||
|
||||
if exist buildtemp283746825t347 move /Y buildtemp283746825t347 .\source\build.h
|
||||
if exist buildtemp283746825t347 del /F /Q buildtemp283746825t347
|
||||
|
||||
::==
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,28 +0,0 @@
|
||||
/* 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+",
|
||||
"++++++++++++++++"
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,801 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: 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 "wx/toolbar.h"
|
||||
#include "wx/artprov.h"
|
||||
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#include "imagj2k.h"
|
||||
#include "imagjp2.h"
|
||||
#include "imagmj2.h"
|
||||
#ifdef USE_MXF
|
||||
#include "imagmxf.h"
|
||||
#endif // USE_MXF
|
||||
|
||||
#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")
|
||||
#define OPJ_APPLICATION_VENDOR wxT("OpenJPEG")
|
||||
|
||||
#ifdef __WXMSW__
|
||||
#define OPJ_APPLICATION_PLATFORM wxT("Windows")
|
||||
#endif
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#define OPJ_APPLICATION_PLATFORM wxT("Linux")
|
||||
#endif
|
||||
|
||||
#define OPJ_FRAME_WIDTH 800
|
||||
#define OPJ_FRAME_HEIGHT 600
|
||||
|
||||
#define OPJ_BROWSER_WIDTH 300
|
||||
#define OPJ_PEEKER_HEIGHT 130
|
||||
|
||||
#define OPJ_CANVAS_BORDER 10
|
||||
#define OPJ_CANVAS_COLOUR *wxWHITE
|
||||
|
||||
|
||||
|
||||
#ifdef USE_JPWL
|
||||
|
||||
//#define MYJPWL_MAX_NO_TILESPECS JPWL_MAX_NO_TILESPECS
|
||||
#define MYJPWL_MAX_NO_TILESPECS 4
|
||||
|
||||
#endif // USE_JPWL
|
||||
|
||||
|
||||
class OPJDecoThread;
|
||||
class OPJEncoThread;
|
||||
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);
|
||||
int OnExit(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, m_enco_threads;
|
||||
|
||||
// crit section protects access to all of the arrays below
|
||||
wxCriticalSection m_deco_critsect, m_parse_critsect, m_enco_critsect;
|
||||
|
||||
// semaphore used to wait for the threads to exit, see OPJFrame::OnQuit()
|
||||
wxSemaphore m_deco_semAllDone, m_parse_semAllDone, m_enco_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, m_enco_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, m_enableparse;
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl, m_enablejpwle;
|
||||
int m_expcomps, m_maxtiles;
|
||||
int m_framewidth, m_frameheight;
|
||||
#endif // USE_JPWL
|
||||
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling, m_origin, m_rates, m_comment, m_index, m_quality;
|
||||
wxString m_cbsize, m_prsize, m_tsize, m_torigin, m_poc;
|
||||
bool m_enablecomm, m_enableidx, m_multicomp, m_irreversible, m_enablesop, m_enableeph;
|
||||
bool m_enablebypass, m_enablereset, m_enablerestart, m_enablevsc, m_enableerterm;
|
||||
bool m_enablesegmark, m_enablepoc;
|
||||
bool m_enablequality;
|
||||
int m_resolutions, m_progression;
|
||||
#ifdef USE_JPWL
|
||||
int m_hprotsel[MYJPWL_MAX_NO_TILESPECS], m_pprotsel[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_htileval[MYJPWL_MAX_NO_TILESPECS], m_ptileval[MYJPWL_MAX_NO_TILESPECS],
|
||||
m_ppackval[MYJPWL_MAX_NO_TILESPECS];
|
||||
int m_sensisel[MYJPWL_MAX_NO_TILESPECS], m_stileval[MYJPWL_MAX_NO_TILESPECS];
|
||||
#endif // USE_JPWL
|
||||
|
||||
// some layout settings
|
||||
bool m_showtoolbar, m_showbrowser, m_showpeeker;
|
||||
int m_browserwidth, m_peekerheight;
|
||||
|
||||
// application configuration
|
||||
wxConfig *OPJconfig;
|
||||
|
||||
// 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);
|
||||
OPJEncoThread *CreateEncoThread(void);
|
||||
OPJChildFrame *m_childframe;
|
||||
|
||||
wxBitmap m_image, m_image100;
|
||||
wxFileName m_fname, m_savename;
|
||||
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;
|
||||
wxString m_desc;
|
||||
|
||||
// private methods and variables
|
||||
private:
|
||||
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 OnFileSaveAs(wxCommandEvent& WXUNUSED(event));
|
||||
void OnMemoryOpen(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 OnToggleToolbar(wxCommandEvent& WXUNUSED(event));
|
||||
void OnReload(wxCommandEvent& event);
|
||||
void OnPrevFrame(wxCommandEvent& event);
|
||||
void OnHomeFrame(wxCommandEvent& event);
|
||||
void OnNextFrame(wxCommandEvent& event);
|
||||
void OnLessLayers(wxCommandEvent& event);
|
||||
void OnAllLayers(wxCommandEvent& event);
|
||||
void OnMoreLayers(wxCommandEvent& event);
|
||||
void OnLessRes(wxCommandEvent& event);
|
||||
void OnFullRes(wxCommandEvent& event);
|
||||
void OnMoreRes(wxCommandEvent& event);
|
||||
void OnPrevComp(wxCommandEvent& event);
|
||||
void OnAllComps(wxCommandEvent& event);
|
||||
void OnNextComp(wxCommandEvent& event);
|
||||
void OnSetsEnco(wxCommandEvent& event);
|
||||
void OnSetsDeco(wxCommandEvent& event);
|
||||
void OnSashDrag(wxSashEvent& event);
|
||||
void OpenFiles(wxArrayString paths, wxArrayString filenames);
|
||||
void SaveFile(wxArrayString paths, wxArrayString filenames);
|
||||
void OnNotebook(wxNotebookEvent& event);
|
||||
void Rescale(int scale, OPJChildFrame *child);
|
||||
|
||||
OPJMarkerTreeHash m_treehash;
|
||||
OPJChildFrameHash m_childhash;
|
||||
wxSashLayoutWindow* markerTreeWindow;
|
||||
wxSashLayoutWindow* loggingWindow;
|
||||
wxToolBar* tool_bar;
|
||||
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_MEMORYOPEN,
|
||||
OPJFRAME_FILESAVEAS,
|
||||
OPJFRAME_FILETOGGLEB,
|
||||
OPJFRAME_FILETOGGLEP,
|
||||
OPJFRAME_FILETOGGLET,
|
||||
OPJFRAME_VIEWZOOM,
|
||||
OPJFRAME_VIEWFIT,
|
||||
OPJFRAME_VIEWRELOAD,
|
||||
OPJFRAME_VIEWPREVFRAME,
|
||||
OPJFRAME_VIEWHOMEFRAME,
|
||||
OPJFRAME_VIEWNEXTFRAME,
|
||||
OPJFRAME_VIEWLESSLAYERS,
|
||||
OPJFRAME_VIEWALLLAYERS,
|
||||
OPJFRAME_VIEWMORELAYERS,
|
||||
OPJFRAME_VIEWLESSRES,
|
||||
OPJFRAME_VIEWFULLRES,
|
||||
OPJFRAME_VIEWMORERES,
|
||||
OPJFRAME_VIEWPREVCOMP,
|
||||
OPJFRAME_VIEWALLCOMPS,
|
||||
OPJFRAME_VIEWNEXTCOMP,
|
||||
OPJFRAME_FILECLOSE,
|
||||
OPJFRAME_SETSENCO,
|
||||
OPJFRAME_SETSDECO,
|
||||
|
||||
OPJFRAME_BROWSEWIN = 10000,
|
||||
OPJFRAME_LOGWIN,
|
||||
OPJFRAME_TOOLBAR
|
||||
};
|
||||
|
||||
|
||||
// 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 OPJEncoThread : public wxThread
|
||||
{
|
||||
public:
|
||||
OPJEncoThread(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 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* CreatePart1_1SettingsPage(wxWindow* parent);
|
||||
wxPanel* CreatePart1_2SettingsPage(wxWindow* parent);
|
||||
/* wxPanel* CreatePart3SettingsPage(wxWindow* parent);*/
|
||||
void OnEnableComm(wxCommandEvent& event);
|
||||
void OnEnableIdx(wxCommandEvent& event);
|
||||
void OnEnablePoc(wxCommandEvent& event);
|
||||
void OnRadioQualityRate(wxCommandEvent& event);
|
||||
#ifdef USE_JPWL
|
||||
void OnEnableJPWL(wxCommandEvent& event);
|
||||
wxPanel* CreatePart11SettingsPage(wxWindow* parent);
|
||||
/*wxCheckBox *m_enablejpwlCheck;*/
|
||||
wxChoice *m_hprotChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_htileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxChoice *m_pprotChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_ptileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_ppackCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxChoice *m_sensiChoice[MYJPWL_MAX_NO_TILESPECS];
|
||||
wxSpinCtrl *m_stileCtrl[MYJPWL_MAX_NO_TILESPECS];
|
||||
void OnHprotSelect(wxCommandEvent& event);
|
||||
void OnPprotSelect(wxCommandEvent& event);
|
||||
void OnSensiSelect(wxCommandEvent& event);
|
||||
#endif // USE_JPWL
|
||||
|
||||
wxTextCtrl *m_subsamplingCtrl, *m_originCtrl, *m_rateCtrl, *m_commentCtrl;
|
||||
wxRadioButton *m_rateRadio, *m_qualityRadio;
|
||||
wxTextCtrl *m_indexCtrl, *m_qualityCtrl, *m_cbsizeCtrl, *m_prsizeCtrl, *m_pocCtrl;
|
||||
wxTextCtrl *m_tsizeCtrl, *m_toriginCtrl;
|
||||
wxRadioBox *progressionBox;
|
||||
wxCheckBox *m_enablecommCheck, *m_enableidxCheck, *m_mctCheck, *m_irrevCheck;
|
||||
wxCheckBox *m_sopCheck, *m_ephCheck, *m_enablebypassCheck, *m_enableresetCheck,
|
||||
*m_enablerestartCheck, *m_enablevscCheck, *m_enableertermCheck, *m_enablesegmarkCheck;
|
||||
wxCheckBox *m_enablepocCheck, *m_enablejpwlCheck;
|
||||
wxSpinCtrl *m_resolutionsCtrl;
|
||||
|
||||
protected:
|
||||
|
||||
enum {
|
||||
OPJENCO_ENABLEJPWL = 100,
|
||||
OPJENCO_RATEFACTOR,
|
||||
OPJENCO_RATERADIO,
|
||||
OPJENCO_QUALITYFACTOR,
|
||||
OPJENCO_QUALITYRADIO,
|
||||
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_ENABLEPOC,
|
||||
OPJENCO_ROICOMP,
|
||||
OPJENCO_ROISHIFT,
|
||||
OPJENCO_IMORIG,
|
||||
OPJENCO_TILORIG,
|
||||
OPJENCO_ENABLEMCT,
|
||||
OPJENCO_ENABLEIRREV,
|
||||
OPJENCO_ENABLEINDEX,
|
||||
OPJENCO_INDEXNAME,
|
||||
OPJENCO_POCSPEC,
|
||||
OPJENCO_ENABLECOMM,
|
||||
OPJENCO_COMMENTTEXT,
|
||||
OPJENCO_HPROT,
|
||||
OPJENCO_HTILE,
|
||||
OPJENCO_PPROT,
|
||||
OPJENCO_PTILE,
|
||||
OPJENCO_PPACK,
|
||||
OPJENCO_SENSI,
|
||||
OPJENCO_STILE
|
||||
};
|
||||
|
||||
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, *m_enableparseCheck;
|
||||
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_ENABLEPARSE,
|
||||
OPJDECO_ENABLEJPWL,
|
||||
OPJDECO_EXPCOMPS,
|
||||
OPJDECO_MAXTILES,
|
||||
OPJDECO_FRAMENUM
|
||||
};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif //__OPJ_VIEWER_H__
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1,3 +0,0 @@
|
||||
OPJChild16 ICON OPJChild.ico
|
||||
OPJViewer16 ICON OPJViewer.ico
|
||||
#include "wx/msw/wx.rc"
|
||||
@@ -1,26 +0,0 @@
|
||||
/* XPM */
|
||||
static char *OPJViewer16[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"16 16 4 1",
|
||||
" c black",
|
||||
". c #800000",
|
||||
"X c red",
|
||||
"o c None",
|
||||
/* pixels */
|
||||
"oooooooooooooooo",
|
||||
"ooo.XXXXoooooooo",
|
||||
"ooXXoo .Xooooooo",
|
||||
"o..oooo .ooooooo",
|
||||
"oX.oooo ooooooo",
|
||||
"oX.oooo .ooooooo",
|
||||
"oXXoooo .ooooooo",
|
||||
"o.XXoo .oooooooo",
|
||||
"oo.XXXXooooooooo",
|
||||
"ooooooooo.Xo .oo",
|
||||
"ooooooooo X. ooo",
|
||||
"oooooooooo...ooo",
|
||||
"oooooooooo XXooo",
|
||||
"oooooooooo .Xooo",
|
||||
"oooooooooooooooo",
|
||||
"oooooooooooooooo"
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
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: ")
|
||||
#include "build.h"
|
||||
wxT(", " __DATE__ ", " __TIME__ "</font><br>")
|
||||
wxT("<font size=-2 color=red>* " wxVERSION_STRING "</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>"
|
||||
);
|
||||
@@ -1 +0,0 @@
|
||||
wxT("404")
|
||||
@@ -1,79 +0,0 @@
|
||||
/* 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 ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
@@ -1,53 +0,0 @@
|
||||
/* 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. ",
|
||||
" ................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
/* 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;>,. ",
|
||||
" ...................# ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
/* 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. ",
|
||||
" .................... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
@@ -1,79 +0,0 @@
|
||||
/* 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..................# ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "
|
||||
};
|
||||
@@ -1,721 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagj2k.cpp
|
||||
// Purpose: wxImage JPEG 2000 codestream handler
|
||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagj2k.cpp,v 0.00 2007/02/08 23:59:00 MW Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "imagj2k.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxJ2KHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxJ2KHandler,wxImageHandler)
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
//------------- JPEG 2000 Data Source Manager
|
||||
|
||||
#define J2K_CFMT 0
|
||||
#define JP2_CFMT 1
|
||||
#define JPT_CFMT 2
|
||||
#define MJ2_CFMT 3
|
||||
#define PXM_DFMT 0
|
||||
#define PGX_DFMT 1
|
||||
#define BMP_DFMT 2
|
||||
#define YUV_DFMT 3
|
||||
|
||||
#define MAX_MESSAGE_LEN 200
|
||||
|
||||
/* sample error callback expecting a FILE* client object */
|
||||
void j2k_error_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample warning callback expecting a FILE* client object */
|
||||
void j2k_warning_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample debug callback expecting no client object */
|
||||
void j2k_info_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
// load the j2k codestream
|
||||
bool wxJ2KHandler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
||||
{
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
opj_image_t *opjimage = NULL;
|
||||
unsigned char *src = NULL;
|
||||
unsigned char *ptr;
|
||||
int file_length;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
|
||||
// destroy the image
|
||||
image->Destroy();
|
||||
|
||||
/* handle to a decompressor */
|
||||
opj_dinfo_t* dinfo = NULL;
|
||||
opj_cio_t *cio = NULL;
|
||||
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = j2k_error_callback;
|
||||
event_mgr.warning_handler = j2k_warning_callback;
|
||||
event_mgr.info_handler = j2k_info_callback;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
/* prepare parameters */
|
||||
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
||||
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
||||
parameters.decod_format = J2K_CFMT;
|
||||
parameters.cod_format = BMP_DFMT;
|
||||
if (m_reducefactor)
|
||||
parameters.cp_reduce = m_reducefactor;
|
||||
if (m_qualitylayers)
|
||||
parameters.cp_layer = m_qualitylayers;
|
||||
|
||||
/* JPWL only */
|
||||
#ifdef USE_JPWL
|
||||
parameters.jpwl_exp_comps = m_expcomps;
|
||||
parameters.jpwl_max_tiles = m_maxtiles;
|
||||
parameters.jpwl_correct = m_enablejpwl;
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_J2K);
|
||||
|
||||
/* find length of the stream */
|
||||
stream.SeekI(0, wxFromEnd);
|
||||
file_length = (int) stream.TellI();
|
||||
|
||||
/* get data */
|
||||
stream.SeekI(0, wxFromStart);
|
||||
src = (unsigned char *) malloc(file_length);
|
||||
stream.Read(src, file_length);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogError(wxT("J2K: failed to decode image!"));
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
opj_image_destroy(opjimage);
|
||||
free(src);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* common rendering method */
|
||||
#include "imagjpeg2000.cpp"
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("J2K: image loaded."));
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
/* close openjpeg structs */
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_image_destroy(opjimage);
|
||||
free(src);
|
||||
|
||||
if (!image->Ok())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
#define CINEMA_24_CS 1302083 /* Codestream length for 24fps */
|
||||
#define CINEMA_48_CS 651041 /* Codestream length for 48fps */
|
||||
#define COMP_24_CS 1041666 /* Maximum size per color component for 2K & 4K @ 24fps */
|
||||
#define COMP_48_CS 520833 /* Maximum size per color component for 2K @ 48fps */
|
||||
|
||||
// save the j2k codestream
|
||||
bool wxJ2KHandler::SaveFile( wxImage *wimage, wxOutputStream& stream, bool verbose )
|
||||
{
|
||||
opj_cparameters_t parameters; /* compression parameters */
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
opj_image_t *oimage = NULL;
|
||||
opj_image_cmptparm_t *cmptparm;
|
||||
opj_cio_t *cio = NULL;
|
||||
opj_codestream_info_t cstr_info;
|
||||
int codestream_length;
|
||||
bool bSuccess;
|
||||
int i;
|
||||
char indexfilename[OPJ_PATH_LEN] = ""; /* index file name */
|
||||
|
||||
/*
|
||||
configure the event callbacks (not required)
|
||||
setting of each callback is optionnal
|
||||
*/
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = j2k_error_callback;
|
||||
event_mgr.warning_handler = j2k_warning_callback;
|
||||
event_mgr.info_handler = j2k_info_callback;
|
||||
|
||||
/* set encoding parameters to default values */
|
||||
opj_set_default_encoder_parameters(¶meters);
|
||||
|
||||
/* load parameters */
|
||||
parameters.cp_cinema = OFF;
|
||||
|
||||
/* subsampling */
|
||||
if (sscanf(m_subsampling.ToAscii(), "%d,%d", &(parameters.subsampling_dx), &(parameters.subsampling_dy)) != 2) {
|
||||
wxLogError(wxT("Wrong sub-sampling encoder setting: dx,dy"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* compression rates */
|
||||
if ((m_rates != wxT("")) && (!m_enablequality)) {
|
||||
const char *s1 = m_rates.ToAscii();
|
||||
wxLogMessage(wxT("rates %s"), s1);
|
||||
while (sscanf(s1, "%f", &(parameters.tcp_rates[parameters.tcp_numlayers])) == 1) {
|
||||
parameters.tcp_numlayers++;
|
||||
while (*s1 && *s1 != ',') {
|
||||
s1++;
|
||||
}
|
||||
if (!*s1)
|
||||
break;
|
||||
s1++;
|
||||
}
|
||||
wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers);
|
||||
parameters.cp_disto_alloc = 1;
|
||||
}
|
||||
|
||||
/* image quality, dB */
|
||||
if ((m_quality != wxT("")) && (m_enablequality)) {
|
||||
const char *s2 = m_quality.ToAscii();
|
||||
wxLogMessage(wxT("qualities %s"), s2);
|
||||
while (sscanf(s2, "%f", ¶meters.tcp_distoratio[parameters.tcp_numlayers]) == 1) {
|
||||
parameters.tcp_numlayers++;
|
||||
while (*s2 && *s2 != ',') {
|
||||
s2++;
|
||||
}
|
||||
if (!*s2)
|
||||
break;
|
||||
s2++;
|
||||
}
|
||||
wxLogMessage(wxT("%d layers"), parameters.tcp_numlayers);
|
||||
parameters.cp_fixed_quality = 1;
|
||||
}
|
||||
|
||||
/* image origin */
|
||||
if (sscanf(m_origin.ToAscii(), "%d,%d", ¶meters.image_offset_x0, ¶meters.image_offset_y0) != 2) {
|
||||
wxLogError(wxT("bad coordinate of the image origin: x0,y0"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Create comment for codestream */
|
||||
if(m_enablecomm) {
|
||||
parameters.cp_comment = (char *) malloc(strlen(m_comment.ToAscii()) + 1);
|
||||
if(parameters.cp_comment) {
|
||||
strcpy(parameters.cp_comment, m_comment.ToAscii());
|
||||
}
|
||||
} else {
|
||||
parameters.cp_comment = NULL;
|
||||
}
|
||||
|
||||
/* indexing file */
|
||||
if (m_enableidx) {
|
||||
strncpy(indexfilename, m_index.ToAscii(), OPJ_PATH_LEN);
|
||||
wxLogMessage(wxT("index file is %s"), indexfilename);
|
||||
}
|
||||
|
||||
/* if no rate entered, lossless by default */
|
||||
if (parameters.tcp_numlayers == 0) {
|
||||
parameters.tcp_rates[0] = 0; /* MOD antonin : losslessbug */
|
||||
parameters.tcp_numlayers++;
|
||||
parameters.cp_disto_alloc = 1;
|
||||
}
|
||||
|
||||
/* irreversible transform */
|
||||
parameters.irreversible = (m_irreversible == true) ? 1 : 0;
|
||||
|
||||
/* resolutions */
|
||||
parameters.numresolution = m_resolutions;
|
||||
|
||||
/* codeblocks size */
|
||||
if (m_cbsize != wxT("")) {
|
||||
int cblockw_init = 0, cblockh_init = 0;
|
||||
sscanf(m_cbsize.ToAscii(), "%d,%d", &cblockw_init, &cblockh_init);
|
||||
if (cblockw_init * cblockh_init > 4096 || cblockw_init > 1024 || cblockw_init < 4 || cblockh_init > 1024 || cblockh_init < 4) {
|
||||
wxLogError(wxT("!! Size of code_block error !! Restrictions:\n width*height<=4096\n 4<=width,height<= 1024"));
|
||||
return false;
|
||||
}
|
||||
parameters.cblockw_init = cblockw_init;
|
||||
parameters.cblockh_init = cblockh_init;
|
||||
}
|
||||
|
||||
/* precincts size */
|
||||
if (m_prsize != wxT("")) {
|
||||
char sep;
|
||||
int res_spec = 0;
|
||||
char *s = (char *) m_prsize.c_str();
|
||||
do {
|
||||
sep = 0;
|
||||
sscanf(s, "[%d,%d]%c", ¶meters.prcw_init[res_spec], ¶meters.prch_init[res_spec], &sep);
|
||||
parameters.csty |= 0x01;
|
||||
res_spec++;
|
||||
s = strpbrk(s, "]") + 2;
|
||||
} while (sep == ',');
|
||||
parameters.res_spec = res_spec;
|
||||
}
|
||||
|
||||
/* tiles */
|
||||
if (m_tsize != wxT("")) {
|
||||
sscanf(m_tsize.ToAscii(), "%d,%d", ¶meters.cp_tdx, ¶meters.cp_tdy);
|
||||
parameters.tile_size_on = true;
|
||||
}
|
||||
|
||||
/* tile origin */
|
||||
if (sscanf(m_torigin.ToAscii(), "%d,%d", ¶meters.cp_tx0, ¶meters.cp_ty0) != 2) {
|
||||
wxLogError(wxT("tile offset setting error: X0,Y0"));
|
||||
return false;
|
||||
}
|
||||
|
||||
/* use SOP */
|
||||
if (m_enablesop)
|
||||
parameters.csty |= 0x02;
|
||||
|
||||
/* use EPH */
|
||||
if (m_enableeph)
|
||||
parameters.csty |= 0x04;
|
||||
|
||||
/* multiple component transform */
|
||||
if (m_multicomp)
|
||||
parameters.tcp_mct = 1;
|
||||
else
|
||||
parameters.tcp_mct = 0;
|
||||
|
||||
/* mode switch */
|
||||
parameters.mode = (m_enablebypass ? 1 : 0) + (m_enablereset ? 2 : 0)
|
||||
+ (m_enablerestart ? 4 : 0) + (m_enablevsc ? 8 : 0)
|
||||
+ (m_enableerterm ? 16 : 0) + (m_enablesegmark ? 32 : 0);
|
||||
|
||||
/* progression order */
|
||||
switch (m_progression) {
|
||||
|
||||
/* LRCP */
|
||||
case 0:
|
||||
parameters.prog_order = LRCP;
|
||||
break;
|
||||
|
||||
/* RLCP */
|
||||
case 1:
|
||||
parameters.prog_order = RLCP;
|
||||
break;
|
||||
|
||||
/* RPCL */
|
||||
case 2:
|
||||
parameters.prog_order = RPCL;
|
||||
break;
|
||||
|
||||
/* PCRL */
|
||||
case 3:
|
||||
parameters.prog_order = PCRL;
|
||||
break;
|
||||
|
||||
/* CPRL */
|
||||
case 4:
|
||||
parameters.prog_order = CPRL;
|
||||
break;
|
||||
|
||||
/* DCI2K24 */
|
||||
case 5:
|
||||
parameters.cp_cinema = CINEMA2K_24;
|
||||
parameters.cp_rsiz = CINEMA2K;
|
||||
break;
|
||||
|
||||
/* DCI2K48 */
|
||||
case 6:
|
||||
parameters.cp_cinema = CINEMA2K_48;
|
||||
parameters.cp_rsiz = CINEMA2K;
|
||||
break;
|
||||
|
||||
/* DCI4K */
|
||||
case 7:
|
||||
parameters.cp_cinema = CINEMA4K_24;
|
||||
parameters.cp_rsiz = CINEMA4K;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* check cinema */
|
||||
if (parameters.cp_cinema) {
|
||||
|
||||
/* set up */
|
||||
parameters.tile_size_on = false;
|
||||
parameters.cp_tdx=1;
|
||||
parameters.cp_tdy=1;
|
||||
|
||||
/*Tile part*/
|
||||
parameters.tp_flag = 'C';
|
||||
parameters.tp_on = 1;
|
||||
|
||||
/*Tile and Image shall be at (0,0)*/
|
||||
parameters.cp_tx0 = 0;
|
||||
parameters.cp_ty0 = 0;
|
||||
parameters.image_offset_x0 = 0;
|
||||
parameters.image_offset_y0 = 0;
|
||||
|
||||
/*Codeblock size= 32*32*/
|
||||
parameters.cblockw_init = 32;
|
||||
parameters.cblockh_init = 32;
|
||||
parameters.csty |= 0x01;
|
||||
|
||||
/*The progression order shall be CPRL*/
|
||||
parameters.prog_order = CPRL;
|
||||
|
||||
/* No ROI */
|
||||
parameters.roi_compno = -1;
|
||||
|
||||
parameters.subsampling_dx = 1;
|
||||
parameters.subsampling_dy = 1;
|
||||
|
||||
/* 9-7 transform */
|
||||
parameters.irreversible = 1;
|
||||
|
||||
}
|
||||
|
||||
/* convert wx image into opj image */
|
||||
cmptparm = (opj_image_cmptparm_t*) malloc(3 * sizeof(opj_image_cmptparm_t));
|
||||
|
||||
/* initialize opj image components */
|
||||
memset(&cmptparm[0], 0, 3 * sizeof(opj_image_cmptparm_t));
|
||||
for(i = 0; i < 3; i++) {
|
||||
cmptparm[i].prec = 8;
|
||||
cmptparm[i].bpp = 8;
|
||||
cmptparm[i].sgnd = false;
|
||||
cmptparm[i].dx = parameters.subsampling_dx;
|
||||
cmptparm[i].dy = parameters.subsampling_dy;
|
||||
cmptparm[i].w = wimage->GetWidth();
|
||||
cmptparm[i].h = wimage->GetHeight();
|
||||
}
|
||||
|
||||
/* create the image */
|
||||
oimage = opj_image_create(3, &cmptparm[0], CLRSPC_SRGB);
|
||||
if(!oimage) {
|
||||
if (cmptparm)
|
||||
free(cmptparm);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* set image offset and reference grid */
|
||||
oimage->x0 = parameters.image_offset_x0;
|
||||
oimage->y0 = parameters.image_offset_y0;
|
||||
oimage->x1 = parameters.image_offset_x0 + (wimage->GetWidth() - 1) * 1 + 1;
|
||||
oimage->y1 = parameters.image_offset_y0 + (wimage->GetHeight() - 1) * 1 + 1;
|
||||
|
||||
/* load image data */
|
||||
unsigned char *value = wimage->GetData();
|
||||
int area = wimage->GetWidth() * wimage->GetHeight();
|
||||
for (i = 0; i < area; i++) {
|
||||
oimage->comps[0].data[i] = *(value++);
|
||||
oimage->comps[1].data[i] = *(value++);
|
||||
oimage->comps[2].data[i] = *(value++);
|
||||
}
|
||||
|
||||
/* check cinema again */
|
||||
if (parameters.cp_cinema) {
|
||||
int i;
|
||||
float temp_rate;
|
||||
opj_poc_t *POC = NULL;
|
||||
|
||||
switch (parameters.cp_cinema) {
|
||||
|
||||
case CINEMA2K_24:
|
||||
case CINEMA2K_48:
|
||||
if (parameters.numresolution > 6) {
|
||||
parameters.numresolution = 6;
|
||||
}
|
||||
if (!((oimage->comps[0].w == 2048) | (oimage->comps[0].h == 1080))) {
|
||||
wxLogWarning(wxT("Image coordinates %d x %d is not 2K compliant. JPEG Digital Cinema Profile-3 "
|
||||
"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080"),
|
||||
oimage->comps[0].w, oimage->comps[0].h);
|
||||
parameters.cp_rsiz = STD_RSIZ;
|
||||
}
|
||||
break;
|
||||
|
||||
case CINEMA4K_24:
|
||||
if (parameters.numresolution < 1) {
|
||||
parameters.numresolution = 1;
|
||||
} else if (parameters.numresolution > 7) {
|
||||
parameters.numresolution = 7;
|
||||
}
|
||||
if (!((oimage->comps[0].w == 4096) | (oimage->comps[0].h == 2160))) {
|
||||
wxLogWarning(wxT("Image coordinates %d x %d is not 4K compliant. JPEG Digital Cinema Profile-4"
|
||||
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160"),
|
||||
oimage->comps[0].w, oimage->comps[0].h);
|
||||
parameters.cp_rsiz = STD_RSIZ;
|
||||
}
|
||||
parameters.POC[0].tile = 1;
|
||||
parameters.POC[0].resno0 = 0;
|
||||
parameters.POC[0].compno0 = 0;
|
||||
parameters.POC[0].layno1 = 1;
|
||||
parameters.POC[0].resno1 = parameters.numresolution - 1;
|
||||
parameters.POC[0].compno1 = 3;
|
||||
parameters.POC[0].prg1 = CPRL;
|
||||
parameters.POC[1].tile = 1;
|
||||
parameters.POC[1].resno0 = parameters.numresolution - 1;
|
||||
parameters.POC[1].compno0 = 0;
|
||||
parameters.POC[1].layno1 = 1;
|
||||
parameters.POC[1].resno1 = parameters.numresolution;
|
||||
parameters.POC[1].compno1 = 3;
|
||||
parameters.POC[1].prg1 = CPRL;
|
||||
parameters.numpocs = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (parameters.cp_cinema) {
|
||||
case CINEMA2K_24:
|
||||
case CINEMA4K_24:
|
||||
for (i = 0 ; i < parameters.tcp_numlayers; i++) {
|
||||
temp_rate = 0;
|
||||
if (parameters.tcp_rates[i] == 0) {
|
||||
parameters.tcp_rates[0] = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
||||
(CINEMA_24_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
||||
}else{
|
||||
temp_rate = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
||||
(parameters.tcp_rates[i] * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
||||
if (temp_rate > CINEMA_24_CS ) {
|
||||
parameters.tcp_rates[i]= ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
||||
(CINEMA_24_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
||||
} else {
|
||||
/* do nothing */
|
||||
}
|
||||
}
|
||||
}
|
||||
parameters.max_comp_size = COMP_24_CS;
|
||||
break;
|
||||
|
||||
case CINEMA2K_48:
|
||||
for (i = 0; i < parameters.tcp_numlayers; i++) {
|
||||
temp_rate = 0 ;
|
||||
if (parameters.tcp_rates[i] == 0) {
|
||||
parameters.tcp_rates[0] = ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
||||
(CINEMA_48_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
||||
}else{
|
||||
temp_rate =((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
||||
(parameters.tcp_rates[i] * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
||||
if (temp_rate > CINEMA_48_CS ){
|
||||
parameters.tcp_rates[0]= ((float) (oimage->numcomps * oimage->comps[0].w * oimage->comps[0].h * oimage->comps[0].prec)) /
|
||||
(CINEMA_48_CS * 8 * oimage->comps[0].dx * oimage->comps[0].dy);
|
||||
}else{
|
||||
/* do nothing */
|
||||
}
|
||||
}
|
||||
}
|
||||
parameters.max_comp_size = COMP_48_CS;
|
||||
break;
|
||||
}
|
||||
|
||||
parameters.cp_disto_alloc = 1;
|
||||
}
|
||||
|
||||
/* get a J2K compressor handle */
|
||||
opj_cinfo_t* cinfo = opj_create_compress(CODEC_J2K);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the encoder parameters using the current image and user parameters */
|
||||
opj_setup_encoder(cinfo, ¶meters, oimage);
|
||||
|
||||
/* open a byte stream for writing */
|
||||
/* allocate memory for all tiles */
|
||||
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
|
||||
|
||||
/* encode the image */
|
||||
bSuccess = opj_encode_with_info(cinfo, cio, oimage, &cstr_info);
|
||||
if (!bSuccess) {
|
||||
|
||||
opj_cio_close(cio);
|
||||
opj_destroy_compress(cinfo);
|
||||
opj_image_destroy(oimage);
|
||||
if (cmptparm)
|
||||
free(cmptparm);
|
||||
if(parameters.cp_comment)
|
||||
free(parameters.cp_comment);
|
||||
if(parameters.cp_matrice)
|
||||
free(parameters.cp_matrice);
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
wxLogError(wxT("failed to encode image"));
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
return false;
|
||||
}
|
||||
codestream_length = cio_tell(cio);
|
||||
wxLogMessage(wxT("Codestream: %d bytes"), codestream_length);
|
||||
|
||||
/* write the buffer to stream */
|
||||
stream.Write(cio->buffer, codestream_length);
|
||||
|
||||
/* close and free the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
if (write_index_file(&cstr_info, indexfilename)) {
|
||||
wxLogError(wxT("Failed to output index file"));
|
||||
}
|
||||
}
|
||||
|
||||
/* free remaining compression structures */
|
||||
opj_destroy_compress(cinfo);
|
||||
|
||||
/* free image data */
|
||||
opj_image_destroy(oimage);
|
||||
|
||||
if (cmptparm)
|
||||
free(cmptparm);
|
||||
if(parameters.cp_comment)
|
||||
free(parameters.cp_comment);
|
||||
if(parameters.cp_matrice)
|
||||
free(parameters.cp_matrice);
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
wxLogMessage(wxT("J2K: Image encoded!"));
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(default:4611)
|
||||
#endif /* VC++ */
|
||||
|
||||
// recognize the 0xFF4F JPEG 2000 SOC marker
|
||||
bool wxJ2KHandler::DoCanRead( wxInputStream& stream )
|
||||
{
|
||||
unsigned char hdr[2];
|
||||
|
||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||
return false;
|
||||
|
||||
return hdr[0] == 0xFF && hdr[1] == 0x4F;
|
||||
}
|
||||
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagj2k.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"
|
||||
#include "codec/index.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");
|
||||
|
||||
/* decoding */
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
|
||||
/* encoding */
|
||||
m_subsampling = wxT("1,1");
|
||||
m_origin = wxT("0,0");
|
||||
m_rates = wxT("20,10,5");
|
||||
m_quality = wxT("30,35,40");
|
||||
m_enablequality = false;
|
||||
m_multicomp = false;
|
||||
m_irreversible = false;
|
||||
m_resolutions = 6;
|
||||
m_progression = 0;
|
||||
m_cbsize = wxT("32,32");
|
||||
m_prsize = wxT("[128,128],[128,128]");
|
||||
m_tsize = wxT("");
|
||||
m_torigin = wxT("0,0");
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
m_enablesop = false;
|
||||
m_enableeph = false;
|
||||
m_enablereset = false;
|
||||
m_enablesegmark = false;
|
||||
m_enablevsc = false;
|
||||
m_enablerestart = false;
|
||||
m_enableerterm = false;
|
||||
m_enablebypass = false;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
m_enableidx = false;
|
||||
m_index = wxT("index.txt");
|
||||
m_enablepoc = false;
|
||||
m_poc = wxT("T1=0,0,1,5,3,CPRL/T1=5,0,1,6,3,CPRL");
|
||||
m_enablecomm = true;
|
||||
|
||||
#if defined __WXMSW__
|
||||
m_comment = wxT("Created by OPJViewer Win32 - OpenJPEG version ");
|
||||
#elif defined __WXGTK__
|
||||
m_comment = wxT("Created by OPJViewer Lin32 - OpenJPEG version ");
|
||||
#else
|
||||
m_comment = wxT("Created by OPJViewer - OpenJPEG version ");
|
||||
#endif
|
||||
|
||||
#ifdef USE_JPWL
|
||||
m_comment += wxString::Format(wxT("%s with JPWL"), (char *) opj_version());
|
||||
#else
|
||||
m_comment += wxString::Format(wxT("%s"), (char *) opj_version());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
// encoding engine parameters
|
||||
wxString m_subsampling;
|
||||
wxString m_origin;
|
||||
wxString m_rates;
|
||||
wxString m_quality;
|
||||
bool m_enablequality;
|
||||
bool m_multicomp;
|
||||
bool m_irreversible;
|
||||
int m_resolutions;
|
||||
int m_progression;
|
||||
wxString m_cbsize;
|
||||
wxString m_prsize;
|
||||
wxString m_tsize;
|
||||
wxString m_torigin;
|
||||
/*m_progression
|
||||
m_resilience*/
|
||||
bool m_enablesop;
|
||||
bool m_enableeph;
|
||||
bool m_enablebypass;
|
||||
bool m_enableerterm;
|
||||
bool m_enablerestart;
|
||||
bool m_enablereset;
|
||||
bool m_enablesegmark;
|
||||
bool m_enablevsc;
|
||||
/*m_roicompo
|
||||
m_roiup
|
||||
m_indexfname*/
|
||||
bool m_enableidx;
|
||||
wxString m_index;
|
||||
bool m_enablecomm;
|
||||
wxString m_comment;
|
||||
bool m_enablepoc;
|
||||
wxString m_poc;
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||
protected:
|
||||
virtual bool DoCanRead( wxInputStream& stream );
|
||||
#endif
|
||||
|
||||
private:
|
||||
OPJ_PROG_ORDER give_progression(char progression[4]);
|
||||
DECLARE_DYNAMIC_CLASS(wxJ2KHandler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // _WX_IMAGJ2K_H_
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagjp2.cpp
|
||||
// Purpose: wxImage JPEG 2000 file format handler
|
||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagjp2.cpp,v 0.00 2007/02/08 23:59:00 MW Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "imagjp2.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxJP2Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxJP2Handler,wxImageHandler)
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
//------------- JPEG 2000 Data Source Manager
|
||||
|
||||
#define J2K_CFMT 0
|
||||
#define JP2_CFMT 1
|
||||
#define JPT_CFMT 2
|
||||
#define MJ2_CFMT 3
|
||||
#define PXM_DFMT 0
|
||||
#define PGX_DFMT 1
|
||||
#define BMP_DFMT 2
|
||||
#define YUV_DFMT 3
|
||||
|
||||
#define MAX_MESSAGE_LEN 200
|
||||
|
||||
/* sample error callback expecting a FILE* client object */
|
||||
void jp2_error_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample warning callback expecting a FILE* client object */
|
||||
void jp2_warning_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample debug callback expecting no client object */
|
||||
void jp2_info_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
// load the jp2 file format
|
||||
bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
||||
{
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
opj_image_t *opjimage = NULL;
|
||||
unsigned char *src = NULL;
|
||||
unsigned char *ptr;
|
||||
int file_length;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
|
||||
// destroy the image
|
||||
image->Destroy();
|
||||
|
||||
/* handle to a decompressor */
|
||||
opj_dinfo_t* dinfo = NULL;
|
||||
opj_cio_t *cio = NULL;
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = jp2_error_callback;
|
||||
event_mgr.warning_handler = jp2_warning_callback;
|
||||
event_mgr.info_handler = jp2_info_callback;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
/* prepare parameters */
|
||||
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
||||
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
||||
parameters.decod_format = JP2_CFMT;
|
||||
parameters.cod_format = BMP_DFMT;
|
||||
if (m_reducefactor)
|
||||
parameters.cp_reduce = m_reducefactor;
|
||||
if (m_qualitylayers)
|
||||
parameters.cp_layer = m_qualitylayers;
|
||||
/*if (n_components)
|
||||
parameters. = n_components;*/
|
||||
|
||||
/* JPWL only */
|
||||
#ifdef USE_JPWL
|
||||
parameters.jpwl_exp_comps = m_expcomps;
|
||||
parameters.jpwl_max_tiles = m_maxtiles;
|
||||
parameters.jpwl_correct = m_enablejpwl;
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JP2);
|
||||
|
||||
/* find length of the stream */
|
||||
stream.SeekI(0, wxFromEnd);
|
||||
file_length = (int) stream.TellI();
|
||||
|
||||
/* get data */
|
||||
stream.SeekI(0, wxFromStart);
|
||||
src = (unsigned char *) malloc(file_length);
|
||||
stream.Read(src, file_length);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogError(wxT("JP2: failed to decode image!"));
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
free(src);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* common rendering method */
|
||||
#include "imagjpeg2000.cpp"
|
||||
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("JP2: image loaded."));
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
/* close openjpeg structs */
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_image_destroy(opjimage);
|
||||
free(src);
|
||||
|
||||
if (!image->Ok())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// save the jp2 file format
|
||||
bool wxJP2Handler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||
{
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogError(wxT("JP2: Couldn't save image -> not implemented."));
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(default:4611)
|
||||
#endif /* VC++ */
|
||||
|
||||
// recognize the JPEG 2000 starting box
|
||||
bool wxJP2Handler::DoCanRead( wxInputStream& stream )
|
||||
{
|
||||
unsigned char hdr[23];
|
||||
|
||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||
return false;
|
||||
|
||||
return (hdr[0] == 0x00 &&
|
||||
hdr[1] == 0x00 &&
|
||||
hdr[2] == 0x00 &&
|
||||
hdr[3] == 0x0C &&
|
||||
hdr[4] == 0x6A &&
|
||||
hdr[5] == 0x50 &&
|
||||
hdr[6] == 0x20 &&
|
||||
hdr[7] == 0x20 &&
|
||||
hdr[20] == 0x6A &&
|
||||
hdr[21] == 0x70 &&
|
||||
hdr[22] == 0x32);
|
||||
}
|
||||
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagjp2.h
|
||||
// Purpose: wxImage JPEG 2000 file format handler
|
||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagjp2.h,v 0.0 2007/02/08 23:45:00 VZ Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGJP2_H_
|
||||
#define _WX_IMAGJP2_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxJP2Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#define wxBITMAP_TYPE_JP2 48
|
||||
|
||||
class WXDLLEXPORT wxJP2Handler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxJP2Handler()
|
||||
{
|
||||
m_name = wxT("JPEG 2000 file format");
|
||||
m_extension = wxT("jp2");
|
||||
m_type = wxBITMAP_TYPE_JP2;
|
||||
m_mime = wxT("image/jp2");
|
||||
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||
protected:
|
||||
virtual bool DoCanRead( wxInputStream& stream );
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxJP2Handler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // _WX_IMAGJP2_H_
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: 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++);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,771 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagmj2.cpp
|
||||
// Purpose: wxImage Motion JPEG 2000 file format handler
|
||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagmj2.cpp,v 0.00 2007/02/18 23:59:00 MW Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "imagmj2.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/log.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/module.h"
|
||||
#endif
|
||||
|
||||
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/wfstream.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMJ2Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMJ2Handler,wxImageHandler)
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
//------------- JPEG 2000 Data Source Manager
|
||||
|
||||
#define J2K_CFMT 0
|
||||
#define JP2_CFMT 1
|
||||
#define JPT_CFMT 2
|
||||
#define MJ2_CFMT 3
|
||||
#define PXM_DFMT 0
|
||||
#define PGX_DFMT 1
|
||||
#define BMP_DFMT 2
|
||||
#define YUV_DFMT 3
|
||||
|
||||
#define MAX_MESSAGE_LEN 200
|
||||
|
||||
/* sample error callback expecting a FILE* client object */
|
||||
void mj2_error_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[ERROR] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample warning callback expecting a FILE* client object */
|
||||
void mj2_warning_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[WARNING] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* sample debug callback expecting no client object */
|
||||
void mj2_info_callback(const char *msg, void *client_data) {
|
||||
int message_len = strlen(msg) - 1;
|
||||
if (msg[message_len] != '\n')
|
||||
message_len = MAX_MESSAGE_LEN;
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiEnter();
|
||||
#endif /* __WXGTK__ */
|
||||
wxLogMessage(wxT("[INFO] %.*s"), message_len, msg);
|
||||
#ifndef __WXGTK__
|
||||
wxMutexGuiLeave();
|
||||
#endif /* __WXGTK__ */
|
||||
}
|
||||
|
||||
/* macro functions */
|
||||
/* From little endian to big endian, 2 and 4 bytes */
|
||||
#define BYTE_SWAP2(X) ((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8)
|
||||
#define BYTE_SWAP4(X) ((X & 0x000000FF) << 24) | ((X & 0x0000FF00) << 8) | ((X & 0x00FF0000) >> 8) | ((X & 0xFF000000) >> 24)
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#define BYTE_SWAP8(X) ((X & 0x00000000000000FFULL) << 56) | ((X & 0x000000000000FF00ULL) << 40) | \
|
||||
((X & 0x0000000000FF0000ULL) << 24) | ((X & 0x00000000FF000000ULL) << 8) | \
|
||||
((X & 0x000000FF00000000ULL) >> 8) | ((X & 0x0000FF0000000000ULL) >> 24) | \
|
||||
((X & 0x00FF000000000000ULL) >> 40) | ((X & 0xFF00000000000000ULL) >> 56)
|
||||
#else
|
||||
#define BYTE_SWAP8(X) ((X & 0x00000000000000FF) << 56) | ((X & 0x000000000000FF00) << 40) | \
|
||||
((X & 0x0000000000FF0000) << 24) | ((X & 0x00000000FF000000) << 8) | \
|
||||
((X & 0x000000FF00000000) >> 8) | ((X & 0x0000FF0000000000) >> 24) | \
|
||||
((X & 0x00FF000000000000) >> 40) | ((X & 0xFF00000000000000) >> 56)
|
||||
#endif
|
||||
|
||||
/* From codestream to int values */
|
||||
#define STREAM_TO_UINT32(C, P) (((unsigned long int) (C)[(P) + 0] << 24) + \
|
||||
((unsigned long int) (C)[(P) + 1] << 16) + \
|
||||
((unsigned long int) (C)[(P) + 2] << 8) + \
|
||||
((unsigned long int) (C)[(P) + 3] << 0))
|
||||
|
||||
#define STREAM_TO_UINT16(C, P) (((unsigned long int) (C)[(P) + 0] << 8) + \
|
||||
((unsigned long int) (C)[(P) + 1] << 0))
|
||||
|
||||
/* defines */
|
||||
#define SHORT_DESCR_LEN 32
|
||||
#define LONG_DESCR_LEN 256
|
||||
|
||||
/* enumeration for file formats */
|
||||
#define J2FILENUM 4
|
||||
typedef enum {
|
||||
|
||||
JP2_FILE,
|
||||
J2K_FILE,
|
||||
MJ2_FILE,
|
||||
UNK_FILE
|
||||
|
||||
} my_j2filetype;
|
||||
|
||||
/* enumeration for the box types */
|
||||
#define J2BOXNUM 23
|
||||
typedef enum {
|
||||
|
||||
FILE_BOX,
|
||||
JP_BOX,
|
||||
FTYP_BOX,
|
||||
JP2H_BOX,
|
||||
IHDR_BOX,
|
||||
COLR_BOX,
|
||||
JP2C_BOX,
|
||||
JP2I_BOX,
|
||||
XML_BOX,
|
||||
UUID_BOX,
|
||||
UINF_BOX,
|
||||
MOOV_BOX,
|
||||
MVHD_BOX,
|
||||
TRAK_BOX,
|
||||
TKHD_BOX,
|
||||
MDIA_BOX,
|
||||
MINF_BOX,
|
||||
STBL_BOX,
|
||||
STSD_BOX,
|
||||
MJP2_BOX,
|
||||
MDAT_BOX,
|
||||
ANY_BOX,
|
||||
UNK_BOX
|
||||
|
||||
} my_j2boxtype;
|
||||
|
||||
/* jp2 family box signatures */
|
||||
#define FILE_SIGN ""
|
||||
#define JP_SIGN "jP\040\040"
|
||||
#define FTYP_SIGN "ftyp"
|
||||
#define JP2H_SIGN "jp2h"
|
||||
#define IHDR_SIGN "ihdr"
|
||||
#define COLR_SIGN "colr"
|
||||
#define JP2C_SIGN "jp2c"
|
||||
#define JP2I_SIGN "jp2i"
|
||||
#define XML_SIGN "xml\040"
|
||||
#define UUID_SIGN "uuid"
|
||||
#define UINF_SIGN "uinf"
|
||||
#define MOOV_SIGN "moov"
|
||||
#define MVHD_SIGN "mvhd"
|
||||
#define TRAK_SIGN "trak"
|
||||
#define TKHD_SIGN "tkhd"
|
||||
#define MDIA_SIGN "mdia"
|
||||
#define MINF_SIGN "minf"
|
||||
#define VMHD_SIGN "vmhd"
|
||||
#define STBL_SIGN "stbl"
|
||||
#define STSD_SIGN "stsd"
|
||||
#define MJP2_SIGN "mjp2"
|
||||
#define MDAT_SIGN "mdat"
|
||||
#define ANY_SIGN ""
|
||||
#define UNK_SIGN ""
|
||||
|
||||
/* the box structure itself */
|
||||
struct my_boxdef {
|
||||
|
||||
char value[5]; /* hexadecimal value/string*/
|
||||
char name[SHORT_DESCR_LEN]; /* short description */
|
||||
char descr[LONG_DESCR_LEN]; /* long description */
|
||||
int sbox; /* is it a superbox? */
|
||||
int req[J2FILENUM]; /* mandatory box */
|
||||
my_j2boxtype ins; /* contained in box... */
|
||||
|
||||
};
|
||||
|
||||
/* the possible boxes */
|
||||
struct my_boxdef j2box[] =
|
||||
{
|
||||
/* sign */ {FILE_SIGN,
|
||||
/* short */ "placeholder for nothing",
|
||||
/* long */ "Nothing to say",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {JP_SIGN,
|
||||
/* short */ "JPEG 2000 Signature box",
|
||||
/* long */ "This box uniquely identifies the file as being part of the JPEG 2000 family of files",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {FTYP_SIGN,
|
||||
/* short */ "File Type box",
|
||||
/* long */ "This box specifies file type, version and compatibility information, including specifying if this file "
|
||||
"is a conforming JP2 file or if it can be read by a conforming JP2 reader",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {JP2H_SIGN,
|
||||
/* short */ "JP2 Header box",
|
||||
/* long */ "This box contains a series of boxes that contain header-type information about the file",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {IHDR_SIGN,
|
||||
/* short */ "Image Header box",
|
||||
/* long */ "This box specifies the size of the image and other related fields",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ JP2H_BOX},
|
||||
|
||||
/* sign */ {COLR_SIGN,
|
||||
/* short */ "Colour Specification box",
|
||||
/* long */ "This box specifies the colourspace of the image",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ JP2H_BOX},
|
||||
|
||||
/* sign */ {JP2C_SIGN,
|
||||
/* short */ "Contiguous Codestream box",
|
||||
/* long */ "This box contains the codestream as defined by Annex A",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {JP2I_SIGN,
|
||||
/* short */ "Intellectual Property box",
|
||||
/* long */ "This box contains intellectual property information about the image",
|
||||
/* sbox */ 0,
|
||||
/* req */ {0, 0, 0},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {XML_SIGN,
|
||||
/* short */ "XML box",
|
||||
/* long */ "This box provides a tool by which vendors can add XML formatted information to a JP2 file",
|
||||
/* sbox */ 0,
|
||||
/* req */ {0, 0, 0},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {UUID_SIGN,
|
||||
/* short */ "UUID box",
|
||||
/* long */ "This box provides a tool by which vendors can add additional information to a file "
|
||||
"without risking conflict with other vendors",
|
||||
/* sbox */ 0,
|
||||
/* req */ {0, 0, 0},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {UINF_SIGN,
|
||||
/* short */ "UUID Info box",
|
||||
/* long */ "This box provides a tool by which a vendor may provide access to additional information associated with a UUID",
|
||||
/* sbox */ 0,
|
||||
/* req */ {0, 0, 0},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {MOOV_SIGN,
|
||||
/* short */ "Movie box",
|
||||
/* long */ "This box contains the media data. In video tracks, this box would contain JPEG2000 video frames",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {MVHD_SIGN,
|
||||
/* short */ "Movie Header box",
|
||||
/* long */ "This box defines overall information which is media-independent, and relevant to the entire presentation "
|
||||
"considered as a whole",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ MOOV_BOX},
|
||||
|
||||
/* sign */ {TRAK_SIGN,
|
||||
/* short */ "Track box",
|
||||
/* long */ "This is a container box for a single track of a presentation. A presentation may consist of one or more tracks",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ MOOV_BOX},
|
||||
|
||||
/* sign */ {TKHD_SIGN,
|
||||
/* short */ "Track Header box",
|
||||
/* long */ "This box specifies the characteristics of a single track. Exactly one Track Header Box is contained in a track",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ TRAK_BOX},
|
||||
|
||||
/* sign */ {MDIA_SIGN,
|
||||
/* short */ "Media box",
|
||||
/* long */ "The media declaration container contains all the objects which declare information about the media data "
|
||||
"within a track",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ TRAK_BOX},
|
||||
|
||||
/* sign */ {MINF_SIGN,
|
||||
/* short */ "Media Information box",
|
||||
/* long */ "This box contains all the objects which declare characteristic information of the media in the track",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ MDIA_BOX},
|
||||
|
||||
/* sign */ {STBL_SIGN,
|
||||
/* short */ "Sample Table box",
|
||||
/* long */ "The sample table contains all the time and data indexing of the media samples in a track",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ MINF_BOX},
|
||||
|
||||
/* sign */ {STSD_SIGN,
|
||||
/* short */ "Sample Description box",
|
||||
/* long */ "The sample description table gives detailed information about the coding type used, and any initialization "
|
||||
"information needed for that coding",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ MINF_BOX},
|
||||
|
||||
/* sign */ {MJP2_SIGN,
|
||||
/* short */ "MJP2 Sample Description box",
|
||||
/* long */ "The MJP2 sample description table gives detailed information about the coding type used, and any initialization "
|
||||
"information needed for that coding",
|
||||
/* sbox */ 0,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ MINF_BOX},
|
||||
|
||||
/* sign */ {MDAT_SIGN,
|
||||
/* short */ "Media Data box",
|
||||
/* long */ "The meta-data for a presentation is stored in the single Movie Box which occurs at the top-level of a file",
|
||||
/* sbox */ 1,
|
||||
/* req */ {1, 1, 1},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {ANY_SIGN,
|
||||
/* short */ "Any box",
|
||||
/* long */ "All the existing boxes",
|
||||
/* sbox */ 0,
|
||||
/* req */ {0, 0, 0},
|
||||
/* ins */ FILE_BOX},
|
||||
|
||||
/* sign */ {UNK_SIGN,
|
||||
/* short */ "Unknown Type box",
|
||||
/* long */ "The signature is not recognised to be that of an existing box",
|
||||
/* sbox */ 0,
|
||||
/* req */ {0, 0, 0},
|
||||
/* ins */ ANY_BOX}
|
||||
|
||||
};
|
||||
|
||||
/* declaration */
|
||||
int
|
||||
my_box_handler_function(my_j2boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
||||
char *scansign, unsigned long int *scanpoint);
|
||||
|
||||
#ifdef __WXMSW__
|
||||
typedef unsigned __int64 int8byte;
|
||||
#endif // __WXMSW__
|
||||
|
||||
#ifdef __WXGTK__
|
||||
typedef unsigned long long int8byte;
|
||||
#endif // __WXGTK__
|
||||
|
||||
/* internal mini-search for a box signature */
|
||||
int
|
||||
my_jpeg2000parse(wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
||||
char *scansign, unsigned long int *scanpoint)
|
||||
{
|
||||
unsigned long int LBox = 0x00000000;
|
||||
//int LBox_read;
|
||||
char TBox[5] = "\0\0\0\0";
|
||||
//int TBox_read;
|
||||
int8byte XLBox = 0x0000000000000000;
|
||||
//int XLBox_read;
|
||||
unsigned long int box_length = 0;
|
||||
int last_box = 0, box_num = 0;
|
||||
int box_type = ANY_BOX;
|
||||
unsigned char /*onebyte[1], twobytes[2],*/ fourbytes[4];
|
||||
int box_number = 0;
|
||||
|
||||
/* cycle all over the file */
|
||||
box_num = 0;
|
||||
last_box = 0;
|
||||
while (!last_box) {
|
||||
|
||||
/* do not exceed file limit */
|
||||
if (filepoint >= filelimit)
|
||||
return (0);
|
||||
|
||||
/* seek on file */
|
||||
if (stream.SeekI(filepoint, wxFromStart) == wxInvalidOffset)
|
||||
return (-1);
|
||||
|
||||
/* read the mandatory LBox, 4 bytes */
|
||||
if (!stream.Read(fourbytes, 4)) {
|
||||
(wxT("Problem reading LBox from the file (file ended?)"));
|
||||
return -1;
|
||||
};
|
||||
LBox = STREAM_TO_UINT32(fourbytes, 0);
|
||||
|
||||
/* read the mandatory TBox, 4 bytes */
|
||||
if (!stream.Read(TBox, 4)) {
|
||||
wxLogError(wxT("Problem reading TBox from the file (file ended?)"));
|
||||
return -1;
|
||||
};
|
||||
|
||||
/* look if scansign is got */
|
||||
if ((scansign != NULL) && (memcmp(TBox, scansign, 4) == 0)) {
|
||||
/* hack/exploit */
|
||||
// stop as soon as you find the level-th codebox
|
||||
if (box_number == level) {
|
||||
memcpy(scansign, " ", 4);
|
||||
*scanpoint = filepoint;
|
||||
return (0);
|
||||
} else
|
||||
box_number++;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* determine the box type */
|
||||
for (box_type = JP_BOX; box_type < UNK_BOX; box_type++)
|
||||
if (memcmp(TBox, j2box[box_type].value, 4) == 0)
|
||||
break;
|
||||
|
||||
/* read the optional XLBox, 8 bytes */
|
||||
if (LBox == 1) {
|
||||
|
||||
if (!stream.Read(&XLBox, 8)) {
|
||||
wxLogError(wxT("Problem reading XLBox from the file (file ended?)"));
|
||||
return -1;
|
||||
};
|
||||
box_length = (unsigned long int) BYTE_SWAP8(XLBox);
|
||||
|
||||
} else if (LBox == 0x00000000) {
|
||||
|
||||
/* last box in file */
|
||||
last_box = 1;
|
||||
box_length = filelimit - filepoint;
|
||||
|
||||
} else
|
||||
|
||||
box_length = LBox;
|
||||
|
||||
|
||||
/* go deep in the box */
|
||||
my_box_handler_function((my_j2boxtype) box_type, stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length, level,
|
||||
scansign, scanpoint);
|
||||
|
||||
/* if it's a superbox go inside it */
|
||||
if (j2box[box_type].sbox)
|
||||
my_jpeg2000parse(stream, (LBox == 1) ? (filepoint + 16) : (filepoint + 8), filepoint + box_length,
|
||||
level, scansign, scanpoint);
|
||||
|
||||
/* increment box number and filepoint*/
|
||||
box_num++;
|
||||
filepoint += box_length;
|
||||
|
||||
};
|
||||
|
||||
/* all good */
|
||||
return (0);
|
||||
}
|
||||
|
||||
// search first contiguos codestream box in an mj2 file
|
||||
unsigned long int
|
||||
searchjp2c(wxInputStream& stream, unsigned long int fsize, int number)
|
||||
{
|
||||
char scansign[] = "jp2c";
|
||||
unsigned long int scanpoint = 0L;
|
||||
|
||||
wxLogMessage(wxT("MJ2: searching jp2c box... "));
|
||||
|
||||
/* do the parsing */
|
||||
if (my_jpeg2000parse(stream, 0, fsize, number, scansign, &scanpoint) < 0)
|
||||
wxLogMessage(wxT("MJ2: Unrecoverable error during file parsing: stopping"));
|
||||
|
||||
if (strcmp(scansign, " "))
|
||||
wxLogMessage(wxT("MJ2: not found"));
|
||||
else {
|
||||
|
||||
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
|
||||
|
||||
};
|
||||
|
||||
|
||||
return (scanpoint);
|
||||
}
|
||||
|
||||
// search the jp2h box in the file
|
||||
unsigned long int
|
||||
searchjpegheaderbox(wxInputStream& stream, unsigned long int fsize)
|
||||
{
|
||||
char scansign[] = "jp2h";
|
||||
unsigned long int scanpoint = 0L;
|
||||
|
||||
wxLogMessage(wxT("MJ2: searching jp2h box... "));
|
||||
|
||||
/* do the parsing */
|
||||
if (my_jpeg2000parse(stream, 0, fsize, 0, scansign, &scanpoint) < 0)
|
||||
wxLogMessage(wxT("Unrecoverable error during file parsing: stopping"));
|
||||
|
||||
if (strcmp(scansign, " "))
|
||||
wxLogMessage(wxT("MJ2: not found"));
|
||||
else
|
||||
wxLogMessage(wxString::Format(wxT("MJ2: found at byte %d"), scanpoint));
|
||||
|
||||
return (scanpoint);
|
||||
}
|
||||
|
||||
/* handling functions */
|
||||
#define ITEM_PER_ROW 10
|
||||
|
||||
/* Box handler function */
|
||||
int
|
||||
my_box_handler_function(my_j2boxtype boxtype, wxInputStream& stream, unsigned long int filepoint, unsigned long int filelimit, int level,
|
||||
char *scansign, unsigned long int *scanpoint)
|
||||
{
|
||||
switch (boxtype) {
|
||||
|
||||
/* Sample Description box */
|
||||
case (STSD_BOX):
|
||||
my_jpeg2000parse(stream, filepoint + 8, filelimit, level, scansign, scanpoint);
|
||||
break;
|
||||
|
||||
/* MJP2 Sample Description box */
|
||||
case (MJP2_BOX):
|
||||
my_jpeg2000parse(stream, filepoint + 78, filelimit, level, scansign, scanpoint);
|
||||
break;
|
||||
|
||||
/* not yet implemented */
|
||||
default:
|
||||
break;
|
||||
|
||||
};
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
// the jP and ftyp parts of the header
|
||||
#define my_jPheadSIZE 32
|
||||
unsigned char my_jPhead[my_jPheadSIZE] = {
|
||||
0x00, 0x00, 0x00, 0x0C, 'j', 'P', ' ', ' ',
|
||||
0x0D, 0x0A, 0x87, 0x0A, 0x00, 0x00, 0x00, 0x14,
|
||||
'f', 't', 'y', 'p', 'j', 'p', '2', ' ',
|
||||
0x00, 0x00, 0x00, 0x00, 'j', 'p', '2', ' '
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////
|
||||
|
||||
// load the mj2 file format
|
||||
bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, int index)
|
||||
{
|
||||
opj_dparameters_t parameters; /* decompression parameters */
|
||||
opj_event_mgr_t event_mgr; /* event manager */
|
||||
opj_image_t *opjimage = NULL;
|
||||
unsigned char *src = NULL;
|
||||
unsigned char *ptr;
|
||||
int file_length, jp2c_point, jp2h_point;
|
||||
unsigned long int jp2hboxlen, jp2cboxlen;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
|
||||
// destroy the image
|
||||
image->Destroy();
|
||||
|
||||
/* handle to a decompressor */
|
||||
opj_dinfo_t* dinfo = NULL;
|
||||
opj_cio_t *cio = NULL;
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = mj2_error_callback;
|
||||
event_mgr.warning_handler = mj2_warning_callback;
|
||||
event_mgr.info_handler = mj2_info_callback;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
/* prepare parameters */
|
||||
strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
|
||||
strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
|
||||
parameters.decod_format = JP2_CFMT;
|
||||
parameters.cod_format = BMP_DFMT;
|
||||
if (m_reducefactor)
|
||||
parameters.cp_reduce = m_reducefactor;
|
||||
if (m_qualitylayers)
|
||||
parameters.cp_layer = m_qualitylayers;
|
||||
/*if (n_components)
|
||||
parameters. = n_components;*/
|
||||
|
||||
/* JPWL only */
|
||||
#ifdef USE_JPWL
|
||||
parameters.jpwl_exp_comps = m_expcomps;
|
||||
parameters.jpwl_max_tiles = m_maxtiles;
|
||||
parameters.jpwl_correct = m_enablejpwl;
|
||||
#endif /* USE_JPWL */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JP2);
|
||||
|
||||
/* find length of the stream */
|
||||
stream.SeekI(0, wxFromEnd);
|
||||
file_length = (int) stream.TellI();
|
||||
|
||||
/* search for the first codestream box and the movie header box */
|
||||
jp2c_point = searchjp2c(stream, file_length, m_framenum);
|
||||
jp2h_point = searchjpegheaderbox(stream, file_length);
|
||||
|
||||
// read the jp2h box and store it
|
||||
stream.SeekI(jp2h_point, wxFromStart);
|
||||
stream.Read(&jp2hboxlen, sizeof(unsigned long int));
|
||||
jp2hboxlen = BYTE_SWAP4(jp2hboxlen);
|
||||
|
||||
// read the jp2c box and store it
|
||||
stream.SeekI(jp2c_point, wxFromStart);
|
||||
stream.Read(&jp2cboxlen, sizeof(unsigned long int));
|
||||
jp2cboxlen = BYTE_SWAP4(jp2cboxlen);
|
||||
|
||||
// malloc memory source
|
||||
src = (unsigned char *) malloc(my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
||||
|
||||
// copy the jP and ftyp
|
||||
memcpy(src, my_jPhead, my_jPheadSIZE);
|
||||
|
||||
// copy the jp2h
|
||||
stream.SeekI(jp2h_point, wxFromStart);
|
||||
stream.Read(&src[my_jPheadSIZE], jp2hboxlen);
|
||||
|
||||
// copy the jp2c
|
||||
stream.SeekI(jp2c_point, wxFromStart);
|
||||
stream.Read(&src[my_jPheadSIZE + jp2hboxlen], jp2cboxlen);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, my_jPheadSIZE + jp2hboxlen + jp2cboxlen);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
wxMutexGuiEnter();
|
||||
wxLogError(wxT("MJ2: failed to decode image!"));
|
||||
wxMutexGuiLeave();
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
free(src);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* common rendering method */
|
||||
#include "imagjpeg2000.cpp"
|
||||
|
||||
wxMutexGuiEnter();
|
||||
wxLogMessage(wxT("MJ2: image loaded."));
|
||||
wxMutexGuiLeave();
|
||||
|
||||
/* close openjpeg structs */
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_image_destroy(opjimage);
|
||||
free(src);
|
||||
|
||||
if (!image->Ok())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
// save the mj2 file format
|
||||
bool wxMJ2Handler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||
{
|
||||
wxLogError(wxT("MJ2: Couldn't save movie -> not implemented."));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(default:4611)
|
||||
#endif /* VC++ */
|
||||
|
||||
// recognize the Motion JPEG 2000 starting box
|
||||
bool wxMJ2Handler::DoCanRead( wxInputStream& stream )
|
||||
{
|
||||
unsigned char hdr[24];
|
||||
|
||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||
return false;
|
||||
|
||||
return (hdr[0] == 0x00 &&
|
||||
hdr[1] == 0x00 &&
|
||||
hdr[2] == 0x00 &&
|
||||
hdr[3] == 0x0C &&
|
||||
hdr[4] == 0x6A &&
|
||||
hdr[5] == 0x50 &&
|
||||
hdr[6] == 0x20 &&
|
||||
hdr[7] == 0x20 &&
|
||||
hdr[20] == 0x6D &&
|
||||
hdr[21] == 0x6A &&
|
||||
hdr[22] == 0x70 &&
|
||||
hdr[23] == 0x32);
|
||||
}
|
||||
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagmj2.h
|
||||
// Purpose: wxImage Motion JPEG 2000 file format handler
|
||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/02/18 23:45:00 VZ Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGMJ2_H_
|
||||
#define _WX_IMAGMJ2_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMJ2Handler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#define wxBITMAP_TYPE_MJ2 49
|
||||
|
||||
class WXDLLEXPORT wxMJ2Handler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxMJ2Handler()
|
||||
{
|
||||
m_name = wxT("Motion JPEG 2000 file format");
|
||||
m_extension = wxT("mj2");
|
||||
m_type = wxBITMAP_TYPE_MJ2;
|
||||
m_mime = wxT("image/mj2");
|
||||
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#ifdef USE_JPWL
|
||||
m_enablejpwl = true;
|
||||
m_expcomps = JPWL_EXPECTED_COMPONENTS;
|
||||
m_maxtiles = JPWL_MAXIMUM_TILES;
|
||||
#endif // USE_JPWL
|
||||
}
|
||||
|
||||
// decoding engine parameters
|
||||
int m_reducefactor, m_qualitylayers, m_components, m_framenum;
|
||||
#ifdef USE_JPWL
|
||||
bool m_enablejpwl;
|
||||
int m_expcomps, m_maxtiles;
|
||||
#endif // USE_JPWL
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||
protected:
|
||||
virtual bool DoCanRead( wxInputStream& stream );
|
||||
#endif
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMJ2Handler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // _WX_IMAGMJ2_H_
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagmxf.cpp
|
||||
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
|
||||
// Author: Giuseppe Baruffa - based on imagjpeg.cpp, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagmxf.cpp,v 0.00 2007/11/19 17:00:00 MW Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef USE_MXF
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#if wxUSE_IMAGE && wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "imagmxf.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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMXFHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMXFHandler,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 mxf_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 mxf_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 mxf_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 mxf file format
|
||||
bool wxMXFHandler::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, j2k_point, j2k_len;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
|
||||
// destroy the image
|
||||
image->Destroy();
|
||||
|
||||
/* handle to a decompressor */
|
||||
opj_dinfo_t* dinfo = NULL;
|
||||
opj_cio_t *cio = NULL;
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = mxf_error_callback;
|
||||
event_mgr.warning_handler = mxf_warning_callback;
|
||||
event_mgr.info_handler = mxf_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;
|
||||
/*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_J2K);
|
||||
|
||||
/* find length of the stream */
|
||||
stream.SeekI(0, wxFromEnd);
|
||||
file_length = (int) stream.TellI();
|
||||
|
||||
/* search for the m_framenum codestream position and length */
|
||||
//jp2c_point = searchjp2c(stream, file_length, m_framenum);
|
||||
//jp2c_len = searchjp2c(stream, file_length, m_framenum);
|
||||
j2k_point = 0;
|
||||
j2k_len = 10;
|
||||
|
||||
// malloc memory source
|
||||
src = (unsigned char *) malloc(j2k_len);
|
||||
|
||||
// copy the jp2c
|
||||
stream.SeekI(j2k_point, wxFromStart);
|
||||
stream.Read(src, j2k_len);
|
||||
|
||||
/* 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, j2k_len);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
opjimage = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
if (!opjimage) {
|
||||
wxMutexGuiEnter();
|
||||
wxLogError(wxT("MXF: 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("MXF: 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 mxf file format
|
||||
bool wxMXFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||
{
|
||||
wxLogError(wxT("MXF: Couldn't save movie -> not implemented."));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef __VISUALC__
|
||||
#pragma warning(default:4611)
|
||||
#endif /* VC++ */
|
||||
|
||||
// recognize the MXF JPEG 2000 starting box
|
||||
bool wxMXFHandler::DoCanRead( wxInputStream& stream )
|
||||
{
|
||||
unsigned char hdr[4];
|
||||
|
||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||
return false;
|
||||
|
||||
return (hdr[0] == 0x06 &&
|
||||
hdr[1] == 0x0E &&
|
||||
hdr[2] == 0x2B &&
|
||||
hdr[3] == 0x34);
|
||||
}
|
||||
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // USE_MXF
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Digital Signal Processing Laboratory, Universit<69> degli studi di Perugia (UPG), Italy
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: imagmxf.h
|
||||
// Purpose: wxImage MXF (Material eXchange Format) JPEG 2000 file format handler
|
||||
// Author: G. Baruffa - based on imagjpeg.h, Vaclav Slavik
|
||||
// RCS-ID: $Id: imagmj2.h,v 0.0 2007/11/19 17:00:00 VZ Exp $
|
||||
// Copyright: (c) Giuseppe Baruffa
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_IMAGMXF_H_
|
||||
#define _WX_IMAGMXF_H_
|
||||
|
||||
#ifdef USE_MXF
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMXFHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_LIBOPENJPEG
|
||||
|
||||
#include "wx/image.h"
|
||||
#include "libopenjpeg/openjpeg.h"
|
||||
|
||||
#define wxBITMAP_TYPE_MXF 50
|
||||
|
||||
class WXDLLEXPORT wxMXFHandler: public wxImageHandler
|
||||
{
|
||||
public:
|
||||
inline wxMXFHandler()
|
||||
{
|
||||
m_name = wxT("MXF JPEG 2000 file format");
|
||||
m_extension = wxT("mxf");
|
||||
m_type = wxBITMAP_TYPE_MXF;
|
||||
m_mime = wxT("image/mxf");
|
||||
|
||||
m_reducefactor = 0;
|
||||
m_qualitylayers = 0;
|
||||
m_components = 0;
|
||||
#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(wxMXFHandler)
|
||||
};
|
||||
|
||||
#endif // wxUSE_LIBOPENJPEG
|
||||
|
||||
#endif // USE_MXF
|
||||
|
||||
#endif // _WX_IMAGMXF_H_
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
Copyright (c) 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.
|
||||
@@ -1,285 +0,0 @@
|
||||
/* 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"
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
This viewer is conceived to open and display information and image content of J2K, JP2,
|
||||
and MJ2 files.
|
||||
The viewer application interface is divided into three main panels:
|
||||
- a browsing pane;
|
||||
- a viewing pane;
|
||||
- a log/peek pane.
|
||||
|
||||
The browsing pane will present the markers or boxes hierarchy, with position (byte number where marker/box starts and stops) and length information (i.e., inner length as signalled by marker/box and total length, with marker/box sign included), in the following form:
|
||||
|
||||
filename
|
||||
|
|
||||
|_ #000: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ *** Marker/Box long name ***
|
||||
| |_ startbyte > stopbyte, inner_length + marker/box sign length (total length)
|
||||
| |_ Additional info, depending on the marker/box type
|
||||
| |_ ...
|
||||
|
|
||||
|_ #001: Marker/Box short name (Hex code)
|
||||
| |
|
||||
| |_ ...
|
||||
|
|
||||
...
|
||||
|
||||
|
||||
The viewing pane will display the decoded image contained in the JPEG 2000 file.
|
||||
It should display correctly images as large as 4000x2000, provided that a couple of GB of RAM are available. Nothing is known about the display of larger sizes: let us know if you manage to get it working.
|
||||
|
||||
|
||||
The log/peek pane is shared among two different subpanels:
|
||||
|
||||
- the log panel will report a lot of debugging info coming out from the wx GUI as well as from the openjpeg library
|
||||
- the peek pane tries to give a peek on the codestream/file portion which is currently selected in the browsing pane. It shows both hex and ascii values corresponding to the marker/box section.
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
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.
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
109
OpenJPEG.rc
109
OpenJPEG.rc
@@ -1,109 +0,0 @@
|
||||
//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-2007, 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
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
Basic instructions on how to build using CMake (CMake 2.4.5 or newer is required)
|
||||
|
||||
svn co http://www.openjpeg.org/svn/trunk
|
||||
cd trunk
|
||||
mkdir bin
|
||||
cd bin
|
||||
cmake .. -DBUILD_EXAMPLES:BOOL=ON
|
||||
make
|
||||
./bin/j2k_to_image
|
||||
33
README.linux
33
README.linux
@@ -1,33 +0,0 @@
|
||||
Release Notes
|
||||
--------------
|
||||
This version of the library has been tested under the following OS:
|
||||
- RedHat Linux 9.0
|
||||
|
||||
You should be able to link progams with the -lopenjpeg option after the library is compiled and installed.
|
||||
You can also statically link with libopenjpeg.a.
|
||||
If you use a really old version of gcc and it chokes on the CRs in the file, you can type 'make dos2unix'
|
||||
to run all of the files through dos2unix which converts CRLF to LF. This no longer appears to be required
|
||||
for RedHat 7.3 or 9.
|
||||
|
||||
Please let us know how this works for you under other Linux distributions or any other *nix.
|
||||
|
||||
Installation
|
||||
------------
|
||||
Note: You will need to have root privileges in order to install the library in
|
||||
/usr/include and /usr/lib directories.
|
||||
The installation process is as simple as this :
|
||||
1) Enter the OpenJPEG directory
|
||||
2) Build the distribution :
|
||||
make
|
||||
make install
|
||||
3) Clean all files produced during the build process
|
||||
make clean
|
||||
|
||||
Simple codec compilation
|
||||
------------------------
|
||||
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following commands to build an encoder and decoder respectively:
|
||||
|
||||
gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
You should add '-L..' to those lines if you did not use the 'install' target (and the 'clean' target neither...).
|
||||
40
README.msvc
40
README.msvc
@@ -1,40 +0,0 @@
|
||||
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
26
README.osx
@@ -1,26 +0,0 @@
|
||||
Release Notes
|
||||
--------------
|
||||
This version of the library has been tested under OSX 10.3 using gcc 3.3.
|
||||
|
||||
While the makefiles will make a .dylib and a .a, it is recommended to simply staticly link with the .a file.
|
||||
|
||||
Installation
|
||||
------------
|
||||
Note: You will need to have root privileges in order to install the library in
|
||||
/usr/include and /usr/lib directories.
|
||||
The installation process is as simple as this :
|
||||
1) Enter the OpenJPEG directory
|
||||
2) Build the distribution :
|
||||
make osx
|
||||
make osxinstall
|
||||
3) Clean all files produced during the build process
|
||||
make osxclean
|
||||
|
||||
Simple codec compilation
|
||||
------------------------
|
||||
Once you've built the library, you might want to test it with a basic codec. To do this, go to the codec directory and use one of the following commands to build an encoder and decoder respectively:
|
||||
|
||||
gcc convert.c image_to_j2k.c -o image_to_j2k -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
gcc convert.c j2k_to_image.c -o j2k_to_image -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
You should add '-L..' and to those lines if you did not use the 'install' target (and the 'clean' target neither...).
|
||||
25
clean.bat
25
clean.bat
@@ -1,25 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
# Build the demo app, small examples
|
||||
|
||||
# First thing define the common source:
|
||||
SET(common_SRCS
|
||||
convert.c
|
||||
index.c
|
||||
)
|
||||
|
||||
# Then check if getopt is present:
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
|
||||
SET(DONT_HAVE_GETOPT 1)
|
||||
IF(UNIX) #I am pretty sure only *nix sys have this anyway
|
||||
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
|
||||
# Seems like we need the contrary:
|
||||
IF(CMAKE_HAVE_GETOPT_H)
|
||||
SET(DONT_HAVE_GETOPT 0)
|
||||
ENDIF(CMAKE_HAVE_GETOPT_H)
|
||||
ENDIF(UNIX)
|
||||
|
||||
# If not getopt was found then add it to the lib:
|
||||
IF(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})
|
||||
ADD_TEST(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
|
||||
# calling those exe without option will make them fail always:
|
||||
SET_TESTS_PROPERTIES(${exe} PROPERTIES WILL_FAIL TRUE)
|
||||
# On unix you need to link to the math library:
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(${exe} m)
|
||||
ENDIF(UNIX)
|
||||
# Install exe
|
||||
INSTALL_TARGETS(/bin/ ${exe})
|
||||
ENDFOREACH(exe)
|
||||
|
||||
# Do testing here, once we know the examples are being built:
|
||||
FILE(GLOB_RECURSE OPENJPEG_DATA_IMAGES_GLOB
|
||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2k"
|
||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.j2c"
|
||||
"${JPEG2000_CONFORMANCE_DATA_ROOT}/*.jp2"
|
||||
)
|
||||
|
||||
FOREACH(filename ${OPENJPEG_DATA_IMAGES_GLOB})
|
||||
GET_FILENAME_COMPONENT(filename_temp ${filename} NAME)
|
||||
ADD_TEST(j2i-${filename_temp} ${EXECUTABLE_OUTPUT_PATH}/j2k_to_image -i ${filename} -o ${filename_temp}.tif)
|
||||
ENDFOREACH(filename)
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# Makefile for the main OpenJPEG codecs: j2k_to_image and image_to_j2k
|
||||
|
||||
CFLAGS = -O3 -lstdc++ # -g -p -pg
|
||||
|
||||
all: j2k_to_image image_to_j2k
|
||||
|
||||
j2k_to_image: j2k_to_image.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) compat/getopt.c index.c convert.c j2k_to_image.c -o j2k_to_image -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
image_to_j2k: image_to_j2k.c ../libopenjpeg.a
|
||||
gcc $(CFLAGS) compat/getopt.c index.c convert.c image_to_j2k.c -o image_to_j2k -L.. -lopenjpeg -I ../libopenjpeg/ -lm -ltiff
|
||||
|
||||
clean:
|
||||
rm -f j2k_to_image image_to_j2k
|
||||
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
* 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 ""
|
||||
|
||||
/* As this class remembers its values from one Java call to the other, reset the values before each use */
|
||||
void reset_options_reading() {
|
||||
opterr = 1;
|
||||
optind = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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\n");
|
||||
++optind;
|
||||
return (BADCH);;
|
||||
}//end function
|
||||
2138
codec/convert.c
2138
codec/convert.c
File diff suppressed because it is too large
Load Diff
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 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
|
||||
|
||||
/**@name RAW image encoding parameters */
|
||||
/*@{*/
|
||||
typedef struct raw_cparameters {
|
||||
/** width of the raw image */
|
||||
int rawWidth;
|
||||
/** height of the raw image */
|
||||
int rawHeight;
|
||||
/** components of the raw image */
|
||||
int rawComp;
|
||||
/** bit depth of the raw image */
|
||||
int rawBitDepth;
|
||||
/** signed/unsigned raw image */
|
||||
bool rawSigned;
|
||||
/*@}*/
|
||||
} raw_cparameters_t;
|
||||
|
||||
/* TGA conversion */
|
||||
opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters);
|
||||
int imagetotga(opj_image_t * image, const char *outfile);
|
||||
|
||||
/* BMP conversion */
|
||||
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);
|
||||
|
||||
/* RAW conversion */
|
||||
int imagetoraw(opj_image_t * image, const char *outfile);
|
||||
opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp);
|
||||
|
||||
#endif /* __J2K_CONVERT_H */
|
||||
|
||||
677
codec/dirent.h
677
codec/dirent.h
@@ -1,677 +0,0 @@
|
||||
|
||||
/*
|
||||
* 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*/
|
||||
1768
codec/image_to_j2k.c
1768
codec/image_to_j2k.c
File diff suppressed because it is too large
Load Diff
@@ -1,118 +0,0 @@
|
||||
# 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" /nodefaultlib:"LIBCMT" /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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\index.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\index.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
Binary file not shown.
@@ -1,292 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="image_to_j2k"
|
||||
ProjectGUID="{81FBE6CF-1DFB-413F-8215-0851F8E2D252}"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/image_to_j2k.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="../libopenjpeg"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPJ_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/image_to_j2k.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib"
|
||||
OutputFile=".\Release/image_to_j2k.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
IgnoreDefaultLibraryNames="LIBC"
|
||||
ProgramDatabaseFile=".\Release/image_to_j2k.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/image_to_j2k.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/image_to_j2k.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../libopenjpeg"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPJ_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\Debug/image_to_j2k.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib"
|
||||
OutputFile=".\Debug/image_to_j2k.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
IgnoreDefaultLibraryNames="LIBC,LIBCMT"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/image_to_j2k.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Debug/image_to_j2k.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="convert.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="convert.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="compat\getopt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="compat\getopt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="image_to_j2k.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\index.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\index.h"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
391
codec/index.c
391
codec/index.c
@@ -1,391 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 2003-2007, Francois-Olivier Devaux
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "openjpeg.h"
|
||||
#include "index.h"
|
||||
|
||||
/* ------------------------------------------------------------------------------------ */
|
||||
|
||||
/**
|
||||
Write a structured index to a file
|
||||
@param cstr_info Codestream information
|
||||
@param index Index filename
|
||||
@return Returns 0 if successful, returns 1 otherwise
|
||||
*/
|
||||
int write_index_file(opj_codestream_info_t *cstr_info, char *index) {
|
||||
int tileno, compno, layno, resno, precno, pack_nb, x, y;
|
||||
FILE *stream = NULL;
|
||||
double total_disto = 0;
|
||||
/* UniPG>> */
|
||||
int tilepartno;
|
||||
char disto_on, numpix_on;
|
||||
|
||||
#ifdef USE_JPWL
|
||||
if (!strcmp(index, JPWL_PRIVATEINDEX_NAME))
|
||||
return 0;
|
||||
#endif /* USE_JPWL */
|
||||
/* <<UniPG */
|
||||
|
||||
if (!cstr_info)
|
||||
return 1;
|
||||
|
||||
stream = fopen(index, "w");
|
||||
if (!stream) {
|
||||
fprintf(stderr, "failed to open index file [%s] for writing\n", index);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (cstr_info->tile[0].distotile)
|
||||
disto_on = 1;
|
||||
else
|
||||
disto_on = 0;
|
||||
|
||||
if (cstr_info->tile[0].numpix)
|
||||
numpix_on = 1;
|
||||
else
|
||||
numpix_on = 0;
|
||||
|
||||
fprintf(stream, "%d %d\n", cstr_info->image_w, cstr_info->image_h);
|
||||
fprintf(stream, "%d\n", cstr_info->prog);
|
||||
fprintf(stream, "%d %d\n", cstr_info->tile_x, cstr_info->tile_y);
|
||||
fprintf(stream, "%d %d\n", cstr_info->tw, cstr_info->th);
|
||||
fprintf(stream, "%d\n", cstr_info->numcomps);
|
||||
fprintf(stream, "%d\n", cstr_info->numlayers);
|
||||
fprintf(stream, "%d\n", cstr_info->numdecompos);
|
||||
|
||||
for (resno = cstr_info->numdecompos[0]; resno >= 0; resno--) {
|
||||
fprintf(stream, "[%d,%d] ",
|
||||
(1 << cstr_info->tile[0].pdx[resno]), (1 << cstr_info->tile[0].pdx[resno])); /* based on tile 0 and component 0 */
|
||||
}
|
||||
|
||||
fprintf(stream, "\n");
|
||||
/* UniPG>> */
|
||||
fprintf(stream, "%d\n", cstr_info->main_head_start);
|
||||
/* <<UniPG */
|
||||
fprintf(stream, "%d\n", cstr_info->main_head_end);
|
||||
fprintf(stream, "%d\n", cstr_info->codestream_size);
|
||||
|
||||
fprintf(stream, "\nINFO ON TILES\n");
|
||||
fprintf(stream, "tileno start_pos end_hd end_tile nbparts");
|
||||
if (disto_on)
|
||||
fprintf(stream," disto");
|
||||
if (numpix_on)
|
||||
fprintf(stream," nbpix");
|
||||
if (disto_on && numpix_on)
|
||||
fprintf(stream," disto/nbpix");
|
||||
fprintf(stream, "\n");
|
||||
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
fprintf(stream, "%4d %9d %9d %9d %9d",
|
||||
cstr_info->tile[tileno].tileno,
|
||||
cstr_info->tile[tileno].start_pos,
|
||||
cstr_info->tile[tileno].end_header,
|
||||
cstr_info->tile[tileno].end_pos,
|
||||
cstr_info->tile[tileno].num_tps);
|
||||
if (disto_on)
|
||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile);
|
||||
if (numpix_on)
|
||||
fprintf(stream," %9d", cstr_info->tile[tileno].numpix);
|
||||
if (disto_on && numpix_on)
|
||||
fprintf(stream," %9e", cstr_info->tile[tileno].distotile / cstr_info->tile[tileno].numpix);
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
for (tileno = 0; tileno < cstr_info->tw * cstr_info->th; tileno++) {
|
||||
int start_pos, end_ph_pos, end_pos;
|
||||
double disto = 0;
|
||||
int max_numdecompos = 0;
|
||||
pack_nb = 0;
|
||||
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
if (max_numdecompos < cstr_info->numdecompos[compno])
|
||||
max_numdecompos = cstr_info->numdecompos[compno];
|
||||
}
|
||||
|
||||
fprintf(stream, "\nTILE %d DETAILS\n", tileno);
|
||||
fprintf(stream, "part_nb tileno start_pack num_packs start_pos end_tph_pos end_pos\n");
|
||||
for (tilepartno = 0; tilepartno < cstr_info->tile[tileno].num_tps; tilepartno++)
|
||||
fprintf(stream, "%4d %9d %9d %9d %9d %11d %9d\n",
|
||||
tilepartno, tileno,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_start_pack,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_numpacks,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_start_pos,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_end_header,
|
||||
cstr_info->tile[tileno].tp[tilepartno].tp_end_pos
|
||||
);
|
||||
|
||||
if (cstr_info->prog == LRCP) { /* LRCP */
|
||||
fprintf(stream, "LRCP\npack_nb tileno layno resno compno precno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max;
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < prec_max; precno++) {
|
||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
fprintf(stream, "%4d %6d %7d %5d %6d %6d %6d %6d %7d",
|
||||
pack_nb, tileno, layno, resno, compno, precno, start_pos, end_ph_pos, end_pos);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* LRCP */
|
||||
|
||||
else if (cstr_info->prog == RLCP) { /* RLCP */
|
||||
fprintf(stream, "RLCP\npack_nb tileno resno layno compno precno start_pos end_ph_pos end_pos\n");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int prec_max;
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
prec_max = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < prec_max; precno++) {
|
||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
fprintf(stream, "%4d %6d %5d %7d %6d %6d %9d %9d %7d",
|
||||
pack_nb, tileno, resno, layno, compno, precno, start_pos, end_ph_pos, end_pos);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* RLCP */
|
||||
|
||||
else if (cstr_info->prog == RPCL) { /* RPCL */
|
||||
|
||||
fprintf(stream, "RPCL\npack_nb tileno resno precno compno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
for (precno = 0; precno < numprec; precno++) {
|
||||
/* I suppose components have same XRsiz, YRsiz */
|
||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor((float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||
int x1 = x0 + cstr_info->tile_x;
|
||||
int y1 = y0 + cstr_info->tile_y;
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (resno > cstr_info->numdecompos[compno])
|
||||
break;
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
fprintf(stream, "%4d %6d %5d %6d %6d %7d %9d %9d %7d",
|
||||
pack_nb, tileno, resno, precno, compno, layno, start_pos, end_ph_pos, end_pos);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* precno */
|
||||
} /* compno */
|
||||
} /* resno */
|
||||
} /* RPCL */
|
||||
|
||||
else if (cstr_info->prog == PCRL) { /* PCRL */
|
||||
/* I suppose components have same XRsiz, YRsiz */
|
||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||
int x1 = x0 + cstr_info->tile_x;
|
||||
int y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
// Count the maximum number of precincts
|
||||
int max_numprec = 0;
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
if (numprec > max_numprec)
|
||||
max_numprec = numprec;
|
||||
}
|
||||
|
||||
fprintf(stream, "PCRL\npack_nb tileno precno compno resno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (precno = 0; precno < max_numprec; precno++) {
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (precno >= numprec)
|
||||
continue;
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d",
|
||||
pack_nb, tileno, precno, compno, resno, layno, start_pos, end_ph_pos, end_pos);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* resno */
|
||||
} /* compno */
|
||||
} /* precno */
|
||||
} /* PCRL */
|
||||
|
||||
else { /* CPRL */
|
||||
// Count the maximum number of precincts
|
||||
int max_numprec = 0;
|
||||
for (resno = 0; resno < max_numdecompos + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
if (numprec > max_numprec)
|
||||
max_numprec = numprec;
|
||||
}
|
||||
|
||||
fprintf(stream, "CPRL\npack_nb tileno compno precno resno layno start_pos end_ph_pos end_pos");
|
||||
if (disto_on)
|
||||
fprintf(stream, " disto");
|
||||
fprintf(stream,"\n");
|
||||
|
||||
for (compno = 0; compno < cstr_info->numcomps; compno++) {
|
||||
/* I suppose components have same XRsiz, YRsiz */
|
||||
int x0 = cstr_info->tile_Ox + tileno - (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tw * cstr_info->tile_x;
|
||||
int y0 = cstr_info->tile_Ox + (int)floor( (float)tileno/(float)cstr_info->tw ) * cstr_info->tile_y;
|
||||
int x1 = x0 + cstr_info->tile_x;
|
||||
int y1 = y0 + cstr_info->tile_y;
|
||||
|
||||
for (precno = 0; precno < max_numprec; precno++) {
|
||||
for (resno = 0; resno < cstr_info->numdecompos[compno] + 1; resno++) {
|
||||
int numprec = cstr_info->tile[tileno].pw[resno] * cstr_info->tile[tileno].ph[resno];
|
||||
int pcnx = cstr_info->tile[tileno].pw[resno];
|
||||
int pcx = (int) pow( 2, cstr_info->tile[tileno].pdx[resno] + cstr_info->numdecompos[compno] - resno );
|
||||
int pcy = (int) pow( 2, cstr_info->tile[tileno].pdy[resno] + cstr_info->numdecompos[compno] - resno );
|
||||
int precno_x = precno - (int) floor( (float)precno/(float)pcnx ) * pcnx;
|
||||
int precno_y = (int) floor( (float)precno/(float)pcnx );
|
||||
if (precno >= numprec)
|
||||
continue;
|
||||
|
||||
for(y = y0; y < y1; y++) {
|
||||
if (precno_y*pcy == y ) {
|
||||
for (x = x0; x < x1; x++) {
|
||||
if (precno_x*pcx == x ) {
|
||||
for (layno = 0; layno < cstr_info->numlayers; layno++) {
|
||||
start_pos = cstr_info->tile[tileno].packet[pack_nb].start_pos;
|
||||
end_ph_pos = cstr_info->tile[tileno].packet[pack_nb].end_ph_pos;
|
||||
end_pos = cstr_info->tile[tileno].packet[pack_nb].end_pos;
|
||||
disto = cstr_info->tile[tileno].packet[pack_nb].disto;
|
||||
fprintf(stream, "%4d %6d %6d %6d %5d %7d %9d %9d %7d",
|
||||
pack_nb, tileno, compno, precno, resno, layno, start_pos, end_ph_pos, end_pos);
|
||||
if (disto_on)
|
||||
fprintf(stream, " %8e", disto);
|
||||
fprintf(stream, "\n");
|
||||
total_disto += disto;
|
||||
pack_nb++;
|
||||
}
|
||||
}
|
||||
}/* x = x0..x1 */
|
||||
}
|
||||
} /* y = y0..y1 */
|
||||
} /* resno */
|
||||
} /* precno */
|
||||
} /* compno */
|
||||
} /* CPRL */
|
||||
} /* tileno */
|
||||
|
||||
if (disto_on) {
|
||||
fprintf(stream, "%8e\n", cstr_info->D_max); /* SE max */
|
||||
fprintf(stream, "%.8e\n", total_disto); /* SE totale */
|
||||
}
|
||||
/* UniPG>> */
|
||||
/* print the markers' list */
|
||||
if (cstr_info->marknum) {
|
||||
fprintf(stream, "\nMARKER LIST\n");
|
||||
fprintf(stream, "%d\n", cstr_info->marknum);
|
||||
fprintf(stream, "type\tstart_pos length\n");
|
||||
for (x = 0; x < cstr_info->marknum; x++)
|
||||
fprintf(stream, "%X\t%9d %9d\n", cstr_info->marker[x].type, cstr_info->marker[x].pos, cstr_info->marker[x].len);
|
||||
}
|
||||
/* <<UniPG */
|
||||
fclose(stream);
|
||||
|
||||
fprintf(stderr,"Generated index file %s\n", index);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,808 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
||||
* Copyright (c) 2002-2007, Professor Benoit Macq
|
||||
* Copyright (c) 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 <math.h>
|
||||
|
||||
#include "openjpeg.h"
|
||||
#include "compat/getopt.h"
|
||||
#include "convert.h"
|
||||
#include "dirent.h"
|
||||
#include "index.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
|
||||
#define RAW_DFMT 15
|
||||
#define TGA_DFMT 16
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
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, TIF, RAW and TGA formats\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, PPM, PNM, PGX, BMP, TIF, RAW and TGA files\n");
|
||||
fprintf(stdout," Binary data is written to the file (not ascii). If a PGX\n");
|
||||
fprintf(stdout," filename is given, there will be as many output files as there are\n");
|
||||
fprintf(stdout," components: an indice starting from 0 will then be appended to the\n");
|
||||
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");
|
||||
fprintf(stdout," -x \n");
|
||||
fprintf(stdout," Create an index file *.Idx (-x index_name.Idx) \n");
|
||||
fprintf(stdout,"\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", "raw", "tga", "j2k", "jp2", "jpt", "j2c" };
|
||||
static const int format[] = { PGX_DFMT, PXM_DFMT, PXM_DFMT, PXM_DFMT, BMP_DFMT, TIF_DFMT, RAW_DFMT, TGA_DFMT, J2K_CFMT, JP2_CFMT, JPT_CFMT, J2K_CFMT };
|
||||
char * ext = strrchr(filename, '.');
|
||||
if (ext == NULL)
|
||||
return -1;
|
||||
ext++;
|
||||
if(ext) {
|
||||
for(i = 0; i < sizeof(format)/sizeof(*format); i++) {
|
||||
if(strnicmp(ext, extension[i], 3) == 0) {
|
||||
return format[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char get_next_file(int imageno,dircnt_t *dirptr,img_fol_t *img_fol, opj_dparameters_t *parameters){
|
||||
char image_filename[OPJ_PATH_LEN], infilename[OPJ_PATH_LEN],outfilename[OPJ_PATH_LEN],temp_ofname[OPJ_PATH_LEN];
|
||||
char *temp_p, temp1[OPJ_PATH_LEN]="";
|
||||
|
||||
strcpy(image_filename,dirptr->filename[imageno]);
|
||||
fprintf(stderr,"File Number %d \"%s\"\n",imageno,image_filename);
|
||||
parameters->decod_format = get_file_format(image_filename);
|
||||
if (parameters->decod_format == -1)
|
||||
return 1;
|
||||
sprintf(infilename,"%s/%s",img_fol->imgdirpath,image_filename);
|
||||
strncpy(parameters->infile, infilename, sizeof(infilename));
|
||||
|
||||
//Set output file
|
||||
strcpy(temp_ofname,strtok(image_filename,"."));
|
||||
while((temp_p = strtok(NULL,".")) != NULL){
|
||||
strcat(temp_ofname,temp1);
|
||||
sprintf(temp1,".%s",temp_p);
|
||||
}
|
||||
if(img_fol->set_out_format==1){
|
||||
sprintf(outfilename,"%s/%s.%s",img_fol->imgdirpath,temp_ofname,img_fol->out_format);
|
||||
strncpy(parameters->outfile, outfilename, sizeof(outfilename));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
|
||||
/* parse the command line */
|
||||
int totlen;
|
||||
option_t long_option[]={
|
||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||
{"OutFor",REQ_ARG, NULL ,'O'},
|
||||
};
|
||||
|
||||
const char optlist[] = "i:o:r:l:hx:"
|
||||
|
||||
/* UniPG>> */
|
||||
#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:
|
||||
case RAW_DFMT:
|
||||
case TGA_DFMT:
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \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;
|
||||
case RAW_DFMT:
|
||||
img_fol->out_format = "raw";
|
||||
break;
|
||||
case TGA_DFMT:
|
||||
img_fol->out_format = "raw";
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown output format image %s [only *.pnm, *.pgm, *.ppm, *.pgx, *.bmp, *.tif, *.raw or *.tga]!! \n", outformat);
|
||||
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;
|
||||
/* ----------------------------------------------------- */
|
||||
case 'x': /* Creation of index file */
|
||||
{
|
||||
char *index = optarg;
|
||||
strncpy(indexfilename, index, OPJ_PATH_LEN);
|
||||
}
|
||||
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, TIF, RAW and TGA!!\n");
|
||||
return 1;
|
||||
}
|
||||
if(!((parameters->outfile[0] == 0))){
|
||||
fprintf(stderr, "Error: options -ImgDir and -o cannot be used together !!\n");
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
if((parameters->infile[0] == 0) || (parameters->outfile[0] == 0)) {
|
||||
fprintf(stderr, "Error: One of the options -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/j2c -o *.pgm/ppm/pnm/pgx/bmp/tif/raw/tga(+ 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;
|
||||
opj_codestream_info_t cstr_info; /* Codestream information structure */
|
||||
char indexfilename[OPJ_PATH_LEN]; /* index file name */
|
||||
|
||||
/* configure the event callbacks (not required) */
|
||||
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
|
||||
event_mgr.error_handler = error_callback;
|
||||
event_mgr.warning_handler = warning_callback;
|
||||
event_mgr.info_handler = info_callback;
|
||||
|
||||
/* set decoding parameters to default values */
|
||||
opj_set_default_decoder_parameters(¶meters);
|
||||
|
||||
/* Initialize indexfilename and img_fol */
|
||||
*indexfilename = 0;
|
||||
memset(&img_fol,0,sizeof(img_fol_t));
|
||||
|
||||
/* parse input and get user encoding parameters */
|
||||
if(parse_cmdline_decoder(argc, argv, ¶meters,&img_fol, indexfilename) == 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Initialize reading of directory */
|
||||
if(img_fol.set_imgdir==1){
|
||||
num_images=get_num_images(img_fol.imgdirpath);
|
||||
|
||||
dirptr=(dircnt_t*)malloc(sizeof(dircnt_t));
|
||||
if(dirptr){
|
||||
dirptr->filename_buf = (char*)malloc(num_images*OPJ_PATH_LEN*sizeof(char)); // Stores at max 10 image file names
|
||||
dirptr->filename = (char**) malloc(num_images*sizeof(char*));
|
||||
|
||||
if(!dirptr->filename_buf){
|
||||
return 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 */
|
||||
if (*indexfilename) // If need to extract codestream information
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
char bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JP2_CFMT:
|
||||
{
|
||||
/* JPEG 2000 compressed image data */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JP2);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using the current image and user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) // If need to extract codestream information
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
char bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case JPT_CFMT:
|
||||
{
|
||||
/* JPEG 2000, JPIP */
|
||||
|
||||
/* get a decoder handle */
|
||||
dinfo = opj_create_decompress(CODEC_JPT);
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
|
||||
|
||||
/* setup the decoder decoding parameters using user parameters */
|
||||
opj_setup_decoder(dinfo, ¶meters);
|
||||
|
||||
/* open a byte stream */
|
||||
cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length);
|
||||
|
||||
/* decode the stream and fill the image structure */
|
||||
if (*indexfilename) // If need to extract codestream information
|
||||
image = opj_decode_with_info(dinfo, cio, &cstr_info);
|
||||
else
|
||||
image = opj_decode(dinfo, cio);
|
||||
if(!image) {
|
||||
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
|
||||
opj_destroy_decompress(dinfo);
|
||||
opj_cio_close(cio);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* close the byte stream */
|
||||
opj_cio_close(cio);
|
||||
|
||||
/* Write the index to disk */
|
||||
if (*indexfilename) {
|
||||
char bSuccess;
|
||||
bSuccess = write_index_file(&cstr_info, indexfilename);
|
||||
if (bSuccess) {
|
||||
fprintf(stderr, "Failed to output index file\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "skipping file..\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* free the memory containing the code-stream */
|
||||
free(src);
|
||||
src = NULL;
|
||||
|
||||
/* 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;
|
||||
|
||||
case RAW_DFMT: /* RAW */
|
||||
if(imagetoraw(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating raw file. Outfile %s not generated\n",parameters.outfile);
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
|
||||
case TGA_DFMT: /* TGA */
|
||||
if(imagetotga(image, parameters.outfile)){
|
||||
fprintf(stdout,"Error generating tga file. Outfile %s not generated\n",parameters.outfile);
|
||||
}
|
||||
else {
|
||||
fprintf(stdout,"Successfully generated Outfile %s\n",parameters.outfile);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* free remaining structures */
|
||||
if(dinfo) {
|
||||
opj_destroy_decompress(dinfo);
|
||||
}
|
||||
/* free codestream information structure */
|
||||
if (*indexfilename)
|
||||
opj_destroy_cstr_info(&cstr_info);
|
||||
/* free image data structure */
|
||||
opj_image_destroy(image);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//end main
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
# 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" /nodefaultlib:"libcmt" /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=.\index.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\index.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\j2k_to_image.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,44 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "LibOpenJPEG"=..\LibOpenJPEG.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "j2k_to_image"=.\j2k_to_image.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name LibOpenJPEG
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Binary file not shown.
@@ -1,291 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="j2k_to_image"
|
||||
ProjectGUID="{28931669-81A2-4B90-8981-CD707C4E76E6}"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Debug/j2k_to_image.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../libopenjpeg"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPJ_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
PrecompiledHeaderFile=".\Debug/j2k_to_image.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib"
|
||||
OutputFile=".\Debug/j2k_to_image.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
IgnoreDefaultLibraryNames="libc,libcmt"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/j2k_to_image.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Debug/j2k_to_image.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TypeLibraryName=".\Release/j2k_to_image.tlb"
|
||||
HeaderFileName=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="2"
|
||||
FavorSizeOrSpeed="1"
|
||||
AdditionalIncludeDirectories="../libopenjpeg"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;OPJ_STATIC;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="true"
|
||||
PrecompiledHeaderFile=".\Release/j2k_to_image.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1036"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib ../libs/libtiff/libtiff.lib"
|
||||
OutputFile=".\Release/j2k_to_image.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
IgnoreDefaultLibraryNames="libc"
|
||||
ProgramDatabaseFile=".\Release/j2k_to_image.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
SuppressStartupBanner="true"
|
||||
OutputFile=".\Release/j2k_to_image.bsc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="convert.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="convert.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="compat\getopt.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="compat\getopt.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\index.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\index.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="j2k_to_image.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions=""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,12 +0,0 @@
|
||||
FIND_PACKAGE(Doxygen REQUIRED)
|
||||
|
||||
# The Doxyfile.dox is poorly defined and produce output
|
||||
# in the source dir
|
||||
ADD_CUSTOM_TARGET(doxygen
|
||||
# By default doxygen target is added to the 'all' target. Project is small
|
||||
# thus running doxygen is not too time consuming
|
||||
ALL
|
||||
${DOXYGEN}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.dox
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
234
doc/Doxyfile.dox
234
doc/Doxyfile.dox
@@ -1,234 +0,0 @@
|
||||
# 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 \
|
||||
USE_JPSEC
|
||||
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
|
||||
@@ -1,5 +0,0 @@
|
||||
# index_create
|
||||
|
||||
ADD_EXECUTABLE(index_create
|
||||
bio.c cio.c int.c pi.c t2.c tgt.c tcd.c index_create.c jpip.c jp2.c
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
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.*
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* 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,129 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user