Showing the changes to codec/encoder/core/src/svc_encode_slice.cpp (1 of 14 files). Show all
Unified · Split
| @@ -52,7 +52,7 @@ namespace WelsEnc { · 51 unmodified lines | |||
| 52 | 52 | ||
| 53 | typedef int32_t (*PWelsCodingSliceFunc) (sWelsEncCtx* pCtx, SSlice* pSlice); | 53 | typedef int32_t (*PWelsCodingSliceFunc) (sWelsEncCtx* pCtx, SSlice* pSlice); |
| 54 | typedef void (*PWelsSliceHeaderWriteFunc) (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, | 54 | typedef void (*PWelsSliceHeaderWriteFunc) (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, |
| 55 | int32_t* pPpsIdDelta); | 55 | IWelsParametersetStrategy* pParametersetStrategy); |
| 56 | 56 | ||
| 57 | void UpdateNonZeroCountCache (SMB* pMb, SMbCache* pMbCache) { | 57 | void UpdateNonZeroCountCache (SMB* pMb, SMbCache* pMbCache) { |
| 58 | ST32 (&pMbCache->iNonZeroCoeffCount[9], LD32 (&pMb->pNonZeroCount[ 0])); | 58 | ST32 (&pMbCache->iNonZeroCoeffCount[9], LD32 (&pMb->pNonZeroCount[ 0])); |
| @@ -276,7 +276,7 @@ void WriteRefPicMarking (SBitStringAux* pBs, SSliceHeader* pSliceHeader, SNalUni · 217 unmodified lines | |||
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | void WelsSliceHeaderWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, | 278 | void WelsSliceHeaderWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, |
| 279 | int32_t* pPpsIdDelta) { | 279 | IWelsParametersetStrategy* pParametersetStrategy) { |
| 280 | SWelsSPS* pSps = pCurLayer->sLayerInfo.pSpsP; | 280 | SWelsSPS* pSps = pCurLayer->sLayerInfo.pSpsP; |
| 281 | SWelsPPS* pPps = pCurLayer->sLayerInfo.pPpsP; | 281 | SWelsPPS* pPps = pCurLayer->sLayerInfo.pPpsP; |
| 282 | SSliceHeader* pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; | 282 | SSliceHeader* pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| @@ -285,7 +285,7 @@ void WelsSliceHeaderWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCur · 2 unmodified lines | |||
| 285 | BsWriteUE (pBs, pSliceHeader->iFirstMbInSlice); | 285 | BsWriteUE (pBs, pSliceHeader->iFirstMbInSlice); |
| 286 | BsWriteUE (pBs, pSliceHeader->eSliceType); /* same type things */ | 286 | BsWriteUE (pBs, pSliceHeader->eSliceType); /* same type things */ |
| 287 | 287 | ||
| 288 | BsWriteUE (pBs, pSliceHeader->pPps->iPpsId + ((pPpsIdDelta != NULL) ? pPpsIdDelta[pSliceHeader->pPps->iPpsId] : 0)); | 288 | BsWriteUE (pBs, pSliceHeader->pPps->iPpsId + pParametersetStrategy->GetPpsIdOffset (pSliceHeader->pPps->iPpsId)); |
| 289 | 289 | ||
| 290 | BsWriteBits (pBs, pSps->uiLog2MaxFrameNum, pSliceHeader->iFrameNum); | 290 | BsWriteBits (pBs, pSps->uiLog2MaxFrameNum, pSliceHeader->iFrameNum); |
| 291 | 291 | ||
| @@ -342,7 +342,7 @@ void WelsSliceHeaderWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCur · 50 unmodified lines | |||
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | void WelsSliceHeaderExtWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, | 344 | void WelsSliceHeaderExtWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* pCurLayer, SSlice* pSlice, |
| 345 | int32_t* pPpsIdDelta) { | 345 | IWelsParametersetStrategy* pParametersetStrategy) { |
| 346 | SWelsSPS* pSps = pCurLayer->sLayerInfo.pSpsP; | 346 | SWelsSPS* pSps = pCurLayer->sLayerInfo.pSpsP; |
| 347 | SWelsPPS* pPps = pCurLayer->sLayerInfo.pPpsP; | 347 | SWelsPPS* pPps = pCurLayer->sLayerInfo.pPpsP; |
| 348 | SSubsetSps* pSubSps = pCurLayer->sLayerInfo.pSubsetSpsP; | 348 | SSubsetSps* pSubSps = pCurLayer->sLayerInfo.pSubsetSpsP; |
| @@ -353,7 +353,8 @@ void WelsSliceHeaderExtWrite (sWelsEncCtx* pCtx, SBitStringAux* pBs, SDqLayer* p · 4 unmodified lines | |||
| 353 | BsWriteUE (pBs, pSliceHeader->iFirstMbInSlice); | 353 | BsWriteUE (pBs, pSliceHeader->iFirstMbInSlice); |
| 354 | BsWriteUE (pBs, pSliceHeader->eSliceType); /* same type things */ | 354 | BsWriteUE (pBs, pSliceHeader->eSliceType); /* same type things */ |
| 355 | 355 | ||
| 356 | BsWriteUE (pBs, pSliceHeader->pPps->iPpsId + ((pPpsIdDelta != NULL) ? pPpsIdDelta[pSliceHeader->pPps->iPpsId] : 0)); | 356 | BsWriteUE (pBs, pSliceHeader->pPps->iPpsId + |
| 357 | pParametersetStrategy->GetPpsIdOffset (pSliceHeader->pPps->iPpsId)); | ||
| 357 | 358 | ||
| 358 | BsWriteBits (pBs, pSps->uiLog2MaxFrameNum, pSliceHeader->iFrameNum); | 359 | BsWriteBits (pBs, pSps->uiLog2MaxFrameNum, pSliceHeader->iFrameNum); |
| 359 | 360 | ||
| @@ -926,20 +927,7 @@ int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, const int32_t kiSliceIdx, const · 566 unmodified lines | |||
| 926 | WelsSliceHeaderExtInit (pEncCtx, pCurLayer, pCurSlice); | 927 | WelsSliceHeaderExtInit (pEncCtx, pCurLayer, pCurSlice); |
| 927 | 928 | ||
| 928 | g_pWelsWriteSliceHeader[pCurSlice->bSliceHeaderExtFlag] (pEncCtx, pBs, pCurLayer, pCurSlice, | 929 | g_pWelsWriteSliceHeader[pCurSlice->bSliceHeaderExtFlag] (pEncCtx, pBs, pCurLayer, pCurSlice, |
| 929 | ((SPS_PPS_LISTING != pEncCtx->pSvcParam->eSpsPpsIdStrategy) ? (& | 930 | pEncCtx->pFuncList->pParametersetStrategy); |
| 930 | (pEncCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_PPS].iParaSetIdDelta[0])) : NULL)); | ||
| 931 | |||
| 932 | #if _DEBUG | ||
| 933 | if (INCREASING_ID & pEncCtx->sPSOVector.eSpsPpsIdStrategy) { | ||
| 934 | const int32_t kiEncoderPpsId = pCurSlice->sSliceHeaderExt.sSliceHeader.pPps->iPpsId; | ||
| 935 | const int32_t kiTmpPpsIdInBs = kiEncoderPpsId + | ||
| 936 | pEncCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_PPS].iParaSetIdDelta[ kiEncoderPpsId ]; | ||
| 937 | assert (MAX_PPS_COUNT > kiTmpPpsIdInBs); | ||
| 938 | |||
| 939 | //when activated need to sure there is avialable PPS | ||
| 940 | assert (pEncCtx->sPSOVector.sParaSetOffsetVariable[PARA_SET_TYPE_PPS].bUsedParaSetIdInBs[kiTmpPpsIdInBs]); | ||
| 941 | } | ||
| 942 | #endif | ||
| 943 | 931 | ||
| 944 | pCurSlice->uiLastMbQp = pCurLayer->sLayerInfo.pPpsP->iPicInitQp + pCurSlice->sSliceHeaderExt.sSliceHeader.iSliceQpDelta; | 932 | pCurSlice->uiLastMbQp = pCurLayer->sLayerInfo.pPpsP->iPicInitQp + pCurSlice->sSliceHeaderExt.sSliceHeader.iSliceQpDelta; |
| 945 | 933 | ||