2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * 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
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
10 #ifndef VPX_VPX_VP8CX_H_
11 #define VPX_VPX_VP8CX_H_
13 /*!\defgroup vp8_encoder WebM VP8/VP9 Encoder
19 #include "./vpx_encoder.h"
22 * \brief Provides definitions for using VP8 or VP9 encoder algorithm within the
23 * vpx Codec Interface.
30 /*!\name Algorithm interface for VP8
32 * This interface provides the capability to encode raw VP8 streams.
35 extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
36 extern vpx_codec_iface_t *vpx_codec_vp8_cx(void);
37 /*!@} - end algorithm interface member group*/
39 /*!\name Algorithm interface for VP9
41 * This interface provides the capability to encode raw VP9 streams.
44 extern vpx_codec_iface_t vpx_codec_vp9_cx_algo;
45 extern vpx_codec_iface_t *vpx_codec_vp9_cx(void);
46 /*!@} - end algorithm interface member group*/
52 /*!\brief Don't reference the last frame
54 * When this flag is set, the encoder will not use the last frame as a
55 * predictor. When not set, the encoder will choose whether to use the
56 * last frame or not automatically.
58 #define VP8_EFLAG_NO_REF_LAST (1 << 16)
60 /*!\brief Don't reference the golden frame
62 * When this flag is set, the encoder will not use the golden frame as a
63 * predictor. When not set, the encoder will choose whether to use the
64 * golden frame or not automatically.
66 #define VP8_EFLAG_NO_REF_GF (1 << 17)
68 /*!\brief Don't reference the alternate reference frame
70 * When this flag is set, the encoder will not use the alt ref frame as a
71 * predictor. When not set, the encoder will choose whether to use the
72 * alt ref frame or not automatically.
74 #define VP8_EFLAG_NO_REF_ARF (1 << 21)
76 /*!\brief Don't update the last frame
78 * When this flag is set, the encoder will not update the last frame with
79 * the contents of the current frame.
81 #define VP8_EFLAG_NO_UPD_LAST (1 << 18)
83 /*!\brief Don't update the golden frame
85 * When this flag is set, the encoder will not update the golden frame with
86 * the contents of the current frame.
88 #define VP8_EFLAG_NO_UPD_GF (1 << 22)
90 /*!\brief Don't update the alternate reference frame
92 * When this flag is set, the encoder will not update the alt ref frame with
93 * the contents of the current frame.
95 #define VP8_EFLAG_NO_UPD_ARF (1 << 23)
97 /*!\brief Force golden frame update
99 * When this flag is set, the encoder copy the contents of the current frame
100 * to the golden frame buffer.
102 #define VP8_EFLAG_FORCE_GF (1 << 19)
104 /*!\brief Force alternate reference frame update
106 * When this flag is set, the encoder copy the contents of the current frame
107 * to the alternate reference frame buffer.
109 #define VP8_EFLAG_FORCE_ARF (1 << 24)
111 /*!\brief Disable entropy update
113 * When this flag is set, the encoder will not update its internal entropy
114 * model based on the entropy of this frame.
116 #define VP8_EFLAG_NO_UPD_ENTROPY (1 << 20)
118 /*!\brief VPx encoder control functions
120 * This set of macros define the control functions available for VPx
123 * \sa #vpx_codec_control
125 enum vp8e_enc_control_id {
126 /*!\brief Codec control function to pass an ROI map to encoder.
128 * Supported in codecs: VP8
130 VP8E_SET_ROI_MAP = 8,
132 /*!\brief Codec control function to pass an Active map to encoder.
134 * Supported in codecs: VP8, VP9
138 /*!\brief Codec control function to set encoder scaling mode.
140 * Supported in codecs: VP8, VP9
142 VP8E_SET_SCALEMODE = 11,
144 /*!\brief Codec control function to set encoder internal speed settings.
146 * Changes in this value influences, among others, the encoder's selection
147 * of motion estimation methods. Values greater than 0 will increase encoder
148 * speed at the expense of quality.
150 * \note Valid range for VP8: -16..16
151 * \note Valid range for VP9: -9..9
153 * Supported in codecs: VP8, VP9
155 VP8E_SET_CPUUSED = 13,
157 /*!\brief Codec control function to enable automatic use of arf frames.
159 * \note Valid range for VP8: 0..1
160 * \note Valid range for VP9: 0..6
162 * Supported in codecs: VP8, VP9
164 VP8E_SET_ENABLEAUTOALTREF,
166 /*!\brief control function to set noise sensitivity
168 * 0: off, 1: OnYOnly, 2: OnYUV,
169 * 3: OnYUVAggressive, 4: Adaptive
171 * Supported in codecs: VP8
173 VP8E_SET_NOISE_SENSITIVITY,
175 /*!\brief Codec control function to set higher sharpness at the expense
178 * \note Valid range: 0..7
180 * Supported in codecs: VP8, VP9
184 /*!\brief Codec control function to set the threshold for MBs treated static.
186 * Supported in codecs: VP8, VP9
188 VP8E_SET_STATIC_THRESHOLD,
190 /*!\brief Codec control function to set the number of token partitions.
192 * Supported in codecs: VP8
194 VP8E_SET_TOKEN_PARTITIONS,
196 /*!\brief Codec control function to get last quantizer chosen by the encoder.
198 * Return value uses internal quantizer scale defined by the codec.
200 * Supported in codecs: VP8, VP9
202 VP8E_GET_LAST_QUANTIZER,
204 /*!\brief Codec control function to get last quantizer chosen by the encoder.
206 * Return value uses the 0..63 scale as used by the rc_*_quantizer config
209 * Supported in codecs: VP8, VP9
211 VP8E_GET_LAST_QUANTIZER_64,
213 /*!\brief Codec control function to set the max no of frames to create arf.
215 * Supported in codecs: VP8, VP9
217 VP8E_SET_ARNR_MAXFRAMES,
219 /*!\brief Codec control function to set the filter strength for the arf.
221 * Supported in codecs: VP8, VP9
223 VP8E_SET_ARNR_STRENGTH,
225 /*!\deprecated control function to set the filter type to use for the arf. */
228 /*!\brief Codec control function to set visual tuning.
230 * Supported in codecs: VP8, VP9
234 /*!\brief Codec control function to set constrained / constant quality level.
236 * \attention For this value to be used vpx_codec_enc_cfg_t::rc_end_usage must
237 * be set to #VPX_CQ or #VPX_Q
238 * \note Valid range: 0..63
240 * Supported in codecs: VP8, VP9
244 /*!\brief Codec control function to set Max data rate for Intra frames.
246 * This value controls additional clamping on the maximum size of a
247 * keyframe. It is expressed as a percentage of the average
248 * per-frame bitrate, with the special (and default) value 0 meaning
249 * unlimited, or no additional clamping beyond the codec's built-in
252 * For example, to allocate no more than 4.5 frames worth of bitrate
253 * to a keyframe, set this to 450.
255 * Supported in codecs: VP8, VP9
257 VP8E_SET_MAX_INTRA_BITRATE_PCT,
259 /*!\brief Codec control function to set reference and update frame flags.
261 * Supported in codecs: VP8
263 VP8E_SET_FRAME_FLAGS,
265 /*!\brief Codec control function to set max data rate for Inter frames.
267 * This value controls additional clamping on the maximum size of an
268 * inter frame. It is expressed as a percentage of the average
269 * per-frame bitrate, with the special (and default) value 0 meaning
270 * unlimited, or no additional clamping beyond the codec's built-in
273 * For example, to allow no more than 4.5 frames worth of bitrate
274 * to an inter frame, set this to 450.
276 * Supported in codecs: VP9
278 VP9E_SET_MAX_INTER_BITRATE_PCT,
280 /*!\brief Boost percentage for Golden Frame in CBR mode.
282 * This value controls the amount of boost given to Golden Frame in
283 * CBR mode. It is expressed as a percentage of the average
284 * per-frame bitrate, with the special (and default) value 0 meaning
285 * the feature is off, i.e., no golden frame boost in CBR mode and
286 * average bitrate target is used.
288 * For example, to allow 100% more bits, i.e, 2X, in a golden frame
289 * than average frame, set this to 100.
291 * Supported in codecs: VP9
293 VP9E_SET_GF_CBR_BOOST_PCT,
295 /*!\brief Codec control function to set the temporal layer id.
297 * For temporal scalability: this control allows the application to set the
298 * layer id for each frame to be encoded. Note that this control must be set
299 * for every frame prior to encoding. The usage of this control function
300 * supersedes the internal temporal pattern counter, which is now deprecated.
302 * Supported in codecs: VP8
304 VP8E_SET_TEMPORAL_LAYER_ID,
306 /*!\brief Codec control function to set encoder screen content mode.
308 * 0: off, 1: On, 2: On with more aggressive rate control.
310 * Supported in codecs: VP8
312 VP8E_SET_SCREEN_CONTENT_MODE,
314 /*!\brief Codec control function to set lossless encoding mode.
316 * VP9 can operate in lossless encoding mode, in which the bitstream
317 * produced will be able to decode and reconstruct a perfect copy of
318 * input source. This control function provides a mean to switch encoder
319 * into lossless coding mode(1) or normal coding mode(0) that may be lossy.
320 * 0 = lossy coding mode
321 * 1 = lossless coding mode
323 * By default, encoder operates in normal coding mode (maybe lossy).
325 * Supported in codecs: VP9
329 /*!\brief Codec control function to set number of tile columns.
331 * In encoding and decoding, VP9 allows an input image frame be partitioned
332 * into separated vertical tile columns, which can be encoded or decoded
333 * independently. This enables easy implementation of parallel encoding and
334 * decoding. This control requests the encoder to use column tiles in
335 * encoding an input frame, with number of tile columns (in Log2 unit) as
341 * n = 2**n tile columns
342 * The requested tile columns will be capped by the encoder based on image
343 * size limitations (The minimum width of a tile column is 256 pixels, the
346 * By default, the value is 6, i.e., the maximum number of tiles supported by
349 * Supported in codecs: VP9
351 VP9E_SET_TILE_COLUMNS,
353 /*!\brief Codec control function to set number of tile rows.
355 * In encoding and decoding, VP9 allows an input image frame be partitioned
356 * into separated horizontal tile rows. Tile rows are encoded or decoded
357 * sequentially. Even though encoding/decoding of later tile rows depends on
358 * earlier ones, this allows the encoder to output data packets for tile rows
359 * prior to completely processing all tile rows in a frame, thereby reducing
360 * the latency in processing between input and output. The parameter
361 * for this control describes the number of tile rows, which has a valid
367 * By default, the value is 0, i.e. one single row tile for entire image.
369 * Supported in codecs: VP9
373 /*!\brief Codec control function to enable frame parallel decoding feature.
375 * VP9 has a bitstream feature to reduce decoding dependency between frames
376 * by turning off backward update of probability context used in encoding
377 * and decoding. This allows staged parallel processing of more than one
378 * video frame in the decoder. This control function provides a means to
379 * turn this feature on or off for bitstreams produced by encoder.
381 * By default, this feature is on.
383 * Supported in codecs: VP9
385 VP9E_SET_FRAME_PARALLEL_DECODING,
387 /*!\brief Codec control function to set adaptive quantization mode.
389 * VP9 has a segment based feature that allows encoder to adaptively change
390 * quantization parameter for each segment within a frame to improve the
391 * subjective quality. This control makes encoder operate in one of the
392 * several AQ_modes supported.
394 * By default, encoder operates with AQ_Mode 0(adaptive quantization off).
396 * Supported in codecs: VP9
400 /*!\brief Codec control function to enable/disable periodic Q boost.
402 * One VP9 encoder speed feature is to enable quality boost by lowering
403 * frame level Q periodically. This control function provides a mean to
404 * turn on/off this feature.
408 * By default, the encoder is allowed to use this feature for appropriate
411 * Supported in codecs: VP9
413 VP9E_SET_FRAME_PERIODIC_BOOST,
415 /*!\brief Codec control function to set noise sensitivity.
417 * 0: off, 1: On(YOnly), 2: For SVC only, on top two spatial layers(YOnly)
419 * Supported in codecs: VP9
421 VP9E_SET_NOISE_SENSITIVITY,
423 /*!\brief Codec control function to turn on/off SVC in encoder.
424 * \note Return value is VPX_CODEC_INVALID_PARAM if the encoder does not
425 * support SVC in its current encoding mode
428 * Supported in codecs: VP9
432 /*!\brief Codec control function to pass an ROI map to encoder.
434 * Supported in codecs: VP9
438 /*!\brief Codec control function to set parameters for SVC.
439 * \note Parameters contain min_q, max_q, scaling factor for each of the
442 * Supported in codecs: VP9
444 VP9E_SET_SVC_PARAMETERS,
446 /*!\brief Codec control function to set svc layer for spatial and temporal.
447 * \note Valid ranges: 0..#vpx_codec_enc_cfg::ss_number_layers for spatial
448 * layer and 0..#vpx_codec_enc_cfg::ts_number_layers for
451 * Supported in codecs: VP9
453 VP9E_SET_SVC_LAYER_ID,
455 /*!\brief Codec control function to set content type.
456 * \note Valid parameter range:
457 * VP9E_CONTENT_DEFAULT = Regular video content (Default)
458 * VP9E_CONTENT_SCREEN = Screen capture content
459 * VP9E_CONTENT_FILM = Film content: improves grain retention
461 * Supported in codecs: VP9
463 VP9E_SET_TUNE_CONTENT,
465 /*!\brief Codec control function to get svc layer ID.
466 * \note The layer ID returned is for the data packet from the registered
469 * Supported in codecs: VP9
471 VP9E_GET_SVC_LAYER_ID,
473 /*!\brief Codec control function to register callback to get per layer packet.
474 * \note Parameter for this control function is a structure with a callback
475 * function and a pointer to private data used by the callback.
477 * Supported in codecs: VP9
479 VP9E_REGISTER_CX_CALLBACK,
481 /*!\brief Codec control function to set color space info.
482 * \note Valid ranges: 0..7, default is "UNKNOWN".
492 * Supported in codecs: VP9
494 VP9E_SET_COLOR_SPACE,
496 /*!\brief Codec control function to set temporal layering mode.
497 * \note Valid ranges: 0..3, default is "0"
498 * (VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING).
499 * 0 = VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING
500 * 1 = VP9E_TEMPORAL_LAYERING_MODE_BYPASS
501 * 2 = VP9E_TEMPORAL_LAYERING_MODE_0101
502 * 3 = VP9E_TEMPORAL_LAYERING_MODE_0212
504 * Supported in codecs: VP9
506 VP9E_SET_TEMPORAL_LAYERING_MODE,
508 /*!\brief Codec control function to set minimum interval between GF/ARF frames
510 * By default the value is set as 4.
512 * Supported in codecs: VP9
514 VP9E_SET_MIN_GF_INTERVAL,
516 /*!\brief Codec control function to set minimum interval between GF/ARF frames
518 * By default the value is set as 16.
520 * Supported in codecs: VP9
522 VP9E_SET_MAX_GF_INTERVAL,
524 /*!\brief Codec control function to get an Active map back from the encoder.
526 * Supported in codecs: VP9
530 /*!\brief Codec control function to set color range bit.
531 * \note Valid ranges: 0..1, default is 0
532 * 0 = Limited range (16..235 or HBD equivalent)
533 * 1 = Full range (0..255 or HBD equivalent)
535 * Supported in codecs: VP9
537 VP9E_SET_COLOR_RANGE,
539 /*!\brief Codec control function to set the frame flags and buffer indices
540 * for spatial layers. The frame flags and buffer indices are set using the
541 * struct #vpx_svc_ref_frame_config defined below.
543 * Supported in codecs: VP9
545 VP9E_SET_SVC_REF_FRAME_CONFIG,
547 /*!\brief Codec control function to set intended rendering image size.
549 * By default, this is identical to the image size in pixels.
551 * Supported in codecs: VP9
553 VP9E_SET_RENDER_SIZE,
555 /*!\brief Codec control function to set target level.
557 * 255: off (default); 0: only keep level stats; 10: target for level 1.0;
558 * 11: target for level 1.1; ... 62: target for level 6.2
560 * Supported in codecs: VP9
562 VP9E_SET_TARGET_LEVEL,
564 /*!\brief Codec control function to set row level multi-threading.
568 * Supported in codecs: VP9
572 /*!\brief Codec control function to get bitstream level.
574 * Supported in codecs: VP9
578 /*!\brief Codec control function to enable/disable special mode for altref
579 * adaptive quantization. You can use it with --aq-mode concurrently.
581 * Enable special adaptive quantization for altref frames based on their
582 * expected prediction quality for the future frames.
584 * Supported in codecs: VP9
588 /*!\brief Boost percentage for Golden Frame in CBR mode.
590 * This value controls the amount of boost given to Golden Frame in
591 * CBR mode. It is expressed as a percentage of the average
592 * per-frame bitrate, with the special (and default) value 0 meaning
593 * the feature is off, i.e., no golden frame boost in CBR mode and
594 * average bitrate target is used.
596 * For example, to allow 100% more bits, i.e, 2X, in a golden frame
597 * than average frame, set this to 100.
599 * Supported in codecs: VP8
601 VP8E_SET_GF_CBR_BOOST_PCT,
603 /*!\brief Codec control function to enable the extreme motion vector unit test
604 * in VP9. Please note that this is only used in motion vector unit test.
606 * 0 : off, 1 : MAX_EXTREME_MV, 2 : MIN_EXTREME_MV
608 * Supported in codecs: VP9
610 VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST,
612 /*!\brief Codec control function to constrain the inter-layer prediction
613 * (prediction of lower spatial resolution) in VP9 SVC.
615 * 0 : inter-layer prediction on, 1 : off, 2 : off only on non-key frames
617 * Supported in codecs: VP9
619 VP9E_SET_SVC_INTER_LAYER_PRED,
621 /*!\brief Codec control function to set mode and thresholds for frame
622 * dropping in SVC. Drop frame thresholds are set per-layer. Mode is set as:
623 * 0 : layer-dependent dropping, 1 : constrained dropping, current layer drop
624 * forces drop on all upper layers. Default mode is 0.
626 * Supported in codecs: VP9
628 VP9E_SET_SVC_FRAME_DROP_LAYER,
630 /*!\brief Codec control function to get the refresh and reference flags and
631 * the buffer indices, up to the last encoded spatial layer.
633 * Supported in codecs: VP9
635 VP9E_GET_SVC_REF_FRAME_CONFIG,
637 /*!\brief Codec control function to enable/disable use of golden reference as
638 * a second temporal reference for SVC. Only used when inter-layer prediction
639 * is disabled on INTER frames.
641 * 0: Off, 1: Enabled (default)
643 * Supported in codecs: VP9
645 VP9E_SET_SVC_GF_TEMPORAL_REF,
647 /*!\brief Codec control function to enable spatial layer sync frame, for any
648 * spatial layer. Enabling it for layer k means spatial layer k will disable
649 * all temporal prediction, but keep the inter-layer prediction. It will
650 * refresh any temporal reference buffer for that layer, and reset the
651 * temporal layer for the superframe to 0. Setting the layer sync for base
652 * spatial layer forces a key frame. Default is off (0) for all spatial
653 * layers. Spatial layer sync flag is reset to 0 after each encoded layer,
654 * so when control is invoked it is only used for the current superframe.
656 * 0: Off (default), 1: Enabled
658 * Supported in codecs: VP9
660 VP9E_SET_SVC_SPATIAL_LAYER_SYNC,
662 /*!\brief Codec control function to enable temporal dependency model.
664 * Vp9 allows the encoder to run temporal dependency model and use it to
665 * improve the compression performance. To enable, set this parameter to be
666 * 1. The default value is set to be 1.
670 /*!\brief Codec control function to enable postencode frame drop.
672 * This will allow encoder to drop frame after it's encoded.
674 * 0: Off (default), 1: Enabled
676 * Supported in codecs: VP9
678 VP9E_SET_POSTENCODE_DROP,
680 /*!\brief Codec control function to set delta q for uv.
684 * Supported in codecs: VP9
688 /*!\brief Codec control function to disable increase Q on overshoot in CBR.
690 * 0: On (default), 1: Disable.
692 * Supported in codecs: VP9
694 VP9E_SET_DISABLE_OVERSHOOT_MAXQ_CBR,
697 /*!\brief vpx 1-D scaling mode
699 * This set of constants define 1-D vpx scaling modes
701 typedef enum vpx_scaling_mode_1d {
708 /*!\brief Temporal layering mode enum for VP9 SVC.
710 * This set of macros define the different temporal layering modes.
711 * Supported codecs: VP9 (in SVC mode)
714 typedef enum vp9e_temporal_layering_mode {
715 /*!\brief No temporal layering.
716 * Used when only spatial layering is used.
718 VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING = 0,
720 /*!\brief Bypass mode.
721 * Used when application needs to control temporal layering.
722 * This will only work when the number of spatial layers equals 1.
724 VP9E_TEMPORAL_LAYERING_MODE_BYPASS = 1,
726 /*!\brief 0-1-0-1... temporal layering scheme with two temporal layers.
728 VP9E_TEMPORAL_LAYERING_MODE_0101 = 2,
730 /*!\brief 0-2-1-2... temporal layering scheme with three temporal layers.
732 VP9E_TEMPORAL_LAYERING_MODE_0212 = 3
733 } VP9E_TEMPORAL_LAYERING_MODE;
735 /*!\brief vpx region of interest map
737 * These defines the data structures for the region of interest map
741 typedef struct vpx_roi_map {
742 /*! If ROI is enabled. */
744 /*! An id between 0-3 (0-7 for vp9) for each 16x16 (8x8 for VP9)
745 * region within a frame. */
746 unsigned char *roi_map;
747 unsigned int rows; /**< Number of rows. */
748 unsigned int cols; /**< Number of columns. */
749 /*! VP8 only uses the first 4 segments. VP9 uses 8 segments. */
750 int delta_q[8]; /**< Quantizer deltas. */
751 int delta_lf[8]; /**< Loop filter deltas. */
752 /*! skip and ref frame segment is only used in VP9. */
753 int skip[8]; /**< Skip this block. */
754 int ref_frame[8]; /**< Reference frame for this block. */
755 /*! Static breakout threshold for each segment. Only used in VP8. */
756 unsigned int static_threshold[4];
759 /*!\brief vpx active region map
761 * These defines the data structures for active region map
765 typedef struct vpx_active_map {
766 /*!\brief specify an on (1) or off (0) each 16x16 region within a frame */
767 unsigned char *active_map;
768 unsigned int rows; /**< number of rows */
769 unsigned int cols; /**< number of cols */
772 /*!\brief vpx image scaling mode
774 * This defines the data structure for image scaling mode
777 typedef struct vpx_scaling_mode {
778 VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
779 VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
780 } vpx_scaling_mode_t;
782 /*!\brief VP8 token partition mode
784 * This defines VP8 partitioning mode for compressed data, i.e., the number of
785 * sub-streams in the bitstream. Used for parallelized decoding.
790 VP8_ONE_TOKENPARTITION = 0,
791 VP8_TWO_TOKENPARTITION = 1,
792 VP8_FOUR_TOKENPARTITION = 2,
793 VP8_EIGHT_TOKENPARTITION = 3
794 } vp8e_token_partitions;
796 /*!brief VP9 encoder content type */
798 VP9E_CONTENT_DEFAULT,
804 /*!\brief VP8 model tuning parameters
806 * Changes the encoder to tune for certain types of input material.
809 typedef enum { VP8_TUNE_PSNR, VP8_TUNE_SSIM } vp8e_tuning;
811 /*!\brief vp9 svc layer parameters
813 * This defines the spatial and temporal layer id numbers for svc encoding.
814 * This is used with the #VP9E_SET_SVC_LAYER_ID control to set the spatial and
815 * temporal layer id for the current frame.
818 typedef struct vpx_svc_layer_id {
819 int spatial_layer_id; /**< First spatial layer to start encoding. */
820 // TODO(jianj): Deprecated, to be removed.
821 int temporal_layer_id; /**< Temporal layer id number. */
822 int temporal_layer_id_per_spatial[VPX_SS_MAX_LAYERS]; /**< Temp layer id. */
823 } vpx_svc_layer_id_t;
825 /*!\brief vp9 svc frame flag parameters.
827 * This defines the frame flags and buffer indices for each spatial layer for
829 * This is used with the #VP9E_SET_SVC_REF_FRAME_CONFIG control to set frame
830 * flags and buffer indices for each spatial layer for the current (super)frame.
833 typedef struct vpx_svc_ref_frame_config {
834 int lst_fb_idx[VPX_SS_MAX_LAYERS]; /**< Last buffer index. */
835 int gld_fb_idx[VPX_SS_MAX_LAYERS]; /**< Golden buffer index. */
836 int alt_fb_idx[VPX_SS_MAX_LAYERS]; /**< Altref buffer index. */
837 int update_buffer_slot[VPX_SS_MAX_LAYERS]; /**< Update reference frames. */
838 // TODO(jianj): Remove update_last/golden/alt_ref, these are deprecated.
839 int update_last[VPX_SS_MAX_LAYERS]; /**< Update last. */
840 int update_golden[VPX_SS_MAX_LAYERS]; /**< Update golden. */
841 int update_alt_ref[VPX_SS_MAX_LAYERS]; /**< Update altref. */
842 int reference_last[VPX_SS_MAX_LAYERS]; /**< Last as reference. */
843 int reference_golden[VPX_SS_MAX_LAYERS]; /**< Golden as reference. */
844 int reference_alt_ref[VPX_SS_MAX_LAYERS]; /**< Altref as reference. */
845 int64_t duration[VPX_SS_MAX_LAYERS]; /**< Duration per spatial layer. */
846 } vpx_svc_ref_frame_config_t;
848 /*!\brief VP9 svc frame dropping mode.
850 * This defines the frame drop mode for SVC.
854 CONSTRAINED_LAYER_DROP,
855 /**< Upper layers are constrained to drop if current layer drops. */
856 LAYER_DROP, /**< Any spatial layer can drop. */
857 FULL_SUPERFRAME_DROP, /**< Only full superframe can drop. */
858 CONSTRAINED_FROM_ABOVE_DROP,
859 /**< Lower layers are constrained to drop if current layer drops. */
860 } SVC_LAYER_DROP_MODE;
862 /*!\brief vp9 svc frame dropping parameters.
864 * This defines the frame drop thresholds for each spatial layer, and
865 * the frame dropping mode: 0 = layer based frame dropping (default),
866 * 1 = constrained dropping where current layer drop forces all upper
867 * spatial layers to drop.
869 typedef struct vpx_svc_frame_drop {
870 int framedrop_thresh[VPX_SS_MAX_LAYERS]; /**< Frame drop thresholds */
872 framedrop_mode; /**< Layer-based or constrained dropping. */
873 int max_consec_drop; /**< Maximum consecutive drops, for any layer. */
874 } vpx_svc_frame_drop_t;
876 /*!\brief vp9 svc spatial layer sync parameters.
878 * This defines the spatial layer sync flag, defined per spatial layer.
881 typedef struct vpx_svc_spatial_layer_sync {
882 int spatial_layer_sync[VPX_SS_MAX_LAYERS]; /**< Sync layer flags */
883 int base_layer_intra_only; /**< Flag for setting Intra-only frame on base */
884 } vpx_svc_spatial_layer_sync_t;
887 /*!\brief VP8 encoder control function parameter type
889 * Defines the data types that VP8E control functions take. Note that
890 * additional common controls are defined in vp8.h
894 VPX_CTRL_USE_TYPE(VP8E_SET_FRAME_FLAGS, int)
895 #define VPX_CTRL_VP8E_SET_FRAME_FLAGS
896 VPX_CTRL_USE_TYPE(VP8E_SET_TEMPORAL_LAYER_ID, int)
897 #define VPX_CTRL_VP8E_SET_TEMPORAL_LAYER_ID
898 VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
899 #define VPX_CTRL_VP8E_SET_ROI_MAP
900 VPX_CTRL_USE_TYPE(VP9E_SET_ROI_MAP, vpx_roi_map_t *)
901 #define VPX_CTRL_VP9E_SET_ROI_MAP
902 VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
903 #define VPX_CTRL_VP8E_SET_ACTIVEMAP
904 VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
905 #define VPX_CTRL_VP8E_SET_SCALEMODE
907 VPX_CTRL_USE_TYPE(VP9E_SET_SVC, int)
908 #define VPX_CTRL_VP9E_SET_SVC
909 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_PARAMETERS, void *)
910 #define VPX_CTRL_VP9E_SET_SVC_PARAMETERS
911 VPX_CTRL_USE_TYPE(VP9E_REGISTER_CX_CALLBACK, void *)
912 #define VPX_CTRL_VP9E_REGISTER_CX_CALLBACK
913 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
914 #define VPX_CTRL_VP9E_SET_SVC_LAYER_ID
916 VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
917 #define VPX_CTRL_VP8E_SET_CPUUSED
918 VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
919 #define VPX_CTRL_VP8E_SET_ENABLEAUTOALTREF
920 VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
921 #define VPX_CTRL_VP8E_SET_NOISE_SENSITIVITY
922 VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
923 #define VPX_CTRL_VP8E_SET_SHARPNESS
924 VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
925 #define VPX_CTRL_VP8E_SET_STATIC_THRESHOLD
926 VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, int) /* vp8e_token_partitions */
927 #define VPX_CTRL_VP8E_SET_TOKEN_PARTITIONS
929 VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
930 #define VPX_CTRL_VP8E_SET_ARNR_MAXFRAMES
931 VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH, unsigned int)
932 #define VPX_CTRL_VP8E_SET_ARNR_STRENGTH
933 VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ARNR_TYPE, unsigned int)
934 #define VPX_CTRL_VP8E_SET_ARNR_TYPE
935 VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vp8e_tuning */
936 #define VPX_CTRL_VP8E_SET_TUNING
937 VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL, unsigned int)
938 #define VPX_CTRL_VP8E_SET_CQ_LEVEL
940 VPX_CTRL_USE_TYPE(VP9E_SET_TILE_COLUMNS, int)
941 #define VPX_CTRL_VP9E_SET_TILE_COLUMNS
942 VPX_CTRL_USE_TYPE(VP9E_SET_TILE_ROWS, int)
943 #define VPX_CTRL_VP9E_SET_TILE_ROWS
945 VPX_CTRL_USE_TYPE(VP9E_SET_TPL, int)
946 #define VPX_CTRL_VP9E_SET_TPL
948 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
949 #define VPX_CTRL_VP8E_GET_LAST_QUANTIZER
950 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
951 #define VPX_CTRL_VP8E_GET_LAST_QUANTIZER_64
952 VPX_CTRL_USE_TYPE(VP9E_GET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
953 #define VPX_CTRL_VP9E_GET_SVC_LAYER_ID
955 VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
956 #define VPX_CTRL_VP8E_SET_MAX_INTRA_BITRATE_PCT
957 VPX_CTRL_USE_TYPE(VP9E_SET_MAX_INTER_BITRATE_PCT, unsigned int)
958 #define VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
960 VPX_CTRL_USE_TYPE(VP8E_SET_GF_CBR_BOOST_PCT, unsigned int)
961 #define VPX_CTRL_VP8E_SET_GF_CBR_BOOST_PCT
963 VPX_CTRL_USE_TYPE(VP8E_SET_SCREEN_CONTENT_MODE, unsigned int)
964 #define VPX_CTRL_VP8E_SET_SCREEN_CONTENT_MODE
966 VPX_CTRL_USE_TYPE(VP9E_SET_GF_CBR_BOOST_PCT, unsigned int)
967 #define VPX_CTRL_VP9E_SET_GF_CBR_BOOST_PCT
969 VPX_CTRL_USE_TYPE(VP9E_SET_LOSSLESS, unsigned int)
970 #define VPX_CTRL_VP9E_SET_LOSSLESS
972 VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PARALLEL_DECODING, unsigned int)
973 #define VPX_CTRL_VP9E_SET_FRAME_PARALLEL_DECODING
975 VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
976 #define VPX_CTRL_VP9E_SET_AQ_MODE
978 VPX_CTRL_USE_TYPE(VP9E_SET_ALT_REF_AQ, int)
979 #define VPX_CTRL_VP9E_SET_ALT_REF_AQ
981 VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
982 #define VPX_CTRL_VP9E_SET_FRAME_PERIODIC_BOOST
984 VPX_CTRL_USE_TYPE(VP9E_SET_NOISE_SENSITIVITY, unsigned int)
985 #define VPX_CTRL_VP9E_SET_NOISE_SENSITIVITY
987 VPX_CTRL_USE_TYPE(VP9E_SET_TUNE_CONTENT, int) /* vp9e_tune_content */
988 #define VPX_CTRL_VP9E_SET_TUNE_CONTENT
990 VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_SPACE, int)
991 #define VPX_CTRL_VP9E_SET_COLOR_SPACE
993 VPX_CTRL_USE_TYPE(VP9E_SET_MIN_GF_INTERVAL, unsigned int)
994 #define VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
996 VPX_CTRL_USE_TYPE(VP9E_SET_MAX_GF_INTERVAL, unsigned int)
997 #define VPX_CTRL_VP9E_SET_MAX_GF_INTERVAL
999 VPX_CTRL_USE_TYPE(VP9E_GET_ACTIVEMAP, vpx_active_map_t *)
1000 #define VPX_CTRL_VP9E_GET_ACTIVEMAP
1002 VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_RANGE, int)
1003 #define VPX_CTRL_VP9E_SET_COLOR_RANGE
1005 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
1006 #define VPX_CTRL_VP9E_SET_SVC_REF_FRAME_CONFIG
1008 VPX_CTRL_USE_TYPE(VP9E_SET_RENDER_SIZE, int *)
1009 #define VPX_CTRL_VP9E_SET_RENDER_SIZE
1011 VPX_CTRL_USE_TYPE(VP9E_SET_TARGET_LEVEL, unsigned int)
1012 #define VPX_CTRL_VP9E_SET_TARGET_LEVEL
1014 VPX_CTRL_USE_TYPE(VP9E_SET_ROW_MT, unsigned int)
1015 #define VPX_CTRL_VP9E_SET_ROW_MT
1017 VPX_CTRL_USE_TYPE(VP9E_GET_LEVEL, int *)
1018 #define VPX_CTRL_VP9E_GET_LEVEL
1020 VPX_CTRL_USE_TYPE(VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST, unsigned int)
1021 #define VPX_CTRL_VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST
1023 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_INTER_LAYER_PRED, unsigned int)
1024 #define VPX_CTRL_VP9E_SET_SVC_INTER_LAYER_PRED
1026 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_FRAME_DROP_LAYER, vpx_svc_frame_drop_t *)
1027 #define VPX_CTRL_VP9E_SET_SVC_FRAME_DROP_LAYER
1029 VPX_CTRL_USE_TYPE(VP9E_GET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
1030 #define VPX_CTRL_VP9E_GET_SVC_REF_FRAME_CONFIG
1032 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_GF_TEMPORAL_REF, unsigned int)
1033 #define VPX_CTRL_VP9E_SET_SVC_GF_TEMPORAL_REF
1035 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_SPATIAL_LAYER_SYNC,
1036 vpx_svc_spatial_layer_sync_t *)
1037 #define VPX_CTRL_VP9E_SET_SVC_SPATIAL_LAYER_SYNC
1039 VPX_CTRL_USE_TYPE(VP9E_SET_POSTENCODE_DROP, unsigned int)
1040 #define VPX_CTRL_VP9E_SET_POSTENCODE_DROP
1042 VPX_CTRL_USE_TYPE(VP9E_SET_DELTA_Q_UV, int)
1043 #define VPX_CTRL_VP9E_SET_DELTA_Q_UV
1045 VPX_CTRL_USE_TYPE(VP9E_SET_DISABLE_OVERSHOOT_MAXQ_CBR, int)
1046 #define VPX_CTRL_VP9E_SET_DISABLE_OVERSHOOT_MAXQ_CBR
1048 /*! @} - end defgroup vp8_encoder */
1053 #endif // VPX_VPX_VP8CX_H_