refactor/clean up in cmdl tool

This commit is contained in:
Gregor Weiss 2024-11-06 17:23:09 +01:00
parent 1a087c1c85
commit acf703f650
Signed by: Gregor Weiss
GPG key ID: 61E170A8BBFE5756

View file

@ -1219,6 +1219,7 @@ int main(int argc, char *argv[])
data->params.nts,
data->params.npar,
precision);
bwc_set_aux(stream, (char*)data->aux.ptr, data->aux.len);
/* Apply the user supplied compression options using the *
* appropriate setter functions. */
@ -1416,8 +1417,6 @@ int main(int argc, char *argv[])
printf("%s", cli_verbose);
}
bwc_set_aux(stream, (char*)data->aux.ptr, data->aux.len);
/* Initialize the rate control string according to the *
* specified bit rate/compression ratio. */
if (bwc_create_compression(coder, stream, rate) == EXIT_FAILURE)
@ -1494,14 +1493,6 @@ int main(int argc, char *argv[])
memset(cli_buffer, '0', sizeof(char) * 1024);
}
if ((arguments.verbose == true) &&
(delim == true))
{
strcat(cli_verbose, " __________________________________________________________\n");
strcat(cli_verbose, "\n");
}
if (arguments.verbose == true)
{
memset(cli_buffer, '0', sizeof(char) * 1024);
@ -1509,7 +1500,7 @@ int main(int argc, char *argv[])
printf("%s", cli_verbose);
}
/* Read the codestream from the specified file. */
/* Read the compressed data from the input file. */
input = calloc(Lfield, sizeof(uchar));
if (fread(input, sizeof(uchar), Lfield, fp) != Lfield)
{
@ -1518,11 +1509,10 @@ int main(int argc, char *argv[])
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));
@ -1531,29 +1521,20 @@ int main(int argc, char *argv[])
{
output = calloc(size, sizeof(float));
}
bwc_close_header(header);
/* Initialize and run the decompression. */
stream = bwc_init_stream(input, output, comp);
coder = bwc_alloc_decoder();
//if (arguments.verbose == true)
//{
//memset(cli_buffer, '0', sizeof(char) * 1024);
//strcat(cli_verbose, "\n==============================================================\n");
//printf("%s", cli_verbose);
//}
/* Initialize the rate control string according to the *
* specified bit rate/compression ratio. */
if (bwc_create_decompression(coder, stream, 0) == EXIT_FAILURE)
{
error_handle = EXIT_FAILURE;
goto OUT;
}
bwc_decompress(coder, stream);
/* Parse decompressed data into eas3 data structure *
* and write to the output file. */
data = calloc(1, sizeof(eas3_data));
bwc_to_eas3(stream, data);
write_eas3(data, cli_output);