modify j2k_dump to support output file, needed for non-regression tests
This commit is contained in:
parent
a7f08e9b36
commit
ff6d246efd
7
CHANGES
7
CHANGES
|
@ -5,12 +5,13 @@ What's New for OpenJPEG
|
||||||
! : changed
|
! : changed
|
||||||
+ : added
|
+ : added
|
||||||
|
|
||||||
|
July 25, 2011
|
||||||
|
* [mickael] fixed issue 74 for trunk
|
||||||
|
! [mickael] modify j2k_dump to support output file, needed for non-regression tests
|
||||||
|
|
||||||
July 22, 2011
|
July 22, 2011
|
||||||
! [mickael] correct some troubles about thirdparty when they are used
|
! [mickael] correct some troubles about thirdparty when they are used
|
||||||
|
|
||||||
July 25, 2011
|
|
||||||
* fixed issue 74 for trunk
|
|
||||||
|
|
||||||
July 21, 2011
|
July 21, 2011
|
||||||
! [mickael] correct a compil error linked to getopt with win platform
|
! [mickael] correct a compil error linked to getopt with win platform
|
||||||
!+ [mickael] add new decode tests based on conformance data and tolerance. Non regression is also added on the decoder output. Deactivate old tests.
|
!+ [mickael] add new decode tests based on conformance data and tolerance. Non regression is also added on the decoder output. Deactivate old tests.
|
||||||
|
|
|
@ -92,6 +92,10 @@ void decode_help_display() {
|
||||||
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
|
fprintf(stdout," REQUIRED only if an Input image directory not specified\n");
|
||||||
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
|
fprintf(stdout," Currently accepts J2K-files, JP2-files and JPT-files. The file type\n");
|
||||||
fprintf(stdout," is identified based on its suffix.\n");
|
fprintf(stdout," is identified based on its suffix.\n");
|
||||||
|
fprintf(stdout," -o <output file>\n");
|
||||||
|
fprintf(stdout," OPTIONAL\n");
|
||||||
|
fprintf(stdout," Output file where file info will be dump.\n");
|
||||||
|
fprintf(stdout," By default it will be in the stdout.\n");
|
||||||
fprintf(stdout,"\n");
|
fprintf(stdout,"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +201,7 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||||
{"ImgDir",REQ_ARG, NULL ,'y'},
|
{"ImgDir",REQ_ARG, NULL ,'y'},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char optlist[] = "i:h";
|
const char optlist[] = "i:o:h";
|
||||||
totlen=sizeof(long_option);
|
totlen=sizeof(long_option);
|
||||||
img_fol->set_out_format = 0;
|
img_fol->set_out_format = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -222,6 +226,15 @@ int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,i
|
||||||
}
|
}
|
||||||
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
strncpy(parameters->infile, infile, sizeof(parameters->infile)-1);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
|
||||||
|
case 'o': /* output file */
|
||||||
|
{
|
||||||
|
char *outfile = optarg;
|
||||||
|
strncpy(parameters->outfile, outfile, sizeof(parameters->outfile)-1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ----------------------------------------------------- */
|
/* ----------------------------------------------------- */
|
||||||
|
@ -306,7 +319,7 @@ int main(int argc, char *argv[])
|
||||||
img_fol_t img_fol;
|
img_fol_t img_fol;
|
||||||
opj_event_mgr_t event_mgr; /* event manager */
|
opj_event_mgr_t event_mgr; /* event manager */
|
||||||
opj_image_t *image = NULL;
|
opj_image_t *image = NULL;
|
||||||
FILE *fsrc = NULL;
|
FILE *fsrc = NULL, *fout = NULL;;
|
||||||
unsigned char *src = NULL;
|
unsigned char *src = NULL;
|
||||||
int file_length;
|
int file_length;
|
||||||
int num_images;
|
int num_images;
|
||||||
|
@ -362,6 +375,19 @@ int main(int argc, char *argv[])
|
||||||
num_images=1;
|
num_images=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (parameters.outfile[0] != 0)
|
||||||
|
{
|
||||||
|
fout = fopen(parameters.outfile,"w");
|
||||||
|
if (!fout)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR -> failed to open %s for reading\n", parameters.outfile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fout = stdout;
|
||||||
|
|
||||||
/*Encoding image one by one*/
|
/*Encoding image one by one*/
|
||||||
for(imageno = 0; imageno < num_images ; imageno++)
|
for(imageno = 0; imageno < num_images ; imageno++)
|
||||||
{
|
{
|
||||||
|
@ -421,10 +447,10 @@ int main(int argc, char *argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* dump image */
|
/* dump image */
|
||||||
j2k_dump_image(stdout, image);
|
j2k_dump_image(fout, image);
|
||||||
|
|
||||||
/* dump cp */
|
/* dump cp */
|
||||||
j2k_dump_cp(stdout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
j2k_dump_cp(fout, image, ((opj_j2k_t*)dinfo->j2k_handle)->cp);
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close the byte stream */
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
@ -472,10 +498,10 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
free(image->icc_profile_buf); image->icc_profile_buf = NULL;
|
||||||
}
|
}
|
||||||
j2k_dump_image(stdout, image);
|
j2k_dump_image(fout, image);
|
||||||
|
|
||||||
/* dump cp */
|
/* dump cp */
|
||||||
j2k_dump_cp(stdout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
j2k_dump_cp(fout, image, ((opj_jp2_t*)dinfo->jp2_handle)->j2k->cp);
|
||||||
|
|
||||||
/* close the byte stream */
|
/* close the byte stream */
|
||||||
opj_cio_close(cio);
|
opj_cio_close(cio);
|
||||||
|
@ -554,6 +580,8 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fout);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue