diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index 48217367a254f9a64f60ac36879c5d4449bdf92e..28526953686c90a01383bfbe26312e8bb910ce6c 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -124,7 +124,7 @@ struct AreaBuf : public Size //ALBERTO AreaBuf(const AreaBuf& other) : Size(other.width, other.height), stride(other.stride), buf(other.buf) { - //////////////////////buf = new T(*other.buf) + //buf = new T(*other.buf); } //END ALBERTO AreaBuf() : Size(), buf(nullptr), stride(0) {} @@ -1106,6 +1106,18 @@ private: public: PelUnitBufPool(); + + //ALBERTO + PelUnitBufPool(const PelUnitBufPool& other) + : m_pelStoragePool(other.m_pelStoragePool) + , m_pelUnitBufPool(other.m_pelUnitBufPool) + , m_map(other.m_map) + , m_chromaFormat(other.m_chromaFormat) + , m_ctuArea(other.m_ctuArea) + { + + } + //END ALBERTO ~PelUnitBufPool(); void initPelUnitBufPool(ChromaFormat chromaFormat, int ctuWidth, int ctuHeight); diff --git a/source/Lib/DecoderLib/DecCu.h b/source/Lib/DecoderLib/DecCu.h index 66084edea12680edd40365f6331cf11153aa3187..5dffbd8aa202f6a352d9d7579f79153e8ddf382c 100644 --- a/source/Lib/DecoderLib/DecCu.h +++ b/source/Lib/DecoderLib/DecCu.h @@ -79,11 +79,11 @@ public: virtual ~DecCu(); //ALBERTO - void setAtributtes(TrQuant* other_m_pcTrQuant, EncModeCtrl* other_m_modeCtrl) + void setAtributtes(TrQuant* m_pcTrQuant, IntraPrediction* m_pcIntraPred, InterPrediction* m_pcInterPred) { - m_pcTrQuant = other_m_pcTrQuant; - (dynamic_cast(m_pcIntraPred))->setAtributtes(other_m_modeCtrl); - (dynamic_cast(m_pcInterPred))->setAtributtes(other_m_modeCtrl); + this->m_pcTrQuant = m_pcTrQuant; + this->m_pcIntraPred = m_pcIntraPred; + this->m_pcInterPred = m_pcInterPred; } //END ALBERTO diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h index 291f3fe8501b056d0e40bcbc894c6ad600270107..a42da769c0a286a12d91b264d6298256ae42d688 100644 --- a/source/Lib/EncoderLib/CABACWriter.h +++ b/source/Lib/EncoderLib/CABACWriter.h @@ -56,6 +56,7 @@ public: m_testCtx = m_binEncoder.getCtx(); m_encCu = nullptr; } + virtual ~CABACWriter() {} public: diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 457fc0db9b63dbd436b7cb8cc1db3c0bd685e0c0..a174123b2a28ac70037950063857548c12800c02 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -75,26 +75,42 @@ EncCu::EncCu() {} // ALBERTO EncCu::EncCu(const EncCu& other, EncSlice* encSlice) : DecCu(other) - ,m_modeCtrl(new EncModeCtrlMTnoRQT(*(dynamic_cast(other.m_modeCtrl)))) + /// m_pc , m_pcTrQuant(other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) : nullptr) + , m_pcEncCfg(other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr) + , m_pcRdCost(other.m_pcRdCost ? new RdCost(*other.m_pcRdCost) : nullptr) //<- Realizar constructor de copia + , m_pcSliceEncoder(encSlice) + , m_pcRateCtrl(other.m_pcRateCtrl ? new RateCtrl(*other.m_pcRateCtrl) : nullptr) + , m_pcIntraSearch(other.m_pcIntraSearch ? new IntraSearch(*other.m_pcIntraSearch, this->m_modeCtrl) : nullptr) + , m_pcInterSearch(other.m_pcInterSearch ? new InterSearch(*other.m_pcInterSearch, this->m_modeCtrl) : nullptr) + /// m_modeCtrl + , m_modeCtrl(new EncModeCtrlMTnoRQT(*(dynamic_cast(other.m_modeCtrl)))) + //Resto , 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 + , m_CurrCtx(other.m_CurrCtx ? new CtxPair(*other.m_CurrCtx) : nullptr) + , m_ctxPool(other.m_ctxPool ? new CtxPool(*other.m_ctxPool) : nullptr) + , m_bestModeUpdated(other.m_bestModeUpdated) + , m_ctxBuffer(other.m_ctxBuffer) + , m_cuChromaQpOffsetIdxPlus1(other.m_cuChromaQpOffsetIdxPlus1) + , m_deblockingFilter(other.m_deblockingFilter ? new DeblockingFilter(*other.m_deblockingFilter) : nullptr) + , m_CABACEstimator(other.m_CABACEstimator ? new CABACWriter(*other.m_CABACEstimator) : nullptr) + , m_AFFBestSATDCost(other.m_AFFBestSATDCost) + , m_mergeBestSATDCost(other.m_mergeBestSATDCost) + , m_ctuIbcSearchRangeX(other.m_ctuIbcSearchRangeX) + , m_ctuIbcSearchRangeY(other.m_ctuIbcSearchRangeY) #if JVET_AC0139_UNIFIED_MERGE ,m_mergeItemList(m_mergeItemList) ///////////CONTINUAR//////////// #endif { - m_bestModeUpdated = other.m_bestModeUpdated; - m_ctxBuffer = other.m_ctxBuffer; - 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; - - DecCu::setAtributtes(m_pcTrQuant, m_modeCtrl); + DecCu::setAtributtes(this->m_pcTrQuant,this->m_pcIntraSearch,this->m_pcInterSearch); + m_pcIntraSearch->setAtributtes(this->m_modeCtrl, this->m_pcTrQuant, this->m_pcEncCfg, this->m_pcRdCost, DecCu::m_pcReshape, this->m_CABACEstimator);//, this->m_pTempCS, this->m_pBestCS); + m_pcInterSearch->setAtributtes(this->m_modeCtrl, this->m_pcTrQuant, this->m_pcEncCfg, this->m_pcRdCost, DecCu::m_pcReshape, this->m_CABACEstimator); + m_modeCtrl->setAtributtes(this->m_pcEncCfg, this->m_pcRateCtrl, this->m_pcRdCost, this->m_pcInterSearch, this->m_pcEncCfg->getAdaptQPmap()); ChromaFormat chromaFormat = other.m_pcEncCfg->getChromaFormatIdc(); unsigned numWidths = gp_sizeIdxInfo->numWidths(); @@ -141,28 +157,9 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice) } } } + //m_pTempCS = other.m_pTempCS; + //m_pBestCS = other.m_pBestCS; - m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : 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 && other.m_modeCtrl ? new InterSearch(*other.m_pcInterSearch,other.m_modeCtrl) : nullptr; - - //m_pcTrQuant = other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) : nullptr; - - m_pcRdCost = other.m_pcRdCost ? new RdCost(*other.m_pcRdCost) : nullptr; - - m_pcSliceEncoder = other.m_pcSliceEncoder ? new EncSlice(*other.m_pcSliceEncoder) : nullptr; - - m_deblockingFilter = other.m_deblockingFilter ? new DeblockingFilter(*other.m_deblockingFilter) : nullptr; - - m_CABACEstimator = other.m_CABACEstimator ? new CABACWriter(*other.m_CABACEstimator) : nullptr; - - m_pcRateCtrl = other.m_pcRateCtrl ? new RateCtrl(*other.m_pcRateCtrl) : nullptr; - - #if !JVET_AC0139_UNIFIED_MERGE std::array m_geoWeightedBuffers; // weighted prediction pixels for (int i = 0; i < m_geoWeightedBuffers.size(); i++) @@ -171,18 +168,10 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice) } #endif - - m_AFFBestSATDCost = other.m_AFFBestSATDCost; - m_mergeBestSATDCost = m_mergeBestSATDCost; - for (int i = 0; i< (MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1) ;i++) { m_SubPuMiBuf[i] = MotionInfo(other.m_SubPuMiBuf[i]); } - - m_ctuIbcSearchRangeX = other.m_ctuIbcSearchRangeX; - m_ctuIbcSearchRangeY = other.m_ctuIbcSearchRangeY; - for (int i = 0; i < m_bestBcwIdx.size(); i++) { m_bestBcwIdx[i] = other.m_bestBcwIdx[i]; @@ -191,14 +180,11 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice) { m_bestBcwCost[i] = other.m_bestBcwCost[i]; } - for (int i = 0; i < 2; i++) { m_sbtCostSave[i] = other.m_sbtCostSave[i]; } - ///////////CONTINUAR//////////// - } // END ALBERTO void EncCu::create( EncCfg* encCfg ) @@ -1193,7 +1179,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par auto duration = std::chrono::duration_cast(end - start); auto before = seconds; seconds += static_cast(duration.count() / 1000); - std::cout << "La iter " << iter << " de la func tarda " << static_cast(duration.count() / 1000) << " + " << before << " = " << seconds << " segundos en ejecutarse." << std::endl; + std::cout << "La func xCompressCU realiza " << iter << " iter que tardan " << static_cast(duration.count() / 1000) << " + " << before << " = " << seconds << " segundos en ejecutarse." << std::endl; iter = 0; } //END ALBERTO diff --git a/source/Lib/EncoderLib/EncModeCtrl.h b/source/Lib/EncoderLib/EncModeCtrl.h index a804036a328fa64dcead09f38164721efc5bea9b..009844eabc75d78c48c5484c5f2a93ab3ce70825 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.h +++ b/source/Lib/EncoderLib/EncModeCtrl.h @@ -353,6 +353,17 @@ public: return m_pcEncCfg; } //END ALBERTO + + //ALBERTO + void setAtributtes(const EncCfg* m_pcEncCfg, const class RateCtrl* m_pcRateCtrl, RdCost* m_pcRdCost, InterSearch* m_pcInterSearch, std::map* m_adaptQPmap) + { + this->m_pcEncCfg = m_pcEncCfg; + this->m_pcRateCtrl = m_pcRateCtrl; + this->m_pcRdCost = m_pcRdCost; + this->m_pcInterSearch = m_pcInterSearch; + this->m_bimQPMap = m_adaptQPmap; + } + //END ALBERTO virtual void create ( const EncCfg& cfg ) = 0; virtual void destroy () = 0; virtual void initCTUEncoding ( const Slice &slice ) = 0; diff --git a/source/Lib/EncoderLib/EncSlice.h b/source/Lib/EncoderLib/EncSlice.h index 1916423bf63aaf5e744d7ae119a7d05c35aa3e97..d7b56b691d5fa83779ac5296dac4e92f7d6ebad4 100644 --- a/source/Lib/EncoderLib/EncSlice.h +++ b/source/Lib/EncoderLib/EncSlice.h @@ -128,6 +128,13 @@ public: void resetQP ( Picture* pic, int sliceQP, double lambda ); + //ALBERTO + void setAtributtes(TrQuant* m_pcTrQuant) + { + this->m_pcTrQuant = m_pcTrQuant; + } + //END ALBERTO + // compress and encode slice void precompressSlice ( Picture* pcPic ); ///< precompress slice for multi-loop slice-level QP opt. void compressSlice ( Picture* pcPic, const bool bCompressEntireSlice, const bool bFastDeltaQP ); ///< analysis stage of slice diff --git a/source/Lib/EncoderLib/InterSearch.h b/source/Lib/EncoderLib/InterSearch.h index 5209d887a1bd3076b7434520bbecea340ceb46fd..9b863a54e7488847adcb5119b1fad8bdd988ab69 100644 --- a/source/Lib/EncoderLib/InterSearch.h +++ b/source/Lib/EncoderLib/InterSearch.h @@ -201,8 +201,14 @@ public: //ALBERTO - void setAtributtes(EncModeCtrl* other_m_modeCtrl) - { m_modeCtrl = other_m_modeCtrl; + void setAtributtes(EncModeCtrl* m_modeCtrl, TrQuant* m_pcTrQuant, EncCfg* m_pcEncCfg, RdCost* m_pcRdCost, Reshape *m_pcReshape, CABACWriter* m_CABACEstimator) + { + this->m_modeCtrl = m_modeCtrl; + this->m_pcTrQuant = m_pcTrQuant; + this->m_pcEncCfg = m_pcEncCfg; + this->m_pcRdCost = m_pcRdCost; + this->m_pcReshape = static_cast(m_pcReshape); + this->m_CABACEstimator = m_CABACEstimator; } //END ALBERTO void init(EncCfg *pcEncCfg, TrQuant *pcTrQuant, int searchRange, int bipredSearchRange, diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index 444e69a814b4a52854c363dd7b0e33a1112f2de8..6151cd31fa627adba112d0666f1a639f1cad4030 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -573,10 +573,10 @@ public: m_orgTUs[i] = other.m_orgTUs[i] ? new TransformUnit(*other.m_orgTUs[i]) : nullptr; } - m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr; + /* m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr; m_pcTrQuant = other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) :nullptr; m_pcRdCost = other.m_pcRdCost ? new RdCost(*other.m_pcRdCost) : nullptr; - m_pcReshape = other.m_pcReshape ? new EncReshape(*other.m_pcReshape) : nullptr; + m_pcReshape = other.m_pcReshape ? new EncReshape(*other.m_pcReshape) : nullptr;*/ m_CABACEstimator = other.m_CABACEstimator ? new CABACWriter(*other.m_CABACEstimator) : nullptr; m_ctxPool = other.m_ctxPool ? new CtxPool(*other.m_ctxPool) : nullptr; m_isInitialized = other.m_isInitialized; @@ -613,9 +613,16 @@ public: ~IntraSearch(); //ALBERTO - void setAtributtes(EncModeCtrl* other_m_modeCtrl) + void setAtributtes(EncModeCtrl* m_modeCtrl, TrQuant* m_pcTrQuant, EncCfg* m_pcEncCfg, RdCost* m_pcRdCost, Reshape* m_pcReshape, CABACWriter* m_CABACEstimator)//, CodingStructure*** m_pTempCS, CodingStructure*** m_pBestCS) { - m_modeCtrl = other_m_modeCtrl; + this->m_modeCtrl = m_modeCtrl; + this->m_pcTrQuant = m_pcTrQuant; + this->m_pcEncCfg = m_pcEncCfg; + this->m_pcRdCost = m_pcRdCost; + this->m_pcReshape = static_cast(m_pcReshape); + this->m_CABACEstimator = m_CABACEstimator; + /* this->m_pTempCS = m_pTempCS; + this->m_pBestCS = m_pBestCS;*/ } //END ALBERTO