Commit f502dc46 authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit nº 3 (06-03-2023)

```---------------------------------------------------------
Continuación del método copia de EncCu para EncSlice.cpp. Se han copiado todos los atributos usando constructores ya implementados en cada clase.
```

---------------------------------------------------------
Queda comprobar el funcionamiento de sus constructores para evitar que los objetos internos compartan referencias en memoria.
parent 9ecea4bd
...@@ -6103,20 +6103,107 @@ EncCu EncCu::copy(EncCu& original) ...@@ -6103,20 +6103,107 @@ EncCu EncCu::copy(EncCu& original)
copy.m_ctxBuffer = m_ctxBufferCopy; copy.m_ctxBuffer = m_ctxBufferCopy;
if (original.m_CurrCtx != NULL) /*Puede ser nulo*/ if (original.m_CurrCtx != NULL) /*Puede ser nulo*/
{ {
CtxPair m_CurrCtxCopy(*original.m_CurrCtx); CtxPair* m_CurrCtxCopy = new CtxPair(*original.m_CurrCtx);
copy.m_CurrCtx = &m_CurrCtxCopy; copy.m_CurrCtx = m_CurrCtxCopy;
} }
else { else {
copy.m_CurrCtx = NULL; copy.m_CurrCtx = NULL;
} }
CtxPool m_ctxPoolCopy(*original.m_ctxPool); CtxPool* m_ctxPoolCopy = new CtxPool(*original.m_ctxPool);
copy.m_ctxPool = &m_ctxPoolCopy; copy.m_ctxPool = m_ctxPoolCopy;
copy.m_cuChromaQpOffsetIdxPlus1 = original.m_cuChromaQpOffsetIdxPlus1; copy.m_cuChromaQpOffsetIdxPlus1 = original.m_cuChromaQpOffsetIdxPlus1;
XuPool m_unitPoolCopy(original.m_unitPool); XuPool m_unitPoolCopy(original.m_unitPool);
copy.m_unitPool = m_unitPoolCopy; copy.m_unitPool = m_unitPoolCopy;
PelUnitBufPool m_pelUnitBufPoolCopy(original.m_pelUnitBufPool);
copy.m_pelUnitBufPool = m_pelUnitBufPoolCopy;
CodingStructure*** m_pTempCSCopy = new CodingStructure**;
*m_pTempCSCopy = new CodingStructure*;
**m_pTempCSCopy = **original.m_pTempCS; // Copia los datos del objeto apuntado por m_pTempCS en la nueva variable
copy.m_pTempCS = m_pTempCSCopy;
CodingStructure*** m_pBestCSCopy = new CodingStructure**;
*m_pBestCSCopy = new CodingStructure*;
**m_pBestCSCopy = **original.m_pBestCS; // Copia los datos del objeto apuntado por m_pBestCS en la nueva variable
copy.m_pBestCS = m_pBestCSCopy;
CodingStructure*** m_pTempCS2Copy = new CodingStructure**;
*m_pTempCS2Copy = new CodingStructure*;
**m_pTempCS2Copy = **original.m_pTempCS2; // Copia los datos del objeto apuntado por m_pTempCS2 en la nueva variable
copy.m_pTempCS2 = m_pTempCS2Copy;
CodingStructure*** m_pBestCS2Copy = new CodingStructure**;
*m_pBestCS2Copy = new CodingStructure*;
**m_pBestCS2Copy = **original.m_pBestCS2; // Copia los datos del objeto apuntado por m_pBestCS2 en la nueva variable
copy.m_pBestCS2 = m_pBestCS2Copy;
EncCfg* m_pcEncCfgCopy = new EncCfg(*original.m_pcEncCfg);
copy.m_pcEncCfg = m_pcEncCfgCopy;
IntraSearch* m_pcIntraSearchCopy = new IntraSearch(*original.m_pcIntraSearch);
copy.m_pcIntraSearch = m_pcIntraSearchCopy;
InterSearch* m_pcInterSearchCopy = new InterSearch(*original.m_pcInterSearch);
copy.m_pcInterSearch = m_pcInterSearchCopy;
TrQuant* m_pcTrQuantCopy = new TrQuant(*original.m_pcTrQuant);
copy.m_pcTrQuant = m_pcTrQuantCopy;
RdCost* m_pcRdCostCopy = new RdCost(*original.m_pcRdCost);
copy.m_pcRdCost = m_pcRdCostCopy;
EncSlice* m_pcSliceEncoderCopy = new EncSlice(*original.m_pcSliceEncoder);
copy.m_pcSliceEncoder = m_pcSliceEncoderCopy;
DeblockingFilter* m_deblockingFilterCopy = new DeblockingFilter(*original.m_deblockingFilter);
copy.m_deblockingFilter = m_deblockingFilterCopy;
CABACWriter* m_CABACEstimatorCopy = new CABACWriter(*original.m_CABACEstimator);
copy.m_CABACEstimator = m_CABACEstimatorCopy;
RateCtrl* m_pcRateCtrlCopy = new RateCtrl(*original.m_pcRateCtrl);
copy.m_pcRateCtrl = m_pcRateCtrlCopy;
IbcHashMap* m_ibcHashMapCopy = new IbcHashMap(original.m_ibcHashMap);
copy.m_ibcHashMap = *m_ibcHashMapCopy;
EncModeCtrlMTnoRQT* m_modeCtrlDerived = dynamic_cast<EncModeCtrlMTnoRQT*>(original.m_modeCtrl); //Downcasting
EncModeCtrl* m_modeCtrlCopy = new EncModeCtrlMTnoRQT(*m_modeCtrlDerived); //Upcasting
copy.m_modeCtrl = m_modeCtrlCopy;
FastGeoCostList* m_geoCostListCopy = new FastGeoCostList(original.m_geoCostList);
copy.m_geoCostList = *m_geoCostListCopy;
copy.m_AFFBestSATDCost = original.m_AFFBestSATDCost;
copy.m_mergeBestSATDCost = original.m_mergeBestSATDCost;
for (int i = 0; i < (MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1); i++)
{
copy.m_SubPuMiBuf[i] = *new MotionInfo(original.m_SubPuMiBuf[i]); //obtenemos el original, creamos nuevo y asignamos contenido al array copia
}
copy.m_ctuIbcSearchRangeX = original.m_ctuIbcSearchRangeX;
copy.m_ctuIbcSearchRangeY = original.m_ctuIbcSearchRangeY;
copy.m_bestBcwIdx = original.m_bestBcwIdx;
copy.m_bestBcwCost = original.m_bestBcwCost;
//static const MergeIdxPair m_geoModeTest[GEO_MAX_NUM_CANDS];
for (int i = 0; i < 2; i++) {
copy.m_sbtCostSave[i] = original.m_sbtCostSave[i];
}
GeoComboCostList* m_comboListCopy = new GeoComboCostList(original.m_comboList);
copy.m_comboList = *m_comboListCopy;
MergeItemList* m_mergeItemListCopy = new MergeItemList(original.m_mergeItemList);
copy.m_mergeItemList = *m_mergeItemListCopy;
//@TODO //@TODO
return copy; return copy;
......
...@@ -233,17 +233,17 @@ public: ...@@ -233,17 +233,17 @@ public:
Ctx best; Ctx best;
}; };
std::vector<CtxPair> m_ctxBuffer; //copy checked std::vector<CtxPair> m_ctxBuffer; //copy
CtxPair* m_CurrCtx; //copy not checked because null CtxPair* m_CurrCtx; //copy
CtxPool *m_ctxPool; //copy checked CtxPool *m_ctxPool; //copy
// Data : encoder control // Data : encoder control
int m_cuChromaQpOffsetIdxPlus1; // if 0, then cu_chroma_qp_offset_flag will be 0, otherwise cu_chroma_qp_offset_flag will be 1. copy checked int m_cuChromaQpOffsetIdxPlus1; // if 0, then cu_chroma_qp_offset_flag will be 0, otherwise cu_chroma_qp_offset_flag will be 1. copy checked
XuPool m_unitPool; //copy not XuPool m_unitPool; //copy
PelUnitBufPool m_pelUnitBufPool; PelUnitBufPool m_pelUnitBufPool;//copy
CodingStructure ***m_pTempCS; CodingStructure ***m_pTempCS; //copy
CodingStructure ***m_pBestCS; CodingStructure ***m_pBestCS;
CodingStructure ***m_pTempCS2; CodingStructure ***m_pTempCS2;
CodingStructure ***m_pBestCS2; CodingStructure ***m_pBestCS2;
......
...@@ -1895,10 +1895,11 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons ...@@ -1895,10 +1895,11 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
{ {
//ALBERTO //ALBERTO
EncCu m_pcCuEncoder_copy = m_pcCuEncoder->copy(*m_pcCuEncoder); EncCu m_pcCuEncoder_copy = m_pcCuEncoder->copy(*m_pcCuEncoder);
bool stopDebugger1 = true;
//END ALBERTO //END ALBERTO
m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP); m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP);
bool stopDebugger = true; bool stopDebugger2 = true;
#if GREEN_METADATA_SEI_ENABLED #if GREEN_METADATA_SEI_ENABLED
FeatureCounterStruct m_featureCounter = pcPic->getFeatureCounter(); FeatureCounterStruct m_featureCounter = pcPic->getFeatureCounter();
countFeatures(m_featureCounter, cs,ctuArea); countFeatures(m_featureCounter, cs,ctuArea);
......
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