libtheoraenc
C encoding API. More...
#include <stddef.h>
#include <ogg/ogg.h>
#include "codec.h"
Go to the source code of this file.
th_encode_ctl() codes | |
These are the available request codes for th_encode_ctl(). By convention, these are even, to distinguish them from the decoder control codes. Keep any experimental or vendor-specific values above 0x8000 . | |
#define | TH_ENCCTL_SET_HUFFMAN_CODES (0) |
Sets the Huffman tables to use. | |
#define | TH_ENCCTL_SET_QUANT_PARAMS (2) |
Sets the quantization parameters to use. | |
#define | TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4) |
Sets the maximum distance between key frames. | |
#define | TH_ENCCTL_SET_VP3_COMPATIBLE (10) |
Disables any encoder features that would prevent lossless transcoding back to VP3. | |
#define | TH_ENCCTL_GET_SPLEVEL_MAX (12) |
Gets the maximum speed level. | |
#define | TH_ENCCTL_SET_SPLEVEL (14) |
Sets the speed level. | |
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 th_enc_ctx | th_enc_ctx |
The encoder context. | |
Functions for encoding | |
You must link to libtheoraenc and libtheoradec if you use any of the functions in this section.The functions are listed in the order they are used in a typical encode. The basic steps are:
| |
th_enc_ctx * | th_encode_alloc (const th_info *_info) |
Allocates an encoder instance. | |
int | th_encode_ctl (th_enc_ctx *_enc, int _req, void *_buf, size_t _buf_sz) |
Encoder control function. | |
int | th_encode_flushheader (th_enc_ctx *_enc, th_comment *_comments, ogg_packet *_op) |
Outputs the next header packet. | |
int | th_encode_ycbcr_in (th_enc_ctx *_enc, th_ycbcr_buffer _ycbcr) |
Submits an uncompressed frame to the encoder. | |
int | th_encode_packetout (th_enc_ctx *_enc, int _last, ogg_packet *_op) |
Retrieves encoded video data packets. | |
void | th_encode_free (th_enc_ctx *_enc) |
Frees an allocated encoder instance. | |
Defines | |
#define | _O_THEORA_THEORAENC_H_ (1) |
Variables | |
const th_quant_info | TH_VP31_QUANT_INFO |
The quantization parameters used by VP3. | |
const th_huff_code | TH_VP31_HUFF_CODES [TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS] |
The Huffman tables used by VP3. |
libtheoraenc
C encoding API.
|
|
|
Gets the maximum speed level. Higher speed levels favor quicker encoding over better quality per bit. Depending on the encoding mode, and the internal algorithms used, quality may actually improve, but in this case bitrate will also likely increase. In any case, overall rate/distortion performance will probably decrease. The maximum value, and the meaning of each value, may change depending on the current encoding mode (VBR vs. CQI, etc.).
|
|
Sets the Huffman tables to use.
The tables are copied, not stored by reference, so they can be freed after this call.
|
|
Sets the maximum distance between key frames.
This can be changed during an encode, but will be bounded by
|
|
Sets the quantization parameters to use.
The parameters are copied, not stored by reference, so they can be freed after this call.
|
|
Sets the speed level. By default, the slowest speed (0) is used.
|
|
Disables any encoder features that would prevent lossless transcoding back to VP3. This primarily means disabling block-level QI values and not using 4MV mode when any of the luma blocks in a macro block are not coded. It also includes using the VP3 quantization tables and Huffman codes; if you set them explicitly after calling this function, the resulting stream will not be VP3-compatible. If you enable VP3-compatibility when encoding 4:2:2 or 4:4:4 source material, or when using a picture region smaller than the full frame (e.g. a non-multiple-of-16 width or height), then non-VP3 bitstream features will still be disabled, but the stream will still not be VP3-compatible, as VP3 was not capable of encoding such formats. If you call this after encoding has already begun, then the quantization tables and codebooks cannot be changed, but the frame-level features will be enabled or disabled as requested.
|
|
The encoder context.
|
|
The Huffman tables used by VP3.
|
|
The quantization parameters used by VP3.
|