]> Creatis software - gdcm.git/blobdiff - src/gdcmjpegls/Decoder/decoder.c
SerieHelper Normalization : stage 1
[gdcm.git] / src / gdcmjpegls / Decoder / decoder.c
index 16a88c00b4c274289ea16d5b741c5cc8ddb70bac..3da8dd8a172f2586eab4892db21fcc71d7936662 100644 (file)
 #include <string.h>
 #include "jpegmark.h"
 
+
+void usage();
+
+
 #define  PGMNAME PGMPREFIX "d"
 #define  EPGMNAME PGMPREFIX "e"
 
-static char *banner="\n\
+/* define color mode strings */
+char plane_int_string[] = "plane by plane",
+   line_int_string[] = "line intlv",
+   pixel_int_string[] = "sample intlv";
+
+static char banner[]="\n\
 =============================================\n\
 SPMG/JPEG-LS DECOMPRESSOR " JPEGLSVERSION "\n\
 =============================================\n\
@@ -100,8 +109,6 @@ int bpp16;            /* Indicates if 16 bits per pixel mode or not */
 int lutmax;            /* lutmax is either 256 or 4501 */
 
 
-
-
 /* reset */
 #ifndef FIXRESET
 int  RESET;
@@ -118,9 +125,6 @@ int     alpha,     /* alphabet size */
 int     highmask;
 #endif
 
-void usage();
-
-
 
 
 
@@ -138,7 +142,7 @@ inline void write_one_line(pixel* line, int cols, FILE* outfile)
       line8 = (unsigned char*)safealloc(cols);
   
       for (i=0; i< cols; i++)
-        *(line8+i)=ENDIAN8(*(line+i));
+        *(line8+i)=(unsigned char)ENDIAN8(*(line+i));
     
       fwrite(line8, sizeof(unsigned char), cols, outfile);
 
@@ -302,9 +306,9 @@ void closebuffers(int multi)
 /* command line argument parsing */
 int initialize(int argc, char *argv[])
 {
-  char *infilename = NULL,
-    *outfilename = OUTFILE ".out",
-    *c_outfilename[MAX_COMPONENTS],
+  char *infilename = NULL;
+  const char *outfilename = OUTFILE ".out";
+  char *c_outfilename[MAX_COMPONENTS],
     *color_mode_string;
   int i, max_samp_columns, max_samp_rows, mk, n_s,
     end_of_seek=0,
@@ -316,7 +320,7 @@ int initialize(int argc, char *argv[])
   int pos;   /* position in the file, after the header */
 
   for (i=0;i<MAX_COMPONENTS;i++) {
-    c_outfilename[i]=malloc(strlen(OUTFILE)+20);
+    c_outfilename[i]=(char*)malloc(strlen(OUTFILE)+20);
     sprintf(c_outfilename[i],"%s%d.out",OUTFILE,i+1);
   }
 
@@ -876,6 +880,7 @@ int main (int argc, char *argv[]) {
     tot_out = 0;
   pixel *local_scanl0,*local_scanl1,*local_pscanline,*local_cscanline;
   int MCUs_counted;
+  local_cscanline = local_pscanline = NULL;
   
   
   /* Parse the parameters, initialize */
@@ -1444,7 +1449,7 @@ int main (int argc, char *argv[]) {
   }
 
   if (head_scan[0]->need_table)
-    fprintf(msgfile,"A mapping table was used which had %i entries of %i bytes each.\n",head_scan[0]->MAXTAB, head_scan[0]->Wt);
+    fprintf(msgfile,"A mapping table was used which had %d entries of %d bytes each.\n",head_scan[0]->MAXTAB, head_scan[0]->Wt);
 
   if (got_restart)
     fprintf(msgfile,"Restart markers were found with a restart interval of %i.\n",restart_interval);
@@ -1465,9 +1470,9 @@ int main (int argc, char *argv[]) {
 
 
   t1 = get_utime();
-  fprintf(msgfile,"Total bits  in: %ld  Symbols out: %ld  %5.3lf bps\n",
+  fprintf(msgfile,"Total bits  in: %ld  Symbols out: %ld  %5.3f bps\n",
            tot_in,tot_out,tot_in/(double)tot_out);
-  fprintf(msgfile,"Time = %1.3lf secs : %1.0lf KSymbols/sec\n",t1-t0,
+  fprintf(msgfile,"Time = %1.3f secs : %1.0f KSymbols/sec\n",t1-t0,
           (tot_out)/(1024*(t1-t0)));
 
   if ( found_EOF )