Commit e115b475 authored by Remy Foray's avatar Remy Foray

Fix segmentation fault after !1133

scalingListAps does not exist when slice_scaling_list_present_flag = 0.
Set Quant::m_scalingListEnabledFlag to sps_scaling_list_present_flag && slice_scaling_list_present_flag.
and use it to derive disableSMForLFNST
parent 68762f78
......@@ -1650,14 +1650,14 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff
const uint32_t log2TrHeight = floorLog2(height);
#if JVET_P0058_CHROMA_TS
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = getScalingListEnabled() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP));
#endif
#else
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = getScalingListEnabled() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)), tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)));
......@@ -1705,14 +1705,14 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo
const uint32_t log2TrHeight = floorLog2(height);
#if JVET_P0058_CHROMA_TS
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = getScalingListEnabled() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP));
#endif
#else
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = getScalingListEnabled() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)), tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx == MTS_SKIP && isLuma(compID)));
......
......@@ -384,7 +384,7 @@ void Quant::dequant(const TransformUnit &tu,
#endif
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = m_scalingListEnabledFlag ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip);
......@@ -1087,7 +1087,7 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf
int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight);
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = m_scalingListEnabledFlag ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip, tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip);
......@@ -1177,7 +1177,7 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff
int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight);
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = m_scalingListEnabledFlag ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0), tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0));
......@@ -1231,7 +1231,7 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co
const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange);
const int scalingListType = getScalingListType(tu.cu->predMode, compID);
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = m_scalingListEnabledFlag ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true);
......@@ -1313,7 +1313,7 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp
const int iTransformShift = getTransformShift(channelBitDepth, rect.size(), maxLog2TrDynamicRange);
const int scalingListType = getScalingListType(tu.cu->predMode, compID);
#if JVET_P0365_SCALING_MATRIX_LFNST
const bool disableSMForLFNST = tu.cs->sps->getScalingListFlag() ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool disableSMForLFNST = m_scalingListEnabledFlag ? tu.cs->slice->getscalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false;
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, tu.cu->lfnstIdx > 0, disableSMForLFNST);
#else
const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true);
......
......@@ -126,6 +126,7 @@ public:
int* getDequantCoeff ( uint32_t list, int qp, uint32_t sizeX, uint32_t sizeY ) { return m_dequantCoef [sizeX][sizeY][list][qp]; }; //!< get DeQuant Coefficent
void setUseScalingList ( bool bUseScalingList){ m_scalingListEnabledFlag = bUseScalingList; };
bool getScalingListEnabled () const { return m_scalingListEnabledFlag; };
#if JVET_P0365_SCALING_MATRIX_LFNST
bool getUseScalingList(const uint32_t width, const uint32_t height, const bool isTransformSkip, const bool lfnstApplied, const bool disableScalingMatrixForLFNSTBlks)
{
......
......@@ -1584,13 +1584,13 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
{
APS* scalingListAPS = pcSlice->getscalingListAPS();
scalingList = scalingListAPS->getScalingList();
quant->setUseScalingList( true );
quant->setScalingListDec( scalingList );
}
else
{
scalingList.setDefaultScalingList();
quant->setUseScalingList( false );
}
quant->setScalingListDec( scalingList );
quant->setUseScalingList( true );
}
else
{
......
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