Commit 84ddcf73 authored by Karsten Suehring's avatar Karsten Suehring
Browse files

refactor TComPattern to remove obsolete data class

parent 48daefe1
......@@ -72,42 +72,22 @@ Int isAboveRightAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiP
Int isBelowLeftAvailable ( const TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool* bValidFlags );
// ====================================================================================================================
// Public member functions (TComPatternParam)
// ====================================================================================================================
/**
\param piTexture pixel data
\param iRoiWidth pattern width
\param iRoiHeight pattern height
\param iStride buffer stride
\param bitDepth bit depth
*/
Void TComPatternParam::setPatternParamPel ( Pel* piTexture,
Int iRoiWidth,
Int iRoiHeight,
Int iStride,
Int bitDepth
)
{
m_piROIOrigin = piTexture;
m_iROIWidth = iRoiWidth;
m_iROIHeight = iRoiHeight;
m_iPatternStride = iStride;
m_bitDepth = bitDepth;
}
// ====================================================================================================================
// Public member functions (TComPattern)
// ====================================================================================================================
Void TComPattern::initPattern (Pel* piY,
Int iRoiWidth,
Int iRoiHeight,
Int iStride,
Int roiWidth,
Int roiHeight,
Int stride,
Int bitDepthLuma)
{
m_cPatternY. setPatternParamPel( piY, iRoiWidth, iRoiHeight, iStride, bitDepthLuma);
m_piROIOrigin = piY;
m_roiWidth = roiWidth;
m_roiHeight = roiHeight;
m_patternStride = stride;
m_bitDepth = bitDepthLuma;
}
......
......@@ -51,56 +51,47 @@
class TComDataCU;
class TComTU;
/// neighbouring pixel access class for one component
class TComPatternParam
/// neighbouring pixel access class for all components
class TComPattern
{
private:
Pel* m_piROIOrigin;
Int m_roiWidth;
Int m_roiHeight;
Int m_patternStride;
Int m_bitDepth;
public:
Int m_iROIWidth;
Int m_iROIHeight;
Int m_iPatternStride;
Int m_bitDepth;
// ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset])
Int getROIYWidth() const { return m_roiWidth; }
Int getROIYHeight() const { return m_roiHeight; }
Int getPatternLStride() const { return m_patternStride; }
Int getBitDepthY() const { return m_bitDepth; }
/// return starting position of ROI (ROI = &pattern[AboveOffset][LeftOffset])
__inline Pel* getROIOrigin()
__inline Pel* getROIY()
{
return m_piROIOrigin;
}
__inline const Pel* getROIOrigin() const
__inline const Pel* getROIY() const
{
return m_piROIOrigin;
}
/// set parameters from Pel buffer for accessing neighbouring pixels
Void setPatternParamPel( Pel* piTexture, Int iRoiWidth, Int iRoiHeight, Int iStride, Int bitDepth );
};
/// neighbouring pixel access class for all components
class TComPattern
{
private:
TComPatternParam m_cPatternY;
// TComPatternParam m_cPatternCb;
//TComPatternParam m_cPatternCr;
TComPattern()
: m_piROIOrigin(NULL)
, m_roiWidth(0)
, m_roiHeight(0)
, m_patternStride(0)
, m_bitDepth(0)
{};
public:
// ROI & pattern information, (ROI = &pattern[AboveOffset][LeftOffset])
Pel* getROIY() { return m_cPatternY.getROIOrigin(); }
const Pel* getROIY() const { return m_cPatternY.getROIOrigin(); }
Int getROIYWidth() const { return m_cPatternY.m_iROIWidth; }
Int getROIYHeight() const { return m_cPatternY.m_iROIHeight; }
Int getPatternLStride() const { return m_cPatternY.m_iPatternStride; }
Int getBitDepthY() const { return m_cPatternY.m_bitDepth; }
// -------------------------------------------------------------------------------------------------------------------
// initialization functions
// -------------------------------------------------------------------------------------------------------------------
/// set parameters from Pel buffers for accessing neighbouring pixels
Void initPattern( Pel* piY, Int iRoiWidth, Int iRoiHeight, Int iStride, Int bitDepthLuma );
Void initPattern( Pel* piY, Int roiWidth, Int roiHeight, Int stride, Int bitDepthLuma );
};
//! \}
......
......@@ -3673,8 +3673,7 @@ Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPa
m_iSearchRange = m_aaiAdaptSR[eRefPicList][iRefIdxPred];
Int iSrchRng = ( bBi ? m_bipredSearchRange : m_iSearchRange );
TComPattern tmpPattern;
TComPattern* pcPatternKey = &tmpPattern;
TComPattern cPattern;
Double fWeight = 1.0;
......@@ -3694,11 +3693,11 @@ Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPa
m_cDistParam.bIsBiPred = bBi;
// Search key pattern initialization
pcPatternKey->initPattern( pcYuv->getAddr ( COMPONENT_Y, uiPartAddr ),
iRoiWidth,
iRoiHeight,
pcYuv->getStride(COMPONENT_Y),
pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
cPattern.initPattern( pcYuv->getAddr ( COMPONENT_Y, uiPartAddr ),
iRoiWidth,
iRoiHeight,
pcYuv->getStride(COMPONENT_Y),
pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
Pel* piRefY = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiPartAddr );
Int iRefStride = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getStride(COMPONENT_Y);
......@@ -3723,7 +3722,7 @@ Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPa
// Do integer search
if ( (m_motionEstimationSearchMethod==MESEARCH_FULL) || bBi )
{
xPatternSearch ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost );
xPatternSearch ( &cPattern, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost );
}
else
{
......@@ -3733,7 +3732,7 @@ Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPa
{
pIntegerMv2Nx2NPred = &(m_integerMv2Nx2N[eRefPicList][iRefIdxPred]);
}
xPatternSearchFast ( pcCU, pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost, pIntegerMv2Nx2NPred );
xPatternSearchFast ( pcCU, &cPattern, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost, pIntegerMv2Nx2NPred );
if (pcCU->getPartitionSize(0) == SIZE_2Nx2N)
{
m_integerMv2Nx2N[eRefPicList][iRefIdxPred] = rcMv;
......@@ -3744,7 +3743,7 @@ Void TEncSearch::xMotionEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPa
m_pcRdCost->setCostScale ( 1 );
const Bool bIsLosslessCoded = pcCU->getCUTransquantBypass(uiPartAddr) != 0;
xPatternSearchFracDIF( bIsLosslessCoded, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost );
xPatternSearchFracDIF( bIsLosslessCoded, &cPattern, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost );
m_pcRdCost->setCostScale( 0 );
rcMv <<= 2;
......
Supports Markdown
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