From f502dc46b89bfefcf2caf3346d297b11db1d08f3 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Date: Mon, 6 Mar 2023 19:43:28 +0100 Subject: [PATCH] =?UTF-8?q?Commit=20n=C2=BA=203=20(06-03-2023)=20---------?= =?UTF-8?q?---------------------------------------------------=20Continuac?= =?UTF-8?q?i=C3=B3n=20del=20m=C3=A9todo=20copia=20de=20EncCu=20para=20EncS?= =?UTF-8?q?lice.cpp.=20Se=20han=20copiado=20todos=20los=20atributos=20usan?= =?UTF-8?q?do=20constructores=20ya=20implementados=20en=20cada=20clase.=20?= =?UTF-8?q?------------------------------------------------------------=20?= =?UTF-8?q?Queda=20comprobar=20el=20funcionamiento=20de=20sus=20constructo?= =?UTF-8?q?res=20para=20evitar=20que=20los=20objetos=20internos=20comparta?= =?UTF-8?q?n=20referencias=20en=20memoria.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Lib/EncoderLib/EncCu.cpp | 95 ++++++++++++++++++++++++++++-- source/Lib/EncoderLib/EncCu.h | 12 ++-- source/Lib/EncoderLib/EncSlice.cpp | 3 +- 3 files changed, 99 insertions(+), 11 deletions(-) diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 82baa81..d992a46 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -6103,20 +6103,107 @@ EncCu EncCu::copy(EncCu& original) copy.m_ctxBuffer = m_ctxBufferCopy; if (original.m_CurrCtx != NULL) /*Puede ser nulo*/ { - CtxPair m_CurrCtxCopy(*original.m_CurrCtx); - copy.m_CurrCtx = &m_CurrCtxCopy; + CtxPair* m_CurrCtxCopy = new CtxPair(*original.m_CurrCtx); + copy.m_CurrCtx = m_CurrCtxCopy; } else { copy.m_CurrCtx = NULL; } - CtxPool m_ctxPoolCopy(*original.m_ctxPool); - copy.m_ctxPool = &m_ctxPoolCopy; + CtxPool* m_ctxPoolCopy = new CtxPool(*original.m_ctxPool); + copy.m_ctxPool = m_ctxPoolCopy; copy.m_cuChromaQpOffsetIdxPlus1 = original.m_cuChromaQpOffsetIdxPlus1; XuPool m_unitPoolCopy(original.m_unitPool); copy.m_unitPool = m_unitPoolCopy; + PelUnitBufPool m_pelUnitBufPoolCopy(original.m_pelUnitBufPool); + copy.m_pelUnitBufPool = m_pelUnitBufPoolCopy; + + + CodingStructure*** m_pTempCSCopy = new CodingStructure**; + *m_pTempCSCopy = new CodingStructure*; + **m_pTempCSCopy = **original.m_pTempCS; // Copia los datos del objeto apuntado por m_pTempCS en la nueva variable + copy.m_pTempCS = m_pTempCSCopy; + + CodingStructure*** m_pBestCSCopy = new CodingStructure**; + *m_pBestCSCopy = new CodingStructure*; + **m_pBestCSCopy = **original.m_pBestCS; // Copia los datos del objeto apuntado por m_pBestCS en la nueva variable + copy.m_pBestCS = m_pBestCSCopy; + + CodingStructure*** m_pTempCS2Copy = new CodingStructure**; + *m_pTempCS2Copy = new CodingStructure*; + **m_pTempCS2Copy = **original.m_pTempCS2; // Copia los datos del objeto apuntado por m_pTempCS2 en la nueva variable + copy.m_pTempCS2 = m_pTempCS2Copy; + + CodingStructure*** m_pBestCS2Copy = new CodingStructure**; + *m_pBestCS2Copy = new CodingStructure*; + **m_pBestCS2Copy = **original.m_pBestCS2; // Copia los datos del objeto apuntado por m_pBestCS2 en la nueva variable + copy.m_pBestCS2 = m_pBestCS2Copy; + + EncCfg* m_pcEncCfgCopy = new EncCfg(*original.m_pcEncCfg); + copy.m_pcEncCfg = m_pcEncCfgCopy; + + IntraSearch* m_pcIntraSearchCopy = new IntraSearch(*original.m_pcIntraSearch); + copy.m_pcIntraSearch = m_pcIntraSearchCopy; + + InterSearch* m_pcInterSearchCopy = new InterSearch(*original.m_pcInterSearch); + copy.m_pcInterSearch = m_pcInterSearchCopy; + + TrQuant* m_pcTrQuantCopy = new TrQuant(*original.m_pcTrQuant); + copy.m_pcTrQuant = m_pcTrQuantCopy; + + RdCost* m_pcRdCostCopy = new RdCost(*original.m_pcRdCost); + copy.m_pcRdCost = m_pcRdCostCopy; + + EncSlice* m_pcSliceEncoderCopy = new EncSlice(*original.m_pcSliceEncoder); + copy.m_pcSliceEncoder = m_pcSliceEncoderCopy; + + DeblockingFilter* m_deblockingFilterCopy = new DeblockingFilter(*original.m_deblockingFilter); + copy.m_deblockingFilter = m_deblockingFilterCopy; + + CABACWriter* m_CABACEstimatorCopy = new CABACWriter(*original.m_CABACEstimator); + copy.m_CABACEstimator = m_CABACEstimatorCopy; + + RateCtrl* m_pcRateCtrlCopy = new RateCtrl(*original.m_pcRateCtrl); + copy.m_pcRateCtrl = m_pcRateCtrlCopy; + + IbcHashMap* m_ibcHashMapCopy = new IbcHashMap(original.m_ibcHashMap); + copy.m_ibcHashMap = *m_ibcHashMapCopy; + + EncModeCtrlMTnoRQT* m_modeCtrlDerived = dynamic_cast(original.m_modeCtrl); //Downcasting + EncModeCtrl* m_modeCtrlCopy = new EncModeCtrlMTnoRQT(*m_modeCtrlDerived); //Upcasting + copy.m_modeCtrl = m_modeCtrlCopy; + + FastGeoCostList* m_geoCostListCopy = new FastGeoCostList(original.m_geoCostList); + copy.m_geoCostList = *m_geoCostListCopy; + + copy.m_AFFBestSATDCost = original.m_AFFBestSATDCost; + copy.m_mergeBestSATDCost = original.m_mergeBestSATDCost; + + for (int i = 0; i < (MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1); i++) + { + copy.m_SubPuMiBuf[i] = *new MotionInfo(original.m_SubPuMiBuf[i]); //obtenemos el original, creamos nuevo y asignamos contenido al array copia + } + + copy.m_ctuIbcSearchRangeX = original.m_ctuIbcSearchRangeX; + copy.m_ctuIbcSearchRangeY = original.m_ctuIbcSearchRangeY; + + copy.m_bestBcwIdx = original.m_bestBcwIdx; + copy.m_bestBcwCost = original.m_bestBcwCost; + + + //static const MergeIdxPair m_geoModeTest[GEO_MAX_NUM_CANDS]; + for (int i = 0; i < 2; i++) { + copy.m_sbtCostSave[i] = original.m_sbtCostSave[i]; + } + + GeoComboCostList* m_comboListCopy = new GeoComboCostList(original.m_comboList); + copy.m_comboList = *m_comboListCopy; + + MergeItemList* m_mergeItemListCopy = new MergeItemList(original.m_mergeItemList); + copy.m_mergeItemList = *m_mergeItemListCopy; + //@TODO return copy; diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index 189e757..b605b02 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -233,17 +233,17 @@ public: Ctx best; }; - std::vector m_ctxBuffer; //copy checked - CtxPair* m_CurrCtx; //copy not checked because null - CtxPool *m_ctxPool; //copy checked + std::vector m_ctxBuffer; //copy + CtxPair* m_CurrCtx; //copy + CtxPool *m_ctxPool; //copy // Data : encoder control int m_cuChromaQpOffsetIdxPlus1; // if 0, then cu_chroma_qp_offset_flag will be 0, otherwise cu_chroma_qp_offset_flag will be 1. copy checked - XuPool m_unitPool; //copy not - PelUnitBufPool m_pelUnitBufPool; + XuPool m_unitPool; //copy + PelUnitBufPool m_pelUnitBufPool;//copy - CodingStructure ***m_pTempCS; + CodingStructure ***m_pTempCS; //copy CodingStructure ***m_pBestCS; CodingStructure ***m_pTempCS2; CodingStructure ***m_pBestCS2; diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index 5a00bf3..7a6aa8a 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -1895,10 +1895,11 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons { //ALBERTO EncCu m_pcCuEncoder_copy = m_pcCuEncoder->copy(*m_pcCuEncoder); + bool stopDebugger1 = true; //END ALBERTO m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP); - bool stopDebugger = true; + bool stopDebugger2 = true; #if GREEN_METADATA_SEI_ENABLED FeatureCounterStruct m_featureCounter = pcPic->getFeatureCounter(); countFeatures(m_featureCounter, cs,ctuArea); -- 2.24.1