summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2005-01-06 19:04:15 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2005-01-06 19:04:15 (GMT)
commitad633eafcc9f1961bcd56d0508263caf9931b3b0 (patch)
treeb99b65a80700e9a982bf2fc76f636bd9aefae960 /src
parent48822308a7e5f25f203c99e3da13dac585b90b02 (diff)
downloadhdf5-ad633eafcc9f1961bcd56d0508263caf9931b3b0.zip
hdf5-ad633eafcc9f1961bcd56d0508263caf9931b3b0.tar.gz
hdf5-ad633eafcc9f1961bcd56d0508263caf9931b3b0.tar.bz2
[svn-r9758] Purpose:
Adding framework of N-bit filter Description: N-bit filter is required for NetCDF project. To add N-bit filter, configure.in configure, Makefile.in under src and other filter-related source code needs to be updated. Currently, N-bit tests are turned off from the library. So the change will affect daily test. Solution: Platforms tested: sol 2.7, linux 2.4, aix 5.1 Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5MPprivate.h1
-rw-r--r--src/H5Pdcpl.c46
-rw-r--r--src/H5Ppublic.h1
-rw-r--r--src/H5Tprecis.c9
-rw-r--r--src/H5Z.c8
-rw-r--r--src/H5Zpkg.h7
-rw-r--r--src/H5Zpublic.h1
-rw-r--r--src/H5config.h.in7
-rw-r--r--src/Makefile.in2
9 files changed, 73 insertions, 9 deletions
diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h
index 97e8ccb..9588b5b 100644
--- a/src/H5MPprivate.h
+++ b/src/H5MPprivate.h
@@ -357,6 +357,7 @@
#define color_H5Pset_deflate "red"
#define color_H5Pset_fletcher32 "red"
#define color_H5Pset_szip "red"
+#define color_H5Pset_nbit "red"
#define color_H5Pset_cache "red"
#define color_H5Pget_cache "red"
#define color_H5Pset_hyper_cache "red"
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 7a71c29..3d7c2e7 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1219,6 +1219,52 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Pset_nbit
+ *
+ * Purpose: Sets nbit filter for a dataset creation property list
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Kent Yang
+ * Wednesday, November 13, 2002
+ *
+ * Modifications:
+ * Xiaowen Wu
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_nbit(hid_t plist_id)
+{
+ H5O_pline_t pline;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_nbit, FAIL);
+ H5TRACE1("e","i",plist_id);
+
+ /* Check arguments */
+ if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
+ HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Add the nbit filter */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ if(H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, 0, NULL)<0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline");
+ if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+
+done:
+ FUNC_LEAVE_API(ret_value);
+} /* end H5Pset_nbit() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Pset_fletcher32
*
* Purpose: Sets Fletcher32 checksum of EDC for a dataset creation
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 849c34f..e51688e 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -245,6 +245,7 @@ H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id);
H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block);
H5_DLL herr_t H5Pset_shuffle(hid_t plist_id);
+H5_DLL herr_t H5Pset_nbit(hid_t plist_id);
H5_DLL herr_t H5Pset_fletcher32(hid_t plist_id);
H5_DLL herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check);
H5_DLL H5Z_EDC_t H5Pget_edc_check(hid_t plist_id);
diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c
index 9728172..b7a37d3 100644
--- a/src/H5Tprecis.c
+++ b/src/H5Tprecis.c
@@ -245,12 +245,17 @@ H5T_set_precision(const H5T_t *dt, size_t prec)
* first when decreasing the precision of a floating point
* type.
*/
+ /*printf("\nsign: %d ", dt->shared->u.atomic.u.f.sign);
+ printf("epos: %d ", dt->shared->u.atomic.u.f.epos);
+ printf("esize: %d ", dt->shared->u.atomic.u.f.esize);
+ printf("mpos: %d ", dt->shared->u.atomic.u.f.mpos);
+ printf("msize: %d ", dt->shared->u.atomic.u.f.msize);
+ printf("prec: %d\n", prec); */
if (dt->shared->u.atomic.u.f.sign >= prec ||
dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec ||
dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjust sign, mantissa, and exponent fields first")
- break;
-
+ break;
default:
HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class")
} /* end switch */ /*lint !e788 All appropriate cases are covered */
diff --git a/src/H5Z.c b/src/H5Z.c
index dc41a9e..ed2df61 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -104,10 +104,14 @@ H5Z_init_interface (void)
if (H5Z_register (H5Z_SZIP)<0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter")
#endif /* H5_HAVE_FILTER_SZIP */
+#ifdef H5_HAVE_FILTER_NBIT
+ if (H5Z_register (H5Z_NBIT)<0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter")
+#endif /* H5_HAVE_FILTER_NBIT */
-#if (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_FLETCHER32 | defined H5_HAVE_FILTER_SHUFFLE | defined H5_HAVE_FILTER_SZIP)
+#if (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_FLETCHER32 | defined H5_HAVE_FILTER_SHUFFLE | defined H5_HAVE_FILTER_SZIP | defined H5_HAVE_FILTER_NBIT)
done:
-#endif /* (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_FLETCHER32 | defined H5_HAVE_FILTER_SHUFFLE | defined H5_HAVE_FILTER_SZIP) */
+#endif /* (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_FLETCHER32 | defined H5_HAVE_FILTER_SHUFFLE | defined H5_HAVE_FILTER_SZIP | defined H5_HAVE_FILTER_NBIT) */
FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5Zpkg.h b/src/H5Zpkg.h
index 7f9fd84..69ed127 100644
--- a/src/H5Zpkg.h
+++ b/src/H5Zpkg.h
@@ -50,6 +50,13 @@ H5_DLLVAR const H5Z_class_t H5Z_FLETCHER32[1];
H5_DLLVAR H5Z_class_t H5Z_SZIP[1];
#endif /* H5_HAVE_FILTER_SZIP */
+#ifdef H5_HAVE_FILTER_NBIT
+/*
+ * nbit filter
+ */
+H5_DLLVAR H5Z_class_t H5Z_NBIT[1];
+#endif /* H5_HAVE_FILTER_NBIT */
+
/* Package-local function prototypes */
H5_DLL void H5Z_update_class_vers(H5Z_class_t * old_vers, H5Z_class_t * curr_vers);
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 83c2ada..944934e 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -34,6 +34,7 @@ typedef int H5Z_filter_t;
#define H5Z_FILTER_SHUFFLE 2 /*shuffle the data */
#define H5Z_FILTER_FLETCHER32 3 /*fletcher32 checksum of EDC */
#define H5Z_FILTER_SZIP 4 /*szip compression */
+#define H5Z_FILTER_NBIT 5 /*nbit compression */
#define H5Z_FILTER_RESERVED 256 /*filter ids below this value are reserved */
#define H5Z_FILTER_MAX 65535 /*maximum filter id */
#define H5Z_MAX_NFILTERS 32 /* Maximum number of filters allowed in a pipeline (should probably be allowed to be an unlimited amount) */
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 95e244d..a345d85 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -42,6 +42,9 @@
/* Define if support for Fletcher32 checksum is enabled */
#undef HAVE_FILTER_FLETCHER32
+/* Define if support for nbit filter is enabled */
+#undef HAVE_FILTER_NBIT
+
/* Define if support for shuffle filter is enabled */
#undef HAVE_FILTER_SHUFFLE
@@ -516,10 +519,6 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define if your system can accurately convert between long double and
- integer values. */
-#undef SW_LDOUBLE_TO_INT_WORKS
-
/* Define if your system can accurately convert unsigned long long values to
floating-point values. */
#undef SW_ULONG_TO_FP_BOTTOM_BIT_WORKS
diff --git a/src/Makefile.in b/src/Makefile.in
index 972b2d4..5e1b653 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -48,7 +48,7 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5Dcontig.c H5Dcompact.c H5Defl.c \
H5Tfixed.c H5Tfloat.c H5Tinit.c H5Tnative.c H5Toffset.c H5Topaque.c \
H5Torder.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvlen.c H5TB.c H5TS.c \
H5V.c H5Z.c H5Zdeflate.c H5Zfletcher32.c H5Zshuffle.c H5Zszip.c \
- H5Ztrans.c
+ H5Znbit.c H5Ztrans.c
LIB_OBJ=$(LIB_SRC:.c=.lo)