about summary refs log tree commit diff
path: root/converter/other/fiasco/lib
diff options
context:
space:
mode:
Diffstat (limited to 'converter/other/fiasco/lib')
-rw-r--r--converter/other/fiasco/lib/arith.c130
-rw-r--r--converter/other/fiasco/lib/bit-io.c56
-rw-r--r--converter/other/fiasco/lib/image.c58
-rw-r--r--converter/other/fiasco/lib/image.h2
-rw-r--r--converter/other/fiasco/lib/macros.h2
5 files changed, 123 insertions, 125 deletions
diff --git a/converter/other/fiasco/lib/arith.c b/converter/other/fiasco/lib/arith.c
index 825d4757..e61e753e 100644
--- a/converter/other/fiasco/lib/arith.c
+++ b/converter/other/fiasco/lib/arith.c
@@ -2,7 +2,7 @@
  *  arith.c:		Adaptive arithmetic coding and decoding
  *
  *  Written by:		Ullrich Hafner
- *  
+ *
  *  This file is part of FIASCO (Fractal Image And Sequence COdec)
  *  Copyright (C) 1994-2000 Ullrich Hafner
  */
@@ -27,7 +27,7 @@
 /******************************************************************************
 
 				public code
-  
+
 ******************************************************************************/
 
 arith_t *
@@ -35,7 +35,7 @@ alloc_encoder (bitfile_t *output)
 /*
  *  Arithmetic coder constructor:
  *  Initialize the arithmetic coder.
- *  
+ *
  *  Return value:
  *	A pointer to the new coder structure
  */
@@ -43,7 +43,7 @@ alloc_encoder (bitfile_t *output)
    arith_t *arith = Calloc (1, sizeof (arith_t));
 
    assert (output);
-   
+
    arith->low       = LOW;
    arith->high      = HIGH;
    arith->underflow = 0;
@@ -58,7 +58,7 @@ free_encoder (arith_t *arith)
  *  Arithmetic encoder destructor.
  *  Flush the arithmetic coder. Append all remaining bits to the
  *  output stream. Append zero bits to get the output file byte aligned.
- *  
+ *
  *  No return value.
  */
 {
@@ -66,14 +66,14 @@ free_encoder (arith_t *arith)
    u_word_t   high;			/* end of the current code range    */
    u_word_t   underflow;		/* number of underflow bits pending */
    bitfile_t *output;
-   
+
    assert (arith);
 
    low       = arith->low;
    high      = arith->high;
    underflow = arith->underflow;
    output    = arith->file;
-   
+
    low = high;
 
    RESCALE_OUTPUT_INTERVAL;
@@ -92,7 +92,7 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model)
  *
  *  The model is updated after encoding the symbol (if necessary the
  *  symbol counts are rescaled).
- *  
+ *
  *  Return value:
  *	information content of the encoded symbol.
  *
@@ -110,7 +110,7 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model)
    u_word_t   high;			/* end of the current code range    */
    u_word_t   underflow;		/* number of underflow bits pending */
    bitfile_t *output;			/* output file */
-   
+
    assert (model && arith);
 
    /*
@@ -122,7 +122,7 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model)
    output    = arith->file;
 
    assert (high > low);
-   
+
    if (model->order > 0)		/* order-'n' model*/
    {
       unsigned power;			/* multiplicator */
@@ -134,10 +134,10 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model)
        */
       power = 1;			/* multiplicator */
       index = 0;			/* address of prob. model */
-	 
-      for (i = 0; i < model->order; i++) /* genarate a M-nary number */
+
+      for (i = 0; i < model->order; i++) /* generate a M-nary number */
       {
-	 index += model->context [i] * power;	
+	 index += model->context [i] * power;
 	 power *= model->symbols;
       }
 
@@ -160,9 +160,9 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model)
    range = (high - low) + 1;
    high  = low + (u_word_t) ((range * high_count) / scale - 1);
    low   = low + (u_word_t) ((range * low_count) / scale);
