Compare commits

..

No commits in common. "master" and "v2.5.0" have entirely different histories.

33 changed files with 306 additions and 508 deletions

3
.gitignore vendored
View File

@ -16,6 +16,3 @@ scripts/opjstyle*
# Ignore directories made by `make`.
/bin/
build
SDK
*.lha

View File

@ -7,7 +7,7 @@
# For this purpose you can define a CMake var: OPENJPEG_NAMESPACE to whatever you like
# e.g.:
# set(OPENJPEG_NAMESPACE "GDCMOPENJPEG")
cmake_minimum_required(VERSION 2.8.5)
cmake_minimum_required(VERSION 2.8.2)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
@ -105,24 +105,55 @@ endif()
# --------------------------------------------------------------------------
# Install directories
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME)
include(GNUInstallDirs)
# Build DOCUMENTATION (not in ALL target and only if Doxygen is found)
option(BUILD_DOC "Build the HTML documentation (with doxygen if available)." OFF)
set(OPENJPEG_INSTALL_SUBDIR "${PROJECT_NAME}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
string(TOLOWER ${PROJECT_NAME} projectname)
set(OPENJPEG_INSTALL_SUBDIR "${projectname}-${OPENJPEG_VERSION_MAJOR}.${OPENJPEG_VERSION_MINOR}")
if(NOT OPENJPEG_INSTALL_BIN_DIR)
set(OPENJPEG_INSTALL_BIN_DIR "bin")
endif()
if(NOT OPENJPEG_INSTALL_LIB_DIR)
set(OPENJPEG_INSTALL_LIB_DIR "lib")
endif()
if(NOT OPENJPEG_INSTALL_SHARE_DIR)
set(OPENJPEG_INSTALL_SHARE_DIR "share")
endif()
if(NOT OPENJPEG_INSTALL_DATA_DIR)
set(OPENJPEG_INSTALL_DATA_DIR "${OPENJPEG_INSTALL_SHARE_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if(NOT OPENJPEG_INSTALL_INCLUDE_DIR)
set(OPENJPEG_INSTALL_INCLUDE_DIR "include/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if(BUILD_DOC)
if(NOT OPENJPEG_INSTALL_MAN_DIR)
set(OPENJPEG_INSTALL_MAN_DIR "share/man/")
endif()
if(NOT OPENJPEG_INSTALL_DOC_DIR)
set(OPENJPEG_INSTALL_DOC_DIR "share/doc/${OPENJPEG_INSTALL_SUBDIR}")
endif()
endif()
if(NOT OPENJPEG_INSTALL_JNI_DIR)
if(WIN32)
set(OPENJPEG_INSTALL_JNI_DIR ${CMAKE_INSTALL_BINDIR})
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_BIN_DIR})
else()
set(OPENJPEG_INSTALL_JNI_DIR ${CMAKE_INSTALL_LIBDIR})
set(OPENJPEG_INSTALL_JNI_DIR ${OPENJPEG_INSTALL_LIB_DIR})
endif()
endif()
if(NOT OPENJPEG_INSTALL_PACKAGE_DIR)
set(OPENJPEG_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${OPENJPEG_INSTALL_SUBDIR}")
# We could install *.cmake files in share/ however those files contains
# hardcoded path to libraries on a multi-arch system (fedora/debian) those
# path will be different (lib/i386-linux-gnu vs lib/x86_64-linux-gnu)
set(OPENJPEG_INSTALL_PACKAGE_DIR "${OPENJPEG_INSTALL_LIB_DIR}/${OPENJPEG_INSTALL_SUBDIR}")
endif()
if (APPLE)
@ -130,7 +161,7 @@ if (APPLE)
# For cmake >= 3.0, we turn on CMP0042 and
# https://cmake.org/cmake/help/v3.0/policy/CMP0042.html mentions
# "Projects wanting @rpath in a targets install name may remove any setting of the INSTALL_NAME_DIR and CMAKE_INSTALL_NAME_DIR variables"
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
list(APPEND OPENJPEG_LIBRARY_PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${OPENJPEG_INSTALL_LIB_DIR}")
endif()
option(OPJ_USE_DSYMUTIL "Call dsymutil on binaries after build." OFF)
endif()
@ -304,28 +335,25 @@ if(BUILD_TESTING)
endif()
#-----------------------------------------------------------------------------
# install all targets referenced as OPENJPEGTargets (relocatable with CMake 3.0+)
# install all targets referenced as OPENJPEGTargets
install(EXPORT OpenJPEGTargets DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR})
if (${CMAKE_VERSION} VERSION_LESS 3.0)
set(PACKAGE_INIT)
set(PACKAGE_CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR})
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
@ONLY
)
else()
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/OpenJPEGConfig.cmake.in
${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
INSTALL_DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
PATH_VARS CMAKE_INSTALL_INCLUDEDIR)
endif()
configure_file( ${${OPENJPEG_NAMESPACE}_SOURCE_DIR}/cmake/OpenJPEGConfig.cmake.in
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/OpenJPEGConfig.cmake
@ONLY
)
install( FILES ${OPENJPEG_BINARY_DIR}/OpenJPEGConfig.cmake
DESTINATION ${OPENJPEG_INSTALL_PACKAGE_DIR}
)
#-----------------------------------------------------------------------------
# install CHANGES and LICENSE
if(BUILD_DOC)
if(EXISTS ${OPENJPEG_SOURCE_DIR}/CHANGES)
install(FILES CHANGES DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
install(FILES LICENSE DESTINATION ${OPENJPEG_INSTALL_DOC_DIR})
endif()
include (cmake/OpenJPEGCPack.cmake)
@ -338,30 +366,18 @@ else()
option(BUILD_PKGCONFIG_FILES "Build and install pkg-config files" OFF)
endif()
if(BUILD_PKGCONFIG_FILES)
macro(set_variable_from_rel_or_absolute_path var root rel_or_abs_path)
if(IS_ABSOLUTE "${rel_or_abs_path}")
set(${var} "${rel_or_abs_path}")
else()
set(${var} "${root}/${rel_or_abs_path}")
endif()
endmacro()
set_variable_from_rel_or_absolute_path("bindir" "\\\${prefix}" "${CMAKE_INSTALL_BINDIR}")
set_variable_from_rel_or_absolute_path("mandir" "\\\${prefix}" "${CMAKE_INSTALL_MANDIR}")
set_variable_from_rel_or_absolute_path("docdir" "\\\${prefix}" "${CMAKE_INSTALL_DOCDIR}")
set_variable_from_rel_or_absolute_path("libdir" "\\\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
set_variable_from_rel_or_absolute_path("includedir" "\\\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR}")
# install in lib and not share (CMAKE_INSTALL_LIBDIR takes care of it for multi-arch)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjp2/libopenjp2.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjp2.pc DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig )
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
#
if(BUILD_JPIP)
# install in lib and not share (see multi-arch note above)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/lib/openjpip/libopenjpip.pc.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc @ONLY)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libopenjpip.pc DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig )
${OPENJPEG_INSTALL_LIB_DIR}/pkgconfig )
endif()
endif()

View File

@ -12,17 +12,6 @@ Check-list OpenJPEG Release
* update release description if needed
* update openjpeg.json with latest release
* update OPJ_LATEST_VERSION in abi-check.sh, uncomment and update OPJ_PREVIOUS_VERSION in abi-check.sh, and push
* locally run: OPJ_CI_ABI_CHECK=1 ./tools/travis-ci/abi-check.sh
* cd ~/abi-check/work/abi-check/
* put the sources of the new version in src/openjpeg/2.X.0/version.-2.X.0.tar.gz
* PATH=$PWD/../../tools/abi-tracker/bin:$PWD/../../tools/wdiff/bin:$PWD/../../tools:$PATH abi-monitor -v 2.X.0 -build ./openjpeg.json
* PATH=$PWD/../../tools/abi-tracker/bin:$PWD/../../tools/wdiff/bin:$PWD/../../tools:$PATH abi-tracker -build ./openjpeg.json
* rm -rf src/openjpeg/current
* rm -rf build_logs
* git add --all .
* git commit -m "Update ABI/API compatibility reports after 2.X.0 release"
* git push
* cd ~/openjpeg/openjpeg
* comment back OPJ_PREVIOUS_VERSION and push
* build doc and update Doxygen on website
* manual build on Windows:

View File

@ -1,55 +0,0 @@
USE_CLIB2=YES
ifeq ($(USE_CLIB2), YES)
LIBC=clib2
CODEC=OFF
else
LIBC=newlib
CODEC=ON
endif
all: build
build:
mkdir build && \
cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_TOOLCHAIN_FILE=$(realpath amigaos4.cmake) \
-DCMAKE_C_FLAGS="-mcrt=${LIBC} -O2 -fPIC" \
-DCMAKE_MODULE_LINKER_FLAGS="-mcrt=${LIBC} -lpthread -athread=native" \
-DBUILD_TESTING=OFF \
-DBUILD_CODEC=${CODEC} \
-DBUILD_SHARED_LIBS=OFF && \
make
clean:
@echo "Clean the build"
@rm -rf build
cleanall: clean
@echo "Clean the build and the release files"
@rm -rf SDK
@rm libopenjpeg.lha
release:
@echo "Create release folders..."
@mkdir -p SDK/local/common/include
@mkdir -p SDK/local/clib2/lib
@mkdir -p SDK/local/newlib/lib SDK/local/newlib/bin
@echo "Building clib2 based libraries..."
@make -f Makefile.os4 USE_CLIB2=YES
@cp ./build/bin/libopenjp2.a SDK/local/clib2/lib/
@cp ./src/lib/openjp2/openjpeg.h SDK/local/common/include/
@echo "Clean build and libraries files..."
@make -f Makefile.os4 clean
@echo "Building newlib based libraries..."
@make -f Makefile.os4 USE_CLIB2=NO
@cp ./build/bin/libopenjp2.a SDK/local/newlib/lib/
@cp ./build/bin/opj_* SDK/local/newlib/bin/
@echo "Creating the lha release file..."
@lha -aeq libopenjpeg.lha SDK/

View File

@ -1,9 +0,0 @@
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_PROCESSOR ppc)
SET(CMAKE_C_COMPILER /opt/ppc-amigaos/bin/ppc-amigaos-gcc)
SET(CMAKE_CXX_COMPILER /opt/ppc-amigaos/bin/ppc-amigaos-g++)
SET(CMAKE_FIND_LIBRARY_SUFFIXES "*.a")
SET(CMAKE_FIND_ROOT_PATH /opt/sdk)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -5,7 +5,6 @@
# This file is configured by OPENJPEG and used by the UseOPENJPEG.cmake
# module to load OPENJPEG's settings for an external project.
@OPENJPEG_CONFIG_INSTALL_ONLY@
@PACKAGE_INIT@
# The OPENJPEG version number.
set(OPENJPEG_MAJOR_VERSION "@OPENJPEG_VERSION_MAJOR@")
set(OPENJPEG_MINOR_VERSION "@OPENJPEG_VERSION_MINOR@")
@ -28,8 +27,12 @@ if(EXISTS ${SELF_DIR}/OpenJPEGTargets.cmake)
# This is an install tree
include(${SELF_DIR}/OpenJPEGTargets.cmake)
set(INC_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/@OPENJPEG_INSTALL_SUBDIR@")
get_filename_component(OPENJPEG_INCLUDE_DIRS "${INC_DIR}" ABSOLUTE)
# We find a relative path from the PKG directory to header files.
set(PKG_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_PACKAGE_DIR@")
set(INC_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_INCLUDE_DIR@")
file(RELATIVE_PATH PKG_TO_INC_RPATH "${PKG_DIR}" "${INC_DIR}")
get_filename_component(OPENJPEG_INCLUDE_DIRS "${SELF_DIR}/${PKG_TO_INC_RPATH}" REALPATH)
else()
if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake)

View File

@ -44,7 +44,7 @@ if(DOXYGEN_FOUND)
# install HTML documentation (install png files too):
install(DIRECTORY ${CMAKE_BINARY_DIR}/doc/html
DESTINATION ${CMAKE_INSTALL_DOCDIR}
DESTINATION ${OPENJPEG_INSTALL_DOC_DIR}
PATTERN ".svn" EXCLUDE
)
else()

View File

@ -67,7 +67,7 @@ foreach(exe opj_decompress opj_compress opj_dump)
# Install exe
install(TARGETS ${exe}
EXPORT OpenJPEGTargets
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
if(OPJ_USE_DSYMUTIL)
add_custom_command(TARGET ${exe} POST_BUILD
@ -83,6 +83,6 @@ 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 ${CMAKE_INSTALL_MANDIR}/man1)
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man1)
#
endif()

View File

@ -846,7 +846,7 @@ static int parse_cmdline_encoder(int argc, char **argv,
/* ----------------------------------------------------- */
case 'q': { /* layer allocation by distortion ratio (PSNR) */
case 'q': { /* add fixed_quality */
char *s = opj_optarg;
while (sscanf(s, "%f", &parameters->tcp_distoratio[parameters->tcp_numlayers])
== 1) {
@ -866,7 +866,7 @@ static int parse_cmdline_encoder(int argc, char **argv,
/* dda */
/* ----------------------------------------------------- */
case 'f': { /* layer allocation by fixed layer */
case 'f': { /* mod fixed_quality (before : -q) */
int *row = NULL, *col = NULL;
OPJ_UINT32 numlayers = 0, numresolution = 0, matrix_width = 0;
@ -1812,7 +1812,7 @@ static int parse_cmdline_encoder(int argc, char **argv,
parameters->cp_fixed_quality))) {
fprintf(stderr, "[ERROR] options -r -q and -f cannot be used together !!\n");
return 1;
}
} /* mod fixed_quality */
/* if no rate entered, lossless by default */

View File

@ -13,7 +13,7 @@ add_executable(opj_jpip_addxml opj_jpip_addxml.c)
# Install exe
install(TARGETS opj_jpip_addxml
EXPORT OpenJPEGTargets
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
if(BUILD_JPIP_SERVER)
@ -38,7 +38,7 @@ if(BUILD_JPIP_SERVER)
# Install exe
install(TARGETS opj_server
EXPORT OpenJPEGTargets
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
endif()
@ -52,7 +52,7 @@ add_executable(${exe} ${exe}.c)
target_link_libraries(${exe} openjpip)
install(TARGETS ${exe}
EXPORT OpenJPEGTargets
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
endforeach()
@ -123,7 +123,7 @@ if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
)
install(FILES ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} COMPONENT JavaModule
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
)
else()
# opj_viewer (simple, no xerces)
@ -153,7 +153,7 @@ if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
)
install(FILES ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} COMPONENT JavaModule
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
)
endif()
else()

View File

@ -2,7 +2,7 @@ include_regular_expression("^.*$")
#
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/opj_config.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR} COMPONENT Headers)
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers)
include_directories(
${${OPENJPEG_NAMESPACE}_BINARY_DIR}/src/lib/openjp2 # opj_config.h and opj_config_private.h
@ -117,21 +117,21 @@ endif()
# Install library
install(TARGETS ${INSTALL_LIBS}
EXPORT OpenJPEGTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
# Install includes files
install(FILES openjpeg.h opj_stdint.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR} COMPONENT Headers
DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR} COMPONENT Headers
)
if(BUILD_DOC)
# install man page of the library
install(
FILES ${OPENJPEG_SOURCE_DIR}/doc/man/man3/libopenjp2.3
DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
DESTINATION ${OPENJPEG_INSTALL_MAN_DIR}/man3)
endif()
if(BUILD_LUTS_GENERATOR)

View File

@ -43,6 +43,12 @@
/** @name Local static functions */
/*@{*/
/**
Write a bit
@param bio BIO handle
@param b Bit to write (0 or 1)
*/
static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b);
/**
Read a bit
@param bio BIO handle
@ -94,6 +100,16 @@ static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio)
return OPJ_TRUE;
}
static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b)
{
if (bio->ct == 0) {
opj_bio_byteout(
bio); /* MSD: why not check the return value of this function ? */
}
bio->ct--;
bio->buf |= b << bio->ct;
}
static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio)
{
if (bio->ct == 0) {
@ -146,16 +162,6 @@ void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len)
bio->ct = 0;
}
void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b)
{
if (bio->ct == 0) {
opj_bio_byteout(
bio); /* MSD: why not check the return value of this function ? */
}
bio->ct--;
bio->buf |= b << bio->ct;
}
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n)
{
OPJ_INT32 i;

View File

@ -106,14 +106,6 @@ Write bits
@param n Number of bits to write
*/
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n);
/**
Write a bit
@param bio BIO handle
@param b Bit to write (0 or 1)
*/
void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b);
/**
Read bits
@param bio BIO handle

View File

@ -69,7 +69,7 @@ static OPJ_BOOL only_cleanup_pass_is_decoded = OPJ_FALSE;
static INLINE
OPJ_UINT32 population_count(OPJ_UINT32 val)
{
#if defined(OPJ_COMPILER_MSVC) && (defined(_M_IX86) || defined(_M_AMD64))
#ifdef OPJ_COMPILER_MSVC
return (OPJ_UINT32)__popcnt(val);
#elif (defined OPJ_COMPILER_GNUC)
return (OPJ_UINT32)__builtin_popcount(val);
@ -294,7 +294,7 @@ void mel_decode(dec_mel_t *melp)
* @param [in] scup is the length of MEL+VLC segments
*/
static INLINE
OPJ_BOOL mel_init(dec_mel_t *melp, OPJ_UINT8* bbuf, int lcup, int scup)
void mel_init(dec_mel_t *melp, OPJ_UINT8* bbuf, int lcup, int scup)
{
int num;
int i;
@ -316,9 +316,7 @@ OPJ_BOOL mel_init(dec_mel_t *melp, OPJ_UINT8* bbuf, int lcup, int scup)
OPJ_UINT64 d;
int d_bits;
if (melp->unstuff == OPJ_TRUE && melp->data[0] > 0x8F) {
return OPJ_FALSE;
}
assert(melp->unstuff == OPJ_FALSE || melp->data[0] <= 0x8F);
d = (melp->size > 0) ? *melp->data : 0xFF; // if buffer is consumed
// set data to 0xFF
if (melp->size == 1) {
@ -334,7 +332,6 @@ OPJ_BOOL mel_init(dec_mel_t *melp, OPJ_UINT8* bbuf, int lcup, int scup)
}
melp->tmp <<= (64 - melp->bits); //push all the way up so the first bit
// is the MSB
return OPJ_TRUE;
}
//************************************************************************/
@ -1066,7 +1063,7 @@ static OPJ_BOOL opj_t1_allocate_buffers(
if (flagssize > t1->flagssize) {
opj_aligned_free(t1->flags);
t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize * sizeof(opj_flag_t));
t1->flags = (opj_flag_t*) opj_aligned_malloc(flagssize);
if (!t1->flags) {
/* FIXME event manager error callback */
return OPJ_FALSE;
@ -1074,7 +1071,7 @@ static OPJ_BOOL opj_t1_allocate_buffers(
}
t1->flagssize = flagssize;
memset(t1->flags, 0, flagssize * sizeof(opj_flag_t));
memset(t1->flags, 0, flagssize);
}
t1->w = w;
@ -1377,17 +1374,7 @@ OPJ_BOOL opj_t1_ht_decode_cblk(opj_t1_t *t1,
}
// init structures
if (mel_init(&mel, coded_data, lcup, scup) == OPJ_FALSE) {
if (p_manager_mutex) {
opj_mutex_lock(p_manager_mutex);
}
opj_event_msg(p_manager, EVT_ERROR, "Malformed HT codeblock. "
"Incorrect MEL segment sequence.\n");
if (p_manager_mutex) {
opj_mutex_unlock(p_manager_mutex);
}
return OPJ_FALSE;
}
mel_init(&mel, coded_data, lcup, scup);
rev_init(&vlc, coded_data, lcup, scup);
frwd_init(&magsgn, coded_data, lcup - scup, 0xFF);
if (num_passes > 1) { // needs to be tested

View File

@ -7666,27 +7666,6 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
return OPJ_FALSE;
}
if (parameters->cp_fixed_alloc) {
if (parameters->cp_matrice == NULL) {
opj_event_msg(p_manager, EVT_ERROR,
"cp_fixed_alloc set, but cp_matrice missing\n");
return OPJ_FALSE;
}
if (parameters->tcp_numlayers > J2K_TCD_MATRIX_MAX_LAYER_COUNT) {
opj_event_msg(p_manager, EVT_ERROR,
"tcp_numlayers when cp_fixed_alloc set should not exceed %d\n",
J2K_TCD_MATRIX_MAX_LAYER_COUNT);
return OPJ_FALSE;
}
if (parameters->numresolution > J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT) {
opj_event_msg(p_manager, EVT_ERROR,
"numresolution when cp_fixed_alloc set should not exceed %d\n",
J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT);
return OPJ_FALSE;
}
}
p_j2k->m_specific_param.m_encoder.m_nb_comps = image->numcomps;
/* keep a link to cp so that we can destroy it later in j2k_destroy_compress */
@ -7906,17 +7885,15 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
cp->m_specific_param.m_enc.m_max_comp_size = (OPJ_UINT32)
parameters->max_comp_size;
cp->rsiz = parameters->rsiz;
if (parameters->cp_fixed_alloc) {
cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy = FIXED_LAYER;
} else if (parameters->cp_fixed_quality) {
cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy =
FIXED_DISTORTION_RATIO;
} else {
cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy =
RATE_DISTORTION_RATIO;
}
cp->m_specific_param.m_enc.m_disto_alloc = (OPJ_UINT32)
parameters->cp_disto_alloc & 1u;
cp->m_specific_param.m_enc.m_fixed_alloc = (OPJ_UINT32)
parameters->cp_fixed_alloc & 1u;
cp->m_specific_param.m_enc.m_fixed_quality = (OPJ_UINT32)
parameters->cp_fixed_quality & 1u;
if (parameters->cp_fixed_alloc) {
/* mod fixed_quality */
if (parameters->cp_fixed_alloc && parameters->cp_matrice) {
size_t array_size = (size_t)parameters->tcp_numlayers *
(size_t)parameters->numresolution * 3 * sizeof(OPJ_INT32);
cp->m_specific_param.m_enc.m_matrice = (OPJ_INT32 *) opj_malloc(array_size);
@ -8074,25 +8051,22 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {
opj_tcp_t *tcp = &cp->tcps[tileno];
const OPJ_BOOL fixed_distoratio =
cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
FIXED_DISTORTION_RATIO;
tcp->numlayers = (OPJ_UINT32)parameters->tcp_numlayers;
for (j = 0; j < tcp->numlayers; j++) {
if (OPJ_IS_CINEMA(cp->rsiz) || OPJ_IS_IMF(cp->rsiz)) {
if (fixed_distoratio) {
if (cp->m_specific_param.m_enc.m_fixed_quality) {
tcp->distoratio[j] = parameters->tcp_distoratio[j];
}
tcp->rates[j] = parameters->tcp_rates[j];
} else {
if (fixed_distoratio) {
if (cp->m_specific_param.m_enc.m_fixed_quality) { /* add fixed_quality */
tcp->distoratio[j] = parameters->tcp_distoratio[j];
} else {
tcp->rates[j] = parameters->tcp_rates[j];
}
}
if (!fixed_distoratio &&
if (!cp->m_specific_param.m_enc.m_fixed_quality &&
tcp->rates[j] <= 1.0) {
tcp->rates[j] = 0.0; /* force lossless */
}

View File

@ -113,9 +113,6 @@ The functions in J2K.C have for goal to read/write the several parts of the code
#define J2K_MAX_POCS 32 /**< Maximum number of POCs */
#define J2K_TCD_MATRIX_MAX_LAYER_COUNT 10
#define J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT 10
/* ----------------------------------------------------------------------- */
/**
@ -275,7 +272,7 @@ typedef struct opj_tcp {
OPJ_UINT32 ppt_data_size;
/** size of ppt_data*/
OPJ_UINT32 ppt_len;
/** PSNR values */
/** add fixed_quality */
OPJ_FLOAT32 distoratio[100];
/** tile-component coding parameters */
opj_tccp_t *tccps;
@ -317,14 +314,6 @@ typedef struct opj_tcp {
} opj_tcp_t;
/**
Rate allocation strategy
*/
typedef enum {
RATE_DISTORTION_RATIO = 0, /** allocation by rate/distortion */
FIXED_DISTORTION_RATIO = 1, /** allocation by fixed distortion ratio (PSNR) (fixed quality) */
FIXED_LAYER = 2, /** allocation by fixed layer (number of passes per layer / resolution / subband) */
} J2K_QUALITY_LAYER_ALLOCATION_STRATEGY;
typedef struct opj_encoding_param {
@ -336,8 +325,12 @@ typedef struct opj_encoding_param {
OPJ_INT32 *m_matrice;
/** Flag determining tile part generation*/
OPJ_BYTE m_tp_flag;
/** Quality layer allocation strategy */
J2K_QUALITY_LAYER_ALLOCATION_STRATEGY m_quality_layer_alloc_strategy;
/** allocation by rate/distortion */
OPJ_BITFIELD m_disto_alloc : 1;
/** allocation by fixed layer */
OPJ_BITFIELD m_fixed_alloc : 1;
/** add fixed_quality */
OPJ_BITFIELD m_fixed_quality : 1;
/** Enabling Tile part generation*/
OPJ_BITFIELD m_tp_on : 1;
}

View File

@ -1108,7 +1108,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image,
pcol = cmap[i].pcol;
src = old_comps[cmp].data;
assert(src); /* verified above */
max = new_comps[i].w * new_comps[i].h;
max = new_comps[pcol].w * new_comps[pcol].h;
/* Direct use: */
if (cmap[i].mtyp == 0) {

View File

@ -1,9 +1,9 @@
prefix=@CMAKE_INSTALL_PREFIX@
bindir=@bindir@
mandir=@mandir@
docdir=@docdir@
libdir=@libdir@
includedir=@includedir@
bindir=${prefix}/@OPENJPEG_INSTALL_BIN_DIR@
mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
Name: openjp2
Description: JPEG2000 library (Part 1 and 2)
@ -12,4 +12,3 @@ Version: @OPENJPEG_VERSION@
Libs: -L${libdir} -lopenjp2
Libs.private: -lm
Cflags: -I${includedir}
Cflags.private: -DOPJ_STATIC

View File

@ -405,7 +405,7 @@ typedef struct opj_cparameters {
int cp_disto_alloc;
/** allocation by fixed layer */
int cp_fixed_alloc;
/** allocation by fixed quality (PSNR) */
/** add fixed_quality */
int cp_fixed_quality;
/** fixed layer */
int *cp_matrice;
@ -829,9 +829,9 @@ typedef struct opj_tile_info {
int pdy[33];
/** information concerning packets inside tile */
opj_packet_info_t *packet;
/** number of pixels of the tile */
/** add fixed_quality */
int numpix;
/** distortion of the tile */
/** add fixed_quality */
double distotile;
/** number of markers */
int marknum;

View File

@ -44,11 +44,7 @@
Standard includes used by the library
==========================================================
*/
#if defined(__amigaos4__)
#include <exec/memory.h>
#else
#include <memory.h>
#endif
#include <stdlib.h>
#include <string.h>
#include <math.h>

View File

@ -173,17 +173,6 @@ static INLINE OPJ_UINT32 opj_uint_ceildiv(OPJ_UINT32 a, OPJ_UINT32 b)
return (OPJ_UINT32)(((OPJ_UINT64)a + b - 1) / b);
}
/**
Divide an integer and round upwards
@return Returns a divided by b
*/
static INLINE OPJ_UINT32 opj_uint64_ceildiv_res_uint32(OPJ_UINT64 a,
OPJ_UINT64 b)
{
assert(b);
return (OPJ_UINT32)((a + b - 1) / b);
}
/**
Divide an integer by a power of 2 and round upwards
@return Returns a divided by 2^b

View File

@ -411,37 +411,41 @@ static OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi)
}
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
(OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
/* Avoids division by zero */
/* Relates to id_000004,sig_06,src_000679,op_arith8,pos_49,val_-17 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (levelno >= 32 ||
((comp->dx << levelno) >> levelno) != comp->dx ||
((comp->dy << levelno) >> levelno) != comp->dy) {
continue;
}
trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
((OPJ_UINT64)comp->dx << levelno));
try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
((OPJ_UINT64)comp->dy << levelno));
trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
((OPJ_UINT64)comp->dx << levelno));
try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
((OPJ_UINT64)comp->dy << levelno));
if ((comp->dx << levelno) > INT_MAX ||
(comp->dy << levelno) > INT_MAX) {
continue;
}
trx0 = opj_uint_ceildiv(pi->tx0, (comp->dx << levelno));
try0 = opj_uint_ceildiv(pi->ty0, (comp->dy << levelno));
trx1 = opj_uint_ceildiv(pi->tx1, (comp->dx << levelno));
try1 = opj_uint_ceildiv(pi->ty1, (comp->dy << levelno));
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
(OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
/* To avoid divisions by zero / undefined behaviour on shift */
/* in below tests */
/* Fixes reading id:000026,sig:08,src:002419,op:int32,pos:60,val:+32 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (rpx >= 31 || ((comp->dx << rpx) >> rpx) != comp->dx ||
rpy >= 31 || ((comp->dy << rpy) >> rpy) != comp->dy) {
continue;
}
/* See ISO-15441. B.12.1.3 Resolution level-position-component-layer progression */
if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
((pi->y == pi->ty0) &&
(((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) &&
((try0 << levelno) % (1U << rpy))))) {
continue;
}
if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
((pi->x == pi->tx0) &&
(((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) &&
((trx0 << levelno) % (1U << rpx))))) {
continue;
}
@ -453,11 +457,11 @@ static OPJ_BOOL opj_pi_next_rpcl(opj_pi_iterator_t * pi)
continue;
}
prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
((OPJ_UINT64)comp->dx << levelno)), res->pdx)
prci = opj_uint_floordivpow2(opj_uint_ceildiv(pi->x,
(comp->dx << levelno)), res->pdx)
- opj_uint_floordivpow2(trx0, res->pdx);
prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
((OPJ_UINT64)comp->dy << levelno)), res->pdy)
prcj = opj_uint_floordivpow2(opj_uint_ceildiv(pi->y,
(comp->dy << levelno)), res->pdy)
- opj_uint_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
@ -545,37 +549,41 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi)
OPJ_UINT32 prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
(OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
/* Avoids division by zero */
/* Relates to id_000004,sig_06,src_000679,op_arith8,pos_49,val_-17 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (levelno >= 32 ||
((comp->dx << levelno) >> levelno) != comp->dx ||
((comp->dy << levelno) >> levelno) != comp->dy) {
continue;
}
trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
((OPJ_UINT64)comp->dx << levelno));
try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
((OPJ_UINT64)comp->dy << levelno));
trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
((OPJ_UINT64)comp->dx << levelno));
try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
((OPJ_UINT64)comp->dy << levelno));
if ((comp->dx << levelno) > INT_MAX ||
(comp->dy << levelno) > INT_MAX) {
continue;
}
trx0 = opj_uint_ceildiv(pi->tx0, (comp->dx << levelno));
try0 = opj_uint_ceildiv(pi->ty0, (comp->dy << levelno));
trx1 = opj_uint_ceildiv(pi->tx1, (comp->dx << levelno));
try1 = opj_uint_ceildiv(pi->ty1, (comp->dy << levelno));
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
(OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
/* To avoid divisions by zero / undefined behaviour on shift */
/* in below tests */
/* Relates to id:000019,sig:08,src:001098,op:flip1,pos:49 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (rpx >= 31 || ((comp->dx << rpx) >> rpx) != comp->dx ||
rpy >= 31 || ((comp->dy << rpy) >> rpy) != comp->dy) {
continue;
}
/* See ISO-15441. B.12.1.4 Position-component-resolution level-layer progression */
if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
((pi->y == pi->ty0) &&
(((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) &&
((try0 << levelno) % (1U << rpy))))) {
continue;
}
if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
((pi->x == pi->tx0) &&
(((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) &&
((trx0 << levelno) % (1U << rpx))))) {
continue;
}
@ -587,11 +595,11 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi)
continue;
}
prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
((OPJ_UINT64)comp->dx << levelno)), res->pdx)
prci = opj_uint_floordivpow2(opj_uint_ceildiv(pi->x,
(comp->dx << levelno)), res->pdx)
- opj_uint_floordivpow2(trx0, res->pdx);
prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
((OPJ_UINT64)comp->dy << levelno)), res->pdy)
prcj = opj_uint_floordivpow2(opj_uint_ceildiv(pi->y,
(comp->dy << levelno)), res->pdy)
- opj_uint_floordivpow2(try0, res->pdy);
pi->precno = prci + prcj * res->pw;
for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
@ -677,37 +685,40 @@ static OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi)
OPJ_UINT32 prci, prcj;
res = &comp->resolutions[pi->resno];
levelno = comp->numresolutions - 1 - pi->resno;
if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << levelno) >> levelno) != comp->dx ||
(OPJ_UINT32)(((OPJ_UINT64)comp->dy << levelno) >> levelno) != comp->dy) {
/* Avoids division by zero on id_000004,sig_06,src_000679,op_arith8,pos_49,val_-17 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (levelno >= 32 ||
((comp->dx << levelno) >> levelno) != comp->dx ||
((comp->dy << levelno) >> levelno) != comp->dy) {
continue;
}
trx0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx0,
((OPJ_UINT64)comp->dx << levelno));
try0 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty0,
((OPJ_UINT64)comp->dy << levelno));
trx1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->tx1,
((OPJ_UINT64)comp->dx << levelno));
try1 = opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->ty1,
((OPJ_UINT64)comp->dy << levelno));
if ((comp->dx << levelno) > INT_MAX ||
(comp->dy << levelno) > INT_MAX) {
continue;
}
trx0 = opj_uint_ceildiv(pi->tx0, (comp->dx << levelno));
try0 = opj_uint_ceildiv(pi->ty0, (comp->dy << levelno));
trx1 = opj_uint_ceildiv(pi->tx1, (comp->dx << levelno));
try1 = opj_uint_ceildiv(pi->ty1, (comp->dy << levelno));
rpx = res->pdx + levelno;
rpy = res->pdy + levelno;
if ((OPJ_UINT32)(((OPJ_UINT64)comp->dx << rpx) >> rpx) != comp->dx ||
(OPJ_UINT32)(((OPJ_UINT64)comp->dy << rpy) >> rpy) != comp->dy) {
/* To avoid divisions by zero / undefined behaviour on shift */
/* in below tests */
/* Fixes reading id:000019,sig:08,src:001098,op:flip1,pos:49 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (rpx >= 31 || ((comp->dx << rpx) >> rpx) != comp->dx ||
rpy >= 31 || ((comp->dy << rpy) >> rpy) != comp->dy) {
continue;
}
/* See ISO-15441. B.12.1.5 Component-position-resolution level-layer progression */
if (!(((OPJ_UINT64)pi->y % ((OPJ_UINT64)comp->dy << rpy) == 0) ||
((pi->y == pi->ty0) &&
(((OPJ_UINT64)try0 << levelno) % ((OPJ_UINT64)1U << rpy))))) {
if (!((pi->y % (comp->dy << rpy) == 0) || ((pi->y == pi->ty0) &&
((try0 << levelno) % (1U << rpy))))) {
continue;
}
if (!(((OPJ_UINT64)pi->x % ((OPJ_UINT64)comp->dx << rpx) == 0) ||
((pi->x == pi->tx0) &&
(((OPJ_UINT64)trx0 << levelno) % ((OPJ_UINT64)1U << rpx))))) {
if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) &&
((trx0 << levelno) % (1U << rpx))))) {
continue;
}
@ -719,11 +730,11 @@ static OPJ_BOOL opj_pi_next_cprl(opj_pi_iterator_t * pi)
continue;
}
prci = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->x,
((OPJ_UINT64)comp->dx << levelno)), res->pdx)
prci = opj_uint_floordivpow2(opj_uint_ceildiv(pi->x,
(comp->dx << levelno)), res->pdx)
- opj_uint_floordivpow2(trx0, res->pdx);
prcj = opj_uint_floordivpow2(opj_uint64_ceildiv_res_uint32((OPJ_UINT64)pi->y,
((OPJ_UINT64)comp->dy << levelno)), res->pdy)
prcj = opj_uint_floordivpow2(opj_uint_ceildiv(pi->y,
(comp->dy << levelno)), res->pdy)
- opj_uint_floordivpow2(try0, res->pdy);
pi->precno = (OPJ_UINT32)(prci + prcj * res->pw);
for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) {
@ -826,24 +837,18 @@ static void opj_get_encoding_parameters(const opj_image_t *p_image,
/* use custom size for precincts */
for (resno = 0; resno < l_tccp->numresolutions; ++resno) {
OPJ_UINT64 l_dx, l_dy;
OPJ_UINT32 l_dx, l_dy;
/* precinct width and height */
l_pdx = l_tccp->prcw[resno];
l_pdy = l_tccp->prch[resno];
l_dx = l_img_comp->dx * ((OPJ_UINT64)1u << (l_pdx + l_tccp->numresolutions - 1 -
resno));
l_dy = l_img_comp->dy * ((OPJ_UINT64)1u << (l_pdy + l_tccp->numresolutions - 1 -
resno));
l_dx = l_img_comp->dx * (1u << (l_pdx + l_tccp->numresolutions - 1 - resno));
l_dy = l_img_comp->dy * (1u << (l_pdy + l_tccp->numresolutions - 1 - resno));
/* take the minimum size for dx for each comp and resolution */
if (l_dx <= UINT_MAX) {
*p_dx_min = opj_uint_min(*p_dx_min, (OPJ_UINT32)l_dx);
}
if (l_dy <= UINT_MAX) {
*p_dy_min = opj_uint_min(*p_dy_min, (OPJ_UINT32)l_dy);
}
*p_dx_min = opj_uint_min(*p_dx_min, l_dx);
*p_dy_min = opj_uint_min(*p_dy_min, l_dy);
/* various calculations of extents */
l_level_no = l_tccp->numresolutions - 1 - resno;

View File

@ -1410,6 +1410,7 @@ static void opj_t1_dec_clnpass(
}
/** mod fixed_quality */
static OPJ_FLOAT64 opj_t1_getwmsedec(
OPJ_INT32 nmsedec,
OPJ_UINT32 compno,
@ -2312,7 +2313,7 @@ OPJ_BOOL opj_t1_encode_cblks(opj_tcd_t* tcd,
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
opj_mutex_t* mutex = opj_mutex_create();
tile->distotile = 0;
tile->distotile = 0; /* fixed_quality */
for (compno = 0; compno < tile->numcomps; ++compno) {
opj_tcd_tilecomp_t* tilec = &tile->comps[compno];
@ -2400,6 +2401,7 @@ static int opj_t1_enc_is_term_pass(opj_tcd_cblk_enc_t* cblk,
}
/** mod fixed_quality */
static OPJ_FLOAT64 opj_t1_encode_cblk(opj_t1_t *t1,
opj_tcd_cblk_enc_t* cblk,
OPJ_UINT32 orient,
@ -2441,13 +2443,6 @@ static OPJ_FLOAT64 opj_t1_encode_cblk(opj_t1_t *t1,
OPJ_INT32 tmp = *datap;
if (tmp < 0) {
OPJ_UINT32 tmp_unsigned;
if (tmp == INT_MIN) {
/* To avoid undefined behaviour when negating INT_MIN */
/* but if we go here, it means we have supplied an input */
/* with more bit depth than we we can really support. */
/* Cf https://github.com/uclouvain/openjpeg/issues/1432 */
tmp = INT_MIN + 1;
}
max = opj_int_max(max, -tmp);
tmp_unsigned = opj_to_smr(tmp);
memcpy(datap, &tmp_unsigned, sizeof(OPJ_INT32));
@ -2503,6 +2498,7 @@ static OPJ_FLOAT64 opj_t1_encode_cblk(opj_t1_t *t1,
break;
}
/* fixed_quality */
tempwmsedec = opj_t1_getwmsedec(nmsedec, compno, level, orient, bpno, qmfbid,
stepsize, numcomps, mct_norms, mct_numcomps) ;
cumwmsedec += tempwmsedec;

View File

@ -167,9 +167,9 @@ static OPJ_BOOL opj_t2_init_seg(opj_tcd_cblk_dec_t* cblk,
static void opj_t2_putcommacode(opj_bio_t *bio, OPJ_INT32 n)
{
while (--n >= 0) {
opj_bio_putbit(bio, 1);
opj_bio_write(bio, 1, 1);
}
opj_bio_putbit(bio, 0);
opj_bio_write(bio, 0, 1);
}
static OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
@ -184,7 +184,7 @@ static OPJ_UINT32 opj_t2_getcommacode(opj_bio_t *bio)
static void opj_t2_putnumpasses(opj_bio_t *bio, OPJ_UINT32 n)
{
if (n == 1) {
opj_bio_putbit(bio, 0);
opj_bio_write(bio, 0, 1);
} else if (n == 2) {
opj_bio_write(bio, 2, 2);
} else if (n <= 5) {
@ -801,7 +801,7 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
}
}
#endif
opj_bio_putbit(bio, packet_empty ? 0 : 1); /* Empty header bit */
opj_bio_write(bio, packet_empty ? 0 : 1, 1); /* Empty header bit */
/* Writing Packet header */
band = res->bands;
@ -849,7 +849,7 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
if (!cblk->numpasses) {
opj_tgt_encode(bio, prc->incltree, cblkno, (OPJ_INT32)(layno + 1));
} else {
opj_bio_putbit(bio, layer->numpasses != 0);
opj_bio_write(bio, layer->numpasses != 0, 1);
}
/* if cblk not included, go to the next cblk */
@ -978,9 +978,7 @@ static OPJ_BOOL opj_t2_encode_packet(OPJ_UINT32 tileno,
return OPJ_FALSE;
}
if (p_t2_mode == FINAL_PASS) {
memcpy(c, layer->data, layer->len);
}
memcpy(c, layer->data, layer->len);
cblk->numpasses += layer->numpasses;
c += layer->len;
length -= layer->len;

View File

@ -42,8 +42,6 @@
#include "opj_includes.h"
#include "opj_common.h"
// #define DEBUG_RATE_ALLOC
/* ----------------------------------------------------------------------- */
/* TODO MSD: */
@ -145,9 +143,6 @@ static OPJ_BOOL opj_tcd_code_block_enc_allocate_data(opj_tcd_cblk_enc_t *
*/
static void opj_tcd_code_block_enc_deallocate(opj_tcd_precinct_t * p_precinct);
static
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
OPJ_UINT32 final);
/**
Free the memory allocated for encoding
@ -229,7 +224,6 @@ opj_tcd_t* opj_tcd_create(OPJ_BOOL p_is_decoder)
/* ----------------------------------------------------------------------- */
static
void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd)
{
OPJ_UINT32 layno;
@ -240,23 +234,17 @@ void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd)
}
/* ----------------------------------------------------------------------- */
/** Returns OPJ_TRUE if the layer allocation is unchanged w.r.t to the previous
* invokation with a different threshold */
static
OPJ_BOOL opj_tcd_makelayer(opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final)
void opj_tcd_makelayer(opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final)
{
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
OPJ_UINT32 passno;
opj_tcd_tile_t *tcd_tile = tcd->tcd_image->tiles;
OPJ_BOOL layer_allocation_is_same = OPJ_TRUE;
tcd_tile->distolayer[layno] = 0;
tcd_tile->distolayer[layno] = 0; /* fixed_quality */
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
@ -316,10 +304,7 @@ OPJ_BOOL opj_tcd_makelayer(opj_tcd_t *tcd,
}
}
if (layer->numpasses != n - cblk->numpassesinlayers) {
layer_allocation_is_same = OPJ_FALSE;
layer->numpasses = n - cblk->numpassesinlayers;
}
layer->numpasses = n - cblk->numpassesinlayers;
if (!layer->numpasses) {
layer->disto = 0;
@ -338,7 +323,7 @@ OPJ_BOOL opj_tcd_makelayer(opj_tcd_t *tcd,
cblk->passes[cblk->numpassesinlayers - 1].distortiondec;
}
tcd_tile->distolayer[layno] += layer->disto;
tcd_tile->distolayer[layno] += layer->disto; /* fixed_quality */
if (final) {
cblk->numpassesinlayers = n;
@ -348,17 +333,14 @@ OPJ_BOOL opj_tcd_makelayer(opj_tcd_t *tcd,
}
}
}
return layer_allocation_is_same;
}
/** For m_quality_layer_alloc_strategy == FIXED_LAYER */
static
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
OPJ_UINT32 final)
{
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
OPJ_INT32 value; /*, matrice[tcd_tcp->numlayers][tcd_tile->comps[0].numresolutions][3]; */
OPJ_INT32 matrice[J2K_TCD_MATRIX_MAX_LAYER_COUNT][J2K_TCD_MATRIX_MAX_RESOLUTION_COUNT][3];
OPJ_INT32 matrice[10][10][3];
OPJ_UINT32 i, j, k;
opj_cp_t *cp = tcd->cp;
@ -458,11 +440,6 @@ void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
}
}
/** Rate allocation for the following methods:
* - allocation by rate/distortio (m_quality_layer_alloc_strategy == RATE_DISTORTION_RATIO)
* - allocation by fixed quality (m_quality_layer_alloc_strategy == FIXED_DISTORTION_RATIO)
*/
static
OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
@ -473,8 +450,8 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_UINT32 compno, resno, bandno, precno, cblkno, layno;
OPJ_UINT32 passno;
OPJ_FLOAT64 min, max;
OPJ_FLOAT64 cumdisto[100];
const OPJ_FLOAT64 K = 1;
OPJ_FLOAT64 cumdisto[100]; /* fixed_quality */
const OPJ_FLOAT64 K = 1; /* 1.1; fixed_quality */
OPJ_FLOAT64 maxSE = 0;
opj_cp_t *cp = tcd->cp;
@ -484,7 +461,7 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
min = DBL_MAX;
max = 0;
tcd_tile->numpix = 0;
tcd_tile->numpix = 0; /* fixed_quality */
for (compno = 0; compno < tcd_tile->numcomps; compno++) {
opj_tcd_tilecomp_t *tilec = &tcd_tile->comps[compno];
@ -534,12 +511,9 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
}
} /* passno */
{
const OPJ_SIZE_T cblk_pix_count = (OPJ_SIZE_T)((cblk->x1 - cblk->x0) *
(cblk->y1 - cblk->y0));
tcd_tile->numpix += cblk_pix_count;
tilec->numpix += cblk_pix_count;
}
/* fixed_quality */
tcd_tile->numpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0));
tilec->numpix += ((cblk->x1 - cblk->x0) * (cblk->y1 - cblk->y0));
} /* cbklno */
} /* precno */
} /* bandno */
@ -553,8 +527,8 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
/* index file */
if (cstr_info) {
opj_tile_info_t *tile_info = &cstr_info->tile[tcd->tcd_tileno];
tile_info->numpix = (int)tcd_tile->numpix;
tile_info->distotile = (int)tcd_tile->distotile;
tile_info->numpix = tcd_tile->numpix;
tile_info->distotile = tcd_tile->distotile;
tile_info->thresh = (OPJ_FLOAT64 *) opj_malloc(tcd_tcp->numlayers * sizeof(
OPJ_FLOAT64));
if (!tile_info->thresh) {
@ -571,54 +545,35 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_FLOAT64 goodthresh = 0;
OPJ_FLOAT64 stable_thresh = 0;
OPJ_UINT32 i;
OPJ_FLOAT64 distotarget;
OPJ_FLOAT64 distotarget; /* fixed_quality */
/* fixed_quality */
distotarget = tcd_tile->distotile - ((K * maxSE) / pow((OPJ_FLOAT32)10,
tcd_tcp->distoratio[layno] / 10));
/* Don't try to find an optimal threshold but rather take everything not included yet, if
-r xx,yy,zz,0 (m_quality_layer_alloc_strategy == RATE_DISTORTION_RATIO and rates == NULL)
-q xx,yy,zz,0 (m_quality_layer_alloc_strategy == FIXED_DISTORTION_RATIO and distoratio == NULL)
-r xx,yy,zz,0 (disto_alloc == 1 and rates == 0)
-q xx,yy,zz,0 (fixed_quality == 1 and distoratio == 0)
==> possible to have some lossy layers and the last layer for sure lossless */
if (((cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
RATE_DISTORTION_RATIO) &&
if (((cp->m_specific_param.m_enc.m_disto_alloc == 1) &&
(tcd_tcp->rates[layno] > 0.0f)) ||
((cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
FIXED_DISTORTION_RATIO) &&
((cp->m_specific_param.m_enc.m_fixed_quality == 1) &&
(tcd_tcp->distoratio[layno] > 0.0))) {
opj_t2_t*t2 = opj_t2_create(tcd->image, cp);
OPJ_FLOAT64 thresh = 0;
OPJ_BOOL last_layer_allocation_ok = OPJ_FALSE;
if (t2 == 00) {
return OPJ_FALSE;
}
for (i = 0; i < 128; ++i) {
OPJ_FLOAT64 distoachieved = 0;
OPJ_BOOL layer_allocation_is_same;
OPJ_FLOAT64 distoachieved = 0; /* fixed_quality */
OPJ_FLOAT64 new_thresh = (lo + hi) / 2;
/* Stop iterating when the threshold has stabilized enough */
/* 0.5 * 1e-5 is somewhat arbitrary, but has been selected */
/* so that this doesn't change the results of the regression */
/* test suite. */
if (fabs(new_thresh - thresh) <= 0.5 * 1e-5 * thresh) {
break;
}
thresh = new_thresh;
#ifdef DEBUG_RATE_ALLOC
opj_event_msg(p_manager, EVT_INFO, "layno=%u, iter=%u, thresh=%g",
layno, i, new_thresh);
#endif
thresh = (lo + hi) / 2;
layer_allocation_is_same = opj_tcd_makelayer(tcd, layno, thresh, 0) && i != 0;
#ifdef DEBUG_RATE_ALLOC
opj_event_msg(p_manager, EVT_INFO, "--> layer_allocation_is_same = %d",
layer_allocation_is_same);
#endif
if (cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
FIXED_DISTORTION_RATIO) {
opj_tcd_makelayer(tcd, layno, thresh, 0);
if (cp->m_specific_param.m_enc.m_fixed_quality) { /* fixed_quality */
if (OPJ_IS_CINEMA(cp->rsiz) || OPJ_IS_IMF(cp->rsiz)) {
if (! opj_t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest,
p_data_written, maxlen, cstr_info, NULL, tcd->cur_tp_num, tcd->tp_pos,
@ -650,41 +605,17 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
}
lo = thresh;
}
} else { /* Disto/rate based optimization */
/* Check if the layer allocation done by opj_tcd_makelayer()
* is compatible of the maximum rate allocation. If not,
* retry with a higher threshold.
* If OK, try with a lower threshold.
* Call opj_t2_encode_packets() only if opj_tcd_makelayer()
* has resulted in different truncation points since its last
* call. */
if ((layer_allocation_is_same && !last_layer_allocation_ok) ||
(!layer_allocation_is_same &&
! opj_t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest,
p_data_written, maxlen, cstr_info, NULL, tcd->cur_tp_num, tcd->tp_pos,
tcd->cur_pino,
THRESH_CALC, p_manager))) {
#ifdef DEBUG_RATE_ALLOC
if (!layer_allocation_is_same) {
opj_event_msg(p_manager, EVT_INFO,
"--> check rate alloc failed (> maxlen=%u)\n", maxlen);
}
#endif
last_layer_allocation_ok = OPJ_FALSE;
} else {
if (! opj_t2_encode_packets(t2, tcd->tcd_tileno, tcd_tile, layno + 1, dest,
p_data_written, maxlen, cstr_info, NULL, tcd->cur_tp_num, tcd->tp_pos,
tcd->cur_pino,
THRESH_CALC, p_manager)) {
/* TODO: what to do with l ??? seek / tell ??? */
/* opj_event_msg(tcd->cinfo, EVT_INFO, "rate alloc: len=%d, max=%d\n", l, maxlen); */
lo = thresh;
continue;
}
#ifdef DEBUG_RATE_ALLOC
if (!layer_allocation_is_same) {
opj_event_msg(p_manager, EVT_INFO,
"--> check rate alloc success (len=%u <= maxlen=%u)\n", *p_data_written,
maxlen);
}
#endif
last_layer_allocation_ok = OPJ_TRUE;
hi = thresh;
stable_thresh = thresh;
}
@ -704,6 +635,7 @@ OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
opj_tcd_makelayer(tcd, layno, goodthresh, 1);
/* fixed_quality */
cumdisto[layno] = (layno == 0) ? tcd_tile->distolayer[0] :
(cumdisto[layno - 1] + tcd_tile->distolayer[layno]);
}
@ -2667,10 +2599,10 @@ static OPJ_BOOL opj_tcd_rate_allocate_encode(opj_tcd_t *p_tcd,
p_cstr_info->index_write = 0;
}
if (l_cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
RATE_DISTORTION_RATIO ||
l_cp->m_specific_param.m_enc.m_quality_layer_alloc_strategy ==
FIXED_DISTORTION_RATIO) {
if (l_cp->m_specific_param.m_enc.m_disto_alloc ||
l_cp->m_specific_param.m_enc.m_fixed_quality) {
/* fixed_quality */
/* Normal Rate/distortion allocation */
if (! opj_tcd_rateallocate(p_tcd, p_dest_data, &l_nb_written, p_max_dest_size,
p_cstr_info, p_manager)) {
return OPJ_FALSE;

View File

@ -222,8 +222,8 @@ typedef struct opj_tcd_tilecomp {
OPJ_UINT32 win_x1;
OPJ_UINT32 win_y1;
/* number of pixels */
OPJ_SIZE_T numpix;
/* add fixed_quality */
OPJ_INT32 numpix;
} opj_tcd_tilecomp_t;
@ -235,9 +235,9 @@ typedef struct opj_tcd_tile {
OPJ_INT32 x0, y0, x1, y1;
OPJ_UINT32 numcomps; /* number of components in tile */
opj_tcd_tilecomp_t *comps; /* Components information */
OPJ_SIZE_T numpix; /* number of pixels */
OPJ_FLOAT64 distotile; /* distortion of the tile */
OPJ_FLOAT64 distolayer[100]; /* distortion per layer */
OPJ_INT32 numpix; /* add fixed_quality */
OPJ_FLOAT64 distotile; /* add fixed_quality */
OPJ_FLOAT64 distolayer[100]; /* add fixed_quality */
OPJ_UINT32 packno; /* packet number */
} opj_tcd_tile_t;
@ -369,6 +369,23 @@ OPJ_BOOL opj_tcd_init(opj_tcd_t *p_tcd,
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
opj_event_mgr_t* p_manager);
void opj_tcd_makelayer_fixed(opj_tcd_t *tcd, OPJ_UINT32 layno,
OPJ_UINT32 final);
void opj_tcd_rateallocate_fixed(opj_tcd_t *tcd);
void opj_tcd_makelayer(opj_tcd_t *tcd,
OPJ_UINT32 layno,
OPJ_FLOAT64 thresh,
OPJ_UINT32 final);
OPJ_BOOL opj_tcd_rateallocate(opj_tcd_t *tcd,
OPJ_BYTE *dest,
OPJ_UINT32 * p_data_written,
OPJ_UINT32 len,
opj_codestream_info_t *cstr_info,
opj_event_mgr_t *p_manager);
/**
* Gets the maximum tile size that will be taken by the tile once decoded.
*/

View File

@ -287,12 +287,12 @@ void opj_tgt_encode(opj_bio_t *bio, opj_tgt_tree_t *tree, OPJ_UINT32 leafno,
while (low < threshold) {
if (low >= node->value) {
if (!node->known) {
opj_bio_putbit(bio, 1);
opj_bio_write(bio, 1, 1);
node->known = 1;
}
break;
}
opj_bio_putbit(bio, 0);
opj_bio_write(bio, 0, 1);
++low;
}

View File

@ -74,9 +74,9 @@ endif()
# Install library
install(TARGETS openjpip
EXPORT OpenJPEGTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Applications
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
RUNTIME DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
LIBRARY DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
ARCHIVE DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
if(BUILD_JPIP_SERVER)
@ -86,6 +86,6 @@ if(BUILD_JPIP_SERVER)
PROPERTIES COMPILE_FLAGS "-DSERVER")
install(TARGETS openjpip_server
EXPORT OpenJPEGTargets
DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Libraries
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
endif()

View File

@ -1,9 +1,9 @@
prefix=@CMAKE_INSTALL_PREFIX@
bindir=@bindir@
mandir=@mandir@
docdir=@docdir@
libdir=@libdir@
includedir=@includedir@
bindir=${prefix}/@OPENJPEG_INSTALL_BIN_DIR@
mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@
docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@
libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@
includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@
Name: openjpip
Description: JPEG2000 Interactivity tools, APIs and protocols (Part 9)
@ -13,4 +13,3 @@ Requires: libopenjp2
Libs: -L${libdir} -lopenjpip
Libs.private: -lm -lcurl -lfcgi -lpthread
Cflags: -I${includedir}
Cflags.private: -DOPJ_STATIC

View File

@ -89,15 +89,8 @@ else(BUILD_THIRDPARTY)
message(STATUS "Your system seems to have a TIFF lib available, we will use it")
set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
# Probably incorrect as PC_TIFF_STATIC_LIBRARIES will lack the path to the libraries
# and will only work if they are in system directories
set(TIFF_LIBNAME ${PC_TIFF_STATIC_LIBRARIES} PARENT_SCOPE)
set(TIFF_INCLUDE_DIRNAME ${PC_TIFF_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
else()
set(TIFF_LIBNAME ${TIFF_LIBRARIES} PARENT_SCOPE)
set(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} PARENT_SCOPE)
endif()
set(TIFF_LIBNAME ${TIFF_LIBRARIES} ${PC_TIFF_STATIC_LIBRARIES} PARENT_SCOPE)
set(TIFF_INCLUDE_DIRNAME ${TIFF_INCLUDE_DIR} ${PC_TIFF_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
else(TIFF_FOUND) # not found
set(OPJ_HAVE_TIFF_H 0 PARENT_SCOPE)
set(OPJ_HAVE_LIBTIFF 0 PARENT_SCOPE)
@ -131,15 +124,8 @@ else(BUILD_THIRDPARTY)
message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
# Probably incorrect as PC_LCMS2_STATIC_LIBRARIES will lack the path to the libraries
# and will only work if they are in system directories
set(LCMS_LIBNAME ${PC_LCMS2_STATIC_LIBRARIES} PARENT_SCOPE)
set(LCMS_INCLUDE_DIRNAME ${PC_LCMS2_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
else()
set(LCMS_LIBNAME ${LCMS2_LIBRARIES} PARENT_SCOPE)
set(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} PARENT_SCOPE)
endif()
set(LCMS_LIBNAME ${LCMS2_LIBRARIES} ${PC_LCMS2_STATIC_LIBRARIES} PARENT_SCOPE)
set(LCMS_INCLUDE_DIRNAME ${LCMS2_INCLUDE_DIRS} ${PC_LCMS2_STATIC_INCLUDE_DIRS} PARENT_SCOPE)
else(LCMS2_FOUND) # not found lcms2
# try to find LCMS
find_package(LCMS)

View File

@ -21,18 +21,6 @@
"PublicSymbols": "public_symbols/openjpeg/current/list",
"PublicTypes": "public_types/openjpeg/current/list"
},
{
"Number": "2.5.0",
"Installed": "installed/openjpeg/2.5.0",
"Source": "src/openjpeg/2.5.0/version.-2.5.0.tar.gz",
"Changelog": "CHANGELOG.md",
"HeadersDiff": "On",
"PkgDiff": "Off",
"ABIView": "Off",
"ABIDiff": "Off",
"PublicSymbols": "public_symbols/openjpeg/2.5.0/list",
"PublicTypes": "public_types/openjpeg/2.5.0/list"
},
{
"Number": "2.4.0",
"Installed": "installed/openjpeg/2.4.0",

View File

@ -24,8 +24,8 @@ if [ "${OPJ_CI_CXX:-}" != "" ]; then
fi
OPJ_UPLOAD_ABI_REPORT=0
#OPJ_PREVIOUS_VERSION="2.4.0"
OPJ_LATEST_VERSION="2.5.0"
#OPJ_PREVIOUS_VERSION="2.3.1"
OPJ_LATEST_VERSION="2.4.0"
if [ "${OPJ_PREVIOUS_VERSION:-}" != "" ]; then
OPJ_LIMIT_ABI_BUILDS="-limit 3"
else

View File

@ -66,5 +66,5 @@ add_custom_target(OpenJPEGJavaJar ALL
)
install(FILES ${LIBRARY_OUTPUT_PATH}/openjpeg.jar
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} COMPONENT JavaModule
DESTINATION ${OPENJPEG_INSTALL_SHARE_DIR} COMPONENT JavaModule
)