Skip to content
Snippets Groups Projects
Commit 6839ee63 authored by Frank Bossen's avatar Frank Bossen
Browse files

Intra prediction code cleanup

Remove fields whRatio and hwRatio from the IntraPredParam
structure when JVET_O0364_PADDING is enabled as they may be needed
only once. When ratios are needed use logs, adds, and shifts
instead of divisions and multiplications.

Add initializer for angularScale when JVET_O0364_PDPC_ANGULAR is
enabled
parent b10ff9b1
No related branches found
No related tags found
No related merge requests found
......@@ -513,8 +513,10 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
const int dirMode = PU::getFinalIntraMode(pu, chType);
const int predMode = getWideAngle( blockSize.width, blockSize.height, dirMode );
#if !JVET_O0364_PADDING
m_ipaParam.whRatio = std::max( unsigned( 1 ), blockSize.width / blockSize.height ) ;
m_ipaParam.hwRatio = std::max( unsigned( 1 ), blockSize.height / blockSize.width ) ;
#endif
m_ipaParam.isModeVer = predMode >= DIA_IDX;
m_ipaParam.multiRefIndex = isLuma (chType) ? pu.multiRefIdx : 0 ;
m_ipaParam.refFilterFlag = false;
......@@ -641,8 +643,10 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
int height=int(pDst.height);
const bool bIsModeVer = m_ipaParam.isModeVer;
#if !JVET_O0364_PADDING
const int whRatio = m_ipaParam.whRatio;
const int hwRatio = m_ipaParam.hwRatio;
#endif
const int multiRefIdx = m_ipaParam.multiRefIndex;
const int intraPredAngle = m_ipaParam.intraPredAngle;
const int invAngle = m_ipaParam.invAngle;
......@@ -718,11 +722,14 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
refSide = bIsModeVer ? refLeft : refAbove;
// Extend main reference to right using replication
int maxIndex = multiRefIdx * (bIsModeVer ? whRatio : hwRatio) + 2;
Pel val = bIsModeVer ? pSrc.at(m_topRefLength + multiRefIdx, 0) : pSrc.at(0, m_leftRefLength + multiRefIdx);
const int log2Ratio = g_aucLog2[width] - g_aucLog2[height];
const int s = std::max<int>(0, bIsModeVer ? log2Ratio : -log2Ratio);
const int maxIndex = (multiRefIdx << s) + 2;
const int refLength = bIsModeVer ? m_topRefLength : m_leftRefLength;
const Pel val = refMain[refLength + multiRefIdx];
for (int z = 1; z <= maxIndex; z++)
{
refMain[(bIsModeVer ? m_topRefLength : m_leftRefLength) + multiRefIdx + z] = val;
refMain[refLength + multiRefIdx + z] = val;
}
#else
for (int x = 0; x < m_topRefLength + 1 + (whRatio + 1) * multiRefIdx; x++)
......
......@@ -81,8 +81,10 @@ private:
bool applyPDPC;
bool isModeVer;
int multiRefIndex;
#if !JVET_O0364_PADDING
int whRatio;
int hwRatio;
#endif
int intraPredAngle;
int invAngle;
bool interpolationFlag;
......@@ -90,16 +92,25 @@ private:
int angularScale;
#endif
IntraPredParam() :
refFilterFlag ( false ),
applyPDPC ( false ),
isModeVer ( false ),
multiRefIndex ( -1 ),
whRatio ( 0 ),
hwRatio ( 0 ),
intraPredAngle ( std::numeric_limits<int>::max() ),
invAngle ( std::numeric_limits<int>::max() ),
interpolationFlag ( false ) {}
// clang-format off
IntraPredParam()
: refFilterFlag(false)
, applyPDPC(false)
, isModeVer(false)
, multiRefIndex(-1)
#if !JVET_O0364_PADDING
, whRatio(0)
, hwRatio(0)
#endif
, intraPredAngle(std::numeric_limits<int>::max())
, invAngle(std::numeric_limits<int>::max())
, interpolationFlag(false)
#if JVET_O0364_PDPC_ANGULAR
, angularScale(-1)
#endif
// clang-format on
{
}
};
IntraPredParam m_ipaParam;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment