| 826 | |
| 827 | |
| 828 | void CWelsPreProcess::AnalyzePictureComplexity (sWelsEncCtx* pCtx, SPicture* pCurPicture, SPicture* pRefPicture, |
| 829 | const int32_t kiDependencyId, const bool bCalculateBGD) { |
| 830 | SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam; |
| 831 | int32_t iComplexityAnalysisMode = 0; |
| 832 | |
| 833 | if (pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| 834 | SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa); |
| 835 | SComplexityAnalysisScreenParam* sComplexityAnalysisParam = &pVaaExt->sComplexityScreenParam; |
| 836 | SWelsSvcRc* pWelsSvcRc = &pCtx->pWelsSvcRc[kiDependencyId]; |
| 837 | |
| 838 | if (pCtx->eSliceType == P_SLICE) |
| 839 | iComplexityAnalysisMode = GOM_SAD; |
| 840 | else if (pCtx->eSliceType == I_SLICE) |
| 841 | iComplexityAnalysisMode = GOM_VAR; |
| 842 | else |
| 843 | return; |
| 844 | |
| 845 | memset (pWelsSvcRc->pGomForegroundBlockNum, 0, pWelsSvcRc->iGomSize * sizeof (int32_t)); |
| 846 | memset (pWelsSvcRc->pCurrentFrameGomSad, 0, pWelsSvcRc->iGomSize * sizeof (int32_t)); |
| 847 | |
| 848 | sComplexityAnalysisParam->iFrameComplexity = 0; |
| 849 | sComplexityAnalysisParam->pGomComplexity = pWelsSvcRc->pCurrentFrameGomSad; |
| 850 | sComplexityAnalysisParam->iGomNumInFrame = pWelsSvcRc->iGomSize; |
| 851 | sComplexityAnalysisParam->iIdrFlag = (pCtx->eSliceType == I_SLICE); |
| 852 | sComplexityAnalysisParam->iMbRowInGom = GOM_H_SCC; |
| 853 | sComplexityAnalysisParam->sScrollResult.bScrollDetectFlag = false; |
| 854 | sComplexityAnalysisParam->sScrollResult.iScrollMvX = 0; |
| 855 | sComplexityAnalysisParam->sScrollResult.iScrollMvY = 0; |
| 856 | |
| 857 | const int32_t iMethodIdx = METHOD_COMPLEXITY_ANALYSIS_SCREEN; |
| 858 | SPixMap sSrcPixMap; |
| 859 | SPixMap sRefPixMap; |
| 860 | memset (&sSrcPixMap, 0, sizeof (SPixMap)); |
| 861 | memset (&sRefPixMap, 0, sizeof (SPixMap)); |
| 862 | int32_t iRet = 0; |
| 863 | |
| 864 | sSrcPixMap.pPixel[0] = pCurPicture->pData[0]; |
| 865 | sSrcPixMap.iSizeInBits = g_kiPixMapSizeInBits; |
| 866 | sSrcPixMap.iStride[0] = pCurPicture->iLineSize[0]; |
| 867 | sSrcPixMap.sRect.iRectWidth = pCurPicture->iWidthInPixel; |
| 868 | sSrcPixMap.sRect.iRectHeight = pCurPicture->iHeightInPixel; |
| 869 | sSrcPixMap.eFormat = VIDEO_FORMAT_I420; |
| 870 | |
| 871 | if (pRefPicture != NULL) { |
| 872 | sRefPixMap.pPixel[0] = pRefPicture->pData[0]; |
| 873 | sRefPixMap.iSizeInBits = g_kiPixMapSizeInBits; |
| 874 | sRefPixMap.iStride[0] = pRefPicture->iLineSize[0]; |
| 875 | sRefPixMap.sRect.iRectWidth = pRefPicture->iWidthInPixel; |
| 876 | sRefPixMap.sRect.iRectHeight = pRefPicture->iHeightInPixel; |
| 877 | sRefPixMap.eFormat = VIDEO_FORMAT_I420; |
| 878 | } |
| 879 | |
| 880 | iRet = m_pInterfaceVp->Set (iMethodIdx, (void*)sComplexityAnalysisParam); |
| 881 | iRet = m_pInterfaceVp->Process (iMethodIdx, &sSrcPixMap, &sRefPixMap); |
| 882 | if (iRet == 0) |
| 883 | m_pInterfaceVp->Get (iMethodIdx, (void*)sComplexityAnalysisParam); |
| 884 | |
| 885 | } else { |
no test coverage detected