This commit is contained in:
dabrain34 2022-11-01 05:42:41 +09:00 committed by GitHub
commit b394822b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 2179 additions and 0 deletions

24
doc/meson.build Normal file
View File

@ -0,0 +1,24 @@
# Generate target to build the html documentation through CMake tool
# After having configured the project with the "build_doc" option you can run make doc
# to generate the html documentation in the doc/html repository of the build folder.
# Try to find the doxygen tool
doxygen_dep = dependency('Doxygen')
if doxygen_dep.found()
# Configure the doxygen config file with variable from CMake and move it
# configure_file([cmake_current_source_dir, '/Doxyfile.dox.cmake.in', cmake_binary_dir, '/doc/Doxyfile-html.dox', '@ONLY'])
# Configure the html mainpage file of the doxygen documentation with variable
# from CMake and move it
# configure_file([cmake_current_source_dir, '/mainpage.dox.in', cmake_binary_dir, '/doc/mainpage.dox', '@ONLY'])
# configure_file([cmake_current_source_dir, '/openjpip.dox.in', cmake_binary_dir, '/doc/openjpip.dox', '@ONLY'])
# copy png file to make local (binary tree) documentation valid:
# configure_file([cmake_current_source_dir, '/jpip_architect.png', cmake_binary_dir, '/doc/html/jpip_architect.png', 'COPYONLY'])
# configure_file([cmake_current_source_dir, '/jpip_protocol.png', cmake_binary_dir, '/doc/html/jpip_protocol.png', 'COPYONLY'])
# file(['GLOB', 'headers', openjpeg_source_dir, '/src/lib/openjp2/*.h', openjpeg_source_dir, '/src/lib/openjp2/*.c', openjpeg_source_dir, '/src/lib/openjpip/*.h', openjpeg_source_dir, '/src/lib/openjpip/*.c'])
# Generate new target to build the html documentation
# add_custom_command(['OUTPUT', cmake_current_binary_dir, '/html/index.html', 'COMMAND', doxygen_executable, cmake_binary_dir, '/doc/Doxyfile-html.dox', 'DEPENDS', cmake_binary_dir, '/doc/Doxyfile-html.dox', cmake_binary_dir, '/doc/mainpage.dox', cmake_binary_dir, '/doc/openjpip.dox', headers])
# add_custom_target(['doc', 'ALL', 'DEPENDS', cmake_binary_dir, '/doc/html/index.html', 'COMMENT', 'Building doxygen documentation'])
# install HTML documentation (install png files too):
# install(['DIRECTORY', cmake_binary_dir, '/doc/html', 'DESTINATION', 'share/doc', 'PATTERN', '.svn', 'EXCLUDE'])
else
message('STATUS: Doxygen not found, we cannot generate the documentation')
endif

150
meson.build Normal file
View File

@ -0,0 +1,150 @@
project('openjp2', 'c', 'cpp', version : '2.3.1',
meson_version : '>= 0.55.0',
default_options : [
'buildtype=debugoptimized',
'c_std=gnu89'
]
)
cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')
host_system = host_machine.system()
host_cpu = host_machine.cpu_family()
fs = import('fs')
openjpeg_version_major = '2'
openjpeg_version_minor = '3'
openjpeg_version_build = '1'
openjpeg_package_version = '@0@.@1@.@2@'.format(openjpeg_version_major, openjpeg_version_minor, openjpeg_version_build)
m_dep = cc.find_library('m')
thread_dep = dependency('threads')
# clock_gettime might require -rt, or it might not. find out
if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include <time.h>')
# XXX: untested
rt_dep = cc.find_library('rt')
else
rt_dep = []
endif
wxwidgets_dep = dependency('wxWidgets', required: get_option('build_viewer'))
subdir('thirdparty')
if host_system == 'windows'
if get_option('default_library') == 'static'
add_project_arguments(['-DOPJ_STATIC'], language: 'c')
else
add_project_arguments(['-DOPJ_EXPORTS'], language: 'c')
endif
endif
#-----------------------------------------------------------------------------
# Big endian test:
# test_big_endian('OPJ_BIG_ENDIAN')
#-----------------------------------------------------------------------------
# OpenJPEG build configuration options.
#executable_output_path = [openjpeg_binary_dir, '/bin', 'CACHE', 'PATH', 'Single output directory for building all executables.']
#library_output_path = [openjpeg_binary_dir, '/bin', 'CACHE', 'PATH', 'Single output directory for building all libraries.']
# mark_as_advanced(['LIBRARY_OUTPUT_PATH', 'EXECUTABLE_OUTPUT_PATH'])
#-----------------------------------------------------------------------------
# configure name mangling to allow multiple libraries to coexist
# peacefully
#if fs.exists('openjpeg_mangle.h.in')
# mangle_prefix = openjpeg_library_name
# configure_file([cmake_current_source_dir, '/openjpeg_mangle.h.in', cmake_current_binary_dir, '/openjpeg_mangle.h', '@ONLY'])
#endif
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Build Library
if get_option('build_jpip_server')
curl_dep = dependency('libcurl', version : '>= 7.55.0', required : false)
fcgi_dep = dependency('fcgi')
threads_dep = dependency('threads')
endif
subdir('src/lib')
#-----------------------------------------------------------------------------
# Build Applications
if get_option('build_codec') or get_option('build_mj2')
# OFF: It will only build 3rd party libs if they are not found on the system
# ON: 3rd party libs will ALWAYS be build, and used
subdir('src/bin')
endif
subdir('wrapping')
#-----------------------------------------------------------------------------
# opj_config.h generation (2/2)
# configure_file([cmake_current_source_dir, '/src/lib/openjp2/opj_config.h.cmake.in', cmake_current_binary_dir, '/src/lib/openjp2/opj_config.h', '@ONLY'])
# configure_file([cmake_current_source_dir, '/src/lib/openjp2/opj_config_private.h.cmake.in', cmake_current_binary_dir, '/src/lib/openjp2/opj_config_private.h', '@ONLY'])
#-----------------------------------------------------------------------------
# build documentation in doc subdir(TODO)
#if get_option('build_doc')
# subdir('doc')
#endif
#-----------------------------------------------------------------------------
# Buld Testing
if get_option('build_testing')
if get_option('build_codec')
# Search openjpeg data needed for the tests
# They could be found via git on the OpenJPEG GitHub code project
# git clone https://github.com/uclouvain/openjpeg-data.git
# find_path(['OPJ_DATA_ROOT', 'README-OPJ-Data', 'PATHS', '$ENV{OPJ_DATA_ROOT}', cmake_source_dir, '/../data', 'NO_DEFAULT_PATH', 'NO_CMAKE_FIND_ROOT_PATH'])
# Add repository where to find tests
#subdir('tests')
else
# message('FATAL_ERROR: You need build codec to run the tests')
endif
endif
# install CHANGES and LICENSE
#if get_option('build_doc')
# if fs.exists('./CHANGES')
# # install(['FILES', 'CHANGES', 'DESTINATION', openjpeg_install_doc_dir])
# endif
# install(['FILES', 'LICENSE', 'DESTINATION', openjpeg_install_doc_dir])
#endif
#-----------------------------------------------------------------------------
# pkgconfig support
if get_option('build_pkgconfig_files')
pkgconfig = import('pkgconfig')
pkgconfig.generate(openjp2_lib, name: 'libopenjp2',
description: 'JPEG2000 library (Part 1 and 2)',
version: meson.project_version(),
libraries: openjp2_lib)
if get_option('build_jpwl')
pkgconfig.generate(openjpwl_lib, name: 'libopenjpwl',
description: 'JPEG2000 Wireless library (Part 11)',
version: meson.project_version(),
libraries: openjpwl_lib)
endif
if get_option('build_jpip')
pkgconfig.generate(openjpip_lib, name: 'libopenjpip',
description: 'JPEG2000 Interactivity tools, APIs and protocols (Part 9)',
version: meson.project_version(),
libraries: openjpip_lib)
endif
if get_option('build_jp3d')
pkgconfig.generate(openjp3d_lib, name: 'libopenjp3d',
description: 'JPEG2000 Extensions for three-dimensional data (Part 10)',
version: meson.project_version(),
libraries: openjp3d_lib)
endif
endif
#-----------------------------------------------------------------------------
# build our version of astyle
#with_astyle = ['FALSE', 'CACHE', 'BOOL', 'If you plan to contribute you should reindent with scripts/prepare-commit.sh (using 'our' astyle)']

18
meson_options.txt Normal file
View File

@ -0,0 +1,18 @@
option('build_doc', type : 'boolean', value : false, description : 'Build the HTML documentation (with doxygen if available).')
option('opj_use_dsymutil', type : 'boolean', value : false, description : 'Call dsymutil on binaries after build.')
option('opj_disable_tpsot_fix', type : 'boolean', value : false, description : 'Disable TPsot==TNsot fix. See https://github.com/uclouvain/openjpeg/issues/254.')
option('opj_use_thread', type : 'boolean', value : true, description : 'Build with thread/mutex support ')
option('build_luts_generator', type : 'boolean', value : false, description : 'Build utility to generate t1_luts.h')
option('build_unit_tests', type : 'boolean', value : false, description : 'Build unit tests (bench_dwt, test_sparse_array, etc..)')
option('build_codec', type : 'boolean', value : true, description : 'Build the CODEC executables')
option('build_mj2', type : 'boolean', value : false, description : 'Build the MJ2 executables.')
option('build_jpwl', type : 'boolean', value : false, description : 'Build the JPWL library and executables')
option('build_jpip', type : 'boolean', value : false, description : 'Build the JPIP library and executables.')
option('build_jpip_server', type : 'boolean', value : false, description : 'Build the JPIP server.')
option('build_viewer', type : 'boolean', value : false, description : 'Build the OPJViewer executable (C++)')
option('build_java', type : 'boolean', value : false, description : 'Build the openjpeg jar (Java)')
option('build_jp3d', type : 'boolean', value : false, description : 'Build the JP3D comp')
option('build_thirdparty', type : 'boolean', value : false, description : 'Build the thirdparty executables if it is needed')
option('build_testing', type : 'boolean', value : false, description : 'Build the tests.')
option('build_pkgconfig_files', type : 'boolean', value : true, description : 'Build and install pkg-config files')
option('with_astyle', type : 'boolean', value : false, description : 'Build with astyle')

View File

@ -0,0 +1,14 @@
# opj_apps_config.h generation
configure_file(input : 'opj_apps_config.h.cmake.in', output : 'opj_apps_config.h', configuration : cappdata, format: 'cmake@')
common_srcs = [ 'color.c']
inc_dirs = include_directories('.','../../lib/openjp2')
common_lib = static_library('common', common_srcs,
include_directories : inc_dirs,
dependencies : [liblcms2_dep]
)
common_dep = declare_dependency(link_with : common_lib,
include_directories : inc_dirs)

45
src/bin/jp2/meson.build Normal file
View File

@ -0,0 +1,45 @@
# Build the demo app, small examples
# First thing define the common source:
common_srcs = ['convert.c'
, 'convertbmp.c'
, 'index.c'
, '../common/color.c'
, '../common/opj_getopt.c'
]
if libtiff_dep.found()
common_srcs += ['converttif.c']
endif
if libpng_dep.found()
common_srcs += ['convertpng.c']
endif
# Headers file are located here:
inc_dirs = include_directories('../../lib/openjp2', '../common')
openjp2_c_args = []
# Loop over all executables:
foreach exe : ['opj_decompress', 'opj_compress', 'opj_dump']
exe_c = exe + '.c'
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjp2_dep, libpng_dep, libtiff_dep, liblcms2_dep, zlib_dep, rt_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : openjp2_c_args
, include_directories : inc_dirs
, dependencies : exe_deps
, install : true
)
endforeach
#if get_option('opj_use_dsymutil')
# add_custom_command(['TARGET', exe, 'POST_BUILD', 'COMMAND', 'dsymutil', '$<TARGET_FILE:${exe}>', 'COMMENT', 'dsymutil $<TARGET_FILE:${exe}>', 'DEPENDS', exe])
#endif
#if get_option('build_doc')
# Install man pages
# install(['FILES', openjpeg_source_dir, '/doc/man/man1/opj_compress.1', openjpeg_source_dir, '/doc/man/man1/opj_decompress.1', openjpeg_source_dir, '/doc/man/man1/opj_dump.1', 'DESTINATION', openjpeg_install_man_dir, '/man1'])
#
#endif

21
src/bin/jp3d/meson.build Normal file
View File

@ -0,0 +1,21 @@
# Build the demo app, small examples
# First thing define the common source:
common_srcs = ['convert.c'
,'../common/opj_getopt.c']
inc_dirs = include_directories('../../lib/openjp2', '../../lib/openjp3d', '../common')
openjp3d_c_args = []
# Loop over all executables:
foreach exe : ['opj_jp3d_compress', 'opj_jp3d_decompress']
exe_c = exe + '.c'
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjp3d_dep, zlib_dep, rt_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : openjp3d_c_args
, include_directories : inc_dirs
, dependencies: exe_deps
, install: true
)
endforeach

83
src/bin/jpip/meson.build Normal file
View File

@ -0,0 +1,83 @@
# Headers file are located here:
inc_dirs = ['../../lib/openjp2',
'../common',
'../jp2',
'../../lib/openjpip']
# Tool to embed metadata into JP2 file
opj_jpip_addxml_exe = executable ('opj_jpip_addxml', ['opj_jpip_addxml.c'], install : true)
# Install exe
if get_option('build_jpip_server')
opj_server_srcs = ['opj_server.c']
# Build executable
# target_link_libraries(['opj_server', fcgi_libraries, 'openjpip_server'])
# set_property(['TARGET', 'opj_server', 'APPEND', 'PROPERTY', 'COMPILE_DEFINITIONS', 'SERVER', 'QUIT_SIGNAL=', 'quitJPIP'])
# On unix you need to link to the math library:
opj_server_exe = executable('opj_server', opj_server_srcs,
dependencies : [m_dep],
install : True)
endif
# Loop over all executables:
foreach exe : ['opj_dec_server', 'opj_jpip_transcode', 'opj_jpip_test']
exe_c = exe + '.c'
exe_c_args = []
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjpip_dep, rt_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : exe_c_args
, dependencies: exe_deps
, install: true
)
endforeach
message ('no java client')
# Build the two java clients:
#java_dep = dependency('Java')
# javac, jar
# User can override this:
#if 'NOT', 'DEFINED', 'JAVA_SOURCE_VERSION'
# java_source_version = '1.5'
#endif
#if 'NOT', 'DEFINED', 'JAVA_TARGET_VERSION'
# java_target_version = '1.5'
#endif
# Only build the java viewer if dev is found:
#if 'Java_Development_FOUND' and 'Java_JAVAC_EXECUTABLE'
#jflags = '$ENV{JFLAGS}'
# search for package org.apache.xerces.parsers
# find_file(['APACHE_XERCES_JAR', 'NAMES', 'xerces-j2.jar', 'xercesImpl.jar', 'PATHS', '/usr/share/java/', 'NO_DEFAULT_PATH'])
# mark_as_advanced('APACHE_XERCES_JAR')
# Decide to build the simple viewer or the xerces one:
#if 'EXISTS', apache_xerces_jar
# configure_file([cmake_current_source_dir, '/opj_viewer_xerces/dist/manifest.txt.in', cmake_current_binary_dir, '/opj_viewer_xerces/dist/manifest.txt', '@ONLY'])
# build dep list:
# file(['GLOB', 'java2_srcs', 'opj_viewer_xerces/src/*.java'])
# Need some common files:
# list(['APPEND', 'java2_srcs', cmake_current_source_dir, '/opj_viewer/src/ImageManager.java', cmake_current_source_dir, '/opj_viewer/src/ImgdecClient.java', cmake_current_source_dir, '/opj_viewer/src/JPIPHttpClient.java', cmake_current_source_dir, '/opj_viewer/src/MML.java', cmake_current_source_dir, '/opj_viewer/src/PnmImage.java', cmake_current_source_dir, '/opj_viewer/src/RegimViewer.java', cmake_current_source_dir, '/opj_viewer/src/ResizeListener.java'])
# make sure target javac dir exists:
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/classes2'])
# Build java
# add_custom_command(['OUTPUT', library_output_path, '/opj_jpip_viewer.jar', 'COMMAND', java_javac_executable, jflags, '-source', java_source_version, '-target', java_target_version, '-classpath', apache_xerces_jar, java2_srcs, '-d', cmake_current_binary_dir, '/classes2', 'COMMAND', java_jar_executable, 'cfm', library_output_path, '/opj_jpip_viewer.jar', cmake_current_binary_dir, '/opj_viewer_xerces/dist/manifest.txt', '-C', cmake_current_binary_dir, '/classes2', '.', 'DEPENDS', java2_srcs, cmake_current_source_dir, '/opj_viewer_xerces/dist/manifest.txt.in', 'COMMENT', 'javac *.java; jar cvf -> opj_viewer_xerces.jar'])
# name the target
# add_custom_target(['OPJViewerXercesJar', 'ALL', 'DEPENDS', library_output_path, '/opj_jpip_viewer.jar', 'COMMENT', 'building opj_jpip_viewer.jar (xerces)'])
# install(['FILES', library_output_path, '/opj_jpip_viewer.jar', 'DESTINATION', openjpeg_install_share_dir, 'COMPONENT', 'JavaModule'])
#else
# opj_viewer (simple, no xerces)
# build dep list:
# file(['GLOB', 'java1_srcs', 'opj_viewer/src/*.java'])
# make sure target javac dir exists:
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/classes1'])
# Build java
# add_custom_command(['OUTPUT', library_output_path, '/opj_jpip_viewer.jar', 'COMMAND', java_javac_executable, jflags, '-source', java_source_version, '-target', java_target_version, java1_srcs, '-d', cmake_current_binary_dir, '/classes1', 'COMMAND', java_jar_executable, 'cfm', library_output_path, '/opj_jpip_viewer.jar', cmake_current_source_dir, '/opj_viewer/dist/manifest.txt', '-C', cmake_current_binary_dir, '/classes1', '.', 'DEPENDS', java1_srcs, cmake_current_source_dir, '/opj_viewer/dist/manifest.txt', 'COMMENT', 'javac *.java; jar cvf -> opj_jpip_viewer.jar'])
# name the target
# add_custom_target(['OPJViewerJar', 'ALL', 'DEPENDS', library_output_path, '/opj_jpip_viewer.jar', 'COMMENT', 'building opj_jpip_viewer.jar (no xerces found)'])
# install(['FILES', library_output_path, '/opj_jpip_viewer.jar', 'DESTINATION', openjpeg_install_share_dir, 'COMPONENT', 'JavaModule'])
#endif
#else
# message(['WARNING', 'No java compiler found. Wont be able to build java viewer'])
#endif

27
src/bin/jpwl/meson.build Normal file
View File

@ -0,0 +1,27 @@
# jpwl apps
# First thing define the common source:
common_srcs = ['convert.c'
, 'index.c'
, '../common/color.c'
, '../common/opj_getopt.c']
# Headers file are located here:
inc_dirs = include_directories('../../lib/openmj2', '../../lib/openjp2', '../common')
openjpwl_c_args = []
openjpwl_c_args += ['-DOPJ_USE_LEGACY', '-DUSE_JPWL']
foreach exe : ['decompress', 'compress']
jpwl_exe = 'opj_jpwl_' + exe
exe_c = jpwl_exe + '.c'
exe_src = [exe_c] + common_srcs
exe_deps = [libopenjpwl_dep, libpng_dep, libtiff_dep, liblcms2_dep, m_dep, zlib_dep ]
exe_exe = executable (exe, exe_src
, c_args : openjpwl_c_args
, include_directories : inc_dirs
, dependencies: exe_deps
, install: true
)
endforeach

19
src/bin/meson.build Normal file
View File

@ -0,0 +1,19 @@
# source code for openjpeg apps:
subdir('common')
# Part 1 & 2:
subdir('jp2')
# optionals components:
if get_option('build_jpwl')
subdir('jpwl')
endif
if get_option('build_mj2')
subdir('mj2')
endif
if get_option('build_jpip')
subdir('jpip')
endif
if get_option('build_jp3d')
subdir('jp3d')
endif
# wx apps:
subdir('wx')

17
src/bin/mj2/meson.build Normal file
View File

@ -0,0 +1,17 @@
# Makefile for the MJ2 codecs of the OpenJPEG library: frames_to_mj2, mj2_to_frames, extract_j2k_from_mj2 and wrap_j2k_in_mj2
common_srcs = ['../common/opj_getopt.c']
inc_dirs = include_directories('../../lib/openmj2','../../lib/openjp2', '../common')
foreach exe : ['opj_mj2_wrap', 'opj_mj2_extract', 'opj_mj2_decompress', 'opj_mj2_compress']
jpwl_exe = 'opj_jpwl_${exe}'
exe_c = exe + '.c'
exe_src = [exe_c] + common_srcs
c_args = ['-DUSE_MJ2', '-DUSE_JPWL']
exe_deps = [common_dep, libopenjp2_dep, libopenmj2_dep, liblcms2_dep, m_dep]
exe_exe = executable (exe, exe_src
, c_args : c_args
, include_directories : inc_dirs
, dependencies: exe_deps
, install: true
)
endforeach

View File

@ -0,0 +1,26 @@
opjv_srcs = ['imagjpeg2000.cpp'
, 'wxj2kparser.cpp'
, '/source/OPJViewer.cpp'
, '/source/wxjp2parser.cpp'
, '/source/OPJDialogs.cpp'
, '/source/OPJThreads.cpp'
, '/source/OPJAbout.cpp'
, '../../jp2/index.c']
inc_dirs = ['/../..', '/..'
, '/src/lib'
, '/src/bin'
, '/src/lib/openjp2'
, '/src/lib/openjp2'])
opjviewer_exe = 'opjviewer'
c_args = ['-DwxUSE_LIBOPENJPEG' -DOPENJPEG_VERSION="1.5.0"]
deps = [openjpeg_dep, wxwidgets_dep, m_dep]
exe = executable (opjviewer_exe, opjv_srcs
, c_args : c_args
, include_directories : inc_dirs
, dependencies: deps
, install: true
)

3
src/bin/wx/meson.build Normal file
View File

@ -0,0 +1,3 @@
if get_option('build_viewer')
subdir('OPJViewer')
endif

21
src/lib/meson.build Normal file
View File

@ -0,0 +1,21 @@
# source code for openjpeg project:
# Part 1 & 2:
subdir('openjp2')
# optionals components:
if get_option('build_jpwl')
subdir('openjpwl')
if get_option('build_mj2')
subdir('openmj2')
endif
else
if get_option('build_mj2')
message('WARNING: you need to enable JPWL to get MJ2')
endif
endif
if get_option('build_jpip')
subdir('openjpip')
endif
if get_option('build_jp3d')
subdir('openjp3d')
endif

206
src/lib/openjp2/meson.build Normal file
View File

@ -0,0 +1,206 @@
openjp2_srcs = [ 'thread.c'
, 'bio.c'
, 'cio.c'
, 'dwt.c'
, 'event.c'
, 'image.c'
, 'invert.c'
, 'j2k.c'
, 'jp2.c'
, 'mct.c'
, 'mqc.c'
, 'openjpeg.c'
, 'opj_clock.c'
, 'pi.c'
, 't1.c'
, 't2.c'
, 'tcd.c'
, 'tgt.c'
, 'function_list.c'
, 'opj_malloc.c'
, 'sparse_array.c'
]
openjp2_headers = ['thread.h'
, 'bio.h'
, 'cio.h'
, 'dwt.h'
, 'event.h'
, 'image.h'
, 'invert.h'
, 'j2k.h'
, 'jp2.h'
, 'mct.h'
, 'mqc.h'
, 'mqc_inl.h'
, 'openjpeg.h'
, 'opj_clock.h'
, 'pi.h'
, 't1.h'
, 't2.h'
, 'tcd.h'
, 'tgt.h'
, 'function_list.h'
, 'opj_codec.h'
, 'opj_includes.h'
, 'opj_intmath.h'
, 'opj_malloc.h'
, 'opj_stdint.h'
, 'sparse_array.h'
]
if get_option('build_jpip')
add_project_arguments('-DUSE_JPIP', language: 'c')
openjp2_srcs += [ 'cidx_manager.c'
, 'phix_manager.c'
, 'ppix_manager.c'
, 'thix_manager.c'
, 'tpix_manager.c'
]
openjp2_headers += [ 'cidx_manager.h', 'indexbox_manager.h']
endif
opj_config = configuration_data()
opj_config.set('OPENJPEG_VERSION_MAJOR', openjpeg_version_major)
opj_config.set('OPENJPEG_VERSION_MINOR', openjpeg_version_minor)
opj_config.set('OPENJPEG_VERSION_BUILD', openjpeg_version_build)
check_headers = [
['OPJ_HAVE_STDINT_H', 'stdint.h'],
]
foreach h : check_headers
if cc.has_header(h.get(1))
opj_config.set(h.get(0), 1)
endif
endforeach
opj_private_config = configuration_data()
check_headers = [
['HAVE_ASSERT_H', 'assert.h'],
['HAVE_CTYPE_H', 'ctype.h'],
['HAVE_DLFCN_H', 'dlfcn.h'],
['HAVE_FLOAT_H', 'float.h'],
['OPJ_HAVE_INTTYPES_H', 'inttypes.h'],
['OPJ_HAVE_MALLOC_H', 'malloc.h'],
['HAVE_MATH_H', 'math.h'],
['HAVE_MEMORY_H', 'memory.h'],
['HAVE_STDARG_H', 'stdarg.h'],
['OPJ_HAVE_STDINT_H', 'stdint.h'],
['HAVE_STDLIB_H', 'stdlib.h'],
['HAVE_STDIO_H', 'stdio.h'],
['HAVE_STRINGS_H', 'strings.h'],
['HAVE_STRING_H', 'string.h'],
['HAVE_SYS_STAT_H', 'sys/stat.h'],
['HAVE_SYS_TYPES_H', 'sys/types.h'],
['HAVE_TIME_H', 'time.h'],
['HAVE_UNISTD_H', 'unistd.h'],
['HAVE_WINSOCK2_H', 'winsock2.h'],
]
foreach h : check_headers
if cc.has_header(h.get(1))
opj_private_config.set(h.get(0), 1)
endif
endforeach
if cc.has_function('_aligned_malloc', prefix : '#include <malloc.h>')
opj_private_config.set('OPJ_HAVE__ALIGNED_MALLOC', 1)
endif
if cc.has_function('memalign', prefix : '#include <malloc.h>')
opj_private_config.set('OPJ_HAVE_MEMALIGN', 1)
endif
if cc.has_function('posix_memalign', prefix : '#include <stdlib.h>')
opj_private_config.set('OPJ_HAVE_POSIX_MEMALIGN', 1)
endif
opj_private_config.set('PACKAGE_VERSION', openjpeg_package_version)
if cc.has_function('fseeko')
opj_private_config.set('OPJ_HAVE_FSEEKO', 'ON')
else
opj_private_config.set('OPJ_HAVE_FSEEKO', 'OFF')
endif
#-----------------------------------------------------------------------------
# opj_config.h generation (1/2)
# Check if some include files are provided by the system
# These files are mandatory
# For the following files, we provide an alternative, they are not mandatory
# Enable Large file support
opj_config.set('OPJ_HAVE_LARGEFILES', 1)
# opj_test_large_files('OPJ_HAVE_LARGEFILES')
configure_file(input: 'opj_config.h.cmake.in', output : 'opj_config.h', configuration : opj_config, format : 'cmake@', install_dir: get_option('includedir'))
configure_file(input : 'opj_config_private.h.cmake.in', output : 'opj_config_private.h', configuration : opj_private_config, format : 'cmake@')
inc_dirs = include_directories('.')
openjp2_c_args = ['-DNDEBUG',
'-fstrict-aliasing',
'-ffast-math',
'-funroll-loops',
'-fomit-frame-pointer',
'-ffinite-math-only',
'-Wall',
'-std=c99']
if get_option('opj_disable_tpsot_fix')
openjp2_c_args += ['-DOPJ_DISABLE_TPSOT_FIX']
endif
#if get_option('build_doc')
# install man page of the library
# install(['FILES', openjpeg_source_dir, '/doc/man/man3/libopenjp2.3', 'DESTINATION', openjpeg_install_man_dir, '/man3'])
#endif
if get_option('build_luts_generator')
t1_generate_luts_exe = executable('t1_generate_luts', 't1_generate_luts.c', dependencies : [libm])
endif
#################################################################################
# threading configuration
#################################################################################
cmake_thread_prefer_pthread = 'TRUE'
if not get_option('opj_use_thread')
openjp2_c_args += ('-DMUTEX_stub')
endif
if get_option('opj_use_thread') and host_system == 'windows' and not thread_dep.found()
# add_definitions('-DMUTEX_win32')
openjp2_c_args += ('-DMUTEX_win32')
endif
if get_option('opj_use_thread') and thread_dep.found()
openjp2_c_args += ('-DMUTEX_pthread')
endif
if get_option('opj_use_thread') and not thread_dep.found()
error('FATAL_ERROR: No thread library found and thread/mutex support is required by "opj_use_thread" option')
endif
open_jp2_deps = [m_dep, thread_dep]
# Build the library
openjp2_lib = library('openjp2', openjp2_srcs,
include_directories : inc_dirs,
c_args : openjp2_c_args,
install : true,
dependencies : open_jp2_deps,
version : meson.project_version())
libopenjp2_dep = declare_dependency(link_with : openjp2_lib,
include_directories : inc_dirs)
install_headers(openjp2_headers)
if get_option('build_unit_tests')
bench_dwt_exe = executable('bench_dwt', 'bench_dwt.c',
dependencies : [libopenjp2_dep, m_dep, thread_dep])
test_sparse_array_exe = executable('test_sparse_array', 'test_sparse_array.c',
dependencies : [libopenjp2_dep, m_dep, thread_dep])
endif

