History

fix dependency ID mapping issue

Karina committed 10 years ago

Commit e3c30661 parent 39c2fb36 files · +4688 −4663Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+39−35
@@ -1754,7 +1754,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1753 unmodified lines
17541754 return 1;
17551755 }
17561756
1757− (*ppCtx)->pReferenceStrategy = IWelsReferenceStrategy::CreateReferenceStrategy((*ppCtx), pParam->iUsageType, pParam->bEnableLongTermReference);
1757+ (*ppCtx)->pReferenceStrategy = IWelsReferenceStrategy::CreateReferenceStrategy ((*ppCtx), pParam->iUsageType,
1758+ pParam->bEnableLongTermReference);
17581759 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pReferenceStrategy), FreeMemorySvc (ppCtx))
17591760
17601761 (*ppCtx)->pIntra4x4PredModeBlocks = static_cast<int8_t*>
@@ -1946,7 +1947,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 185 unmodified lines
19461947 ReleaseMtResource (ppCtx);
19471948
19481949 if (NULL != pCtx->pReferenceStrategy) {
1949− WELS_DELETE_OP(pCtx->pReferenceStrategy);
1950+ WELS_DELETE_OP (pCtx->pReferenceStrategy);
19501951 }
19511952
19521953 // frame bitstream pBuffer
@@ -3453,7 +3454,6 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn · 1500 unmodified lines
34533454 int32_t& iLayerNum, int32_t& iFrameSize, long long uiTimeStamp) {
34543455 SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
34553456 SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];
3456−
34573457 if (!pSvcParam->bSimulcastAVC) {
34583458 pCtx->iSkipFrameFlag = false;
34593459 for (int32_t iDid = 0; iDid < iSpatialNum; iDid++) {
@@ -3461,8 +3461,6 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn · 1 unmodified line
34613461 pCtx->iSkipFrameFlag = 1;
34623462 }
34633463 }
3464−
3465−
34663464 EVideoFrameType eFrameType = DecideFrameType (pCtx, iSpatialNum, iCurDid);
34673465
34683466 if (eFrameType == videoFrameTypeSkip) {
@@ -3502,35 +3500,34 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn · 33 unmodified lines
35023500 pCtx->iContinualSkipFrames = 0;
35033501 iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[iCurDid], pParamInternal->iCodingIndex,
35043502 pSvcParam->uiGopSize);
3505− //skip this spatial layer
3506− if (iCurTid == INVALID_TEMPORAL_ID) {
3507− pParamInternal->iCodingIndex ++;
3508− eFrameType = videoFrameTypeSkip;
3509− pLayerBsInfo->eFrameType = videoFrameTypeSkip;
3510− } else {
3511− pCtx->uiTemporalId = iCurTid;
3512− if (eFrameType == videoFrameTypeIDR) {
3513− // write parameter sets bitstream or SEI/SSEI (if any) here
3514− // TODO: use function pointer instead
3515− if (! (SPS_LISTING & pCtx->pSvcParam->eSpsPpsIdStrategy)) {
3516− if (pSvcParam->bSimulcastAVC) {
3517− pCtx->iEncoderError = WriteSavcParaset (pCtx, iCurDid, pLayerBsInfo, iLayerNum, iFrameSize);
3518− ++ pCtx->uiIdrPicId;
3519− } else {
3520− pCtx->iEncoderError = WriteSsvcParaset (pCtx, iSpatialNum, pLayerBsInfo, iLayerNum, iFrameSize);
3521− ++ pCtx->uiIdrPicId;
3522− }
3503+ pCtx->uiTemporalId = iCurTid;
3504+ if (eFrameType == videoFrameTypeIDR) {
3505+ // write parameter sets bitstream or SEI/SSEI (if any) here
3506+ // TODO: use function pointer instead
3507+ if (! (SPS_LISTING & pCtx->pSvcParam->eSpsPpsIdStrategy)) {
3508+ if (pSvcParam->bSimulcastAVC) {
3509+ pCtx->iEncoderError = WriteSavcParaset (pCtx, iCurDid, pLayerBsInfo, iLayerNum, iFrameSize);
3510+ ++ pCtx->uiIdrPicId;
35233511 } else {
3524− pCtx->iEncoderError = WriteSavcParaset_Listing (pCtx, iSpatialNum, pLayerBsInfo, iLayerNum, iFrameSize);
3525−
3512+ pCtx->iEncoderError = WriteSsvcParaset (pCtx, iSpatialNum, pLayerBsInfo, iLayerNum, iFrameSize);
35263513 ++ pCtx->uiIdrPicId;
35273514 }
3515+ } else {
3516+ pCtx->iEncoderError = WriteSavcParaset_Listing (pCtx, iSpatialNum, pLayerBsInfo, iLayerNum, iFrameSize);
3517+
3518+ ++ pCtx->uiIdrPicId;
35283519 }
35293520 }
3530−
3521+ if (!pSvcParam->bSimulcastAVC) {
3522+ for (int32_t i = 0; i < pSvcParam->iSpatialLayerNum; i++) {
3523+ SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[i];
3524+ pParamInternal->iCodingIndex ++;
3525+ }
3526+ } else {
3527+ SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iCurDid];
3528+ pParamInternal->iCodingIndex++;
3529+ }
35313530 }
3532−
3533−
35343531 return eFrameType;
35353532 }
35363533 /*!
@@ -3608,8 +3605,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 71 unmodified lines
36083605 InitBitStream (pCtx);
36093606 pLayerBsInfo->pBsBuf = pCtx->pFrameBs ;
36103607 pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
3611−
3612− pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid];
3608+ iCurDid = pSpatialIndexMap->iDid;
3609+ pCtx->pCurDqLayer = pCtx->ppDqLayerList[iCurDid];
36133610 pCtx->pCurDqLayer->pRefLayer = NULL;
36143611 if (!pSvcParam->bSimulcastAVC) {
36153612 eFrameType = PrepareEncodeFrame (pCtx, pLayerBsInfo, iSpatialNum , iCurDid, iCurTid, iLayerNum, iFrameSize,
@@ -3617,9 +3614,16 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1 unmodified line
36173614 if (eFrameType == videoFrameTypeSkip) {
36183615 pFbi->eFrameType = videoFrameTypeSkip;
36193616 pLayerBsInfo->eFrameType = videoFrameTypeSkip;
3620−
36213617 return ENC_RETURN_SUCCESS;
36223618 }
3619+ } else {
3620+ for (int32_t iDidIdx = 0; iDidIdx < pSvcParam->iSpatialLayerNum; iDidIdx++) {
3621+ SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iDidIdx];
3622+ int32_t iTemporalId = GetTemporalLevel (pParamInternal, pParamInternal->iCodingIndex,
3623+ pSvcParam->uiGopSize);
3624+ if (iTemporalId == INVALID_TEMPORAL_ID)
3625+ pParamInternal->iCodingIndex ++;
3626+ }
36233627 }
36243628
36253629 while (iSpatialIdx < iSpatialNum) {
@@ -3713,7 +3717,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 87 unmodified lines
37133717
37143718 WelsInitCurrentLayer (pCtx, iCurWidth, iCurHeight);
37153719
3716− pCtx->pReferenceStrategy->MarkPic ();
3720+ pCtx->pReferenceStrategy->MarkPic();
37173721 if (!pCtx->pReferenceStrategy->BuildRefList (pParamInternal->iPOC, 0)) {
37183722 WelsLog (pLogCtx, WELS_LOG_WARNING,
37193723 "WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!",
@@ -3723,7 +3727,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines
37233727 break;
37243728 }
37253729 if (pCtx->eSliceType != I_SLICE) {
3726− pCtx->pReferenceStrategy->AfterBuildRefList ();
3730+ pCtx->pReferenceStrategy->AfterBuildRefList();
37273731 }
37283732 #ifdef LONG_TERM_REF_DUMP
37293733 DumpRef (pCtx);
@@ -3981,7 +3985,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 251 unmodified lines
39813985
39823986 // reference picture list update
39833987 if (eNalRefIdc != NRI_PRI_LOWEST) {
3984− if (!pCtx->pReferenceStrategy->UpdateRefList ()) {
3988+ if (!pCtx->pReferenceStrategy->UpdateRefList()) {
39853989 WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!");
39863990 //the above is to set the next frame to be IDR
39873991 pCtx->iEncoderError = ENC_RETURN_CORRECTED;
@@ -4155,7 +4159,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 167 unmodified lines
41554159 && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) {
41564160 pCtx->bRefOfCurTidIsLtr[iCurDid][iCurTid] = true;
41574161 }
4158− ++ pParamInternal->iCodingIndex;
4162+ // ++ pParamInternal->iCodingIndex;
41594163 }//end of (iSpatialIdx/iSpatialNum)
41604164
41614165 if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {

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