Commit 45ce452b authored by Xiaozhen Zheng's avatar Xiaozhen Zheng

add K0157 Composite Longterm Reference

parent 48883834
......@@ -131,6 +131,8 @@ DMVR : 1
IMV : 2
DepQuant : 1
CompositeLTReference : 1
# Fast tools
PBIntraFast : 1
FastMrg : 1
......
......@@ -130,6 +130,7 @@ DepQuant : 1
IMV : 2
ALF : 1
CompositeLTReference : 1
# Fast tools
PBIntraFast : 1
......
......@@ -131,6 +131,8 @@ DMVR : 1
IMV : 2
DepQuant : 1
CompositeLTReference : 1
# Fast tools
PBIntraFast : 1
FastMrg : 1
......
......@@ -130,6 +130,7 @@ DepQuant : 1
IMV : 2
ALF : 1
CompositeLTReference : 1
# Fast tools
PBIntraFast : 1
......
......@@ -300,6 +300,9 @@ void EncApp::xInitLibCfg()
#if JEM_TOOLS
m_cEncLib.setUseDMVR ( m_DMVR );
m_cEncLib.setMDMS ( m_MDMS );
#endif
#if JVET_K0157
m_cEncLib.setUseCompositeRef ( m_CompositeRefEnabled );
#endif
// ADD_NEW_TOOL : (encoder app) add setting of tool enabling flags and associated parameters here
......
......@@ -910,6 +910,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#if JEM_TOOLS
("DMVR", m_DMVR, false, "Enable decoder-side motion vector refinement")
("MDMS", m_MDMS, false, "multiple direct mode signaling")
#endif
#if JVET_K0157
("CompositeLTReference", m_CompositeRefEnabled, false, "Enable Composite Long Term Reference Frame")
#endif
// ADD_NEW_TOOL : (encoder app) add parsing parameters here
......@@ -1352,6 +1355,18 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
po::ErrorReporter err;
const list<const char*>& argv_unhandled = po::scanArgv(opts, argc, (const char**) argv, err);
#if JVET_K0157
if (m_CompositeRefEnabled) {
for (int i = 0; i < m_iGOPSize; i++) {
m_GOPList[i].m_POC *= 2;
m_GOPList[i].m_deltaRPS *= 2;
for (int j = 0; j < m_GOPList[i].m_numRefPics; j++) {
m_GOPList[i].m_referencePics[j] *= 2;
}
}
}
#endif
for (list<const char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
{
msg( ERROR, "Unhandled argument ignored: `%s'\n", *it);
......@@ -2025,6 +2040,9 @@ bool EncAppCfg::xCheckParameter()
#endif
#if JEM_TOOLS
xConfirmPara( m_IntraPDPC, "PDPC is only allowed with NEXT profile" );
#endif
#if JVET_K0157
xConfirmPara(m_CompositeRefEnabled, "Composite Reference Frame is only allowed with NEXT profile");
#endif
// ADD_NEW_TOOL : (parameter check) add a check for next tools here
}
......@@ -2537,6 +2555,9 @@ bool EncAppCfg::xCheckParameter()
xConfirmPara( m_intraConstraintFlag, "IntraConstraintFlag cannot be 1 for inter sequences");
}
#if JVET_K0157
int multiple_factor = m_CompositeRefEnabled ? 2 : 1;
#endif
bool verifiedGOP=false;
bool errorGOP=false;
int checkGOP=1;
......@@ -2557,7 +2578,11 @@ bool EncAppCfg::xCheckParameter()
for(int i=0; i<m_iGOPSize; i++)
{
#if JVET_K0157
if (m_GOPList[i].m_POC == m_iGOPSize * multiple_factor)
#else
if(m_GOPList[i].m_POC==m_iGOPSize)
#endif
{
xConfirmPara( m_GOPList[i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " );
}
......@@ -2591,7 +2616,11 @@ bool EncAppCfg::xCheckParameter()
while(!verifiedGOP&&!errorGOP)
{
int curGOP = (checkGOP-1)%m_iGOPSize;
#if JVET_K0157
int curPOC = ((checkGOP - 1) / m_iGOPSize)*m_iGOPSize * multiple_factor + m_GOPList[curGOP].m_POC;
#else
int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_GOPList[curGOP].m_POC;
#endif
if(m_GOPList[curGOP].m_POC<0)
{
msg( WARNING, "\nError: found fewer Reference Picture Sets than GOPSize\n");
......@@ -2618,7 +2647,11 @@ bool EncAppCfg::xCheckParameter()
found=true;
for(int k=0; k<m_iGOPSize; k++)
{
#if JVET_K0157
if (absPOC % (m_iGOPSize * multiple_factor) == m_GOPList[k].m_POC % (m_iGOPSize * multiple_factor))
#else
if(absPOC%m_iGOPSize == m_GOPList[k].m_POC%m_iGOPSize)
#endif
{
if(m_GOPList[k].m_temporalId==m_GOPList[curGOP].m_temporalId)
{
......@@ -2670,7 +2703,11 @@ bool EncAppCfg::xCheckParameter()
{
//step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
int offGOP = (checkGOP-1+offset)%m_iGOPSize;
#if JVET_K0157
int offPOC = ((checkGOP - 1 + offset) / m_iGOPSize)*(m_iGOPSize * multiple_factor) + m_GOPList[offGOP].m_POC;
#else
int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_GOPList[offGOP].m_POC;
#endif
if(offPOC>=0&&m_GOPList[offGOP].m_temporalId<=m_GOPList[curGOP].m_temporalId)
{
bool newRef=false;
......@@ -3374,6 +3411,9 @@ void EncAppCfg::xPrintParameter()
#if JEM_TOOLS
msg( VERBOSE, "DMVR:%d ", m_DMVR );
msg( VERBOSE, "MDMS:%d ", m_MDMS );
#endif
#if JVET_K0157
msg(VERBOSE, "CompositeLTReference:%d ", m_CompositeRefEnabled);
#endif
}
// ADD_NEW_TOOL (add some output indicating the usage of tools)
......
......@@ -281,6 +281,9 @@ protected:
#if JEM_TOOLS
bool m_DMVR;
bool m_MDMS;
#endif
#if JVET_K0157
bool m_CompositeRefEnabled;
#endif
// ADD_NEW_TOOL : (encoder app) add tool enabling flags and associated parameters here
......
......@@ -2898,7 +2898,14 @@ void InterPrediction::xFrucCollectSubBlkStartMv( PredictionUnit& pu, const Merge
}
mvCand.refIdx = rMvStart.refIdx;
#if JVET_K0157
if (pColPic->cs->slice->getRefPic((RefPicList)nRefListColPic, colMi.refIdx[nRefListColPic])->longTerm)
mvCand.mv = rColMv;
else
mvCand.mv = PU::scaleMv(rColMv, nCurPOC, nCurRefPOC, pColPic->getPOC(), pColPic->cs->slice->getRefPOC((RefPicList)nRefListColPic, colMi.refIdx[nRefListColPic]), pu.cs->slice);
#else
mvCand.mv = PU::scaleMv( rColMv , nCurPOC , nCurRefPOC , pColPic->getPOC(), pColPic->cs->slice->getRefPOC( ( RefPicList )nRefListColPic , colMi.refIdx[nRefListColPic] ), pu.cs->slice );
#endif
if( mvCand.refIdx < 0 )
{
printf( "base" );
......
......@@ -728,6 +728,10 @@ Picture::Picture()
{
m_prevQP[i] = -1;
}
#if JVET_K0157
m_SpliceIdx = NULL;
ctuNums = 0;
#endif
}
void Picture::create(const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned _margin, const bool _decoder)
......@@ -788,6 +792,13 @@ void Picture::destroy()
tileMap = nullptr;
}
#endif
#if JVET_K0157
if (m_SpliceIdx)
{
delete[] m_SpliceIdx;
m_SpliceIdx = NULL;
}
#endif
}
void Picture::createTempBuffers( const unsigned _maxCUSize )
......@@ -903,6 +914,14 @@ void Picture::finalInit( const SPS& sps, const PPS& pps )
tileMap = new TileMap;
tileMap->create( sps, pps );
#endif
#if JVET_K0157
if (m_SpliceIdx == NULL)
{
ctuNums = cs->pcv->sizeInCtus;
m_SpliceIdx = new int[ctuNums];
memset(m_SpliceIdx, 0, ctuNums * sizeof(int));
}
#endif
}
void Picture::allocateNewSlice()
......@@ -1113,3 +1132,25 @@ Pel* Picture::getOrigin( const PictureType &type, const ComponentID compID ) con
return M_BUFS( jId, type ).getOrigin( compID );
}
#if JVET_K0157
void Picture::createSpliceIdx(int nums)
{
ctuNums = nums;
m_SpliceIdx = new int[ctuNums];
memset(m_SpliceIdx, 0, ctuNums * sizeof(int));
}
bool Picture::getSpliceFull()
{
int count = 0;
for (int i = 0; i < ctuNums; i++)
{
if (m_SpliceIdx[i] != 0)
count++;
}
if (count < ctuNums * 0.25)
return false;
return true;
}
#endif
......@@ -225,6 +225,14 @@ struct Picture : public UnitArea
int getPOC() const { return poc; }
void setBorderExtension( bool bFlag) { m_bIsBorderExtended = bFlag;}
Pel* getOrigin( const PictureType &type, const ComponentID compID ) const;
#if JVET_K0157
int getSpliceIdx(uint32_t idx) const { return m_SpliceIdx[idx]; }
void setSpliceIdx(uint32_t idx, int poc) { m_SpliceIdx[idx] = poc; }
void createSpliceIdx(int nums);
bool getSpliceFull();
#endif
public:
bool m_bIsBorderExtended;
bool referenced;
......@@ -240,6 +248,11 @@ public:
uint32_t layer;
uint32_t depth;
#if JVET_K0157
int* m_SpliceIdx;
int ctuNums;
#endif
#if ENABLE_SPLIT_PARALLELISM
#if ENABLE_WPP_PARALLELISM
PelStorage m_bufs[( PARL_SPLIT_MAX_NUM_JOBS * PARL_WPP_MAX_NUM_THREADS )][NUM_PIC_TYPES];
......
......@@ -1343,7 +1343,11 @@ int Slice::checkThatAllRefPicsAreAvailable( PicList& rcListPic, const ReferenceP
/** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set
*/
void Slice::createExplicitReferencePictureSetFromReference( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled)
void Slice::createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled
#if JVET_K0157
, bool isEncodeLtRef, bool CompositeRefEnable
#endif
)
{
Picture* rpcPic;
int i, j;
......@@ -1383,7 +1387,11 @@ void Slice::createExplicitReferencePictureSetFromReference( PicList& rcListPic,
}
else
{
#if JVET_K0157
if (bEfficientFieldIRAPEnabled && rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC() + (CompositeRefEnable ? 2 : 1))
#else
if(bEfficientFieldIRAPEnabled && rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1)
#endif
{
irapIsInRPS = true;
}
......@@ -1402,7 +1410,11 @@ void Slice::createExplicitReferencePictureSetFromReference( PicList& rcListPic,
while ( iterPic != rcListPic.end())
{
rpcPic = *(iterPic++);
#if JVET_K0157
if (rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC() + (CompositeRefEnable ? 2 : 1))
#else
if(rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC()+1)
#endif
{
pLocalRPS->setDeltaPOC(k, 1);
pLocalRPS->setUsed(k, true);
......@@ -1412,6 +1424,53 @@ void Slice::createExplicitReferencePictureSetFromReference( PicList& rcListPic,
}
}
}
#if JVET_K0157
if (CompositeRefEnable && isEncodeLtRef)
{
useNewRPS = true;
nrOfNegativePictures = 0;
nrOfPositivePictures = 0;
for (i = 0; i<pReferencePictureSet->getNumberOfPictures(); i++)
{
j = 0;
k = 0;
// loop through all pictures in the reference picture buffer
PicList::iterator iterPic = rcListPic.begin();
while (iterPic != rcListPic.end())
{
j++;
rpcPic = *(iterPic++);
if (rpcPic->getPOC() == this->getPOC() + 1 + pReferencePictureSet->getDeltaPOC(i) && rpcPic->referenced)
{
// This picture exists as a reference picture
// and should be added to the explicit Reference Picture Set
pLocalRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i) + 1);
pLocalRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
if (bEfficientFieldIRAPEnabled)
{
pLocalRPS->setUsed(k, pLocalRPS->getUsed(k) && !(bUseRecoveryPoint && this->getPOC() > pocRandomAccess && this->getPOC() + pReferencePictureSet->getDeltaPOC(i) + 1 < pocRandomAccess));
}
if (pLocalRPS->getDeltaPOC(k) < 0)
{
nrOfNegativePictures++;
}
else
{
if (bEfficientFieldIRAPEnabled && rpcPic->getPOC() == this->getAssociatedIRAPPOC() && this->getAssociatedIRAPPOC() == this->getPOC() + 2)
{
irapIsInRPS = true;
}
nrOfPositivePictures++;
}
k++;
}
}
}
}
#endif
pLocalRPS->setNumberOfNegativePictures(nrOfNegativePictures);
pLocalRPS->setNumberOfPositivePictures(nrOfPositivePictures);
pLocalRPS->setNumberOfPictures(nrOfNegativePictures+nrOfPositivePictures);
......@@ -1837,6 +1896,9 @@ SPSNext::SPSNext( SPS& sps )
#endif
#if JEM_TOOLS
, m_CIPFMode ( 0 )
#endif
#if JVET_K0157
, m_CompositeRefEnabled ( false )
#endif
// ADD_NEW_TOOL : (sps extension) add tool enabling flags here (with "false" as default values)
{
......
......@@ -936,6 +936,9 @@ private:
#endif
#if JEM_TOOLS
unsigned m_CIPFMode;
#endif
#if JVET_K0157
bool m_CompositeRefEnabled; //composite longterm reference
#endif
// ADD_NEW_TOOL : (sps extension) add tool enabling flags and associated parameters here
......@@ -1157,6 +1160,10 @@ public:
int getIntraPDPCMode () const { return m_IntraPDPCMode; }
bool isIntraPDPC () const { return 0 != (m_IntraPDPCMode&1); }
bool isPlanarPDPC () const { return 0 != (m_IntraPDPCMode&2); }
#endif
#if JVET_K0157
void setUseCompositeRef(bool b) { m_CompositeRefEnabled = b; }
bool getUseCompositeRef() const { return m_CompositeRefEnabled; }
#endif
// ADD_NEW_TOOL : (sps extension) add access functions for tool enabling flags and associated parameters here
......@@ -1985,9 +1992,13 @@ public:
bool isTemporalLayerSwitchingPoint( PicList& rcListPic ) const;
bool isStepwiseTemporalLayerSwitchingPointCandidate( PicList& rcListPic ) const;
int checkThatAllRefPicsAreAvailable( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool printErrors, int pocRandomAccess = 0, bool bUseRecoveryPoint = false) const;
void createExplicitReferencePictureSetFromReference( PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled);
void createExplicitReferencePictureSetFromReference(PicList& rcListPic, const ReferencePictureSet *pReferencePictureSet, bool isRAP, int pocRandomAccess, bool bUseRecoveryPoint, const bool bEfficientFieldIRAPEnabled
#if JVET_K0157
, bool isEncodeLtRef, bool CompositeRefEanble
#endif
);
void setMaxNumMergeCand(uint32_t val ) { m_maxNumMergeCand = val; }
uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; }
uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; }
void setNoOutputPriorPicsFlag( bool val ) { m_noOutputPriorPicsFlag = val; }
bool getNoOutputPriorPicsFlag() const { return m_noOutputPriorPicsFlag; }
......
......@@ -189,6 +189,7 @@
#define HEVC_USE_SIGN_HIDING 1
#endif
#define JVET_K0157 1
#define KEEP_PRED_AND_RESI_SIGNALS 0
......
......@@ -97,7 +97,15 @@ static void xInitFrucMvpEl( CodingStructure& cs, int x, int y, int nCurPOC, int
mvColPic.setHighPrec();
}
#if JVET_K0157
Mv mv2CurRefPic;
if (cs.slice->getRefPic(eRefPicList, frucMi.refIdx[eRefPicList])->longTerm)
mv2CurRefPic = mvColPic;
else
mv2CurRefPic = PU::scaleMv(mvColPic, nCurPOC, nCurRefPOC, nColPOC, nColRefPOC, cs.slice);
#else
Mv mv2CurRefPic = PU::scaleMv( mvColPic, nCurPOC, nCurRefPOC, nColPOC, nColRefPOC, cs.slice );
#endif
int xCurPic = 0;
int yCurPic = 0;
......@@ -2825,7 +2833,14 @@ static bool deriveScaledMotionTemporal( const Slice& slice,
cColMv = mi.mv[eColRefPicList];
//pcMvFieldSP[2*iPartition + eCurrRefPicList].getMv();
// Assume always short-term for now
#if JVET_K0157
if (slice.getRefPic(eColRefPicList, 0)->longTerm)
iScale = 4096;
else
iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
#else
iScale = xGetDistScaleFactor( iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC );
#endif
if( iScale != 4096 )
{
......@@ -3029,7 +3044,15 @@ bool PU::getInterMergeSubPuMvpCand( const PredictionUnit &pu, MergeCtx& mrgCtx,
if( iNewColPicPOC != iPocColPic )
{
//////////////// POC based scaling of the temporal vector /////////////
#if JVET_K0157
int iScale;
if (pColPic->longTerm)
iScale = 4096;
else
iScale = xGetDistScaleFactor(slice.getPOC(), iNewColPicPOC, slice.getPOC(), iPocColPic);
#else
int iScale = xGetDistScaleFactor( slice.getPOC(), iNewColPicPOC, slice.getPOC(), iPocColPic );
#endif
if( iScale != 4096 )
{
cTempVector = cTMv.scaleMv( iScale );
......@@ -3222,7 +3245,15 @@ bool PU::getMvPair( const PredictionUnit &pu, RefPicList eCurRefPicList, const M
int nCurPOC = slice.getPOC();
int nRefPOC = slice.getRefPOC( eCurRefPicList , rCurMvField.refIdx );
int nTargetPOC = slice.getRefPOC( eTarRefPicList , nTargetRefIdx );
#if JVET_K0157
int nScale = 4096;
if (slice.getRefPic(eTarRefPicList, rCurMvField.refIdx)->longTerm || slice.getRefPic(eTarRefPicList, nTargetRefIdx)->longTerm)
nScale = 4096;
else
nScale = xGetDistScaleFactorFRUC(nCurPOC, nTargetPOC, nCurPOC, nRefPOC, pu.cs->slice);
#else
int nScale = xGetDistScaleFactorFRUC( nCurPOC , nTargetPOC , nCurPOC , nRefPOC, pu.cs->slice );
#endif
rMvPair.mv = rCurMvField.mv.scaleMv( nScale );
rMvPair.refIdx = nTargetRefIdx;
......@@ -3273,7 +3304,15 @@ static void getNeighboringMvField( const Slice& slice, const MotionInfo &miNB, M
iRefPOCSrc = slice.getRefPOC( eRefPicListSrc, miNB.refIdx[eRefPicListSrc] );
iRefPOCMirror = slice.getRefPOC( eRefPicListSrc, 0 );
#if JVET_K0157
int iScale;
if (slice.getRefPic(eRefPicListSrc, miNB.refIdx[eRefPicListSrc])->longTerm)
iScale = 4096;
else
iScale = xGetDistScaleFactor(slice.getPOC(), iRefPOCMirror, slice.getPOC(), iRefPOCSrc);
#else
int iScale = xGetDistScaleFactor( slice.getPOC(), iRefPOCMirror, slice.getPOC(), iRefPOCSrc );
#endif
if( iScale == 4096 )
{
cMvField[uiMvIdxSrc].setMvField( miNB.mv[eRefPicListSrc], 0 );
......@@ -3319,7 +3358,15 @@ static void getNeighboringMvField( const Slice& slice, const MotionInfo &miNB, M
else
{
iRefPOCMirror = slice.getRefPOC( eRefPicListSrc, 0 );
#if JVET_K0157
int iScale;
if (slice.getRefPic(eRefPicListSrc, miNB.refIdx[eRefPicListSrc])->longTerm)
iScale = 4096;
else
iScale = xGetDistScaleFactor(slice.getPOC(), iRefPOCMirror, slice.getPOC(), iRefPOCSrc);
#else
int iScale = xGetDistScaleFactor( slice.getPOC(), iRefPOCMirror, slice.getPOC(), iRefPOCSrc );
#endif
if( iScale == 4096 )
{
cMvField[uiMvIdxSrc].setMvField( miNB.mv[eRefPicListSrc], 0 );
......
......@@ -84,9 +84,17 @@ public:
virtual ~Analyze() {}
Analyze() { clear(); }
void addResult( double psnr[MAX_NUM_COMPONENT], double bits, const double MSEyuvframe[MAX_NUM_COMPONENT])
void addResult( double psnr[MAX_NUM_COMPONENT], double bits, const double MSEyuvframe[MAX_NUM_COMPONENT]
#if JVET_K0157
, bool isEncodeLtRef
#endif
)
{
m_dAddBits += bits;
#if JVET_K0157
if (isEncodeLtRef)
return;
#endif
for(uint32_t i=0; i<MAX_NUM_COMPONENT; i++)
{
m_dPSNRSum[i] += psnr[i];
......
......@@ -269,6 +269,9 @@ protected:
#endif
#if JEM_TOOLS
bool m_DMVR;
#endif
#if JVET_K0157
bool m_CompositeRefEnabled; //composite reference
#endif
// ADD_NEW_TOOL : (encoder lib) add tool enabling flags and associated parameters here
......@@ -822,6 +825,11 @@ public:
void setMDMS ( bool b ) { m_MDMS = b; }
bool getMDMS () const { return m_MDMS; }
#endif
#if JVET_K0157
void setUseCompositeRef (bool b) { m_CompositeRefEnabled = b; }
bool getUseCompositeRef () const { return m_CompositeRefEnabled; }
#endif
// ADD_NEW_TOOL : (encoder lib) add access functions here
void setMaxCUWidth ( uint32_t u ) { m_maxCUWidth = u; }
......
This diff is collapsed.
......@@ -131,6 +131,15 @@ private:
SEIWriter m_seiWriter;
#if JVET_K0157
Picture * m_rpcPicBg;
Picture * m_rpcPicOrig;
int m_BgPOC;
bool m_EncodedLTRef;
bool m_PrepareLTRef;
bool m_UseLTRef;
int m_LastLTRefPoc;
#endif
//--Adaptive Loop filter
EncSampleAdaptiveOffset* m_pcSAO;
#if JEM_TOOLS || JVET_K0371_ALF
......@@ -173,14 +182,34 @@ public:
void init ( EncLib* pcEncLib );
void compressGOP ( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, std::list<PelUnitBuf*>& rcListPicYuvRec,
bool isField, bool isTff, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE );
bool isField, bool isTff, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE
#if JVET_K0157
, bool isEncodeLtRef
#endif
);
void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, OutputBitstream* pcBitstreamRedirect);
int getGOPSize() { return m_iGopSize; }
PicList* getListPic() { return m_pcListPic; }
#if JVET_K0157
void setPicBg(Picture* rpcTmpPicBg) { m_rpcPicBg = rpcTmpPicBg; }
Picture* getPicBg() const { return m_rpcPicBg; }
void setPicOrig(Picture* rpcTmpPicBg) { m_rpcPicOrig = rpcTmpPicBg; }
Picture* getPicOrig() { return m_rpcPicOrig; }
void setNewestBgPOC(int poc) { m_BgPOC = poc; }
int getNewestBgPOC() const { return m_BgPOC; }
void setEncodedLTRef(bool EncodedLTRef) { m_EncodedLTRef = EncodedLTRef; }
bool getEncodedLTRef() { return m_EncodedLTRef; }
void setUseLTRef(bool UseLTRef) { m_UseLTRef = UseLTRef; }
bool getUseLTRef() { return m_UseLTRef; }
void setPrepareLTRef(bool PrepareLTRef) { m_PrepareLTRef = PrepareLTRef; }
bool getPrepareLTRef() { return m_PrepareLTRef; }
void setLastLTRefPoc(int LastLTRefPoc) { m_LastLTRefPoc = LastLTRefPoc; }
int getLastLTRefPoc() const { return m_LastLTRefPoc; }
#endif
void printOutSummary ( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const BitDepths &bitDepths );
#if W0038_DB_OPT
uint64_t preLoopFilterPicAndCalcDist( Picture* pcPic );
......@@ -188,6 +217,10 @@ public:
EncSlice* getSliceEncoder() { return m_pcSliceEncoder; }
NalUnitType getNalUnitType( int pocCurr, int lastIdr, bool isField );
void arrangeLongtermPicturesInRPS(Slice *, PicList& );
#if JVET_K0157
void ArrangeBackgroundReference(Slice* pcSlice, PicList& rcListPic, int pocCurr);
void UpdateBackgroundReference(Slice* pcSlice, PicList& rcListPic, int pocCurr);
#endif
#if EXTENSION_360_VIDEO
Analyze& getAnalyzeAllData() { return m_gcAnalyzeAll; }
......@@ -201,15 +234,31 @@ protected:
protected:
void xInitGOP ( int iPOCLast, int iNumPicRcvd, bool isField );
void xInitGOP ( int iPOCLast, int iNumPicRcvd, bool isField
#if JVET_K0157
, bool isEncodeLtRef
#endif
);
void xGetBuffer ( PicList& rcListPic, std::list<PelUnitBuf*>& rcListPicYuvRecOut,
int iNumPicRcvd, int iTimeOffset, Picture*& rpcPic, int pocCurr, bool isField );
void xCalculateAddPSNRs ( const bool isField, const bool isFieldTopFieldFirst, const int iGOPid, Picture* pcPic, const AccessUnit&accessUnit, PicList &rcListPic, int64_t dEncTime, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE, double* PSNR_Y );
void xCalculateAddPSNR ( Picture* pcPic, PelUnitBuf cPicD, const AccessUnit&, double dEncTime, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE, double* PSNR_Y );
void xCalculateAddPSNRs(const bool isField, const bool isFieldTopFieldFirst, const int iGOPid, Picture* pcPic, const AccessUnit&accessUnit, PicList &rcListPic, int64_t dEncTime, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE, double* PSNR_Y
#if JVET_K0157
, bool isEncodeLtRef
#endif
);
void xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUnit&, double dEncTime, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE, double* PSNR_Y
#if JVET_K0157
, bool isEncodeLtRef
#endif
);
void xCalculateInterlacedAddPSNR( Picture* pcPicOrgFirstField, Picture* pcPicOrgSecondField,
PelUnitBuf cPicRecFirstField, PelUnitBuf cPicRecSecondField,
const InputColourSpaceConversion snr_conversion, const bool printFrameMSE, double* PSNR_Y );
const InputColourSpaceConversion snr_conversion, const bool printFrameMSE, double* PSNR_Y
#if JVET_K0157
, bool isEncodeLtRef
#endif
);
uint64_t xFindDistortionPlane(const CPelBuf& pic0, const CPelBuf& pic1, const uint32_t rshift
#if ENABLE_QPA
......
This diff is collapsed.
......@@ -161,6 +161,9 @@ protected:
void xInitPPS (PPS &pps, const SPS &sps); ///< initialize PPS from encoder options
#if HEVC_USE_SCALING_LISTS
void xInitScalingLists (SPS &sps, PPS &pps); ///< initialize scaling lists
#endif
#if JVET_K0157
void xInitPPSforLT(PPS& pps);
#endif
void xInitHrdParameters(SPS &sps); ///< initialize HRD parameters
......@@ -230,7 +233,12 @@ public:
#endif
RateCtrl* getRateCtrl () { return &m_cRateCtrl; }
void selectReferencePictureSet(Slice* slice, int POCCurr, int GOPid );
void selectReferencePictureSet(Slice* slice, int POCCurr, int GOPid
#if JVET_K0157
, int LtPoc, PicList& rcListPic
#endif
);
int getReferencePictureSetIdxForSOP(int POCCurr, int GOPid );
bool PPSNeedsWriting(int ppsId);
......
......@@ -983,7 +983,15 @@ void EncModeCtrlMTnoRQT::initCTUEncoding( const Slice &slice )
if( m_pcEncCfg->getUseE0023FastEnc() )
{
m_skipThreshold = ( ( slice.getMinPictureDistance() <= PICTURE_DISTANCE_TH ) ? FAST_SKIP_DEPTH : SKIP_DEPTH );
#if JVET_K0157
if (m_pcEncCfg->getUseCompositeRef())
m_skipThreshold = ( ( slice.getMinPictureDistance() <= PICTURE_DISTANCE_TH * 2 ) ? FAST_SKIP_DEPTH : SKIP_DEPTH );
else
m_skipThreshold = ((slice.getMinPictureDistance() <= PICTURE_DISTANCE_TH) ? FAST_SKIP_DEPTH : SKIP_DEPTH);
#else
m_skipThreshold = ((slice.getMinPictureDistance() <= PICTURE_DISTANCE_TH) ? FAST_SKIP_DEPTH : SKIP_DEPTH);
#endif
}
else
{
......
......@@ -159,8 +159,11 @@ EncSlice::setUpLambda( Slice* slice, const double dLambda, int iQP)
\param rpcSlice slice header class
\param isField true for field coding
*/
void EncSlice::initEncSlice( Picture* pcPic, const int pocLast, const int pocCurr, const int iGOPid, Slice*& rpcSlice, const bool isField )
void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr, const int iGOPid, Slice*& rpcSlice, const bool isField
#if JVET_K0157
, bool isEncodeLtRef
#endif
)
{
double dQP;
double dLambda;
......@@ -169,7 +172,19 @@ void EncSlice::initEncSlice( Picture* pcPic, const int pocLast, const int pocCur
rpcSlice->setSliceBits(0);