History

make two un-error ending of encoding go to a same exit and save the duplicated calling of UpdateSpatialPictures and ForceCodingIDR

Sijia Chen committed 11 years ago

Commit 2ff38e91 parent 32d15101 file · +15 −11Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+15−11
@@ -3859,15 +3859,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3858 unmodified lines
38593859
38603860 pCtx->pFuncList->pMarkPic (pCtx);
38613861 if (!pCtx->pFuncList->pBuildRefList (pCtx, pCtx->iPOC, 0)) {
3862− pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx);
3863− // Force coding IDR as followed
3864− ForceCodingIDR (pCtx);
38653862 WelsLog (pLogCtx, WELS_LOG_WARNING,
38663863 "WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!",
38673864 pCtx->iNumRef0);
3868− pFbi->eFrameType = videoFrameTypeIDR;
3865+ eFrameType = videoFrameTypeIDR;
38693866 pCtx->iEncoderError = ENC_RETURN_CORRECTED;
3870− return ENC_RETURN_CORRECTED;
3867+ break;
38713868 }
38723869 if (pCtx->eSliceType != I_SLICE) {
38733870 pCtx->pFuncList->pAfterBuildRefList (pCtx);
@@ -4134,13 +4131,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 260 unmodified lines
41344131 // reference picture list update
41354132 if (eNalRefIdc != NRI_PRI_LOWEST) {
41364133 if (!pCtx->pFuncList->pUpdateRefList (pCtx)) {
4137− pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx);
4138− // Force coding IDR as followed
4139− ForceCodingIDR (pCtx);
41404134 WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!");
41414135 //the above is to set the next frame to be IDR
4142− pFbi->eFrameType = eFrameType;
4143− return ENC_RETURN_CORRECTED;
4136+ pCtx->iEncoderError = ENC_RETURN_CORRECTED;
4137+ break;
41444138 }
41454139 }
41464140
@@ -4293,7 +4287,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 146 unmodified lines
42934287
42944288 if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) {
42954289 ForceCodingIDR (pCtx);
4296− WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");
4290+ WelsLog (pLogCtx, WELS_LOG_WARNING,
4291+ "WelsEncoderEncodeExt(), Logic Error Found in Preprocess updating. ForceCodingIDR!");
42974292 //the above is to set the next frame IDR
42984293 pFbi->eFrameType = eFrameType;
42994294 return ENC_RETURN_CORRECTED;
@@ -4305,6 +4300,15 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 5 unmodified lines
43054300 }
43064301 }
43074302
4303+ if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {
4304+ pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid);
4305+ ForceCodingIDR (pCtx);
4306+ WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");
4307+ //the above is to set the next frame IDR
4308+ pFbi->eFrameType = eFrameType;
4309+ return ENC_RETURN_CORRECTED;
4310+ }
4311+
43084312 #if defined(MT_DEBUG)
43094313 TrackSliceConsumeTime (pCtx, iDidList, iSpatialNum);
43104314 #endif//MT_DEBUG

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