| 463 | } |
| 464 | |
| 465 | int32_t WriteSliceBs (sWelsEncCtx* pCtx, SWelsSliceBs* pSliceBs, const int32_t iSliceIdx, int32_t& iSliceSize) { |
| 466 | const int32_t kiNalCnt = pSliceBs->iNalIndex; |
| 467 | int32_t iNalIdx = 0; |
| 468 | int32_t iNalSize = 0; |
| 469 | int32_t iReturn = ENC_RETURN_SUCCESS; |
| 470 | int32_t iTotalLeftLength = pSliceBs->uiSize - pSliceBs->uiBsPos; |
| 471 | SNalUnitHeaderExt* pNalHdrExt = &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt; |
| 472 | uint8_t* pDst = pSliceBs->pBs; |
| 473 | |
| 474 | assert (kiNalCnt <= 2); |
| 475 | if (kiNalCnt > 2) |
| 476 | return 0; |
| 477 | |
| 478 | iSliceSize = 0; |
| 479 | while (iNalIdx < kiNalCnt) { |
| 480 | iNalSize = 0; |
| 481 | iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, iTotalLeftLength - iSliceSize, |
| 482 | pDst, &iNalSize); |
| 483 | WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS) |
| 484 | |
| 485 | pSliceBs->iNalLen[iNalIdx] = iNalSize; |
| 486 | iSliceSize += iNalSize; |
| 487 | pDst += iNalSize; |
| 488 | ++ iNalIdx; |
| 489 | } |
| 490 | pSliceBs->uiBsPos = iSliceSize; |
| 491 | |
| 492 | return iReturn; |
| 493 | } |
| 494 | |
| 495 | // thread process for coding one pSlice |
| 496 | int32_t DynamicDetectCpuCores() { |
no test coverage detected