History

Merge pull request #1542 from sijchen/review

[Encoder] refactor Sps generation: passed review at https://rbcommons.com/s/OpenH264/r/930/

sijchen committed 11 years ago

Commit 336b2d12 parents 53c14dc cdd410c3 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
@@ -763,6 +763,35 @@ void FreeMbCache (SMbCache* pMbCache, CMemoryAlign* pMa) { · 762 unmodified lines
763763 }
764764 }
765765
766+int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps, const int32_t iDlayerIndex,
767+ const int32_t iDlayerCount, const int32_t kiSpsId,
768+ SWelsSPS*& pSps, SSubsetSps*& pSubsetSps) {
769+ int32_t iRet = 0;
770+
771+ if (!kbUseSubsetSps) {
772+ pSps = & (pCtx->pSpsArray[kiSpsId]);
773+ } else {
774+ pSubsetSps = & (pCtx->pSubsetArray[kiSpsId]);
775+ pSps = &pSubsetSps->pSps;
776+ }
777+
778+ SWelsSvcCodingParam* pParam = pCtx->pSvcParam;
779+ SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
780+ // Need port pSps/pPps initialization due to spatial scalability changed
781+ if (!kbUseSubsetSps) {
782+ iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
783+ pParam->iMaxNumRefFrame,
784+ kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount);
785+
786+
787+
788+ } else {
789+ iRet = WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
790+ pParam->iMaxNumRefFrame,
791+ kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
792+ }
793+ return iRet;
794+}
766795
767796 /*!
768797 * \brief initialize ppDqLayerList and slicepEncCtx_list due to count number of layers available
@@ -952,35 +981,11 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 183 unmodified lines
952981 SSpatialLayerConfig* pDlayerParam = &pParam->sSpatialLayers[iDlayerIndex];
953982
954983 pDqIdc->uiSpatialId = iDlayerIndex;
955− pPps = & (*ppCtx)->pPPSArray[iPpsId];
956− if (!bUseSubsetSps) {
957− pSps = & (*ppCtx)->pSpsArray[iSpsId];
958− } else {
959− pSubsetSps = & (*ppCtx)->pSubsetArray[iSpsId];
960− pSps = &pSubsetSps->pSps;
961− }
962984
963− // Need port pSps/pPps initialization due to spatial scalability changed
964− if (!bUseSubsetSps) {
965− WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
966− pParam->iMaxNumRefFrame,
967− iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
968−
969− if (pDlayerParam->uiProfileIdc == PRO_BASELINE) {
970− pSps->bConstraintSet0Flag = true;
971− }
972− if (pDlayerParam->uiProfileIdc <= PRO_MAIN) {
973− pSps->bConstraintSet1Flag = true;
974− }
975− if (iDlayerCount > 1) {
976− pSps->bConstraintSet2Flag = true;
977− }
978− } else {
979− WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
980− pParam->iMaxNumRefFrame,
981− iSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE);
982− }
985+ WelsGenerateNewSps (*ppCtx, bUseSubsetSps, iDlayerIndex,
986+ iDlayerCount, iSpsId, pSps, pSubsetSps);
983987
988+ pPps = & (*ppCtx)->pPPSArray[iPpsId];
984989 // initialize pPps
985990 WelsInitPps (pPps, pSps, pSubsetSps, iPpsId, true, bUseSubsetSps, pParam->iEntropyCodingModeFlag != 0);
986991

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