* ConstructAccessUnit * construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to * joint a collective access unit. * parameter\ * buf: bitstream data buffer * bit_len: size in bit length of data * buf_len: size in byte length of data * coded_au: mark an Access Unit decoding finished * return: * 0 - success; otherwise
| 2350 | * 0 - success; otherwise returned error_no defined in error_no.h |
| 2351 | */ |
| 2352 | int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) { |
| 2353 | int32_t iErr = ERR_NONE; |
| 2354 | if (GetThreadCount (pCtx) <= 1) { |
| 2355 | iErr = InitConstructAccessUnit (pCtx, pDstInfo); |
| 2356 | if (ERR_NONE != iErr) { |
| 2357 | return iErr; |
| 2358 | } |
| 2359 | } |
| 2360 | if (pCtx->pCabacDecEngine == NULL) { |
| 2361 | pCtx->pCabacDecEngine = (SWelsCabacDecEngine*)pCtx->pMemAlign->WelsMallocz (sizeof (SWelsCabacDecEngine), |
| 2362 | "pCtx->pCabacDecEngine"); |
| 2363 | WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pCtx->pCabacDecEngine)) |
| 2364 | } |
| 2365 | |
| 2366 | iErr = DecodeCurrentAccessUnit (pCtx, ppDst, pDstInfo); |
| 2367 | |
| 2368 | WelsDecodeAccessUnitEnd (pCtx); |
| 2369 | |
| 2370 | if (ERR_NONE != iErr) { |
| 2371 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "returned error from decoding:[0x%x]", iErr); |
| 2372 | return iErr; |
| 2373 | } |
| 2374 | |
| 2375 | return ERR_NONE; |
| 2376 | } |
| 2377 | |
| 2378 | static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) { |
| 2379 | PNalUnitHeaderExt pNalHdrExt = &pNalUnit->sNalHeaderExt; |
no test coverage detected