Commit f4dbd560 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'DQP-and-Indentation-Fixes' into 'master'

several fixes to JVET-L0428 related code additions, editorial fixes

See merge request jvet/VVCSoftware_VTM!143
parents fb4e1214 ec389267
Pipeline #488 passed with stage
......@@ -122,7 +122,7 @@ const TFilterCoeff g_intraGaussFilter[32][4] = {
{ 4, 18, 29, 13 },
{ 3, 18, 29, 14 },
{ 3, 17, 29, 15 },
{ 3, 17, 29, 15 }
{ 3, 17, 29, 15 }
};
#endif
......@@ -281,17 +281,17 @@ Pel IntraPrediction::xGetPredValDc( const CPelBuf &pSrc, const Size &dstSize )
if ( width >= height )
{
for( idx = 0; idx < width; idx++ )
{
sum += pSrc.at( 1 + idx, 0 );
}
for( idx = 0; idx < width; idx++ )
{
sum += pSrc.at( 1 + idx, 0 );
}
}
if ( width <= height )
{
for( idx = 0; idx < height; idx++ )
{
sum += pSrc.at( 0, 1 + idx );
}
for( idx = 0; idx < height; idx++ )
{
sum += pSrc.at( 0, 1 + idx );
}
}
dcVal = (sum + divOffset) >> divShift;
......@@ -388,7 +388,7 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co
case(PLANAR_IDX): xPredIntraPlanar(CPelBuf(ptrSrc, srcStride, srcHStride), piPred, *pu.cs->sps); break;
case(DC_IDX): xPredIntraDc(CPelBuf(ptrSrc, srcStride, srcHStride), piPred, channelType, false); break;
#if JVET_L0628_4TAP_INTRA
case(2):
case(2):
case(DIA_IDX):
case(VDIA_IDX):
if (getWideAngle(iWidth, iHeight, uiDirMode) == static_cast<int>(uiDirMode)) // check if uiDirMode is not wide-angle
......@@ -397,7 +397,7 @@ void IntraPrediction::predIntraAng( const ComponentID compId, PelBuf &piPred, co
#if JVET_L0283_MULTI_REF_LINE
, multiRefIdx
#endif
, useFilteredPredSamples);
, useFilteredPredSamples);
break;
}
default: xPredIntraAng(CPelBuf(getPredictorPtr(compID, false), srcStride, srcHStride), piPred, channelType, uiDirMode, clpRng, *pu.cs->sps
......@@ -719,7 +719,7 @@ void IntraPrediction::xPredIntraAng( const CPelBuf &pSrc, PelBuf &pDst, const Ch
{
#if JVET_L0628_4TAP_INTRA
auto width = int(pDst.width) +1;
auto height = int(pDst.height)+1;
auto height = int(pDst.height)+1;
#if JVET_L0283_MULTI_REF_LINE
auto lastIdx = (bIsModeVer ? width : height) + multiRefIdx;
#else
......@@ -1157,7 +1157,7 @@ void IntraPrediction::initIntraPatternChType(const CodingUnit &cu, const CompAre
// ----- Step 2: filtered reference samples -----
if( bFilterRefSamples )
{
xFilterReferenceSamples( refBufUnfiltered, refBufFiltered, area, *cs.sps
xFilterReferenceSamples( refBufUnfiltered, refBufFiltered, area, *cs.sps
#if JVET_L0283_MULTI_REF_LINE
, cu.firstPU->multiRefIdx
#endif
......@@ -1529,7 +1529,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf
ptrTmp = tmpLineBuf + (totalLeftUnits * unitHeight);
for( int i = 1; i <= predHSize; i++ ) { ptrDst[i*predStride] = ptrTmp[-i]; }
#endif
#endif
}
#if JVET_L0283_MULTI_REF_LINE
// padding of extended samples above right with the last sample
......@@ -1549,7 +1549,7 @@ void IntraPrediction::xFillReferenceSamples( const CPelBuf &recoBuf, Pel* refBuf
#endif
}
void IntraPrediction::xFilterReferenceSamples( const Pel* refBufUnfiltered, Pel* refBufFiltered, const CompArea &area, const SPS &sps
void IntraPrediction::xFilterReferenceSamples( const Pel* refBufUnfiltered, Pel* refBufFiltered, const CompArea &area, const SPS &sps
#if JVET_L0283_MULTI_REF_LINE
, int multiRefIdx
#endif
......@@ -1899,7 +1899,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom
#endif
bLeftAvaillable = availlableUnit == iTUHeightInUnits;
availlableUnit = isAboveAvailable( isChroma( pu.chType ) ? cu : lumaCU, toChannelType( area.compID ), area.pos(), iAboveUnits, iUnitWidth,
#if JVET_L0338_MDLM
( bNeighborFlags + iLeftUnits + leftBelowUnits + 1 ) );
......@@ -1958,7 +1958,7 @@ void IntraPrediction::xGetLumaRecPixels(const PredictionUnit &pu, CompArea chrom
{
pDst[i] = ( piSrc[2 * i] * 2 + piSrc[2 * i - 1] + piSrc[2 * i + 1] + 2 ) >> 2;
}
}
}
else
{
piSrc = pRecSrc0 - iRecStride2;
......@@ -2103,7 +2103,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
bool aboveAvailable, leftAvailable;
int availableUnit =
isAboveAvailable(cu, CHANNEL_TYPE_CHROMA, posLT, aboveUnits, unitWidth,
isAboveAvailable(cu, CHANNEL_TYPE_CHROMA, posLT, aboveUnits, unitWidth,
#if JVET_L0338_MDLM
(neighborFlags + leftUnits + leftBelowUnits + 1));
#else
......@@ -2112,7 +2112,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
aboveAvailable = availableUnit == tuWidthInUnits;
availableUnit =
isLeftAvailable(cu, CHANNEL_TYPE_CHROMA, posLT, leftUnits, unitHeight,
isLeftAvailable(cu, CHANNEL_TYPE_CHROMA, posLT, leftUnits, unitHeight,
#if JVET_L0338_MDLM
(neighborFlags + leftUnits + leftBelowUnits - 1));
#else
......@@ -2158,7 +2158,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
unsigned internalBitDepth = sps.getBitDepth(CHANNEL_TYPE_CHROMA);
int minLuma[2] = { MAX_INT, 0 };
int minLuma[2] = { MAX_INT, 0 };
int maxLuma[2] = { -MAX_INT, 0 };
Pel *src = srcColor0 - srcStride;
......@@ -2242,7 +2242,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
}
}
if ((leftAvailable || aboveAvailable))
if (leftAvailable || aboveAvailable)
{
a = 0;
iShift = 16;
......@@ -2331,7 +2331,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
bool bAboveAvaillable, bLeftAvaillable;
int availlableUnit = isAboveAvailable( cu, CHANNEL_TYPE_CHROMA, posLT, iAboveUnits, iUnitWidth,
int availlableUnit = isAboveAvailable( cu, CHANNEL_TYPE_CHROMA, posLT, iAboveUnits, iUnitWidth,
#if JVET_L0338_MDLM
(bNeighborFlags + iLeftUnits + leftBelowUnits + 1 ) );
#else
......@@ -2339,7 +2339,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
#endif
bAboveAvaillable = availlableUnit == iTUWidthInUnits;
availlableUnit = isLeftAvailable( cu, CHANNEL_TYPE_CHROMA, posLT, iLeftUnits, iUnitHeight,
availlableUnit = isLeftAvailable( cu, CHANNEL_TYPE_CHROMA, posLT, iLeftUnits, iUnitHeight,
#if JVET_L0338_MDLM
(bNeighborFlags + iLeftUnits + leftBelowUnits - 1 ) );
#else
......@@ -2361,7 +2361,7 @@ void IntraPrediction::xGetLMParameters(const PredictionUnit &pu, const Component
Pel *pSrcColor0, *pCurChroma0;
int iSrcStride, iCurStride;
PelBuf Temp;
PelBuf Temp;
#if JVET_L0338_MDLM
if ((curChromaMode == MDLM_L_IDX) || (curChromaMode == MDLM_T_IDX))
{
......
......@@ -2309,7 +2309,7 @@ public:
, maxBtSize { sps.getSpsNext().getMaxBTSizeI(), sps.getSpsNext().getMaxBTSize(), sps.getSpsNext().getMaxBTSizeIChroma() }
, minTtSize { MIN_TT_SIZE, MIN_TT_SIZE_INTER, MIN_TT_SIZE_C }
#if JVET_L0217_L0678_PARTITION_HIGHLEVEL_CONSTRAINT
, maxTtSize { sps.getSpsNext().getMaxTTSizeI(), sps.getSpsNext().getMaxTTSize(), sps.getSpsNext().getMaxTTSizeIChroma() }
, maxTtSize { sps.getSpsNext().getMaxTTSizeI(), sps.getSpsNext().getMaxTTSize(), sps.getSpsNext().getMaxTTSizeIChroma() }
#else
, maxTtSize { MAX_TT_SIZE, MAX_TT_SIZE_INTER, MAX_TT_SIZE_C }
#endif
......
......@@ -1155,7 +1155,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#endif
}
#endif
mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] );
mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAbove.mv[0], miAbove.refIdx[0] );
if( slice.isInterB() )
{
......@@ -1219,7 +1219,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx,
#endif
}
#endif
mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] );
mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] );
if( slice.isInterB() )
{
......
......@@ -200,14 +200,14 @@ bool CABACReader::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i
else
{
isLast = coding_tree(cs, *partitioner, cuCtx);
qps[CH_L] = cuCtx.qp;
if( !isLast && CS::isDualITree( cs ) && cs.pcv->chrFormat != CHROMA_400 )
{
CUCtx cuCtxChroma( qps[CH_C] );
partitioner->initCtu( area, CH_C, *cs.slice );
isLast = coding_tree( cs, *partitioner, cuCtxChroma );
qps[CH_C] = cuCtxChroma.qp;
}
qps[CH_L] = cuCtx.qp;
if( !isLast && CS::isDualITree( cs ) && cs.pcv->chrFormat != CHROMA_400 )
{
CUCtx cuCtxChroma( qps[CH_C] );
partitioner->initCtu( area, CH_C, *cs.slice );
isLast = coding_tree( cs, *partitioner, cuCtxChroma );
qps[CH_C] = cuCtxChroma.qp;
}
}
DTRACE_COND( ctuRsAddr == 0, g_trace_ctx, D_QP_PER_CTU, "\n%4d %2d", cs.picture->poc, cs.slice->getSliceQpBase() );
......@@ -580,13 +580,13 @@ bool CABACReader::coding_tree( CodingStructure& cs, Partitioner& partitioner, CU
}
#if JVET_L0428_DQP_SEP_TREE
const Position chromaCentral(cu.chromaPos().offset(cu.chromaSize().width >> 1, cu.chromaSize().height >> 1));
const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, cu.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, cu.chromaFormat));
const CodingUnit* colLumaCu = cs.getCU(lumaRefPos, CHANNEL_TYPE_LUMA);
if (cu.cs->pps->getUseDQP() && CS::isDualITree(cs) && isChroma(cu.chType))
if (pps.getUseDQP() && CS::isDualITree(cs) && isChroma(cu.chType))
{
cuCtx.qp = colLumaCu->qp;
const Position chromaCentral(cu.chromaPos().offset(cu.chromaSize().width >> 1, cu.chromaSize().height >> 1));
const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, cu.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, cu.chromaFormat));
const CodingUnit* colLumaCu = cs.getCU(lumaRefPos, CHANNEL_TYPE_LUMA);
if (colLumaCu) cuCtx.qp = colLumaCu->qp;
}
#endif
......
......@@ -186,15 +186,15 @@ void CABACWriter::coding_tree_unit( CodingStructure& cs, const UnitArea& area, i
}
else
{
coding_tree( cs, *partitioner, cuCtx );
qps[CH_L] = cuCtx.qp;
if( CS::isDualITree( cs ) && cs.pcv->chrFormat != CHROMA_400 )
{
CUCtx cuCtxChroma( qps[CH_C] );
partitioner->initCtu( area, CH_C, *cs.slice );
coding_tree( cs, *partitioner, cuCtxChroma );
qps[CH_C] = cuCtxChroma.qp;
}
coding_tree( cs, *partitioner, cuCtx );
qps[CH_L] = cuCtx.qp;
if( CS::isDualITree( cs ) && cs.pcv->chrFormat != CHROMA_400 )
{
CUCtx cuCtxChroma( qps[CH_C] );
partitioner->initCtu( area, CH_C, *cs.slice );
coding_tree( cs, *partitioner, cuCtxChroma );
qps[CH_C] = cuCtxChroma.qp;
}
}
delete partitioner;
......@@ -2063,7 +2063,7 @@ void CABACWriter::transform_unit( const TransformUnit& tu, CUCtx& cuCtx, ChromaC
if( cu.cs->pps->getUseDQP() && !cuCtx.isDQPCoded )
{
#if JVET_L0428_DQP_SEP_TREE
if ((!CS::isDualITree(*tu.cs) || isLuma(tu.chType)))
if (!CS::isDualITree(*tu.cs) || isLuma(tu.chType))
#endif
{
cu_qp_delta(cu, cuCtx.qp, cu.qp);
......
......@@ -705,7 +705,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
EncTestMode currTestMode = m_modeCtrl->currTestMode();
#if JVET_L0428_DQP_SEP_TREE
if (tempCS->pps->getUseDQP() && partitioner.chType == CHANNEL_TYPE_CHROMA)
if (tempCS->pps->getUseDQP() && CS::isDualITree(*tempCS) && isChroma(partitioner.chType))
{
const Position chromaCentral(tempCS->area.Cb().chromaPos().offset(tempCS->area.Cb().chromaSize().width >> 1, tempCS->area.Cb().chromaSize().height >> 1));
const Position lumaRefPos(chromaCentral.x << getComponentScaleX(COMPONENT_Cb, tempCS->area.chromaFormat), chromaCentral.y << getComponentScaleY(COMPONENT_Cb, tempCS->area.chromaFormat));
......@@ -713,11 +713,10 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par
const CodingUnit* colLumaCu = baseCS->getCU(lumaRefPos, CHANNEL_TYPE_LUMA);
const TransformUnit* tu = baseCS->getTU(lumaRefPos, CHANNEL_TYPE_LUMA);
if (tu)
if (colLumaCu && tu)
{
currTestMode.qp = colLumaCu->qp;
}
}
#endif
......@@ -1603,7 +1602,7 @@ void EncCu::xCheckDQP( CodingStructure& cs, Partitioner& partitioner, bool bKeep
}
#if JVET_L0428_DQP_SEP_TREE
if (partitioner.chType == CHANNEL_TYPE_CHROMA)
if (CS::isDualITree(cs) && isChroma(partitioner.chType))
{
return;
}
......
......@@ -949,13 +949,13 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru
if( m_pcEncCfg->getUseAdaptiveQP() )
{
#if JVET_L0428_DQP_SEP_TREE
if (partitioner.chType == CHANNEL_TYPE_LUMA || !cs.slice->isIRAP())
if (!CS::isDualITree(cs) || isLuma(partitioner.chType))
#endif
{
baseQP = Clip3(-cs.sps->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, baseQP + xComputeDQP(cs, partitioner));
}
#endif
}
int minQP = baseQP;
int maxQP = baseQP;
......@@ -1292,7 +1292,7 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
CHECK( !slice.isIntra() && !cuECtx.bestTU, "No possible non-intra encoding for a P- or B-slice found" );
if( !( slice.isIRAP() || bestMode.type == ETM_INTRA ||
( ( !m_pcEncCfg->getDisableIntraPUsInInterSlices() ) && !relatedCU.isInter && (
( ( !m_pcEncCfg->getDisableIntraPUsInInterSlices() ) && !relatedCU.isInter && (
( cuECtx.bestTU->cbf[0] != 0 ) ||
( ( numComp > COMPONENT_Cb ) && cuECtx.bestTU->cbf[1] != 0 ) ||
( ( numComp > COMPONENT_Cr ) && cuECtx.bestTU->cbf[2] != 0 ) // avoid very complex intra if it is unlikely
......
......@@ -1826,7 +1826,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
iRefEnd--;
}
#endif
for (int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++)
for (int iRefIdxTemp = iRefStart; iRefIdxTemp <= iRefEnd; iRefIdxTemp++)
{
#if JVET_L0646_GBI
if( m_pcEncCfg->getUseGBiFast() && (gbiIdx != GBI_DEFAULT)
......
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