Hi All you Eager MPEG Makers, here is how to port the PVRG MPEG
encoder/decoder to DOS/PC (386).

Tools required:
	Well the ones that I used.

		GNU C version 2.2.2
		GREP or some other file search util
		An uncompress util for UNIX .Z files
		An untar for UNIX tar files
		Text Editor (sorry some code needs tweaked)

Source required:
		/pub/mpeg/MPEGv1.1.tar.Z
			from havefun.stanford.edu

		/pub/mpeg/MPEGDOCv1.1.tar.Z
			from havefun.stanford.edu

Step 1
	Decompress the .Z files

Step 2 
	Untar the resulting tar files.
	Note that 2 of the file names won't fit in the DOS 8 and 3 name format:
		transform.c truncates to transfor.c
		prototype.h truncates to prototyp.h

Step 3
	Search the C files for fopen and alter the mode to binary. The 2
	sections below were produced by GREP.

	BEFORE
	*** FILE mem.c:
  	if ((inp = fopen(filename,"r")) == NULL)
  	if ((inp = fopen(filename,"r")) == NULL)
  	if ((out = fopen(filename,"w")) == NULL)
  	if ((out = fopen(filename,"w")) == NULL)

	*** FILE mpeg.c:
      	if ((test = fopen(CFrame->ComponentFileName[i],"r")) == NULL)
      
	*** FILE stream.c:
  	if ((srin = fopen(filename,"r")) == NULL)
  	if ((swout = fopen(filename,"w+")) == NULL)
	
	AFTER
	*** FILE mem.c:
	if ((inp = fopen(filename,"rb")) == NULL)
	if ((inp = fopen(filename,"rb")) == NULL)
	if ((out = fopen(filename,"wb")) == NULL)
	if ((out = fopen(filename,"wb")) == NULL)

	*** FILE mpeg.c:
      	if ((test = fopen(CFrame->ComponentFileName[i],"rb")) == NULL)

	*** FILE stream.c:
	if ((srin = fopen(filename,"rb")) == NULL)
	if ((swout = fopen(filename,"wb+")) == NULL)
	
Step 4

	This is an odd one and may only be needed for GNU C v 2.2.2. The file
	lexer.c uses the rint function (round to nearest integer), my copy of
	GNU C has rint in the math header but not in the object library ? So
	my fix is to use floor(x+0.5) instead. Search lexer.c for R_ROUND until
	you see the BEFORE section below and edit it to look like the AFTER
	section.

	BEFORE
	
	case R_ROUND:
	  accum = *(--DataPtr);
	  *(DataPtr++) = rint(accum);
	  break;
	
	AFTER

	case R_ROUND:
	  accum = *(--DataPtr);
	  *(DataPtr++) = floor(accum+0.5);
	  break;
	
Step 5
	Compile all 12 files to *.o using the following example command line 
	GCC.

		GCC -O -c chendct.c

	Ignore the warning from lexer.c and tranfor.c about implicit
	decleration.

Step 6
	Link all the files together to form MPEG

	gcc lexer.o mpeg.o huffman.o transfor.o codec.o io.o marker.o
		 me.o mem.o stat.o stream.o chendct.o  -lgcc -lm -o mpeg
	
	Note all one line 

Step 7 
	Create MPEG.EXE

	aout2exe mpeg mpeg.exe

Step 8
	Use and enjoy and send me a mail message to let me know how you get on
	and any mpegs that you create (I am broad minded !).


Graham Logan

mitgml@dct.ac.uk
 
