summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2003-04-01 15:39:48 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2003-04-01 15:39:48 (GMT)
commitf94431ce1f10d796268767121cd85269b7c0f094 (patch)
tree01edce5f7fe3e3977f5aa86aeddd36e481b61caf /src
parent646ac3850720155ced3851cf0c5ecf52a72857c4 (diff)
downloadhdf5-f94431ce1f10d796268767121cd85269b7c0f094.zip
hdf5-f94431ce1f10d796268767121cd85269b7c0f094.tar.gz
hdf5-f94431ce1f10d796268767121cd85269b7c0f094.tar.bz2
[svn-r6551] Purpose:
To support szip compression in HDF5 Description: szip compression support is required by NASA ESDIS. The compression algorithm is good for scientific data. In HDF5, we add another filter function to make szip as a default compression package as we did for gzip(or zlib). In this check-in, a new function called H5Pset_szip was added into H5Pdcpl.c, this function is very similar to H5Pset_deflate. The only difference is SZIP needs four parameters from the user to get the compression done while gzip needs only one. So we pass a pointer to this function instead of an integer number. The description of the four parameters of szip should be in different documents. H5Z.c and other header files were simply modified to have HDF5 know szip. Solution: See the decription Platforms tested: Since there are changes of configure.in and configure,I didn't use h5committest. I tested with four platforms. 1) Linux 2.4 (eirene) 2) Solaris 2.7(arabica) 3) windows 2000(VS 6.0) 4) SGI IRIX6.5-64(modi4) For test 1)-3), only basic C tests were done For modi4 test, I tested 64-bit C,parallel and fortran. All tests passed, except a warning message from szip library when checksum is used in some order, which doesn't cause any real problems. Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5MPprivate.h1
-rw-r--r--src/H5Pdcpl.c50
-rw-r--r--src/H5Ppublic.h25
-rw-r--r--src/H5Z.c3
-rw-r--r--src/H5Zprivate.h7
-rw-r--r--src/H5Zpublic.h1
6 files changed, 74 insertions, 13 deletions
diff --git a/src/H5MPprivate.h b/src/H5MPprivate.h
index d482369..348a302 100644
--- a/src/H5MPprivate.h
+++ b/src/H5MPprivate.h
@@ -316,6 +316,7 @@
#define color_H5Pget_nfilters "red"
#define color_H5Pget_fileter "red"
#define color_H5Pset_deflate "red"
+#define color_H5Pset_szip "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 438983e..33e0c8c 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -749,6 +749,56 @@ done:
FUNC_LEAVE_API(ret_value);
}
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_szip
+ *
+ * Purpose: Sets the compression method for a permanent or transient
+ * filter pipeline (depending on whether PLIST_ID is a dataset
+ * creation or transfer property list) to H5Z_FILTER_SZIP
+ * Szip is a special compression package that is said to be good
+ * for scientific data.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_szip(hid_t plist_id, const unsigned cd_values[])
+{
+ H5O_pline_t pline;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_szip, FAIL);
+/* H5TRACE2("e","i*Iu",plist_id,cd_values);
+ H5TRACE2("e","i*Iu",plist_id,cd_values);
+*/
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Add the 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_SZIP, H5Z_FLAG_OPTIONAL, 4, cd_values)<0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip 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);
+}
/*-------------------------------------------------------------------------
* Function: H5Pset_shuffle
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index e4760e5..7b3fc38 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -1,16 +1,14 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * All rights reserved. *
- * *
- * This file is part of HDF5. The full HDF5 copyright notice, including *
- * terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/****************************************************************************
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * COPYING file. *
+ * *
+ ****************************************************************************/
/*
* This file contains function prototypes for each exported function in the
@@ -220,6 +218,7 @@ H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter,
unsigned cd_values[]/*out*/,
size_t namelen, char name[]);
H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned aggression);
+H5_DLL herr_t H5Pset_szip(hid_t plist_id,const unsigned cd_values[]);
H5_DLL herr_t H5Pset_shuffle(hid_t plist_id, unsigned bytespertype);
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);
diff --git a/src/H5Z.c b/src/H5Z.c
index 13786e5..681ed04 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -53,6 +53,9 @@ H5Z_init_interface (void)
{
FUNC_ENTER_NOINIT(H5Z_init_interface);
+#ifdef H5_HAVE_FILTER_SZIP
+ H5Z_register (H5Z_FILTER_SZIP, "szip", H5Z_filter_szip);
+#endif /* H5_HAVE_FILTER_SZIP */
#ifdef H5_HAVE_FILTER_DEFLATE
H5Z_register (H5Z_FILTER_DEFLATE, "deflate", H5Z_filter_deflate);
#endif /* H5_HAVE_FILTER_DEFLATE */
diff --git a/src/H5Zprivate.h b/src/H5Zprivate.h
index 07cf38b..9d7d25c 100644
--- a/src/H5Zprivate.h
+++ b/src/H5Zprivate.h
@@ -23,6 +23,9 @@
#include "H5Fprivate.h"
#include "H5Ppublic.h"
+#ifdef H5_HAVE_SZLIB_H
+#include "szlib.h"
+#endif
/*
* The filter table maps filter identification numbers to structs that
* contain a pointers to the filter function and timing statistics.
@@ -62,6 +65,10 @@ H5_DLL size_t H5Z_filter_deflate(unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes,
size_t *buf_size, void **buf);
+H5_DLL size_t H5Z_filter_szip(unsigned flags, size_t cd_nelmts,
+ const unsigned cd_values[], size_t nbytes,
+ size_t *buf_size, void **buf);
+
H5_DLL size_t H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts,
const unsigned cd_values[], size_t nbytes,
size_t *buf_size, void **buf);
diff --git a/src/H5Zpublic.h b/src/H5Zpublic.h
index 8893a88..eaf9e86 100644
--- a/src/H5Zpublic.h
+++ b/src/H5Zpublic.h
@@ -32,6 +32,7 @@ typedef int H5Z_filter_t;
#define H5Z_FILTER_DEFLATE 1 /*deflation like gzip */
#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_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) */