...
 
Commits (50)
......@@ -82,7 +82,7 @@ SBT : 1
LFNST : 1
ISP : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -105,7 +105,7 @@ MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -106,7 +106,7 @@ SBT : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -118,7 +118,7 @@ LFNST : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -134,7 +134,7 @@ LFNST : 1
ISP : 1
MMVD : 1
Affine : 1
SubPuMvp : 1
SbTMVP : 1
MaxNumMergeCand : 6
LMChroma : 1 # use CCLM only
DepQuant : 1
......
......@@ -3,10 +3,10 @@ MaxLayers : 2
MaxSublayers : 1
AllLayersSameNumSublayersFlag : 0
AllIndependentLayersFlag : 0
AllowablePredDirection : 1 1 1 1 1 # equal to 0 specifies the picture in the i-th temporal layer is allowed to use both inter-layer and intra-layer preditions
# equal to 1 specifies the picture in the i-th temporal layer is allowed to use inter-layer predition only
# equal to 2 specifies the picture in the i-th temporal layer is allowed to use intra-layer predition only
AllowablePredDirection : 1 1 1 1 1 # equal to 0 specifies the picture in the i-th temporal layer is allowed to use both inter-layer and intra-layer preditions
# equal to 1 specifies the picture in the i-th temporal layer is allowed to use inter-layer predition only
# equal to 2 specifies the picture in the i-th temporal layer is allowed to use intra-layer predition only
#======== OLSs ===============
EachLayerIsAnOlsFlag : 0
OlsModeIdc : 2
......
SEISubpicLevelInfoEnabled: 1
SEISubpicLevelInfoRefLevels: 4.1 # list of levels to be included
SEISubpicLevelInfoExplicitFraction: 1 # enable sending of explicit fractions
SEISubpicLevelInfoNumSubpics: 2 # number of subpictures - needs to be aligned with NumSubpics
SEISubpicLevelInfoRefLevelFractions: 40 30 # list of fractions: iterates over subpictures and levels (subpictures first)
SEISubpicLevelInfoEnabled: 1
SEISubpicLevelInfoExplicitFraction: 1 # enable sending of explicit fractions
SEISubpicLevelInfoNumSubpics: 2 # number of subpictures - has to be equal to NumSubpics
SEISubpicLevelInfoMaxSublayers: 7 # number of sublayers - has to be equal to vps_max_sublayers_minus1 + 1
SEISubpicLevelInfoSublayerInfoPresentFlag: 0 # 0: all sublayers use the same level information, 1: each sublayer shall specify its own level information
SEISubpicLevelInfoRefLevels: 4.1 # see software manual for list format
SEISubpicLevelInfoRefLevelFractions: 40 30 # see software manual for list format
This diff is collapsed.
......@@ -350,6 +350,10 @@ void BitstreamExtractorApp::xWriteVPS(VPS *vps, std::ostream& out, int layerId,
m_hlSyntaxWriter.setBitstream( &naluOut.m_Bitstream );
m_hlSyntaxWriter.codeVPS( vps );
#if JVET_R0294_SUBPIC_HASH
NALUnitEBSP naluWithHeader(naluOut);
writeAnnexBNalUnit(out, naluWithHeader, true);
#else
// create a dummy AU
AccessUnit tmpAu;
// convert to EBSP (this adds emulation prevention!) and add into NAL unit
......@@ -361,6 +365,7 @@ void BitstreamExtractorApp::xWriteVPS(VPS *vps, std::ostream& out, int layerId,
// AU works without chaning the start code length.
// This cannot be done for VLC NAL units!
writeAnnexB (out, tmpAu);
#endif
}
void BitstreamExtractorApp::xWriteSPS(SPS *sps, std::ostream& out, int layerId, int temporalId)
......@@ -373,6 +378,10 @@ void BitstreamExtractorApp::xWriteSPS(SPS *sps, std::ostream& out, int layerId,
m_hlSyntaxWriter.setBitstream( &naluOut.m_Bitstream );
m_hlSyntaxWriter.codeSPS( sps );
#if JVET_R0294_SUBPIC_HASH
NALUnitEBSP naluWithHeader(naluOut);
writeAnnexBNalUnit(out, naluWithHeader, true);
#else
// create a dummy AU
AccessUnit tmpAu;
// convert to EBSP (this adds emulation prevention!) and add into NAL unit
......@@ -384,6 +393,7 @@ void BitstreamExtractorApp::xWriteSPS(SPS *sps, std::ostream& out, int layerId,
// AU works without chaning the start code length.
// This cannot be done for VLC NAL units!
writeAnnexB (out, tmpAu);
#endif
}
void BitstreamExtractorApp::xWritePPS(PPS *pps, std::ostream& out, int layerId, int temporalId)
......@@ -395,6 +405,10 @@ void BitstreamExtractorApp::xWritePPS(PPS *pps, std::ostream& out, int layerId,
m_hlSyntaxWriter.setBitstream( &naluOut.m_Bitstream );
m_hlSyntaxWriter.codePPS( pps );
#if JVET_R0294_SUBPIC_HASH
NALUnitEBSP naluWithHeader(naluOut);
writeAnnexBNalUnit(out, naluWithHeader, true);
#else
// create a dummy AU
AccessUnit tmpAu;
// convert to EBSP (this adds emulation prevention!) and add into NAL unit
......@@ -406,6 +420,7 @@ void BitstreamExtractorApp::xWritePPS(PPS *pps, std::ostream& out, int layerId,
// AU works without chaning the start code length.
// This cannot be done for VLC NAL units!
writeAnnexB (out, tmpAu);
#endif
}
// returns true, if the NAL unit is to be discarded
......@@ -425,6 +440,48 @@ bool BitstreamExtractorApp::xCheckNumSubLayers(InputNALUnit &nalu, VPS *vps)
return retval;
}
#if JVET_R0294_SUBPIC_HASH
bool BitstreamExtractorApp::xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out)
{
SEIMessages scalableNestingSEIs = getSeisByType(SEIs, SEI::SCALABLE_NESTING);
if (scalableNestingSEIs.size())
{
CHECK ( scalableNestingSEIs.size() > 1, "There shall be only one Scalable Nesting SEI in one NAL unit" );
CHECK ( scalableNestingSEIs.size() != SEIs.size(), "Scalable Nesting SEI shall not be in the same NAL unit as other SEIs" );
// check, if the scalable nesting SEI applies to the target subpicture
SEIScalableNesting *sei = (SEIScalableNesting*) scalableNestingSEIs.front();
if (sei->m_snSubpicFlag == 0)
{
// does not apply to a subpicture -> remove
return false;
}
if (std::find(sei->m_snSubpicId.begin(), sei->m_snSubpicId.end(), m_subPicId) != sei->m_snSubpicId.end())
{
// 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;
}
else
{
// does not apply to target subpicture -> remove
return false;
}
}
// remove not nested decoded picture hash SEIs
SEIMessages hashSEI = getSeisByType(SEIs, SEI::DECODED_PICTURE_HASH);
if (hashSEI.size() > 0)
{
return false;
}
// keep all other SEIs
return true;
}
#endif
uint32_t BitstreamExtractorApp::decode()
{
std::ifstream bitstreamFileIn(m_bitstreamFileNameIn.c_str(), std::ifstream::in | std::ifstream::binary);
......@@ -648,17 +705,28 @@ uint32_t BitstreamExtractorApp::decode()
{
xReadPicHeader(nalu);
}
#if JVET_R0294_SUBPIC_HASH
if ( (nalu.m_nalUnitType == NAL_UNIT_PREFIX_SEI) || (nalu.m_nalUnitType == NAL_UNIT_SUFFIX_SEI))
{
#else
if (m_targetOlsIdx>=0)
{
if (nalu.m_nalUnitType == NAL_UNIT_PREFIX_SEI)
{
// decoding a SEI
SEIMessages SEIs;
HRD hrd;
m_seiReader.parseSEImessage(&(nalu.getBitstream()), SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, m_parameterSetManager.getActiveSPS(), hrd, &std::cout);
#endif
// decode SEI
SEIMessages SEIs;
#if !JVET_R0294_SUBPIC_HASH
HRD hrd;
m_seiReader.parseSEImessage(&(nalu.getBitstream()), SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, m_parameterSetManager.getActiveSPS(), hrd, &std::cout);
#else
m_seiReader.parseSEImessage(&(nalu.getBitstream()), SEIs, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, m_parameterSetManager.getActiveSPS(), m_hrd, &std::cout);
if (m_targetOlsIdx>=0)
{
#endif
for (auto sei : SEIs)
{
// remove unqualiified scalable nesting SEI
// remove unqualified scalable nesting SEI
if (sei->payloadType() == SEI::SCALABLE_NESTING)
{
SEIScalableNesting *seiNesting = (SEIScalableNesting *)sei;
......@@ -683,12 +751,22 @@ uint32_t BitstreamExtractorApp::decode()
writeInpuNalUnitToStream &= !targetOlsIdxGreaterThanZero;
}
}
#if !JVET_R0294_SUBPIC_HASH
}
#endif
if (m_vpsId == -1)
{
delete vps;
}
}
if (m_vpsId == -1)
#if JVET_R0294_SUBPIC_HASH
if (m_subPicId>=0)
{
delete vps;
writeInpuNalUnitToStream &= xCheckSEIsSubPicture(SEIs, nalu, bitstreamFileOut);
}
}
#endif
#if JVET_R0107_BITSTREAM_EXTACTION
Slice slice;
if (nalu.isSlice())
......
......@@ -50,7 +50,9 @@
#include "VLCWriter.h"
#include "SEIread.h"
#if JVET_R0294_SUBPIC_HASH
#include "SEIwrite.h"
#endif
class BitstreamExtractorApp : public BitstreamExtractorAppCfg
{
......@@ -73,6 +75,9 @@ protected:
bool xCheckSliceSubpicture(InputNALUnit &nalu, int subPicId);
#endif
void xReadPicHeader(InputNALUnit &nalu);
#if JVET_R0294_SUBPIC_HASH
bool xCheckSEIsSubPicture(SEIMessages& SEIs, InputNALUnit& nalu, std::ostream& out);
#endif
void xSetSPSUpdated(int spsId) { return m_updatedSPSList.push_back(spsId); }
bool xIsSPSUpdate(int spsId) { return (std::find(m_updatedSPSList.begin(),m_updatedSPSList.end(), spsId) != m_updatedSPSList.end()); }
......@@ -88,6 +93,11 @@ protected:
HLSyntaxReader m_hlSynaxReader;
HLSWriter m_hlSyntaxWriter;
SEIReader m_seiReader;
#if JVET_R0294_SUBPIC_HASH
SEIWriter m_seiWriter;
HRD m_hrd;
#endif
int m_vpsId;
bool m_removeTimingSEI;
......
......@@ -59,6 +59,12 @@
DecApp::DecApp()
: m_iPOCLastDisplay(-MAX_INT)
{
#if JVET_R0270
for (int i = 0; i < MAX_NUM_LAYER_IDS; i++)
{
m_newCLVS[i] = true;
}
#endif
}
// ====================================================================================================================
......@@ -161,8 +167,23 @@ uint32_t DecApp::decode()
(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP))
{
#if JVET_R0270
m_newCLVS[nalu.m_nuhLayerId] = true; // An IDR picture starts a new CLVS
#endif
xFlushOutput(pcListPic, nalu.m_nuhLayerId);
}
#if JVET_R0270
if (m_cDecLib.getFirstSliceInPicture() && nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA && isEosPresentInPu)
{
// A CRA that is immediately preceded by an EOS is a CLVSS
m_newCLVS[nalu.m_nuhLayerId] = true;
}
else if (m_cDecLib.getFirstSliceInPicture() && nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA && !isEosPresentInPu)
{
// A CRA that is not immediately precede by an EOS is not a CLVSS
m_newCLVS[nalu.m_nuhLayerId] = false;
}
#endif
// parse NAL unit syntax if within target decoding layer
if( ( m_iMaxTemporalLayer < 0 || nalu.m_temporalId <= m_iMaxTemporalLayer ) && xIsNaluWithinTargetDecLayerIdSet( &nalu ) )
......@@ -203,6 +224,9 @@ uint32_t DecApp::decode()
if (nalu.m_nalUnitType == NAL_UNIT_EOS)
{
isEosPresentInPu = true;
#if JVET_R0270
m_newCLVS[nalu.m_nuhLayerId] = true; //The presence of EOS means that the next picture is the beginning of new CLVS
#endif
}
// within the current PU, only EOS and EOB are allowed to be sent after an EOS nal unit
if(isEosPresentInPu)
......@@ -217,7 +241,11 @@ uint32_t DecApp::decode()
if (!loopFiltered[nalu.m_nuhLayerId] || bitstreamFile)
{
m_cDecLib.executeLoopFilters();
#if JVET_R0270
m_cDecLib.finishPicture(poc, pcListPic, INFO, m_newCLVS[nalu.m_nuhLayerId]);
#else
m_cDecLib.finishPicture( poc, pcListPic );
#endif
}
loopFiltered[nalu.m_nuhLayerId] = (nalu.m_nalUnitType == NAL_UNIT_EOS);
if (nalu.m_nalUnitType == NAL_UNIT_EOS)
......
......@@ -68,6 +68,9 @@ private:
std::ofstream m_oplFileStream; ///< Used to output log file for confomance testing
#if JVET_R0270
bool m_newCLVS[MAX_NUM_LAYER_IDS]; ///< used to record a new CLVSS
#endif
private:
......
This diff is collapsed.
This diff is collapsed.
......@@ -136,8 +136,7 @@ protected:
#endif
bool m_bIntraOnlyConstraintFlag;
uint32_t m_maxBitDepthConstraintIdc;
uint32_t m_maxChromaFormatConstraintIdc;
bool m_bFrameConstraintFlag;
int m_maxChromaFormatConstraintIdc;
bool m_singleLayerConstraintFlag;
bool m_allLayersIndependentConstraintFlag;
bool m_noMrlConstraintFlag;
......@@ -199,7 +198,7 @@ protected:
uint32_t m_bitDepthConstraint;
ChromaFormat m_chromaFormatConstraint;
bool m_onePictureOnlyConstraintFlag;
bool m_intraConstraintFlag;
bool m_intraOnlyConstraintFlag;
bool m_nonPackedConstraintFlag;
bool m_nonProjectedConstraintFlag;
bool m_noResChangeInClvsConstraintFlag;
......@@ -308,7 +307,7 @@ protected:
bool m_dualTree;
bool m_LFNST;
bool m_useFastLFNST;
int m_SubPuMvpMode;
bool m_sbTmvpEnableFlag;
bool m_Affine;
bool m_AffineType;
bool m_PROF;
......@@ -484,6 +483,9 @@ protected:
bool m_bUseBLambdaForNonKeyLowDelayPictures;
HashType m_decodedPictureHashSEIType; ///< Checksum mode for decoded picture hash SEI message
#if JVET_R0294_SUBPIC_HASH
HashType m_subpicDecodedPictureHashType;
#endif
bool m_bufferingPeriodSEIEnabled;
bool m_pictureTimingSEIEnabled;
bool m_bpDeltasGOPStructure;
......
......@@ -517,12 +517,12 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co
const PPS &pps = *pu.cs->pps;
const Slice &slice = *pu.cs->slice;
CHECK( !pu.cu->affine && pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0 && ( pu.lwidth() + pu.lheight() == 12 ), "invalid 4x8/8x4 bi-predicted blocks" );
WPScalingParam *wp0;
WPScalingParam *wp1;
int refIdx0 = pu.refIdx[REF_PIC_LIST_0];
int refIdx1 = pu.refIdx[REF_PIC_LIST_1];
pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0);
pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1);
const WPScalingParam *wp0 = pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0);
const WPScalingParam *wp1 = pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1);
bool bioApplied = false;
if (pu.cs->sps->getBDOFEnabledFlag() && (!pu.cs->picHeader->getDisBdofFlag()))
......@@ -533,7 +533,8 @@ void InterPrediction::xPredInterBi(PredictionUnit &pu, PelUnitBuf &pcYuvPred, co
}
else
{
const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp0[COMPONENT_Cb].bPresentFlag || wp0[COMPONENT_Cr].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Cb].bPresentFlag || wp1[COMPONENT_Cr].bPresentFlag) && slice.getSliceType() == B_SLICE);
const bool biocheck0 =
!((WPScalingParam::isWeighted(wp0) || WPScalingParam::isWeighted(wp1)) && slice.getSliceType() == B_SLICE);
const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE);
if (biocheck0
&& biocheck1
......@@ -1496,12 +1497,12 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
{
CHECK( !pu.cu->affine && pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0 && ( pu.lwidth() + pu.lheight() == 12 ), "invalid 4x8/8x4 bi-predicted blocks" );
WPScalingParam *wp0;
WPScalingParam *wp1;
int refIdx0 = pu.refIdx[REF_PIC_LIST_0];
int refIdx1 = pu.refIdx[REF_PIC_LIST_1];
pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0);
pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1);
const WPScalingParam *wp0 = pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0);
const WPScalingParam *wp1 = pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1);
bool bioApplied = false;
const Slice &slice = *pu.cs->slice;
if (pu.cs->sps->getBDOFEnabledFlag() && (!pu.cs->picHeader->getDisBdofFlag()))
......@@ -1513,7 +1514,8 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
}
else
{
const bool biocheck0 = !((wp0[COMPONENT_Y].bPresentFlag || wp0[COMPONENT_Cb].bPresentFlag || wp0[COMPONENT_Cr].bPresentFlag || wp1[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Cb].bPresentFlag || wp1[COMPONENT_Cr].bPresentFlag) && slice.getSliceType() == B_SLICE);
const bool biocheck0 =
!((WPScalingParam::isWeighted(wp0) || WPScalingParam::isWeighted(wp1)) && slice.getSliceType() == B_SLICE);
const bool biocheck1 = !(pps.getUseWP() && slice.getSliceType() == P_SLICE);
if (biocheck0
&& biocheck1
......
......@@ -792,10 +792,6 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
{
return tmpBs;
}
if ((cuP.firstPU->ciipFlag || cuQ.firstPU->ciipFlag))
{
return 1;
}
if ( !cu.Y().valid() )
{
......
......@@ -152,19 +152,24 @@ uint64_t ProfileLevelTierFeatures::getCpbSizeInBits() const
uint32_t ProfileLevelTierFeatures::getMaxDpbSize( uint32_t picSizeMaxInSamplesY ) const
{
const uint32_t maxDpbPicBuf = 8;
uint32_t maxDpbSize = maxDpbPicBuf;
uint32_t maxDpbSize;
if( picSizeMaxInSamplesY <= ( m_pLevelTier->maxLumaPs >> 2 ) )
if (m_pLevelTier->level == Level::LEVEL15_5)
{
maxDpbSize = std::min<uint32_t>( 4 * maxDpbPicBuf, 16 );
// maxDpbSize is unconstrained in this case
maxDpbSize = std::numeric_limits<uint32_t>::max();
}
else if( picSizeMaxInSamplesY <= ( m_pLevelTier->maxLumaPs >> 1 ) )
else if (2 * picSizeMaxInSamplesY <= m_pLevelTier->maxLumaPs)
{
maxDpbSize = std::min<uint32_t>( 2 * maxDpbPicBuf, 16 );
maxDpbSize = 2 * maxDpbPicBuf;
}
else if( picSizeMaxInSamplesY <= ( ( 3 * m_pLevelTier->maxLumaPs ) >> 2 ) )
else if (3 * picSizeMaxInSamplesY <= 2 * m_pLevelTier->maxLumaPs)
{
maxDpbSize = std::min<uint32_t>( ( 4 * maxDpbPicBuf ) / 3, 16 );
maxDpbSize = 3 * maxDpbPicBuf / 2;
}
else
{
maxDpbSize = maxDpbPicBuf;
}
return maxDpbSize;
......
......@@ -648,6 +648,10 @@ public:
, m_explicitFractionPresentFlag (false)
, m_cbrConstraintFlag (false)
, m_numSubpics(0)
#if JVET_S0176_SLI_SEI
, m_sliMaxSublayers(1)
, m_sliSublayerInfoPresentFlag(false)
#endif
{}
virtual ~SEISubpicureLevelInfo() {}
......@@ -655,8 +659,15 @@ public:
bool m_explicitFractionPresentFlag;
bool m_cbrConstraintFlag;
int m_numSubpics;
#if JVET_S0176_SLI_SEI
int m_sliMaxSublayers;
bool m_sliSublayerInfoPresentFlag;
std::vector<std::vector<Level::Name>> m_refLevelIdc;
std::vector<std::vector<std::vector<int>>> m_refLevelFraction;
#else
std::vector<Level::Name> m_refLevelIdc;
std::vector<std::vector<int>> m_refLevelFraction;
#endif
};
......
......@@ -63,6 +63,9 @@ Slice::Slice()
, m_eNalUnitType ( NAL_UNIT_CODED_SLICE_IDR_W_RADL )
, m_pictureHeaderInSliceHeader ( false )
, m_eSliceType ( I_SLICE )
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
, m_noOutputOfPriorPicsFlag ( 0 )
#endif
, m_iSliceQp ( 0 )
, m_ChromaQpAdjEnabled ( false )
, m_lmcsEnabledFlag ( 0 )
......@@ -171,6 +174,10 @@ void Slice::initSlice()
m_explicitScalingListUsed = 0;
initEqualRef();
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
m_noOutputOfPriorPicsFlag = 0;
#endif
m_bCheckLDC = false;
m_biDirPred = false;
......@@ -1271,7 +1278,11 @@ void Slice::checkLeadingPictureRestrictions(PicList& rcListPic, const PPS& pps)
}
const Slice* pcSlice = pcPic->slices[0];
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
if (pcSlice->getPicHeader()->getPicOutputFlag() == 1 && !this->getNoOutputOfPriorPicsFlag() && pcPic->layerId == this->m_nuhLayerId)
#else
if (pcSlice->getPicHeader()->getPicOutputFlag() == 1 && !this->getPicHeader()->getNoOutputOfPriorPicsFlag() && pcPic->layerId == this->m_nuhLayerId)
#endif
{
if ((nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL) && !pps.getMixedNaluTypesInPicFlag())
{
......@@ -1418,15 +1429,20 @@ void Slice::checkSubpicTypeConstraints( PicList& rcListPic, const ReferencePictu
}
}
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
if( ( m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) &&
!m_pcPicHeader->getNoOutputOfPriorPicsFlag() && isBufPicOutput == 1 && bufPic->layerId == m_nuhLayerId )
!m_noOutputOfPriorPicsFlag && isBufPicOutput && bufPic->layerId == m_nuhLayerId )
#else
if( ( m_eNalUnitType == NAL_UNIT_CODED_SLICE_CRA || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || m_eNalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL ) &&
!m_pcPicHeader->getNoOutputOfPriorPicsFlag() && isBufPicOutput && bufPic->layerId == m_nuhLayerId )
#endif
{
CHECK( bufPic->poc >= m_iPOC, "Any subpicture, with nuh_layer_id equal to a particular value layerId and subpicture index equal to a particular value subpicIdx, that "
"precedes, in decoding order, an IRAP subpicture with nuh_layer_id equal to layerId and subpicture index equal to subpicIdx shall precede, in output order, the "
"IRAP subpicture" );
}
if( m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL && isBufPicOutput == 1 && bufPic->layerId == m_nuhLayerId &&
if( m_eNalUnitType == NAL_UNIT_CODED_SLICE_RADL && isBufPicOutput && bufPic->layerId == m_nuhLayerId &&
m_prevIRAPSubpicPOC > bufSubpicPrevIRAPSubpicPOC && m_prevIRAPSubpicPOC != bufPic->poc )
{
CHECK( bufPic->poc >= m_iPOC, "Any subpicture, with nuh_layer_id equal to a particular value layerId and subpicture index equal to a particular value subpicIdx, that "
......@@ -1434,8 +1450,13 @@ void Slice::checkSubpicTypeConstraints( PicList& rcListPic, const ReferencePictu
"its associated RADL subpictures" );
}
if( ( m_iPOC == m_pcPicHeader->getRecoveryPocCnt() + m_prevGDRSubpicPOC ) && !m_pcPicHeader->getNoOutputOfPriorPicsFlag() && isBufPicOutput == 1 &&
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
if( ( m_iPOC == m_pcPicHeader->getRecoveryPocCnt() + m_prevGDRSubpicPOC ) && !m_noOutputOfPriorPicsFlag && isBufPicOutput &&
bufPic->layerId == m_nuhLayerId && m_eNalUnitType != NAL_UNIT_CODED_SLICE_GDR && m_pcPicHeader->getRecoveryPocCnt() != -1 )
#else
if( ( m_iPOC == m_pcPicHeader->getRecoveryPocCnt() + m_prevGDRSubpicPOC ) && !m_pcPicHeader->getNoOutputOfPriorPicsFlag() && isBufPicOutput &&
bufPic->layerId == m_nuhLayerId && m_eNalUnitType != NAL_UNIT_CODED_SLICE_GDR && m_pcPicHeader->getRecoveryPocCnt() != -1 )
#endif
{
CHECK( bufPic->poc >= m_iPOC, "Any subpicture, with nuh_layer_id equal to a particular value layerId and subpicture index equal to a particular value subpicIdx, that "
"precedes, in decoding order, a subpicture with nuh_layer_id equal to layerId and subpicture index equal to subpicIdx in a recovery point picture shall precede "
......@@ -2184,10 +2205,30 @@ void Slice::initWpAcDcParam()
}
//! get tables for weighted prediction
void Slice::getWpScaling( RefPicList e, int iRefIdx, WPScalingParam *&wp ) const
const WPScalingParam *Slice::getWpScaling(const RefPicList refPicList, const int refIdx) const
{
CHECK(refPicList >= NUM_REF_PIC_LIST_01, "Invalid picture reference list");
if (refIdx < 0)
{
return nullptr;
}
else
{
return m_weightPredTable[refPicList][refIdx];
}
}
WPScalingParam *Slice::getWpScaling(const RefPicList refPicList, const int refIdx)
{
CHECK(e>=NUM_REF_PIC_LIST_01, "Invalid picture reference list");
wp = (WPScalingParam*) m_weightPredTable[e][iRefIdx];
CHECK(refPicList >= NUM_REF_PIC_LIST_01, "Invalid picture reference list");
if (refIdx < 0)
{
return nullptr;
}
else
{
return m_weightPredTable[refPicList][refIdx];
}
}
//! reset Default WP tables settings : no weight.
......@@ -2200,11 +2241,11 @@ void Slice::resetWpScaling()
for ( int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ )
{
WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);
pwp->bPresentFlag = false;
pwp->uiLog2WeightDenom = 0;
pwp->uiLog2WeightDenom = 0;
pwp->iWeight = 1;
pwp->iOffset = 0;
pwp->presentFlag = false;
pwp->log2WeightDenom = 0;
pwp->log2WeightDenom = 0;
pwp->codedWeight = 1;
pwp->codedOffset = 0;
}
}
}
......@@ -2221,19 +2262,20 @@ void Slice::initWpScaling(const SPS *sps)
for ( int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ )
{
WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);
if ( !pwp->bPresentFlag )
if (!pwp->presentFlag)
{
// Inferring values not present :
pwp->iWeight = (1 << pwp->uiLog2WeightDenom);
pwp->iOffset = 0;
pwp->codedWeight = (1 << pwp->log2WeightDenom);
pwp->codedOffset = 0;
}
const int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8));
pwp->w = pwp->iWeight;
pwp->o = pwp->iOffset * offsetScalingFactor; //NOTE: This value of the ".o" variable is never used - .o is set immediately before it gets used
pwp->shift = pwp->uiLog2WeightDenom;
pwp->round = (pwp->uiLog2WeightDenom>=1) ? (1 << (pwp->uiLog2WeightDenom-1)) : (0);
pwp->w = pwp->codedWeight;
pwp->o = pwp->codedOffset * offsetScalingFactor; // NOTE: This value of the ".o" variable is never used - .o
// is set immediately before it gets used
pwp->shift = pwp->log2WeightDenom;
pwp->round = (pwp->log2WeightDenom >= 1) ? (1 << (pwp->log2WeightDenom - 1)) : (0);
}
}
}
......@@ -2542,7 +2584,9 @@ PicHeader::PicHeader()
: m_valid ( 0 )
, m_nonReferencePictureFlag ( 0 )
, m_gdrPicFlag ( 0 )
#if !JVET_S0193_NO_OUTPUT_PRIOR_PIC
, m_noOutputOfPriorPicsFlag ( 0 )
#endif
, m_recoveryPocCnt ( -1 )
, m_noOutputBeforeRecoveryFlag ( false )
, m_handleCraAsCvsStartFlag ( false )
......@@ -2635,7 +2679,9 @@ void PicHeader::initPicHeader()
m_valid = 0;
m_nonReferencePictureFlag = 0;
m_gdrPicFlag = 0;
#if !JVET_S0193_NO_OUTPUT_PRIOR_PIC
m_noOutputOfPriorPicsFlag = 0;
#endif
m_recoveryPocCnt = -1;
m_spsId = -1;
m_ppsId = -1;
......@@ -2706,10 +2752,30 @@ void PicHeader::initPicHeader()
m_alfApsId.resize(0);
}
void PicHeader::getWpScaling(RefPicList e, int iRefIdx, WPScalingParam *&wp) const
const WPScalingParam *PicHeader::getWpScaling(const RefPicList refPicList, const int refIdx) const
{
CHECK(refPicList >= NUM_REF_PIC_LIST_01, "Invalid picture reference list");
if (refIdx < 0)
{
return nullptr;
}
else
{
return m_weightPredTable[refPicList][refIdx];
}
}
WPScalingParam *PicHeader::getWpScaling(const RefPicList refPicList, const int refIdx)
{
CHECK(e >= NUM_REF_PIC_LIST_01, "Invalid picture reference list");
wp = (WPScalingParam *) m_weightPredTable[e][iRefIdx];
CHECK(refPicList >= NUM_REF_PIC_LIST_01, "Invalid picture reference list");
if (refIdx < 0)
{
return nullptr;
}
else
{
return m_weightPredTable[refPicList][refIdx];
}
}
void PicHeader::resetWpScaling()
......@@ -2721,10 +2787,10 @@ void PicHeader::resetWpScaling()
for ( int yuv=0 ; yuv<MAX_NUM_COMPONENT ; yuv++ )
{
WPScalingParam *pwp = &(m_weightPredTable[e][i][yuv]);
pwp->bPresentFlag = false;
pwp->uiLog2WeightDenom = 0;
pwp->iWeight = 1;
pwp->iOffset = 0;
pwp->presentFlag = false;
pwp->log2WeightDenom = 0;
pwp->codedWeight = 1;
pwp->codedOffset = 0;
}
}
}
......@@ -3629,6 +3695,9 @@ ReferencePictureList::ReferencePictureList( const bool interLayerPicPresentFlag
::memset(m_POC, 0, sizeof(m_POC));
::memset( m_isInterLayerRefPic, 0, sizeof( m_isInterLayerRefPic ) );
::memset( m_interLayerRefPicIdx, 0, sizeof( m_interLayerRefPicIdx ) );
::memset(m_deltaPOCMSBCycleLT, 0, sizeof(m_deltaPOCMSBCycleLT));
::memset(m_deltaPocMSBPresentFlag, 0, sizeof(m_deltaPocMSBPresentFlag));
}
ReferencePictureList::~ReferencePictureList()
......
......@@ -250,7 +250,7 @@ class ConstraintInfo
bool m_frameOnlyConstraintFlag;
bool m_intraOnlyConstraintFlag;
uint32_t m_maxBitDepthConstraintIdc;
ChromaFormat m_maxChromaFormatConstraintIdc;
int m_maxChromaFormatConstraintIdc;
bool m_onePictureOnlyConstraintFlag;
bool m_lowerBitRateConstraintFlag;
......@@ -406,8 +406,8 @@ public:
uint32_t getMaxBitDepthConstraintIdc() const { return m_maxBitDepthConstraintIdc; }
void setMaxBitDepthConstraintIdc(uint32_t bitDepth) { m_maxBitDepthConstraintIdc = bitDepth; }
ChromaFormat getMaxChromaFormatConstraintIdc() const { return m_maxChromaFormatConstraintIdc; }
void setMaxChromaFormatConstraintIdc(ChromaFormat fmt) { m_maxChromaFormatConstraintIdc = fmt; }
int getMaxChromaFormatConstraintIdc() const { return m_maxChromaFormatConstraintIdc; }
void setMaxChromaFormatConstraintIdc(int fmt) { m_maxChromaFormatConstraintIdc = fmt; }
#if !JVET_S0266_VUI_length
bool getNonProjectedConstraintFlag() const { return m_nonProjectedConstraintFlag; }
......@@ -1748,8 +1748,8 @@ void setCCALFEnabledFlag( bool b )
void setJointCbCrEnabledFlag(bool bVal) { m_JointCbCrEnabledFlag = bVal; }
bool getJointCbCrEnabledFlag() const { return m_JointCbCrEnabledFlag; }
bool getSBTMVPEnabledFlag() const { return m_sbtmvpEnabledFlag; }
void setSBTMVPEnabledFlag(bool b) { m_sbtmvpEnabledFlag = b; }
bool getSbTMVPEnabledFlag() const { return m_sbtmvpEnabledFlag; }
void setSbTMVPEnabledFlag(bool b) { m_sbtmvpEnabledFlag = b; }
void setBDOFEnabledFlag(bool b) { m_bdofEnabledFlag = b; }
bool getBDOFEnabledFlag() const { return m_bdofEnabledFlag; }
......@@ -2325,10 +2325,10 @@ struct WPScalingParam
{
// Explicit weighted prediction parameters parsed in slice header,
// or Implicit weighted prediction parameters (8 bits depth values).
bool bPresentFlag;
uint32_t uiLog2WeightDenom;
int iWeight;
int iOffset;
bool presentFlag;
uint32_t log2WeightDenom;
int codedWeight;
int codedOffset;
// Weighted prediction scaling values built from above parameters (bitdepth scaled):
int w;
......@@ -2337,7 +2337,14 @@ struct WPScalingParam
int shift;
int round;
static bool isWeighted(const WPScalingParam *wp);
};
inline bool WPScalingParam::isWeighted(const WPScalingParam *wp)
{
return wp != nullptr && (wp[COMPONENT_Y].presentFlag || wp[COMPONENT_Cb].presentFlag || wp[COMPONENT_Cr].presentFlag);
}
struct WPACDCParam
{
int64_t iAC;
......@@ -2354,7 +2361,9 @@ private:
bool m_nonReferencePictureFlag; //!< non-reference picture flag
bool m_gdrOrIrapPicFlag; //!< gdr or irap picture flag
bool m_gdrPicFlag; //!< gradual decoding refresh picture flag
#if !JVET_S0193_NO_OUTPUT_PRIOR_PIC
bool m_noOutputOfPriorPicsFlag; //!< no output of prior pictures flag
#endif
uint32_t m_recoveryPocCnt; //!< recovery POC count
bool m_noOutputBeforeRecoveryFlag; //!< NoOutputBeforeRecoveryFlag
bool m_handleCraAsCvsStartFlag; //!< HandleCraAsCvsStartFlag
......@@ -2444,8 +2453,10 @@ public:
bool getGdrOrIrapPicFlag() const { return m_gdrOrIrapPicFlag; }
void setGdrPicFlag( bool b ) { m_gdrPicFlag = b; }
bool getGdrPicFlag() const { return m_gdrPicFlag; }
#if !JVET_S0193_NO_OUTPUT_PRIOR_PIC
void setNoOutputOfPriorPicsFlag( bool b ) { m_noOutputOfPriorPicsFlag = b; }
bool getNoOutputOfPriorPicsFlag() const { return m_noOutputOfPriorPicsFlag; }
#endif
void setRecoveryPocCnt( uint32_t u ) { m_recoveryPocCnt = u; }
uint32_t getRecoveryPocCnt() const { return m_recoveryPocCnt; }
void setSPSId( uint32_t u ) { m_spsId = u; }
......@@ -2605,7 +2616,8 @@ public:
{
memcpy(m_weightPredTable, wp, sizeof(WPScalingParam) * NUM_REF_PIC_LIST_01 * MAX_NUM_REF * MAX_NUM_COMPONENT);
}
void getWpScaling(RefPicList e, int iRefIdx, WPScalingParam *&wp) const;
const WPScalingParam * getWpScaling(const RefPicList refPicList, const int refIdx) const;
WPScalingParam * getWpScaling(const RefPicList refPicList, const int refIdx);
WPScalingParam* getWpScalingAll() { return (WPScalingParam *) m_weightPredTable; }
void resetWpScaling();
void setNumL0Weights(int b) { m_numL0Weights = b; }
......@@ -2653,6 +2665,9 @@ private:
bool m_pictureHeaderInSliceHeader;
uint32_t m_nuhLayerId; ///< Nal unit layer id
SliceType m_eSliceType;
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
bool m_noOutputOfPriorPicsFlag; //!< no output of prior pictures flag
#endif
int m_iSliceQp;
int m_iSliceQpBase;
bool m_ChromaQpAdjEnabled;
......@@ -2792,6 +2807,10 @@ public:
NalUnitType getPrevIRAPSubpicType() const { return m_prevIRAPSubpicType; }
void checkSubpicTypeConstraints(PicList& rcListPic, const ReferencePictureList* pRPL0, const ReferencePictureList* pRPL1, const int prevIRAPSubpicDecOrderNo, const bool lastNoOutputBeforeRecoveryFlag );
SliceType getSliceType() const { return m_eSliceType; }
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
void setNoOutputOfPriorPicsFlag(bool b) { m_noOutputOfPriorPicsFlag = b; }
bool getNoOutputOfPriorPicsFlag() const { return m_noOutputOfPriorPicsFlag; }
#endif
int getPOC() const { return m_iPOC; }
int getSliceQp() const { return m_iSliceQp; }
bool getUseWeightedPrediction() const { return( (m_eSliceType==P_SLICE && testWeightPred()) || (m_eSliceType==B_SLICE && testWeightBiPred()) ); }
......@@ -2975,7 +2994,8 @@ public:
memcpy(m_weightPredTable, wp, sizeof(WPScalingParam) * NUM_REF_PIC_LIST_01 * MAX_NUM_REF * MAX_NUM_COMPONENT);
}
WPScalingParam * getWpScalingAll() { return (WPScalingParam *) m_weightPredTable; }
void getWpScaling( RefPicList e, int iRefIdx, WPScalingParam *&wp) const;
WPScalingParam * getWpScaling(const RefPicList refPicList, const int refIdx);
const WPScalingParam * getWpScaling(const RefPicList refPicList, const int refIdx) const;
void resetWpScaling();
void initWpScaling(const SPS *sps);
......
......@@ -52,6 +52,12 @@
//########### place macros to be removed in next cycle below this line ###############
#define JVET_S0193_NO_OUTPUT_PRIOR_PIC 1 // JVET-S0193: Move ph_no_output_of_prior_pics_flag to SH
#define JVET_S0219_ASPECT2_CHANGE_ORDER_APS_PARAMS_TYPE 1 // JVET-S0219 aspect2: change the order to put the aps_params_type before the aps_adaptation_parameter_set_id.
#define JVET_R0270 1 // JVET-S0270: Treating picture with mixed RASL and RADL slices as RASL picture
#define JVET_S0081_NON_REFERENCED_PIC 1 // JVET-S0081: exclude non-referenced picture to be used as prevTid0 picture
#define JVET_R0433 1 // JVET-R0433: APS signaling and semantics cleanup
......@@ -107,6 +113,8 @@
#define JVET_S0185_PROPOSAL2_SEI_CLEANUP 1 // JVET-S0185_PROPOSAL2: Move signalling of syntax element bp_alt_cpb_params_present_flag
#define JVET_R0294_SUBPIC_HASH 1 // JVET-R0294: Allow decoded picture hash SEI messages to be nested in subpicture context
#define JVET_S0181_PROPOSAL1 1 // JVET-0181_Proposal1: Conditionally signal bp_sublayer_initial_cpb_removal_delay_present_flag
#define JVET_Q0406_CABAC_ZERO 1 // JVET-Q0406: signal cabac_zero_words per sub-picture
......@@ -117,6 +125,8 @@
#define JVET_S0178_GENERAL_SEI_CHECK 1 // JVET-S0178: General SEI semantics and constraints
#define JVET_S0176_SLI_SEI 1 // JVET-S0176: On the subpicture level information SEI message
#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
......
......@@ -1403,29 +1403,25 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
bool PU::checkDMVRCondition(const PredictionUnit& pu)
{
WPScalingParam *wp0;
WPScalingParam *wp1;
int refIdx0 = pu.refIdx[REF_PIC_LIST_0];
int refIdx1 = pu.refIdx[REF_PIC_LIST_1];
pu.cu->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0);
pu.cu->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1);
if (pu.cs->sps->getUseDMVR() && (!pu.cs->picHeader->getDisDmvrFlag()))
{
return pu.mergeFlag
&& pu.mergeType == MRG_TYPE_DEFAULT_N
&& !pu.ciipFlag
&& !pu.cu->affine
&& !pu.mmvdMergeFlag
&& !pu.cu->mmvdSkip
&& PU::isBiPredFromDifferentDirEqDistPoc(pu)
&& (pu.lheight() >= 8)
&& (pu.lwidth() >= 8)
&& ((pu.lheight() * pu.lwidth()) >= 128)
&& (pu.cu->BcwIdx == BCW_DEFAULT)
&& ((!wp0[COMPONENT_Y].bPresentFlag) && (!wp0[COMPONENT_Cb].bPresentFlag) && (!wp0[COMPONENT_Cr].bPresentFlag) && (!wp1[COMPONENT_Y].bPresentFlag) && (!wp1[COMPONENT_Cb].bPresentFlag) && (!wp1[COMPONENT_Cr].bPresentFlag))
&& ( refIdx0 < 0 ? true : (pu.cu->slice->getRefPic( REF_PIC_LIST_0, refIdx0 )->isRefScaled( pu.cs->pps ) == false) )
&& ( refIdx1 < 0 ? true : (pu.cu->slice->getRefPic( REF_PIC_LIST_1, refIdx1 )->isRefScaled( pu.cs->pps ) == false) )
;
if (pu.cs->sps->getUseDMVR() && !pu.cs->picHeader->getDisDmvrFlag())
{
const int refIdx0 = pu.refIdx[REF_PIC_LIST_0];
const int refIdx1 = pu.refIdx[REF_PIC_LIST_1];
const WPScalingParam *wp0 = pu.cu->slice->getWpScaling(REF_PIC_LIST_0, refIdx0);
const WPScalingParam *wp1 = pu.cu->slice->getWpScaling(REF_PIC_LIST_1, refIdx1);
const bool ref0IsScaled = refIdx0 < 0 || refIdx0 >= MAX_NUM_REF
? false
: pu.cu->slice->getRefPic(REF_PIC_LIST_0, refIdx0)->isRefScaled(pu.cs->pps);
const bool ref1IsScaled = refIdx1 < 0 || refIdx1 >= MAX_NUM_REF
? false
: pu.cu->slice->getRefPic(REF_PIC_LIST_1, refIdx1)->isRefScaled(pu.cs->pps);
return pu.mergeFlag && pu.mergeType == MRG_TYPE_DEFAULT_N && !pu.ciipFlag && !pu.cu->affine && !pu.mmvdMergeFlag
&& !pu.cu->mmvdSkip && PU::isBiPredFromDifferentDirEqDistPoc(pu) && (pu.lheight() >= 8) && (pu.lwidth() >= 8)
&& ((pu.lheight() * pu.lwidth()) >= 128) && (pu.cu->BcwIdx == BCW_DEFAULT)
&& !WPScalingParam::isWeighted(wp0) && !WPScalingParam::isWeighted(wp1) && !ref0IsScaled && !ref1IsScaled;
}
else
{
......@@ -2623,9 +2619,10 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx
affMrgCtx.numValidMergeCand = 0;
affMrgCtx.maxNumMergeCand = maxNumAffineMergeCand;
bool enableSubPuMvp = slice.getSPS()->getSBTMVPEnabledFlag() && !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
bool sbTmvpEnableFlag = slice.getSPS()->getSbTMVPEnabledFlag()
&& !(slice.getPOC() == slice.getRefPic(REF_PIC_LIST_0, 0)->getPOC() && slice.isIRAP());
bool isAvailableSubPu = false;
if ( enableSubPuMvp && slice.getPicHeader()->getEnableTMVPFlag() )
if (sbTmvpEnableFlag && slice.getPicHeader()->getEnableTMVPFlag())
{
MergeCtx mrgCtx = *affMrgCtx.mrgCtx;
bool tmpLICFlag = false;
......@@ -3732,19 +3729,13 @@ bool CU::isBcwIdxCoded( const CodingUnit &cu )
{
if( cu.firstPU->interDir == 3 )
{
WPScalingParam *wp0;
WPScalingParam *wp1;
int refIdx0 = cu.firstPU->refIdx[REF_PIC_LIST_0];
int refIdx1 = cu.firstPU->refIdx[REF_PIC_LIST_1];
const int refIdx0 = cu.firstPU->refIdx[REF_PIC_LIST_0];
const int refIdx1 = cu.firstPU->refIdx[REF_PIC_LIST_1];
cu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0);
cu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1);
if ((wp0[COMPONENT_Y].bPresentFlag || wp0[COMPONENT_Cb].bPresentFlag || wp0[COMPONENT_Cr].bPresentFlag
|| wp1[COMPONENT_Y].bPresentFlag || wp1[COMPONENT_Cb].bPresentFlag || wp1[COMPONENT_Cr].bPresentFlag))
{
return false;
}
return true;
const WPScalingParam *wp0 = cu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0);
const WPScalingParam *wp1 = cu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1);
return !(WPScalingParam::isWeighted(wp0) || WPScalingParam::isWeighted(wp1));
}
}
......
......@@ -72,14 +72,8 @@ WeightPrediction::WeightPrediction()
{
}
void WeightPrediction::getWpScaling(const Slice *pcSlice,
const int &iRefIdx0,
const int &iRefIdx1,
WPScalingParam *&wp0,
WPScalingParam *&wp1,
const ComponentID maxNumComp)
void WeightPrediction::getWpScaling(Slice *pcSlice, const int &iRefIdx0, const int &iRefIdx1, WPScalingParam *&wp0,
WPScalingParam *&wp1, const ComponentID maxNumComp)
{
CHECK(iRefIdx0 < 0 && iRefIdx1 < 0, "Both picture reference list indizes smaller than '0'");
......@@ -90,14 +84,8 @@ void WeightPrediction::getWpScaling(const Slice *pcSlice,
if (bUniPred || wpBiPred)
{
// explicit --------------------
if (iRefIdx0 >= 0)
{
pcSlice->getWpScaling(REF_PIC_LIST_0, iRefIdx0, wp0);
}
if (iRefIdx1 >= 0)
{
pcSlice->getWpScaling(REF_PIC_LIST_1, iRefIdx1, wp1);
}
wp0 = pcSlice->getWpScaling(REF_PIC_LIST_0, iRefIdx0);
wp1 = pcSlice->getWpScaling(REF_PIC_LIST_1, iRefIdx1);
}
else
{
......@@ -106,11 +94,11 @@ void WeightPrediction::getWpScaling(const Slice *pcSlice,
if (iRefIdx0 < 0)
{
wp0 = NULL;
wp0 = nullptr;
}
if (iRefIdx1 < 0)
{
wp1 = NULL;
wp1 = nullptr;
}
const uint32_t numValidComponent = getNumberValidComponents(pcSlice->getSPS()->getChromaFormatIdc());
......@@ -124,13 +112,13 @@ void WeightPrediction::getWpScaling(const Slice *pcSlice,
const int bitDepth = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
const int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth - 8));
wp0[yuv].w = wp0[yuv].iWeight;
wp1[yuv].w = wp1[yuv].iWeight;
wp0[yuv].o = wp0[yuv].iOffset * offsetScalingFactor;
wp1[yuv].o = wp1[yuv].iOffset * offsetScalingFactor;
wp0[yuv].w = wp0[yuv].codedWeight;
wp1[yuv].w = wp1[yuv].codedWeight;
wp0[yuv].o = wp0[yuv].codedOffset * offsetScalingFactor;
wp1[yuv].o = wp1[yuv].codedOffset * offsetScalingFactor;
wp0[yuv].offset = wp0[yuv].o + wp1[yuv].o;
wp0[yuv].shift = wp0[yuv].uiLog2WeightDenom + 1;
wp0[yuv].round = (1 << wp0[yuv].uiLog2WeightDenom);
wp0[yuv].shift = wp0[yuv].log2WeightDenom + 1;
wp0[yuv].round = (1 << wp0[yuv].log2WeightDenom);
wp1[yuv].offset = wp0[yuv].offset;
wp1[yuv].shift = wp0[yuv].shift;
wp1[yuv].round = wp0[yuv].round;
......@@ -146,10 +134,10 @@ void WeightPrediction::getWpScaling(const Slice *pcSlice,
const int bitDepth = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
const int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth - 8));
pwp[yuv].w = pwp[yuv].iWeight;
pwp[yuv].offset = pwp[yuv].iOffset * offsetScalingFactor;
pwp[yuv].shift = pwp[yuv].uiLog2WeightDenom;
pwp[yuv].round = (pwp[yuv].uiLog2WeightDenom >= 1) ? (1 << (pwp[yuv].uiLog2WeightDenom - 1)) : (0);
pwp[yuv].w = pwp[yuv].codedWeight;
pwp[yuv].offset = pwp[yuv].codedOffset * offsetScalingFactor;
pwp[yuv].shift = pwp[yuv].log2WeightDenom;
pwp[yuv].round = (pwp[yuv].log2WeightDenom >= 1) ? (1 << (pwp[yuv].log2WeightDenom - 1)) : (0);
}
}
}
......
......@@ -55,12 +55,8 @@ class WeightPrediction
public:
WeightPrediction();
void getWpScaling( const Slice *slice,
const int &iRefIdx0,
const int &iRefIdx1,
WPScalingParam *&wp0,
WPScalingParam *&wp1,
const ComponentID maxNumComp = MAX_NUM_COMPONENT );
void getWpScaling(Slice *slice, const int &iRefIdx0, const int &iRefIdx1, WPScalingParam *&wp0, WPScalingParam *&wp1,
const ComponentID maxNumComp = MAX_NUM_COMPONENT);
void addWeightBi( const CPelUnitBuf &pcYuvSrc0,
const CPelUnitBuf &pcYuvSrc1,
......
......@@ -907,7 +907,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
if (pu.mmvdMergeFlag || pu.cu->mmvdSkip)
{
CHECK(pu.ciipFlag == true, "invalid Ciip");
if (pu.cs->sps->getSBTMVPEnabledFlag())
if (pu.cs->sps->getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale(pu.lumaSize());
mrgCtx.subPuMvpMiBuf = MotionBuf(m_SubPuMiBuf, bufSize);
......@@ -934,7 +934,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu )
if( pu.cu->affine )
{
AffineMergeCtx affineMergeCtx;
if ( pu.cs->sps->getSBTMVPEnabledFlag() )
if (pu.cs->sps->getSbTMVPEnabledFlag())
{
Size bufSize = g_miScaling.scale( pu.lumaSize() );
mrgCtx.subPuMvpMiBuf = MotionBuf( m_SubPuMiBuf, bufSize );
......
......@@ -691,7 +691,11 @@ void DecLib::finishPictureLight(int& poc, PicList*& rpcListPic )
m_puCounter++;
}
#if JVET_R0270
void DecLib::finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl, bool associatedWithNewClvs)
#else
void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl )
#endif
{
#if RExt__DECODER_DEBUG_TOOL_STATISTICS
CodingStatistics::StatTool& s = CodingStatistics::GetStatisticTool( STATS__TOOL_TOTAL_FRAME );
......@@ -775,6 +779,30 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl )
#endif
m_pcPic->neededForOutput = (pcSlice->getPicHeader()->getPicOutputFlag() ? true : false);
#if JVET_R0270
if (associatedWithNewClvs && m_pcPic->neededForOutput)
{
if (!pcSlice->getPPS()->getMixedNaluTypesInPicFlag() && pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL)
{
m_pcPic->neededForOutput = false;
}
else if (pcSlice->getPPS()->getMixedNaluTypesInPicFlag())
{
bool isRaslPic = true;
for (int i = 0; isRaslPic && i < m_pcPic->numSlices; i++)
{
if (!(pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RASL || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL))
{
isRaslPic = false;
}
}
if (isRaslPic)
{
m_pcPic->neededForOutput = false;
}
}
}
#endif
m_pcPic->reconstructed = true;
......@@ -930,8 +958,7 @@ void DecLib::checkLayerIdIncludedInCvss()
return;
}
if (m_audIrapOrGdrAuFlag &&
(m_isFirstAuInCvs || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL))
if (m_audIrapOrGdrAuFlag && (m_isFirstAuInCvs || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP || m_accessUnitPicInfo.begin()->m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL))
{
// store layerIDs in the first AU
m_firstAccessUnitPicInfo.assign(m_accessUnitPicInfo.begin(), m_accessUnitPicInfo.end());
......@@ -1964,7 +1991,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
if (m_picHeader.getGdrOrIrapPicFlag() && m_bFirstSliceInPicture)
{
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
m_accessUnitNoOutputPriorPicFlags.push_back(m_apcSlicePilot->getNoOutputOfPriorPicsFlag());
#else
m_accessUnitNoOutputPriorPicFlags.push_back(m_picHeader.getNoOutputOfPriorPicsFlag());
#endif
}
PPS *pps = m_parameterSetManager.getPPS(m_picHeader.getPPSId());
......@@ -2083,11 +2114,19 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
//the inference for NoOutputOfPriorPicsFlag
if( !m_firstSliceInBitstream && m_picHeader.getNoOutputBeforeRecoveryFlag() )
{
m_picHeader.setNoOutputOfPriorPicsFlag( true );
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
m_apcSlicePilot->setNoOutputOfPriorPicsFlag(true);
#else
m_picHeader.setNoOutputOfPriorPicsFlag(true);
#endif
}
else
{
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
m_apcSlicePilot->setNoOutputOfPriorPicsFlag(false);
#else
m_picHeader.setNoOutputOfPriorPicsFlag(false);
#endif
}
if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR)
......@@ -2095,7 +2134,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
m_lastNoOutputBeforeRecoveryFlag[nalu.m_nuhLayerId] = m_picHeader.getNoOutputBeforeRecoveryFlag();
}
if( m_picHeader.getNoOutputOfPriorPicsFlag() )
#if JVET_S0193_NO_OUTPUT_PRIOR_PIC
if (m_apcSlicePilot->getNoOutputOfPriorPicsFlag())
#else
if (m_picHeader.getNoOutputOfPriorPicsFlag())
#endif
{
m_lastPOCNoOutputPriorPics = m_apcSlicePilot->getPOC();
m_isNoOutputPriorPics = true;
......@@ -2256,6 +2299,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
m_firstSliceInBitstream = false;
Slice* pcSlice = m_pcPic->slices[m_uiSliceSegmentIdx];
#if JVET_R0270
m_pcPic->numSlices = m_uiSliceSegmentIdx + 1;
#endif
pcSlice->setPic( m_pcPic );
m_pcPic->poc = pcSlice->getPOC();
m_pcPic->referenced = true;
......
......@@ -216,7 +216,11 @@ public:
void deletePicBuffer();
void executeLoopFilters();
void finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl = INFO);
#if JVET_R0270
void finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl = INFO, bool associatedWithNewClvs = false);
#else
void finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl = INFO);
#endif
void finishPictureLight(int& poc, PicList*& rpcListPic );
void checkNoOutputPriorPics (PicList* rpcListPic);
void checkNalUnitConstraints( uint32_t naluType );
......
......@@ -326,6 +326,12 @@ void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType
sei = new SEIDecodedPictureHash;
xParseSEIDecodedPictureHash((SEIDecodedPictureHash&) *sei, payloadSize, pDecodedMessageOutputStream);
break;
#if JVET_R0294_SUBPIC_HASH
case SEI::SCALABLE_NESTING:
sei = new SEIScalableNesting;
xParseSEIScalableNesting((SEIScalableNesting&)*sei, nalUnitType, nuh_layer_id, payloadSize, vps, sps, pDecodedMessageOutputStream);
break;
#endif