Skip to content

Commit cf8322c

Browse files
committed
Merge pull request opencv#18194 from VadimLevin:dev/vlevin/openjpeg-source-intergration
2 parents 7a796b2 + 0384eb7 commit cf8322c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+42074
-7
lines changed

3rdparty/openjpeg/AUTHORS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Authors of OpenJPEG
2+
See also [THANKS](https://github.com/uclouvain/openjpeg/blob/master/THANKS.md)
3+
4+
David Janssens designed and implemented the first version of OpenJPEG.
5+
6+
Kaori Hagihara designed and implemented the first version of OpenJPIP.
7+
8+
Jerome Fimes implemented the alpha version of OpenJPEG 2.0.
9+
10+
Giuseppe Baruffa added the JPWL functionalities.
11+
12+
Mickaël Savinaud implemented the final OpenJPEG 2.0 version based on a big merge between 1.5 version and alpha version of 2.0.
13+
14+
Mathieu Malaterre participated to the OpenJPEG 2.0 version and improved the libraries and utilities.
15+
16+
Yannick Verschueren,
17+
Herve Drolon,
18+
Francois-Olivier Devaux,
19+
Antonin Descampe
20+
improved the libraries and utilities.
21+

3rdparty/openjpeg/CHANGELOG.md

Lines changed: 683 additions & 0 deletions
Large diffs are not rendered by default.

3rdparty/openjpeg/CMakeLists.txt

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Build scripts are adopted to OpenCV project
2+
# Main CMakeLists.txt to build the OpenJPEG project using CMake (www.cmake.org)
3+
# Written by Mathieu Malaterre
4+
5+
cmake_policy(SET CMP0003 NEW)
6+
if(POLICY CMP0042)
7+
cmake_policy(SET CMP0042 NEW)
8+
endif()
9+
10+
set(OPENJPEG_LIBRARY_NAME libopenjp2)
11+
12+
project(openjpeg C)
13+
14+
#-----------------------------------------------------------------------------
15+
# OPENJPEG version number, useful for packaging and doxygen doc:
16+
set(OPENJPEG_VERSION_MAJOR 2)
17+
set(OPENJPEG_VERSION_MINOR 3)
18+
set(OPENJPEG_VERSION_BUILD 1)
19+
set(OPENJPEG_VERSION
20+
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
21+
set(PACKAGE_VERSION
22+
"${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}")
23+
24+
# Because autotools does not support X.Y notation for SOVERSION, we have to use
25+
# two numbering, one for the openjpeg version and one for openjpeg soversion
26+
# version | soversion
27+
# 1.0 | 0
28+
# 1.1 | 1
29+
# 1.2 | 2
30+
# 1.3 | 3
31+
# 1.4 | 4
32+
# 1.5 | 5
33+
# 1.5.1 | 5
34+
# 2.0 | 6
35+
# 2.0.1 | 6
36+
# 2.1 | 7
37+
# 2.1.1 | 7
38+
# 2.1.2 | 7
39+
# 2.2.0 | 7
40+
# 2.3.0 | 7
41+
# 2.3.1 | 7
42+
# above is the recommendation by the OPJ team. If you really need to override this default,
43+
# you can specify your own OPENJPEG_SOVERSION at cmake configuration time:
44+
# cmake -DOPENJPEG_SOVERSION:STRING=42 /path/to/openjpeg
45+
if(NOT OPENJPEG_SOVERSION)
46+
set(OPENJPEG_SOVERSION 7)
47+
endif()
48+
49+
set(OPENJPEG_LIBRARY_PROPERTIES
50+
VERSION "${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}.${OPENJPEG_VERSION_BUILD}"
51+
SOVERSION "${OPENJPEG_SOVERSION}"
52+
)
53+
54+
set(OPENJPEG_BUILD "opencv-${OPENCV_VERSION}-openjp2-${OPENJPEG_VERSION}")
55+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
56+
set(OPENJPEG_BUILD "${OPENJPEG_BUILD}-debug")
57+
endif()
58+
59+
message(STATUS "OpenJPEG: VERSION = ${OPENJPEG_VERSION}, BUILD = ${OPENJPEG_BUILD}")
60+
61+
# --------------------------------------------------------------------------
62+
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
63+
# warnings
64+
if(WIN32)
65+
if(NOT BORLAND)
66+
if(NOT CYGWIN)
67+
if(NOT MINGW)
68+
if(NOT ITK_ENABLE_VISUAL_STUDIO_DEPRECATED_C_WARNINGS)
69+
add_definitions(
70+
-D_CRT_FAR_MAPPINGS_NO_DEPRECATE
71+
-D_CRT_IS_WCTYPE_NO_DEPRECATE
72+
-D_CRT_MANAGED_FP_NO_DEPRECATE
73+
-D_CRT_NONSTDC_NO_DEPRECATE
74+
-D_CRT_SECURE_NO_DEPRECATE
75+
-D_CRT_SECURE_NO_DEPRECATE_GLOBALS
76+
-D_CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
77+
-D_CRT_TIME_FUNCTIONS_NO_DEPRECATE
78+
-D_CRT_VCCLRIT_NO_DEPRECATE
79+
-D_SCL_SECURE_NO_DEPRECATE
80+
)
81+
endif()
82+
endif()
83+
endif()
84+
endif()
85+
endif()
86+
87+
#-----------------------------------------------------------------------------
88+
# Big endian test:
89+
include(TestBigEndian)
90+
test_big_endian(OPJ_BIG_ENDIAN)
91+
92+
#-----------------------------------------------------------------------------
93+
# opj_config.h generation (1/2)
94+
95+
# Check if some include files are provided by the system
96+
# These files are mandatory, so if they are not provided OpenJPEG library can't be built
97+
include(CheckIncludeFile)
98+
macro(ensure_file_include INCLUDE_FILENAME VARIABLE_NAME MANDATORY_STATUS)
99+
check_include_file(${INCLUDE_FILENAME} ${VARIABLE_NAME})
100+
if(NOT ${VARIABLE_NAME})
101+
if(${MANDATORY_STATUS})
102+
message(STATUS "The file '${INCLUDE_FILENAME}' is mandatory for OpenJPEG build, but not found on your system")
103+
return()
104+
else()
105+
message(STATUS "The file '${INCLUDE_FILENAME}' is optional for OpenJPEG build and not found on your system."
106+
" Internal implementation will be used.")
107+
endif()
108+
endif()
109+
endmacro()
110+
111+
ensure_file_include("string.h" HAVE_STRING_H YES)
112+
ensure_file_include("memory.h" HAVE_MEMORY_H YES)
113+
ensure_file_include("stdlib.h" HAVE_STDLIB_H YES)
114+
ensure_file_include("stdio.h" HAVE_STDIO_H YES)
115+
ensure_file_include("math.h" HAVE_MATH_H YES)
116+
ensure_file_include("float.h" HAVE_FLOAT_H YES)
117+
ensure_file_include("time.h" HAVE_TIME_H YES)
118+
ensure_file_include("stdarg.h" HAVE_STDARG_H YES)
119+
ensure_file_include("ctype.h" HAVE_CTYPE_H YES)
120+
ensure_file_include("assert.h" HAVE_ASSERT_H YES)
121+
122+
# For the following files, we provide an alternative, they are not mandatory
123+
ensure_file_include("stdint.h" OPJ_HAVE_STDINT_H NO)
124+
ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
125+
126+
# why check this one ? for openjpip ?
127+
CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H)
128+
CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
129+
CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
130+
CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H)
131+
132+
# Allocating Aligned Memory Blocks
133+
include(CheckIncludeFiles)
134+
check_include_files(malloc.h OPJ_HAVE_MALLOC_H)
135+
include(CheckSymbolExists)
136+
# _aligned_alloc https://msdn.microsoft.com/en-us/library/8z34s9c6.aspx
137+
check_symbol_exists(_aligned_malloc malloc.h OPJ_HAVE__ALIGNED_MALLOC)
138+
# posix_memalign (needs _POSIX_C_SOURCE >= 200112L on Linux)
139+
set(_prev_CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
140+
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L)
141+
check_symbol_exists(posix_memalign stdlib.h OPJ_HAVE_POSIX_MEMALIGN)
142+
set(CMAKE_REQUIRED_DEFINITIONS ${_prev_CMAKE_REQUIRED_DEFINITIONS})
143+
unset(_prev_CMAKE_REQUIRED_DEFINITIONS)
144+
# memalign (obsolete)
145+
check_symbol_exists(memalign malloc.h OPJ_HAVE_MEMALIGN)
146+
#-----------------------------------------------------------------------------
147+
# opj_config.h generation (2/2)
148+
configure_file(
149+
${CMAKE_CURRENT_LIST_DIR}/openjp2/opj_config.h.cmake.in
150+
${CMAKE_CURRENT_BINARY_DIR}/openjp2/opj_config.h
151+
@ONLY
152+
)
153+
154+
configure_file(
155+
${CMAKE_CURRENT_LIST_DIR}/openjp2/opj_config_private.h.cmake.in
156+
${CMAKE_CURRENT_BINARY_DIR}/openjp2/opj_config_private.h
157+
@ONLY
158+
)
159+
160+
add_subdirectory(openjp2)
161+
162+
set_target_properties(${OPENJPEG_LIBRARY_NAME}
163+
PROPERTIES
164+
OUTPUT_NAME ${OPENJPEG_LIBRARY_NAME}
165+
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
166+
COMPILE_PDB_NAME ${OPENJPEG_LIBRARY_NAME}
167+
COMPILE_PDB_NAME_DEBUG "${OPENJPEG_LIBRARY_NAME}${OPENCV_DEBUG_POSTFIX}"
168+
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
169+
)
170+
171+
if(ENABLE_SOLUTION_FOLDERS)
172+
set_target_properties(${OPENJPEG_LIBRARY_NAME}
173+
PROPERTIES
174+
FOLDER "3rdparty"
175+
)
176+
endif()
177+
178+
ocv_install_3rdparty_licenses(${OPENJPEG_LIBRARY_NAME} README.md LICENSE)
179+
180+
# Setting all necessary variables
181+
set(OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARY_NAME} PARENT_SCOPE)
182+
set(OPENJPEG_VERSION ${OPENJPEG_VERSION} PARENT_SCOPE)
183+
set(OPENJPEG_MAJOR_VERSION ${OPENJPEG_VERSION_MAJOR} PARENT_SCOPE)
184+
set(OPENJPEG_MINOR_VERSION ${OPENJPEG_VERSION_MINOR} PARENT_SCOPE)
185+
set(OPENJPEG_BUILD_VERSION ${OPENJPEG_VERSION_BUILD} PARENT_SCOPE)
186+
get_target_property(_openjpeg_include_dirs ${OPENJPEG_LIBRARY_NAME} INCLUDE_DIRECTORIES)
187+
set(OPENJPEG_INCLUDE_DIRS ${_openjpeg_include_dirs} PARENT_SCOPE)
188+
189+
# OpenJPEG can't be built only if configuration script doesn't encounter any problem
190+
if(NOT DEFINED OCV_CAN_BUILD_OPENJPEG)
191+
# all prerequisites are fulfilled
192+
set(OCV_CAN_BUILD_OPENJPEG TRUE PARENT_SCOPE)
193+
endif()

