Commit 852e499f authored by Alberto Gonzalez's avatar Alberto Gonzalez

Commit 6

-Constructor de copia de Reshape
-Constructor de copia de SliceReshapeInfo
parent acf475c9
...@@ -121,11 +121,12 @@ struct AreaBuf : public Size ...@@ -121,11 +121,12 @@ struct AreaBuf : public Size
ptrdiff_t stride; ptrdiff_t stride;
// the proper type causes awful lot of errors // the proper type causes awful lot of errors
//ptrdiff_t stride; //ptrdiff_t stride;
//ALBERTO //ALBERTO
AreaBuf(const AreaBuf<const T>& other) : Size(other), buf(other.buf), stride(other.stride) {} AreaBuf(const AreaBuf<T>& other) : Size(other.width, other.height), stride(other.stride), buf(other.buf)
{
//////////////////////buf = new T(*other.buf)
}
//END ALBERTO //END ALBERTO
AreaBuf() : Size(), buf(nullptr), stride(0) {} AreaBuf() : Size(), buf(nullptr), stride(0) {}
AreaBuf( T *_buf, const Size &size ) : Size( size ), buf( _buf ), stride( size.width ) { } 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) {} AreaBuf(T *_buf, const ptrdiff_t &_stride, const Size &size) : Size(size), buf(_buf), stride(_stride) {}
...@@ -751,8 +752,13 @@ struct UnitBuf ...@@ -751,8 +752,13 @@ struct UnitBuf
UnitBufBuffers bufs; UnitBufBuffers bufs;
//ALBERTO //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<T>(other.bufs[i]); // Copiamos cada elemento de la original en la nueva instancia
}
}
//END ALBERTO //END ALBERTO
......
...@@ -56,6 +56,29 @@ Reshape::Reshape() ...@@ -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() Reshape::~Reshape()
{ {
} }
......
...@@ -72,6 +72,9 @@ protected: ...@@ -72,6 +72,9 @@ protected:
int m_vpduY; int m_vpduY;
public: public:
Reshape(); Reshape();
//ALBERTO
Reshape(const Reshape& other);
//END ALBERTO
~Reshape(); ~Reshape();
void createDec(int bitDepth); void createDec(int bitDepth);
......
...@@ -165,6 +165,26 @@ public: ...@@ -165,6 +165,26 @@ public:
int reshaperModelBinCWDelta[PIC_CODE_CW_BINS]; int reshaperModelBinCWDelta[PIC_CODE_CW_BINS];
int maxNbitsNeededDeltaCW; int maxNbitsNeededDeltaCW;
int chrResScalingOffset; 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; } void setUseSliceReshaper(bool b) { sliceReshaperEnableFlag = b; }
bool getUseSliceReshaper() const { return sliceReshaperEnableFlag; } bool getUseSliceReshaper() const { return sliceReshaperEnableFlag; }
void setSliceReshapeModelPresentFlag(bool b) { sliceReshaperModelPresentFlag = b; } void setSliceReshapeModelPresentFlag(bool b) { sliceReshaperModelPresentFlag = b; }
......
...@@ -68,6 +68,21 @@ public: ...@@ -68,6 +68,21 @@ public:
TrQuant(); TrQuant();
~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 // initialize class
void init ( void init (
const Quant* otherQuant, const Quant* otherQuant,
......
...@@ -1308,13 +1308,13 @@ public: ...@@ -1308,13 +1308,13 @@ public:
static constexpr size_type max_num_elements = N; static constexpr size_type max_num_elements = N;
//ALBERTO //ALBERTO
static_vector(const static_vector<T, N>& other) : _size(other._size) //static_vector(const static_vector<T, N>& other) : _size(other._size)
{ //{
for (size_t i = 0; i < _size; ++i) // for (size_t i = 0; i < _size; ++i)
{ // {
_arr[i] = T(other._arr[i]); // _arr[i] = T(other._arr[i]);
} // }
} //}
//END ALBERTO //END ALBERTO
static_vector() : _size( 0 ) { } static_vector() : _size( 0 ) { }
static_vector( size_t N_ ) : _size( N_ ) { } static_vector( size_t N_ ) : _size( N_ ) { }
......
...@@ -74,7 +74,7 @@ public: ...@@ -74,7 +74,7 @@ public:
for (int i = 0; i < (MAX_CU_SIZE * MAX_CU_SIZE) >> (MIN_CU_LOG2 << 1); i++) 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 //END ALBERTO
......
...@@ -53,6 +53,10 @@ ...@@ -53,6 +53,10 @@
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
//ALBERTO
#include <chrono>
//END ALBERTO
//! \ingroup EncoderLib //! \ingroup EncoderLib
//! \{ //! \{
...@@ -614,6 +618,11 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS, ...@@ -614,6 +618,11 @@ bool EncCu::xCheckBestMode( CodingStructure *&tempCS, CodingStructure *&bestCS,
void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Partitioner& partitioner, double maxCostAllowed ) 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!"); CHECK(maxCostAllowed < 0, "Wrong value of maxCostAllowed!");
uint32_t compBegin; uint32_t compBegin;
...@@ -1174,6 +1183,18 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par ...@@ -1174,6 +1183,18 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par
CHECK( bestCS->cus.empty() , "No possible encoding found" ); CHECK( bestCS->cus.empty() , "No possible encoding found" );
CHECK( bestCS->cus[0]->predMode == NUMBER_OF_PREDICTION_MODES, "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" ); 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<std::chrono::milliseconds>(end - start);
auto before = seconds;
seconds += static_cast<int>(duration.count() / 1000);
std::cout << "La iter " << iter << " de la func tarda " << static_cast<int>(duration.count() / 1000) << " + " << before << " = " << seconds << " segundos en ejecutarse." << std::endl;
iter = 0;
}
//END ALBERTO
} }
#if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU
......
...@@ -226,6 +226,10 @@ class EncCu ...@@ -226,6 +226,10 @@ class EncCu
: DecCu : DecCu
{ {
private: private:
//ALBERTO
static int iter;
static int seconds;
//END ALBERTO
bool m_bestModeUpdated; bool m_bestModeUpdated;
struct CtxPair struct CtxPair
{ {
......
...@@ -54,6 +54,11 @@ ...@@ -54,6 +54,11 @@
// Constructor / destructor / create / destroy // Constructor / destructor / create / destroy
// ==================================================================================================================== // ====================================================================================================================
//ALBERTO
int EncCu::seconds = 0;
int EncCu::iter = 0;
//END ALBERTO
EncSlice::EncSlice() EncSlice::EncSlice()
: m_encCABACTableIdx(I_SLICE) : m_encCABACTableIdx(I_SLICE)
#if ENABLE_QPA #if ENABLE_QPA
...@@ -84,6 +89,9 @@ void EncSlice::init( EncLib* pcEncLib, const SPS& sps ) ...@@ -84,6 +89,9 @@ void EncSlice::init( EncLib* pcEncLib, const SPS& sps )
{ {
m_pcCfg = pcEncLib; m_pcCfg = pcEncLib;
m_pcLib = pcEncLib; m_pcLib = pcEncLib;
//ALBERTO
m_pcSps = sps;
//END ALBERTO
m_pcListPic = pcEncLib->getListPic(); m_pcListPic = pcEncLib->getListPic();
m_pcGOPEncoder = pcEncLib->getGOPEncoder(); m_pcGOPEncoder = pcEncLib->getGOPEncoder();
...@@ -1896,6 +1904,9 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons ...@@ -1896,6 +1904,9 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
//ALBERTO //ALBERTO
EncCu* m_pcCuEncoder_COPY_BEFORE = new EncCu(*m_pcCuEncoder); EncCu* m_pcCuEncoder_COPY_BEFORE = new EncCu(*m_pcCuEncoder);
bool stop_debugger_1 = true; 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 //END ALBERTO
m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP); m_pcCuEncoder->compressCtu(cs, ctuArea, ctuRsAddr, prevQP, currQP);
//ALBERTO //ALBERTO
......
...@@ -66,6 +66,10 @@ private: ...@@ -66,6 +66,10 @@ private:
EncLib* m_pcLib; EncLib* m_pcLib;
//ALBERTO
SPS m_pcSps;
//END ALBERTO
// pictures // pictures
PicList* m_pcListPic; ///< list of pictures PicList* m_pcListPic; ///< list of pictures
......
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