ECC-396: Support for Jasper 2.0

This commit is contained in:
Shahram Najm 2016-12-06 11:51:41 +00:00
parent 3dd428aa4f
commit 073c35418c
4 changed files with 12 additions and 1 deletions

View File

@ -148,6 +148,8 @@ if( ENABLE_JPG )
list( APPEND ECCODES_TPLS Jasper )
set( HAVE_JPEG 1 )
set( HAVE_LIBJASPER 1 )
# Extract Jasper's major version number to enable conditional code. See ECC-396
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}")
endif()
if( OPENJPEG_FOUND )

View File

@ -107,4 +107,8 @@
#define ECCODES_IFS_SAMPLES_PATH "/MEMFS/ifs_samples"
#endif
#ifdef HAVE_LIBJASPER
#define JASPER_VERSION_MAJOR @JASPER_VERSION_MAJOR@
#endif
#endif /* eccodes_config_h */

View File

@ -110,7 +110,13 @@ int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper)
image.maxcmpts_ = 1;
image.clrspc_ = JAS_CLRSPC_SGRAY;
image.cmprof_ = 0;
#if JASPER_VERSION_MAJOR == 1
/* ECC-396: Support for Jasper 2.0
* Jasper version 1 had the 'inmem_' data member but
* version 2 removed it from the interface */
image.inmem_ = 1;
#endif
cmpt.tlx_ = 0;
cmpt.tly_ = 0;

View File

@ -21,7 +21,6 @@
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#include "jasper/jasper.h"
#endif
#ifdef ENABLE_FLOATING_POINT_EXCEPTIONS