refactor/clean up in cmdl tool
This commit is contained in:
parent
1a087c1c85
commit
acf703f650
1 changed files with 6 additions and 25 deletions
|
@ -1219,6 +1219,7 @@ int main(int argc, char *argv[])
|
||||||
data->params.nts,
|
data->params.nts,
|
||||||
data->params.npar,
|
data->params.npar,
|
||||||
precision);
|
precision);
|
||||||
|
bwc_set_aux(stream, (char*)data->aux.ptr, data->aux.len);
|
||||||
|
|
||||||
/* Apply the user supplied compression options using the *
|
/* Apply the user supplied compression options using the *
|
||||||
* appropriate setter functions. */
|
* appropriate setter functions. */
|
||||||
|
@ -1416,8 +1417,6 @@ int main(int argc, char *argv[])
|
||||||
printf("%s", cli_verbose);
|
printf("%s", cli_verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
bwc_set_aux(stream, (char*)data->aux.ptr, data->aux.len);
|
|
||||||
|
|
||||||
/* Initialize the rate control string according to the *
|
/* Initialize the rate control string according to the *
|
||||||
* specified bit rate/compression ratio. */
|
* specified bit rate/compression ratio. */
|
||||||
if (bwc_create_compression(coder, stream, rate) == EXIT_FAILURE)
|
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);
|
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)
|
if (arguments.verbose == true)
|
||||||
{
|
{
|
||||||
memset(cli_buffer, '0', sizeof(char) * 1024);
|
memset(cli_buffer, '0', sizeof(char) * 1024);
|
||||||
|
@ -1509,7 +1500,7 @@ int main(int argc, char *argv[])
|
||||||
printf("%s", cli_verbose);
|
printf("%s", cli_verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the codestream from the specified file. */
|
/* Read the compressed data from the input file. */
|
||||||
input = calloc(Lfield, sizeof(uchar));
|
input = calloc(Lfield, sizeof(uchar));
|
||||||
if (fread(input, sizeof(uchar), Lfield, fp) != Lfield)
|
if (fread(input, sizeof(uchar), Lfield, fp) != Lfield)
|
||||||
{
|
{
|
||||||
|
@ -1518,11 +1509,10 @@ int main(int argc, char *argv[])
|
||||||
goto OUT;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Retrieve header information and allocate output buffer. */
|
||||||
header = bwc_open_header(input);
|
header = bwc_open_header(input);
|
||||||
|
|
||||||
size = header->info.nX * header->info.nY * header->info.nZ *
|
size = header->info.nX * header->info.nY * header->info.nZ *
|
||||||
header->info.nTS * header->info.nPar;
|
header->info.nTS * header->info.nPar;
|
||||||
|
|
||||||
if(header->info.data_prec == bwc_precision_double)
|
if(header->info.data_prec == bwc_precision_double)
|
||||||
{
|
{
|
||||||
output = calloc(size, sizeof(double));
|
output = calloc(size, sizeof(double));
|
||||||
|
@ -1531,29 +1521,20 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
output = calloc(size, sizeof(float));
|
output = calloc(size, sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
bwc_close_header(header);
|
bwc_close_header(header);
|
||||||
|
|
||||||
|
/* Initialize and run the decompression. */
|
||||||
stream = bwc_init_stream(input, output, comp);
|
stream = bwc_init_stream(input, output, comp);
|
||||||
coder = bwc_alloc_decoder();
|
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)
|
if (bwc_create_decompression(coder, stream, 0) == EXIT_FAILURE)
|
||||||
{
|
{
|
||||||
error_handle = EXIT_FAILURE;
|
error_handle = EXIT_FAILURE;
|
||||||
goto OUT;
|
goto OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bwc_decompress(coder, stream);
|
bwc_decompress(coder, stream);
|
||||||
|
|
||||||
|
/* Parse decompressed data into eas3 data structure *
|
||||||
|
* and write to the output file. */
|
||||||
data = calloc(1, sizeof(eas3_data));
|
data = calloc(1, sizeof(eas3_data));
|
||||||
bwc_to_eas3(stream, data);
|
bwc_to_eas3(stream, data);
|
||||||
write_eas3(data, cli_output);
|
write_eas3(data, cli_output);
|
||||||
|
|
Loading…
Reference in a new issue