From 784e8bedc47f69f0f40b1cf66e0094498079b678 Mon Sep 17 00:00:00 2001
From: Yue Li <yue.li@bytedance.com>
Date: Fri, 29 Jul 2022 20:59:05 -0700
Subject: [PATCH] bugs fix for data dumper

---
 source/Lib/CommonLib/CodingStructure.cpp |  4 +++
 source/Lib/EncoderLib/EncGOP.cpp         | 32 ++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp
index 2f0fc04fa1..d7f0aba8e5 100644
--- a/source/Lib/CommonLib/CodingStructure.cpp
+++ b/source/Lib/CommonLib/CodingStructure.cpp
@@ -1268,6 +1268,10 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C
     if( cpyReco )    getRecoBuf   ( clippedArea ).copyFrom( subRecoBuf );
     if( cpyOrgResi ) getOrgResiBuf( clippedArea ).copyFrom( subStruct.getOrgResiBuf( clippedArea ) );
   }
+#if NNVC_USE_PRED
+  getPredBufCustom                 ( clippedArea ).copyFrom( subStruct.getPredBuf( clippedArea ) );
+  getPredBuf                       ( clippedArea ).copyFrom( subStruct.getPredBuf( clippedArea ) );
+#endif
   if( cpyPred ) picture->getPredBuf( clippedArea ).copyFrom( subPredBuf );
   if( cpyResi ) picture->getResiBuf( clippedArea ).copyFrom( subResiBuf );
   if( cpyReco ) picture->getRecoBuf( clippedArea ).copyFrom( subRecoBuf );
diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp
index 092c2195b4..5ccc0d3602 100644
--- a/source/Lib/EncoderLib/EncGOP.cpp
+++ b/source/Lib/EncoderLib/EncGOP.cpp
@@ -2916,9 +2916,28 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
               const uint32_t height = (yPos + pcv.maxCUHeight > pcv.lumaHeight) ? (pcv.lumaHeight - yPos) : pcv.maxCUHeight;
               const UnitArea area(cs.area.chromaFormat, Area(xPos, yPos, width, height));
               cs.getRecoBuf(area).get(COMPONENT_Y).rspSignal(m_pcReshaper->getInvLUT());
+#if NNVC_USE_PARTITION_AS_CU_AVERAGE
+              pcPic->getCuAverageBuf(area).get(COMPONENT_Y).rspSignal(m_pcReshaper->getInvLUT());
+#endif
+            }
+          }
+        }
+        
+#if NNVC_USE_PRED
+        uint64_t culength=cs.cus.size();
+        for(uint64_t n=0;n<culength;n++)
+        {
+          CodingUnit* cu=cs.cus.at(n);
+          if (cu->slice->getLmcsEnabledFlag())
+          {
+            if (((cu->predMode == MODE_INTRA || cu->predMode == MODE_IBC) && cu->chType != CHANNEL_TYPE_CHROMA) || (cu->predMode == MODE_INTER && m_pcReshaper->getCTUFlag() && cu->firstPU->ciipFlag))
+            {
+              pcPic->getPredBufCustom(cu->block(COMPONENT_Y)).rspSignal(m_pcReshaper->getInvLUT());
             }
           }
         }
+#endif
+        
         m_pcReshaper->setRecReshaped(false);
 
         if(m_pcCfg->getGopBasedTemporalFilterEnabled())
@@ -2986,7 +3005,20 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
           }
         }
       }
+      
+#if NNVC_USE_BS
+      pcPic->getBsMapBuf().fill(0);
+#endif
+      
+#if NNVC_USE_REC_BEFORE_DBF
+      pcPic->getRecBeforeDbfBuf().copyFrom(pcPic->getRecoBuf());
+#endif
+      
       m_pcLoopFilter->loopFilterPic( cs );
+      
+#if NNVC_USE_REC_AFTER_DBF
+      pcPic->getRecAfterDbfBuf().copyFrom(pcPic->getRecoBuf());
+#endif
 
       CS::setRefinedMotionField(cs);
 
-- 
GitLab