Classes | Modules | Files | Defines | Typedefs | Enumerations | Functions

Decoder Algorithm Interface
[Common Algorithm Interface]

Collaboration diagram for Decoder Algorithm Interface:

Classes

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

Modules

 Frame-Based Decoding Functions
 Slice-Based Decoding Functions
 External Memory Allocation Functions

Files

file  vpx_decoder.h
 

Describes the decoder algorithm interface to applications.


file  vpx_decoder_compat.h
 

Provides a compatibility layer between version 1 and 2 of this API.


Defines

#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
 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.
#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().
#define VPX_DEC_CAP_PUT_SLICE   0x0001
 Will issue put_slice callbacks.
#define VPX_DEC_CAP_PUT_FRAME   0x0002
 Will issue put_frame callbacks.
#define VPX_DEC_CAP_XMA   0x0004
 Supports e_xternal Memory Allocation.
#define vpx_dec_init(ctx, iface)   vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)

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.
typedef int vpx_dec_caps_t
 Decoder capabilities bitfield.
typedef vpx_codec_stream_info_t vpx_dec_stream_info_t
 Stream properties.
typedef struct vpx_codec_iface vpx_dec_iface_t
 Decoder interface structure.
typedef struct vpx_codec_priv vpx_dec_priv_t
typedef vpx_codec_iter_t vpx_dec_iter_t
 Iterator.
typedef vpx_codec_ctx_t vpx_dec_ctx_t
 Decoder context structure.

Enumerations

enum  vpx_dec_err_t {
  VPX_DEC_OK = VPX_CODEC_OK, VPX_DEC_ERROR = VPX_CODEC_ERROR, VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR, VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
  VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM, VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE, VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME, VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
  VPX_DEC_LIST_END = VPX_CODEC_LIST_END
}
 

Decoder algorithm return codes.

More...

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.
const char * vpx_dec_build_config (void) DEPRECATED
 Return the build configuration.
const char * vpx_dec_iface_name (vpx_dec_iface_t *iface) DEPRECATED
 Return the name for a given interface.
const char * vpx_dec_err_to_string (vpx_dec_err_t err) DEPRECATED
 Convert error number to printable string.
const char * vpx_dec_error (vpx_dec_ctx_t *ctx) DEPRECATED
 Retrieve error synopsis for decoder context.
const char * vpx_dec_error_detail (vpx_dec_ctx_t *ctx) DEPRECATED
 Retrieve detailed error information for decoder context.
vpx_dec_err_t vpx_dec_init_ver (vpx_dec_ctx_t *ctx, vpx_dec_iface_t *iface, int ver) DEPRECATED
 Initialize a decoder instance.
vpx_dec_err_t vpx_dec_destroy (vpx_dec_ctx_t *ctx) DEPRECATED
 Destroy a decoder instance.
vpx_dec_caps_t vpx_dec_get_caps (vpx_dec_iface_t *iface) DEPRECATED
 Get the capabilities of an algorithm.
vpx_dec_err_t vpx_dec_peek_stream_info (vpx_dec_iface_t *iface, const uint8_t *data, unsigned int data_sz, vpx_dec_stream_info_t *si) DEPRECATED
 Parse stream info from a buffer.
vpx_dec_err_t vpx_dec_get_stream_info (vpx_dec_ctx_t *ctx, vpx_dec_stream_info_t *si) DEPRECATED
 Return information about the current stream.
vpx_dec_err_t vpx_dec_control (vpx_dec_ctx_t *ctx, int ctrl_id, void *data) DEPRECATED
 Control algorithm.
vpx_dec_err_t vpx_dec_decode (vpx_dec_ctx_t *ctx, uint8_t *data, unsigned int data_sz, void *user_priv, int rel_pts) DEPRECATED
 Decode data.
vpx_image_tvpx_dec_get_frame (vpx_dec_ctx_t *ctx, vpx_dec_iter_t *iter) DEPRECATED
 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.

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 codecs.


Define Documentation

#define VPX_CODEC_CAP_POSTPROC   0x40000

Can postprocess decoded frame.

#define VPX_CODEC_CAP_PUT_FRAME   0x20000

Will issue put_frame callbacks.

#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 specifiedby VPX_CODEC_CAP_* defines. Will issue put_slice callbacks

#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.

#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_DEC_CAP_PUT_FRAME   0x0002

