daala 0.0-1185-g52bbd43-dirty
Experimental Daala video codec API reference.
|
The libdaala
C encoding API.
More...
Go to the source code of this file.
Macros | |
#define | _daala_daalaenc_H (1) |
Typedefs | |
Encoder state | |
The following data structure is opaque, and its contents are not publicly defined by this API. Referring to its internals directly is unsupported, and may break without warning. | |
typedef struct daala_enc_ctx | daala_enc_ctx |
The encoder context. | |
Functions for encoding | |
You must link to The functions are listed in the order they are used in a typical encode. The basic steps are:
| |
#define | OD_SET_QUANT 4000 |
Set the quantizer scale. | |
#define | OD_SET_COMPLEXITY 4002 |
Configure the encoder's computational complexity level. | |
#define | OD_GET_COMPLEXITY 4004 |
Get the encoder's computational complexity level. | |
#define | OD_SET_USE_ACTIVITY_MASKING 4006 |
Whether activity masking should be used or not. | |
#define | OD_SET_QM 4008 |
Which quantization matrix to use. | |
#define | OD_SET_USE_DERING 4010 |
Whether the bilinear postprocessing filter should be used or not. | |
#define | OD_SET_MC_USE_CHROMA 4100 |
Whether the motion compensation search should use the chroma planes in addition to the luma plane. | |
#define | OD_SET_MV_RES_MIN 4102 |
Minimum motion vectors resolution for the motion compensation search. | |
#define | OD_SET_MV_LEVEL_MIN 4104 |
Minimum motion vectors level for the motion compensation search. | |
#define | OD_SET_MV_LEVEL_MAX 4106 |
Maximum motion vectors level for the motion compensation search. | |
#define | OD_SET_MC_USE_SATD 4108 |
Whether the SATD metric should be used in motion compensation or not. | |
daala_enc_ctx * | daala_encode_create (const daala_info *info) |
Allocates and initializes an encoder instance. | |
int | daala_encode_ctl (daala_enc_ctx *enc, int req, void *buf, size_t buf_sz) |
Encoder control function. | |
int | daala_encode_flush_header (daala_enc_ctx *enc, daala_comment *comments, ogg_packet *op) |
Outputs the next header packet. | |
int | daala_encode_img_in (daala_enc_ctx *enc, od_img *img, int duration) |
Submits an uncompressed frame to the encoder. | |
int | daala_encode_packet_out (daala_enc_ctx *enc, int last, ogg_packet *op) |
Retrieves encoded video data packets. | |
void | daala_encode_free (daala_enc_ctx *enc) |
Frees an allocated encoder instance. | |
The libdaala
C encoding API.
#define OD_SET_QUANT 4000 |
Set the quantizer scale.
The passed buffer is interpreted as containing a single int
. The valid range is 0-511.
#define OD_SET_COMPLEXITY 4002 |
Configure the encoder's computational complexity level.
[in] | _buf | int : The new encoder complexity level. Values must lie in the range 0...10, inclusive, with higher values requiring more CPU but generally producing better quality at a given bitrate. |
#define OD_GET_COMPLEXITY 4004 |
Get the encoder's computational complexity level.
[in] | _buf | int : Returns a value in the range 0...10, inclusive. Higher values indicate higher CPU requirements, but generally producing better quality at a given bitrate. |
#define OD_SET_USE_ACTIVITY_MASKING 4006 |
Whether activity masking should be used or not.
[in] | _buf | int : 0 to disable the use of activity masking, a non-zero value otherwise (the default). |
#define OD_SET_QM 4008 |
Which quantization matrix to use.
[in] | _buf | int : 0 => flat quantization matrix, 1 => HVS (the default). |
#define OD_SET_USE_DERING 4010 |
Whether the bilinear postprocessing filter should be used or not.
[in] | _buf | int : 0 to disable the bilinear postprocessing filter, a non-zero value otherwise (the default). |
#define OD_SET_MC_USE_CHROMA 4100 |
Whether the motion compensation search should use the chroma planes in addition to the luma plane.
[in] | _buf | int : 0 to disable the use of the chroma planes, a non-zero value otherwise (the default). |
#define OD_SET_MV_RES_MIN 4102 |
Minimum motion vectors resolution for the motion compensation search.
[in] | _buf | int : 0 => 1/8 pel (default), 1 => 1/4 pel, 2 => 1/2 pel |
#define OD_SET_MV_LEVEL_MIN 4104 |
Minimum motion vectors level for the motion compensation search.
If this level is greater than the maximum level, the maximum level will be used instead.
[in] | _buf | int : level between 0 and 4 Default: 0 |
#define OD_SET_MV_LEVEL_MAX 4106 |
Maximum motion vectors level for the motion compensation search.
[in] | _buf | int : level between 0 and 4 Default: 4 |
#define OD_SET_MC_USE_SATD 4108 |
Whether the SATD metric should be used in motion compensation or not.
[in] | _buf | int : 0 to disable the use of SATD (the default), a non-zero value otherwise. |
daala_enc_ctx * daala_encode_create | ( | const daala_info * | info | ) |
Allocates and initializes an encoder instance.
info | A daala_info struct filled with the desired encoding parameters. |
NULL | if the encoding parameters were invalid. |
int daala_encode_ctl | ( | daala_enc_ctx * | enc, |
int | req, | ||
void * | buf, | ||
size_t | buf_sz | ||
) |
Encoder control function.
This is used to provide advanced control of the encoding process.
enc | A daala_enc_ctx handle. |
req | The control code to process. See the list of available control codes for details. |
buf | The parameters for this control code. |
buf_sz | The size of the parameter buffer. |
int daala_encode_flush_header | ( | daala_enc_ctx * | enc, |
daala_comment * | comments, | ||
ogg_packet * | op | ||
) |
Outputs the next header packet.
This should be called repeatedly after encoder initialization until it return 0
to get all of the header packets, in order, before encoding actual video data.
enc | A daala_enc_ctx handle. |
comments | The metadata to place in the comment header, when it is encoded. |
op | An ogg_packet structure to fill. All of the elements of this structure will be set, including a pointer to the header data. The memory for the header data is owned by libdaala . |
0 | No packet was produced, and no more header packets remain. |
OD_EFAULT | enc, comments or op was NULL . |
int daala_encode_img_in | ( | daala_enc_ctx * | enc, |
od_img * | img, | ||
int | duration | ||
) |
Submits an uncompressed frame to the encoder.
enc | A daala_enc_ctx handle. |
img | A buffer of image data to encode. |
duration | The duration to display the frame for, in timebase units. If a non-zero frame duration was specified in the header, then this parameter is ignored. |
0 | Success. |
OD_EFAULT | enc or img was NULL . |
OD_EINVAL | The image size does not match the frame size the encoder was initialized with, or encoding has already completed. |
int daala_encode_packet_out | ( | daala_enc_ctx * | enc, |
int | last, | ||
ogg_packet * | op | ||
) |
Retrieves encoded video data packets.
This should be called repeatedly after each frame is submitted to flush any encoded packets, until it returns 0. The encoder will not buffer these packets as subsequent frames are compressed, so a failure to do so will result in lost video data.
enc | A daala_enc_ctx handle. |
last | Set this flag to a non-zero value if no more uncompressed frames will be submitted. This ensures that a proper EOS flag is set on the last packet. |
op | An ogg_packet structure to fill. All of the elements of this structure will be set, including a pointer to the video data. The memory for the video data is owned by libdaala . |
0 | No packet was produced, and no more encoded video data remains. |
OD_EFAULT | enc or op was NULL . |
void daala_encode_free | ( | daala_enc_ctx * | enc | ) |
Frees an allocated encoder instance.
enc | A daala_enc_ctx handle. |