History

format update and fix build issue when turn on STAT_OUTPUT macro

Karina committed 10 years ago

Commit fee9d501 parent 316f7401 file · +94 −92Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+94−92
@@ -2048,7 +2048,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 2047 unmodified lines
20482048
20492049 //End of pVaa memory allocation
20502050
2051− (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SRefList*), "ppRefPicListExt");
2051+ (*ppCtx)->ppRefPicListExt = (SRefList**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SRefList*),
2052+ "ppRefPicListExt");
20522053 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->ppRefPicListExt), FreeMemorySvc (ppCtx))
20532054
20542055 (*ppCtx)->ppDqLayerList = (SDqLayer**)pMa->WelsMallocz (kiNumDependencyLayers * sizeof (SDqLayer*), "ppDqLayerList");
@@ -2290,7 +2291,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 235 unmodified lines
22902291 if ((*ppCtx)->pMemAlign != NULL) {
22912292 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "FreeMemorySvc(), verify memory usage (%d bytes) after free..",
22922293 (*ppCtx)->pMemAlign->WelsGetMemoryUsage());
2293− WELS_DELETE_OP((*ppCtx)->pMemAlign);
2294+ WELS_DELETE_OP ((*ppCtx)->pMemAlign);
22942295 }
22952296
22962297 free (*ppCtx);
@@ -2397,6 +2398,87 @@ void OutputCpuFeaturesLog (SLogContext* pLogCtx, uint32_t uiCpuFeatureFlags, uin · 100 unmodified lines
23972398 uiCpuCores,
23982399 iCacheLineSize);
23992400 }
2401+/*
2402+ *
2403+ * status information output
2404+ */
2405+#if defined(STAT_OUTPUT)
2406+void StatOverallEncodingExt (sWelsEncCtx* pCtx) {
2407+ int8_t i = 0;
2408+ int8_t j = 0;
2409+ for (i = 0; i < pCtx->pSvcParam->iSpatialLayerNum; i++) {
2410+ fprintf (stdout, "\nDependency layer : %d\n", i);
2411+ fprintf (stdout, "Quality layer : %d\n", j);
2412+ {
2413+ const int32_t iCount = pCtx->sStatData[i][j].sSliceData.iSliceCount[I_SLICE] +
2414+ pCtx->sStatData[i][j].sSliceData.iSliceCount[P_SLICE] +
2415+ pCtx->sStatData[i][j].sSliceData.iSliceCount[B_SLICE];
2416+#if defined(MB_TYPES_CHECK)
2417+ if (iCount > 0) {
2418+ int32_t iCountNumIMb = pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra4x4] +
2419+ pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra16x16] + pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][7];
2420+ int32_t iCountNumPMb = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra4x4] +
2421+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra16x16] +
2422+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][7] +
2423+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
2424+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] +
2425+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] +
2426+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] +
2427+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10] +
2428+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][PSkip];
2429+ int32_t count_p_mbL0 = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
2430+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] +
2431+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] +
2432+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] +
2433+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10];
2434+
2435+ int32_t iMbCount = iCountNumIMb + iCountNumPMb;
2436+ if (iMbCount > 0) {
2437+ fprintf (stderr,
2438+ "SVC: overall Slices MBs: %d Avg\nI4x4: %.3f%% I16x16: %.3f%% IBL: %.3f%%\nP16x16: %.3f%% P16x8: %.3f%% P8x16: %.3f%% P8x8: %.3f%% SUBP8x8: %.3f%% PSKIP: %.3f%%\nILP(All): %.3f%% ILP(PL0): %.3f%% BLSKIP(PL0): %.3f%% RP(PL0): %.3f%%\n",
2439+ iMbCount,
2440+ (100.0f * (pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra4x4] +
2441+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra4x4]) / iMbCount),
2442+ (100.0f * (pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra16x16] +
2443+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra16x16]) / iMbCount),
2444+ (100.0f * (pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][7] +
2445+ pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][7]) / iMbCount),
2446+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] / iMbCount),
2447+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] / iMbCount),
2448+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] / iMbCount),
2449+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] / iMbCount),
2450+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10] / iMbCount),
2451+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][PSkip] / iMbCount),
2452+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][11] / iMbCount),
2453+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][11] / count_p_mbL0),
2454+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][8] / count_p_mbL0),
2455+ (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][9] / count_p_mbL0)
2456+ );
2457+ }
2458+ }
2459+#endif //#if defined(MB_TYPES_CHECK)
2460+
2461+ if (iCount > 0) {
2462+ fprintf (stdout, "SVC: overall PSNR Y: %2.3f U: %2.3f V: %2.3f kb/s: %.1f fps: %.3f\n\n",
2463+ (pCtx->sStatData[i][j].sQualityStat.rYPsnr[I_SLICE] + pCtx->sStatData[i][j].sQualityStat.rYPsnr[P_SLICE] +
2464+ pCtx->sStatData[i][j].sQualityStat.rYPsnr[B_SLICE]) / (float) (iCount),
2465+ (pCtx->sStatData[i][j].sQualityStat.rUPsnr[I_SLICE] + pCtx->sStatData[i][j].sQualityStat.rUPsnr[P_SLICE] +
2466+ pCtx->sStatData[i][j].sQualityStat.rUPsnr[B_SLICE]) / (float) (iCount),
2467+ (pCtx->sStatData[i][j].sQualityStat.rVPsnr[I_SLICE] + pCtx->sStatData[i][j].sQualityStat.rVPsnr[P_SLICE] +
2468+ pCtx->sStatData[i][j].sQualityStat.rVPsnr[B_SLICE]) / (float) (iCount),
2469+ 1.0f * pCtx->pSvcParam->sDependencyLayers[i].fOutputFrameRate * (pCtx->sStatData[i][j].sSliceData.iSliceSize[I_SLICE] +
2470+ pCtx->sStatData[i][j].sSliceData.iSliceSize[P_SLICE] + pCtx->sStatData[i][j].sSliceData.iSliceSize[B_SLICE]) / (float) (
2471+ iCount + pCtx->pWelsSvcRc[i].iSkipFrameNum) / 1000,
2472+ 1.0f * pCtx->pSvcParam->sDependencyLayers[i].fOutputFrameRate);
2473+
2474+ }
2475+
2476+ }
2477+
2478+ }
2479+}
2480+#endif
2481+
24002482
24012483 int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingParam, int16_t& iSliceNum,
24022484 int32_t& iCacheLineSize, uint32_t& uiCpuFeatureFlags) {
@@ -2478,7 +2560,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 75 unmodified lines
24782560
24792561 if ((*ppCtx)->pVpp) {
24802562 (*ppCtx)->pVpp->FreeSpatialPictures (*ppCtx);
2481− WELS_DELETE_OP((*ppCtx)->pVpp);
2563+ WELS_DELETE_OP ((*ppCtx)->pVpp);
24822564 }
24832565 FreeMemorySvc (ppCtx);
24842566 *ppCtx = NULL;
@@ -2589,87 +2671,6 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 104 unmodified lines
25892671
25902672 return 0;
25912673 }
2592−/*
2593− *
2594− * status information output
2595− */
2596−#if defined(STAT_OUTPUT)
2597−void StatOverallEncodingExt (sWelsEncCtx* pCtx) {
2598− int8_t i = 0;
2599− int8_t j = 0;
2600− for (i = 0; i < pCtx->pSvcParam->iSpatialLayerNum; i++) {
2601− fprintf (stdout, "\nDependency layer : %d\n", i);
2602− fprintf (stdout, "Quality layer : %d\n", j);
2603− {
2604− const int32_t iCount = pCtx->sStatData[i][j].sSliceData.iSliceCount[I_SLICE] +
2605− pCtx->sStatData[i][j].sSliceData.iSliceCount[P_SLICE] +
2606− pCtx->sStatData[i][j].sSliceData.iSliceCount[B_SLICE];
2607−#if defined(MB_TYPES_CHECK)
2608− if (iCount > 0) {
2609− int32_t iCountNumIMb = pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra4x4] +
2610− pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra16x16] + pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][7];
2611− int32_t iCountNumPMb = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra4x4] +
2612− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra16x16] +
2613− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][7] +
2614− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
2615− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] +
2616− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] +
2617− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] +
2618− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10] +
2619− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][PSkip];
2620− int32_t count_p_mbL0 = pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] +
2621− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] +
2622− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] +
2623− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] +
2624− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10];
2625−
2626− int32_t iMbCount = iCountNumIMb + iCountNumPMb;
2627− if (iMbCount > 0) {
2628− fprintf (stderr,
2629− "SVC: overall Slices MBs: %d Avg\nI4x4: %.3f%% I16x16: %.3f%% IBL: %.3f%%\nP16x16: %.3f%% P16x8: %.3f%% P8x16: %.3f%% P8x8: %.3f%% SUBP8x8: %.3f%% PSKIP: %.3f%%\nILP(All): %.3f%% ILP(PL0): %.3f%% BLSKIP(PL0): %.3f%% RP(PL0): %.3f%%\n",
2630− iMbCount,
2631− (100.0f * (pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra4x4] +
2632− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra4x4]) / iMbCount),
2633− (100.0f * (pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][Intra16x16] +
2634− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Intra16x16]) / iMbCount),
2635− (100.0f * (pCtx->sStatData[i][j].sSliceData.iMbCount[I_SLICE][7] +
2636− pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][7]) / iMbCount),
2637− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x16] / iMbCount),
2638− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter16x8] / iMbCount),
2639− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x16] / iMbCount),
2640− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][Inter8x8] / iMbCount),
2641− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][10] / iMbCount),
2642− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][PSkip] / iMbCount),
2643− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][11] / iMbCount),
2644− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][11] / count_p_mbL0),
2645− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][8] / count_p_mbL0),
2646− (100.0f * pCtx->sStatData[i][j].sSliceData.iMbCount[P_SLICE][9] / count_p_mbL0)
2647− );
2648− }
2649− }
2650−#endif //#if defined(MB_TYPES_CHECK)
2651−
2652− if (iCount > 0) {
2653− fprintf (stdout, "SVC: overall PSNR Y: %2.3f U: %2.3f V: %2.3f kb/s: %.1f fps: %.3f\n\n",
2654− (pCtx->sStatData[i][j].sQualityStat.rYPsnr[I_SLICE] + pCtx->sStatData[i][j].sQualityStat.rYPsnr[P_SLICE] +
2655− pCtx->sStatData[i][j].sQualityStat.rYPsnr[B_SLICE]) / (float) (iCount),
2656− (pCtx->sStatData[i][j].sQualityStat.rUPsnr[I_SLICE] + pCtx->sStatData[i][j].sQualityStat.rUPsnr[P_SLICE] +
2657− pCtx->sStatData[i][j].sQualityStat.rUPsnr[B_SLICE]) / (float) (iCount),
2658− (pCtx->sStatData[i][j].sQualityStat.rVPsnr[I_SLICE] + pCtx->sStatData[i][j].sQualityStat.rVPsnr[P_SLICE] +
2659− pCtx->sStatData[i][j].sQualityStat.rVPsnr[B_SLICE]) / (float) (iCount),
2660− 1.0f * pCtx->pSvcParam->sDependencyLayers[i].fOutputFrameRate * (pCtx->sStatData[i][j].sSliceData.iSliceSize[I_SLICE] +
2661− pCtx->sStatData[i][j].sSliceData.iSliceSize[P_SLICE] + pCtx->sStatData[i][j].sSliceData.iSliceSize[B_SLICE]) / (float) (
2662− iCount + pCtx->pWelsSvcRc[i].iSkipFrameNum) / 1000,
2663− 1.0f * pCtx->pSvcParam->sDependencyLayers[i].fOutputFrameRate);
2664−
2665− }
2666−
2667− }
2668−
2669− }
2670−}
2671−#endif
2672−
26732674 /*!
26742675 * \brief get temporal level due to configuration and coding context
26752676 */
@@ -3716,7 +3717,7 @@ void ClearFrameBsInfo (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi) { · 1040 unmodified lines
37163717 * \pParam pSrcPic Source Picture
37173718 * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
37183719 */
3719−int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic ) {
3720+int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic) {
37203721 if (pCtx == NULL) {
37213722 return ENC_RETURN_MEMALLOCERR;
37223723 }
@@ -3756,7 +3757,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines
37563757 pCtx->iEncoderError = ENC_RETURN_SUCCESS;
37573758 pCtx->bCurFrameMarkedAsSceneLtr = false;
37583759 pFbi->iLayerNum = 0; // for initialization
3759− pFbi->uiTimeStamp = GetTimestampForRc(pSrcPic->uiTimeStamp, pCtx->uiLastTimestamp, pCtx->pSvcParam->sSpatialLayers[pCtx->pSvcParam->iSpatialLayerNum-1].fFrameRate);
3760+ pFbi->uiTimeStamp = GetTimestampForRc (pSrcPic->uiTimeStamp, pCtx->uiLastTimestamp,
3761+ pCtx->pSvcParam->sSpatialLayers[pCtx->pSvcParam->iSpatialLayerNum - 1].fFrameRate);
37603762 for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) {
37613763 pFbi->sLayerInfo[iNalIdx].eFrameType = videoFrameTypeSkip;
37623764 }
@@ -4784,8 +4786,8 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 1021 unmodified lines
47844786 return iRet;
47854787 }
47864788 int32_t FrameBsRealloc (sWelsEncCtx* pCtx,
4787− SFrameBSInfo* pFrameBsInfo,
4788− SLayerBSInfo* pLayerBsInfo) {
4789+ SFrameBSInfo* pFrameBsInfo,
4790+ SLayerBSInfo* pLayerBsInfo) {
47894791 CMemoryAlign* pMA = pCtx->pMemAlign;
47904792 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
47914793
@@ -4847,7 +4849,7 @@ int32_t SliceBufferRealloc (sWelsEncCtx* pCtx) { · 55 unmodified lines
48474849 SSlice* pSliceIdx = &pSlice[uiSliceIdx];
48484850 const int32_t kiCurDid = pCtx->uiDependencyId;
48494851 const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,
4850− pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
4852+ pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
48514853 while (uiSliceIdx < iMaxSliceNum) {
48524854 SSliceHeaderExt* pSHExt = &pSliceIdx->sSliceHeaderExt;
48534855 pSliceIdx->uiSliceIdx = uiSliceIdx;
@@ -4877,8 +4879,8 @@ int32_t SliceBufferRealloc (sWelsEncCtx* pCtx) { · 23 unmodified lines
48774879 pSliceIdx->sSlicingOverRc.iTotalQpSlice = 0;
48784880 pSliceIdx->sSlicingOverRc.iTotalMbSlice = 0;
48794881 pSliceIdx->sSlicingOverRc.iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb *
4880− pSlice[uiSliceIdx].iCountMbNumInSlice,
4881− INT_MULTIPLY);
4882+ pSlice[uiSliceIdx].iCountMbNumInSlice,
4883+ INT_MULTIPLY);
48824884 pSliceIdx->sSlicingOverRc.iFrameBitsSlice = 0;
48834885 pSliceIdx->sSlicingOverRc.iGomBitsSlice = 0;
48844886
@@ -4901,7 +4903,7 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 16 unmodified lines
49014903 int32_t iRet = 0;
49024904
49034905 iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo);
4904− if(ENC_RETURN_SUCCESS != iRet)
4906+ if (ENC_RETURN_SUCCESS != iRet)
49054907 return iRet;
49064908
49074909 iRet = SliceBufferRealloc (pCtx);

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