Line data Source code
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_VP8DX_H_
21 : #define 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 : VP8_DECODER_CTRL_ID_MAX
120 : };
121 :
122 : /** Decrypt n bytes of data from input -> output, using the decrypt_state
123 : * passed in VPXD_SET_DECRYPTOR.
124 : */
125 : typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
126 : unsigned char *output, int count);
127 :
128 : /*!\brief Structure to hold decryption state
129 : *
130 : * Defines a structure to hold the decryption state and access function.
131 : */
132 : typedef struct vpx_decrypt_init {
133 : /*! Decrypt callback. */
134 : vpx_decrypt_cb decrypt_cb;
135 :
136 : /*! Decryption state. */
137 : void *decrypt_state;
138 : } vpx_decrypt_init;
139 :
140 : /*!\brief A deprecated alias for vpx_decrypt_init.
141 : */
142 : typedef vpx_decrypt_init vp8_decrypt_init;
143 :
144 : /*!\cond */
145 : /*!\brief VP8 decoder control function parameter type
146 : *
147 : * Defines the data types that VP8D control functions take. Note that
148 : * additional common controls are defined in vp8.h
149 : *
150 : */
151 :
152 0 : VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
153 : #define VPX_CTRL_VP8D_GET_LAST_REF_UPDATES
154 0 : VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
155 : #define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED
156 0 : VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
157 : #define VPX_CTRL_VP8D_GET_LAST_REF_USED
158 0 : VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
159 : #define VPX_CTRL_VPXD_SET_DECRYPTOR
160 0 : VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
161 : #define VPX_CTRL_VP8D_SET_DECRYPTOR
162 0 : VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
163 : #define VPX_CTRL_VP9D_GET_DISPLAY_SIZE
164 0 : VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *)
165 : #define VPX_CTRL_VP9D_GET_BIT_DEPTH
166 0 : VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *)
167 : #define VPX_CTRL_VP9D_GET_FRAME_SIZE
168 0 : VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
169 : #define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER
170 : #define VPX_CTRL_VP9_DECODE_SVC_SPATIAL_LAYER
171 0 : VPX_CTRL_USE_TYPE(VP9_DECODE_SVC_SPATIAL_LAYER, int)
172 :
173 : /*!\endcond */
174 : /*! @} - end defgroup vp8_decoder */
175 :
176 : #ifdef __cplusplus
177 : } // extern "C"
178 : #endif
179 :
180 : #endif // VPX_VP8DX_H_
|