History

Merge pull request #2325 from ruil2/trace1

separate each layer trace output

HaiboZhu committed 10 years ago

Commit b940e2c2 parents 737548f d4f979c4 files · +147 −115Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+22−14
@@ -3412,7 +3412,7 @@ int32_t ForceCodingIDR (sWelsEncCtx* pCtx) { · 3411 unmodified lines
3412 pCtx->bCheckWindowStatusRefreshFlag = false;3412 pCtx->bCheckWindowStatusRefreshFlag = false;
3413 3413
3414 WelsLog (&pCtx->sLogCtx, WELS_LOG_INFO, "ForceCodingIDR at InputFrameCount=%d\n",3414 WelsLog (&pCtx->sLogCtx, WELS_LOG_INFO, "ForceCodingIDR at InputFrameCount=%d\n",
3415 pCtx->sEncoderStatistics.uiInputFrameCount);3415 pCtx->sEncoderStatistics[0].uiInputFrameCount);
3416 return 0;3416 return 0;
3417}3417}
3418 3418
@@ -3435,7 +3435,7 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { · 16 unmodified lines
3435 pLayerBsInfo->uiQualityId = 0;3435 pLayerBsInfo->uiQualityId = 0;
3436 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;3436 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
3437 pLayerBsInfo->iNalCount = iCountNal;3437 pLayerBsInfo->iNalCount = iCountNal;
3438 3438 pLayerBsInfo->eFrameType = videoFrameTypeIDR;
3439 //pCtx->eLastNalPriority = NRI_PRI_HIGHEST;3439 //pCtx->eLastNalPriority = NRI_PRI_HIGHEST;
3440 pFbi->iLayerNum = 1;3440 pFbi->iLayerNum = 1;
3441 pFbi->eFrameType = videoFrameTypeInvalid;3441 pFbi->eFrameType = videoFrameTypeInvalid;
@@ -3473,7 +3473,7 @@ int32_t WriteSsvcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 31 unmodified lines
3473 pLayerBsInfo->uiQualityId = 0;3473 pLayerBsInfo->uiQualityId = 0;
3474 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;3474 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
3475 pLayerBsInfo->iNalCount = iCountNal;3475 pLayerBsInfo->iNalCount = iCountNal;
3476 3476 pLayerBsInfo->eFrameType = videoFrameTypeIDR;
3477 //point to next pLayerBsInfo3477 //point to next pLayerBsInfo
3478 ++ pLayerBsInfo;3478 ++ pLayerBsInfo;
3479 ++ pCtx->pOut->iLayerBsIndex;3479 ++ pCtx->pOut->iLayerBsIndex;
@@ -3514,7 +3514,7 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 34 unmodified lines
3514 pLayerBsInfo->uiQualityId = 0;3514 pLayerBsInfo->uiQualityId = 0;
3515 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;3515 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
3516 pLayerBsInfo->iNalCount = iCountNal;3516 pLayerBsInfo->iNalCount = iCountNal;
3517 3517 pLayerBsInfo->eFrameType = videoFrameTypeIDR;
3518 //point to next pLayerBsInfo3518 //point to next pLayerBsInfo
3519 ++ pLayerBsInfo;3519 ++ pLayerBsInfo;
3520 ++ pCtx->pOut->iLayerBsIndex;3520 ++ pCtx->pOut->iLayerBsIndex;
@@ -3547,7 +3547,7 @@ int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 26 unmodified lines
3547 pLayerBsInfo->uiQualityId = 0;3547 pLayerBsInfo->uiQualityId = 0;
3548 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;3548 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
3549 pLayerBsInfo->iNalCount = iCountNal;3549 pLayerBsInfo->iNalCount = iCountNal;
3550 3550 pLayerBsInfo->eFrameType = videoFrameTypeIDR;
3551 //point to next pLayerBsInfo3551 //point to next pLayerBsInfo
3552 ++ pLayerBsInfo;3552 ++ pLayerBsInfo;
3553 ++ pCtx->pOut->iLayerBsIndex;3553 ++ pCtx->pOut->iLayerBsIndex;
@@ -3595,7 +3595,7 @@ int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 41 unmodified lines
3595 pLayerBsInfo->uiQualityId = 0;3595 pLayerBsInfo->uiQualityId = 0;
3596 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;3596 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
3597 pLayerBsInfo->iNalCount = iCountNal;3597 pLayerBsInfo->iNalCount = iCountNal;
3598 3598 pLayerBsInfo->eFrameType = videoFrameTypeIDR;
3599 //point to next pLayerBsInfo3599 //point to next pLayerBsInfo
3600 ++ pLayerBsInfo;3600 ++ pLayerBsInfo;
3601 ++ pCtx->pOut->iLayerBsIndex;3601 ++ pCtx->pOut->iLayerBsIndex;
@@ -3630,7 +3630,7 @@ int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum, · 28 unmodified lines
3630 pLayerBsInfo->uiQualityId = 0;3630 pLayerBsInfo->uiQualityId = 0;
3631 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;3631 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
3632 pLayerBsInfo->iNalCount = iCountNal;3632 pLayerBsInfo->iNalCount = iCountNal;
3633 3633 pLayerBsInfo->eFrameType = videoFrameTypeIDR;
3634 //point to next pLayerBsInfo3634 //point to next pLayerBsInfo
3635 ++ pLayerBsInfo;3635 ++ pLayerBsInfo;
3636 ++ pCtx->pOut->iLayerBsIndex;3636 ++ pCtx->pOut->iLayerBsIndex;
@@ -3745,6 +3745,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 108 unmodified lines
3745 pCtx->bCurFrameMarkedAsSceneLtr = false;3745 pCtx->bCurFrameMarkedAsSceneLtr = false;
3746 pFbi->iLayerNum = 0; // for initialization3746 pFbi->iLayerNum = 0; // for initialization
3747 pFbi->uiTimeStamp = pSrcPic->uiTimeStamp;3747 pFbi->uiTimeStamp = pSrcPic->uiTimeStamp;
3748 for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) {
3749 pFbi->sLayerInfo[iNalIdx].eFrameType = videoFrameTypeSkip;
3750 }
3748 // perform csc/denoise/downsample/padding, generate spatial layers3751 // perform csc/denoise/downsample/padding, generate spatial layers
3749 iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic);3752 iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic);
3750 if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) {3753 if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) {
@@ -3953,12 +3956,14 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 202 unmodified lines
3953 pLayerBsInfo->uiTemporalId = iCurTid;3956 pLayerBsInfo->uiTemporalId = iCurTid;
3954 pLayerBsInfo->uiQualityId = 0;3957 pLayerBsInfo->uiQualityId = 0;
3955 pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;3958 pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;
3959 pLayerBsInfo->eFrameType = eFrameType;
3956 }3960 }
3957 // for dynamic slicing single threading..3961 // for dynamic slicing single threading..
3958 else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {3962 else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
3959 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->sSliceEncCtx.iMbNumInFrame;3963 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->sSliceEncCtx.iMbNumInFrame;
3960 pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0,3964 pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0,
3961 kiLastMbInFrame, 0);3965 kiLastMbInFrame, 0);
3966 pLayerBsInfo->eFrameType = eFrameType;
3962 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)3967 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
3963 } else {3968 } else {
3964 //other multi-slice uiSliceMode3969 //other multi-slice uiSliceMode
@@ -3984,7 +3989,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 19 unmodified lines
3984 pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId;3989 pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId;
3985 pLayerBsInfo->uiQualityId = 0;3990 pLayerBsInfo->uiQualityId = 0;
3986 pLayerBsInfo->iNalCount = 0;3991 pLayerBsInfo->iNalCount = 0;
3987 3992 pLayerBsInfo->eFrameType = eFrameType;
3988 pCtx->pTaskManage->ExecuteTasks();3993 pCtx->pTaskManage->ExecuteTasks();
3989 if (pCtx->iEncoderError) {3994 if (pCtx->iEncoderError) {
3990 WelsLog (pLogCtx, WELS_LOG_ERROR,3995 WelsLog (pLogCtx, WELS_LOG_ERROR,
@@ -4035,7 +4040,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 44 unmodified lines
4035 pLbi->uiTemporalId = pCtx->uiTemporalId;4040 pLbi->uiTemporalId = pCtx->uiTemporalId;
4036 pLbi->uiQualityId = 0;4041 pLbi->uiQualityId = 0;
4037 pLbi->iNalCount = 0;4042 pLbi->iNalCount = 0;
4038 4043 pLbi->eFrameType = eFrameType;
4039 int32_t iIdx = 0;4044 int32_t iIdx = 0;
4040 while (iIdx < kiPartitionCnt) {4045 while (iIdx < kiPartitionCnt) {
4041 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].pFrameBsInfo = pFbi;4046 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].pFrameBsInfo = pFbi;
@@ -4103,6 +4108,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 61 unmodified lines
4103 pLayerBsInfo->uiTemporalId = iCurTid;4108 pLayerBsInfo->uiTemporalId = iCurTid;
4104 pLayerBsInfo->uiQualityId = 0;4109 pLayerBsInfo->uiQualityId = 0;
4105 pLayerBsInfo->iNalCount = iNalIdxInLayer;4110 pLayerBsInfo->iNalCount = iNalIdxInLayer;
4111 pLayerBsInfo->eFrameType = eFrameType;
4106 }4112 }
4107 }4113 }
4108 4114
@@ -4281,6 +4287,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 172 unmodified lines
4281 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;4287 pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER;
4282 pLayerBsInfo->iNalCount = 1;4288 pLayerBsInfo->iNalCount = 1;
4283 pLayerBsInfo->pNalLengthInByte[0] = iPaddingNalSize;4289 pLayerBsInfo->pNalLengthInByte[0] = iPaddingNalSize;
4290 pLayerBsInfo->eFrameType = eFrameType;
4284 ++ pLayerBsInfo;4291 ++ pLayerBsInfo;
4285 ++ pCtx->pOut->iLayerBsIndex;4292 ++ pCtx->pOut->iLayerBsIndex;
4286 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;4293 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
@@ -4314,6 +4321,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 27 unmodified lines
4314 "WelsEncoderEncodeExt(), Logic Error Found in Preprocess updating. ForceCodingIDR!");4321 "WelsEncoderEncodeExt(), Logic Error Found in Preprocess updating. ForceCodingIDR!");
4315 //the above is to set the next frame IDR4322 //the above is to set the next frame IDR
4316 pFbi->eFrameType = eFrameType;4323 pFbi->eFrameType = eFrameType;
4324 pLayerBsInfo->eFrameType = eFrameType;
4317 return ENC_RETURN_CORRECTED;4325 return ENC_RETURN_CORRECTED;
4318 }4326 }
4319 4327
@@ -4326,9 +4334,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 6 unmodified lines
4326 if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {4334 if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {
4327 pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid);4335 pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid);
4328 ForceCodingIDR (pCtx);4336 ForceCodingIDR (pCtx);
4329 WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");4337 WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");
4330 //the above is to set the next frame IDR4338 //the above is to set the next frame IDR
4331 pFbi->eFrameType = eFrameType;4339 pFbi->eFrameType = eFrameType;
4340 pLayerBsInfo->eFrameType = eFrameType;
4332 return ENC_RETURN_CORRECTED;4341 return ENC_RETURN_CORRECTED;
4333 }4342 }
4334 4343
@@ -4509,7 +4518,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 174 unmodified lines
4509 int32_t iTmpPpsIdList[MAX_DQ_LAYER_NUM * MAX_PPS_COUNT];4518 int32_t iTmpPpsIdList[MAX_DQ_LAYER_NUM * MAX_PPS_COUNT];
4510 uint16_t uiTmpIdrPicId = (*ppCtx)->uiIdrPicId;//this is for LTR!4519 uint16_t uiTmpIdrPicId = (*ppCtx)->uiIdrPicId;//this is for LTR!
4511 4520
4512 SEncoderStatistics sTempEncoderStatistics = (*ppCtx)->sEncoderStatistics;4521 SEncoderStatistics sTempEncoderStatistics[MAX_DEPENDENCY_LAYER];
4522 memcpy (sTempEncoderStatistics, (*ppCtx)->sEncoderStatistics, sizeof (sTempEncoderStatistics));
4513 4523
4514 SExistingParasetList sExistingParasetList;4524 SExistingParasetList sExistingParasetList;
4515 SExistingParasetList* pExistingParasetList = NULL;4525 SExistingParasetList* pExistingParasetList = NULL;
@@ -4568,8 +4578,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 52 unmodified lines
4568 (*ppCtx)->uiIdrPicId = uiTmpIdrPicId;4578 (*ppCtx)->uiIdrPicId = uiTmpIdrPicId;
4569 4579
4570 //for sEncoderStatistics4580 //for sEncoderStatistics
4571 (*ppCtx)->sEncoderStatistics = sTempEncoderStatistics;4581 memcpy ((*ppCtx)->sEncoderStatistics, sTempEncoderStatistics, sizeof (sTempEncoderStatistics));
4572
4573 //load back the needed structure for eSpsPpsIdStrategy4582 //load back the needed structure for eSpsPpsIdStrategy
4574 if ((CONSTANT_ID != iOldSpsPpsIdStrategy) && (CONSTANT_ID != pNewParam->eSpsPpsIdStrategy)) {4583 if ((CONSTANT_ID != iOldSpsPpsIdStrategy) && (CONSTANT_ID != pNewParam->eSpsPpsIdStrategy)) {
4575 memcpy ((*ppCtx)->sPSOVector.sParaSetOffsetVariable, sTmpPsoVariable,4584 memcpy ((*ppCtx)->sPSOVector.sParaSetOffsetVariable, sTmpPsoVariable,
@@ -4934,7 +4943,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 358 unmodified lines
4934 pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId;4943 pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId;
4935 pLayerBsInfo->uiQualityId = 0;4944 pLayerBsInfo->uiQualityId = 0;
4936 pLayerBsInfo->iNalCount = iNalIdxInLayer;4945 pLayerBsInfo->iNalCount = iNalIdxInLayer;
4937
4938 return ENC_RETURN_SUCCESS;4946 return ENC_RETURN_SUCCESS;
4939}4947}
4940} // namespace WelsEnc4948} // namespace WelsEnc

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