WebM VP8 Codec SDK
Modules | Files | Data Structures | Defines | Typedefs | Functions
Decoder Algorithm Interface
Common Algorithm Interface

Modules

 Frame-Based Decoding Functions
 Slice-Based Decoding Functions

Files

file  vpx_decoder.h
 

Describes the decoder algorithm interface to applications.


Data Structures

struct  vpx_codec_stream_info
 Stream properties. More...
struct  vpx_codec_dec_cfg
 Initialization Configurations. More...

Defines

#define VPX_DECODER_H
#define VPX_DECODER_ABI_VERSION
 Current ABI version number.
#define VPX_CODEC_CAP_PUT_SLICE   0x10000
 Decoder capabilities bitfield.
#define VPX_CODEC_CAP_PUT_FRAME   0x20000
#define VPX_CODEC_CAP_POSTPROC   0x40000
#define VPX_CODEC_USE_POSTPROC   0x10000
 Initialization-time Feature Enabling.
#define vpx_codec_dec_init(ctx, iface, cfg, flags)   vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
 Convenience macro for vpx_codec_dec_init_ver()

Typedefs

typedef struct
vpx_codec_stream_info 
vpx_codec_stream_info_t
 Stream properties.
typedef struct vpx_codec_dec_cfg vpx_codec_dec_cfg_t
 Initialization Configurations.

Functions

vpx_codec_err_t vpx_codec_dec_init_ver (vpx_codec_ctx_t *ctx, vpx_codec_iface_t *iface, vpx_codec_dec_cfg_t *cfg, vpx_codec_flags_t flags, int ver)
 Initialize a decoder instance.
vpx_codec_err_t vpx_codec_peek_stream_info (vpx_codec_iface_t *iface, const uint8_t *data, unsigned int data_sz, vpx_codec_stream_info_t *si)
 Parse stream info from a buffer.
vpx_codec_err_t vpx_codec_get_stream_info (vpx_codec_ctx_t *ctx, vpx_codec_stream_info_t *si)
 Return information about the current stream.
vpx_codec_err_t vpx_codec_decode (vpx_codec_ctx_t *ctx, const uint8_t *data, unsigned int data_sz, void *user_priv, long deadline)
 Decode data.
vpx_image_tvpx_codec_get_frame (vpx_codec_ctx_t *ctx, vpx_codec_iter_t *iter)
 Decoded frames iterator.

Detailed Description

This abstraction allows applications using this decoder to easily support multiple video formats with minimal code duplication. This section describes the interface common to all decoders.


Define Documentation

#define VPX_CODEC_CAP_PUT_SLICE   0x10000

Decoder capabilities bitfield.

Each decoder advertises the capabilities it supports as part of its vpx_codec_iface_t interface structure. Capabilities are extra interfaces or functionality, and are not required to be supported by a decoder.

The available flags are specified by VPX_CODEC_CAP_* defines. Will issue put_slice callbacks

#define VPX_CODEC_CAP_PUT_FRAME   0x20000

Will issue put_frame callbacks

#define VPX_CODEC_CAP_POSTPROC   0x40000

Can postprocess decoded frame

#define VPX_CODEC_USE_POSTPROC   0x10000

Initialization-time Feature Enabling.

Certain codec features must be known at initialization time, to allow for proper memory allocation.

The available flags are specified by VPX_CODEC_USE_* defines. Postprocess decoded frame

#define vpx_codec_dec_init (   ctx,
  iface,
  cfg,
  flags 
)    vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)

Convenience macro for vpx_codec_dec_init_ver()

Ensures the ABI version parameter is properly set.


Typedef Documentation

Stream properties.

This structure is used to query or set properties of the decoded stream. Algorithms may extend this structure with data specific to their bitstream by setting the sz member appropriately.

Initialization Configurations.

This structure is used to pass init time configuration options to the decoder. alias for struct vpx_codec_dec_cfg


Function Documentation

Initialize a decoder instance.

Initializes a decoder context using the given interface. Applications should call the vpx_codec_dec_init convenience macro instead of this function directly, to ensure that the ABI version number parameter is properly initialized.

In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags parameter), the storage pointed to by the cfg parameter must be kept readable and stable until all memory maps have been set.

Parameters:
[in]ctxPointer to this instance's context.
[in]ifacePointer to the algorithm interface to use.
[in]cfgConfiguration to use, if known. May be NULL.
[in]flagsBitfield of VPX_CODEC_USE_* flags
[in]verABI version number. Must be set to VPX_DECODER_ABI_VERSION
Return values:
VPX_CODEC_OKThe decoder algorithm initialized.
VPX_CODEC_MEM_ERRORMemory allocation failed.
vpx_codec_err_t vpx_codec_peek_stream_info ( vpx_codec_iface_t iface,
const uint8_t *  data,
unsigned int  data_sz,
vpx_codec_stream_info_t si 
)

Parse stream info from a buffer.

Performs high level parsing of the bitstream. Construction of a decoder context is not necessary. Can be used to determine if the bitstream is of the proper format, and to extract information from the stream.

Parameters:
[in]ifacePointer to the algorithm interface
[in]dataPointer to a block of data to parse
[in]data_szSize of the data buffer
[in,out]siPointer to stream info to update. The size member MUST be properly initialized, but MAY be clobbered by the algorithm. This parameter MAY be NULL.
Return values:
VPX_CODEC_OKBitstream is parsable and stream information updated

Return information about the current stream.

Returns information about the stream that has been parsed during decoding.

Parameters:
[in]ctxPointer to this instance's context
[in,out]siPointer to stream info to update. The size member MUST be properly initialized, but MAY be clobbered by the algorithm. This parameter MAY be NULL.
Return values:
VPX_CODEC_OKBitstream is parsable and stream information updated
vpx_codec_err_t vpx_codec_decode ( vpx_codec_ctx_t ctx,
const uint8_t *  data,
unsigned int  data_sz,
void *  user_priv,
long  deadline 
)

Decode data.

Processes a buffer of coded data. If the processing results in a new decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be generated, as appropriate. Encoded data MUST be passed in DTS (decode time stamp) order. Frames produced will always be in PTS (presentation time stamp) order.

Parameters:
[in]ctxPointer to this instance's context
[in]dataPointer to this block of new coded data. If NULL, a VPX_CODEC_CB_PUT_FRAME event is posted for the previously decoded frame.
[in]data_szSize of the coded data, in bytes.
[in]user_privApplication specific data to associate with this frame.
[in]deadlineSoft deadline the decoder should attempt to meet, in us. Set to zero for unlimited.
Returns:
Returns VPX_CODEC_OK if the coded data was processed completely and future pictures can be decoded without error. Otherwise, see the descriptions of the other error codes in vpx_codec_err_t for recoverability capabilities.

Decoded frames iterator.

Iterates over a list of the frames available for display. The iterator storage should be initialized to NULL to start the iteration. Iteration is complete when this function returns NULL.

The list of available frames becomes valid upon completion of the vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.

Parameters:
[in]ctxPointer to this instance's context
[in,out]iterIterator storage, initialized to NULL
Returns:
Returns a pointer to an image, if one is ready for display. Frames produced will always be in PTS (presentation time stamp) order.