home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / graphics / mpgcodec.zip / MAKEMPG.TXT < prev    next >
Text File  |  1993-06-09  |  3KB  |  115 lines

  1. Hi All you Eager MPEG Makers, here is how to port the PVRG MPEG
  2. encoder/decoder to DOS/PC (386).
  3.  
  4. Tools required:
  5.     Well the ones that I used.
  6.  
  7.         GNU C version 2.2.2
  8.         GREP or some other file search util
  9.         An uncompress util for UNIX .Z files
  10.         An untar for UNIX tar files
  11.         Text Editor (sorry some code needs tweaked)
  12.  
  13. Source required:
  14.         /pub/mpeg/MPEGv1.1.tar.Z
  15.             from havefun.stanford.edu
  16.  
  17.         /pub/mpeg/MPEGDOCv1.1.tar.Z
  18.             from havefun.stanford.edu
  19.  
  20. Step 1
  21.     Decompress the .Z files
  22.  
  23. Step 2 
  24.     Untar the resulting tar files.
  25.     Note that 2 of the file names won't fit in the DOS 8 and 3 name format:
  26.         transform.c truncates to transfor.c
  27.         prototype.h truncates to prototyp.h
  28.  
  29. Step 3
  30.     Search the C files for fopen and alter the mode to binary. The 2
  31.     sections below were produced by GREP.
  32.  
  33.     BEFORE
  34.     *** FILE mem.c:
  35.       if ((inp = fopen(filename,"r")) == NULL)
  36.       if ((inp = fopen(filename,"r")) == NULL)
  37.       if ((out = fopen(filename,"w")) == NULL)
  38.       if ((out = fopen(filename,"w")) == NULL)
  39.  
  40.     *** FILE mpeg.c:
  41.           if ((test = fopen(CFrame->ComponentFileName[i],"r")) == NULL)
  42.       
  43.     *** FILE stream.c:
  44.       if ((srin = fopen(filename,"r")) == NULL)
  45.       if ((swout = fopen(filename,"w+")) == NULL)
  46.     
  47.     AFTER
  48.     *** FILE mem.c:
  49.     if ((inp = fopen(filename,"rb")) == NULL)
  50.     if ((inp = fopen(filename,"rb")) == NULL)
  51.     if ((out = fopen(filename,"wb")) == NULL)
  52.     if ((out = fopen(filename,"wb")) == NULL)
  53.  
  54.     *** FILE mpeg.c:
  55.           if ((test = fopen(CFrame->ComponentFileName[i],"rb")) == NULL)
  56.  
  57.     *** FILE stream.c:
  58.     if ((srin = fopen(filename,"rb")) == NULL)
  59.     if ((swout = fopen(filename,"wb+")) == NULL)
  60.     
  61. Step 4
  62.  
  63.     This is an odd one and may only be needed for GNU C v 2.2.2. The file
  64.     lexer.c uses the rint function (round to nearest integer), my copy of
  65.     GNU C has rint in the math header but not in the object library ? So
  66.     my fix is to use floor(x+0.5) instead. Search lexer.c for R_ROUND until
  67.     you see the BEFORE section below and edit it to look like the AFTER
  68.     section.
  69.  
  70.     BEFORE
  71.     
  72.     case R_ROUND:
  73.       accum = *(--DataPtr);
  74.       *(DataPtr++) = rint(accum);
  75.       break;
  76.     
  77.     AFTER
  78.  
  79.     case R_ROUND:
  80.       accum = *(--DataPtr);
  81.       *(DataPtr++) = floor(accum+0.5);
  82.       break;
  83.     
  84. Step 5
  85.     Compile all 12 files to *.o using the following example command line 
  86.     GCC.
  87.  
  88.         GCC -O -c chendct.c
  89.  
  90.     Ignore the warning from lexer.c and tranfor.c about implicit
  91.     decleration.
  92.  
  93. Step 6
  94.     Link all the files together to form MPEG
  95.  
  96.     gcc lexer.o mpeg.o huffman.o transfor.o codec.o io.o marker.o
  97.          me.o mem.o stat.o stream.o chendct.o  -lgcc -lm -o mpeg
  98.     
  99.     Note all one line 
  100.  
  101. Step 7 
  102.     Create MPEG.EXE
  103.  
  104.     aout2exe mpeg mpeg.exe
  105.  
  106. Step 8
  107.     Use and enjoy and send me a mail message to let me know how you get on
  108.     and any mpegs that you create (I am broad minded !).
  109.  
  110.  
  111. Graham Logan
  112.  
  113. mitgml@dct.ac.uk
  114.  
  115.