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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 * | 48 * |
49 * Each encoder advertises the capabilities it supports as part of its | 49 * Each encoder advertises the capabilities it supports as part of its |
50 * ::vpx_codec_iface_t interface structure. Capabilities are extra | 50 * ::vpx_codec_iface_t interface structure. Capabilities are extra |
51 * interfaces or functionality, and are not required to be supported | 51 * interfaces or functionality, and are not required to be supported |
52 * by an encoder. | 52 * by an encoder. |
53 * | 53 * |
54 * The available flags are specified by VPX_CODEC_CAP_* defines. | 54 * The available flags are specified by VPX_CODEC_CAP_* defines. |
55 */ | 55 */ |
56 #define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ | 56 #define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ |
57 | 57 |
58 /*! Can output one partition at a time. Each partition is returned in its | |
59 * own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for | |
60 * every partition but the last. In this mode all frames are always | |
61 * returned partition by partition. | |
62 */ | |
63 #define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000 | |
64 | |
65 | 58 |
66 /*! \brief Initialization-time Feature Enabling | 59 /*! \brief Initialization-time Feature Enabling |
67 * | 60 * |
68 * Certain codec features must be known at initialization time, to allow | 61 * Certain codec features must be known at initialization time, to allow |
69 * for proper memory allocation. | 62 * for proper memory allocation. |
70 * | 63 * |
71 * The available flags are specified by VPX_CODEC_USE_* defines. | 64 * The available flags are specified by VPX_CODEC_USE_* defines. |
72 */ | 65 */ |
73 #define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ | 66 #define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ |
74 #define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000 /**< Make the encoder output one | |
75 partition at a time. */ | |
76 | 67 |
77 | 68 |
78 /*!\brief Generic fixed size buffer structure | 69 /*!\brief Generic fixed size buffer structure |
79 * | 70 * |
80 * This structure is able to hold a reference to any fixed size buffer. | 71 * This structure is able to hold a reference to any fixed size buffer. |
81 */ | 72 */ |
82 typedef struct vpx_fixed_buf | 73 typedef struct vpx_fixed_buf |
83 { | 74 { |
84 void *buf; /**< Pointer to the data */ | 75 void *buf; /**< Pointer to the data */ |
85 size_t sz; /**< Length of the buffer, in chars */ | 76 size_t sz; /**< Length of the buffer, in chars */ |
(...skipping 15 matching lines...) Expand all Loading... |
101 * can be used by an algorithm to provide additional detail, for example to | 92 * can be used by an algorithm to provide additional detail, for example to |
102 * support frame types that are codec specific (MPEG-1 D-frames for example) | 93 * support frame types that are codec specific (MPEG-1 D-frames for example) |
103 */ | 94 */ |
104 typedef uint32_t vpx_codec_frame_flags_t; | 95 typedef uint32_t vpx_codec_frame_flags_t; |
105 #define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */ | 96 #define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */ |
106 #define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting | 97 #define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting |
107 the stream (no future frame depends on | 98 the stream (no future frame depends on |
108 this one) */ | 99 this one) */ |
109 #define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not | 100 #define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not |
110 be shown */ | 101 be shown */ |
111 #define VPX_FRAME_IS_FRAGMENT 0x8 /**< this is a fragment of the encoded | |
112 frame */ | |
113 | 102 |
114 /*!\brief Error Resilient flags | |
115 * | |
116 * These flags define which error resilient features to enable in the | |
117 * encoder. The flags are specified through the | |
118 * vpx_codec_enc_cfg::g_error_resilient variable. | |
119 */ | |
120 typedef uint32_t vpx_codec_er_flags_t; | |
121 #define VPX_ERROR_RESILIENT_DEFAULT 0x1 /**< Improve resiliency against | |
122 losses of whole frames */ | |
123 #define VPX_ERROR_RESILIENT_PARTITIONS 0x2 /**< The frame partitions are | |
124 independently decodable by the | |
125 bool decoder, meaning that | |
126 partitions can be decoded even | |
127 though earlier partitions have | |
128 been lost. Note that intra | |
129 predicition is still done over | |
130 the partition boundary. */ | |
131 | 103 |
132 /*!\brief Encoder output packet variants | 104 /*!\brief Encoder output packet variants |
133 * | 105 * |
134 * This enumeration lists the different kinds of data packets that can be | 106 * This enumeration lists the different kinds of data packets that can be |
135 * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY | 107 * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY |
136 * extend this list to provide additional functionality. | 108 * extend this list to provide additional functionality. |
137 */ | 109 */ |
138 enum vpx_codec_cx_pkt_kind | 110 enum vpx_codec_cx_pkt_kind |
139 { | 111 { |
140 VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */ | 112 VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */ |
(...skipping 15 matching lines...) Expand all Loading... |
156 { | 128 { |
157 struct | 129 struct |
158 { | 130 { |
159 void *buf; /**< compressed data buffer *
/ | 131 void *buf; /**< compressed data buffer *
/ |
160 size_t sz; /**< length of compressed dat
a */ | 132 size_t sz; /**< length of compressed dat
a */ |
161 vpx_codec_pts_t pts; /**< time stamp to show frame | 133 vpx_codec_pts_t pts; /**< time stamp to show frame |
162 (in timebase units) */ | 134 (in timebase units) */ |
163 unsigned long duration; /**< duration to show frame | 135 unsigned long duration; /**< duration to show frame |
164 (in timebase units) */ | 136 (in timebase units) */ |
165 vpx_codec_frame_flags_t flags; /**< flags for this frame */ | 137 vpx_codec_frame_flags_t flags; /**< flags for this frame */ |
166 int partition_id; /**< the partition id | |
167 defines the decoding order | |
168 of the partitions. Only | |
169 applicable when "output partition" | |
170 mode is enabled. First partition | |
171 has id 0.*/ | |
172 | |
173 } frame; /**< data for compressed frame packet */ | 138 } frame; /**< data for compressed frame packet */ |
174 struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet *
/ | 139 struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet *
/ |
175 struct vpx_psnr_pkt | 140 struct vpx_psnr_pkt |
176 { | 141 { |
177 unsigned int samples[4]; /**< Number of samples, total/y/u/v */ | 142 unsigned int samples[4]; /**< Number of samples, total/y/u/v */ |
178 uint64_t sse[4]; /**< sum squared error, total/y/u/v */ | 143 uint64_t sse[4]; /**< sum squared error, total/y/u/v */ |
179 double psnr[4]; /**< PSNR, total/y/u/v */ | 144 double psnr[4]; /**< PSNR, total/y/u/v */ |
180 } psnr; /**< data for PSNR packet */ | 145 } psnr; /**< data for PSNR packet */ |
181 struct vpx_fixed_buf raw; /**< data for arbitrary packets */ | 146 struct vpx_fixed_buf raw; /**< data for arbitrary packets */ |
182 | 147 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 * the \ref RECOMMENDED method is to set the timebase to the reciprocal | 282 * the \ref RECOMMENDED method is to set the timebase to the reciprocal |
318 * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows th
e | 283 * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows th
e |
319 * pts to correspond to the frame number, which can be handy. For | 284 * pts to correspond to the frame number, which can be handy. For |
320 * re-encoding video from containers with absolute time timestamps, the | 285 * re-encoding video from containers with absolute time timestamps, the |
321 * \ref RECOMMENDED method is to set the timebase to that of the parent | 286 * \ref RECOMMENDED method is to set the timebase to that of the parent |
322 * container or multimedia framework (ex: 1/1000 for ms, as in FLV). | 287 * container or multimedia framework (ex: 1/1000 for ms, as in FLV). |
323 */ | 288 */ |
324 struct vpx_rational g_timebase; | 289 struct vpx_rational g_timebase; |
325 | 290 |
326 | 291 |
327 /*!\brief Enable error resilient modes. | 292 /*!\brief Enable error resilient mode. |
328 * | 293 * |
329 * The error resilient bitfield indicates to the encoder which features | 294 * Error resilient mode indicates to the encoder that it should take |
330 * it should enable to take measures for streaming over lossy or noisy | 295 * measures appropriate for streaming over lossy or noisy links, if |
331 * links. | 296 * possible. Set to 1 to enable this feature, 0 to disable it. |
332 */ | 297 */ |
333 vpx_codec_er_flags_t g_error_resilient; | 298 unsigned int g_error_resilient; |
334 | 299 |
335 | 300 |
336 /*!\brief Multi-pass Encoding Mode | 301 /*!\brief Multi-pass Encoding Mode |
337 * | 302 * |
338 * This value should be set to the current phase for multi-pass encoding
. | 303 * This value should be set to the current phase for multi-pass encoding
. |
339 * For single pass, set to #VPX_RC_ONE_PASS. | 304 * For single pass, set to #VPX_RC_ONE_PASS. |
340 */ | 305 */ |
341 enum vpx_enc_pass g_pass; | 306 enum vpx_enc_pass g_pass; |
342 | 307 |
343 | 308 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 * vpx_codec_enc_config_default() with a usage value of 0. | 423 * vpx_codec_enc_config_default() with a usage value of 0. |
459 */ | 424 */ |
460 unsigned int rc_max_quantizer; | 425 unsigned int rc_max_quantizer; |
461 | 426 |
462 | 427 |
463 /* | 428 /* |
464 * bitrate tolerance | 429 * bitrate tolerance |
465 */ | 430 */ |
466 | 431 |
467 | 432 |
468 /*!\brief Rate control adaptation undershoot control | 433 /*!\brief Rate control undershoot tolerance |
469 * | 434 * |
470 * This value, expressed as a percentage of the target bitrate, | 435 * This value, expressed as a percentage of the target bitrate, describe
s |
471 * controls the maximum allowed adaptation speed of the codec. | 436 * the target bitrate for easier frames, allowing bits to be saved for |
472 * This factor controls the maximum amount of bits that can | 437 * harder frames. Set to zero to use the codec default. |
473 * be subtracted from the target bitrate in order to compensate | |
474 * for prior overshoot. | |
475 * | |
476 * Valid values in the range 0-1000. | |
477 */ | 438 */ |
478 unsigned int rc_undershoot_pct; | 439 unsigned int rc_undershoot_pct; |
479 | 440 |
480 | 441 |
481 /*!\brief Rate control adaptation overshoot control | 442 /*!\brief Rate control overshoot tolerance |
482 * | 443 * |
483 * This value, expressed as a percentage of the target bitrate, | 444 * This value, expressed as a percentage of the target bitrate, describe
s |
484 * controls the maximum allowed adaptation speed of the codec. | 445 * the maximum allowed bitrate for a given frame. Set to zero to use th
e |
485 * This factor controls the maximum amount of bits that can | 446 * codec default. |
486 * be added to the target bitrate in order to compensate for | |
487 * prior undershoot. | |
488 * | |
489 * Valid values in the range 0-1000. | |
490 */ | 447 */ |
491 unsigned int rc_overshoot_pct; | 448 unsigned int rc_overshoot_pct; |
492 | 449 |
493 | 450 |
494 /* | 451 /* |
495 * decoder buffer model parameters | 452 * decoder buffer model parameters |
496 */ | 453 */ |
497 | 454 |
498 | 455 |
499 /*!\brief Decoder Buffer Size | 456 /*!\brief Decoder Buffer Size |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 */ | 785 */ |
829 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx); | 786 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx); |
830 | 787 |
831 | 788 |
832 /*!@} - end defgroup encoder*/ | 789 /*!@} - end defgroup encoder*/ |
833 | 790 |
834 #endif | 791 #endif |
835 #ifdef __cplusplus | 792 #ifdef __cplusplus |
836 } | 793 } |
837 #endif | 794 #endif |
OLD | NEW |