TypesAndStructures - sijchen/openh264 GitHub Wiki

SVC Encoding Parameters extention.

Name Type Descritpion
iUsageType EUsageType application type;1.CAMERA_VIDEO_REAL_TIME:camera video signal;2.SCREEN_CONTENT_REAL_TIME:screen content signal;
iPicWidth int width of picture in luminance samples (the maximum of all layers if multiple spatial layers presents)
iPicHeight int height of picture in luminance samples((the maximum of all layers if multiple spatial layers presents)
iTargetBitrate int target bitrate desired
iRCMode RC_MODES rate control mode
fMaxFrameRate float maximal input frame rate
iTemporalLayerNum int temporal layer number, max temporal layer = 4
iSpatialLayerNum int spatial layer number,1<= iSpatialLayerNum <= MAX_SPATIAL_LAYER_NUM, MAX_SPATIAL_LAYER_NUM = 4
sSpatialLayers SSpatialLayerConfig  
iComplexityMode ECOMPLEXITY_MODE  
uiIntraPeriod unsigned int period of Intra frame
iNumRefFrame int number of reference frame used
eSpsPpsIdStrategy EParameterSetStrategy different stategy in adjust ID in SPS/PPS: 0- constant ID, 1-additional ID, 6-mapping and additional
bPrefixNalAddingCtrl bool false:not use Prefix NAL; true: use Prefix NAL
bEnableSSEI bool

false:not use SSEI; true: use SSEI

TODO: planning to remove the interface of SSEI

bSimulcastAVC bool

(when encoding more than 1 spatial layer) false: use SVC syntax for higher layers; true: use Simulcast AVC

coming soon

iPaddingFlag int 0:disable padding;1:padding
iEntropyCodingModeFlag int 0:CAVLC 1:CABAC.
bEnableFrameSkip bool False: don't skip frame even if VBV buffer overflow.True: allow skipping frames to keep the bitrate within limits.
iMaxBitrate int the maximum bitrate
iMaxQp int the maximum QP encoder supports
iMinQp int the minmum QP encoder supports
uiMaxNalSize unsigned int the maximum NAL size. This value should be not 0 for dynamic slice mode
bEnableLongTermReference bool 1: on, 0: off
iLTRRefNum int the number of LTR(long term reference),TODO: not supported to set it arbitrary yet
iLtrMarkPeriod unsigned int the LTR marked period that is used in feedback.
iMultipleThreadIdc unsigned short 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; lager than 1: count number of threads;
iLoopFilterDisableIdc int 0: on, 1: off, 2: on except for slice boundaries
iLoopFilterAlphaC0Offset int AlphaOffset: valid range [-6, 6], default 0.
iLoopFilterBetaOffset int BetaOffset: valid range [-6, 6], default 0.
bEnableDenoise bool denoise control
bEnableBackgroundDetection bool background detection control //VAA_BACKGROUND_DETECTION //BGD cmd
bEnableAdaptiveQuant bool adaptive quantization control
bEnableFrameCroppingFlag bool enable frame cropping flag: TRUE always in application
bEnableSceneChangeDetect bool  
bIsLosslessLink bool LTR advanced setting.

Option types introduced in decoder application.

Name Initializer Descritpion
DECODER_OPTION_DATAFORMAT = 0 color format, now supports 23 only (I420)
DECODER_OPTION_END_OF_STREAM   end of stream flag
DECODER_OPTION_VCL_NAL   feedback whether or not have VCL NAL in current AU for application layer
DECODER_OPTION_TEMPORAL_ID   feedback temporal id for application layer
DECODER_OPTION_FRAME_NUM   feedback current decoded frame number
DECODER_OPTION_IDR_PIC_ID   feedback current frame belong to which IDR period
DECODER_OPTION_LTR_MARKING_FLAG   feedback wether current frame mark a LTR
DECODER_OPTION_LTR_MARKED_FRAME_NUM   feedback frame num marked by current Frame
DECODER_OPTION_ERROR_CON_IDC   not finished yet, indicate decoder error concealment status, in progress
DECODER_OPTION_TRACE_LEVEL    
DECODER_OPTION_TRACE_CALLBACK   a void (*)(void* context, int level, const char* message) function which receives log messages
DECODER_OPTION_TRACE_CALLBACK_CONTEXT   context info of trace callbac
DECODER_OPTION_GET_STATISTICS    

SVC Decoding Parameters, reserved here and potential applicable in the future.

Name Type Descritpion
pFileNameRestructed char * file name of reconstructed frame used for PSNR calculation based debug
eOutputColorFormat EVideoFormatType color space format to be outputed, EVideoFormatType specified in codec_def.h
uiCpuLoad unsigned int CPU load.
uiTargetDqLayer unsigned char setting target dq layer id
eEcActiveIdc ERROR_CON_IDC whether active error concealment feature in decoder
bParseOnly bool decoder for parse only, no reconstruction. When it is true, SPS/PPS size should not exceed SPS_PPS_BS_SIZE (128). Otherwise, it will return error info
sVideoProperty SVideoProperty video stream property

Structure for source picture.

Name Type Descritpion
iColorFormat int color space type
iStride int stride for each plane pData
pData unsigned char * plane pData
iPicWidth int luma picture width in x coordinate
iPicHeight int luma picture height in y coordinate
uiTimeStamp long long  

Option types introduced in SVC encoder application.

Name Initializer Descritpion
ENCODER_OPTION_DATAFORMAT = 0  
ENCODER_OPTION_IDR_INTERVAL   IDR period,0/-1 means no Intra period (only the first frame); lager than 0 means the desired IDR period, must be multiple of (2^temporal_layer)
ENCODER_OPTION_SVC_ENCODE_PARAM_BASE   structure of Base Param
ENCODER_OPTION_SVC_ENCODE_PARAM_EXT   structure of Extension Param
ENCODER_OPTION_FRAME_RATE   maximal input frame rate, current supported range: MAX_FRAME_RATE = 30,MIN_FRAME_RATE = 1
ENCODER_OPTION_BITRATE    
ENCODER_OPTION_MAX_BITRATE    
ENCODER_OPTION_INTER_SPATIAL_PRED    
ENCODER_OPTION_RC_MODE    
ENCODER_PADDING_PADDING   0:disable padding;1:padding
ENCODER_OPTION_PROFILE   assgin the profile for each layer
ENCODER_OPTION_LEVEL   assgin the level for each layer
ENCODER_OPTION_NUMBER_REF   the number of refererence frame
ENCODER_OPTION_DELIVERY_STATUS   the delivery info which is a feedback from app level
ENCODER_LTR_RECOVERY_REQUEST    
ENCODER_LTR_MARKING_FEEDBACK    
ENCODER_LTR_MARKING_PERIOD    
ENCODER_OPTION_LTR   0:disable LTR;larger than 0 enable LTR; LTR number is fixed to be 2 in current encoder
ENCODER_OPTION_COMPLEXITY    
ENCODER_OPTION_ENABLE_SSEI  

enable SSEI: true

enable ssei; false

disable ssei

ENCODER_OPTION_ENABLE_PREFIX_NAL_ADDING  

enable prefix: true

enable prefix; false

disable prefix

ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION  

enable pSps/pPps id addition: true

enable pSps/pPps id; false

disable pSps/pPps id addistion

ENCODER_OPTION_CURRENT_PATH    
ENCODER_OPTION_DUMP_FILE   dump layer reconstruct frame to a specified file
ENCODER_OPTION_TRACE_LEVEL   trace info based on the trace level
ENCODER_OPTION_TRACE_CALLBACK   a void (*)(void* context, int level, const char* message) function which receives log messages
ENCODER_OPTION_TRACE_CALLBACK_CONTEXT   context info of trace callback
ENCODER_OPTION_GET_STATISTICS   read only
ENCODER_OPTION_STATISTICS_LOG_INTERVAL   log interval in millisecond
ENCODER_OPTION_IS_LOSSLESS_LINK   advanced algorithmetic settings
ENCODER_OPTION_BITS_VARY_PERCENTAGE   bit vary percentage

Buffer info.

Name Type Descritpion
iBufferStatus int 0: one frame data is not ready; 1: one frame data is ready
uiInBsTimeStamp unsigned long long input BS timestamp
uiOutYuvTimeStamp unsigned long long output YUV timestamp, when bufferstatus is 1
sSystemBuffer SSysMEMBuffer memory info for one picture
UsrData union SBufferInfo::@2 output buffer info

The capability of decoder, for SDP negotiation.

Name Type Descritpion
iProfileIdc int profile_idc
iProfileIop int profile-iop
iLevelIdc int level_idc
iMaxMbps int max-mbps
iMaxFs int max-fs
iMaxCpb int max-cpb
iMaxDpb int max-dpb
iMaxBr int max-br
bRedPicCap bool redundant-pic-cap

to do

Name Type Descritpion
iNalNum int total NAL number in current AU
iNalLenInByte int each nal length
pDstBuff unsigned char * outputted dst buffer for parsed bitstream
iSpsWidthInPixel int required SPS width info
iSpsHeightInPixel int required SPS height info
uiInBsTimeStamp unsigned long long input BS timestamp
uiOutBsTimeStamp unsigned long long output BS timestamp

SVC Encoding Parameters.

Name Type Descritpion
iUsageType EUsageType application type;1.CAMERA_VIDEO_REAL_TIME:camera video signal; 2.SCREEN_CONTENT_REAL_TIME:screen content signal;
iPicWidth int width of picture in luminance samples (the maximum of all layers if multiple spatial layers presents)
iPicHeight int height of picture in luminance samples((the maximum of all layers if multiple spatial layers presents)
iTargetBitrate int target bitrate desired
iRCMode RC_MODES rate control mode
fMaxFrameRate float maximal input frame rate

Frame bit stream info.

Name Type Descritpion
iTemporalId int temporal ID
iSubSeqId int

refer to D.2.11 Sub-sequence information SEI message semantics

The sub sequence layers are ordered hierarchically based on their dependency on each other so that any picture in a layer shall not be predicted from any picture on any higher layer.

iLayerNum int  
sLayerInfo SLayerBSInfo  
eFrameType EVideoFrameType  
iFrameSizeInBytes int  
uiTimeStamp long long  

Enumerate the type of video format.

Name Initializer Descritpion
videoFormatRGB = 1 rgb color formats
videoFormatRGBA = 2  
videoFormatRGB555 = 3  
videoFormatRGB565 = 4  
videoFormatBGR = 5  
videoFormatBGRA = 6  
videoFormatABGR = 7  
videoFormatARGB = 8  
videoFormatYUY2 = 20 yuv color formats
videoFormatYVYU = 21  
videoFormatUYVY = 22  
videoFormatI420 = 23 the same as IYUV
videoFormatYV12 = 24  
videoFormatInternal = 25 only used in SVC decoder testbed
videoFormatNV12 = 26 new format for output by DXVA decoding
videoFormatVFlip = 0x80000000  

Enumerate the type of rate control mode.

Name Initializer Descritpion
RC_QUALITY_MODE = 0 quality mode
RC_BITRATE_MODE = 1 bitrate mode
RC_BUFFERBASED_MODE = 2 no bitrate control,only using buffer status,adjust the video quality
RC_TIMESTAMP_MODE = 3  
RC_OFF_MODE = -1 rate control off mode

Enumulate for the stategy of SPS/PPS strategy.

Name Initializer Descritpion
CONSTANT_ID = 0 constant id in SPS/PPS
INCREASING_ID = 0x01 SPS/PPS id increases at each IDR.
SPS_LISTING = 0x02 using SPS in the existing list if possible
SPS_LISTING_AND_PPS_INCREASING = 0x03  
SPS_PPS_LISTING = 0x06  

Structure for decoder memery.

Name Type Descritpion
iWidth int width of decoded pic for display
iHeight int height of decoded pic for display
iFormat int type is "EVideoFormatType"
iStride int stride of 2 component

Enumerate the type of error concealment methods.

Name Initializer Descritpion
ERROR_CON_DISABLE = 0  
ERROR_CON_FRAME_COPY    
ERROR_CON_SLICE_COPY    
ERROR_CON_FRAME_COPY_CROSS_IDR    
ERROR_CON_SLICE_COPY_CROSS_IDR    
ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE    
ERROR_CON_SLICE_MV_COPY_CROSS_IDR    
ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE    

Enumulate the complexity mode.

Name Initializer Descritpion
LOW_COMPLEXITY   the lowest compleixty,the fastest speed,
MEDIUM_COMPLEXITY   medium complexity, medium speed,medium quality
HIGH_COMPLEXITY   high complexity, lowest speed, high quality

Define a new struct to show the property of video bitstream.

Name Type Descritpion
size unsigned int size of the struct
eVideoBsType VIDEO_BITSTREAM_TYPE video stream type (AVC/SVC)

Bitstream inforamtion of a layer being encoded.

Name Type Descritpion
uiTemporalId unsigned char  
uiSpatialId unsigned char  
uiQualityId unsigned char  
uiLayerType unsigned char  
iNalCount int count number of NAL coded already
pNalLengthInByte int * length of NAL size in byte from 0 to iNalCount-1
pBsBuf unsigned char * buffer of bitstream contained

Enumerate video frame type.

Name Initializer Descritpion
videoFrameTypeInvalid   encoder not ready or parameters are invalidate
videoFrameTypeIDR   IDR frame in H.264.
videoFrameTypeI   I frame type.
videoFrameTypeP   P frame type.
videoFrameTypeSkip   skip the frame based encoder kernel
videoFrameTypeIPMixed   a frame where I and P slices are mixing, not supported yet

Structure for spatial layer configuration.

Name Type Descritpion
iVideoWidth int width of picture in luminance samples of a layer
iVideoHeight int height of picture in luminance samples of a layer
fFrameRate float frame rate specified for a layer
iSpatialBitrate int target bitrate for a spatial layer
iMaxSpatialBitrate int maximum bitrate for a spatial layer
uiProfileIdc EProfileIdc value of profile IDC (PRO_UNKNOWN for auto-detection)
uiLevelIdc ELevelIdc value of profile IDC (0 for auto-detection)
iDLayerQp int value of level IDC (0 for auto-detection)
sSliceCfg SSliceConfig slice configuration for a layer

Encoder usage type.

Name Initializer Descritpion
CAMERA_VIDEO_REAL_TIME   camera video for real-time communication
SCREEN_CONTENT_REAL_TIME   screen content signal
CAMERA_VIDEO_NON_REAL_TIME    

Enumerate the type of video bitstream which is provided to decoder.

Name Initializer Descritpion
VIDEO_BITSTREAM_AVC = 0  
VIDEO_BITSTREAM_SVC = 1  
VIDEO_BITSTREAM_DEFAULT = VIDEO_BITSTREAM_SVC  

Enumerate the type of level id.

Name Initializer Descritpion
LEVEL_UNKNOWN    
LEVEL_1_0    
LEVEL_1_B    
LEVEL_1_1    
LEVEL_1_2    
LEVEL_1_3    
LEVEL_2_0    
LEVEL_2_1    
LEVEL_2_2    
LEVEL_3_0    
LEVEL_3_1    
LEVEL_3_2    
LEVEL_4_0    
LEVEL_4_1    
LEVEL_4_2    
LEVEL_5_0    
LEVEL_5_1    
LEVEL_5_2    

Enumerate the type of profile id.

Name Initializer Descritpion
PRO_UNKNOWN = 0  
PRO_BASELINE = 66  
PRO_MAIN = 77  
PRO_EXTENDED = 88  
PRO_HIGH = 100  
PRO_HIGH10 = 110  
PRO_HIGH422 = 122  
PRO_HIGH444 = 144  
PRO_CAVLC444 = 244  
PRO_SCALABLE_BASELINE = 83  
PRO_SCALABLE_HIGH = 86  

Structure for slice configuration.

Name Type Descritpion
uiSliceMode SliceModeEnum by default, uiSliceMode will be SM_SINGLE_SLICE
sSliceArgument SSliceArgument  

Structure for slice argument.

Name Type Descritpion
uiSliceMbNum unsigned int only used when uiSliceMode=2;here we use a tmp fixed value since MAX_SLICES_NUM is not defined here and its definition may be changed;
uiSliceNum unsigned int only used when uiSliceMode=1
uiSliceSizeConstraint unsigned int only used when uiSliceMode=4

Enumerate the type of slice mode.

Name Initializer Descritpion
SM_SINGLE_SLICE = 0
SliceNum==1
SM_FIXEDSLCNUM_SLICE = 1
according to SliceNum | enabled dynamic slicing for multi-thread
SM_RASTER_SLICE = 2
according to SlicesAssign | need input of MB numbers each slice. In addition,

if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.

SM_ROWMB_SLICE = 3
according to PictureMBHeight | typical of single row of mbs each slice + slice

size constraint which including re-encoding

SM_DYN_SLICE = 4
according to SliceSize | dynamic slicing (have no idea about slice_nums until

encoding current frame)

SM_AUTO_SLICE = 5
according to thread number
SM_RESERVED = 6  

Structure for slice argument.

Name Type Descritpion
uiSliceMbNum unsigned int only used when uiSliceMode=2;here we use a tmp fixed value since MAX_SLICES_NUM is not defined here and its definition may be changed;
uiSliceNum unsigned int only used when uiSliceMode=1
uiSliceSizeConstraint unsigned int only used when uiSliceMode=4
⚠️ **GitHub.com Fallback** ⚠️