From 8c0c4f945db726fcddd2a40e4f617cdf6aac6be8 Mon Sep 17 00:00:00 2001 From: "Robert E. McGrath" Date: Tue, 2 Nov 2004 14:12:18 -0500 Subject: [PATCH] [svn-r9495] Purpose: Fix SZIP filter to dynmically detect encoder. Description: Solution: See: http://hdf.ncsa.uiuc.edu/RFC/SZIP/Szip_dynamic_12_Oct.pdf Changes to h5dump tests, contingent on detecting SZIP encoder. --- config/commence.in | 1 + src/H5Z.c | 3 +++ src/H5Zszip.c | 6 +----- src/H5config.h.in | 3 --- tools/h5dump/h5dumpgentest.c | 20 ++++++++++---------- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/config/commence.in b/config/commence.in index 4d6b0c7efa..f4c71d756a 100644 --- a/config/commence.in +++ b/config/commence.in @@ -96,6 +96,7 @@ PUB_DOCS= PUB_SUBDOCS= PROGS= TEST_PROGS= +PRIV_PROGS= TEST_PROGS_PARA= TEST_FLAGS= TEST_SCRIPTS= diff --git a/src/H5Z.c b/src/H5Z.c index fa52ec8cb8..4dddca8a4a 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -94,6 +94,9 @@ H5Z_init_interface (void) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") #endif /* H5_HAVE_FILTER_FLETCHER32 */ #ifdef H5_HAVE_FILTER_SZIP + H5Z_SZIP->encoder_present = SZ_encoder_enabled(); + if (H5Z_SZIP->encoder_present < 0) + HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "szip filter reports bad status") if (H5Z_register (H5Z_SZIP)<0) HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter") #endif /* H5_HAVE_FILTER_SZIP */ diff --git a/src/H5Zszip.c b/src/H5Zszip.c index bca998e64a..5d0282a1a4 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -43,11 +43,7 @@ static size_t H5Z_filter_szip (unsigned flags, size_t cd_nelmts, H5Z_class_t H5Z_SZIP[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_SZIP, /* Filter id number */ -#ifdef H5_SZIP_CAN_ENCODE - 1, /* Encoder present */ -#else - 0, /* Encoder disabled */ -#endif + 1, /* Assume encoder present: check before registering */ 1, /* decoder_present flag (set to true) */ "szip", /* Filter name for debugging */ H5Z_can_apply_szip, /* The "can apply" callback */ diff --git a/src/H5config.h.in b/src/H5config.h.in index 2a01753196..d884a20112 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -524,9 +524,6 @@ PTHREAD_SCOPE_SYSTEM) call. */ #undef SYSTEM_SCOPE_THREADS -/* Define if szip encoder is present */ -#undef SZIP_CAN_ENCODE - /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 51ca97fd93..b2a520890c 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -26,10 +26,6 @@ #include "hdf5.h" #include "H5private.h" -#ifdef H5_HAVE_FILTER_SZIP -#include "szlib.h" -#endif - #define FILE1 "tgroup.h5" #define FILE2 "tdset.h5" #define FILE3 "tattr.h5" @@ -4495,10 +4491,10 @@ static void gent_filters(void) hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ hid_t tid; /* datatype ID */ -#if defined (H5_HAVE_FILTER_SZIP) +#ifdef H5_HAVE_FILTER_SZIP unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=4; -#endif +#endif /* H5_HAVE_FILTER_SZIP */ hsize_t dims1[RANK] = {DIM1,DIM2}; hsize_t chunk_dims[RANK] = {CDIM1,CDIM2}; int buf1[DIM1][DIM2]; @@ -4568,7 +4564,8 @@ static void gent_filters(void) * SZIP *------------------------------------------------------------------------- */ -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) +#ifdef H5_HAVE_FILTER_SZIP + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { /* remove the filters from the dcpl */ ret=H5Premove_filter(dcpl,H5Z_FILTER_ALL); assert(ret>=0); @@ -4579,7 +4576,8 @@ static void gent_filters(void) ret=make_dset(fid,"szip",sid,H5T_NATIVE_INT,dcpl,buf1); assert(ret>=0); -#endif + } +#endif /* H5_HAVE_FILTER_SZIP */ /*------------------------------------------------------------------------- * GZIP @@ -4648,12 +4646,14 @@ static void gent_filters(void) assert(ret>=0); #endif -#if defined (H5_HAVE_FILTER_SZIP) && defined (H5_SZIP_CAN_ENCODE) +#ifdef H5_HAVE_FILTER_SZIP + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { szip_options_mask=H5_SZIP_CHIP_OPTION_MASK | H5_SZIP_EC_OPTION_MASK; /* set szip data */ ret=H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block); assert(ret>=0); -#endif + } +#endif /* H5_HAVE_FILTER_SZIP */ #if defined (H5_HAVE_FILTER_DEFLATE) /* set deflate data */