blob: 69b8d3e34e3ed4fbbac12f5fb5206ba14d191614 [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
James Zern7386bde2013-12-15 18:26:15 -080010#ifndef VPX_VP8CX_H_
11#define VPX_VP8CX_H_
John Koleszar0ea50ce2010-05-18 11:58:33 -040012
Yaowu Xuf5bbe242015-01-15 14:32:42 -080013/*!\defgroup vp8_encoder WebM VP8/VP9 Encoder
John Koleszar0ea50ce2010-05-18 11:58:33 -040014 * \ingroup vp8
15 *
16 * @{
17 */
Johanne883c742013-12-16 13:15:26 -080018#include "./vp8.h"
James Zern7999c072015-03-23 16:07:21 -070019#include "./vpx_encoder.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -040020
James Zernf42d52e2011-02-16 17:54:49 -080021/*!\file
Yaowu Xuf5bbe242015-01-15 14:32:42 -080022 * \brief Provides definitions for using VP8 or VP9 encoder algorithm within the
John Koleszar0ea50ce2010-05-18 11:58:33 -040023 * vpx Codec Interface.
24 */
Dmitry Kovaleve288c602013-09-29 18:00:15 -070025
26#ifdef __cplusplus
27extern "C" {
28#endif
John Koleszar0ea50ce2010-05-18 11:58:33 -040029
James Zern8e17e822011-02-24 14:12:57 -080030/*!\name Algorithm interface for VP8
John Koleszar0ea50ce2010-05-18 11:58:33 -040031 *
Yaowu Xuf5bbe242015-01-15 14:32:42 -080032 * This interface provides the capability to encode raw VP8 streams.
James Zern8e17e822011-02-24 14:12:57 -080033 * @{
John Koleszar0ea50ce2010-05-18 11:58:33 -040034 */
John Koleszarfa7a55b2010-09-21 10:35:52 -040035extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
John Koleszarc6b90392012-07-13 15:21:29 -070036extern vpx_codec_iface_t *vpx_codec_vp8_cx(void);
Yaowu Xuf5bbe242015-01-15 14:32:42 -080037/*!@} - end algorithm interface member group*/
John Koleszar0ea50ce2010-05-18 11:58:33 -040038
Yaowu Xuf5bbe242015-01-15 14:32:42 -080039/*!\name Algorithm interface for VP9
40 *
41 * This interface provides the capability to encode raw VP9 streams.
42 * @{
43 */
John Koleszara9c75972012-11-08 17:09:30 -080044extern vpx_codec_iface_t vpx_codec_vp9_cx_algo;
45extern vpx_codec_iface_t *vpx_codec_vp9_cx(void);
John Koleszar83b1d902012-11-05 12:37:14 -080046/*!@} - end algorithm interface member group*/
John Koleszar0952acb2010-06-01 11:14:25 -040047
Jingning Han3ee6db62015-08-05 19:00:31 -070048/*!\name Algorithm interface for VP10
49 *
50 * This interface provides the capability to encode raw VP9 streams.
51 * @{
52 */
53extern vpx_codec_iface_t vpx_codec_vp10_cx_algo;
54extern vpx_codec_iface_t *vpx_codec_vp10_cx(void);
55/*!@} - end algorithm interface member group*/
John Koleszar0952acb2010-06-01 11:14:25 -040056
John Koleszar0ea50ce2010-05-18 11:58:33 -040057/*
58 * Algorithm Flags
59 */
60
61/*!\brief Don't reference the last frame
62 *
63 * When this flag is set, the encoder will not use the last frame as a
64 * predictor. When not set, the encoder will choose whether to use the
65 * last frame or not automatically.
66 */
67#define VP8_EFLAG_NO_REF_LAST (1<<16)
68
69
70/*!\brief Don't reference the golden frame
71 *
72 * When this flag is set, the encoder will not use the golden frame as a
73 * predictor. When not set, the encoder will choose whether to use the
74 * golden frame or not automatically.
75 */
76#define VP8_EFLAG_NO_REF_GF (1<<17)
77
78
79/*!\brief Don't reference the alternate reference frame
80 *
81 * When this flag is set, the encoder will not use the alt ref frame as a
82 * predictor. When not set, the encoder will choose whether to use the
83 * alt ref frame or not automatically.
84 */
85#define VP8_EFLAG_NO_REF_ARF (1<<21)
86
87
88/*!\brief Don't update the last frame
89 *
90 * When this flag is set, the encoder will not update the last frame with
91 * the contents of the current frame.
92 */
93#define VP8_EFLAG_NO_UPD_LAST (1<<18)
94
95
96/*!\brief Don't update the golden frame
97 *
98 * When this flag is set, the encoder will not update the golden frame with
99 * the contents of the current frame.
100 */
101#define VP8_EFLAG_NO_UPD_GF (1<<22)
102
103
104/*!\brief Don't update the alternate reference frame
105 *
106 * When this flag is set, the encoder will not update the alt ref frame with
107 * the contents of the current frame.
108 */
109#define VP8_EFLAG_NO_UPD_ARF (1<<23)
110
111
112/*!\brief Force golden frame update
113 *
114 * When this flag is set, the encoder copy the contents of the current frame
115 * to the golden frame buffer.
116 */
117#define VP8_EFLAG_FORCE_GF (1<<19)
118
119
120/*!\brief Force alternate reference frame update
121 *
122 * When this flag is set, the encoder copy the contents of the current frame
123 * to the alternate reference frame buffer.
124 */
125#define VP8_EFLAG_FORCE_ARF (1<<24)
126
127
128/*!\brief Disable entropy update
129 *
130 * When this flag is set, the encoder will not update its internal entropy
131 * model based on the entropy of this frame.
132 */
133#define VP8_EFLAG_NO_UPD_ENTROPY (1<<20)
134
135
Yaowu Xu41652902015-03-12 17:59:18 -0700136/*!\brief VPx encoder control functions
John Koleszar0ea50ce2010-05-18 11:58:33 -0400137 *
Yaowu Xu41652902015-03-12 17:59:18 -0700138 * This set of macros define the control functions available for VPx
James Zern8e17e822011-02-24 14:12:57 -0800139 * encoder interface.
140 *
141 * \sa #vpx_codec_control
John Koleszar0ea50ce2010-05-18 11:58:33 -0400142 */
John Koleszarc6b90392012-07-13 15:21:29 -0700143enum vp8e_enc_control_id {
Yaowu Xu268f1062015-03-13 09:42:57 -0700144 /*!\brief Codec control function to set mode of entropy update in encoder.
145 *
146 * Supported in codecs: VP8, VP9
147 */
148 VP8E_UPD_ENTROPY = 5,
149
150 /*!\brief Codec control function to set reference update mode in encoder.
151 *
152 * Supported in codecs: VP8, VP9
153 */
154 VP8E_UPD_REFERENCE,
155
156 /*!\brief Codec control function to set which reference frame encoder can use.
157 *
158 * Supported in codecs: VP8, VP9
159 */
160 VP8E_USE_REFERENCE,
161
162 /*!\brief Codec control function to pass an ROI map to encoder.
163 *
164 * Supported in codecs: VP8, VP9
165 */
166 VP8E_SET_ROI_MAP,
167
168 /*!\brief Codec control function to pass an Active map to encoder.
169 *
170 * Supported in codecs: VP8, VP9
171 */
172 VP8E_SET_ACTIVEMAP,
173
174 /*!\brief Codec control function to set encoder scaling mode.
175 *
176 * Supported in codecs: VP8, VP9
177 */
178 VP8E_SET_SCALEMODE = 11,
179
180 /*!\brief Codec control function to set encoder internal speed settings.
John Koleszarc6b90392012-07-13 15:21:29 -0700181 *
182 * Changes in this value influences, among others, the encoder's selection
183 * of motion estimation methods. Values greater than 0 will increase encoder
184 * speed at the expense of quality.
John Koleszarc6b90392012-07-13 15:21:29 -0700185 *
Yaowu Xu268f1062015-03-13 09:42:57 -0700186 * \note Valid range for VP8: -16..16
187 * \note Valid range for VP9: -8..8
188 *
189 * Supported in codecs: VP8, VP9
John Koleszarc6b90392012-07-13 15:21:29 -0700190 */
191 VP8E_SET_CPUUSED = 13,
Yaowu Xu268f1062015-03-13 09:42:57 -0700192
193 /*!\brief Codec control function to enable automatic set and use alf frames.
194 *
195 * Supported in codecs: VP8, VP9
196 */
197 VP8E_SET_ENABLEAUTOALTREF,
198
JackyChenbb1a2362014-09-12 11:48:44 -0700199 /*!\brief control function to set noise sensitivity
200 *
201 * 0: off, 1: OnYOnly, 2: OnYUV,
202 * 3: OnYUVAggressive, 4: Adaptive
Yaowu Xu268f1062015-03-13 09:42:57 -0700203 *
204 * Supported in codecs: VP8
JackyChenbb1a2362014-09-12 11:48:44 -0700205 */
206 VP8E_SET_NOISE_SENSITIVITY,
Adrian Grangea7657052014-05-05 11:31:55 -0700207
Yaowu Xu268f1062015-03-13 09:42:57 -0700208 /*!\brief Codec control function to set sharpness.
209 *
210 * Supported in codecs: VP8, VP9
211 */
212 VP8E_SET_SHARPNESS,
213
214 /*!\brief Codec control function to set the threshold for MBs treated static.
215 *
216 * Supported in codecs: VP8, VP9
217 */
218 VP8E_SET_STATIC_THRESHOLD,
219
220 /*!\brief Codec control function to set the number of token partitions.
221 *
222 * Supported in codecs: VP8
223 */
224 VP8E_SET_TOKEN_PARTITIONS,
225
226 /*!\brief Codec control function to get last quantizer chosen by the encoder.
227 *
228 * Return value uses internal quantizer scale defined by the codec.
229 *
230 * Supported in codecs: VP8, VP9
231 */
232 VP8E_GET_LAST_QUANTIZER,
233
234 /*!\brief Codec control function to get last quantizer chosen by the encoder.
235 *
236 * Return value uses the 0..63 scale as used by the rc_*_quantizer config
237 * parameters.
238 *
239 * Supported in codecs: VP8, VP9
240 */
241 VP8E_GET_LAST_QUANTIZER_64,
242
243 /*!\brief Codec control function to set the max no of frames to create arf.
244 *
245 * Supported in codecs: VP8, VP9
246 */
247 VP8E_SET_ARNR_MAXFRAMES,
248
249 /*!\brief Codec control function to set the filter strength for the arf.
250 *
251 * Supported in codecs: VP8, VP9
252 */
253 VP8E_SET_ARNR_STRENGTH,
254
255 /*!\deprecated control function to set the filter type to use for the arf. */
Adrian Grangea7657052014-05-05 11:31:55 -0700256 VP8E_SET_ARNR_TYPE,
257
Yaowu Xu268f1062015-03-13 09:42:57 -0700258 /*!\brief Codec control function to set visual tuning.
259 *
260 * Supported in codecs: VP8, VP9
261 */
262 VP8E_SET_TUNING,
263
264 /*!\brief Codec control function to set constrained quality level.
John Koleszarc6b90392012-07-13 15:21:29 -0700265 *
266 * \attention For this value to be used vpx_codec_enc_cfg_t::g_usage must be
267 * set to #VPX_CQ.
268 * \note Valid range: 0..63
Yaowu Xu268f1062015-03-13 09:42:57 -0700269 *
270 * Supported in codecs: VP8, VP9
John Koleszarc6b90392012-07-13 15:21:29 -0700271 */
272 VP8E_SET_CQ_LEVEL,
John Koleszar1654ae92011-07-28 09:17:32 -0400273
Yaowu Xu268f1062015-03-13 09:42:57 -0700274 /*!\brief Codec control function to set Max data rate for Intra frames.
John Koleszarc6b90392012-07-13 15:21:29 -0700275 *
276 * This value controls additional clamping on the maximum size of a
277 * keyframe. It is expressed as a percentage of the average
278 * per-frame bitrate, with the special (and default) value 0 meaning
279 * unlimited, or no additional clamping beyond the codec's built-in
280 * algorithm.
281 *
282 * For example, to allocate no more than 4.5 frames worth of bitrate
283 * to a keyframe, set this to 450.
284 *
Yaowu Xu268f1062015-03-13 09:42:57 -0700285 * Supported in codecs: VP8, VP9
John Koleszarc6b90392012-07-13 15:21:29 -0700286 */
287 VP8E_SET_MAX_INTRA_BITRATE_PCT,
John Koleszar83b1d902012-11-05 12:37:14 -0800288
Yaowu Xu268f1062015-03-13 09:42:57 -0700289 /*!\brief Codec control function to set reference and update frame flags.
290 *
291 * Supported in codecs: VP8
292 */
293 VP8E_SET_FRAME_FLAGS,
294
295 /*!\brief Codec control function to set max data rate for Inter frames.
Yaowu Xu636099f2014-10-24 09:31:16 -0700296 *
297 * This value controls additional clamping on the maximum size of an
298 * inter frame. It is expressed as a percentage of the average
299 * per-frame bitrate, with the special (and default) value 0 meaning
300 * unlimited, or no additional clamping beyond the codec's built-in
301 * algorithm.
302 *
303 * For example, to allow no more than 4.5 frames worth of bitrate
304 * to an inter frame, set this to 450.
305 *
Yaowu Xu268f1062015-03-13 09:42:57 -0700306 * Supported in codecs: VP9
Yaowu Xu636099f2014-10-24 09:31:16 -0700307 */
Yaowu Xu268f1062015-03-13 09:42:57 -0700308 VP9E_SET_MAX_INTER_BITRATE_PCT,
Yaowu Xu636099f2014-10-24 09:31:16 -0700309
Yaowu Xu268f1062015-03-13 09:42:57 -0700310 /*!\brief Boost percentage for Golden Frame in CBR mode.
Yaowu Xu03a60b72014-10-27 13:13:14 -0700311 *
312 * This value controls the amount of boost given to Golden Frame in
313 * CBR mode. It is expressed as a percentage of the average
314 * per-frame bitrate, with the special (and default) value 0 meaning
315 * the feature is off, i.e., no golden frame boost in CBR mode and
316 * average bitrate target is used.
317 *
318 * For example, to allow 100% more bits, i.e, 2X, in a golden frame
319 * than average frame, set this to 100.
320 *
Yaowu Xu41652902015-03-12 17:59:18 -0700321 * Supported in codecs: VP9
Yaowu Xu03a60b72014-10-27 13:13:14 -0700322 */
Yaowu Xu41652902015-03-12 17:59:18 -0700323 VP9E_SET_GF_CBR_BOOST_PCT,
John Koleszar83b1d902012-11-05 12:37:14 -0800324
Yaowu Xu268f1062015-03-13 09:42:57 -0700325 /*!\brief Codec control function to set the temporal layer id.
Marcoaf898b52014-11-10 13:07:05 -0800326 *
327 * For temporal scalability: this control allows the application to set the
328 * layer id for each frame to be encoded. Note that this control must be set
329 * for every frame prior to encoding. The usage of this control function
330 * supersedes the internal temporal pattern counter, which is now deprecated.
Yaowu Xu268f1062015-03-13 09:42:57 -0700331 *
332 * Supported in codecs: VP8
Marcoaf898b52014-11-10 13:07:05 -0800333 */
334 VP8E_SET_TEMPORAL_LAYER_ID,
335
Yaowu Xu268f1062015-03-13 09:42:57 -0700336 /*!\brief Codec control function to set encoder screen content mode.
337 *
Marco976f7f42015-04-28 08:29:48 -0700338 * 0: off, 1: On, 2: On with more aggressive rate control.
339 *
Yaowu Xu268f1062015-03-13 09:42:57 -0700340 * Supported in codecs: VP8
341 */
342 VP8E_SET_SCREEN_CONTENT_MODE,
Marcoaf898b52014-11-10 13:07:05 -0800343
Yaowu Xu268f1062015-03-13 09:42:57 -0700344 /*!\brief Codec control function to set lossless encoding mode.
Yaowu Xu87c436f2015-01-13 12:39:42 -0800345 *
346 * VP9 can operate in lossless encoding mode, in which the bitstream
347 * produced will be able to decode and reconstruct a perfect copy of
348 * input source. This control function provides a mean to switch encoder
349 * into lossless coding mode(1) or normal coding mode(0) that may be lossy.
350 * 0 = lossy coding mode
351 * 1 = lossless coding mode
352 *
353 * By default, encoder operates in normal coding mode (maybe lossy).
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700354 *
355 * Supported in codecs: VP9
Yaowu Xu87c436f2015-01-13 12:39:42 -0800356 */
Ronald S. Bultje1407bdc2013-02-01 09:35:28 -0800357 VP9E_SET_LOSSLESS,
Yaowu Xu87c436f2015-01-13 12:39:42 -0800358
Yaowu Xu268f1062015-03-13 09:42:57 -0700359 /*!\brief Codec control function to set number of tile columns.
Yaowu Xu87c436f2015-01-13 12:39:42 -0800360 *
361 * In encoding and decoding, VP9 allows an input image frame be partitioned
362 * into separated vertical tile columns, which can be encoded or decoded
363 * independently. This enables easy implementation of parallel encoding and
364 * decoding. This control requests the encoder to use column tiles in
365 * encoding an input frame, with number of tile columns (in Log2 unit) as
366 * the parameter:
367 * 0 = 1 tile column
368 * 1 = 2 tile columns
369 * 2 = 4 tile columns
370 * .....
371 * n = 2**n tile columns
372 * The requested tile columns will be capped by encoder based on image size
373 * limitation (The minimum width of a tile column is 256 pixel, the maximum
374 * is 4096).
375 *
376 * By default, the value is 0, i.e. one single column tile for entire image.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700377 *
378 * Supported in codecs: VP9
Yaowu Xu87c436f2015-01-13 12:39:42 -0800379 */
Ronald S. Bultje89a206e2013-02-08 11:33:11 -0800380 VP9E_SET_TILE_COLUMNS,
Yaowu Xu87c436f2015-01-13 12:39:42 -0800381
Yaowu Xu268f1062015-03-13 09:42:57 -0700382 /*!\brief Codec control function to set number of tile rows.
Yaowu Xu87c436f2015-01-13 12:39:42 -0800383 *
384 * In encoding and decoding, VP9 allows an input image frame be partitioned
385 * into separated horizontal tile rows. Tile rows are encoded or decoded
386 * sequentially. Even though encoding/decoding of later tile rows depends on
387 * earlier ones, this allows the encoder to output data packets for tile rows
388 * prior to completely processing all tile rows in a frame, thereby reducing
389 * the latency in processing between input and output. The parameter
390 * for this control describes the number of tile rows, which has a valid
391 * range [0, 2]:
392 * 0 = 1 tile row
393 * 1 = 2 tile rows
394 * 2 = 4 tile rows
395 *
396 * By default, the value is 0, i.e. one single row tile for entire image.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700397 *
398 * Supported in codecs: VP9
Yaowu Xu87c436f2015-01-13 12:39:42 -0800399 */
Ronald S. Bultje89a206e2013-02-08 11:33:11 -0800400 VP9E_SET_TILE_ROWS,
Yaowu Xu87c436f2015-01-13 12:39:42 -0800401
Yaowu Xu268f1062015-03-13 09:42:57 -0700402 /*!\brief Codec control function to enable frame parallel decoding feature.
Yaowu Xu87c436f2015-01-13 12:39:42 -0800403 *
404 * VP9 has a bitstream feature to reduce decoding dependency between frames
405 * by turning off backward update of probability context used in encoding
406 * and decoding. This allows staged parallel processing of more than one
407 * video frames in the decoder. This control function provides a mean to
408 * turn this feature on or off for bitstreams produced by encoder.
409 *
410 * By default, this feature is off.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700411 *
412 * Supported in codecs: VP9
Yaowu Xu87c436f2015-01-13 12:39:42 -0800413 */
Ivan Maltz01b35c32013-09-05 08:55:47 -0700414 VP9E_SET_FRAME_PARALLEL_DECODING,
Yaowu Xu87c436f2015-01-13 12:39:42 -0800415
Yaowu Xu268f1062015-03-13 09:42:57 -0700416 /*!\brief Codec control function to set adaptive quantization mode.
Yaowu Xu87c436f2015-01-13 12:39:42 -0800417 *
418 * VP9 has a segment based feature that allows encoder to adaptively change
419 * quantization parameter for each segment within a frame to improve the
420 * subjective quality. This control makes encoder operate in one of the
421 * several AQ_modes supported.
422 *
423 * By default, encoder operates with AQ_Mode 0(adaptive quantization off).
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700424 *
425 * Supported in codecs: VP9
Yaowu Xu87c436f2015-01-13 12:39:42 -0800426 */
Guillaume Martres17084652013-11-14 19:23:57 +0100427 VP9E_SET_AQ_MODE,
Yaowu Xu4ab39e12015-01-14 09:07:02 -0800428
Yaowu Xu268f1062015-03-13 09:42:57 -0700429 /*!\brief Codec control function to enable/disable periodic Q boost.
Yaowu Xu4ab39e12015-01-14 09:07:02 -0800430 *
431 * One VP9 encoder speed feature is to enable quality boost by lowering
432 * frame level Q periodically. This control function provides a mean to
433 * turn on/off this feature.
434 * 0 = off
435 * 1 = on
436 *
437 * By default, the encoder is allowed to use this feature for appropriate
438 * encoding modes.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700439 *
440 * Supported in codecs: VP9
Yaowu Xu4ab39e12015-01-14 09:07:02 -0800441 */
Marco Paniconi0eb88c92014-04-03 15:49:03 -0700442 VP9E_SET_FRAME_PERIODIC_BOOST,
Yaowu Xu4ab39e12015-01-14 09:07:02 -0800443
Yaowu Xu268f1062015-03-13 09:42:57 -0700444 /*!\brief Codec control function to set noise sensitivity.
JackyChenbb1a2362014-09-12 11:48:44 -0700445 *
Yaowu Xu268f1062015-03-13 09:42:57 -0700446 * 0: off, 1: On(YOnly)
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700447 *
448 * Supported in codecs: VP9
JackyChenbb1a2362014-09-12 11:48:44 -0700449 */
450 VP9E_SET_NOISE_SENSITIVITY,
Ivan Maltz01b35c32013-09-05 08:55:47 -0700451
Yaowu Xu268f1062015-03-13 09:42:57 -0700452 /*!\brief Codec control function to turn on/off SVC in encoder.
Yaowu Xu3ca15a82015-01-14 12:02:46 -0800453 * \note Return value is VPX_CODEC_INVALID_PARAM if the encoder does not
454 * support SVC in its current encoding mode
455 * 0: off, 1: on
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700456 *
457 * Supported in codecs: VP9
Yaowu Xu3ca15a82015-01-14 12:02:46 -0800458 */
Ivan Maltz01b35c32013-09-05 08:55:47 -0700459 VP9E_SET_SVC,
Yaowu Xu3ca15a82015-01-14 12:02:46 -0800460
Yaowu Xu268f1062015-03-13 09:42:57 -0700461 /*!\brief Codec control function to set parameters for SVC.
Yaowu Xu3ca15a82015-01-14 12:02:46 -0800462 * \note Parameters contain min_q, max_q, scaling factor for each of the
463 * SVC layers.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700464 *
465 * Supported in codecs: VP9
Yaowu Xu3ca15a82015-01-14 12:02:46 -0800466 */
Marco Paniconi4864ab22014-02-06 09:23:17 -0800467 VP9E_SET_SVC_PARAMETERS,
Deb Mukherjee0ba15422014-11-07 11:01:53 -0800468
Yaowu Xu268f1062015-03-13 09:42:57 -0700469 /*!\brief Codec control function to set svc layer for spatial and temporal.
James Zern53a11c92014-02-20 20:36:28 -0800470 * \note Valid ranges: 0..#vpx_codec_enc_cfg::ss_number_layers for spatial
471 * layer and 0..#vpx_codec_enc_cfg::ts_number_layers for
472 * temporal layer.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700473 *
474 * Supported in codecs: VP9
James Zern53a11c92014-02-20 20:36:28 -0800475 */
Alex Converse572de922014-07-31 08:27:32 -0700476 VP9E_SET_SVC_LAYER_ID,
Yaowu Xudc08b202015-01-14 11:17:09 -0800477
Yaowu Xu268f1062015-03-13 09:42:57 -0700478 /*!\brief Codec control function to set content type.
Yaowu Xudc08b202015-01-14 11:17:09 -0800479 * \note Valid parameter range:
480 * VP9E_CONTENT_DEFAULT = Regular video content (Default)
481 * VP9E_CONTENT_SCREEN = Screen capture content
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700482 *
483 * Supported in codecs: VP9
Yaowu Xudc08b202015-01-14 11:17:09 -0800484 */
Deb Mukherjee0ba15422014-11-07 11:01:53 -0800485 VP9E_SET_TUNE_CONTENT,
Yaowu Xu193ca4b2015-01-14 11:48:29 -0800486
Yaowu Xu268f1062015-03-13 09:42:57 -0700487 /*!\brief Codec control function to get svc layer ID.
Yaowu Xu193ca4b2015-01-14 11:48:29 -0800488 * \note The layer ID returned is for the data packet from the registered
489 * callback function.
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700490 *
491 * Supported in codecs: VP9
Yaowu Xu193ca4b2015-01-14 11:48:29 -0800492 */
Deb Mukherjee0ba15422014-11-07 11:01:53 -0800493 VP9E_GET_SVC_LAYER_ID,
Yaowu Xu193ca4b2015-01-14 11:48:29 -0800494
Yaowu Xu268f1062015-03-13 09:42:57 -0700495 /*!\brief Codec control function to register callback to get per layer packet.
Yaowu Xu193ca4b2015-01-14 11:48:29 -0800496 * \note Parameter for this control function is a structure with a callback
497 * function and a pointer to private data used by the callback.
Yaowu Xu268f1062015-03-13 09:42:57 -0700498 *
499 * Supported in codecs: VP9
Yaowu Xu193ca4b2015-01-14 11:48:29 -0800500 */
Deb Mukherjee0ba15422014-11-07 11:01:53 -0800501 VP9E_REGISTER_CX_CALLBACK,
Yaowu Xue94b4152015-01-13 10:07:20 -0800502
Yaowu Xu268f1062015-03-13 09:42:57 -0700503 /*!\brief Codec control function to set color space info.
Yaowu Xue94b4152015-01-13 10:07:20 -0800504 * \note Valid ranges: 0..7, default is "UNKNOWN".
505 * 0 = UNKNOWN,
506 * 1 = BT_601
507 * 2 = BT_709
508 * 3 = SMPTE_170
509 * 4 = SMPTE_240
510 * 5 = BT_2020
511 * 6 = RESERVED
512 * 7 = SRGB
Yaowu Xu5dd146c2015-03-12 18:14:43 -0700513 *
514 * Supported in codecs: VP9
Yaowu Xue94b4152015-01-13 10:07:20 -0800515 */
516 VP9E_SET_COLOR_SPACE,
Alex Converse4dcb8392015-03-20 14:55:43 -0700517
Marcoc139b812015-05-21 16:15:37 -0700518 /*!\brief Codec control function to set temporal layering mode.
519 * \note Valid ranges: 0..3, default is "0" (VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING).
520 * 0 = VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING
521 * 1 = VP9E_TEMPORAL_LAYERING_MODE_BYPASS
522 * 2 = VP9E_TEMPORAL_LAYERING_MODE_0101
523 * 3 = VP9E_TEMPORAL_LAYERING_MODE_0212
524 *
525 * Supported in codecs: VP9
526 */
527 VP9E_SET_TEMPORAL_LAYERING_MODE,
528
Debargha Mukherjee98526432015-04-01 16:39:06 -0700529 /*!\brief Codec control function to set minimum interval between GF/ARF frames
530 *
531 * By default the value is set as 4.
532 *
533 * Supported in codecs: VP9
534 */
535 VP9E_SET_MIN_GF_INTERVAL,
536
537 /*!\brief Codec control function to set minimum interval between GF/ARF frames
538 *
539 * By default the value is set as 16.
540 *
541 * Supported in codecs: VP9
542 */
543 VP9E_SET_MAX_GF_INTERVAL,
544
Alex Converse4dcb8392015-03-20 14:55:43 -0700545 /*!\brief Codec control function to get an Active map back from the encoder.
546 *
547 * Supported in codecs: VP9
548 */
549 VP9E_GET_ACTIVEMAP,
Ronald S. Bultjeeeb5ef02015-09-15 21:56:51 -0400550
551 /*!\brief Codec control function to set color range bit.
552 * \note Valid ranges: 0..1, default is 0
553 * 0 = Limited range (16..235 or HBD equivalent)
554 * 1 = Full range (0..255 or HBD equivalent)
555 *
556 * Supported in codecs: VP9
557 */
558 VP9E_SET_COLOR_RANGE,
Yaowu Xu7c514e22015-09-28 15:55:46 -0700559
560 /*!\brief Codec control function to set the frame flags and buffer indices
561 * for spatial layers. The frame flags and buffer indices are set using the
562 * struct #vpx_svc_ref_frame_config defined below.
563 *
564 * Supported in codecs: VP9
565 */
566 VP9E_SET_SVC_REF_FRAME_CONFIG,
567
568 /*!\brief Codec control function to set intended rendering image size.
569 *
570 * By default, this is identical to the image size in pixels.
571 *
572 * Supported in codecs: VP9
573 */
574 VP9E_SET_RENDER_SIZE,
John Koleszarb0da9b32010-12-17 09:43:39 -0500575};
John Koleszar0ea50ce2010-05-18 11:58:33 -0400576
577/*!\brief vpx 1-D scaling mode
578 *
579 * This set of constants define 1-D vpx scaling modes
580 */
John Koleszarc6b90392012-07-13 15:21:29 -0700581typedef enum vpx_scaling_mode_1d {
582 VP8E_NORMAL = 0,
583 VP8E_FOURFIVE = 1,
584 VP8E_THREEFIVE = 2,
585 VP8E_ONETWO = 3
John Koleszar0ea50ce2010-05-18 11:58:33 -0400586} VPX_SCALING_MODE;
587
Marcoc139b812015-05-21 16:15:37 -0700588/*!\brief Temporal layering mode enum for VP9 SVC.
589 *
590 * This set of macros define the different temporal layering modes.
591 * Supported codecs: VP9 (in SVC mode)
592 *
593 */
594typedef enum vp9e_temporal_layering_mode {
595 /*!\brief No temporal layering.
596 * Used when only spatial layering is used.
597 */
598 VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING = 0,
599
600 /*!\brief Bypass mode.
601 * Used when application needs to control temporal layering.
602 * This will only work when the number of spatial layers equals 1.
603 */
604 VP9E_TEMPORAL_LAYERING_MODE_BYPASS = 1,
605
606 /*!\brief 0-1-0-1... temporal layering scheme with two temporal layers.
607 */
608 VP9E_TEMPORAL_LAYERING_MODE_0101 = 2,
609
610 /*!\brief 0-2-1-2... temporal layering scheme with three temporal layers.
611 */
612 VP9E_TEMPORAL_LAYERING_MODE_0212 = 3
613} VP9E_TEMPORAL_LAYERING_MODE;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400614
615/*!\brief vpx region of interest map
616 *
617 * These defines the data structures for the region of interest map
618 *
619 */
620
John Koleszarc6b90392012-07-13 15:21:29 -0700621typedef struct vpx_roi_map {
Adrian Grangef58eca92013-10-24 15:11:36 -0700622 /*! An id between 0 and 3 for each 16x16 region within a frame. */
623 unsigned char *roi_map;
624 unsigned int rows; /**< Number of rows. */
625 unsigned int cols; /**< Number of columns. */
Paul Wilkins31ee1932013-04-24 13:04:45 +0100626 // TODO(paulwilkins): broken for VP9 which has 8 segments
627 // q and loop filter deltas for each segment
628 // (see MAX_MB_SEGMENTS)
Adrian Grangef58eca92013-10-24 15:11:36 -0700629 int delta_q[4]; /**< Quantizer deltas. */
630 int delta_lf[4]; /**< Loop filter deltas. */
631 /*! Static breakout threshold for each segment. */
632 unsigned int static_threshold[4];
John Koleszar0ea50ce2010-05-18 11:58:33 -0400633} vpx_roi_map_t;
634
635/*!\brief vpx active region map
636 *
637 * These defines the data structures for active region map
638 *
639 */
640
641
John Koleszarc6b90392012-07-13 15:21:29 -0700642typedef struct vpx_active_map {
643 unsigned char *active_map; /**< specify an on (1) or off (0) each 16x16 region within a frame */
644 unsigned int rows; /**< number of rows */
645 unsigned int cols; /**< number of cols */
John Koleszar0ea50ce2010-05-18 11:58:33 -0400646} vpx_active_map_t;
647
648/*!\brief vpx image scaling mode
649 *
650 * This defines the data structure for image scaling mode
651 *
652 */
John Koleszarc6b90392012-07-13 15:21:29 -0700653typedef struct vpx_scaling_mode {
654 VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
655 VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
John Koleszar0ea50ce2010-05-18 11:58:33 -0400656} vpx_scaling_mode_t;
657
John Koleszar0ea50ce2010-05-18 11:58:33 -0400658/*!\brief VP8 token partition mode
659 *
660 * This defines VP8 partitioning mode for compressed data, i.e., the number of
Dmitry Kovalev116e0a12013-12-27 14:01:12 -0800661 * sub-streams in the bitstream. Used for parallelized decoding.
John Koleszar0ea50ce2010-05-18 11:58:33 -0400662 *
663 */
664
John Koleszarc6b90392012-07-13 15:21:29 -0700665typedef enum {
666 VP8_ONE_TOKENPARTITION = 0,
667 VP8_TWO_TOKENPARTITION = 1,
668 VP8_FOUR_TOKENPARTITION = 2,
John Koleszar83b1d902012-11-05 12:37:14 -0800669 VP8_EIGHT_TOKENPARTITION = 3
John Koleszar0ea50ce2010-05-18 11:58:33 -0400670} vp8e_token_partitions;
671
Alex Converse572de922014-07-31 08:27:32 -0700672/*!brief VP9 encoder content type */
673typedef enum {
674 VP9E_CONTENT_DEFAULT,
675 VP9E_CONTENT_SCREEN,
676 VP9E_CONTENT_INVALID
677} vp9e_tune_content;
John Koleszar0ea50ce2010-05-18 11:58:33 -0400678
John Koleszarb0da9b32010-12-17 09:43:39 -0500679/*!\brief VP8 model tuning parameters
680 *
681 * Changes the encoder to tune for certain types of input material.
682 *
683 */
John Koleszarc6b90392012-07-13 15:21:29 -0700684typedef enum {
685 VP8_TUNE_PSNR,
686 VP8_TUNE_SSIM
John Koleszarb0da9b32010-12-17 09:43:39 -0500687} vp8e_tuning;
688
Marco Paniconi89ec9902014-02-18 17:31:57 -0800689/*!\brief vp9 svc layer parameters
690 *
691 * This defines the spatial and temporal layer id numbers for svc encoding.
692 * This is used with the #VP9E_SET_SVC_LAYER_ID control to set the spatial and
693 * temporal layer id for the current frame.
694 *
695 */
Marco Paniconi4864ab22014-02-06 09:23:17 -0800696typedef struct vpx_svc_layer_id {
Marco Paniconi89ec9902014-02-18 17:31:57 -0800697 int spatial_layer_id; /**< Spatial layer id number. */
698 int temporal_layer_id; /**< Temporal layer id number. */
Marco Paniconi4864ab22014-02-06 09:23:17 -0800699} vpx_svc_layer_id_t;
700
Yaowu Xu7c514e22015-09-28 15:55:46 -0700701/*!\brief vp9 svc frame flag parameters.
702 *
703 * This defines the frame flags and buffer indices for each spatial layer for
704 * svc encoding.
705 * This is used with the #VP9E_SET_SVC_REF_FRAME_CONFIG control to set frame
706 * flags and buffer indices for each spatial layer for the current (super)frame.
707 *
708 */
709typedef struct vpx_svc_ref_frame_config {
710 int frame_flags[VPX_TS_MAX_LAYERS]; /**< Frame flags. */
711 int lst_fb_idx[VPX_TS_MAX_LAYERS]; /**< Last buffer index. */
712 int gld_fb_idx[VPX_TS_MAX_LAYERS]; /**< Golden buffer index. */
713 int alt_fb_idx[VPX_TS_MAX_LAYERS]; /**< Altref buffer index. */
714} vpx_svc_ref_frame_config_t;
715
John Koleszar0ea50ce2010-05-18 11:58:33 -0400716/*!\brief VP8 encoder control function parameter type
717 *
718 * Defines the data types that VP8E control functions take. Note that
719 * additional common controls are defined in vp8.h
720 *
721 */
722
723
724/* These controls have been deprecated in favor of the flags parameter to
725 * vpx_codec_encode(). See the definition of VP8_EFLAG_* above.
726 */
727VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
728VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
729VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
730
Marcoaf898b52014-11-10 13:07:05 -0800731VPX_CTRL_USE_TYPE(VP8E_SET_FRAME_FLAGS, int)
732VPX_CTRL_USE_TYPE(VP8E_SET_TEMPORAL_LAYER_ID, int)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400733VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
734VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
735VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
736
Ivan Maltz01b35c32013-09-05 08:55:47 -0700737VPX_CTRL_USE_TYPE(VP9E_SET_SVC, int)
Minghai Shang209ee122014-09-18 18:05:07 -0700738VPX_CTRL_USE_TYPE(VP9E_SET_SVC_PARAMETERS, void *)
Deb Mukherjee0ba15422014-11-07 11:01:53 -0800739VPX_CTRL_USE_TYPE(VP9E_REGISTER_CX_CALLBACK, void *)
Marco Paniconi4864ab22014-02-06 09:23:17 -0800740VPX_CTRL_USE_TYPE(VP9E_SET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
Ivan Maltz01b35c32013-09-05 08:55:47 -0700741
John Koleszar0ea50ce2010-05-18 11:58:33 -0400742VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
743VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
744VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
745VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
746VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
John Koleszar83b1d902012-11-05 12:37:14 -0800747VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, int) /* vp8e_token_partitions */
John Koleszar0ea50ce2010-05-18 11:58:33 -0400748
749VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
John Koleszarc6b90392012-07-13 15:21:29 -0700750VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH, unsigned int)
Adrian Grangea7657052014-05-05 11:31:55 -0700751VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ARNR_TYPE, unsigned int)
John Koleszar83b1d902012-11-05 12:37:14 -0800752VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vp8e_tuning */
John Koleszarc6b90392012-07-13 15:21:29 -0700753VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL, unsigned int)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400754
Ronald S. Bultje1407bdc2013-02-01 09:35:28 -0800755VPX_CTRL_USE_TYPE(VP9E_SET_TILE_COLUMNS, int)
Ronald S. Bultje89a206e2013-02-08 11:33:11 -0800756VPX_CTRL_USE_TYPE(VP9E_SET_TILE_ROWS, int)
Ronald S. Bultje1407bdc2013-02-01 09:35:28 -0800757
John Koleszar0ea50ce2010-05-18 11:58:33 -0400758VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
759VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
Deb Mukherjee0ba15422014-11-07 11:01:53 -0800760VPX_CTRL_USE_TYPE(VP9E_GET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400761
John Koleszar1654ae92011-07-28 09:17:32 -0400762VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
Yaowu Xu636099f2014-10-24 09:31:16 -0700763VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTER_BITRATE_PCT, unsigned int)
John Koleszar1654ae92011-07-28 09:17:32 -0400764
Marcoaf898b52014-11-10 13:07:05 -0800765VPX_CTRL_USE_TYPE(VP8E_SET_SCREEN_CONTENT_MODE, unsigned int)
766
Yaowu Xu41652902015-03-12 17:59:18 -0700767VPX_CTRL_USE_TYPE(VP9E_SET_GF_CBR_BOOST_PCT, unsigned int)
768
John Koleszar83b1d902012-11-05 12:37:14 -0800769VPX_CTRL_USE_TYPE(VP9E_SET_LOSSLESS, unsigned int)
John Koleszar1654ae92011-07-28 09:17:32 -0400770
John Koleszar81708cc2013-03-27 11:07:26 -0700771VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PARALLEL_DECODING, unsigned int)
Ivan Maltz01b35c32013-09-05 08:55:47 -0700772
Guillaume Martres17084652013-11-14 19:23:57 +0100773VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
774
Marco Paniconi0eb88c92014-04-03 15:49:03 -0700775VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
776
JackyChenbb1a2362014-09-12 11:48:44 -0700777VPX_CTRL_USE_TYPE(VP9E_SET_NOISE_SENSITIVITY, unsigned int)
778
Alex Converse572de922014-07-31 08:27:32 -0700779VPX_CTRL_USE_TYPE(VP9E_SET_TUNE_CONTENT, int) /* vp9e_tune_content */
Yaowu Xue94b4152015-01-13 10:07:20 -0800780
781VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_SPACE, int)
Alex Converse4dcb8392015-03-20 14:55:43 -0700782
Debargha Mukherjee98526432015-04-01 16:39:06 -0700783VPX_CTRL_USE_TYPE(VP9E_SET_MIN_GF_INTERVAL, unsigned int)
Yaowu Xu130c0ec2015-07-20 10:33:48 -0700784
785/*!\brief
786 *
787 * TODO(debargha) : add support of the control in ffmpeg
788 */
Debargha Mukherjeee8a3abe2015-07-06 16:07:53 -0700789#define VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
Debargha Mukherjee98526432015-04-01 16:39:06 -0700790
Yaowu Xu130c0ec2015-07-20 10:33:48 -0700791
Debargha Mukherjee98526432015-04-01 16:39:06 -0700792VPX_CTRL_USE_TYPE(VP9E_SET_MAX_GF_INTERVAL, unsigned int)
Yaowu Xu130c0ec2015-07-20 10:33:48 -0700793/*!\brief
794 *
795 * TODO(debargha) : add support of the control in ffmpeg
796 */
Debargha Mukherjeee8a3abe2015-07-06 16:07:53 -0700797#define VPX_CTRL_VP9E_SET_MAX_GF_INTERVAL
Debargha Mukherjee98526432015-04-01 16:39:06 -0700798
Alex Converse4dcb8392015-03-20 14:55:43 -0700799VPX_CTRL_USE_TYPE(VP9E_GET_ACTIVEMAP, vpx_active_map_t *)
Ronald S. Bultjeeeb5ef02015-09-15 21:56:51 -0400800
801/*!\brief
802 *
803 * TODO(rbultje) : add support of the control in ffmpeg
804 */
805#define VPX_CTRL_VP9E_SET_COLOR_RANGE
806VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_RANGE, int)
Yaowu Xu7c514e22015-09-28 15:55:46 -0700807
808VPX_CTRL_USE_TYPE(VP9E_SET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
809
810/*!\brief
811 *
812 * TODO(rbultje) : add support of the control in ffmpeg
813 */
814#define VPX_CTRL_VP9E_SET_RENDER_SIZE
815VPX_CTRL_USE_TYPE(VP9E_SET_RENDER_SIZE, int *)
John Koleszar0ea50ce2010-05-18 11:58:33 -0400816/*! @} - end defgroup vp8_encoder */
Dmitry Kovaleve288c602013-09-29 18:00:15 -0700817#ifdef __cplusplus
818} // extern "C"
819#endif
820
James Zern7386bde2013-12-15 18:26:15 -0800821#endif // VPX_VP8CX_H_