Commit 4dc3a5e7 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit nº 8 (09-03-2023) <-> 3:31 AM

```-------------------------------------------------------------
Continuar con el constructor de copia de
- CacheBlkInfoCtrl(other)
- SaveLoadEncInfoSbt(other)
- BestEncInfoCache(other)
```

-------------------------------------------------------------
Objetivo Terminar constructor de copia de EncModeCtrlMTnoRTQ para atributo EncModeCtrl de EnCu
parent a066ba64
......@@ -956,11 +956,10 @@ template class CtxStore<BinProbModel_Std>;
Ctx::Ctx() : m_bpmType(BpmType::NONE) {}
Ctx::Ctx(const BinProbModel_Std *dummy) : m_bpmType(BpmType::STD), m_CtxStore_Std(true) {}
Ctx::Ctx(const Ctx &ctx) : m_bpmType(ctx.m_bpmType), m_CtxStore_Std(ctx.m_CtxStore_Std)
//ALBERTO
Ctx::Ctx(const Ctx& ctx) : m_bpmType(ctx.m_bpmType), m_CtxStore_Std(ctx.m_CtxStore_Std), m_baseLevel(ctx.m_baseLevel)
{
::memcpy( m_GRAdaptStats, ctx.m_GRAdaptStats, sizeof( unsigned ) * RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS );
//ALBERTO
m_baseLevel = ctx.m_baseLevel;
//END ALBERTO
::memcpy(m_GRAdaptStats, ctx.m_GRAdaptStats, sizeof(unsigned) * RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS);
}
//END ALBERTO
......@@ -51,6 +51,39 @@
static constexpr double UNSET_IMV_COST = MAX_DOUBLE * 0.125; // Some large, unique value
//ALBERTO
EncModeCtrl::EncModeCtrl() {}
EncModeCtrl::EncModeCtrl(const EncModeCtrl& other)
: m_pcEncCfg(other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr)
, m_pcRateCtrl(other.m_pcRateCtrl ? new 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)
#if SHARP_LUMA_DELTA_QP
, m_lumaQPOffset(other.m_lumaQPOffset)
#endif
, m_fastDeltaQP(other.m_fastDeltaQP)
, m_ComprCUCtxList(other.m_ComprCUCtxList)
, m_pcInterSearch(new InterSearch(*other.m_pcInterSearch))
, m_doPlt(other.m_doPlt)
{
const int* a = nullptr;
a = new int(3);
if (other.m_bimQPMap)
{
m_bimQPMap = new std::map<int, int*>;
for (auto const& entry: *other.m_bimQPMap)
{
int* copyArray = new int[entry.first];
std::memcpy(copyArray, entry.second, sizeof(int) * entry.first);
(*m_bimQPMap)[entry.first] = copyArray;
}
}
else
{
m_bimQPMap = nullptr;
}
}
//END ALBERTO
void EncModeCtrl::init( EncCfg *pCfg, RateCtrl *pRateCtrl, RdCost* pRdCost )
{
m_pcEncCfg = pCfg;
......@@ -1038,6 +1071,19 @@ static bool interHadActive( const ComprCUCtx& ctx )
//////////////////////////////////////////////////////////////////////////
// EncModeCtrlQTBT
//////////////////////////////////////////////////////////////////////////
//ALBERTO
EncModeCtrlMTnoRQT::EncModeCtrlMTnoRQT() {}
EncModeCtrlMTnoRQT::EncModeCtrlMTnoRQT(const EncModeCtrlMTnoRQT& other)
: m_encCfg(other.m_encCfg)
, m_skipThreshold(other.m_skipThreshold)
, EncModeCtrl(other)
, CacheBlkInfoCtrl(other)
, SaveLoadEncInfoSbt(other), BestEncInfoCache(other)
{
}
//END ALBERTO
void EncModeCtrlMTnoRQT::create( const EncCfg& cfg )
{
......
......@@ -283,7 +283,9 @@ protected:
const EncCfg *m_pcEncCfg;
const class RateCtrl *m_pcRateCtrl;
class RdCost *m_pcRdCost;
const Slice *m_slice;
//ALBERTO
const Slice *m_slice = nullptr;
//END ALBERTO
#if SHARP_LUMA_DELTA_QP
int m_lumaLevelToDeltaQPLUT[LUMA_LEVEL_TO_DQP_LUT_MAXSIZE];
int m_lumaQPOffset;
......@@ -296,7 +298,10 @@ protected:
bool m_doPlt;
public:
//ALBERTO
EncModeCtrl();
EncModeCtrl(const EncModeCtrl& other);
//END ALBERTO
virtual ~EncModeCtrl () {}
virtual void create ( const EncCfg& cfg ) = 0;
......@@ -911,6 +916,10 @@ class EncModeCtrlMTnoRQT : public EncModeCtrl, public CacheBlkInfoCtrl
#endif
public:
//ALBERTO
EncModeCtrlMTnoRQT();
EncModeCtrlMTnoRQT(const EncModeCtrlMTnoRQT& other);
//END ALBERTO
virtual void create ( const EncCfg& cfg );
virtual void destroy ();
virtual void initCTUEncoding ( const Slice &slice );
......
......@@ -414,15 +414,16 @@ public:
IntraSearch();
//ALBERTO
IntraSearch(IntraSearch& other)
IntraSearch(IntraSearch& other)
: m_modeCtrl((EncModeCtrl*) new EncModeCtrlMTnoRQT(*dynamic_cast<EncModeCtrlMTnoRQT*>(other.m_modeCtrl)))
{
m_modeCtrl = new EncModeCtrlMTnoRQT();
m_modeCtrl->create(*other.m_pcEncCfg);
for (int i = 0; i < MAX_NUM_TBLOCKS; i++)
{
m_pSharedPredTransformSkip[i] = new Pel(*other.m_pSharedPredTransformSkip[i]);
//CONTINUAR CON EL RESTO DE ATRIBUTOS
}
//m_modeCtrl = new EncModeCtrlMTnoRQT();
//m_modeCtrl->create(*other.m_pcEncCfg);
//for (int i = 0; i < MAX_NUM_TBLOCKS; i++)
//{
// m_pSharedPredTransformSkip[i] = new Pel(*other.m_pSharedPredTransformSkip[i]);
// //CONTINUAR CON EL RESTO DE ATRIBUTOS
//}
}
//END ALBERTO
~IntraSearch();
......
......@@ -95,6 +95,57 @@ struct TRCParameter
class EncRCSeq
{
public:
//ALBERTO
EncRCSeq(const EncRCSeq& other)
{
m_totalFrames = other.m_totalFrames;
m_targetRate = other.m_targetRate;
m_frameRate = other.m_frameRate;
m_GOPSize = other.m_GOPSize;
m_intraPeriod = other.m_intraPeriod;
m_picWidth = other.m_picWidth;
m_picHeight = other.m_picHeight;
m_LCUWidth = other.m_LCUWidth;
m_LCUHeight = other.m_LCUHeight;
m_numberOfLevel = other.m_numberOfLevel;
m_averageBits = other.m_averageBits;
m_numberOfPixel = other.m_numberOfPixel;
m_targetBits = other.m_targetBits;
m_numberOfLCU = other.m_numberOfLCU;
m_bitsRatio = new int[m_GOPSize];
memcpy(m_bitsRatio, other.m_bitsRatio, sizeof(int) * m_GOPSize);
m_GOPID2Level = new int[m_GOPSize];
memcpy(m_GOPID2Level, other.m_GOPID2Level, sizeof(int) * m_GOPSize);
m_picPara = new TRCParameter[m_numberOfLevel];
for (int i = 0; i < m_numberOfLevel; i++)
{
m_picPara[i] = other.m_picPara[i];
}
m_LCUPara = new TRCParameter*[m_numberOfLevel];
for (int i = 0; i < m_numberOfLevel; i++)
{
m_LCUPara[i] = new TRCParameter[m_numberOfLCU];
for (int j = 0; j < m_numberOfLCU; j++)
{
m_LCUPara[i][j] = other.m_LCUPara[i][j];
}
}
m_framesLeft = other.m_framesLeft;
m_bitsLeft = other.m_bitsLeft;
m_seqTargetBpp = other.m_seqTargetBpp;
m_alphaUpdate = other.m_alphaUpdate;
m_betaUpdate = other.m_betaUpdate;
m_useLCUSeparateModel = other.m_useLCUSeparateModel;
m_adaptiveBit = other.m_adaptiveBit;
m_lastLambda = other.m_lastLambda;
m_bitDepth = other.m_bitDepth;
}
//END ALBERTO
EncRCSeq();
~EncRCSeq();
......@@ -187,6 +238,35 @@ private:
class EncRCGOP
{
public:
//ALBERTO
EncRCGOP::EncRCGOP(const EncRCGOP& other)
{
// Copiar los punteros de miembro profundo y los datos primitivos
m_numPic = other.m_numPic;
m_targetBits = other.m_targetBits;
m_picLeft = other.m_picLeft;
m_bitsLeft = other.m_bitsLeft;
m_minEstLambda = other.m_minEstLambda;
m_maxEstLambda = other.m_maxEstLambda;
if (other.m_encRCSeq)
{
m_encRCSeq = new EncRCSeq(*other.m_encRCSeq);
}
else
{
m_encRCSeq = nullptr;
}
// Copiar la matriz dinmica
m_picTargetBitInGOP = new int[m_numPic];
for (int i = 0; i < m_numPic; i++)
{
m_picTargetBitInGOP[i] = other.m_picTargetBitInGOP[i];
}
}
//END ALBERTO
EncRCGOP();
~EncRCGOP();
......@@ -224,6 +304,38 @@ private:
class EncRCPic
{
public:
//ALBERTO
EncRCPic(const EncRCPic& other):
m_frameLevel(other.m_frameLevel)
, m_numberOfPixel(other.m_numberOfPixel)
, m_numberOfLCU(other.m_numberOfLCU)
, m_targetBits(other.m_targetBits)
, m_estHeaderBits(other.m_estHeaderBits)
, m_estPicQP(other.m_estPicQP)
, m_lowerBound(other.m_lowerBound)
, m_estPicLambda(other.m_estPicLambda)
, m_LCULeft(other.m_LCULeft)
, m_bitsLeft(other.m_bitsLeft)
, m_pixelsLeft(other.m_pixelsLeft)
, m_picActualHeaderBits(other.m_picActualHeaderBits)
, m_totalCostIntra(other.m_totalCostIntra)
, m_remainingCostIntra(other.m_remainingCostIntra)
, m_picActualBits(other.m_picActualBits)
, m_picQP(other.m_picQP)
, m_picLambda(other.m_picLambda)
, m_picMSE(other.m_picMSE)
, m_validPixelsInPic(other.m_validPixelsInPic)
{
m_encRCSeq = new EncRCSeq(*other.m_encRCSeq);
m_encRCGOP = new EncRCGOP(*other.m_encRCGOP);
m_LCUs = new TRCLCU[other.m_numberOfLCU];
for (int i = 0; i < other.m_numberOfLCU; i++)
{
m_LCUs[i] = other.m_LCUs[i];
}
}
//END ALBERTO
EncRCPic();
~EncRCPic();
......@@ -321,6 +433,24 @@ private:
class RateCtrl
{
public:
//ALBERTO
RateCtrl(const RateCtrl& other)
: m_RCQP(other.m_RCQP)
, m_CpbSaturationEnabled(other.m_CpbSaturationEnabled)
, m_cpbState(other.m_cpbState)
, m_cpbSize(other.m_cpbSize)
, m_bufferingRate(other.m_bufferingRate)
{
m_encRCSeq = other.m_encRCSeq ? new EncRCSeq(*other.m_encRCSeq): nullptr;
m_encRCGOP = other.m_encRCGOP ? new EncRCGOP(*other.m_encRCGOP): nullptr;
m_encRCPic = other.m_encRCPic ? new EncRCPic(*other.m_encRCPic): nullptr;
for (auto pic: other.m_listRCPictures)
{
m_listRCPictures.push_back(new EncRCPic(*pic));
}
}
//END ALBERTO
RateCtrl();
~RateCtrl();
......
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