tests/: reformat a few files to be modified
This commit is contained in:
parent
714c63efee
commit
3835f37084
|
@ -36,20 +36,23 @@ void error_callback(const char *msg, void *v);
|
|||
void warning_callback(const char *msg, void *v);
|
||||
void info_callback(const char *msg, void *v);
|
||||
|
||||
void error_callback(const char *msg, void *v) {
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
void error_callback(const char *msg, void *v)
|
||||
{
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
}
|
||||
void warning_callback(const char *msg, void *v) {
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
void warning_callback(const char *msg, void *v)
|
||||
{
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
}
|
||||
void info_callback(const char *msg, void *v) {
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
void info_callback(const char *msg, void *v)
|
||||
{
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -87,51 +90,48 @@ int main(int argc, char *argv[])
|
|||
cmptparm.h = image_height;
|
||||
|
||||
image = opj_image_create(numcomps, &cmptparm, color_space);
|
||||
assert( image );
|
||||
assert(image);
|
||||
|
||||
for (i = 0; i < image_width * image_height; i++)
|
||||
{
|
||||
for (i = 0; i < image_width * image_height; i++) {
|
||||
unsigned int compno;
|
||||
for(compno = 0; compno < numcomps; compno++)
|
||||
{
|
||||
for (compno = 0; compno < numcomps; compno++) {
|
||||
image->comps[compno].data[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
opj_set_error_handler(l_codec, error_callback,00);
|
||||
opj_set_info_handler(l_codec, info_callback, 00);
|
||||
opj_set_warning_handler(l_codec, warning_callback, 00);
|
||||
opj_set_error_handler(l_codec, error_callback, 00);
|
||||
|
||||
l_codec = opj_create_compress(OPJ_CODEC_J2K);
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
opj_set_error_handler(l_codec, error_callback,00);
|
||||
opj_set_info_handler(l_codec, info_callback, 00);
|
||||
opj_set_warning_handler(l_codec, warning_callback, 00);
|
||||
opj_set_error_handler(l_codec, error_callback, 00);
|
||||
|
||||
opj_setup_encoder(l_codec, ¶meters, image);
|
||||
|
||||
l_stream = opj_stream_create_default_file_stream("testempty1.j2k",OPJ_FALSE);
|
||||
l_stream = opj_stream_create_default_file_stream("testempty1.j2k", OPJ_FALSE);
|
||||
assert(l_stream);
|
||||
bSuccess = opj_start_compress(l_codec,image,l_stream);
|
||||
if( !bSuccess )
|
||||
{
|
||||
bSuccess = opj_start_compress(l_codec, image, l_stream);
|
||||
if (!bSuccess) {
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
bSuccess = opj_encode(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
bSuccess = opj_end_compress(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
|
||||
puts( "end" );
|
||||
puts("end");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -37,20 +37,23 @@ void error_callback(const char *msg, void *v);
|
|||
void warning_callback(const char *msg, void *v);
|
||||
void info_callback(const char *msg, void *v);
|
||||
|
||||
void error_callback(const char *msg, void *v) {
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
void error_callback(const char *msg, void *v)
|
||||
{
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
}
|
||||
void warning_callback(const char *msg, void *v) {
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
void warning_callback(const char *msg, void *v)
|
||||
{
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
}
|
||||
void info_callback(const char *msg, void *v) {
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
void info_callback(const char *msg, void *v)
|
||||
{
|
||||
(void)msg;
|
||||
(void)v;
|
||||
puts(msg);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -89,56 +92,52 @@ int main(int argc, char *argv[])
|
|||
cmptparm.dy = subsampling_dy;
|
||||
cmptparm.w = image_width;
|
||||
cmptparm.h = image_height;
|
||||
strncpy(parameters.outfile, outputfile, sizeof(parameters.outfile)-1);
|
||||
strncpy(parameters.outfile, outputfile, sizeof(parameters.outfile) - 1);
|
||||
|
||||
image = opj_image_create(numcomps, &cmptparm, color_space);
|
||||
assert( image );
|
||||
assert(image);
|
||||
|
||||
for (i = 0; i < image_width * image_height; i++)
|
||||
{
|
||||
for (i = 0; i < image_width * image_height; i++) {
|
||||
unsigned int compno;
|
||||
for(compno = 0; compno < numcomps; compno++)
|
||||
{
|
||||
for (compno = 0; compno < numcomps; compno++) {
|
||||
image->comps[compno].data[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* catch events using our callbacks and give a local context */
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
opj_set_error_handler(l_codec, error_callback,00);
|
||||
opj_set_info_handler(l_codec, info_callback, 00);
|
||||
opj_set_warning_handler(l_codec, warning_callback, 00);
|
||||
opj_set_error_handler(l_codec, error_callback, 00);
|
||||
|
||||
l_codec = opj_create_compress(OPJ_CODEC_J2K);
|
||||
opj_set_info_handler(l_codec, info_callback,00);
|
||||
opj_set_warning_handler(l_codec, warning_callback,00);
|
||||
opj_set_error_handler(l_codec, error_callback,00);
|
||||
opj_set_info_handler(l_codec, info_callback, 00);
|
||||
opj_set_warning_handler(l_codec, warning_callback, 00);
|
||||
opj_set_error_handler(l_codec, error_callback, 00);
|
||||
|
||||
opj_setup_encoder(l_codec, ¶meters, image);
|
||||
|
||||
l_stream = opj_stream_create_default_file_stream(parameters.outfile,OPJ_FALSE);
|
||||
if( !l_stream )
|
||||
{
|
||||
fprintf( stderr, "Something went wrong during creation of stream\n" );
|
||||
l_stream = opj_stream_create_default_file_stream(parameters.outfile, OPJ_FALSE);
|
||||
if (!l_stream) {
|
||||
fprintf(stderr, "Something went wrong during creation of stream\n");
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
opj_stream_destroy(l_stream);
|
||||
return 1;
|
||||
}
|
||||
assert(l_stream);
|
||||
bSuccess = opj_start_compress(l_codec,image,l_stream);
|
||||
if( !bSuccess )
|
||||
{
|
||||
bSuccess = opj_start_compress(l_codec, image, l_stream);
|
||||
if (!bSuccess) {
|
||||
opj_stream_destroy(l_stream);
|
||||
opj_destroy_codec(l_codec);
|
||||
opj_image_destroy(image);
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
bSuccess = opj_encode(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
bSuccess = opj_end_compress(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
|
||||
|
@ -147,37 +146,37 @@ int main(int argc, char *argv[])
|
|||
|
||||
|
||||
/* read back the generated file */
|
||||
{
|
||||
{
|
||||
opj_codec_t* d_codec = 00;
|
||||
opj_dparameters_t dparameters;
|
||||
|
||||
d_codec = opj_create_decompress(OPJ_CODEC_J2K);
|
||||
opj_set_info_handler(d_codec, info_callback,00);
|
||||
opj_set_warning_handler(d_codec, warning_callback,00);
|
||||
opj_set_error_handler(d_codec, error_callback,00);
|
||||
opj_set_info_handler(d_codec, info_callback, 00);
|
||||
opj_set_warning_handler(d_codec, warning_callback, 00);
|
||||
opj_set_error_handler(d_codec, error_callback, 00);
|
||||
|
||||
bSuccess = opj_setup_decoder(d_codec, &dparameters);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
|
||||
l_stream = opj_stream_create_default_file_stream(outputfile,1);
|
||||
assert( l_stream );
|
||||
l_stream = opj_stream_create_default_file_stream(outputfile, 1);
|
||||
assert(l_stream);
|
||||
|
||||
bSuccess = opj_read_header(l_stream, d_codec, &image);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
|
||||
bSuccess = opj_decode(l_codec, l_stream, image);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
|
||||
bSuccess = opj_end_decompress(l_codec, l_stream);
|
||||
assert( bSuccess );
|
||||
assert(bSuccess);
|
||||
|
||||
opj_stream_destroy(l_stream);
|
||||
|
||||
opj_destroy_codec(d_codec);
|
||||
|
||||
opj_image_destroy(image);
|
||||
}
|
||||
}
|
||||
|
||||
puts( "end" );
|
||||
puts("end");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue