Skip to content
Snippets Groups Projects
Commit c2596724 authored by Zhipin Deng's avatar Zhipin Deng
Browse files

S0154 aspect9 and S0158 aspect 4 about bitstream extraction

parent 74475785
No related branches found
No related tags found
No related merge requests found
...@@ -172,6 +172,30 @@ bool BitstreamExtractorApp::xCheckSliceSubpicture(InputNALUnit &nalu, int target ...@@ -172,6 +172,30 @@ bool BitstreamExtractorApp::xCheckSliceSubpicture(InputNALUnit &nalu, int target
} }
#endif #endif
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
bool BitstreamExtractorApp::xCheckSEIFiller(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten)
{
for (auto sei : SEIs)
{
if (sei->payloadType() == SEI::SUBPICTURE_LEVEL_INFO)
{
SEISubpicureLevelInfo *seiSLI = (SEISubpicureLevelInfo *)sei;
if (!seiSLI->m_cbrConstraintFlag)
{
rmAllFillerInSubpicExt = true;
}
}
}
for (auto sei : SEIs)
{
if (sei->payloadType() == SEI::FILLER_PAYLOAD)
{
return (rmAllFillerInSubpicExt ? false : lastSliceWritten);
}
}
return true;
}
#else
bool BitstreamExtractorApp::xCheckSeiSubpicture(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten, bool isVclNalUnitRemoved) bool BitstreamExtractorApp::xCheckSeiSubpicture(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten, bool isVclNalUnitRemoved)
{ {
bool isWriteSeiNalUnitToStream = true; bool isWriteSeiNalUnitToStream = true;
...@@ -242,6 +266,7 @@ bool BitstreamExtractorApp::xCheckSeiSubpicture(SEIMessages SEIs, int targetSubP ...@@ -242,6 +266,7 @@ bool BitstreamExtractorApp::xCheckSeiSubpicture(SEIMessages SEIs, int targetSubP
return isWriteSeiNalUnitToStream; return isWriteSeiNalUnitToStream;
} }
#endif
void BitstreamExtractorApp::xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic) void BitstreamExtractorApp::xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic)
{ {
...@@ -479,7 +504,11 @@ bool BitstreamExtractorApp::xCheckNumSubLayers(InputNALUnit &nalu, VPS *vps) ...@@ -479,7 +504,11 @@ bool BitstreamExtractorApp::xCheckNumSubLayers(InputNALUnit &nalu, VPS *vps)
return retval; return retval;
} }
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId, VPS *vps)
#else
bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId) bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId)
#endif
{ {
SEIMessages scalableNestingSEIs = getSeisByType(SEIs, SEI::SCALABLE_NESTING); SEIMessages scalableNestingSEIs = getSeisByType(SEIs, SEI::SCALABLE_NESTING);
if (scalableNestingSEIs.size()) if (scalableNestingSEIs.size())
...@@ -496,12 +525,20 @@ bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit ...@@ -496,12 +525,20 @@ bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit
} }
if (std::find(sei->m_snSubpicId.begin(), sei->m_snSubpicId.end(), subpicId) != sei->m_snSubpicId.end()) if (std::find(sei->m_snSubpicId.begin(), sei->m_snSubpicId.end(), subpicId) != sei->m_snSubpicId.end())
{ {
// applies to target subpicture -> extract #if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
OutputNALUnit outNalu( nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId ); // C.7 step 7.c
m_seiWriter.writeSEImessages(outNalu.m_Bitstream, sei->m_nestedSEIs, m_hrd, false, nalu.m_temporalId); if (sei->m_snOlsFlag || vps->getNumLayersInOls(m_targetOlsIdx) == 1)
NALUnitEBSP naluWithHeader(outNalu); {
writeAnnexBNalUnit(out, naluWithHeader, true); #endif
return false; // applies to target subpicture -> extract
OutputNALUnit outNalu( nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId );
m_seiWriter.writeSEImessages(outNalu.m_Bitstream, sei->m_nestedSEIs, m_hrd, false, nalu.m_temporalId);
NALUnitEBSP naluWithHeader(outNalu);
writeAnnexBNalUnit(out, naluWithHeader, true);
return false;
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
}
#endif
} }
else else
{ {
...@@ -812,6 +849,20 @@ uint32_t BitstreamExtractorApp::decode() ...@@ -812,6 +849,20 @@ uint32_t BitstreamExtractorApp::decode()
{ {
writeInpuNalUnitToStream &= xCheckScalableNestingSEI(seiNesting, nalu, vps); writeInpuNalUnitToStream &= xCheckScalableNestingSEI(seiNesting, nalu, vps);
} }
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
// C.6 step 9.c
if (writeInpuNalUnitToStream && (vps->getNumLayersInOls(m_targetOlsIdx) < vps->getMaxLayers()) && !seiNesting->m_snSubpicFlag)
{
if (seiNesting->m_snOlsFlag || vps->getNumLayersInOls(m_targetOlsIdx) == 1)
{
OutputNALUnit outNalu(nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId);
m_seiWriter.writeSEImessages(outNalu.m_Bitstream, seiNesting->m_nestedSEIs, m_hrd, false, nalu.m_temporalId);
NALUnitEBSP naluWithHeader(outNalu);
writeAnnexBNalUnit(bitstreamFileOut, naluWithHeader, true);
writeInpuNalUnitToStream = false;
}
}
#endif
} }
// remove unqualified timing related SEI // remove unqualified timing related SEI
if (sei->payloadType() == SEI::BUFFERING_PERIOD || (m_removeTimingSEI && sei->payloadType() == SEI::PICTURE_TIMING) || sei->payloadType() == SEI::DECODING_UNIT_INFO || sei->payloadType() == SEI::SUBPICTURE_LEVEL_INFO) if (sei->payloadType() == SEI::BUFFERING_PERIOD || (m_removeTimingSEI && sei->payloadType() == SEI::PICTURE_TIMING) || sei->payloadType() == SEI::DECODING_UNIT_INFO || sei->payloadType() == SEI::SUBPICTURE_LEVEL_INFO)
...@@ -820,19 +871,29 @@ uint32_t BitstreamExtractorApp::decode() ...@@ -820,19 +871,29 @@ uint32_t BitstreamExtractorApp::decode()
writeInpuNalUnitToStream &= !targetOlsIdxGreaterThanZero; writeInpuNalUnitToStream &= !targetOlsIdxGreaterThanZero;
} }
} }
#if !JVET_S0154_ASPECT9_AND_S0158_ASPECT4
if (m_subPicIdx >= 0 && writeInpuNalUnitToStream) if (m_subPicIdx >= 0 && writeInpuNalUnitToStream)
{ {
writeInpuNalUnitToStream = xCheckSeiSubpicture(SEIs, subpicIdTarget[nalu.m_nuhLayerId], rmAllFillerInSubpicExt[nalu.m_nuhLayerId], lastSliceWritten, isVclNalUnitRemoved[nalu.m_nuhLayerId]); writeInpuNalUnitToStream = xCheckSeiSubpicture(SEIs, subpicIdTarget[nalu.m_nuhLayerId], rmAllFillerInSubpicExt[nalu.m_nuhLayerId], lastSliceWritten, isVclNalUnitRemoved[nalu.m_nuhLayerId]);
} }
#endif
if (m_vpsId == -1) if (m_vpsId == -1)
{ {
delete vps; delete vps;
} }
} }
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
writeInpuNalUnitToStream &= xCheckSEIFiller(SEIs, subpicIdTarget[nalu.m_nuhLayerId], rmAllFillerInSubpicExt[nalu.m_nuhLayerId], lastSliceWritten);
if (writeInpuNalUnitToStream && isVclNalUnitRemoved[nalu.m_nuhLayerId] && m_subPicIdx >= 0)
{
writeInpuNalUnitToStream &= xCheckSEIsSubPicture(SEIs, nalu, bitstreamFileOut, subpicIdTarget[nalu.m_nuhLayerId], vps);
}
#else
if (m_subPicIdx >= 0) if (m_subPicIdx >= 0)
{ {
writeInpuNalUnitToStream &= xCheckSEIsSubPicture(SEIs, nalu, bitstreamFileOut, subpicIdTarget[nalu.m_nuhLayerId]); writeInpuNalUnitToStream &= xCheckSEIsSubPicture(SEIs, nalu, bitstreamFileOut, subpicIdTarget[nalu.m_nuhLayerId]);
} }
#endif
} }
#if JVET_R0107_BITSTREAM_EXTACTION #if JVET_R0107_BITSTREAM_EXTACTION
...@@ -842,9 +903,15 @@ uint32_t BitstreamExtractorApp::decode() ...@@ -842,9 +903,15 @@ uint32_t BitstreamExtractorApp::decode()
slice = xParseSliceHeader(nalu); slice = xParseSliceHeader(nalu);
} }
#endif #endif
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
if (isMultiSubpicLayer[nalu.m_nuhLayerId] && writeInpuNalUnitToStream)
{
if (m_subPicIdx >= 0 && nalu.isSlice())
#else
if (m_subPicIdx >= 0 && isMultiSubpicLayer[nalu.m_nuhLayerId] && writeInpuNalUnitToStream) if (m_subPicIdx >= 0 && isMultiSubpicLayer[nalu.m_nuhLayerId] && writeInpuNalUnitToStream)
{ {
if (nalu.isSlice()) if (nalu.isSlice())
#endif
{ {
writeInpuNalUnitToStream = xCheckSliceSubpicture(slice, subpicIdTarget[nalu.m_nuhLayerId]); writeInpuNalUnitToStream = xCheckSliceSubpicture(slice, subpicIdTarget[nalu.m_nuhLayerId]);
if (!writeInpuNalUnitToStream) if (!writeInpuNalUnitToStream)
......
...@@ -65,7 +65,11 @@ protected: ...@@ -65,7 +65,11 @@ protected:
void xPrintSubPicInfo (PPS *pps); void xPrintSubPicInfo (PPS *pps);
void xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic); void xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, SubPic &subPic);
void xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, const SPS &sourceSPS, SubPic &subPic); void xRewritePPS (PPS &targetPPS, const PPS &sourcePPS, const SPS &sourceSPS, SubPic &subPic);
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
bool xCheckSEIFiller(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten);
#else
bool xCheckSeiSubpicture(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten, bool isVclNalUnitRemoved); bool xCheckSeiSubpicture(SEIMessages SEIs, int targetSubPicId, bool &rmAllFillerInSubpicExt, bool lastSliceWritten, bool isVclNalUnitRemoved);
#endif
#if JVET_R0107_BITSTREAM_EXTACTION #if JVET_R0107_BITSTREAM_EXTACTION
Slice xParseSliceHeader(InputNALUnit &nalu); Slice xParseSliceHeader(InputNALUnit &nalu);
...@@ -74,7 +78,11 @@ protected: ...@@ -74,7 +78,11 @@ protected:
bool xCheckSliceSubpicture(InputNALUnit &nalu, int subPicId); bool xCheckSliceSubpicture(InputNALUnit &nalu, int subPicId);
#endif #endif
void xReadPicHeader(InputNALUnit &nalu); void xReadPicHeader(InputNALUnit &nalu);
#if JVET_S0154_ASPECT9_AND_S0158_ASPECT4
bool xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId, VPS *vps);
#else
bool xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId); bool xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out, int subpicId);
#endif
bool xCheckScalableNestingSEI(SEIScalableNesting *seiNesting, InputNALUnit& nalu, VPS *vps); bool xCheckScalableNestingSEI(SEIScalableNesting *seiNesting, InputNALUnit& nalu, VPS *vps);
void xSetSPSUpdated(int spsId) { return m_updatedSPSList.push_back(spsId); } void xSetSPSUpdated(int spsId) { return m_updatedSPSList.push_back(spsId); }
......
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
#define JVET_W2005_RANGE_EXTENSION_PROFILES 1 // JVET-W2005 (JVET-W0136 profile plus meeting decisions) #define JVET_W2005_RANGE_EXTENSION_PROFILES 1 // JVET-W2005 (JVET-W0136 profile plus meeting decisions)
#define JVET_S0154_ASPECT9_AND_S0158_ASPECT4 1 // JVET-S0154 #9: In the subpicture sub-bitstream extraction process, insert SEI NAL units to directly contain those SEI messages that were scalable-nested HRD-related SEI messages that apply to the output bitstream, and remove their original container SEI NAL units from the output bitstream. When the target OLS includes only one layer, apply the same for scalable-nested non-HRD-related SEI messages.
// JVET-S0158 #4c: Insert SEI NAL units to directly contain those SEI messages that were scalable-nested HRD-related SEI messages that apply to the output bitstream, and remove their original container SEI NAL units from the output bitstream. When the target OLS includes only one layer, apply the same for scalable-nested non-HRD-related SEI messages.
//########### place macros to be be kept below this line ############### //########### place macros to be be kept below this line ###############
#define GDR_ENABLED 1 #define GDR_ENABLED 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment