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
156 }156 }
157 157
158 }158 }
159 return ENC_RETURN_SUCCESS;159 return WelsCheckRefFrameLimitation (pLogCtx, pCfg);
160}160}
161 161
162 162
@@ -753,7 +753,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 590 unmodified lines
753 pMa = (*ppCtx)->pMemAlign;753 pMa = (*ppCtx)->pMemAlign;
754 pParam = (*ppCtx)->pSvcParam;754 pParam = (*ppCtx)->pSvcParam;
755 iDlayerCount = pParam->iSpatialLayerNum;755 iDlayerCount = pParam->iSpatialLayerNum;
756 iNumRef = pParam->iNumRefFrame;756 iNumRef = pParam->iMaxNumRefFrame;
757 757
758 const int32_t kiFeatureStrategyIndex = FME_DEFAULT_FEATURE_INDEX;758 const int32_t kiFeatureStrategyIndex = FME_DEFAULT_FEATURE_INDEX;
759 const int32_t kiMe16x16 = ME_DIA_CROSS;759 const int32_t kiMe16x16 = ME_DIA_CROSS;
@@ -927,7 +927,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 167 unmodified lines
927 927
928 // Need port pSps/pPps initialization due to spatial scalability changed928 // Need port pSps/pPps initialization due to spatial scalability changed
929 if (!bUseSubsetSps) {929 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,
931 iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);932 iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
932 933
933 if (iDlayerCount > 1) {934 if (iDlayerCount > 1) {
@@ -937,7 +938,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 3 unmodified lines
937 }938 }
938 } else {939 } else {
939 WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,940 WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
940 pParam->iNumRefFrame,941 pParam->iMaxNumRefFrame,
941 iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);942 iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
942 }943 }
943 944
@@ -1420,7 +1421,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 476 unmodified lines
1420 if (pParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {1421 if (pParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
1421 (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa");1422 (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa");
1422 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx))1423 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)) {
1424 WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!");1425 WelsLog (*ppCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!");
1425 FreeMemorySvc (ppCtx);1426 FreeMemorySvc (ppCtx);
1426 return 1;1427 return 1;
@@ -1674,7 +1675,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 247 unmodified lines
1674 FreePicture (pMa, &pRefList->pRef[iRef]);1675 FreePicture (pMa, &pRefList->pRef[iRef]);
1675 }1676 }
1676 ++ iRef;1677 ++ iRef;
1677 } while (iRef < 1 + pParam->iNumRefFrame);1678 } while (iRef < 1 + pParam->iMaxNumRefFrame);
1678 1679
1679 pMa->WelsFree (pCtx->ppRefPicListExt[ilayer], "ppRefPicListExt[]");1680 pMa->WelsFree (pCtx->ppRefPicListExt[ilayer], "ppRefPicListExt[]");
1680 pCtx->ppRefPicListExt[ilayer] = NULL;1681 pCtx->ppRefPicListExt[ilayer] = NULL;
@@ -1727,7 +1728,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 46 unmodified lines
1727 pCtx->pVaa->sVaaCalcInfo.pMad8x8 = NULL;1728 pCtx->pVaa->sVaaCalcInfo.pMad8x8 = NULL;
1728 }1729 }
1729 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)1730 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)
1730 ReleaseMemoryVaaScreen (pCtx->pVaa, pMa, pCtx->pSvcParam->iNumRefFrame);1731 ReleaseMemoryVaaScreen (pCtx->pVaa, pMa, pCtx->pSvcParam->iMaxNumRefFrame);
1731 pMa->WelsFree (pCtx->pVaa, "pVaa");1732 pMa->WelsFree (pCtx->pVaa, "pVaa");
1732 pCtx->pVaa = NULL;1733 pCtx->pVaa = NULL;
1733 }1734 }
@@ -3583,16 +3584,18 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 1849 unmodified lines
3583 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */3584 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */
3584 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */3585 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
3585 bNeedReset = (pOldParam == NULL) ||3586 bNeedReset = (pOldParam == NULL) ||
3586 (pOldParam->iTemporalLayerNum != pNewParam->iTemporalLayerNum) ||
3587 (pOldParam->uiGopSize != pNewParam->uiGopSize) ||
3588 (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||3587 (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
3589 (pOldParam->iDecompStages != pNewParam->iDecompStages) ||
3590 (pOldParam->iPicWidth != pNewParam->iPicWidth3588 (pOldParam->iPicWidth != pNewParam->iPicWidth
3591 || pOldParam->iPicHeight != pNewParam->iPicHeight) ||3589 || pOldParam->iPicHeight != pNewParam->iPicHeight) ||
3592 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth3590 (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth
3593 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||3591 || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||
3594 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||3592 (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||
3595 (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum);3593 (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum);
3594 if (pNewParam->iMaxNumRefFrame > pOldParam->iMaxNumRefFrame) {
3595 pNewParam->iMaxNumRefFrame = pOldParam->iMaxNumRefFrame;
3596 bNeedReset = true;
3597 }
3598
3596 if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer3599 if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
3597 iIndexD = 0;3600 iIndexD = 0;
3598 assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);3601 assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
@@ -3630,12 +3633,6 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 31 unmodified lines
3630 bNeedReset = true;3633 bNeedReset = true;
3631 break;3634 break;
3632 }3635 }
3633
3634 if (kpOldDlp->iHighestTemporalId != kpNewDlp->iHighestTemporalId) {
3635 bNeedReset = true;
3636 break;
3637 }
3638
3639 ++ iIndexD;3636 ++ iIndexD;
3640 } while (iIndexD < pOldParam->iSpatialLayerNum);3637 } while (iIndexD < pOldParam->iSpatialLayerNum);
3641 }3638 }

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