Commit c5404035 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit 2

```-------------------------------------------------------------
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
------------------------------------------------------------
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
parent 5b785518
......@@ -353,6 +353,8 @@ public:
**m_pBestCS2 = (**other.m_pBestCS2) ? new CodingStructure(***other.m_pBestCS2) : nullptr;
m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr;
m_pcIntraSearch = other.m_pcIntraSearch ? new IntraSearch(*other.m_pcIntraSearch) : nullptr;
///////////CONTINUAR////////////
}
//END ALBERTO
......
......@@ -48,6 +48,10 @@
#include <typeinfo>
#include <vector>
//ALBERTO
#include "RateCtrl.h"
//END ALBERTO
//////////////////////////////////////////////////////////////////////////
// Encoder modes to try out
//////////////////////////////////////////////////////////////////////////
......@@ -279,24 +283,68 @@ struct ComprCUCtx
class EncModeCtrl
{
protected:
const EncCfg *m_pcEncCfg;
const class RateCtrl *m_pcRateCtrl;
class RdCost *m_pcRdCost;
const Slice *m_slice;
const EncCfg* m_pcEncCfg;
const class RateCtrl* m_pcRateCtrl;
class RdCost* m_pcRdCost;
const Slice* m_slice;
#if SHARP_LUMA_DELTA_QP
int m_lumaLevelToDeltaQPLUT[LUMA_LEVEL_TO_DQP_LUT_MAXSIZE];
int m_lumaQPOffset;
#endif
std::map<int, int*> *m_bimQPMap;
std::map<int, int*>* m_bimQPMap;
bool m_fastDeltaQP;
static_vector<ComprCUCtx, ( MAX_CU_DEPTH << 2 )> m_ComprCUCtxList;
static_vector<ComprCUCtx, (MAX_CU_DEPTH << 2)> m_ComprCUCtxList;
InterSearch* m_pcInterSearch;
bool m_doPlt;
public:
// ALBERTO
EncModeCtrl::EncModeCtrl()
: m_pcEncCfg(nullptr)
, m_pcRateCtrl(nullptr)
, m_pcRdCost(nullptr)
, m_slice(nullptr)
,
#if SHARP_LUMA_DELTA_QP
m_lumaQPOffset(0)
,
#endif
m_bimQPMap(nullptr)
, m_fastDeltaQP(false)
, m_pcInterSearch(nullptr)
, m_doPlt(false)
{}
EncModeCtrl(const EncModeCtrl& other)
{
m_pcEncCfg = other.m_pcEncCfg ? new EncCfg(*other.m_pcEncCfg) : nullptr;
m_pcRateCtrl = other.m_pcRateCtrl ? new class 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;
for (int i = 0; i < LUMA_LEVEL_TO_DQP_LUT_MAXSIZE; i++)
{
m_lumaLevelToDeltaQPLUT[i] = other.m_lumaLevelToDeltaQPLUT[i];
}
m_lumaQPOffset = other.m_lumaQPOffset;
m_bimQPMap = new std::map<int, int*>;
*m_bimQPMap = *other.m_bimQPMap;
for (auto& pair: *m_bimQPMap)
{
int* value = pair.second;
int* copy = new int(*value);
pair.second = copy;
}
m_fastDeltaQP = other.m_fastDeltaQP;
m_ComprCUCtxList = other.m_ComprCUCtxList;
m_pcInterSearch = other.m_pcInterSearch ? new InterSearch(*other.m_pcInterSearch) : nullptr;
m_doPlt = other.m_doPlt;
}
//END ALBERTO
virtual ~EncModeCtrl () {}
virtual void create ( const EncCfg& cfg ) = 0;
......@@ -911,6 +959,34 @@ class EncModeCtrlMTnoRQT : public EncModeCtrl, public CacheBlkInfoCtrl
#endif
public:
//ALBERTO
// EncModeCtrlMTnoRQT() : EncModeCtrl(), CacheBlkInfoCtrl()
//#if REUSE_CU_RESULTS
// , BestEncInfoCache()
//#endif
// , SaveLoadEncInfoSbt()
// {
// m_skipThreshold = unsigned();
// m_encCfg = EncCfg();
// }
//
// EncModeCtrlMTnoRQT(const EncModeCtrlMTnoRQT& other)
// : EncModeCtrl(other)
// , CacheBlkInfoCtrl(other)
// ,
//#if REUSE_CU_RESULTS
// BestEncInfoCache(other)
// ,
//#endif
// SaveLoadEncInfoSbt(other)
// {
// m_skipThreshold = unsigned(other.m_skipThreshold);
//#if GDR_ENABLED
// m_encCfg = EncCfg(other.m_encCfg);
//#endif
// }
//END ALBERTO
virtual void create ( const EncCfg& cfg );
virtual void destroy ();
......
......@@ -48,6 +48,9 @@
#include "CommonLib/Unit.h"
#include "CommonLib/RdCost.h"
#include "EncReshape.h"
//ALBERTO
#include "EncModeCtrl.h"
//END ALBERTO
//! \ingroup EncoderLib
//! \{
......@@ -219,8 +222,12 @@ private:
ModeInfo() : mipFlg(false), mipTrFlg(false), mRefId(0), ispMod(ISPType::NONE), modeId(0) {}
ModeInfo(const bool mipf, const bool miptf, const int mrid, const ISPType ispm, const uint32_t mode)
: mipFlg(mipf), mipTrFlg(miptf), mRefId(mrid), ispMod(ispm), modeId(mode)
{
}
{}
//ALBERTO
ModeInfo(const ModeInfo& other)
: mipFlg(other.mipFlg), mipTrFlg(other.mipTrFlg), mRefId(other.mRefId), ispMod(other.ispMod), modeId(other.modeId)
{}
//END ALBERTO
bool operator==(const ModeInfo cmp) const { return (mipFlg == cmp.mipFlg && mipTrFlg == cmp.mipTrFlg && mRefId == cmp.mRefId && ispMod == cmp.ispMod && modeId == cmp.modeId); }
};
......@@ -408,7 +415,138 @@ protected:
int m_prevRunPosRDOQ [2][NUM_TRELLIS_STATE];
double m_stateCostRDOQ [2][NUM_TRELLIS_STATE];
public:
//ALBERTO
IntraSearch(const IntraSearch& other) : IntraPrediction(other)
{
EncModeCtrlMTnoRQT* pointer = (dynamic_cast<EncModeCtrlMTnoRQT*>(other.m_modeCtrl));
m_modeCtrl = other.m_modeCtrl ? new EncModeCtrlMTnoRQT(*pointer) : nullptr; //REVISAR M_MODE_CTRL COMPLETO ANTES DE CONTINUAR/////////////////////////////////////////////////////////////////
for (int i = 0; i < MAX_NUM_TBLOCKS; i++)
{
m_pSharedPredTransformSkip[i] = other.m_pSharedPredTransformSkip[i] ? new Pel(*other.m_pSharedPredTransformSkip[i]) : nullptr;
}
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;
m_saveCuCostInSCIPU = other.m_numCuInSCIPU;
for (int i = 0; i < NUM_INTER_CU_INFO_SAVE; i++)
{
m_cuAreaInSCIPU[i] = Area(m_cuAreaInSCIPU[i]);
m_cuCostInSCIPU[i] = double(m_cuCostInSCIPU[i]);
}
for (int i = 0; i < other.m_ispCandList.size(); i++)
{
ISPType ispType = static_cast<ISPType>(i);
static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> vecCopy;
for (int j = 0; j < other.m_ispCandList[ispType].size(); j++)
{
vecCopy.push_back(ModeInfo(other.m_ispCandList[ispType][j]));
}
m_ispCandList[ispType] = vecCopy;
}
m_regIntraRDListWithCosts = other.m_regIntraRDListWithCosts;
for (int i = 0; i < NUM_LFNST_NUM_PER_SET; i++)
{
m_ispTestedModes[i] = ISPTestedModesInfo(other.m_ispTestedModes[i]);
}
m_curIspLfnstIdx = other.m_curIspLfnstIdx;
for (int i = 0; i < NUM_LFNST_NUM_PER_SET; i++)
{
m_bestModeCostStore[i] = other.m_bestModeCostStore[i];
m_bestModeCostValid[i] = other.m_bestModeCostValid[i];
for (int j = 0; j < NUM_LUMA_MODE; j++)
{
m_modeCostStore[i][j] = other.m_modeCostStore[i][j];
m_savedRdModeList[i][j] = ModeInfo(other.m_savedRdModeList[i][j]);
}
m_savedNumRdModes[i] = other.m_savedNumRdModes[i];
}
for (int i = 0; i < 4 * NUM_LFNST_NUM_PER_SET * 2; i++)
{
for (int j = 0; j < FAST_UDI_MAX_RDMODE_NUM; j++)
{
m_savedRdModeFirstColorSpace[i][j] = ModeInfo(other.m_savedRdModeFirstColorSpace[i][j]);
m_savedBDPCMModeFirstColorSpace[i][j] = BdpcmMode(other.m_savedBDPCMModeFirstColorSpace[i][j]);
m_savedRdCostFirstColorSpace[i][j] = other.m_savedRdCostFirstColorSpace[i][j];
}
m_numSavedRdModeFirstColorSpace[i] = other.m_numSavedRdModeFirstColorSpace[i];
}
m_savedRdModeIdx = other.m_savedRdModeIdx;
m_tmpStorageCtu.createFromBuf(other.m_tmpStorageCtu);
m_colorTransResiBuf.createFromBuf(other.m_colorTransResiBuf);
m_savedRdModeListLFNST = other.m_savedRdModeListLFNST;
m_savedHadModeListLFNST = other.m_savedHadModeListLFNST;
m_savedNumRdModesLFNST = uint32_t(other.m_savedNumRdModesLFNST);
m_savedModeCostLFNST = other.m_savedModeCostLFNST;
m_savedHadListLFNST = other.m_savedHadListLFNST;
for (std::size_t i = 0; i < m_orgTUs.size(); ++i)
{
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_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_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;
m_bestEscape = other.m_bestEscape;
for (int i = 0; i < MAXPLTSIZE + 1; i++)
{
m_indexError[i] = other.m_indexError[i] ? new double(*other.m_indexError[i]) : nullptr;
}
m_minErrorIndexMap = other.m_minErrorIndexMap ? new uint8_t(*other.m_minErrorIndexMap) : nullptr;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < NUM_TRELLIS_STATE; j++)
{
for (int k = 0; k < 2 * MAX_CU_BLKSIZE_PLT; k++)
{
m_indexMapRDOQ[i][j][k] = uint8_t(other.m_indexMapRDOQ[i][j][k]);
m_runMapRDOQ[i][j][k] = other.m_runMapRDOQ[i][j][k];
}
m_prevRunTypeRDOQ[i][j] = other.m_prevRunTypeRDOQ[i][j];
m_prevRunPosRDOQ[i][j] = other.m_prevRunPosRDOQ[i][j];
m_stateCostRDOQ[i][j] = other.m_stateCostRDOQ[i][j];
}
}
for (int i = 0; i < NUM_TRELLIS_STATE; i++)
{
m_statePtRDOQ[i] = other.m_statePtRDOQ[i] ? new uint8_t(*other.m_statePtRDOQ[i]) : nullptr;
}
}
//END ALBERTO
IntraSearch();
~IntraSearch();
......
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