Moved metering to a compile time option to streamline API

This commit is contained in:
Patrick Vogler 2024-06-24 16:31:02 +02:00
parent 3920405c4c
commit 1330d5b262
Signed by: Patrick Vogler
GPG key ID: 5536B08CE82E8509
9 changed files with 363 additions and 215 deletions

3
.gitignore vendored
View file

@ -2,6 +2,9 @@
# Prerequisites
*.d
# BWC Data Files
*.bwc
# Object files
*.o
*.ko

View file

@ -181,6 +181,8 @@ add_subdirectory(src/library)
#----------------------------------------------------------#
if(${TOOL})
add_subdirectory(src/tools)
else()
set(ignoreMe "${BUILD_EAS3}${BUILD_NETCDF}")
endif()
#----------------------------------------------------------#

View file

@ -53,14 +53,19 @@
.PHONY: single
.PHONY: tool
.PHONY: profiling
.PHONY: eas3
.PHONY: netCDF
.PHONY: --build_debug
.PHONY: build_debug
.PHONY: default
.PHONY: debug
.PHONY: full
.PHONY: release
.PHONY: cmdl
.PHONY: cldebug
#*--------------------------------------------------------*#
# Initialize the compiler flags used to build the library. #
@ -73,6 +78,8 @@ BUILD_PREC="Double"
BUILD_TOOL="False"
BUILD_PROF="False"
BUILD_EAS3="False"
BUILD_NETCDF="False"
@ -95,12 +102,25 @@ help:
@echo ""
@echo " [Type] [Description]"
@echo ""
@echo " debug Compiles BigWhoop and the command line tool with "
@echo " full file support. All relevant debug flags are set."
@echo " debug Compiles BigWhoop with all relevant debug flags."
@echo ""
@echo " full Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " ble) and the command line tool with full file sup-"
@echo " port. Code optimization is set to the highest level."
@echo " full Removes all files and folders created during a pre-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
@echo " enabled if applicable). Code optimization is set to"
@echo " the highest level."
@echo ""
@echo " release Compiles BigWhoop (with OpenMP enabled if applica-"
@echo " ble). Code optimization is set to the highest level."
@echo ""
@echo " cmdl Removes all files and folders created during a pre-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
@echo " enabled if applicable). All relevant debug flags "
@echo " are set. "
@echo ""
@echo " cmdl Removes all files and folders created during a pre-"
@echo " vious compile run. Compiles BigWhoop (with OpenMP "
@echo " enabled if applicable). Code optimization is set to"
@echo " the highest level."
@echo ""
@echo " clean Removes all files and folders created during a pre-"
@echo " vious compile run."
@ -116,6 +136,8 @@ help:
@echo ""
@echo " tool Build the command line tool."
@echo ""
@echo " profiling Enable Profiling."
@echo ""
@echo " eas3 Adds support for the eas3 file format to the com-"
@echo " mand line tool."
@echo ""
@ -125,7 +147,7 @@ help:
#*--------------------------------------------------------*#
# Define private targets. #
#*--------------------------------------------------------*#
--build_debug:
build_debug:
$(eval BUILD_TYPE="Debug")
#*--------------------------------------------------------*#
@ -143,6 +165,11 @@ single:
tool:
$(eval BUILD_TOOL="True")
#*--------------------------------------------------------*#
# Define target used to activate command line tool build. #
#*--------------------------------------------------------*#
profiling:
$(eval BUILD_PROF="True")
#*--------------------------------------------------------*#
# Define targets used to activate file format support. #
@ -156,9 +183,11 @@ netCDF:
#*--------------------------------------------------------*#
# Define the wrappers for the compile command targets. #
#*--------------------------------------------------------*#
debug: | clean --build_debug tool eas3 build_bwc display
debug: | clean build_debug build_bwc display
full: | clean build_bwc display
release: | build_bwc display
full: | clean tool eas3 build_bwc display
cmdl: | clean tool profiling eas3 build_bwc display
cldebug: | clean build_debug tool profiling eas3 build_bwc display
#*--------------------------------------------------------*#
# Define target used to output compile information. #
@ -182,6 +211,7 @@ display:
@echo " Link Type: $(LINK_TYPE)"
@echo " Precision: $(BUILD_PREC)"
@echo " Utilities: $(BUILD_TOOL)"
@echo " Profiling: $(BUILD_PROF)"
@echo ""
@echo " Build date: $(shell date)"
@echo " User: $(USER)"
@ -192,7 +222,7 @@ display:
# Define the main compile command targets. #
#*--------------------------------------------------------*#
build_bwc:
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
mkdir -p build && cd build && cmake .. "-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" "-DLINK:STRING=${LINK_TYPE}" "-DPREC:STRING=${BUILD_PREC}" "-DTOOL=${BUILD_TOOL}" "-DPROF=${BUILD_PROF}" "-DBUILD_EAS3=${BUILD_EAS3}" "-DBUILD_NETCDF=${BUILD_NETCDF}" && $(MAKE) -j
clean:
- /bin/rm -rf build/ bin/ lib/ lib64/ include/library/public

