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 | 111 | bool bExtensionFlag = false; |
| 112 | 112 | int32_t iErr = ERR_NONE; |
| 113 | 113 | int32_t iBitSize = 0; |
| 114 | − SLogContext* pLogCtx = &(pCtx->sLogCtx); | |
| 114 | + SLogContext* pLogCtx = & (pCtx->sLogCtx); | |
| 115 | 115 | pNalUnitHeader->eNalUnitType = NAL_UNIT_UNSPEC_0;//SHOULD init it. because pCtx->sCurNalHead is common variable. |
| 116 | 116 | |
| 117 | 117 | //remove the consecutive ZERO at the end of current NAL in the reverse order.--2011.6.1 |
| @@ -145,8 +145,8 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 27 unmodified lines | ||
| 145 | 145 | || pCtx->bSpsExistAheadFlag)) { |
| 146 | 146 | if (pCtx->bPrintFrameErrorTraceFlag) { |
| 147 | 147 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 148 | − "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | |
| 149 | − pNalUnitHeader->eNalUnitType); | |
| 148 | + "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | |
| 149 | + pNalUnitHeader->eNalUnitType); | |
| 150 | 150 | } |
| 151 | 151 | pCtx->iErrorCode = dsNoParamSets; |
| 152 | 152 | return NULL; |
| @@ -155,8 +155,8 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 2 unmodified lines | ||
| 155 | 155 | || pCtx->bPpsExistAheadFlag)) { |
| 156 | 156 | if (pCtx->bPrintFrameErrorTraceFlag) { |
| 157 | 157 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 158 | − "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | |
| 159 | − pNalUnitHeader->eNalUnitType); | |
| 158 | + "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", | |
| 159 | + pNalUnitHeader->eNalUnitType); | |
| 160 | 160 | } |
| 161 | 161 | pCtx->iErrorCode = dsNoParamSets; |
| 162 | 162 | return NULL; |
| @@ -166,8 +166,8 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 3 unmodified lines | ||
| 166 | 166 | || pCtx->bPpsExistAheadFlag))) { |
| 167 | 167 | if (pCtx->bPrintFrameErrorTraceFlag) { |
| 168 | 168 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 169 | − "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", | |
| 170 | − pNalUnitHeader->eNalUnitType); | |
| 169 | + "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", | |
| 170 | + pNalUnitHeader->eNalUnitType); | |
| 171 | 171 | } |
| 172 | 172 | pCtx->iErrorCode |= dsNoParamSets; |
| 173 | 173 | return NULL; |
| @@ -622,7 +622,8 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 448 unmodified lines | ||
| 622 | 622 | WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); //extended_spatial_scalability_idc |
| 623 | 623 | pExt->uiExtendedSpatialScalability = uiCode; |
| 624 | 624 | if (pExt->uiExtendedSpatialScalability > 2) { |
| 625 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "DecodeSpsSvcExt():extended_spatial_scalability (%d) != 0, ESS not supported!\n", | |
| 625 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | |
| 626 | + "DecodeSpsSvcExt():extended_spatial_scalability (%d) != 0, ESS not supported!\n", | |
| 626 | 627 | pExt->uiExtendedSpatialScalability); |
| 627 | 628 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_ESS); |
| 628 | 629 | } |
| @@ -810,7 +811,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 181 unmodified lines | ||
| 810 | 811 | uiLevelIdc = uiCode; |
| 811 | 812 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id |
| 812 | 813 | if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009 |
| 813 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n"); | |
| 814 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n"); | |
| 814 | 815 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW); |
| 815 | 816 | } |
| 816 | 817 | iSpsId = uiCode; |
| @@ -819,7 +820,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 2 unmodified lines | ||
| 819 | 820 | memset (pSubsetSps, 0, sizeof (SSubsetSps)); |
| 820 | 821 | const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]); |
| 821 | 822 | if (NULL == pSLevelLimits) { |
| 822 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); | |
| 823 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); | |
| 823 | 824 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 824 | 825 | } else pSps->pSLevelLimits = pSLevelLimits; |
| 825 | 826 | // syntax elements in default |
| @@ -837,20 +838,21 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 11 unmodified lines | ||
| 837 | 838 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //chroma_format_idc |
| 838 | 839 | pSps->uiChromaFormatIdc = uiCode; |
| 839 | 840 | if (pSps->uiChromaFormatIdc != 1) { |
| 840 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) = 1 supported.\n", pSps->uiChromaFormatIdc); | |
| 841 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) = 1 supported.\n", | |
| 842 | + pSps->uiChromaFormatIdc); | |
| 841 | 843 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 842 | 844 | } |
| 843 | 845 | pSps->uiChromaArrayType = pSps->uiChromaFormatIdc; |
| 844 | 846 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8 |
| 845 | 847 | if (uiCode != 0) { |
| 846 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode); | |
| 848 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode); | |
| 847 | 849 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 848 | 850 | } |
| 849 | 851 | pSps->uiBitDepthLuma = 8; |
| 850 | 852 | |
| 851 | 853 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 |
| 852 | 854 | if (uiCode != 0) { |
| 853 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode); | |
| 855 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode); | |
| 854 | 856 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 855 | 857 | } |
| 856 | 858 | pSps->uiBitDepthChroma = 8; |
| @@ -861,7 +863,8 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | ||
| 861 | 863 | pSps->bSeqScalingMatrixPresentFlag = !!uiCode; |
| 862 | 864 | |
| 863 | 865 | if (pSps->bSeqScalingMatrixPresentFlag) { // For high profile, it is not used in current application. FIXME |
| 864 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.\n", | |
| 866 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | |
| 867 | + "ParseSps(): seq_scaling_matrix_present_flag (%d). Feature not supported.\n", | |
| 865 | 868 | pSps->bSeqScalingMatrixPresentFlag); |
| 866 | 869 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 867 | 870 | } |
| @@ -899,7 +902,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 31 unmodified lines | ||
| 899 | 902 | } |
| 900 | 903 | } |
| 901 | 904 | if (pSps->uiPocType > 2) { |
| 902 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " illegal pic_order_cnt_type: %d ! \n", pSps->uiPocType); | |
| 905 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " illegal pic_order_cnt_type: %d ! \n", pSps->uiPocType); | |
| 903 | 906 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_POC_TYPE); |
| 904 | 907 | } |
| 905 | 908 | |
| @@ -910,24 +913,24 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | ||
| 910 | 913 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 |
| 911 | 914 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; |
| 912 | 915 | if (pSps->iMbWidth > MAX_MB_SIZE) { |
| 913 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); | |
| 916 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); | |
| 914 | 917 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 915 | 918 | } |
| 916 | 919 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { |
| 917 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); | |
| 920 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); | |
| 918 | 921 | } |
| 919 | 922 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| 920 | 923 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; |
| 921 | 924 | if (pSps->iMbHeight > MAX_MB_SIZE) { |
| 922 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbHeight); | |
| 925 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbHeight); | |
| 923 | 926 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 924 | 927 | } |
| 925 | 928 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->iMaxFS)) { |
| 926 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); | |
| 929 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); | |
| 927 | 930 | } |
| 928 | 931 | uint32_t uiTmp32 = pSps->iMbWidth * pSps->iMbHeight; |
| 929 | 932 | if (uiTmp32 > (uint32_t)pSLevelLimits->iMaxFS) { |
| 930 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); | |
| 933 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); | |
| 931 | 934 | } |
| 932 | 935 | pSps->uiTotalMbCount = uiTmp32; |
| 933 | 936 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", |
| @@ -938,12 +941,13 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | ||
| 938 | 941 | if (uiMaxDpbFrames > SPS_MAX_NUM_REF_FRAMES_MAX) |
| 939 | 942 | uiMaxDpbFrames = SPS_MAX_NUM_REF_FRAMES_MAX; |
| 940 | 943 | if ((uint32_t)pSps->iNumRefFrames > uiMaxDpbFrames) { |
| 941 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!\n"); | |
| 944 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!\n"); | |
| 942 | 945 | } |
| 943 | 946 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //frame_mbs_only_flag |
| 944 | 947 | pSps->bFrameMbsOnlyFlag = !!uiCode; |
| 945 | 948 | if (!pSps->bFrameMbsOnlyFlag) { |
| 946 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.\n", pSps->bFrameMbsOnlyFlag); | |
| 949 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.\n", | |
| 950 | + pSps->bFrameMbsOnlyFlag); | |
| 947 | 951 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); |
| 948 | 952 | } |
| 949 | 953 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //direct_8x8_inference_flag |
| @@ -956,14 +960,14 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 6 unmodified lines | ||
| 956 | 960 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_right_offset |
| 957 | 961 | pSps->sFrameCrop.iRightOffset = uiCode; |
| 958 | 962 | if ((pSps->sFrameCrop.iLeftOffset + pSps->sFrameCrop.iRightOffset) > ((int32_t)pSps->iMbWidth * 16 / 2)) { |
| 959 | − WelsLog (&(pCtx->sLogCtx), 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"); | |
| 960 | 964 | } |
| 961 | 965 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_top_offset |
| 962 | 966 | pSps->sFrameCrop.iTopOffset = uiCode; |
| 963 | 967 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //frame_crop_bottom_offset |
| 964 | 968 | pSps->sFrameCrop.iBottomOffset = uiCode; |
| 965 | 969 | if ((pSps->sFrameCrop.iTopOffset + pSps->sFrameCrop.iBottomOffset) > ((int32_t)pSps->iMbHeight * 16 / 2)) { |
| 966 | − WelsLog (&(pCtx->sLogCtx), 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"); | |
| 967 | 971 | } |
| 968 | 972 | } else { |
| 969 | 973 | pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset |
| @@ -1100,7 +1104,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 130 unmodified lines | ||
| 1100 | 1104 | WELS_READ_VERIFY (BsGetUe (pBsAux, &uiCode)); //slice_group_map_type |
| 1101 | 1105 | pPps->uiSliceGroupMapType = uiCode; |
| 1102 | 1106 | if (pPps->uiSliceGroupMapType > 1) { |
| 1103 | − WelsLog (&(pCtx->sLogCtx), 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", | |
| 1104 | 1108 | pPps->uiSliceGroupMapType); |
| 1105 | 1109 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_FMOTYPE); |
| 1106 | 1110 | } |
| @@ -1132,7 +1136,8 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 25 unmodified lines | ||
| 1132 | 1136 | WELS_READ_VERIFY (BsGetBits (pBsAux, 2, &uiCode)); //weighted_bipred_idc |
| 1133 | 1137 | pPps->uiWeightedBipredIdc = uiCode; |
| 1134 | 1138 | if (pPps->bWeightedPredFlag || pPps->uiWeightedBipredIdc != 0) { |
| 1135 | − WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "ParsePps(): weighted_pred_flag (%d) weighted_bipred_idc (%d) neither supported.\n", | |
| 1139 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | |
| 1140 | + "ParsePps(): weighted_pred_flag (%d) weighted_bipred_idc (%d) neither supported.\n", | |
| 1136 | 1141 | pPps->bWeightedPredFlag, pPps->uiWeightedBipredIdc); |
| 1137 | 1142 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_WP); |
| 1138 | 1143 | } |