History

add interface parameter(profile/levle/numref) support

ruil2 committed 12 years ago

Commit f49fa811 parent 497b8de4 files · +76 −6Browse files

Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 4 files). Show all

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+56−4
@@ -356,16 +356,16 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 355 unmodified lines
356356 if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
357357 if (pCfg->bEnableLongTermReference) {
358358 pCfg->iLTRRefNum = WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM_SCREEN);
359− if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
359+ if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
360360 pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;
361361 } else {
362362 pCfg->iLTRRefNum = 0;
363− if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
363+ if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
364364 pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1);
365365 }
366366 } else {
367367 pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM) : 0;
368− if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT){
368+ if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT) {
369369 pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :
370370 (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum);
371371 pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
@@ -554,7 +554,29 @@ int CWelsH264SVCEncoder::ForceIntraFrame (bool bIDR) { · 182 unmodified lines
554554
555555 return 0;
556556 }
557−
557+void CWelsH264SVCEncoder::CheckProfileSetting (int32_t iLayer, EProfileIdc uiProfileIdc) {
558+ SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
559+ pLayerInfo->uiProfileIdc = uiProfileIdc;
560+ if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
561+ pLayerInfo->uiProfileIdc = PRO_BASELINE;
562+ WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile", uiProfileIdc);
563+ }
564+ if (iLayer > SPATIAL_LAYER_0) {
565+ if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
566+ pLayerInfo->uiProfileIdc = PRO_BASELINE;
567+ WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile", uiProfileIdc);
568+ }
569+ }
570+}
571+void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc) {
572+ SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
573+ pLayerInfo->uiLevelIdc = uiLevelIdc;
574+ //TBD
575+}
576+void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {
577+ m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;
578+ //TBD
579+}
558580 /************************************************************************
559581 * InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..
560582 ************************************************************************/
@@ -888,6 +910,36 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 327 unmodified lines
888910 }
889911 }
890912 break;
913+ case ENCODER_OPTION_PROFILE: {
914+ SProfileInfo* pProfileInfo = (static_cast<SProfileInfo*> (pOption));
915+ if ((pProfileInfo->iLayer < SPATIAL_LAYER_0) || (pProfileInfo->iLayer > SPATIAL_LAYER_3)) {
916+ WelsLog (m_pEncContext, WELS_LOG_ERROR,
917+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)\n", pProfileInfo->iLayer);
918+ return cmInitParaError;
919+ }
920+ CheckProfileSetting (pProfileInfo->iLayer, pProfileInfo->uiProfileIdc);
921+ }
922+ break;
923+ case ENCODER_OPTION_LEVEL: {
924+ SLevelInfo* pLevelInfo = (static_cast<SLevelInfo*> (pOption));
925+ if ((pLevelInfo->iLayer < SPATIAL_LAYER_0) || (pLevelInfo->iLayer > SPATIAL_LAYER_3)) {
926+ WelsLog (m_pEncContext, WELS_LOG_ERROR,
927+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_PROFILE,iLayer = %d(rang0-3)\n", pLevelInfo->iLayer);
928+ return cmInitParaError;
929+ }
930+ CheckLevelSetting (pLevelInfo->iLayer, pLevelInfo->uiLevelIdc);
931+ }
932+ break;
933+ case ENCODER_OPTION_NUMBER_REF: {
934+ int32_t iValue = * ((int32_t*)pOption);
935+ CheckReferenceNumSetting (iValue);
936+ }
937+ break;
938+ case ENCODER_OPTION_DROP_NUM: {
939+ int32_t iValue = * ((int32_t*)pOption);
940+ m_pEncContext->iDropNumber = iValue;
941+ }
942+ break;
891943 default:
892944 return cmInitParaError;
893945 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t