diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5repack/h5repack_verify.c | 141 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 8 |
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 |