Commit 450b6093 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'R0093_Subpics_and_cropping_window' into 'master'

JVET-R0093/R0294: Subpictures and cropping window

See merge request jvet/VVCSoftware_VTM!1755
parents b46623fd 145e07ef
......@@ -183,6 +183,21 @@ void BitstreamExtractorApp::xRewriteSPS (SPS &targetSPS, const SPS &sourceSPS, S
targetSPS.setSubPicId(0, subPic.getSubPicID());
targetSPS.setMaxPicWidthInLumaSamples(subPic.getSubPicWidthInLumaSample());
targetSPS.setMaxPicHeightInLumaSamples(subPic.getSubPicHeightInLumaSample());
#if JVET_R0093_SUBPICS_AND_CONF_WINDOW
// Set the new conformance window
Window& conf = targetSPS.getConformanceWindow();
int subpicConfWinLeftOffset = (subPic.getSubPicCtuTopLeftX() == 0) ? conf.getWindowLeftOffset() : 0;
int subpicConfWinRightOffset = ((subPic.getSubPicCtuTopLeftX() + subPic.getSubPicWidthInCTUs()) * sourceSPS.getCTUSize() >= sourceSPS.getMaxPicWidthInLumaSamples()) ?
conf.getWindowRightOffset() : 0;
int subpicConfWinTopOffset = (subPic.getSubPicCtuTopLeftY() == 0) ? conf.getWindowTopOffset() : 0;
int subpicConfWinBottomOffset = ((subPic.getSubPicCtuTopLeftY() + subPic.getSubPicHeightInCTUs()) * sourceSPS.getCTUSize() >= sourceSPS.getMaxPicHeightInLumaSamples()) ?
conf.getWindowBottomOffset() : 0;
conf.setWindowLeftOffset(subpicConfWinLeftOffset);
conf.setWindowRightOffset(subpicConfWinRightOffset);
conf.setWindowTopOffset(subpicConfWinTopOffset);
conf.setWindowBottomOffset(subpicConfWinBottomOffset);
#endif
}
......
......@@ -1872,6 +1872,22 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
}
}
#if JVET_R0093_SUBPICS_AND_CONF_WINDOW
if( m_conformanceWindowMode > 0 && m_subPicInfoPresentFlag )
{
for(int i = 0; i < m_numSubPics; i++)
{
CHECK( (m_subPicCtuTopLeftX[i] * m_uiCTUSize) >= (m_iSourceWidth - m_confWinRight * SPS::getWinUnitX(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window");
CHECK( ((m_subPicCtuTopLeftX[i] + m_subPicWidth[i]) * m_uiCTUSize) <= (m_confWinLeft * SPS::getWinUnitX(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window" );
CHECK( (m_subPicCtuTopLeftY[i] * m_uiCTUSize) >= (m_iSourceHeight - m_confWinBottom * SPS::getWinUnitY(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window");
CHECK( ((m_subPicCtuTopLeftY[i] + m_subPicHeight[i]) * m_uiCTUSize) <= (m_confWinTop * SPS::getWinUnitY(m_chromaFormatIDC)),
"No subpicture can be located completely outside of the conformance cropping window");
}
}
#endif
if (tmpDecodedPictureHashSEIMappedType<0 || tmpDecodedPictureHashSEIMappedType>=int(NUMBER_OF_HASHTYPES))
{
......
......@@ -3345,6 +3345,24 @@ void PPS::initSubPic(const SPS &sps)
CHECK(getNumSubPics() > MAX_NUM_SUB_PICS, "Number of sub-pictures in picture exceeds valid range");
m_subPics.resize(getNumSubPics());
#if JVET_R0093_SUBPICS_AND_CONF_WINDOW
// Check that no subpicture is specified outside of the conformance cropping window
for(int i = 0; i < sps.getNumSubPics(); i++)
{
CHECK( (sps.getSubPicCtuTopLeftX(i) * sps.getCTUSize()) >=
(sps.getMaxPicWidthInLumaSamples() - sps.getConformanceWindow().getWindowRightOffset() * SPS::getWinUnitX(sps.getChromaFormatIdc())),
"No subpicture can be located completely outside of the conformance cropping window");
CHECK( ((sps.getSubPicCtuTopLeftX(i) + sps.getSubPicWidth(i)) * sps.getCTUSize()) <= (sps.getConformanceWindow().getWindowLeftOffset() * SPS::getWinUnitX(sps.getChromaFormatIdc())),
"No subpicture can be located completely outside of the conformance cropping window" );
CHECK( (sps.getSubPicCtuTopLeftY(i) * sps.getCTUSize()) >=
(sps.getMaxPicHeightInLumaSamples() - sps.getConformanceWindow().getWindowBottomOffset() * SPS::getWinUnitY(sps.getChromaFormatIdc())),
"No subpicture can be located completely outside of the conformance cropping window");
CHECK( ((sps.getSubPicCtuTopLeftY(i) + sps.getSubPicHeight(i)) * sps.getCTUSize()) <= (sps.getConformanceWindow().getWindowTopOffset() * SPS::getWinUnitY(sps.getChromaFormatIdc())),
"No subpicture can be located completely outside of the conformance cropping window");
}
#endif
// m_ctuSize, m_picWidthInCtu, and m_picHeightInCtu might not be initialized yet.
if (m_ctuSize == 0 || m_picWidthInCtu == 0 || m_picHeightInCtu == 0)
{
......
......@@ -78,6 +78,8 @@
#define JVET_S0155_EOS_NALU_CHECK 1 // JVET-S0155: Constraints on EOS NAL units
#define JVET_R0093_SUBPICS_AND_CONF_WINDOW 1 // JVET-R0093 and JVET-R0294: Constraint on subpictures and conformance cropping window, and rewriting of conformance cropping window in subpicture extraction
#define JVET_S0160_ASPECT1_ASPECT9 1 // JVET-S0160: Aspect 1 Infer the value of pps_loop_filter_across_tiles_enabled_flag to be equal to 0 (instead of 1) when not present
// Aspect 9 The value of ph_poc_msb_cycle_present_flag is required to be equal to 0 when vps_independent_layer_flag[GeneralLayerIdx[nuh_layer_id]] is equal to 0 and there is an ILRP entry in RefPicList[0] or RefPicList[1] of a slice of the current picture
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment