! : changed
+ : added
+July 29, 2011
+! [mickael] solve some obvious warnings for WIN platform, increase number of warning reported on the dashboard, correct last warnings with gcc 4.4 (-Wall)
+
July 27, 2011
! [mickael] added new decoding/dump tests based on data found in input/nonregresion repository (remove JPEG2000_CONFORMANCE_DATA_ROOT variable, add REF_DECODER_BIN_PATH variable for the encoder test suite). Remove definitively old tests.
! [mickael] correct some warnings detected under unix platform
memset(&tga, 0, sizeof(tga_header));
- tga.pixel_depth = bits_per_pixel;
- tga.image_width = width;
- tga.image_height = height;
+ if ( bits_per_pixel < 256 )
+ tga.pixel_depth = (unsigned char)bits_per_pixel;
+ else{
+ fprintf(stderr,"ERROR: Wrong bits per pixel inside tga_header");
+ return 0;
+ }
+ tga.image_width = (unsigned short)width;
+ tga.image_height = (unsigned short)height;
tga.image_type = 2; // Uncompressed.
tga.image_desc = 8; // 8 bits per component.
has_color = 0;
for (j = 0; j < Info_h.biClrUsed; j++)
{
- table_B[j] = getc(IN);
- table_G[j] = getc(IN);
- table_R[j] = getc(IN);
+ table_B[j] = (unsigned char)getc(IN);
+ table_G[j] = (unsigned char)getc(IN);
+ table_R[j] = (unsigned char)getc(IN);
getc(IN);
has_color +=
!(table_R[j] == table_G[j] && table_R[j] == table_B[j]);
has_color = 0;
for (j = 0; j < Info_h.biClrUsed; j++)
{
- table_B[j] = getc(IN);
- table_G[j] = getc(IN);
- table_R[j] = getc(IN);
+ table_B[j] = (unsigned char)getc(IN);
+ table_G[j] = (unsigned char)getc(IN);
+ table_R[j] = (unsigned char)getc(IN);
getc(IN);
has_color += !(table_R[j] == table_G[j] && table_R[j] == table_B[j]);
}
c1 = getc(IN);
for (i = 0; i < c && x < W && pix < beyond; i++, x++, pix++)
- *pix = c1;
+ *pix = (unsigned char)c1;
}
else
{
for (; i < c && x < W && pix < beyond; i++, x++, pix++)
{
c1 = getc(IN);
- *pix = c1;
+ *pix = (unsigned char)c1;
}
if (c & 1) /* skip padding byte */
getc(IN);
}
fseek(f, 0, SEEK_SET);
- fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d",temp,&endian1,&endian2,signtmp,&prec,temp,&w,temp,&h);
-
+ if( fscanf(f, "PG%[ \t]%c%c%[ \t+-]%d%[ \t]%d%[ \t]%d",temp,&endian1,&endian2,signtmp,&prec,temp,&w,temp,&h) != 9){
+ fprintf(stderr, "ERROR: Failed to read the right number of element from the fscanf() function!\n");
+ return NULL;
+ }
i=0;
sign='+';
float *rates;
}img_fol_t;
-void encode_help_display() {
+void encode_help_display(void) {
fprintf(stdout,"HELP for image_to_j2k\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
int parse_cmdline_encoder(int argc, char **argv, opj_cparameters_t *parameters,
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename) {
- int i, j,totlen;
+ int i, j, totlen, c;
option_t long_option[]={
{"cinema2K",REQ_ARG, NULL ,'w'},
{"cinema4K",NO_ARG, NULL ,'y'},
img_fol->set_out_format=0;
raw_cp->rawWidth = 0;
- while (1) {
- int c = getopt_long(argc, argv, optlist,long_option,totlen);
+ do{
+ c = getopt_long(argc, argv, optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
fprintf(stderr, "ERROR -> Command line not valid\n");
return 1;
}
- }
+ }while(c != -1);
/* check for possible errors */
if (parameters->cp_cinema){
}img_fol_t;
-void decode_help_display() {
+void decode_help_display(void) {
fprintf(stdout,"HELP for j2k_dump\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
/* parse the command line */
- int totlen;
+ int totlen, c;
option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
};
const char optlist[] = "i:o:h";
totlen=sizeof(long_option);
img_fol->set_out_format = 0;
- while (1) {
- int c = getopt_long(argc, argv,optlist,long_option,totlen);
+ do {
+ c = getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
break;
}
- }
+ }while(c != -1);
/* check for possible errors */
if(img_fol->set_imgdir==1){
file_length = ftell(fsrc);
fseek(fsrc, 0, SEEK_SET);
src = (unsigned char *) malloc(file_length);
- if (fread(src, 1, file_length, fsrc) != file_length)
+ if (fread(src, 1, file_length, fsrc) != (size_t)file_length)
{
free(src);
fclose(fsrc);
/* Write the index to disk */
if (*indexfilename) {
- char bSuccess;
+ opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
/* Write the index to disk */
if (*indexfilename) {
- char bSuccess;
+ opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
/* Write the index to disk */
if (*indexfilename) {
- char bSuccess;
+ opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
}img_fol_t;
-void decode_help_display() {
+void decode_help_display(void) {
fprintf(stdout,"HELP for j2k_to_image\n----\n\n");
fprintf(stdout,"- the -h option displays this help information on screen\n\n");
/* -------------------------------------------------------------------------- */
int parse_cmdline_decoder(int argc, char **argv, opj_dparameters_t *parameters,img_fol_t *img_fol, char *indexfilename) {
/* parse the command line */
- int totlen;
+ int totlen, c;
option_t long_option[]={
{"ImgDir",REQ_ARG, NULL ,'y'},
{"OutFor",REQ_ARG, NULL ,'O'},
"h" ;
totlen=sizeof(long_option);
img_fol->set_out_format = 0;
- while (1) {
- int c = getopt_long(argc, argv,optlist,long_option,totlen);
+ do {
+ c = getopt_long(argc, argv,optlist,long_option,totlen);
if (c == -1)
break;
switch (c) {
fprintf(stderr,"WARNING -> this option is not valid \"-%c %s\"\n",c, optarg);
break;
}
- }
+ }while(c != -1);
/* check for possible errors */
if(img_fol->set_imgdir==1){
/* Write the index to disk */
if (*indexfilename) {
- char bSuccess;
+ opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
/* Write the index to disk */
if (*indexfilename) {
- char bSuccess;
+ opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
/* Write the index to disk */
if (*indexfilename) {
- char bSuccess;
+ opj_bool bSuccess;
bSuccess = write_index_file(&cstr_info, indexfilename);
if (bSuccess) {
fprintf(stderr, "Failed to output index file\n");
#define EMSG ""
/* As this class remembers its values from one Java call to the other, reset the values before each use */
-void reset_options_reading() {
+void reset_options_reading(void) {
opterr = 1;
optind = 1;
}
extern int getopt(int nargc, char *const *nargv, const char *ostr);
extern int getopt_long(int argc, char * const argv[], const char *optstring,
const struct option *longopts, int totlen);
-extern void reset_options_reading();
+extern void reset_options_reading(void);
#endif /* _GETOPT_H_ */
Utility functions
==========================================================*/
+#ifdef OPJ_CODE_NOT_USED
#ifndef _WIN32
static char*
i2a(unsigned i, char *a, unsigned r) {
}
#endif /* !_WIN32 */
-
+#endif
/* ----------------------------------------------------------------------- */
opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context) {
*/
if(color->jp2_pclr) return OPJ_FALSE;
- nr_entries = cio_read(cio, 2); /* NE */
- nr_channels = cio_read(cio, 1);/* NPC */
+ nr_entries = (unsigned short)cio_read(cio, 2); /* NE */
+ nr_channels = (unsigned short)cio_read(cio, 1);/* NPC */
entries = (unsigned int*)
opj_malloc(nr_channels * nr_entries * sizeof(unsigned int));
for(i = 0; i < nr_channels; ++i)
{
- cmap[i].cmp = cio_read(cio, 2);
+ cmap[i].cmp = (unsigned short)cio_read(cio, 2);
cmap[i].mtyp = cio_read(cio, 1);
cmap[i].pcol = cio_read(cio, 1);
*/
if(color->jp2_cdef) return OPJ_FALSE;
- if((n = cio_read(cio, 2)) == 0) return OPJ_FALSE; /* szukw000: FIXME */
+ if((n = (unsigned short)cio_read(cio, 2)) == 0) return OPJ_FALSE; /* szukw000: FIXME */
info = (opj_jp2_cdef_info_t*)
opj_malloc(n * sizeof(opj_jp2_cdef_info_t));
for(i = 0; i < n; ++i)
{
- info[i].cn = cio_read(cio, 2);
- info[i].typ = cio_read(cio, 2);
- info[i].asoc = cio_read(cio, 2);
+ info[i].cn = (unsigned short)cio_read(cio, 2);
+ info[i].typ = (unsigned short)cio_read(cio, 2);
+ info[i].asoc = (unsigned short)cio_read(cio, 2);
}
return OPJ_TRUE;
c[1] = 145;
c[2] = 0;
c[3] = 4;
- c[4] = (tile->packno % 65536) / 256;
- c[5] = (tile->packno % 65536) % 256;
+ c[4] = (unsigned char)((tile->packno % 65536) / 256);
+ c[5] = (unsigned char)((tile->packno % 65536) % 256);
c += 6;
}
/* </SOP> */
#include "convert.h"
double* parseToleranceValues( char* inArg, const int nbcomp);
-void comparePGXimages_help_display();
+void comparePGXimages_help_display(void);
opj_image_t* readImageFromFilePGX(char* filename, int nbFilenamePGX, char *separator);
#ifdef HAVE_LIBPNG
int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select);
/*******************************************************************************
* Command line help function
*******************************************************************************/
-void comparePGXimages_help_display() {
+void comparePGXimages_help_display(void) {
fprintf(stdout,"\nList of parameters for the comparePGX function \n");
fprintf(stdout,"\n");
fprintf(stdout," -b \t REQUIRED \t filename to the reference/baseline PGX image \n");
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);
#ifdef HAVE_LIBPNG
- it_compc[0] = '\0';
sprintf(it_compc, "_%i", it_comp);
strcat(it_compc,".png");
strcat(filenamePNGbase_it_comp, it_compc);
/*******************************************************************************
* Command line help function
*******************************************************************************/
-void compare_dump_files_help_display() {
+void compare_dump_files_help_display(void) {
fprintf(stdout,"\nList of parameters for the compare_dump_files function \n");
fprintf(stdout,"\n");
fprintf(stdout," -b \t REQUIRED \t filename to the reference/baseline dump file \n");