diff --git a/source/Lib/CommonLib/NNFilterSet0.cpp b/source/Lib/CommonLib/NNFilterSet0.cpp index 271979be38fdc5f123984698efbf5b1a4dbf933d..4ebe3ec3caf67004fa4facf00d96ad0e6318cd1d 100644 --- a/source/Lib/CommonLib/NNFilterSet0.cpp +++ b/source/Lib/CommonLib/NNFilterSet0.cpp @@ -153,14 +153,12 @@ void NNFilterSet0::CNNLFProcess( CodingStructure& cs, CnnlfSliceParam& cnnlfSlic filterPic(cs, cnnlfSliceParam); } -void NNFilterSet0::create( const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], std::string path) +void NNFilterSet0::create( const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, std::string path) { - std::memcpy( m_inputBitDepth, inputBitDepth, sizeof( m_inputBitDepth ) ); m_picWidth = picWidth; m_picHeight = picHeight; m_maxCUWidth = maxCUWidth; m_maxCUHeight = maxCUHeight; - m_maxCUDepth = maxCUDepth; m_chromaFormat = format; m_ModelPath = path; diff --git a/source/Lib/CommonLib/NNFilterSet0.h b/source/Lib/CommonLib/NNFilterSet0.h index 935f29459719e90636a0f0ac75d9c0319ed68716..8367e9f245454fcbd50588e118602532dfeb6e2e 100644 --- a/source/Lib/CommonLib/NNFilterSet0.h +++ b/source/Lib/CommonLib/NNFilterSet0.h @@ -58,7 +58,7 @@ class NNFilterSet0 public: NNFilterSet0(); virtual ~NNFilterSet0(); - void create(const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], std::string path); + void create(const int picWidth, const int picHeight, const ChromaFormat format, const int maxCUWidth, const int maxCUHeight, std::string path); void destroy(); void PreCNNLFProcess(Picture* pic, CodingStructure& cs, CnnlfSliceParam& cnnlfSliceParam); void CNNLFProcess(CodingStructure& cs, CnnlfSliceParam& cnnlfSliceParam); @@ -76,12 +76,10 @@ protected: PelStorage m_wtScaleAdjBuf; #endif - int m_inputBitDepth[MAX_NUM_CHANNEL_TYPE]; int m_picWidth; int m_picHeight; int m_maxCUWidth; int m_maxCUHeight; - int m_maxCUDepth; int m_numCTUsInWidth; int m_numCTUsInHeight; int m_numCTUsInPic; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 8c90cbcbb09771ced1e8ceee51b486a16bbfdea2..81c8c8ab1f6689c9125dfbd08225894680a4e4f0 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1769,8 +1769,7 @@ void DecLib::xActivateParameterSets( const InputNALUnit nalu ) #if NN_FILTERING_SET_0 if (sps->getNnlfSet0EnabledFlag()) { - const int maxDepth = floorLog2(sps->getMaxCUWidth()) - sps->getLog2MinCodingBlockSize(); - m_cCNNLF.create(pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), maxDepth, sps->getBitDepths().recon, getModelPath()); + m_cCNNLF.create(pps->getPicWidthInLumaSamples(), pps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), getModelPath()); } #endif diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 0fb54dd8436770ff297cc86fdf093818dd2e1353..41edbe15234e8c09a4f4effd2475f3529ad8c1e1 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -3058,6 +3058,14 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, } } +#if NN_FILTERING_SET_0 + // create filter #0 object based on the picture size + if (pcSlice->getSPS()->getNnlfSet0EnabledFlag()) + { + m_pcCNNLF->create(picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, m_pcCfg->getModelPath()); + } +#endif + // create SAO object based on the picture size if( pcSlice->getSPS()->getSAOEnabledFlag() ) { diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 8cca88ca79f083fa85e0e7deb3b0b188d6aa0e90..edd4984f3dbbe8a8acad81bb221205328b44e39f 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -135,13 +135,6 @@ void EncLib::create( const int layerId ) m_cLoopFilter.initEncPicYuvBuffer(m_chromaFormatIDC, Size(getSourceWidth(), getSourceHeight()), getMaxCUWidth()); } -#if NN_FILTERING_SET_0 - if (m_nnlfSet0) - { - m_cEncCNNLF.create(getSourceWidth(), getSourceHeight(), m_chromaFormatIDC, m_maxCUWidth, m_maxCUHeight, floorLog2(m_maxCUWidth) - MIN_CU_LOG2, m_bitDepth, m_inputBitDepth, getModelPath()); - } -#endif - #if ENABLE_SPLIT_PARALLELISM m_cReshaper = new EncReshape[m_numCuEncStacks]; #endif diff --git a/source/Lib/EncoderLib/EncNNFilterSet0.cpp b/source/Lib/EncoderLib/EncNNFilterSet0.cpp index f503337819bab7459f5be273a3600eaf3356616b..e8c21a09c2a0ff41599ce1f6ebd27cb10685e8f7 100644 --- a/source/Lib/EncoderLib/EncNNFilterSet0.cpp +++ b/source/Lib/EncoderLib/EncNNFilterSet0.cpp @@ -47,11 +47,16 @@ EncNNFilterSet0::EncNNFilterSet0() { } -void EncNNFilterSet0::create(const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], const int internalBitDepth[MAX_NUM_CHANNEL_TYPE], std::string path) +void EncNNFilterSet0::create(const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, std::string path) { - NNFilterSet0::create(picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, maxCUDepth, inputBitDepth, path); + NNFilterSet0::create(picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, path); for (int compIdx = 0; compIdx < MAX_NUM_COMPONENT; compIdx++) { + if (m_ctuEnableFlagTmp[compIdx]) + { + delete[] m_ctuEnableFlagTmp[compIdx]; + m_ctuEnableFlagTmp[compIdx] = nullptr; + } m_ctuEnableFlagTmp[compIdx] = new uint8_t[m_numCTUsInPic]; } } diff --git a/source/Lib/EncoderLib/EncNNFilterSet0.h b/source/Lib/EncoderLib/EncNNFilterSet0.h index ae8f96c92cddd18470add44fdcb37301bad6a177..11a4cf03a42552bb4c053138b18f18fb28af26a4 100644 --- a/source/Lib/EncoderLib/EncNNFilterSet0.h +++ b/source/Lib/EncoderLib/EncNNFilterSet0.h @@ -60,7 +60,7 @@ public: void PreCNNLFProcess(Picture* pic, CodingStructure& cs); void CNNLFProcess( CodingStructure& cs, const double *lambdas, CnnlfSliceParam& cnnlfSliceParam ); void initCABACEstimator( CABACEncoder* cabacEncoder, CtxCache* ctxCache, Slice* pcSlice ); - void create( const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, const int maxCUDepth, const int inputBitDepth[MAX_NUM_CHANNEL_TYPE], const int internalBitDepth[MAX_NUM_CHANNEL_TYPE], std::string path); + void create( const int picWidth, const int picHeight, const ChromaFormat chromaFormatIDC, const int maxCUWidth, const int maxCUHeight, std::string path); void destroy(); private: