History

Debug about the ExpandBsBuffer (have no Bs buffer offset reset)

Haibo Zhu committed 12 years ago

Commit 8e400f11 parent ee425ec1 file · +28 −14Browse files

Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 1 file). Show all

Unified · Split

codec/decoder/core/src/decoder_core.cpp+28−14
@@ -63,14 +63,14 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 62 unmodified lines
6363 #else
6464 pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010
6565 #endif //LONG_TERM_REF
66− WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO,
66+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
6767 "DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d.\n",
6868 kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset,
6969 pCtx->sFrameCrop.iBottomOffset);
7070 }
7171
7272 if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {
73− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING,
73+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
7474 "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n",
7575 pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
7676 bFrameCompleteFlag = false; //return later after output buffer is done
@@ -318,6 +318,14 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 241 unmodified lines
318318 if (pNewBsBuff == NULL)
319319 return ERR_INFO_OUT_OF_MEMORY;
320320
321+ //Calculate and set the bs start and end position
322+ for (int32_t i = 0; i <= pCtx->pAccessUnitList->uiActualUnitsNum; i++) {
323+ PBitStringAux pSliceBitsRead = &pCtx->pAccessUnitList->pNalUnitsList[i]->sNalData.sVclNal.sSliceBitsRead;
324+ pSliceBitsRead->pStartBuf = pSliceBitsRead->pStartBuf - pCtx->sRawData.pHead + pNewBsBuff;
325+ pSliceBitsRead->pEndBuf = pSliceBitsRead->pEndBuf - pCtx->sRawData.pHead + pNewBsBuff;
326+ pSliceBitsRead->pCurBuf = pSliceBitsRead->pCurBuf - pCtx->sRawData.pHead + pNewBsBuff;
327+ }
328+
321329 //Copy current buffer status to new buffer
322330 memcpy (pNewBsBuff, pCtx->sRawData.pHead, pCtx->iMaxBsBufferSizeInByte);
323331 pCtx->iMaxBsBufferSizeInByte = iNewBuffLen;
@@ -331,7 +339,8 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 7 unmodified lines
331339
332340 int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) {
333341 if (kiSrcLen > MAX_ACCESS_UNIT_CAPACITY) { //exceeds max allowed data
334− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "Max AU size exceeded. Allowed size = %d, current size = %d", MAX_ACCESS_UNIT_CAPACITY,
342+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Max AU size exceeded. Allowed size = %d, current size = %d",
343+ MAX_ACCESS_UNIT_CAPACITY,
335344 kiSrcLen);
336345 pCtx->iErrorCode |= dsBitstreamError;
337346 return ERR_INFO_INVALID_ACCESS;
@@ -455,7 +464,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 117 unmodified lines
455464 bool bSgChangeCycleInvolved = false; // involved slice group change cycle ?
456465 uint32_t uiCode;
457466 int32_t iCode;
458− SLogContext* pLogCtx = &(pCtx->sLogCtx);
467+ SLogContext* pLogCtx = & (pCtx->sLogCtx);
459468
460469 if (kpCurNal == NULL) {
461470 return ERR_INFO_OUT_OF_MEMORY;
@@ -576,7 +585,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 114 unmodified lines
576585
577586 if (bIdrFlag) {
578587 if (pSliceHead->iFrameNum != 0) {
579− WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseSliceHeaderSyntaxs(), invaild frame number: %d due to IDR frame introduced!\n",
588+ WelsLog (pLogCtx, WELS_LOG_WARNING,
589+ "ParseSliceHeaderSyntaxs(), invaild frame number: %d due to IDR frame introduced!\n",
580590 pSliceHead->iFrameNum);
581591 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_FRAME_NUM);
582592 }
@@ -750,7 +760,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 167 unmodified lines
750760 pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc = uiCode;
751761 //refer to JVT-X201wcm1.doc G.7.4.3.4--2010.4.20
752762 if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) {
753− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]\n",
763+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]\n",
754764 pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc);
755765 return ERR_INFO_INVALID_DBLOCKING_IDC;
756766 }
@@ -939,7 +949,8 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { · 182 unmodified lines
939949 }
940950 if (uiActualIdx ==
941951 pCurAu->uiActualUnitsNum) { // no found IDR nal within incoming AU, need exit to avoid mosaic issue, 11/19/2009
942− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.\n");
952+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
953+ "UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.\n");
943954 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
944955 #ifdef LONG_TERM_REF
945956 pCtx->iErrorCode |= dsNoParamSets;
@@ -1631,7 +1642,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 685 unmodified lines
16311642 iErr = SyncPictureResolutionExt (pCtx, pCtx->pSps->iMbWidth, pCtx->pSps->iMbHeight);
16321643
16331644 if (ERR_NONE != iErr) {
1634− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "sync picture resolution ext failed, the error is %d", iErr);
1645+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "sync picture resolution ext failed, the error is %d", iErr);
16351646 return iErr;
16361647 }
16371648 InitErrorCon (pCtx); //Do EC initialization here, for sequence start
@@ -1649,7 +1660,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 11 unmodified lines
16491660 if (pCtx->bNewSeqBegin)
16501661 ResetActiveSPSForEachLayer (pCtx);
16511662 if (ERR_NONE != iErr) {
1652− WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr);
1663+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr);
16531664 return iErr;
16541665 }
16551666
@@ -1785,7 +1796,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 129 unmodified lines
17851796 pCtx->pDec = PrefetchPic (pCtx->pPicBuff[0]);
17861797
17871798 if (NULL == pCtx->pDec) {
1788− WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:%d.\n",
1799+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
1800+ "DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:%d.\n",
17891801 pCtx->pSps->iNumRefFrames);
17901802 pCtx->iErrorCode |= dsOutOfMemory;
17911803 return ERR_INFO_REF_COUNT_OVERFLOW;
@@ -1838,7 +1850,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 46 unmodified lines
18381850 pCtx->pFmo = &pCtx->sFmoList[iPpsId];
18391851 if (!FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum)) {
18401852 pCtx->iErrorCode |= dsBitstreamError;
1841− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeCurrentAccessUnit(), FmoParamUpdate failed, eSliceType: %d.\n",
1853+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeCurrentAccessUnit(), FmoParamUpdate failed, eSliceType: %d.\n",
18421854 pSh->eSliceType);
18431855 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_FMO_INIT_FAIL);
18441856 }
@@ -1863,7 +1875,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 18 unmodified lines
18631875 if (!kbIdrFlag &&
18641876 pSh->iFrameNum != pCtx->iPrevFrameNum &&
18651877 pSh->iFrameNum != ((pCtx->iPrevFrameNum + 1) & ((1 << dq_cur->sLayerInfo.pSps->uiLog2MaxFrameNum) - 1))) {
1866− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING,
1878+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
18671879 "referencing pictures lost due frame gaps exist, prev_frame_num: %d, curr_frame_num: %d\n", pCtx->iPrevFrameNum,
18681880 pSh->iFrameNum);
18691881
@@ -1884,7 +1896,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 14 unmodified lines
18841896 iRet = InitRefPicList (pCtx, uiNalRefIdc, bFreshSliceAvailable, pSh->iPicOrderCntLsb);
18851897 if (iRet) {
18861898 HandleReferenceLost (pCtx, pNalCur);
1887− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "reference picture introduced by this frame is lost during transmission! uiTId: %d\n",
1899+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
1900+ "reference picture introduced by this frame is lost during transmission! uiTId: %d\n",
18881901 pNalCur->sNalHeaderExt.uiTemporalId);
18891902 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
18901903 return iRet;
@@ -1896,7 +1909,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 5 unmodified lines
18961909
18971910 //Output good store_base reconstruction when enhancement quality layer occurred error for MGS key picture case
18981911 if (iRet != ERR_NONE) {
1899− WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeCurrentAccessUnit() failed (%d) in frame: %d uiDId: %d uiQId: %d\n",
1912+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
1913+ "DecodeCurrentAccessUnit() failed (%d) in frame: %d uiDId: %d uiQId: %d\n",
19001914 iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ);
19011915 HandleReferenceLostL0 (pCtx, pNalCur);
19021916 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {

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