]> granicus.if.org Git - openjpeg/commitdiff
Remove some warnings when building
authormayeut <mayeut@users.noreply.github.com>
Fri, 24 Jul 2015 21:55:45 +0000 (23:55 +0200)
committermayeut <mayeut@users.noreply.github.com>
Fri, 24 Jul 2015 21:55:45 +0000 (23:55 +0200)
Update #442

src/bin/jp2/convertpng.c
src/bin/jp2/opj_compress.c
src/bin/jp2/opj_decompress.c
src/lib/openjp2/opj_includes.h

index ccb1c1f7ea4da726efd42f9de1501d285443b0a7..5fe6dcccae378cd320e73ff1057b77f7da4ec3cf 100644 (file)
@@ -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);
index ba3bb281075062f6dcacd61931078d05b9a741ac..68cc046968c126b92edfb50bd8dda7274d75c7d2 100644 (file)
@@ -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(&parameters);
@@ -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;
 }
index 7479097bd8a730f79de3bbc3f313d2b489ca805a..2dfb3400ebaae179ffc5579597a6d4daf8ae8ab8 100644 (file)
@@ -175,12 +175,12 @@ static void decode_help_display(void) {
                       "        Image file Directory path \n"
                       "  -OutFor <PBM|PGM|PPM|PNM|PAM|PGX|PNG|BMP|TIF|RAW|RAWL|TGA>\n"
                       "    REQUIRED only if -ImgDir is used\n"
-                      "        Output format for decompressed images.\n"
-                      "  -i <compressed file>\n"
+                      "        Output format for decompressed images.\n");
+       fprintf(stdout,"  -i <compressed file>\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 <decompressed file>\n"
+                      "    is identified based on its suffix.\n");
+       fprintf(stdout,"  -o <decompressed file>\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 <reduce factor>\n"
+                      "    will be written to the file.\n");
+       fprintf(stdout,"  -r <reduce factor>\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 <number of quality layers to decode>\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 <x0,y0,x1,y1>\n"
                       "    OPTIONAL\n"
@@ -207,8 +207,8 @@ static void decode_help_display(void) {
                       "  -t <tile_number>\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 <comp 0 precision>[C|S][,<comp 1 precision>[C|S][,...]]\n"
+                      "    By default all tiles are decoded.\n");
+       fprintf(stdout,"  -p <comp 0 precision>[C|S][,<comp 1 precision>[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(&parameters);
-       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*/
index d0130028373be944835ddd988e4e2dc20a4f31e5..d8faede017a82645c92094a29caee5eeb23d40fb 100644 (file)
@@ -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{