Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 14 files). Show all
Unified · Split
| @@ -111,7 +111,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 110 unmodified lines | |||
| 111 | bool bExtensionFlag = false; | 111 | bool bExtensionFlag = false; |
| 112 | int32_t iErr = ERR_NONE; | 112 | int32_t iErr = ERR_NONE; |
| 113 | int32_t iBitSize = 0; | 113 | int32_t iBitSize = 0; |
| 114 | 114 | SLogContext* pLogCtx = &(pCtx->sLogCtx); | |
| 115 | pNalUnitHeader->eNalUnitType = NAL_UNIT_UNSPEC_0;//SHOULD init it. because pCtx->sCurNalHead is common variable. | 115 | pNalUnitHeader->eNalUnitType = NAL_UNIT_UNSPEC_0;//SHOULD init it. because pCtx->sCurNalHead is common variable. |
| 116 | 116 | ||
| 117 | //remove the consecutive ZERO at the end of current NAL in the reverse order.--2011.6.1 | 117 | //remove the consecutive ZERO at the end of current NAL in the reverse order.--2011.6.1 |
| @@ -142,12 +142,12 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 24 unmodified lines | |||
| 142 | ++ (*pConsumedBytes); | 142 | ++ (*pConsumedBytes); |
| 143 | 143 | ||
| 144 | #ifdef DEBUG_PARSE_INFO | 144 | #ifdef DEBUG_PARSE_INFO |
| 145 | WelsLog (pCtx, WELS_LOG_INFO, "nal type: %d \n", pNalUnitHeader->eNalUnitType); | 145 | WelsLog (pLogCtx, WELS_LOG_INFO, "nal type: %d \n", pNalUnitHeader->eNalUnitType); |
| 146 | #endif | 146 | #endif |
| 147 | 147 | ||
| 148 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) | 148 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) |
| 149 | || pCtx->bSpsExistAheadFlag)) { | 149 | || pCtx->bSpsExistAheadFlag)) { |
| 150 | WelsLog (pCtx, WELS_LOG_WARNING, | 150 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 151 | "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | 151 | "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", |
| 152 | pNalUnitHeader->eNalUnitType); | 152 | pNalUnitHeader->eNalUnitType); |
| 153 | pCtx->iErrorCode = dsNoParamSets; | 153 | pCtx->iErrorCode = dsNoParamSets; |
| @@ -155,7 +155,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 1 unmodified line | |||
| 155 | } | 155 | } |
| 156 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) | 156 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) |
| 157 | || pCtx->bPpsExistAheadFlag)) { | 157 | || pCtx->bPpsExistAheadFlag)) { |
| 158 | WelsLog (pCtx, WELS_LOG_WARNING, | 158 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 159 | "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | 159 | "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", |
| 160 | pNalUnitHeader->eNalUnitType); | 160 | pNalUnitHeader->eNalUnitType); |
| 161 | pCtx->iErrorCode = dsNoParamSets; | 161 | pCtx->iErrorCode = dsNoParamSets; |
| @@ -164,7 +164,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 2 unmodified lines | |||
| 164 | if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) || | 164 | if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) || |
| 165 | (IS_NEW_INTRODUCED_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag | 165 | (IS_NEW_INTRODUCED_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag |
| 166 | || pCtx->bPpsExistAheadFlag))) { | 166 | || pCtx->bPpsExistAheadFlag))) { |
| 167 | WelsLog (pCtx, WELS_LOG_WARNING, | 167 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 168 | "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", | 168 | "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", |
| 169 | pNalUnitHeader->eNalUnitType); | 169 | pNalUnitHeader->eNalUnitType); |
| 170 | pCtx->iErrorCode |= dsNoParamSets; | 170 | pCtx->iErrorCode |= dsNoParamSets; |
| @@ -201,7 +201,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 30 unmodified lines | |||
| 201 | 201 | ||
| 202 | DecodeNalHeaderExt (pCurNal, pNal); | 202 | DecodeNalHeaderExt (pCurNal, pNal); |
| 203 | if ((pCurNal->sNalHeaderExt.uiQualityId != 0) || (pCurNal->sNalHeaderExt.bUseRefBasePicFlag != 0)) { | 203 | if ((pCurNal->sNalHeaderExt.uiQualityId != 0) || (pCurNal->sNalHeaderExt.bUseRefBasePicFlag != 0)) { |
| 204 | WelsLog (pCtx, WELS_LOG_WARNING, | 204 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 205 | "ParseNalHeader() in Prefix Nal Unit:uiQualityId (%d) != 0, bUseRefBasePicFlag (%d) != 0, not supported!\n", | 205 | "ParseNalHeader() in Prefix Nal Unit:uiQualityId (%d) != 0, bUseRefBasePicFlag (%d) != 0, not supported!\n", |
| 206 | pCurNal->sNalHeaderExt.uiQualityId, pCurNal->sNalHeaderExt.bUseRefBasePicFlag); | 206 | pCurNal->sNalHeaderExt.uiQualityId, pCurNal->sNalHeaderExt.bUseRefBasePicFlag); |
| 207 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 207 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| @@ -244,7 +244,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 36 unmodified lines | |||
| 244 | uint32_t uiAvailNalNum; | 244 | uint32_t uiAvailNalNum; |
| 245 | pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); | 245 | pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); |
| 246 | if (NULL == pCurNal) { | 246 | if (NULL == pCurNal) { |
| 247 | WelsLog (pCtx, WELS_LOG_WARNING, "MemGetNextNal() fail due out of memory.\n"); | 247 | WelsLog (pLogCtx, WELS_LOG_WARNING, "MemGetNextNal() fail due out of memory.\n"); |
| 248 | pCtx->iErrorCode |= dsOutOfMemory; | 248 | pCtx->iErrorCode |= dsOutOfMemory; |
| 249 | return NULL; | 249 | return NULL; |
| 250 | } | 250 | } |
| @@ -273,10 +273,10 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 22 unmodified lines | |||
| 273 | if (pCurNal->sNalHeaderExt.uiQualityId != 0 || | 273 | if (pCurNal->sNalHeaderExt.uiQualityId != 0 || |
| 274 | pCurNal->sNalHeaderExt.bUseRefBasePicFlag) { | 274 | pCurNal->sNalHeaderExt.bUseRefBasePicFlag) { |
| 275 | if (pCurNal->sNalHeaderExt.uiQualityId != 0) | 275 | if (pCurNal->sNalHeaderExt.uiQualityId != 0) |
| 276 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseNalHeader():uiQualityId (%d) != 0, MGS not supported!\n", | 276 | WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseNalHeader():uiQualityId (%d) != 0, MGS not supported!\n", |
| 277 | pCurNal->sNalHeaderExt.uiQualityId); | 277 | pCurNal->sNalHeaderExt.uiQualityId); |
| 278 | if (pCurNal->sNalHeaderExt.bUseRefBasePicFlag != 0) | 278 | if (pCurNal->sNalHeaderExt.bUseRefBasePicFlag != 0) |
| 279 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseNalHeader():bUseRefBasePicFlag (%d) != 0, MGS not supported!\n", | 279 | WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseNalHeader():bUseRefBasePicFlag (%d) != 0, MGS not supported!\n", |
| 280 | pCurNal->sNalHeaderExt.bUseRefBasePicFlag); | 280 | pCurNal->sNalHeaderExt.bUseRefBasePicFlag); |
| 281 | 281 | ||
| 282 | pCtx->iErrorCode |= dsInvalidArgument; | 282 | pCtx->iErrorCode |= dsInvalidArgument; |
| @@ -503,7 +503,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 220 unmodified lines | |||
| 503 | if (iBitSize > 0) | 503 | if (iBitSize > 0) |
| 504 | InitBits (pBs, pRbsp, iBitSize); | 504 | InitBits (pBs, pRbsp, iBitSize); |
| 505 | #ifdef DEBUG_PARSE_INFO | 505 | #ifdef DEBUG_PARSE_INFO |
| 506 | WelsLog (pCtx, WELS_LOG_INFO, "parsing nal: %d \n", eNalType); | 506 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType); |
| 507 | #endif | 507 | #endif |
| 508 | iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); | 508 | iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); |
| 509 | if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 | 509 | if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 |
| @@ -518,7 +518,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 8 unmodified lines | |||
| 518 | if (iBitSize > 0) | 518 | if (iBitSize > 0) |
| 519 | InitBits (pBs, pRbsp, iBitSize); | 519 | InitBits (pBs, pRbsp, iBitSize); |
| 520 | #ifdef DEBUG_PARSE_INFO | 520 | #ifdef DEBUG_PARSE_INFO |
| 521 | WelsLog (pCtx, WELS_LOG_INFO, "parsing nal: %d \n", eNalType); | 521 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType); |
| 522 | #endif | 522 | #endif |
| 523 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); | 523 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); |
| 524 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 | 524 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 |
| @@ -626,7 +626,7 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 101 unmodified lines | |||
| 626 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //extended_spatial_scalability_idc | 626 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //extended_spatial_scalability_idc |
| 627 | pExt->uiExtendedSpatialScalability = uiCode; | 627 | pExt->uiExtendedSpatialScalability = uiCode; |
| 628 | if (pExt->uiExtendedSpatialScalability > 2) { | 628 | if (pExt->uiExtendedSpatialScalability > 2) { |
| 629 | WelsLog (pCtx, WELS_LOG_WARNING, "DecodeSpsSvcExt():extended_spatial_scalability (%d) != 0, ESS not supported!\n", | 629 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeSpsSvcExt():extended_spatial_scalability (%d) != 0, ESS not supported!\n", |
| 630 | pExt->uiExtendedSpatialScalability); | 630 | pExt->uiExtendedSpatialScalability); |
| 631 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_ESS); | 631 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_ESS); |
| 632 | } | 632 | } |
| @@ -814,7 +814,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 181 unmodified lines | |||
| 814 | uiLevelIdc = uiCode; | 814 | uiLevelIdc = uiCode; |
| 815 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id | 815 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id |
| 816 | if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009 | 816 | if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009 |
| 817 | WelsLog (pCtx, WELS_LOG_WARNING, " iSpsId is out of range! \n"); | 817 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n"); |
| 818 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); | 818 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); |
| 819 | } | 819 | } |
| 820 | iSpsId = uiCode; | 820 | iSpsId = uiCode; |
| @@ -823,7 +823,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 2 unmodified lines | |||
| 823 | memset (pSubsetSps, 0, sizeof (SSubsetSps)); | 823 | memset (pSubsetSps, 0, sizeof (SSubsetSps)); |
| 824 | const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]); | 824 | const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]); |
| 825 | if (NULL == pSLevelLimits) { | 825 | if (NULL == pSLevelLimits) { |
| 826 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); | 826 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); |
| 827 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 827 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 828 | } else pSps->pSLevelLimits = pSLevelLimits; | 828 | } else pSps->pSLevelLimits = pSLevelLimits; |
| 829 | // syntax elements in default | 829 | // syntax elements in default |
| @@ -841,20 +841,20 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 11 unmodified lines | |||
| 841 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //chroma_format_idc | 841 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //chroma_format_idc |
| 842 | pSps->uiChromaFormatIdc = uiCode; | 842 | pSps->uiChromaFormatIdc = uiCode; |
| 843 | if (pSps->uiChromaFormatIdc != 1) { | 843 | if (pSps->uiChromaFormatIdc != 1) { |
| 844 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) = 1 supported.\n", pSps->uiChromaFormatIdc); | 844 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) = 1 supported.\n", pSps->uiChromaFormatIdc); |
| 845 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 845 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 846 | } | 846 | } |
| 847 | pSps->uiChromaArrayType = pSps->uiChromaFormatIdc; | 847 | pSps->uiChromaArrayType = pSps->uiChromaFormatIdc; |
| 848 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8 | 848 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8 |
| 849 | if (uiCode != 0) { | 849 | if (uiCode != 0) { |
| 850 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode); | 850 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode); |
| 851 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 851 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 852 | } | 852 | } |
| 853 | pSps->uiBitDepthLuma = 8; | 853 | pSps->uiBitDepthLuma = 8; |
| 854 | 854 | ||
| 855 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 | 855 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 |
| 856 | if (uiCode != 0) { | 856 | if (uiCode != 0) { |
| 857 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode); | 857 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode); |
| 858 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 858 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 859 | } | 859 | } |
| 860 | pSps->uiBitDepthChroma = 8; | 860 | pSps->uiBitDepthChroma = 8; |
| @@ -865,7 +865,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | |||
| 865 | pSps->bSeqScalingMatrixPresentFlag = !!uiCode; | 865 | pSps->bSeqScalingMatrixPresentFlag = !!uiCode; |
| 866 | 866 | ||
| 867 | if (pSps->bSeqScalingMatrixPresentFlag) { // For high profile, it is not used in current application. FIXME | 867 | if (pSps->bSeqScalingMatrixPresentFlag) { // For high profile, it is not used in current application. FIXME |
| 868 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.\n", | 868 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.\n", |
| 869 | pSps->bSeqScalingMatrixPresentFlag); | 869 | pSps->bSeqScalingMatrixPresentFlag); |
| 870 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 870 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 871 | } | 871 | } |
| @@ -903,7 +903,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 31 unmodified lines | |||
| 903 | } | 903 | } |
| 904 | } | 904 | } |
| 905 | if (pSps->uiPocType > 2) { | 905 | if (pSps->uiPocType > 2) { |
| 906 | WelsLog (pCtx, WELS_LOG_WARNING, " illegal pic_order_cnt_type: %d ! \n", pSps->uiPocType); | 906 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " illegal pic_order_cnt_type: %d ! \n", pSps->uiPocType); |
| 907 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_POC_TYPE); | 907 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_POC_TYPE); |
| 908 | } | 908 | } |
| 909 | 909 | ||
| @@ -914,24 +914,24 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | |||
| 914 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 | 914 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 |
| 915 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; | 915 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; |
| 916 | if (pSps->iMbWidth > MAX_MB_SIZE) { | 916 | if (pSps->iMbWidth > MAX_MB_SIZE) { |
| 917 | WelsLog (pCtx, WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); | 917 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); |
| 918 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 918 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 919 | } | 919 | } |
| 920 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { | 920 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { |
| 921 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); | 921 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); |
| 922 | } | 922 | } |
| 923 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 | 923 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| 924 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; | 924 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; |
| 925 | if (pSps->iMbHeight > MAX_MB_SIZE) { | 925 | if (pSps->iMbHeight > MAX_MB_SIZE) { |
| 926 | WelsLog (pCtx, WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbHeight); | 926 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbHeight); |
| 927 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 927 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 928 | } | 928 | } |
| 929 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { | 929 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { |
| 930 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); | 930 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); |
| 931 | } | 931 | } |
| 932 | uint32_t uiTmp32 = pSps->iMbWidth * pSps->iMbHeight; | 932 | uint32_t uiTmp32 = pSps->iMbWidth * pSps->iMbHeight; |
| 933 | if (uiTmp32 > (uint32_t)pSLevelLimits->iMaxFS) { | 933 | if (uiTmp32 > (uint32_t)pSLevelLimits->iMaxFS) { |
| 934 | WelsLog (pCtx, WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); | 934 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); |
| 935 | } | 935 | } |
| 936 | pSps->uiTotalMbCount = uiTmp32; | 936 | pSps->uiTotalMbCount = uiTmp32; |
| 937 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", | 937 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", |
| @@ -942,12 +942,12 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | |||
| 942 | if (uiMaxDpbFrames > SPS_MAX_NUM_REF_FRAMES_MAX) | 942 | if (uiMaxDpbFrames > SPS_MAX_NUM_REF_FRAMES_MAX) |
| 943 | uiMaxDpbFrames = SPS_MAX_NUM_REF_FRAMES_MAX; | 943 | uiMaxDpbFrames = SPS_MAX_NUM_REF_FRAMES_MAX; |
| 944 | if ((uint32_t)pSps->iNumRefFrames > uiMaxDpbFrames) { | 944 | if ((uint32_t)pSps->iNumRefFrames > uiMaxDpbFrames) { |
| 945 | WelsLog (pCtx, WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!\n"); | 945 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!\n"); |
| 946 | } | 946 | } |
| 947 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_mbs_only_flag | 947 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_mbs_only_flag |
| 948 | pSps->bFrameMbsOnlyFlag = !!uiCode; | 948 | pSps->bFrameMbsOnlyFlag = !!uiCode; |
| 949 | if (!pSps->bFrameMbsOnlyFlag) { | 949 | if (!pSps->bFrameMbsOnlyFlag) { |
| 950 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.\n", pSps->bFrameMbsOnlyFlag); | 950 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.\n", pSps->bFrameMbsOnlyFlag); |
| 951 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); | 951 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); |
| 952 | } | 952 | } |
| 953 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //direct_8x8_inference_flag | 953 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //direct_8x8_inference_flag |
| @@ -960,14 +960,14 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 6 unmodified lines | |||
| 960 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_right_offset | 960 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_right_offset |
| 961 | pSps->sFrameCrop.iRightOffset = uiCode; | 961 | pSps->sFrameCrop.iRightOffset = uiCode; |
| 962 | if ((pSps->sFrameCrop.iLeftOffset + pSps->sFrameCrop.iRightOffset) > ((int32_t)pSps->iMbWidth * 16 / 2)) { | 962 | if ((pSps->sFrameCrop.iLeftOffset + pSps->sFrameCrop.iRightOffset) > ((int32_t)pSps->iMbWidth * 16 / 2)) { |
| 963 | WelsLog (pCtx, WELS_LOG_WARNING, "frame_crop_left_offset + frame_crop_right_offset exceeds limits!\n"); | 963 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "frame_crop_left_offset + frame_crop_right_offset exceeds limits!\n"); |
| 964 | } | 964 | } |
| 965 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_top_offset | 965 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_top_offset |
| 966 | pSps->sFrameCrop.iTopOffset = uiCode; | 966 | pSps->sFrameCrop.iTopOffset = uiCode; |
| 967 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_bottom_offset | 967 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_bottom_offset |
| 968 | pSps->sFrameCrop.iBottomOffset = uiCode; | 968 | pSps->sFrameCrop.iBottomOffset = uiCode; |
| 969 | if ((pSps->sFrameCrop.iTopOffset + pSps->sFrameCrop.iBottomOffset) > ((int32_t)pSps->iMbHeight * 16 / 2)) { | 969 | if ((pSps->sFrameCrop.iTopOffset + pSps->sFrameCrop.iBottomOffset) > ((int32_t)pSps->iMbHeight * 16 / 2)) { |
| 970 | WelsLog (pCtx, WELS_LOG_WARNING, "frame_crop_top_offset + frame_crop_right_offset exceeds limits!\n"); | 970 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "frame_crop_top_offset + frame_crop_right_offset exceeds limits!\n"); |
| 971 | } | 971 | } |
| 972 | } else { | 972 | } else { |
| 973 | pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset | 973 | pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset |
| @@ -1104,7 +1104,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 130 unmodified lines | |||
| 1104 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //slice_group_map_type | 1104 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //slice_group_map_type |
| 1105 | pPps->uiSliceGroupMapType = uiCode; | 1105 | pPps->uiSliceGroupMapType = uiCode; |
| 1106 | if (pPps->uiSliceGroupMapType > 1) { | 1106 | if (pPps->uiSliceGroupMapType > 1) { |
| 1107 | WelsLog (pCtx, WELS_LOG_WARNING, "ParsePps(): slice_group_map_type (%d): support only 0,1.\n", | 1107 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParsePps(): slice_group_map_type (%d): support only 0,1.\n", |
| 1108 | pPps->uiSliceGroupMapType); | 1108 | pPps->uiSliceGroupMapType); |
| 1109 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_FMOTYPE); | 1109 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_FMOTYPE); |
| 1110 | } | 1110 | } |
| @@ -1136,7 +1136,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 25 unmodified lines | |||
| 1136 | WELS_READ_VERIFY (BsGetBits (pBsAux, 2, &uiCode)); //weighted_bipred_idc | 1136 | WELS_READ_VERIFY (BsGetBits (pBsAux, 2, &uiCode)); //weighted_bipred_idc |
| 1137 | pPps->uiWeightedBipredIdc = uiCode; | 1137 | pPps->uiWeightedBipredIdc = uiCode; |
| 1138 | if (pPps->bWeightedPredFlag || pPps->uiWeightedBipredIdc != 0) { | 1138 | if (pPps->bWeightedPredFlag || pPps->uiWeightedBipredIdc != 0) { |
| 1139 | WelsLog (pCtx, WELS_LOG_WARNING, "ParsePps(): weighted_pred_flag (%d) weighted_bipred_idc (%d) neither supported.\n", | 1139 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParsePps(): weighted_pred_flag (%d) weighted_bipred_idc (%d) neither supported.\n", |
| 1140 | pPps->bWeightedPredFlag, pPps->uiWeightedBipredIdc); | 1140 | pPps->bWeightedPredFlag, pPps->uiWeightedBipredIdc); |
| 1141 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_WP); | 1141 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_WP); |
| 1142 | } | 1142 | } |