/*
- * Copyright (c) 2011, Mickael Savinaud, Communications & Systemes <mickael.savinaud@c-s.fr>
+ * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <string.h>
#include <ctype.h>
-#include "opj_config.h"
+#include "opj_apps_config.h"
#include "opj_getopt.h"
#include "openjpeg.h"
double* parseToleranceValues( char* inArg, const int nbcomp);
void comparePGXimages_help_display(void);
opj_image_t* readImageFromFilePGX(char* filename, int nbFilenamePGX, char *separator);
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select);
#endif
fprintf(stdout," -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX 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," -r \t OPTIONAL \t indicate if you want to run this function as conformance test or as non regression test\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");
}
/*******************************************************************************
* Parse command line
*******************************************************************************/
-int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
+static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
{
char *MSElistvalues = NULL; char *PEAKlistvalues= NULL;
char *separatorList = NULL;
* Create filenames from a filename by used separator and nb components
* (begin to 0)
*******************************************************************************/
-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;
free(filenameComponentPGX);
}
- image = opj_image_create(nbFilenamePGX, param_image_read, CLRSPC_UNSPECIFIED);
+ image = opj_image_create(nbFilenamePGX, param_image_read, OPJ_CLRSPC_UNSPECIFIED);
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
{
/* Copy data into output image and free memory*/
/*******************************************************************************
*
*******************************************************************************/
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select)
{
opj_image_cmptparm_t param_image_write;
param_image_write.prec = image->comps[num_comp_select].prec;
param_image_write.sgnd = image->comps[num_comp_select].sgnd;
- image_write = opj_image_create(1, ¶m_image_write, CLRSPC_GRAY);
+ image_write = opj_image_create(1, ¶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));
imagetopng(image_write, filename);
int main(int argc, char **argv)
{
test_cmp_parameters inParam;
- int it_comp, itpxl;
+ OPJ_UINT32 it_comp, itpxl;
int failed = 0;
int nbFilenamePGXbase, nbFilenamePGXtest;
char *filenamePNGtest= NULL, *filenamePNGbase = NULL, *filenamePNGdiff = NULL;
inParam.nr_flag, inParam.separator_base, inParam.separator_test);
if ( (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
- {
+ {
+ int it_comp;
printf(" MSE values = [");
for (it_comp = 0; it_comp < inParam.nbcomp; it_comp++)
printf(" %f ", inParam.tabMSEvalues[it_comp]);
return EXIT_FAILURE;
}
- imageDiff = opj_image_create(imageBase->numcomps, param_image_diff, CLRSPC_UNSPECIFIED);
+ imageDiff = opj_image_create(imageBase->numcomps, param_image_diff, OPJ_CLRSPC_UNSPECIFIED);
/* Free memory*/
free(param_image_diff);
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);
-#ifdef HAVE_LIBPNG
+#ifdef OPJ_HAVE_LIBPNG
sprintf(it_compc, "_%i", it_comp);
strcat(it_compc,".png");
strcat(filenamePNGbase_it_comp, it_compc);
strcat(filenamePNGdiff_it_comp, it_compc);
/*printf("filenamePNGdiff_it = %s [%d / %d octets]\n",filenamePNGdiff_it_comp, strlen(filenamePNGdiff_it_comp),memsizedifffilename );*/
+ /*
if ( imageToPNG(imageBase, filenamePNGbase_it_comp, it_comp) == EXIT_SUCCESS )
{
printf("<DartMeasurementFile name=\"BaselineImage_%d\" type=\"image/png\"> %s </DartMeasurementFile> \n", it_comp, filenamePNGbase_it_comp);
{
printf("<DartMeasurementFile name=\"DiffferenceImage_%d\" type=\"image/png\"> %s </DartMeasurementFile> \n", it_comp, filenamePNGdiff_it_comp);
}
+ */
+
#endif
failed = 1;
}