- imageDiff = opj_image_create(imageBase->numcomps, param_image_diff, OPJ_CLRSPC_UNSPECIFIED);
- /* Free memory*/
- free(param_image_diff); param_image_diff = NULL;
-
- /* Measurement computation*/
- printf("Step 2 -> measurement comparison\n");
-
- memsizedifffilename = strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
- filenamePNGdiff = (char*) malloc(memsizedifffilename);
- strcpy(filenamePNGdiff, inParam.test_filename);
- strcat(filenamePNGdiff, ".diff");
- /*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];
- ((imageDiff->comps)[it_comp]).data[itpxl] = abs(valueDiff);
- sumDiff += valueDiff;
- nbPixelDiff++;
-
- SE += (double)valueDiff * valueDiff;
- PEAK = (PEAK > abs(valueDiff)) ? PEAK : abs(valueDiff);
- }
- else
- ((imageDiff->comps)[it_comp]).data[itpxl] = 0;
- }/* h*w loop */
-
- 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 ( (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)
- {
- 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);
+ imageDiff = opj_image_create(imageBase->numcomps, param_image_diff,
+ OPJ_CLRSPC_UNSPECIFIED);
+ /* Free memory*/
+ free(param_image_diff);
+ param_image_diff = NULL;
+
+ /* Measurement computation*/
+ printf("Step 2 -> measurement comparison\n");
+
+ memsizedifffilename = strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
+ filenamePNGdiff = (char*) malloc(memsizedifffilename);
+ strcpy(filenamePNGdiff, inParam.test_filename);
+ strcat(filenamePNGdiff, ".diff");
+ /*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];
+ ((imageDiff->comps)[it_comp]).data[itpxl] = abs(valueDiff);
+ sumDiff += valueDiff;
+ nbPixelDiff++;
+
+ SE += (double)valueDiff * valueDiff;
+ PEAK = (PEAK > abs(valueDiff)) ? PEAK : abs(valueDiff);
+ } else {
+ ((imageDiff->comps)[it_comp]).data[itpxl] = 0;
+ }
+ }/* h*w loop */
+
+ 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 ((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) {
+ 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);