header info mode
This commit is contained in:
parent
acf703f650
commit
6176fea676
1 changed files with 114 additions and 1 deletions
|
@ -1547,7 +1547,120 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
else if (arguments.mode == cli_inf)
|
||||
{
|
||||
printf("Header Info\n");
|
||||
strcat(cli_verbose, bwc_header_art);
|
||||
strcat(cli_verbose, "--------------------------- I/O --------------------------\n\n");
|
||||
sprintf(cli_buffer," Input: %s \n", arguments.in);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
if ((fp = fopen(arguments.in, "r")) == NULL)
|
||||
{
|
||||
error_handle = EXIT_FAILURE;
|
||||
printf(FINERROR);
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
root = ftell(fp);
|
||||
fseek(fp, 0L, SEEK_END);
|
||||
Lfield = ftell(fp) - root;
|
||||
fseek(fp, root, SEEK_SET);
|
||||
|
||||
/* Read the compressed data from the input file. */
|
||||
input = calloc(Lfield, sizeof(uchar));
|
||||
if (fread(input, sizeof(uchar), Lfield, fp) != Lfield)
|
||||
{
|
||||
error_handle = EXIT_FAILURE;
|
||||
printf(RDERROR);
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
/* Retrieve header information and allocate output buffer. */
|
||||
header = bwc_open_header(input);
|
||||
size = header->info.nX * header->info.nY * header->info.nZ *
|
||||
header->info.nTS * header->info.nPar;
|
||||
if(header->info.data_prec == bwc_precision_double)
|
||||
{
|
||||
output = calloc(size, sizeof(double));
|
||||
}
|
||||
else if(header->info.data_prec == bwc_precision_single)
|
||||
{
|
||||
output = calloc(size, sizeof(float));
|
||||
}
|
||||
bwc_close_header(header);
|
||||
|
||||
strcat(cli_verbose, "\n");
|
||||
strcat(cli_verbose, "----------------- Compression Parameters -----------------\n");
|
||||
strcat(cli_verbose, "\n");
|
||||
|
||||
strcat(cli_verbose," Tile Size: \n");
|
||||
sprintf(cli_buffer," - Samples in 1.D: %27ld\n"\
|
||||
" - Samples in 2.D: %27ld\n"\
|
||||
" - Samples in 3.D: %27ld\n"\
|
||||
" - Samples in 4.D: %27ld\n", header->control.tileSizeX,
|
||||
header->control.tileSizeY,
|
||||
header->control.tileSizeZ,
|
||||
header->control.tileSizeTS);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
strcat(cli_verbose, " __________________________________________________________\n");
|
||||
strcat(cli_verbose, "\n");
|
||||
strcat(cli_verbose, " 1.D | 2.D | 3.D | 4.D\n");
|
||||
sprintf(cli_buffer, " Decomposition Levels: %18d |%4d |%4d |%4d\n",
|
||||
header->control.decompX,
|
||||
header->control.decompY,
|
||||
header->control.decompZ,
|
||||
header->control.decompTS);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
sprintf(cli_buffer, " Precincts [log2]: %18d |%4d |%4d |%4d\n",
|
||||
header->control.precSizeX,
|
||||
header->control.precSizeY,
|
||||
header->control.precSizeZ,
|
||||
header->control.precSizeTS);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
sprintf(cli_buffer, " Codeblocks [log2]: %18d |%4d |%4d |%4d\n",
|
||||
header->control.cbX,
|
||||
header->control.cbY,
|
||||
header->control.cbZ,
|
||||
header->control.cbTS);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
strcat(cli_verbose, " __________________________________________________________\n");
|
||||
strcat(cli_verbose, "\n");
|
||||
|
||||
sprintf(cli_buffer, " Q Number Format: %27d\n", header->control.Qm);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
if (header->control.error_resilience)
|
||||
{
|
||||
sprintf(cli_buffer, " Error Resilience: %27s\n", "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(cli_buffer, " Error Resilience: %27s\n", "false");
|
||||
}
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
|
||||
strcat(cli_verbose, " __________________________________________________________\n");
|
||||
strcat(cli_verbose, "\n");
|
||||
|
||||
for(i = 0; i < header->control.nLayers; ++i)
|
||||
{
|
||||
sprintf(cli_buffer, " Quality Layer Nr. %d: %33.2f bpd\n", i,
|
||||
header->control.bitrate[i]);
|
||||
strcat(cli_verbose, cli_buffer);
|
||||
}
|
||||
|
||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||
strcat(cli_verbose, "\n==============================================================\n");
|
||||
printf("%s", cli_verbose);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue