Showing the changes to codec/encoder/core/src/svc_enc_slice_segment.cpp (1 of 15 files). Show all
Unified · Split
| @@ -67,7 +67,7 @@ int32_t AssignMbMapSingleSlice (void* pMbMap, const int32_t kiCountMbNum, const · 66 unmodified lines | |||
| 67 | * | 67 | * |
| 68 | * \return 0 - successful; none 0 - failed | 68 | * \return 0 - successful; none 0 - failed |
| 69 | */ | 69 | */ |
| 70 | int32_t AssignMbMapMultipleSlices (SDqLayer* pCurDq,const SSliceArgument* kpSliceArgument) { | 70 | int32_t AssignMbMapMultipleSlices (SDqLayer* pCurDq, const SSliceArgument* kpSliceArgument) { |
| 71 | SSliceCtx* pSliceSeg = &pCurDq->sSliceEncCtx; | 71 | SSliceCtx* pSliceSeg = &pCurDq->sSliceEncCtx; |
| 72 | int32_t iSliceIdx = 0; | 72 | int32_t iSliceIdx = 0; |
| 73 | if (NULL == pSliceSeg || SM_SINGLE_SLICE == pSliceSeg->uiSliceMode) | 73 | if (NULL == pSliceSeg || SM_SINGLE_SLICE == pSliceSeg->uiSliceMode) |
| @@ -80,8 +80,8 @@ int32_t AssignMbMapMultipleSlices (SDqLayer* pCurDq,const SSliceArgument* kpSlic · 6 unmodified lines | |||
| 80 | iSliceIdx = 0; | 80 | iSliceIdx = 0; |
| 81 | while (iSliceIdx < iSliceNum) { | 81 | while (iSliceIdx < iSliceNum) { |
| 82 | const int32_t kiFirstMb = iSliceIdx * kiMbWidth; | 82 | const int32_t kiFirstMb = iSliceIdx * kiMbWidth; |
| 83 | WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap + kiFirstMb, iSliceIdx, | 83 | WelsSetMemMultiplebytes_c (pSliceSeg->pOverallMbMap + kiFirstMb, iSliceIdx, |
| 84 | kiMbWidth, sizeof(uint16_t)); | 84 | kiMbWidth, sizeof (uint16_t)); |
| 85 | ++ iSliceIdx; | 85 | ++ iSliceIdx; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -108,7 +108,7 @@ int32_t AssignMbMapMultipleSlices (SDqLayer* pCurDq,const SSliceArgument* kpSlic · 20 unmodified lines | |||
| 108 | ++ iSliceIdx; | 108 | ++ iSliceIdx; |
| 109 | } while (iSliceIdx < kiCountSliceNumInFrame && iMbIdx < kiCountNumMbInFrame); | 109 | } while (iSliceIdx < kiCountSliceNumInFrame && iMbIdx < kiCountNumMbInFrame); |
| 110 | } else if (SM_SIZELIMITED_SLICE == pSliceSeg->uiSliceMode) { | 110 | } else if (SM_SIZELIMITED_SLICE == pSliceSeg->uiSliceMode) { |
| 111 | // do nothing,pSliceSeg->pOverallMbMap will be initial later | 111 | // do nothing,pSliceSeg->pOverallMbMap will be initial later |
| 112 | } else { // any else uiSliceMode? | 112 | } else { // any else uiSliceMode? |
| 113 | assert (0); | 113 | assert (0); |
| 114 | } | 114 | } |
| @@ -139,7 +139,7 @@ bool CheckFixedSliceNumMultiSliceSetting (const int32_t kiMbNumInFrame, SSliceAr · 24 unmodified lines | |||
| 139 | 139 | ||
| 140 | pSlicesAssignList[uiSliceIdx] = iNumMbLeft; | 140 | pSlicesAssignList[uiSliceIdx] = iNumMbLeft; |
| 141 | 141 | ||
| 142 | if (iNumMbLeft <= 0 || kiMbNumPerSlice <= 0 ) { | 142 | if (iNumMbLeft <= 0 || kiMbNumPerSlice <= 0) { |
| 143 | return false; | 143 | return false; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| @@ -287,7 +287,7 @@ bool GomValidCheckSliceMbNum (const int32_t kiMbWidth, const int32_t kiMbHeight, · 141 unmodified lines | |||
| 287 | if (iNumMbAssigning < iMinimalMbNum) | 287 | if (iNumMbAssigning < iMinimalMbNum) |
| 288 | iCurNumMbAssigning = iMinimalMbNum; | 288 | iCurNumMbAssigning = iMinimalMbNum; |
| 289 | else if (iNumMbAssigning > iMaximalMbNum) | 289 | else if (iNumMbAssigning > iMaximalMbNum) |
| 290 | iCurNumMbAssigning = ( iMaximalMbNum / iGomSize ) * iGomSize; | 290 | iCurNumMbAssigning = (iMaximalMbNum / iGomSize) * iGomSize; |
| 291 | else | 291 | else |
| 292 | iCurNumMbAssigning = iNumMbAssigning; | 292 | iCurNumMbAssigning = iNumMbAssigning; |
| 293 | 293 | ||
| @@ -304,7 +304,7 @@ bool GomValidCheckSliceMbNum (const int32_t kiMbWidth, const int32_t kiMbHeight, · 10 unmodified lines | |||
| 304 | ++ uiSliceIdx; | 304 | ++ uiSliceIdx; |
| 305 | } | 305 | } |
| 306 | pSlicesAssignList[uiSliceIdx] = iNumMbLeft; | 306 | pSlicesAssignList[uiSliceIdx] = iNumMbLeft; |
| 307 | if ( iNumMbLeft < iMinimalMbNum ) { | 307 | if (iNumMbLeft < iMinimalMbNum) { |
| 308 | return false; | 308 | return false; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| @@ -321,19 +321,18 @@ int32_t GetInitialSliceNum (SSliceArgument* pSliceArgument) { · 10 unmodified lines | |||
| 321 | return -1; | 321 | return -1; |
| 322 | 322 | ||
| 323 | switch (pSliceArgument->uiSliceMode) { | 323 | switch (pSliceArgument->uiSliceMode) { |
| 324 | case SM_SINGLE_SLICE: | 324 | case SM_SINGLE_SLICE: |
| 325 | case SM_FIXEDSLCNUM_SLICE: | 325 | case SM_FIXEDSLCNUM_SLICE: |
| 326 | case SM_RASTER_SLICE: | 326 | case SM_RASTER_SLICE: { |
| 327 | { | 327 | return pSliceArgument->uiSliceNum; |
| 328 | return pSliceArgument->uiSliceNum; | 328 | } |
| 329 | } | 329 | case SM_SIZELIMITED_SLICE: { |
| 330 | case SM_SIZELIMITED_SLICE: { | 330 | return AVERSLICENUM_CONSTRAINT;//at the beginning of dynamic slicing, set the uiSliceNum to be 1 |
| 331 | return AVERSLICENUM_CONSTRAINT;//at the beginning of dynamic slicing, set the uiSliceNum to be 1 | 331 | } |
| 332 | } | 332 | case SM_RESERVED: |
| 333 | case SM_RESERVED: | 333 | default: { |
| 334 | default: { | 334 | return -1; |
| 335 | return -1; | 335 | } |
| 336 | } | ||
| 337 | } | 336 | } |
| 338 | 337 | ||
| 339 | return -1; | 338 | return -1; |
| @@ -395,13 +394,13 @@ int32_t InitSliceSegment (SDqLayer* pCurDq, · 55 unmodified lines | |||
| 395 | return AssignMbMapSingleSlice (pSliceSeg->pOverallMbMap, kiCountMbNum, sizeof (pSliceSeg->pOverallMbMap[0])); | 394 | return AssignMbMapSingleSlice (pSliceSeg->pOverallMbMap, kiCountMbNum, sizeof (pSliceSeg->pOverallMbMap[0])); |
| 396 | } else { //if ( SM_MULTIPLE_SLICE == uiSliceMode ) | 395 | } else { //if ( SM_MULTIPLE_SLICE == uiSliceMode ) |
| 397 | if (uiSliceMode != SM_FIXEDSLCNUM_SLICE && uiSliceMode != SM_RASTER_SLICE | 396 | if (uiSliceMode != SM_FIXEDSLCNUM_SLICE && uiSliceMode != SM_RASTER_SLICE |
| 398 | && uiSliceMode != SM_SIZELIMITED_SLICE ) | 397 | && uiSliceMode != SM_SIZELIMITED_SLICE) |
| 399 | return 1; | 398 | return 1; |
| 400 | 399 | ||
| 401 | pSliceSeg->pOverallMbMap = (uint16_t*)pMa->WelsMallocz (kiCountMbNum * sizeof (uint16_t), "pSliceSeg->pOverallMbMap"); | 400 | pSliceSeg->pOverallMbMap = (uint16_t*)pMa->WelsMallocz (kiCountMbNum * sizeof (uint16_t), "pSliceSeg->pOverallMbMap"); |
| 402 | WELS_VERIFY_RETURN_IF (1, NULL == pSliceSeg->pOverallMbMap) | 401 | WELS_VERIFY_RETURN_IF (1, NULL == pSliceSeg->pOverallMbMap) |
| 403 | 402 | ||
| 404 | WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap, 0, kiCountMbNum, sizeof(uint16_t)); | 403 | WelsSetMemMultiplebytes_c (pSliceSeg->pOverallMbMap, 0, kiCountMbNum, sizeof (uint16_t)); |
| 405 | 404 | ||
| 406 | //SM_SIZELIMITED_SLICE: init, set pSliceSeg->iSliceNumInFrame = 1; | 405 | //SM_SIZELIMITED_SLICE: init, set pSliceSeg->iSliceNumInFrame = 1; |
| 407 | pSliceSeg->iSliceNumInFrame = GetInitialSliceNum (pSliceArgument); | 406 | pSliceSeg->iSliceNumInFrame = GetInitialSliceNum (pSliceArgument); |
| @@ -533,7 +532,7 @@ uint16_t WelsMbToSliceIdc (SDqLayer* pCurDq, const int32_t kiMbXY) { · 125 unmodified lines | |||
| 533 | * \return iFirstMb - successful; -1 - failed; | 532 | * \return iFirstMb - successful; -1 - failed; |
| 534 | */ | 533 | */ |
| 535 | int32_t WelsGetFirstMbOfSlice (SDqLayer* pCurLayer, const int32_t kuiSliceIdc) { | 534 | int32_t WelsGetFirstMbOfSlice (SDqLayer* pCurLayer, const int32_t kuiSliceIdc) { |
| 536 | if ( NULL == pCurLayer || NULL == pCurLayer->pFirstMbIdxOfSlice ) { | 535 | if (NULL == pCurLayer || NULL == pCurLayer->pFirstMbIdxOfSlice) { |
| 537 | return -1; | 536 | return -1; |
| 538 | } | 537 | } |
| 539 | 538 | ||
| @@ -613,7 +612,7 @@ int32_t WelsGetPrevMbOfSlice (SDqLayer* pCurDq, const int32_t kiMbXY) { · 73 unmodified lines | |||
| 613 | * | 612 | * |
| 614 | * \return count_num_of_mb - successful; -1 - failed; | 613 | * \return count_num_of_mb - successful; -1 - failed; |
| 615 | */ | 614 | */ |
| 616 | int32_t WelsGetNumMbInSlice (SDqLayer* pCurDq, SSlice* pSlice, const int32_t kuiSliceIdc) { | 615 | int32_t WelsGetNumMbInSlice (SDqLayer* pCurDq, SSlice* pSlice, const int32_t kuiSliceIdc) { |
| 617 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; | 616 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 618 | bool bInValidFlag = false; | 617 | bool bInValidFlag = false; |
| 619 | 618 | ||
| @@ -623,7 +622,7 @@ int32_t WelsGetNumMbInSlice (SDqLayer* pCurDq, SSlice* pSlice, const int32_t ku · 3 unmodified lines | |||
| 623 | 622 | ||
| 624 | bInValidFlag = ((SM_SINGLE_SLICE != pSliceCtx->uiSliceMode) && (kuiSliceIdc >= pSliceCtx->iSliceNumInFrame)) | 623 | bInValidFlag = ((SM_SINGLE_SLICE != pSliceCtx->uiSliceMode) && (kuiSliceIdc >= pSliceCtx->iSliceNumInFrame)) |
| 625 | || ((SM_SINGLE_SLICE == pSliceCtx->uiSliceMode) && (kuiSliceIdc > 0)); | 624 | || ((SM_SINGLE_SLICE == pSliceCtx->uiSliceMode) && (kuiSliceIdc > 0)); |
| 626 | if(bInValidFlag) { | 625 | if (bInValidFlag) { |
| 627 | return -1; | 626 | return -1; |
| 628 | } | 627 | } |
| 629 | 628 | ||
| @@ -662,8 +661,8 @@ int32_t DynamicAdjustSlicePEncCtxAll (SDqLayer* pCurDq, · 32 unmodified lines | |||
| 662 | pCurDq->pFirstMbIdxOfSlice[iSliceIdx] = iFirstMbIdx; | 661 | pCurDq->pFirstMbIdxOfSlice[iSliceIdx] = iFirstMbIdx; |
| 663 | pCurDq->pCountMbNumInSlice[iSliceIdx] = kiSliceRun; | 662 | pCurDq->pCountMbNumInSlice[iSliceIdx] = kiSliceRun; |
| 664 | 663 | ||
| 665 | WelsSetMemMultiplebytes_c(pSliceCtx->pOverallMbMap + iFirstMbIdx, iSliceIdx, | 664 | WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdx, iSliceIdx, |
| 666 | kiSliceRun, sizeof(uint16_t)); | 665 | kiSliceRun, sizeof (uint16_t)); |
| 667 | 666 | ||
| 668 | iFirstMbIdx += kiSliceRun; | 667 | iFirstMbIdx += kiSliceRun; |
| 669 | 668 | ||