3rdparty/openjpeg/LICENSE

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* The copyright in this software is being made available under the 2-clauses
3+
* BSD License, included below. This software may be subject to other third
4+
* party and contributor rights, including patent rights, and no such rights
5+
* are granted under this license.
6+
*
7+
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8+
* Copyright (c) 2002-2014, Professor Benoit Macq
9+
* Copyright (c) 2003-2014, Antonin Descampe
10+
* Copyright (c) 2003-2009, Francois-Olivier Devaux
11+
* Copyright (c) 2005, Herve Drolon, FreeImage Team
12+
* Copyright (c) 2002-2003, Yannick Verschueren
13+
* Copyright (c) 2001-2003, David Janssens
14+
* Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
15+
* Copyright (c) 2012, CS Systemes d'Information, France
16+
*
17+
* All rights reserved.
18+
*
19+
* Redistribution and use in source and binary forms, with or without
20+
* modification, are permitted provided that the following conditions
21+
* are met:
22+
* 1. Redistributions of source code must retain the above copyright
23+
* notice, this list of conditions and the following disclaimer.
24+
* 2. Redistributions in binary form must reproduce the above copyright
25+
* notice, this list of conditions and the following disclaimer in the
26+
* documentation and/or other materials provided with the distribution.
27+
*
28+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
29+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38+
* POSSIBILITY OF SUCH DAMAGE.
39+
*/

3rdparty/openjpeg/README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
# OPENJPEG Library and Applications
3+
4+
## What is OpenJPEG ?
5+
6+
OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of [JPEG 2000](http://www.jpeg.org/jpeg2000), a still-image compression standard from the Joint Photographic Experts Group ([JPEG](http://www.jpeg.org)). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a [JPEG 2000 Reference Software](http://www.itu.int/rec/T-REC-T.804-201504-I!Amd2).
7+
8+
## Who can use the code ?
9+
[![badge-license]][link-license]
10+
11+
Anyone. As the OpenJPEG code is released under the [BSD 2-clause "Simplified" License][link-license], anyone can use or modify the code, even for commercial applications. The only restriction is to retain the copyright in the sources or in the binaries documentation. Of course, if you modified the code in a way that might be of interest for other users, you are encouraged to share it (through a [github pull request](https://github.com/uclouvain/openjpeg/pulls) or by filling an [issue](https://github.com/uclouvain/openjpeg/issues)) but this is not a requirement.
12+
13+
## How to install and use OpenJPEG ?
14+
API Documentation needs a major refactoring. Meanwhile, you can check [installation](https://github.com/uclouvain/openjpeg/wiki/Installation) instructions and [codec documentation](https://github.com/uclouvain/openjpeg/wiki/DocJ2KCodec).
15+
16+
## Current Status
17+
[![badge-build]][link-build]
18+
19+
[![badge-msvc-build]][link-msvc-build]
20+
21+
[![badge-coverity]][link-coverity]
22+
23+
## Who are the developers ?
24+
25+
The library is developed and maintained by the Image and Signal Processing Group ([ISPGroup](http://sites.uclouvain.be/ispgroup/)), in the Université catholique de Louvain ([UCL](http://www.uclouvain.be/en-index.html), with the support of the [CNES](https://cnes.fr/), the [CS](http://www.c-s.fr/) company and the [intoPIX](http://www.intopix.com) company. The JPWL module has been developed by the Digital Signal Processing Lab ([DSPLab](http://dsplab.diei.unipg.it/)) of the University of Perugia, Italy ([UNIPG](http://www.unipg.it/)).
26+
27+
## Details on folders hierarchy
28+
29+
* src
30+
* lib
31+
* openjp2: contains the sources of the openjp2 library (Part 1 & 2)
32+
* openjpwl: contains the additional sources if you want to build a JPWL-flavoured library.
33+
* openjpip: complete client-server architecture for remote browsing of jpeg 2000 images.
34+
* openjp3d: JP3D implementation
35+
* openmj2: MJ2 implementation
36+
* bin: contains all applications that use the openjpeg library
37+
* common: common files to all applications
38+
* jp2: a basic codec
39+
* mj2: motion jpeg 2000 executables
40+
* jpip: OpenJPIP applications (server and dec server)
41+
* java: a Java client viewer for JPIP
42+
* jp3d: JP3D applications
43+
* tcltk: a test tool for JP3D
44+
* wx
45+
* OPJViewer: gui for displaying j2k files (based on wxWidget)
46+
* wrapping
47+
* java: java jni to use openjpeg in a java program
48+
* thirdparty: thirdparty libraries used by some applications. These libraries will be built only if there are not found on the system. Note that libopenjpeg itself does not have any dependency.
49+
* doc: doxygen documentation setup file and man pages
50+
* tests: configuration files and utilities for the openjpeg test suite. All test images are located in [openjpeg-data](https://github.com/uclouvain/openjpeg-data) repository.
51+
* cmake: cmake related files
52+
* scripts: scripts for developers
53+
54+
See [LICENSE][link-license] for license and copyright information.
55+
56+
See [INSTALL](https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md) for installation procedures.
57+
58+
See [NEWS](https://github.com/uclouvain/openjpeg/blob/master/NEWS.md) for user visible changes in successive releases.
59+
60+
## API/ABI
61+
62+
An API/ABI timeline is automatically updated [here][link-api-timeline].
63+
64+
OpenJPEG strives to provide a stable API/ABI for your applications. As such it
65+
only exposes a limited subset of its functions. It uses a mechanism of
66+
exporting/hiding functions. If you are unsure which functions you can use in
67+
your applications, you should compile OpenJPEG using something similar to gcc:
68+
`-fvisibility=hidden` compilation flag.
69+
See also: http://gcc.gnu.org/wiki/Visibility
70+
71+
On windows, MSVC directly supports export/hiding function and as such the only
72+
API available is the one supported by OpenJPEG.
73+
74+
[comment-license]: https://img.shields.io/github/license/uclouvain/openjpeg.svg "https://img.shields.io/badge/license-BSD--2--Clause-blue.svg"
75+
[badge-license]: https://img.shields.io/badge/license-BSD--2--Clause-blue.svg "BSD 2-clause \"Simplified\" License"
76+
[link-license]: https://github.com/uclouvain/openjpeg/blob/master/LICENSE "BSD 2-clause \"Simplified\" License"
77+
[badge-build]: https://travis-ci.org/uclouvain/openjpeg.svg?branch=master "Build Status"
78+
[link-build]: https://travis-ci.org/uclouvain/openjpeg "Build Status"
79+
[badge-msvc-build]: https://ci.appveyor.com/api/projects/status/github/uclouvain/openjpeg?branch=master&svg=true "Windows Build Status"
80+
[link-msvc-build]: https://ci.appveyor.com/project/detonin/openjpeg/branch/master "Windows Build Status"
81+
[badge-coverity]: https://scan.coverity.com/projects/6383/badge.svg "Coverity Scan Build Status"
82+
[link-coverity]: https://scan.coverity.com/projects/uclouvain-openjpeg "Coverity Scan Build Status"
83+
[link-api-timeline]: http://www.openjpeg.org/abi-check/timeline/openjpeg "OpenJPEG API/ABI timeline"

3rdparty/openjpeg/THANKS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# OpenJPEG THANKS file
2+
3+
Many people have contributed to OpenJPEG by reporting problems, suggesting various improvements,
4+
or submitting actual code. Here is a list of these people. Help me keep
5+
it complete and exempt of errors.
6+
7+
* Giuseppe Baruffa
8+
* Ben Boeckel
9+
* Aaron Boxer
10+
* David Burken
11+
* Matthieu Darbois
12+
* Rex Dieter
13+
* Herve Drolon
14+
* Antonin Descampe
15+
* Francois-Olivier Devaux
16+
* Parvatha Elangovan
17+
* Jerôme Fimes
18+
* Bob Friesenhahn
19+
* Kaori Hagihara
20+
* Luc Hermitte
21+
* Luis Ibanez
22+
* David Janssens
23+
* Hans Johnson
24+
* Callum Lerwick
25+
* Ke Liu (Tencent's Xuanwu LAB)
26+
* Sebastien Lugan
27+
* Benoit Macq
28+
* Mathieu Malaterre
29+
* Julien Malik
30+
* Arnaud Maye
31+
* Vincent Nicolas
32+
* Aleksander Nikolic (Cisco Talos)
33+
* Glenn Pearson
34+
* Even Rouault
35+
* Dzonatas Sol
36+
* Winfried Szukalski
37+
* Vincent Torri
38+
* Yannick Verschueren
39+
* Peter Wimmer

0 commit comments

Comments
 (0)