The UMSH263Encoder object provides methods to compress video frames to the H.263 video format.
To learn more about the UMSH263Encoder object, see:
For introductory information, see Video Codec Objects.
enum ReturnCode { Success, // Command completed successfully Failure, // Bad parameter or execution failure UnsupportedFormat, // Input image format not supported OutOfRange, // Bad parameter value Uninitialized, // Uninitialized internal state variable OutOfMemory, // Failure allocating internal memory UnsupportedValue, // Parameter value not supported ModeNotSupported // Requested mode not supported };
enum ImageFormatIn { YUVPlanar, // YUV 4:2:0 planar (Y plane, U plane, V plane) YUV422, // YUV 4:2:2 interleaved format RGB24, // 32-bits per pixel; pixel is 0RGB BGR24 // 32-bits per pixel; pixel is 0BGR };
enum FrameType { FIRST, // First frame of the sequence INTER, // Inter-frame INTRA // Intra-frame };
enum FrameRate { R_3, // Target rate of 3 frames per second R_5, // Target rate of 5 frames per second R_10, // Target rate of 10 frames per second R_15, // Target rate of 15 frames per second R_30 // Target rate of 30 frames per second };
enum RateControl { ON, // Enable bit rate control OFF // Disable bit rate control };
enum PBFrameMode { PB_ON, // Enable PB Frame mode PB_OFF // Disable PB Frame mode };
enum UnrestrictedMVMode { MV_ON, // Enable unrestricted motion vector range MV_OFF // Disable unrestricted motion vector range };
enum ArithmeticCodingMode { AC_ON, // Enable arithmetic coding AC_OFF // Disable arithmetic coding };
enum AdvancedPredictionMode { AP_ON, // Enable advanced prediction AP_OFF // Disable advanced prediction };
enum PacketMode { ModeA, // RTP 263 Payload Mode A ModeB, // RTP 263 Payload Mode B ModeC // RTP 263 Payload Mode C };
enum ImageSize { SQCIF, // 128 x 96 pixels QCIF, // 176 x 144 pixels CIF, // 352 x 288 pixels CIF_4, // 704 x 576 pixels CIF_16 // 1408 x 1152 pixels };
Set the input image format. The options are YUVPlanar, YUV422, PadRGB24 and PadBGR24.
in ImageFormatIn image_format | The input image format of the data to be compressed. |
Get the input image format setting.
inout ImageFormatIn image_format | A pointer to the ImageFormatIn variable to hold the current setting for the input image format. |
Set the input image dimensions. Currently, only SubQCIF, QCIF, and CIF are supported.
in long width | The width in pixels. |
in long height | The height in pixels. |
Get the current input image dimensions.
inout long width | A pointer to the width in pixels. |
inout long height | A pointer to the height in pixels. |
The encoder can, when packet_size is set to a non-zero value, partition the compressed frames into chunks that may be sent as a series of packets. This method sets the maximum size of the packets. This feature is turned off by setting the size value to zero.
in long packet_size | A long variable that specifies the packet size in bytes. |
Get the packet size setting. If this value is zero (default), then the encoder does not determine packet boundaries.
inout long packet_size | A pointer to the long variable to hold the current setting for the packet size. |
Set the target frame rate. The target frame and the bit_rate are used by the encoder for rate control. The target frame rate is a maximum rate that the encoder attempts to achieve, while staying at or below the target bit rate.
in FrameRate frame_rate | An enum variable that specifies the target frame rate. |
Get the current input frame rate setting.
inout FrameRate frame_rate | A pointer to an enum variable to hold the current setting for the frame rate. |
Enable or disable the bit rate control. If rate control is turned off, the bit rate setting is ignored.
in RateControl rc_state | An enum variable that enables or disables the rate control. |
Get the setting of the rate control state.
inout RateControl rc_state | A pointer to an enum variable to hold the current setting for the rate control state. |
Set the average bit rate, in bits per second, for the compressed data stream.
in long bits_per_second | A long variable that sets the average bit rate for the compressed data stream. |
Get the current setting for the compressed data rate.
inout long bits_per_second | A pointer to a long variable to hold the current setting for the bit rate. |
Set the maximum motion displacement, in unit of pixels. The maximum setting is 31.
inout long displacement | A pointer to a long variable that sets the maximum pixel displacement used in the motion vector search algorithm. |
Get the current setting for the maximum motion displacement.
inout long displacement | A pointer to a long variable to hold the current setting for the motion displacement. |
Set the maximum quantization value. A larger number indicates a bigger step size and lower image quality. This value is a maximum possible value; the actual values used may be lower depending on the image content and bit rate setting.
inout long max_quantization_value | A pointer to a long variable that sets the maximum quantization value used by the encoder. |
Get the current setting for the maximum image quantization.
inout long max_quantization_value | A pointer to a long variable to query the current setting for the maximum quantization value. |
Enable one or more of the advanced encoder modes. Currently none of these advanced modes are supported.
Get the current advanced mode setting.
Get the maximum compressed buffer size for the current input image size, in bytes.
inout long buffer_size | A pointer to a long variable to query the maximum output buffer size needed for a compressed frame. |
Enable the appropriate RTP Payload type. Currently only payload mode A is supported.
in PacketMode packet_mode | An enum variable that specifies the H.263 payload mode. |
Query the current setting for the RTP payload mode.
inout PacketMode packet_mode | A pointer to an enum variable that holds the payload mode. |
Read packet information until packet length equals zero. This method must be called after compress_frame and all information must be read before next call to compress_frame.
Compress the input image frame to a compressed frame, either I-frame (type setting INTRA), P-frame (type setting INTER), or if advanced PB frame is set, a PB-frame (type setting INTER).
The frame_incr value returned by the encoder informs the application how many input image frames should be skipped before calling the compress_frame method again. The frame_incr value only needs to be checked if rate control is ON.
For introductory information, see Video Codec Objects.