| 2421 | } |
| 2422 | |
| 2423 | void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { |
| 2424 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 2425 | const int32_t kiMbNumInFrame = pSliceCtx->iMbNumInFrame; |
| 2426 | int32_t iCountMbNumPerPartition = kiMbNumInFrame; |
| 2427 | int32_t iAssignableMbLeft = kiMbNumInFrame; |
| 2428 | int32_t iCountMbNumInPartition = 0; |
| 2429 | int32_t iFirstMbIdx = 0; |
| 2430 | int32_t i/*, j*/; |
| 2431 | |
| 2432 | if (iPartitionNum <= 0) |
| 2433 | iPartitionNum = 1; |
| 2434 | else if (iPartitionNum > AVERSLICENUM_CONSTRAINT) |
| 2435 | iPartitionNum = AVERSLICENUM_CONSTRAINT; // AVERSLICENUM_CONSTRAINT might be variable, however not fixed by MACRO |
| 2436 | iCountMbNumPerPartition /= iPartitionNum; |
| 2437 | if (iCountMbNumPerPartition == 0 || iCountMbNumPerPartition == 1) { |
| 2438 | iCountMbNumPerPartition = kiMbNumInFrame; |
| 2439 | iPartitionNum = 1; |
| 2440 | } |
| 2441 | |
| 2442 | pSliceCtx->iSliceNumInFrame = iPartitionNum; |
| 2443 | |
| 2444 | i = 0; |
| 2445 | while (i < iPartitionNum) { |
| 2446 | if (i + 1 == iPartitionNum) { |
| 2447 | iCountMbNumInPartition = iAssignableMbLeft; |
| 2448 | } else { |
| 2449 | iCountMbNumInPartition = iCountMbNumPerPartition; |
| 2450 | } |
| 2451 | |
| 2452 | pCurDq->FirstMbIdxOfPartition[i] = iFirstMbIdx; |
| 2453 | pCurDq->EndMbIdxOfPartition[i] = iFirstMbIdx + iCountMbNumInPartition - 1; |
| 2454 | pCurDq->LastCodedMbIdxOfPartition[i] = 0; |
| 2455 | pCurDq->NumSliceCodedOfPartition[i] = 0; |
| 2456 | |
| 2457 | WelsSetMemMultiplebytes_c (pSliceCtx->pOverallMbMap + iFirstMbIdx, i, |
| 2458 | iCountMbNumInPartition, sizeof (uint16_t)); |
| 2459 | |
| 2460 | // for next partition(or pSlice) |
| 2461 | iFirstMbIdx += iCountMbNumInPartition; |
| 2462 | iAssignableMbLeft -= iCountMbNumInPartition; |
| 2463 | ++ i; |
| 2464 | } |
| 2465 | |
| 2466 | while (i < MAX_THREADS_NUM) { |
| 2467 | pCurDq->FirstMbIdxOfPartition[i] = 0; |
| 2468 | pCurDq->EndMbIdxOfPartition[i] = 0; |
| 2469 | pCurDq->LastCodedMbIdxOfPartition[i] = 0; |
| 2470 | pCurDq->NumSliceCodedOfPartition[i] = 0; |
| 2471 | ++ i; |
| 2472 | } |
| 2473 | } |
| 2474 | |
| 2475 | void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { |
| 2476 | SDqLayer* pCurDq = pCtx->pCurDqLayer; |
no test coverage detected