summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2004-08-04 15:59:02 (GMT)
committerRobert E. McGrath <mcgrath@ncsa.uiuc.edu>2004-08-04 15:59:02 (GMT)
commit2491ee240d8d63dda5216cfef6d8a484cac74868 (patch)
tree3dda291d8eb9040a13f1f66286d9d26d208fae3f /src
parent5585cbae21775b0dff9160d1f9e58b6d3da11656 (diff)
downloadhdf5-2491ee240d8d63dda5216cfef6d8a484cac74868.zip
hdf5-2491ee240d8d63dda5216cfef6d8a484cac74868.tar.gz
hdf5-2491ee240d8d63dda5216cfef6d8a484cac74868.tar.bz2
[svn-r9009] Purpose:
Update Szip to accept 'n-bit' data Description: See earlier checkins. Solution: Platforms tested: Misc. update:
Diffstat (limited to 'src')
-rw-r--r--src/H5Zszip.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/H5Zszip.c b/src/H5Zszip.c
index fdd7f48..2133311 100644
--- a/src/H5Zszip.c
+++ b/src/H5Zszip.c
@@ -148,6 +148,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 offset (in bits) */
hsize_t scanline; /* Size of dataspace's fastest changing dimension */
herr_t ret_value=SUCCEED; /* Return value */
@@ -161,9 +164,30 @@ H5Z_set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id)
#endif
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters")
+ /* 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;
+ }
+ }
+ if (dtype_precision>24) {
+ if (dtype_precision <= 32) {
+ dtype_precision=32;
+ } else if ( dtype_precision <= 64) {
+ dtype_precision=64;
+ }
+ }
+
/* 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)
- HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size")
+ cd_values[H5Z_SZIP_PARM_BPP]=dtype_precision;
/* Get dimensions for dataspace */
if ((ndims=H5Sget_simple_extent_dims(space_id, dims, NULL))<0)