View File

@ -0,0 +1,39 @@
# Defines the source code for the library
openjp3d_srcs = ['bio.c'
, 'cio.c'
, 'dwt.c'
, 'event.c'
, 'jp3d.c'
, 'jp3d_lib.c'
, 'mct.c'
, 'mqc.c'
, 'openjp3d.c'
, 'pi.c'
, 'raw.c'
, 't1.c'
, 't1_3d.c'
, 't2.c'
, 'tcd.c'
, 'tgt.c'
, 'volume.c'
]
openjp3d_headers = ['openjp3d.h']
inc_dirs = include_directories('.', '../openjp2')
openjp3d_args = []
# build jp3d lib:
openjp3d_lib = library('openjp3d', openjp3d_srcs,
c_args : openjp3d_args,
include_directories : inc_dirs,
dependencies : [m_dep],
install : true,
version : meson.project_version())
incdir = include_directories('.')
libopenjp3d_dep = declare_dependency(link_with : openjp3d_lib,
include_directories : inc_dirs)
install_headers(openjp3d_headers)

View File

@ -0,0 +1,73 @@
openjpip_srcs = [ 'boxheader_manager.c'
, 'codestream_manager.c'
, 'imgreg_manager.c'
, 'marker_manager.c'
, 'msgqueue_manager.c'
, 'box_manager.c'
, 'faixbox_manager.c'
, 'index_manager.c'
, 'metadata_manager.c'
, 'placeholder_manager.c'
, 'byte_manager.c'
, 'ihdrbox_manager.c'
, 'manfbox_manager.c'
, 'mhixbox_manager.c'
, 'target_manager.c'
, 'cachemodel_manager.c'
, 'j2kheader_manager.c'
, 'jp2k_encoder.c'
, 'openjpip.c'
, 'query_parser.c'
, 'channel_manager.c'
, 'session_manager.c'
, 'jpip_parser.c'
, 'sock_manager.c'
, '../openjp2/opj_malloc.c']
server_srcs = ['auxtrans_manager.c']
local_srcs = [ 'jp2k_decoder.c'
, 'imgsock_manager.c'
, 'jpipstream_manager.c'
, 'cache_manager.c'
, 'dec_clientmsg_handler.c']
openjpip_headers = ['openjpip.h'
, 'session_manager.h'
, 'target_manager.h'
, 'query_parser.h'
, 'msgqueue_manager.h'
, 'sock_manager.h'
, 'auxtrans_manager.h']
openjpip_args = ['-DUSE_JPIP']
inc_dirs = include_directories('.', '../openjp2')
deps = [libopenjp2_dep, m_dep]
if host_system == 'windows'
deps += [cc.find_library('ws2_32')]
endif
# build jpip lib:
openjpip_lib = library('openjpip', openjpip_srcs + local_srcs,
c_args : openjpip_args,
include_directories : inc_dirs,
dependencies: deps,
install : true,
version : meson.project_version())
libopenjpip_dep = declare_dependency(link_with : openjpip_lib,
include_directories : inc_dirs)
# Install library
if get_option('build_jpip_server')
openjpip_server_lib = static_library('openjpip_server', openjpip_srcs + server_srcs
, c_args : ['-DSERVER']
, dependencies: [fcgi_dep, curl_dep]
, version: meson.project_version())
endif
install_headers(openjpip_headers)

View File

@ -0,0 +1,48 @@
# Makefile for the main JPWL OpenJPEG codecs: JPWL_ j2k_to_image and JPWL_image_to_j2k
openjpeg_srcs = ['../openmj2/bio.c'
, '../openmj2/cio.c'
, '../openmj2/dwt.c'
, '../openmj2/event.c'
, '../openmj2/image.c'
, '../openmj2/j2k.c'
, '../openmj2/jp2.c'
, '../openmj2/jpt.c'
, '../openmj2/mct.c'
, '../openmj2/mqc.c'
, '../openmj2/openjpeg.c'
, '../openmj2/j2k_lib.c'
, '../openmj2/pi.c'
, '../openmj2/raw.c'
, '../openmj2/t1.c'
, '../openmj2/t2.c'
, '../openmj2/tcd.c'
, '../openmj2/tgt.c']
jpwl_srcs = ['crc.c', 'jpwl.c', 'jpwl_lib.c', 'rs.c']
jpwl_headers = ['jpwl.h']
inc_dirs = include_directories('.', '..', '../openmj2', '../openjp2', '../openjpwl')
openjpwl_c_args = ['-DUSE_JPWL']
openjpwl_link_args = []
if ['darwin', 'ios'].contains(host_system)
openjpwl_c_args += ['-fno-common']
# set_source_files_properties(['rs.c', 'PROPERTIES', 'COMPILE_FLAGS', '-fno-common'])
endif
openjpwl_lib = library('openjpwl', openjpeg_srcs + jpwl_srcs,
c_args : openjpwl_c_args,
link_args : openjpwl_link_args,
install : true,
dependencies : [m_dep],
include_directories : inc_dirs,
version : meson.project_version()
)
libopenjpwl_dep = declare_dependency(link_with : openjpwl_lib,
include_directories : inc_dirs)
install_headers(jpwl_headers)

View File

@ -0,0 +1,45 @@
openmj2_srcs = ['mj2.c'
, 'mj2_convert.c'
, 'j2k_lib.c'
, 'cio.c'
, 'jp2.c'
, 'j2k.c'
, 'tcd.c'
, 'mct.c'
, 't1.c'
, 't2.c'
, 'pi.c'
, 'bio.c'
, 'mqc.c'
, 'tgt.c'
, 'dwt.c'
, 'event.c'
, 'image.c'
, 'jpt.c'
, 'raw.c'
, 'openjpeg.c']
openmj2_headers = ['opj_includes.h', 'openjpeg.h']
inc_dirs = include_directories('.', '../openjp2', '../openjpwl')
openmj2_c_args = ['-DUSE_JPWL']
openmj2_link_args = []
# build mj2 lib:
openmj2_lib = library('openmj2',
openmj2_srcs,
c_args : openmj2_c_args,
link_args : openmj2_link_args,
install : true,
dependencies : [libopenjpwl_dep, m_dep],
include_directories : inc_dirs,
version : meson.project_version()
)
libopenmj2_dep = declare_dependency(link_with : openmj2_lib,
include_directories : inc_dirs)
install_headers(openmj2_headers)

View File

@ -0,0 +1,404 @@
# CONFORMANCE TESTS AND NON-REGRESSION ON THIS DATASET
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/Temporary'])
temp = [cmake_current_binary_dir, '/Temporary']
baseline_conf = [opj_data_root, '/baseline/conformance']
baseline_nr = [opj_data_root, '/baseline/nonregression']
input_conf = [opj_data_root, '/input/conformance']
# List of components by file (normally p0_13.j2k have 257 components but for this
#set of test we consider only 4)
cp0_nbc_list = 'not_used;1;1;1;3;4;4;3;3;1;3;1;1;4;3;1;1'
cp1_nbc_list = 'not_used;1;3;4;1;3;3;2'
commentcodevar = 'FALSE'
##--------------------------------------------------------------------------
## Tests about class 0 profile 0
## try to decode
## compare to ref file provided by the Executable Test Suite
## non regression comparison
## Parameters and tolerances given by Table C.1
#set( C0P0_ResFactor_list "not_used;0;0;0;3;3;3;0;5;2;0;0;0;0;2;0;0")
#set( C0P0_PEAK_list "not_used;0;0;0;33;54;109;10;7;4;10;0;0;0;0;0;0")
#set( C0P0_MSE_list "not_used;0;0;0;55.8;68;743;0.34;6.72;1.47;2.84;0;0;0;0;0;0")
#foreach(numFileC0P0 RANGE 1 16)
# # Build filenames
# if(${numFileC0P0} LESS 10)
# set( filenameInput p0_0${numFileC0P0}.j2k )
# set( filenameRef c0p0_0${numFileC0P0}.pgx )
# else()
# set( filenameInput p0_${numFileC0P0}.j2k )
# set( filenameRef c0p0_${numFileC0P0}.pgx )
# endif()
# # Get corresponding tests parameters
# list(GET C0P0_ResFactor_list ${numFileC0P0} ResFactor)
# #For Class-0 testing, we always focus on the first component only
# #list(GET CP0_nbC_list ${numFileC0P0} nbComponents)
# set( nbComponents "1")
# list(GET C0P0_PEAK_list ${numFileC0P0} PEAK_limit)
# list(GET C0P0_MSE_list ${numFileC0P0} MSE_limit)
# # Manage cases which need to try different resolution reduction
# if (numFileC0P0 EQUAL 3 OR numFileC0P0 EQUAL 15)
# get_filename_component(filenameRefSub ${filenameRef} NAME_WE)
# #r = 0
# add_test(ETS-C0P0-${filenameInput}-r0-decode
# ${EXECUTABLE_OUTPUT_PATH}/opj_decompress
# -i ${INPUT_CONF}/${filenameInput}
# -o ${TEMP}/c0${filenameInput}-r0.pgx
# -r 0
# )
# add_test(ETS-C0P0-${filenameInput}-r0-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_CONF}/${filenameRefSub}r0.pgx
# -t ${TEMP}/c0${filenameInput}-r0.pgx
# -n ${nbComponents}
# -p ${PEAK_limit}
# -m ${MSE_limit}
# -s t_
# )
# set_tests_properties(ETS-C0P0-${filenameInput}-r0-compare2ref
# PROPERTIES DEPENDS
# ETS-C0P0-${filenameInput}-r0-decode)
# add_test(NR-C0P0-${filenameInput}-r0-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRefSub}-r0.pgx
# -t ${TEMP}/c0${filenameInput}-r0.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
# set_tests_properties(NR-C0P0-${filenameInput}-r0-compare2base
# PROPERTIES DEPENDS
# ETS-C0P0-${filenameInput}-r0-decode)
# #r = 1
# add_test(ETS-C0P0-${filenameInput}-r1-decode
# ${EXECUTABLE_OUTPUT_PATH}/opj_decompress
# -i ${INPUT_CONF}/${filenameInput}
# -o ${TEMP}/c0${filenameInput}-r1.pgx
# -r 1
# )
# add_test(ETS-C0P0-${filenameInput}-r1-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_CONF}/${filenameRefSub}r1.pgx
# -t ${TEMP}/c0${filenameInput}-r1.pgx
# -n ${nbComponents}
# -p ${PEAK_limit}
# -m ${MSE_limit}
# -s t_
# )
# set_tests_properties(ETS-C0P0-${filenameInput}-r1-compare2ref
# PROPERTIES DEPENDS
# ETS-C0P0-${filenameInput}-r1-decode)
# add_test(NR-C0P0-${filenameInput}-r1-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRefSub}-r1.pgx
# -t ${TEMP}/c0${filenameInput}-r1.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
# set_tests_properties(NR-C0P0-${filenameInput}-r1-compare2base
# PROPERTIES DEPENDS
# ETS-C0P0-${filenameInput}-r1-decode)
# else()
# add_test(ETS-C0P0-${filenameInput}-decode
# ${EXECUTABLE_OUTPUT_PATH}/opj_decompress
# -i ${INPUT_CONF}/${filenameInput}
# -o ${TEMP}/c0${filenameInput}.pgx
# -r ${ResFactor}
# )
# add_test(ETS-C0P0-${filenameInput}-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_CONF}/${filenameRef}
# -t ${TEMP}/c0${filenameInput}.pgx
# -n ${nbComponents}
# -p ${PEAK_limit}
# -m ${MSE_limit}
# -s t_
# )
# set_tests_properties(ETS-C0P0-${filenameInput}-compare2ref
# PROPERTIES DEPENDS
# ETS-C0P0-${filenameInput}-decode)
# add_test(NR-C0P0-${filenameInput}-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRef}
# -t ${TEMP}/c0${filenameInput}.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
# set_tests_properties(NR-C0P0-${filenameInput}-compare2base
# PROPERTIES DEPENDS
# ETS-C0P0-${filenameInput}-decode)
# endif()
#endforeach()
##--------------------------------------------------------------------------
## Tests about class 0 profile 1
## try to decode
## compare to ref file
## non regression comparison
## Parameters and tolerances given by Table C.4
#set( C0P1_ResFactor_list "not_used;0;3;3;0;4;1;0")
#set( C0P1_PEAK_list "not_used;0;35;28;2;128;128;0")
#set( C0P1_MSE_list "not_used;0;74;18.8;0.550;16384;16384;0")
#foreach(numFileC0P1 RANGE 1 7)
# # Build filenames
# set( filenameInput p1_0${numFileC0P1}.j2k )
# set( filenameRef c0p1_0${numFileC0P1}.pgx )
# # Get corresponding tests parameters
# list(GET C0P1_ResFactor_list ${numFileC0P1} ResFactor)
# #For Class-0 testing, we always focus on the first component only
# #list(GET CP0_nbC_list ${numFileC0P0} nbComponents)
# set( nbComponents "1")
# list(GET C0P1_PEAK_list ${numFileC0P1} PEAK_limit)
# list(GET C0P1_MSE_list ${numFileC0P1} MSE_limit)
# # Manage cases which need to try different resolution reduction
# if (numFileC0P1 EQUAL 4 )
# get_filename_component(filenameRefSub ${filenameRef} NAME_WE)
# #r = 0
# add_test(ETS-C0P1-${filenameInput}-r0-decode
# ${EXECUTABLE_OUTPUT_PATH}/opj_decompress
# -i ${INPUT_CONF}/${filenameInput}
# -o ${TEMP}/c0${filenameInput}-r0.pgx
# -r 0
# )
# add_test(ETS-C0P1-${filenameInput}-r0-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_CONF}/${filenameRefSub}r0.pgx
# -t ${TEMP}/c0${filenameInput}-r0.pgx
# -n ${nbComponents}
# -p ${PEAK_limit}
# -m ${MSE_limit}
# -s t_
# )
# set_tests_properties(ETS-C0P1-${filenameInput}-r0-compare2ref
# PROPERTIES DEPENDS
# ETS-C0P1-${filenameInput}-r0-decode)
# add_test(NR-C0P1-${filenameInput}-r0-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRefSub}-r0.pgx
# -t ${TEMP}/c0${filenameInput}-r0.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
# set_tests_properties(NR-C0P1-${filenameInput}-r0-compare2base
# PROPERTIES DEPENDS
# ETS-C0P1-${filenameInput}-r0-decode)
# #r = 3
# add_test(ETS-C0P1-${filenameInput}-r3-decode
# ${EXECUTABLE_OUTPUT_PATH}/opj_decompress
# -i ${INPUT_CONF}/${filenameInput}
# -o ${TEMP}/c0${filenameInput}-r3.pgx
# -r 3
# )
# add_test(ETS-C0P1-${filenameInput}-r3-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_CONF}/${filenameRefSub}r3.pgx
# -t ${TEMP}/c0${filenameInput}-r3.pgx
# -n ${nbComponents}
# -p ${PEAK_limit}
# -m ${MSE_limit}
# -s t_
# )
# set_tests_properties(ETS-C0P1-${filenameInput}-r3-compare2ref
# PROPERTIES DEPENDS
# ETS-C0P1-${filenameInput}-r3-decode)
# add_test(NR-C0P1-${filenameInput}-r3-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRefSub}-r3.pgx
# -t ${TEMP}/c0${filenameInput}-r3.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
# set_tests_properties(NR-C0P1-${filenameInput}-r3-compare2base
# PROPERTIES DEPENDS
# ETS-C0P1-${filenameInput}-r3-decode)
# else()
# add_test(ETS-C0P1-${filenameInput}-decode
# ${EXECUTABLE_OUTPUT_PATH}/opj_decompress
# -i ${INPUT_CONF}/${filenameInput}
# -o ${TEMP}/c0${filenameInput}.pgx
# -r ${ResFactor}
# )
# add_test(ETS-C0P1-${filenameInput}-compare2ref
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_CONF}/${filenameRef}
# -t ${TEMP}/c0${filenameInput}.pgx
# -n ${nbComponents}
# -p ${PEAK_limit}
# -m ${MSE_limit}
# -s t_
# )
# set_tests_properties(ETS-C0P1-${filenameInput}-compare2ref
# PROPERTIES DEPENDS
# ETS-C0P1-${filenameInput}-decode)
# add_test(NR-C0P1-${filenameInput}-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRef}
# -t ${TEMP}/c0${filenameInput}.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
# set_tests_properties(NR-C0P1-${filenameInput}-compare2base
# PROPERTIES DEPENDS
# ETS-C0P1-${filenameInput}-decode)
# endif()
#endforeach()
#--------------------------------------------------------------------------
# Tests about class 1 profile 0
# try to decode
# compare to ref file
# non regression comparison
# Parameters and tolerances given by Table C.6
c1p0_resfactor_list = 'not_used;0;0;0;0;0;0;0;1;0;0;0;0;0;0;0;0'
c1p0_peak_list = 'not_used;0;0;0;5:4:6;2:2:2:0;635:403:378:0;0:0:0;0:0:0;0;0:0:0;0;0;0:0:0:0;0:0:0;0;0'
c1p0_mse_list = 'not_used;0;0;0;0.776:0.626:1.070;0.302:0.307:0.269:0;11287:6124:3968:0;0:0:0;0:0:0;0;0:0:0;0;0;0:0:0:0;0:0:0;0;0'
# foreach(['numFileC1P0', 'RANGE', '1', '16'])
# Build filenames
if numfilec1p0, 'LESS', '10'
filenameinput = 'p0_0${numFileC1P0}.j2k'
filenameref = 'c1p0_0${numFileC1P0}.pgx'
else
filenameinput = 'p0_${numFileC1P0}.j2k'
filenameref = 'c1p0_${numFileC1P0}.pgx'
endif
# Get corresponding tests parameters
# list(['GET', 'CP0_nbC_list', numfilec1p0, 'nbComponents'])
# list(['GET', 'C1P0_ResFactor_list', numfilec1p0, 'ResFactor'])
# list(['GET', 'C1P0_PEAK_list', numfilec1p0, 'PEAK_limit'])
# list(['GET', 'C1P0_MSE_list', numfilec1p0, 'MSE_limit'])
test('NAME', 'ETS-C1P0-${filenameInput}-decode', 'COMMAND', 'opj_decompress', '-i', input_conf, '/${filenameInput}', '-o', temp, '/c1${filenameInput}.pgx', '-r', resfactor)
test('NAME', 'ETS-C1P0-${filenameInput}-compare2ref', 'COMMAND', 'compare_images', '-b', baseline_conf, '/${filenameRef}', '-t', temp, '/c1${filenameInput}.pgx', '-n', nbcomponents, '-p', peak_limit, '-m', mse_limit, '-s', 'b_t_')
# set_tests_properties(['ETS-C1P0-${filenameInput}-compare2ref', 'PROPERTIES', 'DEPENDS', 'ETS-C1P0-${filenameInput}-decode'])
test('NAME', 'NR-C1P0-${filenameInput}-compare2base', 'COMMAND', 'compare_images', '-b', baseline_nr, '/opj_${filenameRef}', '-t', temp, '/c1${filenameInput}.pgx', '-n', nbcomponents, '-d', '-s', 'b_t_')
# set_tests_properties(['NR-C1P0-${filenameInput}-compare2base', 'PROPERTIES', 'DEPENDS', 'ETS-C1P0-${filenameInput}-decode'])
# endforeach()
#--------------------------------------------------------------------------
# Tests about class 1 profile 1
# try to decode
# compare to ref file
# non regression comparison
# Parameters and tolerances given by Table C.7
c1p1_peak_list = 'not_used;0;5:4:6;2:2:1:0;624;40:40:40;2:2:2;0:0'
c1p1_mse_list = 'not_used;0;0.765:0.616:1.051;0.3:0.210:0.200:0;3080;8.458:9.816:10.154;0.6:0.6:0.6;0:0'
# foreach(['numFileC1P1', 'RANGE', '1', '7'])
# Build filenames
filenameinput = 'p1_0${numFileC1P1}.j2k'
filenameref = 'c1p1_0${numFileC1P1}.pgx'
# Get corresponding tests parameters
# list(['GET', 'CP1_nbC_list', numfilec1p1, 'nbComponents'])
# list(['GET', 'C1P1_PEAK_list', numfilec1p1, 'PEAK_limit'])
# list(['GET', 'C1P1_MSE_list', numfilec1p1, 'MSE_limit'])
test('NAME', 'ETS-C1P1-${filenameInput}-decode', 'COMMAND', 'opj_decompress', '-i', input_conf, '/${filenameInput}', '-o', temp, '/c1${filenameInput}.pgx', '-r', '0')
test('NAME', 'ETS-C1P1-${filenameInput}-compare2ref', 'COMMAND', 'compare_images', '-b', baseline_conf, '/${filenameRef}', '-t', temp, '/c1${filenameInput}.pgx', '-n', nbcomponents, '-p', peak_limit, '-m', mse_limit, '-s', 'b_t_')
# set_tests_properties(['ETS-C1P1-${filenameInput}-compare2ref', 'PROPERTIES', 'DEPENDS', 'ETS-C1P1-${filenameInput}-decode'])
test('NAME', 'NR-C1P1-${filenameInput}-compare2base', 'COMMAND', 'compare_images', '-b', baseline_nr, '/opj_${filenameRef}', '-t', temp, '/c1${filenameInput}.pgx', '-n', nbcomponents, '-d', '-s', 'b_t_')
# set_tests_properties(['NR-C1P1-${filenameInput}-compare2base', 'PROPERTIES', 'DEPENDS', 'ETS-C1P1-${filenameInput}-decode'])
# endforeach()
#--------------------------------------------------------------------------
# Tests about JP2 file
# try to decode
# compare to ref file
# non regression comparison
# Tolerances given by Part 4 - Table G.1
# Peak is set to 4 only
# foreach(['numFileJP2', 'RANGE', '1', '9'])
# Build filenames
filenameinput = 'file${numFileJP2}.jp2'
filenameref = 'jp2_${numFileJP2}.tif'
test('NAME', 'ETS-JP2-${filenameInput}-decode', 'COMMAND', 'opj_decompress', '-i', input_conf, '/${filenameInput}', '-o', temp, '/${filenameInput}.tif', '-p', '8S', '-force-rgb')
test('NAME', 'ETS-JP2-${filenameInput}-compare2ref', 'COMMAND', 'compare_images', '-b', baseline_conf, '/${filenameRef}', '-t', temp, '/${filenameInput}.tif', '-n', '3', '-p', '4:4:4', '-m', '1:1:1', '-s', 'b_t_')
# set_tests_properties(['ETS-JP2-${filenameInput}-compare2ref', 'PROPERTIES', 'DEPENDS', 'ETS-JP2-${filenameInput}-decode'])
test('NAME', 'NR-JP2-${filenameInput}-compare2base', 'COMMAND', 'compare_images', '-b', baseline_nr, '/opj_${filenameRef}', '-t', temp, '/${filenameInput}.tif', '-n', '3', '-d', '-s', 'b_t_')
# set_tests_properties(['NR-JP2-${filenameInput}-compare2base', 'PROPERTIES', 'DEPENDS', 'ETS-JP2-${filenameInput}-decode'])
# endforeach()
#--------------------------------------------------------------------------
# Tests about Kakadu/J2K file
# try to decode
# compare to ref file
# non regression comparison
# Tolerances given by ???
kdu_j2k_conf_files = ['a1_mono', 'a2_colr', 'a3_mono', 'a4_colr', 'a5_mono', 'a6_mono_colr', 'b1_mono', 'b2_mono', 'b3_mono', 'c1_mono', 'c2_mono', 'd1_colr', 'd2_colr', 'e1_colr', 'e2_colr', 'f1_mono', 'f2_mono', 'g1_colr', 'g2_colr', 'g3_colr', 'g4_colr']
# foreach(['kdu_file', kdu_j2k_conf_files])
# Build filenames
filenameinput = '${kdu_file}.j2c'
filenameref = '${kdu_file}.ppm'
if '${kdu_file}', 'STREQUAL', 'a6_mono_colr'
kdu_test_args = ['-upsample', '-split-pnm']
else
kdu_test_args = '-upsample'
endif
test('NAME', 'ETS-KDU-${filenameInput}-decode', 'COMMAND', 'opj_decompress', '-i', input_conf, '/${filenameInput}', '-o', temp, '/${filenameInput}.ppm', kdu_test_args)
if '${kdu_file}', 'STREQUAL', 'a6_mono_colr'
kdu_test_args = ['-n', '4', '-s', 'b_t_']
kdu_test_args_tol = ['-p', '4:4:4:4', '-m', '1:1:1:1']
else
kdu_test_args = ['-n', '1']
kdu_test_args_tol = ['-p', '4:4:4', '-m', '1:1:1']
endif
test('NAME', 'ETS-KDU-${filenameInput}-compare2ref', 'COMMAND', 'compare_images', '-b', baseline_conf, '/${filenameRef}', '-t', temp, '/${filenameInput}.ppm', kdu_test_args, kdu_test_args_tol)
# set_tests_properties(['ETS-KDU-${filenameInput}-compare2ref', 'PROPERTIES', 'DEPENDS', 'ETS-KDU-${filenameInput}-decode'])
test('NAME', 'NR-KDU-${filenameInput}-compare2base', 'COMMAND', 'compare_images', '-b', baseline_nr, '/opj_${filenameRef}', '-t', temp, '/${filenameInput}.ppm', kdu_test_args, '-d')
# set_tests_properties(['NR-KDU-${filenameInput}-compare2base', 'PROPERTIES', 'DEPENDS', 'ETS-KDU-${filenameInput}-decode'])
# endforeach()
#--------------------------------------------------------------------------
# Tests about Richter/J2K file
# try to decode
# compare to ref file
# non regression comparison
# Tolerances given by ???
richter_jp2_conf_files = ['subsampling_1', 'subsampling_2', 'zoo1', 'zoo2']
# foreach(['r_file', richter_jp2_conf_files])
# Build filenames
filenameinput = '${r_file}.jp2'
filenameref = '${r_file}.ppm'
test('NAME', 'ETS-RIC-${filenameInput}-decode', 'COMMAND', 'opj_decompress', '-i', input_conf, '/${filenameInput}', '-o', temp, '/${filenameInput}.ppm')
ric_test_args = ['-n', '1']
test('NAME', 'ETS-RIC-${filenameInput}-compare2ref', 'COMMAND', 'compare_images', '-b', baseline_conf, '/${filenameRef}', '-t', temp, '/${filenameInput}.ppm', ric_test_args, '-p', '4:4:4', '-m', '2:2:2')
# set_tests_properties(['ETS-RIC-${filenameInput}-compare2ref', 'PROPERTIES', 'DEPENDS', 'ETS-RIC-${filenameInput}-decode'])
test('NAME', 'NR-RIC-${filenameInput}-compare2base', 'COMMAND', 'compare_images', '-b', baseline_nr, '/opj_${filenameRef}', '-t', temp, '/${filenameInput}.ppm', ric_test_args, '-d')
# set_tests_properties(['NR-RIC-${filenameInput}-compare2base', 'PROPERTIES', 'DEPENDS', 'ETS-RIC-${filenameInput}-decode'])
# endforeach()
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------
# Tests about dump of profile 0 file
# try to dump image and codestream information into a file
# non regression comparison this file to the baseline
# foreach(['numFileP0', 'RANGE', '1', '16'])
# Build filenames
if numfilep0, 'LESS', '10'
filenameinput = 'p0_0${numFileP0}.j2k'
else
filenameinput = 'p0_${numFileP0}.j2k'
endif
# get_filename_component(['filenameRefSub', filenameinput, 'NAME_WE'])
test('NAME', 'NR-${filenameInput}-dump', 'COMMAND', 'opj_dump', '-i', input_conf, '/${filenameInput}', '-o', temp, '/${filenameInput}.txt')
test('NAME', 'NR-${filenameInput}-compare_dump2base', 'COMMAND', 'compare_dump_files', '-b', baseline_nr, '/opj_v2_${filenameRefSub}.txt', '-t', temp, '/${filenameInput}.txt')
# set_tests_properties(['NR-${filenameInput}-compare_dump2base', 'PROPERTIES', 'DEPENDS', 'NR-${filenameInput}-dump'])
# endforeach()
#--------------------------------------------------------------------------
# Tests about dump of profile 1 file
# try to dump image and codestream information into a file
# non regression comparison this file to the baseline
# foreach(['numFileP1', 'RANGE', '1', '7'])
# Build filenames
filenameinput = 'p1_0${numFileP1}.j2k'
# get_filename_component(['filenameInputSub', filenameinput, 'NAME_WE'])
test('NAME', 'NR-${filenameInput}-dump', 'COMMAND', 'opj_dump', '-i', input_conf, '/${filenameInput}', '-o', temp, '/${filenameInput}.txt')
test('NAME', 'NR-${filenameInput}-compare_dump2base', 'COMMAND', 'compare_dump_files', '-b', baseline_nr, '/opj_v2_${filenameInputSub}.txt', '-t', temp, '/${filenameInput}.txt')
# set_tests_properties(['NR-${filenameInput}-compare_dump2base', 'PROPERTIES', 'DEPENDS', 'NR-${filenameInput}-dump'])
# endforeach()
#--------------------------------------------------------------------------
# Tests about dump of JP2 file
# try to dump image and codestream information into a file
# non regression comparison this file to the baseline
# foreach(['numFileJP2', 'RANGE', '1', '9'])
# Build filenames
filenameinput = 'file${numFileJP2}.jp2'
# get_filename_component(['filenameInputSub', filenameinput, 'NAME_WE'])
test('NAME', 'NR-${filenameInput}-dump', 'COMMAND', 'opj_dump', '-i', input_conf, '/${filenameInput}', '-o', temp, '/${filenameInput}.txt')
test('NAME', 'NR-${filenameInput}-compare_dump2base', 'COMMAND', 'compare_dump_files', '-b', baseline_nr, '/opj_v2_${filenameInputSub}.txt', '-t', temp, '/${filenameInput}.txt')
# set_tests_properties(['NR-${filenameInput}-compare_dump2base', 'PROPERTIES', 'DEPENDS', 'NR-${filenameInput}-dump'])
# endforeach()

