From b04928f3056cf53d9dd84b1c9c0be191f31bb7a8 Mon Sep 17 00:00:00 2001
From: Yue Li <yue.li@bytedance.com>
Date: Thu, 23 Feb 2023 11:17:36 -0800
Subject: [PATCH] revert the temporary picture buffers-related operations in
 JVET_AC0196_NNSR to resolve issue #25

---
 source/App/DecoderApp/DecApp.cpp | 9 ---------
 source/App/EncoderApp/EncApp.cpp | 3 ---
 source/Lib/CommonLib/Picture.cpp | 6 ------
 source/Lib/DecoderLib/DecLib.cpp | 2 --
 source/Lib/EncoderLib/EncGOP.cpp | 2 --
 5 files changed, 22 deletions(-)

diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp
index c44cc1b837..a4d7480a95 100644
--- a/source/App/DecoderApp/DecApp.cpp
+++ b/source/App/DecoderApp/DecApp.cpp
@@ -922,9 +922,6 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId )
 #endif
               , m_upscaledOutput, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range
             );
-#if JVET_AC0196_NNSR && NNVC_USE_PRED
-            pcPic->m_bufs[PIC_PREDICTION_CUSTOM].destroy();
-#endif
           }
           else
           {
@@ -937,9 +934,6 @@ void DecApp::xWriteOutput( PicList* pcListPic, uint32_t tId )
                                                          conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ),
                                                          NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
           }
-#if JVET_AC0196_NNSR
-          pcPic->destroyTempBuffers();
-#endif
         }
 #if  NNVC_DUMP_DATA
         if (!m_dumpBasename.empty())
@@ -1220,9 +1214,6 @@ void DecApp::xFlushOutput( PicList* pcListPic, const int layerId )
                                                            conf.getWindowBottomOffset() * SPS::getWinUnitY( chromaFormatIDC ),
                                                            NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
             }
-#if JVET_AC0196_NNSR
-            pcPic->destroyTempBuffers();
-#endif
           }
           // write to file
 #if NNVC_DUMP_DATA
diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp
index 2c5ff29099..09b55af765 100644
--- a/source/App/EncoderApp/EncApp.cpp
+++ b/source/App/EncoderApp/EncApp.cpp
@@ -1570,9 +1570,6 @@ void EncApp::xWriteOutput( int iNumEncoded, std::list<PelUnitBuf*>& recBufList )
           m_cVideoIOYuvReconFile.write( pcPicYuvRec->get( COMPONENT_Y ).width, pcPicYuvRec->get( COMPONENT_Y ).height, *pcPicYuvRec, ipCSC, m_packedYUVMode,
             m_confWinLeft, m_confWinRight, m_confWinTop, m_confWinBottom, NUM_CHROMA_FORMAT, m_bClipOutputVideoToRec709Range );
         }
-#if JVET_AC0196_NNSR
-        tempPic->destroyTempBuffers();
-#endif
       }
     }
   }
diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp
index 2d1b877216..3067e43e17 100644
--- a/source/Lib/CommonLib/Picture.cpp
+++ b/source/Lib/CommonLib/Picture.cpp
@@ -338,12 +338,6 @@ void Picture::destroyTempBuffers()
         M_BUFS( jId, t ).destroy();
       }
 #endif
-#if JVET_AC0196_NNSR && NNVC_USE_PRED
-      if (t == PIC_PREDICTION_CUSTOM )
-      {
-        M_BUFS( jId, t ).destroy();
-      }
-#endif
 #if ENABLE_SPLIT_PARALLELISM
       if (t == PIC_RECONSTRUCTION && jId > 0)
       {
diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp
index 2805f31ce3..8c90cbcbb0 100644
--- a/source/Lib/DecoderLib/DecLib.cpp
+++ b/source/Lib/DecoderLib/DecLib.cpp
@@ -940,9 +940,7 @@ void DecLib::finishPicture(int &poc, PicList *&rpcListPic, MsgLevel msgl, bool a
   m_bFirstSliceInPicture  = true; // TODO: immer true? hier ist irgendwas faul
   m_maxDecSubPicIdx = 0;
   m_maxDecSliceAddrInSubPic = -1;
-#if !JVET_AC0196_NNSR
   m_pcPic->destroyTempBuffers();
-#endif
   m_pcPic->cs->destroyCoeffs();
   m_pcPic->cs->releaseIntermediateData();
   m_pcPic->cs->picHeader->initPicHeader();
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index b5fc311f14..0fb54dd843 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -3911,9 +3911,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
     {
       iGOPid=effFieldIRAPMap.restoreGOPid(iGOPid);
     }
-#if !JVET_AC0196_NNSR
     pcPic->destroyTempBuffers();
-#endif
     pcPic->cs->destroyCoeffs();
     pcPic->cs->releaseIntermediateData();
   } // iGOPid-loop
-- 
GitLab