diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index a3ddc3d5764d9af2daedb0dd97b1237600106fe4..a0e4ab338014b878da0aa29b08b13f02fe83744d 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1658,16 +1658,16 @@ bool EncApp::encode() /** Write access units to output file. \param bitstreamFile target bitstream file - \param iNumEncoded number of encoded frames + \param numEncoded number of encoded frames \param accessUnits list of access units to be written */ -void EncApp::xWriteOutput( int iNumEncoded, std::list<PelUnitBuf*>& recBufList ) +void EncApp::xWriteOutput(int numEncoded, std::list<PelUnitBuf *> &recBufList) { const InputColourSpaceConversion ipCSC = (!m_outputInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED; std::list<PelUnitBuf*>::iterator iterPicYuvRec = recBufList.end(); int i; - for ( i = 0; i < iNumEncoded; i++ ) + for (i = 0; i < numEncoded; i++) { --iterPicYuvRec; } @@ -1675,7 +1675,7 @@ void EncApp::xWriteOutput( int iNumEncoded, std::list<PelUnitBuf*>& recBufList ) if (m_isField) { //Reinterlace fields - for ( i = 0; i < iNumEncoded/2; i++ ) + for (i = 0; i < numEncoded / 2; i++) { const PelUnitBuf* pcPicYuvRecTop = *(iterPicYuvRec++); const PelUnitBuf* pcPicYuvRecBottom = *(iterPicYuvRec++); @@ -1691,7 +1691,7 @@ void EncApp::xWriteOutput( int iNumEncoded, std::list<PelUnitBuf*>& recBufList ) } else { - for ( i = 0; i < iNumEncoded; i++ ) + for (i = 0; i < numEncoded; i++) { const PelUnitBuf* pcPicYuvRec = *(iterPicYuvRec++); if (!m_reconFileName.empty()) diff --git a/source/App/EncoderApp/EncApp.h b/source/App/EncoderApp/EncApp.h index 9775f8de01fbe7fa9f59cb0ed7e9b096abbce0e6..76f8cbd0f33ae28128da369193fc991157f95b34 100644 --- a/source/App/EncoderApp/EncApp.h +++ b/source/App/EncoderApp/EncApp.h @@ -90,8 +90,7 @@ private: void xDestroyLib (); ///< destroy encoder class // file I/O - void xWriteOutput ( int iNumEncoded, std::list<PelUnitBuf*>& recBufList - ); ///< write bitstream to file + void xWriteOutput(int numEncoded, std::list<PelUnitBuf *> &recBufList); ///< write bitstream to file void rateStatsAccum ( const AccessUnit& au, const std::vector<uint32_t>& stats); void printRateSummary (); void printChromaFormat(); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 032ac47f67f2f328b5ba15f9c76fcd3d419b9a25..1dd2078fae7c1212e13353dfeeba31f053d5a3f3 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -4137,7 +4137,7 @@ bool EncAppCfg::xCheckParameter() { m_maxDecPicBuffering[i] = m_maxNumReorderPics[i] + 1; } - // a lower layer can not have higher value of m_uiMaxDecPicBuffering than a higher layer + // a lower layer can not have higher value of m_maxDecPicBuffering than a higher layer if(m_maxDecPicBuffering[i+1] < m_maxDecPicBuffering[i]) { m_maxDecPicBuffering[i+1] = m_maxDecPicBuffering[i]; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 282cc93d09c8f7ebc7c40c6d2dbcd235f805995c..273b2f9f8cfbf2998ceb6eb651c594fc2a72432e 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -3006,8 +3006,8 @@ SPS::SPS() for ( int i = 0; i < MAX_TLAYER; i++ ) { - m_uiMaxLatencyIncreasePlus1[i] = 0; - m_uiMaxDecPicBuffering[i] = 1; + m_maxLatencyIncreasePlus1[i] = 0; + m_maxDecPicBuffering[i] = 1; m_maxNumReorderPics[i] = 0; } diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 9a465b748ef2adb9fa6f50ccdb501f124896c767..7ad38233f5a1546ab82731c2369be9ed4df4e7a7 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1486,9 +1486,8 @@ private: unsigned m_numHorVirtualBoundaries; //!< number of horizontal virtual boundaries unsigned m_virtualBoundariesPosX[3]; //!< horizontal position of each vertical virtual boundary unsigned m_virtualBoundariesPosY[3]; //!< vertical position of each horizontal virtual boundary - uint32_t m_uiMaxDecPicBuffering[MAX_TLAYER]; - uint32_t m_uiMaxLatencyIncreasePlus1[MAX_TLAYER]; - + uint32_t m_maxDecPicBuffering[MAX_TLAYER]; + uint32_t m_maxLatencyIncreasePlus1[MAX_TLAYER]; bool m_generalHrdParametersPresentFlag; GeneralHrdParams m_generalHrdParams; @@ -1806,10 +1805,28 @@ void setCCALFEnabledFlag( bool b ) unsigned getVirtualBoundariesPosX(unsigned idx) const { CHECK( idx >= 3, "vitrual boundary index exceeds valid range" ); return m_virtualBoundariesPosX[idx]; } void setVirtualBoundariesPosY(unsigned u, unsigned idx) { CHECK( idx >= 3, "vitrual boundary index exceeds valid range" ); m_virtualBoundariesPosY[idx] = u; } unsigned getVirtualBoundariesPosY(unsigned idx) const { CHECK( idx >= 3, "vitrual boundary index exceeds valid range" ); return m_virtualBoundariesPosY[idx]; } - uint32_t getMaxDecPicBuffering(uint32_t tlayer) const { return m_uiMaxDecPicBuffering[tlayer]; } - void setMaxDecPicBuffering( uint32_t ui, uint32_t tlayer ) { CHECK(tlayer >= MAX_TLAYER, "Invalid T-layer"); m_uiMaxDecPicBuffering[tlayer] = ui; } - uint32_t getMaxLatencyIncreasePlus1(uint32_t tlayer) const { return m_uiMaxLatencyIncreasePlus1[tlayer]; } - void setMaxLatencyIncreasePlus1( uint32_t ui , uint32_t tlayer) { m_uiMaxLatencyIncreasePlus1[tlayer] = ui; } + + uint32_t getMaxDecPicBuffering(uint32_t tlayer) const + { + return m_maxDecPicBuffering[tlayer]; + } + + void setMaxDecPicBuffering(uint32_t val, uint32_t tlayer) + { + CHECK(tlayer >= MAX_TLAYER, "Invalid T-layer"); + m_maxDecPicBuffering[tlayer] = val; + } + + uint32_t getMaxLatencyIncreasePlus1(uint32_t tlayer) const + { + return m_maxLatencyIncreasePlus1[tlayer]; + } + + void setMaxLatencyIncreasePlus1(uint32_t val, uint32_t tlayer) + { + m_maxLatencyIncreasePlus1[tlayer] = val; + } + uint32_t getMaxNumMergeCand() const { return m_maxNumMergeCand; } void setMaxNumMergeCand(uint32_t u) { m_maxNumMergeCand = u; } uint32_t getMaxNumAffineMergeCand() const { return m_maxNumAffineMergeCand; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index e916a5a6bd1441bcde6e61dce4167720cb06954c..85d4b5b9c94935deba5fef28a473632a28262b4f 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -864,7 +864,6 @@ enum ImvMode // ==================================================================================================================== /// parameters for adaptive loop filter -class PicSym; #define MAX_NUM_SAO_CLASSES 32 //(NUM_SAO_EO_GROUPS > NUM_SAO_BO_GROUPS)?NUM_SAO_EO_GROUPS:NUM_SAO_BO_GROUPS diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index f981abe5e5fa5ee32c7beeac54938bb4dc33ebea..3336b16496572f8242cb4f84dbb56401462c14d4 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -403,7 +403,7 @@ bool tryDecodePicture( Picture* pcEncPic, const int expectedPoc, const std::stri //! \{ DecLib::DecLib() - : m_iMaxRefPicNum(0) + : m_maxRefPicNum(0) , m_isFirstGeneralHrd(true) , m_prevGeneralHrdParams() , m_associatedIRAPDecodingOrderNumber{ 0 } @@ -582,8 +582,11 @@ void DecLib::deletePicBuffer ( ) Picture* DecLib::xGetNewPicBuffer( const SPS &sps, const PPS &pps, const uint32_t temporalLayer, const int layerId ) { Picture * pcPic = nullptr; - m_iMaxRefPicNum = ( m_vps == nullptr || m_vps->m_numLayersInOls[m_vps->m_targetOlsIdx] == 1 ) ? sps.getMaxDecPicBuffering( temporalLayer ) : m_vps->getMaxDecPicBuffering( temporalLayer ); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded - if (m_cListPic.size() < (uint32_t)m_iMaxRefPicNum) + // getMaxDecPicBuffering() has space for the picture currently being decoded + m_maxRefPicNum = (m_vps == nullptr || m_vps->m_numLayersInOls[m_vps->m_targetOlsIdx] == 1) + ? sps.getMaxDecPicBuffering(temporalLayer) + : m_vps->getMaxDecPicBuffering(temporalLayer); + if (m_cListPic.size() < (uint32_t) m_maxRefPicNum) { pcPic = new Picture(); @@ -622,7 +625,7 @@ Picture* DecLib::xGetNewPicBuffer( const SPS &sps, const PPS &pps, const uint32_ if( ! bBufferIsAvailable ) { //There is no room for this picture, either because of faulty encoder or dropped NAL. Extend the buffer. - m_iMaxRefPicNum++; + m_maxRefPicNum++; pcPic = new Picture(); diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 61fd0c0010bc62ea723a2e90a8cf9cdfea15dae0..1f38522bfeb22a8d1c7ce39ab0896c9911224560 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -68,7 +68,7 @@ bool tryDecodePicture( Picture* pcPic, const int expectedPoc, const std::string& class DecLib { private: - int m_iMaxRefPicNum; + int m_maxRefPicNum; bool m_isFirstGeneralHrd; GeneralHrdParams m_prevGeneralHrdParams; diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index d565b8572abcab238808e0dd468665e523a63859..127a83e67689063159cced9244491b5a3c957d39 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -296,8 +296,8 @@ protected: bool m_AccessUnitDelimiter; ///< add Access Unit Delimiter NAL units bool m_enablePictureHeaderInSliceHeader; ///< Enable Picture Header in Slice Header - int m_iMaxRefPicNum; ///< this is used to mimic the sliding mechanism used by the decoder - // TODO: We need to have a common sliding mechanism used by both the encoder and decoder + int m_maxRefPicNum; ///< this is used to mimic the sliding mechanism used by the decoder + // TODO: We need to have a common sliding mechanism used by both the encoder and decoder int m_maxTempLayer; ///< Max temporal layer bool m_isLowDelay; @@ -1191,8 +1191,14 @@ public: void setSourcePadding ( int* padding) { for ( int i = 0; i < 2; i++ ) m_sourcePadding[i] = padding[i]; } - int getMaxRefPicNum () { return m_iMaxRefPicNum; } - void setMaxRefPicNum ( int iMaxRefPicNum ) { m_iMaxRefPicNum = iMaxRefPicNum; } + int getMaxRefPicNum() + { + return m_maxRefPicNum; + } + void setMaxRefPicNum(int maxRefPicNum) + { + m_maxRefPicNum = maxRefPicNum; + } int getMaxTempLayer () { return m_maxTempLayer; } void setMaxTempLayer ( int maxTempLayer ) { m_maxTempLayer = maxTempLayer; } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 3e26d3173920235dd0dbe689edb6317dc1083202..c3eaaa28940c9e8d63c0e733d0635374925d00ac 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -69,11 +69,11 @@ EncLib::EncLib( EncLibCommon* encLibCommon ) , m_vps( encLibCommon->getVPS() ) , m_layerDecPicBuffering( encLibCommon->getDecPicBuffering() ) { - m_iPOCLast = -1; - m_iNumPicRcvd = 0; - m_uiNumAllPicCoded = 0; + m_pocLast = -1; + m_receivedPicCount = 0; + m_codedPicCount = 0; - m_iMaxRefPicNum = 0; + m_maxRefPicNum = 0; #if ENABLE_SIMD_OPT_BUFFER g_pelBufOP.initPelBufOpsX86(); @@ -96,7 +96,7 @@ EncLib::~EncLib() void EncLib::create( const int layerId ) { m_layerId = layerId; - m_iPOCLast = m_compositeRefEnabled ? -2 : -1; + m_pocLast = m_compositeRefEnabled ? -2 : -1; // create processing unit classes m_cGOPEncoder. create( ); m_cCuEncoder. create( this ); @@ -334,7 +334,7 @@ void EncLib::init(AUWriterIf *auWriterIf) // link temporary buffets from intra search with inter search to avoid unneccessary memory overhead m_cInterSearch.setTempBuffers( m_cIntraSearch.getSplitCSBuf(), m_cIntraSearch.getFullCSBuf(), m_cIntraSearch.getSaveCSBuf() ); - m_iMaxRefPicNum = 0; + m_maxRefPicNum = 0; #if ER_CHROMA_QP_WCG_PPS if( m_wcgChromaQpControl.isEnabled() ) @@ -468,9 +468,13 @@ void EncLib::deletePicBuffer() m_cListPic.clear(); } -bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTrueOrg, PelStorage* pcPicYuvFilteredOrg, PelStorage* pcPicYuvFilteredOrgForFG, const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded ) +bool EncLib::encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *cPicYuvTrueOrg, + PelStorage *pcPicYuvFilteredOrg, PelStorage *pcPicYuvFilteredOrgForFG, + const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, + int &numEncoded) { - if( m_compositeRefEnabled && m_cGOPEncoder.getPicBg()->getSpliceFull() && m_iPOCLast >= 10 && m_iNumPicRcvd == 0 && m_cGOPEncoder.getEncodedLTRef() == false ) + if (m_compositeRefEnabled && m_cGOPEncoder.getPicBg()->getSpliceFull() && m_pocLast >= 10 && m_receivedPicCount == 0 + && m_cGOPEncoder.getEncodedLTRef() == false) { Picture *picCurr = nullptr; xGetNewPicBuffer( rcListPicYuvRecOut, picCurr, 2 ); @@ -485,8 +489,8 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu #else picCurr->finalInit( m_vps, *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); #endif - picCurr->poc = m_iPOCLast - 1; - m_iPOCLast -= 2; + picCurr->poc = m_pocLast - 1; + m_pocLast -= 2; #if JVET_Z0120_SII_SEI_PROCESSING if (getShutterFilterFlag()) @@ -503,10 +507,10 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu } if( m_RCEnableRateControl ) { - m_cRateCtrl.initRCGOP( m_iNumPicRcvd ); + m_cRateCtrl.initRCGOP(m_receivedPicCount); } - m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, false, false, snrCSC, + m_cGOPEncoder.compressGOP(m_pocLast, m_receivedPicCount, m_cListPic, rcListPicYuvRecOut, false, false, snrCSC, m_printFrameMSE, m_printMSSSIM, true, 0); #if JVET_O0756_CALCULATE_HDRMETRICS @@ -518,8 +522,8 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu m_cRateCtrl.destroyRCGOP(); } - iNumEncoded = 0; - m_iNumPicRcvd = 0; + numEncoded = 0; + m_receivedPicCount = 0; } //PROF_ACCUM_AND_START_NEW_SET( getProfilerPic(), P_GOP_LEVEL ); @@ -532,14 +536,14 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu #if ER_CHROMA_QP_WCG_PPS if( getWCGChromaQPControl().isEnabled() ) { - ppsID = getdQPs()[m_iPOCLast / ( m_compositeRefEnabled ? 2 : 1 ) + 1]; - ppsID += ( getSwitchPOC() != -1 && ( m_iPOCLast + 1 >= getSwitchPOC() ) ? 1 : 0 ); + ppsID = getdQPs()[m_pocLast / (m_compositeRefEnabled ? 2 : 1) + 1]; + ppsID += (getSwitchPOC() != -1 && (m_pocLast + 1 >= getSwitchPOC()) ? 1 : 0); } #endif if( m_resChangeInClvsEnabled && m_intraPeriod == -1 ) { - const int poc = m_iPOCLast + ( m_compositeRefEnabled ? 2 : 1 ); + const int poc = m_pocLast + (m_compositeRefEnabled ? 2 : 1); if( poc / m_switchPocPeriod % 2 ) { @@ -632,7 +636,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu pcPicCurr->finalInit( m_vps, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); #endif - pcPicCurr->poc = m_iPOCLast; + pcPicCurr->poc = m_pocLast; #if JVET_Z0120_SII_SEI_PROCESSING if (getShutterFilterFlag()) @@ -650,15 +654,16 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu } } - if( ( m_iNumPicRcvd == 0 ) || ( !flush && ( m_iPOCLast != 0 ) && ( m_iNumPicRcvd != m_iGOPSize ) && ( m_iGOPSize != 0 ) ) ) + if ((m_receivedPicCount == 0) + || (!flush && (m_pocLast != 0) && (m_receivedPicCount != m_iGOPSize) && (m_iGOPSize != 0))) { - iNumEncoded = 0; + numEncoded = 0; return true; } if( m_RCEnableRateControl ) { - m_cRateCtrl.initRCGOP( m_iNumPicRcvd ); + m_cRateCtrl.initRCGOP(m_receivedPicCount); } m_picIdInGOP = 0; @@ -677,19 +682,20 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu \param snrCSC \retval rcListPicYuvRecOut list of reconstruction YUV pictures \retval accessUnitsOut list of output access units - \retval iNumEncoded number of encoded pictures + \retval numEncoded number of encoded pictures */ -bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded ) +bool EncLib::encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, + int &numEncoded) { // compress GOP - m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, false, false, snrCSC, + m_cGOPEncoder.compressGOP(m_pocLast, m_receivedPicCount, m_cListPic, rcListPicYuvRecOut, false, false, snrCSC, m_printFrameMSE, m_printMSSSIM, false, m_picIdInGOP); m_picIdInGOP++; // go over all pictures in a GOP excluding the first IRAP - if( m_picIdInGOP != m_iGOPSize && m_iPOCLast ) + if (m_picIdInGOP != m_iGOPSize && m_pocLast) { return true; } @@ -703,9 +709,9 @@ bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitB m_cRateCtrl.destroyRCGOP(); } - iNumEncoded = m_iNumPicRcvd; - m_iNumPicRcvd = 0; - m_uiNumAllPicCoded += iNumEncoded; + numEncoded = m_receivedPicCount; + m_receivedPicCount = 0; + m_codedPicCount += numEncoded; return false; } @@ -732,10 +738,11 @@ void separateFields(Pel* org, Pel* dstField, uint32_t stride, uint32_t width, ui } -bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTrueOrg, PelStorage* pcPicYuvFilteredOrg, const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded, bool isTff ) +bool EncLib::encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *pcPicYuvTrueOrg, + PelStorage *pcPicYuvFilteredOrg, const InputColourSpaceConversion snrCSC, + std::list<PelUnitBuf *> &rcListPicYuvRecOut, int &numEncoded, bool isTff) { - iNumEncoded = 0; + numEncoded = 0; bool keepDoing = true; for( int fieldNum = 0; fieldNum < 2; fieldNum++ ) @@ -792,7 +799,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicY pcField->finalInit( m_vps, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); #endif - pcField->poc = m_iPOCLast; + pcField->poc = m_pocLast; pcField->reconstructed = false; pcField->setBorderExtension( false );// where is this normally? @@ -817,7 +824,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicY } - if( m_iNumPicRcvd && ( flush || m_iPOCLast == 1 || m_iNumPicRcvd == m_iGOPSize ) ) + if (m_receivedPicCount && (flush || m_pocLast == 1 || m_receivedPicCount == m_iGOPSize)) { m_picIdInGOP = 0; keepDoing = false; @@ -826,17 +833,19 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicY return keepDoing; } -bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded, bool isTff ) +bool EncLib::encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, + int &numEncoded, bool isTff) { - iNumEncoded = 0; + numEncoded = 0; for( int fieldNum = 0; fieldNum < 2; fieldNum++ ) { - m_iPOCLast = m_iPOCLast < 2 ? fieldNum : m_iPOCLast; + m_pocLast = m_pocLast < 2 ? fieldNum : m_pocLast; // compress GOP - m_cGOPEncoder.compressGOP( m_iPOCLast, m_iPOCLast < 2 ? m_iPOCLast + 1 : m_iNumPicRcvd, m_cListPic, - rcListPicYuvRecOut, true, isTff, snrCSC, m_printFrameMSE, m_printMSSSIM, false, m_picIdInGOP ); + m_cGOPEncoder.compressGOP(m_pocLast, m_pocLast < 2 ? m_pocLast + 1 : m_receivedPicCount, m_cListPic, + rcListPicYuvRecOut, true, isTff, snrCSC, m_printFrameMSE, m_printMSSSIM, false, + m_picIdInGOP); #if JVET_O0756_CALCULATE_HDRMETRICS m_metricTime = m_cGOPEncoder.getMetricTime(); #endif @@ -845,14 +854,14 @@ bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitB } // go over all pictures in a GOP excluding first top field and first bottom field - if( m_picIdInGOP != m_iGOPSize && m_iPOCLast > 1 ) + if (m_picIdInGOP != m_iGOPSize && m_pocLast > 1) { return true; } - iNumEncoded += m_iNumPicRcvd; - m_uiNumAllPicCoded += m_iNumPicRcvd; - m_iNumPicRcvd = 0; + numEncoded += m_receivedPicCount; + m_codedPicCount += m_receivedPicCount; + m_receivedPicCount = 0; return false; } @@ -964,8 +973,8 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict rpcPic->referenced = true; rpcPic->getHashMap()->clearAll(); - m_iPOCLast += (m_compositeRefEnabled ? 2 : 1); - m_iNumPicRcvd++; + m_pocLast += (m_compositeRefEnabled ? 2 : 1); + m_receivedPicCount++; } void EncLib::xInitVPS( const SPS& sps ) diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index 66df79c86418724779f4cfb87e84c4b93cadfe10..24938f87e0fb0adb29ddbd098e9f838ef81c5beb 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -72,9 +72,9 @@ class EncLib : public EncCfg { private: // picture - int m_iPOCLast; ///< time index (POC) - int m_iNumPicRcvd; ///< number of received pictures - uint32_t m_uiNumAllPicCoded; ///< number of coded pictures + int m_pocLast; ///< time index (POC) + int m_receivedPicCount; ///< number of received pictures + uint32_t m_codedPicCount; ///< number of coded pictures PicList& m_cListPic; ///< dynamic list of pictures int m_layerId; @@ -96,9 +96,9 @@ private: EncSlice m_cSliceEncoder; ///< slice encoder EncCu m_cCuEncoder; ///< CU encoder // SPS - ParameterSetMap<SPS>& m_spsMap; ///< SPS. This is the base value. This is copied to PicSym - ParameterSetMap<PPS>& m_ppsMap; ///< PPS. This is the base value. This is copied to PicSym - ParameterSetMap<APS>& m_apsMap; ///< APS. This is the base value. This is copied to PicSym + ParameterSetMap<SPS> &m_spsMap; ///< SPS. This is the base value + ParameterSetMap<PPS> &m_ppsMap; ///< PPS. This is the base value + ParameterSetMap<APS> &m_apsMap; ///< APS. This is the base value PicHeader m_picHeader; ///< picture header // RD cost computation RdCost m_cRdCost; ///< RD cost computation class @@ -207,37 +207,27 @@ public: // encoder function // ------------------------------------------------------------------------------------------------------------------- - /// encode several number of pictures until end-of-sequence - bool encodePrep( bool bEos, - PelStorage* pcPicYuvOrg, - PelStorage* pcPicYuvTrueOrg, - PelStorage* pcPicYuvFilteredOrg, - PelStorage* pcPicYuvFilteredOrgForFG, - const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. - std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded ); - - bool encode( const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. - std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded ); - - bool encodePrep( bool bEos, - PelStorage* pcPicYuvOrg, - PelStorage* pcPicYuvTrueOrg, - PelStorage* pcPicYuvFilteredOrg, - const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. - std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded, bool isTff ); - - bool encode( const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. - std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded, bool isTff ); - - - void printSummary(bool isField) { m_cGOPEncoder.printOutSummary(m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, - m_printSequenceMSE, m_printMSSSIM, m_printHexPsnr, m_resChangeInClvsEnabled, m_spsMap.getFirstPS()->getBitDepths() - , m_layerId - ); } + // encode several number of pictures until end-of-sequence + // snrCSC used for SNR calculations. Picture in original colour space. + bool encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *pcPicYuvTrueOrg, PelStorage *pcPicYuvFilteredOrg, + PelStorage *pcPicYuvFilteredOrgForFG, const InputColourSpaceConversion snrCSC, + std::list<PelUnitBuf *> &rcListPicYuvRecOut, int &numEncoded); + + bool encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, int &numEncoded); + + bool encodePrep(bool flush, PelStorage *pcPicYuvOrg, PelStorage *pcPicYuvTrueOrg, PelStorage *pcPicYuvFilteredOrg, + const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, int &numEncoded, + bool isTff); + + bool encode(const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf *> &rcListPicYuvRecOut, int &numEncoded, + bool isTff); + + void printSummary(bool isField) + { + m_cGOPEncoder.printOutSummary(m_codedPicCount, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, + m_printMSSSIM, m_printHexPsnr, m_resChangeInClvsEnabled, + m_spsMap.getFirstPS()->getBitDepths(), m_layerId); + } int getLayerId() const { return m_layerId; } VPS* getVPS() { return m_vps; }