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