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

UMSJPEGEncoder Object

The JPEG encoder object provides methods to compress video frames to the JPEG image formats. It is presented in the class library for editing and format-conversion purposes. The object permits compression based on a quality factor.

To learn more about the UMSJPEGEncoder 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,
      InvalidSubimage,
      InvalidImageSize,
      Uninitialized,
      InvalidQualityFactor
      };
enum ImageFormatIn {
      RGB24,
      Mono8,
      RGB
      };
enum SubsampleDirection {
      NoSubsampling,
      Vertical,
      Horizontal,
      HorizontalVertical
      };

Type Definitions

The JPEG encoder object defines the following type definitions:

Method Descriptions

ReturnCode compress_frame(in char *image_frame, in char *comp_frame)

Description

This method accepts an image frame and produces a JPEG compressed image.

Note: The compress_frame_seq method is preferred to the compress_frame method because it provides the same method using sequence parameters rather than pointer parameters. This allows the object to be used in distributed applications written with DSOM.
Arguments
in char *image_frame Pointer to the start of the image data.
in char *comp_frame Pointer to the start of the compressed frame data.
Return Values

Success

Failure

ReturnCode compress_frame_seq(in ImageFrame image_frame, inout CompressedFrame comp_frame)

Description

This method accepts an image frame and produces a JPEG compressed image. This method is similar to the compress_frame method. However, this method is preferred because the buffers are specified as sequences instead of as pointers.

Arguments
in ImageFrame image_frame The image data is passed in as an ImageFrame sequence of octets.
inout CompressedFrame comp_frame The compressed frame is returned as a CompressedFrame sequence of octets.
Return Values

Success

Failure

long get_comp_frame_size()

Description

This method allows the application to query the size of the compressed image.

Return Values

The return value is the number of bytes in the compressed image.

ImageFormatIn get_image_format()

Description

This method allows the application to query the current image format.

Return Values

Mono8

RGB24

RGB

ReturnCode get_image_size(inout long width, inout long height)

Description

This method allows the application to query the current image size.

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

Success

Uninitialized

long get_quality_factor()

Description

This method allows the application to query the current quality factor.

Return Values

The return value is the current quality factor setting. Valid values are between 0 and 100.

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

Description

This method allows the application to query the current sub-image parameters.

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.
inout long height Number of pixels in y to encode.
Return Values

Success

Uninitialized

ReturnCode set_image_format(in ImageFormatIn image_format)

Description

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

Arguments
in ImageFormatIn image_format Possible values are Mono8, RGB24, and RGB.
Return Values

Success

UnsupportedFormat

ReturnCode set_image_size(in long width, in long height)

Description

This method allows the application to specify the dimensions of the input image frame.

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

Success

Failure

ReturnCode set_quality_factor(in long factor)

Description

The quality factor enables you to trade off compressed file size against quality of the reconstructed image. The higher the factor setting, the larger the JPEG compressed frame and the better the quality. The range of the factor is between 0 and 100.

Arguments
in long factor The quality factor of JPEG compression.
Return Values

Success

InvalidQualityFactor

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

Description

This method allows a subframe within an image to be compressed. This method does not need to be called if the full image is to be encoded. The offsets must be non-negative integer values. The set_image_size method must also be called to specify the actual input image size.

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.
in long height Number of pixels in y to encode.
Return Values

Success

InvalidSubimage

ReturnCode set_subsample(in SubsampleDirection key)

Description

For color images, the red, green, and blue (RGB) input image components are converted to Y, U, and V (YUV) components before compression. This method provides subsampling of the chrominance components before compression. Calling this method with the Horizontal or Vertical argument causes the chrominance to be subsampled by a factor of two in the horizontal or vertical direction. If the HorizontalVertical argument is used, subsampling takes place in both directions. If the argument NoSubsampling is used, the chrominance components are not subsampled.

Arguments
in SubsampleDirection key The directions of subsampling. Possible values are NoSubsampling, Vertical, Horizontal, and HorizontalVertical.
Return Values

Success

For introductory information, see Video Codec Objects.


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