History

Merge remote-tracking branch 'upstream/master'

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit 3eb2a132 parents a313955 c435fb914 files · +2356 −2337Browse files

Showing the changes to codec/decoder (7 of 14 files). Show all

Unified · Split

7 files
  1. codec/decoder/core/inc/decoder_context.h +1 −0
  2. codec/decoder/core/inc/mv_pred.h +4 −0
  3. codec/decoder/core/src/decoder.cpp +2 −0
  4. codec/decoder/core/src/decoder_core.cpp +1 −1
  5. codec/decoder/core/src/parse_mb_syn_cabac.cpp +4 −0
  6. codec/decoder/core/src/parse_mb_syn_cavlc.cpp +4 −0
  7. codec/decoder/plus/src/welsDecoderExt.cpp +4 −6
codec/decoder/core/inc/decoder_context.h+1−0
@@ -512,6 +512,7 @@ typedef struct TagWelsDecoderContext { · 511 unmodified lines
512512 int16_t lastReadyHeightOffset[LIST_A][MAX_REF_PIC_COUNT]; //last ready reference MB offset
513513 PPictInfo pPictInfoList;
514514 PPictReoderingStatus pPictReoderingStatus;
515+ SBufferInfo* pDstInfo;
515516 } SWelsDecoderContext, *PWelsDecoderContext;
516517
517518 typedef struct tagSWelsDecThread {
codec/decoder/core/inc/mv_pred.h+4−0
@@ -44,6 +44,10 @@ · 43 unmodified lines
4444 #include "dec_frame.h"
4545 #include "decoder_context.h"
4646
47+#define RETURN_ERR_IF_NULL(pRefPic0) \
48+if ( pRefPic0 == NULL) \
49+ return GENERATE_ERROR_NO(ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX)
50+
4751 /*!
4852 * \brief update mv and ref_index cache for current MB, only for P_16x16 (SKIP inclusive)
4953 * \param
codec/decoder/core/src/decoder.cpp+2−0
@@ -255,6 +255,7 @@ void DestroyPicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, CMemoryAlign* · 254 unmodified lines
255255 PPicBuff pPicBuf;
256256
257257 ResetReorderingPictureBuffers (pCtx->pPictReoderingStatus, pCtx->pPictInfoList, false);
258+ if (pCtx->pDstInfo) pCtx->pDstInfo->iBufferStatus = 0;
258259
259260 if (NULL == ppPicBuf || NULL == *ppPicBuf)
260261 return;
@@ -297,6 +298,7 @@ void ResetReorderingPictureBuffers (PPictReoderingStatus pPictReoderingStatus, P · 36 unmodified lines
297298 pPictInfo[i].bLastGOP = false;
298299 pPictInfo[i].iPOC = IMinInt32;
299300 }
301+ pPictInfo->sBufferInfo.iBufferStatus = 0;
300302 }
301303 }
302304
codec/decoder/core/src/decoder_core.cpp+1−1
@@ -404,7 +404,7 @@ void CreateImplicitWeightTable (PWelsDecoderContext pCtx) { · 403 unmodified lines
404404 //fix Bugzilla 1485229 check if pointers are NULL
405405 if (pCtx->sRefPic.pRefList[LIST_0][0] && pCtx->sRefPic.pRefList[LIST_1][0]) {
406406 if (pSliceHeader->uiRefCount[0] == 1 && pSliceHeader->uiRefCount[1] == 1
407− && pCtx->sRefPic.pRefList[LIST_0][0]->iFramePoc + pCtx->sRefPic.pRefList[LIST_1][0]->iFramePoc == 2 * iPoc) {
407+ && int64_t(pCtx->sRefPic.pRefList[LIST_0][0]->iFramePoc) + int64_t(pCtx->sRefPic.pRefList[LIST_1][0]->iFramePoc) == 2 * int64_t(iPoc)) {
408408 pCurDqLayer->bUseWeightedBiPredIdc = false;
409409 return;
410410 }
codec/decoder/core/src/parse_mb_syn_cabac.cpp+4−0
@@ -777,6 +777,7 @@ int32_t ParseInterBMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pN · 776 unmodified lines
777777 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
778778 iRef[listIdx] = 0;
779779 pCtx->iErrorCode |= dsBitstreamError;
780+ RETURN_ERR_IF_NULL(pCtx->sRefPic.pRefList[listIdx][iRef[listIdx]]);
780781 } else {
781782 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
782783 }
@@ -814,6 +815,7 @@ int32_t ParseInterBMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pN · 31 unmodified lines
814815 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
815816 ref_idx = 0;
816817 pCtx->iErrorCode |= dsBitstreamError;
818+ RETURN_ERR_IF_NULL(pCtx->sRefPic.pRefList[listIdx][ref_idx]);
817819 } else {
818820 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
819821 }
@@ -858,6 +860,7 @@ int32_t ParseInterBMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pN · 38 unmodified lines
858860 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
859861 ref_idx = 0;
860862 pCtx->iErrorCode |= dsBitstreamError;
863+ RETURN_ERR_IF_NULL(pCtx->sRefPic.pRefList[listIdx][ref_idx]);
861864 } else {
862865 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
863866 }
@@ -992,6 +995,7 @@ int32_t ParseInterBMotionInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pN · 128 unmodified lines
992995 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
993996 iref = 0;
994997 pCtx->iErrorCode |= dsBitstreamError;
998+ RETURN_ERR_IF_NULL(pCtx->sRefPic.pRefList[listIdx][iref]);
995999 } else {
9961000 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
9971001 }
codec/decoder/core/src/parse_mb_syn_cavlc.cpp+4−0
@@ -1389,6 +1389,7 @@ int32_t ParseInterBInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][ · 1388 unmodified lines
13891389 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
13901390 ref_idx_list[listIdx][0] = 0;
13911391 pCtx->iErrorCode |= dsBitstreamError;
1392+ RETURN_ERR_IF_NULL(ppRefPic[listIdx][ref_idx_list[listIdx][0]]);
13921393 } else {
13931394 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
13941395 }
@@ -1438,6 +1439,7 @@ int32_t ParseInterBInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][ · 43 unmodified lines
14381439 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
14391440 iRefIdx = 0;
14401441 pCtx->iErrorCode |= dsBitstreamError;
1442+ RETURN_ERR_IF_NULL(ppRefPic[listIdx][iRefIdx]);
14411443 } else {
14421444 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
14431445 }
@@ -1497,6 +1499,7 @@ int32_t ParseInterBInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][ · 53 unmodified lines
14971499 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
14981500 iRefIdx = 0;
14991501 pCtx->iErrorCode |= dsBitstreamError;
1502+ RETURN_ERR_IF_NULL(ppRefPic[listIdx][iRefIdx]);
15001503 } else {
15011504 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
15021505 }
@@ -1643,6 +1646,7 @@ int32_t ParseInterBInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][ · 140 unmodified lines
16431646 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
16441647 iref = 0;
16451648 pCtx->iErrorCode |= dsBitstreamError;
1649+ RETURN_ERR_IF_NULL(ppRefPic[listIdx][iref]);
16461650 } else {
16471651 return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_REF_INDEX);
16481652 }
codec/decoder/plus/src/welsDecoderExt.cpp+4−6
@@ -450,6 +450,7 @@ int32_t CWelsDecoder::ResetDecoder (PWelsDecoderContext& pCtx) { · 449 unmodified lines
450450 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null");
451451 }
452452 ResetReorderingPictureBuffers (&m_sReoderingStatus, m_sPictInfoList, false);
453+ if (pCtx->pDstInfo) pCtx->pDstInfo->iBufferStatus = 0;
453454 }
454455 return ERR_INFO_UNINIT;
455456 }
@@ -461,6 +462,7 @@ int32_t CWelsDecoder::ThreadResetDecoder (PWelsDecoderContext& pCtx) { · 5 unmodified lines
461462 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "ResetDecoder(), context error code is %d", pCtx->iErrorCode);
462463 memcpy (&sPrevParam, pCtx->pParam, sizeof (SDecodingParam));
463464 ResetReorderingPictureBuffers (&m_sReoderingStatus, m_sPictInfoList, true);
465+ if (pCtx->pDstInfo) pCtx->pDstInfo->iBufferStatus = 0;
464466 CloseDecoderThreads();
465467 UninitDecoder();
466468 InitDecoder (&sPrevParam);
@@ -811,11 +813,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2WithCtx (PWelsDecoderContext pDecContex · 344 unmodified lines
811813 }
812814 return dsErrorFree;
813815 }
814− if ((pDecContext->iErrorCode & (dsBitstreamError | dsDataErrorConcealed)) && pDecContext->eSliceType == B_SLICE) {
815− ResetReorderingPictureBuffers (&m_sReoderingStatus, m_sPictInfoList, true);
816− WelsResetRefPic (pDecContext);
817− return dsErrorFree;
818− }
819816 //for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss.
820817 if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) ||
821818 (VIDEO_BITSTREAM_AVC == pDecContext->eVideoType)) {
@@ -910,6 +907,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 88 unmodified lines
910907 unsigned char** ppDst,
911908 SBufferInfo* pDstInfo) {
912909 PWelsDecoderContext pDecContext = m_pDecThrCtx[0].pCtx;
910+ pDecContext->pDstInfo = pDstInfo;
913911 return DecodeFrame2WithCtx (pDecContext, kpSrc, kiSrcLen, ppDst, pDstInfo);
914912 }
915913
@@ -1224,7 +1222,7 @@ void CWelsDecoder::ReleaseBufferedReadyPicture (PWelsDecoderContext pCtx, unsign · 308 unmodified lines
12241222 DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (PWelsDecoderContext pDecContext, unsigned char** ppDst,
12251223 SBufferInfo* pDstInfo) {
12261224 DECODING_STATE iRet = dsErrorFree;
1227− if (pDstInfo->iBufferStatus == 1) {
1225+ if ((pDstInfo->iBufferStatus == 1) && (pDecContext->pPps->bEntropyCodingModeFlag)) {
12281226 m_bIsBaseline = pDecContext->pSps->uiProfileIdc == 66 || pDecContext->pSps->uiProfileIdc == 83;
12291227 if (!m_bIsBaseline) {
12301228 BufferingReadyPicture (pDecContext, ppDst, pDstInfo);

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