...
 
Commits (8)
VuiParametersPresent: 1 // enable VUI
ProgressiveSource: 1 // indicates if content is progressive
InterlacedSource: 0 // indicates if content is interlaced
NonPackedSource: 1 // indicates if content is not packed
NonProjectedConstraintFlag: 1 // indicates if content is not projected
AspectRatioInfoPresent: 1 // enable presence of sample aspect ratio information
AspectRatioIdc: 1 // sample aspect ratio pre-defined types according to Rec. ITU-T H.273 | ISO/IEC 23091-2
SarWidth: 1 // sample aspect ratio width, if AspectRatioIdc is equal to 255
SarHeight: 1 // sample aspect ratio height, if AspectRatioIdc is equal to 255
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
ColourDescriptionPresent: 1 // enable presence of colour description information
ColourPrimaries: 1 // the source colour primaries according to Rec. ITU-T H.273 | ISO/IEC 23091-2
TransferCharacteristics: 1 // transfer characteristics function according to Rec. ITU-T H.273 | ISO/IEC 23091-2
MatrixCoefficients: 1 // the formulae used in deriving luma and chroma signals acc. to Rec. ITU-T H.273 | ISO/IEC 23091-2
VideoFullRange: 0 // scaling and offset values applied according to Rec. ITU-T H.273 | ISO/IEC 23091-2
ProgressiveSource: 1 // indicates if content is progressive
InterlacedSource: 0 // indicates if content is interlaced
ChromaLocInfoPresent: 1 // enable presence of chroma location information
ChromaSampleLocTypeTopField: 0 // the location of chroma sample top field
ChromaSampleLocTypeBottomField: 0 // the location of chroma sample bottom field
ChromaSampleLocType: 0 // the location of chroma sample frame
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
VuiParametersPresent: 1 // enable VUI
ProgressiveSource: 1 // Indicates if content is progressive
InterlacedSource: 0 // Indicates if content is interlaced
NonPackedSource: 1 // indicates if content is not packed
NonProjectedConstraintFlag: 1 // indicates if content is not projected
AspectRatioInfoPresent: 1 // enable presence of sample aspect ratio information
AspectRatioIdc: 1 // sample aspect ratio pre-defined types according to Rec. ITU-T H.273 | ISO/IEC 23091-2
SarWidth: 1 // sample aspect ratio width, if AspectRatioIdc is equal to 255
SarHeight: 1 // sample aspect ratio height, if AspectRatioIdc is equal to 255
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
ColourDescriptionPresent: 1 // enable presence of colour description information
ColourPrimaries: 9 // the source colour primaries according to Rec. ITU-T H.273 | ISO/IEC 23091-2
TransferCharacteristics: 16 // transfer characteristics function according to Rec. ITU-T H.273 | ISO/IEC 23091-2
MatrixCoefficients: 9 // the formulae used in deriving luma and chroma signals acc. to Rec. ITU-T H.273 | ISO/IEC 23091-2
VideoFullRange: 0 // scaling and offset values applied according to Rec. ITU-T H.273 | ISO/IEC 23091-2
ProgressiveSource: 1 // Indicates if content is progressive
InterlacedSource: 0 // Indicates if content is interlaced
ChromaLocInfoPresent: 1 // enable presence of chroma location information
ChromaSampleLocTypeTopField: 2 // the location of chroma sample top field
ChromaSampleLocTypeBottomField: 2 // the location of chroma sample bottom field
ChromaSampleLocType: 2 // the location of chroma sample frame
OverscanInfoPresent: 1 // enable presence of overscan information
OverscanAppropriate: 0 // indicates if the cropped decoded pictures output are suitable for display using overscan
......@@ -1018,18 +1018,6 @@ Specifies the value of general_one_picture_only_constraint_flag.
Specifies the value of general_lower_bit_constraint_flag to use for RExt profiles.
\\
\Option{NonPackedSource} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_packed_constraint_flag
\\
\Option{NonProjectedConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_projected_constraint_flag
\\
\Option{NoResChangeInClvsConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
......@@ -2918,6 +2906,16 @@ Specifies the value of general_progressive_source_flag
\Default{false} &
Specifies the value of general_interlaced_source_flag
\\
\Option{NonPackedSource} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_packed_constraint_flag
\\
\Option{NonProjectedConstraintFlag} &
%\ShortOption{\None} &
\Default{false} &
Specifies the value of general_non_projected_constraint_flag
\\
\Option{ChromaLocInfoPresent} &
\Default{false} &
Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present.
......
......@@ -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
}
......
......@@ -821,8 +821,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("OnePictureOnlyConstraintFlag", m_onePictureOnlyConstraintFlag, false, "Value of general_intra_constraint_flag. Can only be used for single frame encodings. Will be set to true for still picture profiles")
("IntraConstraintFlag", m_intraConstraintFlag, false, "Value of intra_only_constraint_flag")
#if !JVET_S0266_VUI_length
("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
("NonProjectedConstraintFlag", m_nonProjectedConstraintFlag, false, "Indicate that the bitstream contains projection SEI messages")
#endif
("NoResChangeInClvsConstraintFlag", m_noResChangeInClvsConstraintFlag, false, "Indicate that the picture spatial resolution does not change within any CLVS referring to the SPS")
("SingleLayerConstraintFlag", m_singleLayerConstraintFlag, false, "Indicate that the bitstream contains only one layer")
("AllLayersIndependentConstraintFlag", m_allLayersIndependentConstraintFlag, false, "Indicate that all layers are independent")
......@@ -1177,6 +1179,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("MatrixCoefficients", m_matrixCoefficients, 2, "Describes the matrix coefficients used in deriving luma and chroma from RGB primaries")
("ProgressiveSource", m_progressiveSourceFlag, false, "Indicate that source is progressive")
("InterlacedSource", m_interlacedSourceFlag, false, "Indicate that source is interlaced")
#if JVET_S0266_VUI_length
("NonPackedSource", m_nonPackedConstraintFlag, false, "Indicate that source does not contain frame packing")
("NonProjectedConstraintFlag", m_nonProjectedConstraintFlag, false, "Indicate that the bitstream contains projection SEI messages")
#endif
("ChromaLocInfoPresent", m_chromaLocInfoPresentFlag, false, "Signals whether chroma_sample_loc_type_top_field and chroma_sample_loc_type_bottom_field are present")
("ChromaSampleLocTypeTopField", m_chromaSampleLocTypeTopField, 0, "Specifies the location of chroma samples for top field")
("ChromaSampleLocTypeBottomField", m_chromaSampleLocTypeBottomField, 0, "Specifies the location of chroma samples for bottom field")
......@@ -1866,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))
{
......
......@@ -193,7 +193,9 @@ Picture::Picture()
m_spliceIdx = NULL;
m_ctuNums = 0;
layerId = NOT_VALID;
#if !JVET_S0258_SUBPIC_CONSTRAINTS
numSubpics = 1;
#endif
numSlices = 1;
}
......
......@@ -216,12 +216,17 @@ public:
int poc;
uint32_t temporalId;
int layerId;
#if JVET_S0258_SUBPIC_CONSTRAINTS
std::vector<SubPic> subPictures;
int numSlices;
#else
int numSubpics;
std::vector<int> subpicWidthInCTUs;
std::vector<int> subpicHeightInCTUs;
std::vector<int> subpicCtuTopLeftX;
std::vector<int> subpicCtuTopLeftY;
int numSlices;
#endif
std::vector<int> sliceSubpicIdx;
bool subLayerNonReferencePictureDueToSTSA;
......@@ -232,7 +237,9 @@ public:
std::vector<bool> m_lossylosslessSliceArray;
bool interLayerRefPicFlag;
#if !JVET_S0258_SUBPIC_CONSTRAINTS
std::vector<int> subPicIDs;
#endif
#if ENABLE_SPLIT_PARALLELISM
PelStorage m_bufs[PARL_SPLIT_MAX_NUM_JOBS][NUM_PIC_TYPES];
......
......@@ -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)
{
......@@ -4317,7 +4335,9 @@ bool Slice::checkRPR()
bool operator == (const ConstraintInfo& op1, const ConstraintInfo& op2)
{
#if !JVET_S0266_VUI_length
if( op1.m_nonPackedConstraintFlag != op2.m_nonPackedConstraintFlag ) return false;
#endif
if( op1.m_frameOnlyConstraintFlag != op2.m_frameOnlyConstraintFlag ) return false;
if( op1.m_intraOnlyConstraintFlag != op2.m_intraOnlyConstraintFlag ) return false;
if( op1.m_maxBitDepthConstraintIdc != op2.m_maxBitDepthConstraintIdc ) return false;
......
......@@ -238,8 +238,10 @@ class ConstraintInfo
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
bool m_gciPresentFlag;
#endif
#if !JVET_S0266_VUI_length
bool m_nonPackedConstraintFlag;
bool m_nonProjectedConstraintFlag;
#endif
bool m_noResChangeInClvsConstraintFlag;
bool m_oneTilePerPicConstraintFlag;
bool m_picHeaderInSliceHeaderConstraintFlag;
......@@ -305,12 +307,15 @@ public:
ConstraintInfo()
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
: m_gciPresentFlag(true)
#if !JVET_S0266_VUI_length
, m_nonPackedConstraintFlag(false)
, m_nonProjectedConstraintFlag(false)
#endif
#else
: m_nonPackedConstraintFlag (false)
#endif
, m_nonProjectedConstraintFlag(false)
, m_noResChangeInClvsConstraintFlag(false)
#endif
, m_oneTilePerPicConstraintFlag(false)
, m_picHeaderInSliceHeaderConstraintFlag(false)
, m_oneSlicePerPicConstraintFlag(false)
......@@ -378,8 +383,10 @@ public:
void setGciPresentFlag(bool b) { m_gciPresentFlag = b; }
#endif
#if !JVET_S0266_VUI_length
bool getNonPackedConstraintFlag() const { return m_nonPackedConstraintFlag; }
void setNonPackedConstraintFlag(bool b) { m_nonPackedConstraintFlag = b; }
#endif
bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
void setFrameOnlyConstraintFlag(bool b) { m_frameOnlyConstraintFlag = b; }
......@@ -390,8 +397,10 @@ public:
ChromaFormat getMaxChromaFormatConstraintIdc() const { return m_maxChromaFormatConstraintIdc; }
void setMaxChromaFormatConstraintIdc(ChromaFormat fmt) { m_maxChromaFormatConstraintIdc = fmt; }
#if !JVET_S0266_VUI_length
bool getNonProjectedConstraintFlag() const { return m_nonProjectedConstraintFlag; }
void setNonProjectedConstraintFlag(bool b) { m_nonProjectedConstraintFlag = b; }
#endif
bool getNoResChangeInClvsConstraintFlag() const { return m_noResChangeInClvsConstraintFlag; }
void setNoResChangeInClvsConstraintFlag(bool b) { m_noResChangeInClvsConstraintFlag = b; }
......@@ -1120,6 +1129,28 @@ public:
class VUI
{
private:
#if JVET_S0266_VUI_length
bool m_progressiveSourceFlag;
bool m_interlacedSourceFlag;
bool m_nonPackedFlag;
bool m_nonProjectedFlag;
bool m_aspectRatioInfoPresentFlag;
bool m_aspectRatioConstantFlag;
int m_aspectRatioIdc;
int m_sarWidth;
int m_sarHeight;
bool m_overscanInfoPresentFlag;
bool m_overscanAppropriateFlag;
bool m_colourDescriptionPresentFlag;
int m_colourPrimaries;
int m_transferCharacteristics;
int m_matrixCoefficients;
bool m_videoFullRangeFlag;
bool m_chromaLocInfoPresentFlag;
int m_chromaSampleLocTypeTopField;
int m_chromaSampleLocTypeBottomField;
int m_chromaSampleLocType;
#else
bool m_aspectRatioInfoPresentFlag;
bool m_aspectRatioConstantFlag;
int m_aspectRatioIdc;
......@@ -1138,9 +1169,32 @@ private:
bool m_overscanInfoPresentFlag;
bool m_overscanAppropriateFlag;
bool m_videoFullRangeFlag;
#endif
public:
VUI()
#if JVET_S0266_VUI_length
: m_progressiveSourceFlag (false) // Default values as documented in VVC D10 are used
, m_interlacedSourceFlag (false)
, m_nonPackedFlag (false)
, m_nonProjectedFlag (false)
, m_aspectRatioInfoPresentFlag (false)
, m_aspectRatioConstantFlag (false)
, m_aspectRatioIdc (0)
, m_sarWidth (0)
, m_sarHeight (0)
, m_overscanInfoPresentFlag (false)
, m_overscanAppropriateFlag (false)
, m_colourDescriptionPresentFlag (false)
, m_colourPrimaries (2)
, m_transferCharacteristics (2)
, m_matrixCoefficients (2)
, m_videoFullRangeFlag (false)
, m_chromaLocInfoPresentFlag (false)
, m_chromaSampleLocTypeTopField (6)
, m_chromaSampleLocTypeBottomField (6)
, m_chromaSampleLocType (6)
#else
: m_aspectRatioInfoPresentFlag (false) //TODO: This initialiser list contains magic numbers
, m_aspectRatioConstantFlag (true)
, m_aspectRatioIdc (0)
......@@ -1159,6 +1213,7 @@ public:
, m_overscanInfoPresentFlag (false)
, m_overscanAppropriateFlag (false)
, m_videoFullRangeFlag (false)
#endif
{}
virtual ~VUI() {}
......@@ -1195,6 +1250,14 @@ public:
bool getInterlacedSourceFlag() const { return m_interlacedSourceFlag; }
void setInterlacedSourceFlag(bool b) { m_interlacedSourceFlag = b; }
#if JVET_S0266_VUI_length
bool getNonPackedFlag() const { return m_nonPackedFlag; }
void setNonPackedFlag(bool b) { m_nonPackedFlag = b; }
bool getNonProjectedFlag() const { return m_nonProjectedFlag; }
void setNonProjectedFlag(bool b) { m_nonProjectedFlag = b; }
#endif
bool getChromaLocInfoPresentFlag() const { return m_chromaLocInfoPresentFlag; }
void setChromaLocInfoPresentFlag(bool i) { m_chromaLocInfoPresentFlag = i; }
......@@ -1394,6 +1457,9 @@ private:
bool m_fieldSeqFlag;
bool m_vuiParametersPresentFlag;
#if JVET_S0266_VUI_length
unsigned m_vuiPayloadSize;
#endif
VUI m_vuiParameters;
SPSRExt m_spsRangeExtension;
......@@ -1731,6 +1797,10 @@ void setCCALFEnabledFlag( bool b )
void setFieldSeqFlag(bool i) { m_fieldSeqFlag = i; }
bool getVuiParametersPresentFlag() const { return m_vuiParametersPresentFlag; }
void setVuiParametersPresentFlag(bool b) { m_vuiParametersPresentFlag = b; }
#if JVET_S0266_VUI_length
unsigned getVuiPayloadSize() const { return m_vuiPayloadSize; }
void setVuiPayloadSize(unsigned i) { m_vuiPayloadSize = i; }
#endif
VUI* getVuiParameters() { return &m_vuiParameters; }
const VUI* getVuiParameters() const { return &m_vuiParameters; }
const ProfileTierLevel* getProfileTierLevel() const { return &m_profileTierLevel; }
......
......@@ -55,10 +55,14 @@
#define JVET_S0133_PH_SYNTAX_OVERRIDE_ENC_FIX 1 // JVET-S0133: Encoder-only fix on the override of partition constriants in PH
#define JVET_S0266_VUI_length 1 // JVET-S0266: VUI modifications including signalling of VUI length
#define JVET_S0179_CONDITIONAL_SIGNAL_GCI 1 // JVET-S0179: Conditional signalling of GCI fields
#define JVET_S0049_ASPECT4 1 // JVET-S0049 aspect 4: Constrain the value of pps_alf_info_in_ph_flag to be equal to 0 when the PH is in the SH
#define JVET_S0258_SUBPIC_CONSTRAINTS 1 // JVET-S0258: sub-picture constraints
#define JVET_S0074_SPS_REORDER 1 // JVET-S0074: aspect 1, rearrange some syntax elements in SPS
#define JVET_S0234_ACT_CRS_FIX 1 // JVET-S0234: perform chroma residual scaling in RGB domain when ACT is on
......@@ -74,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
......@@ -91,6 +97,8 @@
#define JVET_S0186_SPS_CLEANUP 1 // JVET-S0186: Proposal 1, move sps_chroma_format_idc and sps_log2_ctu_size_minus5 to take place sps_reserved_zero_4bits
#define JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP 1 // JVET-S0181 Proposal2: Move signalling of bp_max_sublayers_minus1 and conditionally signal bp_cpb_removal_delay_deltas_present_flag, bp_num_cpb_removal_delay_deltas_minus1, and bp_cpb_removal_delay
//########### place macros to be be kept below this line ###############
#define JVET_S0257_DUMP_360SEI_MESSAGE 1 // Software support of 360 SEI messages
......
......@@ -155,18 +155,46 @@ bool CU::getRprScaling( const SPS* sps, const PPS* curPPS, Picture* refPic, int&
void CU::checkConformanceILRP(Slice *slice)
{
const int numRefList = (slice->getSliceType() == B_SLICE) ? (2) : (1);
const int numRefList = slice->isInterB() ? 2 : 1;
#if JVET_S0258_SUBPIC_CONSTRAINTS
int currentSubPicIdx = NOT_VALID;
// derive sub-picture index for the current slice
for( int subPicIdx = 0; subPicIdx < slice->getPic()->cs->sps->getNumSubPics(); subPicIdx++ )
{
if( slice->getPic()->cs->pps->getSubPic( subPicIdx ).getSubPicID() == slice->getSliceSubPicId() )
{
currentSubPicIdx = subPicIdx;
break;
}
}
CHECK( currentSubPicIdx == NOT_VALID, "Sub-picture was not found" );
if( !slice->getPic()->cs->sps->getSubPicTreatedAsPicFlag( currentSubPicIdx ) )
{
return;
}
#endif
//constraint 1: The picture referred to by each active entry in RefPicList[ 0 ] or RefPicList[ 1 ] has the same subpicture layout as the current picture
bool isAllRefSameSubpicLayout = true;
for (int refList = 0; refList < numRefList; refList++) // loop over l0 and l1
{
RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
for (int refIdx = 0; refIdx < slice->getNumRefIdx(eRefPicList); refIdx++)
{
#if JVET_S0258_SUBPIC_CONSTRAINTS
const Picture* refPic = slice->getRefPic( eRefPicList, refIdx );
if( refPic->subPictures.size() != slice->getPic()->cs->pps->getNumSubPics() )
#else
const Picture* refPic = slice->getRefPic(eRefPicList, refIdx)->unscaledPic;
if (refPic->numSubpics != slice->getPic()->cs->pps->getNumSubPics())
#endif
{
isAllRefSameSubpicLayout = false;
refList = numRefList;
......@@ -174,12 +202,26 @@ void CU::checkConformanceILRP(Slice *slice)
}
else
{
#if JVET_S0258_SUBPIC_CONSTRAINTS
for( int i = 0; i < refPic->subPictures.size(); i++ )
{
const SubPic& refSubPic = refPic->subPictures[i];
const SubPic& curSubPic = slice->getPic()->cs->pps->getSubPic( i );
if( refSubPic.getSubPicWidthInCTUs() != curSubPic.getSubPicWidthInCTUs()
|| refSubPic.getSubPicHeightInCTUs() != curSubPic.getSubPicHeightInCTUs()
|| refSubPic.getSubPicCtuTopLeftX() != curSubPic.getSubPicCtuTopLeftX()
|| refSubPic.getSubPicCtuTopLeftY() != curSubPic.getSubPicCtuTopLeftY()
|| ( refPic->layerId != slice->getPic()->layerId && refSubPic.getSubPicID() != curSubPic.getSubPicID() )
|| refSubPic.getTreatedAsPicFlag() != curSubPic.getTreatedAsPicFlag())
#else
for (int i = 0; i < refPic->numSubpics; i++)
{
if (refPic->subpicWidthInCTUs[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicWidthInCTUs()
|| refPic->subpicHeightInCTUs[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicHeightInCTUs()
|| refPic->subpicCtuTopLeftX[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicCtuTopLeftX()
|| refPic->subpicCtuTopLeftY[i] != slice->getPic()->cs->pps->getSubPic(i).getSubPicCtuTopLeftY())
#endif
{
isAllRefSameSubpicLayout = false;
refIdx = slice->getNumRefIdx(eRefPicList);
......@@ -187,6 +229,14 @@ void CU::checkConformanceILRP(Slice *slice)
break;
}
}
#if JVET_S0258_SUBPIC_CONSTRAINTS
// A picture with different sub-picture ID of the collocated sub-picture cannot be used as an active reference picture in the same layer
if( refPic->layerId == slice->getPic()->layerId )
{
isAllRefSameSubpicLayout = isAllRefSameSubpicLayout && refPic->subPictures[currentSubPicIdx].getSubPicID() == slice->getSliceSubPicId();
}
#endif
}
}
}
......@@ -199,8 +249,13 @@ void CU::checkConformanceILRP(Slice *slice)
RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
for (int refIdx = 0; refIdx < slice->getNumRefIdx(eRefPicList); refIdx++)
{
#if JVET_S0258_SUBPIC_CONSTRAINTS
const Picture* refPic = slice->getRefPic( eRefPicList, refIdx );
CHECK( refPic->layerId == slice->getPic()->layerId || refPic->subPictures.size() > 1, "The inter-layer reference shall contain a single subpicture or have same subpicture layout with the current picture" );
#else
const Picture* refPic = slice->getRefPic(eRefPicList, refIdx)->unscaledPic;
CHECK(!(refPic->layerId != slice->getPic()->layerId && refPic->numSubpics == 1), "The inter-layer reference shall contain a single subpicture or have same subpicture layout with the current picture");
#endif
}
}
}
......
......@@ -2223,6 +2223,14 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
checkPicTypeAfterEos();
#endif
// store sub-picture numbers, sizes, and locations with a picture
#if JVET_S0258_SUBPIC_CONSTRAINTS
pcSlice->getPic()->subPictures.clear();
for( int subPicIdx = 0; subPicIdx < sps->getNumSubPics(); subPicIdx++ )
{
pcSlice->getPic()->subPictures.push_back( pps->getSubPic( subPicIdx ) );
}
#else
pcSlice->getPic()->numSubpics = sps->getNumSubPics();
pcSlice->getPic()->subpicWidthInCTUs.clear();
pcSlice->getPic()->subpicHeightInCTUs.clear();
......@@ -2235,6 +2243,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
pcSlice->getPic()->subpicCtuTopLeftX.push_back(pps->getSubPic(subPicIdx).getSubPicCtuTopLeftX());
pcSlice->getPic()->subpicCtuTopLeftY.push_back(pps->getSubPic(subPicIdx).getSubPicCtuTopLeftY());
}
#endif
pcSlice->getPic()->numSlices = pps->getNumSlicesInPic();
pcSlice->getPic()->sliceSubpicIdx.clear();
}
......@@ -2255,6 +2264,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
pcSlice->scaleRefPicList( scaledRefPic, m_pcPic->cs->picHeader, m_parameterSetManager.getAPSs(), m_picHeader.getLmcsAPS(), m_picHeader.getScalingListAPS(), true );
#if !JVET_S0258_SUBPIC_CONSTRAINTS
// For each value of i in the range of 0 to sps_num_subpics_minus1, inclusive, when the value of SubpicIdVal[ i ] of a current picture is not equal to the value of SubpicIdVal[ i ] of a reference picture,
// the active entries of the RPLs of the coded slices in the i-th subpicture of the current picture shall not include that reference picture.
......@@ -2301,6 +2311,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
}
}
}
#endif
if (!pcSlice->isIntra())
{
......
......@@ -127,7 +127,11 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
DTRACE( g_trace_ctx, D_HEADER, "=========== POC: %d ===========\n", slice->getPOC() );
#if JVET_S0258_SUBPIC_CONSTRAINTS
if( slice->getSliceType() != I_SLICE && slice->getRefPic( REF_PIC_LIST_0, 0 )->subPictures.size() > 1 )
#else
if (slice->getSliceType() != I_SLICE && slice->getRefPic(REF_PIC_LIST_0, 0)->numSubpics > 1)
#endif
{
clipMv = clipMvInSubpic;
}
......@@ -166,7 +170,12 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
for (int idx = 0; idx < n; idx++)
{
Picture *refPic = slice->getRefPic((RefPicList)rlist, idx);
#if JVET_S0258_SUBPIC_CONSTRAINTS
if( !refPic->getSubPicSaved() && refPic->subPictures.size() > 1 )
#else
if (!refPic->getSubPicSaved() && refPic->numSubpics > 1)
#endif
{
refPic->saveSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
refPic->extendSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
......
......@@ -707,7 +707,21 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo
sei_read_code( pDecodedMessageOutputStream, ( sei.m_cpbRemovalDelayLength ), code, "au_cpb_removal_delay_delta_minus1" );
sei.m_auCpbRemovalDelayDelta = code + 1;
#if JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP
sei_read_code(pDecodedMessageOutputStream, 3, code, "bp_max_sub_layers_minus1");
sei.m_bpMaxSubLayers = code + 1;
if (sei.m_bpMaxSubLayers - 1 > 0)
{
sei_read_flag(pDecodedMessageOutputStream, code, "cpb_removal_delay_deltas_present_flag");
sei.m_cpbRemovalDelayDeltasPresentFlag = code;
}
else
{
sei.m_cpbRemovalDelayDeltasPresentFlag = false;
}
#else
sei_read_flag( pDecodedMessageOutputStream, code, "cpb_removal_delay_deltas_present_flag" ); sei.m_cpbRemovalDelayDeltasPresentFlag = code;
#endif
if (sei.m_cpbRemovalDelayDeltasPresentFlag)
{
sei_read_uvlc( pDecodedMessageOutputStream, code, "num_cpb_removal_delay_deltas_minus1" ); sei.m_numCpbRemovalDelayDeltas = code + 1;
......@@ -717,8 +731,10 @@ void SEIReader::xParseSEIBufferingPeriod(SEIBufferingPeriod& sei, uint32_t paylo
sei.m_cpbRemovalDelayDelta[ i ] = code;
}
}
#if !JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP
sei_read_code( pDecodedMessageOutputStream, 3, code, "bp_max_sub_layers_minus1" ); sei.m_bpMaxSubLayers = code + 1;
sei_read_uvlc( pDecodedMessageOutputStream, code, "bp_cpb_cnt_minus1" ); sei.m_bpCpbCnt = code + 1;
#endif
#if JVET_S0181_PROPOSAL1
if (sei.m_bpMaxSubLayers - 1 > 0)
{
......
......@@ -1097,12 +1097,20 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
#if ENABLE_TRACING
DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n");
#endif
#if JVET_S0266_VUI_length
unsigned vuiPayloadSize = pcSPS->getVuiPayloadSize();
InputBitstream *bs = getBitstream();
setBitstream(bs->extractSubstream(vuiPayloadSize * 8));
#endif
uint32_t symbol;
READ_FLAG(symbol, "vui_general_progressive_source_flag" ); pcVUI->setProgressiveSourceFlag(symbol ? true : false);
READ_FLAG(symbol, "vui_general_interlaced_source_flag" ); pcVUI->setInterlacedSourceFlag(symbol ? true : false);
READ_FLAG(symbol, "vui_progressive_source_flag" ); pcVUI->setProgressiveSourceFlag(symbol ? true : false);
READ_FLAG(symbol, "vui_interlaced_source_flag" ); pcVUI->setInterlacedSourceFlag(symbol ? true : false);
#if JVET_S0266_VUI_length
READ_FLAG(symbol, "vui_non_packed_constraint_flag"); pcVUI->setNonPackedFlag(symbol ? true : false);
READ_FLAG(symbol, "vui_non_projected_constraint_flag"); pcVUI->setNonProjectedFlag(symbol ? true : false);
#endif
READ_FLAG( symbol, "vui_aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(symbol);
if (pcVUI->getAspectRatioInfoPresentFlag())
{
......@@ -1127,7 +1135,7 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
READ_CODE(8, symbol, "vui_colour_primaries"); pcVUI->setColourPrimaries(symbol);
READ_CODE(8, symbol, "vui_transfer_characteristics"); pcVUI->setTransferCharacteristics(symbol);
READ_CODE(8, symbol, "vui_matrix_coeffs"); pcVUI->setMatrixCoefficients(symbol);
READ_FLAG( symbol, "vui_video_full_range_flag"); pcVUI->setVideoFullRangeFlag(symbol);
READ_FLAG( symbol, "vui_full_range_flag"); pcVUI->setVideoFullRangeFlag(symbol);
}
READ_FLAG( symbol, "vui_chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(symbol);
......@@ -1144,6 +1152,40 @@ void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
}
}
#if JVET_S0266_VUI_length
int payloadBitsRem = getBitstream()->getNumBitsLeft();
if(payloadBitsRem) //Corresponds to more_data_in_payload()
{
while(payloadBitsRem > 9) //payload_extension_present()
{
READ_CODE(1, symbol, "vui_reserved_payload_extension_data");
payloadBitsRem--;
}
int finalBits = getBitstream()->peekBits(payloadBitsRem);
int numFinalZeroBits = 0;
int mask = 0xff;
while(finalBits & (mask >> numFinalZeroBits))
{
numFinalZeroBits++;
}
while(payloadBitsRem > 9-numFinalZeroBits) //payload_extension_present()
{
READ_CODE(1, symbol, "vui_reserved_payload_extension_data");
payloadBitsRem--;
}
READ_FLAG(symbol, "vui_payload_bit_equal_to_one");
CHECK(symbol != 1, "vui_payload_bit_equal_to_one not equal to 1");
payloadBitsRem--;
while(payloadBitsRem)
{
READ_FLAG(symbol, "vui_payload_bit_equal_to_zero");
CHECK(symbol != 0, "vui_payload_bit_equal_to_zero not equal to 0");
payloadBitsRem--;
}
}
delete getBitstream();
setBitstream(bs);
#endif
}
void HLSyntaxReader::parseGeneralHrdParameters(GeneralHrdParams *hrd)
......@@ -2031,6 +2073,15 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
if (pcSPS->getVuiParametersPresentFlag())
{
#if JVET_S0266_VUI_length
READ_UVLC(uiCode, "sps_vui_payload_size_minus1");
pcSPS->setVuiPayloadSize(uiCode+1);
while (!isByteAligned())
{
READ_FLAG(uiCode, "sps_vui_alignment_zero_bit");
CHECK(uiCode != 0, "sps_vui_alignment_zero_bit not equal to 0");
}
#endif
parseVUI(pcSPS->getVuiParameters(), pcSPS);
}
......@@ -4366,9 +4417,13 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo)
if (cinfo->getGciPresentFlag())
{
#endif
#if !JVET_S0266_VUI_length
READ_FLAG(symbol, "general_non_packed_constraint_flag" ); cinfo->setNonPackedConstraintFlag(symbol ? true : false);
#endif
READ_FLAG(symbol, "general_frame_only_constraint_flag" ); cinfo->setFrameOnlyConstraintFlag(symbol ? true : false);
#if !JVET_S0266_VUI_length
READ_FLAG(symbol, "general_non_projected_constraint_flag" ); cinfo->setNonProjectedConstraintFlag(symbol ? true : false);
#endif
READ_FLAG(symbol, "general_one_picture_only_constraint_flag" ); cinfo->setOnePictureOnlyConstraintFlag(symbol ? true : false);
READ_FLAG(symbol, "intra_only_constraint_flag" ); cinfo->setIntraOnlyConstraintFlag(symbol ? true : false);
......
......@@ -2265,6 +2265,14 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
pcSlice->constructRefPicList(rcListPic);
// store sub-picture numbers, sizes, and locations with a picture
#if JVET_S0258_SUBPIC_CONSTRAINTS
pcSlice->getPic()->subPictures.clear();
for( int subPicIdx = 0; subPicIdx < pcPic->cs->pps->getNumSubPics(); subPicIdx++ )
{
pcSlice->getPic()->subPictures.push_back( pcPic->cs->pps->getSubPic( subPicIdx ) );
}
#else
pcSlice->getPic()->numSubpics = pcPic->cs->pps->getNumSubPics();
pcSlice->getPic()->subpicWidthInCTUs.clear();
pcSlice->getPic()->subpicHeightInCTUs.clear();
......@@ -2277,6 +2285,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
pcSlice->getPic()->subpicCtuTopLeftX.push_back(pcPic->cs->pps->getSubPic(subPicIdx).getSubPicCtuTopLeftX());
pcSlice->getPic()->subpicCtuTopLeftY.push_back(pcPic->cs->pps->getSubPic(subPicIdx).getSubPicCtuTopLeftY());
}
#endif
const VPS* vps = pcPic->cs->vps;
int layerIdx = vps == nullptr ? 0 : vps->getGeneralLayerIdx(pcPic->layerId);
......@@ -2801,7 +2810,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
}
m_pcSliceEncoder->setLosslessSlice(pcPic, isLossless);
#if JVET_S0258_SUBPIC_CONSTRAINTS
if( pcSlice->getSliceType() != I_SLICE && pcSlice->getRefPic( REF_PIC_LIST_0, 0 )->subPictures.size() > 1 )
#else
if (pcSlice->getSliceType() != I_SLICE && pcSlice->getRefPic(REF_PIC_LIST_0, 0)->numSubpics > 1)
#endif
{
clipMv = clipMvInSubpic;
m_pcEncLib->getInterSearch()->setClipMvInSubPic(true);
......
......@@ -1119,8 +1119,10 @@ void EncLib::xInitSPS( SPS& sps )
#if JVET_S0179_CONDITIONAL_SIGNAL_GCI
cinfo->setGciPresentFlag(m_gciPresentFlag);
#endif
#if !JVET_S0266_VUI_length
cinfo->setNonPackedConstraintFlag (m_nonPackedConstraintFlag);
cinfo->setNonProjectedConstraintFlag(m_nonProjectedConstraintFlag);
#endif
cinfo->setNoResChangeInClvsConstraintFlag(m_noResChangeInClvsConstraintFlag);
cinfo->setOneTilePerPicConstraintFlag(m_oneTilePerPicConstraintFlag);
cinfo->setPicHeaderInSliceHeaderConstraintFlag(m_picHeaderInSliceHeaderConstraintFlag);
......@@ -1350,6 +1352,10 @@ void EncLib::xInitSPS( SPS& sps )
pcVUI->setMatrixCoefficients(getMatrixCoefficients());
pcVUI->setProgressiveSourceFlag (getProgressiveSourceFlag());
pcVUI->setInterlacedSourceFlag (getInterlacedSourceFlag());
#if JVET_S0266_VUI_length
pcVUI->setNonPackedFlag (getNonPackedConstraintFlag());
pcVUI->setNonProjectedFlag (getNonProjectedConstraintFlag());
#endif
pcVUI->setChromaLocInfoPresentFlag(getChromaLocInfoPresentFlag());
pcVUI->setChromaSampleLocTypeTopField(getChromaSampleLocTypeTopField());
pcVUI->setChromaSampleLocTypeBottomField(getChromaSampleLocTypeBottomField());
......
......@@ -1553,7 +1553,12 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
for (int idx = 0; idx < n; idx++)
{
Picture *refPic = pcSlice->getRefPic((RefPicList)rlist, idx);
#if JVET_S0258_SUBPIC_CONSTRAINTS
if( !refPic->getSubPicSaved() && refPic->subPictures.size() > 1 )
#else
if (!refPic->getSubPicSaved() && refPic->numSubpics > 1)
#endif
{
refPic->saveSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
refPic->extendSubPicBorder(refPic->getPOC(), subPicX, subPicY, subPicWidth, subPicHeight);
......
......@@ -296,7 +296,17 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei)
CHECK (sei.m_auCpbRemovalDelayDelta < 1, "sei.m_auCpbRemovalDelayDelta must be > 0");
WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, sei.m_cpbRemovalDelayLength, "au_cpb_removal_delay_delta_minus1" );
WRITE_FLAG( sei.m_cpbRemovalDelayDeltasPresentFlag, "cpb_removal_delay_deltas_present_flag");
#if JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP
CHECK(sei.m_bpMaxSubLayers < 1, "bp_max_sub_layers_minus1 must be > 0");
WRITE_CODE(sei.m_bpMaxSubLayers - 1, 3, "bp_max_sub_layers_minus1");
if (sei.m_bpMaxSubLayers - 1 > 0)
{
WRITE_FLAG(sei.m_cpbRemovalDelayDeltasPresentFlag, "cpb_removal_delay_deltas_present_flag");
}
#else
WRITE_FLAG(sei.m_cpbRemovalDelayDeltasPresentFlag, "cpb_removal_delay_deltas_present_flag");
#endif
if (sei.m_cpbRemovalDelayDeltasPresentFlag)
{
CHECK (sei.m_numCpbRemovalDelayDeltas < 1, "m_numCpbRemovalDelayDeltas must be > 0");
......@@ -305,8 +315,10 @@ void SEIWriter::xWriteSEIBufferingPeriod(const SEIBufferingPeriod& sei)
{
WRITE_CODE( sei.m_cpbRemovalDelayDelta[i], sei.m_cpbRemovalDelayLength, "cpb_removal_delay_delta[i]" );
}
#if !JVET_S0181_PROPOSAL2_BUFFERING_PERIOD_CLEANUP
CHECK (sei.m_bpMaxSubLayers < 1, "bp_max_sub_layers_minus1 must be > 0");
WRITE_CODE( sei.m_bpMaxSubLayers - 1, 3, "bp_max_sub_layers_minus1" );
#endif
}
CHECK (sei.m_bpCpbCnt < 1, "sei.m_bpCpbCnt must be > 0");
WRITE_UVLC( sei.m_bpCpbCnt - 1, "bp_cpb_cnt_minus1");
......
......@@ -651,12 +651,19 @@ void HLSWriter::codeScalingListAps( APS* pcAPS )
void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
{
#if ENABLE_TRACING
if( g_HLSTraceEnable )
{
DTRACE( g_trace_ctx, D_HEADER, "----------- vui_parameters -----------\n");
}
#endif
WRITE_FLAG(pcVUI->getProgressiveSourceFlag(), "vui_general_progressive_source_flag" );
WRITE_FLAG(pcVUI->getInterlacedSourceFlag(), "vui_general_interlaced_source_flag" );
WRITE_FLAG(pcVUI->getProgressiveSourceFlag(), "vui_progressive_source_flag" );
WRITE_FLAG(pcVUI->getInterlacedSourceFlag(), "vui_interlaced_source_flag" );
#if JVET_S0266_VUI_length
WRITE_FLAG(pcVUI->getNonPackedFlag(), "vui_non_packed_constraint_flag");
WRITE_FLAG(pcVUI->getNonProjectedFlag(), "vui_non_projected_constraint_flag");
#endif
WRITE_FLAG(pcVUI->getAspectRatioInfoPresentFlag(), "vui_aspect_ratio_info_present_flag");
if (pcVUI->getAspectRatioInfoPresentFlag())
{
......@@ -679,7 +686,7 @@ void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
WRITE_CODE(pcVUI->getColourPrimaries(), 8, "vui_colour_primaries");
WRITE_CODE(pcVUI->getTransferCharacteristics(), 8, "vui_transfer_characteristics");
WRITE_CODE(pcVUI->getMatrixCoefficients(), 8, "vui_matrix_coeffs");
WRITE_FLAG(pcVUI->getVideoFullRangeFlag(), "vui_video_full_range_flag");
WRITE_FLAG(pcVUI->getVideoFullRangeFlag(), "vui_full_range_flag");
}
WRITE_FLAG(pcVUI->getChromaLocInfoPresentFlag(), "vui_chroma_loc_info_present_flag");
if (pcVUI->getChromaLocInfoPresentFlag())
......@@ -694,6 +701,16 @@ void HLSWriter::codeVUI( const VUI *pcVUI, const SPS* pcSPS )
WRITE_UVLC(pcVUI->getChromaSampleLocTypeBottomField(), "vui_chroma_sample_loc_type_bottom_field");
}
}
#if JVET_S0266_VUI_length
if(!isByteAligned())
{
WRITE_FLAG(1, "vui_payload_bit_equal_to_one");
while(!isByteAligned())
{
WRITE_FLAG(0, "vui_payload_bit_equal_to_zero");
}
}
#endif
}
void HLSWriter::codeGeneralHrdparameters(const GeneralHrdParams * hrd)
......@@ -1252,6 +1269,27 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(), "vui_parameters_present_flag" );
if (pcSPS->getVuiParametersPresentFlag())
{
#if JVET_S0266_VUI_length
OutputBitstream *bs = getBitstream();
OutputBitstream bs_count;
setBitstream(&bs_count);
#if ENABLE_TRACING
bool traceEnable = g_HLSTraceEnable;
g_HLSTraceEnable = false;
#endif
codeVUI(pcSPS->getVuiParameters(), pcSPS);
#if ENABLE_TRACING
g_HLSTraceEnable = traceEnable;
#endif
unsigned vui_payload_data_num_bits = bs_count.getNumberOfWrittenBits();
CHECK( vui_payload_data_num_bits % 8 != 0, "Invalid number of VUI payload data bits" );
setBitstream(bs);
WRITE_UVLC((vui_payload_data_num_bits >> 3) - 1, "sps_vui_payload_size_minus1");
while (!isByteAligned())
{
WRITE_FLAG(0, "sps_vui_alignment_zero_bit");
}
#endif
codeVUI(pcSPS->getVuiParameters(), pcSPS);
}
......@@ -2531,9 +2569,13 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo )
if (cinfo->getGciPresentFlag())
{
#endif
#if !JVET_S0266_VUI_length
WRITE_FLAG(cinfo->getNonPackedConstraintFlag(), "general_non_packed_constraint_flag" );
#endif
WRITE_FLAG(cinfo->getFrameOnlyConstraintFlag(), "general_frame_only_constraint_flag" );
#if !JVET_S0266_VUI_length
WRITE_FLAG(cinfo->getNonProjectedConstraintFlag(), "general_non_projected_constraint_flag");
#endif
WRITE_FLAG(cinfo->getOnePictureOnlyConstraintFlag(), "general_one_picture_only_constraint_flag" );
WRITE_FLAG(cinfo->getIntraOnlyConstraintFlag(), "intra_only_constraint_flag" );
......
......@@ -77,6 +77,9 @@ protected:
virtual ~VLCWriter() {}
void setBitstream ( OutputBitstream* p ) { m_pcBitIf = p; }
#if JVET_S0266_VUI_length
OutputBitstream* getBitstream( ) { return m_pcBitIf; }
#endif
void xWriteSCode ( int code, uint32_t length );
void xWriteCode ( uint32_t uiCode, uint32_t uiLength );
void xWriteUvlc ( uint32_t uiCode );
......