about summary refs log tree commit diff
path: root/converter/other/fiasco
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-12-30 00:46:34 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2009-12-30 00:46:34 +0000
commit31b7d917b2c1dca2511220c98b0a87d3dce81ac0 (patch)
treed71bcaa517e05dbdefb67bc11ccc9cc4ea5c9b8b /converter/other/fiasco
parent9abc33b42f651606176b3da8bf27d766588ac776 (diff)
downloadnetpbm-mirror-31b7d917b2c1dca2511220c98b0a87d3dce81ac0.tar.gz
netpbm-mirror-31b7d917b2c1dca2511220c98b0a87d3dce81ac0.tar.xz
netpbm-mirror-31b7d917b2c1dca2511220c98b0a87d3dce81ac0.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1079 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/fiasco')
-rw-r--r--converter/other/fiasco/pnmtofiasco.c416
1 files changed, 208 insertions, 208 deletions
diff --git a/converter/other/fiasco/pnmtofiasco.c b/converter/other/fiasco/pnmtofiasco.c
index 2218256d..07b97d7e 100644
--- a/converter/other/fiasco/pnmtofiasco.c
+++ b/converter/other/fiasco/pnmtofiasco.c
@@ -1,8 +1,8 @@
 /*
- *  cwfa.c:		FIASCO coder
+ *  cwfa.c:     FIASCO coder
  *
- *  Written by:		Ullrich Hafner
- *		
+ *  Written by:     Ullrich Hafner
+ *      
  *  This file is part of FIASCO («F»ractal «I»mage «A»nd «S»equence «CO»dec)
  *  Copyright (C) 1994-2000 Ullrich Hafner <hafner@bigfoot.de>
  */
@@ -18,14 +18,14 @@
 #include "pnm.h"
 
 #if STDC_HEADERS
-#	include <stdlib.h>
-#	include <string.h>
+#   include <stdlib.h>
+#   include <string.h>
 #else /* not STDC_HEADERS */
-#	if HAVE_STRING_H
-#		include <string.h>
-#	else /* not HAVE_STRING_H */
-#		include <strings.h>
-#	endif /* not HAVE_STRING_H */
+#   if HAVE_STRING_H
+#       include <string.h>
+#   else /* not HAVE_STRING_H */
+#       include <strings.h>
+#   endif /* not HAVE_STRING_H */
 #endif /* not STDC_HEADERS */
 
 #include "types.h"
@@ -38,7 +38,7 @@
 
 /*****************************************************************************
 
-			     local variables
+                 local variables
   
 *****************************************************************************/
 
