From: mayeut Date: Fri, 24 Jul 2015 21:55:45 +0000 (+0200) Subject: Remove some warnings when building X-Git-Tag: v2.1.1~22^2~104 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b190a91ab5a147cfdf10dde57354bec90a1f9258;p=openjpeg Remove some warnings when building Update #442 --- diff --git a/src/bin/jp2/convertpng.c b/src/bin/jp2/convertpng.c index ccb1c1f7..5fe6dccc 100644 --- a/src/bin/jp2/convertpng.c +++ b/src/bin/jp2/convertpng.c @@ -536,9 +536,11 @@ int imagetopng(opj_image_t * image, const char *write_idf) { png_set_packing(png); } - // printf("%s:%d:sgnd(%d,%d,%d) w(%d) h(%d) alpha(%d)\n",__FILE__,__LINE__, - //image->comps[0].sgnd, - //image->comps[1].sgnd,image->comps[2].sgnd,width,height,has_alpha); + /* + printf("%s:%d:sgnd(%d,%d,%d) w(%d) h(%d) alpha(%d)\n",__FILE__,__LINE__, + image->comps[0].sgnd, + image->comps[1].sgnd,image->comps[2].sgnd,width,height,has_alpha); + */ adjustR = (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0); adjustG = (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0); diff --git a/src/bin/jp2/opj_compress.c b/src/bin/jp2/opj_compress.c index ba3bb281..68cc0469 100644 --- a/src/bin/jp2/opj_compress.c +++ b/src/bin/jp2/opj_compress.c @@ -1576,7 +1576,7 @@ int main(int argc, char **argv) { opj_codec_t* l_codec = 00; opj_image_t *image = NULL; raw_cparameters_t raw_cp; - OPJ_SIZE_T num_compressed_files = 0; + OPJ_SIZE_T num_compressed_files = 0; char indexfilename[OPJ_PATH_LEN]; /* index file name */ @@ -1587,7 +1587,7 @@ int main(int argc, char **argv) { OPJ_BOOL bSuccess; OPJ_BOOL bUseTiles = OPJ_FALSE; /* OPJ_TRUE */ OPJ_UINT32 l_nb_tiles = 4; - OPJ_FLOAT64 t = opj_clock(); + OPJ_FLOAT64 t = opj_clock(); /* set encoding parameters to default values */ opj_set_default_encoder_parameters(¶meters); @@ -1870,10 +1870,10 @@ int main(int argc, char **argv) { if(parameters.cp_matrice) free(parameters.cp_matrice); if(raw_cp.rawComps) free(raw_cp.rawComps); - t = opj_clock() - t; - if (num_compressed_files) - fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000)/num_compressed_files)); - //getch()); + t = opj_clock() - t; + if (num_compressed_files) { + fprintf(stdout, "encode time: %d ms \n", (int)((t * 1000.0)/(OPJ_FLOAT64)num_compressed_files)); + } return 0; } diff --git a/src/bin/jp2/opj_decompress.c b/src/bin/jp2/opj_decompress.c index 7479097b..2dfb3400 100644 --- a/src/bin/jp2/opj_decompress.c +++ b/src/bin/jp2/opj_decompress.c @@ -175,12 +175,12 @@ static void decode_help_display(void) { " Image file Directory path \n" " -OutFor \n" " REQUIRED only if -ImgDir is used\n" - " Output format for decompressed images.\n" - " -i \n" + " Output format for decompressed images.\n"); + fprintf(stdout," -i \n" " REQUIRED only if an Input image directory is not specified\n" " Currently accepts J2K-files, JP2-files and JPT-files. The file type\n" - " is identified based on its suffix.\n" - " -o \n" + " is identified based on its suffix.\n"); + fprintf(stdout," -o \n" " REQUIRED\n" " Currently accepts formats specified above (see OutFor option)\n" " Binary data is written to the file (not ascii). If a PGX\n" @@ -188,8 +188,8 @@ static void decode_help_display(void) { " components: an indice starting from 0 will then be appended to the\n" " output filename, just before the \"pgx\" extension. If a PGM filename\n" " is given and there are more than one component, only the first component\n" - " will be written to the file.\n" - " -r \n" + " will be written to the file.\n"); + fprintf(stdout," -r \n" " Set the number of highest resolution levels to be discarded. The\n" " image resolution is effectively divided by 2 to the power of the\n" " number of discarded levels. The reduce factor is limited by the\n" @@ -197,8 +197,8 @@ static void decode_help_display(void) { " -l \n" " Set the maximum number of quality layers to decode. If there are\n" " less quality layers than the specified number, all the quality layers\n" - " are decoded.\n" - " -x \n" + " are decoded.\n"); + fprintf(stdout," -x \n" " Create an index file *.Idx (-x index_name.Idx) \n" " -d \n" " OPTIONAL\n" @@ -207,8 +207,8 @@ static void decode_help_display(void) { " -t \n" " OPTIONAL\n" " Set the tile number of the decoded tile. Follow the JPEG2000 convention from left-up to bottom-up\n" - " By default all tiles are decoded.\n" - " -p [C|S][,[C|S][,...]]\n" + " By default all tiles are decoded.\n"); + fprintf(stdout," -p [C|S][,[C|S][,...]]\n" " OPTIONAL\n" " Force the precision (bit depth) of components.\n" " There shall be at least 1 value. Theres no limit on the number of values (comma separated, last values ignored if too much values).\n" @@ -252,7 +252,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p for(;;) { - OPJ_UINT32 prec; + int prec; char mode; char comma; int count; @@ -270,7 +270,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p count = 3; } if (count == 3) { - if (prec > 32U) { + if ((prec < 1) || (prec > 32)) { fprintf(stderr,"Invalid precision %d in precision option %s\n", prec, option); l_result = OPJ_FALSE; break; @@ -313,7 +313,7 @@ static OPJ_BOOL parse_precision(const char* option, opj_decompress_parameters* p parameters->precision = l_new; } - parameters->precision[parameters->nb_precision].prec = prec; + parameters->precision[parameters->nb_precision].prec = (OPJ_UINT32)prec; switch (mode) { case 'C': parameters->precision[parameters->nb_precision].mode = OPJ_PREC_MODE_CLIP; @@ -1540,9 +1540,9 @@ int main(int argc, char **argv) if(failed) remove(parameters.outfile); } destroy_parameters(¶meters); - if (numDecompressedImages) - fprintf(stdout, "decode time: %d ms \n", (int)( (tCumulative * 1000) / numDecompressedImages)); - //getch(); + if (numDecompressedImages) { + fprintf(stdout, "decode time: %d ms\n", (int)( (tCumulative * 1000.0) / (OPJ_FLOAT64)numDecompressedImages)); + } return failed ? EXIT_FAILURE : EXIT_SUCCESS; } /*end main*/ diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h index d0130028..d8faede0 100644 --- a/src/lib/openjp2/opj_includes.h +++ b/src/lib/openjp2/opj_includes.h @@ -127,8 +127,8 @@ static INLINE long lrintf(float f){ #ifdef _M_X64 return _mm_cvt_ss2si(_mm_load_ss(&f)); - // commented out line breaks many tests - ///return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); + /* commented out line breaks many tests */ + /* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */ #else int i; _asm{