View file

@ -103,4 +103,19 @@
bwc_tile_sizeof, // Tiling defined by size of one tile
bwc_tile_numbof, // Tiling defined by the number of tiles
} bwc_tile_instr;
/*----------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! !
! These constants are used to signal the dataset sample precision. !
! !
\*----------------------------------------------------------------------------------------------*/
typedef enum
{
bwc_type_half,
bwc_type_single,
bwc_type_double,
} bwc_type;
#endif

View file

@ -713,24 +713,5 @@
bwc_gl_ctrl control; // Global control structure
bwc_tile *tile; // Structure defining bwc tile.
struct meter
{
double bpd; // Average bits per datapoint.
double cpr; // Compression ratio
double css; // Codestream size.
struct time
{
double ttl; // Total compression time.
double cpy; // Total time used copying data.
double nrm; // Total time used normalizing data.
double wav; // Total time used for wavelet transform.
double ent; // Total time used for entropy encoding.
double ass; // Total codestream assembly time.
} time;
} meter;
} bwc_field;
#endif

View file

@ -94,6 +94,15 @@ else()
target_compile_definitions(bwclib PRIVATE -DBWC_DOUBLE_PRECISION)
endif()
#----------------------------------------------------------#
# Set the target compile definition for the profiling #
# output. #
#----------------------------------------------------------#
if(${PROF})
target_compile_definitions(bwclib PRIVATE -DBWC_PROFILE)
MESSAGE(STATUS "Profiling: ${PROF}")
endif()
#----------------------------------------------------------#
# Set the Version and SOVersion and define the public API #
# for the BigWhoop library. #

View file

