Line data Source code
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 :
12 : /*!\defgroup aom_decoder AOMedia AOM/AV1 Decoder
13 : * \ingroup aom
14 : *
15 : * @{
16 : */
17 : /*!\file
18 : * \brief Provides definitions for using AOM or AV1 within the aom Decoder
19 : * interface.
20 : */
21 : #ifndef AOM_AOMDX_H_
22 : #define AOM_AOMDX_H_
23 :
24 : #ifdef __cplusplus
25 : extern "C" {
26 : #endif
27 :
28 : /* Include controls common to both the encoder and decoder */
29 : #include "./aom.h"
30 :
31 : /*!\name Algorithm interface for AV1
32 : *
33 : * This interface provides the capability to decode AV1 streams.
34 : * @{
35 : */
36 : extern aom_codec_iface_t aom_codec_av1_dx_algo;
37 : extern aom_codec_iface_t *aom_codec_av1_dx(void);
38 : /*!@} - end algorithm interface member group*/
39 :
40 : #ifndef AOM_ACCOUNTING_H_
41 : /** Data structure that stores bit accounting for debug
42 : */
43 : typedef struct Accounting Accounting;
44 : #endif
45 :
46 : #ifndef AOM_INSPECTION_H_
47 : /** Callback that inspects decoder frame data.
48 : */
49 : typedef void (*aom_inspect_cb)(void *decoder, void *ctx);
50 : #endif
51 :
52 : /*!\brief Structure to hold inspection callback and context.
53 : *
54 : * Defines a structure to hold the inspection callback function and calling
55 : * context.
56 : */
57 : typedef struct aom_inspect_init {
58 : /*! Inspection callback. */
59 : aom_inspect_cb inspect_cb;
60 :
61 : /*! Inspection context. */
62 : void *inspect_ctx;
63 : } aom_inspect_init;
64 :
65 : /*!\enum aom_dec_control_id
66 : * \brief AOM decoder control functions
67 : *
68 : * This set of macros define the control functions available for the AOM
69 : * decoder interface.
70 : *
71 : * \sa #aom_codec_control
72 : */
73 : enum aom_dec_control_id {
74 : /** control function to get info on which reference frames were updated
75 : * by the last decode
76 : */
77 : AOMD_GET_LAST_REF_UPDATES = AOM_DECODER_CTRL_ID_START,
78 :
79 : /** check if the indicated frame is corrupted */
80 : AOMD_GET_FRAME_CORRUPTED,
81 :
82 : /** control function to get info on which reference frames were used
83 : * by the last decode
84 : */
85 : AOMD_GET_LAST_REF_USED,
86 :
87 : /** decryption function to decrypt encoded buffer data immediately
88 : * before decoding. Takes a aom_decrypt_init, which contains
89 : * a callback function and opaque context pointer.
90 : */
91 : AOMD_SET_DECRYPTOR,
92 : // AOMD_SET_DECRYPTOR = AOMD_SET_DECRYPTOR,
93 :
94 : /** control function to get the dimensions that the current frame is decoded
95 : * at. This may be different to the intended display size for the frame as
96 : * specified in the wrapper or frame header (see AV1D_GET_DISPLAY_SIZE). */
97 : AV1D_GET_FRAME_SIZE,
98 :
99 : /** control function to get the current frame's intended display dimensions
100 : * (as specified in the wrapper or frame header). This may be different to
101 : * the decoded dimensions of this frame (see AV1D_GET_FRAME_SIZE). */
102 : AV1D_GET_DISPLAY_SIZE,
103 :
104 : /** control function to get the bit depth of the stream. */
105 : AV1D_GET_BIT_DEPTH,
106 :
107 : /** control function to set the byte alignment of the planes in the reference
108 : * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
109 : * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
110 : * follows Y plane, and V plane directly follows U plane. Default value is 0.
111 : */
112 : AV1_SET_BYTE_ALIGNMENT,
113 :
114 : /** control function to invert the decoding order to from right to left. The
115 : * function is used in a test to confirm the decoding independence of tile
116 : * columns. The function may be used in application where this order
117 : * of decoding is desired.
118 : *
119 : * TODO(yaowu): Rework the unit test that uses this control, and in a future
120 : * release, this test-only control shall be removed.
121 : */
122 : AV1_INVERT_TILE_DECODE_ORDER,
123 :
124 : /** control function to set the skip loop filter flag. Valid values are
125 : * integers. The decoder will skip the loop filter when its value is set to
126 : * nonzero. If the loop filter is skipped the decoder may accumulate decode
127 : * artifacts. The default value is 0.
128 : */
129 : AV1_SET_SKIP_LOOP_FILTER,
130 :
131 : /** control function to retrieve a pointer to the Accounting struct. When
132 : * compiled without --enable-accounting, this returns AOM_CODEC_INCAPABLE.
133 : * If called before a frame has been decoded, this returns AOM_CODEC_ERROR.
134 : * The caller should ensure that AOM_CODEC_OK is returned before attempting
135 : * to dereference the Accounting pointer.
136 : */
137 : AV1_GET_ACCOUNTING,
138 :
139 : /** control function to get last decoded frame quantizer. Returned value uses
140 : * internal quantizer scale defined by the codec.
141 : */
142 : AOMD_GET_LAST_QUANTIZER,
143 :
144 : /** control function to set the range of tile decoding. A value that is
145 : * greater and equal to zero indicates only the specific row/column is
146 : * decoded. A value that is -1 indicates the whole row/column is decoded.
147 : * A special case is both values are -1 that means the whole frame is
148 : * decoded.
149 : */
150 : AV1_SET_DECODE_TILE_ROW,
151 : AV1_SET_DECODE_TILE_COL,
152 :
153 : /** control function to set an aom_inspect_cb callback that is invoked each
154 : * time a frame is decoded. When compiled without --enable-inspection, this
155 : * returns AOM_CODEC_INCAPABLE.
156 : */
157 : AV1_SET_INSPECTION_CALLBACK,
158 :
159 : AOM_DECODER_CTRL_ID_MAX,
160 : };
161 :
162 : /** Decrypt n bytes of data from input -> output, using the decrypt_state
163 : * passed in AOMD_SET_DECRYPTOR.
164 : */
165 : typedef void (*aom_decrypt_cb)(void *decrypt_state, const unsigned char *input,
166 : unsigned char *output, int count);
167 :
168 : /*!\brief Structure to hold decryption state
169 : *
170 : * Defines a structure to hold the decryption state and access function.
171 : */
172 : typedef struct aom_decrypt_init {
173 : /*! Decrypt callback. */
174 : aom_decrypt_cb decrypt_cb;
175 :
176 : /*! Decryption state. */
177 : void *decrypt_state;
178 : } aom_decrypt_init;
179 :
180 : /*!\cond */
181 : /*!\brief AOM decoder control function parameter type
182 : *
183 : * Defines the data types that AOMD control functions take. Note that
184 : * additional common controls are defined in aom.h
185 : *
186 : */
187 :
188 0 : AOM_CTRL_USE_TYPE(AOMD_GET_LAST_REF_UPDATES, int *)
189 : #define AOM_CTRL_AOMD_GET_LAST_REF_UPDATES
190 0 : AOM_CTRL_USE_TYPE(AOMD_GET_FRAME_CORRUPTED, int *)
191 : #define AOM_CTRL_AOMD_GET_FRAME_CORRUPTED
192 0 : AOM_CTRL_USE_TYPE(AOMD_GET_LAST_REF_USED, int *)
193 : #define AOM_CTRL_AOMD_GET_LAST_REF_USED
194 0 : AOM_CTRL_USE_TYPE(AOMD_GET_LAST_QUANTIZER, int *)
195 : #define AOM_CTRL_AOMD_GET_LAST_QUANTIZER
196 0 : AOM_CTRL_USE_TYPE(AOMD_SET_DECRYPTOR, aom_decrypt_init *)
197 : #define AOM_CTRL_AOMD_SET_DECRYPTOR
198 : // AOM_CTRL_USE_TYPE(AOMD_SET_DECRYPTOR, aom_decrypt_init *)
199 : //#define AOM_CTRL_AOMD_SET_DECRYPTOR
200 0 : AOM_CTRL_USE_TYPE(AV1D_GET_DISPLAY_SIZE, int *)
201 : #define AOM_CTRL_AV1D_GET_DISPLAY_SIZE
202 0 : AOM_CTRL_USE_TYPE(AV1D_GET_BIT_DEPTH, unsigned int *)
203 : #define AOM_CTRL_AV1D_GET_BIT_DEPTH
204 0 : AOM_CTRL_USE_TYPE(AV1D_GET_FRAME_SIZE, int *)
205 : #define AOM_CTRL_AV1D_GET_FRAME_SIZE
206 0 : AOM_CTRL_USE_TYPE(AV1_INVERT_TILE_DECODE_ORDER, int)
207 : #define AOM_CTRL_AV1_INVERT_TILE_DECODE_ORDER
208 0 : AOM_CTRL_USE_TYPE(AV1_GET_ACCOUNTING, Accounting **)
209 : #define AOM_CTRL_AV1_GET_ACCOUNTING
210 0 : AOM_CTRL_USE_TYPE(AV1_SET_DECODE_TILE_ROW, int)
211 : #define AOM_CTRL_AV1_SET_DECODE_TILE_ROW
212 0 : AOM_CTRL_USE_TYPE(AV1_SET_DECODE_TILE_COL, int)
213 : #define AOM_CTRL_AV1_SET_DECODE_TILE_COL
214 0 : AOM_CTRL_USE_TYPE(AV1_SET_INSPECTION_CALLBACK, aom_inspect_init *)
215 : #define AOM_CTRL_AV1_SET_INSPECTION_CALLBACK
216 : /*!\endcond */
217 : /*! @} - end defgroup aom_decoder */
218 :
219 : #ifdef __cplusplus
220 : } // extern "C"
221 : #endif
222 :
223 : #endif // AOM_AOMDX_H_
|