AOMedia Codec SDK
aom_decoder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3  *
4  * This source code is subject to the terms of the BSD 2 Clause License and
5  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6  * was not distributed with this source code in the LICENSE file, you can
7  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8  * Media Patent License 1.0 was not distributed with this source code in the
9  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10  */
11 #ifndef AOM_AOM_AOM_DECODER_H_
12 #define AOM_AOM_AOM_DECODER_H_
13 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include "aom/aom_codec.h"
34 #include "aom/aom_frame_buffer.h"
35 
44 #define AOM_DECODER_ABI_VERSION \
45  (3 + AOM_CODEC_ABI_VERSION)
55 #define AOM_CODEC_CAP_PUT_SLICE 0x10000
56 #define AOM_CODEC_CAP_PUT_FRAME 0x20000
57 #define AOM_CODEC_CAP_POSTPROC 0x40000
67 #define AOM_CODEC_CAP_EXTERNAL_FRAME_BUFFER 0x200000
68 
69 #define AOM_CODEC_USE_POSTPROC 0x10000
76 typedef struct aom_codec_stream_info {
77  unsigned int w;
78  unsigned int h;
79  unsigned int is_kf;
80  unsigned int number_spatial_layers;
81  unsigned int number_temporal_layers;
82  unsigned int is_annexb;
84 
85 /* REQUIRED FUNCTIONS
86  *
87  * The following functions are required to be implemented for all decoders.
88  * They represent the base case functionality expected of all decoders.
89  */
90 
96 typedef struct aom_codec_dec_cfg {
97  unsigned int threads;
98  unsigned int w;
99  unsigned int h;
100  unsigned int allow_lowbitdepth;
127  aom_codec_iface_t *iface,
128  const aom_codec_dec_cfg_t *cfg,
129  aom_codec_flags_t flags, int ver);
130 
135 #define aom_codec_dec_init(ctx, iface, cfg, flags) \
136  aom_codec_dec_init_ver(ctx, iface, cfg, flags, AOM_DECODER_ABI_VERSION)
137 
160  const uint8_t *data, size_t data_sz,
162 
179 
201 aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data,
202  size_t data_sz, void *user_priv);
203 
221 
237 typedef void (*aom_codec_put_frame_cb_fn_t)(void *user_priv,
238  const aom_image_t *img);
239 
257  void *user_priv);
258 
276 typedef void (*aom_codec_put_slice_cb_fn_t)(void *user_priv,
277  const aom_image_t *img,
278  const aom_image_rect_t *valid,
279  const aom_image_rect_t *update);
280 
298  void *user_priv);
299 
342  aom_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
343 
347 #ifdef __cplusplus
348 }
349 #endif
350 #endif // AOM_AOM_AOM_DECODER_H_
aom_get_frame_buffer_cb_fn_t
int(* aom_get_frame_buffer_cb_fn_t)(void *priv, size_t min_size, aom_codec_frame_buffer_t *fb)
get frame buffer callback prototype
Definition: aom_frame_buffer.h:64
aom_release_frame_buffer_cb_fn_t
int(* aom_release_frame_buffer_cb_fn_t)(void *priv, aom_codec_frame_buffer_t *fb)
release frame buffer callback prototype
Definition: aom_frame_buffer.h:77
aom_codec_decode
aom_codec_err_t aom_codec_decode(aom_codec_ctx_t *ctx, const uint8_t *data, size_t data_sz, void *user_priv)
Decode data.
aom_codec_put_slice_cb_fn_t
void(* aom_codec_put_slice_cb_fn_t)(void *user_priv, const aom_image_t *img, const aom_image_rect_t *valid, const aom_image_rect_t *update)
put slice callback prototype
Definition: aom_decoder.h:276
aom_codec_dec_init_ver
aom_codec_err_t aom_codec_dec_init_ver(aom_codec_ctx_t *ctx, aom_codec_iface_t *iface, const aom_codec_dec_cfg_t *cfg, aom_codec_flags_t flags, int ver)
Initialize a decoder instance.
aom_codec_register_put_frame_cb
aom_codec_err_t aom_codec_register_put_frame_cb(aom_codec_ctx_t *ctx, aom_codec_put_frame_cb_fn_t cb, void *user_priv)
Register for notification of frame completion.
aom_codec_stream_info::w
unsigned int w
Definition: aom_decoder.h:77
aom_image_rect
Representation of a rectangle on a surface.
Definition: aom_image.h:195
aom_codec_stream_info::number_temporal_layers
unsigned int number_temporal_layers
Definition: aom_decoder.h:81
aom_frame_buffer.h
Describes the decoder external frame buffer interface.
aom_codec_dec_cfg::threads
unsigned int threads
Definition: aom_decoder.h:97
aom_codec_ctx
Codec context structure.
Definition: aom_codec.h:204
aom_codec_iface_t
const struct aom_codec_iface aom_codec_iface_t
Codec interface structure.
Definition: aom_codec.h:181
aom_codec_dec_cfg::allow_lowbitdepth
unsigned int allow_lowbitdepth
Definition: aom_decoder.h:100
aom_codec_iter_t
const typedef void * aom_codec_iter_t
Iterator.
Definition: aom_codec.h:194
aom_codec_register_put_slice_cb
aom_codec_err_t aom_codec_register_put_slice_cb(aom_codec_ctx_t *ctx, aom_codec_put_slice_cb_fn_t cb, void *user_priv)
Register for notification of slice completion.
aom_codec_dec_cfg::w
unsigned int w
Definition: aom_decoder.h:98
aom_codec.h
Describes the codec algorithm interface to applications.
aom_codec_stream_info
Stream properties.
Definition: aom_decoder.h:76
aom_codec_dec_cfg_t
struct aom_codec_dec_cfg aom_codec_dec_cfg_t
Initialization Configurations.
aom_codec_peek_stream_info
aom_codec_err_t aom_codec_peek_stream_info(aom_codec_iface_t *iface, const uint8_t *data, size_t data_sz, aom_codec_stream_info_t *si)
Parse stream info from a buffer.
aom_codec_dec_cfg
Initialization Configurations.
Definition: aom_decoder.h:96
aom_codec_put_frame_cb_fn_t
void(* aom_codec_put_frame_cb_fn_t)(void *user_priv, const aom_image_t *img)
put frame callback prototype
Definition: aom_decoder.h:237
aom_codec_dec_cfg::h
unsigned int h
Definition: aom_decoder.h:99
aom_codec_set_frame_buffer_functions
aom_codec_err_t aom_codec_set_frame_buffer_functions(aom_codec_ctx_t *ctx, aom_get_frame_buffer_cb_fn_t cb_get, aom_release_frame_buffer_cb_fn_t cb_release, void *cb_priv)
Pass in external frame buffers for the decoder to use.
aom_codec_stream_info::number_spatial_layers
unsigned int number_spatial_layers
Definition: aom_decoder.h:80
aom_codec_stream_info::is_kf
unsigned int is_kf
Definition: aom_decoder.h:79
aom_codec_err_t
aom_codec_err_t
Algorithm return codes.
Definition: aom_codec.h:101
aom_codec_get_stream_info
aom_codec_err_t aom_codec_get_stream_info(aom_codec_ctx_t *ctx, aom_codec_stream_info_t *si)
Return information about the current stream.
aom_codec_get_frame
aom_image_t * aom_codec_get_frame(aom_codec_ctx_t *ctx, aom_codec_iter_t *iter)
Decoded frames iterator.
aom_codec_stream_info_t
struct aom_codec_stream_info aom_codec_stream_info_t
Stream properties.
aom_codec_flags_t
long aom_codec_flags_t
Initialization-time Feature Enabling.
Definition: aom_codec.h:174
aom_image
Image Descriptor.
Definition: aom_image.h:141
aom_codec_stream_info::is_annexb
unsigned int is_annexb
Definition: aom_decoder.h:82
cfg_options
Config Options.
Definition: aom_codec.h:533
aom_codec_dec_cfg::cfg
cfg_options_t cfg
Definition: aom_decoder.h:101
aom_codec_stream_info::h
unsigned int h
Definition: aom_decoder.h:78