Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 5 files). Show all
Unified · Split
| @@ -600,6 +600,17 @@ void ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { · 599 unmodified lines | |||
| 600 | } | 600 | } |
| 601 | } | 601 | } |
| 602 | 602 | ||
| 603 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MIN -32768 | ||
| 604 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MAX 32767 | ||
| 605 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MIN -32768 | ||
| 606 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MAX 32767 | ||
| 607 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MIN -32768 | ||
| 608 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MAX 32767 | ||
| 609 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_BOTTOM_OFFSET_MIN -32768 | ||
| 610 | #define SUBSET_SPS_SEQ_SCALED_REF_LAYER_BOTTOM_OFFSET_MAX 32767 | ||
| 611 | |||
| 612 | |||
| 613 | |||
| 603 | 614 | ||
| 604 | int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) { | 615 | int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) { |
| 605 | PSpsSvcExt pExt = NULL; | 616 | PSpsSvcExt pExt = NULL; |
| @@ -633,9 +644,17 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin · 27 unmodified lines | |||
| 633 | pExt->uiSeqRefLayerChromaPhaseYPlus1 = BsGetBits (pBs, 2); | 644 | pExt->uiSeqRefLayerChromaPhaseYPlus1 = BsGetBits (pBs, 2); |
| 634 | 645 | ||
| 635 | kpPos->iLeftOffset = BsGetSe (pBs); | 646 | kpPos->iLeftOffset = BsGetSe (pBs); |
| 647 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iLeftOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MIN, | ||
| 648 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_LEFT_OFFSET_MAX, "seq_scaled_ref_layer_left_offset"); | ||
| 636 | kpPos->iTopOffset = BsGetSe (pBs); | 649 | kpPos->iTopOffset = BsGetSe (pBs); |
| 650 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iTopOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MIN, | ||
| 651 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_TOP_OFFSET_MAX, "seq_scaled_ref_layer_top_offset"); | ||
| 637 | kpPos->iRightOffset = BsGetSe (pBs); | 652 | kpPos->iRightOffset = BsGetSe (pBs); |
| 653 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iRightOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MIN, | ||
| 654 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_RIGHT_OFFSET_MAX, "seq_scaled_ref_layer_right_offset"); | ||
| 638 | kpPos->iBottomOffset = BsGetSe (pBs); | 655 | kpPos->iBottomOffset = BsGetSe (pBs); |
| 656 | WELS_CHECK_SE_BOTH_WARNING (kpPos->iBottomOffset, SUBSET_SPS_SEQ_SCALED_REF_LAYER_BOTTOM_OFFSET_MIN, | ||
| 657 | SUBSET_SPS_SEQ_SCALED_REF_LAYER_BOTTOM_OFFSET_MAX, "seq_scaled_ref_layer_bottom_offset"); | ||
| 639 | } | 658 | } |
| 640 | 659 | ||
| 641 | pExt->bSeqTCoeffLevelPredFlag = !!BsGetOneBit (pBs); | 660 | pExt->bSeqTCoeffLevelPredFlag = !!BsGetOneBit (pBs); |
| @@ -675,7 +694,7 @@ const SLevelLimits *GetLevelLimits(int32_t iLevelIdx, bool bConstraint3) { · 33 unmodified lines | |||
| 675 | case 10: | 694 | case 10: |
| 676 | return &g_kSLevelLimits[0]; | 695 | return &g_kSLevelLimits[0]; |
| 677 | case 11: | 696 | case 11: |
| 678 | if(bConstraint3) | 697 | if (bConstraint3) |
| 679 | return &g_kSLevelLimits[1]; | 698 | return &g_kSLevelLimits[1]; |
| 680 | else | 699 | else |
| 681 | return &g_kSLevelLimits[2]; | 700 | return &g_kSLevelLimits[2]; |
| @@ -712,6 +731,16 @@ const SLevelLimits *GetLevelLimits(int32_t iLevelIdx, bool bConstraint3) { · 30 unmodified lines | |||
| 712 | } | 731 | } |
| 713 | return NULL; | 732 | return NULL; |
| 714 | } | 733 | } |
| 734 | |||
| 735 | #define SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX 12 | ||
| 736 | #define SPS_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4_MAX 12 | ||
| 737 | #define SPS_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE_MAX 255 | ||
| 738 | #define SPS_MAX_NUM_REF_FRAMES_MAX 16 | ||
| 739 | #define PPS_PIC_INIT_QP_QS_MIN 0 | ||
| 740 | #define PPS_PIC_INIT_QP_QS_MAX 51 | ||
| 741 | #define PPS_CHROMA_QP_INDEX_OFFSET_MIN -12 | ||
| 742 | #define PPS_CHROMA_QP_INDEX_OFFSET_MAX 12 | ||
| 743 | |||
| 715 | /*! | 744 | /*! |
| 716 | ************************************************************************************* | 745 | ************************************************************************************* |
| 717 | * \brief to parse Sequence Parameter Set (SPS) | 746 | * \brief to parse Sequence Parameter Set (SPS) |
| @@ -728,7 +757,6 @@ const SLevelLimits *GetLevelLimits(int32_t iLevelIdx, bool bConstraint3) { · 10 unmodified lines | |||
| 728 | ************************************************************************************* | 757 | ************************************************************************************* |
| 729 | */ | 758 | */ |
| 730 | 759 | ||
| 731 | |||
| 732 | int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight) { | 760 | int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight) { |
| 733 | PBitStringAux pBs = pBsAux; | 761 | PBitStringAux pBs = pBsAux; |
| 734 | PSps pSps = NULL; | 762 | PSps pSps = NULL; |
| @@ -737,10 +765,10 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 2 unmodified lines | |||
| 737 | ProfileIdc uiProfileIdc; | 765 | ProfileIdc uiProfileIdc; |
| 738 | uint8_t uiLevelIdc; | 766 | uint8_t uiLevelIdc; |
| 739 | int32_t iSpsId; | 767 | int32_t iSpsId; |
| 768 | uint32_t uiTmp; | ||
| 740 | bool bConstraintSetFlags[6] = { false }; | 769 | bool bConstraintSetFlags[6] = { false }; |
| 741 | const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType); | 770 | const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType); |
| 742 | 771 | ||
| 743 | |||
| 744 | if (kbUseSubsetFlag) { // SubsetSps | 772 | if (kbUseSubsetFlag) { // SubsetSps |
| 745 | pCtx->bSubspsExistAheadFlag = true; | 773 | pCtx->bSubspsExistAheadFlag = true; |
| 746 | } else { // Sps | 774 | } else { // Sps |
| @@ -799,12 +827,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 52 unmodified lines | |||
| 799 | pCtx->bSpsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009 | 827 | pCtx->bSpsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009 |
| 800 | #endif //MOSAIC_AVOID_BASED_ON_SPS_PPS_ID | 828 | #endif //MOSAIC_AVOID_BASED_ON_SPS_PPS_ID |
| 801 | } | 829 | } |
| 802 | const SLevelLimits *pSLevelLimits = GetLevelLimits(uiLevelIdc, bConstraintSetFlags[3]); | 830 | const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]); |
| 803 | if (NULL == pSLevelLimits) { | 831 | if (NULL == pSLevelLimits) { |
| 804 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); | 832 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc); |
| 805 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 833 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 806 | } | 834 | } else pSps->pSLevelLimits = pSLevelLimits; |
| 807 | else pSps->pSLevelLimits = pSLevelLimits; | ||
| 808 | // syntax elements in default | 835 | // syntax elements in default |
| 809 | pSps->uiChromaFormatIdc = 1; | 836 | pSps->uiChromaFormatIdc = 1; |
| 810 | pSps->uiBitDepthLuma = | 837 | pSps->uiBitDepthLuma = |
| @@ -845,19 +872,29 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 34 unmodified lines | |||
| 845 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 872 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 846 | } | 873 | } |
| 847 | } | 874 | } |
| 848 | 875 | uiTmp = BsGetUe (pBs); | |
| 849 | pSps->uiLog2MaxFrameNum = 4 + BsGetUe (pBs); // log2_max_frame_num_minus4 | 876 | WELS_CHECK_SE_UPPER_ERROR (uiTmp, SPS_LOG2_MAX_FRAME_NUM_MINUS4_MAX, "log2_max_frame_num_minus4", |
| 877 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_LOG2_MAX_FRAME_NUM_MINUS4)); | ||
| 878 | pSps->uiLog2MaxFrameNum = LOG2_MAX_FRAME_NUM_OFFSET + uiTmp; // log2_max_frame_num_minus4 | ||
| 850 | pSps->uiPocType = BsGetUe (pBs); // pic_order_cnt_type | 879 | pSps->uiPocType = BsGetUe (pBs); // pic_order_cnt_type |
| 851 | 880 | ||
| 852 | if (0 == pSps->uiPocType) { | 881 | if (0 == pSps->uiPocType) { |
| 853 | pSps->iLog2MaxPocLsb = 4 + BsGetUe (pBs); // log2_max_pic_order_cnt_lsb_minus4 | 882 | uiTmp = BsGetUe (pBs); |
| 883 | // log2_max_pic_order_cnt_lsb_minus4 should be in range 0 to 12, inclusive. (sec. 7.4.3) | ||
| 884 | WELS_CHECK_SE_UPPER_ERROR (uiTmp, SPS_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4_MAX, "log2_max_pic_order_cnt_lsb_minus4", | ||
| 885 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4)); | ||
| 886 | pSps->iLog2MaxPocLsb = LOG2_MAX_PIC_ORDER_CNT_LSB_OFFSET + uiTmp; // log2_max_pic_order_cnt_lsb_minus4 | ||
| 854 | 887 | ||
| 855 | } else if (1 == pSps->uiPocType) { | 888 | } else if (1 == pSps->uiPocType) { |
| 856 | int32_t i; | 889 | int32_t i; |
| 857 | pSps->bDeltaPicOrderAlwaysZeroFlag = !!BsGetOneBit (pBs); // bDeltaPicOrderAlwaysZeroFlag | 890 | pSps->bDeltaPicOrderAlwaysZeroFlag = !!BsGetOneBit (pBs); // bDeltaPicOrderAlwaysZeroFlag |
| 858 | pSps->iOffsetForNonRefPic = BsGetSe (pBs); // iOffsetForNonRefPic | 891 | pSps->iOffsetForNonRefPic = BsGetSe (pBs); // iOffsetForNonRefPic |
| 859 | pSps->iOffsetForTopToBottomField = BsGetSe (pBs); // iOffsetForTopToBottomField | 892 | pSps->iOffsetForTopToBottomField = BsGetSe (pBs); // iOffsetForTopToBottomField |
| 860 | pSps->iNumRefFramesInPocCycle = BsGetUe (pBs); // num_ref_frames_in_pic_order_cnt_cycle | 893 | uiTmp = BsGetUe (pBs); |
| 894 | WELS_CHECK_SE_UPPER_ERROR (uiTmp, SPS_NUM_REF_FRAMES_IN_PIC_ORDER_CNT_CYCLE_MAX, | ||
| 895 | "num_ref_frames_in_pic_order_cnt_cycle", GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, | ||
| 896 | ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE)); | ||
| 897 | pSps->iNumRefFramesInPocCycle = uiTmp; // num_ref_frames_in_pic_order_cnt_cycle | ||
| 861 | for (i = 0; i < pSps->iNumRefFramesInPocCycle; i++) | 898 | for (i = 0; i < pSps->iNumRefFramesInPocCycle; i++) |
| 862 | pSps->iOffsetForRefFrame[ i ] = BsGetSe (pBs); // iOffsetForRefFrame[ i ] | 899 | pSps->iOffsetForRefFrame[ i ] = BsGetSe (pBs); // iOffsetForRefFrame[ i ] |
| 863 | } | 900 | } |
| @@ -868,11 +905,39 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 4 unmodified lines | |||
| 868 | 905 | ||
| 869 | pSps->iNumRefFrames = BsGetUe (pBs); // max_num_ref_frames | 906 | pSps->iNumRefFrames = BsGetUe (pBs); // max_num_ref_frames |
| 870 | pSps->bGapsInFrameNumValueAllowedFlag = !!BsGetOneBit (pBs); // bGapsInFrameNumValueAllowedFlag | 907 | pSps->bGapsInFrameNumValueAllowedFlag = !!BsGetOneBit (pBs); // bGapsInFrameNumValueAllowedFlag |
| 871 | pSps->iMbWidth = 1 + BsGetUe (pBs); // pic_width_in_mbs_minus1 | 908 | uiTmp = BsGetUe (pBs); // pic_width_in_mbs_minus1 |
| 872 | pSps->iMbHeight = 1 + BsGetUe (pBs); // pic_height_in_map_units_minus1 | 909 | if (uiTmp == 0xffffffff) { |
| 910 | WelsLog (pCtx, WELS_LOG_ERROR, " pic_width_in_mbs read error!\n"); | ||
| 911 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MB_SIZE_INFO); | ||
| 912 | } | ||
| 913 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiTmp; | ||
| 914 | if ((uint64_t) (pSps->iMbWidth * pSps->iMbWidth) > (8 * pSLevelLimits->iMaxFS)) { | ||
| 915 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); | ||
| 916 | } | ||
| 917 | uiTmp = BsGetUe (pBs); // pic_height_in_map_units_minus1 | ||
| 918 | if (uiTmp == 0xffffffff) { | ||
| 919 | WelsLog (pCtx, WELS_LOG_ERROR, " pic_height_in_mbs read error!\n"); | ||
| 920 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MB_SIZE_INFO); | ||
| 921 | } | ||
| 922 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiTmp; | ||
| 923 | if ((uint64_t) (pSps->iMbHeight * pSps->iMbHeight) > (8 * pSLevelLimits->iMaxFS)) { | ||
| 924 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); | ||
| 925 | } | ||
| 873 | pSps->uiTotalMbCount = pSps->iMbWidth * pSps->iMbHeight; | 926 | pSps->uiTotalMbCount = pSps->iMbWidth * pSps->iMbHeight; |
| 927 | if (pSps->uiTotalMbCount > (uint32_t)pSLevelLimits->iMaxFS) { | ||
| 928 | WelsLog (pCtx, WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); | ||
| 929 | } | ||
| 930 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", | ||
| 931 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES)); | ||
| 932 | // here we check max_num_ref_frames | ||
| 933 | uint32_t uiMaxDpbMbs = pSLevelLimits->iMaxDPBMbs; | ||
| 934 | uint32_t uiMaxDpbFrames = uiMaxDpbMbs / pSps->uiTotalMbCount; | ||
| 935 | if (uiMaxDpbFrames > SPS_MAX_NUM_REF_FRAMES_MAX) | ||
| 936 | uiMaxDpbFrames = SPS_MAX_NUM_REF_FRAMES_MAX; | ||
| 937 | if ((uint32_t)pSps->iNumRefFrames > uiMaxDpbFrames) { | ||
| 938 | WelsLog (pCtx, WELS_LOG_WARNING, " max_num_ref_frames exceeds level limits!\n"); | ||
| 939 | } | ||
| 874 | pSps->bFrameMbsOnlyFlag = !!BsGetOneBit (pBs); // frame_mbs_only_flag | 940 | pSps->bFrameMbsOnlyFlag = !!BsGetOneBit (pBs); // frame_mbs_only_flag |
| 875 | |||
| 876 | if (!pSps->bFrameMbsOnlyFlag) { | 941 | if (!pSps->bFrameMbsOnlyFlag) { |
| 877 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.\n", pSps->bFrameMbsOnlyFlag); | 942 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): frame_mbs_only_flag (%d) not supported.\n", pSps->bFrameMbsOnlyFlag); |
| 878 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); | 943 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_MBAFF); |
| @@ -882,8 +947,14 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 3 unmodified lines | |||
| 882 | if (pSps->bFrameCroppingFlag) { | 947 | if (pSps->bFrameCroppingFlag) { |
| 883 | pSps->sFrameCrop.iLeftOffset = BsGetUe (pBs); // frame_crop_left_offset | 948 | pSps->sFrameCrop.iLeftOffset = BsGetUe (pBs); // frame_crop_left_offset |
| 884 | pSps->sFrameCrop.iRightOffset = BsGetUe (pBs); // frame_crop_right_offset | 949 | pSps->sFrameCrop.iRightOffset = BsGetUe (pBs); // frame_crop_right_offset |
| 950 | if ((pSps->sFrameCrop.iLeftOffset + pSps->sFrameCrop.iRightOffset) > ((int32_t)pSps->iMbWidth * 16 / 2)) { | ||
| 951 | WelsLog (pCtx, WELS_LOG_WARNING, "frame_crop_left_offset + frame_crop_right_offset exceeds limits!\n"); | ||
| 952 | } | ||
| 885 | pSps->sFrameCrop.iTopOffset = BsGetUe (pBs); // frame_crop_top_offset | 953 | pSps->sFrameCrop.iTopOffset = BsGetUe (pBs); // frame_crop_top_offset |
| 886 | pSps->sFrameCrop.iBottomOffset = BsGetUe (pBs); // frame_crop_bottom_offset | 954 | pSps->sFrameCrop.iBottomOffset = BsGetUe (pBs); // frame_crop_bottom_offset |
| 955 | if ((pSps->sFrameCrop.iTopOffset + pSps->sFrameCrop.iBottomOffset) > ((int32_t)pSps->iMbHeight * 16 / 2)) { | ||
| 956 | WelsLog (pCtx, WELS_LOG_WARNING, "frame_crop_top_offset + frame_crop_right_offset exceeds limits!\n"); | ||
| 957 | } | ||
| 887 | } else { | 958 | } else { |
| 888 | pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset | 959 | pSps->sFrameCrop.iLeftOffset = 0; // frame_crop_left_offset |
| 889 | pSps->sFrameCrop.iRightOffset = 0; // frame_crop_right_offset | 960 | pSps->sFrameCrop.iRightOffset = 0; // frame_crop_right_offset |
| @@ -957,7 +1028,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 67 unmodified lines | |||
| 957 | pPps->bEntropyCodingModeFlag = !!BsGetOneBit (pBsAux); | 1028 | pPps->bEntropyCodingModeFlag = !!BsGetOneBit (pBsAux); |
| 958 | pPps->bPicOrderPresentFlag = !!BsGetOneBit (pBsAux); | 1029 | pPps->bPicOrderPresentFlag = !!BsGetOneBit (pBsAux); |
| 959 | 1030 | ||
| 960 | pPps->uiNumSliceGroups = 1 + BsGetUe (pBsAux); | 1031 | pPps->uiNumSliceGroups = NUM_SLICE_GROUPS_OFFSET + BsGetUe (pBsAux); |
| 961 | 1032 | ||
| 962 | if (pPps->uiNumSliceGroups > MAX_SLICEGROUP_IDS) { | 1033 | if (pPps->uiNumSliceGroups > MAX_SLICEGROUP_IDS) { |
| 963 | return ERR_INFO_INVALID_SLICEGROUP; | 1034 | return ERR_INFO_INVALID_SLICEGROUP; |
| @@ -974,7 +1045,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 10 unmodified lines | |||
| 974 | switch (pPps->uiSliceGroupMapType) { | 1045 | switch (pPps->uiSliceGroupMapType) { |
| 975 | case 0: | 1046 | case 0: |
| 976 | for (iTmp = 0; iTmp < pPps->uiNumSliceGroups; iTmp++) { | 1047 | for (iTmp = 0; iTmp < pPps->uiNumSliceGroups; iTmp++) { |
| 977 | pPps->uiRunLength[iTmp] = 1 + BsGetUe (pBsAux); | 1048 | pPps->uiRunLength[iTmp] = RUN_LENGTH_OFFSET + BsGetUe (pBsAux); |
| 978 | } | 1049 | } |
| 979 | break; | 1050 | break; |
| 980 | default: | 1051 | default: |
| @@ -982,8 +1053,8 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 1 unmodified line | |||
| 982 | } | 1053 | } |
| 983 | } | 1054 | } |
| 984 | 1055 | ||
| 985 | pPps->uiNumRefIdxL0Active = 1 + BsGetUe (pBsAux); | 1056 | pPps->uiNumRefIdxL0Active = NUM_REF_IDX_L0_DEFAULT_ACTIVE_OFFSET + BsGetUe (pBsAux); |
| 986 | pPps->uiNumRefIdxL1Active = 1 + BsGetUe (pBsAux); | 1057 | pPps->uiNumRefIdxL1Active = NUM_REF_IDX_L1_DEFAULT_ACTIVE_OFFSET + BsGetUe (pBsAux); |
| 987 | 1058 | ||
| 988 | if (pPps->uiNumRefIdxL0Active > MAX_REF_PIC_COUNT || | 1059 | if (pPps->uiNumRefIdxL0Active > MAX_REF_PIC_COUNT || |
| 989 | pPps->uiNumRefIdxL1Active > MAX_REF_PIC_COUNT) { | 1060 | pPps->uiNumRefIdxL1Active > MAX_REF_PIC_COUNT) { |
| @@ -998,10 +1069,15 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 8 unmodified lines | |||
| 998 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_WP); | 1069 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_WP); |
| 999 | } | 1070 | } |
| 1000 | 1071 | ||
| 1001 | pPps->iPicInitQp = 26 + BsGetSe (pBsAux); | 1072 | pPps->iPicInitQp = PIC_INIT_QP_OFFSET + BsGetSe (pBsAux); |
| 1002 | pPps->iPicInitQs = 26 + BsGetSe (pBsAux); | 1073 | WELS_CHECK_SE_BOTH_ERROR (pPps->iPicInitQp, PPS_PIC_INIT_QP_QS_MIN, PPS_PIC_INIT_QP_QS_MAX, "pic_init_qp_minus26 + 26", |
| 1003 | 1074 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_PIC_INIT_QP)); | |
| 1075 | pPps->iPicInitQs = PIC_INIT_QS_OFFSET + BsGetSe (pBsAux); | ||
| 1076 | WELS_CHECK_SE_BOTH_ERROR (pPps->iPicInitQs, PPS_PIC_INIT_QP_QS_MIN, PPS_PIC_INIT_QP_QS_MAX, "pic_init_qs_minus26 + 26", | ||
| 1077 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_PIC_INIT_QS)); | ||
| 1004 | pPps->iChromaQpIndexOffset = BsGetSe (pBsAux); | 1078 | pPps->iChromaQpIndexOffset = BsGetSe (pBsAux); |
| 1079 | WELS_CHECK_SE_BOTH_ERROR (pPps->iChromaQpIndexOffset, PPS_CHROMA_QP_INDEX_OFFSET_MIN, PPS_CHROMA_QP_INDEX_OFFSET_MAX, | ||
| 1080 | "chroma_qp_index_offset", GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_CHROMA_QP_INDEX_OFFSET)); | ||
| 1005 | pPps->bDeblockingFilterControlPresentFlag = !!BsGetOneBit (pBsAux); | 1081 | pPps->bDeblockingFilterControlPresentFlag = !!BsGetOneBit (pBsAux); |
| 1006 | pPps->bConstainedIntraPredFlag = !!BsGetOneBit (pBsAux); | 1082 | pPps->bConstainedIntraPredFlag = !!BsGetOneBit (pBsAux); |
| 1007 | pPps->bRedundantPicCntPresentFlag = !!BsGetOneBit (pBsAux); | 1083 | pPps->bRedundantPicCntPresentFlag = !!BsGetOneBit (pBsAux); |