@ -56,6 +56,9 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef BWC_PROFILE
#include <inttypes.h>
#endif
#include "bitstream.h"
#include "constants.h"
@ -73,6 +76,72 @@
|| | | \ | \/ | | | |___ | |__| | \| |___ | | |__| | \| ___] ||
|| ||
\************************************************************************************************************/
/*----------------------------------------------------------------------------------------------------------*\
! !
! DESCRIPTION: !
! ------------ !
! This function takes an integer value and generates a version with the appropri- !
! ate byte unit in log2 format that is returned to the function caller. !
! !
! DEVELOPMENT HISTORY: !
! -------------------- !
! !
! Date Author Change Id Release Description Of Change !
! ---- ------ --------- ------- --------------------- !
! 03.05.2019 Patrick Vogler B87D120 V 0.1.0 function created !
! 04.05.2021 Patrick Vogler B87E7E4 V 0.1.0 clean up !
! !
\*----------------------------------------------------------------------------------------------------------*/
#if defined BWC_PROFILE
const char*
get_size(uint64_t integer)
{
/*-----------------------*\
! DEFINE INT VARIABLES: !
\*-----------------------*/
uint64_t multiplier;
uint8_t i;
/*-----------------------*\
! DEFINE CHAR VARIABLES: !
\*-----------------------*/
char *sizes[] = { "EiB", "PiB", "TiB", "GiB", "MiB", "KiB", "B" };
static char str[20];
/*--------------------------------------------------------*\
! Set up the multiplier used to evaluate the digital unit !
! prefix and allocate the character array returned to the !
! function caller. !
\*--------------------------------------------------------*/
multiplier = 1024ULL * 1024ULL * 1024ULL *
1024ULL * 1024ULL * 1024ULL;
/*--------------------------------------------------------*\
! If larger than 0, iterate over the byte units until the !
! integer is within its range and populate the char. array !
! with the appropriate information. !
\*--------------------------------------------------------*/
if(integer > 0)
{
for(i = 0; i < 7; ++i, multiplier /= 1024)
{
if(integer < multiplier)
continue;
if(integer % multiplier == 0)
sprintf(str, "%" PRIu64 " %s", integer / multiplier, sizes[i]);
else
sprintf(str, "%.1f %s", floor((10.0 * integer) / multiplier) / 10.0, sizes[i]);
break;
}
}
else
{
strcpy(str, "0 B");
}
return str;
}
#endif
/*----------------------------------------------------------------------------------------------------------*\
! FUNCTION NAME: uint8 initialize_precinct(bwc_field *const field, bwc_precinct *precinct, !
! -------------- const uint32 dX, const uint32 dY, !
@ -3885,11 +3954,30 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
uint64 i;
uint16 p;
#ifdef BWC_PROFILE
uint64 css;
uint64 nfs;
#endif
/*-----------------------*\
! DEFINE FLOAT VARIABLES: !
\*-----------------------*/
double start, end;
#ifdef BWC_PROFILE
double bpd;
double cpr;
double ttl;
double cpy;
double nrm;
double wav;
double ent;
double ass;
#endif
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
@ -3908,10 +3996,12 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Initialize the compression time measurement. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime();
#else
field->meter.time.ttl = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
ttl = omp_get_wtime();
#else
ttl = (double)clock();
#endif
#endif
/*--------------------------------------------------------*\
@ -3978,18 +4068,22 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
! Fill the working buffer with the flow field data for the !
! current tile parameter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
fill_buffer(field, tile, parameter, working_buffer, data, p);
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.cpy += end - start;
#else
end = (double)clock();
field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
cpy += end - start;
#else
end = (double)clock();
cpy += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -3997,60 +4091,72 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
! scale it to the dynamic range specified by the Qm param- !
! eter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
normalize_param(field, parameter);
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.nrm += end - start;
#else
end = (double)clock();
field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
nrm += end - start;
#else
end = (double)clock();
nrm += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Perform the forward discrete wavelet transform. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(forward_wavelet_transform(field, parameter))
{
free(working_buffer);
return 1;
}
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.wav += end - start;
#else
end = (double)clock();
field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
wav += end - start;
#else
end = (double)clock();
wav += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Tier1 encode the current tile parameter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(t1_encode(field, tile, parameter))
{
free(working_buffer);
return 1;
}
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ent += end - start;
#else
end = (double)clock();
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
ent += end - start;
#else
end = (double)clock();
ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4062,31 +4168,37 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Tier2 encode the current tile. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(t2_encode(field, tile))
{
free(working_buffer);
return 1;
}
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ent += end - start;
#else
end = (double)clock();
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
ent += end - start;
#else
end = (double)clock();
ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
}
/*--------------------------------------------------------*\
! Assemble compressed codestream. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
data->codestream.data = assemble_codestream(field);
if(!data->codestream.data)
@ -4094,12 +4206,14 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
free(working_buffer);
return 1;
}
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ass += end - start;
#else
end = (double)clock();
field->meter.time.ass += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
ass += end - start;
#else
end = (double)clock();
ass += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4108,12 +4222,33 @@ bwc_compress(bwc_field *const field, bwc_data *const data)
free(working_buffer);
/*--------------------------------------------------------*\
! Calculate the compression time. !
! Output the profiling information. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
#else
field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
ttl = omp_get_wtime() - ttl;
#else
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC;
#endif
nfs = (uint64)(info->nX * info->nY * info->nZ * info->nTS * info->nPar * info->precision);
css = (uint64)data->codestream.data->size;
cpr = (double)nfs/css;
bpd = (double)(css * 64.0f)/nfs;
printf("==============================================================\n");
printf(" Compression Time: %*.2f s\n", 25, ttl);
printf(" - Wavelet transformation: %*.2f s\n", 25, wav);
printf(" - Entropy encoding: %*.2f s\n", 25, ent);
printf(" - Codestream assembly: %*.2f s\n", 25, ass);
printf("\n");
printf(" Compression Ratio: %*.2f\n", 27, cpr);
printf(" - Codestream size: %*s\n", 25, get_size(css));
printf(" - Field size: %*s\n", 25, get_size(nfs));
printf(" - Average bpd: %*.2f\n", 27, bpd);
printf("==============================================================\n");
#endif
/*--------------------------------------------------------*\
@ -4240,6 +4375,17 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
\*-----------------------*/
double start, end;
#ifdef BWC_PROFILE
double ttl;
double cpy;
double nrm;
double wav;
double ent;
double ass;
#endif
/*-----------------------*\
! DEFINE STRUCTS: !
\*-----------------------*/
@ -4259,11 +4405,14 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Initialize the decompression time measurement. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime();
#else
field->meter.time.ttl = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
ttl = omp_get_wtime();
#else
ttl = (double)clock();
#endif
#endif
/*--------------------------------------------------------*\
! Save the global control and info structure to temporary !
@ -4350,61 +4499,73 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
/*--------------------------------------------------------*\
! Tier1 decode the current tile parameter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(t1_decode(field, tile, parameter))
{
free(working_buffer);
return 1;
}
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.ent += end - start;
#else
end = (double)clock();
field->meter.time.ent += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
ent += end - start;
#else
end = (double)clock();
ent += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Perform the inverse discrete wavelet transform. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
if(inverse_wavelet_transform(field, parameter))
{
free(working_buffer);
return 1;
}
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.wav += end - start;
#else
end = (double)clock();
field->meter.time.wav += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
wav += end - start;
#else
end = (double)clock();
wav += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
! Denormalize the working buffer scale it to the original !
! dynamic range specified by the Qm parameter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
denormalize_param(field, parameter);
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.nrm += end - start;
#else
end = (double)clock();
field->meter.time.nrm += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
nrm += end - start;
#else
end = (double)clock();
nrm += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4412,18 +4573,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
! in the flow field data structure for the current tile pa-!
! rameter. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#if defined BWC_PROFILE
#if defined (_OPENMP)
start = omp_get_wtime();
#else
start = (double)clock();
#endif
#endif
flush_buffer(field, tile, parameter, working_buffer, data, p);
#if defined (_OPENMP)
end = omp_get_wtime();
field->meter.time.cpy += end - start;
#else
end = (double)clock();
field->meter.time.cpy += (end - start)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
end = omp_get_wtime();
cpy += end - start;
#else
end = (double)clock();
cpy += (end - start)/CLOCKS_PER_SEC;
#endif
#endif
/*--------------------------------------------------------*\
@ -4440,13 +4605,22 @@ bwc_decompress(bwc_field *const field, bwc_data *const data)
free(working_buffer);
/*--------------------------------------------------------*\
! Calculate the decompression time. !
! Output the profiling information. !
\*--------------------------------------------------------*/
#if defined (_OPENMP)
field->meter.time.ttl = omp_get_wtime() - field->meter.time.ttl;
#else
field->meter.time.ttl = ((double)clock() - field->meter.time.ttl)/CLOCKS_PER_SEC;
#if defined BWC_PROFILE
#if defined (_OPENMP)
ttl = omp_get_wtime() - ttl;
#else
ttl = ((double)clock() - ttl)/CLOCKS_PER_SEC;
#endif
printf("==============================================================\n");
printf(" Decompression Time: %*.2f s\n", 24, ttl);
printf(" - Wavelet transformation: %*.2f s\n", 24, wav);
printf(" - Entropy encoding: %*.2f s\n", 24, ent);
printf("==============================================================\n");
#endif
return 0;
}

