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