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
689 /*!\brief vpx 1-D scaling mode
691 * This set of constants define 1-D vpx scaling modes
693 typedef enum vpx_scaling_mode_1d {
700 /*!\brief Temporal layering mode enum for VP9 SVC.
702 * This set of macros define the different temporal layering modes.
703 * Supported codecs: VP9 (in SVC mode)
706 typedef enum vp9e_temporal_layering_mode {
707 /*!\brief No temporal layering.
708 * Used when only spatial layering is used.
710 VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING = 0,
712 /*!\brief Bypass mode.
713 * Used when application needs to control temporal layering.
714 * This will only work when the number of spatial layers equals 1.
716 VP9E_TEMPORAL_LAYERING_MODE_BYPASS = 1,
718 /*!\brief 0-1-0-1... temporal layering scheme with two temporal layers.
720 VP9E_TEMPORAL_LAYERING_MODE_0101 = 2,
722 /*!\brief 0-2-1-2... temporal layering scheme with three temporal layers.
724 VP9E_TEMPORAL_LAYERING_MODE_0212 = 3
725 } VP9E_TEMPORAL_LAYERING_MODE;
727 /*!\brief vpx region of interest map
729 * These defines the data structures for the region of interest map
733 typedef struct vpx_roi_map {
734 /*! If ROI is enabled. */
736 /*! An id between 0-3 (0-7 for vp9) for each 16x16 (8x8 for VP9)
737 * region within a frame. */
738 unsigned char *roi_map;
739 unsigned int rows; /**< Number of rows. */
740 unsigned int cols; /**< Number of columns. */
741 /*! VP8 only uses the first 4 segments. VP9 uses 8 segments. */
742 int delta_q[8]; /**< Quantizer deltas. */
743 int delta_lf[8]; /**< Loop filter deltas. */
744 /*! skip and ref frame segment is only used in VP9. */
745 int skip[8]; /**< Skip this block. */
746 int ref_frame[8]; /**< Reference frame for this block. */
747 /*! Static breakout threshold for each segment. Only used in VP8. */
748 unsigned int static_threshold[4];
751 /*!\brief vpx active region map
753 * These defines the data structures for active region map
757 typedef struct vpx_active_map {
758 /*!\brief specify an on (1) or off (0) each 16x16 region within a frame */
759 unsigned char *active_map;
760 unsigned int rows; /**< number of rows */
761 unsigned int cols; /**< number of cols */
764 /*!\brief vpx image scaling mode
766 * This defines the data structure for image scaling mode
769 typedef struct vpx_scaling_mode {
770 VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
771 VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
772 } vpx_scaling_mode_t;
774 /*!\brief VP8 token partition mode
776 * This defines VP8 partitioning mode for compressed data, i.e., the number of
777 * sub-streams in the bitstream. Used for parallelized decoding.
782 VP8_ONE_TOKENPARTITION = 0,
783 VP8_TWO_TOKENPARTITION = 1,
784 VP8_FOUR_TOKENPARTITION = 2,
785 VP8_EIGHT_TOKENPARTITION = 3
786 } vp8e_token_partitions;
788 /*!brief VP9 encoder content type */
790 VP9E_CONTENT_DEFAULT,
796 /*!\brief VP8 model tuning parameters
798 * Changes the encoder to tune for certain types of input material.
801 typedef enum { VP8_TUNE_PSNR, VP8_TUNE_SSIM } vp8e_tuning;
803 /*!\brief vp9 svc layer parameters
805 * This defines the spatial and temporal layer id numbers for svc encoding.
806 * This is used with the #VP9E_SET_SVC_LAYER_ID control to set the spatial and
807 * temporal layer id for the current frame.
810 typedef struct vpx_svc_layer_id {
811 int spatial_layer_id; /**< First spatial layer to start encoding. */
812 // TODO(jianj): Deprecated, to be removed.
813 int temporal_layer_id; /**< Temporal layer id number. */
814 int temporal_layer_id_per_spatial[VPX_SS_MAX_LAYERS]; /**< Temp layer id. */
815 } vpx_svc_layer_id_t;
817 /*!\brief vp9 svc frame flag parameters.
819 * This defines the frame flags and buffer indices for each spatial layer for
821 * This is used with the #VP9E_SET_SVC_REF_FRAME_CONFIG control to set frame
822 * flags and buffer indices for each spatial layer for the current (super)frame.
825 typedef struct vpx_svc_ref_frame_config {
826 int lst_fb_idx[VPX_SS_MAX_LAYERS]; /**< Last buffer index. */
827 int gld_fb_idx[VPX_SS_MAX_LAYERS]; /**< Golden buffer index. */
828 int alt_fb_idx[VPX_SS_MAX_LAYERS]; /**< Altref buffer index. */
829 int update_buffer_slot[VPX_SS_MAX_LAYERS]; /**< Update reference frames. */
830 // TODO(jianj): Remove update_last/golden/alt_ref, these are deprecated.
831 int update_last[VPX_SS_MAX_LAYERS]; /**< Update last. */
832 int update_golden[VPX_SS_MAX_LAYERS]; /**< Update golden. */
833 int update_alt_ref[VPX_SS_MAX_LAYERS]; /**< Update altref. */
834 int reference_last[VPX_SS_MAX_LAYERS]; /**< Last as reference. */
835 int reference_golden[VPX_SS_MAX_LAYERS]; /**< Golden as reference. */
836 int reference_alt_ref[VPX_SS_MAX_LAYERS]; /**< Altref as reference. */
837 int64_t duration[VPX_SS_MAX_LAYERS]; /**< Duration per spatial layer. */
838 } vpx_svc_ref_frame_config_t;
840 /*!\brief VP9 svc frame dropping mode.
842 * This defines the frame drop mode for SVC.
846 CONSTRAINED_LAYER_DROP,
847 /**< Upper layers are constrained to drop if current layer drops. */
848 LAYER_DROP, /**< Any spatial layer can drop. */
849 FULL_SUPERFRAME_DROP, /**< Only full superframe can drop. */
850 CONSTRAINED_FROM_ABOVE_DROP,
851 /**< Lower layers are constrained to drop if current layer drops. */
852 } SVC_LAYER_DROP_MODE;
854 /*!\brief vp9 svc frame dropping parameters.
856 * This defines the frame drop thresholds for each spatial layer, and
857 * the frame dropping mode: 0 = layer based frame dropping (default),
858 * 1 = constrained dropping where current layer drop forces all upper
859 * spatial layers to drop.
861 typedef struct vpx_svc_frame_drop {
862 int framedrop_thresh[VPX_SS_MAX_LAYERS]; /**< Frame drop thresholds */
864 framedrop_mode; /**< Layer-based or constrained dropping. */
865 int max_consec_drop; /**< Maximum consecutive drops, for any layer. */
866 } vpx_svc_frame_drop_t;
868 /*!\brief vp9 svc spatial layer sync parameters.
870 * This defines the spatial layer sync flag, defined per spatial layer.
873 typedef struct vpx_svc_spatial_layer_sync {
874 int spatial_layer_sync[VPX_SS_MAX_LAYERS]; /**< Sync layer flags */
875 int base_layer_intra_only; /**< Flag for setting Intra-only frame on base */
876 } vpx_svc_spatial_layer_sync_t;
879 /*!\brief VP8 encoder control function parameter type
881 * Defines the data types that VP8E control functions take. Note that
882 * additional common controls are defined in vp8.h
886 VPX_CTRL_USE_TYPE(VP8E_SET_FRAME_FLAGS, int)
887 #define VPX_CTRL_VP8E_SET_FRAME_FLAGS
888 VPX_CTRL_USE_TYPE(VP8E_SET_TEMPORAL_LAYER_ID, int)
889 #define VPX_CTRL_VP8E_SET_TEMPORAL_LAYER_ID
890 VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
891 #define VPX_CTRL_VP8E_SET_ROI_MAP
892 VPX_CTRL_USE_TYPE(VP9E_SET_ROI_MAP, vpx_roi_map_t *)
893 #define VPX_CTRL_VP9E_SET_ROI_MAP
894 VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
895 #define VPX_CTRL_VP8E_SET_ACTIVEMAP
896 VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
897 #define VPX_CTRL_VP8E_SET_SCALEMODE
899 VPX_CTRL_USE_TYPE(VP9E_SET_SVC, int)
900 #define VPX_CTRL_VP9E_SET_SVC
901 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_PARAMETERS, void *)
902 #define VPX_CTRL_VP9E_SET_SVC_PARAMETERS
903 VPX_CTRL_USE_TYPE(VP9E_REGISTER_CX_CALLBACK, void *)
904 #define VPX_CTRL_VP9E_REGISTER_CX_CALLBACK
905 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
906 #define VPX_CTRL_VP9E_SET_SVC_LAYER_ID
908 VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
909 #define VPX_CTRL_VP8E_SET_CPUUSED
910 VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
911 #define VPX_CTRL_VP8E_SET_ENABLEAUTOALTREF
912 VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
913 #define VPX_CTRL_VP8E_SET_NOISE_SENSITIVITY
914 VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
915 #define VPX_CTRL_VP8E_SET_SHARPNESS
916 VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
917 #define VPX_CTRL_VP8E_SET_STATIC_THRESHOLD
918 VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, int) /* vp8e_token_partitions */
919 #define VPX_CTRL_VP8E_SET_TOKEN_PARTITIONS
921 VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
922 #define VPX_CTRL_VP8E_SET_ARNR_MAXFRAMES
923 VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH, unsigned int)
924 #define VPX_CTRL_VP8E_SET_ARNR_STRENGTH
925 VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ARNR_TYPE, unsigned int)
926 #define VPX_CTRL_VP8E_SET_ARNR_TYPE
927 VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vp8e_tuning */
928 #define VPX_CTRL_VP8E_SET_TUNING
929 VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL, unsigned int)
930 #define VPX_CTRL_VP8E_SET_CQ_LEVEL
932 VPX_CTRL_USE_TYPE(VP9E_SET_TILE_COLUMNS, int)
933 #define VPX_CTRL_VP9E_SET_TILE_COLUMNS
934 VPX_CTRL_USE_TYPE(VP9E_SET_TILE_ROWS, int)
935 #define VPX_CTRL_VP9E_SET_TILE_ROWS
937 VPX_CTRL_USE_TYPE(VP9E_SET_TPL, int)
938 #define VPX_CTRL_VP9E_SET_TPL
940 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
941 #define VPX_CTRL_VP8E_GET_LAST_QUANTIZER
942 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
943 #define VPX_CTRL_VP8E_GET_LAST_QUANTIZER_64
944 VPX_CTRL_USE_TYPE(VP9E_GET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
945 #define VPX_CTRL_VP9E_GET_SVC_LAYER_ID
947 VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
948 #define VPX_CTRL_VP8E_SET_MAX_INTRA_BITRATE_PCT
949 VPX_CTRL_USE_TYPE(VP9E_SET_MAX_INTER_BITRATE_PCT, unsigned int)
950 #define VPX_CTRL_VP9E_SET_MAX_INTER_BITRATE_PCT
952 VPX_CTRL_USE_TYPE(VP8E_SET_GF_CBR_BOOST_PCT, unsigned int)
953 #define VPX_CTRL_VP8E_SET_GF_CBR_BOOST_PCT
955 VPX_CTRL_USE_TYPE(VP8E_SET_SCREEN_CONTENT_MODE, unsigned int)
956 #define VPX_CTRL_VP8E_SET_SCREEN_CONTENT_MODE
958 VPX_CTRL_USE_TYPE(VP9E_SET_GF_CBR_BOOST_PCT, unsigned int)
959 #define VPX_CTRL_VP9E_SET_GF_CBR_BOOST_PCT
961 VPX_CTRL_USE_TYPE(VP9E_SET_LOSSLESS, unsigned int)
962 #define VPX_CTRL_VP9E_SET_LOSSLESS
964 VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PARALLEL_DECODING, unsigned int)
965 #define VPX_CTRL_VP9E_SET_FRAME_PARALLEL_DECODING
967 VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
968 #define VPX_CTRL_VP9E_SET_AQ_MODE
970 VPX_CTRL_USE_TYPE(VP9E_SET_ALT_REF_AQ, int)
971 #define VPX_CTRL_VP9E_SET_ALT_REF_AQ
973 VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
974 #define VPX_CTRL_VP9E_SET_FRAME_PERIODIC_BOOST
976 VPX_CTRL_USE_TYPE(VP9E_SET_NOISE_SENSITIVITY, unsigned int)
977 #define VPX_CTRL_VP9E_SET_NOISE_SENSITIVITY
979 VPX_CTRL_USE_TYPE(VP9E_SET_TUNE_CONTENT, int) /* vp9e_tune_content */
980 #define VPX_CTRL_VP9E_SET_TUNE_CONTENT
982 VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_SPACE, int)
983 #define VPX_CTRL_VP9E_SET_COLOR_SPACE
985 VPX_CTRL_USE_TYPE(VP9E_SET_MIN_GF_INTERVAL, unsigned int)
986 #define VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
988 VPX_CTRL_USE_TYPE(VP9E_SET_MAX_GF_INTERVAL, unsigned int)
989 #define VPX_CTRL_VP9E_SET_MAX_GF_INTERVAL
991 VPX_CTRL_USE_TYPE(VP9E_GET_ACTIVEMAP, vpx_active_map_t *)
992 #define VPX_CTRL_VP9E_GET_ACTIVEMAP
994 VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_RANGE, int)
995 #define VPX_CTRL_VP9E_SET_COLOR_RANGE
997 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
998 #define VPX_CTRL_VP9E_SET_SVC_REF_FRAME_CONFIG
1000 VPX_CTRL_USE_TYPE(VP9E_SET_RENDER_SIZE, int *)
1001 #define VPX_CTRL_VP9E_SET_RENDER_SIZE
1003 VPX_CTRL_USE_TYPE(VP9E_SET_TARGET_LEVEL, unsigned int)
1004 #define VPX_CTRL_VP9E_SET_TARGET_LEVEL
1006 VPX_CTRL_USE_TYPE(VP9E_SET_ROW_MT, unsigned int)
1007 #define VPX_CTRL_VP9E_SET_ROW_MT
1009 VPX_CTRL_USE_TYPE(VP9E_GET_LEVEL, int *)
1010 #define VPX_CTRL_VP9E_GET_LEVEL
1012 VPX_CTRL_USE_TYPE(VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST, unsigned int)
1013 #define VPX_CTRL_VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST
1015 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_INTER_LAYER_PRED, unsigned int)
1016 #define VPX_CTRL_VP9E_SET_SVC_INTER_LAYER_PRED
1018 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_FRAME_DROP_LAYER, vpx_svc_frame_drop_t *)
1019 #define VPX_CTRL_VP9E_SET_SVC_FRAME_DROP_LAYER
1021 VPX_CTRL_USE_TYPE(VP9E_GET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
1022 #define VPX_CTRL_VP9E_GET_SVC_REF_FRAME_CONFIG
1024 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_GF_TEMPORAL_REF, unsigned int)
1025 #define VPX_CTRL_VP9E_SET_SVC_GF_TEMPORAL_REF
1027 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_SPATIAL_LAYER_SYNC,
1028 vpx_svc_spatial_layer_sync_t *)
1029 #define VPX_CTRL_VP9E_SET_SVC_SPATIAL_LAYER_SYNC
1031 VPX_CTRL_USE_TYPE(VP9E_SET_POSTENCODE_DROP, unsigned int)
1032 #define VPX_CTRL_VP9E_SET_POSTENCODE_DROP
1034 VPX_CTRL_USE_TYPE(VP9E_SET_DELTA_Q_UV, int)
1035 #define VPX_CTRL_VP9E_SET_DELTA_Q_UV
1038 /*! @} - end defgroup vp8_encoder */
1043 #endif // VPX_VPX_VP8CX_H_