Home | History | Annotate | Download | only in videoencoder
      1 /*
      2 * Copyright (c) 2009-2011 Intel Corporation.  All rights reserved.
      3 *
      4 * Licensed under the Apache License, Version 2.0 (the "License");
      5 * you may not use this file except in compliance with the License.
      6 * You may obtain a copy of the License at
      7 *
      8 * http://www.apache.org/licenses/LICENSE-2.0
      9 *
     10 * Unless required by applicable law or agreed to in writing, software
     11 * distributed under the License is distributed on an "AS IS" BASIS,
     12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 * See the License for the specific language governing permissions and
     14 * limitations under the License.
     15 */
     16 
     17 #ifndef __VIDEO_ENCODER_DEF_H__
     18 #define __VIDEO_ENCODER_DEF_H__
     19 
     20 #include <stdint.h>
     21 
     22 #define STRING_TO_FOURCC(format) ((uint32_t)(((format)[0])|((format)[1]<<8)|((format)[2]<<16)|((format)[3]<<24)))
     23 #define min(X,Y) (((X) < (Y)) ? (X) : (Y))
     24 #define max(X,Y) (((X) > (Y)) ? (X) : (Y))
     25 
     26 typedef int32_t Encode_Status;
     27 
     28 // Video encode error code
     29 enum {
     30     ENCODE_INVALID_SURFACE = -11,
     31     ENCODE_NO_REQUEST_DATA = -10,
     32     ENCODE_WRONG_STATE = -9,
     33     ENCODE_NOTIMPL = -8,
     34     ENCODE_NO_MEMORY = -7,
     35     ENCODE_NOT_INIT = -6,
     36     ENCODE_DRIVER_FAIL = -5,
     37     ENCODE_INVALID_PARAMS = -4,
     38     ENCODE_NOT_SUPPORTED = -3,
     39     ENCODE_NULL_PTR = -2,
     40     ENCODE_FAIL = -1,
     41     ENCODE_SUCCESS = 0,
     42     ENCODE_ALREADY_INIT = 1,
     43     ENCODE_SLICESIZE_OVERFLOW = 2,
     44     ENCODE_BUFFER_TOO_SMALL = 3, // The buffer passed to encode is too small to contain encoded data
     45     ENCODE_DEVICE_BUSY = 4,
     46     ENCODE_DATA_NOT_READY = 5,
     47 };
     48 
     49 typedef enum {
     50     OUTPUT_EVERYTHING = 0,  //Output whatever driver generates
     51     OUTPUT_CODEC_DATA = 1,
     52     OUTPUT_FRAME_DATA = 2, //Equal to OUTPUT_EVERYTHING when no header along with the frame data
     53     OUTPUT_ONE_NAL = 4,
     54     OUTPUT_ONE_NAL_WITHOUT_STARTCODE = 8,
     55     OUTPUT_LENGTH_PREFIXED = 16,
     56     OUTPUT_CODEDBUFFER = 32,
     57     OUTPUT_NALULENGTHS_PREFIXED = 64,
     58     OUTPUT_BUFFER_LAST
     59 } VideoOutputFormat;
     60 
     61 typedef enum {
     62     RAW_FORMAT_NONE = 0,
     63     RAW_FORMAT_YUV420 = 1,
     64     RAW_FORMAT_YUV422 = 2,
     65     RAW_FORMAT_YUV444 = 4,
     66     RAW_FORMAT_NV12 = 8,
     67     RAW_FORMAT_RGBA = 16,
     68     RAW_FORMAT_OPAQUE = 32,
     69     RAW_FORMAT_PROTECTED = 0x80000000,
     70     RAW_FORMAT_LAST
     71 } VideoRawFormat;
     72 
     73 typedef enum {
     74     RATE_CONTROL_NONE = 1,
     75     RATE_CONTROL_CBR = 2,
     76     RATE_CONTROL_VBR = 4,
     77     RATE_CONTROL_VCM = 8,
     78     RATE_CONTROL_LAST
     79 } VideoRateControl;
     80 
     81 typedef enum {
     82     PROFILE_MPEG2SIMPLE = 0,
     83     PROFILE_MPEG2MAIN,
     84     PROFILE_MPEG4SIMPLE,
     85     PROFILE_MPEG4ADVANCEDSIMPLE,
     86     PROFILE_MPEG4MAIN,
     87     PROFILE_H264BASELINE,
     88     PROFILE_H264MAIN,
     89     PROFILE_H264HIGH,
     90     PROFILE_VC1SIMPLE,
     91     PROFILE_VC1MAIN,
     92     PROFILE_VC1ADVANCED,
     93     PROFILE_H263BASELINE
     94 } VideoProfile;
     95 
     96 typedef enum {
     97     AVC_DELIMITER_LENGTHPREFIX = 0,
     98     AVC_DELIMITER_ANNEXB
     99 } AVCDelimiterType;
    100 
    101 typedef enum {
    102     VIDEO_ENC_NONIR,       // Non intra refresh
    103     VIDEO_ENC_CIR, 		// Cyclic intra refresh
    104     VIDEO_ENC_AIR, 		// Adaptive intra refresh
    105     VIDEO_ENC_BOTH,
    106     VIDEO_ENC_LAST
    107 } VideoIntraRefreshType;
    108 
    109 enum VideoBufferSharingMode {
    110     BUFFER_SHARING_NONE = 1, //Means non shared buffer mode
    111     BUFFER_SHARING_CI = 2,
    112     BUFFER_SHARING_V4L2 = 4,
    113     BUFFER_SHARING_SURFACE = 8,
    114     BUFFER_SHARING_USRPTR = 16,
    115     BUFFER_SHARING_GFXHANDLE = 32,
    116     BUFFER_SHARING_KBUFHANDLE = 64,
    117     BUFFER_LAST
    118 };
    119 
    120 typedef enum {
    121     FTYPE_UNKNOWN = 0, // Unknown
    122     FTYPE_I = 1, // General I-frame type
    123     FTYPE_P = 2, // General P-frame type
    124     FTYPE_B = 3, // General B-frame type
    125     FTYPE_SI = 4, // H.263 SI-frame type
    126     FTYPE_SP = 5, // H.263 SP-frame type
    127     FTYPE_EI = 6, // H.264 EI-frame type
    128     FTYPE_EP = 7, // H.264 EP-frame type
    129     FTYPE_S = 8, // MPEG-4 S-frame type
    130     FTYPE_IDR = 9, // IDR-frame type
    131 }FrameType;
    132 
    133 //function call mode
    134 #define FUNC_BLOCK        0xFFFFFFFF
    135 #define FUNC_NONBLOCK        0
    136 
    137 // Output buffer flag
    138 #define ENCODE_BUFFERFLAG_ENDOFFRAME       0x00000001
    139 #define ENCODE_BUFFERFLAG_PARTIALFRAME     0x00000002
    140 #define ENCODE_BUFFERFLAG_SYNCFRAME        0x00000004
    141 #define ENCODE_BUFFERFLAG_CODECCONFIG      0x00000008
    142 #define ENCODE_BUFFERFLAG_DATACORRUPT      0x00000010
    143 #define ENCODE_BUFFERFLAG_DATAINVALID      0x00000020
    144 #define ENCODE_BUFFERFLAG_SLICEOVERFOLOW   0x00000040
    145 #define ENCODE_BUFFERFLAG_ENDOFSTREAM     0x00000080
    146 #define ENCODE_BUFFERFLAG_NSTOPFRAME        0x00000100
    147 
    148 typedef struct {
    149     uint8_t *data;
    150     uint32_t bufferSize; //buffer size
    151     uint32_t dataSize; //actual size
    152     uint32_t offset; //buffer offset
    153     uint32_t remainingSize;
    154     int flag; //Key frame, Codec Data etc
    155     VideoOutputFormat format; //output format
    156     int64_t timeStamp; //reserved
    157     FrameType type;
    158     void *priv; //indicate corresponding input data
    159 } VideoEncOutputBuffer;
    160 
    161 typedef struct {
    162     uint8_t *data;
    163     uint32_t size;
    164     bool bufAvailable; //To indicate whether this buffer can be reused
    165     int64_t timeStamp; //reserved
    166     FrameType type; //frame type expected to be encoded
    167     int flag; // flag to indicate buffer property
    168     void *priv; //indicate corresponding input data
    169 } VideoEncRawBuffer;
    170 
    171 struct VideoEncSurfaceBuffer {
    172     VASurfaceID surface;
    173     uint8_t *usrptr;
    174     uint32_t index;
    175     bool bufAvailable;
    176     VideoEncSurfaceBuffer *next;
    177 };
    178 
    179 struct CirParams {
    180     uint32_t cir_num_mbs;
    181 
    182     CirParams &operator=(const CirParams &other) {
    183         if (this == &other) return *this;
    184 
    185         this->cir_num_mbs = other.cir_num_mbs;
    186         return *this;
    187     }
    188 };
    189 
    190 struct AirParams {
    191     uint32_t airMBs;
    192     uint32_t airThreshold;
    193     uint32_t airAuto;
    194 
    195     AirParams &operator=(const AirParams &other) {
    196         if (this == &other) return *this;
    197 
    198         this->airMBs= other.airMBs;
    199         this->airThreshold= other.airThreshold;
    200         this->airAuto = other.airAuto;
    201         return *this;
    202     }
    203 };
    204 
    205 struct VideoFrameRate {
    206     uint32_t frameRateNum;
    207     uint32_t frameRateDenom;
    208 
    209     VideoFrameRate &operator=(const VideoFrameRate &other) {
    210         if (this == &other) return *this;
    211 
    212         this->frameRateNum = other.frameRateNum;
    213         this->frameRateDenom = other.frameRateDenom;
    214         return *this;
    215     }
    216 };
    217 
    218 struct VideoResolution {
    219     uint32_t width;
    220     uint32_t height;
    221 
    222     VideoResolution &operator=(const VideoResolution &other) {
    223         if (this == &other) return *this;
    224 
    225         this->width = other.width;
    226         this->height = other.height;
    227         return *this;
    228     }
    229 };
    230 
    231 struct VideoRateControlParams {
    232     uint32_t bitRate;
    233     uint32_t initQP;
    234     uint32_t minQP;
    235     uint32_t maxQP;
    236     uint32_t I_minQP;
    237     uint32_t I_maxQP;
    238     uint32_t windowSize;
    239     uint32_t targetPercentage;
    240     uint32_t disableFrameSkip;
    241     uint32_t disableBitsStuffing;
    242     uint32_t enableIntraFrameQPControl;
    243     uint32_t temporalFrameRate;
    244     uint32_t temporalID;
    245 
    246     VideoRateControlParams &operator=(const VideoRateControlParams &other) {
    247         if (this == &other) return *this;
    248 
    249         this->bitRate = other.bitRate;
    250         this->initQP = other.initQP;
    251         this->minQP = other.minQP;
    252         this->maxQP = other.maxQP;
    253         this->I_minQP = other.I_minQP;
    254         this->I_maxQP = other.I_maxQP;
    255         this->windowSize = other.windowSize;
    256         this->targetPercentage = other.targetPercentage;
    257         this->disableFrameSkip = other.disableFrameSkip;
    258         this->disableBitsStuffing = other.disableBitsStuffing;
    259         this->enableIntraFrameQPControl = other.enableIntraFrameQPControl;
    260         this->temporalFrameRate = other.temporalFrameRate;
    261         this->temporalID = other.temporalID;
    262 
    263         return *this;
    264     }
    265 };
    266 
    267 struct SliceNum {
    268     uint32_t iSliceNum;
    269     uint32_t pSliceNum;
    270 
    271     SliceNum &operator=(const SliceNum &other) {
    272         if (this == &other) return *this;
    273 
    274         this->iSliceNum = other.iSliceNum;
    275         this->pSliceNum= other.pSliceNum;
    276         return *this;
    277     }
    278 };
    279 
    280 typedef struct {
    281     uint32_t realWidth;
    282     uint32_t realHeight;
    283     uint32_t lumaStride;
    284     uint32_t chromStride;
    285     uint32_t format;
    286 } ExternalBufferAttrib;
    287 
    288 struct Cropping {
    289     uint32_t LeftOffset;
    290     uint32_t RightOffset;
    291     uint32_t TopOffset;
    292     uint32_t BottomOffset;
    293 
    294     Cropping &operator=(const Cropping &other) {
    295         if (this == &other) return *this;
    296 
    297         this->LeftOffset = other.LeftOffset;
    298         this->RightOffset = other.RightOffset;
    299         this->TopOffset = other.TopOffset;
    300         this->BottomOffset = other.BottomOffset;
    301         return *this;
    302     }
    303 };
    304 
    305 struct SamplingAspectRatio {
    306     uint16_t SarWidth;
    307     uint16_t SarHeight;
    308 
    309     SamplingAspectRatio &operator=(const SamplingAspectRatio &other) {
    310         if (this == &other) return *this;
    311 
    312         this->SarWidth = other.SarWidth;
    313         this->SarHeight = other.SarHeight;
    314         return *this;
    315     }
    316 };
    317 
    318 enum VideoParamConfigType {
    319     VideoParamsTypeStartUnused = 0x01000000,
    320     VideoParamsTypeCommon,
    321     VideoParamsTypeAVC,
    322     VideoParamsTypeH263,
    323     VideoParamsTypeMP4,
    324     VideoParamsTypeVC1,
    325     VideoParamsTypeUpSteamBuffer,
    326     VideoParamsTypeUsrptrBuffer,
    327     VideoParamsTypeHRD,
    328     VideoParamsTypeStoreMetaDataInBuffers,
    329     VideoParamsTypeProfileLevel,
    330     VideoParamsTypeVP8,
    331     VideoParamsTypeTemporalLayer,
    332 
    333     VideoConfigTypeFrameRate,
    334     VideoConfigTypeBitRate,
    335     VideoConfigTypeResolution,
    336     VideoConfigTypeIntraRefreshType,
    337     VideoConfigTypeAIR,
    338     VideoConfigTypeCyclicFrameInterval,
    339     VideoConfigTypeAVCIntraPeriod,
    340     VideoConfigTypeNALSize,
    341     VideoConfigTypeIDRRequest,
    342     VideoConfigTypeSliceNum,
    343     VideoConfigTypeVP8,
    344     VideoConfigTypeVP8ReferenceFrame,
    345     VideoConfigTypeCIR,
    346     VideoConfigTypeVP8MaxFrameSizeRatio,
    347     VideoConfigTypeTemperalLayerBitrateFramerate,
    348 
    349     VideoParamsConfigExtension
    350 };
    351 
    352 struct VideoParamConfigSet {
    353     VideoParamConfigType type;
    354     uint32_t size;
    355 
    356     VideoParamConfigSet &operator=(const VideoParamConfigSet &other) {
    357         if (this == &other) return *this;
    358         this->type = other.type;
    359         this->size = other.size;
    360         return *this;
    361     }
    362 };
    363 
    364 struct VideoParamsCommon : VideoParamConfigSet {
    365 
    366     VAProfile profile;
    367     uint8_t level;
    368     VideoRawFormat rawFormat;
    369     VideoResolution resolution;
    370     VideoFrameRate frameRate;
    371     int32_t intraPeriod;
    372     VideoRateControl rcMode;
    373     VideoRateControlParams rcParams;
    374     VideoIntraRefreshType refreshType;
    375     int32_t cyclicFrameInterval;
    376     AirParams airParams;
    377     CirParams cirParams;
    378     uint32_t disableDeblocking;
    379     bool syncEncMode;
    380     //CodedBuffer properties
    381     uint32_t codedBufNum;
    382     uint32_t numberOfLayer;
    383     uint32_t nPeriodicity;
    384     uint32_t nLayerID[32];
    385 
    386     VideoParamsCommon() {
    387         type = VideoParamsTypeCommon;
    388         size = sizeof(VideoParamsCommon);
    389     }
    390 
    391     VideoParamsCommon &operator=(const VideoParamsCommon &other) {
    392         if (this == &other) return *this;
    393 
    394         VideoParamConfigSet::operator=(other);
    395         this->profile = other.profile;
    396         this->level = other.level;
    397         this->rawFormat = other.rawFormat;
    398         this->resolution = other.resolution;
    399         this->frameRate = other.frameRate;
    400         this->intraPeriod = other.intraPeriod;
    401         this->rcMode = other.rcMode;
    402         this->rcParams = other.rcParams;
    403         this->refreshType = other.refreshType;
    404         this->cyclicFrameInterval = other.cyclicFrameInterval;
    405         this->airParams = other.airParams;
    406         this->disableDeblocking = other.disableDeblocking;
    407         this->syncEncMode = other.syncEncMode;
    408         this->codedBufNum = other.codedBufNum;
    409         this->numberOfLayer = other.numberOfLayer;
    410         return *this;
    411     }
    412 };
    413 
    414 struct VideoParamsAVC : VideoParamConfigSet {
    415     uint32_t basicUnitSize;  //for rate control
    416     uint8_t VUIFlag;
    417     int32_t maxSliceSize;
    418     uint32_t idrInterval;
    419     uint32_t ipPeriod;
    420     uint32_t refFrames;
    421     SliceNum sliceNum;
    422     AVCDelimiterType delimiterType;
    423     Cropping crop;
    424     SamplingAspectRatio SAR;
    425     uint32_t refIdx10ActiveMinus1;
    426     uint32_t refIdx11ActiveMinus1;
    427     bool bFrameMBsOnly;
    428     bool bMBAFF;
    429     bool bEntropyCodingCABAC;
    430     bool bWeightedPPrediction;
    431     uint32_t weightedBipredicitonMode;
    432     bool bConstIpred ;
    433     bool bDirect8x8Inference;
    434     bool bDirectSpatialTemporal;
    435     uint32_t cabacInitIdc;
    436 
    437     VideoParamsAVC() {
    438         type = VideoParamsTypeAVC;
    439         size = sizeof(VideoParamsAVC);
    440     }
    441 
    442     VideoParamsAVC &operator=(const VideoParamsAVC &other) {
    443         if (this == &other) return *this;
    444 
    445         VideoParamConfigSet::operator=(other);
    446         this->basicUnitSize = other.basicUnitSize;
    447         this->VUIFlag = other.VUIFlag;
    448         this->maxSliceSize = other.maxSliceSize;
    449         this->idrInterval = other.idrInterval;
    450         this->ipPeriod = other.ipPeriod;
    451         this->refFrames = other.refFrames;
    452         this->sliceNum = other.sliceNum;
    453         this->delimiterType = other.delimiterType;
    454         this->crop.LeftOffset = other.crop.LeftOffset;
    455         this->crop.RightOffset = other.crop.RightOffset;
    456         this->crop.TopOffset = other.crop.TopOffset;
    457         this->crop.BottomOffset = other.crop.BottomOffset;
    458         this->SAR.SarWidth = other.SAR.SarWidth;
    459         this->SAR.SarHeight = other.SAR.SarHeight;
    460 
    461         this->refIdx10ActiveMinus1 = other.refIdx10ActiveMinus1;
    462         this->refIdx11ActiveMinus1 = other.refIdx11ActiveMinus1;
    463         this->bFrameMBsOnly = other.bFrameMBsOnly;
    464         this->bMBAFF = other.bMBAFF;
    465         this->bEntropyCodingCABAC = other.bEntropyCodingCABAC;
    466         this->bWeightedPPrediction = other.bWeightedPPrediction;
    467         this->weightedBipredicitonMode = other.weightedBipredicitonMode;
    468         this->bConstIpred = other.bConstIpred;
    469         this->bDirect8x8Inference = other.bDirect8x8Inference;
    470         this->bDirectSpatialTemporal = other.bDirectSpatialTemporal;
    471         this->cabacInitIdc = other.cabacInitIdc;
    472         return *this;
    473     }
    474 };
    475 
    476 struct VideoParamsUpstreamBuffer : VideoParamConfigSet {
    477 
    478     VideoParamsUpstreamBuffer() {
    479         type = VideoParamsTypeUpSteamBuffer;
    480         size = sizeof(VideoParamsUpstreamBuffer);
    481     }
    482 
    483     VideoBufferSharingMode bufferMode;
    484     intptr_t *bufList;
    485     uint32_t bufCnt;
    486     ExternalBufferAttrib *bufAttrib;
    487     void *display;
    488 };
    489 
    490 struct VideoParamsUsrptrBuffer : VideoParamConfigSet {
    491 
    492     VideoParamsUsrptrBuffer() {
    493         type = VideoParamsTypeUsrptrBuffer;
    494         size = sizeof(VideoParamsUsrptrBuffer);
    495     }
    496 
    497     //input
    498     uint32_t width;
    499     uint32_t height;
    500     uint32_t format;
    501     uint32_t expectedSize;
    502 
    503     //output
    504     uint32_t actualSize;
    505     uint32_t stride;
    506     uint8_t *usrPtr;
    507 };
    508 
    509 struct VideoParamsHRD : VideoParamConfigSet {
    510 
    511     VideoParamsHRD() {
    512         type = VideoParamsTypeHRD;
    513         size = sizeof(VideoParamsHRD);
    514     }
    515 
    516     uint32_t bufferSize;
    517     uint32_t initBufferFullness;
    518 };
    519 
    520 struct VideoParamsStoreMetaDataInBuffers : VideoParamConfigSet {
    521 
    522     VideoParamsStoreMetaDataInBuffers() {
    523         type = VideoParamsTypeStoreMetaDataInBuffers;
    524         size = sizeof(VideoParamsStoreMetaDataInBuffers);
    525     }
    526 
    527     bool isEnabled;
    528 };
    529 
    530 struct VideoParamsProfileLevel : VideoParamConfigSet {
    531 
    532     VideoParamsProfileLevel() {
    533         type = VideoParamsTypeProfileLevel;
    534         size = sizeof(VideoParamsProfileLevel);
    535     }
    536 
    537     VAProfile profile;
    538     uint32_t level;
    539     bool isSupported;
    540 };
    541 
    542 struct VideoParamsTemporalLayer : VideoParamConfigSet {
    543 
    544     VideoParamsTemporalLayer() {
    545         type = VideoParamsTypeTemporalLayer;
    546         size = sizeof(VideoParamsTemporalLayer);
    547     }
    548 
    549     uint32_t numberOfLayer;
    550     uint32_t nPeriodicity;
    551     uint32_t nLayerID[32];
    552 };
    553 
    554 
    555 struct VideoConfigFrameRate : VideoParamConfigSet {
    556 
    557     VideoConfigFrameRate() {
    558         type = VideoConfigTypeFrameRate;
    559         size = sizeof(VideoConfigFrameRate);
    560     }
    561 
    562     VideoFrameRate frameRate;
    563 };
    564 
    565 struct VideoConfigBitRate : VideoParamConfigSet {
    566 
    567     VideoConfigBitRate() {
    568         type = VideoConfigTypeBitRate;
    569         size = sizeof(VideoConfigBitRate);
    570     }
    571 
    572     VideoRateControlParams rcParams;
    573 };
    574 
    575 struct VideoConfigAVCIntraPeriod : VideoParamConfigSet {
    576 
    577     VideoConfigAVCIntraPeriod() {
    578         type = VideoConfigTypeAVCIntraPeriod;
    579         size = sizeof(VideoConfigAVCIntraPeriod);
    580     }
    581 
    582     uint32_t idrInterval;  //How many Intra frame will have a IDR frame
    583     uint32_t intraPeriod;
    584     uint32_t ipPeriod;
    585 };
    586 
    587 struct VideoConfigNALSize : VideoParamConfigSet {
    588 
    589     VideoConfigNALSize() {
    590         type = VideoConfigTypeNALSize;
    591         size = sizeof(VideoConfigNALSize);
    592     }
    593 
    594     uint32_t maxSliceSize;
    595 };
    596 
    597 struct VideoConfigResolution : VideoParamConfigSet {
    598 
    599     VideoConfigResolution() {
    600         type = VideoConfigTypeResolution;
    601         size = sizeof(VideoConfigResolution);
    602     }
    603 
    604     VideoResolution resolution;
    605 };
    606 
    607 struct VideoConfigIntraRefreshType : VideoParamConfigSet {
    608 
    609     VideoConfigIntraRefreshType() {
    610         type = VideoConfigTypeIntraRefreshType;
    611         size = sizeof(VideoConfigIntraRefreshType);
    612     }
    613 
    614     VideoIntraRefreshType refreshType;
    615 };
    616 
    617 struct VideoConfigCyclicFrameInterval : VideoParamConfigSet {
    618 
    619     VideoConfigCyclicFrameInterval() {
    620         type = VideoConfigTypeCyclicFrameInterval;
    621         size = sizeof(VideoConfigCyclicFrameInterval);
    622     }
    623 
    624     int32_t cyclicFrameInterval;
    625 };
    626 
    627 struct VideoConfigCIR : VideoParamConfigSet {
    628 
    629     VideoConfigCIR() {
    630         type = VideoConfigTypeCIR;
    631         size = sizeof(VideoConfigCIR);
    632     }
    633 
    634     CirParams cirParams;
    635 };
    636 
    637 struct VideoConfigAIR : VideoParamConfigSet {
    638 
    639     VideoConfigAIR() {
    640         type = VideoConfigTypeAIR;
    641         size = sizeof(VideoConfigAIR);
    642     }
    643 
    644     AirParams airParams;
    645 };
    646 
    647 struct VideoConfigSliceNum : VideoParamConfigSet {
    648 
    649     VideoConfigSliceNum() {
    650         type = VideoConfigTypeSliceNum;
    651         size = sizeof(VideoConfigSliceNum);
    652     }
    653 
    654     SliceNum sliceNum;
    655 };
    656 
    657 struct VideoParamsVP8 : VideoParamConfigSet {
    658 
    659         uint32_t profile;
    660         uint32_t error_resilient;
    661         uint32_t num_token_partitions;
    662         uint32_t kf_auto;
    663         uint32_t kf_min_dist;
    664         uint32_t kf_max_dist;
    665         uint32_t min_qp;
    666         uint32_t max_qp;
    667         uint32_t init_qp;
    668         uint32_t rc_undershoot;
    669         uint32_t rc_overshoot;
    670         uint32_t hrd_buf_size;
    671         uint32_t hrd_buf_initial_fullness;
    672         uint32_t hrd_buf_optimal_fullness;
    673         uint32_t max_frame_size_ratio;
    674 
    675         VideoParamsVP8() {
    676                 type = VideoParamsTypeVP8;
    677                 size = sizeof(VideoParamsVP8);
    678         }
    679 };
    680 
    681 struct VideoConfigVP8 : VideoParamConfigSet {
    682 
    683         uint32_t force_kf;
    684         uint32_t refresh_entropy_probs;
    685         uint32_t value;
    686         unsigned char sharpness_level;
    687 
    688         VideoConfigVP8 () {
    689                 type = VideoConfigTypeVP8;
    690                 size = sizeof(VideoConfigVP8);
    691         }
    692 };
    693 
    694 struct VideoConfigVP8ReferenceFrame : VideoParamConfigSet {
    695 
    696         uint32_t no_ref_last;
    697         uint32_t no_ref_gf;
    698         uint32_t no_ref_arf;
    699         uint32_t refresh_last;
    700         uint32_t refresh_golden_frame;
    701         uint32_t refresh_alternate_frame;
    702 
    703         VideoConfigVP8ReferenceFrame () {
    704                 type = VideoConfigTypeVP8ReferenceFrame;
    705                 size = sizeof(VideoConfigVP8ReferenceFrame);
    706         }
    707 };
    708 
    709 struct VideoConfigVP8MaxFrameSizeRatio : VideoParamConfigSet {
    710 
    711     VideoConfigVP8MaxFrameSizeRatio() {
    712         type = VideoConfigTypeVP8MaxFrameSizeRatio;
    713         size = sizeof(VideoConfigVP8MaxFrameSizeRatio);
    714     }
    715 
    716     uint32_t max_frame_size_ratio;
    717 };
    718 
    719 struct VideoConfigTemperalLayerBitrateFramerate : VideoParamConfigSet {
    720 
    721        VideoConfigTemperalLayerBitrateFramerate() {
    722                 type = VideoConfigTypeTemperalLayerBitrateFramerate;
    723                 size = sizeof(VideoConfigTemperalLayerBitrateFramerate);
    724         }
    725 
    726         uint32_t nLayerID;
    727         uint32_t bitRate;
    728         uint32_t frameRate;
    729 };
    730 
    731 #endif /*  __VIDEO_ENCODER_DEF_H__ */
    732