Will issue put_frame callbacks.

#define VPX_DEC_CAP_PUT_SLICE   0x0001

Will issue put_slice callbacks.

#define VPX_DEC_CAP_XMA   0x0004

Supports e_xternal Memory Allocation.

#define vpx_dec_init (   ctx,
  iface 
)    vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
#define VPX_DECODER_ABI_VERSION

Current ABI version number.


Typedef Documentation

Initialization Configurations.

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

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.

typedef int vpx_dec_caps_t

Decoder capabilities bitfield.

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

The available flags are specifiedby VPX_DEC_CAP_* defines.

Decoder context structure.

All decoders MUST support this context structure fully. In general, this data should be considered private to the decoder algorithm, and not be manipulated or examined by the calling application. Applications may reference the 'name' member to get a printable description of the algorithm.

typedef struct vpx_codec_iface vpx_dec_iface_t

Decoder interface structure.

Contains function pointers and other data private to the decoder implementation. This structure is opaque to the application.

Iterator.

Opaque storage used for iterating over lists.

typedef struct vpx_codec_priv vpx_dec_priv_t

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.


Enumeration Type Documentation

Decoder algorithm return codes.

Enumerator:
VPX_DEC_OK 

Operation completed without error.

VPX_DEC_ERROR 

Unspecified error.

VPX_DEC_MEM_ERROR 

Memory operation failed.

VPX_DEC_ABI_MISMATCH 

ABI version mismatch.

VPX_DEC_UNSUP_BITSTREAM 

The given bitstream is not supported.

The bitstream was unable to be parsed at the highest level. The decoder is unable to proceed. This error SHOULD be treated as fatal to the stream.

VPX_DEC_UNSUP_FEATURE 

Encoded bitstream uses an unsupported feature.

The decoder does not implement a feature required by the encoder. This return code should only be used for features that prevent future pictures from being properly decoded. This error MAY be treated as fatal to the stream or MAY be treated as fatal to the current GOP.

VPX_DEC_CORRUPT_FRAME 

The coded data for this stream is corrupt or incomplete.

There was a problem decoding the current frame. This return code should only be used for failures that prevent future pictures from being properly decoded. This error MAY be treated as fatal to the stream or MAY be treated as fatal to the current GOP. If decoding is continued for the current GOP, artifacts may be present.

VPX_DEC_INVALID_PARAM 

An application-supplied parameter is not valid.

VPX_DEC_LIST_END 

An iterator reached the end of list.


Function Documentation

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.

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] ctx Pointer to this instance's context.
[in] iface Pointer to the alogrithm interface to use.
[in] cfg Configuration to use, if known. May be NULL.
[in] flags Bitfield of VPX_CODEC_USE_* flags
[in] ver ABI version number. Must be set to VPX_DECODER_ABI_VERSION
Return values:
VPX_CODEC_OK The decoder algorithm initialized.
VPX_CODEC_MEM_ERROR Memory allocation failed.
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] ctx Pointer to this instance's context
[in] data Pointer 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_sz Size of the coded data, in bytes.
[in] user_priv Application specific data to associate with this frame.
[in] deadline Soft 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.
vpx_image_t* vpx_codec_get_frame ( vpx_codec_ctx_t ctx,
vpx_codec_iter_t iter 
)

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] ctx Pointer to this instance's context
[in,out] iter Iterator 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.
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.

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

Parameters:
[in] ctx Pointer to this instance's context
[in,out] si Pointer 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_OK Bitstream is parsable and stream information updated
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] iface Pointer to the alogrithm interface
[in] data Pointer to a block of data to parse
[in] data_sz Size of the data buffer
[in,out] si Pointer 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_OK Bitstream is parsable and stream information updated
const char* vpx_dec_build_config ( void   ) 

Return the build configuration.

Returns a printable string containing an encoded version of the build configuration. This may be useful to vpx support.

vpx_dec_err_t vpx_dec_control ( vpx_dec_ctx_t ctx,
int  ctrl_id,
void *  data 
)

Control algorithm.

This function is used to exchange algorithm specific data with the decoder instance. This can be used to implement features specific to a particular algorithm.

This wrapper function dispatches the request to the helper function associated with the given ctrl_id. It tries to call this function transparantly, but will return VPX_DEC_ERROR if the request could not be dispatched.

