Commit acf475c9 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit 5

```-------------------------------------------------------------
EncSlice se ha llamado al constructor de EncCu para crear un nuevo objeto antes y después de llamar a compressCtu (líneas 1897-1903)
```

---------------------------------------------------------------
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
- Definido constructor de copia de InterSearch
- Comprobar copia Decu->PelSotrage->PelUnitBuf->UnitBuf->AreaBuf (NO SE HA CONSEGUIDO COPIAR EL ATRIBUTO T* buf) HABLAR CON ANTONIO
------------------------------------------------------------
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.
parent 21940d83
......@@ -122,6 +122,10 @@ struct AreaBuf : public Size
// the proper type causes awful lot of errors
//ptrdiff_t stride;
//ALBERTO
AreaBuf(const AreaBuf<const T>& other) : Size(other), buf(other.buf), stride(other.stride) {}
//END ALBERTO
AreaBuf() : Size(), buf(nullptr), stride(0) {}
AreaBuf( T *_buf, const Size &size ) : Size( size ), buf( _buf ), stride( size.width ) { }
AreaBuf(T *_buf, const ptrdiff_t &_stride, const Size &size) : Size(size), buf(_buf), stride(_stride) {}
......@@ -746,6 +750,12 @@ struct UnitBuf
ChromaFormat chromaFormat;
UnitBufBuffers bufs;
//ALBERTO
UnitBuf(const UnitBuf& other) : chromaFormat(other.chromaFormat), bufs(other.bufs)
{}
//END ALBERTO
UnitBuf() : chromaFormat(ChromaFormat::UNDEFINED) {}
UnitBuf( const ChromaFormat &_chromaFormat, const UnitBufBuffers& _bufs ) : chromaFormat( _chromaFormat ), bufs( _bufs ) { }
UnitBuf( const ChromaFormat &_chromaFormat, UnitBufBuffers&& _bufs ) : chromaFormat( _chromaFormat ), bufs( std::forward<UnitBufBuffers>( _bufs ) ) { }
......@@ -1000,6 +1010,16 @@ struct CompArea;
struct PelStorage : public PelUnitBuf
{
PelStorage();
//ALBERTO
PelStorage::PelStorage(const PelStorage& other) : PelUnitBuf(other)
{
// Copiar m_origin
for (int i = 0; i < MAX_NUM_COMPONENT && i < PelUnitBuf::bufs.size(); i++)
{
m_origin[i] = PelUnitBuf::bufs[i].buf;
}
}
//END ALBERTO
~PelStorage();
void swap( PelStorage& other );
......
......@@ -1307,6 +1307,15 @@ public:
static constexpr size_type max_num_elements = N;
//ALBERTO
static_vector(const static_vector<T, N>& other) : _size(other._size)
{
for (size_t i = 0; i < _size; ++i)
{
_arr[i] = T(other._arr[i]);
}
}
//END ALBERTO
static_vector() : _size( 0 ) { }
static_vector( size_t N_ ) : _size( N_ ) { }
static_vector( size_t N_, const T& _val ) : _size( 0 ) { resize( N_, _val ); }
......
......@@ -47,6 +47,11 @@
#include "CommonLib/IntraPrediction.h"
#include "CommonLib/Unit.h"
#include "CommonLib/Reshape.h"
//ALBERTO
#include "EncoderLib/IntraSearch.h"
#include "EncoderLib/InterSearch.h"
//END ALBERTO
//! \ingroup DecoderLib
//! \{
......@@ -59,8 +64,31 @@ class DecCu
{
public:
DecCu();
//ALBERTO
DecCu(const DecCu& other) : m_geoMrgCtx(other.m_geoMrgCtx)
{
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++)
{
m_SubPuMiBuf[i] = other.m_SubPuMiBuf[i];
}
}
//END ALBERTO
virtual ~DecCu();
//ALBERTO
void setAtributtes(TrQuant* other_m_pcTrQuant, EncModeCtrl* other_m_modeCtrl)
{
m_pcTrQuant = other_m_pcTrQuant;
(dynamic_cast<IntraSearch*>(m_pcIntraPred))->setAtributtes(other_m_modeCtrl);
(dynamic_cast<InterSearch*>(m_pcInterPred))->setAtributtes(other_m_modeCtrl);
}
//END ALBERTO
/// initialize access channels
void init ( TrQuant* pcTrQuant, IntraPrediction* pcIntra, InterPrediction* pcInter );
......
......@@ -69,7 +69,15 @@ const MergeIdxPair EncCu::m_geoModeTest[GEO_MAX_NUM_CANDS] = {
EncCu::EncCu() {}
// ALBERTO
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)
EncCu::EncCu(const EncCu& other)
: DecCu(other)
,m_modeCtrl(new EncModeCtrlMTnoRQT(*(dynamic_cast<EncModeCtrlMTnoRQT*>(other.m_modeCtrl))))
, m_pcTrQuant(other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) : nullptr)
, 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 DIRECCIN
#if JVET_AC0139_UNIFIED_MERGE
,m_mergeItemList(m_mergeItemList)
......@@ -81,32 +89,62 @@ EncCu::EncCu(const EncCu& other) : DecCu(other), m_unitPool(other.m_unitPool), m
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);
m_pTempCS = new CodingStructure**(*other.m_pTempCS);
*m_pTempCS = new CodingStructure*();
**m_pTempCS = (**other.m_pTempCS) ? new CodingStructure(***other.m_pTempCS) : nullptr;
ChromaFormat chromaFormat = other.m_pcEncCfg->getChromaFormatIdc();
unsigned numWidths = gp_sizeIdxInfo->numWidths();
unsigned numHeights = gp_sizeIdxInfo->numHeights();
m_pTempCS = new CodingStructure**[numWidths];
m_pBestCS = new CodingStructure**[numWidths];
m_pTempCS2 = new CodingStructure**[numWidths];
m_pBestCS2 = new CodingStructure**[numWidths];
for (unsigned w = 0; w < numWidths; w++)
{
m_pTempCS[w] = new CodingStructure*[numHeights];
m_pBestCS[w] = new CodingStructure*[numHeights];
m_pTempCS2[w] = new CodingStructure*[numHeights];
m_pBestCS2[w] = new CodingStructure*[numHeights];
m_pBestCS = new CodingStructure**(*other.m_pBestCS);
*m_pBestCS = new CodingStructure*();
**m_pBestCS = (**other.m_pBestCS) ? new CodingStructure(***other.m_pBestCS) : nullptr;
for (unsigned h = 0; h < numHeights; h++)
{
unsigned width = gp_sizeIdxInfo->sizeFrom(w);
unsigned height = gp_sizeIdxInfo->sizeFrom(h);
m_pTempCS2 = new CodingStructure**(*other.m_pTempCS2);
*m_pTempCS2 = new CodingStructure*();
**m_pTempCS2 = (**other.m_pTempCS2) ? new CodingStructure(***other.m_pTempCS2) : nullptr;
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]->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_pBestCS2 = new CodingStructure**(*other.m_pBestCS2);
*m_pBestCS2 = new CodingStructure*();
**m_pBestCS2 = (**other.m_pBestCS2) ? new CodingStructure(***other.m_pBestCS2) : nullptr;
m_pTempCS2[w][h] = new CodingStructure(otherXu);
m_pBestCS2[w][h] = new CodingStructure(otherXu);
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());
}
else
{
m_pTempCS[w][h] = nullptr;
m_pBestCS[w][h] = nullptr;
m_pTempCS2[w][h] = nullptr;
m_pBestCS2[w][h] = nullptr;
}
}
}
m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr;
m_modeCtrl = other.m_modeCtrl ? new EncModeCtrlMTnoRQT(*(dynamic_cast<EncModeCtrlMTnoRQT*>(other.m_modeCtrl))) : nullptr; //REVISAR M_MODE_CTRL COMPLETO ANTES DE CONTINUAR/////////////////////////////////////////////////////////////////
//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_pcTrQuant = other.m_pcTrQuant ? new TrQuant(*other.m_pcTrQuant) : nullptr;
m_pcRdCost = other.m_pcRdCost ? new RdCost(*other.m_pcRdCost) : nullptr;
......@@ -372,7 +410,6 @@ void EncCu::compressCtu(CodingStructure &cs, const UnitArea &area, const unsigne
}
// init current context pointer
m_CurrCtx = m_ctxBuffer.data();
CodingStructure *tempCS = m_pTempCS[gp_sizeIdxInfo->idxFrom( area.lumaSize().width )][gp_sizeIdxInfo->idxFrom( area.lumaSize().height )];
CodingStructure *bestCS = m_pBestCS[gp_sizeIdxInfo->idxFrom( area.lumaSize().width )][gp_sizeIdxInfo->idxFrom( area.lumaSize().height )];
......
......@@ -299,6 +299,12 @@ public:
/// copy parameters from encoder class
void init ( EncLib* pcEncLib, const SPS& sps );
//ALBERTO
EncModeCtrl* getEncModeCtrl()
{
return m_modeCtrl;
}
//END ALBERTO
void setDecCuReshaperInEncCU(EncReshape* pcReshape, ChromaFormat chromaFormatIdc)
{
initDecCuReshaper((Reshape*) pcReshape, chromaFormatIdc);
......
......@@ -199,6 +199,12 @@ public:
//END ALBERTO
virtual ~InterSearch();
//ALBERTO
void setAtributtes(EncModeCtrl* other_m_modeCtrl)
{ m_modeCtrl = other_m_modeCtrl;
}
//END ALBERTO
void init(EncCfg *pcEncCfg, TrQuant *pcTrQuant, int searchRange, int bipredSearchRange,
MESearchMethod motionEstimationSearchMethod, bool useCompositeRef, const uint32_t maxCUWidth,
const uint32_t maxCUHeight, const uint32_t maxTotalCUDepth, RdCost *pcRdCost, CABACWriter *CABACEstimator,
......
......@@ -549,6 +549,13 @@ public:
IntraSearch();
~IntraSearch();
//ALBERTO
void setAtributtes(EncModeCtrl* other_m_modeCtrl)
{
m_modeCtrl = other_m_modeCtrl;
}
//END ALBERTO
void init(EncCfg *pcEncCfg, TrQuant *pcTrQuant, RdCost *pcRdCost, CABACWriter *CABACEstimator, CtxPool *ctxPool,
const uint32_t maxCUWidth, const uint32_t maxCUHeight, const uint32_t maxTotalCUDepth,
EncReshape *m_pcReshape, const unsigned bitDepthY);
......
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