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 #ifndef VPX_VPX_ENCODER_H_ | 10 #ifndef VPX_VPX_ENCODER_H_ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 */ | 73 */ |
74 #define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ | 74 #define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ |
75 | 75 |
76 /*! Can output one partition at a time. Each partition is returned in its | 76 /*! Can output one partition at a time. Each partition is returned in its |
77 * own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for | 77 * own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for |
78 * every partition but the last. In this mode all frames are always | 78 * every partition but the last. In this mode all frames are always |
79 * returned partition by partition. | 79 * returned partition by partition. |
80 */ | 80 */ |
81 #define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000 | 81 #define VPX_CODEC_CAP_OUTPUT_PARTITION 0x20000 |
82 | 82 |
| 83 /*! Can support input images at greater than 8 bitdepth. |
| 84 */ |
| 85 #define VPX_CODEC_CAP_HIGHBITDEPTH 0x40000 |
83 | 86 |
84 /*! \brief Initialization-time Feature Enabling | 87 /*! \brief Initialization-time Feature Enabling |
85 * | 88 * |
86 * Certain codec features must be known at initialization time, to allow | 89 * Certain codec features must be known at initialization time, to allow |
87 * for proper memory allocation. | 90 * for proper memory allocation. |
88 * | 91 * |
89 * The available flags are specified by VPX_CODEC_USE_* defines. | 92 * The available flags are specified by VPX_CODEC_USE_* defines. |
90 */ | 93 */ |
91 #define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ | 94 #define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ |
92 #define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000 /**< Make the encoder output one | 95 #define VPX_CODEC_USE_OUTPUT_PARTITION 0x20000 /**< Make the encoder output one |
93 partition at a time. */ | 96 partition at a time. */ |
| 97 #define VPX_CODEC_USE_HIGHBITDEPTH 0x40000 /**< Use high bitdepth */ |
94 | 98 |
95 | 99 |
96 /*!\brief Generic fixed size buffer structure | 100 /*!\brief Generic fixed size buffer structure |
97 * | 101 * |
98 * This structure is able to hold a reference to any fixed size buffer. | 102 * This structure is able to hold a reference to any fixed size buffer. |
99 */ | 103 */ |
100 typedef struct vpx_fixed_buf { | 104 typedef struct vpx_fixed_buf { |
101 void *buf; /**< Pointer to the data */ | 105 void *buf; /**< Pointer to the data */ |
102 size_t sz; /**< Length of the buffer, in chars */ | 106 size_t sz; /**< Length of the buffer, in chars */ |
103 } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */ | 107 } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 (in timebase units) */ | 185 (in timebase units) */ |
182 vpx_codec_frame_flags_t flags; /**< flags for this frame */ | 186 vpx_codec_frame_flags_t flags; /**< flags for this frame */ |
183 int partition_id; /**< the partition id | 187 int partition_id; /**< the partition id |
184 defines the decoding order | 188 defines the decoding order |
185 of the partitions. Only | 189 of the partitions. Only |
186 applicable when "output partition" | 190 applicable when "output partition" |
187 mode is enabled. First partition | 191 mode is enabled. First partition |
188 has id 0.*/ | 192 has id 0.*/ |
189 | 193 |
190 } frame; /**< data for compressed frame packet */ | 194 } frame; /**< data for compressed frame packet */ |
191 struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */ | 195 vpx_fixed_buf_t twopass_stats; /**< data for two-pass packet */ |
192 struct vpx_fixed_buf firstpass_mb_stats; /**< first pass mb packet */ | 196 vpx_fixed_buf_t firstpass_mb_stats; /**< first pass mb packet */ |
193 struct vpx_psnr_pkt { | 197 struct vpx_psnr_pkt { |
194 unsigned int samples[4]; /**< Number of samples, total/y/u/v */ | 198 unsigned int samples[4]; /**< Number of samples, total/y/u/v */ |
195 uint64_t sse[4]; /**< sum squared error, total/y/u/v */ | 199 uint64_t sse[4]; /**< sum squared error, total/y/u/v */ |
196 double psnr[4]; /**< PSNR, total/y/u/v */ | 200 double psnr[4]; /**< PSNR, total/y/u/v */ |
197 } psnr; /**< data for PSNR packet */ | 201 } psnr; /**< data for PSNR packet */ |
198 struct vpx_fixed_buf raw; /**< data for arbitrary packets */ | 202 vpx_fixed_buf_t raw; /**< data for arbitrary packets */ |
199 #if CONFIG_SPATIAL_SVC | 203 #if CONFIG_SPATIAL_SVC |
200 size_t layer_sizes[VPX_SS_MAX_LAYERS]; | 204 size_t layer_sizes[VPX_SS_MAX_LAYERS]; |
201 #endif | 205 #endif |
202 | 206 |
203 /* This packet size is fixed to allow codecs to extend this | 207 /* This packet size is fixed to allow codecs to extend this |
204 * interface without having to manage storage for raw packets, | 208 * interface without having to manage storage for raw packets, |
205 * i.e., if it's smaller than 128 bytes, you can store in the | 209 * i.e., if it's smaller than 128 bytes, you can store in the |
206 * packet list directly. | 210 * packet list directly. |
207 */ | 211 */ |
208 char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */ | 212 char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */ |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 321 |
318 /*!\brief Height of the frame | 322 /*!\brief Height of the frame |
319 * | 323 * |
320 * This value identifies the presentation resolution of the frame, | 324 * This value identifies the presentation resolution of the frame, |
321 * in pixels. Note that the frames passed as input to the encoder must | 325 * in pixels. Note that the frames passed as input to the encoder must |
322 * have this resolution. Frames will be presented by the decoder in this | 326 * have this resolution. Frames will be presented by the decoder in this |
323 * resolution, independent of any spatial resampling the encoder may do. | 327 * resolution, independent of any spatial resampling the encoder may do. |
324 */ | 328 */ |
325 unsigned int g_h; | 329 unsigned int g_h; |
326 | 330 |
| 331 /*!\brief Bit-depth of the codec |
| 332 * |
| 333 * This value identifies the bit_depth of the codec, |
| 334 * Only certain bit-depths are supported as identified in the |
| 335 * vpx_bit_depth_t enum. |
| 336 */ |
| 337 vpx_bit_depth_t g_bit_depth; |
| 338 |
| 339 /*!\brief Bit-depth of the input frames |
| 340 * |
| 341 * This value identifies the bit_depth of the input frames in bits. |
| 342 * Note that the frames passed as input to the encoder must have |
| 343 * this bit-depth. |
| 344 */ |
| 345 unsigned int g_input_bit_depth; |
327 | 346 |
328 /*!\brief Stream timebase units | 347 /*!\brief Stream timebase units |
329 * | 348 * |
330 * Indicates the smallest interval of time, in seconds, used by the stream. | 349 * Indicates the smallest interval of time, in seconds, used by the stream. |
331 * For fixed frame rate material, or variable frame rate material where | 350 * For fixed frame rate material, or variable frame rate material where |
332 * frames are timed at a multiple of a given clock (ex: video capture), | 351 * frames are timed at a multiple of a given clock (ex: video capture), |
333 * the \ref RECOMMENDED method is to set the timebase to the reciprocal | 352 * the \ref RECOMMENDED method is to set the timebase to the reciprocal |
334 * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the | 353 * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the |
335 * pts to correspond to the frame number, which can be handy. For | 354 * pts to correspond to the frame number, which can be handy. For |
336 * re-encoding video from containers with absolute time timestamps, the | 355 * re-encoding video from containers with absolute time timestamps, the |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 * bitrate are acceptable. | 464 * bitrate are acceptable. |
446 */ | 465 */ |
447 enum vpx_rc_mode rc_end_usage; | 466 enum vpx_rc_mode rc_end_usage; |
448 | 467 |
449 | 468 |
450 /*!\brief Two-pass stats buffer. | 469 /*!\brief Two-pass stats buffer. |
451 * | 470 * |
452 * A buffer containing all of the stats packets produced in the first | 471 * A buffer containing all of the stats packets produced in the first |
453 * pass, concatenated. | 472 * pass, concatenated. |
454 */ | 473 */ |
455 struct vpx_fixed_buf rc_twopass_stats_in; | 474 vpx_fixed_buf_t rc_twopass_stats_in; |
456 | 475 |
457 /*!\brief first pass mb stats buffer. | 476 /*!\brief first pass mb stats buffer. |
458 * | 477 * |
459 * A buffer containing all of the first pass mb stats packets produced | 478 * A buffer containing all of the first pass mb stats packets produced |
460 * in the first pass, concatenated. | 479 * in the first pass, concatenated. |
461 */ | 480 */ |
462 struct vpx_fixed_buf rc_firstpass_mb_stats_in; | 481 vpx_fixed_buf_t rc_firstpass_mb_stats_in; |
463 | 482 |
464 /*!\brief Target data rate | 483 /*!\brief Target data rate |
465 * | 484 * |
466 * Target bandwidth to use for this stream, in kilobits per second. | 485 * Target bandwidth to use for this stream, in kilobits per second. |
467 */ | 486 */ |
468 unsigned int rc_target_bitrate; | 487 unsigned int rc_target_bitrate; |
469 | 488 |
470 | 489 |
471 /* | 490 /* |
472 * quantizer settings | 491 * quantizer settings |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 * \param[in] flags Bitfield of VPX_CODEC_USE_* flags | 727 * \param[in] flags Bitfield of VPX_CODEC_USE_* flags |
709 * \param[in] ver ABI version number. Must be set to | 728 * \param[in] ver ABI version number. Must be set to |
710 * VPX_ENCODER_ABI_VERSION | 729 * VPX_ENCODER_ABI_VERSION |
711 * \retval #VPX_CODEC_OK | 730 * \retval #VPX_CODEC_OK |
712 * The decoder algorithm initialized. | 731 * The decoder algorithm initialized. |
713 * \retval #VPX_CODEC_MEM_ERROR | 732 * \retval #VPX_CODEC_MEM_ERROR |
714 * Memory allocation failed. | 733 * Memory allocation failed. |
715 */ | 734 */ |
716 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx, | 735 vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx, |
717 vpx_codec_iface_t *iface, | 736 vpx_codec_iface_t *iface, |
718 vpx_codec_enc_cfg_t *cfg, | 737 const vpx_codec_enc_cfg_t *cfg, |
719 vpx_codec_flags_t flags, | 738 vpx_codec_flags_t flags, |
720 int ver); | 739 int ver); |
721 | 740 |
722 | 741 |
723 /*!\brief Convenience macro for vpx_codec_enc_init_ver() | 742 /*!\brief Convenience macro for vpx_codec_enc_init_ver() |
724 * | 743 * |
725 * Ensures the ABI version parameter is properly set. | 744 * Ensures the ABI version parameter is properly set. |
726 */ | 745 */ |
727 #define vpx_codec_enc_init(ctx, iface, cfg, flags) \ | 746 #define vpx_codec_enc_init(ctx, iface, cfg, flags) \ |
728 vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION) | 747 vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 */ | 980 */ |
962 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx); | 981 const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx); |
963 | 982 |
964 | 983 |
965 /*!@} - end defgroup encoder*/ | 984 /*!@} - end defgroup encoder*/ |
966 #ifdef __cplusplus | 985 #ifdef __cplusplus |
967 } | 986 } |
968 #endif | 987 #endif |
969 #endif // VPX_VPX_ENCODER_H_ | 988 #endif // VPX_VPX_ENCODER_H_ |
970 | 989 |
OLD | NEW |