summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-10-18 16:42:55 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-10-18 16:42:55 (GMT)
commit45727db7998415ace57a84b20ef75d4298af16ab (patch)
treeb14b08eda495409e5380a8b258db9648ac9a3062 /tools
parent1ab3445511ed5808299c64c7769ce1d7e7fd203c (diff)
downloadhdf5-45727db7998415ace57a84b20ef75d4298af16ab.zip
hdf5-45727db7998415ace57a84b20ef75d4298af16ab.tar.gz
hdf5-45727db7998415ace57a84b20ef75d4298af16ab.tar.bz2
[svn-r9429] Purpose:
bug fix Description: when specifying both an input object e.g -f mydset:GZIP=1 and a defined chunk -l CHUNK=20x20 the filter used a defined default chunk instead Solution: add a check for the input chunk Platforms tested: linux (small change) Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5repack/h5repack.h1
-rw-r--r--tools/h5repack/h5repack_copy.c5
-rw-r--r--tools/h5repack/h5repack_filters.c36
3 files changed, 30 insertions, 12 deletions
diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h
index 97af8a7..ff3d2a8 100644
--- a/tools/h5repack/h5repack.h
+++ b/tools/h5repack/h5repack.h
@@ -190,6 +190,7 @@ int apply_filters(const char* name, /* object name from traverse list */
hid_t dcpl_id, /* dataset creation property list */
hid_t type_id, /* datatype */
pack_opt_t *options, /* repack options */
+ int has_layout, /* input chunk */
pack_info_t *obj); /* info about object to filter */
int has_filter(hid_t dcpl_id,
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index b9e69bb..5ce0e71 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -245,6 +245,7 @@ int do_copy_objects(hid_t fidin,
#endif /* LATER */
int i, j;
int wrote=0;
+ int has_layout;
/*-------------------------------------------------------------------------
* copy the suppplied object list
@@ -255,6 +256,7 @@ int do_copy_objects(hid_t fidin,
{
buf=NULL;
+ has_layout=0;
switch ( travt->objs[i].type )
{
/*-------------------------------------------------------------------------
@@ -373,13 +375,14 @@ int do_copy_objects(hid_t fidin,
obj.chunk.rank=rank;
if (apply_layout(dcpl_id,&obj)<0)
goto error;
+ has_layout=1;
}
/*-------------------------------------------------------------------------
* apply the filter; check if the object is to be filtered.
*-------------------------------------------------------------------------
*/
- if (apply_filters(travt->objs[i].name,rank,dims,dcpl_id,mtype_id,options,&obj)<0)
+ if (apply_filters(travt->objs[i].name,rank,dims,dcpl_id,mtype_id,options,has_layout,&obj)<0)
goto error;
}/*nelmts*/
diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c
index da9147c..5d4d65d 100644
--- a/tools/h5repack/h5repack_filters.c
+++ b/tools/h5repack/h5repack_filters.c
@@ -116,6 +116,7 @@ int apply_filters(const char* name, /* object name from traverse list */
hid_t dcpl_id, /* dataset creation property list */
hid_t type_id, /* dataset datatype */
pack_opt_t *options, /* repack options */
+ int has_layout, /* input chunk */
pack_info_t *obj) /* info about object to filter */
{
int nfilters; /* number of filters in DCPL */
@@ -131,6 +132,22 @@ int apply_filters(const char* name, /* object name from traverse list */
if (rank==0)
goto out;
+/*-------------------------------------------------------------------------
+ * filters require CHUNK layout; if we do not have one define a default
+ *-------------------------------------------------------------------------
+ */
+ if (has_layout)
+ {
+ layout_this(dcpl_id,name,options,obj);
+ }
+ else
+ {
+ obj->chunk.rank=rank;
+ for (i=0; i<rank; i++)
+ obj->chunk.chunk_lengths[i] = dims[i];
+ }
+
+
/* check for datasets too small */
if ((size=H5Tget_size(type_id))==0)
return 0;
@@ -157,17 +174,9 @@ int apply_filters(const char* name, /* object name from traverse list */
if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0)
return -1;
}
-/*-------------------------------------------------------------------------
- * filters require CHUNK layout; if we do not have one define a default
- *-------------------------------------------------------------------------
- */
- if (obj->chunk.rank<=0)
- {
- obj->chunk.rank=rank;
- for (i=0; i<rank; i++)
- obj->chunk.chunk_lengths[i] = dims[i];
- }
-
+
+
+
/*-------------------------------------------------------------------------
* the type of filter and additional parameter
* type can be one of the filters
@@ -206,16 +215,19 @@ int apply_filters(const char* name, /* object name from traverse list */
{
unsigned options_mask;
unsigned pixels_per_block;
+
pixels_per_block=obj->filter[i].cd_values[0];
if (obj->filter[i].szip_coding==0)
options_mask=H5_SZIP_NN_OPTION_MASK;
else
options_mask=H5_SZIP_EC_OPTION_MASK;
+
/* set up for szip data */
if(H5Pset_chunk(dcpl_id,obj->chunk.rank,obj->chunk.chunk_lengths)<0)
return -1;
if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0)
return -1;
+
}
break;
@@ -252,6 +264,8 @@ out:
}
+
+
/*-------------------------------------------------------------------------
* Function: print_filters
*