Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 1 file). Show all
Unified · Split
| @@ -63,14 +63,14 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 62 unmodified lines | |||
| 63 | #else | 63 | #else |
| 64 | pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010 | 64 | pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010 |
| 65 | #endif //LONG_TERM_REF | 65 | #endif //LONG_TERM_REF |
| 66 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, | 66 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, |
| 67 | "DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d.\n", | 67 | "DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d.\n", |
| 68 | kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset, | 68 | kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset, |
| 69 | pCtx->sFrameCrop.iBottomOffset); | 69 | pCtx->sFrameCrop.iBottomOffset); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) { | 72 | if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) { |
| 73 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, | 73 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 74 | "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n", | 74 | "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n", |
| 75 | pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); | 75 | pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); |
| 76 | bFrameCompleteFlag = false; //return later after output buffer is done | 76 | bFrameCompleteFlag = false; //return later after output buffer is done |
| @@ -318,6 +318,14 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 241 unmodified lines | |||
| 318 | if (pNewBsBuff == NULL) | 318 | if (pNewBsBuff == NULL) |
| 319 | return ERR_INFO_OUT_OF_MEMORY; | 319 | return ERR_INFO_OUT_OF_MEMORY; |
| 320 | 320 | ||
| 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 | |||
| 321 | //Copy current buffer status to new buffer | 329 | //Copy current buffer status to new buffer |
| 322 | memcpy (pNewBsBuff, pCtx->sRawData.pHead, pCtx->iMaxBsBufferSizeInByte); | 330 | memcpy (pNewBsBuff, pCtx->sRawData.pHead, pCtx->iMaxBsBufferSizeInByte); |
| 323 | pCtx->iMaxBsBufferSizeInByte = iNewBuffLen; | 331 | pCtx->iMaxBsBufferSizeInByte = iNewBuffLen; |
| @@ -331,7 +339,8 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 7 unmodified lines | |||
| 331 | 339 | ||
| 332 | int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) { | 340 | int32_t CheckBsBuffer (PWelsDecoderContext pCtx, const int32_t kiSrcLen) { |
| 333 | if (kiSrcLen > MAX_ACCESS_UNIT_CAPACITY) { //exceeds max allowed data | 341 | 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, | ||
| 335 | kiSrcLen); | 344 | kiSrcLen); |
| 336 | pCtx->iErrorCode |= dsBitstreamError; | 345 | pCtx->iErrorCode |= dsBitstreamError; |
| 337 | return ERR_INFO_INVALID_ACCESS; | 346 | return ERR_INFO_INVALID_ACCESS; |
| @@ -455,7 +464,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 117 unmodified lines | |||
| 455 | bool bSgChangeCycleInvolved = false; // involved slice group change cycle ? | 464 | bool bSgChangeCycleInvolved = false; // involved slice group change cycle ? |
| 456 | uint32_t uiCode; | 465 | uint32_t uiCode; |
| 457 | int32_t iCode; | 466 | int32_t iCode; |
| 458 | SLogContext* pLogCtx = &(pCtx->sLogCtx); | 467 | SLogContext* pLogCtx = & (pCtx->sLogCtx); |
| 459 | 468 | ||
| 460 | if (kpCurNal == NULL) { | 469 | if (kpCurNal == NULL) { |
| 461 | return ERR_INFO_OUT_OF_MEMORY; | 470 | return ERR_INFO_OUT_OF_MEMORY; |
| @@ -576,7 +585,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 114 unmodified lines | |||
| 576 | 585 | ||
| 577 | if (bIdrFlag) { | 586 | if (bIdrFlag) { |
| 578 | if (pSliceHead->iFrameNum != 0) { | 587 | 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", | ||
| 580 | pSliceHead->iFrameNum); | 590 | pSliceHead->iFrameNum); |
| 581 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_FRAME_NUM); | 591 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_FRAME_NUM); |
| 582 | } | 592 | } |
| @@ -750,7 +760,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 167 unmodified lines | |||
| 750 | pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc = uiCode; | 760 | pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc = uiCode; |
| 751 | //refer to JVT-X201wcm1.doc G.7.4.3.4--2010.4.20 | 761 | //refer to JVT-X201wcm1.doc G.7.4.3.4--2010.4.20 |
| 752 | if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) { | 762 | 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", |
| 754 | pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc); | 764 | pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc); |
| 755 | return ERR_INFO_INVALID_DBLOCKING_IDC; | 765 | return ERR_INFO_INVALID_DBLOCKING_IDC; |
| 756 | } | 766 | } |
| @@ -939,7 +949,8 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { · 182 unmodified lines | |||
| 939 | } | 949 | } |
| 940 | if (uiActualIdx == | 950 | if (uiActualIdx == |
| 941 | pCurAu->uiActualUnitsNum) { // no found IDR nal within incoming AU, need exit to avoid mosaic issue, 11/19/2009 | 951 | 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"); | ||
| 943 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { | 954 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { |
| 944 | #ifdef LONG_TERM_REF | 955 | #ifdef LONG_TERM_REF |
| 945 | pCtx->iErrorCode |= dsNoParamSets; | 956 | pCtx->iErrorCode |= dsNoParamSets; |
| @@ -1631,7 +1642,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 685 unmodified lines | |||
| 1631 | iErr = SyncPictureResolutionExt (pCtx, pCtx->pSps->iMbWidth, pCtx->pSps->iMbHeight); | 1642 | iErr = SyncPictureResolutionExt (pCtx, pCtx->pSps->iMbWidth, pCtx->pSps->iMbHeight); |
| 1632 | 1643 | ||
| 1633 | if (ERR_NONE != iErr) { | 1644 | 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); |
| 1635 | return iErr; | 1646 | return iErr; |
| 1636 | } | 1647 | } |
| 1637 | InitErrorCon (pCtx); //Do EC initialization here, for sequence start | 1648 | 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 | |||
| 1649 | if (pCtx->bNewSeqBegin) | 1660 | if (pCtx->bNewSeqBegin) |
| 1650 | ResetActiveSPSForEachLayer (pCtx); | 1661 | ResetActiveSPSForEachLayer (pCtx); |
| 1651 | if (ERR_NONE != iErr) { | 1662 | 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); |
| 1653 | return iErr; | 1664 | return iErr; |
| 1654 | } | 1665 | } |
| 1655 | 1666 | ||
| @@ -1785,7 +1796,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 129 unmodified lines | |||
| 1785 | pCtx->pDec = PrefetchPic (pCtx->pPicBuff[0]); | 1796 | pCtx->pDec = PrefetchPic (pCtx->pPicBuff[0]); |
| 1786 | 1797 | ||
| 1787 | if (NULL == pCtx->pDec) { | 1798 | 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", | ||
| 1789 | pCtx->pSps->iNumRefFrames); | 1801 | pCtx->pSps->iNumRefFrames); |
| 1790 | pCtx->iErrorCode |= dsOutOfMemory; | 1802 | pCtx->iErrorCode |= dsOutOfMemory; |
| 1791 | return ERR_INFO_REF_COUNT_OVERFLOW; | 1803 | return ERR_INFO_REF_COUNT_OVERFLOW; |
| @@ -1838,7 +1850,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 46 unmodified lines | |||
| 1838 | pCtx->pFmo = &pCtx->sFmoList[iPpsId]; | 1850 | pCtx->pFmo = &pCtx->sFmoList[iPpsId]; |
| 1839 | if (!FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum)) { | 1851 | if (!FmoParamUpdate (pCtx->pFmo, pLayerInfo.pSps, pLayerInfo.pPps, &pCtx->iActiveFmoNum)) { |
| 1840 | pCtx->iErrorCode |= dsBitstreamError; | 1852 | 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", |
| 1842 | pSh->eSliceType); | 1854 | pSh->eSliceType); |
| 1843 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_FMO_INIT_FAIL); | 1855 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_FMO_INIT_FAIL); |
| 1844 | } | 1856 | } |
| @@ -1863,7 +1875,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 18 unmodified lines | |||
| 1863 | if (!kbIdrFlag && | 1875 | if (!kbIdrFlag && |
| 1864 | pSh->iFrameNum != pCtx->iPrevFrameNum && | 1876 | pSh->iFrameNum != pCtx->iPrevFrameNum && |
| 1865 | pSh->iFrameNum != ((pCtx->iPrevFrameNum + 1) & ((1 << dq_cur->sLayerInfo.pSps->uiLog2MaxFrameNum) - 1))) { | 1877 | 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, |
| 1867 | "referencing pictures lost due frame gaps exist, prev_frame_num: %d, curr_frame_num: %d\n", pCtx->iPrevFrameNum, | 1879 | "referencing pictures lost due frame gaps exist, prev_frame_num: %d, curr_frame_num: %d\n", pCtx->iPrevFrameNum, |
| 1868 | pSh->iFrameNum); | 1880 | pSh->iFrameNum); |
| 1869 | 1881 | ||
| @@ -1884,7 +1896,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 14 unmodified lines | |||
| 1884 | iRet = InitRefPicList (pCtx, uiNalRefIdc, bFreshSliceAvailable, pSh->iPicOrderCntLsb); | 1896 | iRet = InitRefPicList (pCtx, uiNalRefIdc, bFreshSliceAvailable, pSh->iPicOrderCntLsb); |
| 1885 | if (iRet) { | 1897 | if (iRet) { |
| 1886 | HandleReferenceLost (pCtx, pNalCur); | 1898 | 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", | ||
| 1888 | pNalCur->sNalHeaderExt.uiTemporalId); | 1901 | pNalCur->sNalHeaderExt.uiTemporalId); |
| 1889 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { | 1902 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { |
| 1890 | return iRet; | 1903 | return iRet; |
| @@ -1896,7 +1909,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 5 unmodified lines | |||
| 1896 | 1909 | ||
| 1897 | //Output good store_base reconstruction when enhancement quality layer occurred error for MGS key picture case | 1910 | //Output good store_base reconstruction when enhancement quality layer occurred error for MGS key picture case |
| 1898 | if (iRet != ERR_NONE) { | 1911 | 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", | ||
| 1900 | iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ); | 1914 | iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ); |
| 1901 | HandleReferenceLostL0 (pCtx, pNalCur); | 1915 | HandleReferenceLostL0 (pCtx, pNalCur); |
| 1902 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { | 1916 | if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { |