Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 2 files). Show all
Unified · Split
| @@ -2832,7 +2832,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2831 unmodified lines | |||
| 2832 | SPicture* fsnr = NULL; | 2832 | SPicture* fsnr = NULL; |
| 2833 | #endif//ENABLE_FRAME_DUMP || ENABLE_PSNR_CALC | 2833 | #endif//ENABLE_FRAME_DUMP || ENABLE_PSNR_CALC |
| 2834 | SPicture* pEncPic = NULL; // to be decided later | 2834 | SPicture* pEncPic = NULL; // to be decided later |
| 2835 | int32_t did_list[MAX_DEPENDENCY_LAYER] = {0}; | 2835 | int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0}; |
| 2836 | int32_t iLayerNum = 0; | 2836 | int32_t iLayerNum = 0; |
| 2837 | int32_t iLayerSize = 0; | 2837 | int32_t iLayerSize = 0; |
| 2838 | int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame | 2838 | int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame |
| @@ -2850,7 +2850,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines | |||
| 2850 | int8_t iCurTid = 0; | 2850 | int8_t iCurTid = 0; |
| 2851 | bool bAvcBased = false; | 2851 | bool bAvcBased = false; |
| 2852 | #if defined(ENABLE_PSNR_CALC) | 2852 | #if defined(ENABLE_PSNR_CALC) |
| 2853 | float snr_y = .0f, snr_u = .0f, snr_v = .0f; | 2853 | float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f; |
| 2854 | #endif//ENABLE_PSNR_CALC | 2854 | #endif//ENABLE_PSNR_CALC |
| 2855 | 2855 | ||
| 2856 | #if defined(_DEBUG) | 2856 | #if defined(_DEBUG) |
| @@ -2909,24 +2909,24 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 52 unmodified lines | |||
| 2909 | pCtx->pCurDqLayer->pRefLayer = NULL; | 2909 | pCtx->pCurDqLayer->pRefLayer = NULL; |
| 2910 | 2910 | ||
| 2911 | while (iSpatialIdx < iSpatialNum) { | 2911 | while (iSpatialIdx < iSpatialNum) { |
| 2912 | const int32_t d_idx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid | 2912 | const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid |
| 2913 | SDLayerParam* param_d = &pSvcParam->sDependencyLayers[d_idx]; | 2913 | SDLayerParam* pParam = &pSvcParam->sDependencyLayers[iDidIdx]; |
| 2914 | 2914 | ||
| 2915 | pCtx->uiDependencyId = iCurDid = (int8_t)d_idx; | 2915 | pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx; |
| 2916 | pCtx->pVpp->AnalyzeSpatialPic (pCtx, d_idx); | 2916 | pCtx->pVpp->AnalyzeSpatialPic (pCtx, iDidIdx); |
| 2917 | 2917 | ||
| 2918 | pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc; | 2918 | pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc; |
| 2919 | pCtx->pEncPic->iPictureType = pCtx->eSliceType; | 2919 | pCtx->pEncPic->iPictureType = pCtx->eSliceType; |
| 2920 | pCtx->pEncPic->iFramePoc = pCtx->iPOC; | 2920 | pCtx->pEncPic->iFramePoc = pCtx->iPOC; |
| 2921 | 2921 | ||
| 2922 | iCurWidth = param_d->iFrameWidth; | 2922 | iCurWidth = pParam->iFrameWidth; |
| 2923 | iCurHeight = param_d->iFrameHeight; | 2923 | iCurHeight = pParam->iFrameHeight; |
| 2924 | 2924 | ||
| 2925 | did_list[iSpatialIdx] = iCurDid; | 2925 | iDidList[iSpatialIdx] = iCurDid; |
| 2926 | 2926 | ||
| 2927 | // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed | 2927 | // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed |
| 2928 | 2928 | ||
| 2929 | switch (param_d->sSliceCfg.uiSliceMode) { | 2929 | switch (pParam->sSliceCfg.uiSliceMode) { |
| 2930 | case SM_FIXEDSLCNUM_SLICE: | 2930 | case SM_FIXEDSLCNUM_SLICE: |
| 2931 | case SM_AUTO_SLICE: { | 2931 | case SM_AUTO_SLICE: { |
| 2932 | if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) && | 2932 | if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) && |
| @@ -3000,7 +3000,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 67 unmodified lines | |||
| 3000 | return ENC_RETURN_CORRECTED; | 3000 | return ENC_RETURN_CORRECTED; |
| 3001 | } | 3001 | } |
| 3002 | #ifdef LONG_TERM_REF_DUMP | 3002 | #ifdef LONG_TERM_REF_DUMP |
| 3003 | dump_ref (pCtx); | 3003 | DumpRef (pCtx); |
| 3004 | #endif | 3004 | #endif |
| 3005 | if((pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)&&(pSvcParam->iRCMode != RC_OFF_MODE)) | 3005 | if((pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)&&(pSvcParam->iRCMode != RC_OFF_MODE)) |
| 3006 | pCtx->pVpp->AnalyzePictureComplexity(pCtx,pCtx->pEncPic,((pCtx->eSliceType == P_SLICE)&&(pCtx->iNumRef0>0))?pCtx->pRefList0[0]:NULL, | 3006 | pCtx->pVpp->AnalyzePictureComplexity(pCtx,pCtx->pEncPic,((pCtx->eSliceType == P_SLICE)&&(pCtx->iNumRef0>0))?pCtx->pRefList0[0]:NULL, |
| @@ -3016,7 +3016,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 9 unmodified lines | |||
| 3016 | //TODO Complexity Calculation here for screen content | 3016 | //TODO Complexity Calculation here for screen content |
| 3017 | iLayerSize = 0; | 3017 | iLayerSize = 0; |
| 3018 | 3018 | ||
| 3019 | if (SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer | 3019 | if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer |
| 3020 | int32_t iSliceSize = 0; | 3020 | int32_t iSliceSize = 0; |
| 3021 | int32_t iPayloadSize = 0; | 3021 | int32_t iPayloadSize = 0; |
| 3022 | 3022 | ||
| @@ -3053,20 +3053,20 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 30 unmodified lines | |||
| 3053 | pLayerBsInfo->iNalCount = ++ iNalIdxInLayer; | 3053 | pLayerBsInfo->iNalCount = ++ iNalIdxInLayer; |
| 3054 | } | 3054 | } |
| 3055 | // for dynamic slicing single threading.. | 3055 | // for dynamic slicing single threading.. |
| 3056 | else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) { | 3056 | else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) { |
| 3057 | const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame; | 3057 | const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame; |
| 3058 | pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0, kiLastMbInFrame, 0); | 3058 | pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0, kiLastMbInFrame, 0); |
| 3059 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3059 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3060 | } else { | 3060 | } else { |
| 3061 | //other multi-slice uiSliceMode | 3061 | //other multi-slice uiSliceMode |
| 3062 | int err = 0; | 3062 | int32_t iRet = 0; |
| 3063 | // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE | 3063 | // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE |
| 3064 | if ((SM_DYN_SLICE != param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { | 3064 | if ((SM_DYN_SLICE != pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |
| 3065 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx); | 3065 | iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx); |
| 3066 | if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed | 3066 | if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed |
| 3067 | WelsLog (pCtx, WELS_LOG_ERROR, | 3067 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3068 | "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!", | 3068 | "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!", |
| 3069 | iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sSliceCfg.uiSliceMode, iSliceCount); | 3069 | iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, pParam->sSliceCfg.uiSliceMode, iSliceCount); |
| 3070 | return ENC_RETURN_UNSUPPORTED_PARA; | 3070 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 3071 | } | 3071 | } |
| 3072 | if (iSliceCount <= 1) { | 3072 | if (iSliceCount <= 1) { |
| @@ -3083,13 +3083,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 10 unmodified lines | |||
| 3083 | 3083 | ||
| 3084 | pCtx->iActiveThreadsNum = iSliceCount; | 3084 | pCtx->iActiveThreadsNum = iSliceCount; |
| 3085 | // to fire slice coding threads | 3085 | // to fire slice coding threads |
| 3086 | err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0], | 3086 | iRet = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0], |
| 3087 | &pCtx->pSliceThreading->pThreadMasterEvent[0], | 3087 | &pCtx->pSliceThreading->pThreadMasterEvent[0], |
| 3088 | pLayerBsInfo, iSliceCount, pCtx->pCurDqLayer->pSliceEncCtx, false); | 3088 | pLayerBsInfo, iSliceCount, pCtx->pCurDqLayer->pSliceEncCtx, false); |
| 3089 | if (err) { | 3089 | if (iRet) { |
| 3090 | WelsLog (pCtx, WELS_LOG_ERROR, | 3090 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3091 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", | 3091 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3092 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); | 3092 | iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3093 | return ENC_RETURN_UNEXPECTED; | 3093 | return ENC_RETURN_UNEXPECTED; |
| 3094 | } | 3094 | } |
| 3095 | 3095 | ||
| @@ -3122,13 +3122,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 26 unmodified lines | |||
| 3122 | iNumThreadsScheduled = pCtx->iActiveThreadsNum; | 3122 | iNumThreadsScheduled = pCtx->iActiveThreadsNum; |
| 3123 | iNumThreadsRunning = iNumThreadsScheduled; | 3123 | iNumThreadsRunning = iNumThreadsScheduled; |
| 3124 | // to fire slice coding threads | 3124 | // to fire slice coding threads |
| 3125 | err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0], | 3125 | iRet = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0], |
| 3126 | &pCtx->pSliceThreading->pThreadMasterEvent[0], | 3126 | &pCtx->pSliceThreading->pThreadMasterEvent[0], |
| 3127 | pLayerBsInfo, iNumThreadsRunning, pCtx->pCurDqLayer->pSliceEncCtx, false); | 3127 | pLayerBsInfo, iNumThreadsRunning, pCtx->pCurDqLayer->pSliceEncCtx, false); |
| 3128 | if (err) { | 3128 | if (iRet) { |
| 3129 | WelsLog (pCtx, WELS_LOG_ERROR, | 3129 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3130 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", | 3130 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3131 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); | 3131 | iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3132 | return ENC_RETURN_UNEXPECTED; | 3132 | return ENC_RETURN_UNEXPECTED; |
| 3133 | } | 3133 | } |
| 3134 | 3134 | ||
| @@ -3164,17 +3164,17 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 29 unmodified lines | |||
| 3164 | } | 3164 | } |
| 3165 | } | 3165 | } |
| 3166 | // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE | 3166 | // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE |
| 3167 | else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { | 3167 | else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |
| 3168 | const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum; | 3168 | const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum; |
| 3169 | 3169 | ||
| 3170 | // to fire slice coding threads | 3170 | // to fire slice coding threads |
| 3171 | err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0], | 3171 | iRet = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0], |
| 3172 | &pCtx->pSliceThreading->pThreadMasterEvent[0], | 3172 | &pCtx->pSliceThreading->pThreadMasterEvent[0], |
| 3173 | pLayerBsInfo, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true); | 3173 | pLayerBsInfo, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true); |
| 3174 | if (err) { | 3174 | if (iRet) { |
| 3175 | WelsLog (pCtx, WELS_LOG_ERROR, | 3175 | WelsLog (pCtx, WELS_LOG_ERROR, |
| 3176 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", | 3176 | "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n", |
| 3177 | err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); | 3177 | iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc); |
| 3178 | return ENC_RETURN_UNEXPECTED; | 3178 | return ENC_RETURN_UNEXPECTED; |
| 3179 | } | 3179 | } |
| 3180 | 3180 | ||
| @@ -3240,7 +3240,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 59 unmodified lines | |||
| 3240 | if ( | 3240 | if ( |
| 3241 | (!pCtx->pCurDqLayer->bDeblockingParallelFlag) && | 3241 | (!pCtx->pCurDqLayer->bDeblockingParallelFlag) && |
| 3242 | #if !defined(ENABLE_FRAME_DUMP) | 3242 | #if !defined(ENABLE_FRAME_DUMP) |
| 3243 | ((eNalRefIdc != NRI_PRI_LOWEST) && (param_d->iHighestTemporalId == 0 || iCurTid < param_d->iHighestTemporalId)) && | 3243 | ((eNalRefIdc != NRI_PRI_LOWEST) && (pParam->iHighestTemporalId == 0 || iCurTid < pParam->iHighestTemporalId)) && |
| 3244 | #endif//!ENABLE_FRAME_DUMP | 3244 | #endif//!ENABLE_FRAME_DUMP |
| 3245 | true | 3245 | true |
| 3246 | ) { | 3246 | ) { |
| @@ -3266,23 +3266,23 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 19 unmodified lines | |||
| 3266 | #ifdef ENABLE_FRAME_DUMP | 3266 | #ifdef ENABLE_FRAME_DUMP |
| 3267 | // Dump reconstruction picture for each sQualityStat layer | 3267 | // Dump reconstruction picture for each sQualityStat layer |
| 3268 | if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) | 3268 | if (iCurDid + 1 < pSvcParam->iSpatialLayerNum) |
| 3269 | DumpDependencyRec (fsnr, ¶m_d->sRecFileName[0], iCurDid); | 3269 | DumpDependencyRec (fsnr, &pParam->sRecFileName[0], iCurDid); |
| 3270 | #endif//ENABLE_FRAME_DUMP | 3270 | #endif//ENABLE_FRAME_DUMP |
| 3271 | 3271 | ||
| 3272 | #if defined(ENABLE_PSNR_CALC) | 3272 | #if defined(ENABLE_PSNR_CALC) |
| 3273 | snr_y = WelsCalcPsnr (fsnr->pData[0], | 3273 | fSnrY = WelsCalcPsnr (fsnr->pData[0], |
| 3274 | fsnr->iLineSize[0], | 3274 | fsnr->iLineSize[0], |
| 3275 | pEncPic->pData[0], | 3275 | pEncPic->pData[0], |
| 3276 | pEncPic->iLineSize[0], | 3276 | pEncPic->iLineSize[0], |
| 3277 | iCurWidth, | 3277 | iCurWidth, |
| 3278 | iCurHeight); | 3278 | iCurHeight); |
| 3279 | snr_u = WelsCalcPsnr (fsnr->pData[1], | 3279 | fSnrU = WelsCalcPsnr (fsnr->pData[1], |
| 3280 | fsnr->iLineSize[1], | 3280 | fsnr->iLineSize[1], |
| 3281 | pEncPic->pData[1], | 3281 | pEncPic->pData[1], |
| 3282 | pEncPic->iLineSize[1], | 3282 | pEncPic->iLineSize[1], |
| 3283 | (iCurWidth >> 1), | 3283 | (iCurWidth >> 1), |
| 3284 | (iCurHeight >> 1)); | 3284 | (iCurHeight >> 1)); |
| 3285 | snr_v = WelsCalcPsnr (fsnr->pData[2], | 3285 | fSnrV = WelsCalcPsnr (fsnr->pData[2], |
| 3286 | fsnr->iLineSize[2], | 3286 | fsnr->iLineSize[2], |
| 3287 | pEncPic->pData[2], | 3287 | pEncPic->pData[2], |
| 3288 | pEncPic->iLineSize[2], | 3288 | pEncPic->iLineSize[2], |
| @@ -3300,9 +3300,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines | |||
| 3300 | iCurDid, | 3300 | iCurDid, |
| 3301 | 0, | 3301 | 0, |
| 3302 | pCtx->pWelsSvcRc[pCtx->uiDependencyId].iAverageFrameQp, | 3302 | pCtx->pWelsSvcRc[pCtx->uiDependencyId].iAverageFrameQp, |
| 3303 | snr_y, | 3303 | fSnrY, |
| 3304 | snr_u, | 3304 | fSnrU, |
| 3305 | snr_v, | 3305 | fSnrV, |
| 3306 | (iLayerSize << 3)); | 3306 | (iLayerSize << 3)); |
| 3307 | #endif//LAYER_INFO_OUTPUT | 3307 | #endif//LAYER_INFO_OUTPUT |
| 3308 | 3308 | ||
| @@ -3310,9 +3310,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1 unmodified line | |||
| 3310 | 3310 | ||
| 3311 | #if defined(ENABLE_PSNR_CALC) | 3311 | #if defined(ENABLE_PSNR_CALC) |
| 3312 | { | 3312 | { |
| 3313 | pCtx->sStatData[iCurDid][0].sQualityStat.rYPsnr[pCtx->eSliceType] += snr_y; | 3313 | pCtx->sStatData[iCurDid][0].sQualityStat.rYPsnr[pCtx->eSliceType] += fSnrY; |
| 3314 | pCtx->sStatData[iCurDid][0].sQualityStat.rUPsnr[pCtx->eSliceType] += snr_u; | 3314 | pCtx->sStatData[iCurDid][0].sQualityStat.rUPsnr[pCtx->eSliceType] += fSnrU; |
| 3315 | pCtx->sStatData[iCurDid][0].sQualityStat.rVPsnr[pCtx->eSliceType] += snr_v; | 3315 | pCtx->sStatData[iCurDid][0].sQualityStat.rVPsnr[pCtx->eSliceType] += fSnrV; |
| 3316 | } | 3316 | } |
| 3317 | #endif//ENABLE_PSNR_CALC | 3317 | #endif//ENABLE_PSNR_CALC |
| 3318 | 3318 | ||
| @@ -3378,9 +3378,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 59 unmodified lines | |||
| 3378 | ++ iLayerNum; | 3378 | ++ iLayerNum; |
| 3379 | } | 3379 | } |
| 3380 | 3380 | ||
| 3381 | if ((param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || param_d->sSliceCfg.uiSliceMode == SM_AUTO_SLICE) | 3381 | if ((pParam->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || pParam->sSliceCfg.uiSliceMode == SM_AUTO_SLICE) |
| 3382 | && pSvcParam->iMultipleThreadIdc > 1 && | 3382 | && pSvcParam->iMultipleThreadIdc > 1 && |
| 3383 | pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) { | 3383 | pSvcParam->iMultipleThreadIdc >= pParam->sSliceCfg.sSliceArgument.uiSliceNum) { |
| 3384 | CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx, | 3384 | CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx, |
| 3385 | pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]); | 3385 | pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]); |
| 3386 | #if defined(MT_DEBUG) | 3386 | #if defined(MT_DEBUG) |
| @@ -3396,10 +3396,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 9 unmodified lines | |||
| 3396 | 3396 | ||
| 3397 | if (pSvcParam->bEnableLongTermReference && (pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag | 3397 | if (pSvcParam->bEnableLongTermReference && (pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag |
| 3398 | && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DELAY_MARK))) { | 3398 | && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DELAY_MARK))) { |
| 3399 | pCtx->bLongTermRefFlag[d_idx][0] = true; | 3399 | pCtx->bLongTermRefFlag[iDidIdx][0] = true; |
| 3400 | } | 3400 | } |
| 3401 | 3401 | ||
| 3402 | if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, d_idx) != 0) { | 3402 | if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) { |
| 3403 | ForceCodingIDR (pCtx); | 3403 | ForceCodingIDR (pCtx); |
| 3404 | WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!\n"); | 3404 | WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!\n"); |
| 3405 | //the above is to set the next frame IDR | 3405 | //the above is to set the next frame IDR |
| @@ -3409,21 +3409,21 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines | |||
| 3409 | 3409 | ||
| 3410 | if (pSvcParam->bEnableLongTermReference && ((pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag | 3410 | if (pSvcParam->bEnableLongTermReference && ((pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag |
| 3411 | && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) { | 3411 | && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) { |
| 3412 | pCtx->bLongTermRefFlag[d_idx][iCurTid] = true; | 3412 | pCtx->bLongTermRefFlag[iDidIdx][iCurTid] = true; |
| 3413 | } | 3413 | } |
| 3414 | } | 3414 | } |
| 3415 | 3415 | ||
| 3416 | #if defined(MT_DEBUG) | 3416 | #if defined(MT_DEBUG) |
| 3417 | TrackSliceConsumeTime (pCtx, did_list, iSpatialNum); | 3417 | TrackSliceConsumeTime (pCtx, iDidList, iSpatialNum); |
| 3418 | #endif//MT_DEBUG | 3418 | #endif//MT_DEBUG |
| 3419 | 3419 | ||
| 3420 | if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID | 3420 | if (pSvcParam->iMultipleThreadIdc > 1 && iDidList[0] == BASE_DEPENDENCY_ID |
| 3421 | && ((pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) | 3421 | && ((pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) |
| 3422 | || (pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) | 3422 | || (pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) |
| 3423 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum | 3423 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum |
| 3424 | && ((pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) | 3424 | && ((pSvcParam->sDependencyLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE) |
| 3425 | || (pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) | 3425 | || (pSvcParam->sDependencyLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) |
| 3426 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum - | 3426 | && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iDidList[iSpatialNum - |
| 3427 | 1]].sSliceCfg.sSliceArgument.uiSliceNum) { | 3427 | 1]].sSliceCfg.sSliceArgument.uiSliceNum) { |
| 3428 | AdjustBaseLayer (pCtx); | 3428 | AdjustBaseLayer (pCtx); |
| 3429 | } | 3429 | } |