diff options
author | Elena Pourmal <epourmal@hdfgroup.org> | 2004-07-21 20:39:11 (GMT) |
---|---|---|
committer | Elena Pourmal <epourmal@hdfgroup.org> | 2004-07-21 20:39:11 (GMT) |
commit | 0fb97eb5fd5424b1f563b89ddf62d171a410dd60 (patch) | |
tree | cc26685d40c72668abe4973a55c914ae81b375e1 /src | |
parent | fd476c92c5c6612bf5a0fc7f86b7ade54d948f21 (diff) | |
download | hdf5-0fb97eb5fd5424b1f563b89ddf62d171a410dd60.zip hdf5-0fb97eb5fd5424b1f563b89ddf62d171a410dd60.tar.gz hdf5-0fb97eb5fd5424b1f563b89ddf62d171a410dd60.tar.bz2 |
[svn-r8915]
Purpose: Improvement
Description: HDF5 Library set pixels_per_scanline parameter to the size of the chunk's
fastest changing dimension. As a result, fastest changing dimension
of the chunk could not be bigger than 4K and smaller than pixels_per_block
value and szip compression couldn't be used for many real datasets.
Solution: Reworked algorithm how HDF5 sets pixels_per_scanline value; only chunks
with the total number of elements less than pixels_per_block value are rejected.
There is no restriction on the size of the chunk's fastest changing
dimension anymore.
Platforms tested: verbena, copper, sol
Misc. update:
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Zszip.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/H5Zszip.c b/src/H5Zszip.c index 5eafec1..0ea7423 100644 --- a/src/H5Zszip.c +++ b/src/H5Zszip.c @@ -83,7 +83,13 @@ H5Z_class_t H5Z_SZIP[1] = {{ * Programmer: Quincey Koziol * Monday, April 7, 2003 * - * Modifications: + * Modifications: Used new logic to set the size of the scanline parameter. + * Now SZIP compression can be applied to the chunk + * of any shape and size with only one restriction: the number + * of elements in the chunk has to be not less than number + * of elements (pixels) in the block (cd_values[H5Z_SZIP_PARM_PPB] + * parameter). + * Elena Pourmal, July 20, 2004 * *------------------------------------------------------------------------- */ @@ -94,7 +100,8 @@ H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) size_t cd_nelmts=H5Z_SZIP_USER_NPARMS; /* Number of filter parameters */ unsigned cd_values[H5Z_SZIP_TOTAL_NPARMS]; /* Filter parameters */ hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dataspace (i.e. chunk) dimensions */ - int ndims; /* Number of (chunk) dimensions */ + int ndims; /* Number of chunk dimensions */ + hssize_t npoints; /* Number of points in the dataspace */ unsigned dtype_size; /* Datatype's size (in bits) */ H5T_order_t dtype_order; /* Datatype's endianness order */ hsize_t scanline; /* Size of dataspace's fastest changing dimension */ @@ -126,7 +133,6 @@ H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* (Note: this may not handle non-atomic datatypes well) */ if(dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order") - /* 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") @@ -135,18 +141,28 @@ H5Z_can_apply_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* (Use the chunk's fastest changing dimension size) */ assert(ndims>0); scanline=dims[ndims-1]; + + /* Adjust scanline if it is smaller than number of pixels per block or + if it is bigger than maximum pixels per scanline */ + + /* Check the pixels per block against the 'scanline' size */ + if(scanline<cd_values[H5Z_SZIP_PARM_PPB]) { + + /* Get number of elements for the dataspace; use + total number of elements in the chunk to define the new 'scanline' size */ + if ((npoints=H5Sget_simple_extent_npoints(space_id))<0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace") + if(npoints<cd_values[H5Z_SZIP_PARM_PPB]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "pixels per block greater than total number of elements in the chunk") + scanline = MIN((cd_values[H5Z_SZIP_PARM_PPB] * SZ_MAX_BLOCKS_PER_SCANLINE), npoints); + goto done; - /* Range check the pixels per block against the 'scanline' size */ - if(scanline<cd_values[H5Z_SZIP_PARM_PPB]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "pixels per block greater than scanline"); + } - /* Range check the scanline's size */ + /* Check the scanline's size against the maximum value and adjust 'scanline' + size if necessary */ if(scanline > SZ_MAX_PIXELS_PER_SCANLINE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid scanline size") - - /* Range check the scanline's number of blocks */ - if((scanline/cd_values[H5Z_SZIP_PARM_PPB]) > SZ_MAX_BLOCKS_PER_SCANLINE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid number of blocks per scanline") + scanline = cd_values[H5Z_SZIP_PARM_PPB] * SZ_MAX_BLOCKS_PER_SCANLINE; done: FUNC_LEAVE_NOAPI(ret_value) |