John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 10 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 11 | #ifndef AOM_AOM_ENCODER_H_ |
| 12 | #define AOM_AOM_ENCODER_H_ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 13 | |
| 14 | /*!\defgroup encoder Encoder Algorithm Interface |
| 15 | * \ingroup codec |
| 16 | * This abstraction allows applications using this encoder to easily support |
| 17 | * multiple video formats with minimal code duplication. This section describes |
| 18 | * the interface common to all encoders. |
| 19 | * @{ |
| 20 | */ |
| 21 | |
James Zern | f42d52e | 2011-02-16 17:54:49 -0800 | [diff] [blame] | 22 | /*!\file |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 23 | * \brief Describes the encoder algorithm interface to applications. |
| 24 | * |
| 25 | * This file describes the interface between an application and a |
| 26 | * video encoder algorithm. |
| 27 | * |
| 28 | */ |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 33 | #include "./aom_codec.h" |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 34 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 35 | /*!\brief Current ABI version number |
| 36 | * |
| 37 | * \internal |
| 38 | * If this file is altered in any way that changes the ABI, this value |
| 39 | * must be bumped. Examples include, but are not limited to, changing |
| 40 | * types, removing or reassigning enums, adding/removing/rearranging |
| 41 | * fields to structures |
| 42 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 43 | #define AOM_ENCODER_ABI_VERSION \ |
| 44 | (5 + AOM_CODEC_ABI_VERSION) /**<\hideinitializer*/ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 45 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 46 | /*! \brief Encoder capabilities bitfield |
| 47 | * |
| 48 | * Each encoder advertises the capabilities it supports as part of its |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 49 | * ::aom_codec_iface_t interface structure. Capabilities are extra |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 50 | * interfaces or functionality, and are not required to be supported |
| 51 | * by an encoder. |
| 52 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 53 | * The available flags are specified by AOM_CODEC_CAP_* defines. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 54 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 55 | #define AOM_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 56 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 57 | /*! Can output one partition at a time. Each partition is returned in its |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 58 | * own AOM_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 59 | * every partition but the last. In this mode all frames are always |
| 60 | * returned partition by partition. |
| 61 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 62 | #define AOM_CODEC_CAP_OUTPUT_PARTITION 0x20000 |
Stefan Holmer | b433e12 | 2011-06-10 15:58:22 +0200 | [diff] [blame] | 63 | |
Deb Mukherjee | 5acfafb | 2014-08-26 12:35:15 -0700 | [diff] [blame] | 64 | /*! Can support input images at greater than 8 bitdepth. |
| 65 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 66 | #define AOM_CODEC_CAP_HIGHBITDEPTH 0x40000 |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 67 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 68 | /*! \brief Initialization-time Feature Enabling |
| 69 | * |
| 70 | * Certain codec features must be known at initialization time, to allow |
| 71 | * for proper memory allocation. |
| 72 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 73 | * The available flags are specified by AOM_CODEC_USE_* defines. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 74 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 75 | #define AOM_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 76 | /*!\brief Make the encoder output one partition at a time. */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 77 | #define AOM_CODEC_USE_OUTPUT_PARTITION 0x20000 |
| 78 | #define AOM_CODEC_USE_HIGHBITDEPTH 0x40000 /**< Use high bitdepth */ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 79 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 80 | /*!\brief Generic fixed size buffer structure |
| 81 | * |
| 82 | * This structure is able to hold a reference to any fixed size buffer. |
| 83 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 84 | typedef struct aom_fixed_buf { |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 85 | void *buf; /**< Pointer to the data */ |
| 86 | size_t sz; /**< Length of the buffer, in chars */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 87 | } aom_fixed_buf_t; /**< alias for struct aom_fixed_buf */ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 88 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 89 | /*!\brief Time Stamp Type |
| 90 | * |
| 91 | * An integer, which when multiplied by the stream's time base, provides |
| 92 | * the absolute time of a sample. |
| 93 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 94 | typedef int64_t aom_codec_pts_t; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 95 | |
| 96 | /*!\brief Compressed Frame Flags |
| 97 | * |
| 98 | * This type represents a bitfield containing information about a compressed |
| 99 | * frame that may be useful to an application. The most significant 16 bits |
| 100 | * can be used by an algorithm to provide additional detail, for example to |
| 101 | * support frame types that are codec specific (MPEG-1 D-frames for example) |
| 102 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 103 | typedef uint32_t aom_codec_frame_flags_t; |
| 104 | #define AOM_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 105 | /*!\brief frame can be dropped without affecting the stream (no future frame |
| 106 | * depends on this one) */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 107 | #define AOM_FRAME_IS_DROPPABLE 0x2 |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 108 | /*!\brief frame should be decoded but will not be shown */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 109 | #define AOM_FRAME_IS_INVISIBLE 0x4 |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 110 | /*!\brief this is a fragment of the encoded frame */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 111 | #define AOM_FRAME_IS_FRAGMENT 0x8 |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 112 | |
| 113 | /*!\brief Error Resilient flags |
| 114 | * |
| 115 | * These flags define which error resilient features to enable in the |
| 116 | * encoder. The flags are specified through the |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 117 | * aom_codec_enc_cfg::g_error_resilient variable. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 118 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 119 | typedef uint32_t aom_codec_er_flags_t; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 120 | /*!\brief Improve resiliency against losses of whole frames */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 121 | #define AOM_ERROR_RESILIENT_DEFAULT 0x1 |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 122 | /*!\brief The frame partitions are independently decodable by the bool decoder, |
| 123 | * meaning that partitions can be decoded even though earlier partitions have |
| 124 | * been lost. Note that intra prediction is still done over the partition |
| 125 | * boundary. */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 126 | #define AOM_ERROR_RESILIENT_PARTITIONS 0x2 |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 127 | |
| 128 | /*!\brief Encoder output packet variants |
| 129 | * |
| 130 | * This enumeration lists the different kinds of data packets that can be |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 131 | * returned by calls to aom_codec_get_cx_data(). Algorithms \ref MAY |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 132 | * extend this list to provide additional functionality. |
| 133 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 134 | enum aom_codec_cx_pkt_kind { |
| 135 | AOM_CODEC_CX_FRAME_PKT, /**< Compressed video frame */ |
| 136 | AOM_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */ |
| 137 | AOM_CODEC_FPMB_STATS_PKT, /**< first pass mb statistics for this frame */ |
| 138 | AOM_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */ |
| 139 | AOM_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 140 | }; |
| 141 | |
| 142 | /*!\brief Encoder output packet |
| 143 | * |
| 144 | * This structure contains the different kinds of output data the encoder |
| 145 | * may produce while compressing a frame. |
| 146 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 147 | typedef struct aom_codec_cx_pkt { |
| 148 | enum aom_codec_cx_pkt_kind kind; /**< packet variant */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 149 | union { |
| 150 | struct { |
| 151 | void *buf; /**< compressed data buffer */ |
| 152 | size_t sz; /**< length of compressed data */ |
| 153 | /*!\brief time stamp to show frame (in timebase units) */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 154 | aom_codec_pts_t pts; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 155 | /*!\brief duration to show frame (in timebase units) */ |
| 156 | unsigned long duration; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 157 | aom_codec_frame_flags_t flags; /**< flags for this frame */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 158 | /*!\brief the partition id defines the decoding order of the partitions. |
| 159 | * Only applicable when "output partition" mode is enabled. First |
| 160 | * partition has id 0.*/ |
| 161 | int partition_id; |
| 162 | } frame; /**< data for compressed frame packet */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 163 | aom_fixed_buf_t twopass_stats; /**< data for two-pass packet */ |
| 164 | aom_fixed_buf_t firstpass_mb_stats; /**< first pass mb packet */ |
| 165 | struct aom_psnr_pkt { |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 166 | unsigned int samples[4]; /**< Number of samples, total/y/u/v */ |
| 167 | uint64_t sse[4]; /**< sum squared error, total/y/u/v */ |
| 168 | double psnr[4]; /**< PSNR, total/y/u/v */ |
| 169 | } psnr; /**< data for PSNR packet */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 170 | aom_fixed_buf_t raw; /**< data for arbitrary packets */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 171 | |
| 172 | /* This packet size is fixed to allow codecs to extend this |
| 173 | * interface without having to manage storage for raw packets, |
| 174 | * i.e., if it's smaller than 128 bytes, you can store in the |
| 175 | * packet list directly. |
| 176 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 177 | char pad[128 - sizeof(enum aom_codec_cx_pkt_kind)]; /**< fixed sz */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 178 | } data; /**< packet data */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 179 | } aom_codec_cx_pkt_t; /**< alias for struct aom_codec_cx_pkt */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 180 | |
| 181 | /*!\brief Rational Number |
| 182 | * |
| 183 | * This structure holds a fractional value. |
| 184 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 185 | typedef struct aom_rational { |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 186 | int num; /**< fraction numerator */ |
| 187 | int den; /**< fraction denominator */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 188 | } aom_rational_t; /**< alias for struct aom_rational */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 189 | |
| 190 | /*!\brief Multi-pass Encoding Pass */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 191 | enum aom_enc_pass { |
| 192 | AOM_RC_ONE_PASS, /**< Single pass mode */ |
| 193 | AOM_RC_FIRST_PASS, /**< First pass of multi-pass mode */ |
| 194 | AOM_RC_LAST_PASS /**< Final pass of multi-pass mode */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 195 | }; |
| 196 | |
| 197 | /*!\brief Rate control mode */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 198 | enum aom_rc_mode { |
| 199 | AOM_VBR, /**< Variable Bit Rate (VBR) mode */ |
| 200 | AOM_CBR, /**< Constant Bit Rate (CBR) mode */ |
| 201 | AOM_CQ, /**< Constrained Quality (CQ) mode */ |
| 202 | AOM_Q, /**< Constant Quality (Q) mode */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 203 | }; |
| 204 | |
| 205 | /*!\brief Keyframe placement mode. |
| 206 | * |
| 207 | * This enumeration determines whether keyframes are placed automatically by |
| 208 | * the encoder or whether this behavior is disabled. Older releases of this |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 209 | * SDK were implemented such that AOM_KF_FIXED meant keyframes were disabled. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 210 | * This name is confusing for this behavior, so the new symbols to be used |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 211 | * are AOM_KF_AUTO and AOM_KF_DISABLED. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 212 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 213 | enum aom_kf_mode { |
| 214 | AOM_KF_FIXED, /**< deprecated, implies AOM_KF_DISABLED */ |
| 215 | AOM_KF_AUTO, /**< Encoder determines optimal placement automatically */ |
| 216 | AOM_KF_DISABLED = 0 /**< Encoder does not place keyframes. */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 217 | }; |
| 218 | |
| 219 | /*!\brief Encoded Frame Flags |
| 220 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 221 | * This type indicates a bitfield to be passed to aom_codec_encode(), defining |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 222 | * per-frame boolean values. By convention, bits common to all codecs will be |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 223 | * named AOM_EFLAG_*, and bits specific to an algorithm will be named |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 224 | * /algo/_eflag_*. The lower order 16 bits are reserved for common use. |
| 225 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 226 | typedef long aom_enc_frame_flags_t; |
| 227 | #define AOM_EFLAG_FORCE_KF (1 << 0) /**< Force this frame to be a keyframe */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 228 | |
| 229 | /*!\brief Encoder configuration structure |
| 230 | * |
| 231 | * This structure contains the encoder settings that have common representations |
| 232 | * across all codecs. This doesn't imply that all codecs support all features, |
| 233 | * however. |
| 234 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 235 | typedef struct aom_codec_enc_cfg { |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 236 | /* |
| 237 | * generic settings (g) |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 238 | */ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 239 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 240 | /*!\brief Algorithm specific "usage" value |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 241 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 242 | * Algorithms may define multiple values for usage, which may convey the |
| 243 | * intent of how the application intends to use the stream. If this value |
| 244 | * is non-zero, consult the documentation for the codec to determine its |
| 245 | * meaning. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 246 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 247 | unsigned int g_usage; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 248 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 249 | /*!\brief Maximum number of threads to use |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 250 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 251 | * For multi-threaded implementations, use no more than this number of |
| 252 | * threads. The codec may use fewer threads than allowed. The value |
| 253 | * 0 is equivalent to the value 1. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 254 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 255 | unsigned int g_threads; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 256 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 257 | /*!\brief Bitstream profile to use |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 258 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 259 | * Some codecs support a notion of multiple bitstream profiles. Typically |
| 260 | * this maps to a set of features that are turned on or off. Often the |
| 261 | * profile to use is determined by the features of the intended decoder. |
| 262 | * Consult the documentation for the codec to determine the valid values |
| 263 | * for this parameter, or set to zero for a sane default. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 264 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 265 | unsigned int g_profile; /**< profile of bitstream to use */ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 266 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 267 | /*!\brief Width of the frame |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 268 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 269 | * This value identifies the presentation resolution of the frame, |
| 270 | * in pixels. Note that the frames passed as input to the encoder must |
| 271 | * have this resolution. Frames will be presented by the decoder in this |
| 272 | * resolution, independent of any spatial resampling the encoder may do. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 273 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 274 | unsigned int g_w; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 275 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 276 | /*!\brief Height of the frame |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 277 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 278 | * This value identifies the presentation resolution of the frame, |
| 279 | * in pixels. Note that the frames passed as input to the encoder must |
| 280 | * have this resolution. Frames will be presented by the decoder in this |
| 281 | * resolution, independent of any spatial resampling the encoder may do. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 282 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 283 | unsigned int g_h; |
Stefan Holmer | 7296b3f | 2011-06-13 16:42:27 +0200 | [diff] [blame] | 284 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 285 | /*!\brief Bit-depth of the codec |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 286 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 287 | * This value identifies the bit_depth of the codec, |
| 288 | * Only certain bit-depths are supported as identified in the |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 289 | * aom_bit_depth_t enum. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 290 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 291 | aom_bit_depth_t g_bit_depth; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 292 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 293 | /*!\brief Bit-depth of the input frames |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 294 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 295 | * This value identifies the bit_depth of the input frames in bits. |
| 296 | * Note that the frames passed as input to the encoder must have |
| 297 | * this bit-depth. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 298 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 299 | unsigned int g_input_bit_depth; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 300 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 301 | /*!\brief Stream timebase units |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 302 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 303 | * Indicates the smallest interval of time, in seconds, used by the stream. |
| 304 | * For fixed frame rate material, or variable frame rate material where |
| 305 | * frames are timed at a multiple of a given clock (ex: video capture), |
| 306 | * the \ref RECOMMENDED method is to set the timebase to the reciprocal |
| 307 | * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the |
| 308 | * pts to correspond to the frame number, which can be handy. For |
| 309 | * re-encoding video from containers with absolute time timestamps, the |
| 310 | * \ref RECOMMENDED method is to set the timebase to that of the parent |
| 311 | * container or multimedia framework (ex: 1/1000 for ms, as in FLV). |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 312 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 313 | struct aom_rational g_timebase; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 314 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 315 | /*!\brief Enable error resilient modes. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 316 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 317 | * The error resilient bitfield indicates to the encoder which features |
| 318 | * it should enable to take measures for streaming over lossy or noisy |
| 319 | * links. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 320 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 321 | aom_codec_er_flags_t g_error_resilient; |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 322 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 323 | /*!\brief Multi-pass Encoding Mode |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 324 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 325 | * This value should be set to the current phase for multi-pass encoding. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 326 | * For single pass, set to #AOM_RC_ONE_PASS. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 327 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 328 | enum aom_enc_pass g_pass; |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 329 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 330 | /*!\brief Allow lagged encoding |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 331 | * |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 332 | * If set, this value allows the encoder to consume a number of input |
| 333 | * frames before producing output frames. This allows the encoder to |
| 334 | * base decisions for the current frame on future frames. This does |
| 335 | * increase the latency of the encoding pipeline, so it is not appropriate |
| 336 | * in all situations (ex: realtime encoding). |
| 337 | * |
| 338 | * Note that this is a maximum value -- the encoder may produce frames |
| 339 | * sooner than the given limit. Set this value to 0 to disable this |
| 340 | * feature. |
John Koleszar | c6b9039 | 2012-07-13 15:21:29 -0700 | [diff] [blame] | 341 | */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 342 | unsigned int g_lag_in_frames; |
| 343 | |
| 344 | /* |
| 345 | * rate control settings (rc) |
| 346 | */ |
| 347 | |
| 348 | /*!\brief Temporal resampling configuration, if supported by the codec. |
| 349 | * |
| 350 | * Temporal resampling allows the codec to "drop" frames as a strategy to |
| 351 | * meet its target data rate. This can cause temporal discontinuities in |
| 352 | * the encoded video, which may appear as stuttering during playback. This |
| 353 | * trade-off is often acceptable, but for many applications is not. It can |
| 354 | * be disabled in these cases. |
| 355 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 356 | * Note that not all codecs support this feature. All aom AVx codecs do. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 357 | * For other codecs, consult the documentation for that algorithm. |
| 358 | * |
| 359 | * This threshold is described as a percentage of the target data buffer. |
| 360 | * When the data buffer falls below this percentage of fullness, a |
| 361 | * dropped frame is indicated. Set the threshold to zero (0) to disable |
| 362 | * this feature. |
| 363 | */ |
| 364 | unsigned int rc_dropframe_thresh; |
| 365 | |
Debargha Mukherjee | 29e40a6 | 2017-06-14 09:37:12 -0700 | [diff] [blame] | 366 | /*!\brief Mode for spatial resampling, if supported by the codec. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 367 | * |
| 368 | * Spatial resampling allows the codec to compress a lower resolution |
Debargha Mukherjee | 29e40a6 | 2017-06-14 09:37:12 -0700 | [diff] [blame] | 369 | * version of the frame, which is then upscaled by the decoder to the |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 370 | * correct presentation resolution. This increases visual quality at |
| 371 | * low data rates, at the expense of CPU time on the encoder/decoder. |
| 372 | */ |
Debargha Mukherjee | 29e40a6 | 2017-06-14 09:37:12 -0700 | [diff] [blame] | 373 | unsigned int rc_resize_mode; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 374 | |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 375 | /*!\brief Frame resize denominator. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 376 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 377 | * The denominator for resize to use, assuming 8 as the numerator. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 378 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 379 | * Valid denominators are 8 - 16 for now. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 380 | */ |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 381 | unsigned int rc_resize_denominator; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 382 | |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 383 | /*!\brief Keyframe resize denominator. |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 384 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 385 | * The denominator for resize to use, assuming 8 as the numerator. |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 386 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 387 | * Valid denominators are 8 - 16 for now. |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 388 | */ |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 389 | unsigned int rc_resize_kf_denominator; |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 390 | |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 391 | /*!\brief Frame super-resolution scaling mode. |
| 392 | * |
| 393 | * Similar to spatial resampling, frame super-resolution integrates |
| 394 | * upscaling after the encode/decode process. Taking control of upscaling and |
| 395 | * using restoration filters should allow it to outperform normal resizing. |
| 396 | * |
Urvang Joshi | 93b779b | 2017-09-26 12:03:51 -0700 | [diff] [blame] | 397 | * Mode 0 is SUPERRES_NONE, mode 1 is SUPERRES_FIXED, mode 2 is |
| 398 | * SUPERRES_RANDOM and mode 3 is SUPERRES_QTHRESH. |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 399 | */ |
| 400 | unsigned int rc_superres_mode; |
| 401 | |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 402 | /*!\brief Frame super-resolution denominator. |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 403 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 404 | * The denominator for superres to use. If fixed it will only change if the |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 405 | * cumulative scale change over resizing and superres is greater than 1/2; |
| 406 | * this forces superres to reduce scaling. |
| 407 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 408 | * Valid denominators are 8 to 16. |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 409 | * |
Debargha Mukherjee | 7166f22 | 2017-09-05 21:32:42 -0700 | [diff] [blame] | 410 | * Used only by SUPERRES_FIXED. |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 411 | */ |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 412 | unsigned int rc_superres_denominator; |
Fergus Simpson | c4e7894 | 2017-04-10 14:59:00 -0700 | [diff] [blame] | 413 | |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 414 | /*!\brief Keyframe super-resolution denominator. |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 415 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 416 | * The denominator for superres to use. If fixed it will only change if the |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 417 | * cumulative scale change over resizing and superres is greater than 1/2; |
| 418 | * this forces superres to reduce scaling. |
| 419 | * |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 420 | * Valid denominators are 8 - 16 for now. |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 421 | */ |
Urvang Joshi | de71d14 | 2017-10-05 12:12:15 -0700 | [diff] [blame] | 422 | unsigned int rc_superres_kf_denominator; |
Fergus Simpson | 87cf61b | 2017-06-15 00:50:34 -0700 | [diff] [blame] | 423 | |
Debargha Mukherjee | 7166f22 | 2017-09-05 21:32:42 -0700 | [diff] [blame] | 424 | /*!\brief Frame super-resolution q threshold. |
| 425 | * |
| 426 | * The q level threshold after which superres is used. |
| 427 | * Valid values are 1 to 63. |
| 428 | * |
| 429 | * Used only by SUPERRES_QTHRESH |
| 430 | */ |
| 431 | unsigned int rc_superres_qthresh; |
| 432 | |
| 433 | /*!\brief Keyframe super-resolution q threshold. |
| 434 | * |
| 435 | * The q level threshold after which superres is used for key frames. |
| 436 | * Valid values are 1 to 63. |
| 437 | * |
| 438 | * Used only by SUPERRES_QTHRESH |
| 439 | */ |
| 440 | unsigned int rc_superres_kf_qthresh; |
| 441 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 442 | /*!\brief Rate control algorithm to use. |
| 443 | * |
| 444 | * Indicates whether the end usage of this stream is to be streamed over |
| 445 | * a bandwidth constrained link, indicating that Constant Bit Rate (CBR) |
| 446 | * mode should be used, or whether it will be played back on a high |
| 447 | * bandwidth link, as from a local disk, where higher variations in |
| 448 | * bitrate are acceptable. |
| 449 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 450 | enum aom_rc_mode rc_end_usage; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 451 | |
| 452 | /*!\brief Two-pass stats buffer. |
| 453 | * |
| 454 | * A buffer containing all of the stats packets produced in the first |
| 455 | * pass, concatenated. |
| 456 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 457 | aom_fixed_buf_t rc_twopass_stats_in; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 458 | |
| 459 | /*!\brief first pass mb stats buffer. |
| 460 | * |
| 461 | * A buffer containing all of the first pass mb stats packets produced |
| 462 | * in the first pass, concatenated. |
| 463 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 464 | aom_fixed_buf_t rc_firstpass_mb_stats_in; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 465 | |
| 466 | /*!\brief Target data rate |
| 467 | * |
| 468 | * Target bandwidth to use for this stream, in kilobits per second. |
| 469 | */ |
| 470 | unsigned int rc_target_bitrate; |
| 471 | |
| 472 | /* |
| 473 | * quantizer settings |
| 474 | */ |
| 475 | |
| 476 | /*!\brief Minimum (Best Quality) Quantizer |
| 477 | * |
| 478 | * The quantizer is the most direct control over the quality of the |
| 479 | * encoded image. The range of valid values for the quantizer is codec |
| 480 | * specific. Consult the documentation for the codec to determine the |
| 481 | * values to use. To determine the range programmatically, call |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 482 | * aom_codec_enc_config_default() with a usage value of 0. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 483 | */ |
| 484 | unsigned int rc_min_quantizer; |
| 485 | |
| 486 | /*!\brief Maximum (Worst Quality) Quantizer |
| 487 | * |
| 488 | * The quantizer is the most direct control over the quality of the |
| 489 | * encoded image. The range of valid values for the quantizer is codec |
| 490 | * specific. Consult the documentation for the codec to determine the |
| 491 | * values to use. To determine the range programmatically, call |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 492 | * aom_codec_enc_config_default() with a usage value of 0. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 493 | */ |
| 494 | unsigned int rc_max_quantizer; |
| 495 | |
| 496 | /* |
| 497 | * bitrate tolerance |
| 498 | */ |
| 499 | |
| 500 | /*!\brief Rate control adaptation undershoot control |
| 501 | * |
| 502 | * This value, expressed as a percentage of the target bitrate, |
| 503 | * controls the maximum allowed adaptation speed of the codec. |
| 504 | * This factor controls the maximum amount of bits that can |
| 505 | * be subtracted from the target bitrate in order to compensate |
| 506 | * for prior overshoot. |
| 507 | * |
| 508 | * Valid values in the range 0-1000. |
| 509 | */ |
| 510 | unsigned int rc_undershoot_pct; |
| 511 | |
| 512 | /*!\brief Rate control adaptation overshoot control |
| 513 | * |
| 514 | * This value, expressed as a percentage of the target bitrate, |
| 515 | * controls the maximum allowed adaptation speed of the codec. |
| 516 | * This factor controls the maximum amount of bits that can |
| 517 | * be added to the target bitrate in order to compensate for |
| 518 | * prior undershoot. |
| 519 | * |
| 520 | * Valid values in the range 0-1000. |
| 521 | */ |
| 522 | unsigned int rc_overshoot_pct; |
| 523 | |
| 524 | /* |
| 525 | * decoder buffer model parameters |
| 526 | */ |
| 527 | |
| 528 | /*!\brief Decoder Buffer Size |
| 529 | * |
| 530 | * This value indicates the amount of data that may be buffered by the |
| 531 | * decoding application. Note that this value is expressed in units of |
| 532 | * time (milliseconds). For example, a value of 5000 indicates that the |
| 533 | * client will buffer (at least) 5000ms worth of encoded data. Use the |
| 534 | * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if |
| 535 | * necessary. |
| 536 | */ |
| 537 | unsigned int rc_buf_sz; |
| 538 | |
| 539 | /*!\brief Decoder Buffer Initial Size |
| 540 | * |
| 541 | * This value indicates the amount of data that will be buffered by the |
| 542 | * decoding application prior to beginning playback. This value is |
| 543 | * expressed in units of time (milliseconds). Use the target bitrate |
| 544 | * (#rc_target_bitrate) to convert to bits/bytes, if necessary. |
| 545 | */ |
| 546 | unsigned int rc_buf_initial_sz; |
| 547 | |
| 548 | /*!\brief Decoder Buffer Optimal Size |
| 549 | * |
| 550 | * This value indicates the amount of data that the encoder should try |
| 551 | * to maintain in the decoder's buffer. This value is expressed in units |
| 552 | * of time (milliseconds). Use the target bitrate (#rc_target_bitrate) |
| 553 | * to convert to bits/bytes, if necessary. |
| 554 | */ |
| 555 | unsigned int rc_buf_optimal_sz; |
| 556 | |
| 557 | /* |
| 558 | * 2 pass rate control parameters |
| 559 | */ |
| 560 | |
| 561 | /*!\brief Two-pass mode CBR/VBR bias |
| 562 | * |
| 563 | * Bias, expressed on a scale of 0 to 100, for determining target size |
| 564 | * for the current frame. The value 0 indicates the optimal CBR mode |
| 565 | * value should be used. The value 100 indicates the optimal VBR mode |
| 566 | * value should be used. Values in between indicate which way the |
| 567 | * encoder should "lean." |
| 568 | */ |
| 569 | unsigned int rc_2pass_vbr_bias_pct; |
| 570 | |
| 571 | /*!\brief Two-pass mode per-GOP minimum bitrate |
| 572 | * |
| 573 | * This value, expressed as a percentage of the target bitrate, indicates |
| 574 | * the minimum bitrate to be used for a single GOP (aka "section") |
| 575 | */ |
| 576 | unsigned int rc_2pass_vbr_minsection_pct; |
| 577 | |
| 578 | /*!\brief Two-pass mode per-GOP maximum bitrate |
| 579 | * |
| 580 | * This value, expressed as a percentage of the target bitrate, indicates |
| 581 | * the maximum bitrate to be used for a single GOP (aka "section") |
| 582 | */ |
| 583 | unsigned int rc_2pass_vbr_maxsection_pct; |
| 584 | |
| 585 | /* |
| 586 | * keyframing settings (kf) |
| 587 | */ |
| 588 | |
| 589 | /*!\brief Keyframe placement mode |
| 590 | * |
| 591 | * This value indicates whether the encoder should place keyframes at a |
| 592 | * fixed interval, or determine the optimal placement automatically |
| 593 | * (as governed by the #kf_min_dist and #kf_max_dist parameters) |
| 594 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 595 | enum aom_kf_mode kf_mode; |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 596 | |
| 597 | /*!\brief Keyframe minimum interval |
| 598 | * |
| 599 | * This value, expressed as a number of frames, prevents the encoder from |
| 600 | * placing a keyframe nearer than kf_min_dist to the previous keyframe. At |
| 601 | * least kf_min_dist frames non-keyframes will be coded before the next |
| 602 | * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval. |
| 603 | */ |
| 604 | unsigned int kf_min_dist; |
| 605 | |
| 606 | /*!\brief Keyframe maximum interval |
| 607 | * |
| 608 | * This value, expressed as a number of frames, forces the encoder to code |
| 609 | * a keyframe if one has not been coded in the last kf_max_dist frames. |
| 610 | * A value of 0 implies all frames will be keyframes. Set kf_min_dist |
| 611 | * equal to kf_max_dist for a fixed interval. |
| 612 | */ |
| 613 | unsigned int kf_max_dist; |
Yunqing Wang | eeb08a9 | 2017-07-07 21:25:18 -0700 | [diff] [blame] | 614 | |
| 615 | /*!\brief Tile coding mode |
| 616 | * |
| 617 | * This value indicates the tile coding mode. |
| 618 | * A value of 0 implies a normal non-large-scale tile coding. A value of 1 |
| 619 | * implies a large-scale tile coding. |
| 620 | */ |
| 621 | unsigned int large_scale_tile; |
Dominic Symes | 26ad0b2 | 2017-10-01 16:35:13 +0200 | [diff] [blame] | 622 | |
| 623 | /*!\brief Number of explicit tile widths specified |
| 624 | * |
| 625 | * This value indicates the number of tile widths specified |
| 626 | * A value of 0 implies no tile widths are specified. |
| 627 | * Tile widths are given in the array tile_widths[] |
| 628 | */ |
| 629 | int tile_width_count; |
| 630 | |
| 631 | /*!\brief Number of explicit tile heights specified |
| 632 | * |
| 633 | * This value indicates the number of tile heights specified |
| 634 | * A value of 0 implies no tile heights are specified. |
| 635 | * Tile heights are given in the array tile_heights[] |
| 636 | */ |
| 637 | int tile_height_count; |
| 638 | |
| 639 | /*!\brief Maximum number of tile widths in tile widths array |
| 640 | * |
| 641 | * This define gives the maximum number of elements in the tile_widths array. |
| 642 | */ |
| 643 | #define MAX_TILE_WIDTHS 64 // maximum tile width array length |
| 644 | |
| 645 | /*!\brief Array of specified tile widths |
| 646 | * |
| 647 | * This array specifies tile widths (and may be empty) |
| 648 | * The number of widths specified is given by tile_width_count |
| 649 | */ |
| 650 | int tile_widths[MAX_TILE_WIDTHS]; |
| 651 | |
| 652 | /*!\brief Maximum number of tile heights in tile heights array. |
| 653 | * |
| 654 | * This define gives the maximum number of elements in the tile_heights array. |
| 655 | */ |
| 656 | #define MAX_TILE_HEIGHTS 64 // maximum tile height array length |
| 657 | |
| 658 | /*!\brief Array of specified tile heights |
| 659 | * |
| 660 | * This array specifies tile heights (and may be empty) |
| 661 | * The number of heights specified is given by tile_height_count |
| 662 | */ |
| 663 | int tile_heights[MAX_TILE_HEIGHTS]; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 664 | } aom_codec_enc_cfg_t; /**< alias for struct aom_codec_enc_cfg */ |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 665 | |
| 666 | /*!\brief Initialize an encoder instance |
| 667 | * |
| 668 | * Initializes a encoder context using the given interface. Applications |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 669 | * should call the aom_codec_enc_init convenience macro instead of this |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 670 | * function directly, to ensure that the ABI version number parameter |
| 671 | * is properly initialized. |
| 672 | * |
| 673 | * If the library was configured with --disable-multithread, this call |
| 674 | * is not thread safe and should be guarded with a lock if being used |
| 675 | * in a multithreaded context. |
| 676 | * |
| 677 | * \param[in] ctx Pointer to this instance's context. |
| 678 | * \param[in] iface Pointer to the algorithm interface to use. |
Yaowu Xu | 7d30b4a | 2017-08-02 15:43:19 -0700 | [diff] [blame] | 679 | * \param[in] cfg Configuration to use, if known. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 680 | * \param[in] flags Bitfield of AOM_CODEC_USE_* flags |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 681 | * \param[in] ver ABI version number. Must be set to |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 682 | * AOM_ENCODER_ABI_VERSION |
| 683 | * \retval #AOM_CODEC_OK |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 684 | * The decoder algorithm initialized. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 685 | * \retval #AOM_CODEC_MEM_ERROR |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 686 | * Memory allocation failed. |
| 687 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 688 | aom_codec_err_t aom_codec_enc_init_ver(aom_codec_ctx_t *ctx, |
| 689 | aom_codec_iface_t *iface, |
| 690 | const aom_codec_enc_cfg_t *cfg, |
| 691 | aom_codec_flags_t flags, int ver); |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 692 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 693 | /*!\brief Convenience macro for aom_codec_enc_init_ver() |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 694 | * |
| 695 | * Ensures the ABI version parameter is properly set. |
| 696 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 697 | #define aom_codec_enc_init(ctx, iface, cfg, flags) \ |
| 698 | aom_codec_enc_init_ver(ctx, iface, cfg, flags, AOM_ENCODER_ABI_VERSION) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 699 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 700 | /*!\brief Initialize multi-encoder instance |
| 701 | * |
| 702 | * Initializes multi-encoder context using the given interface. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 703 | * Applications should call the aom_codec_enc_init_multi convenience macro |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 704 | * instead of this function directly, to ensure that the ABI version number |
| 705 | * parameter is properly initialized. |
| 706 | * |
| 707 | * \param[in] ctx Pointer to this instance's context. |
| 708 | * \param[in] iface Pointer to the algorithm interface to use. |
Yaowu Xu | 7d30b4a | 2017-08-02 15:43:19 -0700 | [diff] [blame] | 709 | * \param[in] cfg Configuration to use, if known. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 710 | * \param[in] num_enc Total number of encoders. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 711 | * \param[in] flags Bitfield of AOM_CODEC_USE_* flags |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 712 | * \param[in] dsf Pointer to down-sampling factors. |
| 713 | * \param[in] ver ABI version number. Must be set to |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 714 | * AOM_ENCODER_ABI_VERSION |
| 715 | * \retval #AOM_CODEC_OK |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 716 | * The decoder algorithm initialized. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 717 | * \retval #AOM_CODEC_MEM_ERROR |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 718 | * Memory allocation failed. |
| 719 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 720 | aom_codec_err_t aom_codec_enc_init_multi_ver( |
| 721 | aom_codec_ctx_t *ctx, aom_codec_iface_t *iface, aom_codec_enc_cfg_t *cfg, |
| 722 | int num_enc, aom_codec_flags_t flags, aom_rational_t *dsf, int ver); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 723 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 724 | /*!\brief Convenience macro for aom_codec_enc_init_multi_ver() |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 725 | * |
| 726 | * Ensures the ABI version parameter is properly set. |
| 727 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 728 | #define aom_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \ |
| 729 | aom_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \ |
| 730 | AOM_ENCODER_ABI_VERSION) |
John Koleszar | 83b1d90 | 2012-11-05 12:37:14 -0800 | [diff] [blame] | 731 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 732 | /*!\brief Get a default configuration |
| 733 | * |
| 734 | * Initializes a encoder configuration structure with default values. Supports |
| 735 | * the notion of "usages" so that an algorithm may offer different default |
| 736 | * settings depending on the user's intended goal. This function \ref SHOULD |
| 737 | * be called by all applications to initialize the configuration structure |
| 738 | * before specializing the configuration with application specific values. |
| 739 | * |
| 740 | * \param[in] iface Pointer to the algorithm interface to use. |
| 741 | * \param[out] cfg Configuration buffer to populate. |
Alex Converse | 6e3c805 | 2016-12-16 09:48:56 -0800 | [diff] [blame] | 742 | * \param[in] reserved Must set to 0. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 743 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 744 | * \retval #AOM_CODEC_OK |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 745 | * The configuration was populated. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 746 | * \retval #AOM_CODEC_INCAPABLE |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 747 | * Interface is not an encoder interface. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 748 | * \retval #AOM_CODEC_INVALID_PARAM |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 749 | * A parameter was NULL, or the usage value was not recognized. |
| 750 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 751 | aom_codec_err_t aom_codec_enc_config_default(aom_codec_iface_t *iface, |
| 752 | aom_codec_enc_cfg_t *cfg, |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 753 | unsigned int reserved); |
John Koleszar | 83b1d90 | 2012-11-05 12:37:14 -0800 | [diff] [blame] | 754 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 755 | /*!\brief Set or change configuration |
| 756 | * |
| 757 | * Reconfigures an encoder instance according to the given configuration. |
| 758 | * |
| 759 | * \param[in] ctx Pointer to this instance's context |
| 760 | * \param[in] cfg Configuration buffer to use |
| 761 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 762 | * \retval #AOM_CODEC_OK |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 763 | * The configuration was populated. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 764 | * \retval #AOM_CODEC_INCAPABLE |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 765 | * Interface is not an encoder interface. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 766 | * \retval #AOM_CODEC_INVALID_PARAM |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 767 | * A parameter was NULL, or the usage value was not recognized. |
| 768 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 769 | aom_codec_err_t aom_codec_enc_config_set(aom_codec_ctx_t *ctx, |
| 770 | const aom_codec_enc_cfg_t *cfg); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 771 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 772 | /*!\brief Get global stream headers |
| 773 | * |
| 774 | * Retrieves a stream level global header packet, if supported by the codec. |
| 775 | * |
| 776 | * \param[in] ctx Pointer to this instance's context |
| 777 | * |
| 778 | * \retval NULL |
| 779 | * Encoder does not support global header |
| 780 | * \retval Non-NULL |
| 781 | * Pointer to buffer containing global header packet |
| 782 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 783 | aom_fixed_buf_t *aom_codec_get_global_headers(aom_codec_ctx_t *ctx); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 784 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 785 | /*!\brief deadline parameter analogous to AVx GOOD QUALITY mode. */ |
| 786 | #define AOM_DL_GOOD_QUALITY (1000000) |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 787 | /*!\brief Encode a frame |
| 788 | * |
| 789 | * Encodes a video frame at the given "presentation time." The presentation |
| 790 | * time stamp (PTS) \ref MUST be strictly increasing. |
| 791 | * |
| 792 | * The encoder supports the notion of a soft real-time deadline. Given a |
| 793 | * non-zero value to the deadline parameter, the encoder will make a "best |
| 794 | * effort" guarantee to return before the given time slice expires. It is |
| 795 | * implicit that limiting the available time to encode will degrade the |
| 796 | * output quality. The encoder can be given an unlimited time to produce the |
| 797 | * best possible frame by specifying a deadline of '0'. This deadline |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 798 | * supercedes the AVx notion of "best quality, good quality, realtime". |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 799 | * Applications that wish to map these former settings to the new deadline |
Thomas Daede | 8082614 | 2017-03-20 15:44:24 -0700 | [diff] [blame] | 800 | * based system can use the symbol #AOM_DL_GOOD_QUALITY. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 801 | * |
| 802 | * When the last frame has been passed to the encoder, this function should |
| 803 | * continue to be called, with the img parameter set to NULL. This will |
| 804 | * signal the end-of-stream condition to the encoder and allow it to encode |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 805 | * any held buffers. Encoding is complete when aom_codec_encode() is called |
| 806 | * and aom_codec_get_cx_data() returns no data. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 807 | * |
| 808 | * \param[in] ctx Pointer to this instance's context |
| 809 | * \param[in] img Image data to encode, NULL to flush. |
| 810 | * \param[in] pts Presentation time stamp, in timebase units. |
| 811 | * \param[in] duration Duration to show frame, in timebase units. |
| 812 | * \param[in] flags Flags to use for encoding this frame. |
| 813 | * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite) |
| 814 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 815 | * \retval #AOM_CODEC_OK |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 816 | * The configuration was populated. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 817 | * \retval #AOM_CODEC_INCAPABLE |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 818 | * Interface is not an encoder interface. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 819 | * \retval #AOM_CODEC_INVALID_PARAM |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 820 | * A parameter was NULL, the image format is unsupported, etc. |
| 821 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 822 | aom_codec_err_t aom_codec_encode(aom_codec_ctx_t *ctx, const aom_image_t *img, |
| 823 | aom_codec_pts_t pts, unsigned long duration, |
| 824 | aom_enc_frame_flags_t flags, |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 825 | unsigned long deadline); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 826 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 827 | /*!\brief Set compressed data output buffer |
| 828 | * |
| 829 | * Sets the buffer that the codec should output the compressed data |
| 830 | * into. This call effectively sets the buffer pointer returned in the |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 831 | * next AOM_CODEC_CX_FRAME_PKT packet. Subsequent packets will be |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 832 | * appended into this buffer. The buffer is preserved across frames, |
| 833 | * so applications must periodically call this function after flushing |
| 834 | * the accumulated compressed data to disk or to the network to reset |
| 835 | * the pointer to the buffer's head. |
| 836 | * |
| 837 | * `pad_before` bytes will be skipped before writing the compressed |
| 838 | * data, and `pad_after` bytes will be appended to the packet. The size |
| 839 | * of the packet will be the sum of the size of the actual compressed |
| 840 | * data, pad_before, and pad_after. The padding bytes will be preserved |
| 841 | * (not overwritten). |
| 842 | * |
| 843 | * Note that calling this function does not guarantee that the returned |
| 844 | * compressed data will be placed into the specified buffer. In the |
| 845 | * event that the encoded data will not fit into the buffer provided, |
| 846 | * the returned packet \ref MAY point to an internal buffer, as it would |
| 847 | * if this call were never used. In this event, the output packet will |
| 848 | * NOT have any padding, and the application must free space and copy it |
| 849 | * to the proper place. This is of particular note in configurations |
| 850 | * that may output multiple packets for a single encoded frame (e.g., lagged |
| 851 | * encoding) or if the application does not reset the buffer periodically. |
| 852 | * |
| 853 | * Applications may restore the default behavior of the codec providing |
| 854 | * the compressed data buffer by calling this function with a NULL |
| 855 | * buffer. |
| 856 | * |
| 857 | * Applications \ref MUSTNOT call this function during iteration of |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 858 | * aom_codec_get_cx_data(). |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 859 | * |
| 860 | * \param[in] ctx Pointer to this instance's context |
| 861 | * \param[in] buf Buffer to store compressed data into |
| 862 | * \param[in] pad_before Bytes to skip before writing compressed data |
| 863 | * \param[in] pad_after Bytes to skip after writing compressed data |
| 864 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 865 | * \retval #AOM_CODEC_OK |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 866 | * The buffer was set successfully. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 867 | * \retval #AOM_CODEC_INVALID_PARAM |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 868 | * A parameter was NULL, the image format is unsupported, etc. |
| 869 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 870 | aom_codec_err_t aom_codec_set_cx_data_buf(aom_codec_ctx_t *ctx, |
| 871 | const aom_fixed_buf_t *buf, |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 872 | unsigned int pad_before, |
| 873 | unsigned int pad_after); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 874 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 875 | /*!\brief Encoded data iterator |
| 876 | * |
| 877 | * Iterates over a list of data packets to be passed from the encoder to the |
| 878 | * application. The different kinds of packets available are enumerated in |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 879 | * #aom_codec_cx_pkt_kind. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 880 | * |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 881 | * #AOM_CODEC_CX_FRAME_PKT packets should be passed to the application's |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 882 | * muxer. Multiple compressed frames may be in the list. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 883 | * #AOM_CODEC_STATS_PKT packets should be appended to a global buffer. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 884 | * |
| 885 | * The application \ref MUST silently ignore any packet kinds that it does |
| 886 | * not recognize or support. |
| 887 | * |
| 888 | * The data buffers returned from this function are only guaranteed to be |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 889 | * valid until the application makes another call to any aom_codec_* function. |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 890 | * |
| 891 | * \param[in] ctx Pointer to this instance's context |
| 892 | * \param[in,out] iter Iterator storage, initialized to NULL |
| 893 | * |
| 894 | * \return Returns a pointer to an output data packet (compressed frame data, |
| 895 | * two-pass statistics, etc.) or NULL to signal end-of-list. |
| 896 | * |
| 897 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 898 | const aom_codec_cx_pkt_t *aom_codec_get_cx_data(aom_codec_ctx_t *ctx, |
| 899 | aom_codec_iter_t *iter); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 900 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 901 | /*!\brief Get Preview Frame |
| 902 | * |
| 903 | * Returns an image that can be used as a preview. Shows the image as it would |
| 904 | * exist at the decompressor. The application \ref MUST NOT write into this |
| 905 | * image buffer. |
| 906 | * |
| 907 | * \param[in] ctx Pointer to this instance's context |
| 908 | * |
| 909 | * \return Returns a pointer to a preview image, or NULL if no image is |
| 910 | * available. |
| 911 | * |
| 912 | */ |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 913 | const aom_image_t *aom_codec_get_preview_frame(aom_codec_ctx_t *ctx); |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 914 | |
clang-format | 83a5207 | 2016-08-08 20:22:13 -0700 | [diff] [blame] | 915 | /*!@} - end defgroup encoder*/ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 916 | #ifdef __cplusplus |
| 917 | } |
| 918 | #endif |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 919 | #endif // AOM_AOM_ENCODER_H_ |