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 | 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 | 71 | SSliceCtx* pSliceSeg = &pCurDq->sSliceEncCtx; |
| 72 | 72 | int32_t iSliceIdx = 0; |
| 73 | 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 | 80 | iSliceIdx = 0; |
| 81 | 81 | while (iSliceIdx < iSliceNum) { |
| 82 | 82 | const int32_t kiFirstMb = iSliceIdx * kiMbWidth; |
| 83 | − WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap + kiFirstMb, iSliceIdx, | |
| 84 | − kiMbWidth, sizeof(uint16_t)); | |
| 83 | + WelsSetMemMultiplebytes_c (pSliceSeg->pOverallMbMap + kiFirstMb, iSliceIdx, | |
| 84 | + kiMbWidth, sizeof (uint16_t)); | |
| 85 | 85 | ++ iSliceIdx; |
| 86 | 86 | } |
| 87 | 87 | |
| @@ -108,7 +108,7 @@ int32_t AssignMbMapMultipleSlices (SDqLayer* pCurDq,const SSliceArgument* kpSlic · 20 unmodified lines | ||
| 108 | 108 | ++ iSliceIdx; |
| 109 | 109 | } while (iSliceIdx < kiCountSliceNumInFrame && iMbIdx < kiCountNumMbInFrame); |
| 110 | 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 | 112 | } else { // any else uiSliceMode? |
| 113 | 113 | assert (0); |
| 114 | 114 | } |
| @@ -139,7 +139,7 @@ bool CheckFixedSliceNumMultiSliceSetting (const int32_t kiMbNumInFrame, SSliceAr · 24 unmodified lines | ||
| 139 | 139 | |
| 140 | 140 | pSlicesAssignList[uiSliceIdx] = iNumMbLeft; |
| 141 | 141 | |
| 142 | − if (iNumMbLeft <= 0 || kiMbNumPerSlice <= 0 ) { | |
| 142 | + if (iNumMbLeft <= 0 || kiMbNumPerSlice <= 0) { | |
| 143 | 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 | 287 | if (iNumMbAssigning < iMinimalMbNum) |
| 288 | 288 | iCurNumMbAssigning = iMinimalMbNum; |
| 289 | 289 | else if (iNumMbAssigning > iMaximalMbNum) |
| 290 | − iCurNumMbAssigning = ( iMaximalMbNum / iGomSize ) * iGomSize; | |
| 290 | + iCurNumMbAssigning = (iMaximalMbNum / iGomSize) * iGomSize; | |
| 291 | 291 | else |
| 292 | 292 | iCurNumMbAssigning = iNumMbAssigning; |
| 293 | 293 | |
| @@ -304,7 +304,7 @@ bool GomValidCheckSliceMbNum (const int32_t kiMbWidth, const int32_t kiMbHeight, · 10 unmodified lines | ||
| 304 | 304 | ++ uiSliceIdx; |
| 305 | 305 | } |
| 306 | 306 | pSlicesAssignList[uiSliceIdx] = iNumMbLeft; |
| 307 | − if ( iNumMbLeft < iMinimalMbNum ) { | |
| 307 | + if (iNumMbLeft < iMinimalMbNum) { | |
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | |
| @@ -321,19 +321,18 @@ int32_t GetInitialSliceNum (SSliceArgument* pSliceArgument) { · 10 unmodified lines | ||
| 321 | 321 | return -1; |
| 322 | 322 | |
| 323 | 323 | switch (pSliceArgument->uiSliceMode) { |
| 324 | − case SM_SINGLE_SLICE: | |
| 325 | − case SM_FIXEDSLCNUM_SLICE: | |
| 326 | − case SM_RASTER_SLICE: | |
| 327 | − { | |
| 328 | − return pSliceArgument->uiSliceNum; | |
| 329 | − } | |
| 330 | − case SM_SIZELIMITED_SLICE: { | |
| 331 | − return AVERSLICENUM_CONSTRAINT;//at the beginning of dynamic slicing, set the uiSliceNum to be 1 | |
| 332 | − } | |
| 333 | − case SM_RESERVED: | |
| 334 | − default: { | |
| 335 | − return -1; | |
| 336 | − } | |
| 324 | + case SM_SINGLE_SLICE: | |
| 325 | + case SM_FIXEDSLCNUM_SLICE: | |
| 326 | + case SM_RASTER_SLICE: { | |
| 327 | + return pSliceArgument->uiSliceNum; | |
| 328 | + } | |
| 329 | + case SM_SIZELIMITED_SLICE: { | |
| 330 | + return AVERSLICENUM_CONSTRAINT;//at the beginning of dynamic slicing, set the uiSliceNum to be 1 | |
| 331 | + } | |
| 332 | + case SM_RESERVED: | |
| 333 | + default: { | |
| 334 | + return -1; | |
| 335 | + } | |
| 337 | 336 | } |
| 338 | 337 | |
| 339 | 338 | return -1; |
| @@ -395,13 +394,13 @@ int32_t InitSliceSegment (SDqLayer* pCurDq, · 55 unmodified lines | ||
| 395 | 394 | return AssignMbMapSingleSlice (pSliceSeg->pOverallMbMap, kiCountMbNum, sizeof (pSliceSeg->pOverallMbMap[0])); |
| 396 | 395 | } else { //if ( SM_MULTIPLE_SLICE == uiSliceMode ) |
| 397 | 396 | if (uiSliceMode != SM_FIXEDSLCNUM_SLICE && uiSliceMode != SM_RASTER_SLICE |
| 398 | − && uiSliceMode != SM_SIZELIMITED_SLICE ) | |
| 397 | + && uiSliceMode != SM_SIZELIMITED_SLICE) | |
| 399 | 398 | return 1; |
| 400 | 399 | |
| 401 | 400 | pSliceSeg->pOverallMbMap = (uint16_t*)pMa->WelsMallocz (kiCountMbNum * sizeof (uint16_t), "pSliceSeg->pOverallMbMap"); |
| 402 | 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 | 405 | //SM_SIZELIMITED_SLICE: init, set pSliceSeg->iSliceNumInFrame = 1; |
| 407 | 406 | pSliceSeg->iSliceNumInFrame = GetInitialSliceNum (pSliceArgument); |
| @@ -533,7 +532,7 @@ uint16_t WelsMbToSliceIdc (SDqLayer* pCurDq, const int32_t kiMbXY) { · 125 unmodified lines | ||
| 533 | 532 | * \return iFirstMb - successful; -1 - failed; |
| 534 | 533 | */ |
| 535 | 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 | 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 | 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 | 616 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 618 | 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 | 623 | bInValidFlag = ((SM_SINGLE_SLICE != pSliceCtx->uiSliceMode) && (kuiSliceIdc >= pSliceCtx->iSliceNumInFrame)) |
| 625 | 624 | || ((SM_SINGLE_SLICE == pSliceCtx->uiSliceMode) && (kuiSliceIdc > 0)); |
| 626 | − if(bInValidFlag) { | |
| 625 | + if (bInValidFlag) { | |
| 627 | 626 | return -1; |
| 628 | 627 | } |
| 629 | 628 | |
| @@ -662,8 +661,8 @@ int32_t DynamicAdjustSlicePEncCtxAll (SDqLayer* pCurDq, · 32 unmodified lines | ||
| 662 | 661 | pCurDq->pFirstMbIdxOfSlice[iSliceIdx] = iFirstMbIdx; |
| 663 | 662 | pCurDq->pCountMbNumInSlice[iSliceIdx] = kiSliceRun; |
| 664 | 663 | |
| 665 | − WelsSetMemMultiplebytes_c(pSliceCtx->pOverallMbMap + iFirstMbIdx, iSliceIdx, | |
| 666 | − kiSliceRun, sizeof(uint16_t)); | |
| 664 | + WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdx, iSliceIdx, | |
| 665 | + kiSliceRun, sizeof (uint16_t)); | |
| 667 | 666 | |
| 668 | 667 | iFirstMbIdx += kiSliceRun; |
| 669 | 668 | |