History

refactor Sps generation

Sijia Chen committed 11 years ago

Commit cdd410c1 parent 24fb2133 files · +47 −30Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+32−27
@@ -761,6 +761,35 @@ void FreeMbCache (SMbCache* pMbCache, CMemoryAlign* pMa) { · 760 unmodified lines
761761 }
762762 }
763763
764+int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
765+ const int32_t iDlayerCount, const int32_t kiSpsId,
766+ SWelsSPS*& pSps, SSubsetSps*& pSubsetSps) {
767+ int32_t iRet = 0;
768+
769+ if (!kbUseSubsetSps) {
770+ pSps = & (pCtx->pSpsArray[kiSpsId]);
771+ } else {
772+ pSubsetSps = & (pCtx->pSubsetArray[kiSpsId]);
773+ pSps = &pSubsetSps->pSps;
774+ }
775+
776+ SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
777+ SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
778+ // Need port pSps/pPps initialization due to spatial scalability changed
779+ if (!kbUseSubsetSps) {
780+ iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
781+ pParam->iMaxNumRefFrame,
782+ kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount);
783+
784+
785+
786+ } else {
787+ iRet = WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
788+ pParam->iMaxNumRefFrame,
789+ kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
790+ }
791+ return iRet;
792+}
764793
765794 /*!
766795 * \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available
@@ -950,35 +979,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 183 unmodified lines
950979 SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
951980
952981 pDqIdc->uiSpatialId = iDlayerIndex;
953− pPps = & (*ppCtx)->pPPSArray[iPpsId];
954− if (!bUseSubsetSps) {
955− pSps = & (*ppCtx)->pSpsArray[iSpsId];
956− } else {
957− pSubsetSps = & (*ppCtx)->pSubsetArray[iSpsId];
958− pSps = &pSubsetSps->pSps;
959− }
960982
961− // Need port pSps/pPps initialization due to spatial scalability changed
962− if (!bUseSubsetSps) {
963− WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
964− pParam->iMaxNumRefFrame,
965− iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
966−
967− if (pDlayerParam->uiProfileIdc == PRO_BASELINE) {
968− pSps->bConstraintSet0Flag = true;
969− }
970− if (pDlayerParam->uiProfileIdc <= PRO_MAIN) {
971− pSps->bConstraintSet1Flag = true;
972− }
973− if (iDlayerCount > 1) {
974− pSps->bConstraintSet2Flag = true;
975− }
976− } else {
977− WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
978− pParam->iMaxNumRefFrame,
979− iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
980− }
983+ WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex,
984+ iDlayerCount, iSpsId, pSps, pSubsetSps);
981985
986+ pPps = & (*ppCtx)->pPPSArray[iPpsId];
982987 // initialize pPps
983988 WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps, pParam->iEntropyCodingModeFlag != 0);
984989

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