@@ -144,27 +144,27 @@ static param_t params [] =
 
 /*****************************************************************************
 
-				prototypes
+                prototypes
   
 *****************************************************************************/
 
 static void 
 checkargs (int argc, char **argv, char const ***image_template,
-	   char **wfa_name, float *quality, fiasco_c_options_t **options);
+       char **wfa_name, float *quality, fiasco_c_options_t **options);
 
 /*****************************************************************************
 
-				public code
+                public code
   
 *****************************************************************************/
  
 int 
 main (int argc, char **argv)
 {
-   char const 	      **image_template;	/* template for input image files */
-   char	       	       *wfa_name;	/* filename of output WFA */
-   float	      	quality;	/* approximation quality */
-   fiasco_c_options_t  *options;	/* additional coder options */
+   char const         **image_template; /* template for input image files */
+   char                *wfa_name;   /* filename of output WFA */
+   float            quality;    /* approximation quality */
+   fiasco_c_options_t  *options;    /* additional coder options */
    
    pnm_init(&argc, argv);
    
@@ -184,228 +184,228 @@ main (int argc, char **argv)
 
 /*****************************************************************************
 
-				private code
+                private code
   
 *****************************************************************************/
 
 static void 
 checkargs (int argc, char **argv, char const ***image_template,
-	   char **wfa_name, float *quality, fiasco_c_options_t **options)
+           char **wfa_name, float *quality, fiasco_c_options_t **options)
 /*
  *  Check validness of command line parameters and of the parameter files.
  *
  *  Return value:
- *	1 on success
- *	0 otherwise
+ *  1 on success
+ *  0 otherwise
  *  
  *
  *  Side effects:
- *	'image_template', 'wfa_name', 'quality' and 'options' are set.
+ *  'image_template', 'wfa_name', 'quality' and 'options' are set.
  */
 {
-   int	 optind;			/* last processed commandline param */
-   char	*image_name;			/* filename given by option '-i' */
-   int	 i;				/* counter */
+    int   optind;            /* last processed commandline param */
+    char *image_name;            /* filename given by option '--input_name' */
+    int   i;             /* counter */
    
-   optind = parseargs (params, argc, argv,
-		       "Compress raw PPM/PGM image FILEs to a FIASCO file.",
-		       "With no image FILE, or if FILE is -, "
-		       "read standard input.\n"
-		       "FILE must be either a filename"
-		       " or an image template of the form:\n"
-		       "`prefix[start-end{+,-}step]suffix'\n"
-		       "e.g., img0[12-01-1].pgm is substituted by"
-		       " img012.pgm ... img001.pgm\n\n"
-		       "Environment:\n"
-		       "FIASCO_DATA   Search and save path for FIASCO files. "
-		       "Default: ./\n"
-		       "FIASCO_IMAGES Search path for image files. "
-		       "Default: ./", " [FILE]...",
-		       FIASCO_SHARE, "system.fiascorc", ".fiascorc");
+    optind = parseargs (params, argc, argv,
+                        "Compress raw PPM/PGM image FILEs to a FIASCO file.",
+                        "With no image FILE, or if FILE is -, "
+                        "read standard input.\n"
+                        "FILE must be either a filename"
+                        " or an image template of the form:\n"
+                        "`prefix[start-end{+,-}step]suffix'\n"
+                        "e.g., img0[12-01-1].pgm is substituted by"
+                        " img012.pgm ... img001.pgm\n\n"
+                        "Environment:\n"
+                        "FIASCO_DATA   Search and save path for FIASCO files. "
+                        "Default: ./\n"
+                        "FIASCO_IMAGES Search path for image files. "
+                        "Default: ./", " [FILE]...",
+                        FIASCO_SHARE, "system.fiascorc", ".fiascorc");
 
-   /*
-    *  Default options ...
-    */
-   image_name = (char *) parameter_value (params, "image-name"); 
-   *wfa_name  = (char *) parameter_value (params, "output-name");
-   for (;;)
-   {
-      *quality = * (float *) parameter_value (params, "quality");
-      if (*quality > 100)
-	 fprintf (stderr, "Typical range of quality: (0,100].\n"
-		  "Expect some trouble on slow machines.\n");
-      if (*quality > 0)
-	 break;
-      ask_and_set (params, "quality",
-		   "Please enter coding quality 'q' ('q' > 0): ");
-   }
+    /*
+     *  Default options ...
+     */
+    image_name = (char *) parameter_value (params, "image-name"); 
+    *wfa_name  = (char *) parameter_value (params, "output-name");
+    for (;;)
+    {
+        *quality = * (float *) parameter_value (params, "quality");
+        if (*quality > 100)
+            fprintf (stderr, "Typical range of quality: (0,100].\n"
+                     "Expect some trouble on slow machines.\n");
+        if (*quality > 0)
+            break;
+        ask_and_set (params, "quality",
+                     "Please enter coding quality 'q' ('q' > 0): ");
+    }
    
-   if (optind < argc)			/* Additional command line param */
-   {
-      if (image_name)
-	 error ("Multiple image_template arguments."
-		"\nOption -i %s already specified!", image_name);
+    if (optind < argc)           /* Additional command line param */
+    {
+        if (image_name)
+            error ("Multiple image_template arguments."
+                   "\nOption --input-name %s already specified!", image_name);
 
-      *image_template = calloc (argc - optind + 1, sizeof (char *));
-      if (!*image_template)
-	 error ("Out of memory.");
-      for (i = 0; optind < argc; i++, optind++)
-	 (*image_template) [i] = argv [optind];
-      (*image_template) [i] = NULL;
-   }
-   else					/* option -i image_name */
-   {
-      *image_template = calloc (2, sizeof (char *));
-      if (!*image_template)
-	 error ("Out of memory.");
-      (*image_template) [0] = image_name;
-      (*image_template) [1] = NULL;
-   }
-   /*
-    *  Additional options ... (have to be set with the fiasco_set_... methods)
-    */
-   {
-      *options = fiasco_c_options_new ();
+        *image_template = calloc (argc - optind + 1, sizeof (char *));
+        if (!*image_template)
+            error ("Out of memory.");
+        for (i = 0; optind < argc; i++, optind++)
+            (*image_template) [i] = argv [optind];
+        (*image_template) [i] = NULL;
+    }
+    else                 /* option -i image_name */
+    {
+        *image_template = calloc (2, sizeof (char *));
+        if (!*image_template)
+            error ("Out of memory.");
+        (*image_template) [0] = image_name;
+        (*image_template) [1] = NULL;
+    }
+    /*
+     *  Additional options ... (have to be set with the fiasco_set_... methods)
+     */
+    {
+        *options = fiasco_c_options_new ();
       
-      {
-	 char *pattern = (char *) parameter_value (params, "pattern");
+        {
+            char *pattern = (char *) parameter_value (params, "pattern");
 
-	 if (!fiasco_c_options_set_frame_pattern (*options, pattern))
-	    error (fiasco_get_error_message ());
-      }
+            if (!fiasco_c_options_set_frame_pattern (*options, pattern))
+                error (fiasco_get_error_message ());
+        }
 
-      {
-	 char *basis = (char *) parameter_value (params, "basis-name");
-	 
-	 if (!fiasco_c_options_set_basisfile (*options, basis))
-	    error (fiasco_get_error_message ());
-      }
+        {
+            char *basis = (char *) parameter_value (params, "basis-name");
+     
+            if (!fiasco_c_options_set_basisfile (*options, basis))
+                error (fiasco_get_error_message ());
+        }
 
-      {
-	 int   n = * (int *) parameter_value (params, "chroma-dictionary");
-	 float q = * (float *) parameter_value (params, "chroma-qfactor");
+        {
+            int   n = * (int *) parameter_value (params, "chroma-dictionary");
+            float q = * (float *) parameter_value (params, "chroma-qfactor");
       
-	 if (!fiasco_c_options_set_chroma_quality (*options, q, max (0, n)))
-	    error (fiasco_get_error_message ());
-      }
+            if (!fiasco_c_options_set_chroma_quality (*options, q, max (0, n)))
+                error (fiasco_get_error_message ());
+        }
       
-      {
-	 int n = *((int *) parameter_value (params, "smooth"));
-	 
-	 if (!fiasco_c_options_set_smoothing (*options, max (0, n)))
-	    error (fiasco_get_error_message ());
-      }
+        {
+            int n = *((int *) parameter_value (params, "smooth"));
+     
+            if (!fiasco_c_options_set_smoothing (*options, max (0, n)))
+                error (fiasco_get_error_message ());
+        }
       
-      {
-          int n = * (int *) parameter_value (params, "progress-meter");
-          fiasco_progress_e type = (n < 0) ? 
-              FIASCO_PROGRESS_NONE : (fiasco_progress_e) n;
+        {
+            int n = * (int *) parameter_value (params, "progress-meter");
+            fiasco_progress_e type = (n < 0) ? 
+                FIASCO_PROGRESS_NONE : (fiasco_progress_e) n;
       
-          if (!fiasco_c_options_set_progress_meter (*options, type))
-              error (fiasco_get_error_message ());
-      }
+            if (!fiasco_c_options_set_progress_meter (*options, type))
+                error (fiasco_get_error_message ());
+        }
       
-      {
-	 char *t = (char *) parameter_value (params, "title");
-	 
-	 if (strlen (t) > 0 && !fiasco_c_options_set_title (*options, t))
-	    error (fiasco_get_error_message ());
-      }
+        {
+            char *t = (char *) parameter_value (params, "title");
+     
+            if (strlen (t) > 0 && !fiasco_c_options_set_title (*options, t))
+                error (fiasco_get_error_message ());
+        }
       
-      {
-	 char *c = (char *) parameter_value (params, "comment");
+        {
+            char *c = (char *) parameter_value (params, "comment");
 
-	 if (strlen (c) > 0 && !fiasco_c_options_set_comment (*options, c))
-	    error (fiasco_get_error_message ());
-      }
+            if (strlen (c) > 0 && !fiasco_c_options_set_comment (*options, c))
+                error (fiasco_get_error_message ());
+        }
       
-      {
-	 fiasco_tiling_e method = FIASCO_TILING_VARIANCE_DSC;
-	 int   e  = * (int *) parameter_value (params, "tiling-exponent");
-	 char *m  = (char *) parameter_value (params, "tiling-method");
+        {
+            fiasco_tiling_e method = FIASCO_TILING_VARIANCE_DSC;
+            int   e  = * (int *) parameter_value (params, "tiling-exponent");
+            char *m  = (char *) parameter_value (params, "tiling-method");
 
-	 if (strcaseeq (m, "desc-variance"))
-	    method = FIASCO_TILING_VARIANCE_DSC;
-	 else if (strcaseeq (m, "asc-variance"))
-	    method = FIASCO_TILING_VARIANCE_ASC;
-	 else if (strcaseeq (m, "asc-spiral"))
-	    method = FIASCO_TILING_SPIRAL_ASC;
-	 else if (strcaseeq (m, "dsc-spiral"))
-	    method = FIASCO_TILING_SPIRAL_DSC;
-	 else
-	    error (_("Invalid tiling method `%s' specified."), m);
+            if (strcaseeq (m, "desc-variance"))
+                method = FIASCO_TILING_VARIANCE_DSC;
+            else if (strcaseeq (m, "asc-variance"))
+                method = FIASCO_TILING_VARIANCE_ASC;
+            else if (strcaseeq (m, "asc-spiral"))
+                method = FIASCO_TILING_SPIRAL_ASC;
+            else if (strcaseeq (m, "dsc-spiral"))
+                method = FIASCO_TILING_SPIRAL_DSC;
+            else
+                error (_("Invalid tiling method `%s' specified."), m);
 
-	 if (!fiasco_c_options_set_tiling (*options, method, max (0, e)))
-	    error (fiasco_get_error_message ());
-      }
+            if (!fiasco_c_options_set_tiling (*options, method, max (0, e)))
+                error (fiasco_get_error_message ());
+        }
       
-      {
-	 int M/*  = * (int *) parameter_value (params, "max-level") */;
-	 int m/*  = * (int *) parameter_value (params, "min-level") */;
-	 int N/*  = * (int *) parameter_value (params, "max-elements") */;
-	 int D = * (int *) parameter_value (params, "dictionary-size");
-	 int o = * (int *) parameter_value (params, "optimize");
+        {
+            int M/*  = * (int *) parameter_value (params, "max-level") */;
+            int m/*  = * (int *) parameter_value (params, "min-level") */;
+            int N/*  = * (int *) parameter_value (params, "max-elements") */;
+            int D = * (int *) parameter_value (params, "dictionary-size");
+            int o = * (int *) parameter_value (params, "optimize");
 
-	 if (o <= 0)
-	 {
-	    o = 0;
-	    M = 10;
-	    m = 6;
-	    N = 3;
-	 }
-	 else
-	 {
-	    o -= 1;
-	    M = 12;
-	    m = 4;
-	    N = 5;
-	 }
-	 
-	 if (!fiasco_c_options_set_optimizations (*options, m, M, N,
-						  max (0, D), o))
-	    error (fiasco_get_error_message ());
-      }
-      {
-	 int M = * (int *) parameter_value (params, "max-level");
-	 int m = * (int *) parameter_value (params, "min-level");
-	 int p = * (int *) parameter_value (params, "prediction");
-	 
-	 if (!fiasco_c_options_set_prediction (*options,
-					       p, max (0, m), max (0, M)))
-	    error (fiasco_get_error_message ());
-      }
-      {
-	 float r    = * (float *) parameter_value (params, "rpf-range");
-	 float dc_r = * (float *) parameter_value (params, "dc-rpf-range");
-	 int   m    = * (int *)   parameter_value (params, "rpf-mantissa");
-	 int   dc_m = * (int *)   parameter_value (params, "dc-rpf-mantissa");
-	 fiasco_rpf_range_e range, dc_range;
-	 
-	 if (r < 1)
-	    range = FIASCO_RPF_RANGE_0_75;
-	 else if (r < 1.5)
-	    range = FIASCO_RPF_RANGE_1_00;
-	 else if (r < 2.0)
-	    range = FIASCO_RPF_RANGE_1_50;
-	 else
-	    range = FIASCO_RPF_RANGE_2_00;
-	    
-	 if (dc_r < 1)
-	    dc_range = FIASCO_RPF_RANGE_0_75;
-	 else if (dc_r < 1.5)
-	    dc_range = FIASCO_RPF_RANGE_1_00;
-	 else if (dc_r < 2.0)
-	    dc_range = FIASCO_RPF_RANGE_1_50;
-	 else
-	    dc_range = FIASCO_RPF_RANGE_2_00;
-	    
-	 if (!fiasco_c_options_set_quantization (*options,
-						 max (0, m), range,
-						 max (0, dc_m), dc_range))
-	    error (fiasco_get_error_message ());
-      }
+            if (o <= 0)
+            {
+                o = 0;
+                M = 10;
+                m = 6;
+                N = 3;
+            }
+            else
+            {
+                o -= 1;
+                M = 12;
+                m = 4;
+                N = 5;
+            }
+     
+            if (!fiasco_c_options_set_optimizations (*options, m, M, N,
+                                                     max (0, D), o))
+                error (fiasco_get_error_message ());
+        }
+        {
+            int M = * (int *) parameter_value (params, "max-level");
+            int m = * (int *) parameter_value (params, "min-level");
+            int p = * (int *) parameter_value (params, "prediction");
+     
+            if (!fiasco_c_options_set_prediction (*options,
+                                                  p, max (0, m), max (0, M)))
+                error (fiasco_get_error_message ());
+        }
+        {
+            float r    = * (float *) parameter_value (params, "rpf-range");
+            float dc_r = * (float *) parameter_value (params, "dc-rpf-range");
+            int   m    = * (int *)   parameter_value (params, "rpf-mantissa");
+            int   dc_m = * (int *)   parameter_value (params, "dc-rpf-mantissa");
+            fiasco_rpf_range_e range, dc_range;
+     
+            if (r < 1)
+                range = FIASCO_RPF_RANGE_0_75;
+            else if (r < 1.5)
+                range = FIASCO_RPF_RANGE_1_00;
+            else if (r < 2.0)
+                range = FIASCO_RPF_RANGE_1_50;
+            else
+                range = FIASCO_RPF_RANGE_2_00;
+        
+            if (dc_r < 1)
+                dc_range = FIASCO_RPF_RANGE_0_75;
+            else if (dc_r < 1.5)
+                dc_range = FIASCO_RPF_RANGE_1_00;
+            else if (dc_r < 2.0)
+                dc_range = FIASCO_RPF_RANGE_1_50;
+            else
+                dc_range = FIASCO_RPF_RANGE_2_00;
+        
+            if (!fiasco_c_options_set_quantization (*options,
+                                                    max (0, m), range,
+                                                    max (0, dc_m), dc_range))
+                error (fiasco_get_error_message ());
+        }
 
-      if (fiasco_get_verbosity () == FIASCO_ULTIMATE_VERBOSITY)
-	 write_parameters (params, stderr);
-   }
-}	
+        if (fiasco_get_verbosity () == FIASCO_ULTIMATE_VERBOSITY)
+            write_parameters (params, stderr);
+    }
+}