diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 81af7b22ccf6a5cd6752de7701bbd044f18f19d8..f1de6de79ffbbc8e16eff01f6414e48b8a0158bc 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -894,9 +894,9 @@ void DecLib::finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl, bool a msg( msgl, "\n"); #if JVET_J0090_MEMORY_BANDWITH_MEASURE - m_cacheModel.reportFrame(); - m_cacheModel.accumulateFrame(); - m_cacheModel.clear(); + m_cacheModel.reportFrame(); + m_cacheModel.accumulateFrame(); + m_cacheModel.clear(); #endif m_pcPic->neededForOutput = (pcSlice->getPicHeader()->getPicOutputFlag() ? true : false); @@ -3819,6 +3819,7 @@ void DecLib::checkNalUnitConstraints( uint32_t naluType ) xCheckNalUnitConstraintFlags( cInfo, naluType ); } } + void DecLib::xCheckNalUnitConstraintFlags( const ConstraintInfo *cInfo, uint32_t naluType ) { if (cInfo != nullptr) @@ -3845,6 +3846,7 @@ void DecLib::xCheckNalUnitConstraintFlags( const ConstraintInfo *cInfo, uint32_t "Non-conforming bitstream. no_aps_constraint_flag is equal to 1 but bitstream contains NAL unit of type APS_SUFFIX_NUT."); } } + void DecLib::xCheckMixedNalUnit(Slice* pcSlice, SPS *sps, InputNALUnit &nalu) { if (pcSlice->getPPS()->getMixedNaluTypesInPicFlag()) diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index fc97e39ba9447ecde1d1d521a540264094e03d7d..d1da991084d6b5a9b9eac9ad30d3aa3c0b23d943 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -934,8 +934,6 @@ void SEIReader::xParseSEIGreenMetadataInfo(SEIGreenMetadataInfo& sei, uint32_t p } } - - void SEIReader::xParseSEIScalableNestingBinary(SEIScalableNesting& sei, const NalUnitType nalUnitType, const uint32_t nuhLayerId, uint32_t payloadSize, const VPS* vps, const SPS* sps, HRD &hrd, std::ostream* decodedMessageOutputStream, std::vector<std::tuple<int, int, bool, uint32_t, uint8_t*, int, int>> *seiList) { uint32_t symbol; @@ -1197,8 +1195,8 @@ void SEIReader::xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& sei, uint32_t pay sei.m_duSptCpbRemovalDelayIncrement[i] = 0; } } - if (!bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag) + if (!bp.m_decodingUnitDpbDuParamsInPicTimingSeiFlag) { sei_read_flag(pDecodedMessageOutputStream, val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = (val != 0); } @@ -1220,7 +1218,6 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo int i, nalOrVcl; uint32_t code; - output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); sei_read_flag( pDecodedMessageOutputStream, code, "bp_nal_hrd_parameters_present_flag" ); sei.m_bpNalCpbParamsPresentFlag = code; @@ -1280,7 +1277,8 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo sei.m_cpbRemovalDelayDelta[ i ] = code; } } - sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_cpb_cnt_minus1" ); sei.m_bpCpbCnt = code + 1; + sei_read_uvlc(pDecodedMessageOutputStream, code, "bp_cpb_cnt_minus1"); + sei.m_bpCpbCnt = code + 1; if (sei.m_bpMaxSubLayers - 1 > 0) { sei_read_flag(pDecodedMessageOutputStream, code, "bp_sublayer_initial_cpb_removal_delay_present_flag"); @@ -1331,12 +1329,10 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo { sei_read_flag(pDecodedMessageOutputStream, code, "use_alt_cpb_params_flag"); sei.m_useAltCpbParamsFlag = code; } - } void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSize, const uint32_t temporalId, const SEIBufferingPeriod& bp, std::ostream *pDecodedMessageOutputStream) { - output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); uint32_t symbol; @@ -1653,6 +1649,7 @@ void SEIReader::xParseSEIAnnotatedRegions(SEIAnnotatedRegions& sei, uint32_t pay } } } + void SEIReader::xParseSEIFrameFieldinfo(SEIFrameFieldInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); @@ -1960,6 +1957,7 @@ void SEIReader::xParseSEIColourTransformInfo(SEIColourTransformInfo& sei, uint32 } } } + void SEIReader::xParseSEIContentColourVolume(SEIContentColourVolume& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { int i; @@ -1998,6 +1996,7 @@ void SEIReader::xParseSEIContentColourVolume(SEIContentColourVolume& sei, uint32 } } } + void SEIReader::xParseSEIEquirectangularProjection(SEIEquirectangularProjection& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { uint32_t val; @@ -2222,10 +2221,14 @@ void SEIReader::xParseSEIScalabilityDimensionInfo(SEIScalabilityDimensionInfo& s for (int j = 0; j < i; j++) { if (sei.m_sdiViewIdVal[i] == sei.m_sdiViewIdVal[j]) + { newViewFlag = false; + } } if (newViewFlag) + { sei.m_sdiNumViews++; + } } } } @@ -2287,7 +2290,7 @@ void SEIReader::xParseSEIMultiviewAcquisitionInfo(SEIMultiviewAcquisitionInfo& s } } } -}; +} void SEIReader::xParseSEIMultiviewViewPosition(SEIMultiviewViewPosition& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { @@ -2300,7 +2303,7 @@ void SEIReader::xParseSEIMultiviewViewPosition(SEIMultiviewViewPosition& sei, ui { sei_read_uvlc(pDecodedMessageOutputStream, val, "view_position"); sei.m_mvpViewPosition[i] = val; } -}; +} void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { @@ -2321,7 +2324,7 @@ void SEIReader::xParseSEIAlphaChannelInfo(SEIAlphaChannelInfo& sei, uint32_t pay sei_read_flag( pDecodedMessageOutputStream, val, "alpha_channel_clip_type_flag" ); sei.m_aciClipTypeFlag = (val == 1); } } -}; +} void SEIReader::xParseSEIDepthRepresentationInfo(SEIDepthRepresentationInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { @@ -2385,7 +2388,8 @@ void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMes if (x_mantissa_len>=16) { f =1.0 + (x_mantissa*1.0)/(1u<<(x_mantissa_len-16))/(256.0*256.0 ); - }else + } + else { f =1.0 + (x_mantissa*1.0)/(1u<<x_mantissa_len); } @@ -2394,22 +2398,24 @@ void SEIReader::xParseSEIDepthRepInfoElement(double& f,std::ostream *pDecodedMes if (x_exp<0) { for(i=0;i<-x_exp;i++) - m = m * 2; - + { + m = m * 2; + } f = f/m; } else { for(i=0;i<x_exp;i++) - m = m * 2; - + { + m = m * 2; + } f= f * m; } if (x_sign==1) { f= -f; } -}; +} void SEIReader::xParseSEISubpictureLevelInfo(SEISubpicureLevelInfo& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { @@ -2644,7 +2650,7 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei.m_SepColDescriptionFlag = val; if(sei.m_SepColDescriptionFlag) - { + { sei_read_code(pDecodedMessageOutputStream, 8, val,"nnpfc_col_primaries"); sei.m_ColPrimaries = val; sei_read_code(pDecodedMessageOutputStream, 8, val,"nnpfc_trans_characteristics"); @@ -2926,7 +2932,9 @@ void SeiCfgFileDump::xDumpSEIGeneralizedCubemapProjection (SEIGeneralizedCubema fprintf(fp, "%s\n", packingTypeStr.c_str()); fprintf(fp, "InputGCMPMappingType : %d # 0: CMP; 1: EAC; 2: parameterized CMP\n", (int)sei.m_gcmpMappingFunctionType); if ((int)sei.m_gcmpMappingFunctionType == 2) + { fprintf(fp, "%s\n", gcmpsettingsStr.c_str()); + } fprintf(fp, "InputGCMPPaddingFlag : %d # 0: input without guard bands; 1: input with guard bands\n", sei.m_gcmpGuardBandFlag); if (sei.m_gcmpGuardBandFlag) { diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 3192b492f306cf416ea970b34ca2e931e7f009bb..00c93a52ab8a4e5d404bf5a9c5f054b6bdd7fbca 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -256,7 +256,6 @@ void VLCReader::xReadString(std::string& code) codeIn = (char*)&uiCode; code.append(codeIn); } - } #endif @@ -744,71 +743,71 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS ) pcPPS->setPPSChromaToolFlag(uiCode ? true : false); if (pcPPS->getPPSChromaToolFlag()) { - READ_SVLC( iCode, "pps_cb_qp_offset"); - pcPPS->setQpOffset(COMPONENT_Cb, iCode); - CHECK( pcPPS->getQpOffset(COMPONENT_Cb) < -12, "Invalid Cb QP offset" ); - CHECK( pcPPS->getQpOffset(COMPONENT_Cb) > 12, "Invalid Cb QP offset" ); - - READ_SVLC( iCode, "pps_cr_qp_offset"); - pcPPS->setQpOffset(COMPONENT_Cr, iCode); - CHECK( pcPPS->getQpOffset(COMPONENT_Cr) < -12, "Invalid Cr QP offset" ); - CHECK( pcPPS->getQpOffset(COMPONENT_Cr) > 12, "Invalid Cr QP offset" ); + READ_SVLC(iCode, "pps_cb_qp_offset"); + pcPPS->setQpOffset(COMPONENT_Cb, iCode); + CHECK(pcPPS->getQpOffset(COMPONENT_Cb) < -12, "Invalid Cb QP offset"); + CHECK(pcPPS->getQpOffset(COMPONENT_Cb) > 12, "Invalid Cb QP offset"); - READ_FLAG(uiCode, "pps_joint_cbcr_qp_offset_present_flag"); - pcPPS->setJointCbCrQpOffsetPresentFlag(uiCode ? true : false); + READ_SVLC(iCode, "pps_cr_qp_offset"); + pcPPS->setQpOffset(COMPONENT_Cr, iCode); + CHECK(pcPPS->getQpOffset(COMPONENT_Cr) < -12, "Invalid Cr QP offset"); + CHECK(pcPPS->getQpOffset(COMPONENT_Cr) > 12, "Invalid Cr QP offset"); - if (pcPPS->getJointCbCrQpOffsetPresentFlag()) - { - READ_SVLC(iCode, "pps_joint_cbcr_qp_offset_value"); - } - else - { - iCode = 0; - } - pcPPS->setQpOffset(JOINT_CbCr, iCode); + READ_FLAG(uiCode, "pps_joint_cbcr_qp_offset_present_flag"); + pcPPS->setJointCbCrQpOffsetPresentFlag(uiCode ? true : false); - CHECK( pcPPS->getQpOffset(JOINT_CbCr) < -12, "Invalid CbCr QP offset" ); - CHECK( pcPPS->getQpOffset(JOINT_CbCr) > 12, "Invalid CbCr QP offset" ); + if (pcPPS->getJointCbCrQpOffsetPresentFlag()) + { + READ_SVLC(iCode, "pps_joint_cbcr_qp_offset_value"); + } + else + { + iCode = 0; + } + pcPPS->setQpOffset(JOINT_CbCr, iCode); - CHECK(MAX_NUM_COMPONENT>3, "Invalid maximal number of components"); + CHECK(pcPPS->getQpOffset(JOINT_CbCr) < -12, "Invalid CbCr QP offset"); + CHECK(pcPPS->getQpOffset(JOINT_CbCr) > 12, "Invalid CbCr QP offset"); - READ_FLAG( uiCode, "pps_slice_chroma_qp_offsets_present_flag" ); - pcPPS->setSliceChromaQpFlag( uiCode ? true : false ); + CHECK(MAX_NUM_COMPONENT > 3, "Invalid maximal number of components"); - READ_FLAG( uiCode, "pps_cu_chroma_qp_offset_list_enabled_flag"); - if (uiCode == 0) - { - pcPPS->clearChromaQpOffsetList(); - } - else - { - uint32_t tableSizeMinus1 = 0; - READ_UVLC(tableSizeMinus1, "pps_chroma_qp_offset_list_len_minus1"); - CHECK(tableSizeMinus1 >= MAX_QP_OFFSET_LIST_SIZE, "Table size exceeds maximum"); + READ_FLAG(uiCode, "pps_slice_chroma_qp_offsets_present_flag"); + pcPPS->setSliceChromaQpFlag(uiCode ? true : false); - for (int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++) + READ_FLAG(uiCode, "pps_cu_chroma_qp_offset_list_enabled_flag"); + if (uiCode == 0) { - int cbOffset; - int crOffset; - int jointCbCrOffset; - READ_SVLC(cbOffset, "pps_cb_qp_offset_list[i]"); - CHECK(cbOffset < -12 || cbOffset > 12, "Invalid chroma QP offset"); - READ_SVLC(crOffset, "pps_cr_qp_offset_list[i]"); - CHECK(crOffset < -12 || crOffset > 12, "Invalid chroma QP offset"); - if (pcPPS->getJointCbCrQpOffsetPresentFlag()) - { - READ_SVLC(jointCbCrOffset, "pps_joint_cbcr_qp_offset_list[i]"); - } - else + pcPPS->clearChromaQpOffsetList(); + } + else + { + uint32_t tableSizeMinus1 = 0; + READ_UVLC(tableSizeMinus1, "pps_chroma_qp_offset_list_len_minus1"); + CHECK(tableSizeMinus1 >= MAX_QP_OFFSET_LIST_SIZE, "Table size exceeds maximum"); + + for (int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++) { - jointCbCrOffset = 0; + int cbOffset; + int crOffset; + int jointCbCrOffset; + READ_SVLC(cbOffset, "pps_cb_qp_offset_list[i]"); + CHECK(cbOffset < -12 || cbOffset > 12, "Invalid chroma QP offset"); + READ_SVLC(crOffset, "pps_cr_qp_offset_list[i]"); + CHECK(crOffset < -12 || crOffset > 12, "Invalid chroma QP offset"); + if (pcPPS->getJointCbCrQpOffsetPresentFlag()) + { + READ_SVLC(jointCbCrOffset, "pps_joint_cbcr_qp_offset_list[i]"); + } + else + { + jointCbCrOffset = 0; + } + CHECK(jointCbCrOffset < -12 || jointCbCrOffset > 12, "Invalid chroma QP offset"); + // table uses +1 for index (see comment inside the function) + pcPPS->setChromaQpOffsetListEntry(cuChromaQpOffsetIdx + 1, cbOffset, crOffset, jointCbCrOffset); } - CHECK(jointCbCrOffset < -12 || jointCbCrOffset > 12, "Invalid chroma QP offset"); - // table uses +1 for index (see comment inside the function) - pcPPS->setChromaQpOffsetListEntry(cuChromaQpOffsetIdx + 1, cbOffset, crOffset, jointCbCrOffset); + CHECK(pcPPS->getChromaQpOffsetListLen() != tableSizeMinus1 + 1, "Invalid chroma QP offset list length"); } - CHECK(pcPPS->getChromaQpOffsetListLen() != tableSizeMinus1 + 1, "Invalid chroma QP offset list length"); - } } else { @@ -1257,6 +1256,7 @@ void HLSyntaxReader::parseGeneralHrdParameters(GeneralHrdParams *hrd) CHECK(symbol > 31,"The value of hrd_cpb_cnt_minus1 shall be in the range of 0 to 31, inclusive"); } } + void HLSyntaxReader::parseOlsHrdParameters(GeneralHrdParams * generalHrd, OlsHrdParams *olsHrd, uint32_t firstSubLayer, uint32_t maxNumSubLayersMinus1) { uint32_t symbol; @@ -1394,9 +1394,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if (pcSPS->getPtlDpbHrdParamsPresentFlag()) { - parseProfileTierLevel(pcSPS->getProfileTierLevel(), true, pcSPS->getMaxTLayers() - 1); - } READ_FLAG(uiCode, "sps_gdr_enabled_flag"); @@ -1705,7 +1703,8 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setMaxBTSize(maxBTSize[1], maxBTSize[0], maxBTSize[2]); pcSPS->setMaxTTSize(maxTTSize[1], maxTTSize[0], maxTTSize[2]); - if (pcSPS->getCTUSize() > 32) { + if (pcSPS->getCTUSize() > 32) + { READ_FLAG(uiCode, "sps_max_luma_transform_size_64_flag"); pcSPS->setLog2MaxTbSize((uiCode ? 1 : 0) + 5); } else @@ -2160,8 +2159,10 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) } if (pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) <= 10) + { CHECK(sps_extension_flags[SPS_EXT__REXT] == 1, "The value of sps_range_extension_flag shall be 0 when BitDepth is less than or equal to 10."); + } bool bSkipTrailingExtensionBits=false; for(int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. @@ -3771,7 +3772,6 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par CHECK(apsToCheckLuma->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA] != 1, "bitstream conformance error, alf_luma_filter_signal_flag shall be equal to 1"); } - pcSlice->setAlfApsIdsLuma(apsId); if (hasChroma) {