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