Commit d0d604d5 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit 7

- Constructor de copia de Area
- EncSlice pasado como puntero al constructor de EncCu
- Definido constructor de copia de PelUnitBufPool
- Definir constructor de copia de RdCost
******* Creadas funciones setAtributtes que permiten teniendo atributos de tipo punteros compartidos entre el objeto original y atributos de ese objeto, darle a ambos el mismo valor, una vez que se crea el puntero en el constructor original.
GRÁFICAMENTE:
Objeto   -> Atributo
ObjetoA -> PunteroA (null)
ObjetoB -> PunteroB (null)
ObjetoA -> ObjetoB
------------------------
ObjetoA -> PunteroA = new PunteroA
ObjetoB -> PunteroB = PunteroA
-------------------------
ObjetoA -> Puntero (0x93873883)
ObjetoB -> Puntero (0x93873883)

//REVISAR ESTRUCTURAS TEMPCS,BESTCS, Y EL RESTO DE CODING STRUCTURE
parent 9e8b0491
......@@ -1916,7 +1916,7 @@ void CodingStructure::clearPUs()
std::fill_n(m_puIdx[chType], unitScale[getFirstComponentOfChannel(chType)].scaleArea(area.block(chType).area()), 0);
}
m_puPool.giveBack(pus);
m_puPool.giveBack(pus); /////ERROR///////
m_numPUs = 0;
for( auto &pcu : cus )
......
......@@ -80,6 +80,10 @@ struct Size
struct Area : public Position, public Size
{
//ALBERTO
Area(const Area& other): Position(other.x,other.y), Size(other.width,other.height)
{}
//END ALBERTO
Area() : Position(), Size() { }
Area(const Position &_pos, const Size &_size) : Position(_pos), Size(_size) { }
Area(const PosType _x, const PosType _y, const SizeType _w, const SizeType _h) : Position(_x, _y), Size(_w, _h) { }
......
......@@ -1465,7 +1465,7 @@ public:
void giveBack(std::vector<T *> &vel)
{
m_items.insert(m_items.end(), vel.begin(), vel.end());
m_items.insert(m_items.end(), vel.begin(), vel.end()); ////ERROR////
vel.clear();
}
};
......
......@@ -69,8 +69,6 @@ public:
{
m_pcReshape = other.m_pcReshape ? new Reshape(*other.m_pcReshape) : nullptr;
m_tmpStorageCtu = other.m_tmpStorageCtu ? new PelStorage(*other.m_tmpStorageCtu) : nullptr;
m_pcIntraPred = other.m_pcIntraPred ? new IntraSearch(*dynamic_cast<IntraSearch*>(other.m_pcIntraPred)) : nullptr;
m_pcInterPred = other.m_pcInterPred ? new InterSearch(*dynamic_cast<InterSearch*>(other.m_pcInterPred)) : nullptr;
for (int i = 0; i < (MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1); i++)
{
......@@ -81,11 +79,11 @@ public:
virtual ~DecCu();
//ALBERTO
void setAtributtes(EncModeCtrl* m_modeCtrl, TrQuant* m_pcTrQuant, EncCfg* m_pcEncCfg, RdCost* m_pcRdCost, CABACWriter* m_CABACEstimator)
void setAtributtes(TrQuant* m_pcTrQuant, IntraPrediction* m_pcIntraPred, InterPrediction* m_pcInterPred)
{
this->m_pcTrQuant = m_pcTrQuant;
(dynamic_cast<IntraSearch*>(m_pcIntraPred))->setAtributtes(m_modeCtrl, m_pcTrQuant, m_pcEncCfg, m_pcRdCost, this->m_pcReshape, m_CABACEstimator);
(dynamic_cast<InterSearch*>(m_pcInterPred))->setAtributtes(m_modeCtrl, m_pcTrQuant, m_pcEncCfg, m_pcRdCost, this->m_pcReshape, m_CABACEstimator);
this->m_pcIntraPred = m_pcIntraPred;
this->m_pcInterPred = m_pcInterPred;
}
//END ALBERTO
......
......@@ -73,13 +73,13 @@ const MergeIdxPair EncCu::m_geoModeTest[GEO_MAX_NUM_CANDS] = {
EncCu::EncCu() {}
// ALBERTO
EncCu::EncCu(const EncCu& other)
EncCu::EncCu(const EncCu& other, EncSlice* encSlice)
: DecCu(other)
///m_pc
/// 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(other.m_pcSliceEncoder ? new EncSlice(*other.m_pcSliceEncoder) : 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)
......@@ -107,11 +107,10 @@ EncCu::EncCu(const EncCu& other)
///////////CONTINUAR////////////
#endif
{
DecCu::setAtributtes(this->m_modeCtrl, this->m_pcTrQuant, this->m_pcEncCfg, this->m_pcRdCost, this->m_CABACEstimator);
m_pcIntraSearch->setAtributtes(this->m_modeCtrl, this->m_pcTrQuant, this->m_pcEncCfg, this->m_pcRdCost, DecCu::m_pcReshape, this->m_CABACEstimator);
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);
//m_pcSliceEncoder->setAtributtes(this->m_pcTrQuant);
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();
......@@ -134,18 +133,20 @@ EncCu::EncCu(const EncCu& other)
if (gp_sizeIdxInfo->isCuSize(width) && gp_sizeIdxInfo->isCuSize(height))
{
XuPool otherXu = other.m_unitPool;
m_pTempCS[w][h] = new CodingStructure(otherXu);
m_pBestCS[w][h] = new CodingStructure(otherXu);
m_pTempCS[w][h] = new CodingStructure(m_unitPool);
m_pBestCS[w][h] = new CodingStructure(m_unitPool);
PosType lx = other.m_pTempCS[w][h]->area.lx();
PosType ly = other.m_pTempCS[w][h]->area.ly();
m_pTempCS[w][h]->create(chromaFormat, Area(0, 0, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pBestCS[w][h]->create(chromaFormat, Area(0, 0, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pTempCS[w][h]->create(chromaFormat, Area(lx, ly, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pBestCS[w][h]->create(chromaFormat, Area(lx, ly, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pTempCS2[w][h] = new CodingStructure(otherXu);
m_pBestCS2[w][h] = new CodingStructure(otherXu);
m_pTempCS2[w][h] = new CodingStructure(m_unitPool);
m_pBestCS2[w][h] = new CodingStructure(m_unitPool);
m_pTempCS2[w][h]->create(chromaFormat, Area(0, 0, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pBestCS2[w][h]->create(chromaFormat, Area(0, 0, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pTempCS2[w][h]->create(chromaFormat, Area(lx, ly, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
m_pBestCS2[w][h]->create(chromaFormat, Area(lx, ly, width, height), false, (bool) other.m_pcEncCfg->getPLTMode());
}
else
{
......@@ -156,6 +157,9 @@ EncCu::EncCu(const EncCu& other)
}
}
}
//m_pTempCS = other.m_pTempCS;
//m_pBestCS = other.m_pBestCS;
#if !JVET_AC0139_UNIFIED_MERGE
std::array<PelStorage, GEO_MAX_TRY_WEIGHTED_SAD> m_geoWeightedBuffers; // weighted prediction pixels
for (int i = 0; i < m_geoWeightedBuffers.size(); i++)
......
......@@ -336,7 +336,7 @@ public:
EncCfg* getEncCfg() const { return m_pcEncCfg; }
//ALBERTO
EncCu(const EncCu& other);
EncCu(const EncCu& other, EncSlice* encSlice);
//END ALBERTO
EncCu();
~EncCu();
......
......@@ -355,12 +355,13 @@ public:
//END ALBERTO
//ALBERTO
void setAtributtes(const EncCfg* m_pcEncCfg, const class RateCtrl* m_pcRateCtrl, RdCost* m_pcRdCost, InterSearch* m_pcInterSearch)
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;
......
......@@ -1902,16 +1902,12 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
if (pCfg->getSwitchPOC() != pcPic->poc || ctuRsAddr >= pCfg->getDebugCTU())
{
//ALBERTO
EncCu* m_pcCuEncoder_COPY_BEFORE = new EncCu(*m_pcCuEncoder);
EncCu* m_pcCuEncoder_COPY_BEFORE = new EncCu(*m_pcCuEncoder, this);
bool stop_debugger_1 = true;
//EncCu new_m_pcCuEncoder;
//new_m_pcCuEncoder.create(m_pcCfg);
//new_m_pcCuEncoder.init(m_pcLib, m_pcSps);
//END ALBERTO
m_pcCuEncoder_COPY_BEFORE->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP);
m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP);
//ALBERTO
EncCu* m_pcCuEncoder_COPY_AFTER = new EncCu(*m_pcCuEncoder);
EncCu* m_pcCuEncoder_COPY_AFTER = new EncCu(*m_pcCuEncoder,this);
bool stop_debugger_2 = true;
//END ALBERTO
#if GREEN_METADATA_SEI_ENABLED
......
......@@ -425,26 +425,89 @@ public:
}
m_unitPool = XuPool(other.m_unitPool);
m_pSplitCS = new CodingStructure***();
*m_pSplitCS = new CodingStructure**();
**m_pSplitCS = new CodingStructure*();
***m_pSplitCS = *other.m_pSplitCS && **other.m_pSplitCS && ***other.m_pSplitCS ? new CodingStructure(****other.m_pSplitCS) : nullptr;
m_pFullCS = new CodingStructure***();
*m_pFullCS = new CodingStructure**();
**m_pFullCS = new CodingStructure*();
***m_pFullCS = *other.m_pFullCS && **other.m_pFullCS && ***other.m_pFullCS ? new CodingStructure(****other.m_pFullCS) : nullptr;
m_pTempCS = new CodingStructure**();
*m_pTempCS = new CodingStructure*();
**m_pTempCS = *other.m_pTempCS && **other.m_pTempCS ? new CodingStructure(***other.m_pTempCS) : nullptr;
m_pBestCS = new CodingStructure**();
*m_pBestCS = new CodingStructure*();
**m_pBestCS = *other.m_pBestCS && **other.m_pBestCS ? new CodingStructure(***other.m_pBestCS) : nullptr;
m_pSaveCS = new CodingStructure*();
*m_pSaveCS = *other.m_pSaveCS ? new CodingStructure(**other.m_pSaveCS) : nullptr;
this->m_pBestCS = other.m_pBestCS;
this->m_pTempCS = other.m_pTempCS;
this->m_pSaveCS = other.m_pSaveCS;
this->m_pFullCS = other.m_pFullCS;
this->m_pSplitCS = other.m_pSplitCS;
// const uint32_t numWidths = gp_sizeIdxInfo->numWidths();
//const uint32_t numHeights = gp_sizeIdxInfo->numHeights();
//const uint32_t numLayersToAllocateSplit = 1;
//const uint32_t numLayersToAllocateFull = 1;
//m_pBestCS = new CodingStructure**[numWidths];
//m_pTempCS = new CodingStructure**[numWidths];
//m_pFullCS = new CodingStructure***[numWidths];
//m_pSplitCS = new CodingStructure***[numWidths];
//for (uint32_t width = 0; width < numWidths; width++)
//{
// m_pBestCS[width] = new CodingStructure*[numHeights];
// m_pTempCS[width] = new CodingStructure*[numHeights];
// m_pFullCS[width] = new CodingStructure**[numHeights];
// m_pSplitCS[width] = new CodingStructure**[numHeights];
// for (uint32_t height = 0; height < numHeights; height++)
// {
// if (gp_sizeIdxInfo->isCuSize(gp_sizeIdxInfo->sizeFrom(width))
// && gp_sizeIdxInfo->isCuSize(gp_sizeIdxInfo->sizeFrom(height)))
// {
// m_pBestCS[width][height] = new CodingStructure(m_unitPool);
// m_pTempCS[width][height] = new CodingStructure(m_unitPool);
// m_pBestCS[width][height]->create(m_pcEncCfg->getChromaFormatIdc(),
// Area(0, 0, gp_sizeIdxInfo->sizeFrom(width), gp_sizeIdxInfo->sizeFrom(height)),
// false, (bool) pcEncCfg->getPLTMode());
// m_pTempCS[width][height]->create(m_pcEncCfg->getChromaFormatIdc(),
// Area(0, 0, gp_sizeIdxInfo->sizeFrom(width), gp_sizeIdxInfo->sizeFrom(height)),
// false, (bool) pcEncCfg->getPLTMode());
// m_pFullCS[width][height] = new CodingStructure*[numLayersToAllocateFull];
// m_pSplitCS[width][height] = new CodingStructure*[numLayersToAllocateSplit];
// for (uint32_t layer = 0; layer < numLayersToAllocateFull; layer++)
// {
// m_pFullCS[width][height][layer] = new CodingStructure(m_unitPool);
// m_pFullCS[width][height][layer]->create(
// m_pcEncCfg->getChromaFormatIdc(),
// Area(0, 0, gp_sizeIdxInfo->sizeFrom(width), gp_sizeIdxInfo->sizeFrom(height)), false,
// (bool) pcEncCfg->getPLTMode());
// }
// for (uint32_t layer = 0; layer < numLayersToAllocateSplit; layer++)
// {
// m_pSplitCS[width][height][layer] = new CodingStructure(m_unitPool);
// m_pSplitCS[width][height][layer]->create(
// m_pcEncCfg->getChromaFormatIdc(),
// Area(0, 0, gp_sizeIdxInfo->sizeFrom(width), gp_sizeIdxInfo->sizeFrom(height)), false,
// (bool) pcEncCfg->getPLTMode());
// }
// }
// else
// {
// m_pBestCS[width][height] = nullptr;
// m_pTempCS[width][height] = nullptr;
// m_pFullCS[width][height] = nullptr;
// m_pSplitCS[width][height] = nullptr;
// }
// }
//}
//const int numSaveLayersToAllocate = 2;
//m_pSaveCS = new CodingStructure*[numSaveLayersToAllocate];
//for (uint32_t depth = 0; depth < numSaveLayersToAllocate; depth++)
//{
// m_pSaveCS[depth] = new CodingStructure(m_unitPool);
// m_pSaveCS[depth]->create(UnitArea(cform, Area(0, 0, maxCUWidth, maxCUHeight)), false,
// (bool) pcEncCfg->getPLTMode());
//}
m_saveCuCostInSCIPU = other.m_numCuInSCIPU;
......@@ -550,7 +613,7 @@ public:
~IntraSearch();
//ALBERTO
void setAtributtes(EncModeCtrl* m_modeCtrl, TrQuant* m_pcTrQuant, EncCfg* m_pcEncCfg, RdCost* m_pcRdCost, Reshape* m_pcReshape, CABACWriter* m_CABACEstimator)
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)
{
this->m_modeCtrl = m_modeCtrl;
this->m_pcTrQuant = m_pcTrQuant;
......@@ -558,6 +621,8 @@ public:
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
......
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