History

Merge pull request #1006 from ruil2/bug_fix

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

huili2 committed 12 years ago

Commit be94bf92 parents 7b461e1 de399045 files · +74 −28Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+13−16
@@ -156,7 +156,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 155 unmodified lines
156156 }
157157
158158 }
159− return ENC_RETURN_SUCCESS;
159+ return WelsCheckRefFrameLimitation (pLogCtx, pCfg);
160160 }
161161
162162
@@ -753,7 +753,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 590 unmodified lines
753753 pMa = (*ppCtx)->pMemAlign;
754754 pParam = (*ppCtx)->pSvcParam;
755755 iDlayerCount = pParam->iSpatialLayerNum;
756− iNumRef = pParam->iNumRefFrame;
756+ iNumRef = pParam->iMaxNumRefFrame;
757757
758758 const int32_t kiFeatureStrategyIndex = FME_DEFAULT_FEATURE_INDEX;
759759 const int32_t kiMe16x16 = ME_DIA_CROSS;
@@ -927,7 +927,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 167 unmodified lines
927927
928928 // Need port pSps/pPps initialization due to spatial scalability changed
929929 if (!bUseSubsetSps) {
930− WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod, pParam->iNumRefFrame,
930+ WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
931+ pParam->iMaxNumRefFrame,
931932 iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
932933
933934 if (iDlayerCount > 1) {
@@ -937,7 +938,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 3 unmodified lines
937938 }
938939 } else {
939940 WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
940− pParam->iNumRefFrame,
941+ pParam->iMaxNumRefFrame,
941942 iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
942943 }
943944
@@ -1420,7 +1421,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 476 unmodified lines
14201421 if (pParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
14211422 (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa");
14221423 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx))
1423− if (RequestMemoryVaaScreen ((*ppCtx)->pVaa, pMa, (*ppCtx)->pSvcParam->iNumRefFrame, iCountMaxMbNum << 2)) {
1424+ if (RequestMemoryVaaScreen ((*ppCtx)->pVaa, pMa, (*ppCtx)->pSvcParam->iMaxNumRefFrame, iCountMaxMbNum << 2)) {
14241425 WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!");
14251426 FreeMemorySvc (ppCtx);
14261427 return 1;
@@ -1674,7 +1675,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 247 unmodified lines
16741675 FreePicture (pMa, &pRefList->pRef[iRef]);
16751676 }
16761677 ++ iRef;
1677− } while (iRef < 1 + pParam->iNumRefFrame);
1678+ } while (iRef < 1 + pParam->iMaxNumRefFrame);
16781679
16791680 pMa->WelsFree (pCtx->ppRefPicListExt[ilayer], "ppRefPicListExt[]");
16801681 pCtx->ppRefPicListExt[ilayer] = NULL;
@@ -1727,7 +1728,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 46 unmodified lines
17271728 pCtx->pVaa->sVaaCalcInfo.pMad8x8 = NULL;
17281729 }
17291730 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)
1730− ReleaseMemoryVaaScreen (pCtx->pVaa, pMa, pCtx->pSvcParam->iNumRefFrame);
1731+ ReleaseMemoryVaaScreen (pCtx->pVaa, pMa, pCtx->pSvcParam->iMaxNumRefFrame);
17311732 pMa->WelsFree (pCtx->pVaa, "pVaa");
17321733 pCtx->pVaa = NULL;
17331734 }
@@ -3583,16 +3584,18 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 1849 unmodified lines
35833584 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */
35843585 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
35853586 bNeedReset = (pOldParam == NULL) ||
3586− (pOldParam->iTemporalLayerNum != pNewParam->iTemporalLayerNum) ||
3587− (pOldParam->uiGopSize != pNewParam->uiGopSize) ||
35883587 (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
3589− (pOldParam->iDecompStages != pNewParam->iDecompStages) ||
35903588 (pOldParam->iPicWidth != pNewParam->iPicWidth
35913589 || pOldParam->iPicHeight != pNewParam->iPicHeight) ||
35923590 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth
35933591 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||
35943592 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||
35953593 (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum);
3594+ if (pNewParam->iMaxNumRefFrame > pOldParam->iMaxNumRefFrame) {
3595+ pNewParam->iMaxNumRefFrame = pOldParam->iMaxNumRefFrame;
3596+ bNeedReset = true;
3597+ }
3598+
35963599 if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
35973600 iIndexD = 0;
35983601 assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
@@ -3630,12 +3633,6 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 31 unmodified lines
36303633 bNeedReset = true;
36313634 break;
36323635 }
3633−
3634− if (kpOldDlp->iHighestTemporalId != kpNewDlp->iHighestTemporalId) {
3635− bNeedReset = true;
3636− break;
3637− }
3638−
36393636 ++ iIndexD;
36403637 } while (iIndexD < pOldParam->iSpatialLayerNum);
36413638 }

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