From 02f25974ef3db1af53de44e10c5aceafeb2b7860 Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Date: Wed, 8 Mar 2023 14:57:52 +0100 Subject: [PATCH] =?UTF-8?q?Commit=20n=C2=BA=205=20(08-03-2023)=20---------?= =?UTF-8?q?------------------------------------------------=20Revisados=20?= =?UTF-8?q?los=20constructores=20de=20copia=20hasta=20PelUnitBufPool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------------------------------------------------------ --- source/Lib/CommonLib/Buffer.h | 15 +++++++++++++++ source/Lib/CommonLib/CodingStructure.cpp | 1 + source/Lib/CommonLib/Contexts.cpp | 3 +++ source/Lib/CommonLib/TypeDef.h | 10 ++++++++++ source/Lib/EncoderLib/EncCu.cpp | 11 ++--------- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index 646b130..da435e2 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -1080,6 +1080,21 @@ private: public: PelUnitBufPool(); + PelUnitBufPool(const PelUnitBufPool& other) + : m_pelStoragePool(other.m_pelStoragePool) + , m_pelUnitBufPool(other.m_pelUnitBufPool) + , m_chromaFormat(other.m_chromaFormat) + , m_ctuArea(other.m_ctuArea) + { + m_pelStoragePool = Pool(other.m_pelStoragePool); + m_pelUnitBufPool = Pool(other.m_pelUnitBufPool); + for (auto& kv: other.m_map) + { + m_map[kv.first] = m_pelStoragePool.get(); // hacer una copia profunda de la PelStorage + m_map[kv.first]->copyFrom(*kv.second); + } + } + ~PelUnitBufPool(); void initPelUnitBufPool(ChromaFormat chromaFormat, int ctuWidth, int ctuHeight); diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 3746076..d62bc87 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -95,6 +95,7 @@ CodingStructure::CodingStructure(XuPool &xuPool) firstColorSpaceTestOnly = false; } + void CodingStructure::destroy() { picture = nullptr; diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index 9cea8e5..53429fc 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -959,5 +959,8 @@ Ctx::Ctx(const BinProbModel_Std *dummy) : m_bpmType(BpmType::STD), m_CtxStore_St Ctx::Ctx(const Ctx &ctx) : m_bpmType(ctx.m_bpmType), m_CtxStore_Std(ctx.m_CtxStore_Std) { ::memcpy( m_GRAdaptStats, ctx.m_GRAdaptStats, sizeof( unsigned ) * RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS ); + //ALBERTO + m_baseLevel = ctx.m_baseLevel; + //END ALBERTO } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 8138baa..50dc7da 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -1408,6 +1408,16 @@ template class Pool std::vector m_items; public: + ////ALBERTO + Pool() = default; + Pool(const Pool& other) + { + for (auto& item : other.m_items) + { + m_items.push_back(new T(*item)); + } + } + ////END ALBERTO ~Pool() { deleteEntries(); } void deleteEntries() diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 4744191..fc0aaca 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -6105,13 +6105,6 @@ EncCu EncCu::copy(EncCu& original) /*COPIAMOS VECTOR QUE CONTIENE CTXPAIR*/ std::vector m_ctxBufferCopy(original.m_ctxBuffer.size()); - for (size_t i = 0; i < original.m_ctxBuffer.size(); i++) - { - CtxPair newCtxPair; - newCtxPair.start = Ctx(original.m_ctxBuffer[i].start); - newCtxPair.best = Ctx(original.m_ctxBuffer[i].best); - m_ctxBufferCopy[i] = newCtxPair; - } copy.m_ctxBuffer = m_ctxBufferCopy; /*COPIAMOS PUNTERO CTXPAIR*/ @@ -6130,10 +6123,10 @@ EncCu EncCu::copy(EncCu& original) copy.m_cuChromaQpOffsetIdxPlus1 = original.m_cuChromaQpOffsetIdxPlus1; /*COPIAMOS OBJETO XUPOOL*/ - copy.m_unitPool = *(new XuPool(original.m_unitPool)); + copy.m_unitPool = XuPool(original.m_unitPool); /*COPIAMOS OBJETO PelUnitBufPool*/ - copy.m_pelUnitBufPool = *(new PelUnitBufPool(original.m_pelUnitBufPool)); + copy.m_pelUnitBufPool = PelUnitBufPool(original.m_pelUnitBufPool); /*COPIAMOS PUNTEROS TRIPLES CODINGSTRUCTURE*/ CodingStructure*** m_pTempCSCopy = new CodingStructure**; -- 2.24.1