overwriteactivesps
Showing the changes to codec/decoder (4 of 4 files). Show all
Unified · Split
| @@ -156,6 +156,13 @@ typedef struct TagExpandPicFunc { · 155 unmodified lines | |||
| 156 | PExpandPictureFunc pExpandChromaPicture[2]; | 156 | PExpandPictureFunc pExpandChromaPicture[2]; |
| 157 | } SExpandPicFunc; | 157 | } SExpandPicFunc; |
| 158 | 158 | ||
| 159 | enum { | ||
| 160 | OVERWRITE_NONE = 0, | ||
| 161 | OVERWRITE_PPS = 1, | ||
| 162 | OVERWRITE_SPS = 1 << 1, | ||
| 163 | OVERWRITE_SUBSETSPS = 1 << 2 | ||
| 164 | }; | ||
| 165 | |||
| 159 | /* | 166 | /* |
| 160 | * SWelsDecoderContext: to maintail all modules data over decoder@framework | 167 | * SWelsDecoderContext: to maintail all modules data over decoder@framework |
| 161 | */ | 168 | */ |
| @@ -231,14 +238,14 @@ typedef struct TagWelsDecoderContext { · 69 unmodified lines | |||
| 231 | 238 | ||
| 232 | SPosOffset sFrameCrop; | 239 | SPosOffset sFrameCrop; |
| 233 | 240 | ||
| 234 | SSps sSpsBuffer[MAX_SPS_COUNT]; | 241 | SSps sSpsBuffer[MAX_SPS_COUNT + 1]; |
| 235 | SPps sPpsBuffer[MAX_PPS_COUNT]; | 242 | SPps sPpsBuffer[MAX_PPS_COUNT + 1]; |
| 236 | PSliceHeader pSliceHeader; | 243 | PSliceHeader pSliceHeader; |
| 237 | 244 | ||
| 238 | PPicBuff pPicBuff[LIST_A]; // Initially allocated memory for pictures which are used in decoding. | 245 | PPicBuff pPicBuff[LIST_A]; // Initially allocated memory for pictures which are used in decoding. |
| 239 | int32_t iPicQueueNumber; | 246 | int32_t iPicQueueNumber; |
| 240 | 247 | ||
| 241 | SSubsetSps sSubsetSpsBuffer[MAX_SPS_COUNT]; | 248 | SSubsetSps sSubsetSpsBuffer[MAX_SPS_COUNT + 1]; |
| 242 | SNalUnit sPrefixNal; | 249 | SNalUnit sPrefixNal; |
| 243 | 250 | ||
| 244 | PAccessUnit pAccessUnitList; // current access unit list to be performed | 251 | PAccessUnit pAccessUnitList; // current access unit list to be performed |
| @@ -279,6 +286,7 @@ typedef struct TagWelsDecoderContext { · 34 unmodified lines | |||
| 279 | uint16_t uiCurIdrPicId; | 286 | uint16_t uiCurIdrPicId; |
| 280 | #endif | 287 | #endif |
| 281 | bool bNewSeqBegin; | 288 | bool bNewSeqBegin; |
| 289 | int iOverwriteFlags; | ||
| 282 | int32_t iErrorConMethod; // | 290 | int32_t iErrorConMethod; // |
| 283 | PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment | 291 | PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment |
| 284 | PGetIntraPredFunc pGetI16x16LumaPredFunc[7]; //h264_predict_copy_16x16; | 292 | PGetIntraPredFunc pGetI16x16LumaPredFunc[7]; //h264_predict_copy_16x16; |
| @@ -174,8 +174,6 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 173 unmodified lines | |||
| 174 | 174 | ||
| 175 | switch (pNalUnitHeader->eNalUnitType) { | 175 | switch (pNalUnitHeader->eNalUnitType) { |
| 176 | case NAL_UNIT_SEI: | 176 | case NAL_UNIT_SEI: |
| 177 | case NAL_UNIT_SPS: | ||
| 178 | case NAL_UNIT_PPS: | ||
| 179 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | 177 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| 180 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | 178 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; |
| 181 | pCtx->bAuReadyFlag = true; | 179 | pCtx->bAuReadyFlag = true; |
| @@ -730,6 +728,14 @@ const SLevelLimits* GetLevelLimits (int32_t iLevelIdx, bool bConstraint3) { · 548 unmodified lines | |||
| 730 | return NULL; | 728 | return NULL; |
| 731 | } | 729 | } |
| 732 | 730 | ||
| 731 | bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps) { | ||
| 732 | for (int i = 0; i < MAX_LAYER_NUM; i++) { | ||
| 733 | if (pCtx->pActiveLayerSps[i] == pSps) | ||
| 734 | return true; | ||
| 735 | } | ||
| 736 | return false; | ||
| 737 | } | ||
| 738 | |||
| 733 | #define SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX 12 | 739 | #define SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX 12 |
| 734 | #define SPS_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4_MAX 12 | 740 | #define SPS_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4_MAX 12 |
| 735 | #define SPS_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE_MAX 255 | 741 | #define SPS_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE_MAX 255 |
| @@ -792,15 +798,9 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 56 unmodified lines | |||
| 792 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); | 798 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); |
| 793 | } | 799 | } |
| 794 | iSpsId = uiCode; | 800 | iSpsId = uiCode; |
| 795 | |||
| 796 | if (kbUseSubsetFlag) { | ||
| 797 | pCtx->bSubspsAvailFlags[iSpsId] = false; | ||
| 798 | } else { | ||
| 799 | pCtx->bSpsAvailFlags[iSpsId] = false; | ||
| 800 | } | ||
| 801 | pSubsetSps = &sTempSubsetSps; | 801 | pSubsetSps = &sTempSubsetSps; |
| 802 | pSps = &sTempSubsetSps.sSps; | 802 | pSps = &sTempSubsetSps.sSps; |
| 803 | memset (pSubsetSps, 0, sizeof(SSubsetSps)); | 803 | memset (pSubsetSps, 0, sizeof (SSubsetSps)); |
| 804 | const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]); | 804 | const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]); |
| 805 | if (NULL == pSLevelLimits) { | 805 | if (NULL == pSLevelLimits) { |
| 806 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); | 806 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); |
| @@ -897,7 +897,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 90 unmodified lines | |||
| 897 | WelsLog (pCtx, WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); | 897 | WelsLog (pCtx, WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); |
| 898 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 898 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 899 | } | 899 | } |
| 900 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t)(8 * pSLevelLimits->iMaxFS)) { | 900 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { |
| 901 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); | 901 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); |
| 902 | } | 902 | } |
| 903 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 | 903 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| @@ -978,12 +978,45 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 74 unmodified lines | |||
| 978 | 978 | ||
| 979 | *pPicWidth = pSps->iMbWidth << 4; | 979 | *pPicWidth = pSps->iMbWidth << 4; |
| 980 | *pPicHeight = pSps->iMbHeight << 4; | 980 | *pPicHeight = pSps->iMbHeight << 4; |
| 981 | PSps pTmpSps = NULL; | ||
| 981 | if (kbUseSubsetFlag) { | 982 | if (kbUseSubsetFlag) { |
| 982 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof(SSubsetSps)); | 983 | pTmpSps = &pCtx->sSubsetSpsBuffer[iSpsId].sSps; |
| 984 | } else { | ||
| 985 | pTmpSps = &pCtx->sSpsBuffer[iSpsId]; | ||
| 986 | } | ||
| 987 | if (CheckSpsActive (pCtx, pTmpSps)) { | ||
| 988 | // we are overwriting the active sps, copy a temp buffer | ||
| 989 | if (kbUseSubsetFlag) { | ||
| 990 | if (memcmp (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)) != 0) { | ||
| 991 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | ||
| 992 | memcpy (&pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], pSubsetSps, sizeof (SSubsetSps)); | ||
| 993 | pCtx->bAuReadyFlag = true; | ||
| 994 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | ||
| 995 | pCtx->iOverwriteFlags |= OVERWRITE_SUBSETSPS; | ||
| 996 | } else { | ||
| 997 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); | ||
| 998 | } | ||
| 999 | } | ||
| 1000 | } else { | ||
| 1001 | if (memcmp (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)) != 0) { | ||
| 1002 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | ||
| 1003 | memcpy (&pCtx->sSpsBuffer[MAX_SPS_COUNT], pSps, sizeof (SSps)); | ||
| 1004 | pCtx->iOverwriteFlags |= OVERWRITE_SPS; | ||
| 1005 | pCtx->bAuReadyFlag = true; | ||
| 1006 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | ||
| 1007 | } else { | ||
| 1008 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)); | ||
| 1009 | } | ||
| 1010 | } | ||
| 1011 | } | ||
| 1012 | } | ||
| 1013 | // Not overwrite active sps, just copy to final place | ||
| 1014 | else if (kbUseSubsetFlag) { | ||
| 1015 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); | ||
| 983 | pCtx->bSubspsAvailFlags[iSpsId] = true; | 1016 | pCtx->bSubspsAvailFlags[iSpsId] = true; |
| 984 | pCtx->bSubspsExistAheadFlag = true; | 1017 | pCtx->bSubspsExistAheadFlag = true; |
| 985 | } else { | 1018 | } else { |
| 986 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof(SSps)); | 1019 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)); |
| 987 | pCtx->bSpsAvailFlags[iSpsId] = true; | 1020 | pCtx->bSpsAvailFlags[iSpsId] = true; |
| 988 | pCtx->bSpsExistAheadFlag = true; | 1021 | pCtx->bSpsExistAheadFlag = true; |
| 989 | } | 1022 | } |
| @@ -1018,10 +1051,8 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 28 unmodified lines | |||
| 1018 | if (uiPpsId >= MAX_PPS_COUNT) { | 1051 | if (uiPpsId >= MAX_PPS_COUNT) { |
| 1019 | return ERR_INFO_PPS_ID_OVERFLOW; | 1052 | return ERR_INFO_PPS_ID_OVERFLOW; |
| 1020 | } | 1053 | } |
| 1021 | |||
| 1022 | pCtx->bPpsAvailFlags[uiPpsId] = false; | ||
| 1023 | pPps = &sTempPps; | 1054 | pPps = &sTempPps; |
| 1024 | memset (pPps, 0, sizeof(SPps)); | 1055 | memset (pPps, 0, sizeof (SPps)); |
| 1025 | 1056 | ||
| 1026 | pPps->iPpsId = uiPpsId; | 1057 | pPps->iPpsId = uiPpsId; |
| 1027 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //seq_parameter_set_id | 1058 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //seq_parameter_set_id |
| @@ -1102,10 +1133,23 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 74 unmodified lines | |||
| 1102 | pPps->bConstainedIntraPredFlag = !!uiCode; | 1133 | pPps->bConstainedIntraPredFlag = !!uiCode; |
| 1103 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag | 1134 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag |
| 1104 | pPps->bRedundantPicCntPresentFlag = !!uiCode; | 1135 | pPps->bRedundantPicCntPresentFlag = !!uiCode; |
| 1105 | 1136 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | |
| 1106 | memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof(SPps)); | 1137 | PNalUnit pLastNalUnit = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1]; |
| 1107 | pCtx->bPpsAvailFlags[uiPpsId] = true; | 1138 | PPps pLastPps = pLastNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pPps; |
| 1108 | 1139 | // the active pps is overwrite, write to a temp place | |
| 1140 | if (pLastPps == &pCtx->sPpsBuffer[uiPpsId] && memcmp (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (*pPps)) != 0) { | ||
| 1141 | memcpy (&pCtx->sPpsBuffer[MAX_PPS_COUNT], pPps, sizeof (SPps)); | ||
| 1142 | pCtx->iOverwriteFlags |= OVERWRITE_PPS; | ||
| 1143 | pCtx->bAuReadyFlag = true; | ||
| 1144 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | ||
| 1145 | } else { | ||
| 1146 | memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps)); | ||
| 1147 | pCtx->bPpsAvailFlags[uiPpsId] = true; | ||
| 1148 | } | ||
| 1149 | } else { | ||
| 1150 | memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps)); | ||
| 1151 | pCtx->bPpsAvailFlags[uiPpsId] = true; | ||
| 1152 | } | ||
| 1109 | return ERR_NONE; | 1153 | return ERR_NONE; |
| 1110 | } | 1154 | } |
| 1111 | 1155 | ||
| @@ -61,7 +61,7 @@ extern PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth · 60 unmodified lines | |||
| 61 | extern void FreePicture (PPicture pPic); | 61 | extern void FreePicture (PPicture pPic); |
| 62 | 62 | ||
| 63 | inline void GetValueOf4Bytes (uint8_t* pDstNal, int32_t iDdstIdx) { | 63 | inline void GetValueOf4Bytes (uint8_t* pDstNal, int32_t iDdstIdx) { |
| 64 | ST32(pDstNal, iDdstIdx); | 64 | ST32 (pDstNal, iDdstIdx); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiSize, | 67 | static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiSize, |
| @@ -422,7 +422,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 354 unmodified lines | |||
| 422 | int32_t iSrcConsumed = 0; // consumed bit count of source bs | 422 | int32_t iSrcConsumed = 0; // consumed bit count of source bs |
| 423 | int32_t iDstIdx = 0; //the size of current NAL after 0x03 removal and 00 00 01 removal | 423 | int32_t iDstIdx = 0; //the size of current NAL after 0x03 removal and 00 00 01 removal |
| 424 | int32_t iSrcLength = 0; //the total size of current AU or NAL | 424 | int32_t iSrcLength = 0; //the total size of current AU or NAL |
| 425 | 425 | int32_t iRet = 0; | |
| 426 | int32_t iConsumedBytes = 0; | 426 | int32_t iConsumedBytes = 0; |
| 427 | int32_t iOffset = 0; | 427 | int32_t iOffset = 0; |
| 428 | 428 | ||
| @@ -462,7 +462,9 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 33 unmodified lines | |||
| 462 | 462 | ||
| 463 | iConsumedBytes = 0; | 463 | iConsumedBytes = 0; |
| 464 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); | 464 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); |
| 465 | 465 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { | |
| 466 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes); | ||
| 467 | } | ||
| 466 | if (pCtx->bAuReadyFlag) { | 468 | if (pCtx->bAuReadyFlag) { |
| 467 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 469 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |
| 468 | 470 | ||
| @@ -481,20 +483,17 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 12 unmodified lines | |||
| 481 | //Do error concealment here | 483 | //Do error concealment here |
| 482 | ImplementErrorCon (pCtx); | 484 | ImplementErrorCon (pCtx); |
| 483 | } | 485 | } |
| 484 | 486 | if (iRet) { | |
| 485 | if ((IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) || IS_SEI_NAL (pCtx->sCurNalHead.eNalUnitType)) && | 487 | iRet = 0; |
| 486 | pNalPayload) { | 488 | if (dsNoParamSets & pCtx->iErrorCode) { |
| 487 | if (ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes)) { | ||
| 488 | if (dsNoParamSets & pCtx->iErrorCode) { | ||
| 489 | #ifdef LONG_TERM_REF | 489 | #ifdef LONG_TERM_REF |
| 490 | pCtx->bParamSetsLostFlag = true; | 490 | pCtx->bParamSetsLostFlag = true; |
| 491 | #else | 491 | #else |
| 492 | pCtx->bReferenceLostAtT0Flag = true; | 492 | pCtx->bReferenceLostAtT0Flag = true; |
| 493 | #endif | 493 | #endif |
| 494 | ResetParameterSetsState (pCtx); | 494 | ResetParameterSetsState (pCtx); |
| 495 | } | ||
| 496 | return pCtx->iErrorCode; | ||
| 497 | } | 495 | } |
| 496 | return pCtx->iErrorCode; | ||
| 498 | } | 497 | } |
| 499 | 498 | ||
| 500 | pDstNal += iDstIdx; //update current position | 499 | pDstNal += iDstIdx; //update current position |
| @@ -521,7 +520,9 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 20 unmodified lines | |||
| 521 | 520 | ||
| 522 | iConsumedBytes = 0; | 521 | iConsumedBytes = 0; |
| 523 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); | 522 | pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); |
| 524 | 523 | if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { | |
| 524 | iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes); | ||
| 525 | } | ||
| 525 | if (pCtx->bAuReadyFlag) { | 526 | if (pCtx->bAuReadyFlag) { |
| 526 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); | 527 | ConstructAccessUnit (pCtx, ppDst, pDstBufInfo); |
| 527 | 528 | ||
| @@ -537,22 +538,18 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 9 unmodified lines | |||
| 537 | //Do error concealment here | 538 | //Do error concealment here |
| 538 | ImplementErrorCon (pCtx); | 539 | ImplementErrorCon (pCtx); |
| 539 | } | 540 | } |
| 540 | 541 | if (iRet) { | |
| 541 | if ((IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) || IS_SEI_NAL (pCtx->sCurNalHead.eNalUnitType)) | 542 | iRet = 0; |
| 542 | && pNalPayload) { | 543 | if (dsNoParamSets & pCtx->iErrorCode) { |
| 543 | if (ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes)) { | ||
| 544 | if (dsNoParamSets & pCtx->iErrorCode) { | ||
| 545 | #ifdef LONG_TERM_REF | 544 | #ifdef LONG_TERM_REF |
| 546 | pCtx->bParamSetsLostFlag = true; | 545 | pCtx->bParamSetsLostFlag = true; |
| 547 | #else | 546 | #else |
| 548 | pCtx->bReferenceLostAtT0Flag = true; | 547 | pCtx->bReferenceLostAtT0Flag = true; |
| 549 | #endif | 548 | #endif |
| 550 | ResetParameterSetsState (pCtx); | 549 | ResetParameterSetsState (pCtx); |
| 551 | } | ||
| 552 | return pCtx->iErrorCode; | ||
| 553 | } | 550 | } |
| 551 | return pCtx->iErrorCode; | ||
| 554 | } | 552 | } |
| 555 | |||
| 556 | pDstNal += iDstIdx; | 553 | pDstNal += iDstIdx; |
| 557 | pRawData->pCurPos = pDstNal; //init the pCurPos for next NAL(s) storage | 554 | pRawData->pCurPos = pDstNal; //init the pCurPos for next NAL(s) storage |
| 558 | } else { /* no supplementary picture payload input, but stored a picture */ | 555 | } else { /* no supplementary picture payload input, but stored a picture */ |
| @@ -575,7 +572,6 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in · 16 unmodified lines | |||
| 575 | ResetParameterSetsState (pCtx); | 572 | ResetParameterSetsState (pCtx); |
| 576 | return pCtx->iErrorCode; | 573 | return pCtx->iErrorCode; |
| 577 | } | 574 | } |
| 578 | //Do error concealment here | ||
| 579 | ImplementErrorCon (pCtx); | 575 | ImplementErrorCon (pCtx); |
| 580 | } | 576 | } |
| 581 | } | 577 | } |
| @@ -663,7 +659,7 @@ void AssignFuncPointerForRec (PWelsDecoderContext pCtx) { · 81 unmodified lines | |||
| 663 | pCtx->pIdctResAddPredFunc = IdctResAddPred_c; | 659 | pCtx->pIdctResAddPredFunc = IdctResAddPred_c; |
| 664 | 660 | ||
| 665 | #if defined(HAVE_NEON) | 661 | #if defined(HAVE_NEON) |
| 666 | if ( pCtx->uiCpuFlag & WELS_CPU_NEON ) { | 662 | if (pCtx->uiCpuFlag & WELS_CPU_NEON) { |
| 667 | pCtx->pIdctResAddPredFunc = IdctResAddPred_neon; | 663 | pCtx->pIdctResAddPredFunc = IdctResAddPred_neon; |
| 668 | 664 | ||
| 669 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon; | 665 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon; |
| @@ -1531,6 +1531,20 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) { · 1530 unmodified lines | |||
| 1531 | return bNewSeq; | 1531 | return bNewSeq; |
| 1532 | } | 1532 | } |
| 1533 | 1533 | ||
| 1534 | static void WriteBackActiveParameters(PWelsDecoderContext pCtx) { | ||
| 1535 | if (pCtx->iOverwriteFlags & OVERWRITE_PPS) { | ||
| 1536 | memcpy(&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof(SPps)); | ||
| 1537 | pCtx->bNewSeqBegin = true; | ||
| 1538 | } | ||
| 1539 | if (pCtx->iOverwriteFlags & OVERWRITE_SPS) { | ||
| 1540 | memcpy(&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof(SSps)); | ||
| 1541 | pCtx->bNewSeqBegin = true; | ||
| 1542 | } | ||
| 1543 | if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) { | ||
| 1544 | memcpy(&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId], &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof(SSubsetSps)); | ||
| 1545 | } | ||
| 1546 | pCtx->iOverwriteFlags = OVERWRITE_NONE; | ||
| 1547 | } | ||
| 1534 | /* | 1548 | /* |
| 1535 | * ConstructAccessUnit | 1549 | * ConstructAccessUnit |
| 1536 | * construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to | 1550 | * construct an access unit for given input bitstream, maybe partial NAL Unit, one or more Units are involved to |
| @@ -1548,12 +1562,12 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 11 unmodified lines | |||
| 1548 | int32_t iWidth; | 1562 | int32_t iWidth; |
| 1549 | int32_t iHeight; | 1563 | int32_t iHeight; |
| 1550 | int32_t iStride[2] = { 0 }; | 1564 | int32_t iStride[2] = { 0 }; |
| 1551 | |||
| 1552 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 1565 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 1553 | 1566 | ||
| 1554 | pCtx->bAuReadyFlag = false; | 1567 | pCtx->bAuReadyFlag = false; |
| 1555 | pCtx->bLastHasMmco5 = false; | 1568 | pCtx->bLastHasMmco5 = false; |
| 1556 | pCtx->bNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx); | 1569 | bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx); |
| 1570 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin && bTmpNewSeqBegin; | ||
| 1557 | iErr = WelsDecodeAccessUnitStart (pCtx); | 1571 | iErr = WelsDecodeAccessUnitStart (pCtx); |
| 1558 | GetVclNalTemporalId (pCtx); | 1572 | GetVclNalTemporalId (pCtx); |
| 1559 | 1573 | ||
| @@ -1584,6 +1598,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 24 unmodified lines | |||
| 1584 | 1598 | ||
| 1585 | WelsDecodeAccessUnitEnd (pCtx); | 1599 | WelsDecodeAccessUnitEnd (pCtx); |
| 1586 | pCtx->bNewSeqBegin = false; | 1600 | pCtx->bNewSeqBegin = false; |
| 1601 | WriteBackActiveParameters(pCtx); | ||
| 1587 | if (ERR_NONE != iErr) { | 1602 | if (ERR_NONE != iErr) { |
| 1588 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); | 1603 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); |
| 1589 | return iErr; | 1604 | return iErr; |