diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-01-26 23:20:20 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2004-01-26 23:20:20 (GMT) |
commit | afc3563b76badc2345ca955d7d48fe16cceaf0c8 (patch) | |
tree | a691cf56cc1246acb05f7fc23a050c93f0d7bf6d /tools/h5repack/h5repack_filters.c | |
parent | 2a4253ceb8757c935304be24db989bd0f72effe8 (diff) | |
download | hdf5-afc3563b76badc2345ca955d7d48fe16cceaf0c8.zip hdf5-afc3563b76badc2345ca955d7d48fe16cceaf0c8.tar.gz hdf5-afc3563b76badc2345ca955d7d48fe16cceaf0c8.tar.bz2 |
[svn-r8113] Purpose:
new library function H5Pdelete_filter
deletes one or all filters from a dataset creation property list
this was done for the NONE option of h5repack, added tests for this feature
added a test for the new function in /test/dsets.c
Description:
Solution:
Platforms tested:
linux
solaris
AIX
Misc. update:
Diffstat (limited to 'tools/h5repack/h5repack_filters.c')
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 8fb45f9..6476595 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -155,7 +155,8 @@ int print_filters(hid_t dcpl_id) * Function: apply_filters * * Purpose: apply the filters in the object to the property list; - * do extra checking in the case of SZIP + * do extra checking in the case of SZIP; delete all filters in the case + * of H5Z_FILTER_NONE present in the PACK_INFO_T filter array * * Return: 0, ok, -1 no * @@ -171,55 +172,55 @@ int apply_filters(hid_t dcpl_id, pack_opt_t *options, /* repack options */ pack_info_t *obj) /* info about object to filter */ { - int nfilters; /* number of filters */ - unsigned filt_flags; /* filter flags */ - H5Z_filter_t filtn; /* filter identification number */ - unsigned cd_values[20]; /* filter client data values */ - size_t cd_nelmts; /* filter client number of values */ - char f_name[256]; /* filter/file name */ - int i, j; + int nfilters; /* number of filters in DCPL */ unsigned aggression; /* the deflate level */ unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block; - + int i; + /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; - for (i=0; i<nfilters; i++) +/*------------------------------------------------------------------------- + * check if we have the H5Z_FILTER_NONE filter + * if so, just delete all filters from the DCPL and exit + *------------------------------------------------------------------------- + */ + + for ( i=0; i<obj->nfilters; i++) { - cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, - &cd_nelmts, - cd_values, - sizeof(f_name), - f_name); - } + if (obj->filter[i].filtn==H5Z_FILTER_NONE) + { + if (nfilters && H5Pdelete_filter(dcpl_id,H5Z_FILTER_NONE)<0) + return -1; + + return 1; + } + } + + +/*------------------------------------------------------------------------- + * the type of filter and additional parameter + * type can be one of the filters + * H5Z_FILTER_NONE 0, uncompress if compressed + * H5Z_FILTER_DEFLATE 1 , deflation like gzip + * H5Z_FILTER_SHUFFLE 2 , shuffle the data + * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC + * H5Z_FILTER_SZIP 4 , szip compression + *------------------------------------------------------------------------- + */ -/* - the type of filter and additional parameter - type can be one of the filters - H5Z_FILTER_NONE 0, uncompress if compressed - H5Z_FILTER_DEFLATE 1 , deflation like gzip - H5Z_FILTER_SHUFFLE 2 , shuffle the data - H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - H5Z_FILTER_SZIP 4 , szip compression -*/ - for ( j=0; j<obj->nfilters; j++) + for ( i=0; i<obj->nfilters; i++) { - switch (obj->filter[j].filtn) + switch (obj->filter[i].filtn) { - case H5Z_FILTER_NONE: - + default: break; - case H5Z_FILTER_DEFLATE: - - aggression=obj->filter[j].cd_values[0]; + aggression=obj->filter[i].cd_values[0]; /* set up for deflated data */ if(H5Pset_chunk(dcpl_id, obj->chunk.rank, obj->chunk.chunk_lengths)<0) @@ -232,7 +233,7 @@ int apply_filters(hid_t dcpl_id, case H5Z_FILTER_SZIP: - szip_pixels_per_block=obj->filter[j].cd_values[0]; + szip_pixels_per_block=obj->filter[i].cd_values[0]; /* check szip parameters */ if (check_szip(obj->chunk.rank, @@ -273,13 +274,10 @@ int apply_filters(hid_t dcpl_id, return -1; break; - - - default: - break; + } /* switch */ - }/*j*/ + }/*i*/ return 0; } |