[ Previous | Next | Contents | Glossary | Home | Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference

UMSUMEncoder Object

The Ultimotion Matinee encoder object provides methods to compress video frames to the Ultimotion Matinee video format. It is presented in the class library for editing and format-conversion purposes. The object permits compression based on a quality factor. The latter can be used over a series of frames to control the average data rate.

To learn more about the UMSUMEncoder object, see:

For introductory information, see Video Codec Objects.

Enumeration Lists

To avoid name collision on defines, integer values have been captured as enumerated lists. The set of valid values from an enumerated list can vary with the application. The detailed method descriptions describe the valid or possible values for the specific use. The enumerated lists that are defined for this object are:

enum ReturnCode {
   Success, 
   Failure, 
   UnsupportedFormat, 
   UnsupportedAlgorithm, 
   OutOfRange, 
   Uninitialized, 
   OutOfMemory, 
   InvalidQualityFactor
   };
enum ImageFormat {
   YUV9, 
   RGB24 
   };
enum AlgorithmType {
   Symmetric, 
   Asymmetric 
   };
enum FrameType {
   IFrame, 
   DFrame 
   };

Type Definitions

The UMSUMEncoder object defines the following type definitions:

Method Descriptions

ReturnCode compress_frame_RC(in char *ImageFrame, in char *CompFrame, out long compressed_frame_size, in FrameType frame_type, in long initial_quality_factor, inout long final_quality_factor, in long length)

Description

This method compresses an input image into an Ultimotion Matinee compression format. The desired length value (in bytes) is used to control the expected bit rate of the algorithm. The actual buffer size allocated should be larger than this desired length. You can call the get_max_buffer_size method before compressing a frame to determine the worst-case buffer size requirements. The initial quality factor determines the starting point for the compression algorithm. By checking the returned quality factor and using a value that is slightly higher (higher quality) on subsequent calls, the frame compression time can be reduced. I frames are somewhat larger than delta frames and the desired length should be adjusted depending on the frame type requested.

Arguments
in char *ImageFrame Address of the start of the image data to be compressed.
in char *CompFrame Address of the start of the compressed frame.
out long compressed_frame_size Length, in bytes, of the compressed frame.
in FrameType frame_type Type of frame: I frame or delta frame.
in long initial_quality_factor Starting quality factor to be used as the initial value for compressing the frame. If the value results in a frame that is too large, the quality factor is changed by the software as it attempts to compress the file to the desired size. The valid range is 0 to 100 (lowest to highest quality).
inout long final_quality_factor Quality factor used to compress the frame.
in long length Desired average length of the compressed frame in bytes.
Return Values

Success

Failure

Uninitialized

InvalidQualityFactor

ReturnCode compress_frame_QF(in char *ImageFrame, in char *CompFrame, out long compressed_frame_size, in FrameType frame_type, in long QualityFactor)

Description

This method compresses an input image into an Ultimotion Matinee compression format. It uses the quality factor to control the amount of compression applied to the input data. You can call the get_max_buffer_size method before compressing a frame to determine the worst-case buffer size requirements. The frame_type variable can be used to specify whether the image is to be compressed as an I frame or delta frame. Each movie sequence must begin with an I frame.

Arguments
in char *ImageFrame Address of the start of the image data to be compressed.
in char *CompFrame Address of the start of the compressed frame.
out long compressed_frame_size Length, in bytes, of the compressed frame.
in FrameType frame_type Type of frame: I frame or delta frame.
in long QualityFactor A value between 0 and 100 that influences image quality. A higher value corresponds to a larger encoded frame size and higher image quality.
Return Values

Success

Failure

Uninitialized

InvalidQualityFactor

AlgorithmType get_algorithm()

Description

This method enables the application to query the setting of the encoder algorithm.

Return Values
AlgorithmType Possible values are Symmetric and Asymmetric.

ImageFormatIn get_image_format()

Description

This method enables the application to query the state of the input image format setting in the encoder.

Return Values

YUV9

RGB24

ReturnCode get_image_size(inout long width, inout long height)

Description

This method enables the application to query the settings for the input image size for the encoder.

Arguments
inout long width Current setting of the x dimension.
inout long height Current setting of the y dimension.
Return Values

Success

long get_max_buffer_size()

Description

The encoder calculates and returns a worst-case buffer size. You can use this value to determine the required size of the compressed image buffer.

Return Values

Specifies the maximum possible encoded image size in bytes, independent of quality or bit-rate settings.

ReturnCode get_subimage_size(inout long x_position, inout long y_position, inout long width, inout long height)

Description

This method enables the application to determine the settings for the subimage dimensions for the encoder.

Arguments
inout long x_position The offset, within the input image, to begin encoding in the x direction.
inout long y_position The offset, within the input image, to begin encoding in the y direction.
inout long width Number of pixels in x to encode; must be a multiple of 8.
inout long height Number of pixels in y to encode; must be a multiple of 8.
Return Values

Success

ReturnCode set_algorithm(in AlgorithmType algorithm_type)

Description

This method selects one of two possible encoding algorithms. The asymmetric format provides the highest quality encoding format. Currently, this is the only supported format.

Arguments
in AlgorithmType algorithm_type Possible values are Symmetric and Asymmetric.
Return Values

Success

UnsupportedAlgorithm

ReturnCode set_image_format(in ImageFormatIn ulti_image_format)

Description

This method sets the format of the input image data frames that the encoder accepts.

Arguments
in ImageFormatIn ulti_image_format Possible values are YUV9 and RGB24.

Format YUV9

A raster scan of 4 x 4 pixel regions, in which each region is of the format:

Y1, Y2, Y3, ..., Y16, U, V, (each element an 8-bit value)

The spatial region is defined as follows, where U and V represent average values over the 4x4 pixel region:

Y1    Y2    Y3    Y4
Y5     Y6  ....
 ..............
Y13   Y14  Y15  Y16

Format RGB24

A raster scan of pixels, in which each 32-bit pixel is in the following form:

Overlay : Red : Green : Blue   (8 bits per color component)
Return Values

Success

UnsupportedFormat

ReturnCode set_image_size(in long width, in long height)

Description

This method enables the application to specify the dimensions of the input image frame. The encoder truncates these to multiples of 8 by extracting a subimage starting at the upper left of the image.

Arguments
in long width Number of pixels in the x dimension.
in long height Number of pixels in the y dimension.
Return Values

Success

OutOfRange

OutOfMemory

ReturnCode set_subimage_size(in long x_position, in long y_position, in long width, in long height)

Description

This method enables a subimage within an image to be compressed. It does not need to be called if the full image is to be encoded. The offsets must be positive integer values, and the width and height must each be a multiple of 8. The set_image_size method must also be called to specify the actual input image size. The offsets are measured from the upper left corner of the original image (right is positive x, down is positive y).

Arguments
in long x_position The offset, within the input image, to begin encoding in the x direction.
in long y_position The offset, within the input image, to begin encoding in the y direction.
in long width Number of pixels in x to encode; must be a multiple of 8.
in long height Number of pixels in y to encode; must be a multiple of 8.
Return Values

Success

OutOfRange

OutOfMemory

For introductory information, see Video Codec Objects.


[ Previous | Next | Contents | Glossary | Home | Search ]