mpeg2enc.doc
上传用户:hkgotone
上传日期:2013-02-17
资源大小:293k
文件大小:24k
源码类别:

Windows Mobile

开发平台:

C/C++

  1.                                  mpeg2encode
  2.                                  ===========
  3.                    MPEG-2 Video Encoder, Version 1.1, June 1994
  4.                         MPEG Software Simulation Group
  5.                              (MPEG-L@netcom.com)
  6. Contents:
  7. =========
  8. 1. Overview
  9. 2. Features and Limitations
  10. 3. Usage
  11. 4. Interpreting the status information
  12. 5. Description of the Encoder Model
  13. 6. References
  14. 1. Overview
  15. ===========
  16.   This is the second public release of our MPEG-2 encoder. It converts an
  17.   ordered set of uncompressed input pictures into a compressed bitstream
  18.   compliant with ISO/IEC 13818-2 DIS [1] (MPEG-2).
  19.   This program will evolve to become: ISO/IEC 13818-5 Software Simulation
  20.   of MPEG-2 Systems, Video, and Audio.
  21. 2. Features and Limitations
  22. ===========================
  23.  2.1 Features
  24.   - generates constant bit rate streams
  25.   - encoder model based on MPEG-2 test model 5 (TM5) rev. 2 [2]
  26.   - progressive and interlaced video
  27.   - also generates ISO/IEC 11172-2 (MPEG-1) sequences
  28.   - input formats: separate YUV, combined YUV, PPM
  29.   - trace and statistics output
  30.   - verifies user parameter settings are legal within Profile and Level
  31.  2.2 Current limitations
  32.   The encoder currently does not support
  33.   - scalable extensions
  34.   - MPEG-1 integer pel vectors (half-pel is typically 1 dB better anyway) 
  35.     and D frame sequences.
  36.   - checking for maximum number of generated bits per macroblock
  37.   - automatic 3:2 pulldown detection or irregular 3:2 pulldown signaling.
  38.   - intra refresh slices (e.g. low delay)
  39.   - concealment motion vectors 
  40.   - special low delay mode rate control
  41.   - editing of encoded video 
  42.   - variable bit rate encoding
  43.   - scene change rate control
  44.  
  45. 3. Usage
  46. ========
  47.   The execution template for the encoder is:
  48.       mpeg2encode parameter_file output.m2v
  49.   Coding parameters can be modified by editing the parameter_file. Since the
  50.   parser expects the operating parameters to be on certain line numbers, 
  51.   kindly do not insert or delete lines from the file.
  52.   We have provided a couple of sample parameter files in the par directory.
  53.   It is recommended to use the one closest to your application as a starting
  54.   point for customization.
  55.   The first line of the parameter file is a comment which is inserted near
  56.   the beginning of the MPEG bitstream as a user_data field, and can be 
  57.   used for arbitrary purposes.
  58.   The remaining lines are described below:
  59.  /* name of source frame files */
  60.   A printf format string defining the name of the input files. It has to
  61.   contain exactly one numerical descriptor (%d, %x etc.):
  62.   Example: frame%02d 
  63.   Then the encoder looks for files: frame00, frame01, frame02
  64.   The encoder adds an extension (.yuv, .ppm, etc.) which depends on the 
  65.   input file format. Input files have to be in frame format, containing 
  66.   two interleaved fields (for interlaced video).
  67.  /* name of reconstructed frame files */
  68.   This user parameter tells the encoder what name to give the reconstructed 
  69.   frames. These frames are identical to frame reconstructions of decoders 
  70.   following normative guidelines (except of course for differences caused by 
  71.   different IDCT implementation). Specifying a name starting with - (or just 
  72.   - by itself) disables output of reconstructed frames.
  73.   The reconstructed frames are always stored in Y,U,V format (see below),
  74.   independent of the input file format.
  75.  /* name of intra quant matrix file     ("-": default matrix) */ 
  76.   Setting this to a value other than  -  specifies a file containing
  77.   a custom intra quantization matrix to be used instead of the default 
  78.   matrix specified in ISO/IEC 13818-2 and 11172-2. This file has to contain 
  79.   64 integer values (range 1...255) separated by white space (blank, tab, 
  80.   or newline), one corresponding  to each of the 64 DCT coefficients. They 
  81.   are ordered line by line, i.e. v-u frequency matrix order (not by the 
  82.   zig-zag pattern used for transmission). The file intra.mat contains the 
  83.   default matrix as a starting point for customization. It is neither 
  84.   necessary or recommended to specify the default matrix explicitly.
  85.   Large values correspond to coarse quantization and consequently more
  86.   noise at that particular spatial frequency.
  87.   For the intra quantization matrix, the first value in the file (DC value)
  88.   is ignored. Use the parameter intra_dc_precision (see below) to define
  89.   the quantization of the DC value.
  90.     
  91.  /* name of non intra quant matrix file ("-": default matrix) */
  92.   This parameter field follows the same rules as described for the above 
  93.   intra quant matrix parameter, but specifies the file for the NON-INTRA 
  94.   coded (predicted / interpolated) blocks. In this case the first 
  95.   coefficient of the matrix is NOT ignored.    
  96.   The default matrix uses a constant value of 16 for all 64 coefficients.
  97.   (a flat matrix is thought to statistically minimize mean square error). 
  98.   The file inter.mat contains an alternate matrix, used in the MPEG-2 test
  99.   model.
  100.  /* name of statistics file */
  101.   Statistics output is stored into the specified file. - directs statistics
  102.   output to stdout.
  103.  /* input picture file format */ 
  104.   A number defining the format of the source input frames.
  105.   
  106.   Code  Format description
  107.   ----  ------------------------------------------------------------------
  108.   0     separate files for luminance (.Y extension), and chrominance (.U, .V)
  109.         all files are in headerless 8 bit per pixel format. .U and .V must 
  110.         correspond to the selected chroma_format (4:2:0, 4:2:2, 4:4:4, see
  111.         below).  Note that in this document, Cb = U, and Cr = V. This format
  112.         is also used in the Stanford PVRG encoder.
  113.   1     similar to 0, but concatenated into one file (extension .yuv).
  114.         This is the format used by the Berkeley MPEG-1 encoder.
  115.   2     PPM, Portable PixMap, only the raw format (P6) is supported.
  116.  /* number of frames */
  117.   This defines the length of the sequence in integer units of frames.
  118.  /* number of first frame */
  119.   Usually 0 or 1, but any other (positive) value is valid.
  120.  /* timecode of first frame */
  121.   This line is used to set the timecode encoded into the first 'Group of
  122.   Pictures' header. The format is based on the SMPTE style:
  123.   hh:mm:ss:ff (hh=hour, mm=minute, ss=second, ff=frame (0..picture_rate-1)
  124.  /* N (# of frames in GOP) */
  125.   This defines the distance between I frames (and 'Group of Pictures'
  126.   headers). Common values are 15 for 30 Hz video and 12 for 25 Hz video.
  127.  /* M (I/P frame distance) */
  128.   Distance between consecutive I or P frames. Usually set to 3.
  129.   N has to be a multiple of M.   M = 1 means no B frames in the sequence.
  130.   (in a future edition of this program, M=0 will mean only I frames).
  131.  /* ISO/IEC 11172-2 stream */
  132.   Set to 1 if you want to generate an MPEG-1 sequence. In this case some
  133.   of the subsequent MPEG-2 specific values are ignored.
  134.  /* picture format */
  135.   0 selects frame picture coding, in which both fields of a frame are coded
  136.   simultaneously, 1 select field picture coding, where fields are coded
  137.   separately. The latter is permitted for interlaced video only.
  138.  /* horizontal_size */
  139.   Pixel width of the frames. It does not need to be a multiple of 16. 
  140.   You have to provide a correct value even for PPM files (the PPM 
  141.   file header is currently ignored).
  142.  
  143.  /* vertical_size */
  144.   Pixel height of the frames. It does not need to be a multiple of 16. 
  145.   You have to provide a correct value even for PPM files (the PPM file 
  146.   header is currently ignored).
  147.  /* aspect_ratio_information */
  148.   Defines the display aspect ratio. Legal values are:
  149.   Code    Meaning
  150.   ----    --------------
  151.   1       square pels
  152.   2       4:3 display
  153.   3       16:9 display
  154.   4       2.21:1 display
  155.   MPEG-1 uses a different coding of aspect ratios. In this cases codes
  156.   1 to 14 are valid.
  157.  /* frame_rate_code */
  158.   Defines the frame rate (for interlaced sequences: field rate is twice 
  159.   the frame rate). Legal values are:
  160.   Code  Frames/sec    Meaning
  161.   ----  ----------    -----------------------------------------------
  162.   1     24000/1001    23.976 fps -- NTSC encapsulated film rate 
  163.   2     24            Standard international cinema film rate
  164.   3     25            PAL (625/50) video frame rate
  165.   4     30000/1001    29.97 -- NTSC video frame rate 
  166.   5     30            NTSC drop-frame (525/60) video frame rate
  167.   6     50            double frame rate/progressive PAL 
  168.   7     60000/1001    double frame rate NTSC
  169.   8     60            double frame rate drop-frame NTSC
  170.  /* bit_rate */
  171.   A positive floating point value specifying the target bitrate.
  172.   In units of bits/sec.
  173.  /* vbv_buffer_size (in multiples 16 kbit) */
  174.   Specifies, according to the Video Buffering Verifier decoder model,  
  175.   the size of the bitstream input buffer required in downstream 
  176.   decoders in order for the sequence to be decoded without underflows or 
  177.   or overflows.  You probably will wish to leave this value at 112 for
  178.   MPEG-2 Main Profile at Main Level, and 20 for Constrained Parameters
  179.   Bitstreams MPEG-1.
  180.  /* low_delay */
  181.   
  182.   When set to 1, this flag specifies whether encoder operates in low delay 
  183.   mode.  Essentially, no B pictures are coded and a different rate control 
  184.   strategy is adopted which allows picture skipping and VBV underflows.  
  185.   This feature has not yet been implemented. Please leave at zero for now.
  186.  /* constrained_parameters_flag */
  187.   Always 0 for MPEG-2. You may set this to 1 if you encode an MPEG-1 
  188.   sequence which meets the parameter limits defined in ISO/IEC 11172-2 
  189.   for constrained parameter bitstreams:
  190.     horizontal_size <= 768
  191.     vertical_size   <= 576
  192.     picture_area    <= 396 macroblocks
  193.     pixel_rate      <= 396x25 macroblocks per second
  194.     vbv_buffer_size <= 20x16384 bit
  195.     bitrate         <= 1856000 bits/second
  196.     motion vector range <= -64...63.5
  197.  /* Profile ID */
  198.   Specifies the subset of the MPEG-2 syntax required for decoding the 
  199.   sequence. All MPEG-2 sequences generated by the current version of 
  200.   the encoder are either Main Profile or Simple Profile sequences.
  201.   Code  Meaning                       Typical use
  202.   ----  --------------------------    ------------------------
  203.   1     High Profile                  production equipment requiring 4:2:2
  204.   2     Spatially Scalable Profile    Simulcasting 
  205.   3     SNR Scalable Profile          Simulcasting
  206.   4     Main Profile                  95 % of TVs, VCRs, cable applications
  207.   5     Simple Profile                Low cost memory, e.g. no B pictures
  208.  /* Level ID */
  209.   Specifies coded parameter constraints, such as bitrate, sample rate, and 
  210.   maximum allowed motion vector range.
  211.   Code  Meaning         Typical use
  212.   ----  --------------- -----------------------------------------------
  213.   4     High Level      HDTV production rates: e.g. 1920 x 1080 x 30 Hz
  214.   6     High 1440 Level HDTV consumer rates: e.g. 1440 x 960 x 30 Hz
  215.   8     Main Level      CCIR 601 rates: e.g. 720 x 480 x 30 Hz
  216.   10    Low Level       SIF video rate: e.g. 352 x 240 x 30 Hz
  217.  /* progressive_sequence */
  218.   
  219.   0 in the case of a sequences containing interlaced video (e.g. 
  220.   video camera source), 1 for progressive video (e.g. film source).
  221.  /* chroma_format */
  222.   Specifies the resolution of chrominance data
  223.   Code  Meaning
  224.   ----  ------- ----------------------------------------
  225.   1     4:2:0   half resolution in both dimensions (most common format)
  226.   2     4:2:2   half resolution in horizontal direction (High Profile only)
  227.   3     4:4:4   full resolution (not allowed in any currently defined profile)
  228.  /* video_format: 0=comp., 1=PAL, 2=NTSC, 3=SECAM, 4=MAC, 5=unspec. */
  229.  
  230.  /* color_primaries */
  231.   Specifies the x, y chromaticity coordinates of the source primaries.
  232.   Code   Meaning
  233.   ----   -------
  234.   1      ITU-R Rec. 709 (1990)
  235.   2      unspecified
  236.   4      ITU-R Rec. 624-4 System M
  237.   5      ITU-R Rec. 624-4 System B, G
  238.   6      SMPTE 170M
  239.   7      SMPTE 240M (1987)
  240.  /* transfer_characteristics */
  241.   Specifies the opto-electronic transfer characteristic of the source picture.
  242.   Code   Meaning
  243.   ----   -------
  244.   1      ITU-R Rec. 709 (1990)
  245.   2      unspecified
  246.   4      ITU-R Rec. 624-4 System M
  247.   5      ITU-R Rec. 624-4 System B, G
  248.   6      SMPTE 170M
  249.   7      SMPTE 240M (1987)
  250.   8      linear transfer characteristics
  251.  /* matrix_coefficients */
  252.   Specifies the matrix coefficients used in deriving luminance and chrominance
  253.   signals from the green, blue, and red primaries.
  254.   Code   Meaning
  255.   ----   -------
  256.   1      ITU-R Rec. 709 (1990)
  257.   2      unspecified
  258.   4      FCC
  259.   5      ITU-R Rec. 624-4 System B, G
  260.   6      SMPTE 170M
  261.   7      SMPTE 240M (1987)
  262.  /* display_horizontal_size */
  263.  /* display_vertical_size */
  264.   Display_horizontal_size and display_vertical_size specify the "intended
  265.   display's" active region (which may be smaller or larger than the
  266.   encoded frame size).
  267.  /* intra_dc_precision */
  268.   Specifies the effective precision of the DC coefficient in MPEG-2 
  269.   intra coded macroblocks. 10-bits usually achieves quality saturation.
  270.   Code    Meaning
  271.   ----    -----------------
  272.   0       8 bit
  273.   1       9 bit
  274.   2       10 bit
  275.   3       11 bit
  276.  /* top_field_first */
  277.   Specifies which of the two fields of an interlaced frame comes earlier.
  278.   The top field corresponds to what is often called the "odd field," and 
  279.   the bottom field is also sometimes called the "even field."   
  280.   Code  Meaning
  281.   ----  -----------------
  282.   0     bottom field first
  283.   1     top field first
  284.  /* frame_pred_frame_dct (I P B) */
  285.   Setting this parameter to 1 restricts motion compensation to frame 
  286.   prediction and DCT to frame DCT. You have to specify this separately for 
  287.   I, P and B picture types.
  288.  /* concealment_motion_vectors (I P B) */
  289.   
  290.   Setting these three flags informs encoder whether or not to generate 
  291.   concealment motion vectors for intra coded macroblocks in the 
  292.   three respective coded picture types.  This feature is mostly useful
  293.   in Intra-coded pictures, but may also be used in low-delay applications
  294.   (which attempts to exclusively use P pictures for video signal refresh, 
  295.   saving the time it takes to download a coded Intra picture across a 
  296.   channel). concealment_motion_vectors in B pictures are rather pointless 
  297.   since there is no error propagation from B pictures. This feature is 
  298.   currently not implemented.  Please leave values at zero.
  299.  /* q_scale_type (I P B) */
  300.   
  301.   These flag sets linear (0) or non-linear (1) quantization scale type 
  302.   for the three respective picture types.
  303.  /* intra_vlc_format (I P B) */
  304.   Selects one of the two variable length coding tables for intra coded blocks.
  305.   Table 1 is considered to be statistically optimized for Intra coded 
  306.   pictures coded within the sweet spot range (e.g. 0.3 to 0.6 bit/pixel)
  307.   of MPEG-2.
  308.   
  309.   Code  Meaning
  310.   ----  -----------------
  311.   0     table 0 (= MPEG-1) 
  312.   1     table 1
  313.  /* alternate_scan (I P B) */
  314.   Selects one of two entropy scanning patterns defining the order in 
  315.   which quantized DCT coefficients are run-length coded.  The alternate 
  316.   scanning pattern is considered to be better suited for interlaced video 
  317.   where the encoder does not employ sophisticated forward quantization 
  318.   (as is the case in our current encoder).
  319.   
  320.   Code  Meaning
  321.   ----  -----------------
  322.   0     Zig-Zag scan (= MPEG-1)
  323.   1     Alternate scan 
  324.  /* repeat_first_field */
  325.   If set to one, the first field of a frame is repeated after the second by
  326.   the display process. The exact function depends on progressive_sequence
  327.   and top_field_first.  repeat_first_field is mainly intended to serve as 
  328.   a signal for the Decoder's Display Process to perform 3:2 pulldown.
  329.  
  330.  /* progressive_frame */
  331.   Specifies whether the frames are interlaced (0) or progressive (1).
  332.   MPEG-2 permits mixing of interlaced and progressive video. The encoder
  333.   currently only supports either interlaced or progressive video.
  334.   progressive_frame is therefore constant for all frames and usually
  335.   set identical to progressive_sequence.
  336.  /* intra_slice refresh picture period (P factor) */
  337.    
  338.    This value indicates the number of successive P pictures in which  
  339.    all slices (macroblock rows in our encoder model) are refreshed 
  340.    with intra coded macroblocks.  This feature assists low delay mode
  341.    coding.  It is currently not implemented.
  342.  /* rate control: r (reaction parameter) */
  343.  /* rate control: avg_act (initial average activity) */
  344.  /* rate control: Xi (initial I frame global complexity measure) */
  345.  /* rate control: Xp (initial P frame global complexity measure) */
  346.  /* rate control: Xb (initial B frame global complexity measure) */
  347.  /* rate control: d0i (initial I frame virtual buffer fullness) */
  348.  /* rate control: d0p (initial P frame virtual buffer fullness) */
  349.  /* rate control: d0b (initial B frame virtual buffer fullness) */
  350.   These parameters modify the behavior of the rate control scheme. Usually
  351.   set them to 0, in which case default values are computed by the encoder.
  352.  /* P:  forw_hor_f_code forw_vert_f_code search_width/height */
  353.  /* B1: forw_hor_f_code forw_vert_f_code search_width/height */
  354.  /* B1: back_hor_f_code back_vert_f_code search_width/height */
  355.  /* B2: forw_hor_f_code forw_vert_f_code search_width/height */
  356.  /* B2: back_hor_f_code back_vert_f_code search_width/height */
  357.   This set of parameters specifies the maximum length of the motion
  358.   vectors. If this length is set smaller than the actual movement
  359.   of objects in the picture, motion compensation becomes ineffective
  360.   and picture quality drops. If it is set too large, an excessive
  361.   number of bits is allocated for motion vector transmission, indirectly
  362.   reducing picture quality, too.
  363.   All f_code values have to be in the range 1 to 9 (1 to 7 for MPEG-1),
  364.   which translate into maximum motion vector lengths as follows:
  365.   code  range (inclusive)  max search width/height
  366.   ================================================
  367.   1        -8 ...    +7.5       7
  368.   2       -16 ...   +15.5      15
  369.   3       -32 ...   +31.5      31
  370.   4       -64 ...   +63.5      63
  371.   5      -128 ...  +127.5     127
  372.   6      -256 ...  +255.5     255
  373.   7      -512 ...  +511.5     511
  374.   8     -1024 ... +1023.5    1023
  375.   9     -2048 ... +2047.5    2047
  376.   f_code is specified individually for each picture type (P,Bn), direction
  377.   (forward prediction, backward prediction) and component (horizontal,
  378.   vertical). Bn is the n'th B frame surrounded by I or P frames
  379.   (e.g.: I B1 B2 B3 P B1 B2 B3 P ...).
  380.   For MPEG-1 sequences, horizontal and vertical f_code have to be
  381.   identical and the range is restricted to 1...7.
  382.   P frame values have to be specified if N (N = # of frames in GOP) is
  383.   greater than 1 (otherwise the sequences contains only I frames).
  384.   M - 1 (M = distance between I/P frames) sets (two lines each) of values
  385.   have to specified for B frames. The first line of each set defines
  386.   values for forward prediction (i.e. from a past frame), the second
  387.   line those for backward prediction (from a future frame).
  388.   search_width and search_height set the (half) width of the window used
  389.   for motion estimation. The encoder currently employs exhaustive
  390.   integer vector block matching. Execution time for this algorithm depends
  391.   on the product of search_width and search_height and, too a large extent,
  392.   determines the speed of the encoder. Therefore these values have to be
  393.   chosen carefully.
  394.   Here is an example of how to set these values, assuming a maximum
  395.   motion of 10 pels per frame in horizontal and 5 pels per frame in
  396.   vertical direction and M=3 (I B1 B2 P):
  397.   search width / height:
  398.   forward  hor.  vert.     backward  hor.  vert.
  399.   I -> B1  10     5        B1 <- P   20    10
  400.   I -> B2  20    10        B2 <- P   10     5
  401.   I -> P   30    15
  402.   f_code values are then selected as the smallest ones resulting in a range
  403.   larger than the search widths / heights:
  404.   3 2  30 15 /* P:  forw_hor_f_code forw_vert_f_code search_width/height */
  405.   2 1  10  5 /* B1: forw_hor_f_code forw_vert_f_code search_width/height */
  406.   3 2  20 10 /* B1: back_hor_f_code back_vert_f_code search_width/height */
  407.   3 2  20 10 /* B2: forw_hor_f_code forw_vert_f_code search_width/height */
  408.   2 1  10  5 /* B2: back_hor_f_code back_vert_f_code search_width/height */
  409. 4. Interpreting the status information 
  410. ======================================
  411.  4.1 Description of the macroblock_type map
  412.   The status information routine prints a two-character code for 
  413.   each macroblock in the picture currently being coded:
  414.   First character:
  415.  S: skipped
  416.  I: intra coded
  417.  0: forward prediction without motion compensation
  418.  F: forward frame/16x8 prediction (in frame/field pictures resp.)
  419.  f: forward field prediction
  420.  p: dual prime prediction
  421.  B: backward frame/16x8 prediction
  422.  b: backward field prediction
  423.  D: frame/16x8 interpolation
  424.  d: field interpolation
  425.  Second character:
  426.  space: coded, no quantization change
  427.  Q:     coded, quantization change
  428.  N:     not coded (only predicted)
  429.  4.2 Description of the mquant map
  430.   The mquant map displays the dynamically changing quantization
  431.   parameter as determined by the rate control algorithm. Larger
  432.   values correspond to coarser quantization. Not displayed values
  433.   indicate same quantization as in the previous macroblock.
  434.   Note that for for MPEG-1 sequences the displayed values are twice
  435.   as large as the quant_scale parameter defined in ISO 11172-2.
  436. 5. Encoder model
  437. ================
  438.   The encoder model describes the "algorithm" or "intelligence" of the 
  439.   encoder.
  440.  5.1 Motion estimation
  441.  
  442.   Exhaustive search pattern with L1 (Minimum Absolute Difference) matching
  443.   criteria on the original (non-coded) reference frame.  Performed only
  444.   on luminance samples.  Half pel search is done on a neighborhood of 8
  445.   bi-linearly interpolated luminance samples from the reconstructed 
  446.   reference frame.
  447.  5.2 Rate control and adaptive quantization
  448.   The encoder adheres to a single-pass coding philosophy (no a priori
  449.   measurements guide the allocation of bits at the global layers).
  450.   Target bit allocation for the current picture being encoded is based
  451.   on global bit budget for the Group of Pictures (dependently coded
  452.   sequence of pictures), and a ratio of weighted relative coding
  453.   complexities of the three picture types.  Coding complexity (X) is
  454.   estimated as a picture's product of: average macroblock quantization
  455.   step size (Q) and the number of bits (S) generated by coding the picture
  456.   (e.g.   X = Q*S).
  457.   Local bit allocation is based on two measurements: 
  458.   1. deviancy from estimated buffer fullness for the Nth macroblock
  459.   2. normalized spatial activity
  460.   The picture is approximated and estimated to have a uniform distribution 
  461.   of bits. If the local trend of generated bits begin to stray from this 
  462.   estimation, a compensation factor emerges to modulate the macroblock 
  463.   quantization scale (mquant). The compensation factor is the difference 
  464.   between where the buffer fullness was predicted at the Nth macroblock 
  465.   and where the buffer fullness truly is) 
  466.   Local spatial activity is estimated as the minimum variance of the 
  467.   four luminance 8x8 frame blocks and the corresponding four luminance 8x8
  468.   field blocks of the original picture being coded.  The variance measure
  469.   is then normalized against the average variance of the most recently coded
  470.   picture.  The scaled product of the local activity measure and the buffer
  471.   compensation factor are combined to modify the final mquant value which
  472.   will be used in the quantization stage of the subsequent block coding
  473.   processes.
  474.  5.3 Decision
  475.   The macroblock decision process selects the various prediction
  476.   switches (yes/no coding of prediction error, yes/no motion 
  477.   compensation) which provide the best quality for the relative coding 
  478.   bit cost.  The decision process follows the piecewise path of least 
  479.   distortion, approximating that the decision stages (whether to use 
  480.   forwards, backwards compensation or none at all..., etc.) are mostly 
  481.   uncorrelated (i.e. can be independently decided).
  482.  5.4 Macroblock coding
  483.   
  484.   The forward DCT is based on the fast Chen-Wang 1984 algorithm.
  485.   Quantization is a mirror of the normative inverse quantizer, as
  486.   specified in the MPEG-2 Test Model.  No special dithering or
  487.   entropy-constrained methods are currently employed.
  488. 6. References
  489. =============
  490. [1] ISO/IEC 13818 Draft International Standard: Generic Coding of
  491.     Moving Pictures and Associated Audio, Part 2: video
  492. [2] Test Model 5, ISO/IEC JTC1/SC29/WG11/ N0400, MPEG93/457, April 1993.