From 4ae0c873e0ce24209ad00324dfc7fea94e22008d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 25 Mar 2013 12:35:39 -0500 Subject: [svn-r23446] HDFFV-8344, HDFFV-8346: merge from 1.8 branch --- release_docs/RELEASE.txt | 4 ++++ tools/lib/h5tools_dump.c | 16 +++++++++++++--- tools/testfiles/tfletcher32.ddl | 2 +- tools/testfiles/tshuffle.ddl | 2 +- tools/testfiles/tuserfilter.ddl | 4 ++-- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8a54b21..dbd3b75 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -276,6 +276,10 @@ New Features Tools: ------ + - h5dump: Fixed displaying comporession ratio for unknown or user-defined + filters. HDFFV-8344 (XCAO 2013/03/19) + - h5dump: Changed UNKNOWN_FILTER to USER_DEFINED_FILTER for user defined filter. + HDFFV-8346 (XCAO 2013/03/19) - h5dump: Added capability for "-a" option to show attributes containing "/" by using an escape character. For example, for a dataset "/dset" containing attribute "speed(m/h)", use "h5dump -a "/dset/speed(\/h)" diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index dbb5f98..d6cd0a0 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2958,11 +2958,14 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, int ndims = H5Sget_simple_extent_dims(sid, dims, NULL); /* only print the compression ratio for these filters */ - for(i = 0; i < nfilters; i++) { + for(i = 0; i < nfilters && !ok; i++) { cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); - + ok = (filtn>=0); + + /* this following code will not show compression ratio for + user defined filter. For example, see HDFFV-8344 --xcao@hdfgroup.org switch(filtn) { case H5Z_FILTER_DEFLATE: case H5Z_FILTER_SZIP: @@ -2971,6 +2974,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, ok = 1; break; } + */ } if(ndims && ok) { @@ -3148,6 +3152,9 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); + + if (filtn<0) + continue; /* nothing to print for invalid filter */ ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); @@ -3241,10 +3248,13 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); break; default: + /* filter do not have to be avaiable for showing registered filter info. + see HDFFV-8346 for details. --xcao@hdfgroup.org if(H5Zfilter_avail(filtn)) h5tools_str_append(&buffer, "%s %s", "USER_REGISTERED_FILTER", BEGIN); else - h5tools_str_append(&buffer, "%s %s", "UNKNOWN_FILTER", BEGIN); + */ + h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, ncols, 0, 0); ctx->indent_level++; diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl index 072ef23..c341ded 100644 --- a/tools/testfiles/tfletcher32.ddl +++ b/tools/testfiles/tfletcher32.ddl @@ -4,7 +4,7 @@ DATASET "fletcher32" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 816 + SIZE 816 (0.980:1 COMPRESSION) } FILTERS { CHECKSUM FLETCHER32 diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl index cd1b5f8..5c183fe 100644 --- a/tools/testfiles/tshuffle.ddl +++ b/tools/testfiles/tshuffle.ddl @@ -4,7 +4,7 @@ DATASET "shuffle" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 800 + SIZE 800 (1.000:1 COMPRESSION) } FILTERS { PREPROCESSING SHUFFLE diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl index 07b478f..24745b9 100644 --- a/tools/testfiles/tuserfilter.ddl +++ b/tools/testfiles/tuserfilter.ddl @@ -4,10 +4,10 @@ DATASET "myfilter" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 800 + SIZE 800 (1.000:1 COMPRESSION) } FILTERS { - UNKNOWN_FILTER { + USER_DEFINED_FILTER { FILTER_ID 405 COMMENT myfilter PARAMS { 5 6 } -- cgit v0.12