
Instructions:

To do the homework, you at least need to read carefully the 
first part. If you are interested, you can continue to read
the remaining parts.

1. Follow the following procedure to do the expriments:

   1) I have edited two batch files for your convenience:
     "enc_1m.bat" first genrates a 1Mbps MEPG-2 video stream 
   using raw video sequence in the directory ".\raw\", and 
   the output video stream will be stored as "test_1m.m2v". 
   The encoding parameters, including the target bit rate,
   are set using the parameter file "test_1m.par". More 
   descriptions on the usage of the encoder code can be found 
   in the 2nd section that follows.
   The video stream "test_1m.m2v" is then decoded, and the 
   reconstructed video frames are stored in the directory 
   ".\recon\".
   In the end the PSNR is calculated between the raw video
   sequence and the reconstructed video sequence, and the
   calculated PSNR values for all frames are stored in 
   a file called "psnr_1m.txt".

     "enc_2m.bat" does the same as "enc_1m.bat" except that 
   the encoding bit rate is 2Mbps, the video stream 
   produced is named "test_2m.m2v", the encoding
   parameter file is "test_2m.par", and the produced PSNR
   data file name is "psrn_2m.txt".

   Thus basically what you need to do is to just run the two 
   batch files "enc_1m.bat" and "enc_2m.bat" from command 
   line and see what they are doing. Then you may plot the 
   PSNR values at 1Mbps and 2Mbps using Matlab and see how
   much difference there is.

   2) I put a MPEG-2 video player in the ".\exe" directory:
      MEPG2PLAY.exe
      You might want to use it to view the encoded video streams.
      
      Just run it, and follow the menu commands.

   3) Note: The video sequence used is in CIF format (352x288), and
      it has 30 frames.


2. More on the encoder, decoder, and PSNR calculation tools:
  1) encoding
     encode parameter_file output_video_stream_file
     
     For example:
     To use a parameter file named "test_1m.par" to encode 
     a video stream called "test_1m.m2v", enter:
        encode test_1m.par test_1m.m2v

  2) decoding
     please run "decode.exe" without giving any command line 
     paramters to find how to use it.
    
     A sample is given as following, which is enough for the 
     purpose of this homework:
         decode -b test_1m.m2v -f -r -o0 .\recon\rec_1m%03d
     It takes video stream "test_1m.m2v", and stores the 
     reconstructed vdieo frames into the directory
     ".\recon\", using name format "rec_1m%03d", in (.Y, .U, .V) 
     format. Thus the reconstructed video frames will be 
             .\recon\rec_1m000.y, .\recon\rec_1m000.u, .\recon\rec_1m000.v, 
             .\recon\rec_1m001.y, .\recon\rec_1m001.u, .\recon\rec_1m001.v, 
             .\recon\rec_1m002.y, .\recon\rec_1m002.u, .\recon\rec_1m002.v, 
             ...                  ...                  ...
             etc.

  3) calculating the PSNR between raw (input video sequence) and 
     the reconstructed video sequence
     Note: PSNR usually is only calculated for Y (luminance) component.

     pleae run "psnr.exe" without giving any command line parameters to
     find how to use it.

     An example is given as follows:
          psnr -a 0 -b 29 -s raw\mcif%03d.y -r recon\rec_1m%03d.y


3. Directory list:
  ->exe :  executable files
           1. encode.exe:   mpeg2 video encoder
           2. mpeg2ply.exe: mpeg video decoder
           Note: Source code for the above two are downloadable from
           "http://www.mpeg.org/MSSG/".
 
           3. psnr.exe:     calculate PSNR for frames of two video sequences
           4. exstream.exe: mpeg2 to AVI converter, downloaded from 
           "http://www.download.com"
  
  ->raw: raw video sequence
  ->recon: stores the reconstructed video frames
  ->out: encoding statistics files