-   
+
    RESCALE_OUTPUT_INTERVAL;
-   
+
    if (model->scale > 0)		/* adaptive model */
    {
       unsigned i;
@@ -189,7 +189,7 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model)
    arith->low  	    = low;
    arith->high 	    = high;
    arith->underflow = underflow;
-   
+
    return - log2 ((high_count - low_count) / (real_t) scale);
 }
 
@@ -214,21 +214,21 @@ encode_array (bitfile_t *output, const unsigned *data, const unsigned *context,
 
    assert (output && c_symbols && data);
    assert (n_context == 1 || context);
-   
+
    /*
     *  Allocate probability models, start with uniform distribution
     */
    totals = Calloc (n_context, sizeof (u_word_t *));
    {
       unsigned c;
-      
+
       for (c = 0; c < n_context; c++)
       {
 	 unsigned i;
-      
+
 	 totals [c]    = Calloc (c_symbols [c] + 1, sizeof (u_word_t));
 	 totals [c][0] = 0;
-      
+
 	 for (i = 0; i < c_symbols [c]; i++)
 	    totals [c][i + 1] = totals [c][i] + 1;
       }
@@ -242,7 +242,7 @@ encode_array (bitfile_t *output, const unsigned *data, const unsigned *context,
       u_word_t high 	 = 0xffff;	/* End of the current code range */
       u_word_t underflow = 0;		/* Number of underflow bits pending */
       unsigned n;
-      
+
       for (n = 0; n < n_data; n++)
       {
 	 u_word_t low_count;		/* lower bound of 'symbol' interval */
@@ -253,8 +253,8 @@ encode_array (bitfile_t *output, const unsigned *data, const unsigned *context,
 	 int	  c;			/* context of current data symbol */
 
 	 d = data [n];
-	 c = n_context > 1 ? context [n] : 0; 
-      
+	 c = n_context > 1 ? context [n] : 0;
+
 	 scale	    = totals [c][c_symbols [c]];
 	 low_count  = totals [c][d];
 	 high_count = totals [c][d + 1];
@@ -266,7 +266,7 @@ encode_array (bitfile_t *output, const unsigned *data, const unsigned *context,
 	 high  = low + (u_word_t) ((range * high_count) / scale - 1);
 	 low   = low + (u_word_t) ((range * low_count) / scale);
 	 RESCALE_OUTPUT_INTERVAL;
-      
+
 	 /*
 	  *  Update probability models
 	  */
@@ -275,7 +275,7 @@ encode_array (bitfile_t *output, const unsigned *data, const unsigned *context,
 
 	    for (i = d + 1; i < c_symbols [c] + 1; i++)
 	       totals [c][i]++;
-	 
+
 	    if (totals [c][c_symbols [c]] > scaling) /* scaling */
 	       for (i = 1; i < c_symbols [c] + 1; i++)
 	       {
@@ -292,7 +292,7 @@ encode_array (bitfile_t *output, const unsigned *data, const unsigned *context,
       RESCALE_OUTPUT_INTERVAL;
       OUTPUT_BYTE_ALIGN (output);
    }
-   
+
    /*
     *  Cleanup ...
     */
@@ -310,16 +310,16 @@ alloc_decoder (bitfile_t *input)
  *  Arithmetic decoder constructor:
  *  Initialize the arithmetic decoder with the first
  *  16 input bits from the stream 'input'.
- *  
+ *
  *  Return value:
  *	A pointer to the new decoder structure
  */
 
 {
    arith_t *arith = Calloc (1, sizeof (arith_t));
-   
+
    assert (input);
-   
+
    arith->low  = LOW;
    arith->high = HIGH;
    arith->code = get_bits (input, 16);
@@ -333,8 +333,8 @@ free_decoder (arith_t *arith)
 /*
  *  Arithmetic decoder destructor:
  *  Flush the arithmetic decoder, i.e., read bits to get the input
- *  file byte aligned. 
- *  
+ *  file byte aligned.
+ *
  *  No return value.
  *
  *  Side effects:
@@ -354,8 +354,8 @@ decode_symbol (arith_t *arith, model_t *model)
  *  Decode the next symbol - the state of the arithmetic decoder
  *  is given in 'arith'. Read refinement bits from the stream 'input'
  *  and use the given probability 'model'. Update the probability model after
- *  deconding the symbol (if necessary also rescale the symbol counts).
- *  
+ *  decoding the symbol (if necessary also rescale the symbol counts).
+ *
  *  Return value:
  *	decoded symbol
  *
@@ -375,7 +375,7 @@ decode_symbol (arith_t *arith, model_t *model)
    bitfile_t *input;			/* input file */
 
    assert (arith && model);
-   
+
    /*
     * Get interval values
     */
@@ -385,22 +385,22 @@ decode_symbol (arith_t *arith, model_t *model)
    input = arith->file;
 
    assert (high > low);
-   
+
    if (model->order > 0)		/* order-'n' model */
    {
       unsigned power;			/* multiplicator */
       unsigned i;
-      
+
       /*
        *  Compute index of the probability model to use.
        *  See init_model() for more details.
        */
       power = 1;			/* multiplicator */
       index = 0;			/* address of prob. model */
-	 
-      for (i = 0; i < model->order; i++) /* genarate a m-nary number */
+
+      for (i = 0; i < model->order; i++) /* generate a m-nary number */
       {
-	 index += model->context[i] * power;	
+	 index += model->context[i] * power;
 	 power *= model->symbols;
       }
 
@@ -420,7 +420,7 @@ decode_symbol (arith_t *arith, model_t *model)
    if (model->order > 0)		/* order-'n' model */
    {
       unsigned i;
-      
+
       for (i = 0; i < model->order - 1; i++)
 	 model->context [i] = model->context [i + 1];
       model->context [i] = symbol;
@@ -432,15 +432,15 @@ decode_symbol (arith_t *arith, model_t *model)
    {
       u_word_t low_count;		/* lower bound of 'symbol' interval */
       u_word_t high_count;		/* upper bound of 'symbol' interval */
-      
+
       low_count  = model->totals [index + symbol];
       high_count = model->totals [index + symbol + 1];
       high       = low + (u_word_t) ((range * high_count) / scale - 1 );
       low        = low + (u_word_t) ((range * low_count) / scale );
    }
-   
+
    RESCALE_INPUT_INTERVAL;
-   
+
    if (model->scale > 0)		/* adaptive model */
    {
       unsigned i;
@@ -460,7 +460,7 @@ decode_symbol (arith_t *arith, model_t *model)
 	 }
       }
    }
-   
+
    /*
     *  Store interval values
     */
@@ -488,28 +488,28 @@ decode_array (bitfile_t *input, const unsigned *context,
 {
    unsigned  *data;			/* array to store decoded symbols */
    u_word_t **totals;			/* probability model */
-   
+
    if (n_context < 1)
       n_context = 1;			/* always use one context */
    assert (input && c_symbols);
    assert (n_context == 1 || context);
 
    data = Calloc (n_data, sizeof (unsigned));
-   
+
    /*
     *  Allocate probability models, start with uniform distribution
     */
    totals = Calloc (n_context, sizeof (u_word_t *));
    {
       unsigned c;
-      
+
       for (c = 0; c < n_context; c++)
       {
 	 unsigned i;
-      
+
 	 totals [c]    = Calloc (c_symbols [c] + 1, sizeof (u_word_t));
 	 totals [c][0] = 0;
-      
+
 	 for (i = 0; i < c_symbols [c]; i++)
 	    totals [c][i + 1] = totals [c][i] + 1;
       }
@@ -523,8 +523,8 @@ decode_array (bitfile_t *input, const unsigned *context,
       u_word_t low  = 0;		/* Start of the current code range */
       u_word_t high = 0xffff;		/* End of the current code range */
       unsigned n;
-      
-      for (n = 0; n < n_data; n++) 
+
+      for (n = 0; n < n_data; n++)
       {
 	 u_word_t scale;		/* range of all 'm' symbol intervals */
 	 u_word_t low_count;		/* lower bound of 'symbol' interval */
@@ -534,13 +534,13 @@ decode_array (bitfile_t *input, const unsigned *context,
 	 unsigned d;			/* current data symbol */
 	 unsigned c;			/* context of current data symbol */
 
-	 c = n_context > 1 ? context [n] : 0; 
+	 c = n_context > 1 ? context [n] : 0;
 
 	 assert (high > low);
 	 scale = totals [c][c_symbols [c]];
 	 range = (high - low) + 1;
 	 count = (((code - low) + 1 ) * scale - 1) / range;
-      
+
 	 for (d = c_symbols [c]; count < totals [c][d]; d--) /* next symbol */
 	    ;
 	 low_count  = totals [c][d];
@@ -558,7 +558,7 @@ decode_array (bitfile_t *input, const unsigned *context,
 
 	    for (i = d + 1; i < c_symbols [c] + 1; i++)
 	       totals [c][i]++;
-	 
+
 	    if (totals [c][c_symbols [c]] > scaling) /* scaling */
 	       for (i = 1; i < c_symbols [c] + 1; i++)
 	       {
@@ -577,12 +577,12 @@ decode_array (bitfile_t *input, const unsigned *context,
     */
    {
       unsigned c;
-      
+
       for (c = 0; c < n_context; c++)
 	 Free (totals [c]);
       Free (totals);
    }
-   
+
    return data;
 }
 
@@ -600,10 +600,10 @@ alloc_model (unsigned m, unsigned scale, unsigned n, unsigned *totals)
  *
  *  Return value:
  *	a pointer to the new probability model structure.
- *  
+ *
  *  Note: We recommend a small size of the alphabet because no escape codes
  *  are used to encode/decode previously unseen symbols.
- *  
+ *
  */
 {
    model_t  *model;			/* new probability model */
@@ -621,7 +621,7 @@ alloc_model (unsigned m, unsigned scale, unsigned n, unsigned *totals)
    model->order   = n;
    model->context = n > 0 ? Calloc (n, sizeof (unsigned)) : NULL;
    /*
-    *  Allocate memory for the probabilty model.
+    *  Allocate memory for the probability model.
     *  Each of the m^n different contexts requires its own probability model.
     */
    for (num = 1, i = 0; i < model->order; i++)
@@ -644,17 +644,17 @@ alloc_model (unsigned m, unsigned scale, unsigned n, unsigned *totals)
        */
       power = 1;			/* multiplicator */
       index = 0;			/* address of prob. model */
-	 
-      for (i = 0; i < model->order; i++)	/* genarate a m-nary number */
+
+      for (i = 0; i < model->order; i++)	/* generate a m-nary number */
       {
-	 index += model->context[i] * power;	
+	 index += model->context[i] * power;
 	 power *= model->symbols;
       }
 
       index *= model->symbols + 1;	/* size of each model is m + 1 */
 
       model->totals [index + 0] = 0;	/* always zero */
-	 
+
       for (i = 1; i <= model->symbols; i++) /* prob of each symbol is 1/m or
 					       as given in totals */
 	 model->totals[index + i] = model->totals [index + i - 1]
@@ -667,14 +667,14 @@ alloc_model (unsigned m, unsigned scale, unsigned n, unsigned *totals)
 	 {
 	    dec = NO;
 	    model->context[i]++;
-	    if (model->context[i] >= model->symbols) 
+	    if (model->context[i] >= model->symbols)
 	    {
 	       /* change previous context */
 	       model->context[i] = 0;
 	       if (i > 0)		/* there's still a context remaining */
 		  dec = YES;
 	       else
-		  cont = NO;		/* all context models initilized */
+		  cont = NO;		/* all context models initialized */
 	    }
 	 }
    }
diff --git a/converter/other/fiasco/lib/bit-io.c b/converter/other/fiasco/lib/bit-io.c
index f69343e6..04716f05 100644
--- a/converter/other/fiasco/lib/bit-io.c
+++ b/converter/other/fiasco/lib/bit-io.c
@@ -1,12 +1,12 @@
 /*
- *  bit-io.c:       Buffered and bit oriented file I/O 
+ *  bit-io.c:       Buffered and bit oriented file I/O
  *
  *  Written by:     Ullrich Hafner
- *  
+ *
  *  This file is part of FIASCO (Fractal Image And Sequence COdec)
  *  Copyright (C) 1994-2000 Ullrich Hafner
  */
- 
+
 /*
  *  $Date: 2000/06/14 20:49:37 $
  *  $Author: hafner $
@@ -35,7 +35,7 @@
 /*****************************************************************************
 
                  local constants
-  
+
 *****************************************************************************/
 
 static const unsigned BUFFER_SIZE = 16350;
@@ -48,7 +48,7 @@ static const unsigned mask[] = {0x0001, 0x0002, 0x0004, 0x0008,
 /*****************************************************************************
 
                 public code
-  
+
 *****************************************************************************/
 
 FILE *
@@ -57,7 +57,7 @@ open_file (const char *filename, const char *env_var, openmode_e mode)
  *  Try to open file 'filename' with mode 'mode' (READ_ACCESS, WRITE_ACCESS).
  *  Scan the current directory first and then cycle through the
  *  path given in the environment variable 'env_var', if set.
- * 
+ *
  *  Return value:
  *  Pointer to open file on success, else NULL.
  */
@@ -81,42 +81,42 @@ open_file (const char *filename, const char *env_var, openmode_e mode)
     {
         if (mode == READ_ACCESS)
             return stdin;
-        else 
+        else
             return stdout;
     }
-   
+
     /*
      *  Try to open 'readonly' file in the current directory
      */
     if (mode == READ_ACCESS && (fp = fopen (filename, read_mode)))
-        return fp; 
+        return fp;
 
     if (mode == WRITE_ACCESS && strchr (filename, '/')) /* contains path */
         return fopen (filename, write_mode);
-   
+
     /*
      *  Get value of environment variable 'env_var', if set
      *  else use DEFAULT_PATH ("./")
      */
     if (env_var != NULL)
         env_path = getenv (env_var);
-    if (env_path == NULL) 
+    if (env_path == NULL)
         env_path = strdup (DEFAULT_PATH);
     else
         env_path = strdup (env_path);
-   
+
     /*
      *  Try to open file in the directory given by the environment
-     *  variable env_var - individual path components are separated by PATH_SEP 
+     *  variable env_var - individual path components are separated by PATH_SEP
      */
     path = strtok (env_path, PATH_SEP);
-    do 
+    do
     {
-        if (ext_filename) 
+        if (ext_filename)
             Free (ext_filename);
         ext_filename =  Calloc (strlen (path) + strlen (filename) + 2,
                                 sizeof (char));
-        strcpy (ext_filename, path); 
+        strcpy (ext_filename, path);
         if (*(ext_filename + strlen (ext_filename) - 1) != '/')
             strcat (ext_filename, "/");
         strcat (ext_filename, filename);
@@ -125,7 +125,7 @@ open_file (const char *filename, const char *env_var, openmode_e mode)
     while (fp == NULL && (path = strtok (NULL, PATH_SEP)) != NULL);
 
     Free (env_path);
-   
+
     return fp;
 }
 
@@ -143,7 +143,7 @@ open_bitfile (const char *filename, const char *env_var, openmode_e mode)
  */
 {
     bitfile_t *bitfile = Calloc (1, sizeof (bitfile_t));
-   
+
     bitfile->file = open_file (filename, env_var, mode);
 
     if (bitfile->file == NULL)
@@ -164,8 +164,8 @@ open_bitfile (const char *filename, const char *env_var, openmode_e mode)
         bitfile->filename = filename ? strdup (filename) : strdup ("(stdout)");
     }
     else
-        error ("Unknow file access mode '%d'.", mode);
-   
+        error ("Unknown file access mode '%d'.", mode);
+
     bitfile->bits_processed = 0;
     bitfile->buffer         = Calloc (BUFFER_SIZE, sizeof (byte_t));
     bitfile->ptr            = bitfile->buffer;
@@ -187,7 +187,7 @@ get_bit (bitfile_t *bitfile)
  */
 {
     assert (bitfile);
-   
+
     if (!bitfile->bitpos--)      /* use next byte ? */
     {
         bitfile->ptr++;
@@ -226,7 +226,7 @@ get_bits (bitfile_t *bitfile, unsigned bits)
  */
 {
     unsigned value = 0;          /* input value */
-   
+
     while (bits--)
         value = (unsigned) (value << 1) | get_bit (bitfile);
 
@@ -235,7 +235,7 @@ get_bits (bitfile_t *bitfile, unsigned bits)
 
 void
 put_bit (bitfile_t *bitfile, unsigned value)
-/*     
+/*
  *  Put the bit 'value' to the bitfile buffer.
  *  The buffer is written to the file 'bitfile->file' if the number of
  *  buffer bytes exceeds 'BUFFER_SIZE'.
@@ -247,7 +247,7 @@ put_bit (bitfile_t *bitfile, unsigned value)
  */
 {
     assert (bitfile);
-   
+
     if (!bitfile->bitpos--)      /* use next byte ? */
     {
         bitfile->ptr++;
@@ -265,7 +265,7 @@ put_bit (bitfile_t *bitfile, unsigned value)
         }
         bitfile->bitpos = 7;
     }
-   
+
     if (value)
         *bitfile->ptr |= mask [bitfile->bitpos];
 
@@ -274,7 +274,7 @@ put_bit (bitfile_t *bitfile, unsigned value)
 
 void
 put_bits (bitfile_t *bitfile, unsigned value, unsigned bits)
-/*     
+/*
  *  Put #'bits' bits of integer 'value' to the bitfile buffer 'bitfile'.
  *
  *  No return value.
@@ -292,7 +292,7 @@ close_bitfile (bitfile_t *bitfile)
 /*
  *  Bitfile destructor:
  *  Close 'bitfile', if 'bitfile->mode' == WRITE_ACCESS write bit buffer
- *  to disk. 
+ *  to disk.
  *
  *  No return value.
  *
@@ -301,7 +301,7 @@ close_bitfile (bitfile_t *bitfile)
  */
 {
     assert (bitfile);
-   
+
     if (bitfile->mode == WRITE_ACCESS)
     {
         unsigned bytes = fwrite (bitfile->buffer, sizeof (byte_t),
diff --git a/converter/other/fiasco/lib/image.c b/converter/other/fiasco/lib/image.c
index a700fe88..705a56aa 100644
--- a/converter/other/fiasco/lib/image.c
+++ b/converter/other/fiasco/lib/image.c
@@ -2,7 +2,7 @@
  *  image.c:        Input and output of PNM images.
  *
  *  Written by:     Ullrich Hafner
- *      
+ *
  *  This file is part of FIASCO (Fractal Image And Sequence COdec)
  *  Copyright (C) 1994-2000 Ullrich Hafner
  */
@@ -31,7 +31,7 @@
 /*****************************************************************************
 
                 prototypes
-  
+
 *****************************************************************************/
 
 static void
@@ -40,7 +40,7 @@ init_chroma_tables (void);
 /*****************************************************************************
 
                 local variables
-  
+
 *****************************************************************************/
 static int *Cr_r_tab = NULL;
 static int *Cr_g_tab = NULL;
@@ -50,7 +50,7 @@ static int *Cb_b_tab = NULL;
 /*****************************************************************************
 
                 public code
-  
+
 *****************************************************************************/
 
 static fiasco_image_t *
@@ -197,7 +197,7 @@ cast_image (fiasco_image_t *image)
    image_t *this = (image_t *) image->private;
    if (this)
    {
-      if (!streq (this->id, "IFIASCO"))
+      if (!STRSEQ(this->id, "IFIASCO"))
       {
      set_error (_("Parameter `image' doesn't match required type."));
      return NULL;
@@ -240,7 +240,7 @@ alloc_image (unsigned width, unsigned height, bool_t color, format_e format)
    image->color       = color;
    image->format      = format;
    image->reference_count = 1;
-   
+
    STRSCPY(image->id, "IFIASCO");
 
    for (band = first_band (color); band <= last_band (color); band++)
@@ -249,7 +249,7 @@ alloc_image (unsigned width, unsigned height, bool_t color, format_e format)
                     sizeof (word_t));
       else
      image->pixels [band] = Calloc (width * height, sizeof (word_t));
-   
+
    return image;
 }
 
@@ -266,7 +266,7 @@ clone_image (image_t *image)
    image_t *new = alloc_image (image->width, image->height, image->color,
                    image->format);
    color_e band;
-   
+
    for (band = first_band (new->color); band <= last_band (new->color); band++)
       if (new->format == FORMAT_4_2_0 && band != Y)
       {
@@ -314,7 +314,7 @@ free_image (image_t *image)
 }
 
 
-static void 
+static void
 read_image_data(image_t * const image, FILE *input, const bool_t color,
                 const int width, const int height, const xelval maxval,
                 const int format) {
@@ -336,27 +336,27 @@ read_image_data(image_t * const image, FILE *input, const bool_t color,
 
    xelrow = pnm_allocrow(width);
 
-   i = 0; 
+   i = 0;
    for (row = 0; row < height; row++) {
        int col;
        pnm_readpnmrow(input, xelrow, width, maxval, format);
        for (col = 0; col < width; col++) {
            if (color) {
-               image->pixels[Y][i] = 
-                   coeff_lu_r * PPM_GETR(xelrow[col]) 
+               image->pixels[Y][i] =
+                   coeff_lu_r * PPM_GETR(xelrow[col])
                    + coeff_lu_g * PPM_GETG(xelrow[col])
                    + coeff_lu_b * PPM_GETB(xelrow[col]) - 2048;
-               image->pixels[Cb][i] = 
-                   coeff_cb_r * PPM_GETR(xelrow[col]) 
+               image->pixels[Cb][i] =
+                   coeff_cb_r * PPM_GETR(xelrow[col])
                    + coeff_cb_g * PPM_GETG(xelrow[col])
                    + coeff_cb_b * PPM_GETB(xelrow[col]);
-               image->pixels[Cr][i] = 
-                   coeff_cr_r * PPM_GETR(xelrow[col]) 
+               image->pixels[Cr][i] =
+                   coeff_cr_r * PPM_GETR(xelrow[col])
                    + coeff_cr_g * PPM_GETG(xelrow[col])
                    + coeff_cr_b * PPM_GETB(xelrow[col]);
 
                i++;
-           } else 
+           } else
                image->pixels[GRAY][i++] =
                    PNM_GET1(xelrow[col]) * 4095 / maxval - 2048;
        }
@@ -434,7 +434,7 @@ void
 write_image (const char *image_name, const image_t *image)
 /*
  *  Write given 'image' data to the file 'image_name'.
- *  
+ *
  *  No return value.
  */
 {
@@ -446,13 +446,13 @@ write_image (const char *image_name, const image_t *image)
    unsigned *gray_clip;         /* clipping table */
 
    assert (image && image_name);
-   
+
    if (image->format == FORMAT_4_2_0)
    {
       warning ("We cannot write images in 4:2:0 format.");
       return;
    }
-   
+
    if (image_name == NULL)
        output = stdout;
    else if (streq(image_name, "-"))
@@ -466,7 +466,7 @@ write_image (const char *image_name, const image_t *image)
    init_chroma_tables ();
 
    format = image->color ? PPM_TYPE : PGM_TYPE;
-   
+
    pnm_writepnminit(output, image->width, image->height, 255, format, 0);
 
    xelrow = pnm_allocrow(image->width);
@@ -481,18 +481,18 @@ write_image (const char *image_name, const image_t *image)
                cbval = image->pixels[Cb][i] / 16;
                crval = image->pixels[Cr][i] / 16;
 
-               PPM_ASSIGN(xelrow[col], 
+               PPM_ASSIGN(xelrow[col],
                           gray_clip[yval + Cr_r_tab[crval]],
                           gray_clip[yval + Cr_g_tab[crval] + Cb_g_tab [cbval]],
                           gray_clip[yval + Cb_b_tab[cbval]]);
 
            } else
                /* The 16 below should be 4095/255 = 16.0588 */
-               PNM_ASSIGN1(xelrow[col], 
+               PNM_ASSIGN1(xelrow[col],
                            gray_clip[image->pixels[GRAY][i]/16+128]);
            i++;
        }
-       pnm_writepnmrow(output, xelrow, 
+       pnm_writepnmrow(output, xelrow,
                        image->width, 255, format, 0);
    }
    pnm_freerow(xelrow);
@@ -511,7 +511,7 @@ same_image_type (const image_t *img1, const image_t *img2)
  */
 {
    assert (img1 && img2);
-   
+
    return ((img1->width == img2->width)
        && (img1->height == img2->height)
        && (img1->color == img2->color)
@@ -521,7 +521,7 @@ same_image_type (const image_t *img1, const image_t *img2)
 /*****************************************************************************
 
                 private code
-  
+
 *****************************************************************************/
 
 static void
@@ -547,21 +547,21 @@ init_chroma_tables (void)
 
       Cr_r_tab[i] =  1.4022 * crval + 0.5;
       Cr_g_tab[i] = -0.7145 * crval + 0.5;
-      Cb_g_tab[i] = -0.3456 * cbval + 0.5; 
+      Cb_g_tab[i] = -0.3456 * cbval + 0.5;
       Cb_b_tab[i] =  1.7710 * cbval + 0.5;
    }
    for (i = 0; i < 256; i++)
    {
       Cr_r_tab[i] = Cr_r_tab[256];
       Cr_g_tab[i] = Cr_g_tab[256];
-      Cb_g_tab[i] = Cb_g_tab[256]; 
+      Cb_g_tab[i] = Cb_g_tab[256];
       Cb_b_tab[i] = Cb_b_tab[256];
    }
    for (i = 512; i < 768; i++)
    {
       Cr_r_tab[i] = Cr_r_tab[511];
       Cr_g_tab[i] = Cr_g_tab[511];
-      Cb_g_tab[i] = Cb_g_tab[511]; 
+      Cb_g_tab[i] = Cb_g_tab[511];
       Cb_b_tab[i] = Cb_b_tab[511];
    }
 
diff --git a/converter/other/fiasco/lib/image.h b/converter/other/fiasco/lib/image.h
index a87a3c05..c3c5f0df 100644
--- a/converter/other/fiasco/lib/image.h
+++ b/converter/other/fiasco/lib/image.h
@@ -29,7 +29,7 @@ typedef struct image
  *  Image data
  */
 {
-   char      id [7];
+   char      id [8];         /* NUL-terminated "IFIASCO" */
    unsigned  reference_count;
    unsigned  width;			/* Width of the image */
    unsigned  height;			/* Height of the image */
diff --git a/converter/other/fiasco/lib/macros.h b/converter/other/fiasco/lib/macros.h
index 0bc80e7c..2f404a74 100644
--- a/converter/other/fiasco/lib/macros.h
+++ b/converter/other/fiasco/lib/macros.h
@@ -34,8 +34,6 @@
   
 *****************************************************************************/
 
-#define streq(str1, str2)	(strcmp ((str1), (str2)) == 0)
-#define strneq(str1, str2)	(strcmp ((str1), (str2)) != 0)
 #define square(x)		((x) * (x))
 #define first_band(color)	((unsigned) ((color) ? Y  : GRAY))
 #define last_band(color)        ((unsigned) ((color) ? Cr : GRAY))