2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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.
11 /*!\defgroup vp8_decoder WebM VP8/VP9 Decoder
17 * \brief Provides definitions for using VP8 or VP9 within the vpx Decoder
20 #ifndef VPX_VPX_VP8DX_H_
21 #define VPX_VPX_VP8DX_H_
27 /* Include controls common to both the encoder and decoder */
30 /*!\name Algorithm interface for VP8
32 * This interface provides the capability to decode VP8 streams.
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*/
39 /*!\name Algorithm interface for VP9
41 * This interface provides the capability to decode VP9 streams.
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*/
48 /*!\enum vp8_dec_control_id
49 * \brief VP8 decoder control functions
51 * This set of macros define the control functions available for the VP8
54 * \sa #vpx_codec_control
56 enum vp8_dec_control_id {
57 /** control function to get info on which reference frames were updated
60 VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START,
62 /** check if the indicated frame is corrupted */
63 VP8D_GET_FRAME_CORRUPTED,
65 /** control function to get info on which reference frames were used
68 VP8D_GET_LAST_REF_USED,
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.
75 VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR,
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). */
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,
87 /** control function to get the bit depth of the stream. */
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.
95 VP9_SET_BYTE_ALIGNMENT,
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.
102 * TODO(yaowu): Rework the unit test that uses this control, and in a future
103 * release, this test-only control shall be removed.
105 VP9_INVERT_TILE_DECODE_ORDER,
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.
112 VP9_SET_SKIP_LOOP_FILTER,
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.
117 VP9_DECODE_SVC_SPATIAL_LAYER,
119 /*!\brief Codec control function to get last decoded frame quantizer.
121 * Return value uses internal quantizer scale defined by the codec.
123 * Supported in codecs: VP8, VP9
125 VPXD_GET_LAST_QUANTIZER,
127 /*!\brief Codec control function to set row level multi-threading.
131 * Supported in codecs: VP9
135 /*!\brief Codec control function to set loopfilter optimization.
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.
141 * Supported in codecs: VP9
143 VP9D_SET_LOOP_FILTER_OPT,
145 VP8_DECODER_CTRL_ID_MAX
148 /** Decrypt n bytes of data from input -> output, using the decrypt_state
149 * passed in VPXD_SET_DECRYPTOR.
151 typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
152 unsigned char *output, int count);
154 /*!\brief Structure to hold decryption state
156 * Defines a structure to hold the decryption state and access function.
158 typedef struct vpx_decrypt_init {
159 /*! Decrypt callback. */
160 vpx_decrypt_cb decrypt_cb;
162 /*! Decryption state. */
167 /*!\brief VP8 decoder control function parameter type
169 * Defines the data types that VP8D control functions take. Note that
170 * additional common controls are defined in vp8.h
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
206 /*! @} - end defgroup vp8_decoder */
212 #endif // VPX_VPX_VP8DX_H_