84
tests/meson.build Normal file
View File

@ -0,0 +1,84 @@
# Tests
# include_directories([openjpeg_binary_dir, '/src/lib/openjp2', openjpeg_binary_dir, '/src/bin/common', openjpeg_source_dir, '/src/lib/openjp2', openjpeg_source_dir, '/src/bin/jp2', openjpeg_source_dir, '/src/bin/common', z_include_dirname, png_include_dirname, tiff_include_dirname])
# First thing define the common source:
compare_images_srcs = ['compare_images.c', openjpeg_source_dir, '/src/bin/jp2/convert.c', openjpeg_source_dir, '/src/bin/jp2/converttif.c', openjpeg_source_dir, '/src/bin/common/opj_getopt.c']
compare_dump_files_srcs = ['compare_dump_files.c', openjpeg_source_dir, '/src/bin/common/opj_getopt.c']
compare_raw_files_srcs = ['compare_raw_files.c', openjpeg_source_dir, '/src/bin/common/opj_getopt.c']
compare_images_exe = executable('compare_images', compare_images_srcs)
# target_link_libraries(['compare_images', openjpeg_library_name, png_libname, tiff_libname])
compare_dump_files_exe = executable('compare_dump_files', compare_dump_files_srcs)
j2k_random_tile_access_exe = executable('j2k_random_tile_access', 'j2k_random_tile_access.c')
# target_link_libraries(['j2k_random_tile_access', openjpeg_library_name])
compare_raw_files_exe = executable('compare_raw_files', compare_raw_files_srcs)
test_tile_encoder_exe = executable('test_tile_encoder', 'test_tile_encoder.c')
# target_link_libraries(['test_tile_encoder', openjpeg_library_name])
test_decode_area_exe = executable('test_decode_area', 'test_decode_area.c')
# target_link_libraries(['test_decode_area', openjpeg_library_name])
# Let's try a couple of possibilities:
test('NAME', 'tte0', 'COMMAND', 'test_tile_encoder')
test('NAME', 'tte1', 'COMMAND', 'test_tile_encoder', '3', '2048', '2048', '1024', '1024', '8', '1', 'tte1.j2k')
test('NAME', 'tte2', 'COMMAND', 'test_tile_encoder', '3', '2048', '2048', '1024', '1024', '8', '1', 'tte2.jp2')
test('NAME', 'tte3', 'COMMAND', 'test_tile_encoder', '1', '2048', '2048', '1024', '1024', '8', '1', 'tte3.j2k')
test('NAME', 'tte4', 'COMMAND', 'test_tile_encoder', '1', '256', '256', '128', '128', '8', '0', 'tte4.j2k')
test('NAME', 'tte5', 'COMMAND', 'test_tile_encoder', '1', '512', '512', '256', '256', '8', '0', 'tte5.j2k')
#add_test(NAME tte6 COMMAND test_tile_encoder 1 8192 8192 512 512 8 0 tte6.j2k)
#add_test(NAME tte7 COMMAND test_tile_encoder 1 32768 32768 512 512 8 0 tte7.jp2)
test_tile_decoder_exe = executable('test_tile_decoder', 'test_tile_decoder.c')
# target_link_libraries(['test_tile_decoder', openjpeg_library_name])
test('NAME', 'ttd0', 'COMMAND', 'test_tile_decoder')
# set_property(['TEST', 'ttd0', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte0'])
test('NAME', 'ttd1', 'COMMAND', 'test_tile_decoder', '0', '0', '1024', '1024', 'tte1.j2k')
# set_property(['TEST', 'ttd1', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte1'])
test('NAME', 'ttd2', 'COMMAND', 'test_tile_decoder', '0', '0', '1024', '1024', 'tte2.jp2')
# set_property(['TEST', 'ttd2', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte2'])
#add_test(NAME ttd6 COMMAND test_tile_decoder 0 0 512 512 tte6.j2k)
#set_property(TEST ttd6 APPEND PROPERTY DEPENDS tte6)
#add_test(NAME ttd7 COMMAND test_tile_decoder 0 0 512 512 tte7.jp2)
#set_property(TEST ttd7 APPEND PROPERTY DEPENDS tte7)
test('NAME', 'rta1', 'COMMAND', 'j2k_random_tile_access', 'tte1.j2k')
# set_property(['TEST', 'rta1', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte1'])
test('NAME', 'rta2', 'COMMAND', 'j2k_random_tile_access', 'tte2.jp2')
# set_property(['TEST', 'rta2', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte2'])
test('NAME', 'rta3', 'COMMAND', 'j2k_random_tile_access', 'tte3.j2k')
# set_property(['TEST', 'rta3', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte3'])
test('NAME', 'rta4', 'COMMAND', 'j2k_random_tile_access', 'tte4.j2k')
# set_property(['TEST', 'rta4', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte4'])
test('NAME', 'rta5', 'COMMAND', 'j2k_random_tile_access', 'tte5.j2k')
# set_property(['TEST', 'rta5', 'APPEND', 'PROPERTY', 'DEPENDS', 'tte5'])
test('NAME', 'tda_prep_reversible_no_precinct', 'COMMAND', 'test_tile_encoder', '1', '256', '256', '32', '32', '8', '0', 'reversible_no_precinct.j2k', '4', '4', '3', '0', '0', '1')
test('NAME', 'tda_reversible_no_precinct', 'COMMAND', 'test_decode_area', '-q', 'reversible_no_precinct.j2k')
# set_property(['TEST', 'tda_reversible_no_precinct', 'APPEND', 'PROPERTY', 'DEPENDS', 'tda_prep_reversible_no_precinct'])
test('NAME', 'tda_prep_reversible_203_201_17_19_no_precinct', 'COMMAND', 'test_tile_encoder', '1', '203', '201', '17', '19', '8', '0', 'reversible_203_201_17_19_no_precinct.j2k', '4', '4', '3', '0', '0', '1')
test('NAME', 'tda_reversible_203_201_17_19_no_precinct', 'COMMAND', 'test_decode_area', '-q', 'reversible_203_201_17_19_no_precinct.j2k')
# set_property(['TEST', 'tda_reversible_203_201_17_19_no_precinct', 'APPEND', 'PROPERTY', 'DEPENDS', 'tda_prep_reversible_203_201_17_19_no_precinct'])
test('NAME', 'tda_prep_reversible_with_precinct', 'COMMAND', 'test_tile_encoder', '1', '256', '256', '32', '32', '8', '0', 'reversible_with_precinct.j2k', '4', '4', '3', '0', '0', '1', '16', '16')
test('NAME', 'tda_reversible_with_precinct', 'COMMAND', 'test_decode_area', '-q', 'reversible_with_precinct.j2k')
# set_property(['TEST', 'tda_reversible_with_precinct', 'APPEND', 'PROPERTY', 'DEPENDS', 'tda_prep_reversible_with_precinct'])
test('NAME', 'tda_prep_irreversible_no_precinct', 'COMMAND', 'test_tile_encoder', '1', '256', '256', '32', '32', '8', '1', 'irreversible_no_precinct.j2k', '4', '4', '3', '0', '0', '1')
test('NAME', 'tda_irreversible_no_precinct', 'COMMAND', 'test_decode_area', '-q', 'irreversible_no_precinct.j2k')
# set_property(['TEST', 'tda_irreversible_no_precinct', 'APPEND', 'PROPERTY', 'DEPENDS', 'tda_prep_irreversible_no_precinct'])
test('NAME', 'tda_prep_irreversible_203_201_17_19_no_precinct', 'COMMAND', 'test_tile_encoder', '1', '203', '201', '17', '19', '8', '1', 'irreversible_203_201_17_19_no_precinct.j2k', '4', '4', '3', '0', '0', '1')
test('NAME', 'tda_irreversible_203_201_17_19_no_precinct', 'COMMAND', 'test_decode_area', '-q', 'irreversible_203_201_17_19_no_precinct.j2k')
# set_property(['TEST', 'tda_irreversible_203_201_17_19_no_precinct', 'APPEND', 'PROPERTY', 'DEPENDS', 'tda_prep_irreversible_203_201_17_19_no_precinct'])
test('NAME', 'tda_prep_strip', 'COMMAND', 'test_tile_encoder', '1', '256', '256', '256', '256', '8', '0', 'tda_single_tile.j2k')
test('NAME', 'tda_strip', 'COMMAND', 'test_decode_area', '-q', '-strip_height', '3', '-strip_check', 'tda_single_tile.j2k')
# set_property(['TEST', 'tda_strip', 'APPEND', 'PROPERTY', 'DEPENDS', 'tda_prep_strip'])
include_openjpeg_exe = executable('include_openjpeg', 'include_openjpeg.c')
# No image send to the dashboard if lib PNG is not available.
if 'NOT', 'OPJ_HAVE_LIBPNG'
# message(['WARNING', 'Lib PNG seems to be not available: if you want run the non-regression tests with images reported to the dashboard, you need it (try BUILD_THIRDPARTY)'])
endif
subdir('conformance')
subdir('nonregression')
subdir('unit')
if get_option('build_jpip')
if get_option('build_jpip_server')
#set(s "http://jpip.example.com/myFCGI?target=16.jp2&fsiz=170,170&cnew=http&type=jpp-stream")
s = '${JPIP_SERVER}?target=16.jp2&fsiz=170,170&cnew=http&type=jpp-stream'
p = '${CMAKE_CURRENT_BINARY_DIR}/jpip.dat'
md5 = 'd41d8cd98f00b204e9800998ecf8427e'
test('NAME', 'TestJPIP1', 'COMMAND', cmake_command, '-DD_URL:STRING=${s}', '-DD_FILE:PATH=${p}', '-DEXPECTED_MD5=${md5}', '-P', project_source_dir, '/cmake/JPIPTestDriver.cmake')
endif
endif
ppm2rgb3_exe = executable('ppm2rgb3', 'ppm2rgb3.c')
#add_executable(pdf2jp2 pdf2jp2.c)

