MCPcopy Create free account
hub / github.com/cisco/openh264 / AnalyzeSpatialPic

Method AnalyzeSpatialPic

codec/encoder/core/src/wels_preprocess.cpp:265–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265int32_t CWelsPreProcess::AnalyzeSpatialPic (sWelsEncCtx* pCtx, const int32_t kiDidx) {
266 SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
267 bool bNeededMbAq = (pSvcParam->bEnableAdaptiveQuant && (pCtx->eSliceType == P_SLICE));
268 bool bCalculateBGD = (pCtx->eSliceType == P_SLICE && pSvcParam->bEnableBackgroundDetection);
269 SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[kiDidx];
270 int32_t iCurTemporalIdx = m_uiSpatialLayersInTemporal[kiDidx] - 1;
271
272 int32_t iRefTemporalIdx = (int32_t)g_kuiRefTemporalIdx[pSvcParam->iDecompStages][pParamInternal->iCodingIndex &
273 (pSvcParam->uiGopSize - 1)];
274 if (pCtx->uiTemporalId == 0 && pCtx->pLtr[pCtx->uiDependencyId].bReceivedT0LostFlag)
275 iRefTemporalIdx = m_uiSpatialLayersInTemporal[kiDidx] + pCtx->pVaa->uiValidLongTermPicIdx;
276
277 SPicture* pCurPic = m_pSpatialPic[kiDidx][iCurTemporalIdx];
278 bool bCalculateVar = (pSvcParam->iRCMode >= RC_BITRATE_MODE && pCtx->eSliceType == I_SLICE);
279
280 if (pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
281 SPicture* pRefPic = GetBestRefPic (pSvcParam->iUsageType, pCtx->bCurFrameMarkedAsSceneLtr, pCtx->eSliceType, kiDidx,
282 iRefTemporalIdx);
283
284 VaaCalculation (pCtx->pVaa, pCurPic, pRefPic, false, bCalculateVar, bCalculateBGD);
285
286 if (pSvcParam->bEnableBackgroundDetection) {
287 BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
288 }
289 if (bNeededMbAq) {
290 AdaptiveQuantCalculation (pCtx->pVaa, pCurPic, pRefPic);
291 }
292 } else {
293 SPicture* pRefPic = GetBestRefPic (kiDidx, iRefTemporalIdx);
294 SPicture* pLastPic = m_pLastSpatialPicture[kiDidx][0];
295 bool bCalculateSQDiff = ((pLastPic->pData[0] == pRefPic->pData[0]) && bNeededMbAq);
296
297 VaaCalculation (pCtx->pVaa, pCurPic, pRefPic, bCalculateSQDiff, bCalculateVar, bCalculateBGD);
298
299 if (pSvcParam->bEnableBackgroundDetection) {
300 BackgroundDetection (pCtx->pVaa, pCurPic, pRefPic, bCalculateBGD && pRefPic->iPictureType != I_SLICE);
301 }
302
303 if (bNeededMbAq) {
304 AdaptiveQuantCalculation (pCtx->pVaa, m_pLastSpatialPicture[kiDidx][1], m_pLastSpatialPicture[kiDidx][0]);
305 }
306 }
307 return 0;
308}
309
310int32_t CWelsPreProcess::GetCurPicPosition (const int32_t kiDidx) {
311 return (m_uiSpatialLayersInTemporal[kiDidx] - 1);

Callers 1

WelsEncoderEncodeExtFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected