History

fix defect7654 that the encoder won't generate IDR when temporal layer setting changes

ruil2 committed 12 years ago

Commit 0a1b6151 parent 3f333b05 files · +85 −35Browse files

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

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+17−10
@@ -356,22 +356,23 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 355 unmodified lines
356 if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {356 if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
357 if (pCfg->bEnableLongTermReference) {357 if (pCfg->bEnableLongTermReference) {
358 pCfg->iLTRRefNum = WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM_SCREEN);358 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)
360 pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;360 pCfg->iNumRefFrame = WELS_MAX (1, WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;
361 } else {361 } else {
362 pCfg->iLTRRefNum = 0;362 pCfg->iLTRRefNum = 0;
363 if (pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)363 if(pCfg->iNumRefFrame == AUTO_REF_PIC_COUNT)
364 pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1);364 pCfg->iNumRefFrame = WELS_MAX (1, pCfg->uiGopSize >> 1);;
365 }365 }
366 } else {366 } else {
367 pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3 (pCfg->iLTRRefNum, 1, LONG_TERM_REF_NUM) : 0;367 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){
369 pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :369 pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :
370 (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum);370 (MIN_REF_PIC_COUNT + pCfg->iLTRRefNum);
371 pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);371 pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
372 }372 }
373 }373 }
374 374 if(pCfg->iNumRefFrame > pCfg->iMaxNumRefFrame)
375 pCfg->iMaxNumRefFrame = pCfg->iNumRefFrame;
375 if (pCfg->iLtrMarkPeriod == 0) {376 if (pCfg->iLtrMarkPeriod == 0) {
376 pCfg->iLtrMarkPeriod = 30;377 pCfg->iLtrMarkPeriod = 30;
377 }378 }
@@ -559,23 +560,29 @@ void CWelsH264SVCEncoder::CheckProfileSetting (int32_t iLayer, EProfileIdc uiPro · 181 unmodified lines
559 pLayerInfo->uiProfileIdc = uiProfileIdc;560 pLayerInfo->uiProfileIdc = uiProfileIdc;
560 if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {561 if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
561 pLayerInfo->uiProfileIdc = PRO_BASELINE;562 pLayerInfo->uiProfileIdc = PRO_BASELINE;
562 WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile", uiProfileIdc);563 WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile\n", uiProfileIdc);
563 }564 }
564 if (iLayer > SPATIAL_LAYER_0) {565 if (iLayer > SPATIAL_LAYER_0) {
565 if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {566 if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
566 pLayerInfo->uiProfileIdc = PRO_BASELINE;567 pLayerInfo->uiProfileIdc = PRO_BASELINE;
567 WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile", uiProfileIdc);568 WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile\n", uiProfileIdc);
568 }569 }
569 }570 }
570}571}
571void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc) {572void CWelsH264SVCEncoder::CheckLevelSetting (int32_t iLayer, ELevelIdc uiLevelIdc) {
572 SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];573 SSpatialLayerConfig* pLayerInfo = &m_pEncContext->pSvcParam->sSpatialLayers[iLayer];
573 pLayerInfo->uiLevelIdc = uiLevelIdc;574 pLayerInfo->uiLevelIdc = uiLevelIdc;
574 //TBD575 if( (uiLevelIdc< LEVEL_1_0)||(uiLevelIdc >LEVEL_5_2)){
576 pLayerInfo->uiLevelIdc = LEVEL_5_2;
577 WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support level(%d) change to LEVEL_5_2\n",uiLevelIdc);
578 }
575}579}
576void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {580void CWelsH264SVCEncoder::CheckReferenceNumSetting (int32_t iNumRef) {
577 m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;581 m_pEncContext->pSvcParam->iNumRefFrame = iNumRef;
578 //TBD582 if((iNumRef < MIN_REF_PIC_COUNT)||(iNumRef> MAX_REFERENCE_PICTURE_COUNT_NUM)){
583 m_pEncContext->pSvcParam->iNumRefFrame = AUTO_REF_PIC_COUNT;
584 WelsLog (m_pEncContext, WELS_LOG_WARNING, "doesn't support the number of reference frame(%d) change to auto select mode\n",iNumRef);
585 }
579}586}
580/************************************************************************587/************************************************************************
581* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..588* InDataFormat, IDRInterval, SVC Encode Param, Frame Rate, Bitrate,..

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