fix codingIdx update issue
This commit is contained in:
parent
f6b6a0f6aa
commit
4f41c3a5bf
@ -2454,7 +2454,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar
|
|||||||
WelsCabacInit (pCtx);
|
WelsCabacInit (pCtx);
|
||||||
WelsRcInitModule (pCtx, pCtx->pSvcParam->iRCMode);
|
WelsRcInitModule (pCtx, pCtx->pSvcParam->iRCMode);
|
||||||
|
|
||||||
pCtx->pVpp = CWelsPreProcess::CreatePreProcess(pCtx);
|
pCtx->pVpp = CWelsPreProcess::CreatePreProcess (pCtx);
|
||||||
if (pCtx->pVpp == NULL) {
|
if (pCtx->pVpp == NULL) {
|
||||||
iRet = 1;
|
iRet = 1;
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), pOut of memory in case new CWelsPreProcess().");
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), pOut of memory in case new CWelsPreProcess().");
|
||||||
@ -3453,15 +3453,15 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn
|
|||||||
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
|
||||||
SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];
|
SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];
|
||||||
|
|
||||||
bool bSkipFrameFlag = WelsRcCheckFrameStatus (pCtx,uiTimeStamp,iSpatialNum,iCurDid);
|
bool bSkipFrameFlag = WelsRcCheckFrameStatus (pCtx, uiTimeStamp, iSpatialNum, iCurDid);
|
||||||
EVideoFrameType eFrameType = DecideFrameType (pCtx, iSpatialNum, iCurDid, bSkipFrameFlag);
|
EVideoFrameType eFrameType = DecideFrameType (pCtx, iSpatialNum, iCurDid, bSkipFrameFlag);
|
||||||
if (eFrameType == videoFrameTypeSkip) {
|
if (eFrameType == videoFrameTypeSkip) {
|
||||||
if (pSvcParam->bSimulcastAVC) {
|
if (pSvcParam->bSimulcastAVC) {
|
||||||
if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip)
|
if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip)
|
||||||
pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iCurDid);
|
pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iCurDid);
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
||||||
"[Rc] Frame timestamp = %lld, iDid = %d,skip one frame due to target_br, continual skipped %d frames",
|
"[Rc] Frame timestamp = %lld, iDid = %d,skip one frame due to target_br, continual skipped %d frames",
|
||||||
uiTimeStamp, iCurDid, pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames);
|
uiTimeStamp, iCurDid, pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -3471,8 +3471,8 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
||||||
"[Rc] Frame timestamp = %lld, iDid = %d,skip one frame due to target_br, continual skipped %d frames",
|
"[Rc] Frame timestamp = %lld, iDid = %d,skip one frame due to target_br, continual skipped %d frames",
|
||||||
uiTimeStamp, iCurDid, pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames);
|
uiTimeStamp, iCurDid, pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -3498,17 +3498,6 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn
|
|||||||
++ pCtx->uiIdrPicId;
|
++ pCtx->uiIdrPicId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pSvcParam->bSimulcastAVC) {
|
|
||||||
for (int32_t i = 0; i < pSvcParam->iSpatialLayerNum; i++) {
|
|
||||||
SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[i];
|
|
||||||
pParamInternal->iCodingIndex ++;
|
|
||||||
pCtx->pWelsSvcRc[i].iContinualSkipFrames = 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iCurDid];
|
|
||||||
pParamInternal->iCodingIndex++;
|
|
||||||
pCtx->pWelsSvcRc[iCurDid].iContinualSkipFrames = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return eFrameType;
|
return eFrameType;
|
||||||
}
|
}
|
||||||
@ -3580,7 +3569,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
pLayerBsInfo->eFrameType = videoFrameTypeSkip;
|
pLayerBsInfo->eFrameType = videoFrameTypeSkip;
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
|
||||||
"[Rc] Frame timestamp = %lld, skip one frame due to preprocessing return (temporal layer settings or else)",
|
"[Rc] Frame timestamp = %lld, skip one frame due to preprocessing return (temporal layer settings or else)",
|
||||||
pSrcPic->uiTimeStamp);
|
pSrcPic->uiTimeStamp);
|
||||||
return ENC_RETURN_SUCCESS;
|
return ENC_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3602,7 +3591,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
for (int32_t iDidIdx = 0; iDidIdx < pSvcParam->iSpatialLayerNum; iDidIdx++) {
|
for (int32_t iDidIdx = 0; iDidIdx < pSvcParam->iSpatialLayerNum; iDidIdx++) {
|
||||||
SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iDidIdx];
|
SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iDidIdx];
|
||||||
int32_t iTemporalId = GetTemporalLevel (pParamInternal, pParamInternal->iCodingIndex,
|
int32_t iTemporalId = GetTemporalLevel (pParamInternal, pParamInternal->iCodingIndex,
|
||||||
pSvcParam->uiGopSize);
|
pSvcParam->uiGopSize);
|
||||||
if (iTemporalId == INVALID_TEMPORAL_ID)
|
if (iTemporalId == INVALID_TEMPORAL_ID)
|
||||||
pParamInternal->iCodingIndex ++;
|
pParamInternal->iCodingIndex ++;
|
||||||
}
|
}
|
||||||
@ -4138,9 +4127,17 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
&& (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) {
|
&& (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) {
|
||||||
pCtx->bRefOfCurTidIsLtr[iCurDid][iCurTid] = true;
|
pCtx->bRefOfCurTidIsLtr[iCurDid][iCurTid] = true;
|
||||||
}
|
}
|
||||||
// ++ pParamInternal->iCodingIndex;
|
if (pSvcParam->bSimulcastAVC)
|
||||||
|
++ pParamInternal->iCodingIndex;
|
||||||
}//end of (iSpatialIdx/iSpatialNum)
|
}//end of (iSpatialIdx/iSpatialNum)
|
||||||
|
|
||||||
|
if (!pSvcParam->bSimulcastAVC) {
|
||||||
|
for (int32_t i = 0; i < pSvcParam->iSpatialLayerNum; i++) {
|
||||||
|
SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[i];
|
||||||
|
pParamInternal->iCodingIndex ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {
|
if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {
|
||||||
pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid);
|
pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid);
|
||||||
ForceCodingIDR (pCtx);
|
ForceCodingIDR (pCtx);
|
||||||
@ -4183,12 +4180,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
pFbi->iLayerNum = iLayerNum;
|
pFbi->iLayerNum = iLayerNum;
|
||||||
|
|
||||||
WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsEncoderEncodeExt() OutputInfo iLayerNum = %d,iFrameSize = %d",
|
WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsEncoderEncodeExt() OutputInfo iLayerNum = %d,iFrameSize = %d",
|
||||||
iLayerNum,iFrameSize);
|
iLayerNum, iFrameSize);
|
||||||
for (int32_t i = 0; i < iLayerNum; i++)
|
for (int32_t i = 0; i < iLayerNum; i++)
|
||||||
WelsLog (pLogCtx, WELS_LOG_DEBUG,
|
WelsLog (pLogCtx, WELS_LOG_DEBUG,
|
||||||
"WelsEncoderEncodeExt() OutputInfo iLayerId = %d,iNalType = %d,iNalCount = %d, first Nal Length=%d,uiSpatialId = %d,uiTemporalId = %d,iSubSeqId = %d",i,
|
"WelsEncoderEncodeExt() OutputInfo iLayerId = %d,iNalType = %d,iNalCount = %d, first Nal Length=%d,uiSpatialId = %d,uiTemporalId = %d,iSubSeqId = %d",
|
||||||
|
i,
|
||||||
pFbi->sLayerInfo[i].uiLayerType, pFbi->sLayerInfo[i].iNalCount, pFbi->sLayerInfo[i].pNalLengthInByte[0],
|
pFbi->sLayerInfo[i].uiLayerType, pFbi->sLayerInfo[i].iNalCount, pFbi->sLayerInfo[i].pNalLengthInByte[0],
|
||||||
pFbi->sLayerInfo[i].uiSpatialId, pFbi->sLayerInfo[i].uiTemporalId,pFbi->sLayerInfo[i].iSubSeqId);
|
pFbi->sLayerInfo[i].uiSpatialId, pFbi->sLayerInfo[i].uiTemporalId, pFbi->sLayerInfo[i].iSubSeqId);
|
||||||
WelsEmms();
|
WelsEmms();
|
||||||
|
|
||||||
pLayerBsInfo->eFrameType = eFrameType;
|
pLayerBsInfo->eFrameType = eFrameType;
|
||||||
|
@ -123,7 +123,7 @@ void RcInitSequenceParameter (sWelsEncCtx* pEncCtx) {
|
|||||||
pWelsSvcRc->iCost2BitsIntra = 1;
|
pWelsSvcRc->iCost2BitsIntra = 1;
|
||||||
pWelsSvcRc->iAvgCost2Bits = 1;
|
pWelsSvcRc->iAvgCost2Bits = 1;
|
||||||
pWelsSvcRc->iSkipBufferRatio = SKIP_RATIO;
|
pWelsSvcRc->iSkipBufferRatio = SKIP_RATIO;
|
||||||
|
pWelsSvcRc->iContinualSkipFrames = 0;
|
||||||
pWelsSvcRc->iQpRangeUpperInFrame = (QP_RANGE_UPPER_MODE1 * MAX_BITS_VARY_PERCENTAGE - ((
|
pWelsSvcRc->iQpRangeUpperInFrame = (QP_RANGE_UPPER_MODE1 * MAX_BITS_VARY_PERCENTAGE - ((
|
||||||
QP_RANGE_UPPER_MODE1 - QP_RANGE_MODE0) *
|
QP_RANGE_UPPER_MODE1 - QP_RANGE_MODE0) *
|
||||||
pWelsSvcRc->iRcVaryRatio)) / MAX_BITS_VARY_PERCENTAGE;
|
pWelsSvcRc->iRcVaryRatio)) / MAX_BITS_VARY_PERCENTAGE;
|
||||||
@ -1056,6 +1056,7 @@ int32_t RcCalculateCascadingQp (struct TagWelsEncCtx* pEncCtx, int32_t iQp) {
|
|||||||
|
|
||||||
void WelsRcPictureInitGom (sWelsEncCtx* pEncCtx, long long uiTimeStamp) {
|
void WelsRcPictureInitGom (sWelsEncCtx* pEncCtx, long long uiTimeStamp) {
|
||||||
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
|
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
|
||||||
|
pWelsSvcRc->iContinualSkipFrames = 0;
|
||||||
|
|
||||||
if (pEncCtx->eSliceType == I_SLICE) {
|
if (pEncCtx->eSliceType == I_SLICE) {
|
||||||
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
|
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user