Home | History | Annotate | Download | only in vpx
      1 /*
      2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
      3  *
      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.
      9  */
     10 #ifndef VPX_VP8CX_H_
     11 #define VPX_VP8CX_H_
     12 
     13 /*!\defgroup vp8_encoder WebM VP8/VP9 Encoder
     14  * \ingroup vp8
     15  *
     16  * @{
     17  */
     18 #include "./vp8.h"
     19 #include "./vpx_encoder.h"
     20 
     21 /*!\file
     22  * \brief Provides definitions for using VP8 or VP9 encoder algorithm within the
     23  *        vpx Codec Interface.
     24  */
     25 
     26 #ifdef __cplusplus
     27 extern "C" {
     28 #endif
     29 
     30 /*!\name Algorithm interface for VP8
     31  *
     32  * This interface provides the capability to encode raw VP8 streams.
     33  * @{
     34  */
     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*/
     38 
     39 /*!\name Algorithm interface for VP9
     40  *
     41  * This interface provides the capability to encode raw VP9 streams.
     42  * @{
     43  */
     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*/
     47 
     48 /*
     49  * Algorithm Flags
     50  */
     51 
     52 /*!\brief Don't reference the last frame
     53  *
     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.
     57  */
     58 #define VP8_EFLAG_NO_REF_LAST (1 << 16)
     59 
     60 /*!\brief Don't reference the golden frame
     61  *
     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.
     65  */
     66 #define VP8_EFLAG_NO_REF_GF (1 << 17)
     67 
     68 /*!\brief Don't reference the alternate reference frame
     69  *
     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.
     73  */
     74 #define VP8_EFLAG_NO_REF_ARF (1 << 21)
     75 
     76 /*!\brief Don't update the last frame
     77  *
     78  * When this flag is set, the encoder will not update the last frame with
     79  * the contents of the current frame.
     80  */
     81 #define VP8_EFLAG_NO_UPD_LAST (1 << 18)
     82 
     83 /*!\brief Don't update the golden frame
     84  *
     85  * When this flag is set, the encoder will not update the golden frame with
     86  * the contents of the current frame.
     87  */
     88 #define VP8_EFLAG_NO_UPD_GF (1 << 22)
     89 
     90 /*!\brief Don't update the alternate reference frame
     91  *
     92  * When this flag is set, the encoder will not update the alt ref frame with
     93  * the contents of the current frame.
     94  */
     95 #define VP8_EFLAG_NO_UPD_ARF (1 << 23)
     96 
     97 /*!\brief Force golden frame update
     98  *
     99  * When this flag is set, the encoder copy the contents of the current frame
    100  * to the golden frame buffer.
    101  */
    102 #define VP8_EFLAG_FORCE_GF (1 << 19)
    103 
    104 /*!\brief Force alternate reference frame update
    105  *
    106  * When this flag is set, the encoder copy the contents of the current frame
    107  * to the alternate reference frame buffer.
    108  */
    109 #define VP8_EFLAG_FORCE_ARF (1 << 24)
    110 
    111 /*!\brief Disable entropy update
    112  *
    113  * When this flag is set, the encoder will not update its internal entropy
    114  * model based on the entropy of this frame.
    115  */
    116 #define VP8_EFLAG_NO_UPD_ENTROPY (1 << 20)
    117 
    118 /*!\brief VPx encoder control functions
    119  *
    120  * This set of macros define the control functions available for VPx
    121  * encoder interface.
    122  *
    123  * \sa #vpx_codec_control
    124  */
    125 enum vp8e_enc_control_id {
    126   /*!\brief Codec control function to pass an ROI map to encoder.
    127    *
    128    * Supported in codecs: VP8, VP9
    129    */
    130   VP8E_SET_ROI_MAP = 8,
    131 
    132   /*!\brief Codec control function to pass an Active map to encoder.
    133    *
    134    * Supported in codecs: VP8, VP9
    135    */
    136   VP8E_SET_ACTIVEMAP,
    137 
    138   /*!\brief Codec control function to set encoder scaling mode.
    139    *
    140    * Supported in codecs: VP8, VP9
    141    */
    142   VP8E_SET_SCALEMODE = 11,
    143 
    144   /*!\brief Codec control function to set encoder internal speed settings.
    145    *
    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.
    149    *
    150    * \note Valid range for VP8: -16..16
    151    * \note Valid range for VP9: -8..8
    152    *
    153    * Supported in codecs: VP8, VP9
    154    */
    155   VP8E_SET_CPUUSED = 13,
    156 
    157   /*!\brief Codec control function to enable automatic set and use alf frames.
    158    *
    159    * Supported in codecs: VP8, VP9
    160    */
    161   VP8E_SET_ENABLEAUTOALTREF,
    162 
    163   /*!\brief control function to set noise sensitivity
    164    *
    165    * 0: off, 1: OnYOnly, 2: OnYUV,
    166    * 3: OnYUVAggressive, 4: Adaptive
    167    *
    168    * Supported in codecs: VP8
    169    */
    170   VP8E_SET_NOISE_SENSITIVITY,
    171 
    172   /*!\brief Codec control function to set sharpness.
    173    *
    174    * Supported in codecs: VP8, VP9
    175    */
    176   VP8E_SET_SHARPNESS,
    177 
    178   /*!\brief Codec control function to set the threshold for MBs treated static.
    179    *
    180    * Supported in codecs: VP8, VP9
    181    */
    182   VP8E_SET_STATIC_THRESHOLD,
    183 
    184   /*!\brief Codec control function to set the number of token partitions.
    185    *
    186    * Supported in codecs: VP8
    187    */
    188   VP8E_SET_TOKEN_PARTITIONS,
    189 
    190   /*!\brief Codec control function to get last quantizer chosen by the encoder.
    191    *
    192    * Return value uses internal quantizer scale defined by the codec.
    193    *
    194    * Supported in codecs: VP8, VP9
    195    */
    196   VP8E_GET_LAST_QUANTIZER,
    197 
    198   /*!\brief Codec control function to get last quantizer chosen by the encoder.
    199    *
    200    * Return value uses the 0..63 scale as used by the rc_*_quantizer config
    201    * parameters.
    202    *
    203    * Supported in codecs: VP8, VP9
    204    */
    205   VP8E_GET_LAST_QUANTIZER_64,
    206 
    207   /*!\brief Codec control function to set the max no of frames to create arf.
    208    *
    209    * Supported in codecs: VP8, VP9
    210    */
    211   VP8E_SET_ARNR_MAXFRAMES,
    212 
    213   /*!\brief Codec control function to set the filter strength for the arf.
    214    *
    215    * Supported in codecs: VP8, VP9
    216    */
    217   VP8E_SET_ARNR_STRENGTH,
    218 
    219   /*!\deprecated control function to set the filter type to use for the arf. */
    220   VP8E_SET_ARNR_TYPE,
    221 
    222   /*!\brief Codec control function to set visual tuning.
    223    *
    224    * Supported in codecs: VP8, VP9
    225    */
    226   VP8E_SET_TUNING,
    227 
    228   /*!\brief Codec control function to set constrained quality level.
    229    *
    230    * \attention For this value to be used vpx_codec_enc_cfg_t::g_usage must be
    231    *            set to #VPX_CQ.
    232    * \note Valid range: 0..63
    233    *
    234    * Supported in codecs: VP8, VP9
    235    */
    236   VP8E_SET_CQ_LEVEL,
    237 
    238   /*!\brief Codec control function to set Max data rate for Intra frames.
    239    *
    240    * This value controls additional clamping on the maximum size of a
    241    * keyframe. It is expressed as a percentage of the average
    242    * per-frame bitrate, with the special (and default) value 0 meaning
    243    * unlimited, or no additional clamping beyond the codec's built-in
    244    * algorithm.
    245    *
    246    * For example, to allocate no more than 4.5 frames worth of bitrate
    247    * to a keyframe, set this to 450.
    248    *
    249    * Supported in codecs: VP8, VP9
    250    */
    251   VP8E_SET_MAX_INTRA_BITRATE_PCT,
    252 
    253   /*!\brief Codec control function to set reference and update frame flags.
    254    *
    255    *  Supported in codecs: VP8
    256    */
    257   VP8E_SET_FRAME_FLAGS,
    258 
    259   /*!\brief Codec control function to set max data rate for Inter frames.
    260    *
    261    * This value controls additional clamping on the maximum size of an
    262    * inter frame. It is expressed as a percentage of the average
    263    * per-frame bitrate, with the special (and default) value 0 meaning
    264    * unlimited, or no additional clamping beyond the codec's built-in
    265    * algorithm.
    266    *
    267    * For example, to allow no more than 4.5 frames worth of bitrate
    268    * to an inter frame, set this to 450.
    269    *
    270    * Supported in codecs: VP9
    271    */
    272   VP9E_SET_MAX_INTER_BITRATE_PCT,
    273 
    274   /*!\brief Boost percentage for Golden Frame in CBR mode.
    275    *
    276    * This value controls the amount of boost given to Golden Frame in
    277    * CBR mode. It is expressed as a percentage of the average
    278    * per-frame bitrate, with the special (and default) value 0 meaning
    279    * the feature is off, i.e., no golden frame boost in CBR mode and
    280    * average bitrate target is used.
    281    *
    282    * For example, to allow 100% more bits, i.e, 2X, in a golden frame
    283    * than average frame, set this to 100.
    284    *
    285    * Supported in codecs: VP9
    286    */
    287   VP9E_SET_GF_CBR_BOOST_PCT,
    288 
    289   /*!\brief Codec control function to set the temporal layer id.
    290    *
    291    * For temporal scalability: this control allows the application to set the
    292    * layer id for each frame to be encoded. Note that this control must be set
    293    * for every frame prior to encoding. The usage of this control function
    294    * supersedes the internal temporal pattern counter, which is now deprecated.
    295    *
    296    * Supported in codecs: VP8
    297    */
    298   VP8E_SET_TEMPORAL_LAYER_ID,
    299 
    300   /*!\brief Codec control function to set encoder screen content mode.
    301    *
    302    * 0: off, 1: On, 2: On with more aggressive rate control.
    303    *
    304    * Supported in codecs: VP8
    305    */
    306   VP8E_SET_SCREEN_CONTENT_MODE,
    307 
    308   /*!\brief Codec control function to set lossless encoding mode.
    309    *
    310    * VP9 can operate in lossless encoding mode, in which the bitstream
    311    * produced will be able to decode and reconstruct a perfect copy of
    312    * input source. This control function provides a mean to switch encoder
    313    * into lossless coding mode(1) or normal coding mode(0) that may be lossy.
    314    *                          0 = lossy coding mode
    315    *                          1 = lossless coding mode
    316    *
    317    *  By default, encoder operates in normal coding mode (maybe lossy).
    318    *
    319    * Supported in codecs: VP9
    320    */
    321   VP9E_SET_LOSSLESS,
    322 
    323   /*!\brief Codec control function to set number of tile columns.
    324    *
    325    * In encoding and decoding, VP9 allows an input image frame be partitioned
    326    * into separated vertical tile columns, which can be encoded or decoded
    327    * independently. This enables easy implementation of parallel encoding and
    328    * decoding. This control requests the encoder to use column tiles in
    329    * encoding an input frame, with number of tile columns (in Log2 unit) as
    330    * the parameter:
    331    *             0 = 1 tile column
    332    *             1 = 2 tile columns
    333    *             2 = 4 tile columns
    334    *             .....
    335    *             n = 2**n tile columns
    336    * The requested tile columns will be capped by encoder based on image size
    337    * limitation (The minimum width of a tile column is 256 pixel, the maximum
    338    * is 4096).
    339    *
    340    * By default, the value is 0, i.e. one single column tile for entire image.
    341    *
    342    * Supported in codecs: VP9
    343    */
    344   VP9E_SET_TILE_COLUMNS,
    345 
    346   /*!\brief Codec control function to set number of tile rows.
    347    *
    348    * In encoding and decoding, VP9 allows an input image frame be partitioned
    349    * into separated horizontal tile rows. Tile rows are encoded or decoded
    350    * sequentially. Even though encoding/decoding of later tile rows depends on
    351    * earlier ones, this allows the encoder to output data packets for tile rows
    352    * prior to completely processing all tile rows in a frame, thereby reducing
    353    * the latency in processing between input and output. The parameter
    354    * for this control describes the number of tile rows, which has a valid
    355    * range [0, 2]:
    356    *            0 = 1 tile row
    357    *            1 = 2 tile rows
    358    *            2 = 4 tile rows
    359    *
    360    * By default, the value is 0, i.e. one single row tile for entire image.
    361    *
    362    * Supported in codecs: VP9
    363    */
    364   VP9E_SET_TILE_ROWS,
    365 
    366   /*!\brief Codec control function to enable frame parallel decoding feature.
    367    *
    368    * VP9 has a bitstream feature to reduce decoding dependency between frames
    369    * by turning off backward update of probability context used in encoding
    370    * and decoding. This allows staged parallel processing of more than one
    371    * video frames in the decoder. This control function provides a mean to
    372    * turn this feature on or off for bitstreams produced by encoder.
    373    *
    374    * By default, this feature is off.
    375    *
    376    * Supported in codecs: VP9
    377    */
    378   VP9E_SET_FRAME_PARALLEL_DECODING,
    379 
    380   /*!\brief Codec control function to set adaptive quantization mode.
    381    *
    382    * VP9 has a segment based feature that allows encoder to adaptively change
    383    * quantization parameter for each segment within a frame to improve the
    384    * subjective quality. This control makes encoder operate in one of the
    385    * several AQ_modes supported.
    386    *
    387    * By default, encoder operates with AQ_Mode 0(adaptive quantization off).
    388    *
    389    * Supported in codecs: VP9
    390    */
    391   VP9E_SET_AQ_MODE,
    392 
    393   /*!\brief Codec control function to enable/disable periodic Q boost.
    394    *
    395    * One VP9 encoder speed feature is to enable quality boost by lowering
    396    * frame level Q periodically. This control function provides a mean to
    397    * turn on/off this feature.
    398    *               0 = off
    399    *               1 = on
    400    *
    401    * By default, the encoder is allowed to use this feature for appropriate
    402    * encoding modes.
    403    *
    404    * Supported in codecs: VP9
    405    */
    406   VP9E_SET_FRAME_PERIODIC_BOOST,
    407 
    408   /*!\brief Codec control function to set noise sensitivity.
    409    *
    410    *  0: off, 1: On(YOnly)
    411    *
    412    * Supported in codecs: VP9
    413    */
    414   VP9E_SET_NOISE_SENSITIVITY,
    415 
    416   /*!\brief Codec control function to turn on/off SVC in encoder.
    417    * \note Return value is VPX_CODEC_INVALID_PARAM if the encoder does not
    418    *       support SVC in its current encoding mode
    419    *  0: off, 1: on
    420    *
    421    * Supported in codecs: VP9
    422    */
    423   VP9E_SET_SVC,
    424 
    425   /*!\brief Codec control function to set parameters for SVC.
    426    * \note Parameters contain min_q, max_q, scaling factor for each of the
    427    *       SVC layers.
    428    *
    429    * Supported in codecs: VP9
    430    */
    431   VP9E_SET_SVC_PARAMETERS,
    432 
    433   /*!\brief Codec control function to set svc layer for spatial and temporal.
    434    * \note Valid ranges: 0..#vpx_codec_enc_cfg::ss_number_layers for spatial
    435    *                     layer and 0..#vpx_codec_enc_cfg::ts_number_layers for
    436    *                     temporal layer.
    437    *
    438    * Supported in codecs: VP9
    439    */
    440   VP9E_SET_SVC_LAYER_ID,
    441 
    442   /*!\brief Codec control function to set content type.
    443    * \note Valid parameter range:
    444    *              VP9E_CONTENT_DEFAULT = Regular video content (Default)
    445    *              VP9E_CONTENT_SCREEN  = Screen capture content
    446    *
    447    * Supported in codecs: VP9
    448    */
    449   VP9E_SET_TUNE_CONTENT,
    450 
    451   /*!\brief Codec control function to get svc layer ID.
    452    * \note The layer ID returned is for the data packet from the registered
    453    *       callback function.
    454    *
    455    * Supported in codecs: VP9
    456    */
    457   VP9E_GET_SVC_LAYER_ID,
    458 
    459   /*!\brief Codec control function to register callback to get per layer packet.
    460    * \note Parameter for this control function is a structure with a callback
    461    *       function and a pointer to private data used by the callback.
    462    *
    463    * Supported in codecs: VP9
    464    */
    465   VP9E_REGISTER_CX_CALLBACK,
    466 
    467   /*!\brief Codec control function to set color space info.
    468    * \note Valid ranges: 0..7, default is "UNKNOWN".
    469    *                     0 = UNKNOWN,
    470    *                     1 = BT_601
    471    *                     2 = BT_709
    472    *                     3 = SMPTE_170
    473    *                     4 = SMPTE_240
    474    *                     5 = BT_2020
    475    *                     6 = RESERVED
    476    *                     7 = SRGB
    477    *
    478    * Supported in codecs: VP9
    479    */
    480   VP9E_SET_COLOR_SPACE,
    481 
    482   /*!\brief Codec control function to set temporal layering mode.
    483    * \note Valid ranges: 0..3, default is "0"
    484    * (VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING).
    485    *                     0 = VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING
    486    *                     1 = VP9E_TEMPORAL_LAYERING_MODE_BYPASS
    487    *                     2 = VP9E_TEMPORAL_LAYERING_MODE_0101
    488    *                     3 = VP9E_TEMPORAL_LAYERING_MODE_0212
    489    *
    490    * Supported in codecs: VP9
    491    */
    492   VP9E_SET_TEMPORAL_LAYERING_MODE,
    493 
    494   /*!\brief Codec control function to set minimum interval between GF/ARF frames
    495    *
    496    * By default the value is set as 4.
    497    *
    498    * Supported in codecs: VP9
    499    */
    500   VP9E_SET_MIN_GF_INTERVAL,
    501 
    502   /*!\brief Codec control function to set minimum interval between GF/ARF frames
    503    *
    504    * By default the value is set as 16.
    505    *
    506    * Supported in codecs: VP9
    507    */
    508   VP9E_SET_MAX_GF_INTERVAL,
    509 
    510   /*!\brief Codec control function to get an Active map back from the encoder.
    511    *
    512    * Supported in codecs: VP9
    513    */
    514   VP9E_GET_ACTIVEMAP,
    515 
    516   /*!\brief Codec control function to set color range bit.
    517    * \note Valid ranges: 0..1, default is 0
    518    *                     0 = Limited range (16..235 or HBD equivalent)
    519    *                     1 = Full range (0..255 or HBD equivalent)
    520    *
    521    * Supported in codecs: VP9
    522    */
    523   VP9E_SET_COLOR_RANGE,
    524 
    525   /*!\brief Codec control function to set the frame flags and buffer indices
    526    * for spatial layers. The frame flags and buffer indices are set using the
    527    * struct #vpx_svc_ref_frame_config defined below.
    528    *
    529    * Supported in codecs: VP9
    530   */
    531   VP9E_SET_SVC_REF_FRAME_CONFIG,
    532 
    533   /*!\brief Codec control function to set intended rendering image size.
    534    *
    535    * By default, this is identical to the image size in pixels.
    536    *
    537    * Supported in codecs: VP9
    538    */
    539   VP9E_SET_RENDER_SIZE,
    540 
    541   /*!\brief Codec control function to set target level.
    542    *
    543    * 255: off (default); 0: only keep level stats; 10: target for level 1.0;
    544    * 11: target for level 1.1; ... 62: target for level 6.2
    545    *
    546    * Supported in codecs: VP9
    547    */
    548   VP9E_SET_TARGET_LEVEL,
    549 
    550   /*!\brief Codec control function to set row level multi-threading.
    551   *
    552   * 0 : off, 1 : on
    553   *
    554   * Supported in codecs: VP9
    555   */
    556   VP9E_SET_ROW_MT,
    557 
    558   /*!\brief Codec control function to get bitstream level.
    559    *
    560    * Supported in codecs: VP9
    561    */
    562   VP9E_GET_LEVEL,
    563 
    564   /*!\brief Codec control function to enable/disable special mode for altref
    565    *        adaptive quantization. You can use it with --aq-mode concurrently.
    566    *
    567    * Enable special adaptive quantization for altref frames based on their
    568    * expected prediction quality for the future frames.
    569    *
    570    * Supported in codecs: VP9
    571    */
    572   VP9E_SET_ALT_REF_AQ,
    573 
    574   /*!\brief Boost percentage for Golden Frame in CBR mode.
    575     *
    576     * This value controls the amount of boost given to Golden Frame in
    577     * CBR mode. It is expressed as a percentage of the average
    578     * per-frame bitrate, with the special (and default) value 0 meaning
    579     * the feature is off, i.e., no golden frame boost in CBR mode and
    580     * average bitrate target is used.
    581     *
    582     * For example, to allow 100% more bits, i.e, 2X, in a golden frame
    583     * than average frame, set this to 100.
    584     *
    585     * Supported in codecs: VP8
    586     */
    587   VP8E_SET_GF_CBR_BOOST_PCT,
    588 
    589   /*!\brief Codec control function to enable the extreme motion vector unit test
    590    * in VP9. Please note that this is only used in motion vector unit test.
    591    *
    592    * 0 : off, 1 : MAX_EXTREME_MV, 2 : MIN_EXTREME_MV
    593    *
    594    * Supported in codecs: VP9
    595    */
    596   VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST,
    597 };
    598 
    599 /*!\brief vpx 1-D scaling mode
    600  *
    601  * This set of constants define 1-D vpx scaling modes
    602  */
    603 typedef enum vpx_scaling_mode_1d {
    604   VP8E_NORMAL = 0,
    605   VP8E_FOURFIVE = 1,
    606   VP8E_THREEFIVE = 2,
    607   VP8E_ONETWO = 3
    608 } VPX_SCALING_MODE;
    609 
    610 /*!\brief Temporal layering mode enum for VP9 SVC.
    611  *
    612  * This set of macros define the different temporal layering modes.
    613  * Supported codecs: VP9 (in SVC mode)
    614  *
    615  */
    616 typedef enum vp9e_temporal_layering_mode {
    617   /*!\brief No temporal layering.
    618    * Used when only spatial layering is used.
    619    */
    620   VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING = 0,
    621 
    622   /*!\brief Bypass mode.
    623    * Used when application needs to control temporal layering.
    624    * This will only work when the number of spatial layers equals 1.
    625    */
    626   VP9E_TEMPORAL_LAYERING_MODE_BYPASS = 1,
    627 
    628   /*!\brief 0-1-0-1... temporal layering scheme with two temporal layers.
    629    */
    630   VP9E_TEMPORAL_LAYERING_MODE_0101 = 2,
    631 
    632   /*!\brief 0-2-1-2... temporal layering scheme with three temporal layers.
    633    */
    634   VP9E_TEMPORAL_LAYERING_MODE_0212 = 3
    635 } VP9E_TEMPORAL_LAYERING_MODE;
    636 
    637 /*!\brief  vpx region of interest map
    638  *
    639  * These defines the data structures for the region of interest map
    640  *
    641  */
    642 
    643 typedef struct vpx_roi_map {
    644   /*! An id between 0 and 3 for each 16x16 region within a frame. */
    645   unsigned char *roi_map;
    646   unsigned int rows; /**< Number of rows. */
    647   unsigned int cols; /**< Number of columns. */
    648   // TODO(paulwilkins): broken for VP9 which has 8 segments
    649   // q and loop filter deltas for each segment
    650   // (see MAX_MB_SEGMENTS)
    651   int delta_q[4];  /**< Quantizer deltas. */
    652   int delta_lf[4]; /**< Loop filter deltas. */
    653   /*! Static breakout threshold for each segment. */
    654   unsigned int static_threshold[4];
    655 } vpx_roi_map_t;
    656 
    657 /*!\brief  vpx active region map
    658  *
    659  * These defines the data structures for active region map
    660  *
    661  */
    662 
    663 typedef struct vpx_active_map {
    664   /*!\brief specify an on (1) or off (0) each 16x16 region within a frame */
    665   unsigned char *active_map;
    666   unsigned int rows; /**< number of rows */
    667   unsigned int cols; /**< number of cols */
    668 } vpx_active_map_t;
    669 
    670 /*!\brief  vpx image scaling mode
    671  *
    672  * This defines the data structure for image scaling mode
    673  *
    674  */
    675 typedef struct vpx_scaling_mode {
    676   VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
    677   VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode   */
    678 } vpx_scaling_mode_t;
    679 
    680 /*!\brief VP8 token partition mode
    681  *
    682  * This defines VP8 partitioning mode for compressed data, i.e., the number of
    683  * sub-streams in the bitstream. Used for parallelized decoding.
    684  *
    685  */
    686 
    687 typedef enum {
    688   VP8_ONE_TOKENPARTITION = 0,
    689   VP8_TWO_TOKENPARTITION = 1,
    690   VP8_FOUR_TOKENPARTITION = 2,
    691   VP8_EIGHT_TOKENPARTITION = 3
    692 } vp8e_token_partitions;
    693 
    694 /*!brief VP9 encoder content type */
    695 typedef enum {
    696   VP9E_CONTENT_DEFAULT,
    697   VP9E_CONTENT_SCREEN,
    698   VP9E_CONTENT_INVALID
    699 } vp9e_tune_content;
    700 
    701 /*!\brief VP8 model tuning parameters
    702  *
    703  * Changes the encoder to tune for certain types of input material.
    704  *
    705  */
    706 typedef enum { VP8_TUNE_PSNR, VP8_TUNE_SSIM } vp8e_tuning;
    707 
    708 /*!\brief  vp9 svc layer parameters
    709  *
    710  * This defines the spatial and temporal layer id numbers for svc encoding.
    711  * This is used with the #VP9E_SET_SVC_LAYER_ID control to set the spatial and
    712  * temporal layer id for the current frame.
    713  *
    714  */
    715 typedef struct vpx_svc_layer_id {
    716   int spatial_layer_id;  /**< Spatial layer id number. */
    717   int temporal_layer_id; /**< Temporal layer id number. */
    718 } vpx_svc_layer_id_t;
    719 
    720 /*!\brief  vp9 svc frame flag parameters.
    721  *
    722  * This defines the frame flags and buffer indices for each spatial layer for
    723  * svc encoding.
    724  * This is used with the #VP9E_SET_SVC_REF_FRAME_CONFIG control to set frame
    725  * flags and buffer indices for each spatial layer for the current (super)frame.
    726  *
    727  */
    728 typedef struct vpx_svc_ref_frame_config {
    729   int frame_flags[VPX_TS_MAX_LAYERS]; /**< Frame flags. */
    730   int lst_fb_idx[VPX_TS_MAX_LAYERS];  /**< Last buffer index. */
    731   int gld_fb_idx[VPX_TS_MAX_LAYERS];  /**< Golden buffer index. */
    732   int alt_fb_idx[VPX_TS_MAX_LAYERS];  /**< Altref buffer index. */
    733 } vpx_svc_ref_frame_config_t;
    734 
    735 /*!\cond */
    736 /*!\brief VP8 encoder control function parameter type
    737  *
    738  * Defines the data types that VP8E control functions take. Note that
    739  * additional common controls are defined in vp8.h
    740  *
    741  */
    742 
    743 VPX_CTRL_USE_TYPE(VP8E_SET_FRAME_FLAGS, int)
    744 #define VPX_CTRL_VP8E_SET_FRAME_FLAGS
    745 VPX_CTRL_USE_TYPE(VP8E_SET_TEMPORAL_LAYER_ID, int)
    746 #define VPX_CTRL_VP8E_SET_TEMPORAL_LAYER_ID
    747 VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
    748 #define VPX_CTRL_VP8E_SET_ROI_MAP
    749 VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
    750 #define VPX_CTRL_VP8E_SET_ACTIVEMAP
    751 VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
    752 #define VPX_CTRL_VP8E_SET_SCALEMODE
    753 
    754 VPX_CTRL_USE_TYPE(VP9E_SET_SVC, int)
    755 #define VPX_CTRL_VP9E_SET_SVC
    756 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_PARAMETERS, void *)
    757 #define VPX_CTRL_VP9E_SET_SVC_PARAMETERS
    758 VPX_CTRL_USE_TYPE(VP9E_REGISTER_CX_CALLBACK, void *)
    759 #define VPX_CTRL_VP9E_REGISTER_CX_CALLBACK
    760 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
    761 #define VPX_CTRL_VP9E_SET_SVC_LAYER_ID
    762 
    763 VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
    764 #define VPX_CTRL_VP8E_SET_CPUUSED
    765 VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
    766 #define VPX_CTRL_VP8E_SET_ENABLEAUTOALTREF
    767 VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
    768 #define VPX_CTRL_VP8E_SET_NOISE_SENSITIVITY
    769 VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
    770 #define VPX_CTRL_VP8E_SET_SHARPNESS
    771 VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
    772 #define VPX_CTRL_VP8E_SET_STATIC_THRESHOLD
    773 VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, int) /* vp8e_token_partitions */
    774 #define VPX_CTRL_VP8E_SET_TOKEN_PARTITIONS
    775 
    776 VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
    777 #define VPX_CTRL_VP8E_SET_ARNR_MAXFRAMES
    778 VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH, unsigned int)
    779 #define VPX_CTRL_VP8E_SET_ARNR_STRENGTH
    780 VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ARNR_TYPE, unsigned int)
    781 #define VPX_CTRL_VP8E_SET_ARNR_TYPE
    782 VPX_CTRL_USE_TYPE(VP8E_SET_TUNING, int) /* vp8e_tuning */
    783 #define VPX_CTRL_VP8E_SET_TUNING
    784 VPX_CTRL_USE_TYPE(VP8E_SET_CQ_LEVEL, unsigned int)
    785 #define VPX_CTRL_VP8E_SET_CQ_LEVEL
    786 
    787 VPX_CTRL_USE_TYPE(VP9E_SET_TILE_COLUMNS, int)
    788 #define VPX_CTRL_VP9E_SET_TILE_COLUMNS
    789 VPX_CTRL_USE_TYPE(VP9E_SET_TILE_ROWS, int)
    790 #define VPX_CTRL_VP9E_SET_TILE_ROWS
    791 
    792 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
    793 #define VPX_CTRL_VP8E_GET_LAST_QUANTIZER
    794 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
    795 #define VPX_CTRL_VP8E_GET_LAST_QUANTIZER_64
    796 VPX_CTRL_USE_TYPE(VP9E_GET_SVC_LAYER_ID, vpx_svc_layer_id_t *)
    797 #define VPX_CTRL_VP9E_GET_SVC_LAYER_ID
    798 
    799 VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTRA_BITRATE_PCT, unsigned int)
    800 #define VPX_CTRL_VP8E_SET_MAX_INTRA_BITRATE_PCT
    801 VPX_CTRL_USE_TYPE(VP8E_SET_MAX_INTER_BITRATE_PCT, unsigned int)
    802 #define VPX_CTRL_VP8E_SET_MAX_INTER_BITRATE_PCT
    803 
    804 VPX_CTRL_USE_TYPE(VP8E_SET_GF_CBR_BOOST_PCT, unsigned int)
    805 #define VPX_CTRL_VP8E_SET_GF_CBR_BOOST_PCT
    806 
    807 VPX_CTRL_USE_TYPE(VP8E_SET_SCREEN_CONTENT_MODE, unsigned int)
    808 #define VPX_CTRL_VP8E_SET_SCREEN_CONTENT_MODE
    809 
    810 VPX_CTRL_USE_TYPE(VP9E_SET_GF_CBR_BOOST_PCT, unsigned int)
    811 #define VPX_CTRL_VP9E_SET_GF_CBR_BOOST_PCT
    812 
    813 VPX_CTRL_USE_TYPE(VP9E_SET_LOSSLESS, unsigned int)
    814 #define VPX_CTRL_VP9E_SET_LOSSLESS
    815 
    816 VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PARALLEL_DECODING, unsigned int)
    817 #define VPX_CTRL_VP9E_SET_FRAME_PARALLEL_DECODING
    818 
    819 VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
    820 #define VPX_CTRL_VP9E_SET_AQ_MODE
    821 
    822 VPX_CTRL_USE_TYPE(VP9E_SET_ALT_REF_AQ, int)
    823 #define VPX_CTRL_VP9E_SET_ALT_REF_AQ
    824 
    825 VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
    826 #define VPX_CTRL_VP9E_SET_FRAME_PERIODIC_BOOST
    827 
    828 VPX_CTRL_USE_TYPE(VP9E_SET_NOISE_SENSITIVITY, unsigned int)
    829 #define VPX_CTRL_VP9E_SET_NOISE_SENSITIVITY
    830 
    831 VPX_CTRL_USE_TYPE(VP9E_SET_TUNE_CONTENT, int) /* vp9e_tune_content */
    832 #define VPX_CTRL_VP9E_SET_TUNE_CONTENT
    833 
    834 VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_SPACE, int)
    835 #define VPX_CTRL_VP9E_SET_COLOR_SPACE
    836 
    837 VPX_CTRL_USE_TYPE(VP9E_SET_MIN_GF_INTERVAL, unsigned int)
    838 #define VPX_CTRL_VP9E_SET_MIN_GF_INTERVAL
    839 
    840 VPX_CTRL_USE_TYPE(VP9E_SET_MAX_GF_INTERVAL, unsigned int)
    841 #define VPX_CTRL_VP9E_SET_MAX_GF_INTERVAL
    842 
    843 VPX_CTRL_USE_TYPE(VP9E_GET_ACTIVEMAP, vpx_active_map_t *)
    844 #define VPX_CTRL_VP9E_GET_ACTIVEMAP
    845 
    846 VPX_CTRL_USE_TYPE(VP9E_SET_COLOR_RANGE, int)
    847 #define VPX_CTRL_VP9E_SET_COLOR_RANGE
    848 
    849 VPX_CTRL_USE_TYPE(VP9E_SET_SVC_REF_FRAME_CONFIG, vpx_svc_ref_frame_config_t *)
    850 #define VPX_CTRL_VP9E_SET_SVC_REF_FRAME_CONFIG
    851 
    852 VPX_CTRL_USE_TYPE(VP9E_SET_RENDER_SIZE, int *)
    853 #define VPX_CTRL_VP9E_SET_RENDER_SIZE
    854 
    855 VPX_CTRL_USE_TYPE(VP9E_SET_TARGET_LEVEL, unsigned int)
    856 #define VPX_CTRL_VP9E_SET_TARGET_LEVEL
    857 
    858 VPX_CTRL_USE_TYPE(VP9E_SET_ROW_MT, unsigned int)
    859 #define VPX_CTRL_VP9E_SET_ROW_MT
    860 
    861 VPX_CTRL_USE_TYPE(VP9E_GET_LEVEL, int *)
    862 #define VPX_CTRL_VP9E_GET_LEVEL
    863 
    864 VPX_CTRL_USE_TYPE(VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST, unsigned int)
    865 #define VPX_CTRL_VP9E_ENABLE_MOTION_VECTOR_UNIT_TEST
    866 
    867 /*!\endcond */
    868 /*! @} - end defgroup vp8_encoder */
    869 #ifdef __cplusplus
    870 }  // extern "C"
    871 #endif
    872 
    873 #endif  // VPX_VP8CX_H_
    874