View File

@ -0,0 +1,233 @@
# NON-REGRESSION TESTS ON THIS DATASET LOCATED ${OPJ_DATA_ROOT}/input/nonregression
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/Temporary'])
temp = [cmake_current_binary_dir, '/Temporary']
baseline_nr = [opj_data_root, '/baseline/nonregression']
input_nr = [opj_data_root, '/input/nonregression']
input_nr_path = input_nr
temp_path = temp
input_conf_path = [opj_data_root, '/input/conformance']
# need kdu_expand if possible
KAKADU_dep = dependency('KAKADU')
# need jpylyzer if possible
JPYLYZER_dep = dependency('JPYLYZER')
#########################################################################
# GENERATION OF THE TEST SUITE (DUMP)
# Dump all files with the selected extension inside the input directory
# technically opj_dump should simply parse these one, since syntax is ok.
blacklist_jpeg2000_tmp = ['2539.pdf.SIGFPE.706.1712.jp2', '0290cb77c5df21828fa74cf2ab2c84d8.SIGFPE.d25.31.jp2', '26ccf3651020967f7778238ef5af08af.SIGFPE.d25.527.jp2', '4035.pdf.SIGSEGV.d8b.3375.jp2', '3635.pdf.asan.77.2930.jp2', 'issue165.jp2', 'edf_c2_1178956.jp2', 'edf_c2_1000290.jp2', 'edf_c2_1377017.jp2', 'edf_c2_1002767.jp2', 'edf_c2_10025.jp2', 'edf_c2_1000234.jp2', 'edf_c2_225881.jp2', 'edf_c2_1000671.jp2', 'edf_c2_1015644.jp2', 'edf_c2_101463.jp2', 'edf_c2_1674177.jp2', 'edf_c2_1673169.jp2', 'issue418.jp2', 'issue429.jp2', 'issue427-null-image-size.jp2', 'issue427-illegal-tile-offset.jp2', 'issue495.jp2', 'issue820.jp2']
# Define a list of file which should be gracefully rejected:
blacklist_jpeg2000 = [blacklist_jpeg2000_tmp, 'broken1.jp2', 'broken2.jp2', 'broken3.jp2', 'broken4.jp2', 'gdal_fuzzer_assert_in_opj_j2k_read_SQcd_SQcc.patch.jp2', 'gdal_fuzzer_check_comp_dx_dy.jp2', 'gdal_fuzzer_check_number_of_tiles.jp2', 'gdal_fuzzer_unchecked_numresolutions.jp2', 'mem-b2ace68c-1381.jp2', '1851.pdf.SIGSEGV.ce9.948.jp2', '1888.pdf.asan.35.988.jp2', 'issue362-2863.jp2', 'issue362-2866.jp2', 'issue362-2894.jp2', 'issue400.jp2', 'issue364-38.jp2', 'issue364-903.jp2', 'issue393.jp2', 'issue408.jp2', 'issue420.jp2', '27ac957758a35d00d6765a0c86350d9c.SIGFPE.d25.537.jpc', '3672da2f1f67bbecad27d7181b4e9d7c.SIGFPE.d25.805.jpc', 'issue475.jp2', 'issue413.jp2', 'issue823.jp2']
# file(['GLOB_RECURSE', 'OPJ_DATA_NR_LIST', '${INPUT_NR}/*.j2k', '${INPUT_NR}/*.j2c', '${INPUT_NR}/*.jp2', '${INPUT_NR}/*.jpc'])
# foreach(['INPUT_FILENAME', opj_data_nr_list])
# get_filename_component(['INPUT_FILENAME_NAME', input_filename, 'NAME'])
#get_filename_component(INPUT_FILENAME_NAME_WE ${INPUT_FILENAME_NAME} NAME_WE)
# cannot use longest extension function, since some name contains multiples
# dots. Instead write out own shortest extension function:
# string(['FIND', input_filename_name, '.', 'SHORTEST_EXT_POS', 'REVERSE'])
# string(['SUBSTRING', input_filename_name, '0', shortest_ext_pos, 'INPUT_FILENAME_NAME_WE'])
# string(['REGEX', 'MATCH', input_filename_name, 'bad_jpeg2000', blacklist_jpeg2000])
# Dump the input image
test('NAME', 'NR-${INPUT_FILENAME_NAME}-dump', 'COMMAND', 'opj_dump', '-i', input_filename, '-o', temp, '/${INPUT_FILENAME_NAME}.txt', '-v')
if 'bad_jpeg2000'
# set_tests_properties(['NR-${INPUT_FILENAME_NAME}-dump', 'PROPERTIES', 'WILL_FAIL', 'TRUE'])
else
# Compare the dump output with the baseline
test('NAME', 'NR-${INPUT_FILENAME_NAME}-compare_dump2base', 'COMMAND', 'compare_dump_files', '-b', baseline_nr, '/opj_v2_${INPUT_FILENAME_NAME_WE}.txt', '-t', temp, '/${INPUT_FILENAME_NAME}.txt')
# set_tests_properties(['NR-${INPUT_FILENAME_NAME}-compare_dump2base', 'PROPERTIES', 'DEPENDS', 'NR-${INPUT_FILENAME_NAME}-dump'])
endif
# endforeach()
#########################################################################
# GENERATION OF THE TEST SUITE (DECODE AND ENCODE)
# Read one and more input file(s) (located in ${OPJ_DATA_ROOT}/input/nonregression)
# to know which files processed and with which options.
# Configure the test suite file:
# configure_file(['test_suite.ctest.in', '${CMAKE_CURRENT_BINARY_DIR}/test_suite.ctest', '@ONLY'])
# Read the file into a list
# file(['STRINGS', cmake_current_binary_dir, '/test_suite.ctest', 'OPJ_TEST_CMD_LINE_LIST'])
# Try to find and configure and read another test suite file
# file(['GLOB', 'TEST_SUITE_FILES', '*.ctest.in'])
if 'TEST_SUITE_FILES'
# foreach(['TEST_SUITE_FILE', test_suite_files])
# Avoid to process the official test suite
file_already_read = '0'
# get_filename_component(['TEST_SUITE_FILENAME', test_suite_file, 'NAME'])
# string(['REGEX', 'MATCH', '^test_suite.ctest.in$', 'FILE_ALREADY_READ', test_suite_filename])
if 'NOT', 'FILE_ALREADY_READ'
# Configure the additional test suite file:
# get_filename_component(['TEST_SUITE_FILE_SUB', test_suite_file, 'NAME_WE'])
# configure_file(['${TEST_SUITE_FILE}', '${CMAKE_CURRENT_BINARY_DIR}/${TEST_SUITE_FILE_SUB}.ctest', '@ONLY'])
# Read the additional file into a list
# file(['STRINGS', cmake_current_binary_dir, '/${TEST_SUITE_FILE_SUB}.ctest', 'OPJ_TEST_CMD_LINE_LIST_TEMP'])
# Append the list of command
opj_test_cmd_line_list = [opj_test_cmd_line_list, opj_test_cmd_line_list_temp]
endif
# endforeach()
else
# message(['FATAL_ERROR', 'One test suite should be available (test_suite.ctest.in) !!!'])
endif
nonregression_filenames_used =
# Parse the command line found in the file(s)
it_test_enc = '0'
it_test_dec = '0'
# foreach(['OPJ_TEST_CMD_LINE', opj_test_cmd_line_list])
ignore_line_found = '0'
# Replace space by ; to generate a list
# string(['REPLACE', ' ', ';', 'CMD_ARG_LIST', opj_test_cmd_line])
# Check if the first argument begin by the comment sign
# list(['GET', 'CMD_ARG_LIST', '0', 'EXE_NAME'])
if 'EXE_NAME'
# string(['REGEX', 'MATCH', '^#', 'IGNORE_LINE_FOUND', exe_name])
endif
if 'IGNORE_LINE_FOUND', 'OR', 'NOT', 'EXE_NAME'
#message( STATUS "Current line is ignored: ${OPJ_TEST_CMD_LINE}")
else
# Check if the first argument begin by the failed sign
failed_test_found = '0'
# string(['REGEX', 'MATCH', '^!', 'FAILED_TEST_FOUND', exe_name])
if 'FAILED_TEST_FOUND'
# Manage the different cases with the failed sign to remove the first argument which must be opj_compress
failed_test_found_1 = '0'
# string(['REGEX', 'MATCH', '^!opj_compress$|^!opj_decompress$', 'FAILED_TEST_FOUND_1', exe_name])
if 'FAILED_TEST_FOUND_1'
# list(['REMOVE_AT', 'CMD_ARG_LIST', '0'])
else
failed_test_found_2 = '0'
# list(['GET', 'CMD_ARG_LIST', '1', 'EXE_NAME'])
# string(['REGEX', 'MATCH', '^opj_compress$|^opj_decompress$', 'FAILED_TEST_FOUND_2', exe_name])
if 'FAILED_TEST_FOUND_2'
# list(['REMOVE_AT', 'CMD_ARG_LIST', '0'])
# list(['REMOVE_AT', 'CMD_ARG_LIST', '0'])
else
# message(['FATAL_ERROR', '${EXE_NAME} is not the right executable name to encode file (try to use opj_compress or opj_decompress)'])
endif
endif
else
# Check if the first argument is equal to opj_compress
# string(['REGEX', 'MATCH', '^opj_compress$|^opj_compress_no_raw$|^opj_compress_no_raw_lossless$|^opj_decompress$', 'EXE_NAME_FOUND', exe_name])
if 'EXE_NAME_FOUND'
# string(['REGEX', 'MATCH', '^opj_compress$|^opj_compress_no_raw$|^opj_compress_no_raw_lossless$', 'ENC_TEST_FOUND', exe_name])
# string(['REGEX', 'MATCH', '^opj_compress_no_raw$|^opj_compress_no_raw_lossless$', 'NO_RAW', exe_name])
# string(['REGEX', 'MATCH', 'opj_compress_no_raw_lossless', 'LOSSLESS', exe_name])
else
# message(['FATAL_ERROR', '${EXE_NAME} is not the right executable name to encode file (try to use opj_compress)'])
endif
# list(['REMOVE_AT', 'CMD_ARG_LIST', '0'])
endif
# Parse the argument list to find the input filename and output filename
cmd_arg_list_2 = ''
arg_pos = '0'
input_arg_pos = '0'
output_arg_pos = '0'
# foreach(['CMD_ARG_ELT', cmd_arg_list])
# math(['EXPR', 'ARG_POS', '${ARG_POS}+1'])
# string(['COMPARE', 'EQUAL', cmd_arg_elt, '-i', 'INPUT_ARG_FOUND'])
if 'INPUT_ARG_FOUND'
input_arg_pos = arg_pos
input_arg_found = '0'
endif
# string(['COMPARE', 'EQUAL', cmd_arg_elt, '-o', 'OUTPUT_ARG_FOUND'])
if 'OUTPUT_ARG_FOUND'
output_arg_pos = arg_pos
output_arg_found = '0'
endif
# list(['APPEND', 'CMD_ARG_LIST_2', cmd_arg_elt])
# endforeach()
# list(['GET', 'CMD_ARG_LIST_2', input_arg_pos, 'INPUT_FILENAME'])
# get_filename_component(['INPUT_FILENAME_NAME', input_filename, 'NAME'])
# get_filename_component(['INPUT_FILENAME_NAME_WE', input_filename_name, 'NAME_WE'])
# list(['GET', 'CMD_ARG_LIST_2', output_arg_pos, 'OUTPUT_FILENAME'])
# get_filename_component(['OUTPUT_FILENAME_NAME_WE', output_filename, 'NAME_WE'])
#-----
# Now we can add the test suite corresponding to a line command in the file
#-----
# ENCODER TEST SUITE
if 'ENC_TEST_FOUND'
# math(['EXPR', 'IT_TEST_ENC', '${IT_TEST_ENC}+1'])
# Encode an image into the jpeg2000 format
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode', 'COMMAND', 'opj_compress', cmd_arg_list_2)
if 'FAILED_TEST_FOUND'
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode', 'PROPERTIES', 'WILL_FAIL', 'TRUE'])
else
# Dump the encoding file
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump', 'COMMAND', 'opj_dump', '-i', output_filename, '-o', output_filename, '-ENC-${IT_TEST_ENC}.txt')
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode'])
# Compare the dump file with the baseline
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dump2base', 'COMMAND', 'compare_dump_files', '-b', baseline_nr, '/opj_v2_${OUTPUT_FILENAME_NAME_WE}-ENC-${IT_TEST_ENC}.txt', '-t', output_filename, '-ENC-${IT_TEST_ENC}.txt')
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dump2base', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump'])
# Decode the encoding file with kakadu expand command
if 'KDU_EXPAND_EXECUTABLE'
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref', 'COMMAND', kdu_expand_executable, '-i', output_filename, '-o', output_filename, '.raw')
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode'])
if 'NOT', 'NO_RAW'
# Compare the decoding file with baseline generated from the kdu_expand and baseline.j2k
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base', 'COMMAND', 'compare_raw_files', '-b', baseline_nr, '/opj_${OUTPUT_FILENAME_NAME_WE}-ENC-${IT_TEST_ENC}.raw', '-t', output_filename, '.raw')
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref'])
endif
endif
# Test the encoded file is a valid JP2 file
if 'JPYLYZER_EXECUTABLE'
if output_filename, 'MATCHES', '\\.jp2$'
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-jpylyser', 'COMMAND', jpylyzer_executable, output_filename)
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-jpylyser', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode', 'PASS_REGULAR_EXPRESSION', '<isValidJP2>True</isValidJP2>'])
endif
endif
# If lossless compression (simple test is 4 arguments), decompress & compare
# list(['LENGTH', 'CMD_ARG_LIST_2', 'ARG_COUNT'])
if ( ARG_COUNT EQUAL 4 ) OR LOSSLESS
# can we compare with the input image ?
if input_filename_name, 'MATCHES', '\\.tif$'
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode', 'COMMAND', 'opj_decompress', '-i', output_filename, '-o', output_filename, '.lossless.tif')
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode'])
test('NAME', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare', 'COMMAND', 'compare_images', '-b', input_filename, '-t', output_filename, '.lossless.tif', '-n', '1', '-d')
# set_tests_properties(['NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-compare', 'PROPERTIES', 'DEPENDS', 'NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-lossless-decode'])
endif
endif
endif
# DECODER TEST SUITE
else
# string(['FIND', input_filename, 'nonregression', 'nr_pos'])
if nr_pos, 'GREATER', '0'
# list(['APPEND', 'nonregression_filenames_used', input_filename_name])
endif
# math(['EXPR', 'IT_TEST_DEC', '${IT_TEST_DEC}+1'])
# Decode the input image
test('NAME', 'NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode', 'COMMAND', 'opj_decompress', cmd_arg_list_2)
if 'FAILED_TEST_FOUND'
# set_tests_properties(['NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode', 'PROPERTIES', 'WILL_FAIL', 'TRUE'])
else
# if not failed, check against registered md5:
test('NAME', 'NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5', 'COMMAND', cmake_command, '-DREFFILE:STRING=${CMAKE_CURRENT_SOURCE_DIR}/md5refs.txt', '-DOUTFILENAME:STRING=${OUTPUT_FILENAME}', '-P', cmake_current_source_dir, '/checkmd5refs.cmake')
# set_tests_properties(['NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode-md5', 'PROPERTIES', 'DEPENDS', 'NR-DEC-${INPUT_FILENAME_NAME}-${IT_TEST_DEC}-decode'])
# FIXME: add a compare2base function base on raw which
# can output png diff files if necessary
# add_test(NR-${filename}-compare2base
# ${EXECUTABLE_OUTPUT_PATH}/compare_images
# -b ${BASELINE_NR}/opj_${filenameRef}
# -t ${TEMP}/${filename}.pgx
# -n ${nbComponents}
# -d
# -s b_t_
# )
#
# set_tests_properties(NR-${filename}-compare2base
# PROPERTIES DEPENDS
# NR-${filename}-decode)
endif
endif
endif
# endforeach()
existing_filenames =
# foreach(['f', opj_data_nr_list])
# get_filename_component(['ff', f, 'NAME'])
# list(['APPEND', 'existing_filenames', ff])
# endforeach()
if 'existing_filenames'
# list(['REMOVE_ITEM', 'existing_filenames', nonregression_filenames_used])
endif
# keep track of new addition:
# if we reach here, then a J2K files was added but no test is present in
# test_suite.ctest.in:
# foreach(['found_but_no_test', existing_filenames])
test('NAME', 'Found-But-No-Test-${found_but_no_test}', 'COMMAND', cmake_command, '-E', 'echo', '${found_but_no_test}')
# set_tests_properties(['Found-But-No-Test-${found_but_no_test}', 'PROPERTIES', 'WILL_FAIL', 'TRUE'])
# endforeach()

8
tests/unit/meson.build Normal file
View File

@ -0,0 +1,8 @@
# UNIT TESTS
# include_directories([openjpeg_binary_dir, '/src/lib/openjp2', openjpeg_source_dir, '/src/lib/openjp2'])
unit_test = ['testempty0', 'testempty1', 'testempty2']
# foreach(['ut', unit_test])
ut_exe = executable(ut, ut, '.c')
# target_link_libraries([ut, 'openjp2'])
test('NAME', ut, 'COMMAND', ut)
# endforeach()

14
thirdparty/astyle/meson.build vendored Normal file
View File

@ -0,0 +1,14 @@
astyle_srcs = ['astyle_main.cpp',
'ASBeautifier.cpp',
'ASEnhancer.cpp',
'ASFormatter.cpp',
'ASLocalizer.cpp',
'ASResource.cpp']
# No warnings for astyle build
# if cc.get_id() == 'clang-cl'
# linker_flags = '${CMAKE_EXE_LINKER_FLAGS} -lstdc++'
# endif
opjstyle_exe = executable('opjstyle', astyle_srcs)

36
thirdparty/liblcms2/meson.build vendored Normal file
View File

@ -0,0 +1,36 @@
lcms2_srcs = [ 'src/cmsalpha.c'
, 'src/cmscgats.c'
, 'src/cmserr.c'
, 'src/cmsgmt.c'
, 'src/cmsintrp.c'
, 'src/cmsio1.c'
, 'src/cmsmd5.c'
, 'src/cmsnamed.c'
, 'src/cmspack.c'
, 'src/cmsplugin.c'
, 'src/cmssamp.c'
, 'src/cmstypes.c'
, 'src/cmswtpnt.c'
, 'src/cmscam02.c'
, 'src/cmscnvrt.c'
, 'src/cmsgamma.c'
, 'src/cmshalf.c'
, 'src/cmsio0.c'
, 'src/cmslut.c'
, 'src/cmsmtrx.c'
, 'src/cmsopt.c'
, 'src/cmspcs.c'
, 'src/cmsps2.c'
, 'src/cmssm.c'
, 'src/cmsvirt.c'
, 'src/cmsxform.c'
]
inc_dirs = include_directories('include')
liblcms2_lib = static_library('lcms2', lcms2_srcs,
include_directories : inc_dirs
)
liblcms2_dep = declare_dependency(link_with : liblcms2_lib,
include_directories : inc_dirs)

39
thirdparty/libpng/meson.build vendored Normal file
View File

@ -0,0 +1,39 @@
libpng_srcs = ['png.c',
'pngmem.c',
'pngrio.c',
'pngset.c',
'pngwrite.c',
'pngerror.c',
'pngpread.c',
'pngrtran.c',
'pngtrans.c',
'pngwtran.c',
'pngget.c',
'pngread.c',
'pngrutil.c',
'pngwio.c',
'pngwutil.c'
]
libpng_headers = [ 'pngconf.h'
, 'pngdebug.h'
, 'png.h'
, 'pnginfo.h'
, 'pnglibconf.h'
, 'pngpriv.h'
, 'pngstruct.h'
]
inc_dirs = include_directories('.')
ext_hdrs = ['/thirdparty/include/zlib.h', '/thirdparty/include/zconf.h']
libpng_lib = static_library('png', libpng_srcs
, include_directories : inc_dirs
, dependencies : [zlib_dep]
)
libpng_dep = declare_dependency(link_with : libpng_lib,
include_directories : inc_dirs)

View File

@ -221,6 +221,7 @@ else()
message(FATAL_ERROR "unknown ssize_t")
endif()
else()
set(TIFF_SSIZE_FORMAT "%ld")
set(TIFF_SSIZE_T ssize_t)
endif()
set(TIFF_INT32_FORMAT "%d")

312
thirdparty/libtiff/meson.build vendored Normal file
View File

@ -0,0 +1,312 @@
libtiff_srcs = ['tif_aux.c'
, 'tif_close.c'
, 'tif_codec.c'
, 'tif_color.c'
, 'tif_compress.c'
, 'tif_dir.c'
, 'tif_dirinfo.c'
, 'tif_dirread.c'
, 'tif_dirwrite.c'
, 'tif_dumpmode.c'
, 'tif_error.c'
, 'tif_extension.c'
, 'tif_fax3.c'
, 'tif_fax3sm.c'
, 'tif_flush.c'
, 'tif_getimage.c'
, 'tif_jbig.c'
, 'tif_jpeg.c'
, 'tif_luv.c'
, 'tif_lzw.c'
, 'tif_next.c'
, 'tif_ojpeg.c'
, 'tif_open.c'
, 'tif_packbits.c'
, 'tif_pixarlog.c'
, 'tif_predict.c'
, 'tif_print.c'
, 'tif_read.c'
, 'tif_strip.c'
, 'tif_swab.c'
, 'tif_thunder.c'
, 'tif_tile.c'
, 'tif_version.c'
, 'tif_warning.c'
, 'tif_write.c'
, 'tif_zip.c'
, 'tif_jpeg_12.c'
, 'tif_lzma.c']
libtiff_hdrs = ['t4.h', 'tiffiop.h', 'tif_dir.h', 'tif_fax3.h', 'tif_predict.h', 'uvcode.h']
inc_dirs = include_directories('.')
c_tif_config_data = configuration_data()
c_tiffconf_data = configuration_data()
libtiff_c_args = []
if host_system == 'linux'
libtiff_srcs += ['tif_unix.c']
libtiff_c_args += ['-D_FILE_OFFSET_BITS=64']
# Large file support
# This might not catch every possibility catered for by
# AC_SYS_LARGEFILE.
c_tif_config_data.set('_FILE_OFFSET_BITS',64)
else
libtiff_srcs += ['tif_win32.c']
endif
# test_big_endian('WORDS_BIGENDIAN')
# host_bigendian = words_bigendian
if host_machine.endian() == 'big'
c_tiffconf_data.set('HOST_FILLORDER', 'FILLORDER_MSB2LSB')
else
c_tiffconf_data.set('HOST_FILLORDER', 'FILLORDER_LSB2MSB')
endif
libjpeg_dep = dependency('libjpeg')
c_tiffconf_data.set('JPEG_SUPPORT', 0)
if libjpeg_dep.found()
c_tiffconf_data.set('JPEG_SUPPORT', 1)
endif
c_tiffconf_data.set('ZIP_SUPPORT', 0)
if zlib_dep.found()
c_tiffconf_data.set('ZIP_SUPPORT', 1)
c_tiffconf_data.set('PIXARLOG_SUPPORT', 1)
endif
check_headers = [
['HAVE_ASSERT_H', 'assert.h'],
['HAVE_CTYPE_H', 'ctype.h'],
['HAVE_DLFCN_H', 'dlfcn.h'],
['HAVE_FCNTL_H', 'fcntl.h'],
['HAVE_FLOAT_H', 'float.h'],
['HAVE_INTTYPES_H', 'inttypes.h'],
['HAVE_IEEEFP_H', 'ieeefp.h'],
['HAVE_IO_H', 'io.h'],
['HAVE_LIMITS_H', 'limits.h'],
['HAVE_MALLOC_H', 'malloc.h'],
['HAVE_MATH_H', 'math.h'],
['HAVE_MEMORY_H', 'memory.h'],
['HAVE_SEARCH_H', 'search.h'],
['HAVE_STDARG_H', 'stdarg.h'],
['HAVE_STDINT_H', 'stdint.h'],
['HAVE_STDLIB_H', 'stdlib.h'],
['HAVE_STDIO_H', 'stdio.h'],
['HAVE_STRING_H', 'string.h'],
['HAVE_STRINGS_H', 'strings.h'],
['HAVE_SYS_STAT_H', 'sys/stat.h'],
['HAVE_SYS_TIME_H', 'sys/time.h'],
['HAVE_SYS_TYPES_H', 'sys/types.h'],
['HAVE_TIME_H', 'time.h'],
['HAVE_UNISTD_H', 'unistd.h'],
['HAVE_WINDOWS_H', 'windows.h'],
['HAVE_WINSOCK2_H', 'winsock2.h']
]
foreach h : check_headers
if cc.has_header(h.get(1))
c_tif_config_data.set(h.get(0), 1)
endif
endforeach
# wotsit ?
if c_tif_config_data.get('HAVE_TIME_H') == 1 and c_tif_config_data.get('HAVE_SYS_TIME_H') == 1
c_tiffconf_data.set('TIME_WITH_SYS_TIME', 1)
endif
c_tiffconf_data.set('LZMA_SUPPORT', 0)
c_tiffconf_data.set('MDI_SUPPORT', 1)
c_tiffconf_data.set('STDC_HEADERS', 1)
# why not ?
c_tiffconf_data.set('DEFAULT_EXTRASAMPLE_AS_ALPHA', 1)
c_tif_config_data.set('CHECK_JPEG_YCBCR_SUBSAMPLING', 1)
c_tif_config_data.set('CCITT_SUPPORT', 1)
c_tiffconf_data.set('DEFER_STRILE_LOAD', 0)
c_tiffconf_data.set('HAVE_JBG_NEWLEN', 0)
# FIXME: jbigkit stuff
c_tiffconf_data.set('STRIPCHOP_DEFAULT', 'TIFF_STRIPCHOP')
c_tif_config_data.set('STRIP_SIZE_DEFAULT', 8192)
c_tiffconf_data.set('SUBIFD_SUPPORT', 1)
c_tiffconf_data.set('THUNDER_SUPPORT', 1)
check_functions = [
['getopt', 'HAVE_GETOPT'],
['isascii', 'HAVE_ISASCII'],
['memmove', 'HAVE_MEMMOVE'],
['memset', 'HAVE_MEMSET'],
['mmap', 'HAVE_MMAP'],
['strcasecmp', 'HAVE_STRCASECMP'],
['strchr', 'HAVE_STRCHR'],
['strrchr', 'HAVE_STRRCHR'],
['strstr', 'HAVE_STRSTR'],
['strtol', 'HAVE_STRTOL'],
['strtoul', 'HAVE_STRTOUL'],
['strtoull', 'HAVE_STRTOULL'],
]
foreach h : check_functions
if cc.has_function(h.get(0))
c_tif_config_data.set(h.get(1), 1)
else
c_tif_config_data.set(h.get(1), 0)
endif
endforeach
if cc.has_function('snprintf') or cc.has_header_symbol('stdio.h', 'snprintf')
c_tif_config_data.set('HAVE_SNPRINTF', 1)
else
libtiff_srcs += ['snprintf.c']
endif
c_tif_config_data.set('SIZEOF_SIGNED_INT', cc.sizeof('signed int'))
c_tif_config_data.set('SIZEOF_SIGNED_LONG', cc.sizeof('signed long'))
c_tif_config_data.set('SIZEOF_SIGNED_LONG_LONG', cc.sizeof('signed long long'))
c_tif_config_data.set('SIZEOF_SIGNED_SHORT', cc.sizeof('signed short'))
c_tif_config_data.set('SIZEOF_UNSIGNED_INT', cc.sizeof('unsigned int'))
c_tif_config_data.set('SIZEOF_UNSIGNED_LONG', cc.sizeof('unsigned long'))
c_tif_config_data.set('SIZEOF_UNSIGNED_LONG_LONG', cc.sizeof('unsigned long long'))
c_tif_config_data.set('SIZEOF_UNSIGNED_SHORT', cc.sizeof('unsigned short'))
c_tif_config_data.set('SIZEOF_UNSIGNED_CHAR_P', cc.sizeof('unsigned char*'))
if cc.sizeof('ssize_t') != -1
c_tiffconf_data.set('HAVE_SSIZE_T', 1)
endif
if c_tif_config_data.get('HAVE_STDINT_H') == 1
c_tiffconf_data.set('TIFF_INT8_T', 'int8_t')
c_tiffconf_data.set('TIFF_INT16_T', 'int16_t')
c_tiffconf_data.set('TIFF_INT32_T', 'int32_t')
c_tiffconf_data.set('TIFF_INT64_T', 'int64_t')
c_tiffconf_data.set('TIFF_UINT8_T', 'uint8_t')
c_tif_config_data.set('TIFF_UINT8_T', 'uint8_t')
c_tiffconf_data.set('TIFF_UINT16_T', 'uint16_t')
c_tiffconf_data.set('TIFF_UINT32_T', 'uint32_t')
c_tiffconf_data.set('TIFF_UINT64_T', 'uint64_t')
c_tiffconf_data.set('TIFF_PTRDIFF_T', 'ptrdiff_t')
if not c_tiffconf_data.has('HAVE_SSIZE_T')
voidp_size = cc.sizeof('void*')
if voidp_size == 8
c_tiffconf_data.set('TIFF_SSIZE_T', 'int64_t')
c_tif_config_data.set('TIFF_SSIZE_FORMAT', '%lld')
c_tif_config_data.set('TIFF_SIZE_FORMAT', '%llu')
elif voidp_size == 4
c_tiffconf_data.set('TIFF_SSIZE_T', 'int32_t')
c_tif_config_data.set('TIFF_SSIZE_FORMAT', '%d')
c_tif_config_data.set('TIFF_SIZE_FORMAT', '%u')
else
error('FATAL_ERROR: unknown ssize_t')
endif
else
c_tif_config_data.set('TIFF_SSIZE_FORMAT', '%ld')
c_tiffconf_data.set('TIFF_SSIZE_T', 'ssize_t')
endif
c_tif_config_data.set('TIFF_INT32_FORMAT', '%d')
c_tif_config_data.set('TIFF_UINT32_FORMAT', '%u')
c_tif_config_data.set('TIFF_INT64_FORMAT', '%lld')
c_tif_config_data.set('TIFF_UINT64_FORMAT', '%lu')
c_tif_config_data.set('TIFF_PTRDIFF_FORMAT', '%ld')
else
c_tiffconf_data.set('TIFF_INT8_T', 'signed __int8')
c_tiffconf_data.set('TIFF_INT16_T', 'signed __int16')
c_tiffconf_data.set('TIFF_INT32_T', 'signed __int32')
c_tiffconf_data.set('TIFF_INT64_T', 'signed __int64')
c_tif_config_data.set('TIFF_UINT8_T', 'unsigned __int8')
c_tiffconf_data.set('TIFF_UINT8_T', 'unsigned __int8')
c_tiffconf_data.set('TIFF_UINT16_T', 'unsigned __int16')
c_tiffconf_data.set('TIFF_UINT32_T', 'unsigned __int32')
c_tiffconf_data.set('TIFF_UINT64_T', 'unsigned __int64')
c_tiffconf_data.set('TIFF_PTRDIFF_T', 'ptrdiff_t')
if not c_tiffconf_data.has('HAVE_SSIZE_T')
voidp_size = cc.sizeof('void*')
if voidp_size == 8
c_tiffconf_data.set('TIFF_SSIZE_T', 'signed __int64')
c_tiffconf_data.set('TIFF_SSIZE_FORMAT', '%lld')
c_tiffconf_data.set('TIFF_SIZE_FORMAT', '%llu')
elif voidp_size == 4
c_tiffconf_data.set('TIFF_SSIZE_T', 'signed __int32')
c_tiffconf_data.set('TIFF_SSIZE_FORMAT', '%d')
c_tiffconf_data.set('TIFF_SIZE_FORMAT', '%u')
else
# message(['FATAL_ERROR', 'unknown ssize_t'])
endif
else
c_tiffconf_data.set('TIFF_SSIZE_T', 'ssize_t')
endif
c_tif_config_data.set('TIFF_INT32_FORMAT', '%d')
c_tif_config_data.set('TIFF_UINT32_FORMAT', '%u')
c_tif_config_data.set('TIFF_INT64_FORMAT', '%lld')
c_tif_config_data.set('TIFF_UINT64_FORMAT', '%llu')
c_tif_config_data.set('TIFF_PTRDIFF_FORMAT', '%ld')
endif
#
version = '"4.0.6"'
c_tif_config_data.set('VERSION', version)
c_tif_config_data.set('PACKAGE_VERSION', version)
c_tif_config_data.set('PACKAGE', '"tiff"')
# universal build ?
if host_system == 'darwin'
ac_apple_universal_build = '1'
endif
if host_system == 'linux'
cmake_required_libraries = 'm'
have_libm = '1'
endif
check_funcs = [
['floor', 'HAVE_FLOOR', ''],
['sqrt', 'HAVE_SQRT', ''],
['pow', 'HAVE_POW', ''],
['lfind', 'HAVE_LFIND', ''],
['setmod', 'HAVE_SETMODE', '']
]
foreach h : check_funcs
if cc.has_function(h.get(0))
c_tif_config_data.set(h.get(1), 1)
endif
endforeach
code = '''
typedef int foo_t;
static inline foo_t static_foo(){return 0;}
foo_t foo(){return 0;}
int main(int argc, char *argv[]){return 0;}
'''
c_inline = false
foreach keyword : ['inline', '__inline__', '__inline']
c_args = '-Dinline=' + keyword
if not c_inline
result = cc.compiles(code, name : 'basic inline', args : c_args)
if result
c_tif_config_data.set('INLINE_KEYWORD', keyword)
c_inline = true
endif
endif
endforeach
configure_file(input: 'tif_config.h.cmake.in', output : 'tif_config.h', configuration : c_tif_config_data, format : 'cmake@')
configure_file(input: 'tiffconf.h.cmake.in', output : 'tiffconf.h', configuration : c_tiffconf_data)
libtiff_lib = static_library('libtiff', libtiff_srcs)
libtiff_dep = declare_dependency(link_with : libtiff_lib,
include_directories : inc_dirs)

49
thirdparty/libz/meson.build vendored Normal file
View File

@ -0,0 +1,49 @@
z_c_args = []
z_link_args = []
inc_dirs = include_directories('.', '../include')
check_headers = [
['HAVE_STDINT_H', 'stdint.h'],
['HAVE_STDIO_H', 'stddef.h'],
['HAVE_SYS_TYPES_H', 'sys/types.h'],
['Z_HAVE_UNISTD_H', 'unistd.h'],
]
foreach h : check_headers
if cc.has_header(h.get(1))
z_c_args += ['-D'+h.get(0) + '=' + '1']
endif
endforeach
if cc.sizeof('off64_t') != -1
z_c_args += '-D_LARGEFILE64_SOURCE=1'
endif
if not cc.has_function('fseeko')
z_c_args += '-DNO_FSEEKO'
endif
if cc.get_id() == 'gcc' and host_machine.system() == 'linux'
vflag = '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
z_link_args += [vflag]
endif
z_src = ['adler32.c', 'crc32.c', 'deflate.c', 'infback.c', 'inffast.c', 'inflate.c',
'inftrees.c', 'trees.c', 'zutil.c',
'compress.c', 'uncompr.c', 'gzclose.c', 'gzlib.c', 'gzread.c', 'gzwrite.c']
z_headers = ['../include/zconf.h', '../include/zlib.h']
zlib = static_library('z', z_src,
c_args : z_c_args,
link_args : z_link_args,
include_directories : inc_dirs,
install : true,
version : meson.project_version())
zlib_dep = declare_dependency(link_with : zlib,
include_directories : inc_dirs)
install_headers(z_headers)

82
thirdparty/meson.build vendored Normal file
View File

@ -0,0 +1,82 @@
cappdata = configuration_data()
# 3rd party libs
#------------
# Try to find lib Z
if get_option('build_thirdparty')
message('STATUS: We will build Z lib from thirdparty')
subdir('libz')
message('STATUS: We will build PNG lib from thirdparty')
cappdata.set('OPJ_HAVE_LIBPNG', 1)
cappdata.set('OPJ_HAVE_PNG_H', 1)
subdir('libpng')
message('STATUS: We will build TIFF lib from thirdparty')
cappdata.set('OPJ_HAVE_LIBTIFF', 1)
cappdata.set('OPJ_HAVE_TIFF_H', 1)
subdir('libtiff')
message('STATUS: We will build lcms2 lib from thirdparty')
cappdata.set('OPJ_HAVE_LIBLCMS2', 1)
cappdata.set('OPJ_HAVE_LCMS2_H', 1)
subdir('liblcms2')
else
zlib_dep = dependency('zlib', required : false)
if not zlib_dep.found()
if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
zlib_dep = cc.find_library('z', required : false)
else
zlib_dep = cc.find_library('zlib1', required : false)
if not zlib_dep.found()
zlib_dep = cc.find_library('zlib', required : false)
endif
endif
if not zlib_dep.found() or not cc.has_header('zlib.h')
zlib_dep = subproject('zlib').get_variable('zlib_dep')
endif
# fallback on third party folder
if zlib_dep.found()
message('STATUS: Your system seems to have a Z lib available, we will use it to generate Z lib')
else
message('STATUS: We will build Z lib from thirdparty folder')
subdir('libz')
endif
endif
# Try to find libpng first
cappdata.set('OPJ_HAVE_LIBPNG', 1)
cappdata.set('OPJ_HAVE_PNG_H', 1)
libpng_dep = dependency('libpng', required : false)
if libpng_dep.found()
message('STATUS: Your system seems to have a png lib available, we will use it to generate PNG lib')
else
subdir('libpng')
message('STATUS: libpng not found, We will build libpng from thirdparty folder')
endif
# Try to find libtiff first
cappdata.set('OPJ_HAVE_LIBTIFF', 1)
cappdata.set('OPJ_HAVE_TIFF_H', 1)
libtiff_dep = dependency('libtiff', required : false)
if libtiff_dep.found()
message('STATUS: Your system seems to have a tiff lib available, we will use it instead of thirdparty')
else
subdir('libtiff')
message('STATUS: tiff not found, We will build libtiff from thirdparty folder')
endif
# Try to find lcms2 first
cappdata.set('OPJ_HAVE_LIBLCMS2', 1)
cappdata.set('OPJ_HAVE_LCMS2_H', 1)
liblcms2_dep = dependency('lcms2', required : false)
if liblcms2_dep.found()
message('STATUS: Your system seems to have a lcms2 lib available, we will use it instead of thirdparty folder')
else
subdir('liblcms2')
message('STATUS: tiff not found, We will build libtiff from thirdparty folder')
endif
endif
#------------TODO
#if get_option('WITH_ASTYLE')
# subdir('astyle')
#endif

View File

@ -0,0 +1,2 @@
#
subdir('openjp2')

View File

@ -0,0 +1,32 @@
#JavaOpenJPEG/CMakeLists.txt
# First thing define the common source:
openjpegjni_srcs = ['JavaOpenJPEGDecoder.c', 'JavaOpenJPEG.c', openjpeg_source_dir, '/src/bin/common/opj_getopt.c', openjpeg_source_dir, '/src/bin/jp2/convert.c', 'index.c']
# JNI binding:
JNI_dep = dependency('JNI')
# include_directories(jni_include_dirs)
# required header file:
# include_directories([openjpeg_binary_dir, '/src/lib/openjp2', openjpeg_source_dir, '/src/lib/openmj2', openjpeg_source_dir, '/src/bin/common', openjpeg_source_dir, '/src/bin/jp2'])
openjpegjni_lib = library('openjpegjni', 'MODULE', openjpegjni_srcs)
# Java module should not have a SONAME:
# set_property(['TARGET', 'openjpegjni', 'PROPERTY', 'NO_SONAME', '1'])
# FIXME (need to use old API):
if get_option('build_mj2')
# target_link_libraries(['openjpegjni', 'openmj2'])
endif
# target_link_libraries(['openjpegjni', png_libname, tiff_libname, lcms_libname, z_libname])
if host_system == 'linux'
# target_link_libraries(['openjpegjni', 'm'])
endif
# install(['TARGETS', 'openjpegjni', 'EXPORT', 'OpenJPEGTargets', 'LIBRARY', 'DESTINATION', openjpeg_install_jni_dir, 'COMPONENT', 'Libraries'])
# build jar:
Java_dep = dependency('Java')
# javac, jar
# build dep list:
# file(['GLOB', 'java_srcs', 'java-sources/org/openJpeg/*.java'])
# make sure target javac dir exists:
# file(['MAKE_DIRECTORY', cmake_current_binary_dir, '/classes'])
# Build java
# add_custom_command(['OUTPUT', library_output_path, '/openjpeg.jar', 'COMMAND', java_javac_executable, '-sourcepath', '${CMAKE_CURRENT_SOURCE_DIR}/java-sources', java_srcs, '-d', cmake_current_binary_dir, '/classes', 'COMMAND', java_jar_executable, 'cvf', library_output_path, '/openjpeg.jar', 'org', 'WORKING_DIRECTORY', cmake_current_binary_dir, '/classes', 'DEPENDS', java_srcs, 'COMMENT', 'javac *.java; jar cvf -> openjpeg.jar'])
# name the target
# add_custom_target(['OpenJPEGJavaJar', 'ALL', 'DEPENDS', library_output_path, '/openjpeg.jar', 'COMMENT', 'building openjpeg.jar'])
# install(['FILES', library_output_path, '/openjpeg.jar', 'DESTINATION', openjpeg_install_share_dir, 'COMPONENT', 'JavaModule'])

4
wrapping/meson.build Normal file
View File

@ -0,0 +1,4 @@
# wrapping
if get_option('build_java')
subdir('java')
endif