4 * Created on: 8 juil. 2011
13 #include "opj_config.h"
17 #include "format_defs.h"
20 double* parseToleranceValues( char* inArg, const int nbcomp);
21 void comparePGXimages_help_display();
22 opj_image_t* readImageFromFilePGX(char* filename, int nbFilenamePGX, char *separator);
24 int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select);
27 typedef struct test_cmp_parameters
33 /** Number of components */
38 double* tabPEAKvalues;
42 char separator_base[2];
44 char separator_test[2];
46 } test_cmp_parameters;
48 /*******************************************************************************
49 * Command line help function
50 *******************************************************************************/
51 void comparePGXimages_help_display() {
52 fprintf(stdout,"\nList of parameters for the comparePGX function \n");
54 fprintf(stdout," -b \t REQUIRED \t filename to the reference/baseline PGX image \n");
55 fprintf(stdout," -t \t REQUIRED \t filename to the test PGX image\n");
56 fprintf(stdout," -n \t REQUIRED \t number of component of the image (used to generate correct filename)\n");
57 fprintf(stdout," -m \t OPTIONAL \t list of MSE tolerances, separated by : (size must correspond to the number of component) of \n");
58 fprintf(stdout," -p \t OPTIONAL \t list of PEAK tolerances, separated by : (size must correspond to the number of component) \n");
59 fprintf(stdout," -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX image with different components, "
60 "please indicate b or t before separator to indicate respectively the separator "
61 "for ref/base file and for test file. \n");
62 fprintf(stdout," -r \t OPTIONAL \t indicate if you want to run this function as conformance test or as non regression test\n");
66 /*******************************************************************************
68 *******************************************************************************/
69 int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
71 char *MSElistvalues = NULL; char *PEAKlistvalues= NULL;
72 char *separatorList = NULL;
73 int sizemembasefile, sizememtestfile;
74 int index, flagM=0, flagP=0;
75 const char optlist[] = "b:t:n:m:p:s:d";
79 param->base_filename = NULL;
80 param->test_filename = NULL;
82 param->tabMSEvalues = NULL;
83 param->tabPEAKvalues = NULL;
88 while ((c = getopt(argc, argv, optlist)) != -1)
92 sizemembasefile = (int)strlen(optarg)+1;
93 param->base_filename = (char*) malloc(sizemembasefile);
94 param->base_filename[0] = '\0';
95 strncpy(param->base_filename, optarg, strlen(optarg));
96 param->base_filename[strlen(optarg)] = '\0';
97 //printf("param->base_filename = %s [%d / %d]\n", param->base_filename, strlen(param->base_filename), sizemembasefile );
100 sizememtestfile = (int) strlen(optarg) + 1;
101 param->test_filename = (char*) malloc(sizememtestfile);
102 param->test_filename[0] = '\0';
103 strncpy(param->test_filename, optarg, strlen(optarg));
104 param->test_filename[strlen(optarg)] = '\0';
105 //printf("param->test_filename = %s [%d / %d]\n", param->test_filename, strlen(param->test_filename), sizememtestfile);
108 param->nbcomp = atoi(optarg);
111 MSElistvalues = optarg;
115 PEAKlistvalues = optarg;
122 separatorList = optarg;
125 if ((optopt == 'b') || (optopt == 't') || (optopt == 'n') || (optopt == 'p') || (optopt == 'm') || (optopt
127 fprintf(stderr, "Option -%c requires an argument.\n", optopt);
129 if (isprint(optopt)) fprintf(stderr, "Unknown option `-%c'.\n", optopt);
130 else fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
133 fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, optarg);
139 for (index = optind; index < argc; index++)
140 fprintf(stderr,"Non-option argument %s\n", argv[index]);
144 if (param->nbcomp == 0)
146 fprintf(stderr,"Need to indicate the number of components !\n");
151 if ( flagM && flagP )
153 param->tabMSEvalues = parseToleranceValues( MSElistvalues, param->nbcomp);
154 param->tabPEAKvalues = parseToleranceValues( PEAKlistvalues, param->nbcomp);
155 if ( (param->tabMSEvalues == NULL) || (param->tabPEAKvalues == NULL))
157 fprintf(stderr,"MSE and PEAK values are not correct (respectively need %d values)\n",param->nbcomp);
167 // Get separators after corresponding letter (b or t)
168 if (separatorList != NULL)
170 if( (strlen(separatorList) ==2) || (strlen(separatorList) ==4) )
172 // keep original string
173 int sizeseplist = (int)strlen(separatorList)+1;
174 char* separatorList2 = (char*)malloc( sizeseplist );
175 separatorList2[0] = '\0';
176 strncpy(separatorList2, separatorList, strlen(separatorList));
177 separatorList2[strlen(separatorList)] = '\0';
178 //printf("separatorList2 = %s [%d / %d]\n", separatorList2, strlen(separatorList2), sizeseplist);
180 if (strlen(separatorList) == 2) // one separator behind b or t
182 char *resultT = NULL;
183 resultT = strtok(separatorList2, "t");
184 if (strlen(resultT) == strlen(separatorList)) // didn't find t character, try to find b
186 char *resultB = NULL;
187 resultB = strtok(resultT, "b");
188 if (strlen(resultB) == 1)
190 param->separator_base[0] = separatorList[1];param->separator_base[1] = '\0';
191 param->separator_test[0] ='\0';
195 free(separatorList2);
201 param->separator_base[0] ='\0';
202 param->separator_test[0] = separatorList[1];param->separator_test[1] = '\0';
204 //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) );
206 else // == 4 characters we must found t and b
208 char *resultT = NULL;
209 resultT = strtok(separatorList2, "t");
210 if (strlen(resultT) == 3) // found t in first place
212 char *resultB = NULL;
213 resultB = strtok(resultT, "b");
214 if (strlen(resultB) == 1) // found b after t
216 param->separator_test[0] = separatorList[1];param->separator_test[1] = '\0';
217 param->separator_base[0] = separatorList[3];param->separator_base[1] = '\0';
219 else // didn't find b after t
221 free(separatorList2);
225 else // == 2, didn't find t in first place
227 char *resultB = NULL;
228 resultB = strtok(resultT, "b");
229 if (strlen(resultB) == 1) // found b in first place
231 param->separator_base[0] = separatorList[1]; param->separator_base[1] = '\0';
232 param->separator_test[0] = separatorList[3]; param->separator_test[1] = '\0';
234 else // didn't found b in first place => problem
236 free(separatorList2);
241 free(separatorList2);
243 else // wrong number of argument after -s
250 if (param->nbcomp == 1)
252 param->separator_base[0] = '\0';
253 param->separator_test[0] = '\0';
257 fprintf(stderr,"If number of component is > 1, we need separator\n");
263 if ( (param->nr_flag) && (flagP || flagM) )
265 fprintf(stderr,"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
268 if ( (!param->nr_flag) && (!flagP || !flagM) )
270 fprintf(stderr,"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
277 /*******************************************************************************
278 * Parse MSE and PEAK input values (
280 *******************************************************************************/
281 double* parseToleranceValues( char* inArg, const int nbcomp)
283 double* outArgs= malloc(nbcomp * sizeof(double));
287 result = strtok( inArg, delims );
289 while( (result != NULL) && (it_comp < nbcomp ))
291 outArgs[it_comp] = atof(result);
292 result = strtok( NULL, delims );
296 if (it_comp != nbcomp)
301 /*******************************************************************************
302 * Create filenames from a filename by used separator and nb components
304 *******************************************************************************/
305 char* createMultiComponentsFilename(const char* inFilename, const int indexF, const char* separator)
308 char *outFilename, *ptr;
312 //printf("inFilename = %s\n", inFilename);
313 if ((ptr = strrchr(inFilename, token)) != NULL)
315 posToken = (int) (strlen(inFilename) - strlen(ptr));
316 //printf("Position of %c character inside inFilename = %d\n", token, posToken);
320 //printf("Token %c not found\n", token);
321 outFilename = (char*)malloc(1);
322 outFilename[0] = '\0';
326 outFilename = (char*)malloc((posToken + 7) * sizeof(char)); //6
328 strncpy(outFilename, inFilename, posToken);
330 outFilename[posToken] = '\0';
332 strcat(outFilename, separator);
334 sprintf(s, "%i", indexF);
335 strcat(outFilename, s);
337 strcat(outFilename, ".pgx");
339 //printf("outfilename: %s\n", outFilename);
342 /*******************************************************************************
344 *******************************************************************************/
345 opj_image_t* readImageFromFilePGX(char* filename, int nbFilenamePGX, char *separator)
348 opj_image_t* image_read = NULL;
349 opj_image_t* image = NULL;
350 opj_cparameters_t parameters;
351 opj_image_cmptparm_t* param_image_read;
354 // If separator is empty => nb file to read is equal to one
355 if ( strlen(separator) == 0 )
358 /* set encoding parameters to default values */
359 opj_set_default_encoder_parameters(¶meters);
360 parameters.decod_format = PGX_DFMT;
361 strncpy(parameters.infile, filename, sizeof(parameters.infile)-1);
364 param_image_read = malloc(nbFilenamePGX * sizeof(opj_image_cmptparm_t));
365 data = malloc(nbFilenamePGX * sizeof(*data));
368 for (it_file = 0; it_file < nbFilenamePGX; it_file++)
370 // Create the right filename
371 char *filenameComponentPGX;
372 if (strlen(separator) == 0)
374 filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(*filenameComponentPGX));
375 strcpy(filenameComponentPGX, filename);
378 filenameComponentPGX = createMultiComponentsFilename(filename, it_file, separator);
380 // Read the pgx file corresponding to the component
381 image_read = pgxtoimage(filenameComponentPGX, ¶meters);
384 fprintf(stderr, "Unable to load pgx file\n");
388 // Set the image_read parameters
389 param_image_read[it_file].x0 = 0;
390 param_image_read[it_file].y0 = 0;
391 param_image_read[it_file].dx = 0;
392 param_image_read[it_file].dy = 0;
393 param_image_read[it_file].h = image_read->comps->h;
394 param_image_read[it_file].w = image_read->comps->w;
395 param_image_read[it_file].bpp = image_read->comps->bpp;
396 param_image_read[it_file].prec = image_read->comps->prec;
397 param_image_read[it_file].sgnd = image_read->comps->sgnd;
400 data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w * sizeof(int));
401 memcpy(data[it_file], image_read->comps->data, image_read->comps->h * image_read->comps->w * sizeof(int));
404 opj_image_destroy(image_read);
405 free(filenameComponentPGX);
408 image = opj_image_create(nbFilenamePGX, param_image_read, CLRSPC_UNSPECIFIED);
409 for (it_file = 0; it_file < nbFilenamePGX; it_file++)
411 // Copy data into output image and free memory
412 memcpy(image->comps[it_file].data, data[it_file], image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
417 free(param_image_read);
423 /*******************************************************************************
425 *******************************************************************************/
427 int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select)
429 opj_image_cmptparm_t param_image_write;
430 opj_image_t* image_write = NULL;
432 param_image_write.x0 = 0;
433 param_image_write.y0 = 0;
434 param_image_write.dx = 0;
435 param_image_write.dy = 0;
436 param_image_write.h = image->comps[num_comp_select].h;
437 param_image_write.w = image->comps[num_comp_select].w;
438 param_image_write.bpp = image->comps[num_comp_select].bpp;
439 param_image_write.prec = image->comps[num_comp_select].prec;
440 param_image_write.sgnd = image->comps[num_comp_select].sgnd;
442 image_write = opj_image_create(1, ¶m_image_write, CLRSPC_GRAY);
443 memcpy(image_write->comps->data, image->comps[num_comp_select].data, param_image_write.h * param_image_write.w * sizeof(int));
445 imagetopng(image_write, filename);
447 opj_image_destroy(image_write);
453 /*******************************************************************************
455 *******************************************************************************/
456 int main(int argc, char **argv)
458 test_cmp_parameters inParam;
461 int nbFilenamePGXbase, nbFilenamePGXtest;
462 char *filenamePNGtest= NULL, *filenamePNGbase = NULL, *filenamePNGdiff = NULL;
463 int memsizebasefilename, memsizetestfilename, memsizedifffilename;
464 int valueDiff = 0, nbPixelDiff = 0;
465 double sumDiff = 0.0;
466 // Structures to store image parameters and data
467 opj_image_t *imageBase = NULL, *imageTest = NULL, *imageDiff = NULL;
468 opj_image_cmptparm_t* param_image_diff;
470 // Get parameters from command line
471 if( parse_cmdline_cmp(argc, argv, &inParam) == EXIT_FAILURE )
473 comparePGXimages_help_display();
474 if (!inParam.tabMSEvalues) free(inParam.tabMSEvalues);
475 if (!inParam.tabPEAKvalues) free(inParam.tabPEAKvalues);
476 if (!inParam.base_filename) free(inParam.base_filename);
477 if (!inParam.test_filename) free(inParam.test_filename);
481 // Display Parameters
482 printf("******Parameters********* \n");
483 printf(" base_filename = %s\n"
484 " test_filename = %s\n"
485 " nb of Components = %d\n"
486 " Non regression test = %d\n"
487 " separator Base = %s\n"
488 " separator Test = %s\n",
489 inParam.base_filename, inParam.test_filename, inParam.nbcomp,
490 inParam.nr_flag, inParam.separator_base, inParam.separator_test);
492 if ( (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
494 printf(" MSE values = [");
495 for (it_comp = 0; it_comp < inParam.nbcomp; it_comp++)
496 printf(" %f ", inParam.tabMSEvalues[it_comp]);
498 printf(" PEAK values = [");
499 for (it_comp = 0; it_comp < inParam.nbcomp; it_comp++)
500 printf(" %f ", inParam.tabPEAKvalues[it_comp]);
502 printf(" Non-regression test = %d\n", inParam.nr_flag);
505 if (strlen(inParam.separator_base) == 0)
506 nbFilenamePGXbase = 0;
508 nbFilenamePGXbase = inParam.nbcomp;
510 if (strlen(inParam.separator_test) == 0)
511 nbFilenamePGXtest = 0;
513 nbFilenamePGXtest = inParam.nbcomp;
515 printf(" NbFilename to generate from base filename = %d\n", nbFilenamePGXbase);
516 printf(" NbFilename to generate from test filename = %d\n", nbFilenamePGXtest);
517 printf("************************* \n");
519 //----------BASELINE IMAGE--------
521 memsizebasefilename = (int)strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
522 memsizetestfilename = (int)strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
524 imageBase = readImageFromFilePGX( inParam.base_filename, nbFilenamePGXbase, inParam.separator_base);
525 if ( imageBase != NULL)
527 filenamePNGbase = (char*) malloc(memsizebasefilename);
528 filenamePNGbase[0] = '\0';
529 strncpy(filenamePNGbase, inParam.test_filename, strlen(inParam.test_filename));
530 filenamePNGbase[strlen(inParam.test_filename)] = '\0';
531 strcat(filenamePNGbase, ".base");
532 //printf("filenamePNGbase = %s [%d / %d octets]\n",filenamePNGbase, strlen(filenamePNGbase),memsizebasefilename );
536 if (!inParam.tabMSEvalues) free(inParam.tabMSEvalues);
537 if (!inParam.tabPEAKvalues) free(inParam.tabPEAKvalues);
538 if (!inParam.base_filename) free(inParam.base_filename);
539 if (!inParam.test_filename) free(inParam.test_filename);
543 //----------TEST IMAGE--------
546 imageTest = readImageFromFilePGX(inParam.test_filename, nbFilenamePGXtest, inParam.separator_test);
547 if ( imageTest != NULL)
549 filenamePNGtest = (char*) malloc(memsizetestfilename);
550 filenamePNGtest[0] = '\0';
551 strncpy(filenamePNGtest, inParam.test_filename, strlen(inParam.test_filename));
552 filenamePNGtest[strlen(inParam.test_filename)] = '\0';
553 strcat(filenamePNGtest, ".test");
554 //printf("filenamePNGtest = %s [%d / %d octets]\n",filenamePNGtest, strlen(filenamePNGtest),memsizetestfilename );
558 if (!inParam.tabMSEvalues) free(inParam.tabMSEvalues);
559 if (!inParam.tabPEAKvalues) free(inParam.tabPEAKvalues);
560 if (!inParam.base_filename) free(inParam.base_filename);
561 if (!inParam.test_filename) free(inParam.test_filename);
562 free(filenamePNGbase);
566 //----------DIFF IMAGE--------
570 param_image_diff = malloc( imageBase->numcomps * sizeof(opj_image_cmptparm_t));
572 // Comparison of header parameters
573 printf("Step 1 -> Header comparison\n");
575 for (it_comp = 0; it_comp < imageBase->numcomps; it_comp++)
577 param_image_diff[it_comp].x0 = 0;
578 param_image_diff[it_comp].y0 = 0;
579 param_image_diff[it_comp].dx = 0;
580 param_image_diff[it_comp].dy = 0;
582 if (imageBase->comps[it_comp].sgnd != imageTest->comps[it_comp].sgnd)
584 printf("ERROR: sign mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).sgnd, ((imageTest->comps)[it_comp]).sgnd);
588 param_image_diff[it_comp].sgnd = 0 ;
590 if (((imageBase->comps)[it_comp]).prec != ((imageTest->comps)[it_comp]).prec)
592 printf("ERROR: prec mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).prec, ((imageTest->comps)[it_comp]).prec);
596 param_image_diff[it_comp].prec = 8 ;
598 if (((imageBase->comps)[it_comp]).bpp != ((imageTest->comps)[it_comp]).bpp)
600 printf("ERROR: byte per pixel mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).bpp, ((imageTest->comps)[it_comp]).bpp);
604 param_image_diff[it_comp].bpp = 1 ;
606 if (((imageBase->comps)[it_comp]).h != ((imageTest->comps)[it_comp]).h)
608 printf("ERROR: height mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).h, ((imageTest->comps)[it_comp]).h);
612 param_image_diff[it_comp].h = imageBase->comps[it_comp].h ;
614 if (((imageBase->comps)[it_comp]).w != ((imageTest->comps)[it_comp]).w)
616 printf("ERROR: width mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).w, ((imageTest->comps)[it_comp]).w);
620 param_image_diff[it_comp].w = imageBase->comps[it_comp].w ;
623 // If only one parameter is different, we stop the test
626 free(inParam.tabMSEvalues);
627 free(inParam.tabPEAKvalues);
628 free(inParam.base_filename);
629 free(inParam.test_filename);
631 free(filenamePNGbase);
632 free(filenamePNGtest);
634 opj_image_destroy(imageBase);
635 opj_image_destroy(imageTest);
637 free(param_image_diff);
642 imageDiff = opj_image_create(imageBase->numcomps, param_image_diff, CLRSPC_UNSPECIFIED);
644 free(param_image_diff);
646 // Measurement computation
647 printf("Step 2 -> measurement comparison\n");
649 memsizedifffilename = strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
650 filenamePNGdiff = (char*) malloc(memsizedifffilename);
651 filenamePNGdiff[0] = '\0';
652 strncpy(filenamePNGdiff, inParam.test_filename, strlen(inParam.test_filename));
653 filenamePNGdiff[strlen(inParam.test_filename)] = '\0';
654 strcat(filenamePNGdiff, ".diff");
655 //printf("filenamePNGdiff = %s [%d / %d octets]\n",filenamePNGdiff, strlen(filenamePNGdiff),memsizedifffilename );
657 // Compute pixel diff
658 for (it_comp = 0; it_comp < imageDiff->numcomps; it_comp++)
662 char *filenamePNGbase_it_comp, *filenamePNGtest_it_comp, *filenamePNGdiff_it_comp;
664 filenamePNGbase_it_comp = (char*) malloc(memsizebasefilename);
665 filenamePNGbase_it_comp[0] = '\0';
666 strncpy(filenamePNGbase_it_comp,filenamePNGbase,strlen(filenamePNGbase));
667 filenamePNGbase_it_comp[strlen(filenamePNGbase)] = '\0';
669 filenamePNGtest_it_comp = (char*) malloc(memsizetestfilename);
670 filenamePNGtest_it_comp[0] = '\0';
671 strncpy(filenamePNGtest_it_comp,filenamePNGtest,strlen(filenamePNGtest));
672 filenamePNGtest_it_comp[strlen(filenamePNGtest)] = '\0';
674 filenamePNGdiff_it_comp = (char*) malloc(memsizedifffilename);
675 filenamePNGdiff_it_comp[0] = '\0';
676 strncpy(filenamePNGdiff_it_comp,filenamePNGdiff,strlen(filenamePNGdiff));
677 filenamePNGdiff_it_comp[strlen(filenamePNGdiff)] = '\0';
679 for (itpxl = 0; itpxl < ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h; itpxl++)
681 if (abs( ((imageBase->comps)[it_comp]).data[itpxl] - ((imageTest->comps)[it_comp]).data[itpxl] ) > 0)
683 valueDiff = ((imageBase->comps)[it_comp]).data[itpxl] - ((imageTest->comps)[it_comp]).data[itpxl];
684 ((imageDiff->comps)[it_comp]).data[itpxl] = abs(valueDiff);
685 sumDiff += (double)valueDiff;
688 SE += (double)(valueDiff * valueDiff);
689 PEAK = (PEAK > abs(valueDiff)) ? PEAK : abs(valueDiff);
692 ((imageDiff->comps)[it_comp]).data[itpxl] = 0;
695 MSE = SE / ( ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h );
697 if (!inParam.nr_flag && (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
698 { // Conformance test
699 printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, PEAK);
700 printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, MSE);
702 if ( (MSE > inParam.tabMSEvalues[it_comp]) || (PEAK > inParam.tabPEAKvalues[it_comp]) )
704 printf("ERROR: MSE (%f) or PEAK (%f) values produced by the decoded file are greater "
705 "than the allowable error (respectively %f and %f) \n",
706 MSE, PEAK, inParam.tabMSEvalues[it_comp], inParam.tabPEAKvalues[it_comp]);
710 else // Non regression-test
712 if ( nbPixelDiff > 0)
716 printf("<DartMeasurement name=\"NumberOfPixelsWithDifferences_%d\" type=\"numeric/int\"> %d </DartMeasurement> \n", it_comp, nbPixelDiff);
717 printf("<DartMeasurement name=\"ComponentError_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, sumDiff);
721 sprintf(it_compc, "_%i", it_comp);
722 strcat(it_compc,".png");
723 strcat(filenamePNGbase_it_comp, it_compc);
724 //printf("filenamePNGbase_it = %s [%d / %d octets]\n",filenamePNGbase_it_comp, strlen(filenamePNGbase_it_comp),memsizebasefilename );
725 strcat(filenamePNGtest_it_comp, it_compc);
726 //printf("filenamePNGtest_it = %s [%d / %d octets]\n",filenamePNGtest_it_comp, strlen(filenamePNGtest_it_comp),memsizetestfilename );
727 strcat(filenamePNGdiff_it_comp, it_compc);
728 //printf("filenamePNGdiff_it = %s [%d / %d octets]\n",filenamePNGdiff_it_comp, strlen(filenamePNGdiff_it_comp),memsizedifffilename );
730 if ( imageToPNG(imageBase, filenamePNGbase_it_comp, it_comp) == EXIT_SUCCESS )
732 printf("<DartMeasurementFile name=\"BaselineImage_%d\" type=\"image/png\"> %s </DartMeasurementFile> \n", it_comp, filenamePNGbase_it_comp);
735 if ( imageToPNG(imageTest, filenamePNGtest_it_comp, it_comp) == EXIT_SUCCESS )
737 printf("<DartMeasurementFile name=\"TestImage_%d\" type=\"image/png\"> %s </DartMeasurementFile> \n", it_comp, filenamePNGtest_it_comp);
740 if ( imageToPNG(imageDiff, filenamePNGdiff_it_comp, it_comp) == EXIT_SUCCESS )
742 printf("<DartMeasurementFile name=\"DiffferenceImage_%d\" type=\"image/png\"> %s </DartMeasurementFile> \n", it_comp, filenamePNGdiff_it_comp);
748 free(filenamePNGbase_it_comp);
749 free(filenamePNGtest_it_comp);
750 free(filenamePNGdiff_it_comp);
753 //-----------------------------
755 opj_image_destroy(imageBase);
756 opj_image_destroy(imageTest);
757 opj_image_destroy(imageDiff);
759 free(filenamePNGbase);
760 free(filenamePNGtest);
761 free(filenamePNGdiff);
763 free(inParam.tabMSEvalues);
764 free(inParam.tabPEAKvalues);
765 free(inParam.base_filename);
766 free(inParam.test_filename);
772 printf("---- TEST SUCCEED ----\n");