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
ptrdiff_t stride;
// the proper type causes awful lot of errors
//ptrdiff_t stride;
//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
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<T>(other.bufs[i]); // Copiamos cada elemento de la original en la nueva instancia
}
}
//END ALBERTO
......
......@@ -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()
{
}
......
......@@ -72,6 +72,9 @@ protected:
int m_vpduY;
public:
Reshape();
//ALBERTO
Reshape(const Reshape& other);
//END ALBERTO
~Reshape();
void createDec(int bitDepth);
......
......@@ -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; }
......
......@@ -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,
......
......@@ -1308,13 +1308,13 @@ public:
static constexpr size_type max_num_elements = N;
//ALBERTO
static_vector(const static_vector<T, N>& other) : _size(other._size)
{
for (size_t i = 0; i < _size; ++i)
{
_arr[i] = T(other._arr[i]);
}
}
//static_vector(const static_vector<T, N>& 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_ ) { }
......
......@@ -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
......
......@@ -53,6 +53,10 @@
#include <cmath>
#include <algorithm>
//ALBERTO
#include <chrono>
//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<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
......
......@@ -226,6 +226,10 @@ class EncCu
: DecCu
{
private:
//ALBERTO
static int iter;
static int seconds;
//END ALBERTO
bool m_bestModeUpdated;
struct CtxPair
{
......
......@@ -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
......
......@@ -66,6 +66,10 @@ private:
EncLib* m_pcLib;
//ALBERTO
SPS m_pcSps;
//END ALBERTO
// 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