Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 54 files). Show all
Unified · Split
| @@ -110,7 +110,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 109 unmodified lines | |||
| 110 | int32_t iNalSize = iSrcRbspLen; | 110 | int32_t iNalSize = iSrcRbspLen; |
| 111 | PBitStringAux pBs = NULL; | 111 | PBitStringAux pBs = NULL; |
| 112 | bool bExtensionFlag = false; | 112 | bool bExtensionFlag = false; |
| 113 | int32_t iErr = ERR_NONE; | 113 | int32_t iErr = ERR_NONE; |
| 114 | int32_t iBitSize = 0; | 114 | int32_t iBitSize = 0; |
| 115 | SDataBuffer* pSavedData = &pCtx->sSavedData; | 115 | SDataBuffer* pSavedData = &pCtx->sSavedData; |
| 116 | SLogContext* pLogCtx = & (pCtx->sLogCtx); | 116 | SLogContext* pLogCtx = & (pCtx->sLogCtx); |
| @@ -132,7 +132,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 15 unmodified lines | |||
| 132 | } | 132 | } |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | pNalUnitHeader->uiForbiddenZeroBit = (uint8_t) (pNal[0] >> 7); // uiForbiddenZeroBit | 135 | pNalUnitHeader->uiForbiddenZeroBit = (uint8_t) (pNal[0] >> 7); // uiForbiddenZeroBit |
| 136 | if (pNalUnitHeader->uiForbiddenZeroBit) { //2010.4.14 | 136 | if (pNalUnitHeader->uiForbiddenZeroBit) { //2010.4.14 |
| 137 | pCtx->iErrorCode |= dsBitstreamError; | 137 | pCtx->iErrorCode |= dsBitstreamError; |
| 138 | return NULL; //uiForbiddenZeroBit should always equal to 0 | 138 | return NULL; //uiForbiddenZeroBit should always equal to 0 |
| @@ -155,7 +155,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 16 unmodified lines | |||
| 155 | pCtx->iSpsErrorIgnored++; | 155 | pCtx->iSpsErrorIgnored++; |
| 156 | } | 156 | } |
| 157 | pCtx->sDecoderStatistics.iSpsNoExistNalNum++; | 157 | pCtx->sDecoderStatistics.iSpsNoExistNalNum++; |
| 158 | pCtx->iErrorCode = dsNoParamSets; | 158 | pCtx->iErrorCode = dsNoParamSets; |
| 159 | return NULL; | 159 | return NULL; |
| 160 | } | 160 | } |
| 161 | pCtx->iSpsErrorIgnored = 0; | 161 | pCtx->iSpsErrorIgnored = 0; |
| @@ -169,7 +169,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 7 unmodified lines | |||
| 169 | pCtx->iPpsErrorIgnored++; | 169 | pCtx->iPpsErrorIgnored++; |
| 170 | } | 170 | } |
| 171 | pCtx->sDecoderStatistics.iPpsNoExistNalNum++; | 171 | pCtx->sDecoderStatistics.iPpsNoExistNalNum++; |
| 172 | pCtx->iErrorCode = dsNoParamSets; | 172 | pCtx->iErrorCode = dsNoParamSets; |
| 173 | return NULL; | 173 | return NULL; |
| 174 | } | 174 | } |
| 175 | pCtx->iPpsErrorIgnored = 0; | 175 | pCtx->iPpsErrorIgnored = 0; |
| @@ -184,7 +184,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 8 unmodified lines | |||
| 184 | pCtx->iSubSpsErrorIgnored++; | 184 | pCtx->iSubSpsErrorIgnored++; |
| 185 | } | 185 | } |
| 186 | pCtx->sDecoderStatistics.iSubSpsNoExistNalNum++; | 186 | pCtx->sDecoderStatistics.iSubSpsNoExistNalNum++; |
| 187 | pCtx->iErrorCode |= dsNoParamSets; | 187 | pCtx->iErrorCode |= dsNoParamSets; |
| 188 | return NULL; | 188 | return NULL; |
| 189 | } | 189 | } |
| 190 | pCtx->iSubSpsErrorIgnored = 0; | 190 | pCtx->iSubSpsErrorIgnored = 0; |
| @@ -203,7 +203,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 12 unmodified lines | |||
| 203 | pCurNal->uiTimeStamp = pCtx->uiTimeStamp; | 203 | pCurNal->uiTimeStamp = pCtx->uiTimeStamp; |
| 204 | 204 | ||
| 205 | if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) { | 205 | if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) { |
| 206 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 206 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 207 | uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum; | 207 | uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum; |
| 208 | 208 | ||
| 209 | if (uiAvailNalNum > 0) { | 209 | if (uiAvailNalNum > 0) { |
| @@ -222,7 +222,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 12 unmodified lines | |||
| 222 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 222 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 223 | "ParseNalHeader() in Prefix Nal Unit:uiQualityId (%d) != 0, bUseRefBasePicFlag (%d) != 0, not supported!", | 223 | "ParseNalHeader() in Prefix Nal Unit:uiQualityId (%d) != 0, bUseRefBasePicFlag (%d) != 0, not supported!", |
| 224 | pCurNal->sNalHeaderExt.uiQualityId, pCurNal->sNalHeaderExt.bUseRefBasePicFlag); | 224 | pCurNal->sNalHeaderExt.uiQualityId, pCurNal->sNalHeaderExt.bUseRefBasePicFlag); |
| 225 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 225 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 226 | uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum; | 226 | uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum; |
| 227 | 227 | ||
| 228 | if (uiAvailNalNum > 0) { | 228 | if (uiAvailNalNum > 0) { |
| @@ -250,7 +250,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 21 unmodified lines | |||
| 250 | iErr = DecInitBits (pBs, pNal, iBitSize); | 250 | iErr = DecInitBits (pBs, pNal, iBitSize); |
| 251 | if (iErr) { | 251 | if (iErr) { |
| 252 | WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_PREFIX: DecInitBits() fail due invalid access."); | 252 | WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_PREFIX: DecInitBits() fail due invalid access."); |
| 253 | pCtx->iErrorCode |= dsBitstreamError; | 253 | pCtx->iErrorCode |= dsBitstreamError; |
| 254 | return NULL; | 254 | return NULL; |
| 255 | } | 255 | } |
| 256 | ParsePrefixNalUnit (pCtx, pBs); | 256 | ParsePrefixNalUnit (pCtx, pBs); |
| @@ -262,12 +262,12 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 5 unmodified lines | |||
| 262 | bExtensionFlag = true; | 262 | bExtensionFlag = true; |
| 263 | case NAL_UNIT_CODED_SLICE: | 263 | case NAL_UNIT_CODED_SLICE: |
| 264 | case NAL_UNIT_CODED_SLICE_IDR: { | 264 | case NAL_UNIT_CODED_SLICE_IDR: { |
| 265 | PAccessUnit pCurAu = NULL; | 265 | PAccessUnit pCurAu = NULL; |
| 266 | uint32_t uiAvailNalNum; | 266 | uint32_t uiAvailNalNum; |
| 267 | pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); | 267 | pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); |
| 268 | if (NULL == pCurNal) { | 268 | if (NULL == pCurNal) { |
| 269 | WelsLog (pLogCtx, WELS_LOG_ERROR, "MemGetNextNal() fail due out of memory."); | 269 | WelsLog (pLogCtx, WELS_LOG_ERROR, "MemGetNextNal() fail due out of memory."); |
| 270 | pCtx->iErrorCode |= dsOutOfMemory; | 270 | pCtx->iErrorCode |= dsOutOfMemory; |
| 271 | return NULL; | 271 | return NULL; |
| 272 | } | 272 | } |
| 273 | pCurNal->uiTimeStamp = pCtx->uiTimeStamp; | 273 | pCurNal->uiTimeStamp = pCtx->uiTimeStamp; |
| @@ -386,7 +386,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 112 unmodified lines | |||
| 386 | } | 386 | } |
| 387 | } | 387 | } |
| 388 | WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_CODED_SLICE: DecInitBits() fail due invalid access."); | 388 | WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_CODED_SLICE: DecInitBits() fail due invalid access."); |
| 389 | pCtx->iErrorCode |= dsBitstreamError; | 389 | pCtx->iErrorCode |= dsBitstreamError; |
| 390 | return NULL; | 390 | return NULL; |
| 391 | } | 391 | } |
| 392 | iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag); | 392 | iErr = ParseSliceHeaderSyntaxs (pCtx, pBs, bExtensionFlag); |
| @@ -585,7 +585,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 192 unmodified lines | |||
| 585 | if (kiSrcLen <= 0) | 585 | if (kiSrcLen <= 0) |
| 586 | return iErr; | 586 | return iErr; |
| 587 | 587 | ||
| 588 | pBs = &pCtx->sBs; // SBitStringAux instance for non VCL NALs decoding | 588 | pBs = &pCtx->sBs; // SBitStringAux instance for non VCL NALs decoding |
| 589 | iBitSize = (kiSrcLen << 3) - BsGetTrailingBits (pRbsp + kiSrcLen - 1); // convert into bit | 589 | iBitSize = (kiSrcLen << 3) - BsGetTrailingBits (pRbsp + kiSrcLen - 1); // convert into bit |
| 590 | eNalType = pCtx->sCurNalHead.eNalUnitType; | 590 | eNalType = pCtx->sCurNalHead.eNalUnitType; |
| 591 | 591 | ||
| @@ -633,7 +633,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 41 unmodified lines | |||
| 633 | return iErr; | 633 | return iErr; |
| 634 | } | 634 | } |
| 635 | 635 | ||
| 636 | pCtx->bPpsExistAheadFlag = true; | 636 | pCtx->bPpsExistAheadFlag = true; |
| 637 | 637 | ||
| 638 | break; | 638 | break; |
| 639 | 639 | ||
| @@ -667,7 +667,7 @@ int32_t ParseRefBasePicMarking (PBitStringAux pBs, PRefBasePicMarking pRefBasePi · 27 unmodified lines | |||
| 667 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //MMCO_base | 667 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //MMCO_base |
| 668 | const uint32_t kuiMmco = uiCode; | 668 | const uint32_t kuiMmco = uiCode; |
| 669 | 669 | ||
| 670 | pRefBasePicMarking->mmco_base[iIdx].uiMmcoType = kuiMmco; | 670 | pRefBasePicMarking->mmco_base[iIdx].uiMmcoType = kuiMmco; |
| 671 | 671 | ||
| 672 | if (kuiMmco == MMCO_END) | 672 | if (kuiMmco == MMCO_END) |
| 673 | break; | 673 | break; |
| @@ -678,7 +678,7 @@ int32_t ParseRefBasePicMarking (PBitStringAux pBs, PRefBasePicMarking pRefBasePi · 4 unmodified lines | |||
| 678 | pRefBasePicMarking->mmco_base[iIdx].iShortFrameNum = 0; | 678 | pRefBasePicMarking->mmco_base[iIdx].iShortFrameNum = 0; |
| 679 | } else if (kuiMmco == MMCO_LONG2UNUSED) { | 679 | } else if (kuiMmco == MMCO_LONG2UNUSED) { |
| 680 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_base_pic_num | 680 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //long_term_base_pic_num |
| 681 | pRefBasePicMarking->mmco_base[iIdx].uiLongTermPicNum = uiCode; | 681 | pRefBasePicMarking->mmco_base[iIdx].uiLongTermPicNum = uiCode; |
| 682 | } | 682 | } |
| 683 | ++ iIdx; | 683 | ++ iIdx; |
| 684 | } while (iIdx < MAX_MMCO_COUNT); | 684 | } while (iIdx < MAX_MMCO_COUNT); |
| @@ -694,7 +694,7 @@ int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { · 9 unmodified lines | |||
| 694 | PNalUnitHeaderExt head_ext = &pCurNal->sNalHeaderExt; | 694 | PNalUnitHeaderExt head_ext = &pCurNal->sNalHeaderExt; |
| 695 | PPrefixNalUnit sPrefixNal = &pCurNal->sNalData.sPrefixNal; | 695 | PPrefixNalUnit sPrefixNal = &pCurNal->sNalData.sPrefixNal; |
| 696 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //store_ref_base_pic_flag | 696 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //store_ref_base_pic_flag |
| 697 | sPrefixNal->bStoreRefBasePicFlag = !!uiCode; | 697 | sPrefixNal->bStoreRefBasePicFlag = !!uiCode; |
| 698 | if ((head_ext->bUseRefBasePicFlag || sPrefixNal->bStoreRefBasePicFlag) && !head_ext->bIdrFlag) { | 698 | if ((head_ext->bUseRefBasePicFlag || sPrefixNal->bStoreRefBasePicFlag) && !head_ext->bIdrFlag) { |
| 699 | WELS_READ_VERIFY (ParseRefBasePicMarking (pBs, &sPrefixNal->sRefPicBaseMarking)); | 699 | WELS_READ_VERIFY (ParseRefBasePicMarking (pBs, &sPrefixNal->sRefPicBaseMarking)); |
| 700 | } | 700 | } |
| @@ -702,7 +702,7 @@ int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { · 1 unmodified line | |||
| 702 | sPrefixNal->bPrefixNalUnitAdditionalExtFlag = !!uiCode; | 702 | sPrefixNal->bPrefixNalUnitAdditionalExtFlag = !!uiCode; |
| 703 | if (sPrefixNal->bPrefixNalUnitAdditionalExtFlag) { | 703 | if (sPrefixNal->bPrefixNalUnitAdditionalExtFlag) { |
| 704 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //additional_prefix_nal_unit_extension_data_flag | 704 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //additional_prefix_nal_unit_extension_data_flag |
| 705 | sPrefixNal->bPrefixNalUnitExtFlag = !!uiCode; | 705 | sPrefixNal->bPrefixNalUnitExtFlag = !!uiCode; |
| 706 | } | 706 | } |
| 707 | } | 707 | } |
| 708 | return ERR_NONE; | 708 | return ERR_NONE; |
| @@ -721,16 +721,16 @@ int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { · 12 unmodified lines | |||
| 721 | 721 | ||
| 722 | 722 | ||
| 723 | int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) { | 723 | int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) { |
| 724 | PSpsSvcExt pExt = NULL; | 724 | PSpsSvcExt pExt = NULL; |
| 725 | uint32_t uiCode; | 725 | uint32_t uiCode; |
| 726 | int32_t iCode; | 726 | int32_t iCode; |
| 727 | 727 | ||
| 728 | pExt = &pSpsExt->sSpsSvcExt; | 728 | pExt = &pSpsExt->sSpsSvcExt; |
| 729 | 729 | ||
| 730 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //inter_layer_deblocking_filter_control_present_flag | 730 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //inter_layer_deblocking_filter_control_present_flag |
| 731 | pExt->bInterLayerDeblockingFilterCtrlPresentFlag = !!uiCode; | 731 | pExt->bInterLayerDeblockingFilterCtrlPresentFlag = !!uiCode; |
| 732 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //extended_spatial_scalability_idc | 732 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //extended_spatial_scalability_idc |
| 733 | pExt->uiExtendedSpatialScalability = uiCode; | 733 | pExt->uiExtendedSpatialScalability = uiCode; |
| 734 | if (pExt->uiExtendedSpatialScalability > 2) { | 734 | if (pExt->uiExtendedSpatialScalability > 2) { |
| 735 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | 735 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 736 | "DecodeSpsSvcExt():extended_spatial_scalability (%d) != 0, ESS not supported!", | 736 | "DecodeSpsSvcExt():extended_spatial_scalability (%d) != 0, ESS not supported!", |
| @@ -738,14 +738,14 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 1 unmodified line | |||
| 738 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_ESS); | 738 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_ESS); |
| 739 | } | 739 | } |
| 740 | 740 | ||
| 741 | pExt->uiChromaPhaseXPlus1Flag = | 741 | pExt->uiChromaPhaseXPlus1Flag = |
| 742 | 0; // FIXME: Incoherent with JVT X201 standard (= 1), but conformance to JSVM (= 0) implementation. | 742 | 0; // FIXME: Incoherent with JVT X201 standard (= 1), but conformance to JSVM (= 0) implementation. |
| 743 | pExt->uiChromaPhaseYPlus1 = 1; | 743 | pExt->uiChromaPhaseYPlus1 = 1; |
| 744 | 744 | ||
| 745 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //chroma_phase_x_plus1_flag | 745 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //chroma_phase_x_plus1_flag |
| 746 | pExt->uiChromaPhaseXPlus1Flag = uiCode; | 746 | pExt->uiChromaPhaseXPlus1Flag = uiCode; |
| 747 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //chroma_phase_y_plus1 | 747 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //chroma_phase_y_plus1 |
| 748 | pExt->uiChromaPhaseYPlus1 = uiCode; | 748 | pExt->uiChromaPhaseYPlus1 = uiCode; |
| 749 | 749 | ||
| 750 | pExt->uiSeqRefLayerChromaPhaseXPlus1Flag = pExt->uiChromaPhaseXPlus1Flag; | 750 | pExt->uiSeqRefLayerChromaPhaseXPlus1Flag = pExt->uiChromaPhaseXPlus1Flag; |
| 751 | pExt->uiSeqRefLayerChromaPhaseYPlus1 = pExt->uiChromaPhaseYPlus1; | 751 | pExt->uiSeqRefLayerChromaPhaseYPlus1 = pExt->uiChromaPhaseYPlus1; |
| @@ -754,20 +754,20 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 2 unmodified lines | |||
| 754 | if (pExt->uiExtendedSpatialScalability == 1) { | 754 | if (pExt->uiExtendedSpatialScalability == 1) { |
| 755 | SPosOffset* const kpPos = &pExt->sSeqScaledRefLayer; | 755 | SPosOffset* const kpPos = &pExt->sSeqScaledRefLayer; |
| 756 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_ref_layer_chroma_phase_x_plus1_flag | 756 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_ref_layer_chroma_phase_x_plus1_flag |
| 757 | pExt->uiSeqRefLayerChromaPhaseXPlus1Flag = uiCode; | 757 | pExt->uiSeqRefLayerChromaPhaseXPlus1Flag = uiCode; |
| 758 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //seq_ref_layer_chroma_phase_y_plus1 | 758 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //seq_ref_layer_chroma_phase_y_plus1 |
| 759 | pExt->uiSeqRefLayerChromaPhaseYPlus1 = uiCode; | 759 | pExt->uiSeqRefLayerChromaPhaseYPlus1 = uiCode; |
| 760 | 760 | ||
| 761 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_left_offset | 761 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_left_offset |
| 762 | kpPos->iLeftOffset = iCode; | 762 | kpPos->iLeftOffset = iCode; |
| 763 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iLeftOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MIN, | 763 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iLeftOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MIN, |
| 764 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MAX, "seq_scaled_ref_layer_left_offset"); | 764 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MAX, "seq_scaled_ref_layer_left_offset"); |
| 765 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_top_offset | 765 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_top_offset |
| 766 | kpPos->iTopOffset = iCode; | 766 | kpPos->iTopOffset = iCode; |
| 767 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iTopOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MIN, | 767 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iTopOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MIN, |
| 768 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MAX, "seq_scaled_ref_layer_top_offset"); | 768 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MAX, "seq_scaled_ref_layer_top_offset"); |
| 769 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_right_offset | 769 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_right_offset |
| 770 | kpPos->iRightOffset = iCode; | 770 | kpPos->iRightOffset = iCode; |
| 771 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iRightOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MIN, | 771 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iRightOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MIN, |
| 772 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MAX, "seq_scaled_ref_layer_right_offset"); | 772 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MAX, "seq_scaled_ref_layer_right_offset"); |
| 773 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_bottom_offset | 773 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //seq_scaled_ref_layer_bottom_offset |
| @@ -777,14 +777,14 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 3 unmodified lines | |||
| 777 | } | 777 | } |
| 778 | 778 | ||
| 779 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_tcoeff_level_prediction_flag | 779 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_tcoeff_level_prediction_flag |
| 780 | pExt->bSeqTCoeffLevelPredFlag = !!uiCode; | 780 | pExt->bSeqTCoeffLevelPredFlag = !!uiCode; |
| 781 | pExt->bAdaptiveTCoeffLevelPredFlag = false; | 781 | pExt->bAdaptiveTCoeffLevelPredFlag = false; |
| 782 | if (pExt->bSeqTCoeffLevelPredFlag) { | 782 | if (pExt->bSeqTCoeffLevelPredFlag) { |
| 783 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //adaptive_tcoeff_level_prediction_flag | 783 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //adaptive_tcoeff_level_prediction_flag |
| 784 | pExt->bAdaptiveTCoeffLevelPredFlag = !!uiCode; | 784 | pExt->bAdaptiveTCoeffLevelPredFlag = !!uiCode; |
| 785 | } | 785 | } |
| 786 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //slice_header_restriction_flag | 786 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //slice_header_restriction_flag |
| 787 | pExt->bSliceHeaderRestrictionFlag = !!uiCode; | 787 | pExt->bSliceHeaderRestrictionFlag = !!uiCode; |
| 788 | 788 | ||
| 789 | 789 | ||
| 790 | 790 | ||
| @@ -903,10 +903,10 @@ bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) { · 112 unmodified lines | |||
| 903 | 903 | ||
| 904 | int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight, | 904 | int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight, |
| 905 | uint8_t* pSrcNal, const int32_t kSrcNalLen) { | 905 | uint8_t* pSrcNal, const int32_t kSrcNalLen) { |
| 906 | PBitStringAux pBs = pBsAux; | 906 | PBitStringAux pBs = pBsAux; |
| 907 | SSubsetSps sTempSubsetSps; | 907 | SSubsetSps sTempSubsetSps; |
| 908 | PSps pSps = NULL; | 908 | PSps pSps = NULL; |
| 909 | PSubsetSps pSubsetSps = NULL; | 909 | PSubsetSps pSubsetSps = NULL; |
| 910 | SNalUnitHeader* pNalHead = &pCtx->sCurNalHead; | 910 | SNalUnitHeader* pNalHead = &pCtx->sCurNalHead; |
| 911 | ProfileIdc uiProfileIdc; | 911 | ProfileIdc uiProfileIdc; |
| 912 | uint8_t uiLevelIdc; | 912 | uint8_t uiLevelIdc; |
| @@ -917,28 +917,28 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | |||
| 917 | const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType); | 917 | const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType); |
| 918 | 918 | ||
| 919 | WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc | 919 | WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc |
| 920 | uiProfileIdc = uiCode; | 920 | uiProfileIdc = uiCode; |
| 921 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set0_flag | 921 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set0_flag |
| 922 | bConstraintSetFlags[0] = !!uiCode; | 922 | bConstraintSetFlags[0] = !!uiCode; |
| 923 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set1_flag | 923 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set1_flag |
| 924 | bConstraintSetFlags[1] = !!uiCode; | 924 | bConstraintSetFlags[1] = !!uiCode; |
| 925 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set2_flag | 925 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set2_flag |
| 926 | bConstraintSetFlags[2] = !!uiCode; | 926 | bConstraintSetFlags[2] = !!uiCode; |
| 927 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set3_flag | 927 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set3_flag |
| 928 | bConstraintSetFlags[3] = !!uiCode; | 928 | bConstraintSetFlags[3] = !!uiCode; |
| 929 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set4_flag | 929 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set4_flag |
| 930 | bConstraintSetFlags[4] = !!uiCode; | 930 | bConstraintSetFlags[4] = !!uiCode; |
| 931 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set5_flag | 931 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set5_flag |
| 932 | bConstraintSetFlags[5] = !!uiCode; | 932 | bConstraintSetFlags[5] = !!uiCode; |
| 933 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); // reserved_zero_2bits, equal to 0 | 933 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); // reserved_zero_2bits, equal to 0 |
| 934 | WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc | 934 | WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc |
| 935 | uiLevelIdc = uiCode; | 935 | uiLevelIdc = uiCode; |
| 936 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id | 936 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id |
| 937 | if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009 | 937 | if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009 |
| 938 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n"); | 938 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n"); |
| 939 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); | 939 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); |
| 940 | } | 940 | } |
| 941 | iSpsId = uiCode; | 941 | iSpsId = uiCode; |
| 942 | pSubsetSps = &sTempSubsetSps; | 942 | pSubsetSps = &sTempSubsetSps; |
| 943 | pSps = &sTempSubsetSps.sSps; | 943 | pSps = &sTempSubsetSps.sSps; |
| 944 | memset (pSubsetSps, 0, sizeof (SSubsetSps)); | 944 | memset (pSubsetSps, 0, sizeof (SSubsetSps)); |
| @@ -978,19 +978,19 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 33 unmodified lines | |||
| 978 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.", 8 + uiCode); | 978 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.", 8 + uiCode); |
| 979 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 979 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 980 | } | 980 | } |
| 981 | pSps->uiBitDepthLuma = 8; | 981 | pSps->uiBitDepthLuma = 8; |
| 982 | 982 | ||
| 983 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 | 983 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 |
| 984 | if (uiCode != 0) { | 984 | if (uiCode != 0) { |
| 985 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.", 8 + uiCode); | 985 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.", 8 + uiCode); |
| 986 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 986 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 987 | } | 987 | } |
| 988 | pSps->uiBitDepthChroma = 8; | 988 | pSps->uiBitDepthChroma = 8; |
| 989 | 989 | ||
| 990 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag | 990 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag |
| 991 | pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode; | 991 | pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode; |
| 992 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag | 992 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag |
| 993 | pSps->bSeqScalingMatrixPresentFlag = !!uiCode; | 993 | pSps->bSeqScalingMatrixPresentFlag = !!uiCode; |
| 994 | 994 | ||
| 995 | if (pSps->bSeqScalingMatrixPresentFlag) { | 995 | if (pSps->bSeqScalingMatrixPresentFlag) { |
| 996 | WELS_READ_VERIFY (ParseScalingList (pSps, pBs, 0, pSps->bSeqScalingListPresentFlag, pSps->iScalingList4x4, | 996 | WELS_READ_VERIFY (ParseScalingList (pSps, pBs, 0, pSps->bSeqScalingListPresentFlag, pSps->iScalingList4x4, |
| @@ -1000,33 +1000,33 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 3 unmodified lines | |||
| 1000 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_frame_num_minus4 | 1000 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_frame_num_minus4 |
| 1001 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX, "log2_max_frame_num_minus4", | 1001 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX, "log2_max_frame_num_minus4", |
| 1002 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_LOG2_MAX_FRAME_NUM_MINUS4)); | 1002 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_LOG2_MAX_FRAME_NUM_MINUS4)); |
| 1003 | pSps->uiLog2MaxFrameNum = LOG2_MAX_FRAME_NUM_OFFSET + uiCode; | 1003 | pSps->uiLog2MaxFrameNum = LOG2_MAX_FRAME_NUM_OFFSET + uiCode; |
| 1004 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_order_cnt_type | 1004 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_order_cnt_type |
| 1005 | pSps->uiPocType = uiCode; | 1005 | pSps->uiPocType = uiCode; |
| 1006 | 1006 | ||
| 1007 | if (0 == pSps->uiPocType) { | 1007 | if (0 == pSps->uiPocType) { |
| 1008 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_pic_order_cnt_lsb_minus4 | 1008 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //log2_max_pic_order_cnt_lsb_minus4 |
| 1009 | // log2_max_pic_order_cnt_lsb_minus4 should be in range 0 to 12, inclusive. (sec. 7.4.3) | 1009 | // log2_max_pic_order_cnt_lsb_minus4 should be in range 0 to 12, inclusive. (sec. 7.4.3) |
| 1010 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4_MAX, "log2_max_pic_order_cnt_lsb_minus4", | 1010 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4_MAX, "log2_max_pic_order_cnt_lsb_minus4", |
| 1011 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4)); | 1011 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4)); |
| 1012 | pSps->iLog2MaxPocLsb = LOG2_MAX_PIC_ORDER_CNT_LSB_OFFSET + uiCode; // log2_max_pic_order_cnt_lsb_minus4 | 1012 | pSps->iLog2MaxPocLsb = LOG2_MAX_PIC_ORDER_CNT_LSB_OFFSET + uiCode; // log2_max_pic_order_cnt_lsb_minus4 |
| 1013 | 1013 | ||
| 1014 | } else if (1 == pSps->uiPocType) { | 1014 | } else if (1 == pSps->uiPocType) { |
| 1015 | int32_t i; | 1015 | int32_t i; |
| 1016 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //delta_pic_order_always_zero_flag | 1016 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //delta_pic_order_always_zero_flag |
| 1017 | pSps->bDeltaPicOrderAlwaysZeroFlag = !!uiCode; | 1017 | pSps->bDeltaPicOrderAlwaysZeroFlag = !!uiCode; |
| 1018 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //offset_for_non_ref_pic | 1018 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //offset_for_non_ref_pic |
| 1019 | pSps->iOffsetForNonRefPic = iCode; | 1019 | pSps->iOffsetForNonRefPic = iCode; |
| 1020 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //offset_for_top_to_bottom_field | 1020 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //offset_for_top_to_bottom_field |
| 1021 | pSps->iOffsetForTopToBottomField = iCode; | 1021 | pSps->iOffsetForTopToBottomField = iCode; |
| 1022 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //num_ref_frames_in_pic_order_cnt_cycle | 1022 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //num_ref_frames_in_pic_order_cnt_cycle |
| 1023 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE_MAX, | 1023 | WELS_CHECK_SE_UPPER_ERROR (uiCode, SPS_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE_MAX, |
| 1024 | "num_ref_frames_in_pic_order_cnt_cycle", GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, | 1024 | "num_ref_frames_in_pic_order_cnt_cycle", GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, |
| 1025 | ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE)); | 1025 | ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE)); |
| 1026 | pSps->iNumRefFramesInPocCycle = uiCode; | 1026 | pSps->iNumRefFramesInPocCycle = uiCode; |
| 1027 | for (i = 0; i < pSps->iNumRefFramesInPocCycle; i++) { | 1027 | for (i = 0; i < pSps->iNumRefFramesInPocCycle; i++) { |
| 1028 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //offset_for_ref_frame[ i ] | 1028 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //offset_for_ref_frame[ i ] |
| 1029 | pSps->iOffsetForRefFrame[ i ] = iCode; | 1029 | pSps->iOffsetForRefFrame[ i ] = iCode; |
| 1030 | } | 1030 | } |
| 1031 | } | 1031 | } |
| 1032 | if (pSps->uiPocType > 2) { | 1032 | if (pSps->uiPocType > 2) { |
| @@ -1035,11 +1035,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 2 unmodified lines | |||
| 1035 | } | 1035 | } |
| 1036 | 1036 | ||
| 1037 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //max_num_ref_frames | 1037 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //max_num_ref_frames |
| 1038 | pSps->iNumRefFrames = uiCode; | 1038 | pSps->iNumRefFrames = uiCode; |
| 1039 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //gaps_in_frame_num_value_allowed_flag | 1039 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //gaps_in_frame_num_value_allowed_flag |
| 1040 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; | 1040 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; |
| 1041 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 | 1041 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 |
| 1042 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; | 1042 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; |
| 1043 | if (pSps->iMbWidth > MAX_MB_SIZE) { | 1043 | if (pSps->iMbWidth > MAX_MB_SIZE) { |
| 1044 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbWidth); | 1044 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbWidth); |
| 1045 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 1045 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| @@ -1048,7 +1048,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 2 unmodified lines | |||
| 1048 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!"); | 1048 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!"); |
| 1049 | } | 1049 | } |
| 1050 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 | 1050 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| 1051 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; | 1051 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; |
| 1052 | if (pSps->iMbHeight > MAX_MB_SIZE) { | 1052 | if (pSps->iMbHeight > MAX_MB_SIZE) { |
| 1053 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbHeight); | 1053 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbHeight); |
| 1054 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 1054 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| @@ -1060,7 +1060,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 5 unmodified lines | |||
| 1060 | if (uiTmp32 > (uint32_t)pSLevelLimits->uiMaxFS) { | 1060 | if (uiTmp32 > (uint32_t)pSLevelLimits->uiMaxFS) { |
| 1061 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!"); | 1061 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!"); |
| 1062 | } | 1062 | } |
| 1063 | pSps->uiTotalMbCount = uiTmp32; | 1063 | pSps->uiTotalMbCount = uiTmp32; |
| 1064 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", | 1064 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", |
| 1065 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES)); | 1065 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES)); |
| 1066 | // here we check max_num_ref_frames | 1066 | // here we check max_num_ref_frames |
| @@ -1072,29 +1072,29 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 5 unmodified lines | |||
| 1072 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!"); | 1072 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!"); |
| 1073 | } | 1073 | } |
| 1074 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_mbs_only_flag | 1074 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_mbs_only_flag |
| 1075 | pSps->bFrameMbsOnlyFlag = !!uiCode; | 1075 | pSps->bFrameMbsOnlyFlag = !!uiCode; |
| 1076 | if (!pSps->bFrameMbsOnlyFlag) { | 1076 | if (!pSps->bFrameMbsOnlyFlag) { |
| 1077 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.", | 1077 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.", |
| 1078 | pSps->bFrameMbsOnlyFlag); | 1078 | pSps->bFrameMbsOnlyFlag); |
| 1079 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); | 1079 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); |
| 1080 | } | 1080 | } |
| 1081 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //direct_8x8_inference_flag | 1081 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //direct_8x8_inference_flag |
| 1082 | pSps->bDirect8x8InferenceFlag = !!uiCode; | 1082 | pSps->bDirect8x8InferenceFlag = !!uiCode; |
| 1083 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_cropping_flag | 1083 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_cropping_flag |
| 1084 | pSps->bFrameCroppingFlag = !!uiCode; | 1084 | pSps->bFrameCroppingFlag = !!uiCode; |
| 1085 | if (pSps->bFrameCroppingFlag) { | 1085 | if (pSps->bFrameCroppingFlag) { |
| 1086 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_left_offset | 1086 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_left_offset |
| 1087 | pSps->sFrameCrop.iLeftOffset = uiCode; | 1087 | pSps->sFrameCrop.iLeftOffset = uiCode; |
| 1088 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_right_offset | 1088 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_right_offset |
| 1089 | pSps->sFrameCrop.iRightOffset = uiCode; | 1089 | pSps->sFrameCrop.iRightOffset = uiCode; |
| 1090 | if ((pSps->sFrameCrop.iLeftOffset + pSps->sFrameCrop.iRightOffset) > ((int32_t)pSps->iMbWidth * 16 / 2)) { | 1090 | if ((pSps->sFrameCrop.iLeftOffset + pSps->sFrameCrop.iRightOffset) > ((int32_t)pSps->iMbWidth * 16 / 2)) { |
| 1091 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "frame_crop_left_offset + frame_crop_right_offset exceeds limits!"); | 1091 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "frame_crop_left_offset + frame_crop_right_offset exceeds limits!"); |
| 1092 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CROPPING_DATA); | 1092 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CROPPING_DATA); |
| 1093 | } | 1093 | } |
| 1094 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_top_offset | 1094 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_top_offset |
| 1095 | pSps->sFrameCrop.iTopOffset = uiCode; | 1095 | pSps->sFrameCrop.iTopOffset = uiCode; |
| 1096 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_bottom_offset | 1096 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_bottom_offset |
| 1097 | pSps->sFrameCrop.iBottomOffset = uiCode; | 1097 | pSps->sFrameCrop.iBottomOffset = uiCode; |
| 1098 | if ((pSps->sFrameCrop.iTopOffset + pSps->sFrameCrop.iBottomOffset) > ((int32_t)pSps->iMbHeight * 16 / 2)) { | 1098 | if ((pSps->sFrameCrop.iTopOffset + pSps->sFrameCrop.iBottomOffset) > ((int32_t)pSps->iMbHeight * 16 / 2)) { |
| 1099 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "frame_crop_top_offset + frame_crop_right_offset exceeds limits!"); | 1099 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "frame_crop_top_offset + frame_crop_right_offset exceeds limits!"); |
| 1100 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CROPPING_DATA); | 1100 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CROPPING_DATA); |
| @@ -1106,7 +1106,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 5 unmodified lines | |||
| 1106 | pSps->sFrameCrop.iBottomOffset = 0; // frame_crop_bottom_offset | 1106 | pSps->sFrameCrop.iBottomOffset = 0; // frame_crop_bottom_offset |
| 1107 | } | 1107 | } |
| 1108 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag | 1108 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //vui_parameters_present_flag |
| 1109 | pSps->bVuiParamPresentFlag = !!uiCode; | 1109 | pSps->bVuiParamPresentFlag = !!uiCode; |
| 1110 | 1110 | ||
| 1111 | if (pCtx->bParseOnly) { | 1111 | if (pCtx->bParseOnly) { |
| 1112 | if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds! | 1112 | if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds! |
| @@ -1206,7 +1206,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 93 unmodified lines | |||
| 1206 | 1206 | ||
| 1207 | 1207 | ||
| 1208 | if (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc) | 1208 | if (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc) |
| 1209 | pCtx->bAvcBasedFlag = false; | 1209 | pCtx->bAvcBasedFlag = false; |
| 1210 | 1210 | ||
| 1211 | *pPicWidth = pSps->iMbWidth << 4; | 1211 | *pPicWidth = pSps->iMbWidth << 4; |
| 1212 | *pPicHeight = pSps->iMbHeight << 4; | 1212 | *pPicHeight = pSps->iMbHeight << 4; |
| @@ -1251,12 +1251,12 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 38 unmodified lines | |||
| 1251 | // Not overwrite active sps, just copy to final place | 1251 | // Not overwrite active sps, just copy to final place |
| 1252 | else if (kbUseSubsetFlag) { | 1252 | else if (kbUseSubsetFlag) { |
| 1253 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); | 1253 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); |
| 1254 | pCtx->bSubspsAvailFlags[iSpsId] = true; | 1254 | pCtx->bSubspsAvailFlags[iSpsId] = true; |
| 1255 | pCtx->bSubspsExistAheadFlag = true; | 1255 | pCtx->bSubspsExistAheadFlag = true; |
| 1256 | } else { | 1256 | } else { |
| 1257 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)); | 1257 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)); |
| 1258 | pCtx->bSpsAvailFlags[iSpsId] = true; | 1258 | pCtx->bSpsAvailFlags[iSpsId] = true; |
| 1259 | pCtx->bSpsExistAheadFlag = true; | 1259 | pCtx->bSpsExistAheadFlag = true; |
| 1260 | } | 1260 | } |
| 1261 | return 0; | 1261 | return 0; |
| 1262 | } | 1262 | } |
| @@ -1573,8 +1573,8 @@ int32_t ResetFmoList (PWelsDecoderContext pCtx) { · 310 unmodified lines | |||
| 1573 | if (NULL != pCtx) { | 1573 | if (NULL != pCtx) { |
| 1574 | // Fixed memory leak due to PPS_ID might not be continuous sometimes, 1/5/2010 | 1574 | // Fixed memory leak due to PPS_ID might not be continuous sometimes, 1/5/2010 |
| 1575 | UninitFmoList (&pCtx->sFmoList[0], MAX_PPS_COUNT, pCtx->iActiveFmoNum); | 1575 | UninitFmoList (&pCtx->sFmoList[0], MAX_PPS_COUNT, pCtx->iActiveFmoNum); |
| 1576 | iCountNum = pCtx->iActiveFmoNum; | 1576 | iCountNum = pCtx->iActiveFmoNum; |
| 1577 | pCtx->iActiveFmoNum = 0; | 1577 | pCtx->iActiveFmoNum = 0; |
| 1578 | } | 1578 | } |
| 1579 | return iCountNum; | 1579 | return iCountNum; |
| 1580 | } | 1580 | } |