From 430f9ca50e2eb9a09fb6b7c889ba0131d32f81bb Mon Sep 17 00:00:00 2001 From: Frank Bossen <fbossen@gmail.com> Date: Fri, 17 Jan 2020 15:28:40 +0100 Subject: [PATCH] remove macro JVET_N0278_FIXES --- source/App/DecoderApp/DecApp.cpp | 69 ---- source/App/DecoderApp/DecApp.h | 8 - source/App/EncoderApp/EncApp.cpp | 181 --------- source/App/EncoderApp/EncApp.h | 22 -- source/App/EncoderApp/EncAppCfg.cpp | 2 - source/App/EncoderApp/EncAppCfg.h | 2 - source/App/EncoderApp/encmain.cpp | 54 --- source/Lib/CommonLib/Picture.cpp | 8 - source/Lib/CommonLib/Picture.h | 6 - source/Lib/CommonLib/Slice.cpp | 46 --- source/Lib/CommonLib/Slice.h | 5 - source/Lib/CommonLib/TypeDef.h | 1 - source/Lib/DecoderLib/DecLib.cpp | 98 +---- source/Lib/DecoderLib/DecLib.h | 15 - .../Lib/EncoderLib/EncAdaptiveLoopFilter.cpp | 18 - source/Lib/EncoderLib/EncAdaptiveLoopFilter.h | 8 - source/Lib/EncoderLib/EncGOP.cpp | 116 ------ source/Lib/EncoderLib/EncGOP.h | 2 - source/Lib/EncoderLib/EncLib.cpp | 344 ------------------ source/Lib/EncoderLib/EncLib.h | 39 -- source/Lib/EncoderLib/NALwrite.h | 6 - source/Lib/Utilities/VideoIOYuv.h | 2 - source/Lib/Utilities/program_options_lite.h | 2 - 23 files changed, 1 insertion(+), 1053 deletions(-) diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 6d3ac2c3eb..f579d87d26 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -111,9 +111,6 @@ uint32_t DecApp::decode() } // main decoder loop -#if !JVET_N0278_FIXES - bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen) -#endif bool loopFiltered = false; #if JVET_P1019_OUTPUT_LAYER_SET @@ -154,11 +151,7 @@ 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_N0278_FIXES xFlushOutput(pcListPic, nalu.m_nuhLayerId); -#else - xFlushOutput(pcListPic); -#endif } // parse NAL unit syntax if within target decoding layer @@ -243,11 +236,7 @@ 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_N0278_FIXES xFlushOutput( pcListPic, nalu.m_nuhLayerId ); -#else - xFlushOutput(pcListPic); -#endif } #if JVET_P1019_OUTPUT_LAYER_SET @@ -264,12 +253,6 @@ uint32_t DecApp::decode() if (bNewPicture) { // check if new picture was detected at an access unit delimiter NALU -#if !JVET_N0278_FIXES - if(nalu.m_nalUnitType != NAL_UNIT_ACCESS_UNIT_DELIMITER) - { - msg( ERROR, "Error: New picture detected without access unit delimiter. VVC requires the presence of access unit delimiters.\n"); - } -#endif bitstreamFile.clear(); /* location points to the current nalunit payload[1] due to the * need for the annexB parser to read three extra bytes. @@ -321,11 +304,7 @@ uint32_t DecApp::decode() if( pcListPic ) { -#if JVET_N0278_FIXES if( !m_reconFileName.empty() && !m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].isOpen() ) -#else - if ( (!m_reconFileName.empty()) && (!openedReconFile) ) -#endif { const BitDepths &bitDepths=pcListPic->front()->cs->sps->getBitDepths(); // use bit depths of first reconstructed picture. for( uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++ ) @@ -341,7 +320,6 @@ uint32_t DecApp::decode() EXIT ("Invalid output bit-depth for packed YUV output, aborting\n"); } -#if JVET_N0278_FIXES std::string reconFileName = m_reconFileName; #if JVET_P1019_OUTPUT_LAYER_SET if (m_reconFileName.compare("/dev/null") && (m_cDecLib.getVPS() != nullptr) && (m_cDecLib.getVPS()->getMaxLayers() > 1) && (isNaluWithinTargetOutputLayerIdSet(&nalu))) @@ -365,10 +343,6 @@ uint32_t DecApp::decode() (m_cDecLib.getVPS() == nullptr)) #endif m_cVideoIOYuvReconFile[nalu.m_nuhLayerId].open(reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon); // write mode -#else - m_cVideoIOYuvReconFile.open( m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, bitDepths.recon ); // write mode - openedReconFile = true; -#endif } // write reconstruction to file if( bNewPicture ) @@ -831,7 +805,6 @@ void DecApp::xCreateDecLib() void DecApp::xDestroyDecLib() { -#if JVET_N0278_FIXES if( !m_reconFileName.empty() ) { for( auto & recFile : m_cVideoIOYuvReconFile ) @@ -839,12 +812,6 @@ void DecApp::xDestroyDecLib() recFile.second.close(); } } -#else - if ( !m_reconFileName.empty() ) - { - m_cVideoIOYuvReconFile.close(); - } -#endif // destroy decoder class m_cDecLib.destroy(); @@ -941,11 +908,7 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) if (display) { -#if JVET_N0278_FIXES m_cVideoIOYuvReconFile[pcPicTop->layerId].write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), -#else - m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), -#endif m_outputColourSpaceConvert, false, // TODO: m_packedYUVMode, conf.getWindowLeftOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ), @@ -999,19 +962,11 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); if( m_upscaledOutput ) { -#if JVET_N0278_FIXES m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); -#else - m_cVideoIOYuvReconFile.writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); -#endif } else { -#if JVET_N0278_FIXES m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), -#else - m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), -#endif m_outputColourSpaceConvert, m_packedYUVMode, conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), @@ -1046,11 +1001,7 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId ) /** \param pcListPic list of pictures to be written to file */ -#if JVET_N0278_FIXES void DecApp::xFlushOutput( PicList* pcListPic, const int layerId ) -#else -void DecApp::xFlushOutput( PicList* pcListPic ) -#endif { if(!pcListPic || pcListPic->empty()) { @@ -1072,12 +1023,10 @@ void DecApp::xFlushOutput( PicList* pcListPic ) iterPic++; pcPicBottom = *(iterPic); -#if JVET_N0278_FIXES if( pcPicTop->layerId != layerId && layerId != NOT_VALID ) { continue; } -#endif if ( pcPicTop->neededForOutput && pcPicBottom->neededForOutput && !(pcPicTop->getPOC()%2) && (pcPicBottom->getPOC() == pcPicTop->getPOC()+1) ) { @@ -1087,11 +1036,7 @@ void DecApp::xFlushOutput( PicList* pcListPic ) const Window &conf = pcPicTop->cs->pps->getConformanceWindow(); const bool isTff = pcPicTop->topField; -#if JVET_N0278_FIXES m_cVideoIOYuvReconFile[pcPicTop->layerId].write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), -#else - m_cVideoIOYuvReconFile.write( pcPicTop->getRecoBuf(), pcPicBottom->getRecoBuf(), -#endif m_outputColourSpaceConvert, false, // TODO: m_packedYUVMode, conf.getWindowLeftOffset() * SPS::getWinUnitX( pcPicTop->cs->sps->getChromaFormatIdc() ), @@ -1137,13 +1082,11 @@ void DecApp::xFlushOutput( PicList* pcListPic ) { pcPic = *(iterPic); -#if JVET_N0278_FIXES if( pcPic->layerId != layerId && layerId != NOT_VALID ) { iterPic++; continue; } -#endif if (pcPic->neededForOutput) { @@ -1156,19 +1099,11 @@ void DecApp::xFlushOutput( PicList* pcListPic ) ChromaFormat chromaFormatIDC = sps->getChromaFormatIdc(); if( m_upscaledOutput ) { -#if JVET_N0278_FIXES m_cVideoIOYuvReconFile[pcPic->layerId].writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); -#else - m_cVideoIOYuvReconFile.writeUpscaledPicture( *sps, *pcPic->cs->pps, pcPic->getRecoBuf(), m_outputColourSpaceConvert, m_packedYUVMode, m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range ); -#endif } else { -#if JVET_N0278_FIXES m_cVideoIOYuvReconFile[pcPic->layerId].write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), -#else - m_cVideoIOYuvReconFile.write( pcPic->getRecoBuf().get( COMPONENT_Y ).width, pcPic->getRecoBuf().get( COMPONENT_Y ).height, pcPic->getRecoBuf(), -#endif m_outputColourSpaceConvert, m_packedYUVMode, conf.getWindowLeftOffset() * SPS::getWinUnitX( chromaFormatIDC ), @@ -1201,21 +1136,17 @@ void DecApp::xFlushOutput( PicList* pcListPic ) pcPic->destroy(); delete pcPic; pcPic = NULL; -#if JVET_N0278_FIXES *iterPic = nullptr; -#endif } iterPic++; } } -#if JVET_N0278_FIXES if( layerId != NOT_VALID ) { pcListPic->remove_if([](Picture* p) { return p == nullptr; }); } else -#endif pcListPic->clear(); m_iPOCLastDisplay = -MAX_INT; } diff --git a/source/App/DecoderApp/DecApp.h b/source/App/DecoderApp/DecApp.h index 62b10efb53..f258d37638 100644 --- a/source/App/DecoderApp/DecApp.h +++ b/source/App/DecoderApp/DecApp.h @@ -61,11 +61,7 @@ class DecApp : public DecAppCfg private: // class interface DecLib m_cDecLib; ///< decoder class -#if JVET_N0278_FIXES std::unordered_map<int, VideoIOYuv> m_cVideoIOYuvReconFile; ///< reconstruction YUV class -#else - VideoIOYuv m_cVideoIOYuvReconFile; ///< reconstruction YUV class -#endif // for output control int m_iPOCLastDisplay; ///< last POC in display order @@ -84,11 +80,7 @@ private: void xCreateDecLib (); ///< create internal classes void xDestroyDecLib (); ///< destroy internal classes void xWriteOutput ( PicList* pcListPic , uint32_t tId); ///< write YUV to file -#if JVET_N0278_FIXES void xFlushOutput( PicList* pcListPic, const int layerId = NOT_VALID ); ///< flush all remaining decoded pictures to file -#else - void xFlushOutput ( PicList* pcListPic ); ///< flush all remaining decoded pictures to file -#endif bool isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet #if JVET_P1019_OUTPUT_LAYER_SET bool isNaluWithinTargetOutputLayerIdSet(InputNALUnit* nalu); ///< check whether given Nalu is within targetOutputLayerIdSet diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index effb382cea..81d7c51b0b 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -44,16 +44,7 @@ #include "EncApp.h" #include "EncoderLib/AnnexBwrite.h" -#if JVET_N0278_FIXES #include "EncoderLib/EncLibCommon.h" -#else -#if EXTENSION_360_VIDEO -#include "AppEncHelper360/TExt360AppEncTop.h" -#endif -#if JVET_O0549_ENCODER_ONLY_FILTER -#include "EncoderLib/EncTemporalFilter.h" -#endif -#endif using namespace std; @@ -64,13 +55,9 @@ using namespace std; // Constructor / destructor / initialization / destroy // ==================================================================================================================== -#if JVET_N0278_FIXES EncApp::EncApp( fstream& bitStream, EncLibCommon* encLibCommon ) : m_cEncLib( encLibCommon ) , m_bitstream( bitStream ) -#else -EncApp::EncApp() -#endif { m_iFrameRcvd = 0; m_totalBytes = 0; @@ -78,10 +65,8 @@ EncApp::EncApp() #if JVET_O0756_CALCULATE_HDRMETRICS m_metricTime = std::chrono::milliseconds(0); #endif -#if JVET_N0278_FIXES m_numEncoded = 0; m_flush = false; -#endif } EncApp::~EncApp() @@ -92,7 +77,6 @@ void EncApp::xInitLibCfg() { VPS vps; -#if JVET_N0278_FIXES vps.setMaxLayers( m_maxLayers ); #if JVET_O1159_SCALABILITY @@ -188,9 +172,6 @@ void EncApp::xInitLibCfg() } } #endif -#else - vps.setMaxLayers ( 1 ); -#endif #if !JVET_O1159_SCALABILITY for(int i = 0; i < MAX_TLAYER; i++) { @@ -997,11 +978,7 @@ void EncApp::xInitLibCfg() #endif } -#if JVET_N0278_FIXES void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ) -#else -void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList ) -#endif { // Video I/O m_cVideoIOYuvInputFile.open( m_inputFileName, false, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth ); // read mode @@ -1028,7 +1005,6 @@ void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList ) EXIT ("Invalid chroma output bit-depth or image width for packed YUV output, aborting\n"); } -#if JVET_N0278_FIXES std::string reconFileName = m_reconFileName; if( m_reconFileName.compare( "/dev/null" ) && (m_maxLayers > 1) ) { @@ -1043,17 +1019,10 @@ void EncApp::xCreateLib( std::list<PelUnitBuf*>& recBufList ) } } m_cVideoIOYuvReconFile.open( reconFileName, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth ); // write mode -#else - m_cVideoIOYuvReconFile.open(m_reconFileName, true, m_outputBitDepth, m_outputBitDepth, m_internalBitDepth); // write mode -#endif } // create the encoder -#if JVET_N0278_FIXES m_cEncLib.create( layerId ); -#else - m_cEncLib.create(); -#endif // create the output buffer for( int i = 0; i < (m_iGOPSize + 1 + (m_isField ? 1 : 0)); i++ ) @@ -1081,7 +1050,6 @@ void EncApp::xInitLib(bool isFieldCoding) // Public member functions // ==================================================================================================================== -#if JVET_N0278_FIXES void EncApp::createLib( const int layerId ) { const int sourceHeight = m_isField ? m_iSourceHeightOrg : m_iSourceHeight; @@ -1257,155 +1225,6 @@ bool EncApp::encode() return keepDoing; } -#else -/** - - create internal class - - initialize internal variable - - until the end of input YUV file, call encoding function in EncLib class - - delete allocated buffers - - destroy internal class - . - */ -void EncApp::encode() -{ - m_bitstream.open(m_bitstreamFileName.c_str(), fstream::binary | fstream::out); - if (!m_bitstream) - { - EXIT( "Failed to open bitstream file " << m_bitstreamFileName.c_str() << " for writing\n"); - } - - std::list<PelUnitBuf*> recBufList; - // initialize internal class & member variables - xInitLibCfg(); - xCreateLib( recBufList - ); - xInitLib(m_isField); - - printChromaFormat(); - - // main encoder loop - int iNumEncoded = 0; - bool bEos = false; - - const InputColourSpaceConversion ipCSC = m_inputColourSpaceConvert; - const InputColourSpaceConversion snrCSC = (!m_snrInternalColourSpace) ? m_inputColourSpaceConvert : IPCOLOURSPACE_UNCHANGED; - - PelStorage trueOrgPic; - PelStorage orgPic; - const int sourceHeight = m_isField ? m_iSourceHeightOrg : m_iSourceHeight; - UnitArea unitArea( m_chromaFormatIDC, Area( 0, 0, m_iSourceWidth, sourceHeight ) ); - - orgPic.create( unitArea ); - trueOrgPic.create( unitArea ); -#if EXTENSION_360_VIDEO - TExt360AppEncTop ext360(*this, m_cEncLib.getGOPEncoder()->getExt360Data(), *(m_cEncLib.getGOPEncoder()), orgPic); -#endif - -#if JVET_O0549_ENCODER_ONLY_FILTER - EncTemporalFilter temporalFilter; - if (m_gopBasedTemporalFilterEnabled) - { - temporalFilter.init(m_FrameSkip, m_inputBitDepth, m_MSBExtendedBitDepth, m_internalBitDepth, m_iSourceWidth, m_iSourceHeight, - m_aiPad, m_bClipInputVideoToRec709Range, m_inputFileName, m_chromaFormatIDC, - m_inputColourSpaceConvert, m_iQP, m_gopBasedTemporalFilterStrengths, - m_gopBasedTemporalFilterFutureReference); - } -#endif - - while ( !bEos ) - { - // read input YUV file -#if EXTENSION_360_VIDEO - if (ext360.isEnabled()) - { - ext360.read(m_cVideoIOYuvInputFile, orgPic, trueOrgPic, ipCSC); - } - else - { - m_cVideoIOYuvInputFile.read(orgPic, trueOrgPic, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range); - } -#else - m_cVideoIOYuvInputFile.read( orgPic, trueOrgPic, ipCSC, m_aiPad, m_InputChromaFormatIDC, m_bClipInputVideoToRec709Range ); -#endif - -#if JVET_O0549_ENCODER_ONLY_FILTER - if (m_gopBasedTemporalFilterEnabled) - { - temporalFilter.filter(&orgPic, m_iFrameRcvd); - } -#endif - - // increase number of received frames - m_iFrameRcvd++; - - bEos = (m_isField && (m_iFrameRcvd == (m_framesToBeEncoded >> 1) )) || ( !m_isField && (m_iFrameRcvd == m_framesToBeEncoded) ); - - bool flush = 0; - // if end of file (which is only detected on a read failure) flush the encoder of any queued pictures - if (m_cVideoIOYuvInputFile.isEof()) - { - flush = true; - bEos = true; - m_iFrameRcvd--; - m_cEncLib.setFramesToBeEncoded(m_iFrameRcvd); - } - - // call encoding function for one frame - if ( m_isField ) - { - m_cEncLib.encode( bEos, flush ? 0 : &orgPic, flush ? 0 : &trueOrgPic, snrCSC, recBufList, - iNumEncoded, m_isTopFieldFirst ); -#if JVET_O0756_CALCULATE_HDRMETRICS - m_metricTime = m_cEncLib.getMetricTime(); -#endif - } - else - { - m_cEncLib.encode( bEos, flush ? 0 : &orgPic, flush ? 0 : &trueOrgPic, snrCSC, recBufList, - iNumEncoded ); -#if JVET_O0756_CALCULATE_HDRMETRICS - m_metricTime = m_cEncLib.getMetricTime(); -#endif - } - - // write bistream to file if necessary - if ( iNumEncoded > 0 ) - { - xWriteOutput( iNumEncoded, recBufList - ); - } - // temporally skip frames - if( m_temporalSubsampleRatio > 1 ) - { -#if EXTENSION_360_VIDEO - m_cVideoIOYuvInputFile.skipFrames(m_temporalSubsampleRatio - 1, m_inputFileWidth, m_inputFileHeight, m_InputChromaFormatIDC); -#else - m_cVideoIOYuvInputFile.skipFrames(m_temporalSubsampleRatio-1, m_iSourceWidth - m_aiPad[0], m_iSourceHeight - m_aiPad[1], m_InputChromaFormatIDC); -#endif - } - } - - m_cEncLib.printSummary(m_isField); - - - // delete used buffers in encoder class - m_cEncLib.deletePicBuffer(); - - for( auto &p : recBufList ) - { - delete p; - } - recBufList.clear(); - - xDestroyLib(); - - m_bitstream.close(); - - printRateSummary(); - - return; -} -#endif // ==================================================================================================================== // Protected member functions diff --git a/source/App/EncoderApp/EncApp.h b/source/App/EncoderApp/EncApp.h index f62272ad24..eba2511ba1 100644 --- a/source/App/EncoderApp/EncApp.h +++ b/source/App/EncoderApp/EncApp.h @@ -45,22 +45,18 @@ #include "Utilities/VideoIOYuv.h" #include "CommonLib/NAL.h" #include "EncAppCfg.h" -#if JVET_N0278_FIXES #if EXTENSION_360_VIDEO #include "AppEncHelper360/TExt360AppEncTop.h" #endif #if JVET_O0549_ENCODER_ONLY_FILTER #include "EncoderLib/EncTemporalFilter.h" #endif -#endif #if JVET_O0756_CALCULATE_HDRMETRICS #include <chrono> #endif -#if JVET_N0278_FIXES class EncAppCommon; -#endif //! \ingroup EncoderApp //! \{ @@ -80,22 +76,14 @@ private: int m_iFrameRcvd; ///< number of received frames uint32_t m_essentialBytes; uint32_t m_totalBytes; -#if JVET_N0278_FIXES fstream& m_bitstream; -#else - fstream m_bitstream; -#endif #if JVET_O0756_CALCULATE_HDRMETRICS std::chrono::duration<long long, ratio<1, 1000000000>> m_metricTime; #endif private: // initialization -#if JVET_N0278_FIXES void xCreateLib( std::list<PelUnitBuf*>& recBufList, const int layerId ); ///< create files & encoder class -#else - void xCreateLib ( std::list<PelUnitBuf*>& recBufList ); ///< create files & encoder class -#endif void xInitLibCfg (); ///< initialize internal variables void xInitLib (bool isFieldCoding); ///< initialize encoder class void xDestroyLib (); ///< destroy encoder class @@ -107,7 +95,6 @@ private: void printRateSummary (); void printChromaFormat(); -#if JVET_N0278_FIXES std::list<PelUnitBuf*> m_recBufList; int m_numEncoded; PelStorage* m_trueOrgPic; @@ -119,25 +106,16 @@ private: EncTemporalFilter m_temporalFilter; #endif bool m_flush; -#endif public: -#if JVET_N0278_FIXES EncApp( fstream& bitStream, EncLibCommon* encLibCommon ); -#else - EncApp(); -#endif virtual ~EncApp(); -#if JVET_N0278_FIXES int getMaxLayers() const { return m_maxLayers; } void createLib( int layerId ); void destroyLib(); bool encodePrep( bool& eos ); bool encode(); ///< main encoding function -#else - void encode(); ///< main encoding function -#endif void outputAU( const AccessUnit& au ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index e47061e5f1..d1f0bad7f0 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1769,7 +1769,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "FractionNumFrames", m_fractionOfFrames, 1.0, "Encode a fraction of the specified in FramesToBeEncoded frames" ) ( "SwitchPocPeriod", m_switchPocPeriod, 0, "Switch POC period for RPR" ) ( "UpscaledOutput", m_upscaledOutput, 0, "Output upscaled (2), decoded but in full resolution buffer (1) or decoded cropped (0, default) picture for RPR" ) -#if JVET_N0278_FIXES ( "MaxLayers", m_maxLayers, 1, "Max number of layers" ) #if JVET_O1159_SCALABILITY @@ -1785,7 +1784,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "OlsModeIdc", m_olsModeIdc, 0, "Output layer set mode") ( "NumOutputLayerSets", m_numOutputLayerSets, 1, "Number of output layer sets") ( "OlsOutputLayer%d", m_olsOutputLayerStr, string(""), MAX_VPS_LAYERS, "Output layer index of i-th OLS") -#endif #endif ; diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index a32f424b46..ce53a31e05 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -832,7 +832,6 @@ protected: std::map<int, double> m_gopBasedTemporalFilterStrengths; ///< Filter strength per frame for the GOP-based Temporal Filter #endif -#if JVET_N0278_FIXES int m_maxLayers; #if JVET_O1159_SCALABILITY @@ -848,7 +847,6 @@ protected: int m_numOutputLayerSets; std::string m_olsOutputLayerStr[MAX_VPS_LAYERS]; #endif -#endif #if EXTENSION_360_VIDEO TExt360AppEncCfg m_ext360; diff --git a/source/App/EncoderApp/encmain.cpp b/source/App/EncoderApp/encmain.cpp index a399049fcf..1b752b0c14 100644 --- a/source/App/EncoderApp/encmain.cpp +++ b/source/App/EncoderApp/encmain.cpp @@ -114,7 +114,6 @@ int main(int argc, char* argv[]) #endif fprintf( stdout, "\n" ); -#if JVET_N0278_FIXES std::fstream bitstream; EncLibCommon encLibCommon; @@ -181,26 +180,6 @@ int main(int argc, char* argv[]) } while( layerIdx < pcEncApp.size() ); delete[] layerArgv; -#else - EncApp* pcEncApp = new EncApp; - // create application encoder class - pcEncApp->create(); - - // parse configuration - try - { - if(!pcEncApp->parseCfg( argc, argv )) - { - pcEncApp->destroy(); - return 1; - } - } - catch (df::program_options_lite::ParseFailure &e) - { - std::cerr << "Error parsing option \""<< e.arg <<"\" with argument \""<< e.val <<"\"." << std::endl; - return 1; - } -#endif #if PRINT_MACRO_VALUES printMacroSettings(); @@ -212,7 +191,6 @@ int main(int argc, char* argv[]) fprintf(stdout, " started @ %s", std::ctime(&startTime2) ); clock_t startClock = clock(); -#if JVET_N0278_FIXES // call encoding function per layer bool eos = false; @@ -272,42 +250,17 @@ int main(int argc, char* argv[]) } } } -#else - // call encoding function -#ifndef _DEBUG - try - { -#endif - pcEncApp->encode(); -#ifndef _DEBUG - } - catch( Exception &e ) - { - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; - } - catch (const std::bad_alloc &e) - { - std::cout << "Memory allocation failed: " << e.what() << std::endl; - return EXIT_FAILURE; - } -#endif -#endif // ending time clock_t endClock = clock(); auto endTime = std::chrono::steady_clock::now(); std::time_t endTime2 = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); #if JVET_O0756_CALCULATE_HDRMETRICS -#if JVET_N0278_FIXES auto metricTime = pcEncApp[0]->getMetricTime(); for( int layerIdx = 1; layerIdx < pcEncApp.size(); layerIdx++ ) { metricTime += pcEncApp[layerIdx]->getMetricTime(); } -#else - auto metricTime = pcEncApp->getMetricTime(); -#endif auto totalTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime - startTime ).count(); auto encTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime - startTime - metricTime ).count(); auto metricTimeuser = std::chrono::duration_cast<std::chrono::milliseconds>( metricTime ).count(); @@ -315,7 +268,6 @@ int main(int argc, char* argv[]) auto encTime = std::chrono::duration_cast<std::chrono::milliseconds>( endTime - startTime).count(); #endif -#if JVET_N0278_FIXES for( auto & encApp : pcEncApp ) { encApp->destroyLib(); @@ -330,12 +282,6 @@ int main(int argc, char* argv[]) destroyROM(); pcEncApp.clear(); -#else - // destroy application encoder class - pcEncApp->destroy(); - - delete pcEncApp; -#endif printf( "\n finished @ %s", std::ctime(&endTime2) ); diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index bfb812584c..e29c6d2c3c 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -537,20 +537,12 @@ Picture::Picture() } m_spliceIdx = NULL; m_ctuNums = 0; -#if JVET_N0278_FIXES layerId = NOT_VALID; -#endif } -#if JVET_N0278_FIXES void Picture::create( const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned _margin, const bool _decoder, const int _layerId ) -#else -void Picture::create(const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned _margin, const bool _decoder) -#endif { -#if JVET_N0278_FIXES layerId = _layerId; -#endif UnitArea::operator=( UnitArea( _chromaFormat, Area( Position{ 0, 0 }, size ) ) ); margin = MAX_SCALING_RATIO*_margin; const Area a = Area( Position(), size ); diff --git a/source/Lib/CommonLib/Picture.h b/source/Lib/CommonLib/Picture.h index d90d728874..d557cdc8a7 100644 --- a/source/Lib/CommonLib/Picture.h +++ b/source/Lib/CommonLib/Picture.h @@ -168,11 +168,7 @@ struct Picture : public UnitArea uint32_t margin; Picture(); -#if JVET_N0278_FIXES void create( const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned margin, const bool bDecoder, const int layerId ); -#else - void create(const ChromaFormat &_chromaFormat, const Size &size, const unsigned _maxCUSize, const unsigned margin, const bool bDecoder); -#endif void destroy(); void createTempBuffers( const unsigned _maxCUSize ); @@ -298,9 +294,7 @@ public: int poc; uint32_t layer; uint32_t depth; -#if JVET_N0278_FIXES int layerId; -#endif #if JVET_O0235_NAL_UNIT_TYPE_CONSTRAINTS bool subLayerNonReferencePictureDueToSTSA; diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 1e6e5a8c80..1bd425ffa1 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -378,22 +378,14 @@ void Slice::sortPicList (PicList& rcListPic) } } -#if JVET_N0278_FIXES Picture* Slice::xGetRefPic( PicList& rcListPic, int poc, const int layerId ) -#else -Picture* Slice::xGetRefPic (PicList& rcListPic, int poc) -#endif { PicList::iterator iterPic = rcListPic.begin(); Picture* pcPic = *(iterPic); while ( iterPic != rcListPic.end() ) { -#if JVET_N0278_FIXES if( pcPic->getPOC() == poc && pcPic->layerId == layerId ) -#else - if(pcPic->getPOC() == poc) -#endif { break; } @@ -403,11 +395,7 @@ Picture* Slice::xGetRefPic (PicList& rcListPic, int poc) return pcPic; } -#if JVET_N0278_FIXES Picture* Slice::xGetLongTermRefPic( PicList& rcListPic, int poc, bool pocHasMsb, const int layerId ) -#else -Picture* Slice::xGetLongTermRefPic( PicList& rcListPic, int poc, bool pocHasMsb) -#endif { PicList::iterator iterPic = rcListPic.begin(); Picture* pcPic = *(iterPic); @@ -422,11 +410,7 @@ Picture* Slice::xGetLongTermRefPic( PicList& rcListPic, int poc, bool pocHasMsb) while ( iterPic != rcListPic.end() ) { pcPic = *(iterPic); -#if JVET_N0278_FIXES if( pcPic && pcPic->getPOC() != this->getPOC() && pcPic->referenced && pcPic->layerId == layerId ) -#else - if (pcPic && pcPic->getPOC()!=this->getPOC() && pcPic->referenced) -#endif { int picPoc = pcPic->getPOC(); if (!pocHasMsb) @@ -517,11 +501,7 @@ void Slice::constructRefPicList(PicList& rcListPic) #endif if (!m_pRPL0->isRefPicLongterm(ii)) { -#if JVET_N0278_FIXES pcRefPic = xGetRefPic( rcListPic, getPOC() - m_pRPL0->getRefPicIdentifier( ii ), m_pcPic->layerId ); -#else - pcRefPic = xGetRefPic(rcListPic, getPOC() - m_pRPL0->getRefPicIdentifier(ii)); -#endif pcRefPic->longTerm = false; } else @@ -530,11 +510,7 @@ void Slice::constructRefPicList(PicList& rcListPic) int pocMask = (1 << pocBits) - 1; int ltrpPoc = m_pRPL0->getRefPicIdentifier(ii) & pocMask; ltrpPoc += m_localRPL0.getDeltaPocMSBPresentFlag(ii) ? (pocMask + 1) * m_localRPL0.getDeltaPocMSBCycleLT(ii) : 0; -#if JVET_N0278_FIXES pcRefPic = xGetLongTermRefPic( rcListPic, ltrpPoc, m_localRPL0.getDeltaPocMSBPresentFlag( ii ), m_pcPic->layerId ); -#else - pcRefPic = xGetLongTermRefPic(rcListPic, ltrpPoc, m_localRPL0.getDeltaPocMSBPresentFlag(ii)); -#endif pcRefPic->longTerm = true; } pcRefPic->extendPicBorder(); @@ -560,11 +536,7 @@ void Slice::constructRefPicList(PicList& rcListPic) #endif if (!m_pRPL1->isRefPicLongterm(ii)) { -#if JVET_N0278_FIXES pcRefPic = xGetRefPic( rcListPic, getPOC() - m_pRPL1->getRefPicIdentifier( ii ), m_pcPic->layerId ); -#else - pcRefPic = xGetRefPic(rcListPic, getPOC() - m_pRPL1->getRefPicIdentifier(ii)); -#endif pcRefPic->longTerm = false; } else @@ -573,11 +545,7 @@ void Slice::constructRefPicList(PicList& rcListPic) int pocMask = (1 << pocBits) - 1; int ltrpPoc = m_pRPL1->getRefPicIdentifier(ii) & pocMask; ltrpPoc += m_localRPL1.getDeltaPocMSBPresentFlag(ii) ? (pocMask + 1) * m_localRPL1.getDeltaPocMSBCycleLT(ii) : 0; -#if JVET_N0278_FIXES pcRefPic = xGetLongTermRefPic( rcListPic, ltrpPoc, m_localRPL1.getDeltaPocMSBPresentFlag( ii ), m_pcPic->layerId ); -#else - pcRefPic = xGetLongTermRefPic(rcListPic, ltrpPoc, m_localRPL1.getDeltaPocMSBPresentFlag(ii)); -#endif pcRefPic->longTerm = true; } pcRefPic->extendPicBorder(); @@ -637,11 +605,7 @@ void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureLi } else { -#if JVET_N0278_FIXES CHECK( xGetLongTermRefPic( rcListPic, pRPL0->getRefPicIdentifier( i ), pRPL0->getDeltaPocMSBPresentFlag( i ), m_pcPic->layerId )->getPOC() < pocCRA, "Invalid state" ); -#else - CHECK(xGetLongTermRefPic(rcListPic, pRPL0->getRefPicIdentifier(i), pRPL0->getDeltaPocMSBPresentFlag(i))->getPOC() < pocCRA, "Invalid state"); -#endif } } numRefPic = pRPL1->getNumberOfShorttermPictures() + pRPL1->getNumberOfLongtermPictures(); @@ -657,11 +621,7 @@ void Slice::checkCRA(const ReferencePictureList *pRPL0, const ReferencePictureLi else #endif { -#if JVET_N0278_FIXES CHECK( xGetLongTermRefPic( rcListPic, pRPL1->getRefPicIdentifier( i ), pRPL1->getDeltaPocMSBPresentFlag( i ), m_pcPic->layerId )->getPOC() < pocCRA, "Invalid state" ); -#else - CHECK(xGetLongTermRefPic(rcListPic, pRPL1->getRefPicIdentifier(i), pRPL1->getDeltaPocMSBPresentFlag(i))->getPOC() < pocCRA, "Invalid state"); -#endif } } } @@ -2874,9 +2834,7 @@ void PPS::checkSliceMap() APS::APS() : m_APSId(0) , m_temporalId( 0 ) -#if JVET_N0278_FIXES , m_layerId( 0 ) -#endif { } @@ -4001,11 +3959,7 @@ void Slice::scaleRefPicList( Picture *scaledRefPic[ ], APS** apss, APS* lmcsAps, scaledRefPic[j]->poc = -1; -#if JVET_N0278_FIXES scaledRefPic[j]->create( sps->getChromaFormatIdc(), Size( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples() ), sps->getMaxCUWidth(), sps->getMaxCUWidth() + 16, isDecoder, m_pcPic->layerId ); -#else - scaledRefPic[j]->create( sps->getChromaFormatIdc(), Size( pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples() ), sps->getMaxCUWidth(), sps->getMaxCUWidth() + 16, isDecoder ); -#endif } scaledRefPic[j]->poc = poc; diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 18288fb11e..28d23d8316 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -2994,13 +2994,8 @@ public: #endif protected: -#if JVET_N0278_FIXES Picture* xGetRefPic( PicList& rcListPic, int poc, const int layerId ); Picture* xGetLongTermRefPic( PicList& rcListPic, int poc, bool pocHasMsb, const int layerId ); -#else - Picture* xGetRefPic (PicList& rcListPic, int poc); - Picture* xGetLongTermRefPic(PicList& rcListPic, int poc, bool pocHasMsb); -#endif public: std::unordered_map< Position, std::unordered_map< Size, double> > m_mapPltCost; private: diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 331a2de9f9..dd0cf3b7b3 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -153,7 +153,6 @@ #define JVET_P0347_MAX_MTT_DEPTH_CONSTRAINT 1 // JVET-P0347: Max MTT Depth constraint -#define JVET_N0278_FIXES 1 // Working draft 5 independent layers #define JVET_O1159_SCALABILITY 1 // JVET-O1159: Scalability diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index ab4cdd383a..d6aa795179 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -422,9 +422,7 @@ DecLib::DecLib() , m_prefixSEINALUs() , m_debugPOC( -1 ) , m_debugCTU( -1 ) -#if JVET_N0278_FIXES , m_vps( nullptr ) -#endif #if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC , m_scalingListUpdateFlag(true) , m_PreScalingListAPSId(-1) @@ -443,7 +441,7 @@ DecLib::~DecLib() m_prefixSEINALUs.pop_front(); } -#if JVET_N0278_FIXES && !JVET_O1159_SCALABILITY +#if !JVET_O1159_SCALABILITY if( m_vps != nullptr ) { delete m_vps; @@ -505,11 +503,7 @@ void DecLib::deletePicBuffer ( ) m_cReshaper.destroy(); } -#if JVET_N0278_FIXES Picture* DecLib::xGetNewPicBuffer( const SPS &sps, const PPS &pps, const uint32_t temporalLayer, const int layerId ) -#else -Picture* DecLib::xGetNewPicBuffer ( const SPS &sps, const PPS &pps, const uint32_t temporalLayer ) -#endif { Picture * pcPic = nullptr; m_iMaxRefPicNum = sps.getMaxDecPicBuffering(temporalLayer); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded @@ -517,11 +511,7 @@ Picture* DecLib::xGetNewPicBuffer ( const SPS &sps, const PPS &pps, const uint32 { pcPic = new Picture(); -#if JVET_N0278_FIXES pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true, layerId ); -#else - pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#endif m_cListPic.push_back( pcPic ); @@ -557,22 +547,14 @@ Picture* DecLib::xGetNewPicBuffer ( const SPS &sps, const PPS &pps, const uint32 m_cListPic.push_back( pcPic ); -#if JVET_N0278_FIXES pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true, layerId ); -#else - pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#endif } else { if( !pcPic->Y().Size::operator==( Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ) ) || pcPic->cs->pcv->maxCUWidth != sps.getMaxCUWidth() || pcPic->cs->pcv->maxCUHeight != sps.getMaxCUHeight() ) { pcPic->destroy(); -#if JVET_N0278_FIXES pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true, layerId ); -#else - pcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, true ); -#endif } } @@ -664,11 +646,7 @@ void DecLib::finishPicture(int& poc, PicList*& rpcListPic, MsgLevel msgl ) if (pcSlice->isDRAP()) c = 'D'; //-- For time output for each slice -#if JVET_N0278_FIXES msg( msgl, "POC %4d LId: %2d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(), pcSlice->getPic()->layerId, -#else - msg( msgl, "POC %4d TId: %1d ( %c-SLICE, QP%3d ) ", pcSlice->getPOC(), -#endif pcSlice->getTLayer(), c, pcSlice->getSliceQp() ); @@ -784,18 +762,10 @@ void DecLib::xUpdateRasInit(Slice* slice) } } -#if JVET_N0278_FIXES void DecLib::xCreateLostPicture( int iLostPoc, const int layerId ) -#else -void DecLib::xCreateLostPicture(int iLostPoc) -#endif { msg( INFO, "\ninserting lost poc : %d\n",iLostPoc); -#if JVET_N0278_FIXES Picture *cFillPic = xGetNewPicBuffer( *( m_parameterSetManager.getFirstSPS() ), *( m_parameterSetManager.getFirstPPS() ), 0, layerId ); -#else - Picture *cFillPic = xGetNewPicBuffer(*(m_parameterSetManager.getFirstSPS()), *(m_parameterSetManager.getFirstPPS()), 0); -#endif CHECK( !cFillPic->slices.size(), "No slices in picture" ); @@ -836,26 +806,14 @@ void DecLib::xCreateLostPicture(int iLostPoc) } -#if JVET_N0278_FIXES #if JVET_P0184 void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, const int layerId, const bool interLayerRefPicFlag) #else void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, const int layerId) #endif -#else -#if JVET_P0184 -void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, const bool interLayerRefPicFlag) -#else -void DecLib::xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag) -#endif -#endif { msg(INFO, "\ninserting unavailable poc : %d\n", iUnavailablePoc); -#if JVET_N0278_FIXES Picture* cFillPic = xGetNewPicBuffer( *( m_parameterSetManager.getFirstSPS() ), *( m_parameterSetManager.getFirstPPS() ), 0, layerId ); -#else - Picture* cFillPic = xGetNewPicBuffer(*(m_parameterSetManager.getFirstSPS()), *(m_parameterSetManager.getFirstPPS()), 0); -#endif CHECK(!cFillPic->slices.size(), "No slices in picture"); @@ -1055,11 +1013,7 @@ void activateAPS(Slice* pSlice, ParameterSetManager& parameterSetManager, APS** #endif } -#if JVET_N0278_FIXES void DecLib::xActivateParameterSets( const int layerId ) -#else -void DecLib::xActivateParameterSets() -#endif { if (m_bFirstSliceInPicture) { @@ -1125,11 +1079,7 @@ void DecLib::xActivateParameterSets() #endif // Get a new picture buffer. This will also set up m_pcPic, and therefore give us a SPS and PPS pointer that we can use. -#if JVET_N0278_FIXES m_pcPic = xGetNewPicBuffer( *sps, *pps, m_apcSlicePilot->getTLayer(), layerId ); -#else - m_pcPic = xGetNewPicBuffer (*sps, *pps, m_apcSlicePilot->getTLayer()); -#endif #if JVET_O1159_SCALABILITY m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId ); @@ -1609,7 +1559,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl { if ( ( (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA) ) && m_apcSlicePilot->getNoIncorrectPicOutputFlag() ) { -#if JVET_N0278_FIXES #if JVET_P0184 if (m_apcSlicePilot->getRPL0()->isInterLayerRefPic(refPicIndex) == 0) { @@ -1617,32 +1566,17 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } #else xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL0()->isRefPicLongterm(refPicIndex), m_apcSlicePilot->getPic()->layerId); -#endif -#else -#if JVET_P0184 - if (m_apcSlicePilot->getRPL0()->isInterLayerRefPic(refPicIndex) == 0) - { - xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL0()->isRefPicLongterm(refPicIndex), m_apcSlicePilot->getRPL0()->isInterLayerRefPic(refPicIndex)); - } -#else - xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL0()->isRefPicLongterm(refPicIndex)); -#endif #endif } else { -#if JVET_N0278_FIXES xCreateLostPicture( lostPoc - 1, m_apcSlicePilot->getPic()->layerId ); -#else - xCreateLostPicture(lostPoc - 1); -#endif } } while ((lostPoc = m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPL1(), 0, true, &refPicIndex)) > 0) { if (((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_GDR) || (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA)) && m_apcSlicePilot->getNoIncorrectPicOutputFlag()) { -#if JVET_N0278_FIXES #if JVET_P0184 if (m_apcSlicePilot->getRPL1()->isInterLayerRefPic(refPicIndex) == 0) { @@ -1650,25 +1584,11 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } #else xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL1()->isRefPicLongterm(refPicIndex), m_apcSlicePilot->getPic()->layerId); -#endif -#else -#if JVET_P0184 - if (m_apcSlicePilot->getRPL1()->isInterLayerRefPic(refPicIndex) == 0) - { - xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL1()->isRefPicLongterm(refPicIndex), m_apcSlicePilot->getRPL1()->isInterLayerRefPic(refPicIndex)); - } -#else - xCreateUnavailablePicture(lostPoc - 1, m_apcSlicePilot->getRPL1()->isRefPicLongterm(refPicIndex)); -#endif #endif } else { -#if JVET_N0278_FIXES xCreateLostPicture( lostPoc - 1, m_apcSlicePilot->getPic()->layerId ); -#else - xCreateLostPicture(lostPoc - 1); -#endif } } } @@ -1681,11 +1601,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl } // actual decoding starts here -#if JVET_N0278_FIXES xActivateParameterSets( nalu.m_nuhLayerId ); -#else - xActivateParameterSets(); -#endif m_bFirstSliceInSequence = false; m_bFirstSliceInBitstream = false; @@ -1697,9 +1613,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_pcPic->layer = pcSlice->getTLayer(); m_pcPic->referenced = true; m_pcPic->layer = nalu.m_temporalId; -#if JVET_N0278_FIXES m_pcPic->layerId = nalu.m_nuhLayerId; -#endif #if JVET_O0235_NAL_UNIT_TYPE_CONSTRAINTS m_pcPic->subLayerNonReferencePictureDueToSTSA = false; #endif @@ -2022,7 +1936,6 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl void DecLib::xDecodeVPS( InputNALUnit& nalu ) { -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY m_vps = new VPS(); #else @@ -2039,15 +1952,6 @@ void DecLib::xDecodeVPS( InputNALUnit& nalu ) #if JVET_O1159_SCALABILITY m_parameterSetManager.storeVPS( m_vps, nalu.getBitstream().getFifo()); #endif -#else - VPS* vps = new VPS(); - m_HLSReader.setBitstream( &nalu.getBitstream() ); - - CHECK( nalu.m_temporalId, "The value of TemporalId of VPS NAL units shall be equal to 0" ); - - m_HLSReader.parseVPS( vps ); - delete vps; -#endif } void DecLib::xDecodeDPS( InputNALUnit& nalu ) diff --git a/source/Lib/DecoderLib/DecLib.h b/source/Lib/DecoderLib/DecLib.h index 27e30f429b..f51ec697b9 100644 --- a/source/Lib/DecoderLib/DecLib.h +++ b/source/Lib/DecoderLib/DecLib.h @@ -142,9 +142,7 @@ private: std::vector<std::pair<NalUnitType, int>> m_accessUnitNals; std::vector<int> m_accessUnitApsNals; -#if JVET_N0278_FIXES VPS* m_vps; -#endif #if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC bool m_scalingListUpdateFlag; int m_PreScalingListAPSId; @@ -199,9 +197,7 @@ public: bool isSliceNaluFirstInAU( bool newPicture, InputNALUnit &nalu ); #endif -#if JVET_N0278_FIXES const VPS* getVPS() { return m_vps; } -#endif #if JVET_P0257_SCALING_LISTS_SPEEDUP_DEC void initScalingList() { @@ -216,7 +212,6 @@ public: protected: void xUpdateRasInit(Slice* slice); -#if JVET_N0278_FIXES Picture * xGetNewPicBuffer( const SPS &sps, const PPS &pps, const uint32_t temporalLayer, const int layerId ); void xCreateLostPicture( int iLostPOC, const int layerId ); #if JVET_P0184 @@ -225,16 +220,6 @@ protected: void xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, const int layerId); #endif void xActivateParameterSets( const int layerId ); -#else - Picture * xGetNewPicBuffer(const SPS &sps, const PPS &pps, const uint32_t temporalLayer); - void xCreateLostPicture (int iLostPOC); -#if JVET_P0184 - void xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag, const bool interLayerRefPicFlag); -#else - void xCreateUnavailablePicture(int iUnavailablePoc, bool longTermFlag); -#endif - void xActivateParameterSets(); -#endif #if JVET_P1006_PICTURE_HEADER void xDecodePicHeader( InputNALUnit& nalu ); #endif diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index 11cc0283ab..5ff91d429b 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -400,17 +400,9 @@ int AlfCovariance::gnsSolveByChol( TE LHS, double* rhs, double *x, int numEq ) c } ////////////////////////////////////////////////////////////////////////////////////////// -#if JVET_N0278_FIXES EncAdaptiveLoopFilter::EncAdaptiveLoopFilter( int& apsIdStart ) -#else -EncAdaptiveLoopFilter::EncAdaptiveLoopFilter() -#endif : m_CABACEstimator( nullptr ) -#if JVET_N0278_FIXES , m_apsIdStart( apsIdStart ) -#else - , m_apsIdStart( ALF_CTB_MAX_NUM_APS ) -#endif { for( int i = 0; i < MAX_NUM_COMPONENT; i++ ) { @@ -648,7 +640,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda #endif ) { -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY int layerIdx = cs.vps == nullptr ? 0 : cs.vps->getGeneralLayerIdx( cs.slice->getPic()->layerId ); #else @@ -657,9 +648,6 @@ void EncAdaptiveLoopFilter::ALFProcess(CodingStructure& cs, const double *lambda // IRAP AU is assumed if( !layerIdx && ( cs.slice->getPendingRasInit() || cs.slice->isIDRorBLA() ) ) -#else - if (cs.slice->getPendingRasInit() || cs.slice->isIDRorBLA()) -#endif { memset(cs.slice->getAlfAPSs(), 0, sizeof(*cs.slice->getAlfAPSs())*ALF_CTB_MAX_NUM_APS); m_apsIdStart = ALF_CTB_MAX_NUM_APS; @@ -2446,11 +2434,7 @@ std::vector<int> EncAdaptiveLoopFilter::getAvaiApsIdsLuma(CodingStructure& cs, i { APS* curAPS = cs.slice->getAlfAPSs()[curApsId]; -#if JVET_N0278_FIXES if( curAPS && curAPS->getLayerId() == cs.slice->getPic()->layerId && curAPS->getTemporalId() <= cs.slice->getTLayer() && curAPS->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA] ) -#else - if (curAPS && curAPS->getTemporalId() <= cs.slice->getTLayer() && curAPS->getAlfAPSParam().newFilterFlag[CHANNEL_TYPE_LUMA]) -#endif { result.push_back(curApsId); } @@ -2806,12 +2790,10 @@ void EncAdaptiveLoopFilter::alfEncoderCtb(CodingStructure& cs, AlfParam& alfPar } APS* curAPS = m_apsMap->getPS((curApsId << NUM_APS_TYPE_LEN) + ALF_APS); -#if JVET_N0278_FIXES if( curAPS && curAPS->getLayerId() != cs.slice->getPic()->layerId ) { continue; } -#endif double curCost = m_lambda[CHANNEL_TYPE_CHROMA] * 3; if (curApsId == newApsIdChroma) diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h index 9426073732..b410ce69ff 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.h @@ -246,11 +246,7 @@ private: int** m_diffFilterCoeff; short m_filterIndices[MAX_NUM_ALF_CLASSES][MAX_NUM_ALF_CLASSES]; unsigned m_bitsNewFilter[MAX_NUM_CHANNEL_TYPE]; -#if JVET_N0278_FIXES int& m_apsIdStart; -#else - int m_apsIdStart; -#endif double *m_ctbDistortionFixedFilter; double *m_ctbDistortionUnfilter[MAX_NUM_COMPONENT]; std::vector<short> m_alfCtbFilterSetIndexTmp; @@ -260,11 +256,7 @@ private: int m_clipTmp[MAX_NUM_ALF_LUMA_COEFF]; public: -#if JVET_N0278_FIXES EncAdaptiveLoopFilter( int& apsIdStart ); -#else - EncAdaptiveLoopFilter(); -#endif virtual ~EncAdaptiveLoopFilter() {} void initDistortion(); std::vector<int> getAvaiApsIdsLuma(CodingStructure& cs, int &newApsId); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 3f7205fce2..597ea3dd6e 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -373,9 +373,7 @@ int EncGOP::xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId ) m_HLSWriter->setBitstream(&nalu.m_Bitstream); nalu.m_nuhLayerId = layerId; nalu.m_temporalId = aps->getTemporalId(); -#if JVET_N0278_FIXES aps->setLayerId( layerId ); -#endif CHECK( nalu.m_temporalId < accessUnit.temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); m_HLSWriter->codeAPS(aps); accessUnit.push_back(new NALUnitEBSP(nalu)); @@ -386,7 +384,6 @@ int EncGOP::xWriteParameterSets( AccessUnit &accessUnit, Slice *slice, const boo { int actualTotalBits = 0; -#if JVET_N0278_FIXES if( bSeqFirst ) { #if JVET_P0205_VPS_ID_0 @@ -414,33 +411,6 @@ int EncGOP::xWriteParameterSets( AccessUnit &accessUnit, Slice *slice, const boo { actualTotalBits += xWritePPS( accessUnit, slice->getPPS(), slice->getSPS(), m_pcEncLib->getLayerId() ); } -#else - if (bSeqFirst) - { -#if JVET_P0205_VPS_ID_0 - if (slice->getSPS()->getVPSId() != 0) - { - actualTotalBits += xWriteVPS(accessUnit, m_pcEncLib->getVPS()); - } -#else - actualTotalBits += xWriteVPS(accessUnit, m_pcEncLib->getVPS()); -#endif - } - if (bSeqFirst) - { - actualTotalBits += xWriteDPS(accessUnit, m_pcEncLib->getDPS()); - } - - if (m_pcEncLib->SPSNeedsWriting(slice->getSPS()->getSPSId())) // Note this assumes that all changes to the SPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). - { - CHECK(!(bSeqFirst), "Unspecified error"); // Implementations that use more than 1 SPS need to be aware of activation issues. - actualTotalBits += xWriteSPS(accessUnit, slice->getSPS()); - } - if (m_pcEncLib->PPSNeedsWriting(slice->getPPS()->getPPSId())) // Note this assumes that all changes to the PPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). - { - actualTotalBits += xWritePPS(accessUnit, slice->getPPS(), slice->getSPS()); - } -#endif return actualTotalBits; } @@ -497,11 +467,7 @@ void EncGOP::xWriteSEI (NalUnitType naluType, SEIMessages& seiMessages, AccessUn { return; } -#if JVET_N0278_FIXES OutputNALUnit nalu( naluType, m_pcEncLib->getLayerId(), temporalId ); -#else - OutputNALUnit nalu(naluType, temporalId); -#endif m_seiWriter.writeSEImessages(nalu.m_Bitstream, seiMessages, sps, *m_HRD, false, temporalId); auPos = accessUnit.insert(auPos, new NALUnitEBSP(nalu)); auPos++; @@ -518,11 +484,7 @@ void EncGOP::xWriteSEISeparately (NalUnitType naluType, SEIMessages& seiMessages { SEIMessages tmpMessages; tmpMessages.push_back(*sei); -#if JVET_N0278_FIXES OutputNALUnit nalu( naluType, m_pcEncLib->getLayerId(), temporalId ); -#else - OutputNALUnit nalu(naluType, temporalId); -#endif m_seiWriter.writeSEImessages(nalu.m_Bitstream, tmpMessages, sps, *m_HRD, false, temporalId); auPos = accessUnit.insert(auPos, new NALUnitEBSP(nalu)); auPos++; @@ -2110,15 +2072,11 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) #endif if (m_pcReshaper->getSliceReshaperInfo().getSliceReshapeModelPresentFlag()) { -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ); #else int apsId = std::min<int>( 3, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx #endif -#else - int apsId = 0; -#endif #if JVET_P1006_PICTURE_HEADER picHeader->setLmcsAPSId(apsId); APS* lmcsAPS = picHeader->getLmcsAPS(); @@ -2162,15 +2120,11 @@ void EncGOP::xPicInitLMCS(Picture *pic, Slice *slice) if (slice->getLmcsEnabledFlag()) #endif { -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ); #else int apsId = std::min<int>( 3, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx #endif -#else - int apsId = 0; -#endif #if JVET_P1006_PICTURE_HEADER picHeader->setLmcsAPSId(apsId); #else @@ -2191,9 +2145,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, std::list<PelUnitBuf*>& rcListPicYuvRecOut, bool isField, bool isTff, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE , bool isEncodeLtRef -#if JVET_N0278_FIXES , const int picIdInGOP -#endif ) { // TODO: Split this function up. @@ -2223,7 +2175,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, effFieldIRAPMap.initialize(isField, m_iGopSize, iPOCLast, iNumPicRcvd, m_iLastIDR, this, m_pcCfg); } -#if JVET_N0278_FIXES #if FIELD_CODING_FIX if( isField && picIdInGOP == 0 ) { @@ -2237,16 +2188,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { // reset flag indicating whether pictures have been encoded m_pcCfg->setEncodedFlag( iGOPid, false ); -#else - // reset flag indicating whether pictures have been encoded - for ( int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) - { - m_pcCfg->setEncodedFlag(iGOPid, false); - } - - for ( int iGOPid=0; iGOPid < m_iGopSize; iGOPid++ ) - { -#endif if (m_pcCfg->getEfficientFieldIRAPEnabled()) { iGOPid=effFieldIRAPMap.adjustGOPid(iGOPid); @@ -3045,15 +2986,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setscalingListPresentFlag( true ); #endif -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY int apsId = std::min<int>( 7, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ); #else int apsId = std::min<int>( 7, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx #endif -#else - int apsId = 0; -#endif #if JVET_P1006_PICTURE_HEADER picHeader->setScalingListAPSId( apsId ); #else @@ -3162,15 +3099,11 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setLmcsEnabledFlag(true); #endif -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY int apsId = std::min<int>( 3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ) ); #else int apsId = std::min<int>( 3, m_pcEncLib->getLayerId() ); //VS: layerId should be converted to laeyrIdx #endif -#else - int apsId = 0; -#endif #if JVET_P1006_PICTURE_HEADER picHeader->setLmcsAPSId(apsId); @@ -3373,7 +3306,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, m_pcEncLib->setParamSetChanged(pcSlice->getSPS()->getSPSId(), pcSlice->getPPS()->getPPSId()); } -#if JVET_N0278_FIXES #if JVET_O1159_SCALABILITY int layerIdx = m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx( m_pcEncLib->getLayerId() ); #else @@ -3382,9 +3314,6 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, // it is assumed that layerIdx equal to 0 is always present actualTotalBits += xWriteParameterSets( accessUnit, pcSlice, writePS && !layerIdx ); -#else - actualTotalBits += xWriteParameterSets(accessUnit, pcSlice, writePS); -#endif if (writePS) { @@ -3395,12 +3324,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, m_bSeqFirst = false; } -#if JVET_N0278_FIXES // it is assumed that layerIdx equal to 0 is always present if( m_pcCfg->getAccessUnitDelimiter() && !layerIdx ) -#else - if (m_pcCfg->getAccessUnitDelimiter()) -#endif { xWriteAccessUnitDelimiter(accessUnit, pcSlice); } @@ -3420,18 +3345,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, bool writeAPS = aps && apsMap->getChangedFlag((apsId << NUM_APS_TYPE_LEN) + LMCS_APS); if (writeAPS) { -#if JVET_N0278_FIXES #if JVET_P0588_SUFFIX_APS actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); #else actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId() ); -#endif -#else -#if JVET_P0588_SUFFIX_APS - actualTotalBits += xWriteAPS(accessUnit, aps, 0, true ); -#else - actualTotalBits += xWriteAPS(accessUnit, aps, 0 ); -#endif #endif apsMap->clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + LMCS_APS); #if JVET_P1006_PICTURE_HEADER @@ -3455,18 +3372,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, bool writeAPS = aps && apsMap->getChangedFlag( ( apsId << NUM_APS_TYPE_LEN ) + SCALING_LIST_APS ); if( writeAPS ) { -#if JVET_N0278_FIXES #if JVET_P0588_SUFFIX_APS actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); #else actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId() ); -#endif -#else -#if JVET_P0588_SUFFIX_APS - actualTotalBits += xWriteAPS( accessUnit, aps, 0, true ); -#else - actualTotalBits += xWriteAPS( accessUnit, aps, 0 ); -#endif #endif apsMap->clearChangedFlag( ( apsId << NUM_APS_TYPE_LEN ) + SCALING_LIST_APS ); #if JVET_P1006_PICTURE_HEADER @@ -3495,18 +3404,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, if (writeAPS ) { -#if JVET_N0278_FIXES #if JVET_P0588_SUFFIX_APS actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); #else actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId() ); -#endif -#else -#if JVET_P0588_SUFFIX_APS - actualTotalBits += xWriteAPS( accessUnit, aps, 0, true ); -#else - actualTotalBits += xWriteAPS(accessUnit, aps, 0); -#endif #endif apsMap->clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + ALF_APS); CHECK(aps != pcSlice->getAlfAPSs()[apsId], "Wrong APS pointer in compressGOP"); @@ -3630,11 +3531,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } /* start slice NALunit */ -#if JVET_N0278_FIXES OutputNALUnit nalu( pcSlice->getNalUnitType(), m_pcEncLib->getLayerId(), pcSlice->getTLayer() ); -#else - OutputNALUnit nalu( pcSlice->getNalUnitType(), pcSlice->getTLayer() ); -#endif m_HLSWriter->setBitstream( &nalu.m_Bitstream ); #if !JVET_P1006_PICTURE_HEADER @@ -3831,11 +3728,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, delete pcBitstreamRedirect; -#if JVET_N0278_FIXES CHECK( m_iNumPicCoded > 1, "Unspecified error" ); -#else - CHECK(!( (m_iNumPicCoded == iNumPicRcvd) ), "Unspecified error"); -#endif } void EncGOP::printOutSummary( uint32_t uiNumAllPicCoded, bool isField, const bool printMSEBasedSNR, const bool printSequenceMSE, const bool printHexPsnr, const bool printRprPSNR, const BitDepths &bitDepths ) @@ -4026,11 +3919,7 @@ void EncGOP::xGetBuffer( PicList& rcListPic, while (iterPic != rcListPic.end()) { rpcPic = *(iterPic); -#if JVET_N0278_FIXES if( rpcPic->getPOC() == pocCurr && rpcPic->layerId == m_pcEncLib->getLayerId() ) -#else - if (rpcPic->getPOC() == pocCurr) -#endif { break; } @@ -4631,14 +4520,9 @@ void EncGOP::xCalculateAddPSNR(Picture* pcPic, PelUnitBuf cPicD, const AccessUni if( g_verbosity >= NOTICE ) { -#if JVET_N0278_FIXES msg( NOTICE, "POC %4d LId: %2d TId: %1d ( %c-SLICE, QP %d ) %10d bits", pcSlice->getPOC(), pcSlice->getPic()->layerId, -#else - msg( NOTICE, "POC %4d TId: %1d ( %c-SLICE, QP %d ) %10d bits", - pcSlice->getPOC(), -#endif pcSlice->getTLayer(), c, pcSlice->getSliceQp(), diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h index bbe60f28d7..b20a43b1f4 100644 --- a/source/Lib/EncoderLib/EncGOP.h +++ b/source/Lib/EncoderLib/EncGOP.h @@ -212,9 +212,7 @@ public: void compressGOP ( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, std::list<PelUnitBuf*>& rcListPicYuvRec, bool isField, bool isTff, const InputColourSpaceConversion snr_conversion, const bool printFrameMSE , bool isEncodeLtRef -#if JVET_N0278_FIXES , const int picIdInGOP -#endif ); void xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, OutputBitstream* pcBitstreamRedirect); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 90ad151ee9..30b7bc3304 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -46,9 +46,7 @@ #if ENABLE_SPLIT_PARALLELISM #include <omp.h> #endif -#if JVET_N0278_FIXES #include "EncLibCommon.h" -#endif //! \ingroup EncoderLib //! \{ @@ -57,7 +55,6 @@ // Constructor / destructor / create / destroy // ==================================================================================================================== -#if JVET_N0278_FIXES EncLib::EncLib( EncLibCommon* encLibCommon ) : m_cListPic( encLibCommon->getPictureBuffer() ) , m_cEncALF( encLibCommon->getApsIdStart() ) @@ -65,13 +62,6 @@ EncLib::EncLib( EncLibCommon* encLibCommon ) , m_ppsMap( encLibCommon->getPpsMap() ) , m_apsMap( encLibCommon->getApsMap() ) , m_AUWriterIf( nullptr ) -#else -EncLib::EncLib() - : m_spsMap( MAX_NUM_SPS ) - , m_ppsMap( MAX_NUM_PPS ) - , m_apsMap(MAX_NUM_APS * MAX_NUM_APS_TYPE) - , m_AUWriterIf( nullptr ) -#endif #if JVET_J0090_MEMORY_BANDWITH_MEASURE , m_cacheModel() #endif @@ -95,29 +85,17 @@ EncLib::EncLib() memset(m_apss, 0, sizeof(m_apss)); -#if JVET_N0278_FIXES m_layerId = NOT_VALID; m_picIdInGOP = NOT_VALID; -#endif } EncLib::~EncLib() { } -#if JVET_N0278_FIXES void EncLib::create( const int layerId ) -#else -void EncLib::create () -#endif { -#if JVET_N0278_FIXES m_layerId = layerId; -#else - // initialize global variables - initROM(); - TComHash::initBlockSizeToIndex(); -#endif m_iPOCLast = m_compositeRefEnabled ? -2 : -1; // create processing unit classes m_cGOPEncoder. create( ); @@ -221,10 +199,6 @@ void EncLib::destroy () delete[] m_CtxCache; #endif -#if !JVET_N0278_FIXES - // destroy ROM - destroyROM(); -#endif return; } @@ -233,11 +207,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) m_AUWriterIf = auWriterIf; SPS &sps0=*(m_spsMap.allocatePS(0)); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues. -#if JVET_N0278_FIXES PPS &pps0 = *( m_ppsMap.allocatePS( m_layerId ) ); -#else - PPS &pps0=*(m_ppsMap.allocatePS(0)); -#endif APS &aps0 = *( m_apsMap.allocatePS( SCALING_LIST_APS ) ); aps0.setAPSId( 0 ); aps0.setAPSType( SCALING_LIST_APS ); @@ -466,11 +436,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) if (getUseCompositeRef()) { Picture *picBg = new Picture; -#if JVET_N0278_FIXES picBg->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false, m_layerId ); -#else - picBg->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false ); -#endif picBg->getRecoBuf().fill(0); #if JVET_P1006_PICTURE_HEADER #if JVET_O1159_SCALABILITY @@ -488,11 +454,7 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) picBg->createSpliceIdx(pps0.pcv->sizeInCtus); m_cGOPEncoder.setPicBg(picBg); Picture *picOrig = new Picture; -#if JVET_N0278_FIXES picOrig->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false, m_layerId ); -#else - picOrig->create( sps0.getChromaFormatIdc(), Size( pps0.getPicWidthInLumaSamples(), pps0.getPicHeightInLumaSamples() ), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false ); -#endif picOrig->getOrigBuf().fill(0); m_cGOPEncoder.setPicOrig(picOrig); } @@ -620,12 +582,9 @@ void EncLib::deletePicBuffer() pcPic = NULL; } -#if JVET_N0278_FIXES m_cListPic.clear(); -#endif } -#if JVET_N0278_FIXES bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded ) { if( m_compositeRefEnabled && m_cGOPEncoder.getPicBg()->getSpliceFull() && m_iPOCLast >= 10 && m_iNumPicRcvd == 0 && m_cGOPEncoder.getEncodedLTRef() == false ) @@ -700,12 +659,10 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu } } -#if JVET_N0278_FIXES if( m_cVPS.getMaxLayers() > 1 ) { ppsID = m_layerId; } -#endif xGetNewPicBuffer( rcListPicYuvRecOut, pcPicCurr, ppsID ); @@ -856,206 +813,6 @@ bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitB return false; } -#else -/** - - Application has picture buffer list with size of GOP + 1 - - Picture buffer list acts like as ring buffer - - End of the list has the latest picture - . - \param flush cause encoder to encode a partial GOP - \param pcPicYuvOrg original YUV picture - \param pcPicYuvTrueOrg - \param snrCSC - \retval rcListPicYuvRecOut list of reconstruction YUV pictures - \retval accessUnitsOut list of output access units - \retval iNumEncoded number of encoded pictures - */ -void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded ) -{ - if (m_compositeRefEnabled && m_cGOPEncoder.getPicBg()->getSpliceFull() && m_iPOCLast >= 10 && m_iNumPicRcvd == 0 && m_cGOPEncoder.getEncodedLTRef() == false) - { - Picture* picCurr = NULL; - xGetNewPicBuffer(rcListPicYuvRecOut, picCurr, 2); - const PPS *pps = m_ppsMap.getPS(2); - const SPS *sps = m_spsMap.getPS(pps->getSPSId()); - - picCurr->M_BUFS(0, PIC_ORIGINAL).copyFrom(m_cGOPEncoder.getPicBg()->getRecoBuf()); -#if JVET_P1006_PICTURE_HEADER - picCurr->finalInit( *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - picCurr->finalInit( *sps, *pps, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif - picCurr->poc = m_iPOCLast - 1; - m_iPOCLast -= 2; - if (getUseAdaptiveQP()) - { - AQpPreanalyzer::preanalyze(picCurr); - } - if (m_RCEnableRateControl) - { - m_cRateCtrl.initRCGOP(m_iNumPicRcvd); - } - - m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, - false, false, snrCSC, m_printFrameMSE, true); - -#if JVET_O0756_CALCULATE_HDRMETRICS - m_metricTime = m_cGOPEncoder.getMetricTime(); -#endif - m_cGOPEncoder.setEncodedLTRef(true); - if (m_RCEnableRateControl) - { - m_cRateCtrl.destroyRCGOP(); - } - - iNumEncoded = 0; - m_iNumPicRcvd = 0; - } - //PROF_ACCUM_AND_START_NEW_SET( getProfilerPic(), P_GOP_LEVEL ); - if (pcPicYuvOrg != NULL) - { - // get original YUV - Picture* pcPicCurr = NULL; - - int ppsID=-1; // Use default PPS ID -#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); - } -#endif - - if( m_rprEnabled && m_uiIntraPeriod == -1 ) - { - const int poc = m_iPOCLast + ( m_compositeRefEnabled ? 2 : 1 ); - - if( poc / m_switchPocPeriod % 2 ) - { - ppsID = ENC_PPS_ID_RPR; - } - else - { - ppsID = 0; - } - } - xGetNewPicBuffer( rcListPicYuvRecOut, pcPicCurr, ppsID ); - - const PPS *pPPS = ( ppsID < 0 ) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS( ppsID ); - const SPS *pSPS = m_spsMap.getPS( pPPS->getSPSId() ); - - if( m_rprEnabled ) - { - pcPicCurr->M_BUFS( 0, PIC_ORIGINAL_INPUT ).getBuf( COMPONENT_Y ).copyFrom( pcPicYuvOrg->getBuf( COMPONENT_Y ) ); - pcPicCurr->M_BUFS( 0, PIC_ORIGINAL_INPUT ).getBuf( COMPONENT_Cb ).copyFrom( pcPicYuvOrg->getBuf( COMPONENT_Cb ) ); - pcPicCurr->M_BUFS( 0, PIC_ORIGINAL_INPUT ).getBuf( COMPONENT_Cr ).copyFrom( pcPicYuvOrg->getBuf( COMPONENT_Cr ) ); - - pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).getBuf( COMPONENT_Y ).copyFrom( cPicYuvTrueOrg->getBuf( COMPONENT_Y ) ); - pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).getBuf( COMPONENT_Cb ).copyFrom( cPicYuvTrueOrg->getBuf( COMPONENT_Cb ) ); - pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL_INPUT ).getBuf( COMPONENT_Cr ).copyFrom( cPicYuvTrueOrg->getBuf( COMPONENT_Cr ) ); - - const ChromaFormat chromaFormatIDC = pSPS->getChromaFormatIdc(); - - const PPS *refPPS = m_ppsMap.getPS( 0 ); -#if JVET_P0590_SCALING_WINDOW - const Window& curScalingWindow = pPPS->getScalingWindow(); - int curPicWidth = pPPS->getPicWidthInLumaSamples() - curScalingWindow.getWindowLeftOffset() - curScalingWindow.getWindowRightOffset(); - int curPicHeight = pPPS->getPicHeightInLumaSamples() - curScalingWindow.getWindowTopOffset() - curScalingWindow.getWindowBottomOffset(); - - const Window& refScalingWindow = refPPS->getScalingWindow(); - int refPicWidth = refPPS->getPicWidthInLumaSamples() - refScalingWindow.getWindowLeftOffset() - refScalingWindow.getWindowRightOffset(); - int refPicHeight = refPPS->getPicHeightInLumaSamples() - refScalingWindow.getWindowTopOffset() - refScalingWindow.getWindowBottomOffset(); - - int xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; - int yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; - std::pair<int, int> scalingRatio = std::pair<int, int>( xScale, yScale ); - -#if JVET_P0592_CHROMA_PHASE - Picture::rescalePicture( scalingRatio, *pcPicYuvOrg, refPPS->getScalingWindow(), pcPicCurr->getOrigBuf(), pPPS->getScalingWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true, - pSPS->getHorCollocatedChromaFlag(), pSPS->getVerCollocatedChromaFlag() ); - Picture::rescalePicture( scalingRatio, *cPicYuvTrueOrg, refPPS->getScalingWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getScalingWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true, - pSPS->getHorCollocatedChromaFlag(), pSPS->getVerCollocatedChromaFlag() ); -#else - Picture::rescalePicture( scalingRatio, *pcPicYuvOrg, refPPS->getScalingWindow(), pcPicCurr->getOrigBuf(), pPPS->getScalingWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); - Picture::rescalePicture( scalingRatio, *cPicYuvTrueOrg, refPPS->getScalingWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getScalingWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); -#endif -#elif JVET_P0592_CHROMA_PHASE - const Window& curWindow = pPPS->getConformanceWindow(); - int curPicWidth = pPPS->getPicWidthInLumaSamples() - ( curWindow.getWindowLeftOffset() + curWindow.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ); - int curPicHeight = pPPS->getPicHeightInLumaSamples() - ( curWindow.getWindowTopOffset() + curWindow.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ); - - const Window& refWindow = refPPS->getConformanceWindow(); - int refPicWidth = refPPS->getPicWidthInLumaSamples() - ( refWindow.getWindowLeftOffset() + refWindow.getWindowRightOffset() ) * SPS::getWinUnitX( chromaFormatIDC ); - int refPicHeight = refPPS->getPicHeightInLumaSamples() - ( refWindow.getWindowTopOffset() + refWindow.getWindowBottomOffset() ) * SPS::getWinUnitY( chromaFormatIDC ); - - int xScale = ( ( refPicWidth << SCALE_RATIO_BITS ) + ( curPicWidth >> 1 ) ) / curPicWidth; - int yScale = ( ( refPicHeight << SCALE_RATIO_BITS ) + ( curPicHeight >> 1 ) ) / curPicHeight; - std::pair<int, int> scalingRatio = std::pair<int, int>( xScale, yScale ); - - Picture::rescalePicture( scalingRatio, *pcPicYuvOrg, refPPS->getConformanceWindow(), pcPicCurr->getOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true, - pSPS->getHorCollocatedChromaFlag(), pSPS->getVerCollocatedChromaFlag() ); - Picture::rescalePicture( scalingRatio, *cPicYuvTrueOrg, refPPS->getConformanceWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true, - pSPS->getHorCollocatedChromaFlag(), pSPS->getVerCollocatedChromaFlag() ); -#else - Picture::rescalePicture( *pcPicYuvOrg, refPPS->getConformanceWindow(), pcPicCurr->getOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); - Picture::rescalePicture( *cPicYuvTrueOrg, refPPS->getConformanceWindow(), pcPicCurr->getTrueOrigBuf(), pPPS->getConformanceWindow(), chromaFormatIDC, pSPS->getBitDepths(), true, true ); -#endif - } - else - { - pcPicCurr->M_BUFS( 0, PIC_ORIGINAL ).swap( *pcPicYuvOrg ); - pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL ).swap( *cPicYuvTrueOrg ); - } - -#if JVET_P1006_PICTURE_HEADER - pcPicCurr->finalInit( *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - pcPicCurr->finalInit( *pSPS, *pPPS, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif - PPS *ptrPPS = ( ppsID < 0 ) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS( ppsID ); - ptrPPS->setNumBricksInPic( (int)pcPicCurr->brickMap->bricks.size() ); - - pcPicCurr->poc = m_iPOCLast; - - // compute image characteristics - if ( getUseAdaptiveQP() ) - { - AQpPreanalyzer::preanalyze( pcPicCurr ); - } - } - - if ((m_iNumPicRcvd == 0) || (!flush && (m_iPOCLast != 0) && (m_iNumPicRcvd != m_iGOPSize) && (m_iGOPSize != 0))) - { - iNumEncoded = 0; - return; - } - - if ( m_RCEnableRateControl ) - { - m_cRateCtrl.initRCGOP( m_iNumPicRcvd ); - } - - // compress GOP - m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, - false, false, snrCSC, m_printFrameMSE - , false - ); - -#if JVET_O0756_CALCULATE_HDRMETRICS - m_metricTime = m_cGOPEncoder.getMetricTime(); -#endif - - if ( m_RCEnableRateControl ) - { - m_cRateCtrl.destroyRCGOP(); - } - - iNumEncoded = m_iNumPicRcvd; - m_iNumPicRcvd = 0; - m_uiNumAllPicCoded += iNumEncoded; -} -#endif /**------------------------------------------------ Separate interlaced frame into two fields @@ -1079,7 +836,6 @@ void separateFields(Pel* org, Pel* dstField, uint32_t stride, uint32_t width, ui } -#if JVET_N0278_FIXES bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded, bool isTff ) { @@ -1223,88 +979,6 @@ bool EncLib::encode( const InputColourSpaceConversion snrCSC, std::list<PelUnitB return false; #endif } -#else -void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded, bool isTff ) -{ - iNumEncoded = 0; - - for (int fieldNum=0; fieldNum<2; fieldNum++) - { - if (pcPicYuvOrg) - { - /* -- field initialization -- */ - const bool isTopField=isTff==(fieldNum==0); - - Picture *pcField; - xGetNewPicBuffer( rcListPicYuvRecOut, pcField, -1 ); - - for (uint32_t comp = 0; comp < ::getNumberValidComponents(pcPicYuvOrg->chromaFormat); comp++) - { - const ComponentID compID = ComponentID(comp); - { - PelBuf compBuf = pcPicYuvOrg->get( compID ); - separateFields( compBuf.buf, - pcField->getOrigBuf().get(compID).buf, - compBuf.stride, - compBuf.width, - compBuf.height, - isTopField); -#if FIELD_CODING_FIX - // to get fields of true original buffer to avoid wrong PSNR calculation in summary - compBuf = pcPicYuvTrueOrg->get( compID ); - separateFields( compBuf.buf, - pcField->getTrueOrigBuf().get(compID).buf, - compBuf.stride, - compBuf.width, - compBuf.height, - isTopField); -#endif - } - } - - { - int ppsID=-1; // Use default PPS ID - const PPS *pPPS=(ppsID<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsID); - const SPS *pSPS=m_spsMap.getPS(pPPS->getSPSId()); - -#if JVET_P1006_PICTURE_HEADER - pcField->finalInit( *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else - pcField->finalInit( *pSPS, *pPPS, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif - } - - pcField->poc = m_iPOCLast; - pcField->reconstructed = false; - - pcField->setBorderExtension(false);// where is this normally? - - pcField->topField = isTopField; // interlaced requirement - - // compute image characteristics - if ( getUseAdaptiveQP() ) - { - AQpPreanalyzer::preanalyze( pcField ); - } - } - - if ( m_iNumPicRcvd && ((flush&&fieldNum==1) || (m_iPOCLast/2)==0 || m_iNumPicRcvd==m_iGOPSize ) ) - { - // compress GOP - m_cGOPEncoder.compressGOP(m_iPOCLast, m_iNumPicRcvd, m_cListPic, rcListPicYuvRecOut, true, isTff, snrCSC, m_printFrameMSE - , false - ); -#if JVET_O0756_CALCULATE_HDRMETRICS - m_metricTime = m_cGOPEncoder.getMetricTime(); -#endif - iNumEncoded += m_iNumPicRcvd; - m_uiNumAllPicCoded += m_iNumPicRcvd; - m_iNumPicRcvd = 0; - } - } -} -#endif // ==================================================================================================================== // Protected member functions @@ -1343,7 +1017,6 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict for( int i = 0; i < iSize; i++ ) { rpcPic = *iterPic; -#if JVET_N0278_FIXES if( !rpcPic->referenced && rpcPic->layerId == m_layerId ) { break; @@ -1352,22 +1025,12 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict { rpcPic = nullptr; } -#else - if( !rpcPic->referenced ) - { - break; - } -#endif iterPic++; } // If PPS ID is the same, we will assume that it has not changed since it was last used // and return the old object. -#if JVET_N0278_FIXES if( rpcPic && pps.getPPSId() != rpcPic->cs->pps->getPPSId() ) -#else - if (pps.getPPSId() != rpcPic->cs->pps->getPPSId()) -#endif { // the IDs differ - free up an entry in the list, and then create a new one, as with the case where the max buffering state has not been reached. rpcPic->destroy(); @@ -1380,11 +1043,7 @@ void EncLib::xGetNewPicBuffer ( std::list<PelUnitBuf*>& rcListPicYuvRecOut, Pict if (rpcPic==0) { rpcPic = new Picture; -#if JVET_N0278_FIXES rpcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, false, m_layerId ); -#else - rpcPic->create( sps.getChromaFormatIdc(), Size( pps.getPicWidthInLumaSamples(), pps.getPicHeightInLumaSamples() ), sps.getMaxCUWidth(), sps.getMaxCUWidth() + 16, false ); -#endif if( m_rprEnabled ) { rpcPic->M_BUFS( 0, PIC_ORIGINAL_INPUT ).create( sps.getChromaFormatIdc(), Area( Position(), Size( sps.getMaxPicWidthInLumaSamples(), sps.getMaxPicHeightInLumaSamples() ) ) ); @@ -1424,9 +1083,6 @@ void EncLib::xInitVPS(VPS& vps) { // The SPS must have already been set up. // set the VPS profile information. -#if !JVET_N0278_FIXES - vps.setMaxLayers(1); -#endif #if !JVET_O1159_SCALABILITY for (uint32_t i = 0; i < vps.getMaxLayers(); i++) { diff --git a/source/Lib/EncoderLib/EncLib.h b/source/Lib/EncoderLib/EncLib.h index dd37ddc43e..891fad8edf 100644 --- a/source/Lib/EncoderLib/EncLib.h +++ b/source/Lib/EncoderLib/EncLib.h @@ -58,9 +58,7 @@ #include "EncAdaptiveLoopFilter.h" #include "RateCtrl.h" -#if JVET_N0278_FIXES class EncLibCommon; -#endif //! \ingroup EncoderLib //! \{ @@ -77,12 +75,8 @@ private: int m_iPOCLast; ///< time index (POC) int m_iNumPicRcvd; ///< number of received pictures uint32_t m_uiNumAllPicCoded; ///< number of coded pictures -#if JVET_N0278_FIXES PicList& m_cListPic; ///< dynamic list of pictures int m_layerId; -#else - PicList m_cListPic; ///< dynamic list of pictures -#endif // encoder search #if ENABLE_SPLIT_PARALLELISM @@ -123,15 +117,9 @@ private: EncCu m_cCuEncoder; ///< CU encoder #endif // SPS -#if JVET_N0278_FIXES 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 -#else - 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 -#endif #if JVET_P1006_PICTURE_HEADER PicHeader m_picHeader; ///< picture header #endif @@ -167,9 +155,7 @@ private: #if JVET_O0756_CALCULATE_HDRMETRICS std::chrono::duration<long long, ratio<1, 1000000000>> m_metricTime; #endif -#if JVET_N0278_FIXES int m_picIdInGOP; -#endif public: SPS* getSPS( int spsId ) { return m_spsMap.getPS( spsId ); }; @@ -204,18 +190,10 @@ protected: void xInitRPL(SPS &sps, bool isFieldCoding); ///< initialize SPS from encoder options public: -#if JVET_N0278_FIXES EncLib( EncLibCommon* encLibCommon ); -#else - EncLib(); -#endif virtual ~EncLib(); -#if JVET_N0278_FIXES void create ( const int layerId ); -#else - void create (); -#endif void destroy (); void init ( bool isFieldCoding, AUWriterIf* auWriterIf ); void deletePicBuffer (); @@ -296,7 +274,6 @@ public: // ------------------------------------------------------------------------------------------------------------------- /// encode several number of pictures until end-of-sequence -#if JVET_N0278_FIXES bool encodePrep( bool bEos, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. @@ -316,27 +293,11 @@ public: bool encode( const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. std::list<PelUnitBuf*>& rcListPicYuvRecOut, int& iNumEncoded, bool isTff ); -#else - void encode( bool bEos, - PelStorage* pcPicYuvOrg, - PelStorage* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. - std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded ); - - /// encode several number of pictures until end-of-sequence - void encode( bool bEos, - PelStorage* pcPicYuvOrg, - PelStorage* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space. - std::list<PelUnitBuf*>& rcListPicYuvRecOut, - int& iNumEncoded, bool isTff ); -#endif void printSummary( bool isField ) { m_cGOPEncoder.printOutSummary( m_uiNumAllPicCoded, isField, m_printMSEBasedSequencePSNR, m_printSequenceMSE, m_printHexPsnr, m_rprEnabled, m_spsMap.getFirstPS()->getBitDepths() ); } -#if JVET_N0278_FIXES int getLayerId() const { return m_layerId; } -#endif }; //! \} diff --git a/source/Lib/EncoderLib/NALwrite.h b/source/Lib/EncoderLib/NALwrite.h index e5bc108062..34a787d406 100644 --- a/source/Lib/EncoderLib/NALwrite.h +++ b/source/Lib/EncoderLib/NALwrite.h @@ -58,16 +58,10 @@ struct OutputNALUnit : public NALUnit */ OutputNALUnit( NalUnitType nalUnitType, -#if JVET_N0278_FIXES uint32_t layerId = 0, -#endif uint32_t temporalID = 0, uint32_t reserved_zero_6bits = 0) -#if JVET_N0278_FIXES : NALUnit( nalUnitType, temporalID, reserved_zero_6bits, 0, layerId ) -#else - : NALUnit(nalUnitType, temporalID, reserved_zero_6bits) -#endif , m_Bitstream() {} diff --git a/source/Lib/Utilities/VideoIOYuv.h b/source/Lib/Utilities/VideoIOYuv.h index b52576056c..27504973ee 100644 --- a/source/Lib/Utilities/VideoIOYuv.h +++ b/source/Lib/Utilities/VideoIOYuv.h @@ -95,9 +95,7 @@ public: bool isEof (); ///< check for end-of-file bool isFail(); ///< check for failure -#if JVET_N0278_FIXES bool isOpen() { return m_cHandle.is_open(); } -#endif bool writeUpscaledPicture( const SPS& sps, const PPS& pps, const CPelUnitBuf& pic, const InputColourSpaceConversion ipCSC, const bool bPackedYUVOutputMode, int outputChoice = 0, ChromaFormat format = NUM_CHROMA_FORMAT, const bool bClipToRec709 = false ); ///< write one upsaled YUV frame diff --git a/source/Lib/Utilities/program_options_lite.h b/source/Lib/Utilities/program_options_lite.h index 8a0b084ca2..6fc3dd3378 100644 --- a/source/Lib/Utilities/program_options_lite.h +++ b/source/Lib/Utilities/program_options_lite.h @@ -232,7 +232,6 @@ namespace df parent.addOption(new Option<T>(name, storage, default_val, desc)); return *this; } -#if 1 //JVET_O1159_SCALABILITY template<typename T> OptionSpecific& operator()(const std::string& name, T* storage, T default_val, unsigned uiMaxNum, const std::string& desc = "") @@ -288,7 +287,6 @@ namespace df return *this; } -#endif /** * Add option described by name to the parent Options list, * with desc as an optional help description -- GitLab