Refine Nal length related structure
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 8 files). Show all
Unified · Split
| @@ -1303,6 +1303,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 1302 unmodified lines | |||
| 1303 | (*ppCtx)->pOut->uiSize = iCountBsLen; | 1303 | (*ppCtx)->pOut->uiSize = iCountBsLen; |
| 1304 | (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); | 1304 | (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList"); |
| 1305 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx)) | 1305 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx)) |
| 1306 | (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz(iCountNals * sizeof (int32_t), "pOut->pNalLen"); | ||
| 1307 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc(ppCtx)) | ||
| 1306 | (*ppCtx)->pOut->iCountNals = iCountNals; | 1308 | (*ppCtx)->pOut->iCountNals = iCountNals; |
| 1307 | (*ppCtx)->pOut->iNalIndex = 0; | 1309 | (*ppCtx)->pOut->iNalIndex = 0; |
| 1308 | 1310 | ||
| @@ -1497,6 +1499,11 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 188 unmodified lines | |||
| 1497 | pMa->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList"); | 1499 | pMa->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList"); |
| 1498 | pCtx->pOut->sNalList = NULL; | 1500 | pCtx->pOut->sNalList = NULL; |
| 1499 | } | 1501 | } |
| 1502 | // NALs len | ||
| 1503 | if (NULL != pCtx->pOut->pNalLen) { | ||
| 1504 | pMa->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen"); | ||
| 1505 | pCtx->pOut->pNalLen = NULL; | ||
| 1506 | } | ||
| 1500 | pMa->WelsFree (pCtx->pOut, "SWelsEncoderOutput"); | 1507 | pMa->WelsFree (pCtx->pOut, "SWelsEncoderOutput"); |
| 1501 | pCtx->pOut = NULL; | 1508 | pCtx->pOut = NULL; |
| 1502 | } | 1509 | } |
| @@ -2772,7 +2779,6 @@ static inline int32_t AddPrefixNal (sWelsEncCtx* pCtx, · 1269 unmodified lines | |||
| 2772 | iPayloadSize = pNalLen[*pNalIdxInLayer]; | 2779 | iPayloadSize = pNalLen[*pNalIdxInLayer]; |
| 2773 | 2780 | ||
| 2774 | pCtx->iPosBsBuffer += iPayloadSize; | 2781 | pCtx->iPosBsBuffer += iPayloadSize; |
| 2775 | pLayerBsInfo->iNalLengthInByte[*pNalIdxInLayer] = iPayloadSize; | ||
| 2776 | 2782 | ||
| 2777 | (*pNalIdxInLayer) ++; | 2783 | (*pNalIdxInLayer) ++; |
| 2778 | } else { // No Prefix NAL Unit RBSP syntax here, but need add NAL Unit Header extension | 2784 | } else { // No Prefix NAL Unit RBSP syntax here, but need add NAL Unit Header extension |
| @@ -2789,7 +2795,6 @@ static inline int32_t AddPrefixNal (sWelsEncCtx* pCtx, · 10 unmodified lines | |||
| 2789 | iPayloadSize = pNalLen[*pNalIdxInLayer]; | 2795 | iPayloadSize = pNalLen[*pNalIdxInLayer]; |
| 2790 | 2796 | ||
| 2791 | pCtx->iPosBsBuffer += iPayloadSize; | 2797 | pCtx->iPosBsBuffer += iPayloadSize; |
| 2792 | pLayerBsInfo->iNalLengthInByte[*pNalIdxInLayer] = iPayloadSize; | ||
| 2793 | 2798 | ||
| 2794 | (*pNalIdxInLayer) ++; | 2799 | (*pNalIdxInLayer) ++; |
| 2795 | } | 2800 | } |
| @@ -2855,13 +2860,13 @@ int32_t ForceCodingIDR (sWelsEncCtx* pCtx) { · 59 unmodified lines | |||
| 2855 | int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { | 2860 | int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { |
| 2856 | SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst; | 2861 | SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst; |
| 2857 | SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0]; | 2862 | SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0]; |
| 2858 | int32_t iNalLen[128] = {0}; | ||
| 2859 | int32_t iCountNal = 0; | 2863 | int32_t iCountNal = 0; |
| 2860 | 2864 | ||
| 2861 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs; | 2865 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs; |
| 2866 | pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen; | ||
| 2862 | InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize); | 2867 | InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize); |
| 2863 | 2868 | ||
| 2864 | int32_t iReturn = WelsWriteParameterSets (pCtx, &iNalLen[0], &iCountNal); | 2869 | int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal); |
| 2865 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) | 2870 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 2866 | 2871 | ||
| 2867 | pLayerBsInfo->uiPriorityId = 0; | 2872 | pLayerBsInfo->uiPriorityId = 0; |
| @@ -2870,9 +2875,6 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { · 2 unmodified lines | |||
| 2870 | pLayerBsInfo->uiQualityId = 0; | 2875 | pLayerBsInfo->uiQualityId = 0; |
| 2871 | pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER; | 2876 | pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER; |
| 2872 | pLayerBsInfo->iNalCount = iCountNal; | 2877 | pLayerBsInfo->iNalCount = iCountNal; |
| 2873 | for (int32_t iNalIndex = 0; iNalIndex < iCountNal; ++ iNalIndex) { | ||
| 2874 | pLayerBsInfo->iNalLengthInByte[iNalIndex] = iNalLen[iNalIndex]; | ||
| 2875 | } | ||
| 2876 | 2878 | ||
| 2877 | pCtx->eLastNalPriority = NRI_PRI_HIGHEST; | 2879 | pCtx->eLastNalPriority = NRI_PRI_HIGHEST; |
| 2878 | pFbi->iLayerNum = 1; | 2880 | pFbi->iLayerNum = 1; |
| @@ -2904,7 +2906,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 25 unmodified lines | |||
| 2904 | int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame | 2906 | int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame |
| 2905 | int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame | 2907 | int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame |
| 2906 | int32_t iFrameSize = 0; | 2908 | int32_t iFrameSize = 0; |
| 2907 | int32_t iNalLen[128] = {0}; | ||
| 2908 | int32_t iNalIdxInLayer = 0; | 2909 | int32_t iNalIdxInLayer = 0; |
| 2909 | int32_t iCountNal = 0; | 2910 | int32_t iCountNal = 0; |
| 2910 | EVideoFrameType eFrameType = videoFrameTypeInvalid; | 2911 | EVideoFrameType eFrameType = videoFrameTypeInvalid; |
| @@ -2948,13 +2949,14 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 37 unmodified lines | |||
| 2948 | pCtx->uiTemporalId = iCurTid; | 2949 | pCtx->uiTemporalId = iCurTid; |
| 2949 | 2950 | ||
| 2950 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs ; | 2951 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs ; |
| 2952 | pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen; | ||
| 2951 | 2953 | ||
| 2952 | if (eFrameType == videoFrameTypeIDR) { | 2954 | if (eFrameType == videoFrameTypeIDR) { |
| 2953 | ++ pCtx->sPSOVector.uiIdrPicId; | 2955 | ++ pCtx->sPSOVector.uiIdrPicId; |
| 2954 | //if ( pSvcParam->bEnableSSEI ) | 2956 | //if ( pSvcParam->bEnableSSEI ) |
| 2955 | 2957 | ||
| 2956 | // write parameter sets bitstream here | 2958 | // write parameter sets bitstream here |
| 2957 | pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &iNalLen[0], &iCountNal); | 2959 | pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal); |
| 2958 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 2960 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 2959 | 2961 | ||
| 2960 | pLayerBsInfo->uiPriorityId = 0; | 2962 | pLayerBsInfo->uiPriorityId = 0; |
| @@ -2963,12 +2965,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines | |||
| 2963 | pLayerBsInfo->uiQualityId = 0; | 2965 | pLayerBsInfo->uiQualityId = 0; |
| 2964 | pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER; | 2966 | pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER; |
| 2965 | pLayerBsInfo->iNalCount = iCountNal; | 2967 | pLayerBsInfo->iNalCount = iCountNal; |
| 2966 | for (int32_t iNalIndex = 0; iNalIndex < iCountNal; ++ iNalIndex) { | ||
| 2967 | pLayerBsInfo->iNalLengthInByte[iNalIndex] = iNalLen[iNalIndex]; | ||
| 2968 | } | ||
| 2969 | 2968 | ||
| 2970 | ++ pLayerBsInfo; | 2969 | ++ pLayerBsInfo; |
| 2971 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; | 2970 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; |
| 2971 | pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal; | ||
| 2972 | ++ iLayerNum; | 2972 | ++ iLayerNum; |
| 2973 | } | 2973 | } |
| 2974 | 2974 | ||
| @@ -3089,7 +3089,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 114 unmodified lines | |||
| 3089 | int32_t iPayloadSize = 0; | 3089 | int32_t iPayloadSize = 0; |
| 3090 | 3090 | ||
| 3091 | if (pCtx->bNeedPrefixNalFlag) { | 3091 | if (pCtx->bNeedPrefixNalFlag) { |
| 3092 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &iNalLen[0], &iNalIdxInLayer, eNalType, eNalRefIdc, | 3092 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, eNalRefIdc, |
| 3093 | iPayloadSize); | 3093 | iPayloadSize); |
| 3094 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3094 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3095 | iLayerSize += iPayloadSize; | 3095 | iLayerSize += iPayloadSize; |
| @@ -3106,9 +3106,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 10 unmodified lines | |||
| 3106 | &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt, | 3106 | &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt, |
| 3107 | pCtx->iFrameBsSize - pCtx->iPosBsBuffer, | 3107 | pCtx->iFrameBsSize - pCtx->iPosBsBuffer, |
| 3108 | pCtx->pFrameBs + pCtx->iPosBsBuffer, | 3108 | pCtx->pFrameBs + pCtx->iPosBsBuffer, |
| 3109 | &iNalLen[iNalIdxInLayer]); | 3109 | &pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]); |
| 3110 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3110 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3111 | iSliceSize = iNalLen[iNalIdxInLayer]; | 3111 | iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]; |
| 3112 | 3112 | ||
| 3113 | iLayerSize += iSliceSize; | 3113 | iLayerSize += iSliceSize; |
| 3114 | pCtx->iPosBsBuffer += iSliceSize; | 3114 | pCtx->iPosBsBuffer += iSliceSize; |
| @@ -3117,7 +3117,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2 unmodified lines | |||
| 3117 | pLayerBsInfo->uiTemporalId = iCurTid; | 3117 | pLayerBsInfo->uiTemporalId = iCurTid; |
| 3118 | pLayerBsInfo->uiQualityId = 0; | 3118 | pLayerBsInfo->uiQualityId = 0; |
| 3119 | pLayerBsInfo->uiPriorityId = 0; | 3119 | pLayerBsInfo->uiPriorityId = 0; |
| 3120 | pLayerBsInfo->iNalLengthInByte[iNalIdxInLayer] = iSliceSize; | ||
| 3121 | pLayerBsInfo->iNalCount = ++ iNalIdxInLayer; | 3120 | pLayerBsInfo->iNalCount = ++ iNalIdxInLayer; |
| 3122 | } | 3121 | } |
| 3123 | // for dynamic slicing single threading.. | 3122 | // for dynamic slicing single threading.. |
| @@ -3260,7 +3259,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 136 unmodified lines | |||
| 3260 | int32_t iSliceSize = 0; | 3259 | int32_t iSliceSize = 0; |
| 3261 | int32_t iPayloadSize = 0; | 3260 | int32_t iPayloadSize = 0; |
| 3262 | if (bNeedPrefix) { | 3261 | if (bNeedPrefix) { |
| 3263 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &iNalLen[0], &iNalIdxInLayer, eNalType, eNalRefIdc, | 3262 | pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, eNalRefIdc, |
| 3264 | iPayloadSize); | 3263 | iPayloadSize); |
| 3265 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3264 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3266 | iLayerSize += iPayloadSize; | 3265 | iLayerSize += iPayloadSize; |
| @@ -3275,13 +3274,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 8 unmodified lines | |||
| 3275 | pCtx->iEncoderError = WelsEncodeNal (&pCtx->pOut->sNalList[pCtx->pOut->iNalIndex - 1], | 3274 | pCtx->iEncoderError = WelsEncodeNal (&pCtx->pOut->sNalList[pCtx->pOut->iNalIndex - 1], |
| 3276 | &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt, | 3275 | &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt, |
| 3277 | pCtx->iFrameBsSize - pCtx->iPosBsBuffer, | 3276 | pCtx->iFrameBsSize - pCtx->iPosBsBuffer, |
| 3278 | pCtx->pFrameBs + pCtx->iPosBsBuffer, &iNalLen[iNalIdxInLayer]); | 3277 | pCtx->pFrameBs + pCtx->iPosBsBuffer, &pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]); |
| 3279 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) | 3278 | WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS) |
| 3280 | iSliceSize = iNalLen[iNalIdxInLayer]; | 3279 | iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]; |
| 3281 | 3280 | ||
| 3282 | pCtx->iPosBsBuffer += iSliceSize; | 3281 | pCtx->iPosBsBuffer += iSliceSize; |
| 3283 | iLayerSize += iSliceSize; | 3282 | iLayerSize += iSliceSize; |
| 3284 | pLayerBsInfo->iNalLengthInByte[iNalIdxInLayer] = iSliceSize; | ||
| 3285 | 3283 | ||
| 3286 | #if defined(SLICE_INFO_OUTPUT) | 3284 | #if defined(SLICE_INFO_OUTPUT) |
| 3287 | fprintf (stderr, | 3285 | fprintf (stderr, |
| @@ -3413,10 +3411,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 125 unmodified lines | |||
| 3413 | } | 3411 | } |
| 3414 | #endif//STAT_OUTPUT | 3412 | #endif//STAT_OUTPUT |
| 3415 | 3413 | ||
| 3414 | iCountNal = pLayerBsInfo->iNalCount; | ||
| 3416 | ++ iLayerNum; | 3415 | ++ iLayerNum; |
| 3417 | ++ pLayerBsInfo; | 3416 | ++ pLayerBsInfo; |
| 3418 | 3417 | ||
| 3419 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; | 3418 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; |
| 3419 | pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal; | ||
| 3420 | 3420 | ||
| 3421 | if (pSvcParam->iPaddingFlag && pCtx->pWelsSvcRc[pCtx->uiDependencyId].iPaddingSize > 0) { | 3421 | if (pSvcParam->iPaddingFlag && pCtx->pWelsSvcRc[pCtx->uiDependencyId].iPaddingSize > 0) { |
| 3422 | int32_t iPaddingNalSize = 0; | 3422 | int32_t iPaddingNalSize = 0; |
| @@ -3440,9 +3440,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 17 unmodified lines | |||
| 3440 | pLayerBsInfo->uiQualityId = 0; | 3440 | pLayerBsInfo->uiQualityId = 0; |
| 3441 | pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER; | 3441 | pLayerBsInfo->uiLayerType = NON_VIDEO_CODING_LAYER; |
| 3442 | pLayerBsInfo->iNalCount = 1; | 3442 | pLayerBsInfo->iNalCount = 1; |
| 3443 | pLayerBsInfo->iNalLengthInByte[0] = iPaddingNalSize; | 3443 | pLayerBsInfo->pNalLengthInByte[0] = iPaddingNalSize; |
| 3444 | ++ pLayerBsInfo; | 3444 | ++ pLayerBsInfo; |
| 3445 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; | 3445 | pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; |
| 3446 | pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1; | ||
| 3446 | ++ iLayerNum; | 3447 | ++ iLayerNum; |
| 3447 | } | 3448 | } |
| 3448 | 3449 | ||
| @@ -3696,7 +3697,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 247 unmodified lines | |||
| 3696 | 3697 | ||
| 3697 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; | 3698 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 3698 | SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx; | 3699 | SSliceCtx* pSliceCtx = pCurLayer->pSliceEncCtx; |
| 3699 | int32_t iNalLen[MAX_NAL_UNITS_IN_LAYER] = {0}; | ||
| 3700 | int32_t iNalIdxInLayer = *pNalIdxInLayer; | 3700 | int32_t iNalIdxInLayer = *pNalIdxInLayer; |
| 3701 | int32_t iSliceIdx = iStartSliceIdx; | 3701 | int32_t iSliceIdx = iStartSliceIdx; |
| 3702 | const int32_t kiSliceStep = pCtx->iActiveThreadsNum; | 3702 | const int32_t kiSliceStep = pCtx->iActiveThreadsNum; |
| @@ -3727,7 +3727,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 24 unmodified lines | |||
| 3727 | } | 3727 | } |
| 3728 | 3728 | ||
| 3729 | if (kbNeedPrefix) { | 3729 | if (kbNeedPrefix) { |
| 3730 | iReturn = AddPrefixNal (pCtx, pLayerBsInfo, &iNalLen[0], &iNalIdxInLayer, keNalType, keNalRefIdc, iPayloadSize); | 3730 | iReturn = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, keNalType, keNalRefIdc, iPayloadSize); |
| 3731 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) | 3731 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 3732 | iPartitionBsSize += iPayloadSize; | 3732 | iPartitionBsSize += iPayloadSize; |
| 3733 | } | 3733 | } |
| @@ -3741,13 +3741,12 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 7 unmodified lines | |||
| 3741 | &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt, | 3741 | &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt, |
| 3742 | pCtx->iFrameBsSize - pCtx->iPosBsBuffer, | 3742 | pCtx->iFrameBsSize - pCtx->iPosBsBuffer, |
| 3743 | pCtx->pFrameBs + pCtx->iPosBsBuffer, | 3743 | pCtx->pFrameBs + pCtx->iPosBsBuffer, |
| 3744 | &iNalLen[iNalIdxInLayer]); | 3744 | &pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]); |
| 3745 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) | 3745 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 3746 | iSliceSize = iNalLen[iNalIdxInLayer]; | 3746 | iSliceSize = pLayerBsInfo->pNalLengthInByte[iNalIdxInLayer]; |
| 3747 | 3747 | ||
| 3748 | pCtx->iPosBsBuffer += iSliceSize; | 3748 | pCtx->iPosBsBuffer += iSliceSize; |
| 3749 | iPartitionBsSize += iSliceSize; | 3749 | iPartitionBsSize += iSliceSize; |
| 3750 | pLayerBsInfo->iNalLengthInByte[iNalIdxInLayer] = iSliceSize; | ||
| 3751 | 3750 | ||
| 3752 | #if defined(SLICE_INFO_OUTPUT) | 3751 | #if defined(SLICE_INFO_OUTPUT) |
| 3753 | fprintf (stderr, | 3752 | fprintf (stderr, |