From 7a5edc075a27c9f1cb45260f3ffc2cce8ab5531e Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Thu, 1 May 2008 11:45:32 -0500 Subject: [svn-r14905] Introduced a ratio formula compression ratio = uncompressed size / compressed size in the printing of the compression with 3 digits of precision per hdf-forum NASA developers suggestion tested: windows, linux, solaris --- tools/h5dump/h5dump.c | 14 +++++++------- tools/testfiles/tallfilters.ddl | 2 +- tools/testfiles/tdeflate.ddl | 2 +- tools/testfiles/tnbit.ddl | 2 +- tools/testfiles/tscaleoffset.ddl | 2 +- tools/testfiles/tszip.ddl | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 2389ef4..694c634 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -2507,7 +2507,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) int ndims = H5Sget_simple_extent_dims( sid, dims, NULL); hsize_t nelmts = 1; hsize_t size; - double per = 0; + double ratio = 0; hssize_t a, b; int ok = 0; @@ -2539,13 +2539,13 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) size = nelmts * datum_size; a = size; b = storage_size; - if (a!=0) - per = (double) (b-a)/a; - - per = -per; - per *=100; - HDfprintf(stdout, "SIZE %Hu (%.1f%%COMPRESSION)\n ", storage_size, per); + /* compression ratio = uncompressed size / compressed size */ + + if (b!=0) + ratio = (double) a / (double) b; + + HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio); } else diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl index 43c27a9..16405b7 100644 --- a/tools/testfiles/tallfilters.ddl +++ b/tools/testfiles/tallfilters.ddl @@ -7,7 +7,7 @@ DATASET "all" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 458 (42.8%COMPRESSION) + SIZE 458 (1.747:1 COMPRESSION) } FILTERS { PREPROCESSING SHUFFLE diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl index cc5b49b..7f658e7 100644 --- a/tools/testfiles/tdeflate.ddl +++ b/tools/testfiles/tdeflate.ddl @@ -7,7 +7,7 @@ DATASET "deflate" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 385 (51.9%COMPRESSION) + SIZE 385 (2.078:1 COMPRESSION) } FILTERS { COMPRESSION DEFLATE { LEVEL 9 } diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl index 2f932b5..c310592 100644 --- a/tools/testfiles/tnbit.ddl +++ b/tools/testfiles/tnbit.ddl @@ -7,7 +7,7 @@ DATASET "nbit" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 76 (90.5%COMPRESSION) + SIZE 76 (10.526:1 COMPRESSION) } FILTERS { COMPRESSION NBIT diff --git a/tools/testfiles/tscaleoffset.ddl b/tools/testfiles/tscaleoffset.ddl index c9a46f4..3428bfa 100644 --- a/tools/testfiles/tscaleoffset.ddl +++ b/tools/testfiles/tscaleoffset.ddl @@ -7,7 +7,7 @@ DATASET "scaleoffset" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 152 (81.0%COMPRESSION) + SIZE 152 (5.263:1 COMPRESSION) } FILTERS { COMPRESSION SCALEOFFSET { MIN BITS 4 } diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl index 6411bc3..b9f80ca 100644 --- a/tools/testfiles/tszip.ddl +++ b/tools/testfiles/tszip.ddl @@ -7,7 +7,7 @@ DATASET "szip" { DATASPACE SIMPLE { ( 20, 10 ) / ( 20, 10 ) } STORAGE_LAYOUT { CHUNKED ( 10, 5 ) - SIZE 372 (53.5%COMPRESSION) + SIZE 372 (2.151:1 COMPRESSION) } FILTERS { COMPRESSION SZIP { -- cgit v0.12