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

Function WelsMdInterMbLoop

codec/encoder/core/src/svc_encode_slice.cpp:1807–1898  ·  view source on GitHub ↗

for inter non-dynamic pSlice

Source from the content-addressed store, hash-verified

1805}
1806// for inter non-dynamic pSlice
1807int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd, const int32_t kiSliceFirstMbXY) {
1808 SWelsMD* pMd = (SWelsMD*)pWelsMd;
1809 SBitStringAux* pBs = pSlice->pSliceBsa;
1810 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
1811 SMbCache* pMbCache = &pSlice->sMbCacheInfo;
1812 SMB* pMbList = pCurLayer->sMbDataP;
1813 SMB* pCurMb = NULL;
1814 int32_t iNumMbCoded = 0;
1815 int32_t iNextMbIdx = kiSliceFirstMbXY;
1816 int32_t iCurMbIdx = -1;
1817 const int32_t kiTotalNumMb = pCurLayer->iMbWidth * pCurLayer->iMbHeight;
1818 const int32_t kiMvdInterTableStride = pEncCtx->iMvdCostTableStride;
1819 uint16_t* pMvdCostTable = &pEncCtx->pMvdCostTable[pEncCtx->iMvdCostTableSize];
1820 const int32_t kiSliceIdx = pSlice->iSliceIdx;
1821 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
1822 int32_t iEncReturn = ENC_RETURN_SUCCESS;
1823 SDynamicSlicingStack sDss;
1824 if (pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
1825 WelsInitSliceCabac (pEncCtx, pSlice);
1826 sDss.pRestoreBuffer = NULL;
1827 sDss.iStartPos = sDss.iCurrentPos = 0;
1828 }
1829 pSlice->iMbSkipRun = 0;
1830 for (;;) {
1831 if (!pEncCtx->pSvcParam->iEntropyCodingModeFlag)
1832 pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, pSlice->iMbSkipRun);
1833 //point to current pMb
1834 iCurMbIdx = iNextMbIdx;
1835 pCurMb = &pMbList[ iCurMbIdx ];
1836
1837
1838 //step(1): set QP for the current MB
1839 pEncCtx->pFuncList->pfRc.pfWelsRcMbInit (pEncCtx, pCurMb, pSlice);
1840
1841 //step (2). save some vale for future use, initial pWelsMd
1842 WelsMdIntraInit (pEncCtx, pCurMb, pMbCache, kiSliceFirstMbXY);
1843 WelsMdInterInit (pEncCtx, pSlice, pCurMb, kiSliceFirstMbXY);
1844
1845TRY_REENCODING:
1846 WelsInitInterMDStruc (pCurMb, pMvdCostTable, kiMvdInterTableStride, pMd);
1847 pEncCtx->pFuncList->pfInterMd (pEncCtx, pMd, pSlice, pCurMb, pMbCache);
1848 //mb_qp
1849
1850 //step (4): save from the MD process from future use
1851 WelsMdInterSaveSadAndRefMbType ((pCurLayer->pDecPic->uiRefMbType), pMbCache, pCurMb, pMd);
1852
1853 pEncCtx->pFuncList->pfMdBackgroundInfoUpdate (pCurLayer, pCurMb, pMbCache->bCollocatedPredFlag,
1854 pEncCtx->pRefPic->iPictureType);
1855
1856 //step (5): update cache
1857 UpdateNonZeroCountCache (pCurMb, pMbCache);
1858
1859 //step (6): begin to write bit stream; if the pSlice size is controlled, the writing may be skipped
1860
1861 iEncReturn = pEncCtx->pFuncList->pfWelsSpatialWriteMbSyn (pEncCtx, pSlice, pCurMb);
1862 if (!pEncCtx->pSvcParam->iEntropyCodingModeFlag) {
1863 if (iEncReturn == ENC_RETURN_VLCOVERFLOWFOUND && (pCurMb->uiLumaQp < 50)) {
1864 pSlice->iMbSkipRun = pEncCtx->pFuncList->pfStashPopMBStatus (&sDss, pSlice);

Callers 1

WelsPSliceMdEncFunction · 0.85

Calls 11

WelsInitSliceCabacFunction · 0.85
WelsMdIntraInitFunction · 0.85
WelsMdInterInitFunction · 0.85
WelsInitInterMDStrucFunction · 0.85
UpdateNonZeroCountCacheFunction · 0.85
UpdateQpForOverflowFunction · 0.85
WelsCountMbTypeFunction · 0.85
WelsGetNextMbOfSliceFunction · 0.85
BsWriteUEFunction · 0.85

Tested by

no test coverage detected