OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 * | 25 * |
26 */ | 26 */ |
27 #ifdef __cplusplus | 27 #ifdef __cplusplus |
28 extern "C" { | 28 extern "C" { |
29 #endif | 29 #endif |
30 | 30 |
31 #ifndef VPX_ENCODER_H | 31 #ifndef VPX_ENCODER_H |
32 #define VPX_ENCODER_H | 32 #define VPX_ENCODER_H |
33 #include "vpx_codec.h" | 33 #include "vpx_codec.h" |
34 | 34 |
35 /*! Temporal Scalability: Maximum length of the sequence defining frame | 35 /*! Temporal Scalability: Maximum length of the sequence defining frame |
36 * layer membership | 36 * layer membership |
37 */ | 37 */ |
38 #define VPX_TS_MAX_PERIODICITY 16 | 38 #define VPX_TS_MAX_PERIODICITY 16 |
39 | 39 |
40 /*! Temporal Scalability: Maximum number of coding layers */ | 40 /*! Temporal Scalability: Maximum number of coding layers */ |
41 #define VPX_TS_MAX_LAYERS 5 | 41 #define VPX_TS_MAX_LAYERS 5 |
42 | 42 |
43 /*!\deprecated Use #VPX_TS_MAX_PERIODICITY instead. */ | 43 /*!\deprecated Use #VPX_TS_MAX_PERIODICITY instead. */ |
44 #define MAX_PERIODICITY VPX_TS_MAX_PERIODICITY | 44 #define MAX_PERIODICITY VPX_TS_MAX_PERIODICITY |
45 | 45 |
46 /*!\deprecated Use #VPX_TS_MAX_LAYERS instead. */ | 46 /*!\deprecated Use #VPX_TS_MAX_LAYERS instead. */ |
47 #define MAX_LAYERS VPX_TS_MAX_LAYERS | 47 #define MAX_LAYERS VPX_TS_MAX_LAYERS |
48 | 48 |
49 /*!\brief Current ABI version number | 49 /*!\brief Current ABI version number |
50 * | 50 * |
51 * \internal | 51 * \internal |
52 * If this file is altered in any way that changes the ABI, this value | 52 * If this file is altered in any way that changes the ABI, this value |
53 * must be bumped. Examples include, but are not limited to, changing | 53 * must be bumped. Examples include, but are not limited to, changing |
54 * types, removing or reassigning enums, adding/removing/rearranging | 54 * types, removing or reassigning enums, adding/removing/rearranging |
55 * fields to structures | 55 * fields to structures |
56 */ | 56 */ |
57 #define VPX_ENCODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer
*/ | 57 #define VPX_ENCODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer
*/ |
58 | 58 |
59 | 59 |
60 /*! \brief Encoder capabilities bitfield | 60 /*! \brief Encoder capabilities bitfield |
61 * | 61 * |
62 * Each encoder advertises the capabilities it supports as part of its | 62 * Each encoder advertises the capabilities it supports as part of its |
63 * ::vpx_codec_iface_t interface structure. Capabilities are extra | 63 * ::vpx_codec_iface_t interface structure. Capabilities are extra |
64 * interfaces or functionality, and are not required to be supported | 64 * interfaces or functionality, and are not required to be supported |
65 * by an encoder. | 65 * by an encoder. |
66 * | 66 * |
67 * The available flags are specified by VPX_CODEC_CAP_* defines. | 67 * The available flags are specified by VPX_CODEC_CAP_* defines. |
68 */ | 68 */ |
69 #define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ | 69 #define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ |
70 | 70 |
71 /*! Can output one partition at a time. Each partition is returned in its | 71 /*! Can output one partition at a time. Each partition is returned in its |
72 * own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for | 72 * own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for |
73 * every partition but the last. In this mode all frames are always | 73 * every partition but the last. In this mode all frames are always |
74 * returned partition by partition. | 74 * returned partition by partition. |
75 */ | 75 */ |
76 #define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000 | 76 #define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000 |
77 | 77 |
78 | 78 |
79 /*! \brief Initialization-time Feature Enabling | 79 /*! \brief Initialization-time Feature Enabling |
80 * | 80 * |
81 * Certain codec features must be known at initialization time, to allow | 81 * Certain codec features must be known at initialization time, to allow |
82 * for proper memory allocation. | 82 * for proper memory allocation. |
83 * | 83 * |
84 * The available flags are specified by VPX_CODEC_USE_* defines. | 84 * The available flags are specified by VPX_CODEC_USE_* defines. |
85 */ | 85 */ |
86 #define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ | 86 #define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ |
87 #define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000 /**< Make the encoder output one | 87 #define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000 /**< Make the encoder output one |
88 partition at a time. */ | 88 partition at a time. */ |
89 | 89 |
90 | 90 |
91 /*!\brief Generic fixed size buffer structure | 91 /*!\brief Generic fixed size buffer structure |
92 * | 92 * |
93 * This structure is able to hold a reference to any fixed size buffer. | 93 * This structure is able to hold a reference to any fixed size buffer. |
94 */ | 94 */ |
95 typedef struct vpx_fixed_buf | 95 typedef struct vpx_fixed_buf { |
96 { | 96 void *buf; /**< Pointer to the data */ |
97 void *buf; /**< Pointer to the data */ | 97 size_t sz; /**< Length of the buffer, in chars */ |
98 size_t sz; /**< Length of the buffer, in chars */ | 98 } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */ |
99 } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */ | 99 |
100 | 100 |
101 | 101 /*!\brief Time Stamp Type |
102 /*!\brief Time Stamp Type | 102 * |
103 * | 103 * An integer, which when multiplied by the stream's time base, provides |
104 * An integer, which when multiplied by the stream's time base, provides | 104 * the absolute time of a sample. |
105 * the absolute time of a sample. | 105 */ |
106 */ | 106 typedef int64_t vpx_codec_pts_t; |
107 typedef int64_t vpx_codec_pts_t; | 107 |
108 | 108 |
109 | 109 /*!\brief Compressed Frame Flags |
110 /*!\brief Compressed Frame Flags | 110 * |
111 * | 111 * This type represents a bitfield containing information about a compressed |
112 * This type represents a bitfield containing information about a compressed | 112 * frame that may be useful to an application. The most significant 16 bits |
113 * frame that may be useful to an application. The most significant 16 bits | 113 * can be used by an algorithm to provide additional detail, for example to |
114 * can be used by an algorithm to provide additional detail, for example to | 114 * support frame types that are codec specific (MPEG-1 D-frames for example) |
115 * support frame types that are codec specific (MPEG-1 D-frames for example) | 115 */ |
116 */ | 116 typedef uint32_t vpx_codec_frame_flags_t; |
117 typedef uint32_t vpx_codec_frame_flags_t; | |
118 #define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */ | 117 #define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */ |
119 #define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting | 118 #define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting |
120 the stream (no future frame depends on | 119 the stream (no future frame depends on |
121 this one) */ | 120 this one) */ |
122 #define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not | 121 #define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not |
123 be shown */ | 122 be shown */ |
124 #define VPX_FRAME_IS_FRAGMENT 0x8 /**< this is a fragment of the encoded | 123 #define VPX_FRAME_IS_FRAGMENT 0x8 /**< this is a fragment of the encoded |
125 frame */ | 124 frame */ |
126 | 125 |
127 /*!\brief Error Resilient flags | 126 /*!\brief Error Resilient flags |
128 * | 127 * |
129 * These flags define which error resilient features to enable in the | 128 * These flags define which error resilient features to enable in the |
130 * encoder. The flags are specified through the | 129 * encoder. The flags are specified through the |
131 * vpx_codec_enc_cfg::g_error_resilient variable. | 130 * vpx_codec_enc_cfg::g_error_resilient variable. |
132 */ | 131 */ |
133 typedef uint32_t vpx_codec_er_flags_t; | 132 typedef uint32_t vpx_codec_er_flags_t; |
134 #define VPX_ERROR_RESILIENT_DEFAULT 0x1 /**< Improve resiliency against | 133 #define VPX_ERROR_RESILIENT_DEFAULT 0x1 /**< Improve resiliency against |
135 losses of whole frames */ | 134 losses of whole frames */ |
136 #define VPX_ERROR_RESILIENT_PARTITIONS 0x2 /**< The frame partitions are | 135 #define VPX_ERROR_RESILIENT_PARTITIONS 0x2 /**< The frame partitions are |
137 independently decodable by the | 136 independently decodable by the |
138 bool decoder, meaning that | 137 bool decoder, meaning that |
139 partitions can be decoded even | 138 partitions can be decoded even |
140 though earlier partitions have | 139 though earlier partitions have |
141 been lost. Note that intra | 140 been lost. Note that intra |
142 predicition is still done over | 141 predicition is still done over |
143 the partition boundary. */ | 142 the partition boundary. */ |
144 | 143 |
145 /*!\brief Encoder output packet variants | 144 /*!\brief Encoder output packet variants |
146 * | 145 * |
147 * This enumeration lists the different kinds of data packets that can be | 146 * This enumeration lists the different kinds of data packets that can be |
148 * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY | 147 * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY |
149 * extend this list to provide additional functionality. | 148 * extend this list to provide additional functionality. |
150 */ | 149 */ |
151 enum vpx_codec_cx_pkt_kind | 150 enum vpx_codec_cx_pkt_kind { |
152 { | 151 VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */ |
153 VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */ | 152 VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */ |
154 VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */ | 153 VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */ |
155 VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */ | 154 VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */ |
156 VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */ | 155 }; |
157 }; | 156 |
158 | 157 |
159 | 158 /*!\brief Encoder output packet |
160 /*!\brief Encoder output packet | 159 * |
161 * | 160 * This structure contains the different kinds of output data the encoder |
162 * This structure contains the different kinds of output data the encoder | 161 * may produce while compressing a frame. |
163 * may produce while compressing a frame. | 162 */ |
164 */ | 163 typedef struct vpx_codec_cx_pkt { |
165 typedef struct vpx_codec_cx_pkt | 164 enum vpx_codec_cx_pkt_kind kind; /**< packet variant */ |
166 { | 165 union { |
167 enum vpx_codec_cx_pkt_kind kind; /**< packet variant */ | 166 struct { |
168 union | 167 void *buf; /**< compressed data buffer */ |
169 { | 168 size_t sz; /**< length of compressed data */ |
170 struct | 169 vpx_codec_pts_t pts; /**< time stamp to show frame |
171 { | |
172 void *buf; /**< compressed data buffer *
/ | |
173 size_t sz; /**< length of compressed dat
a */ | |
174 vpx_codec_pts_t pts; /**< time stamp to show frame | |
175 (in timebase units) */ | 170 (in timebase units) */ |
176 unsigned long duration; /**< duration to show frame | 171 unsigned long duration; /**< duration to show frame |
177 (in timebase units) */ | 172 (in timebase units) */ |
178 vpx_codec_frame_flags_t flags; /**< flags for this frame */ | 173 vpx_codec_frame_flags_t flags; /**< flags for this frame */ |
179 int partition_id; /**< the partition id | 174 int partition_id; /**< the partition id |
180 defines the decoding order | 175 defines the decoding order |
181 of the partitions. Only | 176 of the partitions. Only |
182 applicable when "output partition" | 177 applicable when "output partition" |
183 mode is enabled. First partition | 178 mode is enabled. First partition |
184 has id 0.*/ | 179 has id 0.*/ |
185 | 180 |
186 } frame; /**< data for compressed frame packet */ | 181 } frame; /**< data for compressed frame packet */ |
187 struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet *
/ | 182 struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */ |
188 struct vpx_psnr_pkt | 183 struct vpx_psnr_pkt { |
189 { | 184 unsigned int samples[4]; /**< Number of samples, total/y/u/v */ |
190 unsigned int samples[4]; /**< Number of samples, total/y/u/v */ | 185 uint64_t sse[4]; /**< sum squared error, total/y/u/v */ |
191 uint64_t sse[4]; /**< sum squared error, total/y/u/v */ | 186 double psnr[4]; /**< PSNR, total/y/u/v */ |
192 double psnr[4]; /**< PSNR, total/y/u/v */ | 187 } psnr; /**< data for PSNR packet */ |
193 } psnr; /**< data for PSNR packet */ | 188 struct vpx_fixed_buf raw; /**< data for arbitrary packets */ |
194 struct vpx_fixed_buf raw; /**< data for arbitrary packets */ | 189 |
195 | 190 /* This packet size is fixed to allow codecs to extend this |
196 /* This packet size is fixed to allow codecs to extend this | 191 * interface without having to manage storage for raw packets, |
197 * interface without having to manage storage for raw packets, | 192 * i.e., if it's smaller than 128 bytes, you can store in the |
198 * i.e., if it's smaller than 128 bytes, you can store in the | 193 * packet list directly. |
199 * packet list directly. | 194 */ |
200 */ | 195 char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */ |
201 char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */ | 196 } data; /**< packet data */ |
202 } data; /**< packet data */ | 197 } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */ |
203 } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */ | 198 |
204 | 199 |
205 | 200 /*!\brief Rational Number |
206 /*!\brief Rational Number | 201 * |
207 * | 202 * This structure holds a fractional value. |
208 * This structure holds a fractional value. | 203 */ |
209 */ | 204 typedef struct vpx_rational { |
210 typedef struct vpx_rational | 205 int num; /**< fraction numerator */ |
211 { | 206 int den; /**< fraction denominator */ |
212 int num; /**< fraction numerator */ | 207 } vpx_rational_t; /**< alias for struct vpx_rational */ |
213 int den; /**< fraction denominator */ | 208 |
214 } vpx_rational_t; /**< alias for struct vpx_rational */ | 209 |
215 | 210 /*!\brief Multi-pass Encoding Pass */ |
216 | 211 enum vpx_enc_pass { |
217 /*!\brief Multi-pass Encoding Pass */ | 212 VPX_RC_ONE_PASS, /**< Single pass mode */ |
218 enum vpx_enc_pass | 213 VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */ |
219 { | 214 VPX_RC_LAST_PASS /**< Final pass of multi-pass mode */ |
220 VPX_RC_ONE_PASS, /**< Single pass mode */ | 215 }; |
221 VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */ | 216 |
222 VPX_RC_LAST_PASS /**< Final pass of multi-pass mode */ | 217 |
223 }; | 218 /*!\brief Rate control mode */ |
224 | 219 enum vpx_rc_mode { |
225 | 220 VPX_VBR, /**< Variable Bit Rate (VBR) mode */ |
226 /*!\brief Rate control mode */ | 221 VPX_CBR, /**< Constant Bit Rate (CBR) mode */ |
227 enum vpx_rc_mode | 222 VPX_CQ /**< Constant Quality (CQ) mode */ |
228 { | 223 }; |
229 VPX_VBR, /**< Variable Bit Rate (VBR) mode */ | 224 |
230 VPX_CBR, /**< Constant Bit Rate (CBR) mode */ | 225 |
231 VPX_CQ /**< Constant Quality (CQ) mode */ | 226 /*!\brief Keyframe placement mode. |
232 }; | 227 * |
233 | 228 * This enumeration determines whether keyframes are placed automatically by |
234 | 229 * the encoder or whether this behavior is disabled. Older releases of this |
235 /*!\brief Keyframe placement mode. | 230 * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled. |
236 * | 231 * This name is confusing for this behavior, so the new symbols to be used |
237 * This enumeration determines whether keyframes are placed automatically by | 232 * are VPX_KF_AUTO and VPX_KF_DISABLED. |
238 * the encoder or whether this behavior is disabled. Older releases of this | 233 */ |
239 * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled
. | 234 enum vpx_kf_mode { |
240 * This name is confusing for this behavior, so the new symbols to be used | 235 VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */ |
241 * are VPX_KF_AUTO and VPX_KF_DISABLED. | 236 VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */ |
242 */ | 237 VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */ |
243 enum vpx_kf_mode | 238 }; |
244 { | 239 |
245 VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */ | 240 |
246 VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */ | 241 /*!\brief Encoded Frame Flags |
247 VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */ | 242 * |
248 }; | 243 * This type indicates a bitfield to be passed to vpx_codec_encode(), defining |
249 | 244 * per-frame boolean values. By convention, bits common to all codecs will be |
250 | 245 * named VPX_EFLAG_*, and bits specific to an algorithm will be named |
251 /*!\brief Encoded Frame Flags | 246 * /algo/_eflag_*. The lower order 16 bits are reserved for common use. |
252 * | 247 */ |
253 * This type indicates a bitfield to be passed to vpx_codec_encode(), defini
ng | 248 typedef long vpx_enc_frame_flags_t; |
254 * per-frame boolean values. By convention, bits common to all codecs will b
e | |
255 * named VPX_EFLAG_*, and bits specific to an algorithm will be named | |
256 * /algo/_eflag_*. The lower order 16 bits are reserved for common use. | |
257 */ | |
258 typedef long vpx_enc_frame_flags_t; | |
259 #define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */ | 249 #define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */ |
260 | 250 |
261 | 251 |
262 /*!\brief Encoder configuration structure | 252 /*!\brief Encoder configuration structure |
263 * | 253 * |
264 * This structure contains the encoder settings that have common representat
ions | 254 * This structure contains the encoder settings that have common representatio
ns |
265 * across all codecs. This doesn't imply that all codecs support all feature
s, | 255 * across all codecs. This doesn't imply that all codecs support all features, |
266 * however. | 256 * however. |
267 */ | 257 */ |
268 typedef struct vpx_codec_enc_cfg | 258 typedef struct vpx_codec_enc_cfg { |
269 { | 259 /* |
270 /* | 260 * generic settings (g) |
271 * generic settings (g) | 261 */ |
272 */ | 262 |
273 | 263 /*!\brief Algorithm specific "usage" value |
274 /*!\brief Algorithm specific "usage" value | 264 * |
275 * | 265 * Algorithms may define multiple values for usage, which may convey the |
276 * Algorithms may define multiple values for usage, which may convey the | 266 * intent of how the application intends to use the stream. If this value |
277 * intent of how the application intends to use the stream. If this valu
e | 267 * is non-zero, consult the documentation for the codec to determine its |
278 * is non-zero, consult the documentation for the codec to determine its | 268 * meaning. |
279 * meaning. | 269 */ |
280 */ | 270 unsigned int g_usage; |
281 unsigned int g_usage; | 271 |
282 | 272 |
283 | 273 /*!\brief Maximum number of threads to use |
284 /*!\brief Maximum number of threads to use | 274 * |
285 * | 275 * For multi-threaded implementations, use no more than this number of |
286 * For multi-threaded implementations, use no more than this number of | 276 * threads. The codec may use fewer threads than allowed. The value |
287 * threads. The codec may use fewer threads than allowed. The value | 277 * 0 is equivalent to the value 1. |
288 * 0 is equivalent to the value 1. | 278 */ |
289 */ | 279 unsigned int g_threads; |
290 unsigned int g_threads; | 280 |
291 | 281 |
292 | 282 /*!\brief Bitstream profile to use |
293 /*!\brief Bitstream profile to use | 283 * |
294 * | 284 * Some codecs support a notion of multiple bitstream profiles. Typically |
295 * Some codecs support a notion of multiple bitstream profiles. Typicall
y | 285 * this maps to a set of features that are turned on or off. Often the |
296 * this maps to a set of features that are turned on or off. Often the | 286 * profile to use is determined by the features of the intended decoder. |
297 * profile to use is determined by the features of the intended decoder. | 287 * Consult the documentation for the codec to determine the valid values |
298 * Consult the documentation for the codec to determine the valid values | 288 * for this parameter, or set to zero for a sane default. |
299 * for this parameter, or set to zero for a sane default. | 289 */ |
300 */ | 290 unsigned int g_profile; /**< profile of bitstream to use */ |
301 unsigned int g_profile; /**< profile of bitstream to use */ | 291 |
302 | 292 |
303 | 293 |
304 | 294 /*!\brief Width of the frame |
305 /*!\brief Width of the frame | 295 * |
306 * | 296 * This value identifies the presentation resolution of the frame, |
307 * This value identifies the presentation resolution of the frame, | 297 * in pixels. Note that the frames passed as input to the encoder must |
308 * in pixels. Note that the frames passed as input to the encoder must | 298 * have this resolution. Frames will be presented by the decoder in this |
309 * have this resolution. Frames will be presented by the decoder in this | 299 * resolution, independent of any spatial resampling the encoder may do. |
310 * resolution, independent of any spatial resampling the encoder may do. | 300 */ |
311 */ | 301 unsigned int g_w; |
312 unsigned int g_w; | 302 |
313 | 303 |
314 | 304 /*!\brief Height of the frame |
315 /*!\brief Height of the frame | 305 * |
316 * | 306 * This value identifies the presentation resolution of the frame, |
317 * This value identifies the presentation resolution of the frame, | 307 * in pixels. Note that the frames passed as input to the encoder must |
318 * in pixels. Note that the frames passed as input to the encoder must | 308 * have this resolution. Frames will be presented by the decoder in this |
319 * have this resolution. Frames will be presented by the decoder in this | 309 * resolution, independent of any spatial resampling the encoder may do. |
320 * resolution, independent of any spatial resampling the encoder may do. | 310 */ |
321 */ | 311 unsigned int g_h; |
322 unsigned int g_h; | 312 |
323 | 313 |
324 | 314 /*!\brief Stream timebase units |
325 /*!\brief Stream timebase units | 315 * |
326 * | 316 * Indicates the smallest interval of time, in seconds, used by the stream. |
327 * Indicates the smallest interval of time, in seconds, used by the stre
am. | 317 * For fixed frame rate material, or variable frame rate material where |
328 * For fixed frame rate material, or variable frame rate material where | 318 * frames are timed at a multiple of a given clock (ex: video capture), |
329 * frames are timed at a multiple of a given clock (ex: video capture), | 319 * the \ref RECOMMENDED method is to set the timebase to the reciprocal |
330 * the \ref RECOMMENDED method is to set the timebase to the reciprocal | 320 * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the |
331 * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows th
e | 321 * pts to correspond to the frame number, which can be handy. For |
332 * pts to correspond to the frame number, which can be handy. For | 322 * re-encoding video from containers with absolute time timestamps, the |
333 * re-encoding video from containers with absolute time timestamps, the | 323 * \ref RECOMMENDED method is to set the timebase to that of the parent |
334 * \ref RECOMMENDED method is to set the timebase to that of the parent | 324 * container or multimedia framework (ex: 1/1000 for ms, as in FLV). |
335 * container or multimedia framework (ex: 1/1000 for ms, as in FLV). | 325 */ |
336 */ | 326 struct vpx_rational g_timebase; |
337 struct vpx_rational g_timebase; | 327 |
338 | 328 |
339 | 329 /*!\brief Enable error resilient modes. |
340 /*!\brief Enable error resilient modes. | 330 * |
341 * | 331 * The error resilient bitfield indicates to the encoder which features |
342 * The error resilient bitfield indicates to the encoder which features | 332 * it should enable to take measures for streaming over lossy or noisy |
343 * it should enable to take measures for streaming over lossy or noisy | 333 * links. |
344 * links. | 334 */ |
345 */ | 335 vpx_codec_er_flags_t g_error_resilient; |
346 vpx_codec_er_flags_t g_error_resilient; | 336 |
347 | 337 |
348 | 338 /*!\brief Multi-pass Encoding Mode |
349 /*!\brief Multi-pass Encoding Mode | 339 * |
350 * | 340 * This value should be set to the current phase for multi-pass encoding. |
351 * This value should be set to the current phase for multi-pass encoding
. | 341 * For single pass, set to #VPX_RC_ONE_PASS. |
352 * For single pass, set to #VPX_RC_ONE_PASS. | 342 */ |
353 */ | 343 enum vpx_enc_pass g_pass; |
354 enum vpx_enc_pass g_pass; | 344 |
355 | 345 |
356 | 346 /*!\brief Allow lagged encoding |
357 /*!\brief Allow lagged encoding | 347 * |
358 * | 348 * If set, this value allows the encoder to consume a number of input |
359 * If set, this value allows the encoder to consume a number of input | 349 * frames before producing output frames. This allows the encoder to |
360 * frames before producing output frames. This allows the encoder to | 350 * base decisions for the current frame on future frames. This does |
361 * base decisions for the current frame on future frames. This does | 351 * increase the latency of the encoding pipeline, so it is not appropriate |
362 * increase the latency of the encoding pipeline, so it is not appropria
te | 352 * in all situations (ex: realtime encoding). |
363 * in all situations (ex: realtime encoding). | 353 * |
364 * | 354 * Note that this is a maximum value -- the encoder may produce frames |
365 * Note that this is a maximum value -- the encoder may produce frames | 355 * sooner than the given limit. Set this value to 0 to disable this |
366 * sooner than the given limit. Set this value to 0 to disable this | 356 * feature. |
367 * feature. | 357 */ |
368 */ | 358 unsigned int g_lag_in_frames; |
369 unsigned int g_lag_in_frames; | 359 |
370 | 360 |
371 | 361 /* |
372 /* | 362 * rate control settings (rc) |
373 * rate control settings (rc) | 363 */ |
374 */ | 364 |
375 | 365 /*!\brief Temporal resampling configuration, if supported by the codec. |
376 /*!\brief Temporal resampling configuration, if supported by the codec. | 366 * |
377 * | 367 * Temporal resampling allows the codec to "drop" frames as a strategy to |
378 * Temporal resampling allows the codec to "drop" frames as a strategy t
o | 368 * meet its target data rate. This can cause temporal discontinuities in |
379 * meet its target data rate. This can cause temporal discontinuities in | 369 * the encoded video, which may appear as stuttering during playback. This |
380 * the encoded video, which may appear as stuttering during playback. Th
is | 370 * trade-off is often acceptable, but for many applications is not. It can |
381 * trade-off is often acceptable, but for many applications is not. It c
an | 371 * be disabled in these cases. |
382 * be disabled in these cases. | 372 * |
383 * | 373 * Note that not all codecs support this feature. All vpx VPx codecs do. |
384 * Note that not all codecs support this feature. All vpx VPx codecs do. | 374 * For other codecs, consult the documentation for that algorithm. |
385 * For other codecs, consult the documentation for that algorithm. | 375 * |
386 * | 376 * This threshold is described as a percentage of the target data buffer. |
387 * This threshold is described as a percentage of the target data buffer
. | 377 * When the data buffer falls below this percentage of fullness, a |
388 * When the data buffer falls below this percentage of fullness, a | 378 * dropped frame is indicated. Set the threshold to zero (0) to disable |
389 * dropped frame is indicated. Set the threshold to zero (0) to disable | 379 * this feature. |
390 * this feature. | 380 */ |
391 */ | 381 unsigned int rc_dropframe_thresh; |
392 unsigned int rc_dropframe_thresh; | 382 |
393 | 383 |
394 | 384 /*!\brief Enable/disable spatial resampling, if supported by the codec. |
395 /*!\brief Enable/disable spatial resampling, if supported by the codec. | 385 * |
396 * | 386 * Spatial resampling allows the codec to compress a lower resolution |
397 * Spatial resampling allows the codec to compress a lower resolution | 387 * version of the frame, which is then upscaled by the encoder to the |
398 * version of the frame, which is then upscaled by the encoder to the | 388 * correct presentation resolution. This increases visual quality at |
399 * correct presentation resolution. This increases visual quality at | 389 * low data rates, at the expense of CPU time on the encoder/decoder. |
400 * low data rates, at the expense of CPU time on the encoder/decoder. | 390 */ |
401 */ | 391 unsigned int rc_resize_allowed; |
402 unsigned int rc_resize_allowed; | 392 |
403 | 393 |
404 | 394 /*!\brief Spatial resampling up watermark. |
405 /*!\brief Spatial resampling up watermark. | 395 * |
406 * | 396 * This threshold is described as a percentage of the target data buffer. |
407 * This threshold is described as a percentage of the target data buffer
. | 397 * When the data buffer rises above this percentage of fullness, the |
408 * When the data buffer rises above this percentage of fullness, the | 398 * encoder will step up to a higher resolution version of the frame. |
409 * encoder will step up to a higher resolution version of the frame. | 399 */ |
410 */ | 400 unsigned int rc_resize_up_thresh; |
411 unsigned int rc_resize_up_thresh; | 401 |
412 | 402 |
413 | 403 /*!\brief Spatial resampling down watermark. |
414 /*!\brief Spatial resampling down watermark. | 404 * |
415 * | 405 * This threshold is described as a percentage of the target data buffer. |
416 * This threshold is described as a percentage of the target data buffer
. | 406 * When the data buffer falls below this percentage of fullness, the |
417 * When the data buffer falls below this percentage of fullness, the | 407 * encoder will step down to a lower resolution version of the frame. |
418 * encoder will step down to a lower resolution version of the frame. | 408 */ |
419 */ | 409 unsigned int rc_resize_down_thresh; |
420 unsigned int rc_resize_down_thresh; | 410 |
421 | 411 |
422 | 412 /*!\brief Rate control algorithm to use. |
423 /*!\brief Rate control algorithm to use. | 413 * |
424 * | 414 * Indicates whether the end usage of this stream is to be streamed over |
425 * Indicates whether the end usage of this stream is to be streamed over | 415 * a bandwidth constrained link, indicating that Constant Bit Rate (CBR) |
426 * a bandwidth constrained link, indicating that Constant Bit Rate (CBR) | 416 * mode should be used, or whether it will be played back on a high |
427 * mode should be used, or whether it will be played back on a high | 417 * bandwidth link, as from a local disk, where higher variations in |
428 * bandwidth link, as from a local disk, where higher variations in | 418 * bitrate are acceptable. |
429 * bitrate are acceptable. | 419 */ |
430 */ | 420 enum vpx_rc_mode rc_end_usage; |
431 enum vpx_rc_mode rc_end_usage; | 421 |
432 | 422 |
433 | 423 /*!\brief Two-pass stats buffer. |
434 /*!\brief Two-pass stats buffer. | 424 * |
435 * | 425 * A buffer containing all of the stats packets produced in the first |
436 * A buffer containing all of the stats packets produced in the first | 426 * pass, concatenated. |
437 * pass, concatenated. | 427 */ |
438 */ | 428 struct vpx_fixed_buf rc_twopass_stats_in; |
439 struct vpx_fixed_buf rc_twopass_stats_in; | 429 |
440 | 430 |
441 | 431 /*!\brief Target data rate |
442 /*!\brief Target data rate | 432 * |
443 * | 433 * Target bandwidth to use for this stream, in kilobits per second. |
444 * Target bandwidth to use for this stream, in kilobits per second. | 434 */ |
445 */ | 435 unsigned int rc_target_bitrate; |
446 unsigned int rc_target_bitrate; | 436 |
447 | 437 |
448 | 438 /* |
449 /* | 439 * quantizer settings |
450 * quantizer settings | 440 */ |
451 */ | 441 |
452 | 442 |
453 | 443 /*!\brief Minimum (Best Quality) Quantizer |
454 /*!\brief Minimum (Best Quality) Quantizer | 444 * |
455 * | 445 * The quantizer is the most direct control over the quality of the |
456 * The quantizer is the most direct control over the quality of the | 446 * encoded image. The range of valid values for the quantizer is codec |
457 * encoded image. The range of valid values for the quantizer is codec | 447 * specific. Consult the documentation for the codec to determine the |
458 * specific. Consult the documentation for the codec to determine the | 448 * values to use. To determine the range programmatically, call |
459 * values to use. To determine the range programmatically, call | 449 * vpx_codec_enc_config_default() with a usage value of 0. |
460 * vpx_codec_enc_config_default() with a usage value of 0. | 450 */ |
461 */ | 451 unsigned int rc_min_quantizer; |
462 unsigned int rc_min_quantizer; | 452 |
463 | 453 |
464 | 454 /*!\brief Maximum (Worst Quality) Quantizer |
465 /*!\brief Maximum (Worst Quality) Quantizer | 455 * |
466 * | 456 * The quantizer is the most direct control over the quality of the |
467 * The quantizer is the most direct control over the quality of the | 457 * encoded image. The range of valid values for the quantizer is codec |
468 * encoded image. The range of valid values for the quantizer is codec | 458 * specific. Consult the documentation for the codec to determine the |
469 * specific. Consult the documentation for the codec to determine the | 459 * values to use. To determine the range programmatically, call |
470 * values to use. To determine the range programmatically, call | 460 * vpx_codec_enc_config_default() with a usage value of 0. |
471 * vpx_codec_enc_config_default() with a usage value of 0. | 461 */ |
472 */ | 462 unsigned int rc_max_quantizer; |
473 unsigned int rc_max_quantizer; | 463 |
474 | 464 |
475 | 465 /* |
476 /* | 466 * bitrate tolerance |
477 * bitrate tolerance | 467 */ |
478 */ | 468 |
479 | 469 |
480 | 470 /*!\brief Rate control adaptation undershoot control |
481 /*!\brief Rate control adaptation undershoot control | 471 * |
482 * | 472 * This value, expressed as a percentage of the target bitrate, |
483 * This value, expressed as a percentage of the target bitrate, | 473 * controls the maximum allowed adaptation speed of the codec. |
484 * controls the maximum allowed adaptation speed of the codec. | 474 * This factor controls the maximum amount of bits that can |
485 * This factor controls the maximum amount of bits that can | 475 * be subtracted from the target bitrate in order to compensate |
486 * be subtracted from the target bitrate in order to compensate | 476 * for prior overshoot. |
487 * for prior overshoot. | 477 * |
488 * | 478 * Valid values in the range 0-1000. |
489 * Valid values in the range 0-1000. | 479 */ |
490 */ | 480 unsigned int rc_undershoot_pct; |
491 unsigned int rc_undershoot_pct; | 481 |
492 | 482 |
493 | 483 /*!\brief Rate control adaptation overshoot control |
494 /*!\brief Rate control adaptation overshoot control | 484 * |
495 * | 485 * This value, expressed as a percentage of the target bitrate, |
496 * This value, expressed as a percentage of the target bitrate, | 486 * controls the maximum allowed adaptation speed of the codec. |
497 * controls the maximum allowed adaptation speed of the codec. | 487 * This factor controls the maximum amount of bits that can |
498 * This factor controls the maximum amount of bits that can | 488 * be added to the target bitrate in order to compensate for |
499 * be added to the target bitrate in order to compensate for | 489 * prior undershoot. |
500 * prior undershoot. | 490 * |
501 * | 491 * Valid values in the range 0-1000. |
502 * Valid values in the range 0-1000. | 492 */ |
503 */ | 493 unsigned int rc_overshoot_pct; |
504 unsigned int rc_overshoot_pct; | 494 |
505 | 495 |
506 | 496 /* |
507 /* | 497 * decoder buffer model parameters |
508 * decoder buffer model parameters | 498 */ |
509 */ | 499 |
510 | 500 |
511 | 501 /*!\brief Decoder Buffer Size |
512 /*!\brief Decoder Buffer Size | 502 * |
513 * | 503 * This value indicates the amount of data that may be buffered by the |
514 * This value indicates the amount of data that may be buffered by the | 504 * decoding application. Note that this value is expressed in units of |
515 * decoding application. Note that this value is expressed in units of | 505 * time (milliseconds). For example, a value of 5000 indicates that the |
516 * time (milliseconds). For example, a value of 5000 indicates that the | 506 * client will buffer (at least) 5000ms worth of encoded data. Use the |
517 * client will buffer (at least) 5000ms worth of encoded data. Use the | 507 * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if |
518 * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if | 508 * necessary. |
519 * necessary. | 509 */ |
520 */ | 510 unsigned int rc_buf_sz; |
521 unsigned int rc_buf_sz; | 511 |
522 | 512 |
523 | 513 /*!\brief Decoder Buffer Initial Size |
524 /*!\brief Decoder Buffer Initial Size | 514 * |
525 * | 515 * This value indicates the amount of data that will be buffered by the |
526 * This value indicates the amount of data that will be buffered by the | 516 * decoding application prior to beginning playback. This value is |
527 * decoding application prior to beginning playback. This value is | 517 * expressed in units of time (milliseconds). Use the target bitrate |
528 * expressed in units of time (milliseconds). Use the target bitrate | 518 * (#rc_target_bitrate) to convert to bits/bytes, if necessary. |
529 * (#rc_target_bitrate) to convert to bits/bytes, if necessary. | 519 */ |
530 */ | 520 unsigned int rc_buf_initial_sz; |
531 unsigned int rc_buf_initial_sz; | 521 |
532 | 522 |
533 | 523 /*!\brief Decoder Buffer Optimal Size |
534 /*!\brief Decoder Buffer Optimal Size | 524 * |
535 * | 525 * This value indicates the amount of data that the encoder should try |
536 * This value indicates the amount of data that the encoder should try | 526 * to maintain in the decoder's buffer. This value is expressed in units |
537 * to maintain in the decoder's buffer. This value is expressed in units | 527 * of time (milliseconds). Use the target bitrate (#rc_target_bitrate) |
538 * of time (milliseconds). Use the target bitrate (#rc_target_bitrate) | 528 * to convert to bits/bytes, if necessary. |
539 * to convert to bits/bytes, if necessary. | 529 */ |
540 */ | 530 unsigned int rc_buf_optimal_sz; |
541 unsigned int rc_buf_optimal_sz; | 531 |
542 | 532 |
543 | 533 /* |
544 /* | 534 * 2 pass rate control parameters |
545 * 2 pass rate control parameters | 535 */ |
546 */ | 536 |
547 | 537 |
548 | 538 /*!\brief Two-pass mode CBR/VBR bias |
549 /*!\brief Two-pass mode CBR/VBR bias | 539 * |
550 * | 540 * Bias, expressed on a scale of 0 to 100, for determining target size |
551 * Bias, expressed on a scale of 0 to 100, for determining target size | 541 * for the current frame. The value 0 indicates the optimal CBR mode |
552 * for the current frame. The value 0 indicates the optimal CBR mode | 542 * value should be used. The value 100 indicates the optimal VBR mode |
553 * value should be used. The value 100 indicates the optimal VBR mode | 543 * value should be used. Values in between indicate which way the |
554 * value should be used. Values in between indicate which way the | 544 * encoder should "lean." |
555 * encoder should "lean." | 545 */ |
556 */ | 546 unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias betwee
n CBR and VBR(0-100: 0->CBR, 100->VBR) */ |
557 unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias be
tween CBR and VBR(0-100: 0->CBR, 100->VBR) */ | 547 |
558 | 548 |
559 | 549 /*!\brief Two-pass mode per-GOP minimum bitrate |
560 /*!\brief Two-pass mode per-GOP minimum bitrate | 550 * |
561 * | 551 * This value, expressed as a percentage of the target bitrate, indicates |
562 * This value, expressed as a percentage of the target bitrate, indicate
s | 552 * the minimum bitrate to be used for a single GOP (aka "section") |
563 * the minimum bitrate to be used for a single GOP (aka "section") | 553 */ |
564 */ | 554 unsigned int rc_2pass_vbr_minsection_pct; |
565 unsigned int rc_2pass_vbr_minsection_pct; | 555 |
566 | 556 |
567 | 557 /*!\brief Two-pass mode per-GOP maximum bitrate |
568 /*!\brief Two-pass mode per-GOP maximum bitrate | 558 * |
569 * | 559 * This value, expressed as a percentage of the target bitrate, indicates |
570 * This value, expressed as a percentage of the target bitrate, indicate
s | 560 * the maximum bitrate to be used for a single GOP (aka "section") |
571 * the maximum bitrate to be used for a single GOP (aka "section") | 561 */ |
572 */ | 562 unsigned int rc_2pass_vbr_maxsection_pct; |
573 unsigned int rc_2pass_vbr_maxsection_pct; | 563 |
574 | 564 |
575 | 565 /* |
576 /* | 566 * keyframing settings (kf) |
577 * keyframing settings (kf) | 567 */ |
578 */ | 568 |
579 | 569 /*!\brief Keyframe placement mode |
580 /*!\brief Keyframe placement mode | 570 * |
581 * | 571 * This value indicates whether the encoder should place keyframes at a |
582 * This value indicates whether the encoder should place keyframes at a | 572 * fixed interval, or determine the optimal placement automatically |
583 * fixed interval, or determine the optimal placement automatically | 573 * (as governed by the #kf_min_dist and #kf_max_dist parameters) |
584 * (as governed by the #kf_min_dist and #kf_max_dist parameters) | 574 */ |
585 */ | 575 enum vpx_kf_mode kf_mode; |
586 enum vpx_kf_mode kf_mode; | 576 |
587 | 577 |
588 | 578 /*!\brief Keyframe minimum interval |
589 /*!\brief Keyframe minimum interval | 579 * |
590 * | 580 * This value, expressed as a number of frames, prevents the encoder from |
591 * This value, expressed as a number of frames, prevents the encoder fro
m | 581 * placing a keyframe nearer than kf_min_dist to the previous keyframe. At |
592 * placing a keyframe nearer than kf_min_dist to the previous keyframe.
At | 582 * least kf_min_dist frames non-keyframes will be coded before the next |
593 * least kf_min_dist frames non-keyframes will be coded before the next | 583 * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval. |
594 * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval. | 584 */ |
595 */ | 585 unsigned int kf_min_dist; |
596 unsigned int kf_min_dist; | 586 |
597 | 587 |
598 | 588 /*!\brief Keyframe maximum interval |
599 /*!\brief Keyframe maximum interval | 589 * |
600 * | 590 * This value, expressed as a number of frames, forces the encoder to code |
601 * This value, expressed as a number of frames, forces the encoder to co
de | 591 * a keyframe if one has not been coded in the last kf_max_dist frames. |
602 * a keyframe if one has not been coded in the last kf_max_dist frames. | 592 * A value of 0 implies all frames will be keyframes. Set kf_min_dist |
603 * A value of 0 implies all frames will be keyframes. Set kf_min_dist | 593 * equal to kf_max_dist for a fixed interval. |
604 * equal to kf_max_dist for a fixed interval. | 594 */ |
605 */ | 595 unsigned int kf_max_dist; |
606 unsigned int kf_max_dist; | 596 |
607 | 597 /* |
608 /* | 598 * Temporal scalability settings (ts) |
609 * Temporal scalability settings (ts) | 599 */ |
610 */ | 600 |
611 | 601 /*!\brief Number of coding layers |
612 /*!\brief Number of coding layers | 602 * |
613 * | 603 * This value specifies the number of coding layers to be used. |
614 * This value specifies the number of coding layers to be used. | 604 */ |
615 */ | 605 unsigned int ts_number_layers; |
616 unsigned int ts_number_layers; | 606 |
617 | 607 /*!\brief Target bitrate for each layer |
618 /*!\brief Target bitrate for each layer | 608 * |
619 * | 609 * These values specify the target coding bitrate for each coding layer. |
620 * These values specify the target coding bitrate for each coding layer. | 610 */ |
621 */ | 611 unsigned int ts_target_bitrate[VPX_TS_MAX_LAYERS]; |
622 unsigned int ts_target_bitrate[VPX_TS_MAX_LAYERS]; | 612 |
623 | 613 /*!\brief Frame rate decimation factor for each layer |
624 /*!\brief Frame rate decimation factor for each layer | 614 * |
625 * | 615 * These values specify the frame rate decimation factors to apply |
626 * These values specify the frame rate decimation factors to apply | 616 * to each layer. |
627 * to each layer. | 617 */ |
628 */ | 618 unsigned int ts_rate_decimator[VPX_TS_MAX_LAYERS]; |
629 unsigned int ts_rate_decimator[VPX_TS_MAX_LAYERS]; | 619 |
630 | 620 /*!\brief Length of the sequence defining frame layer membership |
631 /*!\brief Length of the sequence defining frame layer membership | 621 * |
632 * | 622 * This value specifies the length of the sequence that defines the |
633 * This value specifies the length of the sequence that defines the | 623 * membership of frames to layers. For example, if ts_periodicity=8 then |
634 * membership of frames to layers. For example, if ts_periodicity=8 then | 624 * frames are assigned to coding layers with a repeated sequence of |
635 * frames are assigned to coding layers with a repeated sequence of | 625 * length 8. |
636 * length 8. | 626 */ |
637 */ | 627 unsigned int ts_periodicity; |
638 unsigned int ts_periodicity; | 628 |
639 | 629 /*!\brief Template defining the membership of frames to coding layers |
640 /*!\brief Template defining the membership of frames to coding layers | 630 * |
641 * | 631 * This array defines the membership of frames to coding layers. For a |
642 * This array defines the membership of frames to coding layers. For a | 632 * 2-layer encoding that assigns even numbered frames to one layer (0) |
643 * 2-layer encoding that assigns even numbered frames to one layer (0) | 633 * and odd numbered frames to a second layer (1) with ts_periodicity=8, |
644 * and odd numbered frames to a second layer (1) with ts_periodicity=8, | 634 * then ts_layer_id = (0,1,0,1,0,1,0,1). |
645 * then ts_layer_id = (0,1,0,1,0,1,0,1). | 635 */ |
646 */ | 636 unsigned int ts_layer_id[VPX_TS_MAX_PERIODICITY]; |
647 unsigned int ts_layer_id[VPX_TS_MAX_PERIODICITY]; | 637 } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */ |
648 } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */ | 638 |
649 | 639 |
650 | 640 /*!\brief Initialize an encoder instance |
651 /*!\brief Initialize an encoder instance | 641 * |
652 * | 642 * Initializes a encoder context using the given interface. Applications |
653 * Initializes a encoder context using the given interface. Applications | 643 * should call the vpx_codec_enc_init convenience macro instead of this |
654 * should call the vpx_codec_enc_init convenience macro instead of this | 644 * function directly, to ensure that the ABI version number parameter |
655 * function directly, to ensure that the ABI version number parameter | 645 * is properly initialized. |
656 * is properly initialized. | 646 * |
657 * | 647 * If the library was configured with --disable-multithread, this call |
658 * If the library was configured with --disable-multithread, this call | 648 * is not thread safe and should be guarded with a lock if being used |
659 * is not thread safe and should be guarded with a lock if being used | 649 * in a multithreaded context. |
660 * in a multithreaded context. | 650 * |
661 * | 651 * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags |
662 * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags | 652 * parameter), the storage pointed to by the cfg parameter must be |
663 * parameter), the storage pointed to by the cfg parameter must be | 653 * kept readable and stable until all memory maps have been set. |
664 * kept readable and stable until all memory maps have been set. | 654 * |
665 * | 655 * \param[in] ctx Pointer to this instance's context. |
666 * \param[in] ctx Pointer to this instance's context. | 656 * \param[in] iface Pointer to the algorithm interface to use. |
667 * \param[in] iface Pointer to the algorithm interface to use. | 657 * \param[in] cfg Configuration to use, if known. May be NULL. |
668 * \param[in] cfg Configuration to use, if known. May be NULL. | 658 * \param[in] flags Bitfield of VPX_CODEC_USE_* flags |
669 * \param[in] flags Bitfield of VPX_CODEC_USE_* flags | 659 * \param[in] ver ABI version number. Must be set to |
670 * \param[in] ver ABI version number. Must be set to | 660 * VPX_ENCODER_ABI_VERSION |
671 * VPX_ENCODER_ABI_VERSION | 661 * \retval #VPX_CODEC_OK |
672 * \retval #VPX_CODEC_OK | 662 * The decoder algorithm initialized. |
673 * The decoder algorithm initialized. | 663 * \retval #VPX_CODEC_MEM_ERROR |
674 * \retval #VPX_CODEC_MEM_ERROR | 664 * Memory allocation failed. |
675 * Memory allocation failed. | 665 */ |
676 */ | 666 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx, |
677 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx, | 667 vpx_codec_iface_t *iface, |
678 vpx_codec_iface_t *iface, | 668 vpx_codec_enc_cfg_t *cfg, |
679 vpx_codec_enc_cfg_t *cfg, | 669 vpx_codec_flags_t flags, |
680 vpx_codec_flags_t flags, | 670 int ver); |
681 int ver); | 671 |
682 | 672 |
683 | 673 /*!\brief Convenience macro for vpx_codec_enc_init_ver() |
684 /*!\brief Convenience macro for vpx_codec_enc_init_ver() | 674 * |
685 * | 675 * Ensures the ABI version parameter is properly set. |
686 * Ensures the ABI version parameter is properly set. | 676 */ |
687 */ | |
688 #define vpx_codec_enc_init(ctx, iface, cfg, flags) \ | 677 #define vpx_codec_enc_init(ctx, iface, cfg, flags) \ |
689 vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION) | 678 vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION) |
690 | 679 |
691 | 680 |
692 /*!\brief Initialize multi-encoder instance | 681 /*!\brief Initialize multi-encoder instance |
693 * | 682 * |
694 * Initializes multi-encoder context using the given interface. | 683 * Initializes multi-encoder context using the given interface. |
695 * Applications should call the vpx_codec_enc_init_multi convenience macro | 684 * Applications should call the vpx_codec_enc_init_multi convenience macro |
696 * instead of this function directly, to ensure that the ABI version number | 685 * instead of this function directly, to ensure that the ABI version number |
697 * parameter is properly initialized. | 686 * parameter is properly initialized. |
698 * | 687 * |
699 * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags | 688 * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags |
700 * parameter), the storage pointed to by the cfg parameter must be | 689 * parameter), the storage pointed to by the cfg parameter must be |
701 * kept readable and stable until all memory maps have been set. | 690 * kept readable and stable until all memory maps have been set. |
702 * | 691 * |
703 * \param[in] ctx Pointer to this instance's context. | 692 * \param[in] ctx Pointer to this instance's context. |
704 * \param[in] iface Pointer to the algorithm interface to use. | 693 * \param[in] iface Pointer to the algorithm interface to use. |
705 * \param[in] cfg Configuration to use, if known. May be NULL. | 694 * \param[in] cfg Configuration to use, if known. May be NULL. |
706 * \param[in] num_enc Total number of encoders. | 695 * \param[in] num_enc Total number of encoders. |
707 * \param[in] flags Bitfield of VPX_CODEC_USE_* flags | 696 * \param[in] flags Bitfield of VPX_CODEC_USE_* flags |
708 * \param[in] dsf Pointer to down-sampling factors. | 697 * \param[in] dsf Pointer to down-sampling factors. |
709 * \param[in] ver ABI version number. Must be set to | 698 * \param[in] ver ABI version number. Must be set to |
710 * VPX_ENCODER_ABI_VERSION | 699 * VPX_ENCODER_ABI_VERSION |
711 * \retval #VPX_CODEC_OK | 700 * \retval #VPX_CODEC_OK |
712 * The decoder algorithm initialized. | 701 * The decoder algorithm initialized. |
713 * \retval #VPX_CODEC_MEM_ERROR | 702 * \retval #VPX_CODEC_MEM_ERROR |
714 * Memory allocation failed. | 703 * Memory allocation failed. |
715 */ | 704 */ |
716 vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx, | 705 vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx, |
717 vpx_codec_iface_t *iface, | 706 vpx_codec_iface_t *iface, |
718 vpx_codec_enc_cfg_t *cfg, | 707 vpx_codec_enc_cfg_t *cfg, |
719 int num_enc, | 708 int num_enc, |
720 vpx_codec_flags_t flags, | 709 vpx_codec_flags_t flags, |
721 vpx_rational_t *dsf, | 710 vpx_rational_t *dsf, |
722 int ver); | 711 int ver); |
723 | 712 |
724 | 713 |
725 /*!\brief Convenience macro for vpx_codec_enc_init_multi_ver() | 714 /*!\brief Convenience macro for vpx_codec_enc_init_multi_ver() |
726 * | 715 * |
727 * Ensures the ABI version parameter is properly set. | 716 * Ensures the ABI version parameter is properly set. |
728 */ | 717 */ |
729 #define vpx_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \ | 718 #define vpx_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \ |
730 vpx_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \ | 719 vpx_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \ |
731 VPX_ENCODER_ABI_VERSION) | 720 VPX_ENCODER_ABI_VERSION) |
732 | 721 |
733 | 722 |
734 /*!\brief Get a default configuration | 723 /*!\brief Get a default configuration |
735 * | 724 * |
736 * Initializes a encoder configuration structure with default values. Suppor
ts | 725 * Initializes a encoder configuration structure with default values. Supports |
737 * the notion of "usages" so that an algorithm may offer different default | 726 * the notion of "usages" so that an algorithm may offer different default |
738 * settings depending on the user's intended goal. This function \ref SHOULD | 727 * settings depending on the user's intended goal. This function \ref SHOULD |
739 * be called by all applications to initialize the configuration structure | 728 * be called by all applications to initialize the configuration structure |
740 * before specializing the configuration with application specific values. | 729 * before specializing the configuration with application specific values. |
741 * | 730 * |
742 * \param[in] iface Pointer to the algorithm interface to use. | 731 * \param[in] iface Pointer to the algorithm interface to use. |
743 * \param[out] cfg Configuration buffer to populate | 732 * \param[out] cfg Configuration buffer to populate |
744 * \param[in] usage End usage. Set to 0 or use codec specific values. | 733 * \param[in] usage End usage. Set to 0 or use codec specific values. |
745 * | 734 * |
746 * \retval #VPX_CODEC_OK | 735 * \retval #VPX_CODEC_OK |
747 * The configuration was populated. | 736 * The configuration was populated. |
748 * \retval #VPX_CODEC_INCAPABLE | 737 * \retval #VPX_CODEC_INCAPABLE |
749 * Interface is not an encoder interface. | 738 * Interface is not an encoder interface. |
750 * \retval #VPX_CODEC_INVALID_PARAM | 739 * \retval #VPX_CODEC_INVALID_PARAM |
751 * A parameter was NULL, or the usage value was not recognized. | 740 * A parameter was NULL, or the usage value was not recognized. |
752 */ | 741 */ |
753 vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, | 742 vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, |
754 vpx_codec_enc_cfg_t *cfg, | 743 vpx_codec_enc_cfg_t *cfg, |
755 unsigned int usage); | 744 unsigned int usage); |
756 | 745 |
757 | 746 |
758 /*!\brief Set or change configuration | 747 /*!\brief Set or change configuration |
759 * | 748 * |
760 * Reconfigures an encoder instance according to the given configuration. | 749 * Reconfigures an encoder instance according to the given configuration. |
761 * | 750 * |
762 * \param[in] ctx Pointer to this instance's context | 751 * \param[in] ctx Pointer to this instance's context |
763 * \param[in] cfg Configuration buffer to use | 752 * \param[in] cfg Configuration buffer to use |
764 * | 753 * |
765 * \retval #VPX_CODEC_OK | 754 * \retval #VPX_CODEC_OK |
766 * The configuration was populated. | 755 * The configuration was populated. |
767 * \retval #VPX_CODEC_INCAPABLE | 756 * \retval #VPX_CODEC_INCAPABLE |
768 * Interface is not an encoder interface. | 757 * Interface is not an encoder interface. |
769 * \retval #VPX_CODEC_INVALID_PARAM | 758 * \retval #VPX_CODEC_INVALID_PARAM |
770 * A parameter was NULL, or the usage value was not recognized. | 759 * A parameter was NULL, or the usage value was not recognized. |
771 */ | 760 */ |
772 vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx, | 761 vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx, |
773 const vpx_codec_enc_cfg_t *cfg); | 762 const vpx_codec_enc_cfg_t *cfg); |
774 | 763 |
775 | 764 |
776 /*!\brief Get global stream headers | 765 /*!\brief Get global stream headers |
777 * | 766 * |
778 * Retrieves a stream level global header packet, if supported by the codec. | 767 * Retrieves a stream level global header packet, if supported by the codec. |
779 * | 768 * |
780 * \param[in] ctx Pointer to this instance's context | 769 * \param[in] ctx Pointer to this instance's context |
781 * | 770 * |
782 * \retval NULL | 771 * \retval NULL |
783 * Encoder does not support global header | 772 * Encoder does not support global header |
784 * \retval Non-NULL | 773 * \retval Non-NULL |
785 * Pointer to buffer containing global header packet | 774 * Pointer to buffer containing global header packet |
786 */ | 775 */ |
787 vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx); | 776 vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx); |
788 | 777 |
789 | 778 |
790 #define VPX_DL_REALTIME (1) /**< deadline parameter analogous to | 779 #define VPX_DL_REALTIME (1) /**< deadline parameter analogous to |
791 * VPx REALTIME mode. */ | 780 * VPx REALTIME mode. */ |
792 #define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to | 781 #define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to |
793 * VPx GOOD QUALITY mode. */ | 782 * VPx GOOD QUALITY mode. */ |
794 #define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to | 783 #define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to |
795 * VPx BEST QUALITY mode. */ | 784 * VPx BEST QUALITY mode. */ |
796 /*!\brief Encode a frame | 785 /*!\brief Encode a frame |
797 * | 786 * |
798 * Encodes a video frame at the given "presentation time." The presentation | 787 * Encodes a video frame at the given "presentation time." The presentation |
799 * time stamp (PTS) \ref MUST be strictly increasing. | 788 * time stamp (PTS) \ref MUST be strictly increasing. |
800 * | 789 * |
801 * The encoder supports the notion of a soft real-time deadline. Given a | 790 * The encoder supports the notion of a soft real-time deadline. Given a |
802 * non-zero value to the deadline parameter, the encoder will make a "best | 791 * non-zero value to the deadline parameter, the encoder will make a "best |
803 * effort" guarantee to return before the given time slice expires. It is | 792 * effort" guarantee to return before the given time slice expires. It is |
804 * implicit that limiting the available time to encode will degrade the | 793 * implicit that limiting the available time to encode will degrade the |
805 * output quality. The encoder can be given an unlimited time to produce the | 794 * output quality. The encoder can be given an unlimited time to produce the |
806 * best possible frame by specifying a deadline of '0'. This deadline | 795 * best possible frame by specifying a deadline of '0'. This deadline |
807 * supercedes the VPx notion of "best quality, good quality, realtime". | 796 * supercedes the VPx notion of "best quality, good quality, realtime". |
808 * Applications that wish to map these former settings to the new deadline | 797 * Applications that wish to map these former settings to the new deadline |
809 * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY, | 798 * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY, |
810 * and #VPX_DL_BEST_QUALITY. | 799 * and #VPX_DL_BEST_QUALITY. |
811 * | 800 * |
812 * When the last frame has been passed to the encoder, this function should | 801 * When the last frame has been passed to the encoder, this function should |
813 * continue to be called, with the img parameter set to NULL. This will | 802 * continue to be called, with the img parameter set to NULL. This will |
814 * signal the end-of-stream condition to the encoder and allow it to encode | 803 * signal the end-of-stream condition to the encoder and allow it to encode |
815 * any held buffers. Encoding is complete when vpx_codec_encode() is called | 804 * any held buffers. Encoding is complete when vpx_codec_encode() is called |
816 * and vpx_codec_get_cx_data() returns no data. | 805 * and vpx_codec_get_cx_data() returns no data. |
817 * | 806 * |
818 * \param[in] ctx Pointer to this instance's context | 807 * \param[in] ctx Pointer to this instance's context |
819 * \param[in] img Image data to encode, NULL to flush. | 808 * \param[in] img Image data to encode, NULL to flush. |
820 * \param[in] pts Presentation time stamp, in timebase units. | 809 * \param[in] pts Presentation time stamp, in timebase units. |
821 * \param[in] duration Duration to show frame, in timebase units. | 810 * \param[in] duration Duration to show frame, in timebase units. |
822 * \param[in] flags Flags to use for encoding this frame. | 811 * \param[in] flags Flags to use for encoding this frame. |
823 * \param[in] deadline Time to spend encoding, in microseconds. (0=infin
ite) | 812 * \param[in] deadline Time to spend encoding, in microseconds. (0=infinit
e) |
824 * | 813 * |
825 * \retval #VPX_CODEC_OK | 814 * \retval #VPX_CODEC_OK |
826 * The configuration was populated. | 815 * The configuration was populated. |
827 * \retval #VPX_CODEC_INCAPABLE | 816 * \retval #VPX_CODEC_INCAPABLE |
828 * Interface is not an encoder interface. | 817 * Interface is not an encoder interface. |
829 * \retval #VPX_CODEC_INVALID_PARAM | 818 * \retval #VPX_CODEC_INVALID_PARAM |
830 * A parameter was NULL, the image format is unsupported, etc. | 819 * A parameter was NULL, the image format is unsupported, etc. |
831 */ | 820 */ |
832 vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx, | 821 vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx, |
833 const vpx_image_t *img, | 822 const vpx_image_t *img, |
834 vpx_codec_pts_t pts, | 823 vpx_codec_pts_t pts, |
835 unsigned long duration, | 824 unsigned long duration, |
836 vpx_enc_frame_flags_t flags, | 825 vpx_enc_frame_flags_t flags, |
837 unsigned long deadline); | 826 unsigned long deadline); |
838 | 827 |
839 /*!\brief Set compressed data output buffer | 828 /*!\brief Set compressed data output buffer |
840 * | 829 * |
841 * Sets the buffer that the codec should output the compressed data | 830 * Sets the buffer that the codec should output the compressed data |
842 * into. This call effectively sets the buffer pointer returned in the | 831 * into. This call effectively sets the buffer pointer returned in the |
843 * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be | 832 * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be |
844 * appended into this buffer. The buffer is preserved across frames, | 833 * appended into this buffer. The buffer is preserved across frames, |
845 * so applications must periodically call this function after flushing | 834 * so applications must periodically call this function after flushing |
846 * the accumulated compressed data to disk or to the network to reset | 835 * the accumulated compressed data to disk or to the network to reset |
847 * the pointer to the buffer's head. | 836 * the pointer to the buffer's head. |
848 * | 837 * |
849 * `pad_before` bytes will be skipped before writing the compressed | 838 * `pad_before` bytes will be skipped before writing the compressed |
850 * data, and `pad_after` bytes will be appended to the packet. The size | 839 * data, and `pad_after` bytes will be appended to the packet. The size |
851 * of the packet will be the sum of the size of the actual compressed | 840 * of the packet will be the sum of the size of the actual compressed |
852 * data, pad_before, and pad_after. The padding bytes will be preserved | 841 * data, pad_before, and pad_after. The padding bytes will be preserved |
853 * (not overwritten). | 842 * (not overwritten). |
854 * | 843 * |
855 * Note that calling this function does not guarantee that the returned | 844 * Note that calling this function does not guarantee that the returned |
856 * compressed data will be placed into the specified buffer. In the | 845 * compressed data will be placed into the specified buffer. In the |
857 * event that the encoded data will not fit into the buffer provided, | 846 * event that the encoded data will not fit into the buffer provided, |
858 * the returned packet \ref MAY point to an internal buffer, as it would | 847 * the returned packet \ref MAY point to an internal buffer, as it would |
859 * if this call were never used. In this event, the output packet will | 848 * if this call were never used. In this event, the output packet will |
860 * NOT have any padding, and the application must free space and copy it | 849 * NOT have any padding, and the application must free space and copy it |
861 * to the proper place. This is of particular note in configurations | 850 * to the proper place. This is of particular note in configurations |
862 * that may output multiple packets for a single encoded frame (e.g., lagged | 851 * that may output multiple packets for a single encoded frame (e.g., lagged |
863 * encoding) or if the application does not reset the buffer periodically. | 852 * encoding) or if the application does not reset the buffer periodically. |
864 * | 853 * |
865 * Applications may restore the default behavior of the codec providing | 854 * Applications may restore the default behavior of the codec providing |
866 * the compressed data buffer by calling this function with a NULL | 855 * the compressed data buffer by calling this function with a NULL |
867 * buffer. | 856 * buffer. |
868 * | 857 * |
869 * Applications \ref MUSTNOT call this function during iteration of | 858 * Applications \ref MUSTNOT call this function during iteration of |
870 * vpx_codec_get_cx_data(). | 859 * vpx_codec_get_cx_data(). |
871 * | 860 * |
872 * \param[in] ctx Pointer to this instance's context | 861 * \param[in] ctx Pointer to this instance's context |
873 * \param[in] buf Buffer to store compressed data into | 862 * \param[in] buf Buffer to store compressed data into |
874 * \param[in] pad_before Bytes to skip before writing compressed data | 863 * \param[in] pad_before Bytes to skip before writing compressed data |
875 * \param[in] pad_after Bytes to skip after writing compressed data | 864 * \param[in] pad_after Bytes to skip after writing compressed data |
876 * | 865 * |
877 * \retval #VPX_CODEC_OK | 866 * \retval #VPX_CODEC_OK |
878 * The buffer was set successfully. | 867 * The buffer was set successfully. |
879 * \retval #VPX_CODEC_INVALID_PARAM | 868 * \retval #VPX_CODEC_INVALID_PARAM |
880 * A parameter was NULL, the image format is unsupported, etc. | 869 * A parameter was NULL, the image format is unsupported, etc. |
881 */ | 870 */ |
882 vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx, | 871 vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx, |
883 const vpx_fixed_buf_t *buf, | 872 const vpx_fixed_buf_t *buf, |
884 unsigned int pad_before, | 873 unsigned int pad_before, |
885 unsigned int pad_after); | 874 unsigned int pad_after); |
886 | 875 |
887 | 876 |
888 /*!\brief Encoded data iterator | 877 /*!\brief Encoded data iterator |
889 * | 878 * |
890 * Iterates over a list of data packets to be passed from the encoder to the | 879 * Iterates over a list of data packets to be passed from the encoder to the |
891 * application. The different kinds of packets available are enumerated in | 880 * application. The different kinds of packets available are enumerated in |
892 * #vpx_codec_cx_pkt_kind. | 881 * #vpx_codec_cx_pkt_kind. |
893 * | 882 * |
894 * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's | 883 * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's |
895 * muxer. Multiple compressed frames may be in the list. | 884 * muxer. Multiple compressed frames may be in the list. |
896 * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer. | 885 * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer. |
897 * | 886 * |
898 * The application \ref MUST silently ignore any packet kinds that it does | 887 * The application \ref MUST silently ignore any packet kinds that it does |
899 * not recognize or support. | 888 * not recognize or support. |
900 * | 889 * |
901 * The data buffers returned from this function are only guaranteed to be | 890 * The data buffers returned from this function are only guaranteed to be |
902 * valid until the application makes another call to any vpx_codec_* functio
n. | 891 * valid until the application makes another call to any vpx_codec_* function. |
903 * | 892 * |
904 * \param[in] ctx Pointer to this instance's context | 893 * \param[in] ctx Pointer to this instance's context |
905 * \param[in,out] iter Iterator storage, initialized to NULL | 894 * \param[in,out] iter Iterator storage, initialized to NULL |
906 * | 895 * |
907 * \return Returns a pointer to an output data packet (compressed frame data
, | 896 * \return Returns a pointer to an output data packet (compressed frame data, |
908 * two-pass statistics, etc.) or NULL to signal end-of-list. | 897 * two-pass statistics, etc.) or NULL to signal end-of-list. |
909 * | 898 * |
910 */ | 899 */ |
911 const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx, | 900 const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx, |
912 vpx_codec_iter_t *iter); | 901 vpx_codec_iter_t *iter); |
913 | 902 |
914 | 903 |
915 /*!\brief Get Preview Frame | 904 /*!\brief Get Preview Frame |
916 * | 905 * |
917 * Returns an image that can be used as a preview. Shows the image as it wou
ld | 906 * Returns an image that can be used as a preview. Shows the image as it would |
918 * exist at the decompressor. The application \ref MUST NOT write into this | 907 * exist at the decompressor. The application \ref MUST NOT write into this |
919 * image buffer. | 908 * image buffer. |
920 * | 909 * |
921 * \param[in] ctx Pointer to this instance's context | 910 * \param[in] ctx Pointer to this instance's context |
922 * | 911 * |
923 * \return Returns a pointer to a preview image, or NULL if no image is | 912 * \return Returns a pointer to a preview image, or NULL if no image is |
924 * available. | 913 * available. |
925 * | 914 * |
926 */ | 915 */ |
927 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx); | 916 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx); |
928 | 917 |
929 | 918 |
930 /*!@} - end defgroup encoder*/ | 919 /*!@} - end defgroup encoder*/ |
931 | 920 |
932 #endif | 921 #endif |
933 #ifdef __cplusplus | 922 #ifdef __cplusplus |
934 } | 923 } |
935 #endif | 924 #endif |
OLD | NEW |