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 12 /*!\defgroup vp8_decoder WebM VP8/VP9 Decoder 13 * \ingroup vp8 14 * 15 * @{ 16 */ 17 /*!\file 18 * \brief Provides definitions for using VP8 or VP9 within the vpx Decoder 19 * interface. 20 */ 21 #ifndef VPX_VP8DX_H_ 22 #define VPX_VP8DX_H_ 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Include controls common to both the encoder and decoder */ 29 #include "./vp8.h" 30 31 /*!\name Algorithm interface for VP8 32 * 33 * This interface provides the capability to decode VP8 streams. 34 * @{ 35 */ 36 extern vpx_codec_iface_t vpx_codec_vp8_dx_algo; 37 extern vpx_codec_iface_t *vpx_codec_vp8_dx(void); 38 /*!@} - end algorithm interface member group*/ 39 40 /*!\name Algorithm interface for VP9 41 * 42 * This interface provides the capability to decode VP9 streams. 43 * @{ 44 */ 45 extern vpx_codec_iface_t vpx_codec_vp9_dx_algo; 46 extern vpx_codec_iface_t *vpx_codec_vp9_dx(void); 47 /*!@} - end algorithm interface member group*/ 48 49 /*!\name Algorithm interface for VP10 50 * 51 * This interface provides the capability to decode VP10 streams. 52 * @{ 53 */ 54 extern vpx_codec_iface_t vpx_codec_vp10_dx_algo; 55 extern vpx_codec_iface_t *vpx_codec_vp10_dx(void); 56 /*!@} - end algorithm interface member group*/ 57 58 /*!\enum vp8_dec_control_id 59 * \brief VP8 decoder control functions 60 * 61 * This set of macros define the control functions available for the VP8 62 * decoder interface. 63 * 64 * \sa #vpx_codec_control 65 */ 66 enum vp8_dec_control_id { 67 /** control function to get info on which reference frames were updated 68 * by the last decode 69 */ 70 VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START, 71 72 /** check if the indicated frame is corrupted */ 73 VP8D_GET_FRAME_CORRUPTED, 74 75 /** control function to get info on which reference frames were used 76 * by the last decode 77 */ 78 VP8D_GET_LAST_REF_USED, 79 80 /** decryption function to decrypt encoded buffer data immediately 81 * before decoding. Takes a vpx_decrypt_init, which contains 82 * a callback function and opaque context pointer. 83 */ 84 VPXD_SET_DECRYPTOR, 85 VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR, 86 87 /** control function to get the dimensions that the current frame is decoded 88 * at. This may be different to the intended display size for the frame as 89 * specified in the wrapper or frame header (see VP9D_GET_DISPLAY_SIZE). */ 90 VP9D_GET_FRAME_SIZE, 91 92 /** control function to get the current frame's intended display dimensions 93 * (as specified in the wrapper or frame header). This may be different to 94 * the decoded dimensions of this frame (see VP9D_GET_FRAME_SIZE). */ 95 VP9D_GET_DISPLAY_SIZE, 96 97 /** control function to get the bit depth of the stream. */ 98 VP9D_GET_BIT_DEPTH, 99 100 /** control function to set the byte alignment of the planes in the reference 101 * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets 102 * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly 103 * follows Y plane, and V plane directly follows U plane. Default value is 0. 104 */ 105 VP9_SET_BYTE_ALIGNMENT, 106 107 /** control function to invert the decoding order to from right to left. The 108 * function is used in a test to confirm the decoding independence of tile 109 * columns. The function may be used in application where this order 110 * of decoding is desired. 111 * 112 * TODO(yaowu): Rework the unit test that uses this control, and in a future 113 * release, this test-only control shall be removed. 114 */ 115 VP9_INVERT_TILE_DECODE_ORDER, 116 117 /** control function to set the skip loop filter flag. Valid values are 118 * integers. The decoder will skip the loop filter when its value is set to 119 * nonzero. If the loop filter is skipped the decoder may accumulate decode 120 * artifacts. The default value is 0. 121 */ 122 VP9_SET_SKIP_LOOP_FILTER, 123 124 VP8_DECODER_CTRL_ID_MAX 125 }; 126 127 /** Decrypt n bytes of data from input -> output, using the decrypt_state 128 * passed in VPXD_SET_DECRYPTOR. 129 */ 130 typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input, 131 unsigned char *output, int count); 132 133 /*!\brief Structure to hold decryption state 134 * 135 * Defines a structure to hold the decryption state and access function. 136 */ 137 typedef struct vpx_decrypt_init { 138 /*! Decrypt callback. */ 139 vpx_decrypt_cb decrypt_cb; 140 141 /*! Decryption state. */ 142 void *decrypt_state; 143 } vpx_decrypt_init; 144 145 /*!\brief A deprecated alias for vpx_decrypt_init. 146 */ 147 typedef vpx_decrypt_init vp8_decrypt_init; 148 149 150 /*!\cond */ 151 /*!\brief VP8 decoder control function parameter type 152 * 153 * Defines the data types that VP8D control functions take. Note that 154 * additional common controls are defined in vp8.h 155 * 156 */ 157 158 159 VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *) 160 #define VPX_CTRL_VP8D_GET_LAST_REF_UPDATES 161 VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *) 162 #define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED 163 VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *) 164 #define VPX_CTRL_VP8D_GET_LAST_REF_USED 165 VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *) 166 #define VPX_CTRL_VPXD_SET_DECRYPTOR 167 VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *) 168 #define VPX_CTRL_VP8D_SET_DECRYPTOR 169 VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *) 170 #define VPX_CTRL_VP9D_GET_DISPLAY_SIZE 171 VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *) 172 #define VPX_CTRL_VP9D_GET_BIT_DEPTH 173 VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *) 174 #define VPX_CTRL_VP9D_GET_FRAME_SIZE 175 VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int) 176 #define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER 177 178 /*!\endcond */ 179 /*! @} - end defgroup vp8_decoder */ 180 181 #ifdef __cplusplus 182 } // extern "C" 183 #endif 184 185 #endif // VPX_VP8DX_H_ 186