2030 lines · 82.7 KB · C++
RawDownload
/*! * \copy *     Copyright (c)  2013, Cisco Systems *     All rights reserved. * *     Redistribution and use in source and binary forms, with or without *     modification, are permitted provided that the following conditions *     are met: * *        * Redistributions of source code must retain the above copyright *          notice, this list of conditions and the following disclaimer. * *        * Redistributions in binary form must reproduce the above copyright *          notice, this list of conditions and the following disclaimer in *          the documentation and/or other materials provided with the *          distribution. * *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *     COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *     POSSIBILITY OF SUCH DAMAGE. * *	decoder_core.c:	Wels decoder framework core implementation */ #include "decoder_core.h"#include "error_code.h"#include "memmgr_nal_unit.h"#include "au_parser.h"#include "decode_slice.h"#include "manage_dec_ref.h"#include "expand_pic.h"#include "decoder.h"#include "decode_mb_aux.h"#include "mem_align.h"#include "error_concealment.h" namespace WelsDec { static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {  PDqLayer pCurDq = pCtx->pCurDqLayer;  PPicture pPic = pCtx->pDec;   const int32_t kiWidth = pCurDq->iMbWidth << 4;  const int32_t kiHeight = pCurDq->iMbHeight << 4;   const int32_t kiTotalNumMbInCurLayer = pCurDq->iMbWidth * pCurDq->iMbHeight;  bool bFrameCompleteFlag = true;   if (pCtx->bNewSeqBegin) {    memcpy (& (pCtx->sFrameCrop), & (pCurDq->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->sFrameCrop),            sizeof (SPosOffset)); //confirmed_safe_unsafe_usage#ifdef LONG_TERM_REF    pCtx->bParamSetsLostFlag      = false;#else    pCtx->bReferenceLostAtT0Flag = false;	// need initialize it due new seq, 6/4/2010#endif //LONG_TERM_REF    if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) {      pCtx->bPrintFrameErrorTraceFlag = true;      WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,               "DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d, ignored error packet:%d.",               kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset,               pCtx->sFrameCrop.iBottomOffset, pCtx->iIgnoredErrorInfoPacketCount);      pCtx->iIgnoredErrorInfoPacketCount = 0;    }  }   if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,             "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d ",             pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);    bFrameCompleteFlag = false; //return later after output buffer is done    if (pCtx->bInstantDecFlag) //no-delay decoding, wait for new slice      return -1;  } else if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag             && (pCtx->iErrorCode == dsErrorFree)) { //complete non-ECed IDR frame done    pCtx->bDecErrorConedFlag = false;  }   pCtx->iTotalNumMbRec = 0;   //////output:::normal path  ppDst[0]      = pPic->pData[0];  ppDst[1]      = pPic->pData[1];  ppDst[2]      = pPic->pData[2];   pDstInfo->UsrData.sSystemBuffer.iFormat = videoFormatI420;   pDstInfo->UsrData.sSystemBuffer.iWidth = kiWidth - (pCtx->sFrameCrop.iLeftOffset + pCtx->sFrameCrop.iRightOffset) * 2;  pDstInfo->UsrData.sSystemBuffer.iHeight = kiHeight - (pCtx->sFrameCrop.iTopOffset + pCtx->sFrameCrop.iBottomOffset) * 2;  pDstInfo->UsrData.sSystemBuffer.iStride[0] = pPic->iLinesize[0];  pDstInfo->UsrData.sSystemBuffer.iStride[1] = pPic->iLinesize[1];  ppDst[0] = ppDst[0] + pCtx->sFrameCrop.iTopOffset * 2 * pPic->iLinesize[0] + pCtx->sFrameCrop.iLeftOffset * 2;  ppDst[1] = ppDst[1] + pCtx->sFrameCrop.iTopOffset  * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset;  ppDst[2] = ppDst[2] + pCtx->sFrameCrop.iTopOffset  * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset;  pDstInfo->iBufferStatus = 1;   if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete    pDstInfo->iBufferStatus = (int32_t) bFrameCompleteFlag;   if (!bFrameCompleteFlag) {    pCtx->iErrorCode |= dsBitstreamError;    return -1;  }   return 0;} inline bool    CheckSliceNeedReconstruct (uint8_t uiLayerDqId, uint8_t uiTargetDqId) {  return (uiLayerDqId == uiTargetDqId); // target layer} inline uint8_t GetTargetDqId (uint8_t uiTargetDqId,  SDecodingParam* psParam) {  uint8_t  uiRequiredDqId = psParam ? psParam->uiTargetDqLayer : (uint8_t)255;   return WELS_MIN (uiTargetDqId, uiRequiredDqId);}  inline void    HandleReferenceLostL0 (PWelsDecoderContext pCtx, PNalUnit pCurNal) {  if (0 == pCurNal->sNalHeaderExt.uiTemporalId) {    pCtx->bReferenceLostAtT0Flag = true;  }  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {#ifndef LONG_TERM_REF    if (pCtx->bReferenceLostAtT0Flag) {      ResetParameterSetsState (pCtx);    }#endif  }  pCtx->iErrorCode |= dsBitstreamError;} inline void    HandleReferenceLost (PWelsDecoderContext pCtx, PNalUnit pCurNal) {  if ((0 == pCurNal->sNalHeaderExt.uiTemporalId) || (1 == pCurNal->sNalHeaderExt.uiTemporalId)) {    pCtx->bReferenceLostAtT0Flag = true;  }  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {#ifndef LONG_TERM_REF    if (pCtx->bReferenceLostAtT0Flag) {      ResetParameterSetsState (pCtx);    }#endif  }  pCtx->iErrorCode |= dsRefLost;} inline int32_t  WelsDecodeConstructSlice (PWelsDecoderContext pCtx, PNalUnit pCurNal) {  int32_t  iRet = WelsTargetSliceConstruction (pCtx);   if (iRet) {    HandleReferenceLostL0 (pCtx, pCurNal);  }   return iRet;} /* *	Predeclared function routines .. */int32_t ParseRefPicListReordering (PBitStringAux pBs, PSliceHeader pSh) {  int32_t iList = 0;  const EWelsSliceType keSt = pSh->eSliceType;  PRefPicListReorderSyn pRefPicListReordering = &pSh->pRefPicListReordering;  PSps pSps = pSh->pSps;  uint32_t uiCode;  if (keSt == I_SLICE || keSt == SI_SLICE)    return ERR_NONE;   // Common syntaxs for P or B slices: list0, list1 followed if B slices used.  do {    WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //ref_pic_list_modification_flag_l0    pRefPicListReordering->bRefPicListReorderingFlag[iList]	= !!uiCode;     if (pRefPicListReordering->bRefPicListReorderingFlag[iList]) {      int32_t iIdx = 0;      do {        WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //modification_of_pic_nums_idc        const uint32_t kuiIdc = uiCode;         //Fixed the referrence list reordering crash issue.(fault kIdc value > 3 case)---        if ((iIdx >= MAX_REF_PIC_COUNT) || (kuiIdc > 3)) {          return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_REORDERING);        }        pRefPicListReordering->sReorderingSyn[iList][iIdx].uiReorderingOfPicNumsIdc	= kuiIdc;        if (kuiIdc == 3)          break;         if (iIdx >= pSh->uiRefCount[iList] || iIdx >= MAX_REF_PIC_COUNT)          return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_REORDERING);         if (kuiIdc == 0 || kuiIdc == 1) {          // abs_diff_pic_num_minus1 should be in range 0 to MaxPicNum-1, MaxPicNum is derived as          // 2^(4+log2_max_frame_num_minus4)          WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //abs_diff_pic_num_minus1          WELS_CHECK_SE_UPPER_ERROR_NOLOG (uiCode, (uint32_t) (1 << pSps->uiLog2MaxFrameNum), "abs_diff_pic_num_minus1",                                           GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_REORDERING));          pRefPicListReordering->sReorderingSyn[iList][iIdx].uiAbsDiffPicNumMinus1 = uiCode;	// uiAbsDiffPicNumMinus1        } else if (kuiIdc == 2) {          WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_pic_num          pRefPicListReordering->sReorderingSyn[iList][iIdx].uiLongTermPicNum = uiCode;        }         ++ iIdx;      } while (true);    }    if (keSt != B_SLICE)      break;    ++ iList;  } while (iList < LIST_A);   return ERR_NONE;} int32_t ParseDecRefPicMarking (PWelsDecoderContext pCtx, PBitStringAux pBs, PSliceHeader pSh, PSps pSps,                               const bool kbIdrFlag) {  PRefPicMarking const kpRefMarking = &pSh->sRefMarking;  uint32_t uiCode;  if (kbIdrFlag) {    WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //no_output_of_prior_pics_flag    kpRefMarking->bNoOutputOfPriorPicsFlag	= !!uiCode;    WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //long_term_reference_flag    kpRefMarking->bLongTermRefFlag			= !!uiCode;  } else {    WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //adaptive_ref_pic_marking_mode_flag    kpRefMarking->bAdaptiveRefPicMarkingModeFlag	= !!uiCode;    if (kpRefMarking->bAdaptiveRefPicMarkingModeFlag) {      int32_t iIdx = 0;      do {        WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //memory_management_control_operation        const int32_t kiMmco = uiCode;         kpRefMarking->sMmcoRef[iIdx].uiMmcoType = kiMmco;        if (kiMmco == MMCO_END)          break;         if (kiMmco == MMCO_SHORT2UNUSED || kiMmco == MMCO_SHORT2LONG) {          WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //difference_of_pic_nums_minus1          kpRefMarking->sMmcoRef[iIdx].iDiffOfPicNum = 1 + uiCode;          kpRefMarking->sMmcoRef[iIdx].iShortFrameNum = (pSh->iFrameNum - kpRefMarking->sMmcoRef[iIdx].iDiffOfPicNum) & ((                1 << pSps->uiLog2MaxFrameNum) - 1);        } else if (kiMmco == MMCO_LONG2UNUSED) {          WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_pic_num          kpRefMarking->sMmcoRef[iIdx].uiLongTermPicNum = uiCode;        }        if (kiMmco == MMCO_SHORT2LONG || kiMmco == MMCO_LONG) {          WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_frame_idx          kpRefMarking->sMmcoRef[iIdx].iLongTermFrameIdx = uiCode;        } else if (kiMmco == MMCO_SET_MAX_LONG) {          WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //max_long_term_frame_idx_plus1          kpRefMarking->sMmcoRef[iIdx].iMaxLongTermFrameIdx = -1 + uiCode;        }        ++ iIdx;       } while (iIdx < MAX_MMCO_COUNT);    }  }   return ERR_NONE;} bool FillDefaultSliceHeaderExt (PSliceHeaderExt pShExt, PNalUnitHeaderExt pNalExt) {  if (pShExt == NULL || pNalExt == NULL)    return false;   if (pNalExt->iNoInterLayerPredFlag || pNalExt->uiQualityId > 0)    pShExt->bBasePredWeightTableFlag	= false;  else    pShExt->bBasePredWeightTableFlag	= true;  pShExt->uiRefLayerDqId = (uint8_t) - 1;  pShExt->uiDisableInterLayerDeblockingFilterIdc	= 0;  pShExt->iInterLayerSliceAlphaC0Offset			= 0;  pShExt->iInterLayerSliceBetaOffset				= 0;  pShExt->bConstrainedIntraResamplingFlag			= false;  pShExt->uiRefLayerChromaPhaseXPlus1Flag			= 0;  pShExt->uiRefLayerChromaPhaseYPlus1				= 1;  //memset(&pShExt->sScaledRefLayer, 0, sizeof(SPosOffset));   pShExt->iScaledRefLayerPicWidthInSampleLuma	= pShExt->sSliceHeader.iMbWidth << 4;  pShExt->iScaledRefLayerPicHeightInSampleLuma	= pShExt->sSliceHeader.iMbHeight << 4;   pShExt->bSliceSkipFlag	= false;  pShExt->bAdaptiveBaseModeFlag	= false;  pShExt->bDefaultBaseModeFlag	= false;  pShExt->bAdaptiveMotionPredFlag	= false;  pShExt->bDefaultMotionPredFlag	= false;  pShExt->bAdaptiveResidualPredFlag	= false;  pShExt->bDefaultResidualPredFlag	= false;  pShExt->bTCoeffLevelPredFlag		= false;  pShExt->uiScanIdxStart				= 0;  pShExt->uiScanIdxEnd				= 15;   return true;} int32_t InitBsBuffer (PWelsDecoderContext pCtx) {  if (pCtx == NULL)    return ERR_INFO_INVALID_PTR;   pCtx->iMaxBsBufferSizeInByte = MIN_ACCESS_UNIT_CAPACITY * MAX_BUFFERED_NUM;  if ((pCtx->sRawData.pHead = static_cast<uint8_t*> (WelsMalloc (pCtx->iMaxBsBufferSizeInByte,                              "pCtx->sRawData.pHead"))) == NULL) {    return ERR_INFO_OUT_OF_MEMORY;  }  pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;  pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;  return ERR_NONE;} int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) {  if (pCtx == NULL)    return ERR_INFO_INVALID_PTR;  int32_t iExpandStepShift = 1;  int32_t iNewBuffLen = WELS_MAX ((kiSrcLen * MAX_BUFFERED_NUM), (pCtx->iMaxBsBufferSizeInByte << iExpandStepShift));  //allocate new bs buffer  uint8_t* pNewBsBuff = static_cast<uint8_t*> (WelsMalloc (iNewBuffLen, "pCtx->sRawData.pHead"));  if (pNewBsBuff == NULL)    return ERR_INFO_OUT_OF_MEMORY;   //Calculate and set the bs start and end position  for (uint32_t i = 0; i <= pCtx->pAccessUnitList->uiActualUnitsNum; i++) {    PBitStringAux pSliceBitsRead = &pCtx->pAccessUnitList->pNalUnitsList[i]->sNalData.sVclNal.sSliceBitsRead;    pSliceBitsRead->pStartBuf = pSliceBitsRead->pStartBuf - pCtx->sRawData.pHead + pNewBsBuff;    pSliceBitsRead->pEndBuf   = pSliceBitsRead->pEndBuf   - pCtx->sRawData.pHead + pNewBsBuff;    pSliceBitsRead->pCurBuf   = pSliceBitsRead->pCurBuf   - pCtx->sRawData.pHead + pNewBsBuff;  }   //Copy current buffer status to new buffer  memcpy (pNewBsBuff, pCtx->sRawData.pHead, pCtx->iMaxBsBufferSizeInByte);  pCtx->iMaxBsBufferSizeInByte = iNewBuffLen;  pCtx->sRawData.pStartPos = pNewBsBuff + (pCtx->sRawData.pStartPos - pCtx->sRawData.pHead);  pCtx->sRawData.pCurPos = pNewBsBuff + (pCtx->sRawData.pCurPos - pCtx->sRawData.pHead);  pCtx->sRawData.pEnd = pNewBsBuff + iNewBuffLen;  WelsFree (pCtx->sRawData.pHead, "pCtx->sRawData.pHead");  pCtx->sRawData.pHead = pNewBsBuff;  return ERR_NONE;} int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) {  if (kiSrcLen > MAX_ACCESS_UNIT_CAPACITY) { //exceeds max allowed data    WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Max AU size exceeded. Allowed size = %d, current size = %d",             MAX_ACCESS_UNIT_CAPACITY,             kiSrcLen);    pCtx->iErrorCode |= dsBitstreamError;    return ERR_INFO_INVALID_ACCESS;  } else if (kiSrcLen > pCtx->iMaxBsBufferSizeInByte /             MAX_BUFFERED_NUM) { //may lead to buffer overwrite, prevent it by expanding buffer    if (ExpandBsBuffer (pCtx, kiSrcLen)) {      return ERR_INFO_OUT_OF_MEMORY;    }  }   return ERR_NONE;} /* * WelsInitMemory * Memory request for new introduced data * Especially for: * rbsp_au_buffer, cur_dq_layer_ptr and ref_dq_layer_ptr in MB info cache. * return: *	0 - success; otherwise returned error_no defined in error_no.h.*/int32_t WelsInitMemory (PWelsDecoderContext pCtx) {  if (pCtx == NULL) {    return ERR_INFO_INVALID_PTR;  }   if (MemInitNalList (&pCtx->pAccessUnitList, MAX_NAL_UNIT_NUM_IN_AU) != 0)    return ERR_INFO_OUT_OF_MEMORY;   if (InitBsBuffer (pCtx) != 0)    return ERR_INFO_OUT_OF_MEMORY;   pCtx->uiTargetDqId			= (uint8_t) - 1;  pCtx->bEndOfStreamFlag	= false;  pCtx->iImgWidthInPixel	= 0;  pCtx->iImgHeightInPixel	= 0;   return ERR_NONE;} /* * WelsFreeMemory * Free memory introduced in WelsInitMemory at destruction of decoder. * */void WelsFreeMemory (PWelsDecoderContext pCtx) {  if (pCtx == NULL)    return;   if (NULL != pCtx->pParam) {    WelsFree (pCtx->pParam, "pCtx->pParam");     pCtx->pParam = NULL;  }   MemFreeNalList (&pCtx->pAccessUnitList);   if (pCtx->sRawData.pHead) {    WelsFree (pCtx->sRawData.pHead, "pCtx->sRawData->pHead");  }  pCtx->sRawData.pHead                = NULL;  pCtx->sRawData.pEnd                 = NULL;  pCtx->sRawData.pStartPos	        = NULL;  pCtx->sRawData.pCurPos             = NULL;} /* *	DecodeNalHeaderExt *	Trigger condition: NAL_UNIT_TYPE = NAL_UNIT_PREFIX or NAL_UNIT_CODED_SLICE_EXT *	Parameter: *	pNal:	target NALUnit ptr *	pSrc:	NAL Unit bitstream */void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) {  PNalUnitHeaderExt pHeaderExt = &pNal->sNalHeaderExt;   uint8_t uiCurByte = *pSrc;  pHeaderExt->bIdrFlag				 = !! (uiCurByte & 0x40);  pHeaderExt->uiPriorityId			 = uiCurByte & 0x3F;   uiCurByte = * (++pSrc);  pHeaderExt->iNoInterLayerPredFlag = uiCurByte >> 7;  pHeaderExt->uiDependencyId			 = (uiCurByte & 0x70) >> 4;  pHeaderExt->uiQualityId				 = uiCurByte & 0x0F;  uiCurByte = * (++pSrc);  pHeaderExt->uiTemporalId			 = uiCurByte >> 5;  pHeaderExt->bUseRefBasePicFlag	     = !! (uiCurByte & 0x10);  pHeaderExt->bDiscardableFlag		 = !! (uiCurByte & 0x08);  pHeaderExt->bOutputFlag				 = !! (uiCurByte & 0x04);  pHeaderExt->uiReservedThree2Bits	 = uiCurByte & 0x03;  pHeaderExt->uiLayerDqId				 = (pHeaderExt->uiDependencyId << 4) | pHeaderExt->uiQualityId;}  #define SLICE_HEADER_IDR_PIC_ID_MAX 65535#define SLICE_HEADER_REDUNDANT_PIC_CNT_MAX 127#define SLICE_HEADER_ALPHAC0_BETA_OFFSET_MIN -12#define SLICE_HEADER_ALPHAC0_BETA_OFFSET_MAX 12#define SLICE_HEADER_INTER_LAYER_ALPHAC0_BETA_OFFSET_MIN -12#define SLICE_HEADER_INTER_LAYER_ALPHAC0_BETA_OFFSET_MAX 12#define MAX_NUM_REF_IDX_L0_ACTIVE_MINUS1 15/* *	decode_slice_header_avc *	Parse slice header of bitstream in avc for storing data structure */int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) {  PNalUnit const kpCurNal				= pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1];   PNalUnitHeaderExt pNalHeaderExt	= NULL;  PSliceHeader pSliceHead			= NULL;  PSliceHeaderExt pSliceHeadExt	= NULL;  PSubsetSps pSubsetSps				= NULL;  PSps pSps							= NULL;  PPps pPps							= NULL;  EWelsNalUnitType eNalType				= static_cast<EWelsNalUnitType> (0);  int32_t iPpsId						= 0;  int32_t iRet						= ERR_NONE;  uint8_t uiSliceType				= 0;  uint8_t uiQualityId					= BASE_QUALITY_ID;  bool	bIdrFlag					= false;  bool	bSgChangeCycleInvolved	= false;	// involved slice group change cycle ?  uint32_t uiCode;  int32_t iCode;  SLogContext* pLogCtx = & (pCtx->sLogCtx);   if (kpCurNal == NULL) {    return ERR_INFO_OUT_OF_MEMORY;  }   pNalHeaderExt	= &kpCurNal->sNalHeaderExt;  pSliceHead		= &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;  eNalType		= pNalHeaderExt->sNalUnitHeader.eNalUnitType;   pSliceHeadExt	= &kpCurNal->sNalData.sVclNal.sSliceHeaderExt;   if (pSliceHeadExt) {    SRefBasePicMarking sBaseMarking;    const bool kbStoreRefBaseFlag = pSliceHeadExt->bStoreRefBasePicFlag;    memcpy (&sBaseMarking, &pSliceHeadExt->sRefBasePicMarking, sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage    memset (pSliceHeadExt, 0, sizeof (SSliceHeaderExt));    pSliceHeadExt->bStoreRefBasePicFlag	= kbStoreRefBaseFlag;    memcpy (&pSliceHeadExt->sRefBasePicMarking, &sBaseMarking, sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage  }   kpCurNal->sNalData.sVclNal.bSliceHeaderExtFlag	= kbExtensionFlag;   // first_mb_in_slice  WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //first_mb_in_slice  pSliceHead->iFirstMbInSlice	= uiCode; 

Lines 1–500 of 2030.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t