Commit 6d4315b1 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit 8

- Definido constructor de Area
- Establecido atributo EncSlice de EncCu como un puntero a la clase EncSlice donde se crea ese EncCU

/////////////////////////////////////////////////////
Revisar las creaciones de los punteros de tipo CodingStructure en EncCu e IntraSearch:
- m_pTempCS
- m_pBestCS
- m_pTempCS2
- m_pBestCS2
- m_pfullCS
- m_psaveCS
...
parent aff1e1c4
...@@ -124,7 +124,7 @@ struct AreaBuf : public Size ...@@ -124,7 +124,7 @@ struct AreaBuf : public Size
//ALBERTO //ALBERTO
AreaBuf(const AreaBuf<T>& other) : Size(other.width, other.height), stride(other.stride), buf(other.buf) AreaBuf(const AreaBuf<T>& other) : Size(other.width, other.height), stride(other.stride), buf(other.buf)
{ {
//////////////////////buf = new T(*other.buf) //buf = new T(*other.buf);
} }
//END ALBERTO //END ALBERTO
AreaBuf() : Size(), buf(nullptr), stride(0) {} AreaBuf() : Size(), buf(nullptr), stride(0) {}
...@@ -1106,6 +1106,18 @@ private: ...@@ -1106,6 +1106,18 @@ private:
public: public:
PelUnitBufPool(); 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(); ~PelUnitBufPool();
void initPelUnitBufPool(ChromaFormat chromaFormat, int ctuWidth, int ctuHeight); void initPelUnitBufPool(ChromaFormat chromaFormat, int ctuWidth, int ctuHeight);
......
...@@ -79,11 +79,11 @@ public: ...@@ -79,11 +79,11 @@ public:
virtual ~DecCu(); virtual ~DecCu();
//ALBERTO //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; this->m_pcTrQuant = m_pcTrQuant;
(dynamic_cast<IntraSearch*>(m_pcIntraPred))->setAtributtes(other_m_modeCtrl); this->m_pcIntraPred = m_pcIntraPred;
(dynamic_cast<InterSearch*>(m_pcInterPred))->setAtributtes(other_m_modeCtrl); this->m_pcInterPred = m_pcInterPred;
} }
//END ALBERTO //END ALBERTO
......
...@@ -56,6 +56,7 @@ public: ...@@ -56,6 +56,7 @@ public:
m_testCtx = m_binEncoder.getCtx(); m_testCtx = m_binEncoder.getCtx();
m_encCu = nullptr; m_encCu = nullptr;
} }
virtual ~CABACWriter() {} virtual ~CABACWriter() {}
public: public:
......
...@@ -75,26 +75,42 @@ EncCu::EncCu() {} ...@@ -75,26 +75,42 @@ EncCu::EncCu() {}
// ALBERTO // ALBERTO
EncCu::EncCu(const EncCu& other, EncSlice* encSlice) EncCu::EncCu(const EncCu& other, EncSlice* encSlice)
: DecCu(other) : DecCu(other)
,m_modeCtrl(new EncModeCtrlMTnoRQT(*(dynamic_cast<EncModeCtrlMTnoRQT*>(other.m_modeCtrl)))) /// m_pc
, m_pcTrQuant(other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) : nullptr) , 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<EncModeCtrlMTnoRQT*>(other.m_modeCtrl))))
//Resto
, m_unitPool(other.m_unitPool) , m_unitPool(other.m_unitPool)
, m_pelUnitBufPool(other.m_pelUnitBufPool) , m_pelUnitBufPool(other.m_pelUnitBufPool)
, m_ibcHashMap(other.m_ibcHashMap) , m_ibcHashMap(other.m_ibcHashMap)
, m_geoCostList(other.m_geoCostList) , m_geoCostList(other.m_geoCostList)
, m_comboList(other.m_comboList) , 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 DIRECCIN , 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 #if JVET_AC0139_UNIFIED_MERGE
,m_mergeItemList(m_mergeItemList) ,m_mergeItemList(m_mergeItemList)
///////////CONTINUAR//////////// ///////////CONTINUAR////////////
#endif #endif
{ {
m_bestModeUpdated = other.m_bestModeUpdated; DecCu::setAtributtes(this->m_pcTrQuant,this->m_pcIntraSearch,this->m_pcInterSearch);
m_ctxBuffer = other.m_ctxBuffer; 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_CurrCtx = other.m_CurrCtx ? new CtxPair(*other.m_CurrCtx) : nullptr; m_pcInterSearch->setAtributtes(this->m_modeCtrl, this->m_pcTrQuant, this->m_pcEncCfg, this->m_pcRdCost, DecCu::m_pcReshape, this->m_CABACEstimator);
m_ctxPool = other.m_ctxPool ? new CtxPool(*other.m_ctxPool) : nullptr; m_modeCtrl->setAtributtes(this->m_pcEncCfg, this->m_pcRateCtrl, this->m_pcRdCost, this->m_pcInterSearch, this->m_pcEncCfg->getAdaptQPmap());
m_cuChromaQpOffsetIdxPlus1 = other.m_cuChromaQpOffsetIdxPlus1;
DecCu::setAtributtes(m_pcTrQuant, m_modeCtrl);
ChromaFormat chromaFormat = other.m_pcEncCfg->getChromaFormatIdc(); ChromaFormat chromaFormat = other.m_pcEncCfg->getChromaFormatIdc();
unsigned numWidths = gp_sizeIdxInfo->numWidths(); unsigned numWidths = gp_sizeIdxInfo->numWidths();
...@@ -141,27 +157,8 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice) ...@@ -141,27 +157,8 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice)
} }
} }
} }
//m_pTempCS = other.m_pTempCS;
m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr; //m_pBestCS = other.m_pBestCS;
//m_modeCtrl = other.m_modeCtrl ? new EncModeCtrlMTnoRQT(*(dynamic_cast<EncModeCtrlMTnoRQT*>(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 #if !JVET_AC0139_UNIFIED_MERGE
std::array<PelStorage, GEO_MAX_TRY_WEIGHTED_SAD> m_geoWeightedBuffers; // weighted prediction pixels std::array<PelStorage, GEO_MAX_TRY_WEIGHTED_SAD> m_geoWeightedBuffers; // weighted prediction pixels
...@@ -171,18 +168,10 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice) ...@@ -171,18 +168,10 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice)
} }
#endif #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++) 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_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++) for (int i = 0; i < m_bestBcwIdx.size(); i++)
{ {
m_bestBcwIdx[i] = other.m_bestBcwIdx[i]; m_bestBcwIdx[i] = other.m_bestBcwIdx[i];
...@@ -191,14 +180,11 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice) ...@@ -191,14 +180,11 @@ EncCu::EncCu(const EncCu& other, EncSlice* encSlice)
{ {
m_bestBcwCost[i] = other.m_bestBcwCost[i]; m_bestBcwCost[i] = other.m_bestBcwCost[i];
} }
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
m_sbtCostSave[i] = other.m_sbtCostSave[i]; m_sbtCostSave[i] = other.m_sbtCostSave[i];
} }
///////////CONTINUAR//////////// ///////////CONTINUAR////////////
} }
// END ALBERTO // END ALBERTO
void EncCu::create( EncCfg* encCfg ) void EncCu::create( EncCfg* encCfg )
...@@ -1193,7 +1179,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par ...@@ -1193,7 +1179,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
auto before = seconds; auto before = seconds;
seconds += static_cast<int>(duration.count() / 1000); seconds += static_cast<int>(duration.count() / 1000);
std::cout << "La iter " << iter << " de la func tarda " << static_cast<int>(duration.count() / 1000) << " + " << before << " = " << seconds << " segundos en ejecutarse." << std::endl; std::cout << "La func xCompressCU realiza " << iter << " iter que tardan " << static_cast<int>(duration.count() / 1000) << " + " << before << " = " << seconds << " segundos en ejecutarse." << std::endl;
iter = 0; iter = 0;
} }
//END ALBERTO //END ALBERTO
......
...@@ -353,6 +353,17 @@ public: ...@@ -353,6 +353,17 @@ public:
return m_pcEncCfg; return m_pcEncCfg;
} }
//END ALBERTO //END ALBERTO
//ALBERTO
void setAtributtes(const EncCfg* m_pcEncCfg, const class RateCtrl* m_pcRateCtrl, RdCost* m_pcRdCost, InterSearch* m_pcInterSearch, std::map<int, int*>* 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 create ( const EncCfg& cfg ) = 0;
virtual void destroy () = 0; virtual void destroy () = 0;
virtual void initCTUEncoding ( const Slice &slice ) = 0; virtual void initCTUEncoding ( const Slice &slice ) = 0;
......
...@@ -128,6 +128,13 @@ public: ...@@ -128,6 +128,13 @@ public:
void resetQP ( Picture* pic, int sliceQP, double lambda ); 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 // compress and encode slice
void precompressSlice ( Picture* pcPic ); ///< precompress slice for multi-loop slice-level QP opt. 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 void compressSlice ( Picture* pcPic, const bool bCompressEntireSlice, const bool bFastDeltaQP ); ///< analysis stage of slice
......
...@@ -201,8 +201,14 @@ public: ...@@ -201,8 +201,14 @@ public:
//ALBERTO //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)
{ 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<EncReshape *>(m_pcReshape);
this->m_CABACEstimator = m_CABACEstimator;
} }
//END ALBERTO //END ALBERTO
void init(EncCfg *pcEncCfg, TrQuant *pcTrQuant, int searchRange, int bipredSearchRange, void init(EncCfg *pcEncCfg, TrQuant *pcTrQuant, int searchRange, int bipredSearchRange,
......
...@@ -573,10 +573,10 @@ public: ...@@ -573,10 +573,10 @@ public:
m_orgTUs[i] = other.m_orgTUs[i] ? new TransformUnit(*other.m_orgTUs[i]) : nullptr; 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_pcTrQuant = other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) :nullptr;
m_pcRdCost = other.m_pcRdCost ? new RdCost(*other.m_pcRdCost) : 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_CABACEstimator = other.m_CABACEstimator ? new CABACWriter(*other.m_CABACEstimator) : nullptr;
m_ctxPool = other.m_ctxPool ? new CtxPool(*other.m_ctxPool) : nullptr; m_ctxPool = other.m_ctxPool ? new CtxPool(*other.m_ctxPool) : nullptr;
m_isInitialized = other.m_isInitialized; m_isInitialized = other.m_isInitialized;
...@@ -613,9 +613,16 @@ public: ...@@ -613,9 +613,16 @@ public:
~IntraSearch(); ~IntraSearch();
//ALBERTO //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<EncReshape *>(m_pcReshape);
this->m_CABACEstimator = m_CABACEstimator;
/* this->m_pTempCS = m_pTempCS;
this->m_pBestCS = m_pBestCS;*/
} }
//END ALBERTO //END ALBERTO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment