compare_images.c: code reformatting
This commit is contained in:
parent
3d35d0f3af
commit
c2b9d09c65
|
@ -53,22 +53,20 @@
|
|||
* Parse MSE and PEAK input values (
|
||||
* separator = ":"
|
||||
*******************************************************************************/
|
||||
static double* parseToleranceValues( char* inArg, const int nbcomp)
|
||||
static double* parseToleranceValues(char* inArg, const int nbcomp)
|
||||
{
|
||||
double* outArgs= malloc((size_t)nbcomp * sizeof(double));
|
||||
double* outArgs = malloc((size_t)nbcomp * sizeof(double));
|
||||
int it_comp = 0;
|
||||
const char delims[] = ":";
|
||||
char *result = strtok( inArg, delims );
|
||||
char *result = strtok(inArg, delims);
|
||||
|
||||
while( (result != NULL) && (it_comp < nbcomp ))
|
||||
{
|
||||
while ((result != NULL) && (it_comp < nbcomp)) {
|
||||
outArgs[it_comp] = atof(result);
|
||||
result = strtok( NULL, delims );
|
||||
result = strtok(NULL, delims);
|
||||
it_comp++;
|
||||
}
|
||||
|
||||
if (it_comp != nbcomp)
|
||||
{
|
||||
if (it_comp != nbcomp) {
|
||||
free(outArgs);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -81,27 +79,39 @@ static double* parseToleranceValues( char* inArg, const int nbcomp)
|
|||
*******************************************************************************/
|
||||
static void compare_images_help_display(void)
|
||||
{
|
||||
fprintf(stdout,"\nList of parameters for the compare_images function \n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout," -b \t REQUIRED \t filename to the reference/baseline PGX/TIF/PNM image \n");
|
||||
fprintf(stdout," -t \t REQUIRED \t filename to the test PGX/TIF/PNM image\n");
|
||||
fprintf(stdout," -n \t REQUIRED \t number of component of the image (used to generate correct filename, not used when both input files are TIF)\n");
|
||||
fprintf(stdout," -m \t OPTIONAL \t list of MSE tolerances, separated by : (size must correspond to the number of component) of \n");
|
||||
fprintf(stdout," -p \t OPTIONAL \t list of PEAK tolerances, separated by : (size must correspond to the number of component) \n");
|
||||
fprintf(stdout," -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX/PNM image with different components, "
|
||||
fprintf(stdout, "\nList of parameters for the compare_images function \n");
|
||||
fprintf(stdout, "\n");
|
||||
fprintf(stdout,
|
||||
" -b \t REQUIRED \t filename to the reference/baseline PGX/TIF/PNM image \n");
|
||||
fprintf(stdout, " -t \t REQUIRED \t filename to the test PGX/TIF/PNM image\n");
|
||||
fprintf(stdout,
|
||||
" -n \t REQUIRED \t number of component of the image (used to generate correct filename, not used when both input files are TIF)\n");
|
||||
fprintf(stdout,
|
||||
" -m \t OPTIONAL \t list of MSE tolerances, separated by : (size must correspond to the number of component) of \n");
|
||||
fprintf(stdout,
|
||||
" -p \t OPTIONAL \t list of PEAK tolerances, separated by : (size must correspond to the number of component) \n");
|
||||
fprintf(stdout,
|
||||
" -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX/PNM image with different components, "
|
||||
"please indicate b or t before separator to indicate respectively the separator "
|
||||
"for ref/base file and for test file. \n");
|
||||
fprintf(stdout," -d \t OPTIONAL \t indicate if you want to run this function as conformance test or as non regression test\n");
|
||||
fprintf(stdout,"\n");
|
||||
fprintf(stdout,
|
||||
" -d \t OPTIONAL \t indicate if you want to run this function as conformance test or as non regression test\n");
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
static int get_decod_format_from_string(const char *filename)
|
||||
{
|
||||
const int dot = '.';
|
||||
char * ext = strrchr(filename, dot);
|
||||
if( strcmp(ext,".pgx") == 0 ) return PGX_DFMT;
|
||||
if( strcmp(ext,".tif") == 0 ) return TIF_DFMT;
|
||||
if( strcmp(ext,".ppm") == 0 ) return PXM_DFMT;
|
||||
if (strcmp(ext, ".pgx") == 0) {
|
||||
return PGX_DFMT;
|
||||
}
|
||||
if (strcmp(ext, ".tif") == 0) {
|
||||
return TIF_DFMT;
|
||||
}
|
||||
if (strcmp(ext, ".ppm") == 0) {
|
||||
return PXM_DFMT;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -110,7 +120,8 @@ static int get_decod_format_from_string(const char *filename)
|
|||
* Create filenames from a filename using separator and nb components
|
||||
* (begin from 0)
|
||||
*******************************************************************************/
|
||||
static char* createMultiComponentsFilename(const char* inFilename, const int indexF, const char* separator)
|
||||
static char* createMultiComponentsFilename(const char* inFilename,
|
||||
const int indexF, const char* separator)
|
||||
{
|
||||
char s[255];
|
||||
char *outFilename, *ptr;
|
||||
|
@ -119,13 +130,10 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
|
|||
int decod_format;
|
||||
|
||||
/*printf("inFilename = %s\n", inFilename);*/
|
||||
if ((ptr = strrchr(inFilename, token)) != NULL)
|
||||
{
|
||||
if ((ptr = strrchr(inFilename, token)) != NULL) {
|
||||
posToken = strlen(inFilename) - strlen(ptr);
|
||||
/*printf("Position of %c character inside inFilename = %d\n", token, posToken);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/*printf("Token %c not found\n", token);*/
|
||||
outFilename = (char*)malloc(1);
|
||||
outFilename[0] = '\0';
|
||||
|
@ -141,12 +149,9 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
|
|||
strcat(outFilename, s);
|
||||
|
||||
decod_format = get_decod_format_from_string(inFilename);
|
||||
if( decod_format == PGX_DFMT )
|
||||
{
|
||||
if (decod_format == PGX_DFMT) {
|
||||
strcat(outFilename, ".pgx");
|
||||
}
|
||||
else if( decod_format == PXM_DFMT )
|
||||
{
|
||||
} else if (decod_format == PXM_DFMT) {
|
||||
strcat(outFilename, ".pgm");
|
||||
}
|
||||
|
||||
|
@ -157,7 +162,8 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
|
|||
/*******************************************************************************
|
||||
*
|
||||
*******************************************************************************/
|
||||
static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX, const char *separator)
|
||||
static opj_image_t* readImageFromFilePPM(const char* filename,
|
||||
int nbFilenamePGX, const char *separator)
|
||||
{
|
||||
int it_file;
|
||||
opj_image_t* image_read = NULL;
|
||||
|
@ -167,8 +173,9 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
|
|||
int** data;
|
||||
|
||||
/* If separator is empty => nb file to read is equal to one*/
|
||||
if ( strlen(separator) == 0 )
|
||||
if (strlen(separator) == 0) {
|
||||
nbFilenamePGX = 1;
|
||||
}
|
||||
|
||||
/* set encoding parameters to default values */
|
||||
opj_set_default_encoder_parameters(¶meters);
|
||||
|
@ -179,22 +186,21 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
|
|||
param_image_read = malloc((size_t)nbFilenamePGX * sizeof(opj_image_cmptparm_t));
|
||||
data = malloc((size_t)nbFilenamePGX * sizeof(*data));
|
||||
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
|
||||
{
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
|
||||
/* Create the right filename*/
|
||||
char *filenameComponentPGX;
|
||||
if (strlen(separator) == 0)
|
||||
{
|
||||
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(*filenameComponentPGX));
|
||||
if (strlen(separator) == 0) {
|
||||
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(
|
||||
*filenameComponentPGX));
|
||||
strcpy(filenameComponentPGX, filename);
|
||||
} else {
|
||||
filenameComponentPGX = createMultiComponentsFilename(filename, it_file,
|
||||
separator);
|
||||
}
|
||||
else
|
||||
filenameComponentPGX = createMultiComponentsFilename(filename, it_file, separator);
|
||||
|
||||
/* Read the tif file corresponding to the component */
|
||||
image_read = pnmtoimage(filenameComponentPGX, ¶meters);
|
||||
if (!image_read)
|
||||
{
|
||||
if (!image_read) {
|
||||
int it_free_data;
|
||||
fprintf(stderr, "Unable to load ppm file: %s\n", filenameComponentPGX);
|
||||
|
||||
|
@ -222,19 +228,22 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
|
|||
param_image_read[it_file].sgnd = image_read->comps->sgnd;
|
||||
|
||||
/* Copy data*/
|
||||
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w * sizeof(int));
|
||||
memcpy(data[it_file], image_read->comps->data, image_read->comps->h * image_read->comps->w * sizeof(int));
|
||||
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w
|
||||
* sizeof(int));
|
||||
memcpy(data[it_file], image_read->comps->data,
|
||||
image_read->comps->h * image_read->comps->w * sizeof(int));
|
||||
|
||||
/* Free memory*/
|
||||
opj_image_destroy(image_read);
|
||||
free(filenameComponentPGX);
|
||||
}
|
||||
|
||||
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read, OPJ_CLRSPC_UNSPECIFIED);
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
|
||||
{
|
||||
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read,
|
||||
OPJ_CLRSPC_UNSPECIFIED);
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
|
||||
/* Copy data into output image and free memory*/
|
||||
memcpy(image->comps[it_file].data, data[it_file], image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
|
||||
memcpy(image->comps[it_file].data, data[it_file],
|
||||
image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
|
||||
free(data[it_file]);
|
||||
}
|
||||
|
||||
|
@ -245,7 +254,8 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
|
|||
return image;
|
||||
}
|
||||
|
||||
static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX, const char *separator)
|
||||
static opj_image_t* readImageFromFileTIF(const char* filename,
|
||||
int nbFilenamePGX, const char *separator)
|
||||
{
|
||||
opj_image_t* image_read = NULL;
|
||||
opj_cparameters_t parameters;
|
||||
|
@ -262,7 +272,9 @@ static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX
|
|||
TIFFSetErrorHandler(NULL);
|
||||
#endif
|
||||
|
||||
if ( strlen(separator) != 0 ) return NULL;
|
||||
if (strlen(separator) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* set encoding parameters to default values */
|
||||
opj_set_default_encoder_parameters(¶meters);
|
||||
|
@ -273,8 +285,7 @@ static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX
|
|||
#ifdef OPJ_HAVE_LIBTIFF
|
||||
image_read = tiftoimage(filename, ¶meters);
|
||||
#endif
|
||||
if (!image_read)
|
||||
{
|
||||
if (!image_read) {
|
||||
fprintf(stderr, "Unable to load TIF file\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -282,7 +293,8 @@ static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX
|
|||
return image_read;
|
||||
}
|
||||
|
||||
static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX, const char *separator)
|
||||
static opj_image_t* readImageFromFilePGX(const char* filename,
|
||||
int nbFilenamePGX, const char *separator)
|
||||
{
|
||||
int it_file;
|
||||
opj_image_t* image_read = NULL;
|
||||
|
@ -292,8 +304,9 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
|
|||
int** data;
|
||||
|
||||
/* If separator is empty => nb file to read is equal to one*/
|
||||
if ( strlen(separator) == 0 )
|
||||
if (strlen(separator) == 0) {
|
||||
nbFilenamePGX = 1;
|
||||
}
|
||||
|
||||
/* set encoding parameters to default values */
|
||||
opj_set_default_encoder_parameters(¶meters);
|
||||
|
@ -304,22 +317,21 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
|
|||
param_image_read = malloc((size_t)nbFilenamePGX * sizeof(opj_image_cmptparm_t));
|
||||
data = malloc((size_t)nbFilenamePGX * sizeof(*data));
|
||||
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
|
||||
{
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
|
||||
/* Create the right filename*/
|
||||
char *filenameComponentPGX;
|
||||
if (strlen(separator) == 0)
|
||||
{
|
||||
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(*filenameComponentPGX));
|
||||
if (strlen(separator) == 0) {
|
||||
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(
|
||||
*filenameComponentPGX));
|
||||
strcpy(filenameComponentPGX, filename);
|
||||
} else {
|
||||
filenameComponentPGX = createMultiComponentsFilename(filename, it_file,
|
||||
separator);
|
||||
}
|
||||
else
|
||||
filenameComponentPGX = createMultiComponentsFilename(filename, it_file, separator);
|
||||
|
||||
/* Read the pgx file corresponding to the component */
|
||||
image_read = pgxtoimage(filenameComponentPGX, ¶meters);
|
||||
if (!image_read)
|
||||
{
|
||||
if (!image_read) {
|
||||
int it_free_data;
|
||||
fprintf(stderr, "Unable to load pgx file\n");
|
||||
|
||||
|
@ -347,19 +359,22 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
|
|||
param_image_read[it_file].sgnd = image_read->comps->sgnd;
|
||||
|
||||
/* Copy data*/
|
||||
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w * sizeof(int));
|
||||
memcpy(data[it_file], image_read->comps->data, image_read->comps->h * image_read->comps->w * sizeof(int));
|
||||
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w
|
||||
* sizeof(int));
|
||||
memcpy(data[it_file], image_read->comps->data,
|
||||
image_read->comps->h * image_read->comps->w * sizeof(int));
|
||||
|
||||
/* Free memory*/
|
||||
opj_image_destroy(image_read);
|
||||
free(filenameComponentPGX);
|
||||
}
|
||||
|
||||
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read, OPJ_CLRSPC_UNSPECIFIED);
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
|
||||
{
|
||||
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read,
|
||||
OPJ_CLRSPC_UNSPECIFIED);
|
||||
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
|
||||
/* Copy data into output image and free memory*/
|
||||
memcpy(image->comps[it_file].data, data[it_file], image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
|
||||
memcpy(image->comps[it_file].data, data[it_file],
|
||||
image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
|
||||
free(data[it_file]);
|
||||
}
|
||||
|
||||
|
@ -374,7 +389,8 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
|
|||
/*******************************************************************************
|
||||
*
|
||||
*******************************************************************************/
|
||||
static int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select)
|
||||
static int imageToPNG(const opj_image_t* image, const char* filename,
|
||||
int num_comp_select)
|
||||
{
|
||||
opj_image_cmptparm_t param_image_write;
|
||||
opj_image_t* image_write = NULL;
|
||||
|
@ -390,7 +406,8 @@ static int imageToPNG(const opj_image_t* image, const char* filename, int num_co
|
|||
param_image_write.sgnd = image->comps[num_comp_select].sgnd;
|
||||
|
||||
image_write = opj_image_create(1u, ¶m_image_write, OPJ_CLRSPC_GRAY);
|
||||
memcpy(image_write->comps->data, image->comps[num_comp_select].data, param_image_write.h * param_image_write.w * sizeof(int));
|
||||
memcpy(image_write->comps->data, image->comps[num_comp_select].data,
|
||||
param_image_write.h * param_image_write.w * sizeof(int));
|
||||
|
||||
imagetopng(image_write, filename);
|
||||
|
||||
|
@ -400,8 +417,7 @@ static int imageToPNG(const opj_image_t* image, const char* filename, int num_co
|
|||
}
|
||||
#endif
|
||||
|
||||
typedef struct test_cmp_parameters
|
||||
{
|
||||
typedef struct test_cmp_parameters {
|
||||
/** */
|
||||
char* base_filename;
|
||||
/** */
|
||||
|
@ -424,9 +440,11 @@ typedef struct test_cmp_parameters
|
|||
/* return decode format PGX / TIF / PPM , return -1 on error */
|
||||
static int get_decod_format(test_cmp_parameters* param)
|
||||
{
|
||||
int base_format = get_decod_format_from_string( param->base_filename );
|
||||
int test_format = get_decod_format_from_string( param->test_filename );
|
||||
if( base_format != test_format ) return -1;
|
||||
int base_format = get_decod_format_from_string(param->base_filename);
|
||||
int test_format = get_decod_format_from_string(param->test_filename);
|
||||
if (base_format != test_format) {
|
||||
return -1;
|
||||
}
|
||||
/* handle case -1: */
|
||||
return base_format;
|
||||
}
|
||||
|
@ -436,10 +454,11 @@ static int get_decod_format(test_cmp_parameters* param)
|
|||
*******************************************************************************/
|
||||
static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
|
||||
{
|
||||
char *MSElistvalues = NULL; char *PEAKlistvalues= NULL;
|
||||
char *MSElistvalues = NULL;
|
||||
char *PEAKlistvalues = NULL;
|
||||
char *separatorList = NULL;
|
||||
size_t sizemembasefile, sizememtestfile;
|
||||
int index, flagM=0, flagP=0;
|
||||
int index, flagM = 0, flagP = 0;
|
||||
const char optlist[] = "b:t:n:m:p:s:d";
|
||||
int c;
|
||||
|
||||
|
@ -456,8 +475,7 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
|
|||
opj_opterr = 0;
|
||||
|
||||
while ((c = opj_getopt(argc, argv, optlist)) != -1)
|
||||
switch (c)
|
||||
{
|
||||
switch (c) {
|
||||
case 'b':
|
||||
sizemembasefile = strlen(opj_optarg) + 1;
|
||||
param->base_filename = (char*) malloc(sizemembasefile);
|
||||
|
@ -488,150 +506,127 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
|
|||
separatorList = opj_optarg;
|
||||
break;
|
||||
case '?':
|
||||
if ((opj_optopt == 'b') || (opj_optopt == 't') || (opj_optopt == 'n') || (opj_optopt == 'p') || (opj_optopt == 'm') || (opj_optopt
|
||||
== 's'))
|
||||
if ((opj_optopt == 'b') || (opj_optopt == 't') || (opj_optopt == 'n') ||
|
||||
(opj_optopt == 'p') || (opj_optopt == 'm') || (opj_optopt
|
||||
== 's')) {
|
||||
fprintf(stderr, "Option -%c requires an argument.\n", opj_optopt);
|
||||
else
|
||||
if (isprint(opj_optopt)) fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
|
||||
else fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
|
||||
} else if (isprint(opj_optopt)) {
|
||||
fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
|
||||
} else {
|
||||
fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
|
||||
}
|
||||
return 1;
|
||||
default:
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, opj_optarg);
|
||||
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c,
|
||||
opj_optarg);
|
||||
break;
|
||||
}
|
||||
|
||||
if (opj_optind != argc)
|
||||
{
|
||||
for (index = opj_optind; index < argc; index++)
|
||||
fprintf(stderr,"Non-option argument %s\n", argv[index]);
|
||||
if (opj_optind != argc) {
|
||||
for (index = opj_optind; index < argc; index++) {
|
||||
fprintf(stderr, "Non-option argument %s\n", argv[index]);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (param->nbcomp == 0)
|
||||
{
|
||||
fprintf(stderr,"Need to indicate the number of components !\n");
|
||||
if (param->nbcomp == 0) {
|
||||
fprintf(stderr, "Need to indicate the number of components !\n");
|
||||
return 1;
|
||||
}
|
||||
/* else */
|
||||
if ( flagM && flagP )
|
||||
{
|
||||
param->tabMSEvalues = parseToleranceValues( MSElistvalues, param->nbcomp);
|
||||
param->tabPEAKvalues = parseToleranceValues( PEAKlistvalues, param->nbcomp);
|
||||
if ( (param->tabMSEvalues == NULL) || (param->tabPEAKvalues == NULL))
|
||||
{
|
||||
fprintf(stderr,"MSE and PEAK values are not correct (respectively need %d values)\n",param->nbcomp);
|
||||
if (flagM && flagP) {
|
||||
param->tabMSEvalues = parseToleranceValues(MSElistvalues, param->nbcomp);
|
||||
param->tabPEAKvalues = parseToleranceValues(PEAKlistvalues, param->nbcomp);
|
||||
if ((param->tabMSEvalues == NULL) || (param->tabPEAKvalues == NULL)) {
|
||||
fprintf(stderr,
|
||||
"MSE and PEAK values are not correct (respectively need %d values)\n",
|
||||
param->nbcomp);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get separators after corresponding letter (b or t)*/
|
||||
if (separatorList != NULL)
|
||||
{
|
||||
if( (strlen(separatorList) ==2) || (strlen(separatorList) ==4) )
|
||||
{
|
||||
if (separatorList != NULL) {
|
||||
if ((strlen(separatorList) == 2) || (strlen(separatorList) == 4)) {
|
||||
/* keep original string*/
|
||||
size_t sizeseplist = strlen(separatorList)+1;
|
||||
char* separatorList2 = (char*)malloc( sizeseplist );
|
||||
size_t sizeseplist = strlen(separatorList) + 1;
|
||||
char* separatorList2 = (char*)malloc(sizeseplist);
|
||||
strcpy(separatorList2, separatorList);
|
||||
/*printf("separatorList2 = %s [%d / %d]\n", separatorList2, strlen(separatorList2), sizeseplist);*/
|
||||
|
||||
if (strlen(separatorList) == 2) /* one separator behind b or t*/
|
||||
{
|
||||
if (strlen(separatorList) == 2) { /* one separator behind b or t*/
|
||||
char *resultT = NULL;
|
||||
resultT = strtok(separatorList2, "t");
|
||||
if (strlen(resultT) == strlen(separatorList)) /* didn't find t character, try to find b*/
|
||||
{
|
||||
if (strlen(resultT) == strlen(
|
||||
separatorList)) { /* didn't find t character, try to find b*/
|
||||
char *resultB = NULL;
|
||||
resultB = strtok(resultT, "b");
|
||||
if (strlen(resultB) == 1)
|
||||
{
|
||||
if (strlen(resultB) == 1) {
|
||||
param->separator_base[0] = separatorList[1];
|
||||
param->separator_base[1] = 0;
|
||||
param->separator_test[0] = 0;
|
||||
}
|
||||
else /* not found b*/
|
||||
{
|
||||
} else { /* not found b*/
|
||||
free(separatorList2);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else /* found t*/
|
||||
{
|
||||
} else { /* found t*/
|
||||
param->separator_base[0] = 0;
|
||||
param->separator_test[0] = separatorList[1];
|
||||
param->separator_test[1] = 0;
|
||||
}
|
||||
/*printf("sep b = %s [%d] and sep t = %s [%d]\n",param->separator_base, strlen(param->separator_base), param->separator_test, strlen(param->separator_test) );*/
|
||||
}
|
||||
else /* == 4 characters we must found t and b*/
|
||||
{
|
||||
} else { /* == 4 characters we must found t and b*/
|
||||
char *resultT = NULL;
|
||||
resultT = strtok(separatorList2, "t");
|
||||
if (strlen(resultT) == 3) /* found t in first place*/
|
||||
{
|
||||
if (strlen(resultT) == 3) { /* found t in first place*/
|
||||
char *resultB = NULL;
|
||||
resultB = strtok(resultT, "b");
|
||||
if (strlen(resultB) == 1) /* found b after t*/
|
||||
{
|
||||
if (strlen(resultB) == 1) { /* found b after t*/
|
||||
param->separator_test[0] = separatorList[1];
|
||||
param->separator_test[1] = 0;
|
||||
param->separator_base[0] = separatorList[3];
|
||||
param->separator_base[1] = 0;
|
||||
}
|
||||
else /* didn't find b after t*/
|
||||
{
|
||||
} else { /* didn't find b after t*/
|
||||
free(separatorList2);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else /* == 2, didn't find t in first place*/
|
||||
{
|
||||
} else { /* == 2, didn't find t in first place*/
|
||||
char *resultB = NULL;
|
||||
resultB = strtok(resultT, "b");
|
||||
if (strlen(resultB) == 1) /* found b in first place*/
|
||||
{
|
||||
if (strlen(resultB) == 1) { /* found b in first place*/
|
||||
param->separator_base[0] = separatorList[1];
|
||||
param->separator_base[1] = 0;
|
||||
param->separator_test[0] = separatorList[3];
|
||||
param->separator_test[1] = 0;
|
||||
}
|
||||
else /* didn't found b in first place => problem*/
|
||||
{
|
||||
} else { /* didn't found b in first place => problem*/
|
||||
free(separatorList2);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(separatorList2);
|
||||
}
|
||||
else /* wrong number of argument after -s*/
|
||||
{
|
||||
} else { /* wrong number of argument after -s*/
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (param->nbcomp == 1)
|
||||
{
|
||||
assert( param->separator_base[0] == 0 );
|
||||
assert( param->separator_test[0] == 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr,"If number of component is > 1, we need separator\n");
|
||||
} else {
|
||||
if (param->nbcomp == 1) {
|
||||
assert(param->separator_base[0] == 0);
|
||||
assert(param->separator_test[0] == 0);
|
||||
} else {
|
||||
fprintf(stderr, "If number of component is > 1, we need separator\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( (param->nr_flag) && (flagP || flagM) )
|
||||
{
|
||||
fprintf(stderr,"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
|
||||
if ((param->nr_flag) && (flagP || flagM)) {
|
||||
fprintf(stderr,
|
||||
"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
|
||||
return 1;
|
||||
}
|
||||
if ( (!param->nr_flag) && (!flagP || !flagM) )
|
||||
{
|
||||
fprintf(stderr,"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
|
||||
if ((!param->nr_flag) && (!flagP || !flagM)) {
|
||||
fprintf(stderr,
|
||||
"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -647,7 +642,7 @@ int main(int argc, char **argv)
|
|||
OPJ_UINT32 it_comp, itpxl;
|
||||
int failed = 1;
|
||||
int nbFilenamePGXbase = 0, nbFilenamePGXtest = 0;
|
||||
char *filenamePNGtest= NULL, *filenamePNGbase = NULL, *filenamePNGdiff = NULL;
|
||||
char *filenamePNGtest = NULL, *filenamePNGbase = NULL, *filenamePNGdiff = NULL;
|
||||
size_t memsizebasefilename, memsizetestfilename;
|
||||
size_t memsizedifffilename;
|
||||
int valueDiff = 0, nbPixelDiff = 0;
|
||||
|
@ -658,8 +653,7 @@ int main(int argc, char **argv)
|
|||
int decod_format;
|
||||
|
||||
/* Get parameters from command line*/
|
||||
if( parse_cmdline_cmp(argc, argv, &inParam) )
|
||||
{
|
||||
if (parse_cmdline_cmp(argc, argv, &inParam)) {
|
||||
compare_images_help_display();
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -675,25 +669,28 @@ int main(int argc, char **argv)
|
|||
inParam.base_filename, inParam.test_filename, inParam.nbcomp,
|
||||
inParam.nr_flag, inParam.separator_base, inParam.separator_test);
|
||||
|
||||
if ( (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
|
||||
{
|
||||
if ((inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL)) {
|
||||
int it_comp2;
|
||||
printf(" MSE values = [");
|
||||
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++)
|
||||
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++) {
|
||||
printf(" %f ", inParam.tabMSEvalues[it_comp2]);
|
||||
}
|
||||
printf("]\n");
|
||||
printf(" PEAK values = [");
|
||||
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++)
|
||||
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++) {
|
||||
printf(" %f ", inParam.tabPEAKvalues[it_comp2]);
|
||||
}
|
||||
printf("]\n");
|
||||
printf(" Non-regression test = %d\n", inParam.nr_flag);
|
||||
}
|
||||
|
||||
if (strlen(inParam.separator_base) != 0)
|
||||
if (strlen(inParam.separator_base) != 0) {
|
||||
nbFilenamePGXbase = inParam.nbcomp;
|
||||
}
|
||||
|
||||
if (strlen(inParam.separator_test) != 0)
|
||||
if (strlen(inParam.separator_test) != 0) {
|
||||
nbFilenamePGXtest = inParam.nbcomp;
|
||||
}
|
||||
|
||||
printf(" NbFilename to generate from base filename = %d\n", nbFilenamePGXbase);
|
||||
printf(" NbFilename to generate from test filename = %d\n", nbFilenamePGXtest);
|
||||
|
@ -704,31 +701,31 @@ int main(int argc, char **argv)
|
|||
memsizetestfilename = strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
|
||||
|
||||
decod_format = get_decod_format(&inParam);
|
||||
if( decod_format == -1 )
|
||||
{
|
||||
fprintf( stderr, "Unhandled file format\n" );
|
||||
if (decod_format == -1) {
|
||||
fprintf(stderr, "Unhandled file format\n");
|
||||
goto cleanup;
|
||||
}
|
||||
assert( decod_format == PGX_DFMT || decod_format == TIF_DFMT || decod_format == PXM_DFMT );
|
||||
assert(decod_format == PGX_DFMT || decod_format == TIF_DFMT ||
|
||||
decod_format == PXM_DFMT);
|
||||
|
||||
if( decod_format == PGX_DFMT )
|
||||
{
|
||||
imageBase = readImageFromFilePGX( inParam.base_filename, nbFilenamePGXbase, inParam.separator_base);
|
||||
if ( imageBase == NULL )
|
||||
if (decod_format == PGX_DFMT) {
|
||||
imageBase = readImageFromFilePGX(inParam.base_filename, nbFilenamePGXbase,
|
||||
inParam.separator_base);
|
||||
if (imageBase == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
else if( decod_format == TIF_DFMT )
|
||||
{
|
||||
imageBase = readImageFromFileTIF( inParam.base_filename, nbFilenamePGXbase, "");
|
||||
if ( imageBase == NULL )
|
||||
} else if (decod_format == TIF_DFMT) {
|
||||
imageBase = readImageFromFileTIF(inParam.base_filename, nbFilenamePGXbase, "");
|
||||
if (imageBase == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
else if( decod_format == PXM_DFMT )
|
||||
{
|
||||
imageBase = readImageFromFilePPM( inParam.base_filename, nbFilenamePGXbase, inParam.separator_base);
|
||||
if ( imageBase == NULL )
|
||||
} else if (decod_format == PXM_DFMT) {
|
||||
imageBase = readImageFromFilePPM(inParam.base_filename, nbFilenamePGXbase,
|
||||
inParam.separator_base);
|
||||
if (imageBase == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
filenamePNGbase = (char*) malloc(memsizebasefilename);
|
||||
strcpy(filenamePNGbase, inParam.test_filename);
|
||||
|
@ -737,24 +734,24 @@ int main(int argc, char **argv)
|
|||
|
||||
/*----------TEST IMAGE--------*/
|
||||
|
||||
if( decod_format == PGX_DFMT )
|
||||
{
|
||||
imageTest = readImageFromFilePGX(inParam.test_filename, nbFilenamePGXtest, inParam.separator_test);
|
||||
if ( imageTest == NULL )
|
||||
if (decod_format == PGX_DFMT) {
|
||||
imageTest = readImageFromFilePGX(inParam.test_filename, nbFilenamePGXtest,
|
||||
inParam.separator_test);
|
||||
if (imageTest == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
else if( decod_format == TIF_DFMT )
|
||||
{
|
||||
} else if (decod_format == TIF_DFMT) {
|
||||
imageTest = readImageFromFileTIF(inParam.test_filename, nbFilenamePGXtest, "");
|
||||
if ( imageTest == NULL )
|
||||
if (imageTest == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
else if( decod_format == PXM_DFMT )
|
||||
{
|
||||
imageTest = readImageFromFilePPM(inParam.test_filename, nbFilenamePGXtest, inParam.separator_test);
|
||||
if ( imageTest == NULL )
|
||||
} else if (decod_format == PXM_DFMT) {
|
||||
imageTest = readImageFromFilePPM(inParam.test_filename, nbFilenamePGXtest,
|
||||
inParam.separator_test);
|
||||
if (imageTest == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
filenamePNGtest = (char*) malloc(memsizetestfilename);
|
||||
strcpy(filenamePNGtest, inParam.test_filename);
|
||||
|
@ -764,20 +761,19 @@ int main(int argc, char **argv)
|
|||
/*----------DIFF IMAGE--------*/
|
||||
|
||||
/* Allocate memory*/
|
||||
param_image_diff = malloc( imageBase->numcomps * sizeof(opj_image_cmptparm_t));
|
||||
param_image_diff = malloc(imageBase->numcomps * sizeof(opj_image_cmptparm_t));
|
||||
|
||||
/* Comparison of header parameters*/
|
||||
printf("Step 1 -> Header comparison\n");
|
||||
|
||||
/* check dimensions (issue 286)*/
|
||||
if(imageBase->numcomps != imageTest->numcomps )
|
||||
{
|
||||
printf("ERROR: dim mismatch (%d><%d)\n", imageBase->numcomps, imageTest->numcomps);
|
||||
if (imageBase->numcomps != imageTest->numcomps) {
|
||||
printf("ERROR: dim mismatch (%d><%d)\n", imageBase->numcomps,
|
||||
imageTest->numcomps);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
for (it_comp = 0; it_comp < imageBase->numcomps; it_comp++)
|
||||
{
|
||||
for (it_comp = 0; it_comp < imageBase->numcomps; it_comp++) {
|
||||
param_image_diff[it_comp].x0 = 0;
|
||||
param_image_diff[it_comp].y0 = 0;
|
||||
param_image_diff[it_comp].dx = 0;
|
||||
|
@ -788,40 +784,42 @@ int main(int argc, char **argv)
|
|||
param_image_diff[it_comp].h = imageBase->comps[it_comp].h;
|
||||
param_image_diff[it_comp].w = imageBase->comps[it_comp].w;
|
||||
|
||||
if (imageBase->comps[it_comp].sgnd != imageTest->comps[it_comp].sgnd)
|
||||
{
|
||||
printf("ERROR: sign mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).sgnd, ((imageTest->comps)[it_comp]).sgnd);
|
||||
if (imageBase->comps[it_comp].sgnd != imageTest->comps[it_comp].sgnd) {
|
||||
printf("ERROR: sign mismatch [comp %d] (%d><%d)\n", it_comp,
|
||||
((imageBase->comps)[it_comp]).sgnd, ((imageTest->comps)[it_comp]).sgnd);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (((imageBase->comps)[it_comp]).prec != ((imageTest->comps)[it_comp]).prec)
|
||||
{
|
||||
printf("ERROR: prec mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).prec, ((imageTest->comps)[it_comp]).prec);
|
||||
if (((imageBase->comps)[it_comp]).prec != ((imageTest->comps)[it_comp]).prec) {
|
||||
printf("ERROR: prec mismatch [comp %d] (%d><%d)\n", it_comp,
|
||||
((imageBase->comps)[it_comp]).prec, ((imageTest->comps)[it_comp]).prec);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (((imageBase->comps)[it_comp]).bpp != ((imageTest->comps)[it_comp]).bpp)
|
||||
{
|
||||
printf("ERROR: byte per pixel mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).bpp, ((imageTest->comps)[it_comp]).bpp);
|
||||
if (((imageBase->comps)[it_comp]).bpp != ((imageTest->comps)[it_comp]).bpp) {
|
||||
printf("ERROR: byte per pixel mismatch [comp %d] (%d><%d)\n", it_comp,
|
||||
((imageBase->comps)[it_comp]).bpp, ((imageTest->comps)[it_comp]).bpp);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (((imageBase->comps)[it_comp]).h != ((imageTest->comps)[it_comp]).h)
|
||||
{
|
||||
printf("ERROR: height mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).h, ((imageTest->comps)[it_comp]).h);
|
||||
if (((imageBase->comps)[it_comp]).h != ((imageTest->comps)[it_comp]).h) {
|
||||
printf("ERROR: height mismatch [comp %d] (%d><%d)\n", it_comp,
|
||||
((imageBase->comps)[it_comp]).h, ((imageTest->comps)[it_comp]).h);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (((imageBase->comps)[it_comp]).w != ((imageTest->comps)[it_comp]).w)
|
||||
{
|
||||
printf("ERROR: width mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).w, ((imageTest->comps)[it_comp]).w);
|
||||
if (((imageBase->comps)[it_comp]).w != ((imageTest->comps)[it_comp]).w) {
|
||||
printf("ERROR: width mismatch [comp %d] (%d><%d)\n", it_comp,
|
||||
((imageBase->comps)[it_comp]).w, ((imageTest->comps)[it_comp]).w);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
imageDiff = opj_image_create(imageBase->numcomps, param_image_diff, OPJ_CLRSPC_UNSPECIFIED);
|
||||
imageDiff = opj_image_create(imageBase->numcomps, param_image_diff,
|
||||
OPJ_CLRSPC_UNSPECIFIED);
|
||||
/* Free memory*/
|
||||
free(param_image_diff); param_image_diff = NULL;
|
||||
free(param_image_diff);
|
||||
param_image_diff = NULL;
|
||||
|
||||
/* Measurement computation*/
|
||||
printf("Step 2 -> measurement comparison\n");
|
||||
|
@ -833,68 +831,74 @@ int main(int argc, char **argv)
|
|||
/*printf("filenamePNGdiff = %s [%d / %d octets]\n",filenamePNGdiff, strlen(filenamePNGdiff),memsizedifffilename );*/
|
||||
|
||||
/* Compute pixel diff*/
|
||||
for (it_comp = 0; it_comp < imageDiff->numcomps; it_comp++)
|
||||
{
|
||||
double SE=0,PEAK=0;
|
||||
double MSE=0;
|
||||
for (itpxl = 0; itpxl < ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h; itpxl++)
|
||||
{
|
||||
if (abs( ((imageBase->comps)[it_comp]).data[itpxl] - ((imageTest->comps)[it_comp]).data[itpxl] ) > 0)
|
||||
{
|
||||
valueDiff = ((imageBase->comps)[it_comp]).data[itpxl] - ((imageTest->comps)[it_comp]).data[itpxl];
|
||||
for (it_comp = 0; it_comp < imageDiff->numcomps; it_comp++) {
|
||||
double SE = 0, PEAK = 0;
|
||||
double MSE = 0;
|
||||
for (itpxl = 0;
|
||||
itpxl < ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h;
|
||||
itpxl++) {
|
||||
if (abs(((imageBase->comps)[it_comp]).data[itpxl] - ((
|
||||
imageTest->comps)[it_comp]).data[itpxl]) > 0) {
|
||||
valueDiff = ((imageBase->comps)[it_comp]).data[itpxl] - ((
|
||||
imageTest->comps)[it_comp]).data[itpxl];
|
||||
((imageDiff->comps)[it_comp]).data[itpxl] = abs(valueDiff);
|
||||
sumDiff += valueDiff;
|
||||
nbPixelDiff++;
|
||||
|
||||
SE += (double)valueDiff * valueDiff;
|
||||
PEAK = (PEAK > abs(valueDiff)) ? PEAK : abs(valueDiff);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
((imageDiff->comps)[it_comp]).data[itpxl] = 0;
|
||||
}
|
||||
}/* h*w loop */
|
||||
|
||||
MSE = SE / ( ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h );
|
||||
MSE = SE / (((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h);
|
||||
|
||||
if (!inParam.nr_flag && (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
|
||||
{ /* Conformance test*/
|
||||
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, PEAK);
|
||||
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, MSE);
|
||||
if (!inParam.nr_flag && (inParam.tabMSEvalues != NULL) &&
|
||||
(inParam.tabPEAKvalues != NULL)) {
|
||||
/* Conformance test*/
|
||||
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
|
||||
it_comp, PEAK);
|
||||
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
|
||||
it_comp, MSE);
|
||||
|
||||
if ( (MSE > inParam.tabMSEvalues[it_comp]) || (PEAK > inParam.tabPEAKvalues[it_comp]) )
|
||||
{
|
||||
if ((MSE > inParam.tabMSEvalues[it_comp]) ||
|
||||
(PEAK > inParam.tabPEAKvalues[it_comp])) {
|
||||
printf("ERROR: MSE (%f) or PEAK (%f) values produced by the decoded file are greater "
|
||||
"than the allowable error (respectively %f and %f) \n",
|
||||
MSE, PEAK, inParam.tabMSEvalues[it_comp], inParam.tabPEAKvalues[it_comp]);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
else /* Non regression-test */
|
||||
{
|
||||
if ( nbPixelDiff > 0)
|
||||
{
|
||||
} else { /* Non regression-test */
|
||||
if (nbPixelDiff > 0) {
|
||||
char it_compc[255];
|
||||
it_compc[0] = 0;
|
||||
|
||||
printf("<DartMeasurement name=\"NumberOfPixelsWithDifferences_%d\" type=\"numeric/int\"> %d </DartMeasurement> \n", it_comp, nbPixelDiff);
|
||||
printf("<DartMeasurement name=\"ComponentError_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, sumDiff);
|
||||
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, PEAK);
|
||||
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, MSE);
|
||||
printf("<DartMeasurement name=\"NumberOfPixelsWithDifferences_%d\" type=\"numeric/int\"> %d </DartMeasurement> \n",
|
||||
it_comp, nbPixelDiff);
|
||||
printf("<DartMeasurement name=\"ComponentError_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
|
||||
it_comp, sumDiff);
|
||||
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
|
||||
it_comp, PEAK);
|
||||
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
|
||||
it_comp, MSE);
|
||||
|
||||
#ifdef OPJ_HAVE_LIBPNG
|
||||
{
|
||||
char *filenamePNGbase_it_comp, *filenamePNGtest_it_comp, *filenamePNGdiff_it_comp;
|
||||
char *filenamePNGbase_it_comp, *filenamePNGtest_it_comp,
|
||||
*filenamePNGdiff_it_comp;
|
||||
|
||||
filenamePNGbase_it_comp = (char*) malloc(memsizebasefilename);
|
||||
strcpy(filenamePNGbase_it_comp,filenamePNGbase);
|
||||
strcpy(filenamePNGbase_it_comp, filenamePNGbase);
|
||||
|
||||
filenamePNGtest_it_comp = (char*) malloc(memsizetestfilename);
|
||||
strcpy(filenamePNGtest_it_comp,filenamePNGtest);
|
||||
strcpy(filenamePNGtest_it_comp, filenamePNGtest);
|
||||
|
||||
filenamePNGdiff_it_comp = (char*) malloc(memsizedifffilename);
|
||||
strcpy(filenamePNGdiff_it_comp,filenamePNGdiff);
|
||||
strcpy(filenamePNGdiff_it_comp, filenamePNGdiff);
|
||||
|
||||
sprintf(it_compc, "_%i", it_comp);
|
||||
strcat(it_compc,".png");
|
||||
strcat(it_compc, ".png");
|
||||
strcat(filenamePNGbase_it_comp, it_compc);
|
||||
/*printf("filenamePNGbase_it = %s [%d / %d octets]\n",filenamePNGbase_it_comp, strlen(filenamePNGbase_it_comp),memsizebasefilename );*/
|
||||
strcat(filenamePNGtest_it_comp, it_compc);
|
||||
|
|
Loading…
Reference in New Issue