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