From 0fb97eb5fd5424b1f563b89ddf62d171a410dd60 Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Wed, 21 Jul 2004 15:39:11 -0500 Subject: [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: --- src/H5Zszip.c | 40 ++++++++++++++++++++++++++++------------ 1 file 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 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) -- cgit v0.12