register_state_check.h: add compiler barrier
[platform/upstream/libvpx.git] / vpx / vp8dx.h
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11 /*!\defgroup vp8_decoder WebM VP8/VP9 Decoder
12  * \ingroup vp8
13  *
14  * @{
15  */
16 /*!\file
17  * \brief Provides definitions for using VP8 or VP9 within the vpx Decoder
18  *        interface.
19  */
20 #ifndef VPX_VPX_VP8DX_H_
21 #define VPX_VPX_VP8DX_H_
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /* Include controls common to both the encoder and decoder */
28 #include "./vp8.h"
29
30 /*!\name Algorithm interface for VP8
31  *
32  * This interface provides the capability to decode VP8 streams.
33  * @{
34  */
35 extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
36 extern vpx_codec_iface_t *vpx_codec_vp8_dx(void);
37 /*!@} - end algorithm interface member group*/
38
39 /*!\name Algorithm interface for VP9
40  *
41  * This interface provides the capability to decode VP9 streams.
42  * @{
43  */
44 extern vpx_codec_iface_t vpx_codec_vp9_dx_algo;
45 extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);
46 /*!@} - end algorithm interface member group*/
47
48 /*!\enum vp8_dec_control_id
49  * \brief VP8 decoder control functions
50  *
51  * This set of macros define the control functions available for the VP8
52  * decoder interface.
53  *
54  * \sa #vpx_codec_control
55  */
56 enum vp8_dec_control_id {
57   /** control function to get info on which reference frames were updated
58    *  by the last decode
59    */
60   VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START,
61
62   /** check if the indicated frame is corrupted */
63   VP8D_GET_FRAME_CORRUPTED,
64
65   /** control function to get info on which reference frames were used
66    *  by the last decode
67    */
68   VP8D_GET_LAST_REF_USED,
69
70   /** decryption function to decrypt encoded buffer data immediately
71    * before decoding. Takes a vpx_decrypt_init, which contains
72    * a callback function and opaque context pointer.
73    */
74   VPXD_SET_DECRYPTOR,
75   VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR,
76
77   /** control function to get the dimensions that the current frame is decoded
78    * at. This may be different to the intended display size for the frame as
79    * specified in the wrapper or frame header (see VP9D_GET_DISPLAY_SIZE). */
80   VP9D_GET_FRAME_SIZE,
81
82   /** control function to get the current frame's intended display dimensions
83    * (as specified in the wrapper or frame header). This may be different to
84    * the decoded dimensions of this frame (see VP9D_GET_FRAME_SIZE). */
85   VP9D_GET_DISPLAY_SIZE,
86
87   /** control function to get the bit depth of the stream. */
88   VP9D_GET_BIT_DEPTH,
89
90   /** control function to set the byte alignment of the planes in the reference
91    * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
92    * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
93    * follows Y plane, and V plane directly follows U plane. Default value is 0.
94    */
95   VP9_SET_BYTE_ALIGNMENT,
96
97   /** control function to invert the decoding order to from right to left. The
98    * function is used in a test to confirm the decoding independence of tile
99    * columns. The function may be used in application where this order
100    * of decoding is desired.
101    *
102    * TODO(yaowu): Rework the unit test that uses this control, and in a future
103    *              release, this test-only control shall be removed.
104    */
105   VP9_INVERT_TILE_DECODE_ORDER,
106
107   /** control function to set the skip loop filter flag. Valid values are
108    * integers. The decoder will skip the loop filter when its value is set to
109    * nonzero. If the loop filter is skipped the decoder may accumulate decode
110    * artifacts. The default value is 0.
111    */
112   VP9_SET_SKIP_LOOP_FILTER,
113
114   /** control function to decode SVC stream up to the x spatial layers,
115    * where x is passed in through the control, and is 0 for base layer.
116    */
117   VP9_DECODE_SVC_SPATIAL_LAYER,
118
119   /*!\brief Codec control function to get last decoded frame quantizer.
120    *
121    * Return value uses internal quantizer scale defined by the codec.
122    *
123    * Supported in codecs: VP8, VP9
124    */
125   VPXD_GET_LAST_QUANTIZER,
126
127   /*!\brief Codec control function to set row level multi-threading.
128    *
129    * 0 : off, 1 : on
130    *
131    * Supported in codecs: VP9
132    */
133   VP9D_SET_ROW_MT,
134
135   /*!\brief Codec control function to set loopfilter optimization.
136    *
137    * 0 : off, Loop filter is done after all tiles have been decoded
138    * 1 : on, Loop filter is done immediately after decode without
139    *     waiting for all threads to sync.
140    *
141    * Supported in codecs: VP9
142    */
143   VP9D_SET_LOOP_FILTER_OPT,
144
145   VP8_DECODER_CTRL_ID_MAX
146 };
147
148 /** Decrypt n bytes of data from input -> output, using the decrypt_state
149  *  passed in VPXD_SET_DECRYPTOR.
150  */
151 typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
152                                unsigned char *output, int count);
153
154 /*!\brief Structure to hold decryption state
155  *
156  * Defines a structure to hold the decryption state and access function.
157  */
158 typedef struct vpx_decrypt_init {
159   /*! Decrypt callback. */
160   vpx_decrypt_cb decrypt_cb;
161
162   /*! Decryption state. */
163   void *decrypt_state;
164 } vpx_decrypt_init;
165
166 /*!\cond */
167 /*!\brief VP8 decoder control function parameter type
168  *
169  * Defines the data types that VP8D control functions take. Note that
170  * additional common controls are defined in vp8.h
171  *
172  */
173
174 VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
175 #define VPX_CTRL_VP8D_GET_LAST_REF_UPDATES
176 VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
177 #define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED
178 VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
179 #define VPX_CTRL_VP8D_GET_LAST_REF_USED
180 VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
181 #define VPX_CTRL_VPXD_SET_DECRYPTOR
182 VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
183 #define VPX_CTRL_VP8D_SET_DECRYPTOR
184 VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *)
185 #define VPX_CTRL_VP9D_GET_FRAME_SIZE
186 VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
187 #define VPX_CTRL_VP9D_GET_DISPLAY_SIZE
188 VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *)
189 #define VPX_CTRL_VP9D_GET_BIT_DEPTH
190 VPX_CTRL_USE_TYPE(VP9_SET_BYTE_ALIGNMENT, int)
191 #define VPX_CTRL_VP9_SET_BYTE_ALIGNMENT
192 VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
193 #define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER
194 VPX_CTRL_USE_TYPE(VP9_SET_SKIP_LOOP_FILTER, int)
195 #define VPX_CTRL_VP9_SET_SKIP_LOOP_FILTER
196 VPX_CTRL_USE_TYPE(VP9_DECODE_SVC_SPATIAL_LAYER, int)
197 #define VPX_CTRL_VP9_DECODE_SVC_SPATIAL_LAYER
198 VPX_CTRL_USE_TYPE(VPXD_GET_LAST_QUANTIZER, int *)
199 #define VPX_CTRL_VPXD_GET_LAST_QUANTIZER
200 VPX_CTRL_USE_TYPE(VP9D_SET_ROW_MT, int)
201 #define VPX_CTRL_VP9_DECODE_SET_ROW_MT
202 VPX_CTRL_USE_TYPE(VP9D_SET_LOOP_FILTER_OPT, int)
203 #define VPX_CTRL_VP9_SET_LOOP_FILTER_OPT
204
205 /*!\endcond */
206 /*! @} - end defgroup vp8_decoder */
207
208 #ifdef __cplusplus
209 }  // extern "C"
210 #endif
211
212 #endif  // VPX_VPX_VP8DX_H_