fame_encode_frame(3)

NAME
fame_encode_frame - encode a single frame

SYNOPSIS
#include <fame.h>

int fame_encode_frame(fame_context_t *context, fame_yuv_t *yuv, unsigned char *shape);

DESCRIPTION
fame_encode_frame() encodes a single uncompressed frame from yuv to a binary stream in buffer, according to initialization parameters and optionnaly previously encoded frames. Note that in the case of video sequences containing B frames, data may not be output instantaneously, but only once coding is made possible by providing the future reference frame. That is, for a "IBBPBBPBB" sequence, the first B picture encoded data will only be available once the first P frame has been sent to the encoder.

context is the context handle previously returned by fame_open

yuv is a pointer to the input frame. Currently, only YV12 planar format, also called YUV 4:2:0, is supported. The YV12 planar format consists in three plane, one for the Y (luminance) and two for the Cr and Cb (chrominance) components, the chrominance planes being subsampled by 2x2. These three planes are mapped linearly in memory:

           width
yuv ->  +=========+
        |         |
        |    Y    | height
        |         |
        +====+====+
        | Cr | height / 2
        +====+
        | Cb | height / 2
        +====+
       width / 2

The process of converting RGB pictures to YUV12 will not be detailled here.

shape represents the shape in case of video with arbitrary shape. It consists in a bitmap of width x height bytes, with 255 representing an opaque pixel and 0 representing a transparent pixel. Values between 0 and 255 are not supported yet. For rectangular video, this parameter must be set to NULL.

RETURN VALUE
fame_encode_frame returns the number of bytes written to buffer. As previously said above, when coding sequences containing B frames, zero can be a valid value.

BUGS
MMX arithmetic performs bad at quality > 95%. Encoding of B frames is not yet supported.

SEE ALSO
fame_open(3), fame_init(3), fame_close(3)