Merge pull request #992 from ruil2/interface_update
add interface parameter(profile/levle/numref) support
This commit is contained in:
commit
b0d6cf7b9b
@ -82,6 +82,11 @@ typedef enum {
|
||||
ENCODER_OPTION_RC_MODE,
|
||||
ENCODER_PADDING_PADDING,
|
||||
|
||||
ENCODER_OPTION_PROFILE,
|
||||
ENCODER_OPTION_LEVEL,
|
||||
ENCODER_OPTION_NUMBER_REF,
|
||||
ENCODER_OPTION_DELIVERY_STATUS,
|
||||
|
||||
ENCODER_LTR_RECOVERY_REQUEST,
|
||||
ENCODER_LTR_MARKING_FEEDBACK,
|
||||
ENCOCER_LTR_MARKING_PERIOD,
|
||||
@ -398,4 +403,20 @@ typedef struct TagDumpLayer {
|
||||
int iLayer;
|
||||
char* pFileName;
|
||||
} SDumpLayer;
|
||||
|
||||
typedef struct TagProfileInfo {
|
||||
int iLayer;
|
||||
EProfileIdc uiProfileIdc; //the profile info
|
||||
} SProfileInfo;
|
||||
|
||||
typedef struct TagLevelInfo {
|
||||
int iLayer;
|
||||
ELevelIdc uiLevelIdc; //the level info
|
||||
} SLevelInfo;
|
||||
|
||||
typedef struct TagDeliveryStatus{
|
||||
int iDropNum; //the number of video frames that are dropped continuously before delivery to encoder, which is used by screen content.
|
||||
int iDropFrameType; // the frame type that is dropped
|
||||
int iDropFrameSize; // the frame size that is dropped
|
||||
}SDeliveryStatus;
|
||||
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
|
||||
|
@ -216,7 +216,7 @@ typedef struct TagWelsEncCtx {
|
||||
|
||||
int32_t iEncoderError;
|
||||
WELS_MUTEX mutexEncoderError;
|
||||
|
||||
int32_t iDropNumber;
|
||||
} sWelsEncCtx/*, *PWelsEncCtx*/;
|
||||
}
|
||||
#endif//sWelsEncCtx_H__
|
||||
|
@ -104,7 +104,9 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
|
||||
|
||||
private:
|
||||
int InitializeInternal (SWelsSvcCodingParam* argv);
|
||||
|
||||
void CheckProfileSetting (int32_t iLayer, EProfileIdc uiProfileIdc);
|
||||
void CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc);
|
||||
void CheckReferenceNumSetting (int32_t iNumRef);
|
||||
sWelsEncCtx* m_pEncContext;
|
||||
|
||||
welsCodecTrace* m_pWelsTrace;
|
||||
|
@ -356,16 +356,16 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) {
|
||||
if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
|
||||
if (pCfg->bEnableLongTermReference) {
|
||||
pCfg->iLTRRefNum = WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM_SCREEN);
|
||||
if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
|
||||
if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
|
||||
pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;
|
||||
} else {
|
||||
pCfg->iLTRRefNum = 0;
|
||||
if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
|
||||
if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
|
||||
pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1);
|
||||
}
|
||||
} else {
|
||||
pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM) : 0;
|
||||
if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT){
|
||||
if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT) {
|
||||
pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :
|
||||
(MIN_REF_PIC_COUNT + pCfg->iLTRRefNum);
|
||||
pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
|
||||
@ -554,7 +554,29 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CWelsH264SVCEncoder::CheckProfileSetting (int32_t iLayer, EProfileIdc uiProfileIdc) {
|
||||
SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
|
||||
pLayerInfo->uiProfileIdc = uiProfileIdc;
|
||||
if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
|
||||
pLayerInfo->uiProfileIdc = PRO_BASELINE;
|
||||
WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile", uiProfileIdc);
|
||||
}
|
||||
if (iLayer > SPATIAL_LAYER_0) {
|
||||
if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
|
||||
pLayerInfo->uiProfileIdc = PRO_BASELINE;
|
||||
WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile", uiProfileIdc);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc) {
|
||||
SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
|
||||
pLayerInfo->uiLevelIdc = uiLevelIdc;
|
||||
//TBD
|
||||
}
|
||||
void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {
|
||||
m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;
|
||||
//TBD
|
||||
}
|
||||
/************************************************************************
|
||||
* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..
|
||||
************************************************************************/
|
||||
@ -888,6 +910,36 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ENCODER_OPTION_PROFILE: {
|
||||
SProfileInfo* pProfileInfo = (static_cast<SProfileInfo*> (pOption));
|
||||
if ((pProfileInfo->iLayer < SPATIAL_LAYER_0) || (pProfileInfo->iLayer > SPATIAL_LAYER_3)) {
|
||||
WelsLog (m_pEncContext, WELS_LOG_ERROR,
|
||||
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)\n", pProfileInfo->iLayer);
|
||||
return cmInitParaError;
|
||||
}
|
||||
CheckProfileSetting (pProfileInfo->iLayer, pProfileInfo->uiProfileIdc);
|
||||
}
|
||||
break;
|
||||
case ENCODER_OPTION_LEVEL: {
|
||||
SLevelInfo* pLevelInfo = (static_cast<SLevelInfo*> (pOption));
|
||||
if ((pLevelInfo->iLayer < SPATIAL_LAYER_0) || (pLevelInfo->iLayer > SPATIAL_LAYER_3)) {
|
||||
WelsLog (m_pEncContext, WELS_LOG_ERROR,
|
||||
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)\n", pLevelInfo->iLayer);
|
||||
return cmInitParaError;
|
||||
}
|
||||
CheckLevelSetting (pLevelInfo->iLayer, pLevelInfo->uiLevelIdc);
|
||||
}
|
||||
break;
|
||||
case ENCODER_OPTION_NUMBER_REF: {
|
||||
int32_t iValue = * ((int32_t*)pOption);
|
||||
CheckReferenceNumSetting (iValue);
|
||||
}
|
||||
break;
|
||||
case ENCODER_OPTION_DELIVERY_STATUS: {
|
||||
SDeliveryStatus *pValue = (static_cast<SDeliveryStatus*>(pOption));
|
||||
m_pEncContext->iDropNumber = pValue->iDropNum;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return cmInitParaError;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user