summaryrefslogtreecommitdiffstats
path: root/src/H5Pdcpl.c
diff options
context:
space:
mode:
authorXiaowen Wu <wuxiaowe@ncsa.uiuc.edu>2005-04-26 20:22:22 (GMT)
committerXiaowen Wu <wuxiaowe@ncsa.uiuc.edu>2005-04-26 20:22:22 (GMT)
commit0af6a38a3f82cc6badaaea514c404d3c8b88e799 (patch)
treebba6c372e546ee93d7a508f72148d5db8ad77eaf /src/H5Pdcpl.c
parentc7e6a3d9d8719d7209ef5e06473e2f63681041a2 (diff)
downloadhdf5-0af6a38a3f82cc6badaaea514c404d3c8b88e799.zip
hdf5-0af6a38a3f82cc6badaaea514c404d3c8b88e799.tar.gz
hdf5-0af6a38a3f82cc6badaaea514c404d3c8b88e799.tar.bz2
[svn-r10671] Purpose:
New feature. Description: The H5Pset_scaleoffset is changed for the scaleoffset filter to handle both integer and floating-point data. Currently, the D-scaling method from GRIB has been implemented for compressing floating-point data. Solution: One more parameter is added to the H5Pset_scaleoffset interface to let user specify what type of data is used and what method to use as well as corresponding parameters. Platforms tested: heping Misc. update:
Diffstat (limited to 'src/H5Pdcpl.c')
-rw-r--r--src/H5Pdcpl.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index fde63f7..4bd477a 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1265,12 +1265,12 @@ done:
* Function: H5Pset_scaleoffset
*
* Purpose: Sets scaleoffset filter for a dataset creation property list
- * and user-supplied minimum number of bits
+ * and user-supplied parameters
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Xiaowen Wu
- * Wednesday, February 9, 2005
+ * Thursday, April 14, 2005
*
* Modifications:
*
@@ -1278,15 +1278,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_scaleoffset(hid_t plist_id, unsigned min_bits)
+H5Pset_scaleoffset(hid_t plist_id, int scale_factor, unsigned scale_type)
{
H5O_pline_t pline;
H5P_genplist_t *plist; /* Property list pointer */
- unsigned cd_values[1]; /* Filter parameters */
+ unsigned cd_values[2]; /* Filter parameters */
herr_t ret_value=SUCCEED; /* return value */
FUNC_ENTER_API(H5Pset_scaleoffset, FAIL);
- H5TRACE2("e","iIu",plist_id,min_bits);
+ H5TRACE3("e","iIIu",plist_id,scale_factor,scale_type);
/* Check arguments */
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
@@ -1296,15 +1296,21 @@ H5Pset_scaleoffset(hid_t plist_id, unsigned min_bits)
if(NULL == (plist = H5I_object(plist_id)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
- /* Set the parameter for the filter
- * if min_bits is zero, the scaleoffset filter will automatically calculate min_bits
+ /* Set parameters for the filter
+ * scale_type = 0: floating-point type, filter uses variable-minimum-bits method,
+ * scale_factor is decimal scale factor
+ * scale_type = 1: floating-point type, filter uses fixed-minimum-bits method,
+ * scale_factor is the fixed minimum number of bits
+ * scale type = other: integer type, scale_factor is minimum number of bits
+ * if scale_factor = 0, then filter calculates minimum number of bits
*/
- cd_values[0] = min_bits;
+ cd_values[0] = scale_factor;
+ cd_values[1] = scale_type;
/* Add the scaleoffset 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_SCALEOFFSET, H5Z_FLAG_OPTIONAL, 1, cd_values)<0)
+ if(H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, 2, cd_values)<0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset 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");