summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_copy.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2004-07-20 19:21:03 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2004-07-20 19:21:03 (GMT)
commit4cb6c01d7f59be968649e36a61346be044f76345 (patch)
treee0a0b81e542768b75d5bbb2de8afc1abfb8c4370 /tools/h5repack/h5repack_copy.c
parent00909f278d64017c21c8348537231daba97be9dd (diff)
downloadhdf5-4cb6c01d7f59be968649e36a61346be044f76345.zip
hdf5-4cb6c01d7f59be968649e36a61346be044f76345.tar.gz
hdf5-4cb6c01d7f59be968649e36a61346be044f76345.tar.bz2
[svn-r8904] Purpose:
h5diff and h5repack changes Description: h5diff introduced the following four modes of output: Normal mode: print the number of differences found and where they occured Report mode: print the above plus the differences Verbose mode: print the above plus a list of objects and warnings Quiet mode: do not print output (h5diff always returns an exit code of 1 when differences are found) h5repack added an extra parameter for SZIP filter (coding method) the new syntax is -f SZIP=<pixels per block,coding> (pixels per block is a even number in 2-32 and coding method is 'EC' or 'NN') Example of use: ./h5repack -i file1 -o file2 -f SZIP=8,NN -v updated usage messages, test scripts and files accordingly Solution: Platforms tested: linux AIX solaris Misc. update:
Diffstat (limited to 'tools/h5repack/h5repack_copy.c')
-rw-r--r--tools/h5repack/h5repack_copy.c149
1 files changed, 105 insertions, 44 deletions
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 870f3c7..110069b 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -19,6 +19,110 @@
#include "H5private.h"
#include "h5repack.h"
+#if 0
+#define PRINT_DEBUG
+#endif
+
+/*-------------------------------------------------------------------------
+ * Function: print_obj
+ *
+ * Purpose: print name and filters of an object
+ *
+ *-------------------------------------------------------------------------
+ */
+static void print_obj(hid_t dcpl_id, char *name)
+{
+ char str[255];
+#if defined (PRINT_DEBUG )
+ char temp[255];
+#endif
+ 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 name */
+ int i;
+
+ strcpy(str,"\0");
+
+ /* get information about input filters */
+ if ((nfilters = H5Pget_nfilters(dcpl_id))<0)
+ return;
+
+ for ( i=0; i<nfilters; i++)
+ {
+ cd_nelmts = NELMTS(cd_values);
+
+#ifdef H5_WANT_H5_V1_6_COMPAT
+ filtn = H5Pget_filter(dcpl_id,
+ (unsigned)i,
+ &filt_flags,
+ &cd_nelmts,
+ cd_values,
+ sizeof(f_name),
+ f_name);
+#else
+ filtn = H5Pget_filter(dcpl_id,
+ (unsigned)i,
+ &filt_flags,
+ &cd_nelmts,
+ cd_values,
+ sizeof(f_name),
+ f_name,
+ NULL);
+#endif /* H5_WANT_H5_V1_6_COMPAT */
+
+
+ switch (filtn)
+ {
+ default:
+ break;
+ case H5Z_FILTER_DEFLATE:
+ strcat(str,"GZIP ");
+
+#if defined (PRINT_DEBUG)
+ {
+ unsigned level=cd_values[0];
+ sprintf(temp,"(%d)",level);
+ strcat(str,temp);
+ }
+#endif
+
+ break;
+ case H5Z_FILTER_SZIP:
+ strcat(str,"SZIP ");
+
+#if defined (PRINT_DEBUG)
+ {
+ unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/
+ unsigned ppb=cd_values[1];
+ sprintf(temp,"(%d,",ppb);
+ strcat(str,temp);
+ if (options_mask & H5_SZIP_EC_OPTION_MASK)
+ strcpy(temp,"EC) ");
+ else if (options_mask & H5_SZIP_NN_OPTION_MASK)
+ strcpy(temp,"NN) ");
+ }
+ strcat(str,temp);
+
+#endif
+
+ break;
+ case H5Z_FILTER_SHUFFLE:
+ strcat(str,"SHUF ");
+ break;
+ case H5Z_FILTER_FLETCHER32:
+ strcat(str,"FLET ");
+ break;
+ } /* switch */
+ }/*i*/
+
+ printf(" %-10s %s %s\n", "dataset",str,name );
+
+}
+
+
/*-------------------------------------------------------------------------
* Function: copy_objects
*
@@ -112,46 +216,6 @@ out:
}
-/*-------------------------------------------------------------------------
- * Function: print_obj
- *
- * Purpose: print name and filters of an object
- *
- *-------------------------------------------------------------------------
- */
-
-
-void print_obj(pack_info_t *obj, char *name)
-{
- char str[26]; /*5x5+1*/
- int i;
-
- strcpy(str,"\0");
-
- for ( i=0; i<obj->nfilters; i++)
- {
- switch (obj->filter[i].filtn)
- {
- default:
- break;
- case H5Z_FILTER_DEFLATE:
- strcat(str,"GZIP ");
- break;
- case H5Z_FILTER_SZIP:
- strcat(str,"SZIP ");
- break;
- case H5Z_FILTER_SHUFFLE:
- strcat(str,"SHUF ");
- break;
- case H5Z_FILTER_FLETCHER32:
- strcat(str,"FLET ");
- break;
- } /* switch */
- }/*i*/
-
- printf(" %-10s %s %s\n", "dataset",str,name );
-
-}
/*-------------------------------------------------------------------------
@@ -262,9 +326,6 @@ int do_copy_objects(hid_t fidin,
if ((msize=H5Tget_size(mtype_id))==0)
goto error;
- if (options->verbose)
- print_filters(dcpl_id);
-
/*-------------------------------------------------------------------------
* check for external files
*-------------------------------------------------------------------------
@@ -370,7 +431,7 @@ int do_copy_objects(hid_t fidin,
free(buf);
if (options->verbose && wrote)
- print_obj(&obj,travt->objs[i].name );
+ print_obj(dcpl_id,travt->objs[i].name );