Skip to content

Commit d239564

Browse files
Isaacclaude
andcommitted
feat: gate Log2MaxFrameNum on bSubcodecMode via WelsInitSps parameter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e647f73 commit d239564

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

third-party/openh264/third_party/openh264/src/codec/encoder/core/inc/au_set.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int32_t WelsWritePpsSyntax (SWelsPPS* pPps, SBitStringAux* pBitStringAux, IWelsP
107107
int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialLayerInternal* pLayerParamInternal,
108108
const uint32_t kuiIntraPeriod, const int32_t kiNumRefFrame,
109109
const uint32_t kiSpsId, const bool kbEnableFrameCropping, bool bEnableRc,
110-
const int32_t kiDlayerCount,bool bSVCBaselayer);
110+
const int32_t kiDlayerCount, bool bSVCBaselayer, bool bSubcodecMode);
111111

112112
/*!
113113
* \brief initialize subset pSps based on configurable parameters in svc

third-party/openh264/third_party/openh264/src/codec/encoder/core/src/au_set.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,14 @@ static inline bool WelsGetPaddingOffset (int32_t iActualWidth, int32_t iActualHe
485485
int32_t WelsInitSps (SWelsSPS* pSps, SSpatialLayerConfig* pLayerParam, SSpatialLayerInternal* pLayerParamInternal,
486486
const uint32_t kuiIntraPeriod, const int32_t kiNumRefFrame,
487487
const uint32_t kuiSpsId, const bool kbEnableFrameCropping, bool bEnableRc,
488-
const int32_t kiDlayerCount, bool bSVCBaselayer) {
488+
const int32_t kiDlayerCount, bool bSVCBaselayer, bool bSubcodecMode) {
489489
memset (pSps, 0, sizeof (SWelsSPS));
490490
pSps->uiSpsId = kuiSpsId;
491491
pSps->iMbWidth = (pLayerParam->iVideoWidth + 15) >> 4;
492492
pSps->iMbHeight = (pLayerParam->iVideoHeight + 15) >> 4;
493493

494494
//max value of both iFrameNum and POC are 2^16-1, in our encoder, iPOC=2*iFrameNum, so max of iFrameNum should be 2^15-1.--
495-
pSps->uiLog2MaxFrameNum = 15;//16;
495+
pSps->uiLog2MaxFrameNum = bSubcodecMode ? 4 : 15;//16;
496496
pSps->iLog2MaxPocLsb = 1 + pSps->uiLog2MaxFrameNum;
497497

498498
pSps->iNumRefFrames = kiNumRefFrame; /* min pRef size when fifo pRef operation*/
@@ -565,7 +565,7 @@ int32_t WelsInitSubsetSps (SSubsetSps* pSubsetSps, SSpatialLayerConfig* pLayerPa
565565
memset (pSubsetSps, 0, sizeof (SSubsetSps));
566566

567567
WelsInitSps (pSps, pLayerParam, pLayerParamInternal, kuiIntraPeriod, kiNumRefFrame, kuiSpsId, kbEnableFrameCropping,
568-
bEnableRc, kiDlayerCount, false);
568+
bEnableRc, kiDlayerCount, false, false);
569569

570570
pSps->uiProfileIdc = pLayerParam->uiProfileIdc ;
571571

third-party/openh264/third_party/openh264/src/codec/encoder/core/src/paraset_strategy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int32_t WelsGenerateNewSps (sWelsEncCtx* pCtx, const bool kbUseSubsetSps,
9494
iRet = WelsInitSps (pSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
9595
pParam->iMaxNumRefFrame,
9696
kiSpsId, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount,
97-
bSVCBaselayer);
97+
bSVCBaselayer, pParam->bSubcodecMode);
9898
} else {
9999
iRet = WelsInitSubsetSps (pSubsetSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
100100
pParam->iMaxNumRefFrame,
@@ -178,7 +178,7 @@ int32_t FindExistingSps (SWelsSvcCodingParam* pParam, const bool kbUseSubsetSps,
178178
WelsInitSps (&sTmpSps, pDlayerParam, &pParam->sDependencyLayers[iDlayerIndex], pParam->uiIntraPeriod,
179179
pParam->iMaxNumRefFrame,
180180
0, pParam->bEnableFrameCroppingFlag, pParam->iRCMode != RC_OFF_MODE, iDlayerCount,
181-
bSVCBaseLayer);
181+
bSVCBaseLayer, pParam->bSubcodecMode);
182182
for (int32_t iId = 0; iId < iSpsNumInUse; iId++) {
183183
if (CheckMatchedSps (&sTmpSps, &pSpsArray[iId])) {
184184
return iId;

0 commit comments

Comments
 (0)