View file

@ -52,14 +52,14 @@ add_executable(bwccmd bwccmdl.c
# Set the target compile definition for the requested file #
# format support. #
#----------------------------------------------------------#
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
if(${BUILD_EAS3})
target_compile_definitions(bwccmd PRIVATE -DBWC_EAS3)
MESSAGE(STATUS "EAS3 file format support: ${BUILD_EAS3}")
endif()
if(${BUILD_NETCDF})
target_compile_definitions(bwccmd PRIVATE -DBWC_NETCDF)
MESSAGE(STATUS "NetCDF file format support: ${BUILD_NETCDF}")
endif()
#----------------------------------------------------------#

View file

@ -3012,57 +3012,6 @@ main(int argc,
{
printf("==============================================================\n");
}
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
if(file->info.parameter)
{
param = file->info.parameter->root;
while(param != NULL)
{
size += (param->size * param->precision);
param = param -> next;
}
}
comp_ratio = (double)size/(file->codestream.data->size);
bpd = (double)(file->codestream.data->size * 64)/size;
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
csSize = get_size(file->codestream.data->size);
fdSize = get_size(size);
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
printf(" Compression Time: %*.2f s\n", 25, field->meter.time.ttl);
printf(" - Wavelet transformation: %*.2f s\n", 25, field->meter.time.wav);
printf(" - Entropy encoding: %*.2f s\n", 25, field->meter.time.ent);
printf(" - Codestream assembly: %*.2f s\n", 25, field->meter.time.ass);
printf("\n");
printf(" Compression Ratio: %*.2f\n", 27, comp_ratio);
printf(" - Codestream size: %*s\n", 25, csSize);
printf(" - Field size: %*s\n", 25, fdSize);
printf(" - Average bpd: %*.2f\n", 27, bpd);
printf("==============================================================\n");
/*--------------------------------------------------------*\
! Calculate the original field size, compression ratio and !
! bits per datapoint and print the miscellaneous compres- !
! sion information to the standard output. !
\*--------------------------------------------------------*/
free(csSize);
free(fdSize);
}
}
/*--------------------------------------------------------*\
@ -3152,21 +3101,6 @@ main(int argc,
goto OUT;
}
}
/*--------------------------------------------------------*\
! If the verbose flag is set by the function caller, print !
! the miscellaneous decompression information to the stan- !
! dard output. !
\*--------------------------------------------------------*/
temp = retrieve_arg(args, "verbose");
if(temp != NULL)
{
printf("==============================================================\n");
printf(" Decompression Time: %*.2f s\n", 24, field->meter.time.ttl);
printf(" - Wavelet transformation: %*.2f s\n", 24, field->meter.time.wav);
printf(" - Entropy encoding: %*.2f s\n", 24, field->meter.time.ent);
printf("==============================================================\n");
}
}
/*--------------------------------------------------------*\
! !