Commit 5b44c20b authored by Karsten Suehring's avatar Karsten Suehring

- fix encoder/decoder mismatch due to LMChroma issue

- correct some defines for combinations of options
- fix some more compiler warnings
parent 6496f8e0
......@@ -3048,10 +3048,9 @@ Void AdaptiveLoopFilter::xFrameChromaAlf( ALFParam* pcAlfParam, const PelUnitBuf
Int iTap = pcAlfParam->tap_chroma;
Int *qh = pcAlfParam->coeff_chroma;
Int i, x, y, value, N;//, offset;
Int i, x, y, value;//, offset;
Pel PixSum[m_ALF_MAX_NUM_COEF];
N = (iTap*iTap+1)>>1;
//offset = iTap>>1;
Int iHeight = recUnitBuf.get(compID).height;
Int iWidth = recUnitBuf.get(compID).width;
......@@ -3112,6 +3111,7 @@ Void AdaptiveLoopFilter::xFrameChromaAlf( ALFParam* pcAlfParam, const PelUnitBuf
*pTmpPixSum = (*pTmpDec1);
value = 0;
const int N = (iTap*iTap+1)>>1;
for(i=0; i<N; i++)
{
value += qh[i]*PixSum[i];
......@@ -3193,6 +3193,7 @@ Void AdaptiveLoopFilter::xFrameChromaAlf( ALFParam* pcAlfParam, const PelUnitBuf
*pTmpPixSum = (*pTmpDec1);
value = 0;
const int N = (iTap*iTap+1)>>1;
for(i=0; i<N; i++)
{
value += qh[i]*PixSum[i];
......@@ -3308,6 +3309,7 @@ Void AdaptiveLoopFilter::xFrameChromaAlf( ALFParam* pcAlfParam, const PelUnitBuf
*pTmpPixSum =(*pTmpDec1);
value = 0;
const int N = (iTap*iTap+1)>>1;
for(i=0; i<N; i++)
{
value += qh[i]*PixSum[i];
......@@ -3356,4 +3358,4 @@ void AdaptiveLoopFilter::loadALFParam( ALFParam* pAlfParam, unsigned idx, unsign
copyALFParam(pAlfParam, &m_acStoredAlfPara[tLayer][idx], false);
}
#endif
\ No newline at end of file
#endif
......@@ -375,6 +375,9 @@ Void LoopFilter::xSetEdgefilterMultipleSubPu(const CodingUnit& cu,
void LoopFilter::xSetLoopfilterParam( const CodingUnit& cu )
{
const Slice& slice = *cu.slice;
#if HEVC_TILES_WPP
const PPS& pps = *cu.cs->pps;
#endif
if( slice.getDeblockingFilterDisable() )
{
......
......@@ -575,7 +575,7 @@ enum DFunc
DF_SAD_FULL_NBIT32 = DF_SAD_FULL_NBIT+5, ///< 32xM SAD with full bit usage
DF_SAD_FULL_NBIT64 = DF_SAD_FULL_NBIT+6, ///< 64xM SAD with full bit usage
DF_SAD_FULL_NBIT16N = DF_SAD_FULL_NBIT+7, ///< 16NxM SAD with full bit usage
#if WCG_EXT
DF_SSE_WTD = 54, ///< general size SSE
DF_SSE2_WTD = DF_SSE_WTD+1, ///< 4xM SSE
......@@ -1186,7 +1186,11 @@ struct LumaLevelToDeltaQPMapping
LumaLevelToDQPMode mode; ///< use deltaQP determined by block luma level
Double maxMethodWeight; ///< weight of max luma value when mode = 2
std::vector< std::pair<Int, Int> > mapping; ///< first=luma level, second=delta QP.
#if ENABLE_QPA
bool isEnabled() const { return (mode != LUMALVL_TO_DQP_DISABLED && mode != LUMALVL_TO_DQP_NUM_MODES); }
#else
Bool isEnabled() const { return mode!=LUMALVL_TO_DQP_DISABLED; }
#endif
};
#endif
......
......@@ -130,6 +130,10 @@ Void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream )
#endif
#if HEVC_TILES_WPP
const int startCtuRsAddr = tileMap.getCtuTsToRsAddrMap(startCtuTsAddr);
#else
#if HEVC_DEPENDENT_SLICES
const int startCtuRsAddr = startCtuTsAddr;
#endif
#endif
const unsigned numCtusInFrame = cs.pcv->sizeInCtus;
const unsigned widthInCtus = cs.pcv->widthInCtus;
......@@ -164,6 +168,8 @@ Void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream )
// This calculates the common offset for all substreams in this slice.
#if HEVC_DEPENDENT_SLICES
const unsigned subStreamOffset = tileMap.getSubstreamForCtuAddr( startCtuRsAddr, true, slice );
#elif HEVC_TILES_WPP
const unsigned subStreamOffset = 0;
#endif
#if HEVC_DEPENDENT_SLICES
......
......@@ -1102,7 +1102,9 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
{
#if HEVC_TILES_WPP
const TileMap& tileMap = *tempCS->picture->tileMap;
const UInt CtuAddr = CU::getCtuAddr( *bestCS->getCU( partitioner.chType ) );
#endif
#if HEVC_TILES_WPP || HEVC_DEPENDENT_SLICES
const UInt CtuAddr = CU::getCtuAddr( *bestCS->getCU( partitioner.chType ) );
#endif
const Bool isEndOfSlice = slice.getSliceMode() == FIXED_NUMBER_OF_BYTES
&& ((slice.getSliceBits() + CS::getEstBits(*bestCS)) > slice.getSliceArgument() << 3)
......
......@@ -804,15 +804,8 @@ static bool applyQPAdaptation (Picture* const pcPic, Slice* const pcSlice, co
iQPAdapt = max (0, iQPAdapt + 1 - int((3 * uAvgLuma * uAvgLuma) >> UInt64(2 * iBitDepth - 1)));
}
const UInt uRefScale = g_invQuantScales[iQPAdapt % 6] << ((iQPAdapt / 6) + iBitDepth - (pcSlice->isIntra() ? 4 : 3));
#else
const UInt uRefScale = g_invQuantScales[iQPAdapt % 6] << ((iQPAdapt / 6) + iBitDepth - 3);
#endif
#if HEVC_TILES_WPP
const UInt ctuRsAddr = tileMap.getCtuTsToRsAddrMap (ctuTsAddr);
#else
const UInt ctuRsAddr = ctuTsAddr;
#endif
const UInt uRefScale = g_invQuantScales[iQPAdapt % 6] << ((iQPAdapt / 6) + iBitDepth - (pcSlice->isIntra() ? 4 : 3));
const CompArea subArea = clipArea (CompArea (COMPONENT_Y, pcPic->chromaFormat, Area ((ctuRsAddr % pcv.widthInCtus) * pcv.maxCUWidth, (ctuRsAddr / pcv.widthInCtus) * pcv.maxCUHeight, pcv.maxCUWidth, pcv.maxCUHeight)), pcPic->Y());
const Pel* pSrc = pcPic->getOrigBuf (subArea).buf;
const SizeType iSrcStride = pcPic->getOrigBuf (subArea).stride;
......@@ -1226,11 +1219,11 @@ Void EncSlice::compressSlice( Picture* pcPic, const Bool bCompressEntireSlice, c
{
for (UInt ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr; ctuTsAddr++)
{
#if HEVC_TILES_WPP
#if HEVC_TILES_WPP
const UInt ctuRsAddr = tileMap.getCtuTsToRsAddrMap (ctuTsAddr);
#else
#else
const UInt ctuRsAddr = ctuTsAddr;
#endif
#endif
const Position pos ((ctuRsAddr % widthInCtus) * pcv.maxCUWidth, (ctuRsAddr / widthInCtus) * pcv.maxCUHeight);
const CompArea subArea = clipArea (CompArea (COMPONENT_Y, pcPic->chromaFormat, Area (pos.x, pos.y, pcv.maxCUWidth, pcv.maxCUHeight)), pcPic->Y());
const CompArea fltArea = clipArea (CompArea (COMPONENT_Y, pcPic->chromaFormat, Area (pos.x > 0 ? pos.x - 1 : 0, pos.y > 0 ? pos.y - 1 : 0, pcv.maxCUWidth + (pos.x > 0 ? 2 : 1), pcv.maxCUHeight + (pos.y > 0 ? 2 : 1))), pcPic->Y());
......@@ -1428,9 +1421,9 @@ void EncSlice::encodeCtus( Picture* pcPic, const Bool bCompressEntireSlice, cons
for( UInt ctuTsAddr = startCtuTsAddr; ctuTsAddr < boundingCtuTsAddr; ctuTsAddr++ )
{
#if HEVC_TILES_WPP
const int ctuRsAddr = tileMap.getCtuTsToRsAddrMap(ctuTsAddr);
const UInt ctuRsAddr = tileMap.getCtuTsToRsAddrMap(ctuTsAddr);
#else
const int ctuRsAddr = ctuTsAddr;
const UInt ctuRsAddr = ctuTsAddr;
#endif
#if HEVC_TILES_WPP
......@@ -1440,7 +1433,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const Bool bCompressEntireSlice, cons
#endif
const UInt ctuXPosInCtus = ctuRsAddr % widthInCtus;
const UInt ctuYPosInCtus = ctuRsAddr / widthInCtus;
const Position pos (ctuXPosInCtus * pcv.maxCUWidth, ctuYPosInCtus * pcv.maxCUHeight);
const UnitArea ctuArea( cs.area.chromaFormat, Area( pos.x, pos.y, pcv.maxCUWidth, pcv.maxCUHeight ) );
#if JEM_TOOLS
......@@ -1779,7 +1772,6 @@ Void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, UI
const UInt tileYPosInCtus = firstCtuRsAddrOfTile / widthInCtus;
#else
const UInt ctuRsAddr = ctuTsAddr;
#endif
const UInt ctuXPosInCtus = ctuRsAddr % widthInCtus;
const UInt ctuYPosInCtus = ctuRsAddr / widthInCtus;
......@@ -1869,7 +1861,7 @@ Void EncSlice::encodeSlice ( Picture* pcPic, OutputBitstream* pcSubstreams, UI
)
)
#else
if( ctuTsAddr + 1 == boundingCtuTsAddr)
if( ctuTsAddr + 1 == boundingCtuTsAddr )
#endif
{
m_CABACWriter->end_of_slice();
......@@ -1921,12 +1913,10 @@ Void EncSlice::calculateBoundingCtuTsAddrForSlice(UInt &startCtuTSAddrSlice, UIn
{
#if HEVC_TILES_WPP
Slice* pcSlice = pcPic->slices[getSliceSegmentIdx()];
const TileMap& tileMap = *(pcPic->tileMap);
const TileMap& tileMap = *( pcPic->tileMap );
const PPS &pps = *( pcSlice->getPPS() );
#endif
const UInt numberOfCtusInFrame = pcPic->cs->pcv->sizeInCtus;
#if HEVC_TILES_WPP
const PPS &pps=*(pcSlice->getPPS());
#endif
boundingCtuTSAddrSlice=0;
#if HEVC_TILES_WPP
haveReachedTileBoundary=false;
......
......@@ -75,7 +75,8 @@ IntraSearch::IntraSearch()
{
m_pSharedPredTransformSkip[ch] = nullptr;
}
#if JEM_TOOLS
#if JEM_TOOLS && !ENABLE_BMS
m_pLMMFPredSaved = new Pel*[8];//4*(Cb+Cr)
for (Int k = 0; k < 8; k++)
{
......@@ -166,7 +167,7 @@ Void IntraSearch::destroy()
m_pSharedPredTransformSkip[ch] = nullptr;
}
#if JEM_TOOLS
#if JEM_TOOLS && !ENABLE_BMS
for (Int k = 0; k < 8; k++)
{
delete[]m_pLMMFPredSaved[k];
......@@ -1030,8 +1031,10 @@ Void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner)
predIntraChromaLM(COMPONENT_Cb, piPredCb, pu, areaCb, uiMode);
#if !ENABLE_BMS
PelBuf savePredCb(m_pLMMFPredSaved[(uiMode - LM_CHROMA_F1_IDX) * 2], areaCb.width, areaCb);
savePredCb.copyFrom(piPredCb);
#endif
uiSad += distParam.distFunc(distParam);
CompArea areaCr = pu.Cr();
......@@ -1043,9 +1046,10 @@ Void IntraSearch::estIntraPredChromaQT(CodingUnit &cu, Partitioner &partitioner)
predIntraChromaLM(COMPONENT_Cr, piPredCr, pu, areaCr, uiMode);
#if !ENABLE_BMS
PelBuf savePredCr(m_pLMMFPredSaved[(uiMode - LM_CHROMA_F1_IDX) * 2 + 1], areaCr.width, areaCr);
savePredCr.copyFrom(piPredCr);
#endif
uiSad += distParam.distFunc(distParam);
auiSATDSortedcost[iCurLMMFIdx] = uiSad;
......@@ -1647,7 +1651,7 @@ Void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
//===== init availability pattern =====
PelBuf sharedPredTS( m_pSharedPredTransformSkip[compID], area );
#if JEM_TOOLS
#if JEM_TOOLS && !ENABLE_BMS
if( pu.cs->pcv->noRQT && pu.cs->sps->getSpsNext().isELMModeMFLM() && ( ( uiChFinalMode >= LM_CHROMA_F1_IDX ) && ( uiChFinalMode < LM_CHROMA_F1_IDX + LM_FILTER_NUM ) ) )
{
PelBuf savePred( m_pLMMFPredSaved[( uiChFinalMode - LM_CHROMA_F1_IDX ) * 2 + compID - COMPONENT_Cb], area.width, area );
......@@ -1665,7 +1669,9 @@ Void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
#if JEM_TOOLS
if( compID != COMPONENT_Y && PU::isLMCMode( uiChFinalMode ) )
{
#if !ENABLE_BMS
if( !PU::isMFLMEnabled(pu) || !pu.cs->pcv->noRQT)
#endif
{
xGetLumaRecPixels( pu, area );
}
......
......@@ -78,7 +78,7 @@ private:
CodingStructure **m_pSaveCS;
#if JEM_TOOLS
#if JEM_TOOLS && !ENABLE_BMS
Pel **m_pLMMFPredSaved;
#endif
......
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