Commit 05aa4452 authored by Karsten Suehring's avatar Karsten Suehring

Merge branch 'R0059_CLEANUP' into 'master'

JVET-R0059 Aspect 2: condition the signalling of ltrp_in_header_flag[ listIdx ][ rplsIdx ]

See merge request jvet/VVCSoftware_VTM!1548
parents 8c599292 8a177028
......@@ -51,6 +51,8 @@
#include <cassert>
//########### place macros to be removed in next cycle below this line ###############
#define JVET_R0059_RPL_CLEANUP 1 // JVET-R0059 aspect 2: Condition the signalling of ltrp_in_header_flag[ listIdx ][ rplsIdx ].
#define JVET_R0202_WHEN_PH_IN_SH_INFO_FLAGS_EQUAL_0 1 // JVET-R0202 When sh_picture_header_in_slice_header_flag is equal to 1, rpl_info_in_ph_flag, dbf_info_in_ph_flag, sao_info_in_ph_flag, wp_info_in_ph_flag, qp_delta_info_in_ph_flag shall be be equal to 0
#define JVET_R0202_WHEN_PH_IN_SH_NO_SUBPIC_SEPARATE_COLOR 1 // JVET-R0202 Add constraints when sh_picture_header_in_slice_header_flag equal to 1 sps_subpic_info_present_flag and separate_colour_plane_flag shall be equal to 0
......
......@@ -315,7 +315,11 @@ void HLSyntaxReader::copyRefPicList(SPS* sps, ReferencePictureList* source_rpl,
}
}
#if JVET_R0059_RPL_CLEANUP
void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl, int rplIdx)
#else
void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
#endif
{
uint32_t code;
READ_UVLC(code, "num_ref_entries[ listIdx ][ rplsIdx ]");
......@@ -324,11 +328,21 @@ void HLSyntaxReader::parseRefPicList(SPS* sps, ReferencePictureList* rpl)
uint32_t numLtrp = 0;
uint32_t numIlrp = 0;
#if JVET_R0059_RPL_CLEANUP
if (sps->getLongTermRefsPresent() && rplIdx != -1)
#else
if (sps->getLongTermRefsPresent())
#endif
{
READ_FLAG(code, "ltrp_in_slice_header_flag[ listIdx ][ rplsIdx ]");
rpl->setLtrpInSliceHeaderFlag(code);
}
#if JVET_R0059_RPL_CLEANUP
else if(sps->getLongTermRefsPresent())
{
rpl->setLtrpInSliceHeaderFlag( 1 );
}
#endif
bool isLongTerm;
int prevDelta = MAX_INT;
......@@ -1460,7 +1474,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
for (uint32_t ii = 0; ii < numberOfRPL; ii++)
{
rpl = rplList->getReferencePictureList(ii);
#if JVET_R0059_RPL_CLEANUP
parseRefPicList(pcSPS, rpl, ii);
#else
parseRefPicList(pcSPS, rpl);
#endif
}
//Read candidate for List1
......@@ -1473,7 +1491,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
for (uint32_t ii = 0; ii < numberOfRPL; ii++)
{
rpl = rplList->getReferencePictureList(ii);
#if JVET_R0059_RPL_CLEANUP
parseRefPicList(pcSPS, rpl, ii);
#else
parseRefPicList(pcSPS, rpl);
#endif
}
}
else
......@@ -2530,7 +2552,11 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag
{
ReferencePictureList* rpl = picHeader->getLocalRPL( listIdx );
(*rpl) = ReferencePictureList();
#if JVET_R0059_RPL_CLEANUP
parseRefPicList(sps, rpl, -1);
#else
parseRefPicList(sps, rpl);
#endif
picHeader->setRPLIdx(listIdx, -1);
picHeader->setRPL(listIdx, rpl);
}
......@@ -3394,7 +3420,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
{
ReferencePictureList* rpl0 = pcSlice->getLocalRPL0();
(*rpl0) = ReferencePictureList();
#if JVET_R0059_RPL_CLEANUP
parseRefPicList(sps, rpl0, -1);
#else
parseRefPicList(sps, rpl0);
#endif
pcSlice->setRPL0idx(-1);
pcSlice->setRPL0(rpl0);
}
......@@ -3500,7 +3530,11 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par
{
ReferencePictureList* rpl1 = pcSlice->getLocalRPL1();
(*rpl1) = ReferencePictureList();
#if JVET_R0059_RPL_CLEANUP
parseRefPicList(sps, rpl1, -1);
#else
parseRefPicList(sps, rpl1);
#endif
pcSlice->setRPL1idx(-1);
pcSlice->setRPL1(rpl1);
}
......
......@@ -152,7 +152,11 @@ public:
protected:
void copyRefPicList(SPS* pcSPS, ReferencePictureList* source_rpl, ReferencePictureList* dest_rpl);
#if JVET_R0059_RPL_CLEANUP
void parseRefPicList(SPS* pcSPS, ReferencePictureList* rpl, int rplIdx);
#else
void parseRefPicList(SPS* pcSPS, ReferencePictureList* rpl);
#endif
public:
void setBitstream ( InputBitstream* p ) { m_pcBitstream = p; }
......
......@@ -5219,7 +5219,11 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL
int numPics = numOfLTRPL0 + numOfSTRPL0;
pLocalRPL0->setNumberOfActivePictures( ( numPics < rpl0->getNumberOfActivePictures() ? numPics : rpl0->getNumberOfActivePictures() ) + numOfILRPL0 );
#if JVET_R0059_RPL_CLEANUP
pLocalRPL0->setLtrpInSliceHeaderFlag( 1 );
#else
pLocalRPL0->setLtrpInSliceHeaderFlag( rpl0->getLtrpInSliceHeaderFlag() );
#endif
slice->setRPL0idx( -1 );
slice->setRPL0( pLocalRPL0 );
......@@ -5263,7 +5267,11 @@ void EncGOP::xCreateExplicitReferencePictureSetFromReference( Slice* slice, PicL
numPics = numOfLTRPL1 + numOfSTRPL1;
pLocalRPL1->setNumberOfActivePictures( ( isDisallowMixedRefPic ? numPics : ( numPics < rpl1->getNumberOfActivePictures() ? numPics : rpl1->getNumberOfActivePictures() ) ) + numOfILRPL1 );
#if JVET_R0059_RPL_CLEANUP
pLocalRPL1->setLtrpInSliceHeaderFlag( 1 );
#else
pLocalRPL1->setLtrpInSliceHeaderFlag( rpl1->getLtrpInSliceHeaderFlag() );
#endif
slice->setRPL1idx( -1 );
slice->setRPL1( pLocalRPL1 );
}
......
......@@ -179,12 +179,20 @@ void AUDWriter::codeAUD(OutputBitstream& bs, const int pictureType)
xWriteRbspTrailingBits();
}
void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc )
#if JVET_R0059_RPL_CLEANUP
void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc, int rplIdx)
#else
void HLSWriter::xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc)
#endif
{
uint32_t numRefPic = rpl->getNumberOfShorttermPictures() + rpl->getNumberOfLongtermPictures() + rpl->getNumberOfInterLayerPictures();
WRITE_UVLC( numRefPic, "num_ref_entries[ listIdx ][ rplsIdx ]" );
#if JVET_R0059_RPL_CLEANUP
if (isLongTermPresent && rplIdx != -1)
#else
if (isLongTermPresent)
#endif
{
WRITE_FLAG(rpl->getLtrpInSliceHeaderFlag(), "ltrp_in_slice_header_flag[ listIdx ][ rplsIdx ]");
}
......@@ -893,7 +901,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
for (int ii = 0; ii < numberOfRPL; ii++)
{
const ReferencePictureList* rpl = rplList0->getReferencePictureList(ii);
xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred() );
#if JVET_R0059_RPL_CLEANUP
xCodeRefPicList(rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred(), ii);
#else
xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred());
#endif
}
//Write candidate for List1
......@@ -904,7 +916,11 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
for (int ii = 0; ii < numberOfRPL; ii++)
{
const ReferencePictureList* rpl = rplList1->getReferencePictureList(ii);
xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred() );
#if JVET_R0059_RPL_CLEANUP
xCodeRefPicList(rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred(), ii);
#else
xCodeRefPicList( rpl, pcSPS->getLongTermRefsPresent(), pcSPS->getBitsForPOC(), !pcSPS->getUseWP() && !pcSPS->getUseWPBiPred());
#endif
}
}
if( pcSPS->getChromaFormatIdc() != CHROMA_400 )
......@@ -1642,7 +1658,11 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB
// explicit RPL in picture header
else
{
xCodeRefPicList( picHeader->getRPL(listIdx), sps->getLongTermRefsPresent(), sps->getBitsForPOC(), !sps->getUseWP() && !sps->getUseWPBiPred() );
#if JVET_R0059_RPL_CLEANUP
xCodeRefPicList( picHeader->getRPL(listIdx), sps->getLongTermRefsPresent(), sps->getBitsForPOC(), !sps->getUseWP() && !sps->getUseWPBiPred(), -1);
#else
xCodeRefPicList( picHeader->getRPL(listIdx), sps->getLongTermRefsPresent(), sps->getBitsForPOC(), !sps->getUseWP() && !sps->getUseWPBiPred());
#endif
}
// POC MSB cycle signalling for LTRP
......@@ -2127,7 +2147,11 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
}
else
{ //write local RPL0
xCodeRefPicList( pcSlice->getRPL0(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred() );
#if JVET_R0059_RPL_CLEANUP
xCodeRefPicList( pcSlice->getRPL0(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred(), -1);
#else
xCodeRefPicList( pcSlice->getRPL0(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred());
#endif
}
//Deal POC Msb cycle signalling for LTRP
if (pcSlice->getRPL0()->getNumberOfLongtermPictures())
......@@ -2188,7 +2212,11 @@ void HLSWriter::codeSliceHeader ( Slice* pcSlice )
}
else
{ //write local RPL1
xCodeRefPicList( pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred() );
#if JVET_R0059_RPL_CLEANUP
xCodeRefPicList( pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred(), -1);
#else
xCodeRefPicList( pcSlice->getRPL1(), pcSlice->getSPS()->getLongTermRefsPresent(), pcSlice->getSPS()->getBitsForPOC(), !pcSlice->getSPS()->getUseWP() && !pcSlice->getSPS()->getUseWPBiPred());
#endif
}
//Deal POC Msb cycle signalling for LTRP
if (pcSlice->getRPL1()->getNumberOfLongtermPictures())
......
......@@ -113,7 +113,11 @@ public:
virtual ~HLSWriter() {}
private:
void xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc );
#if JVET_R0059_RPL_CLEANUP
void xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc, int rplIdx);
#else
void xCodeRefPicList( const ReferencePictureList* rpl, bool isLongTermPresent, uint32_t ltLsbBitsCount, const bool isForbiddenZeroDeltaPoc);
#endif
bool xFindMatchingLTRP ( Slice* pcSlice, uint32_t *ltrpsIndex, int ltrpPOC, bool usedFlag );
void xCodePredWeightTable ( Slice* pcSlice );
void xCodePredWeightTable ( PicHeader *picHeader, const SPS *sps );
......
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