Parameters:
[in] ctx Pointer to this instance's context
[in] ctrl_id Algorithm specific control identifier
[in,out] data Data to exchange with algorithm instance.
Return values:
VPX_DEC_OK The control request was processed.
VPX_DEC_ERROR The control request was not processed.
VPX_DEC_INVALID_PARAM The data was not valid.
vpx_dec_err_t vpx_dec_decode ( vpx_dec_ctx_t ctx,
uint8_t *  data,
unsigned int  data_sz,
void *  user_priv,
int  rel_pts 
)

Decode data.

Processes a buffer of coded data. If the processing results in a new decoded frame becoming available, VPX_DEC_CB_PUT_SLICE and VPX_DEC_CB_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] ctx Pointer to this instance's context
[in] data Pointer to this block of new coded data. If NULL, a VPX_DEC_CB_PUT_FRAME event is posted for the previously decoded frame.
[in] data_sz Size of the coded data, in bytes.
[in] user_priv Application specific data to associate with this frame.
[in] rel_pts PTS relative to the previous frame, in us. If unknown or unavailable, set to zero.
Returns:
Returns VPX_DEC_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_dec_err_t for recoverability capabilities.
vpx_dec_err_t vpx_dec_destroy ( vpx_dec_ctx_t ctx  ) 

Destroy a decoder instance.

Destroys a decoder context, freeing any associated memory buffers.

Parameters:
[in] ctx Pointer to this instance's context
Return values:
VPX_DEC_OK The decoder algorithm initialized.
VPX_DEC_MEM_ERROR Memory allocation failed.
const char* vpx_dec_err_to_string ( vpx_dec_err_t  err  ) 

Convert error number to printable string.

Returns a human readable string for the last error returned by the algorithm. The returned error will be one line and will not contain any newline characters.

Parameters:
[in] err Error number.
const char* vpx_dec_error ( vpx_dec_ctx_t ctx  ) 

Retrieve error synopsis for decoder context.

Returns a human readable string for the last error returned by the algorithm. The returned error will be one line and will not contain any newline characters.

Parameters:
[in] ctx Pointer to this instance's context.
const char* vpx_dec_error_detail ( vpx_dec_ctx_t ctx  ) 

Retrieve detailed error information for decoder context.

Returns a human readable string providing detailed information about the last error.

Parameters:
[in] ctx Pointer to this instance's context.
Return values:
NULL No detailed information is available.
vpx_dec_caps_t vpx_dec_get_caps ( vpx_dec_iface_t iface  ) 

Get the capabilities of an algorithm.

Retrieves the capabliities bitfield from the algorithm's interface.

Parameters:
[in] iface Pointer to the alogrithm interface
vpx_image_t* vpx_dec_get_frame ( vpx_dec_ctx_t ctx,
vpx_dec_iter_t iter 
)

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_dec_decode call, and remains valid until the next call to vpx_dec_decode.

Parameters:
[in] ctx Pointer to this instance's context
in out] iter Iterator 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.
vpx_dec_err_t vpx_dec_get_stream_info ( vpx_dec_ctx_t ctx,
vpx_dec_stream_info_t si 
)

Return information about the current stream.

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

Parameters:
[in] ctx Pointer to this instance's context
[in,out] si Pointer 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_DEC_OK Bitstream is parsable and stream information updated
const char* vpx_dec_iface_name ( vpx_dec_iface_t iface  ) 

Return the name for a given interface.

Returns a human readable string for name of the given decoder interface.

Parameters:
[in] iface Interface pointer
vpx_dec_err_t vpx_dec_init_ver ( vpx_dec_ctx_t ctx,
vpx_dec_iface_t iface,
int  ver 
)

Initialize a decoder instance.

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

Parameters:
[in] ctx Pointer to this instance's context.
[in] iface Pointer to the alogrithm interface to use.
[in] ver ABI version number. Must be set to VPX_DECODER_ABI_VERSION
Return values:
VPX_DEC_OK The decoder algorithm initialized.
VPX_DEC_MEM_ERROR Memory allocation failed.
vpx_dec_err_t vpx_dec_peek_stream_info ( vpx_dec_iface_t iface,
const uint8_t *  data,
unsigned int  data_sz,
vpx_dec_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] iface Pointer to the alogrithm interface
[in] data Pointer to a block of data to parse
[in] data_sz Size of the data buffer
[in,out] si Pointer 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_DEC_OK Bitstream is parsable and stream information updated