History

Merge pull request #1057 from sijchen/scc_md_merge11

[Encoder] Completing and bug-fixing the screen content MD/ME process

ruil2 committed 12 years ago

Commit 3ef97dc2 parents bdf9f6b a964ae817 files · +404 −289Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+62−35
@@ -46,6 +46,7 @@ · 45 unmodified lines
46#include "picture_handle.h"46#include "picture_handle.h"
47#include "svc_base_layer_md.h"47#include "svc_base_layer_md.h"
48#include "svc_encode_slice.h"48#include "svc_encode_slice.h"
49#include "svc_mode_decision.h"
49#include "decode_mb_aux.h"50#include "decode_mb_aux.h"
50#include "deblocking.h"51#include "deblocking.h"
51#include "ref_list_mgr_svc.h"52#include "ref_list_mgr_svc.h"
@@ -527,7 +528,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 475 unmodified lines
527 iCountNumNals += kiNumOfSlice;528 iCountNumNals += kiNumOfSlice;
528 assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);529 assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);
529 if (kiNumOfSlice > MAX_SLICES_NUM) {530 if (kiNumOfSlice > MAX_SLICES_NUM) {
530 WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR,531 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR,
531 "AcquireLayersNals(), num_of_slice(%d) > MAX_SLICES_NUM(%d) per (iDid= %d, qid= %d) settings!\n",532 "AcquireLayersNals(), num_of_slice(%d) > MAX_SLICES_NUM(%d) per (iDid= %d, qid= %d) settings!\n",
532 kiNumOfSlice, MAX_SLICES_NUM, iDIndex, 0);533 kiNumOfSlice, MAX_SLICES_NUM, iDIndex, 0);
533 return 1;534 return 1;
@@ -535,7 +536,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 1 unmodified line
535 }536 }
536 537
537 if (iCountNumNals - iOrgNumNals > MAX_NAL_UNITS_IN_LAYER) {538 if (iCountNumNals - iOrgNumNals > MAX_NAL_UNITS_IN_LAYER) {
538 WelsLog (&(*ppCtx)->sLogCtx, WELS_LOG_ERROR,539 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR,
539 "AcquireLayersNals(), num_of_nals(%d) > MAX_NAL_UNITS_IN_LAYER(%d) per (iDid= %d, qid= %d) settings!\n",540 "AcquireLayersNals(), num_of_nals(%d) > MAX_NAL_UNITS_IN_LAYER(%d) per (iDid= %d, qid= %d) settings!\n",
540 (iCountNumNals - iOrgNumNals), MAX_NAL_UNITS_IN_LAYER, iDIndex, 0);541 (iCountNumNals - iOrgNumNals), MAX_NAL_UNITS_IN_LAYER, iDIndex, 0);
541 return 1;542 return 1;
@@ -551,7 +552,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 9 unmodified lines
551 552
552 // to check number of layers / nals / slices dependencies, 12/8/2010553 // to check number of layers / nals / slices dependencies, 12/8/2010
553 if (iCountNumLayers > MAX_LAYER_NUM_OF_FRAME) {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 iCountNumLayers, MAX_LAYER_NUM_OF_FRAME);556 iCountNumLayers, MAX_LAYER_NUM_OF_FRAME);
556 return 1;557 return 1;
557 }558 }
@@ -955,7 +956,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) { · 397 unmodified lines
955 & (pDlayerParam->sSliceCfg),956 & (pDlayerParam->sSliceCfg),
956 pPps);957 pPps);
957 if (iResult) {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 FreeMemorySvc (ppCtx);960 FreeMemorySvc (ppCtx);
960 return 1;961 return 1;
961 }962 }
@@ -1278,21 +1279,22 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 316 unmodified lines
1278 (*ppCtx)->iMvRange = pParam->iUsageType ? EXPANDED_MV_RANGE : CAMERA_STARTMV_RANGE;1279 (*ppCtx)->iMvRange = pParam->iUsageType ? EXPANDED_MV_RANGE : CAMERA_STARTMV_RANGE;
1279 const int32_t kiMvdRange = (pParam->iUsageType ? EXPANDED_MVD_RANGE : ((kiNumDependencyLayers == 1) ? CAMERA_MVD_RANGE :1280 const int32_t kiMvdRange = (pParam->iUsageType ? EXPANDED_MVD_RANGE : ((kiNumDependencyLayers == 1) ? CAMERA_MVD_RANGE :
1280 CAMERA_HIGHLAYER_MVD_RANGE));1281 CAMERA_HIGHLAYER_MVD_RANGE));
1281 const uint32_t kuiMvdInterTableSize = 1 + (kiMvdRange << 3);//intepel*4=qpel; qpel_mv_range*2=(+/-);1282 const uint32_t kuiMvdInterTableSize = (kiMvdRange << 2); //intepel*4=qpel
1282 const uint32_t kuiMvdCacheAlignedSize = kuiMvdInterTableSize * sizeof (uint16_t);1283 const uint32_t kuiMvdInterTableStride = 1 + (kuiMvdInterTableSize << 1);//qpel_mv_range*2=(+/-);
1284 const uint32_t kuiMvdCacheAlignedSize = kuiMvdInterTableStride * sizeof (uint16_t);
1283 int32_t iVclLayersBsSizeCount = 0;1285 int32_t iVclLayersBsSizeCount = 0;
1284 int32_t iNonVclLayersBsSizeCount = 0;1286 int32_t iNonVclLayersBsSizeCount = 0;
1285 int32_t iTargetSpatialBsSize = 0;1287 int32_t iTargetSpatialBsSize = 0;
1286 1288
1287 if (kiNumDependencyLayers < 1 || kiNumDependencyLayers > MAX_DEPENDENCY_LAYER) {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 kiNumDependencyLayers);1291 kiNumDependencyLayers);
1290 FreeMemorySvc (ppCtx);1292 FreeMemorySvc (ppCtx);
1291 return 1;1293 return 1;
1292 }1294 }
1293 1295
1294 if (pParam->uiGopSize == 0 || (pParam->uiIntraPeriod && ((pParam->uiIntraPeriod % pParam->uiGopSize) != 0))) {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 "RequestMemorySvc() failed due to invalid uiIntraPeriod(%d) (=multipler of uiGopSize(%d)!",1298 "RequestMemorySvc() failed due to invalid uiIntraPeriod(%d) (=multipler of uiGopSize(%d)!",
1297 pParam->uiIntraPeriod, pParam->uiGopSize);1299 pParam->uiIntraPeriod, pParam->uiGopSize);
1298 FreeMemorySvc (ppCtx);1300 FreeMemorySvc (ppCtx);
@@ -1306,7 +1308,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 7 unmodified lines
1306 1308
1307 iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals);1309 iResult = AcquireLayersNals (ppCtx, pParam, &iCountLayers, &iCountNals);
1308 if (iResult) {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 FreeMemorySvc (ppCtx);1312 FreeMemorySvc (ppCtx);
1311 return 1;1313 return 1;
1312 }1314 }
@@ -1359,7 +1361,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 46 unmodified lines
1359 1361
1360 // for pSlice bs buffers1362 // for pSlice bs buffers
1361 if (pParam->iMultipleThreadIdc > 1 && RequestMtResource (ppCtx, pParam, iCountBsLen, iTargetSpatialBsSize)) {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 FreeMemorySvc (ppCtx);1365 FreeMemorySvc (ppCtx);
1364 return 1;1366 return 1;
1365 }1367 }
@@ -1406,7 +1408,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 40 unmodified lines
1406 1408
1407 // stride tables1409 // stride tables
1408 if (AllocStrideTables (ppCtx, kiNumDependencyLayers)) {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 FreeMemorySvc (ppCtx);1412 FreeMemorySvc (ppCtx);
1411 return 1;1413 return 1;
1412 }1414 }
@@ -1422,7 +1424,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 9 unmodified lines
1422 (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa");1424 (*ppCtx)->pVaa = (SVAAFrameInfoExt*)pMa->WelsMallocz (sizeof (SVAAFrameInfoExt), "pVaa");
1423 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx))1425 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pVaa), FreeMemorySvc (ppCtx))
1424 if (RequestMemoryVaaScreen ((*ppCtx)->pVaa, pMa, (*ppCtx)->pSvcParam->iMaxNumRefFrame, iCountMaxMbNum << 2)) {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 FreeMemorySvc (ppCtx);1428 FreeMemorySvc (ppCtx);
1427 return 1;1429 return 1;
1428 }1430 }
@@ -1471,20 +1473,22 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 42 unmodified lines
1471 1473
1472 iResult = InitDqLayers (ppCtx);1474 iResult = InitDqLayers (ppCtx);
1473 if (iResult) {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 FreeMemorySvc (ppCtx);1477 FreeMemorySvc (ppCtx);
1476 return iResult;1478 return iResult;
1477 }1479 }
1478 1480
1479 if (InitMbListD (ppCtx)) {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 FreeMemorySvc (ppCtx);1483 FreeMemorySvc (ppCtx);
1482 return 1;1484 return 1;
1483 }1485 }
1484 1486
1485 (*ppCtx)->pMvdCostTableInter = (uint16_t*)pMa->WelsMallocz (52 * kuiMvdCacheAlignedSize, "pMvdCostTableInter");1487 (*ppCtx)->iMvdCostTableSize = kuiMvdInterTableSize;
1486 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pMvdCostTableInter), FreeMemorySvc (ppCtx))1488 (*ppCtx)->iMvdCostTableStride = kuiMvdInterTableStride;
1487 MvdCostInit ((*ppCtx)->pMvdCostTableInter, kuiMvdInterTableSize); //should put to a better place?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 if ((*ppCtx)->ppRefPicListExt[0] != NULL && (*ppCtx)->ppRefPicListExt[0]->pRef[0] != NULL)1493 if ((*ppCtx)->ppRefPicListExt[0] != NULL && (*ppCtx)->ppRefPicListExt[0]->pRef[0] != NULL)
1490 (*ppCtx)->pDecPic = (*ppCtx)->ppRefPicListExt[0]->pRef[0];1494 (*ppCtx)->pDecPic = (*ppCtx)->ppRefPicListExt[0]->pRef[0];
@@ -1741,9 +1745,9 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 250 unmodified lines
1741 }1745 }
1742 1746
1743 /* MVD cost tables for Inter */1747 /* MVD cost tables for Inter */
1744 if (NULL != pCtx->pMvdCostTableInter) {1748 if (NULL != pCtx->pMvdCostTable) {
1745 pMa->WelsFree (pCtx->pMvdCostTableInter, "pMvdCostTableInter");1749 pMa->WelsFree (pCtx->pMvdCostTable, "pMvdCostTable");
1746 pCtx->pMvdCostTableInter = NULL;1750 pCtx->pMvdCostTable = NULL;
1747 }1751 }
1748 1752
1749 FreeCodingParam (&pCtx->pSvcParam, pMa);1753 FreeCodingParam (&pCtx->pSvcParam, pMa);
@@ -1757,7 +1761,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 7 unmodified lines
1757#endif//MEMORY_MONITOR1761#endif//MEMORY_MONITOR
1758 1762
1759 if ((*ppCtx)->pMemAlign != NULL) {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 (*ppCtx)->pMemAlign->WelsGetMemoryUsage());1765 (*ppCtx)->pMemAlign->WelsGetMemoryUsage());
1762 delete (*ppCtx)->pMemAlign;1766 delete (*ppCtx)->pMemAlign;
1763 (*ppCtx)->pMemAlign = NULL;1767 (*ppCtx)->pMemAlign = NULL;
@@ -2150,7 +2154,8 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 386 unmodified lines
2150 if (NULL == ppCtx || NULL == *ppCtx)2154 if (NULL == ppCtx || NULL == *ppCtx)
2151 return;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 (void*) (*ppCtx), (*ppCtx)->pSvcParam->iCountThreadsNum, (*ppCtx)->pSvcParam->iMultipleThreadIdc);2159 (void*) (*ppCtx), (*ppCtx)->pSvcParam->iCountThreadsNum, (*ppCtx)->pSvcParam->iMultipleThreadIdc);
2155 2160
2156#if defined(STAT_OUTPUT)2161#if defined(STAT_OUTPUT)
@@ -2168,7 +2173,8 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 11 unmodified lines
2168 WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);2173 WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
2169 WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);2174 WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
2170 res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit2175 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 res);2178 res);
2173 (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;2179 (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
2174 }2180 }
@@ -2333,7 +2339,7 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 158 unmodified lines
2333 / (pSliceCtx->iMaxSliceNumConstraint))2339 / (pSliceCtx->iMaxSliceNumConstraint))
2334 ) {2340 ) {
2335 2341
2336 WelsLog (&(pCtx->sLogCtx),2342 WelsLog (& (pCtx->sLogCtx),
2337 WELS_LOG_WARNING,2343 WELS_LOG_WARNING,
2338 "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!\n",2344 "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!\n",
2339 pSliceCtx->uiSliceSizeConstraint,2345 pSliceCtx->uiSliceSizeConstraint,
@@ -2492,16 +2498,21 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 152 unmodified lines
2492 const bool kbHighestSpatialLayer =2498 const bool kbHighestSpatialLayer =
2493 (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1));2499 (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1));
2494 SWelsFuncPtrList* pFuncList = pCtx->pFuncList;2500 SWelsFuncPtrList* pFuncList = pCtx->pFuncList;
2495 SLogContext* pLogCtx = &(pCtx->sLogCtx);2501 SLogContext* pLogCtx = & (pCtx->sLogCtx);
2496 /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */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 SetFastCodingFunc (pFuncList);2507 SetFastCodingFunc (pFuncList);
2499 } else {2508 } else {
2500 SetNormalCodingFunc (pFuncList);2509 SetNormalCodingFunc (pFuncList);
2501 }2510 }
2502 2511
2503 if (P_SLICE == pCtx->eSliceType) {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 pFuncList->pfSearchMethod[BLOCK_16x16] =2516 pFuncList->pfSearchMethod[BLOCK_16x16] =
2506 pFuncList->pfSearchMethod[BLOCK_16x8] =2517 pFuncList->pfSearchMethod[BLOCK_16x8] =
2507 pFuncList->pfSearchMethod[BLOCK_8x16] =2518 pFuncList->pfSearchMethod[BLOCK_8x16] =
@@ -2509,6 +2520,8 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 1 unmodified line
2509 pFuncList->pfSearchMethod[BLOCK_4x4] = WelsDiamondSearch;2520 pFuncList->pfSearchMethod[BLOCK_4x4] = WelsDiamondSearch;
2510 pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;2521 pFuncList->pfFirstIntraMode = WelsMdFirstIntraMode;
2511 pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;2522 pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;
2523 pFuncList->pfSetScrollingMv = SetScrollingMvToMdNull;
2524
2512 if (kbHighestSpatialLayer) {2525 if (kbHighestSpatialLayer) {
2513 pFuncList->pfCalculateSatd = NotCalculateSatdCost;2526 pFuncList->pfCalculateSatd = NotCalculateSatdCost;
2514 pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa;2527 pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa;
@@ -2518,7 +2531,6 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 3 unmodified lines
2518 }2531 }
2519 }2532 }
2520 2533
2521 return;
2522 //to init at each frame will be needed when dealing with hybrid content (camera+screen)2534 //to init at each frame will be needed when dealing with hybrid content (camera+screen)
2523 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {2535 if (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) {
2524 if (P_SLICE == pCtx->eSliceType) {2536 if (P_SLICE == pCtx->eSliceType) {
@@ -2526,6 +2538,17 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 1 unmodified line
2526 pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen;2538 pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaaOnScreen;
2527 2539
2528 //ME related func pointers2540 //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 //ME16x162552 //ME16x16
2530 if (!SetMeMethod (ME_DIA_CROSS, pFuncList->pfSearchMethod[BLOCK_16x16])) {2553 if (!SetMeMethod (ME_DIA_CROSS, pFuncList->pfSearchMethod[BLOCK_16x16])) {
2531 WelsLog (pLogCtx, WELS_LOG_WARNING, "SetMeMethod(BLOCK_16x16) ME_DIA_CROSS unsuccessful, switched to default search\n");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 pFeatureSearchPreparation->pRefBlockFeature = pScreenBlockFeatureStorage;2570 pFeatureSearchPreparation->pRefBlockFeature = pScreenBlockFeatureStorage;
2548 if (pFeatureSearchPreparation->bFMESwitchFlag2571 if (pFeatureSearchPreparation->bFMESwitchFlag
2549 && !pScreenBlockFeatureStorage->bRefBlockFeatureCalculated) {2572 && !pScreenBlockFeatureStorage->bRefBlockFeatureCalculated) {
2550 //TODO: use ORIGIN of reference when preprocessing is ready2573 PerformFMEPreprocess (pFuncList, pCurLayer->pRefOri[0], pFeatureSearchPreparation->pFeatureOfBlock,
2551 PerformFMEPreprocess (pFuncList, pCurLayer->pRefPic, pFeatureSearchPreparation->pFeatureOfBlock,
2552 pScreenBlockFeatureStorage);2574 pScreenBlockFeatureStorage);
2553 }2575 }
2554 2576
@@ -2556,7 +2578,8 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 1 unmodified line
2556 if (pFeatureSearchPreparation->bFMESwitchFlag && pScreenBlockFeatureStorage->bRefBlockFeatureCalculated2578 if (pFeatureSearchPreparation->bFMESwitchFlag && pScreenBlockFeatureStorage->bRefBlockFeatureCalculated
2557 && (!pScreenBlockFeatureStorage->iIs16x16)) {2579 && (!pScreenBlockFeatureStorage->iIs16x16)) {
2558 if (!SetMeMethod (ME_DIA_CROSS_FME, pFuncList->pfSearchMethod[BLOCK_8x8])) {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 if ((pBs->pBufEnd - pBs->pBufPtr) < iLen || iNal >= pCtx->pOut->iCountNals) {2857 if ((pBs->pBufEnd - pBs->pBufPtr) < iLen || iNal >= pCtx->pOut->iCountNals) {
2835#if GOM_TRACE_FLAG2858#if GOM_TRACE_FLAG
2836 WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR,2859 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
2837 "[RC] paddingcal pBuffer overflow, bufferlen=%lld, paddinglen=%d, iNalIdx= %d, iCountNals= %d\n",2860 "[RC] paddingcal pBuffer overflow, bufferlen=%lld, paddinglen=%d, iNalIdx= %d, iCountNals= %d\n",
2838 static_cast<long long int> (pBs->pBufEnd - pBs->pBufPtr), iLen, iNal, pCtx->pOut->iCountNals);2861 static_cast<long long int> (pBs->pBufEnd - pBs->pBufPtr), iLen, iNal, pCtx->pOut->iCountNals);
2839#endif2862#endif
@@ -2947,7 +2970,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 107 unmodified lines
2947 int8_t iCurDid = 0;2970 int8_t iCurDid = 0;
2948 int8_t iCurTid = 0;2971 int8_t iCurTid = 0;
2949 bool bAvcBased = false;2972 bool bAvcBased = false;
2950 SLogContext* pLogCtx = &(pCtx->sLogCtx);2973 SLogContext* pLogCtx = & (pCtx->sLogCtx);
2951#if defined(ENABLE_PSNR_CALC)2974#if defined(ENABLE_PSNR_CALC)
2952 float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f;2975 float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f;
2953#endif//ENABLE_PSNR_CALC2976#endif//ENABLE_PSNR_CALC
@@ -3366,6 +3389,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 412 unmodified lines
3366 PerformDeblockingFilter (pCtx);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 // reference picture list update3398 // reference picture list update
3370 if (eNalRefIdc != NRI_PRI_LOWEST) {3399 if (eNalRefIdc != NRI_PRI_LOWEST) {
3371 if (!pCtx->pFuncList->pUpdateRefList (pCtx)) {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 iFrameSize += iLayerSize;3410 iFrameSize += iLayerSize;
3382 3411
3383 pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize);
3384
3385#ifdef ENABLE_FRAME_DUMP3412#ifdef ENABLE_FRAME_DUMP
3386 // Dump reconstruction picture for each sQualityStat layer3413 // Dump reconstruction picture for each sQualityStat layer
3387 if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) {3414 if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) {

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