MCPcopy Create free account
hub / github.com/cisco/openh264 / DecodeCurrentAccessUnit

Function DecodeCurrentAccessUnit

codec/decoder/core/src/decoder_core.cpp:2490–2890  ·  view source on GitHub ↗

* DecodeCurrentAccessUnit * Decode current access unit when current AU is completed. */

Source from the content-addressed store, hash-verified

2488 * Decode current access unit when current AU is completed.
2489 */
2490int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
2491 PNalUnit pNalCur = pCtx->pNalCur = NULL;
2492 PAccessUnit pCurAu = pCtx->pAccessUnitList;
2493
2494 int32_t iIdx = pCurAu->uiStartPos;
2495 int32_t iEndIdx = pCurAu->uiEndPos;
2496
2497 //get current thread ctx
2498 PWelsDecoderThreadCTX pThreadCtx = NULL;
2499 if (pCtx->pThreadCtx != NULL) {
2500 pThreadCtx = (PWelsDecoderThreadCTX)pCtx->pThreadCtx;
2501 }
2502 //get last thread ctx
2503 PWelsDecoderThreadCTX pLastThreadCtx = NULL;
2504 if (pCtx->pLastThreadCtx != NULL) {
2505 pLastThreadCtx = (PWelsDecoderThreadCTX) (pCtx->pLastThreadCtx);
2506 if (pLastThreadCtx->pDec == NULL) {
2507 pLastThreadCtx->pDec = PrefetchLastPicForThread (pCtx->pPicBuff,
2508 pLastThreadCtx->iPicBuffIdx);
2509 }
2510 }
2511 int32_t iThreadCount = GetThreadCount (pCtx);
2512 int32_t iPpsId = 0;
2513 int32_t iRet = ERR_NONE;
2514
2515 bool bAllRefComplete = true; // Assume default all ref picutres are complete
2516
2517 const uint8_t kuiTargetLayerDqId = GetTargetDqId (pCtx->uiTargetDqId, pCtx->pParam);
2518 const uint8_t kuiDependencyIdMax = (kuiTargetLayerDqId & 0x7F) >> 4;
2519 int16_t iLastIdD = -1, iLastIdQ = -1;
2520 int16_t iCurrIdD = 0, iCurrIdQ = 0;
2521 pCtx->uiNalRefIdc = 0;
2522 bool bFreshSliceAvailable =
2523 true; // Another fresh slice comingup for given dq layer, for multiple slices in case of header parts of slices sometimes loss over error-prone channels, 8/14/2008
2524
2525 //update pCurDqLayer at the starting of AU decoding
2526 if (pCtx->bInitialDqLayersMem || pCtx->pCurDqLayer == NULL) {
2527 pCtx->pCurDqLayer = pCtx->pDqLayersList[0];
2528 }
2529
2530 InitCurDqLayerData (pCtx, pCtx->pCurDqLayer);
2531
2532 pNalCur = pCurAu->pNalUnitsList[iIdx];
2533 while (iIdx <= iEndIdx) {
2534 PDqLayer dq_cur = pCtx->pCurDqLayer;
2535 SLayerInfo pLayerInfo;
2536 PSliceHeaderExt pShExt = NULL;
2537 PSliceHeader pSh = NULL;
2538 bool isNewFrame = true;
2539 if (iThreadCount > 1) {
2540 isNewFrame = pCtx->pDec == NULL;
2541 }
2542 if (pCtx->pDec == NULL) {
2543 //make call PrefetchPic first before updating reference lists in threaded mode
2544 //this prevents from possible thread-decoding hanging
2545 pCtx->pDec = PrefetchPic (pCtx->pPicBuff);
2546 if (pLastThreadCtx != NULL) {
2547 pLastThreadCtx->pDec->bUsedAsRef = pLastThreadCtx->pCtx->uiNalRefIdc > 0;

Callers 1

ConstructAccessUnitFunction · 0.85

Calls 15

PrefetchLastPicForThreadFunction · 0.85
GetThreadCountFunction · 0.85
GetTargetDqIdFunction · 0.85
InitCurDqLayerDataFunction · 0.85
PrefetchPicFunction · 0.85
WelsMarkAsRefFunction · 0.85
WelsResetRefPicFunction · 0.85
WelsLogFunction · 0.85
FmoParamUpdateFunction · 0.85
WelsDqLayerDecodeStartFunction · 0.85

Tested by

no test coverage detected