From 21940d837f78f006ee64dc9976fe22ac3126b4d5 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Date: Wed, 15 Mar 2023 19:58:26 +0100 Subject: [PATCH] =?UTF-8?q?Commit=204=20```-------------------------------?= =?UTF-8?q?------------------------------=20EncSlice=20se=20ha=20llamado?= =?UTF-8?q?=20al=20constructor=20de=20EncCu=20para=20crear=20un=20nuevo=20?= =?UTF-8?q?objeto=20antes=20y=20despu=C3=A9s=20de=20llamar=20a=20compressC?= =?UTF-8?q?tu=20(l=C3=ADneas=201897-1903)=20```?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------------------------------------------------------------- Secundariamente: - Añadido atributo InstraSearch - Definido constructor de copia de ModeInfo - Definido constructor de copia de ISPTestedModeInfo - Definido constructor de copia de EncModeCtrlMTnoRQT - Definido constructor de copia de IntraSearch - Continuar definición constructor de copia de InterSearch ------------------------------------------------------------ CONTINUAR CON ATRIBUTOS DE EncCU en la línea marcada con el comentario ///////////CONTINUAR//////////// REVISAR CONSTRUCTOR DE INTRASEARCH PARA ASEGURAR EXCLUSIÓN ENTRE LOS ATRIBUTOS --------------------------------------------------------------- Hasta este punto el encoder funciona con una media de 115 segundos por cada ejecucción --------------------------------------------------------------- IMPORTANTE: IntraSearch/InterSearch hace uso del mismo atributo EncModeCtrl (Se ha comprobado que la dirección en el objeto original y los atributos es la misma). Para ello se han creado nuevos constructores de copia que reciben como argumento ese puntero también. --- source/Lib/EncoderLib/EncCu.cpp | 13 ++++---- source/Lib/EncoderLib/InterSearch.cpp | 43 ++------------------------- source/Lib/EncoderLib/InterSearch.h | 2 +- source/Lib/EncoderLib/IntraSearch.h | 5 ++-- 4 files changed, 12 insertions(+), 51 deletions(-) diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 5a182b2..32aabb0 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -69,7 +69,8 @@ const MergeIdxPair EncCu::m_geoModeTest[GEO_MAX_NUM_CANDS] = { EncCu::EncCu() {} // ALBERTO -EncCu::EncCu(const EncCu& other) : DecCu(other), m_ibcHashMap(other.m_ibcHashMap), m_geoCostList(other.m_geoCostList), m_comboList(other.m_comboList) +EncCu::EncCu(const EncCu& other) : DecCu(other), m_unitPool(other.m_unitPool), m_pelUnitBufPool(other.m_pelUnitBufPool), m_ibcHashMap(other.m_ibcHashMap), m_geoCostList(other.m_geoCostList), m_comboList(other.m_comboList) +//ATENCION : M_MODE_CRTL SE CREA MUCHAS VECES, PERO EN EL OBJETO ORIGINAL SE CREA UNA VEZ Y SE COMPARTE LA DIRECCIÓN #if JVET_AC0139_UNIFIED_MERGE ,m_mergeItemList(m_mergeItemList) ///////////CONTINUAR//////////// @@ -80,8 +81,6 @@ EncCu::EncCu(const EncCu& other) : DecCu(other), m_ibcHashMap(other.m_ibcHashMap m_CurrCtx = other.m_CurrCtx ? new CtxPair(*other.m_CurrCtx) : nullptr; m_ctxPool = other.m_ctxPool ? new CtxPool(*other.m_ctxPool) : nullptr; m_cuChromaQpOffsetIdxPlus1 = other.m_cuChromaQpOffsetIdxPlus1; - m_unitPool = XuPool(other.m_unitPool); - m_pelUnitBufPool = PelUnitBufPool(other.m_pelUnitBufPool); m_pTempCS = new CodingStructure**(*other.m_pTempCS); *m_pTempCS = new CodingStructure*(); @@ -101,9 +100,11 @@ EncCu::EncCu(const EncCu& other) : DecCu(other), m_ibcHashMap(other.m_ibcHashMap m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr; - m_pcIntraSearch = other.m_pcIntraSearch ? new IntraSearch(*other.m_pcIntraSearch) : nullptr; + m_modeCtrl = other.m_modeCtrl ? new EncModeCtrlMTnoRQT(*(dynamic_cast(other.m_modeCtrl))) : nullptr; //REVISAR M_MODE_CTRL COMPLETO ANTES DE CONTINUAR///////////////////////////////////////////////////////////////// + + m_pcIntraSearch = other.m_pcIntraSearch && other.m_modeCtrl ? new IntraSearch(*other.m_pcIntraSearch,other.m_modeCtrl) : nullptr; - m_pcInterSearch = other.m_pcInterSearch ? new InterSearch(*other.m_pcInterSearch) : nullptr; + m_pcInterSearch = other.m_pcInterSearch && other.m_modeCtrl ? new InterSearch(*other.m_pcInterSearch,other.m_modeCtrl) : nullptr; m_pcTrQuant = other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) : nullptr; @@ -117,7 +118,7 @@ EncCu::EncCu(const EncCu& other) : DecCu(other), m_ibcHashMap(other.m_ibcHashMap m_pcRateCtrl = other.m_pcRateCtrl ? new RateCtrl(*other.m_pcRateCtrl) : nullptr; - m_modeCtrl = other.m_modeCtrl ? new EncModeCtrlMTnoRQT(*(dynamic_cast(other.m_modeCtrl))) : nullptr; //REVISAR M_MODE_CTRL COMPLETO ANTES DE CONTINUAR///////////////////////////////////////////////////////////////// + #if !JVET_AC0139_UNIFIED_MERGE std::array m_geoWeightedBuffers; // weighted prediction pixels for (int i = 0; i < m_geoWeightedBuffers.size(); i++) diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 2a8268d..cd10aa3 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -120,48 +120,9 @@ InterSearch::InterSearch() m_histBestMtsIdx = MtsType::NONE; } -InterSearch::InterSearch(const InterSearch& other) : InterPrediction(other), AffineGradientSearch(other) +InterSearch::InterSearch(const InterSearch& other, EncModeCtrl* otherModeCtrl) : InterPrediction(other), AffineGradientSearch(other) { - if (other.m_modeCtrl && other.m_modeCtrl->getEncCfg()) - { - m_modeCtrl = new EncModeCtrlMTnoRQT(); - m_modeCtrl->create(*other.m_modeCtrl->getEncCfg()); - /*EncModeCtrl(const EncModeCtrl& other) - { - m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr; - m_pcRateCtrl = other.m_pcRateCtrl ? new class RateCtrl(*other.m_pcRateCtrl) : nullptr; - m_pcRdCost = other.m_pcRdCost ? new RdCost(*other.m_pcRdCost) : nullptr; - m_slice = other.m_slice ? new Slice(*other.m_slice) : nullptr; - - for (int i = 0; i < LUMA_LEVEL_TO_DQP_LUT_MAXSIZE; i++) - { - m_lumaLevelToDeltaQPLUT[i] = other.m_lumaLevelToDeltaQPLUT[i]; - } - - m_lumaQPOffset = other.m_lumaQPOffset; - - m_bimQPMap = new std::map; - *m_bimQPMap = *other.m_bimQPMap; - for (auto& pair: *m_bimQPMap) - { - int* value = pair.second; - int* copy = new int(*value); - pair.second = copy; - } - - m_fastDeltaQP = other.m_fastDeltaQP; - m_ComprCUCtxList = other.m_ComprCUCtxList; - m_pcInterSearch = other.m_pcInterSearch ? new InterSearch(*other.m_pcInterSearch) : nullptr; - m_doPlt = other.m_doPlt; - }*/ - - } - else - { - m_modeCtrl = nullptr; - } - //? new EncModeCtrlMTnoRQT(*static_cast(other.m_modeCtrl)) : nullptr; // CONTINUAR///////////////////////////////////////////////////////////////// - + m_modeCtrl = otherModeCtrl;// CONTINUAR///////////////////////////////////////////////////////////////// for (int i = 0; i < NUM_REF_PIC_LIST_01; i++) { m_tmpPredStorage[i].createFromBuf(other.m_tmpPredStorage[i]); diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index feb6e0b..4460870 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -195,7 +195,7 @@ protected: public: InterSearch(); //ALBERTO - InterSearch(const InterSearch& other); + InterSearch(const InterSearch& other, EncModeCtrl* otherModeCtrl); //END ALBERTO virtual ~InterSearch(); diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index a603844..f786eeb 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -416,10 +416,9 @@ protected: double m_stateCostRDOQ [2][NUM_TRELLIS_STATE]; public: //ALBERTO - IntraSearch(const IntraSearch& other) : IntraPrediction(other) + IntraSearch(const IntraSearch& other, EncModeCtrl* otherModeCtrl) : IntraPrediction(other) { - EncModeCtrlMTnoRQT* pointer = (dynamic_cast(other.m_modeCtrl)); - m_modeCtrl = other.m_modeCtrl ? new EncModeCtrlMTnoRQT(*pointer) : nullptr; //REVISAR M_MODE_CTRL COMPLETO ANTES DE CONTINUAR///////////////////////////////////////////////////////////////// + m_modeCtrl = otherModeCtrl; // REVISAR M_MODE_CTRL COMPLETO ANTES DE CONTINUAR///////////////////////////////////////////////////////////////// for (int i = 0; i < MAX_NUM_TBLOCKS; i++) { m_pSharedPredTransformSkip[i] = other.m_pSharedPredTransformSkip[i] ? new Pel(*other.m_pSharedPredTransformSkip[i]) : nullptr; -- 2.24.1