[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference
Indeo 3.2 Encoder
Ultimedia Services supports version 3.2 of Intel's Indeo video codec. To learn more about using the Indeo 3.2 encoder, see:
For introductory information, see Programming with Video Codec Objects.
File Format
Indeo 3.2 video is always embedded in Microsoft's AVI file format.
Algorithm Overview
The Indeo 3.2 codec is a much more advanced codec than the Indeo 2.1 codec. Indeo 3.x and Indeo 2.1 formats are incompatible.
Common frame sizes for Indeo 3.2 video are 160 x 120, 240 x 180, 320 x 240, and 640 x 480. In fact, an Indeo 3.2 encoder, such as the UMSIndeo3Encoder here, must be able to encode video with dimensions that are arbitrary multiples of 4, between 16 x 16 and 640 x 480.
Note that an Indeo 3.2 decoder decodes all files generated by Indeo 3.0 and 3.1 encoders, but an earlier version of the decoder does not decode Indeo 3.2 files. The UMSIndeo3VideoDecoder object has been updated to handle Indeo 3.2 video.
The Indeo 3.2 codec is highly asymmetric. The decoder is very fast, producing smooth video, while the encoder takes on the order of a second per frame. The actual times depend on the particular workstation used.
The UMSIndeo3Encoder object supports the RGB, YUV9, and YVU9 formats. YUV9 is Ultimedia Services' interleaved YUV format; YVU9 is Intel's planar YUV frame format, which is used with Microsoft's AVI file format.
In both Indeo 2.1 video and Indeo 3.2 video, the chrominance components U and V are subsampled by 4:1 in both directions relative to the luminance component Y. Therefore, both codecs exhibit blurriness and color smudging around the edges of objects. However, the Indeo 3.2 codec handles motion much better than the Indeo 2.1 codec.
For an Indeo 3.2 encoder with YVU9 input, the compression ratio is usually between 5:1 and 10:1.
Encoding Indeo 3.2 Video
To encode Indeo 3.2 video, do the following:
- Set up the source for the video.
- Create UMSAVIReadWrite and UMSIndeo3Encoder objects.
- Open an AVI file for writing, and write the necessary headers.
- Set the format of the input frames with the encoder's set_image_format method.
- Set the size of the input frames with the encoder's set_image_size method.
- Optionally, call the encoder's set_subimage_size method to encode only a subimage of each frame.
- Call the encoder's get_max_buffer_size method to get the size of the buffers for the compressed frames.
- Allocate memory for the input and output buffers, and insert them into SOM sequences.
- To compress a frame with a given quality factor, call the encoder's compress_frame_QF method.
- To compress a frame to within a requested maximum compressed size, call the encoder's compress_frame_RC method (RC = rate control).
When the video has been encoded, close the file, free all buffers, and destroy the objects with _somFree.
Tips for Using the Indeo 3.2 Encoder
The following tips provide important information for using the Indeo 3.2 encoder:
- The width of the frame or subframe to be encoded should be between 16 and 640; the height should be between 16 and 480. The UMSIndeo3Encoder object truncates the dimensions of the area to be encoded to multiples of 4.
- The application controls whether a frame is compressed as a
- reference frame or a delta frame; it does this by way of the
- frame_type parameter in the compress_frame_QF and
- compress_frame_RC methods. Always compress the first frame of a new video clip as a Reference frame. The period between Reference frames should be at most 15 frames.
- An application can set a quality factor that ranges from 0 (worst
- quality) to 100 (highest quality). It does this by way of the
- initial_quality_factor parameter in the compression methods.
- The encoder returns the quality factor it actually used in the
- final_quality_factor parameter. When using the
- compress_frame_RC method for bit-rate-controlled
- encoding, the application can speed up the encoding by
- using the final_quality_factor value from the previous frame
- as the initial_quality_factor value for the current frame.
- Each Indeo 3.2 frame has a frame number in its header. This
- counts the number of frame intervals since the start of the clip.
- This allows an Indeo 3.2 encoder to skip input frames if it gets
- behind. For results that are visually pleasing, the frame-skipping should be periodic. For example, the encoder should compress
- every nth input frame for some small value of n.
- When the compress_frame_QF method is used, the UMSIndeo3Encoder object has many discrete quality levels, which are mapped to the range 0 to 100. When the compress_frame_RC method is used, the initial_quality_factor and final_quality_factor variables can vary continuously between 0 and 100.
- The encoder object supports the RGB24, YUV9 (interleaved) and YVU9 (planar) formats. The default settings for the encoder are:
input format |
RGB24 |
frame width |
0 |
frame height |
0 |
subimage width |
0 |
subimage height |
0 |
subimage position |
(0, 0) |
For introductory information, see Programming with Video Codec Objects.
[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]