removed é in license header to prevent warning C4819 (see http://code.google.com...
[openjpeg.git] / jp3d / codec / jp3d_to_volume.c
index 81dc1c78d0cd37095d2dca417bd6a71cc109b864..eb7fe308a5cd09634d6f6dffea0f7c1da8406404 100755 (executable)
@@ -2,7 +2,7 @@
  * Copyright (c) 2001-2003, David Janssens\r
  * Copyright (c) 2002-2003, Yannick Verschueren\r
  * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe\r
- * Copyright (c) 2005, Herv Drolon, FreeImage Team\r
+ * Copyright (c) 2005, Hervcalloc Drolon, FreeImage Team\r
  * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium\r
  * Copyright (c) 2006, M�nica D�ez Garc�a, Image Processing Laboratory, University of Valladolid, Spain\r
  * All rights reserved.\r
 #include <stdlib.h>\r
 #include <math.h>\r
 \r
-#include "openjpeg.h"\r
+#include "../libjp3dvm/openjpeg3d.h"\r
 #include "getopt.h"\r
 #include "convert.h"\r
 \r
-#ifndef WIN32\r
+#ifdef _WIN32\r
+#include <windows.h>\r
+#else\r
 #define stricmp strcasecmp\r
 #define strnicmp strncasecmp\r
-#endif\r
+#endif /* _WIN32 */\r
 \r
 /* ----------------------------------------------------------------------- */\r
 static double calc_PSNR(opj_volume_t *original, opj_volume_t *decoded)\r
@@ -177,12 +179,12 @@ void decode_help_display() {
        fprintf(stdout,"    Set the maximum number of quality layers to decode. If there are\n");\r
        fprintf(stdout,"    less quality layers than the specified number, all the quality layers\n");\r
        fprintf(stdout,"    are decoded. \n");\r
-       fprintf(stdout,"  -O original-file \n");
-    fprintf(stdout,"    This option offers the possibility to compute some quality results  \n");
-       fprintf(stdout,"    for the decompressed volume, like the PSNR value achieved or the global SSIM value.  \n");
-       fprintf(stdout,"    Needs the original file in order to compare with the new one.\n");
-    fprintf(stdout,"    NOTE: Only valid when -r option is 0,0,0 (both original and decompressed volumes have same resolutions) \n");
-    fprintf(stdout,"    NOTE: If original file is .BIN file, the volume characteristics file shall be defined with the -m option. \n");
+       fprintf(stdout,"  -O original-file \n");\r
+    fprintf(stdout,"    This option offers the possibility to compute some quality results  \n");\r
+       fprintf(stdout,"    for the decompressed volume, like the PSNR value achieved or the global SSIM value.  \n");\r
+       fprintf(stdout,"    Needs the original file in order to compare with the new one.\n");\r
+    fprintf(stdout,"    NOTE: Only valid when -r option is 0,0,0 (both original and decompressed volumes have same resolutions) \n");\r
+    fprintf(stdout,"    NOTE: If original file is .BIN file, the volume characteristics file shall be defined with the -m option. \n");\r
        fprintf(stdout,"    (i.e. -O original-BIN-file -m original-IMG-file) \n");\r
        fprintf(stdout,"  -BE \n");\r
        fprintf(stdout,"    Define that the recovered volume data will be saved with big endian byte order.\n");\r
@@ -196,10 +198,13 @@ int get_file_format(char *filename) {
        int i;\r
        static const char *extension[] = {"pgx", "bin", "j3d", "jp3d", "j2k", "img"};\r
        static const int format[] = { PGX_DFMT, BIN_DFMT, J3D_CFMT, J3D_CFMT, J2K_CFMT, IMG_DFMT};\r
-       char * ext = strrchr(filename, '.') + 1;\r
-       for(i = 0; i < sizeof(format); i++) {\r
-               if(strnicmp(ext, extension[i], 3) == 0) {\r
-                       return format[i];\r
+       char * ext = strrchr(filename, '.');\r
+       if(ext) {\r
+               ext++;\r
+               for(i = 0; i < sizeof(format) / sizeof(format[0]); i++) {\r
+                       if(strnicmp(ext, extension[i], 3) == 0) {\r
+                               return format[i];\r
+                       }\r
                }\r
        }\r
 \r