Commit 9623538e authored by Christian Helmrich's avatar Christian Helmrich

merge, address software coordinator's comments

parents e5c1ab7f d528eb7d
......@@ -843,7 +843,7 @@ void AdaptiveLoopFilter::deriveClassificationBlk(AlfClassifier** classifier, int
d0 = sumD0;
dirTempD = 2;
}
if( d1*hv0 > hv1*d0 )
if( (uint32_t)d1 * (uint32_t)hv0 > (uint32_t)hv1 * (uint32_t)d0 )
{
hvd1 = d1;
hvd0 = d0;
......
......@@ -92,10 +92,12 @@ public:
void resetPCMBlkClassInfo(CodingStructure & cs, AlfClassifier** classifier, const CPelBuf& srcLuma, const Area& blk);
template<AlfFilterType filtType>
static void filterBlk(AlfClassifier** classifier, const PelUnitBuf &recDst, const CPelUnitBuf& recSrc, const Area& blkDst, const Area& blk, const ComponentID compId, short* filterSet, short* fClipSet, const ClpRng& clpRng, CodingStructure& cs, int vbCTUHeight, int vbPos);
#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING
inline static int getMaxGolombIdx( AlfFilterType filterType )
{
return filterType == ALF_FILTER_5 ? 2 : 3;
}
#endif
void(*m_deriveClassificationBlk)(AlfClassifier** classifier, int** laplacian[NUM_DIRECTIONS], const CPelBuf& srcLuma, const Area& blkDst, const Area& blk, const int shift, int vbCTUHeight, int vbPos);
......
......@@ -111,7 +111,7 @@ struct AreaBuf : public Size
void copyClip ( const AreaBuf<const T> &src, const ClpRng& clpRng);
void subtract ( const AreaBuf<const T> &other );
#if !JVET_O0105_ICT_HHI
#if !JVET_O0105_ICT
void copyAndNegate ( const AreaBuf<const T> &other );
void subtractAndHalve ( const AreaBuf<const T> &other );
#endif
......@@ -359,7 +359,7 @@ void AreaBuf<T>::subtract( const AreaBuf<const T> &other )
#undef SUBS_INC
}
#if !JVET_O0105_ICT_HHI
#if !JVET_O0105_ICT
template<typename T>
void AreaBuf<T>::copyAndNegate( const AreaBuf<const T> &other )
{
......@@ -928,11 +928,11 @@ private:
Pel *m_origin[MAX_NUM_COMPONENT];
};
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
struct CompStorage : public PelBuf
{
CompStorage () { m_memory = nullptr; }
~CompStorage() { delete [] m_memory; }
~CompStorage() { if (valid()) delete [] m_memory; }
void create( const Size& size )
{
......@@ -942,7 +942,7 @@ struct CompStorage : public PelBuf
}
void destroy()
{
delete [] m_memory;
if (valid()) delete [] m_memory;
m_memory = nullptr;
}
bool valid() { return m_memory != nullptr; }
......
......@@ -445,6 +445,9 @@ static constexpr int MV_MIN = -(1 << (MV_BITS - 1));
static const int PIC_ANALYZE_CW_BINS = 32;
static const int PIC_CODE_CW_BINS = 16;
#if JVET_O0272_LMCS_SIMP_INVERSE_MAPPING
static const int LMCS_SEG_SIZE = (PIC_CODE_CW_BINS << 1);
#endif
static const int FP_PREC = 11;
static const int CSCALE_FP_PREC = 11;
#if JVET_O1109_UNFIY_CRS
......
......@@ -784,7 +784,7 @@ const CtxSet ContextSetCfg::IBCFlag = ContextSetCfg::addCtxSet
const CtxSet ContextSetCfg::JointCbCrFlag = ContextSetCfg::addCtxSet
({
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
{ 156, 156, 156, },
{ 156, 156, 156, },
{ 184, 184, 184, },
......
......@@ -750,15 +750,13 @@ namespace DQIntern
{
if (enableScalingLists)
invQScale = piDequantCoef[rasterPos];//scalingfactor*levelScale
if (shift < 0)
if (shift < 0 && (enableScalingLists || scanIdx == lastScanIdx))
{
invQScale <<= -shift;
shift = 0;
//add = (1 << shift) >> 1;
}
Intermediate_Int qIdx = ( level << 1 ) + ( level > 0 ? -(state>>1) : (state>>1) );
Intermediate_Int nomTCoeff = ( qIdx * invQScale + add ) >> shift;
tCoeff[ rasterPos ] = (TCoeff)Clip3<Intermediate_Int>( minTCoeff, maxTCoeff, nomTCoeff );
int64_t nomTCoeff = ((int64_t)qIdx * (int64_t)invQScale + add) >> ((shift < 0) ? 0 : shift);
tCoeff[rasterPos] = (TCoeff)Clip3<int64_t>(minTCoeff, maxTCoeff, nomTCoeff);
}
state = ( 32040 >> ((state<<2)+((level&1)<<1)) ) & 3; // the 16-bit value "32040" represent the state transition table
}
......@@ -1615,7 +1613,7 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff
CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list");
const uint32_t log2TrWidth = g_aucLog2[width];
const uint32_t log2TrHeight = g_aucLog2[height];
const bool enableScalingLists = getUseScalingList(width, height, tu.mtsIdx == MTS_SKIP);
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)));
static_cast<DQIntern::DepQuant*>(p)->quant( tu, pSrc, compID, cQP, Quant::m_dLambda, ctx, uiAbsSum, enableScalingLists, Quant::getQuantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) );
}
else
......@@ -1639,7 +1637,7 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo
const uint32_t log2TrWidth = g_aucLog2[width];
const uint32_t log2TrHeight = g_aucLog2[height];
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP));
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)));
static_cast<DQIntern::DepQuant*>(p)->dequant( tu, dstCoeff, compID, cQP, enableScalingLists, Quant::getDequantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) );
}
else
......
......@@ -578,11 +578,7 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
}
else
{
#if JVET_O0055_INT_DMVR_DIS_BDOF
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), (bioApplied ? 1 : 0));
#else
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied );
#endif
}
}
}
......@@ -1121,11 +1117,7 @@ void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int
g_pelBufOP.calcBlkGradient(sx, sy, arraysGx2, arraysGxGy, arraysGxdI, arraysGy2, arraysGydI, sGx2, sGy2, sGxGy, sGxdI, sGydI, width, height, unitSize);
}
#if JVET_O0055_INT_DMVR_DIS_BDOF
void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const int& bioApplied )
#else
void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied )
#endif
{
const int iRefIdx0 = pu.refIdx[0];
const int iRefIdx1 = pu.refIdx[1];
......@@ -1138,11 +1130,7 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx);
return;
}
#if JVET_O0055_INT_DMVR_DIS_BDOF
if (bioApplied > 0)
#else
if (bioApplied)
#endif
{
const int src0Stride = pu.lwidth() + 2 * BIO_EXTEND_SIZE + 2;
const int src1Stride = pu.lwidth() + 2 * BIO_EXTEND_SIZE + 2;
......@@ -1849,7 +1837,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
#if JVET_O0055_INT_DMVR_DIS_BDOF
int bioEnabledThres = 8 * (dy >> 1) * dx;
int bioAppliedType[64];
bool bioAppliedType[MAX_NUM_SUBCU_DMVR];
#endif
{
int num = 0;
......@@ -1909,7 +1897,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
}
#if JVET_O0055_INT_DMVR_DIS_BDOF
bioAppliedType[num] = (minCost < bioEnabledThres) ? 0 : (bioApplied ? 2 : 0);
bioAppliedType[num] = (minCost < bioEnabledThres) ? false : bioApplied;
#endif
totalDeltaMV[0] = (totalDeltaMV[0] << mvShift);
totalDeltaMV[1] = (totalDeltaMV[1] << mvShift);
......@@ -1956,7 +1944,7 @@ void InterPrediction::xProcessDMVR(PredictionUnit& pu, PelUnitBuf &pcYuvDst, con
m_cYuvRefBuffSubCuDMVRL0 = m_cYuvRefBuffDMVRL0.subBuf(UnitAreaRelative(pu, subPu));
m_cYuvRefBuffSubCuDMVRL1 = m_cYuvRefBuffDMVRL1.subBuf(UnitAreaRelative(pu, subPu));
#if JVET_O0055_INT_DMVR_DIS_BDOF
xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffSubCuDMVRL0, m_cYuvRefBuffSubCuDMVRL1, (bioAppliedType[num] > 0 ? true : false), mergeMv);
xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffSubCuDMVRL0, m_cYuvRefBuffSubCuDMVRL1, bioAppliedType[num], mergeMv);
#else
xFinalPaddedMCForDMVR(subPu, srcPred0, srcPred1, m_cYuvRefBuffSubCuDMVRL0, m_cYuvRefBuffSubCuDMVRL1, bioApplied, mergeMv);
#endif
......
......@@ -136,11 +136,7 @@ protected:
void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth);
void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth);
void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize);
#if JVET_O0055_INT_DMVR_DIS_BDOF
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const int& bioApplied );
#else
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied );
#endif
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied );
void xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng );
void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 );
......
......@@ -58,9 +58,15 @@
const uint8_t IntraPrediction::m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS] =
{
{ // Luma
#if JVET_O0277_INTRA_SMALL_BLOCK_DCTIF
24, // 1xn
24, // 2xn
24, // 4xn
#else
20, // 1xn
20, // 2xn
20, // 4xn
#endif
14, // 8xn
2, // 16xn
0, // 32xn
......@@ -556,14 +562,19 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
else if (!useISP)// HOR, VER and angular modes (MDIS)
{
bool filterFlag = false;
#if !JVET_O0277_INTRA_SMALL_BLOCK_DCTIF
if (predMode != dirMode ) // wide-anlge mode
{
filterFlag = true;
}
else
#endif
{
#if JVET_O0277_INTRA_SMALL_BLOCK_DCTIF
const int diff = std::min<int>( abs( predMode - HOR_IDX ), abs( predMode - VER_IDX ) );
#else
const int diff = std::min<int>( abs( dirMode - HOR_IDX ), abs( dirMode - VER_IDX ) );
#endif
const int log2Size = ((g_aucLog2[puSize.width] + g_aucLog2[puSize.height]) >> 1);
CHECK( log2Size >= MAX_INTRA_FILTER_DEPTHS, "Size not supported" );
filterFlag = (diff > m_aucIntraFilter[chType][log2Size]);
......@@ -573,7 +584,12 @@ void IntraPrediction::initPredIntraParams(const PredictionUnit & pu, const CompA
if (filterFlag)
{
const bool isRefFilter = isIntegerSlope(absAng);
#if JVET_O0277_INTRA_SMALL_BLOCK_DCTIF
CHECK( puSize.width * puSize.height <= 32, "DCT-IF interpolation filter is always used for 4x4, 4x8, and 8x4 luma CB" );
m_ipaParam.refFilterFlag = isRefFilter;
#else
m_ipaParam.refFilterFlag = isRefFilter && puSize.width * puSize.height > 32;
#endif
m_ipaParam.interpolationFlag = !isRefFilter;
}
}
......
......@@ -667,7 +667,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
tmpBs += BsSet(1, COMPONENT_Y);
}
// U
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cb) || TU::getCbf(tuP, COMPONENT_Cb) || tuQ.jointCbCr || tuP.jointCbCr))
#else
if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cb) || TU::getCbf(tuP, COMPONENT_Cb)))
......@@ -676,7 +676,7 @@ unsigned LoopFilter::xGetBoundaryStrengthSingle ( const CodingUnit& cu, const De
tmpBs += BsSet(1, COMPONENT_Cb);
}
// V
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cr) || TU::getCbf(tuP, COMPONENT_Cr) || tuQ.jointCbCr || tuP.jointCbCr))
#else
if (m_aapucBS[edgeDir][rasterIdx] && (TU::getCbf(tuQ, COMPONENT_Cr) || TU::getCbf(tuP, COMPONENT_Cr)))
......@@ -1214,18 +1214,33 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
const int dp0 = xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset);
const int dq0 = xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset);
#if JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION
const int subSamplingShift = ( edgeDir == EDGE_VER ) ? m_shiftVer : m_shiftHor;
const int dp3 = ( subSamplingShift == 1 ) ? xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset) : xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 3), iOffset);
const int dq3 = ( subSamplingShift == 1 ) ? xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset) : xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 3), iOffset);
#else
const int dp1 = xCalcDP(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset);
const int dq1 = xCalcDQ(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset);
#endif
const int d0 = dp0 + dq0;
#if JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION
const int d3 = dp3 + dq3;
const int d = d0 + d3;
#else
const int d1 = dp1 + dq1;
const int d = d0 + d1;
#endif
if (d < beta)
{
useLongFilter = true;
const bool sw = xUseStrongFiltering(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 0), iOffset, 2 * d0, beta, iTc)
#if JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION
&& xUseStrongFiltering(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + ( ( subSamplingShift == 1 ) ? 1 : 3 ) ), iOffset, 2 * d3, beta, iTc);
#else
&& xUseStrongFiltering(piTmpSrcChroma + iSrcStep*(iIdx*uiLoopLength + 1), iOffset, 2 * d1, beta, iTc);
#endif
for (unsigned step = 0; step < uiLoopLength; step++)
{
......
......@@ -221,7 +221,9 @@ struct LutMotionCand
{
static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lut;
static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutIbc;
#if !JVET_O0078_SINGLE_HMVPLUT
static_vector<MotionInfo, MAX_NUM_HMVP_CANDS> lutShareIbc;
#endif
};
struct PatentBvCand
{
......
......@@ -103,9 +103,8 @@ QpParam::QpParam(const TransformUnit& tu, const ComponentID &compIDX, const int
if (isChroma(compID))
{
#if JVET_O0105_ICT_HHI
const int absIct = abs( TU::getICTMode(tu) );
const bool useJQP = ( absIct == 2 || absIct == 4 );
#if JVET_O0105_ICT
const bool useJQP = ( abs(TU::getICTMode(tu)) == 2 );
chromaQpOffset += tu.cs->pps->getQpOffset ( useJQP ? JOINT_CbCr : compID );
chromaQpOffset += tu.cs->slice->getSliceChromaQpDelta( useJQP ? JOINT_CbCr : compID );
......@@ -407,7 +406,7 @@ void Quant::dequant(const TransformUnit &tu,
const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth];
const uint32_t uiLog2TrHeight = g_aucLog2[uiHeight];
int *piDequantCoef = getDequantCoeff(scalingListType, QP_rem, uiLog2TrWidth - 1, uiLog2TrHeight - 1);
int *piDequantCoef = getDequantCoeff(scalingListType, QP_rem, uiLog2TrWidth, uiLog2TrHeight);
if(rightShift > 0)
{
......@@ -921,7 +920,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf
const CCoeffBuf &piCoef = pSrc;
CoeffBuf piQCoef = tu.getCoeffs(compID);
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP;
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID);
const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID));
{
......@@ -935,7 +934,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf
CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list");
const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth];
const uint32_t uiLog2TrHeight = g_aucLog2[uiHeight];
int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth-1, uiLog2TrHeight-1);
int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth, uiLog2TrHeight);
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip);
......@@ -998,7 +997,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff
const CCoeffBuf piCoef = pSrc;
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP;
const bool useTransformSkip = tu.mtsIdx == MTS_SKIP && isLuma(compID);
const int maxLog2TrDynamicRange = sps.getMaxLog2TrDynamicRange(toChannelType(compID));
int scalingListType = getScalingListType(tu.cu->predMode, compID);
......@@ -1006,7 +1005,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff
const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth];
const uint32_t uiLog2TrHeight = g_aucLog2[uiHeight];
int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth-1, uiLog2TrHeight-1);
int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth, uiLog2TrHeight);
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0));
......@@ -1064,7 +1063,7 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co
const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth];
const uint32_t uiLog2TrHeight = g_aucLog2[uiHeight];
const int *const piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth-1, uiLog2TrHeight-1);
const int *const piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem, uiLog2TrWidth, uiLog2TrHeight);
/* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be
* implemented as a bit-shift (the quantised result will be sqrt(2) * larger than required). Alternatively, adjust the
......@@ -1138,7 +1137,7 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp
const uint32_t uiLog2TrWidth = g_aucLog2[uiWidth];
const uint32_t uiLog2TrHeight = g_aucLog2[uiHeight];
int *piDequantCoef = getDequantCoeff(scalingListType,QP_rem,uiLog2TrWidth-1, uiLog2TrHeight-1);
int *piDequantCoef = getDequantCoeff(scalingListType, QP_rem, uiLog2TrWidth, uiLog2TrHeight);
if (rightShift > 0)
{
......
......@@ -511,7 +511,7 @@ void QuantRDOQ::quant(TransformUnit &tu, const ComponentID &compID, const CCoeff
const CCoeffBuf &piCoef = pSrc;
CoeffBuf piQCoef = tu.getCoeffs(compID);
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP;
const bool useTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID);
bool useRDOQ = useTransformSkip ? m_useRDOQTS : m_useRDOQ;
......@@ -620,8 +620,8 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID,
const bool needSqrtAdjustment= TU::needsBlockSizeTrafoScale( tu, compID );
const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, (uiLog2BlockWidth - 1), (uiLog2BlockHeight - 1), cQP.rem);
const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem, (uiLog2BlockWidth-1), (uiLog2BlockHeight-1));
const double *const pdErrScale = xGetErrScaleCoeffSL(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem);
const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem, uiLog2BlockWidth, uiLog2BlockHeight);
const bool isTransformSkip = tu.mtsIdx==MTS_SKIP && isLuma(compID);
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip);
const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem];
......
......@@ -585,6 +585,10 @@ int8_t g_aucLog2 [MAX_CU_SIZE + 1];
int8_t g_aucNextLog2[MAX_CU_SIZE + 1];
int8_t g_aucPrevLog2[MAX_CU_SIZE + 1];
#if JVET_O0105_ICT
const int g_ictModes[2][4] = { { 0, 3, 1, 2 }, { 0, -3, -1, -2 } };
#endif
UnitScale g_miScaling( MIN_CU_LOG2, MIN_CU_LOG2 );
......
......@@ -146,6 +146,10 @@ extern int8_t g_aucLog2 [MAX_CU_SIZE + 1];
extern int8_t g_aucNextLog2 [MAX_CU_SIZE + 1];
extern int8_t g_aucPrevLog2 [MAX_CU_SIZE + 1];
#if JVET_O0105_ICT
extern const int g_ictModes[2][4];
#endif
inline bool is34( const SizeType& size )
{
return ( size & ( ( int64_t ) 1 << ( g_aucLog2[size] - 1 ) ) );
......
......@@ -97,7 +97,7 @@ Slice::Slice()
, m_bTestWeightBiPred ( false )
, m_substreamSizes ( )
, m_cabacInitFlag ( false )
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
, m_jointCbCrSignFlag ( false )
#endif
, m_bLMvdL1Zero ( false )
......@@ -195,7 +195,7 @@ void Slice::initSlice()
m_disFracMMVD = false;
m_substreamSizes.clear();
m_cabacInitFlag = false;
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
m_jointCbCrSignFlag = false;
#endif
m_enableTMVPFlag = true;
......@@ -678,7 +678,7 @@ void Slice::copySliceInfo(Slice *pSrc, bool cpyAlmostAll)
}
m_cabacInitFlag = pSrc->m_cabacInitFlag;
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
m_jointCbCrSignFlag = pSrc->m_jointCbCrSignFlag;
#endif
memcpy(m_alfApss, pSrc->m_alfApss, sizeof(m_alfApss)); // this might be quite unsafe
......@@ -1705,7 +1705,7 @@ void ScalingList::checkPredMode(uint32_t sizeId, uint32_t listId)
{
for (int predListIdx = (int)listId; predListIdx >= 0; predListIdx--)
{
if ((sizeId == SCALING_LIST_64x64 && (listId % 3) != 0) || (sizeId == SCALING_LIST_2x2 && (listId % 3) == 0))
if ((sizeId == SCALING_LIST_64x64 && ((listId % 3) != 0 || (predListIdx % 3) != 0)) || (sizeId == SCALING_LIST_2x2 && ((listId % 3) == 0 || (predListIdx % 3) == 0)))
continue;
if( !::memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ?
getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(int)*std::min(MAX_MATRIX_COEF_NUM,(int)g_scalingListSize[sizeId])) // check value of matrix
......
......@@ -1467,7 +1467,7 @@ private:
bool m_cabacInitFlag;
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
bool m_jointCbCrSignFlag;
#endif
......@@ -1744,7 +1744,7 @@ public:
void setCabacInitFlag( bool val ) { m_cabacInitFlag = val; } //!< set CABAC initial flag
bool getCabacInitFlag() const { return m_cabacInitFlag; } //!< get CABAC initial flag
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
void setJointCbCrSignFlag( bool b ) { m_jointCbCrSignFlag = b; }
bool getJointCbCrSignFlag() const { return m_jointCbCrSignFlag; }
#endif
......
......@@ -83,8 +83,8 @@ InvTrans *fastInvTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
//! \ingroup CommonLib
//! \{
#if JVET_O0105_ICT_HHI
int64_t sqr( int d ) { return d*d; }
#if JVET_O0105_ICT
int64_t square( int d ) { return d*d; }
template<int signedMode> std::pair<int64_t,int64_t> fwdTransformCbCr( const PelBuf &resCb, const PelBuf &resCr, PelBuf& resC1, PelBuf& resC2 )
{
......@@ -102,37 +102,37 @@ template<int signedMode> std::pair<int64_t,int64_t> fwdTransformCbCr( const PelB
if ( signedMode == 1 )
{
c1[x] = Pel( ( 4*cbx + 2*crx ) / 5 );
d1 += sqr( cbx - c1[x] ) + sqr( crx - (c1[x]>>1) );
d1 += square( cbx - c1[x] ) + square( crx - (c1[x]>>1) );
}
else if ( signedMode == -1 )
{
c1[x] = Pel( ( 4*cbx - 2*crx ) / 5 );
d1 += sqr( cbx - c1[x] ) + sqr( crx - (-c1[x]>>1) );
d1 += square( cbx - c1[x] ) + square( crx - (-c1[x]>>1) );
}
else if ( signedMode == 2 )
{
c1[x] = Pel( ( cbx + crx ) / 2 );
d1 += sqr( cbx - c1[x] ) + sqr( crx - c1[x] );
d1 += square( cbx - c1[x] ) + square( crx - c1[x] );
}
else if ( signedMode == -2 )
{
c1[x] = Pel( ( cbx - crx ) / 2 );
d1 += sqr( cbx - c1[x] ) + sqr( crx + c1[x] );
d1 += square( cbx - c1[x] ) + square( crx + c1[x] );
}
else if ( signedMode == 3 )
{
c2[x] = Pel( ( 4*crx + 2*cbx ) / 5 );
d1 += sqr( cbx - (c2[x]>>1) ) + sqr( crx - c2[x] );
d1 += square( cbx - (c2[x]>>1) ) + square( crx - c2[x] );
}
else if ( signedMode == -3 )
{
c2[x] = Pel( ( 4*crx - 2*cbx ) / 5 );
d1 += sqr( cbx - (-c2[x]>>1) ) + sqr( crx - c2[x] );
d1 += square( cbx - (-c2[x]>>1) ) + square( crx - c2[x] );
}
else
{
d1 += sqr( cbx );
d2 += sqr( crx );
d1 += square( cbx );
d2 += square( crx );
}
}
}
......@@ -170,7 +170,7 @@ TrQuant::TrQuant() : m_quant( nullptr )
{
m_mtsCoeffs[i] = (TCoeff*) xMalloc( TCoeff, MAX_CU_SIZE * MAX_CU_SIZE );
}
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
{
m_invICT = m_invICTMem + maxAbsIctMode;
m_invICT[ 0] = invTransformCbCr< 0>;
......@@ -650,7 +650,7 @@ void TrQuant::invRdpcmNxN(TransformUnit& tu, const ComponentID &compID, PelBuf &
}
}
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
std::pair<int64_t,int64_t> TrQuant::fwdTransformICT( const TransformUnit &tu, const PelBuf &resCb, const PelBuf &resCr, PelBuf &resC1, PelBuf &resC2, int jointCbCr )
{
......@@ -670,7 +670,7 @@ std::vector<int> TrQuant::selectICTCandidates( const TransformUnit &tu, CompStor
{
CHECK( !resCb[0].valid() || !resCr[0].valid(), "standard components are not valid" );
#if JVET_O0543_ICT_HHI_ICU_ONLY
#if JVET_O0543_ICT_ICU_ONLY
if( !CU::isIntra( *tu.cu ) )
{
int cbfMask = 3;
......
......@@ -103,7 +103,7 @@ public:
void transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &compID, const TCoeff &resiDiff, TCoeff &coeff, const uint32_t &uiPos, const QpParam &cQP, const bool bUseHalfRoundingPoint);
void invTrSkipDeQuantOneSample (TransformUnit &tu, const ComponentID &compID, const TCoeff &pcCoeff, Pel &reconSample, const uint32_t &uiPos, const QpParam &cQP);
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
void invTransformICT ( const TransformUnit &tu, PelBuf &resCb, PelBuf &resCr );
std::pair<int64_t,int64_t> fwdTransformICT ( const TransformUnit &tu, const PelBuf &resCb, const PelBuf &resCr, PelBuf& resC1, PelBuf& resC2, int jointCbCr = -1 );
std::vector<int> selectICTCandidates ( const TransformUnit &tu, CompStorage* resCb, CompStorage* resCr );
......@@ -138,7 +138,7 @@ private:
TCoeff** m_mtsCoeffs;
TCoeff m_tempInMatrix [ 48 ];
TCoeff m_tempOutMatrix[ 48 ];
#if JVET_O0105_ICT_HHI
#if JVET_O0105_ICT
static const int maxAbsIctMode = 3;
void (*m_invICTMem[1+2*maxAbsIctMode])(PelBuf&,PelBuf&);
std::pair<int64_t,int64_t>(*m_fwdICTMem[1+2*maxAbsIctMode])(const PelBuf&,const PelBuf&,PelBuf&,PelBuf&);
......
......@@ -50,11 +50,17 @@
#include <assert.h>
#include <cassert>
#define JVET_O0105_ICT_HHI 1 // JVET-O0105: inter-chroma transform (ICT) as extension of joint chroma coding (JCC)
#define JVET_O0543_ICT_HHI_ICU_ONLY 1 // JVET-O0543: ICT only in Intra CUs (was Intra slices, modified during adoption)
#define JVET_O0105_ICT 1 // JVET-O0105: inter-chroma transform (ICT) as extension of joint chroma coding (JCC)
#define JVET_O0543_ICT_ICU_ONLY 1 // JVET-O0543: ICT only in Intra CUs (was Intra slices, modified during adoption)
#define JVET_O0216_ALF_COEFF_EG3 1 // JVET-O0216/O0302/O0648: using EG3 for ALF coefficients coding
#define JVET_O0272_LMCS_SIMP_INVERSE_MAPPING 1 // JVET-O0272: LMCS simplified inverse mapping
#define JVET_O0247_ALF_CTB_CODING_REDUNDANCY_REMOVAL 1 // JVET-O0247: not signal APS index when number APS is 2
#define JVET_O0637_CHROMA_GRADIENT_LINE_SELECTION 1 // Choose line0 and line3 for gradient computation when chroma is same size as luma
#define JVET_O0288_UNIFY_ALF_SLICE_TYPE_REMOVAL 1 // JVET-O0288: remove slice type dependency in ALF
#define JVET_O0064_SIMP_ALF_CLIP_CODING 1 // JVET-O0047/O0058/O0064/O0067/O0290/O0301/O0430: use FLC for alf clipping indices, always signal alf clipping indices
......@@ -81,6 +87,8 @@
#define JVET_O0055_INT_DMVR_DIS_BDOF 1 // integer-distance DMVR cost to disable BDOF and disable BDOF early termination
#define JVET_O0277_INTRA_SMALL_BLOCK_DCTIF 1 // JVET-O0277: DCT-IF interpolation filter is always used for 4x4, 4x8, and 8x4 luma CB
#define JVET_O0267_IBC_SCALING_LIST 1
#define JVET_O0280_SIMD_TRIANGLE_WEIGHTING 1 // JVET-O0280: SIMD implementation for weighted sample prediction process of triangle prediction mode
......@@ -88,6 +96,12 @@
#define JVET_O0364_PDPC_DC 1 // JVET-O0364 Part 4: align PDPC process for DC with the one for Planar
#define JVET_O0364_PDPC_ANGULAR 1 // JVET-O0364 Part 5: simplify PDPC process for angular modes
#define JVET_O0294_TRANSFORM_CLEANUP 1 // JVET-O0294: Context modelling for MTS index
#define JVET_O1124_ALLOW_CCLM_COND 1 // JVET-O1124/JVET-O0196: CCLM restriction to reduce luma-chroma latency for chroma separate tree
#define JVET_O0078_SINGLE_HMVPLUT 1 // JVET-O0078Single HMVP table for all CUs inside the shared merge list region for IBC
#define FIX_DB_MAX_TRANSFORM_SIZE 1
#define MRG_SHARELIST_SHARSIZE 32
......@@ -1368,12 +1382,13 @@ struct AlfFilterShape
2, 2, 2,
2, 2, 1, 1
};
#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING
golombIdx = {
0,
0, 1, 0,
0, 1, 2, 2
};
#endif
filterType = ALF_FILTER_5;
}
......@@ -1395,13 +1410,14 @@ struct AlfFilterShape
2, 2, 2, 2, 2,
2, 2, 2, 1, 1
};
#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING
golombIdx = {
0,
0, 1, 0,
0, 1, 2, 1, 0,
0, 1, 2, 3, 3
};
#endif
filterType = ALF_FILTER_7;
}
......@@ -1418,7 +1434,9 @@ struct AlfFilterShape
int filterSize;
std::vector<int> pattern;
std::vector<int> weights;
#if !JVET_O0216_ALF_COEFF_EG3 || !JVET_O0064_SIMP_ALF_CLIP_CODING
std::vector<int> golombIdx;
#endif
};
struct AlfSliceParam
......
......@@ -327,6 +327,71 @@ void CodingUnit::initData()
mipFlag = false;
}
#if JVET_O1124_ALLOW_CCLM_COND
const bool CodingUnit::checkCCLMAllowed() const
{
bool allowCCLM = false;