[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference
Indeo 2.1 Encoder
Ultimedia Services supports version 2.1 of Intel's Indeo codec. To learn more about using the Indeo Encoder, see:
For introductory information, see Programming with Video Codec Objects.
File Format
Indeo video is always embedded in Microsoft's AVI file format.
Algorithm Overview
The Indeo 2.1 codec is essentially RTV 2.1, with a different aspect ratio and embedded in a different file format (AVI instead of AVSS).
The three most common frame sizes for Indeo 2.1 are 160 x 120, 240 x180, and 320 x 240. On a square-pixel monitor, Indeo video displays correctly without the frame widening necessary with RTV 2.1 in AVSS.
In Ultimedia Services, the Indeo 2.1 codec is symmetric. The Indeo 2.1 encoder object supports the RGB24 and YUV9 input formats.
The major visual artifacts in Indeo 2.1 video are blurriness and double images at scene changes and in the presence of fast motion. The problems occur only in delta frames; the solution is to encode the offending frames as reference frames instead. In Ultimedia Services, the Indeo 2.1 encoder object automatically detects problematic frames, and changes a requested frame type from Delta to Reference if necessary.
Encoding Indeo 2.1 Video
To encode Indeo 2.1 video, do the following:
- Set up the source for the video.
- Create UMSAVIReadWrite and UMSIndeoEncoder 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 2.1 Encoder
The following tips provide important information for using the Indeo 2.1 encoder:
- The encoder rejects any frame or subimage dimension greater than 4096. Also, it truncates the dimensions of the area to be encoded to multiples of 8.
- A PeriodRef frame is just a Reference frame with one extra bit set in its initial header. It is intended for reference frames that occur at a set period, for example, every 15 frames.
- 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 or PeriodRef frame.
- 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.
- To avoid double images and blurriness, the compress_frame_QF and compress_frame_RC methods can change a requested frame type from Delta to Reference; they return the final frame type to the calling application.
- Each Indeo 2.1 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 2.1 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.
- The Indeo 2.1 encoder object has eight internal quality levels. These are mapped to the range 0 to 100.
- The encoder supports the RGB24 and YUV9 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 ]