History

update pre-processing workflow for screen content

ruil2 committed 12 years ago

Commit 37f20f11 parent 2ab706a4 files · +73 −31Browse files

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

Unified · Split

codec/encoder/core/src/wels_preprocess.cpp+32−16
@@ -347,31 +347,47 @@ int32_t CWelsPreProcess::AnalyzeSpatialPic (sWelsEncCtx* pCtx, const int32_t kiD · 346 unmodified lines
347347 iRefTemporalIdx = m_uiSpatialLayersInTemporal[kiDidx] + pCtx->pVaa->uiValidLongTermPicIdx;
348348
349349 SPicture* pCurPic = m_pSpatialPic[kiDidx][iCurTemporalIdx];
350− SPicture* pRefPic = m_pSpatialPic[kiDidx][iRefTemporalIdx];
351− {
350+ bool bCalculateVar = (pSvcParam->iRCMode >= RC_BITRATE_MODE && pCtx->eSliceType == I_SLICE);
351+
352+ if(pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME){
353+ SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (m_pEncCtx->pVaa);
354+ SRefInfoParam* BestRefCandidateParam =&(pVaaExt->sVaaStrBestRefCandidate[0]);
355+ SPicture *pRefPic= m_pSpatialPic[0][BestRefCandidateParam->iSrcListIdx];
356+
357+ VaaCalculation (pCtx->pVaa, pCurPic, pRefPic, false, bCalculateVar, bCalculateBGD);
358+
359+ if (pSvcParam->bEnableBackgroundDetection) {
360+ BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
361+ }
362+
363+ if (bNeededMbAq) {
364+ AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
365+ }
366+ } else {
367+ SPicture* pRefPic = m_pSpatialPic[kiDidx][iRefTemporalIdx];
352368 SPicture* pLastPic = m_pLastSpatialPicture[kiDidx][0];
353369 bool bCalculateSQDiff = ((pLastPic->pData[0] == pRefPic->pData[0]) && bNeededMbAq);
354370 bool bCalculateVar = (pSvcParam->iRCMode >= RC_BITRATE_MODE && pCtx->eSliceType == I_SLICE);
355371
356372 VaaCalculation (pCtx->pVaa, pCurPic, pRefPic, bCalculateSQDiff, bCalculateVar, bCalculateBGD);
357− }
358373
359− if (pSvcParam->bEnableBackgroundDetection) {
360− BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
361− }
374+ if (pSvcParam->bEnableBackgroundDetection) {
375+ BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
376+ }
362377
363− if (bNeededMbAq) {
364− SPicture* pCurPic = m_pLastSpatialPicture[kiDidx][1];
365− SPicture* pRefPic = m_pLastSpatialPicture[kiDidx][0];
378+ if (bNeededMbAq) {
379+ SPicture* pCurPic = m_pLastSpatialPicture[kiDidx][1];
380+ SPicture* pRefPic = m_pLastSpatialPicture[kiDidx][0];
366381
367− AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
368− }
382+ AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
383+ }
369384
370− if(pSvcParam->iUsageType != SCREEN_CONTENT_REAL_TIME){
371− if (pSvcParam->iRCMode != RC_OFF_MODE) {
372− AnalyzePictureComplexity (pCtx, pCurPic, pRefPic, kiDidx, bCalculateBGD);
385+ if(pSvcParam->iUsageType != SCREEN_CONTENT_REAL_TIME){
386+ if (pSvcParam->iRCMode != RC_OFF_MODE) {
387+ AnalyzePictureComplexity (pCtx, pCurPic, pRefPic, kiDidx, bCalculateBGD);
388+ }
389+ WelsExchangeSpatialPictures (&m_pLastSpatialPicture[kiDidx][1], &m_pLastSpatialPicture[kiDidx][0]);
373390 }
374− WelsExchangeSpatialPictures (&m_pLastSpatialPicture[kiDidx][1], &m_pLastSpatialPicture[kiDidx][0]);
375391 }
376392 return 0;
377393 }
@@ -1132,7 +1148,7 @@ int32_t CWelsPreProcess::GetRefCandidateLtrIndex(int32_t iRefIdx) · 754 unmodified lines
11321148 {
11331149 const int32_t iTargetDid = m_pEncCtx->pSvcParam->iSpatialLayerNum - 1;
11341150 SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (m_pEncCtx->pVaa);
1135− SRefInfoParam* BestRefCandidateParam =&(pVaaExt->sVaaStrBestRefCandidate[iRefIdx]);
1151+ SRefInfoParam* BestRefCandidateParam =&(pVaaExt->sVaaStrBestRefCandidate[iRefIdx]);
11361152 int32_t iLtrRefIdx = m_pSpatialPic[iTargetDid][BestRefCandidateParam->iSrcListIdx]->iLongTermPicNum;
11371153 return iLtrRefIdx;
11381154 }

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