home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 August
/
Chip_2004-08_cd2.bin
/
prevodniky
/
download
/
AVI2MPG
/
avi2mpg1.exe
/
PARAM.TXT
< prev
next >
Wrap
Text File
|
1997-07-21
|
13KB
|
321 lines
The contents of this file were edited from the original MSSG
ditribution. The parameter file is a subset of the MSSG version
since avi2mpg1 only generates MPEG-1, and since many of the
encoding parameters can be determined from the avi file format.
The file "TEMPLATE.PAR" should be used as a template for any
changes. TEMPLATE.PAR contains the same parameters that are used
by default by avi2mpg1 if no parameter file is specified. The main
use of a parameter file will probably be to experiment with different
motion etsimation search vectors.
DO NOT ADD OR DELETE LINES FROM THE PARAMETER FILE, the input
routines depend on the exact ordering of the parameter lines!
Use the template.par provided and edit the given parameters.
The first line of the parameter file is a comment which is inserted near
the beginning of the MPEG bitstream as a user_data field, and can be
used for arbitrary purposes.
The remaining lines are described below:
/* name of intra quant matrix file ("-": default matrix) */
Setting this to a value other than - specifies a file containing
a custom intra quantization matrix to be used instead of the default
matrix specified in ISO/IEC 13818-2 and 11172-2. This file has to contain
64 integer values (range 1...255) separated by white space (blank, tab,
or newline), one corresponding to each of the 64 DCT coefficients. They
are ordered line by line, i.e. v-u frequency matrix order (not by the
zig-zag pattern used for transmission). The file intra.mat contains the
default matrix as a starting point for customization. It is neither
necessary or recommended to specify the default matrix explicitly.
Large values correspond to coarse quantization and consequently more
noise at that particular spatial frequency.
For the intra quantization matrix, the first value in the file (DC value)
is ignored. Use the parameter intra_dc_precision (see below) to define
the quantization of the DC value.
/* name of non intra quant matrix file ("-": default matrix) */
This parameter field follows the same rules as described for the above
intra quant matrix parameter, but specifies the file for the NON-INTRA
coded (predicted / interpolated) blocks. In this case the first
coefficient of the matrix is NOT ignored.
The default matrix uses a constant value of 16 for all 64 coefficients.
(a flat matrix is thought to statistically minimize mean square error).
The file inter.mat contains an alternate matrix, used in the MPEG-2 test
model.
/* timecode of first frame */
This line is used to set the timecode encoded into the first 'Group of
Pictures' header. The format is based on the SMPTE style:
hh:mm:ss:ff (hh=hour, mm=minute, ss=second, ff=frame (0..picture_rate-1)
/* N (# of frames in GOP) */
This defines the distance between I frames (and 'Group of Pictures'
headers). Common values are 15 for 30 Hz video and 12 for 25 Hz video.
/* M (I/P frame distance) */
Distance between consecutive I or P frames. Usually set to 3.
N has to be a multiple of M. M = 1 means no B frames in the sequence.
(in a future edition of this program, M=0 will mean only I frames).
/* aspect_ratio_information */
Defines the display aspect ratio. Legal values are:
Code Meaning
---- --------------
1 square pels
2 4:3 display
3 16:9 display
4 2.21:1 display
MPEG-1 uses a different coding of aspect ratios. In this cases codes
1 to 14 are valid.
/* vbv_buffer_size (in multiples 16 kbit) */
Specifies, according to the Video Buffering Verifier decoder model,
the size of the bitstream input buffer required in downstream
decoders in order for the sequence to be decoded without underflows or
or overflows. You probably will wish to leave this value at
20 for Constrained Parameters Bitstreams MPEG-1.
/* constrained_parameters_flag */
You may set this to 1 if you encode an MPEG-1
sequence which meets the parameter limits defined in ISO/IEC 11172-2
for constrained parameter bitstreams:
horizontal_size <= 768
vertical_size <= 576
picture_area <= 396 macroblocks
pixel_rate <= 396x25 macroblocks per second
vbv_buffer_size <= 20x16384 bit
bitrate <= 1856000 bits/second
motion vector range <= -64...63.5
/* Profile ID */
Specifies the subset of the MPEG-2 syntax required for decoding the
sequence. All MPEG-2 sequences generated by the current version of
the encoder are either Main Profile or Simple Profile sequences.
Code Meaning Typical use
---- -------------------------- ------------------------
1 High Profile production equipment requiring 4:2:2
2 Spatially Scalable Profile Simulcasting
3 SNR Scalable Profile Simulcasting
4 Main Profile 95 % of TVs, VCRs, cable applications
5 Simple Profile Low cost memory, e.g. no B pictures
/* Level ID */
Specifies coded parameter constraints, such as bitrate, sample rate, and
maximum allowed motion vector range.
Code Meaning Typical use
---- --------------- -----------------------------------------------
4 High Level HDTV production rates: e.g. 1920 x 1080 x 30 Hz
6 High 1440 Level HDTV consumer rates: e.g. 1440 x 960 x 30 Hz
8 Main Level CCIR 601 rates: e.g. 720 x 480 x 30 Hz
10 Low Level SIF video rate: e.g. 352 x 240 x 30 Hz
/* video_format: 0=comp., 1=PAL, 2=NTSC, 3=SECAM, 4=MAC, 5=unspec. */
/* color_primaries */
Specifies the x, y chromaticity coordinates of the source primaries.
Code Meaning
---- -------
1 ITU-R Rec. 709 (1990)
2 unspecified
4 ITU-R Rec. 624-4 System M
5 ITU-R Rec. 624-4 System B, G
6 SMPTE 170M
7 SMPTE 240M (1987)
/* transfer_characteristics */
Specifies the opto-electronic transfer characteristic of the source picture.
Code Meaning
---- -------
1 ITU-R Rec. 709 (1990)
2 unspecified
4 ITU-R Rec. 624-4 System M
5 ITU-R Rec. 624-4 System B, G
6 SMPTE 170M
7 SMPTE 240M (1987)
8 linear transfer characteristics
/* matrix_coefficients */
Specifies the matrix coefficients used in deriving luminance and chrominance
signals from the green, blue, and red primaries.
Code Meaning
---- -------
1 ITU-R Rec. 709 (1990)
2 unspecified
4 FCC
5 ITU-R Rec. 624-4 System B, G
6 SMPTE 170M
7 SMPTE 240M (1987)
/* intra_dc_precision */
Specifies the effective precision of the DC coefficient in MPEG-2
intra coded macroblocks. 10-bits usually achieves quality saturation.
Code Meaning
---- -----------------
0 8 bit
1 9 bit
2 10 bit
3 11 bit
/* frame_pred_frame_dct (I P B) */
Setting this parameter to 1 restricts motion compensation to frame
prediction and DCT to frame DCT. You have to specify this separately for
I, P and B picture types.
/* q_scale_type (I P B) */
These flag sets linear (0) or non-linear (1) quantization scale type
for the three respective picture types.
/* intra_vlc_format (I P B) */
Selects one of the two variable length coding tables for intra coded blocks.
Table 1 is considered to be statistically optimized for Intra coded
pictures coded within the sweet spot range (e.g. 0.3 to 0.6 bit/pixel)
of MPEG-2.
Code Meaning
---- -----------------
0 table 0 (= MPEG-1)
1 table 1
/* alternate_scan (I P B) */
Selects one of two entropy scanning patterns defining the order in
which quantized DCT coefficients are run-length coded. The alternate
scanning pattern is considered to be better suited for interlaced video
where the encoder does not employ sophisticated forward quantization
(as is the case in our current encoder).
Code Meaning
---- -----------------
0 Zig-Zag scan (= MPEG-1)
1 Alternate scan
/* repeat_first_field */
If set to one, the first field of a frame is repeated after the second by
the display process. The exact function depends on progressive_sequence
and top_field_first. repeat_first_field is mainly intended to serve as
a signal for the Decoder's Display Process to perform 3:2 pulldown.
/* intra_slice refresh picture period (P factor) */
This value indicates the number of successive P pictures in which
all slices (macroblock rows in our encoder model) are refreshed
with intra coded macroblocks. This feature assists low delay mode
coding. It is currently not implemented.
/* rate control: r (reaction parameter) */
/* rate control: avg_act (initial average activity) */
/* rate control: Xi (initial I frame global complexity measure) */
/* rate control: Xp (initial P frame global complexity measure) */
/* rate control: Xb (initial B frame global complexity measure) */
/* rate control: d0i (initial I frame virtual buffer fullness) */
/* rate control: d0p (initial P frame virtual buffer fullness) */
/* rate control: d0b (initial B frame virtual buffer fullness) */
These parameters modify the behavior of the rate control scheme. Usually
set them to 0, in which case default values are computed by the encoder.
/* P: forw_hor_f_code forw_vert_f_code search_width/height */
/* B1: forw_hor_f_code forw_vert_f_code search_width/height */
/* B1: back_hor_f_code back_vert_f_code search_width/height */
/* B2: forw_hor_f_code forw_vert_f_code search_width/height */
/* B2: back_hor_f_code back_vert_f_code search_width/height */
This set of parameters specifies the maximum length of the motion
vectors. If this length is set smaller than the actual movement
of objects in the picture, motion compensation becomes ineffective
and picture quality drops. If it is set too large, an excessive
number of bits is allocated for motion vector transmission, indirectly
reducing picture quality, too.
All f_code values have to be in the range 1 to 9 (1 to 7 for MPEG-1),
which translate into maximum motion vector lengths as follows:
code range (inclusive) max search width/height
================================================
1 -8 ... +7.5 7
2 -16 ... +15.5 15
3 -32 ... +31.5 31
4 -64 ... +63.5 63
5 -128 ... +127.5 127
6 -256 ... +255.5 255
7 -512 ... +511.5 511
8 -1024 ... +1023.5 1023
9 -2048 ... +2047.5 2047
f_code is specified individually for each picture type (P,Bn), direction
(forward prediction, backward prediction) and component (horizontal,
vertical). Bn is the n'th B frame surrounded by I or P frames
(e.g.: I B1 B2 B3 P B1 B2 B3 P ...).
For MPEG-1 sequences, horizontal and vertical f_code have to be
identical and the range is restricted to 1...7.
P frame values have to be specified if N (N = # of frames in GOP) is
greater than 1 (otherwise the sequences contains only I frames).
M - 1 (M = distance between I/P frames) sets (two lines each) of values
have to specified for B frames. The first line of each set defines
values for forward prediction (i.e. from a past frame), the second
line those for backward prediction (from a future frame).
search_width and search_height set the (half) width of the window used
for motion estimation. The encoder currently employs exhaustive
integer vector block matching. Execution time for this algorithm depends
on the product of search_width and search_height and, too a large extent,
determines the speed of the encoder. Therefore these values have to be
chosen carefully.
Here is an example of how to set these values, assuming a maximum
motion of 10 pels per frame in horizontal and 5 pels per frame in
vertical direction and M=3 (I B1 B2 P):
search width / height:
forward hor. vert. backward hor. vert.
I -> B1 10 5 B1 <- P 20 10
I -> B2 20 10 B2 <- P 10 5
I -> P 30 15
f_code values are then selected as the smallest ones resulting in a range
larger than the search widths / heights:
3 2 30 15 /* P: forw_hor_f_code forw_vert_f_code search_width/height */
2 1 10 5 /* B1: forw_hor_f_code forw_vert_f_code search_width/height */
3 2 20 10 /* B1: back_hor_f_code back_vert_f_code search_width/height */
3 2 20 10 /* B2: forw_hor_f_code forw_vert_f_code search_width/height */
2 1 10 5 /* B2: back_hor_f_code back_vert_f_code search_width/height */