summaryrefslogtreecommitdiffstats
path: root/tools/h5repack/h5repack_verify.c
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-12-20 21:31:34 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-12-20 21:31:34 (GMT)
commit491971980d68bb763899d42946a63fc127f9c4cb (patch)
treec913ed03fe3587acd1f647574d9387d3d9147a7d /tools/h5repack/h5repack_verify.c
parent837780443693fc562725f57e874312120cde32d8 (diff)
downloadhdf5-491971980d68bb763899d42946a63fc127f9c4cb.zip
hdf5-491971980d68bb763899d42946a63fc127f9c4cb.tar.gz
hdf5-491971980d68bb763899d42946a63fc127f9c4cb.tar.bz2
[svn-r14355] uncomment previously commented code regarding nbit and scale-offset filter adding
changed the logic of the filter compare function to first compare filter type, then filter client data values (separate here in each individual case, since some filters return private filter values. Todo: handle the nbit and scale-offest cases) tested: windows, linux
Diffstat (limited to 'tools/h5repack/h5repack_verify.c')
-rw-r--r--tools/h5repack/h5repack_verify.c141
1 files changed, 90 insertions, 51 deletions
diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c
index ff708b1..92c3756 100644
--- a/tools/h5repack/h5repack_verify.c
+++ b/tools/h5repack/h5repack_verify.c
@@ -29,14 +29,21 @@ static int filtcmp( filter_info_t f1, filter_info_t f2);
/*-------------------------------------------------------------------------
* Function: h5repack_verify
*
- * Purpose: verify if the filters and layout specified in the options list are
- * present on the OUTPUT file
+ * Purpose: verify if filters and layout in the input file match the output file
*
- * Return: 1=present, 0=not present, -1=error
+ * Return:
+ * 1 match
+ * 0 do not match
+ * -1 error
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente, pvn@hdfgroup.org
*
* Date: December 19, 2003
+ * Modified: December, 19, 2007 (exactly 4 years later :-) )
+ * Separate into 3 cases
+ * 1) no filter input, get all datasets and compare DCPLs. TO DO
+ * 2) filter input on selected datasets, get each one trough OBJ and match
+ * 3) filter input on all datasets, get all objects and match
*
*-------------------------------------------------------------------------
*/
@@ -696,68 +703,100 @@ static int filtcmp( filter_info_t f1 /*DCPL*/, filter_info_t f2 /*OPT*/)
{
unsigned i;
+
/*-------------------------------------------------------------------------
- * compare cd_nelmts and cd_values
+ * compare first the filter type
*-------------------------------------------------------------------------
*/
-
- if ( f1.filtn == 4 ) /* SZIP special case */
+
+ if (f1.filtn < f2.filtn)
{
-
- if ( f1.cd_nelmts != 4 && f2.cd_nelmts != 2 )
- return -1;
-
- if ( f2.cd_values[0] != f1.cd_values[2] &&
- f2.cd_values[1] != f1.cd_values[1] )
- return -1;
-
+ return -1;
}
-
- else if ( f1.filtn == 2 ) /* SHUFFLE returns 1 cd_nelmts */
+ else if (f1.filtn > f2.filtn)
{
-
- if ( f1.cd_nelmts != 1 && f2.cd_nelmts != 0 )
- return -1;
-
+ return 1;
}
-
- else
-
+ else if (f1.filtn == f2.filtn)
{
-
- if ( f1.cd_nelmts != f2.cd_nelmts )
- return -1;
-
- /* consider different filter values as "less" */
- for( i = 0; i < f1.cd_nelmts; i++)
+
+ switch (f1.filtn)
{
- if (f1.cd_values[i] != f2.cd_values[i])
+
+ case H5Z_FILTER_SHUFFLE:
+
+ /* 1 private client value is returned by DCPL */
+ if ( f1.cd_nelmts != 1 && f2.cd_nelmts != 0 )
+ return -1;
+
+ return 0;
+
+
+ break;
+
+ case H5Z_FILTER_SZIP:
+
+ /* 4 private client values are returned by DCPL */
+ if ( f1.cd_nelmts != 4 && f2.cd_nelmts != 2 )
+ return -1;
+
+ if ( f2.cd_values[0] != f1.cd_values[2] &&
+ f2.cd_values[1] != f1.cd_values[1] )
+ return -1;
+
+ return 0;
+
+
+ break;
+
+ case H5Z_FILTER_NBIT:
+
+ /* TO DO */
+
+ return 0;
+
+
+ break;
+
+ case H5Z_FILTER_SCALEOFFSET:
+
+ /* TO DO */
+
+ return 0;
+
+
+ break;
+
+ case H5Z_FILTER_FLETCHER32:
+ case H5Z_FILTER_DEFLATE:
+
+ if ( f1.cd_nelmts != f2.cd_nelmts )
+ return -1;
+
+ /* consider different filter values as "less" */
+ for( i = 0; i < f1.cd_nelmts; i++)
{
- return -1;
+ if (f1.cd_values[i] != f2.cd_values[i])
+ {
+ return -1;
+ }
+
}
+
+ return 0;
- }
-
- }
+
+ break;
+
+
+
+ } /* switch */
+
+
+ } /* f1.filtn == f2.filtn */
- /*-------------------------------------------------------------------------
- * compare the filter type
- *-------------------------------------------------------------------------
- */
- if (f1.filtn == f2.filtn)
- {
- return 0;
- }
- else if (f1.filtn < f2.filtn)
- {
- return -1;
- }
- else if (f1.filtn > f2.filtn)
- {
- return 1;
- }
assert(0);
return -1;