diff --git a/source/Lib/CommonLib/Buffer.h b/source/Lib/CommonLib/Buffer.h index ac059e366f5e977251ddaf3594ad4110b63d4c8d..48217367a254f9a64f60ac36879c5d4449bdf92e 100644 --- a/source/Lib/CommonLib/Buffer.h +++ b/source/Lib/CommonLib/Buffer.h @@ -121,11 +121,12 @@ struct AreaBuf : public Size ptrdiff_t stride; // the proper type causes awful lot of errors //ptrdiff_t stride; - //ALBERTO - AreaBuf(const AreaBuf& other) : Size(other), buf(other.buf), stride(other.stride) {} + AreaBuf(const AreaBuf& other) : Size(other.width, other.height), stride(other.stride), buf(other.buf) + { + //////////////////////buf = new T(*other.buf) + } //END ALBERTO - AreaBuf() : Size(), buf(nullptr), stride(0) {} AreaBuf( T *_buf, const Size &size ) : Size( size ), buf( _buf ), stride( size.width ) { } AreaBuf(T *_buf, const ptrdiff_t &_stride, const Size &size) : Size(size), buf(_buf), stride(_stride) {} @@ -751,8 +752,13 @@ struct UnitBuf UnitBufBuffers bufs; //ALBERTO - UnitBuf(const UnitBuf& other) : chromaFormat(other.chromaFormat), bufs(other.bufs) - {} + UnitBuf(const UnitBuf& other) : chromaFormat(other.chromaFormat), bufs(other.bufs.size()) + { + for (int i = 0; i < other.bufs.size(); ++i) + { + bufs[i] = AreaBuf(other.bufs[i]); // Copiamos cada elemento de la original en la nueva instancia + } + } //END ALBERTO diff --git a/source/Lib/CommonLib/Reshape.cpp b/source/Lib/CommonLib/Reshape.cpp index b6fc2e39c8831ea7debd87d7721495cf2dea0fcb..d928c23aa161c7814c631005e2841cb020a68263 100644 --- a/source/Lib/CommonLib/Reshape.cpp +++ b/source/Lib/CommonLib/Reshape.cpp @@ -56,6 +56,29 @@ Reshape::Reshape() { } +//ALBERTO +Reshape::Reshape(const Reshape& other) + : m_sliceReshapeInfo(other.m_sliceReshapeInfo) + , m_ctuFlag(other.m_ctuFlag) + , m_recReshaped(other.m_recReshaped) + , m_invLUT(other.m_invLUT) + , m_fwdLUT(other.m_fwdLUT) + , m_chromaAdjHelpLUT(other.m_chromaAdjHelpLUT) + , m_binCW(other.m_binCW) + , m_initCW(other.m_initCW) + , m_reshape(other.m_reshape) + , m_reshapePivot(other.m_reshapePivot) + , m_inputPivot(other.m_inputPivot) + , m_fwdScaleCoef(other.m_fwdScaleCoef) + , m_invScaleCoef(other.m_invScaleCoef) + , m_lumaBD(other.m_lumaBD) + , m_reshapeLUTSize(other.m_reshapeLUTSize) + , m_chromaScale(other.m_chromaScale) + , m_vpduX(other.m_vpduX) + , m_vpduY(other.m_vpduY) + {} +// END ALBERTO + Reshape::~Reshape() { } diff --git a/source/Lib/CommonLib/Reshape.h b/source/Lib/CommonLib/Reshape.h index ade245c94b5e3d76ea737c9ac315662a95e1a638..77df571d78a8bc2662ff1adf3d7e8310ce5e6d6f 100644 --- a/source/Lib/CommonLib/Reshape.h +++ b/source/Lib/CommonLib/Reshape.h @@ -72,6 +72,9 @@ protected: int m_vpduY; public: Reshape(); + //ALBERTO + Reshape(const Reshape& other); + //END ALBERTO ~Reshape(); void createDec(int bitDepth); diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 774fa03619c2c14d379c37b22e120e7fe04866ec..7f5dda9f597934588602efa76bdaa1efe0154739 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -165,6 +165,26 @@ public: int reshaperModelBinCWDelta[PIC_CODE_CW_BINS]; int maxNbitsNeededDeltaCW; int chrResScalingOffset; + + //ALBERTO + SliceReshapeInfo() {} + + SliceReshapeInfo(const SliceReshapeInfo& other) + : sliceReshaperEnableFlag(other.sliceReshaperEnableFlag) + , sliceReshaperModelPresentFlag(other.sliceReshaperModelPresentFlag) + , enableChromaAdj(other.enableChromaAdj) + , reshaperModelMinBinIdx(other.reshaperModelMinBinIdx) + , reshaperModelMaxBinIdx(other.reshaperModelMaxBinIdx) + , maxNbitsNeededDeltaCW(other.maxNbitsNeededDeltaCW) + , chrResScalingOffset(other.chrResScalingOffset) + { + for (size_t i = 0; i < PIC_CODE_CW_BINS; ++i) + { + reshaperModelBinCWDelta[i] = other.reshaperModelBinCWDelta[i]; + } + } + //END ALBERTO + void setUseSliceReshaper(bool b) { sliceReshaperEnableFlag = b; } bool getUseSliceReshaper() const { return sliceReshaperEnableFlag; } void setSliceReshapeModelPresentFlag(bool b) { sliceReshaperModelPresentFlag = b; } diff --git a/source/Lib/CommonLib/TrQuant.h b/source/Lib/CommonLib/TrQuant.h index 9c772e2003e1dafec153c58ceb2226d0c5eac41d..0554f8cf996e9457be28ae440c39cce28e553e95 100644 --- a/source/Lib/CommonLib/TrQuant.h +++ b/source/Lib/CommonLib/TrQuant.h @@ -68,6 +68,21 @@ public: TrQuant(); ~TrQuant(); + //ALBERTO + TrQuant::TrQuant(const TrQuant& other) + { + m_quant = new DepQuant(*other.m_quant); + std::memcpy(m_tempCoeff, other.m_tempCoeff, sizeof(m_tempCoeff)); + m_mtsCoeffs = other.m_mtsCoeffs; + std::memcpy(m_tempInMatrix, other.m_tempInMatrix, sizeof(m_tempInMatrix)); + std::memcpy(m_tempOutMatrix, other.m_tempOutMatrix, sizeof(m_tempOutMatrix)); + std::memcpy(m_invICTMem, other.m_invICTMem, sizeof(m_invICTMem)); + std::memcpy(m_fwdICTMem, other.m_fwdICTMem, sizeof(m_fwdICTMem)); + m_invICT = other.m_invICT; + m_fwdICT = other.m_fwdICT; + } + //END ALBERTO + // initialize class void init ( const Quant* otherQuant, diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index c524f0adda12232f52dd33cb78161941c2555aa1..17e00b108b7a9edd83908103c4267d207def73e4 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -1308,13 +1308,13 @@ public: static constexpr size_type max_num_elements = N; //ALBERTO - static_vector(const static_vector& other) : _size(other._size) - { - for (size_t i = 0; i < _size; ++i) - { - _arr[i] = T(other._arr[i]); - } - } + //static_vector(const static_vector& other) : _size(other._size) + //{ + // for (size_t i = 0; i < _size; ++i) + // { + // _arr[i] = T(other._arr[i]); + // } + //} //END ALBERTO static_vector() : _size( 0 ) { } static_vector( size_t N_ ) : _size( N_ ) { } diff --git a/source/Lib/DecoderLib/DecCu.h b/source/Lib/DecoderLib/DecCu.h index 5aeb972ba62025f46cbd99c1300a02c181869863..d72ce0b0d42942e15dec69fb9aa20a47d11627b8 100644 --- a/source/Lib/DecoderLib/DecCu.h +++ b/source/Lib/DecoderLib/DecCu.h @@ -74,7 +74,7 @@ public: for (int i = 0; i < (MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1); i++) { - m_SubPuMiBuf[i] = other.m_SubPuMiBuf[i]; + m_SubPuMiBuf[i] = MotionInfo(other.m_SubPuMiBuf[i]); } } //END ALBERTO diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 30f6018d5b2538e2beeda7a97eb2a869a3ff1c57..38696b9053e86c793aec6864a3d4a565213ed6a0 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -53,6 +53,10 @@ #include #include +//ALBERTO +#include +//END ALBERTO + //! \ingroup EncoderLib //! \{ @@ -614,6 +618,11 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS, void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Partitioner& partitioner, double maxCostAllowed ) { + //ALBERTO + iter += 1; + int iterLocal = iter; + auto start = std::chrono::high_resolution_clock::now(); + //END ALBERTO CHECK(maxCostAllowed < 0, "Wrong value of maxCostAllowed!"); uint32_t compBegin; @@ -1174,6 +1183,18 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par CHECK( bestCS->cus.empty() , "No possible encoding found" ); CHECK( bestCS->cus[0]->predMode == NUMBER_OF_PREDICTION_MODES, "No possible encoding found" ); CHECK( bestCS->cost == MAX_DOUBLE , "No possible encoding found" ); + + //ALBERTO + if (iterLocal == 1) + { + auto end = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(end - start); + auto before = seconds; + seconds += static_cast(duration.count() / 1000); + std::cout << "La iter " << iter << " de la func tarda " << static_cast(duration.count() / 1000) << " + " << before << " = " << seconds << " segundos en ejecutarse." << std::endl; + iter = 0; + } + //END ALBERTO } #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index d787168c9ac802ca36643feffb10555082d79869..15e709092757ce6c1c0b852e2c2653b692ddd775 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -226,6 +226,10 @@ class EncCu : DecCu { private: + //ALBERTO + static int iter; + static int seconds; + //END ALBERTO bool m_bestModeUpdated; struct CtxPair { diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index 1b9d4c9f44f7fe3a9e0df16b03e5af1a2b0eb990..7f722e59703a1ee8912d95c659fd98234d43d1f4 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -54,6 +54,11 @@ // Constructor / destructor / create / destroy // ==================================================================================================================== +//ALBERTO +int EncCu::seconds = 0; +int EncCu::iter = 0; +//END ALBERTO + EncSlice::EncSlice() : m_encCABACTableIdx(I_SLICE) #if ENABLE_QPA @@ -84,6 +89,9 @@ void EncSlice::init( EncLib* pcEncLib, const SPS& sps ) { m_pcCfg = pcEncLib; m_pcLib = pcEncLib; + //ALBERTO + m_pcSps = sps; + //END ALBERTO m_pcListPic = pcEncLib->getListPic(); m_pcGOPEncoder = pcEncLib->getGOPEncoder(); @@ -1896,6 +1904,9 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons //ALBERTO EncCu* m_pcCuEncoder_COPY_BEFORE = new EncCu(*m_pcCuEncoder); bool stop_debugger_1 = true; + //EncCu new_m_pcCuEncoder; + //new_m_pcCuEncoder.create(m_pcCfg); + //new_m_pcCuEncoder.init(m_pcLib, m_pcSps); //END ALBERTO m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP); //ALBERTO diff --git a/source/Lib/EncoderLib/EncSlice.h b/source/Lib/EncoderLib/EncSlice.h index 7b7ffc89f97261dbbad779b37f369a1891431e4b..1916423bf63aaf5e744d7ae119a7d05c35aa3e97 100644 --- a/source/Lib/EncoderLib/EncSlice.h +++ b/source/Lib/EncoderLib/EncSlice.h @@ -66,6 +66,10 @@ private: EncLib* m_pcLib; + //ALBERTO + SPS m_pcSps; + //END ALBERTO + // pictures PicList* m_pcListPic; ///< list of pictures