diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index b250b5dc803c6e6a6092c1c6645929fa61e29f87..590f7e2bfbd38a4705e7291172d9e4fe3107ccfe 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -735,6 +735,16 @@ void EncApp::xInitLibCfg() m_cEncLib.setUseScalingListId ( m_useScalingListId ); m_cEncLib.setScalingListFileName ( m_scalingListFileName ); m_cEncLib.setDisableScalingMatrixForLfnstBlks ( m_disableScalingMatrixForLfnstBlks); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + if ( m_cEncLib.getUseColorTrans() && m_cEncLib.getUseScalingListId() ) + { + m_cEncLib.setDisableScalingMatrixForAlternativeColourSpace(m_disableScalingMatrixForAlternativeColourSpace); + } + if ( m_cEncLib.getDisableScalingMatrixForAlternativeColourSpace() ) + { + m_cEncLib.setScalingMatrixDesignatedColourSpace(m_scalingMatrixDesignatedColourSpace); + } +#endif m_cEncLib.setDepQuantEnabledFlag ( m_depQuantEnabledFlag); m_cEncLib.setSignDataHidingEnabledFlag ( m_signDataHidingEnabledFlag); m_cEncLib.setUseRateCtrl ( m_RCEnableRateControl ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 673eb6141870c9a23a9c6c20e0d4f4105059ae4d..25c5ad560b1e8224ca4f80840cf57eadb23640d5 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1103,6 +1103,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("ScalingList", m_useScalingListId, SCALING_LIST_OFF, "0/off: no scaling list, 1/default: default scaling lists, 2/file: scaling lists specified in ScalingListFile") ("ScalingListFile", m_scalingListFileName, string(""), "Scaling list file name. Use an empty string to produce help.") ("DisableScalingMatrixForLFNST", m_disableScalingMatrixForLfnstBlks, true, "Disable scaling matrices, when enabled, for LFNST-coded blocks") +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + ("DisableScalingMatrixForAlternativeColourSpace", m_disableScalingMatrixForAlternativeColourSpace, false, "Disable scaling matrices when the colour space is not equal to the designated colour space of scaling matrix") + ("ScalingMatrixDesignatedColourSpace", m_scalingMatrixDesignatedColourSpace, true, "Indicates if the designated colour space of scaling matrices is equal to the original colour space") +#endif ("DepQuant", m_depQuantEnabledFlag, true, "Enable dependent quantization (Default: 1)" ) ("SignHideFlag,-SBH", m_signDataHidingEnabledFlag, false, "Enable sign hiding" ) ("MaxNumMergeCand", m_maxNumMergeCand, 5u, "Maximum number of merge candidates") diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 2f19e32b65555b8686784e0d3271eefb71d4c0d7..7788dc9eb78e382c07f414247a0917b04218352b 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -623,6 +623,10 @@ protected: ScalingListMode m_useScalingListId; ///< using quantization matrix std::string m_scalingListFileName; ///< quantization matrix file name bool m_disableScalingMatrixForLfnstBlks; +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + bool m_disableScalingMatrixForAlternativeColourSpace; + bool m_scalingMatrixDesignatedColourSpace; +#endif CostMode m_costMode; ///< Cost mode to use #if JVET_R0143_TSRCdisableLL bool m_TSRCdisableLL; ///< disable TSRC for lossless diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp index 06b168d49d34180587b0b1a270779124527e44db..45ec89bc63cfd47bd8effba28d76d44ae94023d3 100644 --- a/source/Lib/CommonLib/DepQuant.cpp +++ b/source/Lib/CommonLib/DepQuant.cpp @@ -1593,7 +1593,12 @@ void DepQuant::quant( TransformUnit &tu, const ComponentID &compID, const CCoeff const uint32_t log2TrHeight = floorLog2(height); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), isLfnstApplied, disableSMForLFNST); +#endif static_cast<DQIntern::DepQuant*>(p)->quant( tu, pSrc, compID, cQP, Quant::m_dLambda, ctx, uiAbsSum, enableScalingLists, Quant::getQuantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); } else @@ -1623,7 +1628,12 @@ void DepQuant::dequant( const TransformUnit &tu, CoeffBuf &dstCoeff, const Compo const uint32_t log2TrHeight = floorLog2(height); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(width, height, (tu.mtsIdx[compID] == MTS_SKIP), isLfnstApplied, disableSMForLFNST); +#endif static_cast<DQIntern::DepQuant*>(p)->dequant( tu, dstCoeff, compID, cQP, enableScalingLists, Quant::getDequantCoeff(scalingListType, qpRem, log2TrWidth, log2TrHeight) ); } else diff --git a/source/Lib/CommonLib/Quant.cpp b/source/Lib/CommonLib/Quant.cpp index 16456be300a0e499f05fd04f693efbf1877cf748..15489433d85cb91bfc0a8f08151ee1cef2b62c13 100644 --- a/source/Lib/CommonLib/Quant.cpp +++ b/source/Lib/CommonLib/Quant.cpp @@ -383,7 +383,12 @@ void Quant::dequant(const TransformUnit &tu, const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, isLfnstApplied, disableSMForLFNST); +#endif const int scalingListType = getScalingListType(tu.cu->predMode, compID); const int channelBitDepth = sps->getBitDepth(toChannelType(compID)); @@ -995,7 +1000,12 @@ void Quant::quant(TransformUnit &tu, const ComponentID &compID, const CCoeffBuf int *piQuantCoeff = getQuantCoeff(scalingListType, cQP.rem(useTransformSkip), uiLog2TrWidth, uiLog2TrHeight); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip, isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, useTransformSkip, isLfnstApplied, disableSMForLFNST); +#endif // for blocks that where width*height != 4^N, the effective scaling applied during transformation cannot be // compensated by a bit-shift (the quantised result will be sqrt(2) * larger than required). @@ -1074,7 +1084,12 @@ bool Quant::xNeedRDOQ(TransformUnit &tu, const ComponentID &compID, const CCoeff const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0), isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, (useTransformSkip != 0), isLfnstApplied, disableSMForLFNST); +#endif /* 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 @@ -1125,7 +1140,12 @@ void Quant::transformSkipQuantOneSample(TransformUnit &tu, const ComponentID &co const int scalingListType = getScalingListType(tu.cu->predMode, compID); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, isLfnstApplied, disableSMForLFNST); +#endif const bool useTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); const int defaultQuantisationCoefficient = g_quantScales[0][cQP.rem(useTransformSkip)]; @@ -1185,7 +1205,12 @@ void Quant::invTrSkipDeQuantOneSample(TransformUnit &tu, const ComponentID &comp const int scalingListType = getScalingListType(tu.cu->predMode, compID); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, true, isLfnstApplied, disableSMForLFNST); +#endif CHECK(scalingListType >= SCALING_LIST_NUM, "Invalid scaling list"); const bool isTransformSkip = (tu.mtsIdx[compID] == MTS_SKIP); diff --git a/source/Lib/CommonLib/Quant.h b/source/Lib/CommonLib/Quant.h index e1b561cf10cdef5ff87d69bc308a52b15c3d5d17..0a1b5570e451f273fd7a01d7a58e07ffbf45b930 100644 --- a/source/Lib/CommonLib/Quant.h +++ b/source/Lib/CommonLib/Quant.h @@ -134,9 +134,17 @@ 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; }; +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + bool getUseScalingList(const uint32_t width, const uint32_t height, const bool isTransformSkip, const bool lfnstApplied, const bool disableScalingMatrixForLFNSTBlks, const bool disableSMforACT) +#else bool getUseScalingList(const uint32_t width, const uint32_t height, const bool isTransformSkip, const bool lfnstApplied, const bool disableScalingMatrixForLFNSTBlks) +#endif { +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + return (m_scalingListEnabledFlag && !isTransformSkip && (!lfnstApplied || !disableScalingMatrixForLFNSTBlks) && !disableSMforACT); +#else return (m_scalingListEnabledFlag && !isTransformSkip && (!lfnstApplied || !disableScalingMatrixForLFNSTBlks)); +#endif } void setScalingListDec ( const ScalingList &scalingList); void processScalingListEnc ( int *coeff, int *quantcoeff, int qpMod6, uint32_t height, uint32_t width, uint32_t ratio, int sizuNum, uint32_t dc); diff --git a/source/Lib/CommonLib/QuantRDOQ.cpp b/source/Lib/CommonLib/QuantRDOQ.cpp index 881f0178c4f42f4d62e5d4534b1230cc9582ee9f..b748319be744ec0a2a06ba082cffb514915793be 100644 --- a/source/Lib/CommonLib/QuantRDOQ.cpp +++ b/source/Lib/CommonLib/QuantRDOQ.cpp @@ -631,7 +631,12 @@ void QuantRDOQ::xRateDistOptQuant(TransformUnit &tu, const ComponentID &compID, const int *const piQCoef = getQuantCoeff(scalingListType, cQP.rem(isTransformSkip), uiLog2BlockWidth, uiLog2BlockHeight); const bool disableSMForLFNST = tu.cs->slice->getExplicitScalingListUsed() ? tu.cs->picHeader->getScalingListAPS()->getScalingList().getDisableScalingMatrixForLfnstBlks() : false; const bool isLfnstApplied = tu.cu->lfnstIdx > 0 && (tu.cu->isSepTree() ? true : isLuma(compID)); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + const bool disableSMForACT = tu.cs->slice->getSPS()->getScalingMatrixForAlternativeColourSpaceDisabledFlag() && (tu.cs->slice->getSPS()->getScalingMatrixDesignatedColourSpaceFlag() == tu.cu->colorTransform); + const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, isLfnstApplied, disableSMForLFNST, disableSMForACT); +#else const bool enableScalingLists = getUseScalingList(uiWidth, uiHeight, isTransformSkip, isLfnstApplied, disableSMForLFNST); +#endif const int defaultQuantisationCoefficient = g_quantScales[ needSqrtAdjustment ?1:0][cQP.rem(isTransformSkip)]; const double defaultErrorScale = xGetErrScaleCoeffNoScalingList(scalingListType, uiLog2BlockWidth, uiLog2BlockHeight, cQP.rem(isTransformSkip)); const int iQBits = QUANT_SHIFT + cQP.per(isTransformSkip) + iTransformShift + (needSqrtAdjustment?-1:0); // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 7de09c48eb384a64a3011f42a4d6f08b980c4f85..0fd8235aa60625ac85ea184aa668841dc2e5ffb8 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -2463,6 +2463,10 @@ SPS::SPS() , m_maxNumAffineMergeCand(AFFINE_MRG_MAX_NUM_CANDS) , m_maxNumIBCMergeCand(IBC_MRG_MAX_NUM_CANDS) , m_maxNumGeoCand(0) +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB +, m_scalingMatrixAlternativeColourSpaceDisabledFlag( false ) +, m_scalingMatrixDesignatedColourSpaceFlag( true ) +#endif { for(int ch=0; ch<MAX_NUM_CHANNEL_TYPE; ch++) { diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index 65f2870b61bfeede0414a2f5f0bd6afcbfd38ace..e42123ee4d4484be43d52a52483c3e140f57d075 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -1392,6 +1392,10 @@ private: uint32_t m_maxNumAffineMergeCand; uint32_t m_maxNumIBCMergeCand; uint32_t m_maxNumGeoCand; +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + bool m_scalingMatrixAlternativeColourSpaceDisabledFlag; + bool m_scalingMatrixDesignatedColourSpaceFlag; +#endif public: SPS(); @@ -1768,6 +1772,12 @@ void setCCALFEnabledFlag( bool b ) bool getPPSValidFlag(int i) { return m_ppsValidFlag[i]; } void setScalingWindowSizeInPPS(int i, int scWidth, int scHeight) { m_scalingWindowSizeInPPS[i].width = scWidth; m_scalingWindowSizeInPPS[i].height = scHeight;} const Size& getScalingWindowSizeInPPS(int i) { return m_scalingWindowSizeInPPS[i]; } +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + void setScalingMatrixForAlternativeColourSpaceDisabledFlag(bool b) { m_scalingMatrixAlternativeColourSpaceDisabledFlag = b; } + bool getScalingMatrixForAlternativeColourSpaceDisabledFlag() const { return m_scalingMatrixAlternativeColourSpaceDisabledFlag; } + void setScalingMatrixDesignatedColourSpaceFlag(bool b) { m_scalingMatrixDesignatedColourSpaceFlag = b; } + bool getScalingMatrixDesignatedColourSpaceFlag() const { return m_scalingMatrixDesignatedColourSpaceFlag; } +#endif }; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 23b29455535515e3cf29c0aea7beb866e8a160d7..116639f9e90259821294de3a1eb7b4115ce46dce 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -53,6 +53,8 @@ //########### place macros to be removed in next cycle below this line ############### #define JVET_R0483_SH_TSRC_DISABLED_FLAG_CLEANUP 1 // JVET-R0483 Comb 4: R0049 + R0271, only R0049 method 3 aspect (Skip signaling sh_ts_residual_coding_disabled_flag when sps_transform_skip_enabled_flag = 0, also proposed in R0068, R0097, R0142, R0153) as R0271 has its own macro +#define JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB 1 // JVET-R0380 solution3-3: Disable scaling matrix for blocks coded in alternative colour space. + #define R0324_PH_SYNTAX_CONDITION_MODIFY 1 // JVET-R0324 add conditions on PH syntax to conder whether current pic is bi-predictive picture #define JVET_R0278_CONSTRAINT 1 // JVET-R0278: ph_inter_slice_allowed_flag constraint diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 8d9788e8f701da33d1e070b094eb18d586ddc246..d385120832b3423496ba0e9218c826e9faa0dfa5 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1917,6 +1917,16 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) pcSPS->setLog2ParallelMergeLevelMinus2(uiCode); READ_FLAG(uiCode, "sps_explicit_scaling_list_enabled_flag"); pcSPS->setScalingListFlag(uiCode); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + if (pcSPS->getUseColorTrans() && pcSPS->getScalingListFlag()) + { + READ_FLAG(uiCode, "sps_scaling_matrix_for_alternative_colour_space_disabled_flag"); pcSPS->setScalingMatrixForAlternativeColourSpaceDisabledFlag(uiCode); + } + if (pcSPS->getScalingMatrixForAlternativeColourSpaceDisabledFlag()) + { + READ_FLAG(uiCode, "sps_scaling_matrix_designated_colour_space_flag"); pcSPS->setScalingMatrixDesignatedColourSpaceFlag(uiCode); + } +#endif READ_FLAG(uiCode, "sps_dep_quant_enabled_flag"); pcSPS->setDepQuantEnabledFlag(uiCode); if (!pcSPS->getDepQuantEnabledFlag()) { diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index c2587682ed95e9d89d462074169a80a7f2abf55c..41742926dd801d70d16d96d2ce15c4da0f76ff4f 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -622,6 +622,10 @@ protected: uint32_t m_maxNumIBCMergeCand; ///< Max number of IBC merge candidates ScalingListMode m_useScalingListId; ///< Using quantization matrix i.e. 0=off, 1=default, 2=file. std::string m_scalingListFileName; ///< quantization matrix file name +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + bool m_disableScalingMatrixForAlternativeColourSpace; + bool m_scalingMatrixDesignatedColourSpace; +#endif bool m_sliceLevelRpl; ///< code reference picture lists in slice headers rather than picture header bool m_sliceLevelDblk; ///< code deblocking filter parameters in slice headers rather than picture header bool m_sliceLevelSao; ///< code SAO parameters in slice headers rather than picture header @@ -1649,6 +1653,12 @@ public: ScalingListMode getUseScalingListId () { return m_useScalingListId; } void setScalingListFileName ( const std::string &s ) { m_scalingListFileName = s; } const std::string& getScalingListFileName () const { return m_scalingListFileName; } +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + void setDisableScalingMatrixForAlternativeColourSpace(bool b) { m_disableScalingMatrixForAlternativeColourSpace = b; } + bool getDisableScalingMatrixForAlternativeColourSpace() { return m_disableScalingMatrixForAlternativeColourSpace; } + void setScalingMatrixDesignatedColourSpace (bool b) { m_scalingMatrixDesignatedColourSpace = b; } + bool getScalingMatrixDesignatedColourSpace () { return m_scalingMatrixDesignatedColourSpace; } +#endif void setSliceLevelRpl ( bool b ) { m_sliceLevelRpl = b; } bool getSliceLevelRpl () { return m_sliceLevelRpl; } void setSliceLevelDblk ( bool b ) { m_sliceLevelDblk = b; } diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 6c9e60ef1d62c99d2b7163ed019332c486bf12eb..07d1a62855e5641215b3d6f421940c032adb862e 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -1246,6 +1246,10 @@ void EncLib::xInitSPS( SPS& sps ) } sps.setScalingListFlag ( (m_useScalingListId == SCALING_LIST_OFF) ? 0 : 1 ); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + sps.setScalingMatrixForAlternativeColourSpaceDisabledFlag( m_disableScalingMatrixForAlternativeColourSpace ); + sps.setScalingMatrixDesignatedColourSpaceFlag( m_scalingMatrixDesignatedColourSpace ); +#endif sps.setALFEnabledFlag( m_alf ); sps.setCCALFEnabledFlag( m_ccalf ); sps.setFieldSeqFlag(false); diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 36158eda8b2b710f670442562b8f2875f47962ca..1d338fa6ad1cfec5ffc6fe0922644eb01cffa3b0 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1184,6 +1184,16 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) // KJS: remove scaling lists? WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "sps_scaling_list_enabled_flag" ); +#if JVET_R0380_SCALING_MATRIX_DISABLE_YCC_OR_RGB + if (pcSPS->getUseColorTrans() && pcSPS->getScalingListFlag()) + { + WRITE_FLAG(pcSPS->getScalingMatrixForAlternativeColourSpaceDisabledFlag(), "sps_scaling_matrix_for_alternative_colour_space_disabled_flag"); + } + if (pcSPS->getScalingMatrixForAlternativeColourSpaceDisabledFlag()) + { + WRITE_FLAG(pcSPS->getScalingMatrixDesignatedColourSpaceFlag(), "sps_scaling_matrix_designated_colour_space_flag"); + } +#endif WRITE_FLAG(pcSPS->getDepQuantEnabledFlag(), "sps_dep_quant_enabled_flag"); if (!pcSPS->getDepQuantEnabledFlag()) {