1233d2500723e5594f3e7c70896ffeeef32b9c950ywan/*
2233d2500723e5594f3e7c70896ffeeef32b9c950ywan *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3233d2500723e5594f3e7c70896ffeeef32b9c950ywan *
4233d2500723e5594f3e7c70896ffeeef32b9c950ywan *  Use of this source code is governed by a BSD-style license
5233d2500723e5594f3e7c70896ffeeef32b9c950ywan *  that can be found in the LICENSE file in the root of the source
6233d2500723e5594f3e7c70896ffeeef32b9c950ywan *  tree. An additional intellectual property rights grant can be found
7233d2500723e5594f3e7c70896ffeeef32b9c950ywan *  in the file PATENTS.  All contributing project authors may
8233d2500723e5594f3e7c70896ffeeef32b9c950ywan *  be found in the AUTHORS file in the root of the source tree.
9233d2500723e5594f3e7c70896ffeeef32b9c950ywan */
10233d2500723e5594f3e7c70896ffeeef32b9c950ywan#ifndef VPX_VPX_ENCODER_H_
11233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_VPX_ENCODER_H_
12233d2500723e5594f3e7c70896ffeeef32b9c950ywan
13233d2500723e5594f3e7c70896ffeeef32b9c950ywan/*!\defgroup encoder Encoder Algorithm Interface
14233d2500723e5594f3e7c70896ffeeef32b9c950ywan * \ingroup codec
15233d2500723e5594f3e7c70896ffeeef32b9c950ywan * This abstraction allows applications using this encoder to easily support
16233d2500723e5594f3e7c70896ffeeef32b9c950ywan * multiple video formats with minimal code duplication. This section describes
17233d2500723e5594f3e7c70896ffeeef32b9c950ywan * the interface common to all encoders.
18233d2500723e5594f3e7c70896ffeeef32b9c950ywan * @{
19233d2500723e5594f3e7c70896ffeeef32b9c950ywan */
20233d2500723e5594f3e7c70896ffeeef32b9c950ywan
21233d2500723e5594f3e7c70896ffeeef32b9c950ywan/*!\file
22233d2500723e5594f3e7c70896ffeeef32b9c950ywan * \brief Describes the encoder algorithm interface to applications.
23233d2500723e5594f3e7c70896ffeeef32b9c950ywan *
24233d2500723e5594f3e7c70896ffeeef32b9c950ywan * This file describes the interface between an application and a
25233d2500723e5594f3e7c70896ffeeef32b9c950ywan * video encoder algorithm.
26233d2500723e5594f3e7c70896ffeeef32b9c950ywan *
27233d2500723e5594f3e7c70896ffeeef32b9c950ywan */
28233d2500723e5594f3e7c70896ffeeef32b9c950ywan#ifdef __cplusplus
29233d2500723e5594f3e7c70896ffeeef32b9c950ywanextern "C" {
30233d2500723e5594f3e7c70896ffeeef32b9c950ywan#endif
31233d2500723e5594f3e7c70896ffeeef32b9c950ywan
32233d2500723e5594f3e7c70896ffeeef32b9c950ywan#include "./vpx_codec.h"
33233d2500723e5594f3e7c70896ffeeef32b9c950ywan
34233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*! Temporal Scalability: Maximum length of the sequence defining frame
35233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * layer membership
36233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
37233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_TS_MAX_PERIODICITY 16
38233d2500723e5594f3e7c70896ffeeef32b9c950ywan
39233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*! Temporal Scalability: Maximum number of coding layers */
40233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_TS_MAX_LAYERS       5
41233d2500723e5594f3e7c70896ffeeef32b9c950ywan
42233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\deprecated Use #VPX_TS_MAX_PERIODICITY instead. */
43233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define MAX_PERIODICITY VPX_TS_MAX_PERIODICITY
44233d2500723e5594f3e7c70896ffeeef32b9c950ywan
45233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\deprecated Use #VPX_TS_MAX_LAYERS instead. */
46233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define MAX_LAYERS      VPX_TS_MAX_LAYERS
47233d2500723e5594f3e7c70896ffeeef32b9c950ywan
48233d2500723e5594f3e7c70896ffeeef32b9c950ywan/*! Spatial Scalability: Maximum number of coding layers */
49233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_SS_MAX_LAYERS       5
50233d2500723e5594f3e7c70896ffeeef32b9c950ywan
51233d2500723e5594f3e7c70896ffeeef32b9c950ywan/*! Spatial Scalability: Default number of coding layers */
52233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_SS_DEFAULT_LAYERS       1
53233d2500723e5594f3e7c70896ffeeef32b9c950ywan
54233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Current ABI version number
55233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
56233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \internal
57233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * If this file is altered in any way that changes the ABI, this value
58233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * must be bumped.  Examples include, but are not limited to, changing
59233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * types, removing or reassigning enums, adding/removing/rearranging
60233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * fields to structures
61233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
62233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_ENCODER_ABI_VERSION (3 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
63233d2500723e5594f3e7c70896ffeeef32b9c950ywan
64233d2500723e5594f3e7c70896ffeeef32b9c950ywan
65233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*! \brief Encoder capabilities bitfield
66233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
67233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  Each encoder advertises the capabilities it supports as part of its
68233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  ::vpx_codec_iface_t interface structure. Capabilities are extra
69233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  interfaces or functionality, and are not required to be supported
70233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  by an encoder.
71233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
72233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  The available flags are specified by VPX_CODEC_CAP_* defines.
73233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
74233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_CODEC_CAP_PSNR  0x10000 /**< Can issue PSNR packets */
75233d2500723e5594f3e7c70896ffeeef32b9c950ywan
76233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*! Can output one partition at a time. Each partition is returned in its
77233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  own VPX_CODEC_CX_FRAME_PKT, with the FRAME_IS_FRAGMENT flag set for
78233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  every partition but the last. In this mode all frames are always
79233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  returned partition by partition.
80233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
81233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_CODEC_CAP_OUTPUT_PARTITION  0x20000
82233d2500723e5594f3e7c70896ffeeef32b9c950ywan
83233d2500723e5594f3e7c70896ffeeef32b9c950ywan
84233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*! \brief Initialization-time Feature Enabling
85233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
86233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  Certain codec features must be known at initialization time, to allow
87233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  for proper memory allocation.
88233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
89233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *  The available flags are specified by VPX_CODEC_USE_* defines.
90233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
91233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_CODEC_USE_PSNR  0x10000 /**< Calculate PSNR on each frame */
92233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_CODEC_USE_OUTPUT_PARTITION  0x20000 /**< Make the encoder output one
93233d2500723e5594f3e7c70896ffeeef32b9c950ywan  partition at a time. */
94233d2500723e5594f3e7c70896ffeeef32b9c950ywan
95233d2500723e5594f3e7c70896ffeeef32b9c950ywan
96233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Generic fixed size buffer structure
97233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
98233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This structure is able to hold a reference to any fixed size buffer.
99233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
100233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef struct vpx_fixed_buf {
101233d2500723e5594f3e7c70896ffeeef32b9c950ywan    void          *buf; /**< Pointer to the data */
102233d2500723e5594f3e7c70896ffeeef32b9c950ywan    size_t         sz;  /**< Length of the buffer, in chars */
103233d2500723e5594f3e7c70896ffeeef32b9c950ywan  } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */
104233d2500723e5594f3e7c70896ffeeef32b9c950ywan
105233d2500723e5594f3e7c70896ffeeef32b9c950ywan
106233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Time Stamp Type
107233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
108233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * An integer, which when multiplied by the stream's time base, provides
109233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the absolute time of a sample.
110233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
111233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef int64_t vpx_codec_pts_t;
112233d2500723e5594f3e7c70896ffeeef32b9c950ywan
113233d2500723e5594f3e7c70896ffeeef32b9c950ywan
114233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Compressed Frame Flags
115233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
116233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This type represents a bitfield containing information about a compressed
117233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * frame that may be useful to an application. The most significant 16 bits
118233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * can be used by an algorithm to provide additional detail, for example to
119233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * support frame types that are codec specific (MPEG-1 D-frames for example)
120233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
121233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef uint32_t vpx_codec_frame_flags_t;
122233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_FRAME_IS_KEY       0x1 /**< frame is the start of a GOP */
123233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting
124233d2500723e5594f3e7c70896ffeeef32b9c950ywan  the stream (no future frame depends on
125233d2500723e5594f3e7c70896ffeeef32b9c950ywan              this one) */
126233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
127233d2500723e5594f3e7c70896ffeeef32b9c950ywan  be shown */
128233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_FRAME_IS_FRAGMENT  0x8 /**< this is a fragment of the encoded
129233d2500723e5594f3e7c70896ffeeef32b9c950ywan  frame */
130233d2500723e5594f3e7c70896ffeeef32b9c950ywan
131233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Error Resilient flags
132233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
133233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * These flags define which error resilient features to enable in the
134233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * encoder. The flags are specified through the
135233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * vpx_codec_enc_cfg::g_error_resilient variable.
136233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
137233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef uint32_t vpx_codec_er_flags_t;
138233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_ERROR_RESILIENT_DEFAULT     0x1 /**< Improve resiliency against
139233d2500723e5594f3e7c70896ffeeef32b9c950ywan  losses of whole frames */
140233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_ERROR_RESILIENT_PARTITIONS  0x2 /**< The frame partitions are
141233d2500723e5594f3e7c70896ffeeef32b9c950ywan  independently decodable by the
142233d2500723e5594f3e7c70896ffeeef32b9c950ywan  bool decoder, meaning that
143233d2500723e5594f3e7c70896ffeeef32b9c950ywan  partitions can be decoded even
144233d2500723e5594f3e7c70896ffeeef32b9c950ywan  though earlier partitions have
145233d2500723e5594f3e7c70896ffeeef32b9c950ywan  been lost. Note that intra
146233d2500723e5594f3e7c70896ffeeef32b9c950ywan  predicition is still done over
147233d2500723e5594f3e7c70896ffeeef32b9c950ywan  the partition boundary. */
148233d2500723e5594f3e7c70896ffeeef32b9c950ywan
149233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Encoder output packet variants
150233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
151233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This enumeration lists the different kinds of data packets that can be
152233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY
153233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * extend this list to provide additional functionality.
154233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
155233d2500723e5594f3e7c70896ffeeef32b9c950ywan  enum vpx_codec_cx_pkt_kind {
156233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_CODEC_CX_FRAME_PKT,    /**< Compressed video frame */
157233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_CODEC_STATS_PKT,       /**< Two-pass statistics for this frame */
158233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_CODEC_PSNR_PKT,        /**< PSNR statistics for this frame */
159233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions  */
160233d2500723e5594f3e7c70896ffeeef32b9c950ywan  };
161233d2500723e5594f3e7c70896ffeeef32b9c950ywan
162233d2500723e5594f3e7c70896ffeeef32b9c950ywan
163233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Encoder output packet
164233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
165233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This structure contains the different kinds of output data the encoder
166233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * may produce while compressing a frame.
167233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
168233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef struct vpx_codec_cx_pkt {
169233d2500723e5594f3e7c70896ffeeef32b9c950ywan    enum vpx_codec_cx_pkt_kind  kind; /**< packet variant */
170233d2500723e5594f3e7c70896ffeeef32b9c950ywan    union {
171233d2500723e5594f3e7c70896ffeeef32b9c950ywan      struct {
172233d2500723e5594f3e7c70896ffeeef32b9c950ywan        void                    *buf;      /**< compressed data buffer */
173233d2500723e5594f3e7c70896ffeeef32b9c950ywan        size_t                   sz;       /**< length of compressed data */
174233d2500723e5594f3e7c70896ffeeef32b9c950ywan        vpx_codec_pts_t          pts;      /**< time stamp to show frame
175233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                                    (in timebase units) */
176233d2500723e5594f3e7c70896ffeeef32b9c950ywan        unsigned long            duration; /**< duration to show frame
177233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                                    (in timebase units) */
178233d2500723e5594f3e7c70896ffeeef32b9c950ywan        vpx_codec_frame_flags_t  flags;    /**< flags for this frame */
179233d2500723e5594f3e7c70896ffeeef32b9c950ywan        int                      partition_id; /**< the partition id
180233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                              defines the decoding order
181233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                              of the partitions. Only
182233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                              applicable when "output partition"
183233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                              mode is enabled. First partition
184233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                              has id 0.*/
185233d2500723e5594f3e7c70896ffeeef32b9c950ywan
186233d2500723e5594f3e7c70896ffeeef32b9c950ywan      } frame;  /**< data for compressed frame packet */
187233d2500723e5594f3e7c70896ffeeef32b9c950ywan      struct vpx_fixed_buf twopass_stats;  /**< data for two-pass packet */
188233d2500723e5594f3e7c70896ffeeef32b9c950ywan      struct vpx_psnr_pkt {
189233d2500723e5594f3e7c70896ffeeef32b9c950ywan        unsigned int samples[4];  /**< Number of samples, total/y/u/v */
190233d2500723e5594f3e7c70896ffeeef32b9c950ywan        uint64_t     sse[4];      /**< sum squared error, total/y/u/v */
191233d2500723e5594f3e7c70896ffeeef32b9c950ywan        double       psnr[4];     /**< PSNR, total/y/u/v */
192233d2500723e5594f3e7c70896ffeeef32b9c950ywan      } psnr;                       /**< data for PSNR packet */
193233d2500723e5594f3e7c70896ffeeef32b9c950ywan      struct vpx_fixed_buf raw;     /**< data for arbitrary packets */
194233d2500723e5594f3e7c70896ffeeef32b9c950ywan
195233d2500723e5594f3e7c70896ffeeef32b9c950ywan      /* This packet size is fixed to allow codecs to extend this
196233d2500723e5594f3e7c70896ffeeef32b9c950ywan       * interface without having to manage storage for raw packets,
197233d2500723e5594f3e7c70896ffeeef32b9c950ywan       * i.e., if it's smaller than 128 bytes, you can store in the
198233d2500723e5594f3e7c70896ffeeef32b9c950ywan       * packet list directly.
199233d2500723e5594f3e7c70896ffeeef32b9c950ywan       */
200233d2500723e5594f3e7c70896ffeeef32b9c950ywan      char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */
201233d2500723e5594f3e7c70896ffeeef32b9c950ywan    } data; /**< packet data */
202233d2500723e5594f3e7c70896ffeeef32b9c950ywan  } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */
203233d2500723e5594f3e7c70896ffeeef32b9c950ywan
204233d2500723e5594f3e7c70896ffeeef32b9c950ywan
205233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Rational Number
206233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
207233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This structure holds a fractional value.
208233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
209233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef struct vpx_rational {
210233d2500723e5594f3e7c70896ffeeef32b9c950ywan    int num; /**< fraction numerator */
211233d2500723e5594f3e7c70896ffeeef32b9c950ywan    int den; /**< fraction denominator */
212233d2500723e5594f3e7c70896ffeeef32b9c950ywan  } vpx_rational_t; /**< alias for struct vpx_rational */
213233d2500723e5594f3e7c70896ffeeef32b9c950ywan
214233d2500723e5594f3e7c70896ffeeef32b9c950ywan
215233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Multi-pass Encoding Pass */
216233d2500723e5594f3e7c70896ffeeef32b9c950ywan  enum vpx_enc_pass {
217233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_RC_ONE_PASS,   /**< Single pass mode */
218233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */
219233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_RC_LAST_PASS   /**< Final pass of multi-pass mode */
220233d2500723e5594f3e7c70896ffeeef32b9c950ywan  };
221233d2500723e5594f3e7c70896ffeeef32b9c950ywan
222233d2500723e5594f3e7c70896ffeeef32b9c950ywan
223233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Rate control mode */
224233d2500723e5594f3e7c70896ffeeef32b9c950ywan  enum vpx_rc_mode {
225233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_VBR,  /**< Variable Bit Rate (VBR) mode */
226233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_CBR,  /**< Constant Bit Rate (CBR) mode */
227233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_CQ,   /**< Constrained Quality (CQ)  mode */
228233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_Q,    /**< Constant Quality (Q) mode */
229233d2500723e5594f3e7c70896ffeeef32b9c950ywan  };
230233d2500723e5594f3e7c70896ffeeef32b9c950ywan
231233d2500723e5594f3e7c70896ffeeef32b9c950ywan
232233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Keyframe placement mode.
233233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
234233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This enumeration determines whether keyframes are placed automatically by
235233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the encoder or whether this behavior is disabled. Older releases of this
236233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
237233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This name is confusing for this behavior, so the new symbols to be used
238233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * are VPX_KF_AUTO and VPX_KF_DISABLED.
239233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
240233d2500723e5594f3e7c70896ffeeef32b9c950ywan  enum vpx_kf_mode {
241233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */
242233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_KF_AUTO,  /**< Encoder determines optimal placement automatically */
243233d2500723e5594f3e7c70896ffeeef32b9c950ywan    VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
244233d2500723e5594f3e7c70896ffeeef32b9c950ywan  };
245233d2500723e5594f3e7c70896ffeeef32b9c950ywan
246233d2500723e5594f3e7c70896ffeeef32b9c950ywan
247233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Encoded Frame Flags
248233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
249233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This type indicates a bitfield to be passed to vpx_codec_encode(), defining
250233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * per-frame boolean values. By convention, bits common to all codecs will be
251233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * named VPX_EFLAG_*, and bits specific to an algorithm will be named
252233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * /algo/_eflag_*. The lower order 16 bits are reserved for common use.
253233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
254233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef long vpx_enc_frame_flags_t;
255233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_EFLAG_FORCE_KF (1<<0)  /**< Force this frame to be a keyframe */
256233d2500723e5594f3e7c70896ffeeef32b9c950ywan
257233d2500723e5594f3e7c70896ffeeef32b9c950ywan
258233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Encoder configuration structure
259233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
260233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * This structure contains the encoder settings that have common representations
261233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * across all codecs. This doesn't imply that all codecs support all features,
262233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * however.
263233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
264233d2500723e5594f3e7c70896ffeeef32b9c950ywan  typedef struct vpx_codec_enc_cfg {
265233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
266233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * generic settings (g)
267233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
268233d2500723e5594f3e7c70896ffeeef32b9c950ywan
269233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Algorithm specific "usage" value
270233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
271233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Algorithms may define multiple values for usage, which may convey the
272233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * intent of how the application intends to use the stream. If this value
273233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * is non-zero, consult the documentation for the codec to determine its
274233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * meaning.
275233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
276233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           g_usage;
277233d2500723e5594f3e7c70896ffeeef32b9c950ywan
278233d2500723e5594f3e7c70896ffeeef32b9c950ywan
279233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Maximum number of threads to use
280233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
281233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * For multi-threaded implementations, use no more than this number of
282233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * threads. The codec may use fewer threads than allowed. The value
283233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * 0 is equivalent to the value 1.
284233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
285233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           g_threads;
286233d2500723e5594f3e7c70896ffeeef32b9c950ywan
287233d2500723e5594f3e7c70896ffeeef32b9c950ywan
288233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Bitstream profile to use
289233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
290233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Some codecs support a notion of multiple bitstream profiles. Typically
291233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * this maps to a set of features that are turned on or off. Often the
292233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * profile to use is determined by the features of the intended decoder.
293233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Consult the documentation for the codec to determine the valid values
294233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * for this parameter, or set to zero for a sane default.
295233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
296233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           g_profile;  /**< profile of bitstream to use */
297233d2500723e5594f3e7c70896ffeeef32b9c950ywan
298233d2500723e5594f3e7c70896ffeeef32b9c950ywan
299233d2500723e5594f3e7c70896ffeeef32b9c950ywan
300233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Width of the frame
301233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
302233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value identifies the presentation resolution of the frame,
303233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * in pixels. Note that the frames passed as input to the encoder must
304233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * have this resolution. Frames will be presented by the decoder in this
305233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * resolution, independent of any spatial resampling the encoder may do.
306233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
307233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           g_w;
308233d2500723e5594f3e7c70896ffeeef32b9c950ywan
309233d2500723e5594f3e7c70896ffeeef32b9c950ywan
310233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Height of the frame
311233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
312233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value identifies the presentation resolution of the frame,
313233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * in pixels. Note that the frames passed as input to the encoder must
314233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * have this resolution. Frames will be presented by the decoder in this
315233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * resolution, independent of any spatial resampling the encoder may do.
316233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
317233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           g_h;
318233d2500723e5594f3e7c70896ffeeef32b9c950ywan
319233d2500723e5594f3e7c70896ffeeef32b9c950ywan
320233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Stream timebase units
321233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
322233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Indicates the smallest interval of time, in seconds, used by the stream.
323233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * For fixed frame rate material, or variable frame rate material where
324233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * frames are timed at a multiple of a given clock (ex: video capture),
325233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * the \ref RECOMMENDED method is to set the timebase to the reciprocal
326233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
327233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * pts to correspond to the frame number, which can be handy. For
328233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * re-encoding video from containers with absolute time timestamps, the
329233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * \ref RECOMMENDED method is to set the timebase to that of the parent
330233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
331233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
332233d2500723e5594f3e7c70896ffeeef32b9c950ywan    struct vpx_rational    g_timebase;
333233d2500723e5594f3e7c70896ffeeef32b9c950ywan
334233d2500723e5594f3e7c70896ffeeef32b9c950ywan
335233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Enable error resilient modes.
336233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
337233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * The error resilient bitfield indicates to the encoder which features
338233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * it should enable to take measures for streaming over lossy or noisy
339233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * links.
340233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
341233d2500723e5594f3e7c70896ffeeef32b9c950ywan    vpx_codec_er_flags_t   g_error_resilient;
342233d2500723e5594f3e7c70896ffeeef32b9c950ywan
343233d2500723e5594f3e7c70896ffeeef32b9c950ywan
344233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Multi-pass Encoding Mode
345233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
346233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value should be set to the current phase for multi-pass encoding.
347233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * For single pass, set to #VPX_RC_ONE_PASS.
348233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
349233d2500723e5594f3e7c70896ffeeef32b9c950ywan    enum vpx_enc_pass      g_pass;
350233d2500723e5594f3e7c70896ffeeef32b9c950ywan
351233d2500723e5594f3e7c70896ffeeef32b9c950ywan
352233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Allow lagged encoding
353233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
354233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * If set, this value allows the encoder to consume a number of input
355233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * frames before producing output frames. This allows the encoder to
356233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * base decisions for the current frame on future frames. This does
357233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * increase the latency of the encoding pipeline, so it is not appropriate
358233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * in all situations (ex: realtime encoding).
359233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
360233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Note that this is a maximum value -- the encoder may produce frames
361233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * sooner than the given limit. Set this value to 0 to disable this
362233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * feature.
363233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
364233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           g_lag_in_frames;
365233d2500723e5594f3e7c70896ffeeef32b9c950ywan
366233d2500723e5594f3e7c70896ffeeef32b9c950ywan
367233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
368233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * rate control settings (rc)
369233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
370233d2500723e5594f3e7c70896ffeeef32b9c950ywan
371233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Temporal resampling configuration, if supported by the codec.
372233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
373233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Temporal resampling allows the codec to "drop" frames as a strategy to
374233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * meet its target data rate. This can cause temporal discontinuities in
375233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * the encoded video, which may appear as stuttering during playback. This
376233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * trade-off is often acceptable, but for many applications is not. It can
377233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * be disabled in these cases.
378233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
379233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Note that not all codecs support this feature. All vpx VPx codecs do.
380233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * For other codecs, consult the documentation for that algorithm.
381233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
382233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This threshold is described as a percentage of the target data buffer.
383233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * When the data buffer falls below this percentage of fullness, a
384233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * dropped frame is indicated. Set the threshold to zero (0) to disable
385233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * this feature.
386233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
387233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_dropframe_thresh;
388233d2500723e5594f3e7c70896ffeeef32b9c950ywan
389233d2500723e5594f3e7c70896ffeeef32b9c950ywan
390233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Enable/disable spatial resampling, if supported by the codec.
391233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
392233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Spatial resampling allows the codec to compress a lower resolution
393233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * version of the frame, which is then upscaled by the encoder to the
394233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * correct presentation resolution. This increases visual quality at
395233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * low data rates, at the expense of CPU time on the encoder/decoder.
396233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
397233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_resize_allowed;
398233d2500723e5594f3e7c70896ffeeef32b9c950ywan
399233d2500723e5594f3e7c70896ffeeef32b9c950ywan
400233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Spatial resampling up watermark.
401233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
402233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This threshold is described as a percentage of the target data buffer.
403233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * When the data buffer rises above this percentage of fullness, the
404233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * encoder will step up to a higher resolution version of the frame.
405233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
406233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_resize_up_thresh;
407233d2500723e5594f3e7c70896ffeeef32b9c950ywan
408233d2500723e5594f3e7c70896ffeeef32b9c950ywan
409233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Spatial resampling down watermark.
410233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
411233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This threshold is described as a percentage of the target data buffer.
412233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * When the data buffer falls below this percentage of fullness, the
413233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * encoder will step down to a lower resolution version of the frame.
414233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
415233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_resize_down_thresh;
416233d2500723e5594f3e7c70896ffeeef32b9c950ywan
417233d2500723e5594f3e7c70896ffeeef32b9c950ywan
418233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Rate control algorithm to use.
419233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
420233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Indicates whether the end usage of this stream is to be streamed over
421233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
422233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * mode should be used, or whether it will be played back on a high
423233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * bandwidth link, as from a local disk, where higher variations in
424233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * bitrate are acceptable.
425233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
426233d2500723e5594f3e7c70896ffeeef32b9c950ywan    enum vpx_rc_mode       rc_end_usage;
427233d2500723e5594f3e7c70896ffeeef32b9c950ywan
428233d2500723e5594f3e7c70896ffeeef32b9c950ywan
429233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Two-pass stats buffer.
430233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
431233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * A buffer containing all of the stats packets produced in the first
432233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * pass, concatenated.
433233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
434233d2500723e5594f3e7c70896ffeeef32b9c950ywan    struct vpx_fixed_buf   rc_twopass_stats_in;
435233d2500723e5594f3e7c70896ffeeef32b9c950ywan
436233d2500723e5594f3e7c70896ffeeef32b9c950ywan
437233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Target data rate
438233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
439233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Target bandwidth to use for this stream, in kilobits per second.
440233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
441233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_target_bitrate;
442233d2500723e5594f3e7c70896ffeeef32b9c950ywan
443233d2500723e5594f3e7c70896ffeeef32b9c950ywan
444233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
445233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * quantizer settings
446233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
447233d2500723e5594f3e7c70896ffeeef32b9c950ywan
448233d2500723e5594f3e7c70896ffeeef32b9c950ywan
449233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Minimum (Best Quality) Quantizer
450233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
451233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * The quantizer is the most direct control over the quality of the
452233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * encoded image. The range of valid values for the quantizer is codec
453233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * specific. Consult the documentation for the codec to determine the
454233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * values to use. To determine the range programmatically, call
455233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * vpx_codec_enc_config_default() with a usage value of 0.
456233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
457233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_min_quantizer;
458233d2500723e5594f3e7c70896ffeeef32b9c950ywan
459233d2500723e5594f3e7c70896ffeeef32b9c950ywan
460233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Maximum (Worst Quality) Quantizer
461233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
462233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * The quantizer is the most direct control over the quality of the
463233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * encoded image. The range of valid values for the quantizer is codec
464233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * specific. Consult the documentation for the codec to determine the
465233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * values to use. To determine the range programmatically, call
466233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * vpx_codec_enc_config_default() with a usage value of 0.
467233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
468233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_max_quantizer;
469233d2500723e5594f3e7c70896ffeeef32b9c950ywan
470233d2500723e5594f3e7c70896ffeeef32b9c950ywan
471233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
472233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * bitrate tolerance
473233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
474233d2500723e5594f3e7c70896ffeeef32b9c950ywan
475233d2500723e5594f3e7c70896ffeeef32b9c950ywan
476233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Rate control adaptation undershoot control
477233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
478233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value, expressed as a percentage of the target bitrate,
479233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * controls the maximum allowed adaptation speed of the codec.
480233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This factor controls the maximum amount of bits that can
481233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * be subtracted from the target bitrate in order to compensate
482233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * for prior overshoot.
483233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
484233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Valid values in the range 0-1000.
485233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
486233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_undershoot_pct;
487233d2500723e5594f3e7c70896ffeeef32b9c950ywan
488233d2500723e5594f3e7c70896ffeeef32b9c950ywan
489233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Rate control adaptation overshoot control
490233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
491233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value, expressed as a percentage of the target bitrate,
492233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * controls the maximum allowed adaptation speed of the codec.
493233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This factor controls the maximum amount of bits that can
494233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * be added to the target bitrate in order to compensate for
495233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * prior undershoot.
496233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
497233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Valid values in the range 0-1000.
498233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
499233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_overshoot_pct;
500233d2500723e5594f3e7c70896ffeeef32b9c950ywan
501233d2500723e5594f3e7c70896ffeeef32b9c950ywan
502233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
503233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * decoder buffer model parameters
504233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
505233d2500723e5594f3e7c70896ffeeef32b9c950ywan
506233d2500723e5594f3e7c70896ffeeef32b9c950ywan
507233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Decoder Buffer Size
508233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
509233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value indicates the amount of data that may be buffered by the
510233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * decoding application. Note that this value is expressed in units of
511233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * time (milliseconds). For example, a value of 5000 indicates that the
512233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * client will buffer (at least) 5000ms worth of encoded data. Use the
513233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
514233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * necessary.
515233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
516233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_buf_sz;
517233d2500723e5594f3e7c70896ffeeef32b9c950ywan
518233d2500723e5594f3e7c70896ffeeef32b9c950ywan
519233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Decoder Buffer Initial Size
520233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
521233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value indicates the amount of data that will be buffered by the
522233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * decoding application prior to beginning playback. This value is
523233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * expressed in units of time (milliseconds). Use the target bitrate
524233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
525233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
526233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_buf_initial_sz;
527233d2500723e5594f3e7c70896ffeeef32b9c950ywan
528233d2500723e5594f3e7c70896ffeeef32b9c950ywan
529233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Decoder Buffer Optimal Size
530233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
531233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value indicates the amount of data that the encoder should try
532233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * to maintain in the decoder's buffer. This value is expressed in units
533233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
534233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * to convert to bits/bytes, if necessary.
535233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
536233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_buf_optimal_sz;
537233d2500723e5594f3e7c70896ffeeef32b9c950ywan
538233d2500723e5594f3e7c70896ffeeef32b9c950ywan
539233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
540233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * 2 pass rate control parameters
541233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
542233d2500723e5594f3e7c70896ffeeef32b9c950ywan
543233d2500723e5594f3e7c70896ffeeef32b9c950ywan
544233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Two-pass mode CBR/VBR bias
545233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
546233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Bias, expressed on a scale of 0 to 100, for determining target size
547233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * for the current frame. The value 0 indicates the optimal CBR mode
548233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * value should be used. The value 100 indicates the optimal VBR mode
549233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * value should be used. Values in between indicate which way the
550233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * encoder should "lean."
551233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
552233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_2pass_vbr_bias_pct;       /**< RC mode bias between CBR and VBR(0-100: 0->CBR, 100->VBR)   */
553233d2500723e5594f3e7c70896ffeeef32b9c950ywan
554233d2500723e5594f3e7c70896ffeeef32b9c950ywan
555233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Two-pass mode per-GOP minimum bitrate
556233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
557233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value, expressed as a percentage of the target bitrate, indicates
558233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * the minimum bitrate to be used for a single GOP (aka "section")
559233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
560233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_2pass_vbr_minsection_pct;
561233d2500723e5594f3e7c70896ffeeef32b9c950ywan
562233d2500723e5594f3e7c70896ffeeef32b9c950ywan
563233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Two-pass mode per-GOP maximum bitrate
564233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
565233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value, expressed as a percentage of the target bitrate, indicates
566233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * the maximum bitrate to be used for a single GOP (aka "section")
567233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
568233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           rc_2pass_vbr_maxsection_pct;
569233d2500723e5594f3e7c70896ffeeef32b9c950ywan
570233d2500723e5594f3e7c70896ffeeef32b9c950ywan
571233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
572233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * keyframing settings (kf)
573233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
574233d2500723e5594f3e7c70896ffeeef32b9c950ywan
575233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Keyframe placement mode
576233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
577233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value indicates whether the encoder should place keyframes at a
578233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * fixed interval, or determine the optimal placement automatically
579233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * (as governed by the #kf_min_dist and #kf_max_dist parameters)
580233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
581233d2500723e5594f3e7c70896ffeeef32b9c950ywan    enum vpx_kf_mode       kf_mode;
582233d2500723e5594f3e7c70896ffeeef32b9c950ywan
583233d2500723e5594f3e7c70896ffeeef32b9c950ywan
584233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Keyframe minimum interval
585233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
586233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value, expressed as a number of frames, prevents the encoder from
587233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
588233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * least kf_min_dist frames non-keyframes will be coded before the next
589233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
590233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
591233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           kf_min_dist;
592233d2500723e5594f3e7c70896ffeeef32b9c950ywan
593233d2500723e5594f3e7c70896ffeeef32b9c950ywan
594233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Keyframe maximum interval
595233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
596233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value, expressed as a number of frames, forces the encoder to code
597233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * a keyframe if one has not been coded in the last kf_max_dist frames.
598233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * A value of 0 implies all frames will be keyframes. Set kf_min_dist
599233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * equal to kf_max_dist for a fixed interval.
600233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
601233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           kf_max_dist;
602233d2500723e5594f3e7c70896ffeeef32b9c950ywan
603233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*
604233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * Spatial scalability settings (ss)
605233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
606233d2500723e5594f3e7c70896ffeeef32b9c950ywan
607233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Number of spatial coding layers.
608233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
609233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value specifies the number of spatial coding layers to be used.
610233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
611233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ss_number_layers;
612233d2500723e5594f3e7c70896ffeeef32b9c950ywan
613233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Target bitrate for each spatial layer.
614233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
615233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * These values specify the target coding bitrate to be used for each
616233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * spatial layer.
617233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
618233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ss_target_bitrate[VPX_SS_MAX_LAYERS];
619233d2500723e5594f3e7c70896ffeeef32b9c950ywan
620233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Number of temporal coding layers.
621233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
622233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value specifies the number of temporal layers to be used.
623233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
624233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ts_number_layers;
625233d2500723e5594f3e7c70896ffeeef32b9c950ywan
626233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Target bitrate for each temporal layer.
627233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
628233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * These values specify the target coding bitrate to be used for each
629233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * temporal layer.
630233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
631233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ts_target_bitrate[VPX_TS_MAX_LAYERS];
632233d2500723e5594f3e7c70896ffeeef32b9c950ywan
633233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Frame rate decimation factor for each temporal layer.
634233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
635233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * These values specify the frame rate decimation factors to apply
636233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * to each temporal layer.
637233d2500723e5594f3e7c70896ffeeef32b9c950ywan     */
638233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ts_rate_decimator[VPX_TS_MAX_LAYERS];
639233d2500723e5594f3e7c70896ffeeef32b9c950ywan
640233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Length of the sequence defining frame temporal layer membership.
641233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
642233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This value specifies the length of the sequence that defines the
643233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * membership of frames to temporal layers. For example, if the
644233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * ts_periodicity = 8, then the frames are assigned to coding layers with a
645233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * repeated sequence of length 8.
646233d2500723e5594f3e7c70896ffeeef32b9c950ywan    */
647233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ts_periodicity;
648233d2500723e5594f3e7c70896ffeeef32b9c950ywan
649233d2500723e5594f3e7c70896ffeeef32b9c950ywan    /*!\brief Template defining the membership of frames to temporal layers.
650233d2500723e5594f3e7c70896ffeeef32b9c950ywan     *
651233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * This array defines the membership of frames to temporal coding layers.
652233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * For a 2-layer encoding that assigns even numbered frames to one temporal
653233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * layer (0) and odd numbered frames to a second temporal layer (1) with
654233d2500723e5594f3e7c70896ffeeef32b9c950ywan     * ts_periodicity=8, then ts_layer_id = (0,1,0,1,0,1,0,1).
655233d2500723e5594f3e7c70896ffeeef32b9c950ywan    */
656233d2500723e5594f3e7c70896ffeeef32b9c950ywan    unsigned int           ts_layer_id[VPX_TS_MAX_PERIODICITY];
657233d2500723e5594f3e7c70896ffeeef32b9c950ywan  } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */
658233d2500723e5594f3e7c70896ffeeef32b9c950ywan
659233d2500723e5594f3e7c70896ffeeef32b9c950ywan
660233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Initialize an encoder instance
661233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
662233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Initializes a encoder context using the given interface. Applications
663233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * should call the vpx_codec_enc_init convenience macro instead of this
664233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * function directly, to ensure that the ABI version number parameter
665233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * is properly initialized.
666233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
667233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * If the library was configured with --disable-multithread, this call
668233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * is not thread safe and should be guarded with a lock if being used
669233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * in a multithreaded context.
670233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
671233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
672233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * parameter), the storage pointed to by the cfg parameter must be
673233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * kept readable and stable until all memory maps have been set.
674233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
675233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ctx     Pointer to this instance's context.
676233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    iface   Pointer to the algorithm interface to use.
677233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    cfg     Configuration to use, if known. May be NULL.
678233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    flags   Bitfield of VPX_CODEC_USE_* flags
679233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ver     ABI version number. Must be set to
680233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *                       VPX_ENCODER_ABI_VERSION
681233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_OK
682233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     The decoder algorithm initialized.
683233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_MEM_ERROR
684233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Memory allocation failed.
685233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
686233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t      *ctx,
687233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                         vpx_codec_iface_t    *iface,
688233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                         vpx_codec_enc_cfg_t  *cfg,
689233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                         vpx_codec_flags_t     flags,
690233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                         int                   ver);
691233d2500723e5594f3e7c70896ffeeef32b9c950ywan
692233d2500723e5594f3e7c70896ffeeef32b9c950ywan
693233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Convenience macro for vpx_codec_enc_init_ver()
694233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
695233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Ensures the ABI version parameter is properly set.
696233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
697233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
698233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
699233d2500723e5594f3e7c70896ffeeef32b9c950ywan
700233d2500723e5594f3e7c70896ffeeef32b9c950ywan
701233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Initialize multi-encoder instance
702233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
703233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Initializes multi-encoder context using the given interface.
704233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Applications should call the vpx_codec_enc_init_multi convenience macro
705233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * instead of this function directly, to ensure that the ABI version number
706233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * parameter is properly initialized.
707233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
708233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
709233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * parameter), the storage pointed to by the cfg parameter must be
710233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * kept readable and stable until all memory maps have been set.
711233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
712233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ctx     Pointer to this instance's context.
713233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    iface   Pointer to the algorithm interface to use.
714233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    cfg     Configuration to use, if known. May be NULL.
715233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    num_enc Total number of encoders.
716233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    flags   Bitfield of VPX_CODEC_USE_* flags
717233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    dsf     Pointer to down-sampling factors.
718233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ver     ABI version number. Must be set to
719233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *                       VPX_ENCODER_ABI_VERSION
720233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_OK
721233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     The decoder algorithm initialized.
722233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_MEM_ERROR
723233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Memory allocation failed.
724233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
725233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t      *ctx,
726233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                               vpx_codec_iface_t    *iface,
727233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                               vpx_codec_enc_cfg_t  *cfg,
728233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                               int                   num_enc,
729233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                               vpx_codec_flags_t     flags,
730233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                               vpx_rational_t       *dsf,
731233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                               int                   ver);
732233d2500723e5594f3e7c70896ffeeef32b9c950ywan
733233d2500723e5594f3e7c70896ffeeef32b9c950ywan
734233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Convenience macro for vpx_codec_enc_init_multi_ver()
735233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
736233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Ensures the ABI version parameter is properly set.
737233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
738233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define vpx_codec_enc_init_multi(ctx, iface, cfg, num_enc, flags, dsf) \
739233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_enc_init_multi_ver(ctx, iface, cfg, num_enc, flags, dsf, \
740233d2500723e5594f3e7c70896ffeeef32b9c950ywan                               VPX_ENCODER_ABI_VERSION)
741233d2500723e5594f3e7c70896ffeeef32b9c950ywan
742233d2500723e5594f3e7c70896ffeeef32b9c950ywan
743233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Get a default configuration
744233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
745233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Initializes a encoder configuration structure with default values. Supports
746233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the notion of "usages" so that an algorithm may offer different default
747233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * settings depending on the user's intended goal. This function \ref SHOULD
748233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * be called by all applications to initialize the configuration structure
749233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * before specializing the configuration with application specific values.
750233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
751233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    iface   Pointer to the algorithm interface to use.
752233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[out]   cfg     Configuration buffer to populate
753233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    usage   End usage. Set to 0 or use codec specific values.
754233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
755233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_OK
756233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     The configuration was populated.
757233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INCAPABLE
758233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Interface is not an encoder interface.
759233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INVALID_PARAM
760233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     A parameter was NULL, or the usage value was not recognized.
761233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
762233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_err_t  vpx_codec_enc_config_default(vpx_codec_iface_t    *iface,
763233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                                vpx_codec_enc_cfg_t  *cfg,
764233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                                unsigned int          usage);
765233d2500723e5594f3e7c70896ffeeef32b9c950ywan
766233d2500723e5594f3e7c70896ffeeef32b9c950ywan
767233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Set or change configuration
768233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
769233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Reconfigures an encoder instance according to the given configuration.
770233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
771233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ctx     Pointer to this instance's context
772233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    cfg     Configuration buffer to use
773233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
774233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_OK
775233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     The configuration was populated.
776233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INCAPABLE
777233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Interface is not an encoder interface.
778233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INVALID_PARAM
779233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     A parameter was NULL, or the usage value was not recognized.
780233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
781233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_err_t  vpx_codec_enc_config_set(vpx_codec_ctx_t            *ctx,
782233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                            const vpx_codec_enc_cfg_t  *cfg);
783233d2500723e5594f3e7c70896ffeeef32b9c950ywan
784233d2500723e5594f3e7c70896ffeeef32b9c950ywan
785233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Get global stream headers
786233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
787233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Retrieves a stream level global header packet, if supported by the codec.
788233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
789233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ctx     Pointer to this instance's context
790233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
791233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval NULL
792233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Encoder does not support global header
793233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval Non-NULL
794233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Pointer to buffer containing global header packet
795233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
796233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t   *ctx);
797233d2500723e5594f3e7c70896ffeeef32b9c950ywan
798233d2500723e5594f3e7c70896ffeeef32b9c950ywan
799233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_DL_REALTIME     (1)        /**< deadline parameter analogous to
800233d2500723e5594f3e7c70896ffeeef32b9c950ywan  *   VPx REALTIME mode. */
801233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_DL_GOOD_QUALITY (1000000)  /**< deadline parameter analogous to
802233d2500723e5594f3e7c70896ffeeef32b9c950ywan  *   VPx GOOD QUALITY mode. */
803233d2500723e5594f3e7c70896ffeeef32b9c950ywan#define VPX_DL_BEST_QUALITY (0)        /**< deadline parameter analogous to
804233d2500723e5594f3e7c70896ffeeef32b9c950ywan  *   VPx BEST QUALITY mode. */
805233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Encode a frame
806233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
807233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Encodes a video frame at the given "presentation time." The presentation
808233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * time stamp (PTS) \ref MUST be strictly increasing.
809233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
810233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * The encoder supports the notion of a soft real-time deadline. Given a
811233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * non-zero value to the deadline parameter, the encoder will make a "best
812233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * effort" guarantee to  return before the given time slice expires. It is
813233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * implicit that limiting the available time to encode will degrade the
814233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * output quality. The encoder can be given an unlimited time to produce the
815233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * best possible frame by specifying a deadline of '0'. This deadline
816233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * supercedes the VPx notion of "best quality, good quality, realtime".
817233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Applications that wish to map these former settings to the new deadline
818233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
819233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * and #VPX_DL_BEST_QUALITY.
820233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
821233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * When the last frame has been passed to the encoder, this function should
822233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * continue to be called, with the img parameter set to NULL. This will
823233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * signal the end-of-stream condition to the encoder and allow it to encode
824233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * any held buffers. Encoding is complete when vpx_codec_encode() is called
825233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * and vpx_codec_get_cx_data() returns no data.
826233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
827233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ctx       Pointer to this instance's context
828233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    img       Image data to encode, NULL to flush.
829233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    pts       Presentation time stamp, in timebase units.
830233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    duration  Duration to show frame, in timebase units.
831233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    flags     Flags to use for encoding this frame.
832233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    deadline  Time to spend encoding, in microseconds. (0=infinite)
833233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
834233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_OK
835233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     The configuration was populated.
836233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INCAPABLE
837233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     Interface is not an encoder interface.
838233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INVALID_PARAM
839233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     A parameter was NULL, the image format is unsupported, etc.
840233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
841233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_err_t  vpx_codec_encode(vpx_codec_ctx_t            *ctx,
842233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                    const vpx_image_t          *img,
843233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                    vpx_codec_pts_t             pts,
844233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                    unsigned long               duration,
845233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                    vpx_enc_frame_flags_t       flags,
846233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                    unsigned long               deadline);
847233d2500723e5594f3e7c70896ffeeef32b9c950ywan
848233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Set compressed data output buffer
849233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
850233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Sets the buffer that the codec should output the compressed data
851233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * into. This call effectively sets the buffer pointer returned in the
852233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be
853233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * appended into this buffer. The buffer is preserved across frames,
854233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * so applications must periodically call this function after flushing
855233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the accumulated compressed data to disk or to the network to reset
856233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the pointer to the buffer's head.
857233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
858233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * `pad_before` bytes will be skipped before writing the compressed
859233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * data, and `pad_after` bytes will be appended to the packet. The size
860233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * of the packet will be the sum of the size of the actual compressed
861233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * data, pad_before, and pad_after. The padding bytes will be preserved
862233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * (not overwritten).
863233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
864233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Note that calling this function does not guarantee that the returned
865233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * compressed data will be placed into the specified buffer. In the
866233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * event that the encoded data will not fit into the buffer provided,
867233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the returned packet \ref MAY point to an internal buffer, as it would
868233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * if this call were never used. In this event, the output packet will
869233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * NOT have any padding, and the application must free space and copy it
870233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * to the proper place. This is of particular note in configurations
871233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * that may output multiple packets for a single encoded frame (e.g., lagged
872233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * encoding) or if the application does not reset the buffer periodically.
873233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
874233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Applications may restore the default behavior of the codec providing
875233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * the compressed data buffer by calling this function with a NULL
876233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * buffer.
877233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
878233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Applications \ref MUSTNOT call this function during iteration of
879233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * vpx_codec_get_cx_data().
880233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
881233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    ctx         Pointer to this instance's context
882233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    buf         Buffer to store compressed data into
883233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    pad_before  Bytes to skip before writing compressed data
884233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]    pad_after   Bytes to skip after writing compressed data
885233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
886233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_OK
887233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     The buffer was set successfully.
888233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \retval #VPX_CODEC_INVALID_PARAM
889233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *     A parameter was NULL, the image format is unsupported, etc.
890233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
891233d2500723e5594f3e7c70896ffeeef32b9c950ywan  vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t       *ctx,
892233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                            const vpx_fixed_buf_t *buf,
893233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                            unsigned int           pad_before,
894233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                            unsigned int           pad_after);
895233d2500723e5594f3e7c70896ffeeef32b9c950ywan
896233d2500723e5594f3e7c70896ffeeef32b9c950ywan
897233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Encoded data iterator
898233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
899233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Iterates over a list of data packets to be passed from the encoder to the
900233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * application. The different kinds of packets available are enumerated in
901233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * #vpx_codec_cx_pkt_kind.
902233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
903233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's
904233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * muxer. Multiple compressed frames may be in the list.
905233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer.
906233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
907233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * The application \ref MUST silently ignore any packet kinds that it does
908233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * not recognize or support.
909233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
910233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * The data buffers returned from this function are only guaranteed to be
911233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * valid until the application makes another call to any vpx_codec_* function.
912233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
913233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]     ctx      Pointer to this instance's context
914233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in,out] iter     Iterator storage, initialized to NULL
915233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
916233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \return Returns a pointer to an output data packet (compressed frame data,
917233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *         two-pass statistics, etc.) or NULL to signal end-of-list.
918233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
919233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
920233d2500723e5594f3e7c70896ffeeef32b9c950ywan  const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t   *ctx,
921233d2500723e5594f3e7c70896ffeeef32b9c950ywan                                                  vpx_codec_iter_t  *iter);
922233d2500723e5594f3e7c70896ffeeef32b9c950ywan
923233d2500723e5594f3e7c70896ffeeef32b9c950ywan
924233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!\brief Get Preview Frame
925233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
926233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * Returns an image that can be used as a preview. Shows the image as it would
927233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * exist at the decompressor. The application \ref MUST NOT write into this
928233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * image buffer.
929233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
930233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \param[in]     ctx      Pointer to this instance's context
931233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
932233d2500723e5594f3e7c70896ffeeef32b9c950ywan   * \return Returns a pointer to a preview image, or NULL if no image is
933233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *         available.
934233d2500723e5594f3e7c70896ffeeef32b9c950ywan   *
935233d2500723e5594f3e7c70896ffeeef32b9c950ywan   */
936233d2500723e5594f3e7c70896ffeeef32b9c950ywan  const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t   *ctx);
937233d2500723e5594f3e7c70896ffeeef32b9c950ywan
938233d2500723e5594f3e7c70896ffeeef32b9c950ywan
939233d2500723e5594f3e7c70896ffeeef32b9c950ywan  /*!@} - end defgroup encoder*/
940233d2500723e5594f3e7c70896ffeeef32b9c950ywan#ifdef __cplusplus
941233d2500723e5594f3e7c70896ffeeef32b9c950ywan}
942233d2500723e5594f3e7c70896ffeeef32b9c950ywan#endif
943233d2500723e5594f3e7c70896ffeeef32b9c950ywan#endif  // VPX_VPX_ENCODER_H_
944233d2500723e5594f3e7c70896ffeeef32b9c950ywan
945