summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2004-08-02 19:37:51 (GMT)
committerRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2004-08-02 19:37:51 (GMT)
commit2a36f1b1d295ff43b8f2adb1cba5115361a64d8f (patch)
treea652271a4ad0292a17360ec96adcee72f4d7353b /src
parent34cbb564af98b82c9b9f392fa33787094be4c74f (diff)
downloadhdf5-2a36f1b1d295ff43b8f2adb1cba5115361a64d8f.zip
hdf5-2a36f1b1d295ff43b8f2adb1cba5115361a64d8f.tar.gz
hdf5-2a36f1b1d295ff43b8f2adb1cba5115361a64d8f.tar.bz2
[svn-r8990] Purpose:
Add missing feature. Strongly requested by NASA. Description: Add support for 'n-bit' data in SZIP filter. Solution: When precision < (size*8) use precision at the BPP for SZIP. Platforms tested: verbena,arabica,hirdls (SGI 64bit) Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5Zszip.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index e8f7c07..c999ba8 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -142,6 +142,9 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dataspace (i.e. chunk) dimensions */
int ndims; /* Number of (chunk) dimensions */
H5T_order_t dtype_order; /* Datatype's endianness order */
+ int dtype_size; /* Datatype's size (in bits) */
+ size_t dtype_precision; /* Datatype's precision (in bits) */
+ size_t dtype_offset; /* Datatype's precision (in bits) */
hsize_t scanline; /* Size of dataspace's fastest changing dimension */
herr_t ret_value=SUCCEED; /* Return value */
@@ -151,10 +154,24 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_SZIP,&flags,&cd_nelmts, cd_values,0,NULL)<0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters");
- /* Set "local" parameter for this dataset's "bits-per-pixel" */
- if((cd_values[H5Z_SZIP_PARM_BPP]=(8*sizeof(unsigned char)*H5Tget_size(type_id)))==0)
+ /* Get datatype's size, for checking the "bits-per-pixel" */
+ if((dtype_size=(8*H5Tget_size(type_id)))==0)
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size");
+ /* Get datatype's precision, in case is less than full bits */
+ if((dtype_precision=H5Tget_precision(type_id))==0)
+ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision");
+
+ if(dtype_precision<dtype_size) {
+ dtype_offset=H5Tget_offset(type_id);
+ if(dtype_offset != 0) {
+ dtype_precision=dtype_size;
+ }
+ }
+
+ /* Set "local" parameter for this dataset's "bits-per-pixel" */
+ cd_values[H5Z_SZIP_PARM_BPP]=dtype_precision;
+
/* Get dimensions for dataspace */
if ((ndims=H5Sget_simple_extent_dims(space_id, dims, NULL))<0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions");