about summary refs log tree commit diff
path: root/converter/ppm/ppmtompeg
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-06-28 23:07:55 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-06-28 23:07:55 +0000
commit11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32 (patch)
tree7c40f096dd973943ef563ec87b2a68d8205db4fb /converter/ppm/ppmtompeg
parent89c6ec14eb7514630aea5abc4b90b51d1473d33a (diff)
downloadnetpbm-mirror-11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32.tar.gz
netpbm-mirror-11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32.tar.xz
netpbm-mirror-11fd0bc3fdbe7b5eb9266a728a81d0bcac91fe32.zip
Promote Stable to Super_stable
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@3640 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/ppm/ppmtompeg')
-rw-r--r--converter/ppm/ppmtompeg/BUGS2
-rw-r--r--converter/ppm/ppmtompeg/CHANGES2
-rw-r--r--converter/ppm/ppmtompeg/Makefile69
-rw-r--r--converter/ppm/ppmtompeg/bframe.c2
-rw-r--r--converter/ppm/ppmtompeg/bitio.c4
-rw-r--r--converter/ppm/ppmtompeg/bsearch.c3
-rw-r--r--converter/ppm/ppmtompeg/combine.c10
-rw-r--r--converter/ppm/ppmtompeg/docs/template.param2
-rw-r--r--converter/ppm/ppmtompeg/examples/template.param2
-rw-r--r--converter/ppm/ppmtompeg/frame.c2
-rw-r--r--converter/ppm/ppmtompeg/gethostname.c1
-rw-r--r--converter/ppm/ppmtompeg/gethostname_win32.c2
-rw-r--r--converter/ppm/ppmtompeg/headers/all.h3
-rw-r--r--converter/ppm/ppmtompeg/headers/ansi.h76
-rw-r--r--converter/ppm/ppmtompeg/headers/bitio.h1
-rw-r--r--converter/ppm/ppmtompeg/headers/dct.h8
-rw-r--r--converter/ppm/ppmtompeg/headers/frame.h21
-rw-r--r--converter/ppm/ppmtompeg/headers/frames.h2
-rw-r--r--converter/ppm/ppmtompeg/headers/frametype.h2
-rw-r--r--converter/ppm/ppmtompeg/headers/general.h10
-rw-r--r--converter/ppm/ppmtompeg/headers/huff.h5
-rw-r--r--converter/ppm/ppmtompeg/headers/jpeg.h4
-rw-r--r--converter/ppm/ppmtompeg/headers/mheaders.h23
-rw-r--r--converter/ppm/ppmtompeg/headers/motion_search.h3
-rw-r--r--converter/ppm/ppmtompeg/headers/mpeg.h5
-rw-r--r--converter/ppm/ppmtompeg/headers/mproto.h47
-rw-r--r--converter/ppm/ppmtompeg/headers/mtypes.h15
-rw-r--r--converter/ppm/ppmtompeg/headers/opts.h15
-rw-r--r--converter/ppm/ppmtompeg/headers/parallel.h1
-rw-r--r--converter/ppm/ppmtompeg/headers/param.h18
-rw-r--r--converter/ppm/ppmtompeg/headers/prototypes.h35
-rw-r--r--converter/ppm/ppmtompeg/headers/rate.h20
-rw-r--r--converter/ppm/ppmtompeg/headers/specifics.h9
-rw-r--r--converter/ppm/ppmtompeg/huff.c3
-rw-r--r--converter/ppm/ppmtompeg/input.c14
-rw-r--r--converter/ppm/ppmtompeg/jpeg.c24
-rw-r--r--converter/ppm/ppmtompeg/jrevdct.c9
-rw-r--r--converter/ppm/ppmtompeg/mfwddct.c180
-rw-r--r--converter/ppm/ppmtompeg/mpeg.c25
-rw-r--r--converter/ppm/ppmtompeg/opts.c6
-rw-r--r--converter/ppm/ppmtompeg/parallel.c86
-rw-r--r--converter/ppm/ppmtompeg/param.c67
-rw-r--r--converter/ppm/ppmtompeg/ppmtompeg.c28
-rw-r--r--converter/ppm/ppmtompeg/psearch.c2
-rw-r--r--converter/ppm/ppmtompeg/psocket.c44
-rw-r--r--converter/ppm/ppmtompeg/rate.c20
-rw-r--r--converter/ppm/ppmtompeg/readframe.c83
-rw-r--r--converter/ppm/ppmtompeg/rgbtoycc.c6
-rw-r--r--converter/ppm/ppmtompeg/specifics.c24
49 files changed, 488 insertions, 557 deletions
diff --git a/converter/ppm/ppmtompeg/BUGS b/converter/ppm/ppmtompeg/BUGS
index 64269dfb..9724014e 100644
--- a/converter/ppm/ppmtompeg/BUGS
+++ b/converter/ppm/ppmtompeg/BUGS
@@ -14,7 +14,7 @@ Known BUGS:
      REFERENCE_FRAME	DECODED
    does not work
 
-5. Cannot use both STDIN and CDL_FILEs (ok, since it doesnt make sense...)
+5. Cannot use both STDIN and CDL_FILEs (ok, since it doesn't make sense...)
 
 6. <fixed>
 
diff --git a/converter/ppm/ppmtompeg/CHANGES b/converter/ppm/ppmtompeg/CHANGES
index fffa7a65..efb8fdcf 100644
--- a/converter/ppm/ppmtompeg/CHANGES
+++ b/converter/ppm/ppmtompeg/CHANGES
@@ -28,7 +28,7 @@ Changes chronology
 	- non-integer frame rates now work for all machines
 	- fixed parsing of -mv_histogram
 	- fixed numPadding bug (file name problem)
-	- fixed full pixel assertation bug
+	- fixed full pixel assertion bug
         - corrected ASPECT_RATIO bug (was forced to 1)
 	- buffer size is now set correctly
         - complains when file is too small
diff --git a/converter/ppm/ppmtompeg/Makefile b/converter/ppm/ppmtompeg/Makefile
index a1004fdd..eeab9727 100644
--- a/converter/ppm/ppmtompeg/Makefile
+++ b/converter/ppm/ppmtompeg/Makefile
@@ -31,14 +31,17 @@ endif
 #	1) long's are 32 bits and
 #	2) int's are not
 #
-# if you are using a non-ANSI compiler, then use:
-#	-DNON_ANSI_COMPILER
-#
 # one other option:
 #	-DHEINOUS_DEBUG_MODE
 #
 
-MP_BASE_OBJS = mfwddct.o postdct.o huff.o bitio.o mheaders.o
+MP_BASE_OBJS = \
+  mfwddct.o \
+  postdct.o \
+  huff.o \
+  bitio.o \
+  mheaders.o \
+
 MP_ENCODE_OBJS = \
   frames.o \
   iframe.o \
@@ -46,12 +49,25 @@ MP_ENCODE_OBJS = \
   bframe.o \
   psearch.o \
   bsearch.o \
-  block.o 
-
-MP_OTHER_OBJS = mpeg.o subsample.o param.o rgbtoycc.o \
-	readframe.o combine.o jrevdct.o frame.o fsize.o frametype.o \
-	specifics.o rate.o opts.o input.o
-ifeq ($(OMIT_NETWORK),y)
+  block.o \
+
+MP_OTHER_OBJS = \
+  mpeg.o \
+  subsample.o \
+  param.o \
+  rgbtoycc.o \
+  readframe.o \
+  combine.o \
+  jrevdct.o \
+  frame.o \
+  fsize.o \
+  frametype.o \
+  specifics.o \
+  rate.o \
+  opts.o \
+  input.o \
+
+ifeq ($(OMIT_NETWORK),Y)
   MP_OTHER_OBJS += noparallel.o
 else
   MP_OTHER_OBJS += parallel.o psocket.o
@@ -62,14 +78,19 @@ else
   MP_OTHER_OBJS += gethostname.o
 endif
 
-NONMAIN_OBJS = $(MP_BASE_OBJS) $(MP_OTHER_OBJS) $(MP_ENCODE_OBJS) \
-	      	$(JPEG_MODULE).o
-OBJECTS = ppmtompeg.o $(NONMAIN_OBJS)
-MERGE_OBJECTS = ppmtompeg.o2 $(NONMAIN_OBJS)
+ADDL_OBJECTS = \
+  $(MP_BASE_OBJS) \
+  $(MP_OTHER_OBJS) \
+  $(MP_ENCODE_OBJS) \
+  $(JPEG_MODULE).o \
+
+OBJECTS = ppmtompeg.o $(ADDL_OBJECTS)
+MERGE_OBJECTS = ppmtompeg.o2 $(ADDL_OBJECTS)
 MP_INCLUDE = mproto.h mtypes.h huff.h bitio.h
 MP_MISC = Makefile huff.table parse_huff.pl
 
-BINARIES = ppmtompeg
+PORTBINARIES = ppmtompeg
+BINARIES = $(PORTBINARIES)
 MERGEBINARIES = $(BINARIES)
 SCRIPTS = 
 
@@ -84,18 +105,14 @@ else
   LIBOPTR =
 endif
 
-ppmtompeg: $(OBJECTS) $(NETPBMLIB) $(LIBOPT)
-	$(LD) -o $@ \
-          $(OBJECTS) $(shell $(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(JPEGLIBX)) \
-	  $(NETWORKLD) $(MATHLIB) $(LDFLAGS) $(LDLIBS) \
-	  $(RPATH) $(LADD)
-
-profile: $(OBJECTS) $(NETPBMLIB) $(LIBOPT)
-	$(LD) -o $@ -Bstatic -pg \
-          $(OBJECTS) $(shell $(LIBOPT) $(NETPBMLIB) $(LIBOPTR) $(JPEGLIBX)) \
-	  $(NETWORKLD) $(MATHLIB) $(LDFLAGS) $(LDLIBS) \
-	  $(RPATH) $(LADD)
+ppmtompeg: $(ADDL_OBJECTS) $(LIBOPT)
+ppmtompeg: LDFLAGS_TARGET = \
+  $(shell $(LIBOPT) $(LIBOPTR) $(JPEGLIBX)) $(NETWORKLD)
 
+profile: $(ADDL_OBJECTS) $(LIBOPT)
+profile: LDFLAGS_TARGET = \
+  -Bstatic -pg \
+  $(shell $(LIBOPT) $(LIBOPTR) $(JPEGLIBX)) $(NETWORKLD)
 
 #########
 # OTHER #
diff --git a/converter/ppm/ppmtompeg/bframe.c b/converter/ppm/ppmtompeg/bframe.c
index 1dbc1846..f5009d6c 100644
--- a/converter/ppm/ppmtompeg/bframe.c
+++ b/converter/ppm/ppmtompeg/bframe.c
@@ -523,7 +523,7 @@ makeNonSkipBlock(int              const y,
                  MpegFrame *      const curr, 
                  MpegFrame *      const prev, 
                  MpegFrame *      const next,
-                 boolean          const specificsOn,
+                 bool             const specificsOn,
                  int              const mbAddress,
                  int              const QScale,
                  const LumBlock * const currentBlockP,
diff --git a/converter/ppm/ppmtompeg/bitio.c b/converter/ppm/ppmtompeg/bitio.c
index e0dc4d4e..3812bc39 100644
--- a/converter/ppm/ppmtompeg/bitio.c
+++ b/converter/ppm/ppmtompeg/bitio.c
@@ -244,8 +244,8 @@ Bitio_Write(BitBucket * const bbPtr,
     assert(nbits <= 32 && nbits >= 0);
 
     /*
-     * Clear top bits if not part of data, necessary due to down and
-     * dirty calls of Bitio_Write with unecessary top bits set.
+     * Clear top bits if not part of data, necessary because of down and
+     * dirty calls of Bitio_Write with unnecessary top bits set.
      */
 
     bits &= lower_mask[nbits];
diff --git a/converter/ppm/ppmtompeg/bsearch.c b/converter/ppm/ppmtompeg/bsearch.c
index 70edfef6..c618bbd4 100644
--- a/converter/ppm/ppmtompeg/bsearch.c
+++ b/converter/ppm/ppmtompeg/bsearch.c
@@ -43,7 +43,7 @@
  * Changed copyrights
  *
  * Revision 1.6  1994/12/07  00:40:36  smoot
- * Added seperate P and B search ranges
+ * Added separate P and B search ranges
  *
  * Revision 1.5  1994/03/15  00:27:11  keving
  * nothing
@@ -834,7 +834,6 @@ BMotionSearchCross2(const LumBlock * const currentBlockP,
     interpErrF = FindBestMatch(&forwardBlock, currentBlockP,
                                next, by, bx, &newMotion.bwd,
                                bestErr, searchRangeB);
-    bestErr = min(bestErr, interpErr);
     interpErrB = FindBestMatch(&backBlock, currentBlockP,
                                prev, by, bx, &newMotion.fwd,
                                bestErr, searchRangeB);
diff --git a/converter/ppm/ppmtompeg/combine.c b/converter/ppm/ppmtompeg/combine.c
index 8e0d3281..c00f9c71 100644
--- a/converter/ppm/ppmtompeg/combine.c
+++ b/converter/ppm/ppmtompeg/combine.c
@@ -104,7 +104,7 @@ appendSpecifiedGopFiles(struct inputSource * const inputSourceP,
         FILE * ifP;
 
         GetNthInputFileName(inputSourceP, fileSeq, &inputFileName);
-        asprintfN(&fileName, "%s/%s", currentGOPPath, inputFileName);
+        pm_asprintf(&fileName, "%s/%s", currentGOPPath, inputFileName);
 
         for (nAttempts = 0, ifP = NULL;
              nAttempts < READ_ATTEMPTS && !ifP;
@@ -122,8 +122,8 @@ appendSpecifiedGopFiles(struct inputSource * const inputSourceP,
         } else
             pm_error("Unable to read file '%s' after %u attempts.",
                      fileName, READ_ATTEMPTS);
-        strfree(fileName);
-        strfree(inputFileName);
+        pm_strfree(fileName);
+        pm_strfree(inputFileName);
     }
 } 
 
@@ -140,7 +140,7 @@ appendDefaultGopFiles(const char * const outputFileName,
         const char * fileName;
         FILE * ifP;
 
-        asprintfN(&fileName, "%s.gop.%u", outputFileName, fileSeq);
+        pm_asprintf(&fileName, "%s.gop.%u", outputFileName, fileSeq);
         
         ifP = fopen(fileName, "rb");
         if (ifP == NULL)
@@ -151,7 +151,7 @@ appendDefaultGopFiles(const char * const outputFileName,
             
             AppendFile(ofP, ifP);
         }
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
diff --git a/converter/ppm/ppmtompeg/docs/template.param b/converter/ppm/ppmtompeg/docs/template.param
index 66b6dd98..78ad5300 100644
--- a/converter/ppm/ppmtompeg/docs/template.param
+++ b/converter/ppm/ppmtompeg/docs/template.param
@@ -18,7 +18,7 @@
 # files in the order in which they must appear, followed by 'END_INPUT'
 #
 # Also, if you use the `command` method of generating input file names,
-# the command will only be executed in the INPUT_DIR if INPUT_DIR preceeds
+# the command will only be executed in the INPUT_DIR if INPUT_DIR precedes
 # the INPUT parameter.
 #
 # <option> MUST be in UPPER CASE
diff --git a/converter/ppm/ppmtompeg/examples/template.param b/converter/ppm/ppmtompeg/examples/template.param
index 66b6dd98..78ad5300 100644
--- a/converter/ppm/ppmtompeg/examples/template.param
+++ b/converter/ppm/ppmtompeg/examples/template.param
@@ -18,7 +18,7 @@
 # files in the order in which they must appear, followed by 'END_INPUT'
 #
 # Also, if you use the `command` method of generating input file names,
-# the command will only be executed in the INPUT_DIR if INPUT_DIR preceeds
+# the command will only be executed in the INPUT_DIR if INPUT_DIR precedes
 # the INPUT parameter.
 #
 # <option> MUST be in UPPER CASE
diff --git a/converter/ppm/ppmtompeg/frame.c b/converter/ppm/ppmtompeg/frame.c
index 09f46f66..75b209f8 100644
--- a/converter/ppm/ppmtompeg/frame.c
+++ b/converter/ppm/ppmtompeg/frame.c
@@ -753,7 +753,7 @@ Frame_AllocHalf(MpegFrame * const frameP) {
  *===========================================================================*/
 void
 Frame_AllocDecoded(MpegFrame * const frameP,
-                   boolean     const makeReference) {
+                   bool        const makeReference) {
 
     if (frameP->decoded_y != NULL) {
         /* already allocated */
diff --git a/converter/ppm/ppmtompeg/gethostname.c b/converter/ppm/ppmtompeg/gethostname.c
index 014b42e8..d20af17c 100644
--- a/converter/ppm/ppmtompeg/gethostname.c
+++ b/converter/ppm/ppmtompeg/gethostname.c
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 #define _BSD_SOURCE   /* Make sure strdup() is in string.h */
 
 #include <string.h>
diff --git a/converter/ppm/ppmtompeg/gethostname_win32.c b/converter/ppm/ppmtompeg/gethostname_win32.c
index 383f4e55..e37fbb37 100644
--- a/converter/ppm/ppmtompeg/gethostname_win32.c
+++ b/converter/ppm/ppmtompeg/gethostname_win32.c
@@ -94,7 +94,7 @@ get_string_version(push_string_t *str)
             return FALSE;
     }
 
-    /* Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. */
+    /* Call GetNativeSystemInfo if available; GetSystemInfo otherwise. */
     pGNSI = (PGNSI)
             GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), 
             "GetNativeSystemInfo");
diff --git a/converter/ppm/ppmtompeg/headers/all.h b/converter/ppm/ppmtompeg/headers/all.h
index e350aab8..8f095d8e 100644
--- a/converter/ppm/ppmtompeg/headers/all.h
+++ b/converter/ppm/ppmtompeg/headers/all.h
@@ -33,7 +33,7 @@
  * added little_endian force for irizx
  *
  * Revision 1.8  1995/02/02  22:02:18  smoot
- * added ifdefs for compatability on stranger and stranger architectures...
+ * added ifdefs for compatibility on stranger and stranger architectures...
  *
  * Revision 1.7  1995/02/02  07:26:45  eyhung
  * added parens to all.h to remove compiler warning
@@ -80,7 +80,6 @@
 #include <time.h>
 #endif
 
-#include "ansi.h"
 #include "general.h"
 
 /* some machines have #define index strchr; get rid of this nonsense */
diff --git a/converter/ppm/ppmtompeg/headers/ansi.h b/converter/ppm/ppmtompeg/headers/ansi.h
deleted file mode 100644
index b3c3ab17..00000000
--- a/converter/ppm/ppmtompeg/headers/ansi.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*===========================================================================*
- * ansi.h								     *
- *									     *
- *	macro for non-ansi compilers					     *
- *									     *
- *===========================================================================*/
-
-/*
- * Copyright (c) 1995 The Regents of the University of California.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose, without fee, and without written agreement is
- * hereby granted, provided that the above copyright notice and the following
- * two paragraphs appear in all copies of this software.
- *
- * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
- * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-/*  
- *  $Header: /n/picasso/project/mpeg/mpeg_dist/mpeg_encode/headers/RCS/ansi.h,v 1.6 1995/08/15 23:43:13 smoot Exp $
- *  $Log: ansi.h,v $
- *  Revision 1.6  1995/08/15 23:43:13  smoot
- *  *** empty log message ***
- *
- *  Revision 1.5  1995/01/19 23:54:35  eyhung
- *  Changed copyrights
- *
- * Revision 1.4  1994/11/12  02:12:13  keving
- * nothing
- *
- * Revision 1.3  1993/07/22  22:24:23  keving
- * nothing
- *
- * Revision 1.2  1993/07/09  00:17:23  keving
- * nothing
- *
- * Revision 1.1  1993/06/14  22:50:22  keving
- * nothing
- *
- */
-
-
-#ifndef ANSI_INCLUDED
-#define ANSI_INCLUDED
-
-
-/*  
- *  _ANSI_ARGS_ macro stolen from Tcl6.5 by John Ousterhout
- */
-#undef _ANSI_ARGS_
-#undef const
-#ifdef NON_ANSI_COMPILER
-#define _ANSI_ARGS_(x)       ()
-#define CONST
-#else
-#define _ANSI_ARGS_(x)   x
-#define CONST const
-#ifdef __cplusplus
-#define VARARGS (...)
-#else
-#define VARARGS ()
-#endif
-#endif
-
-
-#endif /* ANSI_INCLUDED */
diff --git a/converter/ppm/ppmtompeg/headers/bitio.h b/converter/ppm/ppmtompeg/headers/bitio.h
index a24c21cd..931bcdd9 100644
--- a/converter/ppm/ppmtompeg/headers/bitio.h
+++ b/converter/ppm/ppmtompeg/headers/bitio.h
@@ -63,7 +63,6 @@
 #include <stdio.h>
 
 #include "general.h"
-#include "ansi.h"
 
 
 /*===========*
diff --git a/converter/ppm/ppmtompeg/headers/dct.h b/converter/ppm/ppmtompeg/headers/dct.h
index e024b6c1..3b824cf0 100644
--- a/converter/ppm/ppmtompeg/headers/dct.h
+++ b/converter/ppm/ppmtompeg/headers/dct.h
@@ -31,7 +31,6 @@
 #define DCT_INCLUDED
 
 
-#include "ansi.h"
 
 
 
@@ -47,11 +46,12 @@ typedef DCTELEM DCTBLOCK_2D[DCTSIZE][DCTSIZE];
 /*  
  *  from mfwddct.c:
  */
-extern void mp_fwd_dct_block2 _ANSI_ARGS_((DCTBLOCK_2D src, DCTBLOCK_2D dest));
+void init_fdct (void);
+extern void mp_fwd_dct_block2 (DCTBLOCK_2D src, DCTBLOCK_2D dest);
 
 /* jrevdct.c */
-extern void init_pre_idct _ANSI_ARGS_((void ));
-extern void mpeg_jrevdct _ANSI_ARGS_((DCTBLOCK data ));
+extern void init_pre_idct (void );
+extern void mpeg_jrevdct (DCTBLOCK data );
 
 
 /* We assume that right shift corresponds to signed division by 2 with
diff --git a/converter/ppm/ppmtompeg/headers/frame.h b/converter/ppm/ppmtompeg/headers/frame.h
index acd74419..e1f587a2 100644
--- a/converter/ppm/ppmtompeg/headers/frame.h
+++ b/converter/ppm/ppmtompeg/headers/frame.h
@@ -34,8 +34,7 @@
  * HEADER FILES *
  *==============*/
 
-#include "general.h"
-#include "ansi.h"
+#include "netpbm/pm_c_util.h"
 #include "mtypes.h"
 
 /*===========*
@@ -54,8 +53,10 @@ typedef struct mpegFrame {
     int type;
     char    inputFileName[256];
     int id;           /* the frame number -- starts at 0 */
-    boolean inUse;	/* TRUE iff this frame is currently being used */
-			/* FALSE means any data here can be thrashed */
+    bool inUse;
+	   /* this frame is currently being used (if not, any data here can be
+          thrashed)
+       */
 
     /*  
      *  now, the YCrCb data.  All pixel information is stored in unsigned
@@ -64,17 +65,17 @@ typedef struct mpegFrame {
      *
      *  if orig_y is NULL, then orig_cr, orig_cb are undefined
      */
-    uint8 **orig_y, **orig_cr, **orig_cb;
+    uint8_t **orig_y, **orig_cr, **orig_cb;
 
     /* now, the decoded data -- relevant only if
      *	    referenceFrame == DECODED_FRAME
      *
      * if decoded_y is NULL, then decoded_cr, decoded_cb are undefined 
      */
-    uint8 **decoded_y, **decoded_cr, **decoded_cb;
+    uint8_t **decoded_y, **decoded_cr, **decoded_cb;
 
     /* reference data */
-    uint8 **ref_y, **ref_cr, **ref_cb;
+    uint8_t **ref_y, **ref_cr, **ref_cb;
 
     /*  
      *  these are the Blocks which will ultimately compose MacroBlocks.
@@ -86,9 +87,9 @@ typedef struct mpegFrame {
     /*
      *  this is the half-pixel luminance data (for reference frames)
      */
-    uint8 **halfX, **halfY, **halfBoth;
+    uint8_t **halfX, **halfY, **halfBoth;
 
-    boolean   halfComputed;        /* TRUE iff half-pixels already computed */
+    bool   halfComputed;        /* TRUE iff half-pixels already computed */
 
     struct mpegFrame *next;  /* points to the next B-frame to be encoded, if
 		       * stdin is used as the input. 
@@ -120,7 +121,7 @@ Frame_AllocHalf(MpegFrame * const frameP);
 
 void
 Frame_AllocDecoded(MpegFrame * const frameP,
-                   boolean     const makeReference);
+                   bool        const makeReference);
 
 void
 Frame_Resize(MpegFrame * const omf,
diff --git a/converter/ppm/ppmtompeg/headers/frames.h b/converter/ppm/ppmtompeg/headers/frames.h
index f2bcf6ae..2ec11d69 100644
--- a/converter/ppm/ppmtompeg/headers/frames.h
+++ b/converter/ppm/ppmtompeg/headers/frames.h
@@ -13,7 +13,6 @@
  *==============*/
 
 #include "pm_config.h"  /* For __inline__ */
-#include "ansi.h"
 #include "mtypes.h"
 #include "mheaders.h"
 #include "iframe.h"
@@ -255,7 +254,6 @@ extern int gopSize;
 extern int slicesPerFrame;
 extern int blocksPerSlice;
 extern int referenceFrame;
-extern boolean specificsOn;
 extern int quietTime;       /* shut up for at least quietTime seconds;
                  * negative means shut up forever
                  */
diff --git a/converter/ppm/ppmtompeg/headers/frametype.h b/converter/ppm/ppmtompeg/headers/frametype.h
index 63bee964..33b604e6 100644
--- a/converter/ppm/ppmtompeg/headers/frametype.h
+++ b/converter/ppm/ppmtompeg/headers/frametype.h
@@ -7,7 +7,7 @@ FType_Type(unsigned int const frameNum);
 unsigned int
 FType_FutureRef(unsigned int const currFrameNum);
 
-int	FType_PastRef _ANSI_ARGS_((int currFrameNum));
+int	FType_PastRef (int currFrameNum);
 
 void SetFramePattern(const char * const pattern);
 
diff --git a/converter/ppm/ppmtompeg/headers/general.h b/converter/ppm/ppmtompeg/headers/general.h
index f29c9445..59c33c73 100644
--- a/converter/ppm/ppmtompeg/headers/general.h
+++ b/converter/ppm/ppmtompeg/headers/general.h
@@ -111,15 +111,7 @@ int pclose();
 #define NEWLINE '\n'
 
 
-/*==================*
- * TYPE DEFINITIONS *
- *==================*/
-
-#ifndef HAVE_BOOLEAN
 typedef int boolean;
-#define HAVE_BOOLEAN
-/* JPEG library also defines boolean */
-#endif
 
 /* In the following, we need the "signed" in order to make these typedefs
    match those in AIX system header files.  Otherwise, compile fails on 
@@ -167,8 +159,6 @@ typedef signed int int32;
 #define max(a,b) ((a) > (b) ? (a) : (b))
 #undef min
 #define min(a,b) ((a) < (b) ? (a) : (b))
-#undef abs
-#define abs(a) ((a) >= 0 ? (a) : -(a))
 
 
 #endif
diff --git a/converter/ppm/ppmtompeg/headers/huff.h b/converter/ppm/ppmtompeg/headers/huff.h
index 47ffb843..a6379248 100644
--- a/converter/ppm/ppmtompeg/headers/huff.h
+++ b/converter/ppm/ppmtompeg/headers/huff.h
@@ -24,8 +24,11 @@
  */
 
 /*  
- *  THIS FILE IS MACHINE GENERATED!  DO NOT EDIT!
+ *  THIS FILE WAS ORIGINALLY MACHINE GENERATED
  */
+
+#include "general.h"
+
 #define HUFF_MAXRUN	32
 #define HUFF_MAXLEVEL	41
 
diff --git a/converter/ppm/ppmtompeg/headers/jpeg.h b/converter/ppm/ppmtompeg/headers/jpeg.h
index 62c6f930..76d73d9e 100644
--- a/converter/ppm/ppmtompeg/headers/jpeg.h
+++ b/converter/ppm/ppmtompeg/headers/jpeg.h
@@ -1,5 +1,5 @@
-#include "ansi.h"
-
+#include <stdio.h>
+#include "frame.h"
 
 void
 JMovie2JPEG(const char * const infilename,
diff --git a/converter/ppm/ppmtompeg/headers/mheaders.h b/converter/ppm/ppmtompeg/headers/mheaders.h
index 21d43e3d..edd9552d 100644
--- a/converter/ppm/ppmtompeg/headers/mheaders.h
+++ b/converter/ppm/ppmtompeg/headers/mheaders.h
@@ -54,7 +54,6 @@
  *==============*/
 
 #include "general.h"
-#include "ansi.h"
 #include "bitio.h"
 
 
@@ -62,7 +61,7 @@
  * EXTERNAL PROCEDURE prototypes *
  *===============================*/
 
-void	SetGOPStartTime _ANSI_ARGS_((int index));
+void	SetGOPStartTime (int index);
 
 void
 Mhead_GenSequenceHeader(BitBucket *   const bbPtr, 
@@ -80,21 +79,21 @@ Mhead_GenSequenceHeader(BitBucket *   const bbPtr,
                         uint8 *       const user_data,
                         int32         const user_data_size);
 
-void	Mhead_GenSequenceEnder _ANSI_ARGS_((BitBucket *bbPtr));
-void	Mhead_GenGOPHeader _ANSI_ARGS_((BitBucket *bbPtr,
+void	Mhead_GenSequenceEnder (BitBucket *bbPtr);
+void	Mhead_GenGOPHeader (BitBucket *bbPtr,
 	   int32 drop_frame_flag,
            int32 tc_hrs, int32 tc_min,
            int32 tc_sec, int32 tc_pict,
            int32 closed_gop, int32 broken_link,
            uint8 *ext_data, int32 ext_data_size,
-           uint8 *user_data, int32 user_data_size));
-void	Mhead_GenPictureHeader _ANSI_ARGS_((BitBucket *bbPtr, int frameType,
-					    int pictCount, int f_code));
-void	Mhead_GenSliceHeader _ANSI_ARGS_((BitBucket *bbPtr, uint32 slicenum,
+           uint8 *user_data, int32 user_data_size);
+void	Mhead_GenPictureHeader (BitBucket *bbPtr, int frameType,
+					    int pictCount, int f_code);
+void	Mhead_GenSliceHeader (BitBucket *bbPtr, uint32 slicenum,
 					  uint32 qscale, uint8 *extra_info,
-					  uint32 extra_info_size));
-void	Mhead_GenSliceEnder _ANSI_ARGS_((BitBucket *bbPtr));
-void	Mhead_GenMBHeader _ANSI_ARGS_((BitBucket *bbPtr,
+					  uint32 extra_info_size);
+void	Mhead_GenSliceEnder (BitBucket *bbPtr);
+void	Mhead_GenMBHeader (BitBucket *bbPtr,
 	  uint32 pict_code_type, uint32 addr_incr,
           uint32 q_scale,
           uint32 forw_f_code, uint32 back_f_code,
@@ -103,7 +102,7 @@ void	Mhead_GenMBHeader _ANSI_ARGS_((BitBucket *bbPtr,
           int32 motion_forw, int32 m_horiz_forw,
           int32 m_vert_forw, int32 motion_back,
           int32 m_horiz_back, int32 m_vert_back,
-          uint32 mb_pattern, uint32 mb_intra));
+          uint32 mb_pattern, uint32 mb_intra);
 
 
 #endif /* MHEADERS_INCLUDED */
diff --git a/converter/ppm/ppmtompeg/headers/motion_search.h b/converter/ppm/ppmtompeg/headers/motion_search.h
index 62f3abab..d00509c4 100644
--- a/converter/ppm/ppmtompeg/headers/motion_search.h
+++ b/converter/ppm/ppmtompeg/headers/motion_search.h
@@ -9,7 +9,6 @@
  * HEADER FILES *
  *==============*/
 
-#include "ansi.h"
 
 
 /*===========*
@@ -140,7 +139,7 @@ extern int psearchAlg;
  *  Changed copyrights
  *
  * Revision 1.4  1994/12/07  00:42:01  smoot
- * Added seperate P and B search ranges
+ * Added separate P and B search ranges
  *
  * Revision 1.3  1994/11/12  02:12:58  keving
  * nothing
diff --git a/converter/ppm/ppmtompeg/headers/mpeg.h b/converter/ppm/ppmtompeg/headers/mpeg.h
index 56862c42..fbfaaf2c 100644
--- a/converter/ppm/ppmtompeg/headers/mpeg.h
+++ b/converter/ppm/ppmtompeg/headers/mpeg.h
@@ -34,7 +34,6 @@
 
 #include "pm_c_util.h"
 #include "ppm.h"
-#include "ansi.h"
 #include "mtypes.h"
 #include "frame.h"
 
@@ -80,7 +79,7 @@ ComputeGOPFrames(int            const whichGOP,
                  unsigned int * const lastFrameP, 
                  unsigned int   const numFrames);
 
-extern void	IncrementTCTime _ANSI_ARGS_((void));
+extern void	IncrementTCTime (void);
 void SetReferenceFrameType(const char * const type);
 
 boolean
@@ -93,7 +92,7 @@ ReadDecodedRefFrame(MpegFrame *  const frameP,
 void
 SetBitRateFileName(const char * const fileName);
 
-extern void	SetFrameRate _ANSI_ARGS_((void));
+extern void	SetFrameRate (void);
 
 
 /*==================*
diff --git a/converter/ppm/ppmtompeg/headers/mproto.h b/converter/ppm/ppmtompeg/headers/mproto.h
index d8fefd84..5b003b2e 100644
--- a/converter/ppm/ppmtompeg/headers/mproto.h
+++ b/converter/ppm/ppmtompeg/headers/mproto.h
@@ -70,7 +70,6 @@
  *==============*/
 
 #include "general.h"
-#include "ansi.h"
 #include "bitio.h"
 
 
@@ -86,39 +85,39 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2];
 /*  
  *  from mbasic.c:
  */
-void mp_reset _ANSI_ARGS_((void));
-void mp_free _ANSI_ARGS_((MpegFrame *mf));
-MpegFrame *mp_new _ANSI_ARGS_((int fnumber, char type, MpegFrame *oldFrame));
-void mp_ycc_calc _ANSI_ARGS_((MpegFrame *mf));
-void mp_dct_blocks _ANSI_ARGS_((MpegFrame *mf));
-void	AllocDecoded _ANSI_ARGS_((MpegFrame *frame));
+void mp_reset (void);
+void mp_free (MpegFrame *mf);
+MpegFrame *mp_new (int fnumber, char type, MpegFrame *oldFrame);
+void mp_ycc_calc (MpegFrame *mf);
+void mp_dct_blocks (MpegFrame *mf);
+void	AllocDecoded (MpegFrame *frame);
 
 /*  
  *  from moutput.c:
  */
-boolean mp_quant_zig_block _ANSI_ARGS_((Block in, FlatBlock out, int qscale, int iblock));
-void	UnQuantZig _ANSI_ARGS_((FlatBlock in, Block out, int qscale, boolean iblock));
-void mp_rle_huff_block _ANSI_ARGS_((FlatBlock in, BitBucket *out));
-void mp_rle_huff_pblock _ANSI_ARGS_((FlatBlock in, BitBucket *out));
-void mp_create_blocks _ANSI_ARGS_((MpegFrame *mf));
+boolean mp_quant_zig_block (Block in, FlatBlock out, int qscale, int iblock);
+void	UnQuantZig (FlatBlock in, Block out, int qscale, boolean iblock);
+void mp_rle_huff_block (FlatBlock in, BitBucket *out);
+void mp_rle_huff_pblock (FlatBlock in, BitBucket *out);
+void mp_create_blocks (MpegFrame *mf);
 
 
 
 
-void	ReadEYUV _ANSI_ARGS_((MpegFrame * mf, FILE *fpointer, int width,
-			    int height));
-boolean	ReadPPM _ANSI_ARGS_((MpegFrame *mf, FILE *fpointer));
-void PPMtoYCC _ANSI_ARGS_((MpegFrame * mf));
+void	ReadEYUV (MpegFrame * mf, FILE *fpointer, int width,
+			    int height);
+boolean	ReadPPM (MpegFrame *mf, FILE *fpointer);
+void PPMtoYCC (MpegFrame * mf);
 
-void	ComputeHalfPixelData _ANSI_ARGS_((MpegFrame *frame));
-void mp_validate_size _ANSI_ARGS_((int *x, int *y));
-void AllocYCC _ANSI_ARGS_((MpegFrame * mf));
+void	ComputeHalfPixelData (MpegFrame *frame);
+void mp_validate_size (int *x, int *y);
+void AllocYCC (MpegFrame * mf);
 
 
 /* jrevdct.c */
-void init_pre_idct _ANSI_ARGS_((void ));
-void j_rev_dct_sparse _ANSI_ARGS_((DCTBLOCK data , int pos ));
-void j_rev_dct _ANSI_ARGS_((DCTBLOCK data ));
-void j_rev_dct_sparse _ANSI_ARGS_((DCTBLOCK data , int pos ));
-void j_rev_dct _ANSI_ARGS_((DCTBLOCK data ));
+void init_pre_idct (void );
+void j_rev_dct_sparse (DCTBLOCK data , int pos );
+void j_rev_dct (DCTBLOCK data );
+void j_rev_dct_sparse (DCTBLOCK data , int pos );
+void j_rev_dct (DCTBLOCK data );
 
diff --git a/converter/ppm/ppmtompeg/headers/mtypes.h b/converter/ppm/ppmtompeg/headers/mtypes.h
index 0db5a330..a44ce680 100644
--- a/converter/ppm/ppmtompeg/headers/mtypes.h
+++ b/converter/ppm/ppmtompeg/headers/mtypes.h
@@ -10,12 +10,7 @@
 #ifndef MTYPES_INCLUDED
 #define MTYPES_INCLUDED
 
-
-/*==============*
- * HEADER FILES *
- *==============*/
-
-#include "general.h"
+#include "netpbm/pm_config.h"
 #include "dct.h"
 
 
@@ -48,12 +43,12 @@ typedef struct motion {
 /*  
  *  your basic Block type
  */
-typedef int16 Block[DCTSIZE][DCTSIZE];
-typedef int16 FlatBlock[DCTSIZE_SQ];
+typedef int16_t Block[DCTSIZE][DCTSIZE];
+typedef int16_t FlatBlock[DCTSIZE_SQ];
 typedef	struct {
-    int32 l[2*DCTSIZE][2*DCTSIZE];
+    int32_t l[2*DCTSIZE][2*DCTSIZE];
 } LumBlock;
-typedef	int32 ChromBlock[DCTSIZE][DCTSIZE];
+typedef	int32_t ChromBlock[DCTSIZE][DCTSIZE];
 
 /*========*
  * MACROS *
diff --git a/converter/ppm/ppmtompeg/headers/opts.h b/converter/ppm/ppmtompeg/headers/opts.h
index 5901a677..1756334e 100644
--- a/converter/ppm/ppmtompeg/headers/opts.h
+++ b/converter/ppm/ppmtompeg/headers/opts.h
@@ -38,7 +38,6 @@
  */
 
 #include "general.h"
-#include "ansi.h"
 #include "mtypes.h"
 
 /*
@@ -110,14 +109,14 @@ extern int LaplaceNum, LaplaceCnum;
 extern boolean BSkipBlocks;
 
 /* Procedures Prototypes */
-int	GetIQScale _ANSI_ARGS_((void));
-int	GetPQScale _ANSI_ARGS_((void));
-int	GetBQScale _ANSI_ARGS_((void));
-void	Tune_Init _ANSI_ARGS_((void));
-int     CalcRLEHuffLength _ANSI_ARGS_((FlatBlock in));
+int	GetIQScale (void);
+int	GetPQScale (void);
+int	GetBQScale (void);
+void	Tune_Init (void);
+int     CalcRLEHuffLength (FlatBlock in);
 void    ParseTuneParam(const char * const charPtr);
-int     mse _ANSI_ARGS_((Block blk1, Block blk2));
-void    Mpost_UnQuantZigBlockLaplace _ANSI_ARGS_((FlatBlock in, Block out, int qscale, boolean iblock));
+int     mse (Block blk1, Block blk2);
+void    Mpost_UnQuantZigBlockLaplace (FlatBlock in, Block out, int qscale, boolean iblock);
 extern void CalcLambdas(void);
 
 
diff --git a/converter/ppm/ppmtompeg/headers/parallel.h b/converter/ppm/ppmtompeg/headers/parallel.h
index 90edd874..0a31fac2 100644
--- a/converter/ppm/ppmtompeg/headers/parallel.h
+++ b/converter/ppm/ppmtompeg/headers/parallel.h
@@ -30,7 +30,6 @@
  * HEADER FILES *
  *==============*/
 
-#include "ansi.h"
 #include "bitio.h"
 #include "frame.h"
 
diff --git a/converter/ppm/ppmtompeg/headers/param.h b/converter/ppm/ppmtompeg/headers/param.h
index c7f57b44..46a544b3 100644
--- a/converter/ppm/ppmtompeg/headers/param.h
+++ b/converter/ppm/ppmtompeg/headers/param.h
@@ -1,7 +1,6 @@
 /* COPYRIGHT information is at end of file */
 
 #include "pm_c_util.h"
-#include "ansi.h"
 #include "input.h"
 
 
@@ -51,7 +50,7 @@ extern char machineName[MAX_MACHINES][256];
 extern char userName[MAX_MACHINES][256];
 extern char executable[MAX_MACHINES][1024];
 extern char remoteParamFile[MAX_MACHINES][1024];
-extern boolean remote[MAX_MACHINES];
+extern bool remote[MAX_MACHINES];
 extern char currentPath[MAXPATHLEN];
 extern char currentFramePath[MAXPATHLEN];
 extern char currentGOPPath[MAXPATHLEN];
@@ -62,12 +61,21 @@ extern int realWidth, realHeight;
 extern char ioConversion[1024];
 extern char slaveConversion[1024];
 extern FILE * bitRateFile;
-extern boolean showBitRatePerFrame;
-extern boolean computeMVHist;
 extern const double VidRateNum[9];
-extern boolean keepTempFiles;
+extern bool keepTempFiles;
+extern int outputWidth, outputHeight;
+extern bool specificsOn;
+extern char specificsFile[256];
+extern char specificsDefines[1024];
+extern bool GammaCorrection;
+extern float GammaValue;
+extern char userDataFileName[256];
 
 
+/* Defined in ppmtompeg.c; computed from command line */
+extern bool showBitRatePerFrame;
+extern bool computeMVHist;
+
 /*
  * Copyright (c) 1995 The Regents of the University of California.
  * All rights reserved.
diff --git a/converter/ppm/ppmtompeg/headers/prototypes.h b/converter/ppm/ppmtompeg/headers/prototypes.h
index b421af35..432062e3 100644
--- a/converter/ppm/ppmtompeg/headers/prototypes.h
+++ b/converter/ppm/ppmtompeg/headers/prototypes.h
@@ -30,7 +30,6 @@
  *==============*/
 
 #include "general.h"
-#include "ansi.h"
 #include "frame.h"
 
 
@@ -38,34 +37,34 @@
  * EXTERNAL PROCEDURE prototypes *
  *===============================*/
 
-int GetBQScale _ANSI_ARGS_((void));
-int GetPQScale _ANSI_ARGS_((void));
-void    ResetBFrameStats _ANSI_ARGS_((void));
-void    ResetPFrameStats _ANSI_ARGS_((void));
+int GetBQScale (void);
+int GetPQScale (void);
+void    ResetBFrameStats (void);
+void    ResetPFrameStats (void);
 void SetSearchRange (int const pixelsP,
                      int const pixelsB);
 void
 SetPixelSearch(const char * const searchType);
-void    SetPQScale _ANSI_ARGS_((int qP));
-void    SetBQScale _ANSI_ARGS_((int qB));
-float   EstimateSecondsPerPFrame _ANSI_ARGS_((void));
-float   EstimateSecondsPerBFrame _ANSI_ARGS_((void));
-void    SetGOPSize _ANSI_ARGS_((int size));
+void    SetPQScale (int qP);
+void    SetBQScale (int qB);
+float   EstimateSecondsPerPFrame (void);
+float   EstimateSecondsPerBFrame (void);
+void    SetGOPSize (int size);
 void
 SetStatFileName(const char * const fileName);
 
 
-void DCTFrame _ANSI_ARGS_((MpegFrame * mf));
+void DCTFrame (MpegFrame * mf);
 
-void PPMtoYCC _ANSI_ARGS_((MpegFrame * mf));
+void PPMtoYCC (MpegFrame * mf);
 
-void    MotionSearchPreComputation _ANSI_ARGS_((MpegFrame *frame));
+void    MotionSearchPreComputation (MpegFrame *frame);
 
-void    ComputeHalfPixelData _ANSI_ARGS_((MpegFrame *frame));
-void mp_validate_size _ANSI_ARGS_((int *x, int *y));
+void    ComputeHalfPixelData (MpegFrame *frame);
+void mp_validate_size (int *x, int *y);
 
 
 /* psearch.c */
-void    ShowPMVHistogram _ANSI_ARGS_((FILE *fpointer));
-void    ShowBBMVHistogram _ANSI_ARGS_((FILE *fpointer));
-void    ShowBFMVHistogram _ANSI_ARGS_((FILE *fpointer));
+void    ShowPMVHistogram (FILE *fpointer);
+void    ShowBBMVHistogram (FILE *fpointer);
+void    ShowBFMVHistogram (FILE *fpointer);
diff --git a/converter/ppm/ppmtompeg/headers/rate.h b/converter/ppm/ppmtompeg/headers/rate.h
index df5ca1cc..a5f5076f 100644
--- a/converter/ppm/ppmtompeg/headers/rate.h
+++ b/converter/ppm/ppmtompeg/headers/rate.h
@@ -64,11 +64,11 @@ targetRateControl(MpegFrame * const frameP);
  * MB_RateOut
  *
  *      Prints out sampling of MB rate control data.  Every "nth" block
- *	stats are printed, with "n" controled by global RC_MB_SAMPLE_RATE
+ *	stats are printed, with "n" controlled by global RC_MB_SAMPLE_RATE
  *
  * RETURNS:     nothing
  *===========================================================================*/
-extern void MB_RateOut _ANSI_ARGS_((int type));
+extern void MB_RateOut (int type);
 
 
 /*===========================================================================*
@@ -92,7 +92,7 @@ updateRateControl(int const type);
  *
  * RETURNS:     new Qscale
  *===========================================================================*/
-extern int needQScaleChange _ANSI_ARGS_((int oldQScale,  Block blk0, Block blk1, Block blk2, Block blk3));
+extern int needQScaleChange (int oldQScale,  Block blk0, Block blk1, Block blk2, Block blk3);
 
 /*===========================================================================*
  *
@@ -101,7 +101,7 @@ extern int needQScaleChange _ANSI_ARGS_((int oldQScale,  Block blk0, Block blk1,
  *
  * RETURNS:   nothing
  *===========================================================================*/
-extern void incNumBlocks _ANSI_ARGS_((int num));
+extern void incNumBlocks (int num);
 
 
 /*===========================================================================*
@@ -113,7 +113,7 @@ extern void incNumBlocks _ANSI_ARGS_((int num));
  *
  * RETURNS:   nothing
  *===========================================================================*/
-extern void incMacroBlockBits _ANSI_ARGS_((int num));
+extern void incMacroBlockBits (int num);
 
 
 /*===========================================================================*
@@ -125,7 +125,7 @@ extern void incMacroBlockBits _ANSI_ARGS_((int num));
  *
  * RETURNS:     nothing
  *===========================================================================*/
-extern void SetRateControl _ANSI_ARGS_((char *charPtr));
+extern void SetRateControl (char *charPtr);
 
 
 /*===========================================================================*
@@ -150,7 +150,7 @@ setBufferSize(const char * const charPtr);
  *
  * RETURNS:     int (or -1 if invalid)
  *===========================================================================*/
-extern int getBufferSize _ANSI_ARGS_((void));
+extern int getBufferSize (void);
 
 
 /*===========================================================================*
@@ -178,7 +178,7 @@ setBitRate(const char * const charPtr);
  *
  * RETURNS:     int (-1 if Variable mode operation)
  *===========================================================================*/
-extern int getBitRate _ANSI_ARGS_((void));
+extern int getBitRate (void);
 
 
 /*===========================================================================*
@@ -189,7 +189,7 @@ extern int getBitRate _ANSI_ARGS_((void));
  *
  * RETURNS:     integer
  *===========================================================================*/
-extern int getRateMode _ANSI_ARGS_((void));
+extern int getRateMode (void);
 
 
 /*===========================================================================*
@@ -200,5 +200,5 @@ extern int getRateMode _ANSI_ARGS_((void));
  *
  * RETURNS:   nothing
  *===========================================================================*/
-extern void incQuantOverride  _ANSI_ARGS_((int num));
+extern void incQuantOverride  (int num);
 
diff --git a/converter/ppm/ppmtompeg/headers/specifics.h b/converter/ppm/ppmtompeg/headers/specifics.h
index 7bcf4ace..4f5c7074 100644
--- a/converter/ppm/ppmtompeg/headers/specifics.h
+++ b/converter/ppm/ppmtompeg/headers/specifics.h
@@ -1,4 +1,3 @@
-#include "ansi.h"
 
 
 /*===========*
@@ -29,8 +28,8 @@ typedef struct fsl_def {
 } FrameSpecList;
 
 
-void	Specifics_Init _ANSI_ARGS_((void));
-int     SpecLookup _ANSI_ARGS_((int fn, int typ, int num, 
-				BlockMV **info, int start_qs));
-int SpecTypeLookup _ANSI_ARGS_((int fn));
+void	Specifics_Init (void);
+int     SpecLookup (int fn, int typ, int num,
+			    BlockMV **info, int start_qs);
+int SpecTypeLookup (int fn);
 
diff --git a/converter/ppm/ppmtompeg/huff.c b/converter/ppm/ppmtompeg/huff.c
index 821daca1..f2be16ef 100644
--- a/converter/ppm/ppmtompeg/huff.c
+++ b/converter/ppm/ppmtompeg/huff.c
@@ -24,8 +24,9 @@
  */
 
 /*  
- *  THIS FILE IS MACHINE GENERATED!  DO NOT EDIT!
+ *  THIS FILE WAS ORIGINALLY MACHINE GENERATED
  */
+#include "general.h"
 #include "mtypes.h"
 #include "huff.h"
 
diff --git a/converter/ppm/ppmtompeg/input.c b/converter/ppm/ppmtompeg/input.c
index 2b87afa7..4266d39b 100644
--- a/converter/ppm/ppmtompeg/input.c
+++ b/converter/ppm/ppmtompeg/input.c
@@ -104,17 +104,17 @@ GetNthInputFileName(struct inputSource * const inputSourceP,
         }
 
         if (mapNEntryP->repeat != TRUE)
-            asprintfN(fileNameP, "%s%s%s",
-                      mapNEntryP->left, &numBuffer[32-numPadding],
-                      mapNEntryP->right);
+            pm_asprintf(fileNameP, "%s%s%s",
+                        mapNEntryP->left, &numBuffer[32-numPadding],
+                        mapNEntryP->right);
         else
-            asprintfN(fileNameP, "%s", mapNEntryP->left);
+            pm_asprintf(fileNameP, "%s", mapNEntryP->left);
     } else {
         if (mapNEntryP->repeat != TRUE)
-            asprintfN(fileNameP, "%s%d%s",
-                      mapNEntryP->left, index, mapNEntryP->right);
+            pm_asprintf(fileNameP, "%s%d%s",
+                        mapNEntryP->left, index, mapNEntryP->right);
         else
-            asprintfN(fileNameP, "%s", mapNEntryP->left);
+            pm_asprintf(fileNameP, "%s", mapNEntryP->left);
     }
 
     lastN = n;
diff --git a/converter/ppm/ppmtompeg/jpeg.c b/converter/ppm/ppmtompeg/jpeg.c
index a703cf39..24c9ae2d 100644
--- a/converter/ppm/ppmtompeg/jpeg.c
+++ b/converter/ppm/ppmtompeg/jpeg.c
@@ -17,7 +17,6 @@
 #define _XOPEN_SOURCE    /* Make sure stdio.h contains fileno() */
 #include <unistd.h>
 #include <stdio.h>
-#include "all.h"
 /* With the lossless jpeg patch applied to the Jpeg library
     (ftp://ftp.wizards.dupont.com/pub/ImageMagick/delegates/ljpeg-6b.tar.gz),
     the name of min_DCT_scaled_size changes to min_codec_data_unit,
@@ -26,16 +25,17 @@
 #define min_codec_data_unit min_DCT_scaled_size
 #include <jpeglib.h>
 #undef min_codec_data_unit
-#include "mtypes.h"
-#include "frames.h"
-#include "prototypes.h"
-#include "param.h"
-#include "readframe.h"
+
+#include "netpbm/pm_config.h"
+#include "netpbm/pm_c_util.h"
+#include "netpbm/mallocvar.h"
+#include "netpbm/pm.h"
+
 #include "fsize.h"
-#include "rgbtoycc.h"
+#include "frame.h"
+
 #include "jpeg.h"
 
-#include "mallocvar.h"
 
 /* make it happier.... */
 #undef DCTSIZE2
@@ -101,7 +101,7 @@ JMovie2JPEG(const char * const infilename,
     char ofname[256];     /* output filename string */
     int Temp = 0, temp = 0;   /* dummy variables */
     int image_offset = 0;     /* counting variable */
-    /* J_Movie header infomation */
+    /* J_Movie header information */
     int ver_no;           /* version number - expected to be 2 */
     int fps;              /* frame rate - frames per second */
     int no_frames;        /* total number of frames in jmovie */
@@ -360,7 +360,7 @@ JMovie2JPEG(const char * const infilename,
  *
  *      allocate and initialize JPEG decompression object
  *      specify data source (eg, a file)
- *      jpeg_read_header();     // obtain image dimensions and other parameters
+ *      jpeg_read_header();      obtain image dimensions and other parameters
  *      set parameters for decompression
  *      jpeg_start_decompress();
  *      while (scan lines remain to be read)
@@ -385,7 +385,7 @@ ReadJPEG(MpegFrame * const mf,
     jpeg_component_info *compptr;
     int buffer_height;
     int current_row[3];
-    uint8 **orig[3];
+    uint8_t **orig[3];
     int h_samp[3],v_samp[3];
     int max_h_samp,max_v_samp;
     int temp_h, temp_v;
@@ -500,7 +500,7 @@ ReadJPEG(MpegFrame * const mf,
 
         (void) jpeg_read_raw_data(&cinfo, scanarray, buffer_height);
 
-        /* alter subsample ratio's if neccessary */
+        /* alter subsample ratio's if necessary */
         if ((h_samp[0]==2) && (h_samp[1]==1) && (h_samp[2]==1) &&
             (v_samp[0]==2) && (v_samp[1]==1) && (v_samp[2]==1)) {
             /* we are 4:1:1 as expected by the encoder*/
diff --git a/converter/ppm/ppmtompeg/jrevdct.c b/converter/ppm/ppmtompeg/jrevdct.c
index 2e99a67a..bf9196c4 100644
--- a/converter/ppm/ppmtompeg/jrevdct.c
+++ b/converter/ppm/ppmtompeg/jrevdct.c
@@ -28,7 +28,6 @@
 
 #include <memory.h>
 #include "all.h"
-#include "ansi.h"
 #include "dct.h"
 
 
@@ -162,9 +161,9 @@ ones here or successive P-frames will drift too much with Reference frame coding
 /*
   Switch on reverse_dct choices
 */
-void reference_rev_dct _ANSI_ARGS_((int16 *block));
-void mpeg_jrevdct_quick _ANSI_ARGS_((int16 *block));
-void init_idctref _ANSI_ARGS_((void));
+void reference_rev_dct (int16 *block);
+void mpeg_jrevdct_quick (int16 *block);
+void init_idctref (void);
 
 extern boolean pureDCT;
 
@@ -199,7 +198,7 @@ mpeg_jrevdct_quick(data)
   dataptr = data;
 
   for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
-    /* Due to quantization, we will usually find that many of the input
+    /* Because of quantization, we will usually find that many of the input
      * coefficients are zero, especially the AC terms.  We can exploit this
      * by short-circuiting the IDCT calculation for any row in which all
      * the AC terms are zero.  In that case each output is equal to the
diff --git a/converter/ppm/ppmtompeg/mfwddct.c b/converter/ppm/ppmtompeg/mfwddct.c
index 4643bf25..75c3a718 100644
--- a/converter/ppm/ppmtompeg/mfwddct.c
+++ b/converter/ppm/ppmtompeg/mfwddct.c
@@ -122,33 +122,68 @@
 #define OSIN_5_16 OCOS_3_16
 #define OCOS_5_16 OSIN_3_16
 
-/* Prototypes */
-void reference_fwd_dct _ANSI_ARGS_((Block block, Block dest));
-void mp_fwd_dct_fast _ANSI_ARGS_((Block data2d, Block dest2d));
-void init_fdct _ANSI_ARGS_((void));
 
-/*
- * --------------------------------------------------------------
- *
- * mp_fwd_dct_block2 --
- *
- * Select the appropriate mp_fwd_dct routine
- *
- * Results: None
- *
- * Side effects: None
- *
- * --------------------------------------------------------------
- */
-extern boolean pureDCT;
-void
-mp_fwd_dct_block2(data, dest)
-    Block data, dest;
+static double trans_coef[8][8]; /* transform coefficients */
+
+
+
+static void reference_fwd_dct(block, dest)
+Block block, dest;
 {
-  if (pureDCT) reference_fwd_dct(data, dest);
-  else mp_fwd_dct_fast(data, dest);
+  int i, j, k;
+  double s;
+  double tmp[64];
+
+  if (DoLaplace) {
+    LaplaceNum++;
+  }
+
+  for (i=0; i<8; i++)
+    for (j=0; j<8; j++)
+    {
+      s = 0.0;
+
+      for (k=0; k<8; k++)
+        s += trans_coef[j][k] * block[i][k];
+
+      tmp[8*i+j] = s;
+    }
+
+  for (i=0; i<8; i++)
+    for (j=0; j<8; j++)
+    {
+      s = 0.0;
+
+      for (k=0; k<8; k++)
+        s += trans_coef[i][k] * tmp[8*k+j];
+
+      if (collect_quant) {
+	fprintf(collect_quant_fp, "%d %f\n", 8*i+j, s);
+      } 
+      if (DoLaplace) {
+	L1[LaplaceCnum][i*8+j] += s*s;
+	L2[LaplaceCnum][i*8+j] += s;
+      }
+
+
+      dest[i][j] = (int)floor(s+0.499999);
+      /*
+       * reason for adding 0.499999 instead of 0.5:
+       * s is quite often x.5 (at least for i and/or j = 0 or 4)
+       * and setting the rounding threshold exactly to 0.5 leads to an
+       * extremely high arithmetic implementation dependency of the result;
+       * s being between x.5 and x.500001 (which is now incorrectly rounded
+       * downwards instead of upwards) is assumed to occur less often
+       * (if at all)
+       */
+    }
 }
 
+
+
+static void
+mp_fwd_dct_fast(data2d, dest2d)
+    Block data2d, dest2d;
 /*
  * --------------------------------------------------------------
  *
@@ -166,9 +201,6 @@ mp_fwd_dct_block2(data, dest)
  * --------------------------------------------------------------
  */
 
-void
-mp_fwd_dct_fast(data2d, dest2d)
-    Block data2d, dest2d;
 {
     int16 *data = (int16 *) data2d;	/* this algorithm wants
 					 * a 1-d array */
@@ -236,10 +268,12 @@ mp_fwd_dct_fast(data2d, dest2d)
 	    tmp13 = tmp0 - tmp3;
 
 	    outptr[0] = (int16) UNFIXH((tmp10 + tmp11) * SIN_1_4);
-	    outptr[DCTSIZE * 4] = (int16) UNFIXH((tmp10 - tmp11) * COS_1_4);
-
-	    outptr[DCTSIZE * 2] = (int16) UNFIXH(tmp13 * COS_1_8 + tmp12 * SIN_1_8);
-	    outptr[DCTSIZE * 6] = (int16) UNFIXH(tmp13 * SIN_1_8 - tmp12 * COS_1_8);
+	    outptr[DCTSIZE * 4] =
+            (int16) UNFIXH((tmp10 - tmp11) * COS_1_4);
+	    outptr[DCTSIZE * 2] =
+            (int16) UNFIXH(tmp13 * COS_1_8 + tmp12 * SIN_1_8);
+	    outptr[DCTSIZE * 6] =
+            (int16) UNFIXH(tmp13 * SIN_1_8 - tmp12 * COS_1_8);
 
 	    tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4);
 	    tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4);
@@ -257,10 +291,14 @@ mp_fwd_dct_fast(data2d, dest2d)
 	    tmp26 = tmp7 - tmp16;
 	    tmp17 = tmp7 + tmp16;
 
-	    outptr[DCTSIZE] = (int16) UNFIXH(tmp17 * OCOS_1_16 + tmp14 * OSIN_1_16);
-	    outptr[DCTSIZE * 7] = (int16) UNFIXH(tmp17 * OCOS_7_16 - tmp14 * OSIN_7_16);
-	    outptr[DCTSIZE * 5] = (int16) UNFIXH(tmp26 * OCOS_5_16 + tmp25 * OSIN_5_16);
-	    outptr[DCTSIZE * 3] = (int16) UNFIXH(tmp26 * OCOS_3_16 - tmp25 * OSIN_3_16);
+	    outptr[DCTSIZE] =
+            (int16) UNFIXH(tmp17 * OCOS_1_16 + tmp14 * OSIN_1_16);
+	    outptr[DCTSIZE * 7] =
+            (int16) UNFIXH(tmp17 * OCOS_7_16 - tmp14 * OSIN_7_16);
+	    outptr[DCTSIZE * 5] =
+            (int16) UNFIXH(tmp26 * OCOS_5_16 + tmp25 * OSIN_5_16);
+	    outptr[DCTSIZE * 3] =
+            (int16) UNFIXH(tmp26 * OCOS_3_16 - tmp25 * OSIN_3_16);
 
 	    inptr += DCTSIZE;	/* advance inptr to next row */
 	    outptr++;		/* advance outptr to next column */
@@ -285,6 +323,28 @@ mp_fwd_dct_fast(data2d, dest2d)
 }
 
 
+extern boolean pureDCT;
+void
+mp_fwd_dct_block2(data, dest)
+    DCTBLOCK_2D data, dest;
+/*
+ * --------------------------------------------------------------
+ *
+ * mp_fwd_dct_block2 --
+ *
+ * Select the appropriate mp_fwd_dct routine
+ *
+ * Results: None
+ *
+ * Side effects: None
+ *
+ * --------------------------------------------------------------
+ */
+{
+  if (pureDCT) reference_fwd_dct(data, dest);
+  else mp_fwd_dct_fast(data, dest);
+}
+
 /* Modifies from the MPEG2 verification coder */
 /* fdctref.c, forward discrete cosine transform, double precision           */
 
@@ -323,9 +383,6 @@ mp_fwd_dct_fast(data2d, dest2d)
 #endif
 #endif
 
-/* private data */
-static double trans_coef[8][8]; /* transform coefficients */
-
 void init_fdct()
 {
   int i, j;
@@ -340,54 +397,5 @@ void init_fdct()
   }
 }
 
-void reference_fwd_dct(block, dest)
-Block block, dest;
-{
-  int i, j, k;
-  double s;
-  double tmp[64];
-
-  if (DoLaplace) {
-    LaplaceNum++;
-  }
-
-  for (i=0; i<8; i++)
-    for (j=0; j<8; j++)
-    {
-      s = 0.0;
-
-      for (k=0; k<8; k++)
-        s += trans_coef[j][k] * block[i][k];
 
-      tmp[8*i+j] = s;
-    }
 
-  for (i=0; i<8; i++)
-    for (j=0; j<8; j++)
-    {
-      s = 0.0;
-
-      for (k=0; k<8; k++)
-        s += trans_coef[i][k] * tmp[8*k+j];
-
-      if (collect_quant) {
-	fprintf(collect_quant_fp, "%d %f\n", 8*i+j, s);
-      } 
-      if (DoLaplace) {
-	L1[LaplaceCnum][i*8+j] += s*s;
-	L2[LaplaceCnum][i*8+j] += s;
-      }
-
-
-      dest[i][j] = (int)floor(s+0.499999);
-      /*
-       * reason for adding 0.499999 instead of 0.5:
-       * s is quite often x.5 (at least for i and/or j = 0 or 4)
-       * and setting the rounding threshold exactly to 0.5 leads to an
-       * extremely high arithmetic implementation dependency of the result;
-       * s being between x.5 and x.500001 (which is now incorrectly rounded
-       * downwards instead of upwards) is assumed to occur less often
-       * (if at all)
-       */
-    }
-}
diff --git a/converter/ppm/ppmtompeg/mpeg.c b/converter/ppm/ppmtompeg/mpeg.c
index 6557f377..24d337ed 100644
--- a/converter/ppm/ppmtompeg/mpeg.c
+++ b/converter/ppm/ppmtompeg/mpeg.c
@@ -30,6 +30,7 @@
  * HEADER FILES *
  *==============*/
 
+#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 #define _BSD_SOURCE   /* Make sure strdup() is in string.h */
 
 #include "all.h"
@@ -125,9 +126,9 @@ int32 bit_rate, buf_size;
  * INTERNAL PROCEDURE prototypes *
  *===============================*/
 
-static void ComputeDHMSTime _ANSI_ARGS_((int32 someTime, char *timeText));
-static void OpenBitRateFile _ANSI_ARGS_((void));
-static void CloseBitRateFile _ANSI_ARGS_((void));
+static void ComputeDHMSTime (int32 someTime, char *timeText);
+static void OpenBitRateFile (void);
+static void CloseBitRateFile (void);
 
 
 static void
@@ -413,11 +414,11 @@ bitioNew(const char * const outputFileName,
     else {
         const char * fileName;
 
-        asprintfN(&fileName, "%s.frame.%d", outputFileName, frameNumber);
+        pm_asprintf(&fileName, "%s.frame.%d", outputFileName, frameNumber);
 
         bbP = Bitio_New_Filename(fileName);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
     return bbP;
 }
@@ -771,12 +772,12 @@ doFirstFrameStuff(enum frameContext const context,
             time_t now;
                     
             time(&now);
-            asprintfN(&userDataString,"MPEG stream encoded by UCB Encoder "
-                      "(mpeg_encode) v%s on %s.",
-                      VERSION, ctime(&now));
+            pm_asprintf(&userDataString,"MPEG stream encoded by UCB Encoder "
+                        "(mpeg_encode) v%s on %s.",
+                        VERSION, ctime(&now));
             userData = strdup(userDataString);
             userDataSize = strlen(userData);
-            strfree(userDataString);
+            pm_strfree(userDataString);
         }
         Mhead_GenSequenceHeader(bbP, Fsize_x, Fsize_y,
                                 /* pratio */ aspectRatio,
@@ -1322,12 +1323,12 @@ PrintStartStats(time_t               const startTime,
             GetNthInputFileName(inputSourceP, 0, &inputFileName);
             fprintf(fpointer, "FIRST FILE:  %s/%s\n", 
                     currentPath, inputFileName);
-            strfree(inputFileName);
+            pm_strfree(inputFileName);
             GetNthInputFileName(inputSourceP, inputSourceP->numInputFiles-1, 
                                 &inputFileName);
             fprintf(fpointer, "LAST FILE:  %s/%s\n", 
                     currentPath, inputFileName);
-            strfree(inputFileName);
+            pm_strfree(inputFileName);
         }    
         fprintf(fpointer, "OUTPUT:  %s\n", outputFileName);
 
@@ -1680,7 +1681,7 @@ ReadDecodedRefFrame(MpegFrame *  const frameP,
     }
 
     if ((fpointer = fopen(fileName, "rb")) == NULL) {
-        sleepN(1000);
+        pm_sleep(1000);
         if ((fpointer = fopen(fileName, "rb")) == NULL) {
             fprintf(stderr, "Cannot open %s\n", fileName);
             exit(1);
diff --git a/converter/ppm/ppmtompeg/opts.c b/converter/ppm/ppmtompeg/opts.c
index c4d0c0b3..841efdab 100644
--- a/converter/ppm/ppmtompeg/opts.c
+++ b/converter/ppm/ppmtompeg/opts.c
@@ -40,6 +40,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include "opts.h"
+#include "dct.h"
 
 /*==============*
  * EXTERNALS    *
@@ -51,8 +52,7 @@ extern int32   qtable[], niqtable[];
 extern int     ZAG[];
 extern boolean printSNR, decodeRefFrames;
 
-void init_idctref _ANSI_ARGS_((void));
-void init_fdct _ANSI_ARGS_((void));
+void init_idctref (void);
 
 
 /*===================*
@@ -255,7 +255,7 @@ SetupLocalDCT(const char * const charPtr)
  *
  * SetupLaplace
  *
- *     Setup encoder to find distrubution for I-frames, and use for -snr
+ *     Setup encoder to find distribution for I-frames, and use for -snr
  *
  * RETURNS:	nothing
  *
diff --git a/converter/ppm/ppmtompeg/parallel.c b/converter/ppm/ppmtompeg/parallel.c
index e13bf221..2835c67c 100644
--- a/converter/ppm/ppmtompeg/parallel.c
+++ b/converter/ppm/ppmtompeg/parallel.c
@@ -156,7 +156,7 @@ machineDebug(const char format[], ...) {
     if (debugMachines) {
         const char * const hostname = GetHostName();
         fprintf(stderr, "%s: ---", hostname);
-        strfree(hostname);
+        pm_strfree(hostname);
         vfprintf(stderr, format, args);
         fputc('\n', stderr);
     }
@@ -175,7 +175,7 @@ errorExit(const char format[], ...) {
     va_start(args, format);
 
     fprintf(stderr, "%s: FATAL ERROR.  ", hostname);
-    strfree(hostname);
+    pm_strfree(hostname);
     vfprintf(stderr, format, args);
     fputc('\n', stderr);
 
@@ -767,13 +767,13 @@ routeFromSocketToDisk(int              const otherSock,
     ReadBytes(otherSock, bigBuffer, numBytes);
     
     /* open file to output this stuff to */
-    asprintfN(&fileName, "%s.frame.%d", outputFileName, frameNumber);
+    pm_asprintf(&fileName, "%s.frame.%d", outputFileName, frameNumber);
     filePtr = fopen(fileName, "wb");
 
     if (filePtr == NULL)
         errorExit("I/O SERVER: Could not open output file(3):  %s", fileName);
 
-    strfree(fileName);
+    pm_strfree(fileName);
 
     /* now write the bytes here */
     fwrite(bigBuffer, sizeof(char), numBytes, filePtr);
@@ -968,7 +968,7 @@ IoServer(struct inputSource * const inputSourceP,
 -----------------------------------------------------------------------------*/
     int       ioPortNum;
     int       serverSocket;
-    boolean   done;
+    bool   done;
     unsigned char   *bigBuffer;
         /* A work buffer that we keep around permanently.  We increase
            its size as needed, but never shrink it.
@@ -1104,8 +1104,8 @@ GetRemoteFrame(MpegFrame * const frameP,
 
                 if (numBytes > sizeof(buffer))
                     errorExit("Invalid message received: numBytes = %d, "
-                              "which is greater than %d\n", 
-                              numBytes, sizeof(numBytes));
+                              "which is greater than %u", 
+                              numBytes, (unsigned)sizeof(numBytes));
                 ReadBytes(clientSocket, buffer, numBytes);
 
                 fwrite(buffer, 1, numBytes, filePtr);
@@ -1209,7 +1209,7 @@ openInputFile(const char * const fileName,
             pm_message("ERROR  Couldn't read frame file '%s' errno = %d (%s)"
                        "attempt %d", 
                        fileName, errno, strerror(errno), attempts);
-            sleepN(1000);
+            pm_sleep(1000);
         }
         ++attempts;
     }
@@ -1246,11 +1246,11 @@ waitForOutputFile(void *        const inputHandle,
         }
         machineDebug("COMBINE SERVER: Wait for frame %u over", frameNumber);
 
-        asprintfN(&fileName, "%s.frame.%u", outputFileName, frameNumber);
+        pm_asprintf(&fileName, "%s.frame.%u", outputFileName, frameNumber);
 
         openInputFile(fileName, ifPP);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -1263,11 +1263,11 @@ unlinkFile(void *       const inputHandle,
     if (!keepTempFiles) {
         const char * fileName;
 
-        asprintfN(&fileName, "%s.frame.%u", outputFileName, frameNumber);
+        pm_asprintf(&fileName, "%s.frame.%u", outputFileName, frameNumber);
 
         unlink(fileName);
 
-        strfree(fileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -1340,13 +1340,13 @@ startCombineServer(const char * const encoderName,
     int          otherSock;
     const char * error;
 
-    snprintf(command, sizeof(command), 
-             "%s %s -max_machines %d -output_server %s %d %d %s",
-             encoderName, 
-             debugMachines ? "-debug_machines" : "",
-             numMachines, masterHostName, masterPortNum, 
-             numInputFiles, paramFileName);
-
+    pm_snprintf(command, sizeof(command), 
+                "%s %s -max_machines %d -output_server %s %d %d %s",
+                encoderName, 
+                debugMachines ? "-debug_machines" : "",
+                numMachines, masterHostName, masterPortNum, 
+                numInputFiles, paramFileName);
+    
     machineDebug("MASTER: Starting combine server with shell command '%s'",
                  command);
 
@@ -1382,12 +1382,12 @@ startDecodeServer(const char * const encoderName,
     int          otherSock;
     const char * error;
 
-    snprintf(command, sizeof(command), 
-             "%s %s -max_machines %d -decode_server %s %d %d %s",
-             encoder_name, 
-             debugMachines ? "-debug_machines" : "",
-             numMachines, masterHostName, masterPortNum,
-             numInputFiles, paramFileName);
+    pm_snprintf(command, sizeof(command), 
+                "%s %s -max_machines %d -decode_server %s %d %d %s",
+                encoder_name, 
+                debugMachines ? "-debug_machines" : "",
+                numMachines, masterHostName, masterPortNum,
+                numInputFiles, paramFileName);
 
     machineDebug("MASTER: Starting decode server with shell command '%s'",
                  command);
@@ -1680,23 +1680,23 @@ startChildren(struct scheduler *   const schedulerP,
                 }
                 --childrenLeftCurrentIoServer;
             } 
-            snprintf(command, sizeof(command),
-                     "%s %s -l %s %s "
-                     "%s %s -child %s %d %d %d %d %d %d "
-                     "-frames %d %d %s",
-                     rsh,
-                     machineName[childNum], userName[childNum],
-                     beNice ? "nice" : "",
-                     executable[childNum],
-                     debugMachines ? "-debug_machines" : "",
-                     masterHostName, masterPortNum, 
-                     remote[childNum] ? ioPortNum[numIoServers-1] : 0,
-                     combinePortNum, decodePortNum, childNum,
-                     remote[childNum] ? 1 : 0,
-                     startFrame, startFrame + nFrames - 1,
-                     remote[childNum] ? 
-                         remoteParamFile[childNum] : paramFileName
-            );
+            pm_snprintf(command, sizeof(command),
+                        "%s %s -l %s %s "
+                        "%s %s -child %s %d %d %d %d %d %d "
+                        "-frames %d %d %s",
+                        rsh,
+                        machineName[childNum], userName[childNum],
+                        beNice ? "nice" : "",
+                        executable[childNum],
+                        debugMachines ? "-debug_machines" : "",
+                        masterHostName, masterPortNum, 
+                        remote[childNum] ? ioPortNum[numIoServers-1] : 0,
+                        combinePortNum, decodePortNum, childNum,
+                        remote[childNum] ? 1 : 0,
+                        startFrame, startFrame + nFrames - 1,
+                        remote[childNum] ? 
+                          remoteParamFile[childNum] : paramFileName
+                );
         
             machineDebug("MASTER: Starting child server "
                          "with shell command '%s'", command);
@@ -2070,7 +2070,7 @@ MasterServer(struct inputSource * const inputSourceP,
         fclose(statFile);
 
     free(childState);
-    strfree(hostName);
+    pm_strfree(hostName);
 }
 
 
diff --git a/converter/ppm/ppmtompeg/param.c b/converter/ppm/ppmtompeg/param.c
index a145d33c..45605981 100644
--- a/converter/ppm/ppmtompeg/param.c
+++ b/converter/ppm/ppmtompeg/param.c
@@ -73,14 +73,14 @@
 #define LAST_OPTION           15
 
 /* put any non-required options after LAST_OPTION */
-#define OPTION_RESIZE	      16
+#define OPTION_RESIZE         16
 #define OPTION_IO_CONVERT     17
 #define OPTION_SLAVE_CONVERT  18
-#define OPTION_IQTABLE	      19
-#define OPTION_NIQTABLE	      20
+#define OPTION_IQTABLE        19
+#define OPTION_NIQTABLE       20
 #define OPTION_FRAME_RATE     21
 #define OPTION_ASPECT_RATIO   22
-#define OPTION_YUV_SIZE	      23
+#define OPTION_YUV_SIZE       23
 #define OPTION_SPECIFICS      24
 #define OPTION_DEFS_SPECIFICS 25
 #define OPTION_BUFFER_SIZE    26
@@ -98,48 +98,49 @@
  * GLOBAL VARIABLES *
  *==================*/
 
-extern char currentPath[MAXPATHLEN];
-char	outputFileName[256];
-int	outputWidth, outputHeight;
+char outputFileName[256];
+int outputWidth, outputHeight;
 char inputConversion[1024];
 char ioConversion[1024];
 char slaveConversion[1024];
 char yuvConversion[256];
 char specificsFile[256],specificsDefines[1024]="";
-boolean GammaCorrection=FALSE;
-float   GammaValue;
+bool GammaCorrection=FALSE;
+float GammaValue;
 char userDataFileName[256]={0};
-boolean specificsOn = FALSE;
+bool specificsOn = FALSE;
 char currentGOPPath[MAXPATHLEN];
 char currentFramePath[MAXPATHLEN];
-boolean keepTempFiles;
+bool keepTempFiles;
+int numMachines;
+char machineName[MAX_MACHINES][256];
+char userName[MAX_MACHINES][256];
+char executable[MAX_MACHINES][1024];
+char remoteParamFile[MAX_MACHINES][1024];
+bool remote[MAX_MACHINES];
+int mult_seq_headers = 0;  /* 0 for none, N for header/N GOPs */
+
+
+extern char currentPath[MAXPATHLEN];
 
 static const char * const optionText[LAST_OPTION+1] = { 
     "GOP_SIZE", "PATTERN", "PIXEL", "PQSCALE",
     "OUTPUT", "RANGE", "PSEARCH_ALG", "IQSCALE", "INPUT_DIR",
     "INPUT_CONVERT", "INPUT", "BQSCALE", "BASE_FILE_FORMAT",
     "SLICES_PER_FRAME", "BSEARCH_ALG", "REFERENCE_FRAME"};
-static boolean optionSeen[NUM_OPTIONS+1];
+static bool optionSeen[NUM_OPTIONS+1];
     /* optionSeen[x] means we have seen option x in the parameter file we've
        been reading.
     */
 
-int numMachines;
-char	machineName[MAX_MACHINES][256];
-char	userName[MAX_MACHINES][256];
-char	executable[MAX_MACHINES][1024];
-char	remoteParamFile[MAX_MACHINES][1024];
-boolean	remote[MAX_MACHINES];
-int mult_seq_headers = 0;  /* 0 for none, N for header/N GOPs */
-
 
 /*===========================================================================*
  *
  * SkipSpacesTabs
  *
- *	skip all spaces and tabs
+ *  skip all spaces and tabs
  *
- * RETURNS:	point to next character not a space or tab
+ * RETURNS: point to next character not a space or tab
  *
  * SIDE EFFECTS:    none
  *
@@ -172,13 +173,13 @@ static int
 GetAspectRatio(const char * const p)
 {
   float   ratio;
-  int	  ttRatio;
+  int     ttRatio;
   int     retval;
 
   sscanf(p, "%f", &ratio);
   ttRatio = (int)(0.5+ratio*10000.0);
 
-  if ( ttRatio == 10000 )	      retval = 1;
+  if ( ttRatio == 10000 )         retval = 1;
   else if ( ttRatio ==  6735 )    retval = 2;
   else if ( ttRatio ==  7031 )    retval = 3;
   else if ( ttRatio ==  7615 )    retval = 4;
@@ -205,9 +206,9 @@ GetAspectRatio(const char * const p)
  *
  * ReadMachineNames
  *
- *	read a list of machine names for parallel execution
+ *  read a list of machine names for parallel execution
  *
- * RETURNS:	nothing
+ * RETURNS: nothing
  *
  * SIDE EFFECTS:    machine info updated
  *
@@ -219,7 +220,7 @@ ReadMachineNames(FILE * const fpointer)
   const char *charPtr;
 
   while ( (fgets(input, 256, fpointer) != NULL) &&
-	 (strncmp(input, "END_PARALLEL", 12) != 0) ) {
+     (strncmp(input, "END_PARALLEL", 12) != 0) ) {
     if ( input[0] == '#' || input[0] == '\n') {
       continue;
     }
@@ -229,13 +230,13 @@ ReadMachineNames(FILE * const fpointer)
       remote[numMachines] = TRUE;
 
       sscanf(charPtr, "%s %s %s %s", machineName[numMachines],
-	     userName[numMachines], executable[numMachines],
-	     remoteParamFile[numMachines]);
+         userName[numMachines], executable[numMachines],
+         remoteParamFile[numMachines]);
     } else {
       remote[numMachines] = FALSE;
 
       sscanf(input, "%s %s %s", machineName[numMachines],
-	     userName[numMachines], executable[numMachines]);
+         userName[numMachines], executable[numMachines]);
     }
 
     numMachines++;
@@ -259,13 +260,13 @@ static int
 GetFrameRate(const char * const p)
 {
   float   rate;
-  int	  thouRate;
+  int     thouRate;
   int     retval;
 
   sscanf(p, "%f", &rate);
   thouRate = (int)(0.5+1000.0*rate);
 
-  if ( thouRate == 23976 )	       retval = 1;
+  if ( thouRate == 23976 )         retval = 1;
   else if ( thouRate == 24000 )    retval = 2;
   else if ( thouRate == 25000 )    retval = 3;
   else if ( thouRate == 29970 )    retval = 4;
@@ -988,7 +989,7 @@ ReadParamFile(const char *         const fileName,
                            paramP);
               /* May read additional lines from file */
 
-      strfree(input);
+      pm_strfree(input);
   }
 
   fclose(fpointer);
diff --git a/converter/ppm/ppmtompeg/ppmtompeg.c b/converter/ppm/ppmtompeg/ppmtompeg.c
index f53ffea9..cd94db39 100644
--- a/converter/ppm/ppmtompeg/ppmtompeg.c
+++ b/converter/ppm/ppmtompeg/ppmtompeg.c
@@ -30,12 +30,14 @@
  * HEADER FILES *
  *==============*/
 
+#define _XOPEN_SOURCE 500  /* Make sure strdup() is in string.h */
 #define _BSD_SOURCE   /* Make sure strdup() is in string.h */
 
 #include <assert.h>
 
 #include "all.h"
 #include "mtypes.h"
+#include "dct.h"
 #include "mpeg.h"
 #include "motion_search.h"
 #include "prototypes.h"
@@ -57,14 +59,15 @@
 
 #include <time.h>
 
-int main _ANSI_ARGS_((int argc, char **argv));
+int main (int argc, char **argv);
 
 
 /*==================*
  * GLOBAL VARIABLES *
  *==================*/
 
-boolean showBitRatePerFrame;
+bool showBitRatePerFrame;
+bool computeMVHist = FALSE;
 boolean frameSummary;
 
 extern time_t IOtime;
@@ -78,9 +81,7 @@ boolean noFrameSummaryOption = FALSE;
 boolean debugSockets = FALSE;
 boolean debugMachines = FALSE;
 boolean bitRateInfoOption = FALSE;
-boolean computeMVHist = FALSE;
 int     baseFormat;
-extern  boolean specificsOn;
 extern  FrameSpecList *fsl;
 boolean pureDCT=FALSE;
 char    encoder_name[1024];
@@ -91,8 +92,7 @@ const char * hostname;
  * External PROCEDURE prototypes  *
  *================================*/
 
-void init_idctref _ANSI_ARGS_((void));
-void init_fdct _ANSI_ARGS_((void));
+void init_idctref (void);
 
 
 struct cmdlineInfo {
@@ -335,9 +335,9 @@ announceJob(enum frameContext const context,
         const char * combineDest;
 
         if (context == CONTEXT_JUSTFRAMES)
-            asprintfN(&outputDest, "to individual frame files");
+            pm_asprintf(&outputDest, "to individual frame files");
         else
-            asprintfN(&outputDest, "to file '%s'", outputFileName);
+            pm_asprintf(&outputDest, "to file '%s'", outputFileName);
 
         if (childProcess)
             combineDest = strdup("for delivery to combine server");
@@ -347,8 +347,8 @@ announceJob(enum frameContext const context,
         pm_message("%s:  ENCODING FRAMES %u-%u to %s %s",
                    hostname, frameStart, frameEnd, outputDest, combineDest);
 
-        strfree(combineDest);
-        strfree(outputDest);
+        pm_strfree(combineDest);
+        pm_strfree(outputDest);
     }
 }
 
@@ -540,15 +540,15 @@ getUserFrameFile(void *       const handle,
 
         GetNthInputFileName(inputSourceP, frameNumber, &inputFileName);
         
-        asprintfN(&fileName, "%s/%s", currentFramePath, inputFileName);
+        pm_asprintf(&fileName, "%s/%s", currentFramePath, inputFileName);
         
         *ifPP = fopen(fileName, "rb");
         if (*ifPP == NULL)
             pm_error("Unable to open file '%s'.  Errno = %d (%s)",
                      fileName, errno, strerror(errno));
         
-        strfree(inputFileName);
-        strfree(fileName);
+        pm_strfree(inputFileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -702,7 +702,7 @@ main(int argc, char **argv) {
     } 
     Frame_Exit();
         
-    strfree(hostname);
+    pm_strfree(hostname);
 
     return 0;
 }
diff --git a/converter/ppm/ppmtompeg/psearch.c b/converter/ppm/ppmtompeg/psearch.c
index 83c62d04..3cca1241 100644
--- a/converter/ppm/ppmtompeg/psearch.c
+++ b/converter/ppm/ppmtompeg/psearch.c
@@ -962,7 +962,7 @@ ShowBFMVHistogram(fpointer)
  * Changed copyrights
  *
  * Revision 1.8  1994/12/07  00:40:36  smoot
- * Added seperate P and B search ranges
+ * Added separate P and B search ranges
  *
  * Revision 1.7  1994/11/12  02:09:45  eyhung
  * full pixel bug
diff --git a/converter/ppm/ppmtompeg/psocket.c b/converter/ppm/ppmtompeg/psocket.c
index 707f1d84..6a50dc27 100644
--- a/converter/ppm/ppmtompeg/psocket.c
+++ b/converter/ppm/ppmtompeg/psocket.c
@@ -91,7 +91,7 @@ errorExit(const char format[], ...) {
     va_start(args, format);
 
     fprintf(stderr, "%s: FATAL ERROR.  ", hostname);
-    strfree(hostname);
+    pm_strfree(hostname);
     vfprintf(stderr, format, args);
     fputc('\n', stderr);
 
@@ -272,13 +272,13 @@ ConnectToSocket(const char *      const machineName,
     if ((*hostEnt) == NULL) {
         (*hostEnt) = gethostbyname(machineName);
         if ((*hostEnt) == NULL)
-            asprintfN(errorP, "Couldn't get host by name (%s)", machineName);
+            pm_asprintf(errorP, "Couldn't get host by name (%s)", machineName);
     }
     if (!*errorP) {
         rc = socket(AF_INET, SOCK_STREAM, 0);
         if (rc < 0)
-            asprintfN(errorP, "socket() failed with errno %d (%s)", 
-                      errno, strerror(errno));
+            pm_asprintf(errorP, "socket() failed with errno %d (%s)", 
+                        errno, strerror(errno));
         else {
             int const socketFd = rc;
             
@@ -298,10 +298,10 @@ ConnectToSocket(const char *      const machineName,
                          sizeof(struct sockaddr));
             
             if (rc != 0)
-                asprintfN(errorP, 
-                          "connect() to host '%s', port %d failed with "
-                          "errno %d (%s)",
-                          machineName, portNum, errno, strerror(errno));
+                pm_asprintf(errorP, 
+                            "connect() to host '%s', port %d failed with "
+                            "errno %d (%s)",
+                            machineName, portNum, errno, strerror(errno));
             else {
                 *errorP = NULL;
                 *socketFdP = socketFd;
@@ -364,14 +364,14 @@ bindToUnusedPort(int              const socketFd,
             foundPort = TRUE;
             *portNumP = trialPortNum;
         } else if (!portInUseErrno(errno))
-            asprintfN(errorP, "bind() of TCP port number %hu failed "
-                      "with errno %d (%s)", 
-                      trialPortNum, errno, strerror(errno));
+            pm_asprintf(errorP, "bind() of TCP port number %hu failed "
+                        "with errno %d (%s)", 
+                        trialPortNum, errno, strerror(errno));
     }
     
     if (!*errorP && !foundPort)
-        asprintfN(errorP, "Unable to find a free port.  Every TCP port "
-                  "in the range 2048-16383 is in use");
+        pm_asprintf(errorP, "Unable to find a free port.  Every TCP port "
+                    "in the range 2048-16383 is in use");
 }
 
 
@@ -392,10 +392,10 @@ CreateListeningSocket(int *         const socketP,
     
     rc = socket(AF_INET, SOCK_STREAM, 0);
     if (rc < 0)
-        asprintfN(errorP,
-                  "Unable to create socket.  "
-                  "socket() failed with errno %d (%s)",
-                  errno, strerror(errno));
+        pm_asprintf(errorP,
+                    "Unable to create socket.  "
+                    "socket() failed with errno %d (%s)",
+                    errno, strerror(errno));
     else {
         int const socketFd = rc;
 
@@ -414,9 +414,9 @@ CreateListeningSocket(int *         const socketP,
             */
             rc = listen(socketFd, SOMAXCONN);
             if (rc != 0)
-                asprintfN(errorP, "Unable to listen on TCP socket.  "
-                          "listen() fails with errno %d (%s)", 
-                          errno, strerror(errno));
+                pm_asprintf(errorP, "Unable to listen on TCP socket.  "
+                            "listen() fails with errno %d (%s)", 
+                            errno, strerror(errno));
         }
         if (*errorP)
             close(socketFd);
@@ -443,8 +443,8 @@ AcceptConnection(int           const listenSocketFd,
     rc = accept(listenSocketFd, &otherSocket, &otherSize);
 
     if (rc < 0)
-        asprintfN(errorP, "accept() failed with errno %d (%s).  ",
-                  errno, strerror(errno));
+        pm_asprintf(errorP, "accept() failed with errno %d (%s).  ",
+                    errno, strerror(errno));
     else {
         *connectSocketFdP = rc;
         *errorP = NULL;
diff --git a/converter/ppm/ppmtompeg/rate.c b/converter/ppm/ppmtompeg/rate.c
index 1a44cb95..c775e055 100644
--- a/converter/ppm/ppmtompeg/rate.c
+++ b/converter/ppm/ppmtompeg/rate.c
@@ -204,13 +204,13 @@ extern int framePatternLen;
  * INTERNAL PROCEDURE prototypes *
  *===============================*/
 
-int initGOPRateControl _ANSI_ARGS_((void));
-int determineMBCount _ANSI_ARGS_((void));
-void checkBufferFullness _ANSI_ARGS_((int count));
-void checkSpatialActivity _ANSI_ARGS_((Block blk0, Block blk1, Block blk2, Block blk3));
-void incNumBlocks _ANSI_ARGS_((int num));
-void calculateVBVDelay _ANSI_ARGS_((int num));
-int BlockExperiments  _ANSI_ARGS_((int16 *OrigBlock, int16 *NewBlock, int control));
+int initGOPRateControl (void);
+int determineMBCount (void);
+void checkBufferFullness (int count);
+void checkSpatialActivity (Block blk0, Block blk1, Block blk2, Block blk3);
+void incNumBlocks (int num);
+void calculateVBVDelay (int num);
+int BlockExperiments  (int16 *OrigBlock, int16 *NewBlock, int control);
      
      
 
@@ -236,7 +236,7 @@ analyzePattern(const char *  const framePattern,
         case 'p': ++*gop_pP; break;
         case 'b': ++*gop_bP; break;
         default:
-            asprintfN(errorP, "Bad pattern - not composed of i, p, and b");
+            pm_asprintf(errorP, "Bad pattern - not composed of i, p, and b");
         }
     }
     assert(*gop_xP == *gop_iP + *gop_pP + *gop_bP);
@@ -285,7 +285,7 @@ initRateControl(bool const wantUnderflowWarning,
     if (error) {
         pm_message("Unable to set up rate control.  Switching to variable.  "
                    "%s", error);
-        strfree(error);
+        pm_strfree(error);
         RateControlMode = VARIABLE_RATE;
         return -1;
     }
@@ -595,7 +595,7 @@ updateRateControl(int const type) {
  * MB_RateOut
  *
  *      Prints out sampling of MB rate control data.  Every "nth" block
- *	stats are printed, with "n" controled by global RC_MB_SAMPLE_RATE
+ *	stats are printed, with "n" controlled by global RC_MB_SAMPLE_RATE
  *	(NB. "skipped" blocks do not go through this function and thus do not
  *		show up in the sample )
  *
diff --git a/converter/ppm/ppmtompeg/readframe.c b/converter/ppm/ppmtompeg/readframe.c
index d1423c1f..23752706 100644
--- a/converter/ppm/ppmtompeg/readframe.c
+++ b/converter/ppm/ppmtompeg/readframe.c
@@ -67,9 +67,6 @@ struct YuvLine {
  * Global VARIABLES *
  *==================*/
 
-extern boolean GammaCorrection;
-extern float GammaValue;
-extern int outputWidth,outputHeight;
 boolean resizeFrame;
 const char *CurrFile;
 
@@ -77,19 +74,19 @@ const char *CurrFile;
  * INTERNAL PROCEDURE prototypes *
  *===============================*/
 
-static void ReadEYUV _ANSI_ARGS_((MpegFrame * mf, FILE *fpointer,
-                 int width, int height));
-static void ReadAYUV _ANSI_ARGS_((MpegFrame * mf, FILE *fpointer,
-                 int width, int height));
-static void SeparateLine _ANSI_ARGS_((FILE *fpointer, struct YuvLine *lineptr,
-                     int width));
-static void ReadY _ANSI_ARGS_((MpegFrame * mf, FILE *fpointer,
-                 int width, int height));
-static void ReadSub4 _ANSI_ARGS_((MpegFrame * mf, FILE *fpointer,
-                  int width, int height));
-static void DoGamma  _ANSI_ARGS_((MpegFrame *mf, int width, int height));
+static void ReadEYUV (MpegFrame * mf, FILE *fpointer,
+                 int width, int height);
+static void ReadAYUV (MpegFrame * mf, FILE *fpointer,
+                 int width, int height);
+static void SeparateLine (FILE *fpointer, struct YuvLine *lineptr,
+                     int width);
+static void ReadY (MpegFrame * mf, FILE *fpointer,
+                 int width, int height);
+static void ReadSub4 (MpegFrame * mf, FILE *fpointer,
+                  int width, int height);
+static void DoGamma  (MpegFrame *mf, int width, int height);
 
-static void DoKillDim _ANSI_ARGS_((MpegFrame *mf, int w, int h));
+static void DoKillDim (MpegFrame *mf, int w, int h);
 
 #define safe_fread(ptr,sz,len,fileptr)                           \
     if ((safe_read_count=fread(ptr,sz,len,fileptr))!=sz*len) {   \
@@ -155,7 +152,7 @@ openFile(struct inputSource * const inputSourceP,
         
         GetNthInputFileName(inputSourceP, frameNumber, &fileName);
         
-        asprintfN(&fullFileName, "%s/%s", currentPath, fileName);
+        pm_asprintf(&fullFileName, "%s/%s", currentPath, fileName);
         
         CurrFile = fullFileName;
         
@@ -207,8 +204,8 @@ openFile(struct inputSource * const inputSourceP,
             if (baseFormat == JMOVIE_FILE_TYPE)
                 unlink(fullFileName);
         }
-        strfree(fullFileName);
-        strfree(fileName);
+        pm_strfree(fullFileName);
+        pm_strfree(fileName);
     }
 }
 
@@ -377,10 +374,10 @@ ReadFrame(MpegFrame *          const frameP,
 void
 SetFileType(const char * const conversion)
 {
-    if ( strcmp(conversion, "*") == 0 ) {
-    fileType = BASE_FILE_TYPE;
+    if (streq(conversion, "*")) {
+        fileType = BASE_FILE_TYPE;
     } else {
-    fileType = ANY_FILE_TYPE;
+        fileType = ANY_FILE_TYPE;
     }
 }
 
@@ -399,23 +396,23 @@ SetFileType(const char * const conversion)
 void
 SetFileFormat(const char * const format)
 {
-    if ( strcmp(format, "PPM") == 0 ) {
-    baseFormat = PNM_FILE_TYPE;
-    } else if ( strcmp(format, "YUV") == 0 ) {
-    baseFormat = YUV_FILE_TYPE;
-    } else if ( strcmp(format, "Y") == 0 ) {
-    baseFormat = Y_FILE_TYPE;
-    } else if ( strcmp(format, "PNM") == 0 ) {
-    baseFormat = PNM_FILE_TYPE;
-    } else if (( strcmp(format, "JPEG") == 0 ) || ( strcmp(format, "JPG") == 0 )) {
-    baseFormat = JPEG_FILE_TYPE;
-    } else if ( strcmp(format, "JMOVIE") == 0 ) {
-    baseFormat = JMOVIE_FILE_TYPE;
-    } else if ( strcmp(format, "SUB4") == 0 ) {
-    baseFormat = SUB4_FILE_TYPE;
+    if (streq(format, "PPM")) {
+        baseFormat = PNM_FILE_TYPE;
+    } else if (streq(format, "YUV")) {
+        baseFormat = YUV_FILE_TYPE;
+    } else if (streq(format, "Y")) {
+        baseFormat = Y_FILE_TYPE;
+    } else if (streq(format, "PNM")) {
+        baseFormat = PNM_FILE_TYPE;
+    } else if (streq(format, "JPEG") || streq(format, "JPG")) {
+        baseFormat = JPEG_FILE_TYPE;
+    } else if (streq(format, "JMOVIE")) {
+        baseFormat = JMOVIE_FILE_TYPE;
+    } else if (streq(format, "SUB4")) {
+        baseFormat = SUB4_FILE_TYPE;
     } else {
-    fprintf(stderr, "ERROR:  Invalid file format:  %s\n", format);
-    exit(1);
+        fprintf(stderr, "ERROR:  Invalid file format:  %s\n", format);
+        exit(1);
     }
 }
 
@@ -435,9 +432,9 @@ ReadIOConvert(struct inputSource * const inputSourceP,
 
     GetNthInputFileName(inputSourceP, frameNumber, &fileName);
 
-    asprintfN(&fullFileName, "%s/%s", currentPath, fileName);
+    pm_asprintf(&fullFileName, "%s/%s", currentPath, fileName);
 
-    if ( strcmp(ioConversion, "*") == 0 ) {
+    if (streq(ioConversion, "*")) {
         char buff[1024];
         ifp = fopen(fullFileName, "rb");
         sprintf(buff,"fopen \"%s\"",fullFileName);
@@ -483,8 +480,8 @@ ReadIOConvert(struct inputSource * const inputSourceP,
         exit(1);
     }
 
-    strfree(fullFileName);
-    strfree(fileName);
+    pm_strfree(fullFileName);
+    pm_strfree(fileName);
 
     return ifp;
 }
@@ -828,7 +825,7 @@ MpegFrame *mf;
 int w,h;
 {
   static int GammaVal[256];
-  static boolean init_done=FALSE;
+  static bool init_done=FALSE;
   int i,j;
 
   if (!init_done) {
@@ -882,7 +879,7 @@ DoKillDim(mf, w, h)
 MpegFrame *mf;
 int w,h;
 {
-  static boolean init_done=FALSE;
+  static bool init_done=FALSE;
   static unsigned char mapper[256];
   register int i,j;
   double slope, intercept;
diff --git a/converter/ppm/ppmtompeg/rgbtoycc.c b/converter/ppm/ppmtompeg/rgbtoycc.c
index 766b8902..2dd1899a 100644
--- a/converter/ppm/ppmtompeg/rgbtoycc.c
+++ b/converter/ppm/ppmtompeg/rgbtoycc.c
@@ -84,11 +84,11 @@ compute_mult_tables(const pixval maxval) {
         if (mult299 == NULL || mult587 == NULL || mult114 == NULL ||
             mult16874 == NULL || mult33126 == NULL || mult5 == NULL ||
             mult41869 == NULL || mult08131 == NULL) 
-            pm_error("Unable to allocate storage for arithmetic tables.\n"
+            pm_error("Unable to allocate storage for arithmetic tables.  "
                      "We need %d bytes, which is the maxval of the input "
-                     "image, plus 1,\n"
+                     "image, plus 1, "
                      "times the storage size of a floating point value.", 
-                     8 * (table_maxval+1)*sizeof(float));
+                     (unsigned)(8 * (table_maxval+1)*sizeof(float)));
 
         {
             int index;
diff --git a/converter/ppm/ppmtompeg/specifics.c b/converter/ppm/ppmtompeg/specifics.c
index 38e8fc43..fb5e3649 100644
--- a/converter/ppm/ppmtompeg/specifics.c
+++ b/converter/ppm/ppmtompeg/specifics.c
@@ -46,28 +46,26 @@
 #include <stdio.h>
 #include <string.h>
 #include "prototypes.h"
+#include "param.h"
 
 /*==================*
  * GLOBAL VARIABLES *
  *==================*/
 
-extern boolean specificsOn;
-extern char specificsFile[];
-extern char specificsDefines[];
 FrameSpecList *fsl;
 
 /*=====================*
  * Internal procedures *
  *=====================*/
 
-void Parse_Specifics_File _ANSI_ARGS_((FILE *fp));
-void Parse_Specifics_File_v1 _ANSI_ARGS_((FILE *fp));
-void Parse_Specifics_File_v2 _ANSI_ARGS_((FILE *fp));
-FrameSpecList *MakeFslEntry _ANSI_ARGS_((void));
-void AddSlc _ANSI_ARGS_((FrameSpecList *c,int snum, int qs));
-Block_Specifics *AddBs _ANSI_ARGS_((FrameSpecList *c,int bnum, 
-				    boolean rel, int qs));
-FrameSpecList *MakeFslEntry _ANSI_ARGS_((void));
+void Parse_Specifics_File (FILE *fp);
+void Parse_Specifics_File_v1 (FILE *fp);
+void Parse_Specifics_File_v2 (FILE *fp);
+FrameSpecList *MakeFslEntry (void);
+void AddSlc (FrameSpecList *c,int snum, int qs);
+Block_Specifics *AddBs (FrameSpecList *c,int bnum, 
+				    boolean rel, int qs);
+FrameSpecList *MakeFslEntry (void);
 #define my_upper(c) (((c>='a') && (c<='z')) ? (c-'a'+'A') : c)
 #define CvtType(x) ReallyCvt(my_upper(x))
 #define ReallyCvt(x) (x=='I' ? 1 : (x=='P')?2: ((x=='B')?3:-1))
@@ -91,7 +89,7 @@ version N
   Specify the version of the specifics file format (this is 1)
 frame N T M
   Sets frame number N to type T and Qscale M
-  (type T is I,B,P,other, other means unspec.  I recomend - )
+  (type T is I,B,P,other, other means unspec.  I recommend - )
 slice M Q
   Sets slice M (in frame N as defined by a previous frame command)
   to qscale Q
@@ -559,7 +557,7 @@ int start_qs;
       } else {
 	/* if not next, check from the start.
 	   (this allows people to put frames out of order,even
-	   though the spec doesnt allow it.) */
+	   though the spec doesn't allow it.) */
 	tmp = fsl;
 	found_it = FALSE;
 	while (tmp != (FrameSpecList *) NULL) {