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

Method InitDecoderCtx

codec/decoder/plus/src/welsDecoderExt.cpp:400–437  ·  view source on GitHub ↗

the return value of this function is not suitable, it need report failure info to upper layer.

Source from the content-addressed store, hash-verified

398
399// the return value of this function is not suitable, it need report failure info to upper layer.
400int32_t CWelsDecoder::InitDecoderCtx (PWelsDecoderContext& pCtx, const SDecodingParam* pParam) {
401
402 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
403 "CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d",
404 VERSION_NUMBER, (int32_t)pParam->bParseOnly);
405
406 //reset decoder context
407 UninitDecoderCtx (pCtx);
408 pCtx = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext");
409 if (NULL == pCtx)
410 return cmMallocMemeError;
411 int32_t iCacheLineSize = 16; // on chip cache line size in byte
412 pCtx->pMemAlign = new CMemoryAlign (iCacheLineSize);
413 WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, (NULL == pCtx->pMemAlign), UninitDecoderCtx (pCtx))
414 if (m_iCtxCount <= 1) m_pDecThrCtx[0].pCtx = pCtx;
415 //fill in default value into context
416 pCtx->pLastDecPicInfo = &m_sLastDecPicInfo;
417 pCtx->pDecoderStatistics = &m_sDecoderStatistics;
418 pCtx->pVlcTable = &m_sVlcTable;
419 pCtx->pPictInfoList = m_sPictInfoList;
420 pCtx->pPictReoderingStatus = &m_sReoderingStatus;
421 pCtx->pCsDecoder = &m_csDecoder;
422 pCtx->pStreamSeqNum = &m_iStreamSeqNum;
423 WelsDecoderDefaults (pCtx, &m_pWelsTrace->m_sLogCtx);
424 WelsDecoderSpsPpsDefaults (pCtx->sSpsPpsCtx);
425 //check param and update decoder context
426 pCtx->pParam = (SDecodingParam*)pCtx->pMemAlign->WelsMallocz (sizeof (SDecodingParam),
427 "SDecodingParam");
428 WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, (NULL == pCtx->pParam), UninitDecoderCtx (pCtx));
429 int32_t iRet = DecoderConfigParam (pCtx, pParam);
430 WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess);
431
432 //init decoder
433 WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, WelsInitDecoder (pCtx, &m_pWelsTrace->m_sLogCtx),
434 UninitDecoderCtx (pCtx))
435 pCtx->pPicBuff = NULL;
436 return cmResultSuccess;
437}
438
439int32_t CWelsDecoder::ResetDecoder (PWelsDecoderContext& pCtx) {
440 // TBC: need to be modified when context and trace point are null

Callers

nothing calls this directly

Calls 7

WelsLogFunction · 0.85
WelsMalloczFunction · 0.85
WelsDecoderDefaultsFunction · 0.85
DecoderConfigParamFunction · 0.85
WelsInitDecoderFunction · 0.85
WelsMalloczMethod · 0.80

Tested by

no test coverage detected