Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 17 files). Show all
Unified · Split
| @@ -46,6 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | #include "picture_handle.h" |
| 47 | 47 | #include "svc_base_layer_md.h" |
| 48 | 48 | #include "svc_encode_slice.h" |
| 49 | +#include "svc_mode_decision.h" | |
| 49 | 50 | #include "decode_mb_aux.h" |
| 50 | 51 | #include "deblocking.h" |
| 51 | 52 | #include "ref_list_mgr_svc.h" |
| @@ -527,7 +528,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 475 unmodified lines | ||
| 527 | 528 | iCountNumNals += kiNumOfSlice; |
| 528 | 529 | assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER); |
| 529 | 530 | if (kiNumOfSlice > MAX_SLICES_NUM) { |
| 530 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR, | |
| 531 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR, | |
| 531 | 532 | "AcquireLayersNals(), num_of_slice(%d) > MAX_SLICES_NUM(%d) per (iDid= %d, qid= %d) settings!\n", |
| 532 | 533 | kiNumOfSlice, MAX_SLICES_NUM, iDIndex, 0); |
| 533 | 534 | return 1; |
| @@ -535,7 +536,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 1 unmodified line | ||
| 535 | 536 | } |
| 536 | 537 | |
| 537 | 538 | if (iCountNumNals - iOrgNumNals > MAX_NAL_UNITS_IN_LAYER) { |
| 538 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR, | |
| 539 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR, | |
| 539 | 540 | "AcquireLayersNals(), num_of_nals(%d) > MAX_NAL_UNITS_IN_LAYER(%d) per (iDid= %d, qid= %d) settings!\n", |
| 540 | 541 | (iCountNumNals - iOrgNumNals), MAX_NAL_UNITS_IN_LAYER, iDIndex, 0); |
| 541 | 542 | return 1; |
| @@ -551,7 +552,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 9 unmodified lines | ||
| 551 | 552 | |
| 552 | 553 | // to check number of layers / nals / slices dependencies, 12/8/2010 |
| 553 | 554 | if (iCountNumLayers > MAX_LAYER_NUM_OF_FRAME) { |
| 554 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR, "AcquireLayersNals(), iCountNumLayers(%d) > MAX_LAYER_NUM_OF_FRAME(%d)!", | |
| 555 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR, "AcquireLayersNals(), iCountNumLayers(%d) > MAX_LAYER_NUM_OF_FRAME(%d)!", | |
| 555 | 556 | iCountNumLayers, MAX_LAYER_NUM_OF_FRAME); |
| 556 | 557 | return 1; |
| 557 | 558 | } |
| @@ -955,7 +956,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 397 unmodified lines | ||
| 955 | 956 | & (pDlayerParam->sSliceCfg), |
| 956 | 957 | pPps); |
| 957 | 958 | if (iResult) { |
| 958 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult); | |
| 959 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult); | |
| 959 | 960 | FreeMemorySvc (ppCtx); |
| 960 | 961 | return 1; |
| 961 | 962 | } |
| @@ -1278,21 +1279,22 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 316 unmodified lines | ||
| 1278 | 1279 | (*ppCtx)->iMvRange = pParam->iUsageType ? EXPANDED_MV_RANGE : CAMERA_STARTMV_RANGE; |
| 1279 | 1280 | const int32_t kiMvdRange = (pParam->iUsageType ? EXPANDED_MVD_RANGE : ((kiNumDependencyLayers == 1) ? CAMERA_MVD_RANGE : |
| 1280 | 1281 | CAMERA_HIGHLAYER_MVD_RANGE)); |
| 1281 | − const uint32_t kuiMvdInterTableSize = 1 + (kiMvdRange << 3);//intepel*4=qpel; qpel_mv_range*2=(+/-); | |
| 1282 | − const uint32_t kuiMvdCacheAlignedSize = kuiMvdInterTableSize * sizeof (uint16_t); | |
| 1282 | + const uint32_t kuiMvdInterTableSize = (kiMvdRange << 2); //intepel*4=qpel | |
| 1283 | + const uint32_t kuiMvdInterTableStride = 1 + (kuiMvdInterTableSize << 1);//qpel_mv_range*2=(+/-); | |
| 1284 | + const uint32_t kuiMvdCacheAlignedSize = kuiMvdInterTableStride * sizeof (uint16_t); | |
| 1283 | 1285 | int32_t iVclLayersBsSizeCount = 0; |
| 1284 | 1286 | int32_t iNonVclLayersBsSizeCount = 0; |
| 1285 | 1287 | int32_t iTargetSpatialBsSize = 0; |
| 1286 | 1288 | |
| 1287 | 1289 | if (kiNumDependencyLayers < 1 || kiNumDependencyLayers > MAX_DEPENDENCY_LAYER) { |
| 1288 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc() failed due to invalid iNumDependencyLayers(%d)!\n", | |
| 1290 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc() failed due to invalid iNumDependencyLayers(%d)!\n", | |
| 1289 | 1291 | kiNumDependencyLayers); |
| 1290 | 1292 | FreeMemorySvc (ppCtx); |
| 1291 | 1293 | return 1; |
| 1292 | 1294 | } |
| 1293 | 1295 | |
| 1294 | 1296 | if (pParam->uiGopSize == 0 || (pParam->uiIntraPeriod && ((pParam->uiIntraPeriod % pParam->uiGopSize) != 0))) { |
| 1295 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, | |
| 1297 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, | |
| 1296 | 1298 | "RequestMemorySvc() failed due to invalid uiIntraPeriod(%d) (=multipler of uiGopSize(%d)!", |
| 1297 | 1299 | pParam->uiIntraPeriod, pParam->uiGopSize); |
| 1298 | 1300 | FreeMemorySvc (ppCtx); |
| @@ -1306,7 +1308,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 7 unmodified lines | ||
| 1306 | 1308 | |
| 1307 | 1309 | iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals); |
| 1308 | 1310 | if (iResult) { |
| 1309 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AcquireLayersNals failed(%d)!", iResult); | |
| 1311 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AcquireLayersNals failed(%d)!", iResult); | |
| 1310 | 1312 | FreeMemorySvc (ppCtx); |
| 1311 | 1313 | return 1; |
| 1312 | 1314 | } |
| @@ -1359,7 +1361,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 46 unmodified lines | ||
| 1359 | 1361 | |
| 1360 | 1362 | // for pSlice bs buffers |
| 1361 | 1363 | if (pParam->iMultipleThreadIdc > 1 && RequestMtResource (ppCtx, pParam, iCountBsLen, iTargetSpatialBsSize)) { |
| 1362 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!"); | |
| 1364 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!"); | |
| 1363 | 1365 | FreeMemorySvc (ppCtx); |
| 1364 | 1366 | return 1; |
| 1365 | 1367 | } |
| @@ -1406,7 +1408,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 40 unmodified lines | ||
| 1406 | 1408 | |
| 1407 | 1409 | // stride tables |
| 1408 | 1410 | if (AllocStrideTables (ppCtx, kiNumDependencyLayers)) { |
| 1409 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AllocStrideTables failed!"); | |
| 1411 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), AllocStrideTables failed!"); | |
| 1410 | 1412 | FreeMemorySvc (ppCtx); |
| 1411 | 1413 | return 1; |
| 1412 | 1414 | } |
| @@ -1422,7 +1424,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 9 unmodified lines | ||
| 1422 | 1424 | (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa"); |
| 1423 | 1425 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx)) |
| 1424 | 1426 | if (RequestMemoryVaaScreen ((*ppCtx)->pVaa, pMa, (*ppCtx)->pSvcParam->iMaxNumRefFrame, iCountMaxMbNum << 2)) { |
| 1425 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!"); | |
| 1427 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMemoryVaaScreen failed!"); | |
| 1426 | 1428 | FreeMemorySvc (ppCtx); |
| 1427 | 1429 | return 1; |
| 1428 | 1430 | } |
| @@ -1471,20 +1473,22 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 42 unmodified lines | ||
| 1471 | 1473 | |
| 1472 | 1474 | iResult = InitDqLayers (ppCtx); |
| 1473 | 1475 | if (iResult) { |
| 1474 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitDqLayers failed(%d)!", iResult); | |
| 1476 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitDqLayers failed(%d)!", iResult); | |
| 1475 | 1477 | FreeMemorySvc (ppCtx); |
| 1476 | 1478 | return iResult; |
| 1477 | 1479 | } |
| 1478 | 1480 | |
| 1479 | 1481 | if (InitMbListD (ppCtx)) { |
| 1480 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitMbListD failed!"); | |
| 1482 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), InitMbListD failed!"); | |
| 1481 | 1483 | FreeMemorySvc (ppCtx); |
| 1482 | 1484 | return 1; |
| 1483 | 1485 | } |
| 1484 | 1486 | |
| 1485 | − (*ppCtx)->pMvdCostTableInter = (uint16_t*)pMa->WelsMallocz (52 * kuiMvdCacheAlignedSize, "pMvdCostTableInter"); | |
| 1486 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pMvdCostTableInter), FreeMemorySvc (ppCtx)) | |
| 1487 | − MvdCostInit ((*ppCtx)->pMvdCostTableInter, kuiMvdInterTableSize); //should put to a better place? | |
| 1487 | + (*ppCtx)->iMvdCostTableSize = kuiMvdInterTableSize; | |
| 1488 | + (*ppCtx)->iMvdCostTableStride = kuiMvdInterTableStride; | |
| 1489 | + (*ppCtx)->pMvdCostTable = (uint16_t*)pMa->WelsMallocz (52 * kuiMvdCacheAlignedSize, "pMvdCostTable"); | |
| 1490 | + WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pMvdCostTable), FreeMemorySvc (ppCtx)) | |
| 1491 | + MvdCostInit ((*ppCtx)->pMvdCostTable, kuiMvdInterTableStride); //should put to a better place? | |
| 1488 | 1492 | |
| 1489 | 1493 | if ((*ppCtx)->ppRefPicListExt[0] != NULL && (*ppCtx)->ppRefPicListExt[0]->pRef[0] != NULL) |
| 1490 | 1494 | (*ppCtx)->pDecPic = (*ppCtx)->ppRefPicListExt[0]->pRef[0]; |
| @@ -1741,9 +1745,9 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 250 unmodified lines | ||
| 1741 | 1745 | } |
| 1742 | 1746 | |
| 1743 | 1747 | /* MVD cost tables for Inter */ |
| 1744 | − if (NULL != pCtx->pMvdCostTableInter) { | |
| 1745 | − pMa->WelsFree (pCtx->pMvdCostTableInter, "pMvdCostTableInter"); | |
| 1746 | − pCtx->pMvdCostTableInter = NULL; | |
| 1748 | + if (NULL != pCtx->pMvdCostTable) { | |
| 1749 | + pMa->WelsFree (pCtx->pMvdCostTable, "pMvdCostTable"); | |
| 1750 | + pCtx->pMvdCostTable = NULL; | |
| 1747 | 1751 | } |
| 1748 | 1752 | |
| 1749 | 1753 | FreeCodingParam (&pCtx->pSvcParam, pMa); |
| @@ -1757,7 +1761,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 7 unmodified lines | ||
| 1757 | 1761 | #endif//MEMORY_MONITOR |
| 1758 | 1762 | |
| 1759 | 1763 | if ((*ppCtx)->pMemAlign != NULL) { |
| 1760 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_INFO, "FreeMemorySvc(), verify memory usage (%d bytes) after free..\n", | |
| 1764 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "FreeMemorySvc(), verify memory usage (%d bytes) after free..\n", | |
| 1761 | 1765 | (*ppCtx)->pMemAlign->WelsGetMemoryUsage()); |
| 1762 | 1766 | delete (*ppCtx)->pMemAlign; |
| 1763 | 1767 | (*ppCtx)->pMemAlign = NULL; |
| @@ -2150,7 +2154,8 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 386 unmodified lines | ||
| 2150 | 2154 | if (NULL == ppCtx || NULL == *ppCtx) |
| 2151 | 2155 | return; |
| 2152 | 2156 | |
| 2153 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pCtx= %p, iThreadCount= %d, iMultipleThreadIdc= %d.\n", | |
| 2157 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, | |
| 2158 | + "WelsUninitEncoderExt(), pCtx= %p, iThreadCount= %d, iMultipleThreadIdc= %d.\n", | |
| 2154 | 2159 | (void*) (*ppCtx), (*ppCtx)->pSvcParam->iCountThreadsNum, (*ppCtx)->pSvcParam->iMultipleThreadIdc); |
| 2155 | 2160 | |
| 2156 | 2161 | #if defined(STAT_OUTPUT) |
| @@ -2168,7 +2173,8 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 11 unmodified lines | ||
| 2168 | 2173 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]); |
| 2169 | 2174 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]); |
| 2170 | 2175 | res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit |
| 2171 | − WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", iThreadIdx, | |
| 2176 | + WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..\n", | |
| 2177 | + iThreadIdx, | |
| 2172 | 2178 | res); |
| 2173 | 2179 | (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0; |
| 2174 | 2180 | } |
| @@ -2333,7 +2339,7 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 158 unmodified lines | ||
| 2333 | 2339 | / (pSliceCtx->iMaxSliceNumConstraint)) |
| 2334 | 2340 | ) { |
| 2335 | 2341 | |
| 2336 | − WelsLog (&(pCtx->sLogCtx), | |
| 2342 | + WelsLog (& (pCtx->sLogCtx), | |
| 2337 | 2343 | WELS_LOG_WARNING, |
| 2338 | 2344 | "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!\n", |
| 2339 | 2345 | pSliceCtx->uiSliceSizeConstraint, |
| @@ -2492,16 +2498,21 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 152 unmodified lines | ||
| 2492 | 2498 | const bool kbHighestSpatialLayer = |
| 2493 | 2499 | (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1)); |
| 2494 | 2500 | SWelsFuncPtrList* pFuncList = pCtx->pFuncList; |
| 2495 | − SLogContext* pLogCtx = &(pCtx->sLogCtx); | |
| 2501 | + SLogContext* pLogCtx = & (pCtx->sLogCtx); | |
| 2496 | 2502 | /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */ |
| 2497 | − if (kbHighestSpatialLayer && pCtx->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME) { | |
| 2503 | + if ((pCtx->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME && kbHighestSpatialLayer) || | |
| 2504 | + (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME && P_SLICE == pCtx->eSliceType | |
| 2505 | + && kbHighestSpatialLayer) //TODO: here is for sync with the origin code, consider the design again with more tests | |
| 2506 | + ) { | |
| 2498 | 2507 | SetFastCodingFunc (pFuncList); |
| 2499 | 2508 | } else { |
| 2500 | 2509 | SetNormalCodingFunc (pFuncList); |
| 2501 | 2510 | } |
| 2502 | 2511 | |
| 2503 | 2512 | if (P_SLICE == pCtx->eSliceType) { |
| 2504 | − pFuncList->pfMotionSearch[0] = WelsMotionEstimateSearch; | |
| 2513 | + for (int i = 0; i < BLOCK_STATIC_IDC_ALL; i++) { | |
| 2514 | + pFuncList->pfMotionSearch[i] = WelsMotionEstimateSearch; | |
| 2515 | + } | |
| 2505 | 2516 | pFuncList->pfSearchMethod[BLOCK_16x16] = |
| 2506 | 2517 | pFuncList->pfSearchMethod[BLOCK_16x8] = |
| 2507 | 2518 | pFuncList->pfSearchMethod[BLOCK_8x16] = |
| @@ -2509,6 +2520,8 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 1 unmodified line | ||
| 2509 | 2520 | pFuncList->pfSearchMethod[BLOCK_4x4] = WelsDiamondSearch; |
| 2510 | 2521 | pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode; |
| 2511 | 2522 | pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd; |
| 2523 | + pFuncList->pfSetScrollingMv = SetScrollingMvToMdNull; | |
| 2524 | + | |
| 2512 | 2525 | if (kbHighestSpatialLayer) { |
| 2513 | 2526 | pFuncList->pfCalculateSatd = NotCalculateSatdCost; |
| 2514 | 2527 | pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa; |
| @@ -2518,7 +2531,6 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 3 unmodified lines | ||
| 2518 | 2531 | } |
| 2519 | 2532 | } |
| 2520 | 2533 | |
| 2521 | − return; | |
| 2522 | 2534 | //to init at each frame will be needed when dealing with hybrid content (camera+screen) |
| 2523 | 2535 | if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) { |
| 2524 | 2536 | if (P_SLICE == pCtx->eSliceType) { |
| @@ -2526,6 +2538,17 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 1 unmodified line | ||
| 2526 | 2538 | pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen; |
| 2527 | 2539 | |
| 2528 | 2540 | //ME related func pointers |
| 2541 | + SVAAFrameInfoExt* pVaaExt = static_cast<SVAAFrameInfoExt*> (pCtx->pVaa); | |
| 2542 | + if (pVaaExt->sScrollDetectInfo.bScrollDetectFlag | |
| 2543 | + && (pVaaExt->sScrollDetectInfo.iScrollMvX | pVaaExt->sScrollDetectInfo.iScrollMvY)) { | |
| 2544 | + pFuncList->pfSetScrollingMv = SetScrollingMvToMd; | |
| 2545 | + } else { | |
| 2546 | + pFuncList->pfSetScrollingMv = SetScrollingMvToMdNull; | |
| 2547 | + } | |
| 2548 | + | |
| 2549 | + pFuncList->pfMotionSearch[NO_STATIC] = WelsMotionEstimateSearch; | |
| 2550 | + pFuncList->pfMotionSearch[COLLOCATED_STATIC] = WelsMotionEstimateSearchStatic; | |
| 2551 | + pFuncList->pfMotionSearch[SCROLLED_STATIC] = WelsMotionEstimateSearchScrolled; | |
| 2529 | 2552 | //ME16x16 |
| 2530 | 2553 | if (!SetMeMethod (ME_DIA_CROSS, pFuncList->pfSearchMethod[BLOCK_16x16])) { |
| 2531 | 2554 | WelsLog (pLogCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_16x16) ME_DIA_CROSS unsuccessful, switched to default search\n"); |
| @@ -2547,8 +2570,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 15 unmodified lines | ||
| 2547 | 2570 | pFeatureSearchPreparation->pRefBlockFeature = pScreenBlockFeatureStorage; |
| 2548 | 2571 | if (pFeatureSearchPreparation->bFMESwitchFlag |
| 2549 | 2572 | && !pScreenBlockFeatureStorage->bRefBlockFeatureCalculated) { |
| 2550 | − //TODO: use ORIGIN of reference when preprocessing is ready | |
| 2551 | − PerformFMEPreprocess (pFuncList, pCurLayer->pRefPic, pFeatureSearchPreparation->pFeatureOfBlock, | |
| 2573 | + PerformFMEPreprocess (pFuncList, pCurLayer->pRefOri[0], pFeatureSearchPreparation->pFeatureOfBlock, | |
| 2552 | 2574 | pScreenBlockFeatureStorage); |
| 2553 | 2575 | } |
| 2554 | 2576 | |
| @@ -2556,7 +2578,8 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 1 unmodified line | ||
| 2556 | 2578 | if (pFeatureSearchPreparation->bFMESwitchFlag && pScreenBlockFeatureStorage->bRefBlockFeatureCalculated |
| 2557 | 2579 | && (!pScreenBlockFeatureStorage->iIs16x16)) { |
| 2558 | 2580 | if (!SetMeMethod (ME_DIA_CROSS_FME, pFuncList->pfSearchMethod[BLOCK_8x8])) { |
| 2559 | − WelsLog (pLogCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_8x8) ME_DIA_CROSS_FME unsuccessful, switched to default search\n"); | |
| 2581 | + WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 2582 | + "SetMeMethod(BLOCK_8x8) ME_DIA_CROSS_FME unsuccessful, switched to default search\n"); | |
| 2560 | 2583 | } |
| 2561 | 2584 | } |
| 2562 | 2585 | |
| @@ -2833,7 +2856,7 @@ int32_t WritePadding (sWelsEncCtx* pCtx, int32_t iLen, int32_t& iSize) { · 270 unmodified lines | ||
| 2833 | 2856 | |
| 2834 | 2857 | if ((pBs->pBufEnd - pBs->pBufPtr) < iLen || iNal >= pCtx->pOut->iCountNals) { |
| 2835 | 2858 | #if GOM_TRACE_FLAG |
| 2836 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, | |
| 2859 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | |
| 2837 | 2860 | "[RC] paddingcal pBuffer overflow, bufferlen=%lld, paddinglen=%d, iNalIdx= %d, iCountNals= %d\n", |
| 2838 | 2861 | static_cast<long long int> (pBs->pBufEnd - pBs->pBufPtr), iLen, iNal, pCtx->pOut->iCountNals); |
| 2839 | 2862 | #endif |
| @@ -2947,7 +2970,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 107 unmodified lines | ||
| 2947 | 2970 | int8_t iCurDid = 0; |
| 2948 | 2971 | int8_t iCurTid = 0; |
| 2949 | 2972 | bool bAvcBased = false; |
| 2950 | − SLogContext* pLogCtx = &(pCtx->sLogCtx); | |
| 2973 | + SLogContext* pLogCtx = & (pCtx->sLogCtx); | |
| 2951 | 2974 | #if defined(ENABLE_PSNR_CALC) |
| 2952 | 2975 | float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f; |
| 2953 | 2976 | #endif//ENABLE_PSNR_CALC |
| @@ -3366,6 +3389,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 412 unmodified lines | ||
| 3366 | 3389 | PerformDeblockingFilter (pCtx); |
| 3367 | 3390 | } |
| 3368 | 3391 | |
| 3392 | + pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); | |
| 3393 | + pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc->iAverageFrameQp; | |
| 3394 | + | |
| 3395 | + //update scc related | |
| 3396 | + pCtx->pFuncList->pfUpdateFMESwitch (pCtx->pCurDqLayer); | |
| 3397 | + | |
| 3369 | 3398 | // reference picture list update |
| 3370 | 3399 | if (eNalRefIdc != NRI_PRI_LOWEST) { |
| 3371 | 3400 | if (!pCtx->pFuncList->pUpdateRefList (pCtx)) { |
| @@ -3380,8 +3409,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 8 unmodified lines | ||
| 3380 | 3409 | |
| 3381 | 3410 | iFrameSize += iLayerSize; |
| 3382 | 3411 | |
| 3383 | − pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); | |
| 3384 | − | |
| 3385 | 3412 | #ifdef ENABLE_FRAME_DUMP |
| 3386 | 3413 | // Dump reconstruction picture for each sQualityStat layer |
| 3387 | 3414 | if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) |