From 526f22324700725dc8087b167c8f5803e74e4ea4 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Date: Sat, 11 Mar 2023 03:55:10 +0100 Subject: [PATCH] =?UTF-8?q?Commit=20n=C2=BA=209=20(11-03-2023)=20<->=203:5?= =?UTF-8?q?4=20AM=20------------------------------------------------------?= =?UTF-8?q?------=20Revisar=20constructir=20de=20copia=20de=20IntraSearch?= =?UTF-8?q?=20->=20CodingStructure=20->=20prevPLT=20=3D=20*new=20PLTBuf(ot?= =?UTF-8?q?her.prevPLT);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------------------------------------------------------ Objetivo Terminar constructor de copia de IntraSearch --- source/Lib/CommonLib/CodingStructure.h | 102 +++++++++++++++++-- source/Lib/EncoderLib/EncModeCtrl.cpp | 2 + source/Lib/EncoderLib/IntraSearch.h | 130 +++++++++++++++++++++++-- 3 files changed, 217 insertions(+), 17 deletions(-) diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index 8c5b8fb..cd418b0 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -83,8 +83,9 @@ public: Picture *picture; CodingStructure *parent; CodingStructure *bestCS; - Slice *slice; - + //ALBERTO + Slice *slice = nullptr; + //END ALBERTO UnitScale unitScale[MAX_NUM_COMPONENT]; int baseQP; @@ -92,16 +93,96 @@ public: EnumArray currQP; int chromaQpAdj; - const SPS *sps; - const PPS *pps; + //ALBERTO + const SPS *sps = nullptr; + const PPS *pps = nullptr; + //END ALBERTO PicHeader *picHeader; APS* alfApss[ALF_CTB_MAX_NUM_APS]; - APS * lmcsAps; - APS * scalinglistAps; - const VPS *vps; - const PreCalcValues* pcv; + //ALBERTO + APS * lmcsAps = nullptr; + APS * scalinglistAps = nullptr; + const VPS *vps = nullptr; + const PreCalcValues* pcv = nullptr; + //END ALBERTO + CodingStructure(XuPool &); + //ALBERTO + CodingStructure(const CodingStructure& other) + : area(other.area) + //, picture(other.picture ? new Picture(*other.picture) : nullptr) + , parent(other.parent ? new CodingStructure(*other.parent) : nullptr) + , bestCS(other.bestCS ? new CodingStructure(*other.bestCS) : nullptr) + , slice(other.slice ? new Slice(*other.slice) : nullptr) + , baseQP(other.baseQP) + , prevQP(other.prevQP) + , currQP(other.currQP) + , chromaQpAdj(other.chromaQpAdj) + , sps(other.sps ? new SPS(*other.sps) : nullptr) + , pps(other.pps ? new PPS(*other.pps) : nullptr) + , picHeader(other.picHeader ? new PicHeader(*other.picHeader) : nullptr) + , lmcsAps(other.lmcsAps ? new APS(*other.lmcsAps) : nullptr) + , scalinglistAps(other.scalinglistAps ? new APS(*other.scalinglistAps) : nullptr) + , vps(other.vps ? new VPS(*other.vps) : nullptr) + , pcv(other.pcv ? new PreCalcValues(*other.pcv) : nullptr) + , cus(other.cus) + , pus(other.pus) + , tus(other.tus) + , motionLut(other.motionLut) + , m_isTuEnc(other.m_isTuEnc) + , m_cuIdx(other.m_cuIdx) + , m_puIdx(other.m_puIdx) + , m_tuIdx(other.m_tuIdx) + , m_isDecomp(other.m_isDecomp) + , m_numCUs(other.m_numCUs) + , m_numPUs(other.m_numPUs) + , m_numTUs(other.m_numTUs) + , m_cuPool(other.m_cuPool) + , m_puPool(other.m_puPool) + , m_tuPool(other.m_tuPool) + , m_sao(other.m_sao) + , m_pred(other.m_pred) + , m_resi(other.m_resi) + , m_reco(other.m_reco) + , m_orgr(other.m_orgr) + , m_runType(other.m_runType) + , m_motionBuf(other.m_motionBuf ? new MotionInfo(*other.m_motionBuf) : nullptr) + , bestParent(other.bestParent ? new CodingStructure(*other.bestParent) : nullptr) + , tmpColorSpaceCost(other.tmpColorSpaceCost) + , firstColorSpaceSelected(other.firstColorSpaceSelected) + , firstColorSpaceTestOnly(other.firstColorSpaceTestOnly) + , resetIBCBuffer(other.resetIBCBuffer) + , features(other.features) + , splitRdCostBest(other.splitRdCostBest? new double(*other.splitRdCostBest):nullptr) + , useDbCost(other.useDbCost) + , costDbOffset(other.costDbOffset) + , lumaCost(other.lumaCost) + , fracBits(other.fracBits) + , dist(other.dist) + , interHad(other.interHad) + , treeType(other.treeType) + , modeType(other.modeType) + { + for (int i = 0; i < MAX_NUM_COMPONENT; i++) + { + unitScale[i] = UnitScale(other.unitScale[i]); + m_coeffs[i] = other.m_coeffs[i] ? new TCoeff(*other.m_coeffs[i]) : nullptr; + m_pcmbuf[i] = other.m_pcmbuf[i] ? new Pel(*other.m_pcmbuf[i]) : nullptr; + m_offsets[i] = other.m_offsets[i]; + } + for (int i = 0; i < ALF_CTB_MAX_NUM_APS; i++) + { + alfApss[i] = other.alfApss[i]; + } + for (int i = 0; i < 2; i++) + { + tmpColorSpaceIntraCost[i] = other.tmpColorSpaceIntraCost[i]; + } + prevPLT = *new PLTBuf(other.prevPLT); + } + //END ALBERTO + void create(const UnitArea &_unit, const bool isTopLayer, const bool isPLTused); void create(const ChromaFormat &_chromaFormat, const Area& _area, const bool isTopLayer, const bool isPLTused); @@ -189,8 +270,9 @@ public: // --------------------------------------------------------------------------- static_vector features; - - double *splitRdCostBest; //[Partition::NUM_PART_SPLIT]; + //ALBERTO + double *splitRdCostBest = nullptr; //[Partition::NUM_PART_SPLIT]; + //END ALBERTO double cost; bool useDbCost; double costDbOffset; diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 3b1b704..4a8d83b 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1078,8 +1078,10 @@ EncModeCtrlMTnoRQT::EncModeCtrlMTnoRQT(const EncModeCtrlMTnoRQT& other) : m_encCfg(other.m_encCfg) , m_skipThreshold(other.m_skipThreshold) , EncModeCtrl(other) + /////////////////////CONTINUAR/////////////////////////// , CacheBlkInfoCtrl(other) , SaveLoadEncInfoSbt(other), BestEncInfoCache(other) + ////////////////////CONTINUAR//////////////////////////// { } diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h index 1f8fa97..370ec18 100644 --- a/source/Lib/EncoderLib/IntraSearch.h +++ b/source/Lib/EncoderLib/IntraSearch.h @@ -246,6 +246,11 @@ private: double rdCost; ISPTestedModeInfo() {} + ISPTestedModeInfo(const ISPTestedModeInfo& other) + { + numCompSubParts=other.numCompSubParts; + rdCost = other.rdCost; + } void setMode(int numParts, double cost) { @@ -416,14 +421,125 @@ public: //ALBERTO IntraSearch(IntraSearch& other) : m_modeCtrl((EncModeCtrl*) new EncModeCtrlMTnoRQT(*dynamic_cast(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_unitPool(other.m_unitPool) + , m_saveCuCostInSCIPU(other.m_saveCuCostInSCIPU) + , m_numCuInSCIPU(other.m_numCuInSCIPU) + , m_ispCandList(other.m_ispCandList) + , m_regIntraRDListWithCosts(other.m_regIntraRDListWithCosts) + , m_curIspLfnstIdx(other.m_curIspLfnstIdx) + , m_savedRdModeIdx(m_savedRdModeIdx) + , m_savedRdModeListLFNST(other.m_savedRdModeListLFNST) + , m_savedHadModeListLFNST(other.m_savedHadModeListLFNST) + , m_savedNumRdModesLFNST(other.m_savedNumRdModesLFNST) + , m_savedModeCostLFNST(other.m_savedModeCostLFNST) + , m_savedHadListLFNST(other.m_savedHadListLFNST) + , m_tmpStorageCtu(other.m_tmpStorageCtu) + , m_colorTransResiBuf(other.m_colorTransResiBuf) + , m_pcEncCfg(new EncCfg(*other.m_pcEncCfg)) + , m_pcTrQuant(new TrQuant(*other.m_pcTrQuant)) + , m_pcRdCost(new RdCost(*other.m_pcRdCost)) + , m_pcReshape(new EncReshape(*other.m_pcReshape)) + , m_CABACEstimator(new CABACWriter(*other.m_CABACEstimator)) + , m_ctxPool(new CtxPool(*other.m_ctxPool)) + , m_isInitialized(other.m_isInitialized) + , m_bestEscape(other.m_bestEscape) + , m_minErrorIndexMap(other.m_minErrorIndexMap?new uint8_t(*other.m_minErrorIndexMap):nullptr) + { + //if (other.m_pSplitCS) { + // m_pSplitCS = new CodingStructure***; + // *m_pSplitCS = new CodingStructure**; + // **m_pSplitCS = new CodingStructure*; + // ***m_pSplitCS = ***other.m_pSplitCS; + //} + //if (other.m_pFullCS) { + // m_pFullCS = new CodingStructure***; + // *m_pFullCS = new CodingStructure**; + // **m_pFullCS = new CodingStructure*; + // ***m_pFullCS = ***other.m_pFullCS; + //} + //if (other.m_pTempCS) { + // m_pTempCS = new CodingStructure**; + // *m_pTempCS = new CodingStructure*; + // **m_pTempCS = **other.m_pTempCS; //} + //if (other.m_pBestCS) { + // m_pBestCS = new CodingStructure**; + // *m_pBestCS = new CodingStructure*; + // **m_pBestCS = **other.m_pBestCS; + //} + if (other.m_pSaveCS) { + m_pSaveCS = new CodingStructure*; + *m_pSaveCS = new CodingStructure(**other.m_pSaveCS); + } + for (int i = 0; i < MAX_NUM_TBLOCKS; i++) + { + m_pSharedPredTransformSkip[i] = new Pel(*other.m_pSharedPredTransformSkip[i]); + } + for (int i = 0; i < NUM_INTER_CU_INFO_SAVE; i++) + { + m_cuAreaInSCIPU[i] = Area(other.m_cuAreaInSCIPU[i]); + } + for (int i = 0; i < NUM_INTER_CU_INFO_SAVE; i++) + { + m_cuCostInSCIPU[i] = other.m_cuCostInSCIPU[i]; + } + for (int i = 0; i < NUM_LFNST_NUM_PER_SET; i++) + { + m_ispTestedModes[i] = ISPTestedModesInfo(other.m_ispTestedModes[i]); + } + std::copy(other.m_bestModeCostStore, other.m_bestModeCostStore + NUM_LFNST_NUM_PER_SET, m_bestModeCostStore); + std::copy(other.m_bestModeCostValid, other.m_bestModeCostValid + NUM_LFNST_NUM_PER_SET, m_bestModeCostValid); + for (int i = 0; i < NUM_LFNST_NUM_PER_SET; i++) + { + std::copy(other.m_modeCostStore[i], other.m_modeCostStore[i] + NUM_LUMA_MODE, m_modeCostStore[i]); + } + for (int i = 0; i < NUM_LFNST_NUM_PER_SET; i++) + { + for (int j = 0; j < NUM_LUMA_MODE; j++) + { + m_savedRdModeList[i][j] = other.m_savedRdModeList[i][j]; + } + } + std::copy(other.m_savedNumRdModes, other.m_savedNumRdModes + NUM_LFNST_NUM_PER_SET, m_savedNumRdModes); + 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]); + } + } + 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_savedBDPCMModeFirstColorSpace[i][j] = BdpcmMode(other.m_savedBDPCMModeFirstColorSpace[i][j]); + } + } + 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_savedRdCostFirstColorSpace[i][j] = double(other.m_savedRdCostFirstColorSpace[i][j]); + } + } + std::copy(other.m_numSavedRdModeFirstColorSpace, other.m_numSavedRdModeFirstColorSpace + 4 * NUM_LFNST_NUM_PER_SET * 2, m_numSavedRdModeFirstColorSpace); + for (const auto& tu: other.m_orgTUs) + { + m_orgTUs.push_back(new TransformUnit(*tu)); + } + for (int i = 0; i < MAXPLTSIZE + 1; i++) + { + m_indexError[i] = other.m_indexError[i] ? new double(*other.m_indexError[i]) : nullptr; + } + std::copy(&other.m_indexMapRDOQ[0][0][0], &other.m_indexMapRDOQ[2][NUM_TRELLIS_STATE][2 * MAX_CU_BLKSIZE_PLT],&m_indexMapRDOQ[0][0][0]); + std::copy(&other.m_runMapRDOQ[0][0][0], &other.m_runMapRDOQ[2][NUM_TRELLIS_STATE][2 * MAX_CU_BLKSIZE_PLT],&m_runMapRDOQ[0][0][0]); + for (int i = 0; i < NUM_TRELLIS_STATE; i++) + { + m_statePtRDOQ[i] = other.m_statePtRDOQ[i]? new uint8_t(*other.m_statePtRDOQ[i]) : nullptr; + } + std::copy(&other.m_prevRunTypeRDOQ[0][0], &other.m_prevRunTypeRDOQ[2][NUM_TRELLIS_STATE], &m_prevRunTypeRDOQ[0][0]); + std::copy(&other.m_prevRunPosRDOQ[0][0], &other.m_prevRunPosRDOQ[2][NUM_TRELLIS_STATE], &m_prevRunPosRDOQ[0][0]); + std::copy(&other.m_stateCostRDOQ[0][0], &other.m_stateCostRDOQ[2][NUM_TRELLIS_STATE], &m_stateCostRDOQ[0][0]); } //END ALBERTO ~IntraSearch(); -- 2.24.1