summaryrefslogtreecommitdiffstats
path: root/tools
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
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')
-rw-r--r--tools/h5repack/h5repack_verify.c141
-rw-r--r--tools/h5repack/h5repacktst.c8
2 files changed, 92 insertions, 57 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;
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c
index 67f00d4..99448c4 100644
--- a/tools/h5repack/h5repacktst.c
+++ b/tools/h5repack/h5repacktst.c
@@ -896,6 +896,8 @@ if (szip_can_encode) {
GOERROR;
if (h5repack_verify(FNAME7OUT,&pack_options)<=0)
GOERROR;
+ if (h5repack_cmpdcpl(FNAME7,FNAME7OUT)<=0)
+ GOERROR;
if (h5repack_end (&pack_options) < 0)
GOERROR;
@@ -1097,8 +1099,6 @@ if (szip_can_encode) {
SKIPPED();
#endif
-#if 0
- /* solve bug in Nbit filter return value of cd_nelmts */
TESTING(" adding nbit filter");
@@ -1121,7 +1121,6 @@ if (szip_can_encode) {
SKIPPED();
#endif
-#endif
TESTING(" copy of scaleoffset filter");
@@ -1163,8 +1162,6 @@ if (szip_can_encode) {
SKIPPED();
#endif
-#if 0
- /* solve bug in scaleoffset filter return value of cd_nelmts */
TESTING(" adding scaleoffset filter");
@@ -1188,7 +1185,6 @@ if (szip_can_encode) {
#endif
-#endif
/*-------------------------------------------------------------------------
* file with all filters