diff --git a/doc/software-manual.pdf b/doc/software-manual.pdf index 2b45b25927e2db47494e6cd83e69346f55d9832c..92c9b04aaa9a744b6f7767f7efe99be4d80325a7 100644 Binary files a/doc/software-manual.pdf and b/doc/software-manual.pdf differ diff --git a/doc/software-manual.tex b/doc/software-manual.tex index 1e2f855a8bbadd25bee74e30a9c76a86170226c1..32224ab11da82c836b1bfe102d1a84de1cdb8742 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -2402,6 +2402,11 @@ Specifies the shift to apply to the SAO parameters. If negative, an estimate wil Specifies the maximum TU size for which transform-skip can be used; the minimum value is 2. Version 1 and some Version 2 (RExt) profiles require this to be 2. \\ +\Option{BDPCM} & +\Default{false} & +When true, specifies the use of the BDPCM tool (for intra). Version 1 and some Version 2 (RExt) profiles require this to be false. +\\ + \Option{ImplicitResidualDPCM} & \Default{false} & When true, specifies the use of the implicitly signalled residual RDPCM tool (for intra). Version 1 and some Version 2 (RExt) profiles require this to be false. diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 48b4c1149520e921ad77303d383b3d65c66b6c02..573358b74760a58601c227ed83c4ed3645831125 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -133,6 +133,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setNoTriangleConstraintFlag ( !m_Triangle ); m_cEncLib.setNoLadfConstraintFlag ( !m_LadfEnabed ); m_cEncLib.setNoTransformSkipConstraintFlag ( !m_useTransformSkip ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + m_cEncLib.setNoBDPCMConstraintFlag ( !m_useBDPCM ); +#endif m_cEncLib.setNoQpDeltaConstraintFlag ( m_bNoQpDeltaConstraintFlag ); m_cEncLib.setNoDepQuantConstraintFlag ( !m_depQuantEnabledFlag); m_cEncLib.setNoSignDataHidingConstraintFlag ( !m_signDataHidingEnabledFlag ); @@ -341,6 +344,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setLog2SaoOffsetScale ( CHANNEL_TYPE_CHROMA, m_log2SaoOffsetScale[CHANNEL_TYPE_CHROMA] ); m_cEncLib.setUseTransformSkip ( m_useTransformSkip ); m_cEncLib.setUseTransformSkipFast ( m_useTransformSkipFast ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + m_cEncLib.setUseBDPCM ( m_useBDPCM ); +#endif m_cEncLib.setTransformSkipRotationEnabledFlag ( m_transformSkipRotationEnabledFlag ); m_cEncLib.setTransformSkipContextEnabledFlag ( m_transformSkipContextEnabledFlag ); m_cEncLib.setPersistentRiceAdaptationEnabledFlag ( m_persistentRiceAdaptationEnabledFlag ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index c545ae37127e41222372bcbc2cd57e09b0ca905b..780ca157c36878cd7634960ce94d7c10de60bd2e 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -134,6 +134,9 @@ EncAppCfg::EncAppCfg() , m_bNoTriangleConstraintFlag(false) , m_bNoLadfConstraintFlag(false) , m_noTransformSkipConstraintFlag(false) +#if JVET_O1136_TS_BDPCM_SIGNALLING +, m_noBDPCMConstraintFlag(false) +#endif , m_bNoQpDeltaConstraintFlag(false) , m_bNoDepQuantConstraintFlag(false) , m_bNoSignDataHidingConstraintFlag(false) @@ -1050,6 +1053,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("TransformSkip", m_useTransformSkip, false, "Intra transform skipping") ("TransformSkipFast", m_useTransformSkipFast, false, "Fast encoder search for transform skipping, winner takes it all mode.") ("TransformSkipLog2MaxSize", m_log2MaxTransformSkipBlockSize, 5U, "Specify transform-skip maximum size. Minimum 2, Maximum 5. (not valid in V1 profiles)") +#if JVET_O1136_TS_BDPCM_SIGNALLING + ("BDPCM", m_useBDPCM, false, "BDPCM") +#endif ("ISPFast", m_useFastISP, false, "Fast encoder search for ISP") ("ImplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_IMPLICIT], false, "Enable implicitly signalled residual DPCM for intra (also known as sample-adaptive intra predict) (not valid in V1 profiles)") ("ExplicitResidualDPCM", m_rdpcmEnabledFlag[RDPCM_SIGNAL_EXPLICIT], false, "Enable explicitly signalled residual DPCM for inter (not valid in V1 profiles)") @@ -3251,6 +3257,9 @@ void EncAppCfg::xPrintParameter() msg( VERBOSE, "TransformSkip:%d ", m_useTransformSkip ); msg( VERBOSE, "TransformSkipFast:%d ", m_useTransformSkipFast ); msg( VERBOSE, "TransformSkipLog2MaxSize:%d ", m_log2MaxTransformSkipBlockSize); +#if JVET_O1136_TS_BDPCM_SIGNALLING + msg( VERBOSE, "BDPCM:%d ", m_useBDPCM ); +#endif msg( VERBOSE, "Slice: M=%d ", int(m_sliceMode)); if (m_sliceMode!=NO_SLICES) { diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 99eacd0a148545ebba0a34ebae784c64173a3bc2..9ba6b9afb643504a938443c05439bacbc02883c4 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -143,6 +143,9 @@ protected: bool m_bNoTriangleConstraintFlag; bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool m_noBDPCMConstraintFlag; +#endif bool m_bNoQpDeltaConstraintFlag; bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -180,6 +183,9 @@ protected: uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; ///< number of bits for the upward bit shift operation on the decoded SAO offsets bool m_useTransformSkip; ///< flag for enabling intra transform skipping bool m_useTransformSkipFast; ///< flag for enabling fast intra transform skipping +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool m_useBDPCM; +#endif uint32_t m_log2MaxTransformSkipBlockSize; ///< transform-skip maximum size (minimum of 2) bool m_transformSkipRotationEnabledFlag; ///< control flag for transform-skip/transquant-bypass residual rotation bool m_transformSkipContextEnabledFlag; ///< control flag for transform-skip/transquant-bypass single significance map context diff --git a/source/Lib/CommonLib/CommonDef.h b/source/Lib/CommonLib/CommonDef.h index 57cbdea4e8d5fcb2af4cd373a6d34cf0cbdc6bdb..cc2258ac1985888d3af916c9b51064e324fd8be4 100644 --- a/source/Lib/CommonLib/CommonDef.h +++ b/source/Lib/CommonLib/CommonDef.h @@ -370,7 +370,9 @@ static const int DMVR_SUBCU_WIDTH_LOG2 = 4; static const int DMVR_SUBCU_HEIGHT_LOG2 = 4; static const int MAX_NUM_SUBCU_DMVR = ((MAX_CU_SIZE * MAX_CU_SIZE) >> (DMVR_SUBCU_WIDTH_LOG2 + DMVR_SUBCU_HEIGHT_LOG2)); static const int DMVR_NUM_ITERATION = 2; +#if !JVET_O1136_TS_BDPCM_SIGNALLING static const int BDPCM_MAX_CU_SIZE = 32; ///< maximum CU size for RDPCM mode +#endif //QTBT high level parameters //for I slice luma CTB configuration para. diff --git a/source/Lib/CommonLib/Slice.cpp b/source/Lib/CommonLib/Slice.cpp index 42d91cd6ecd42f794fe0fa51d015d488442fa999..f5001fbc74512227e1bfe5590dbea59f7011a629 100644 --- a/source/Lib/CommonLib/Slice.cpp +++ b/source/Lib/CommonLib/Slice.cpp @@ -1404,6 +1404,10 @@ SPS::SPS() , m_pcmEnabledFlag (false) , m_pcmLog2MaxSize ( 5) , m_uiPCMLog2MinSize ( 7) +#if JVET_O1136_TS_BDPCM_SIGNALLING +, m_transformSkipEnabledFlag (false) +, m_BDPCMEnabledFlag (false) +#endif , m_bPCMFilterDisableFlag (false) , m_sbtmvpEnabledFlag (false) , m_bdofEnabledFlag (false) @@ -1519,7 +1523,9 @@ PPS::PPS() , m_numRefIdxL1DefaultActive (1) , m_rpl1IdxPresentFlag (false) , m_TransquantBypassEnabledFlag (false) +#if !JVET_O1136_TS_BDPCM_SIGNALLING , m_useTransformSkip (false) +#endif , m_entropyCodingSyncEnabledFlag (false) , m_loopFilterAcrossBricksEnabledFlag (true) , m_uniformTileSpacingFlag (false) diff --git a/source/Lib/CommonLib/Slice.h b/source/Lib/CommonLib/Slice.h index e4ce25345d1152655d5f75ab0673d03fa7c6acaa..68cd5bb508721a691d5c379e03726cd6d5cd445c 100644 --- a/source/Lib/CommonLib/Slice.h +++ b/source/Lib/CommonLib/Slice.h @@ -202,6 +202,9 @@ class ConstraintInfo bool m_noTriangleConstraintFlag; bool m_noLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool m_noBDPCMConstraintFlag; +#endif bool m_noQpDeltaConstraintFlag; bool m_noDepQuantConstraintFlag; bool m_noSignDataHidingConstraintFlag; @@ -237,6 +240,9 @@ public: , m_noTriangleConstraintFlag (false) , m_noLadfConstraintFlag (false) , m_noTransformSkipConstraintFlag(false) +#if JVET_O1136_TS_BDPCM_SIGNALLING + , m_noBDPCMConstraintFlag (false) +#endif , m_noQpDeltaConstraintFlag (false) , m_noDepQuantConstraintFlag (false) , m_noSignDataHidingConstraintFlag(false) @@ -313,6 +319,10 @@ public: void setNoLadfConstraintFlag(bool bVal) { m_noLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } void setNoTransformSkipConstraintFlag(bool bVal) { m_noTransformSkipConstraintFlag = bVal; } +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool getNoBDPCMConstraintFlag() const { return m_noBDPCMConstraintFlag; } + void setNoBDPCMConstraintFlag(bool bVal) { m_noBDPCMConstraintFlag = bVal; } +#endif bool getNoQpDeltaConstraintFlag() const { return m_noQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_noQpDeltaConstraintFlag = bVal; } bool getNoDepQuantConstraintFlag() const { return m_noDepQuantConstraintFlag; } @@ -709,6 +719,11 @@ private: uint32_t m_pcmLog2MaxSize; uint32_t m_uiPCMLog2MinSize; +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool m_transformSkipEnabledFlag; + bool m_BDPCMEnabledFlag; +#endif + // Parameter BitDepths m_bitDepths; int m_qpBDOffset[MAX_NUM_CHANNEL_TYPE]; @@ -865,6 +880,12 @@ public: uint32_t getPCMLog2MaxSize() const { return m_pcmLog2MaxSize; } void setPCMLog2MinSize( uint32_t u ) { m_uiPCMLog2MinSize = u; } uint32_t getPCMLog2MinSize() const { return m_uiPCMLog2MinSize; } +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool getTransformSkipEnabledFlag() const { return m_transformSkipEnabledFlag; } + void setTransformSkipEnabledFlag( bool b ) { m_transformSkipEnabledFlag = b; } + bool getBDPCMEnabledFlag() const { return m_BDPCMEnabledFlag; } + void setBDPCMEnabledFlag( bool b ) { m_BDPCMEnabledFlag = b; } +#endif void setBitsForPOC( uint32_t u ) { m_uiBitsForPOC = u; } uint32_t getBitsForPOC() const { return m_uiBitsForPOC; } void setNumReorderPics(int i, uint32_t tlayer) { m_numReorderPics[tlayer] = i; } @@ -1122,7 +1143,9 @@ private: bool m_useWeightedBiPred; //!< Use of Weighting Bi-Prediction (B_SLICE) bool m_OutputFlagPresentFlag; //!< Indicates the presence of output_flag in slice header bool m_TransquantBypassEnabledFlag; //!< Indicates presence of cu_transquant_bypass_flag in CUs. +#if !JVET_O1136_TS_BDPCM_SIGNALLING bool m_useTransformSkip; +#endif bool m_entropyCodingSyncEnabledFlag; //!< Indicates the presence of wavefronts bool m_loopFilterAcrossBricksEnabledFlag; @@ -1242,8 +1265,10 @@ public: void setTransquantBypassEnabledFlag( bool b ) { m_TransquantBypassEnabledFlag = b; } bool getTransquantBypassEnabledFlag() const { return m_TransquantBypassEnabledFlag; } +#if !JVET_O1136_TS_BDPCM_SIGNALLING bool getUseTransformSkip() const { return m_useTransformSkip; } void setUseTransformSkip( bool b ) { m_useTransformSkip = b; } +#endif void setLoopFilterAcrossBricksEnabledFlag(bool b) { m_loopFilterAcrossBricksEnabledFlag = b; } bool getLoopFilterAcrossBricksEnabledFlag() const { return m_loopFilterAcrossBricksEnabledFlag; } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 3c476b7766dfc4d4029e37b2a0e3b503932289c3..da35fe6364ecfa91734ef31f0b2c27f455954b02 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include <assert.h> #include <cassert> +#define JVET_O1136_TS_BDPCM_SIGNALLING 1 // JVET-O1136: Unified syntax for JVET-O0165/O0200/O0783 on TS and BDPCM signalling + #define JVET_O0219_LFNST_TRANSFORM_SET_FOR_LMCMODE 1 #define JVET_O0426_MRL_REF_SAMPLES_DC_MODE 1 // JVET-O0426: align MRL reference samples used for DC intra mode prediction diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 028f88c7e144d0f0991ed4fc0378efa7a507881e..3aec86d1c7ecd686ae3016706a192622e5ba08ab 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -4524,9 +4524,17 @@ uint8_t CU::deriveGbiIdx( uint8_t gbiLO, uint8_t gbiL1 ) bool CU::bdpcmAllowed( const CodingUnit& cu, const ComponentID compID ) { +#if JVET_O1136_TS_BDPCM_SIGNALLING + SizeType transformSkipMaxSize = 1 << cu.cs->pps->getPpsRangeExtension().getLog2MaxTransformSkipBlockSize(); +#endif + bool bdpcmAllowed = compID == COMPONENT_Y; bdpcmAllowed &= CU::isIntra( cu ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + bdpcmAllowed &= ( cu.lwidth() <= transformSkipMaxSize && cu.lheight() <= transformSkipMaxSize ); +#else bdpcmAllowed &= ( cu.lwidth() <= 32 && cu.lheight() <= 32 ); +#endif return bdpcmAllowed; } @@ -4560,11 +4568,20 @@ bool TU::isTSAllowed(const TransformUnit &tu, const ComponentID compID) bool tsAllowed = compID == COMPONENT_Y; const int maxSize = tu.cs->pps->getPpsRangeExtension().getLog2MaxTransformSkipBlockSize(); +#if JVET_O1136_TS_BDPCM_SIGNALLING + tsAllowed &= tu.cs->sps->getTransformSkipEnabledFlag(); +#else tsAllowed &= tu.cs->pps->getUseTransformSkip(); +#endif tsAllowed &= !tu.cu->transQuantBypass; tsAllowed &= ( !tu.cu->ispMode || !isLuma(compID) ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + SizeType transformSkipMaxSize = 1 << maxSize; + tsAllowed &= !(tu.cu->bdpcmMode && tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize); +#else tsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= BDPCM_MAX_CU_SIZE && tu.lheight() <= BDPCM_MAX_CU_SIZE ); SizeType transformSkipMaxSize = 1 << maxSize; +#endif tsAllowed &= tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize; tsAllowed &= !tu.cu->sbtInfo; @@ -4580,7 +4597,12 @@ bool TU::isMTSAllowed(const TransformUnit &tu, const ComponentID compID) mtsAllowed &= ( tu.lwidth() <= maxSize && tu.lheight() <= maxSize ); mtsAllowed &= !tu.cu->ispMode; mtsAllowed &= !tu.cu->sbtInfo; +#if JVET_O1136_TS_BDPCM_SIGNALLING + SizeType transformSkipMaxSize = 1 << tu.cs->pps->getPpsRangeExtension().getLog2MaxTransformSkipBlockSize(); + mtsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= transformSkipMaxSize && tu.lheight() <= transformSkipMaxSize); +#else mtsAllowed &= !( tu.cu->bdpcmMode && tu.lwidth() <= BDPCM_MAX_CU_SIZE && tu.lheight() <= BDPCM_MAX_CU_SIZE ); +#endif return mtsAllowed; } diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index 245c8b5a7755e14cf9e26bc581c31bd2e61507a3..2f7f64a3e06a30bf54a8bf4499922bfada57ead3 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -1017,6 +1017,9 @@ void CABACReader::bdpcm_mode( CodingUnit& cu, const ComponentID compID ) { cu.bdpcmMode = 0; +#if JVET_O1136_TS_BDPCM_SIGNALLING + if( !cu.cs->sps->getBDPCMEnabledFlag() ) return; +#endif if( !CU::bdpcmAllowed( cu, compID ) ) return; RExt__DECODER_DEBUG_BIT_STATISTICS_CREATE_SET_SIZE2( STATS__CABAC_BITS__BDPCM_MODE, cu.block(compID).lumaSize(), compID ); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 2a2609cb0dd481dc19639d87dc55c7683480909a..1a8ecc240ce99ccff93803610af269b32335afc3 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -377,8 +377,10 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); +#if !JVET_O1136_TS_BDPCM_SIGNALLING READ_FLAG( uiCode, "transform_skip_enabled_flag" ); pcPPS->setUseTransformSkip ( uiCode ? true : false ); +#endif READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); if( pcPPS->getUseDQP() ) @@ -686,7 +688,11 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS, ParameterSetManager *parameterSetMana PPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); CHECK(bSkipTrailingExtensionBits, "Invalid state"); +#if JVET_O1136_TS_BDPCM_SIGNALLING + if (parameterSetManager->getSPS(pcPPS->getSPSId())->getTransformSkipEnabledFlag()) +#else if (pcPPS->getUseTransformSkip()) +#endif { READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2"); ppsRangeExtension.setLog2MaxTransformSkipBlockSize(uiCode+2); @@ -1198,6 +1204,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); } +#if JVET_O1136_TS_BDPCM_SIGNALLING + READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false); + if (pcSPS->getTransformSkipEnabledFlag()) + { + READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false); + } +#endif + if( pcSPS->getCTUSize() + 2*(1 << pcSPS->getLog2MinCodingBlockSize()) <= pcSPS->getPicWidthInLumaSamples() ) { READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag"); pcSPS->setWrapAroundEnabledFlag( uiCode ? true : false ); @@ -2266,6 +2280,9 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo) READ_FLAG(symbol, "no_triangle_constraint_flag"); cinfo->setNoTriangleConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_ladf_constraint_flag"); cinfo->setNoLadfConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_transform_skip_constraint_flag"); cinfo->setNoTransformSkipConstraintFlag(symbol > 0 ? true : false); +#if JVET_O1136_TS_BDPCM_SIGNALLING + READ_FLAG(symbol, "no_bdpcm_constraint_flag"); cinfo->setNoBDPCMConstraintFlag(symbol > 0 ? true : false); +#endif READ_FLAG(symbol, "no_qp_delta_constraint_flag"); cinfo->setNoQpDeltaConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_dep_quant_constraint_flag"); cinfo->setNoDepQuantConstraintFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "no_sign_data_hiding_constraint_flag"); cinfo->setNoSignDataHidingConstraintFlag(symbol > 0 ? true : false); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index aaa75beca75b77e99516a7bb4fdaa275213f8aa5..2872cb08ba9ddc56aed8fdf879e00795ea2c226a 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -776,6 +776,9 @@ void CABACWriter::pred_mode( const CodingUnit& cu ) } void CABACWriter::bdpcm_mode( const CodingUnit& cu, const ComponentID compID ) { +#if JVET_O1136_TS_BDPCM_SIGNALLING + if( !cu.cs->sps->getBDPCMEnabledFlag() ) return; +#endif if( !CU::bdpcmAllowed( cu, compID ) ) return; m_BinEncoder.encodeBin( cu.bdpcmMode > 0 ? 1 : 0, Ctx::BDPCMMode( 0 ) ); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 080d5aeb660d4859cfaedbf7d74b7facff91610c..df9f1d2a620e05d9e0441bb38a6f449a97760010 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -202,6 +202,9 @@ protected: bool m_bNoTriangleConstraintFlag; bool m_bNoLadfConstraintFlag; bool m_noTransformSkipConstraintFlag; +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool m_noBDPCMConstraintFlag; +#endif bool m_bNoQpDeltaConstraintFlag; bool m_bNoDepQuantConstraintFlag; bool m_bNoSignDataHidingConstraintFlag; @@ -414,6 +417,9 @@ protected: uint32_t m_log2SaoOffsetScale[MAX_NUM_CHANNEL_TYPE]; bool m_useTransformSkip; bool m_useTransformSkipFast; +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool m_useBDPCM; +#endif uint32_t m_log2MaxTransformSkipBlockSize; bool m_transformSkipRotationEnabledFlag; bool m_transformSkipContextEnabledFlag; @@ -694,6 +700,10 @@ public: void setNoLadfConstraintFlag(bool bVal) { m_bNoLadfConstraintFlag = bVal; } bool getNoTransformSkipConstraintFlag() const { return m_noTransformSkipConstraintFlag; } void setNoTransformSkipConstraintFlag(bool bVal) { m_noTransformSkipConstraintFlag = bVal; } +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool getNoBDPCMConstraintFlag() const { return m_noBDPCMConstraintFlag; } + void setNoBDPCMConstraintFlag(bool bVal) { m_noBDPCMConstraintFlag = bVal; } +#endif bool getNoQpDeltaConstraintFlag() const { return m_bNoQpDeltaConstraintFlag; } void setNoQpDeltaConstraintFlag(bool bVal) { m_bNoQpDeltaConstraintFlag = bVal; } bool getNoDepQuantConstraintFlag() const { return m_bNoDepQuantConstraintFlag; } @@ -1140,6 +1150,10 @@ public: void setTransformSkipRotationEnabledFlag (const bool value) { m_transformSkipRotationEnabledFlag = value; } bool getTransformSkipContextEnabledFlag () const { return m_transformSkipContextEnabledFlag; } void setTransformSkipContextEnabledFlag (const bool value) { m_transformSkipContextEnabledFlag = value; } +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool getUseBDPCM () { return m_useBDPCM; } + void setUseBDPCM ( bool b ) { m_useBDPCM = b; } +#endif bool getPersistentRiceAdaptationEnabledFlag () const { return m_persistentRiceAdaptationEnabledFlag; } void setPersistentRiceAdaptationEnabledFlag (const bool value) { m_persistentRiceAdaptationEnabledFlag = value; } bool getCabacBypassAlignmentEnabledFlag () const { return m_cabacBypassAlignmentEnabledFlag; } diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 7fe9650b1622140b94bd8266a8f3d86ace7743a2..a24ce82a21b600e2d046a55c8ea24851dac8374c 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -235,11 +235,19 @@ int EncGOP::xWriteSPS (AccessUnit &accessUnit, const SPS *sps) } +#if JVET_O1136_TS_BDPCM_SIGNALLING +int EncGOP::xWritePPS (AccessUnit &accessUnit, const PPS *pps, const SPS *sps) +#else int EncGOP::xWritePPS (AccessUnit &accessUnit, const PPS *pps) +#endif { OutputNALUnit nalu(NAL_UNIT_PPS); m_HLSWriter->setBitstream( &nalu.m_Bitstream ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + m_HLSWriter->codePPS( pps, sps ); +#else m_HLSWriter->codePPS( pps ); +#endif accessUnit.push_back(new NALUnitEBSP(nalu)); return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8; } @@ -273,7 +281,11 @@ int EncGOP::xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const boo } if (m_pcEncLib->PPSNeedsWriting(slice->getPPS()->getPPSId())) // Note this assumes that all changes to the PPS are made at the EncLib level prior to picture creation (EncLib::xGetNewPicBuffer). { +#if JVET_O1136_TS_BDPCM_SIGNALLING + actualTotalBits += xWritePPS(accessUnit, slice->getPPS(), slice->getSPS()); +#else actualTotalBits += xWritePPS(accessUnit, slice->getPPS()); +#endif } return actualTotalBits; diff --git a/source/Lib/EncoderLib/EncGOP.h b/source/Lib/EncoderLib/EncGOP.h index 21144d0312dd82a9467d0a6010e5efdc74d3e4ea..5df421faf9c181651fec189cc039c3efa70cad34 100644 --- a/source/Lib/EncoderLib/EncGOP.h +++ b/source/Lib/EncoderLib/EncGOP.h @@ -274,7 +274,11 @@ protected: int xWriteVPS (AccessUnit &accessUnit, const VPS *vps); int xWriteDPS (AccessUnit &accessUnit, const DPS *dps); int xWriteSPS (AccessUnit &accessUnit, const SPS *sps); +#if JVET_O1136_TS_BDPCM_SIGNALLING + int xWritePPS (AccessUnit &accessUnit, const PPS *pps, const SPS *sps); +#else int xWritePPS (AccessUnit &accessUnit, const PPS *pps); +#endif int xWriteAPS(AccessUnit &accessUnit, APS *aps); int xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst); diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index 87b7d546752d7365ad5bccf2da1923c950954f15..ce97ff3119d935a3e1285c6efe55d32a056a4ef0 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -867,6 +867,9 @@ void EncLib::xInitSPS(SPS &sps) cinfo->setNoTriangleConstraintFlag(m_bNoTriangleConstraintFlag); cinfo->setNoLadfConstraintFlag(m_bNoLadfConstraintFlag); cinfo->setNoTransformSkipConstraintFlag(m_noTransformSkipConstraintFlag); +#if JVET_O1136_TS_BDPCM_SIGNALLING + cinfo->setNoBDPCMConstraintFlag(m_noBDPCMConstraintFlag); +#endif cinfo->setNoQpDeltaConstraintFlag(m_bNoQpDeltaConstraintFlag); cinfo->setNoDepQuantConstraintFlag(m_bNoDepQuantConstraintFlag); cinfo->setNoSignDataHidingConstraintFlag(m_bNoSignDataHidingConstraintFlag); @@ -958,6 +961,11 @@ void EncLib::xInitSPS(SPS &sps) sps.setPCMEnabledFlag ( m_usePCM ); sps.setPCMLog2MaxSize( m_pcmLog2MaxSize ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + sps.setTransformSkipEnabledFlag(m_useTransformSkip); + sps.setBDPCMEnabledFlag(m_useBDPCM); +#endif + sps.setSPSTemporalMVPEnabledFlag((getTMVPModeId() == 2 || getTMVPModeId() == 1)); #if MAX_TB_SIZE_SIGNALLING @@ -1264,7 +1272,9 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps) pps.setNumRefIdxL0DefaultActive(bestPos); pps.setNumRefIdxL1DefaultActive(bestPos); pps.setTransquantBypassEnabledFlag(getTransquantBypassEnabledFlag()); +#if !JVET_O1136_TS_BDPCM_SIGNALLING pps.setUseTransformSkip( m_useTransformSkip ); +#endif pps.getPpsRangeExtension().setLog2MaxTransformSkipBlockSize( m_log2MaxTransformSkipBlockSize ); diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 324e654c97d1be6324febab440cf2821c918252b..9f501fe5b2eab56103500b47daf0a6907f0ac431 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -371,7 +371,11 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, m_intraModeTestedNormalIntra.clear(); } +#if JVET_O1136_TS_BDPCM_SIGNALLING + const bool testBDPCM = sps.getBDPCMEnabledFlag() && CU::bdpcmAllowed( cu, ComponentID( partitioner.chType ) ) && cu.mtsFlag == 0 && cu.lfnstIdx == 0; +#else const bool testBDPCM = m_pcEncCfg->getRDPCM() && CU::bdpcmAllowed( cu, ComponentID( partitioner.chType ) ) && cu.mtsFlag == 0 && cu.lfnstIdx == 0; +#endif static_vector<ModeInfo, FAST_UDI_MAX_RDMODE_NUM> uiHadModeList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandCostList; static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandHadList; @@ -1322,7 +1326,11 @@ void IntraSearch::estIntraPredChromaQT( CodingUnit &cu, Partitioner &partitioner continue; } +#if JVET_O1136_TS_BDPCM_SIGNALLING + if (cs.sps->getTransformSkipEnabledFlag()) +#else if (cs.pps->getUseTransformSkip()) +#endif { m_CABACEstimator->getCtx() = ctxStart; } @@ -2231,7 +2239,11 @@ bool IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par double dSingleCost = MAX_DOUBLE; Distortion uiSingleDistLuma = 0; uint64_t singleFracBits = 0; +#if JVET_O1136_TS_BDPCM_SIGNALLING + bool checkTransformSkip = sps.getTransformSkipEnabledFlag(); +#else bool checkTransformSkip = pps.getUseTransformSkip(); +#endif int bestModeId[ MAX_NUM_COMPONENT ] = { 0, 0, 0 }; uint8_t nNumTransformCands = cu.mtsFlag ? 4 : 1; uint8_t numTransformIndexCands = nNumTransformCands; diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index 76160698a4207cb6e20c1c2d35ad6fbc41c866f6..76fedd8078b7e7967309bbc696dff6e02fd9783d 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -192,7 +192,11 @@ void HLSWriter::xCodeRefPicList(const ReferencePictureList* rpl, bool isLongTerm } } +#if JVET_O1136_TS_BDPCM_SIGNALLING +void HLSWriter::codePPS( const PPS* pcPPS, const SPS* pcSPS ) +#else void HLSWriter::codePPS( const PPS* pcPPS ) +#endif { #if ENABLE_TRACING xTracePPSHeader (); @@ -209,7 +213,9 @@ void HLSWriter::codePPS( const PPS* pcPPS ) WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag" ); +#if !JVET_O1136_TS_BDPCM_SIGNALLING WRITE_FLAG( pcPPS->getUseTransformSkip() ? 1 : 0, "transform_skip_enabled_flag" ); +#endif WRITE_FLAG( pcPPS->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag" ); if ( pcPPS->getUseDQP() ) { @@ -373,7 +379,11 @@ void HLSWriter::codePPS( const PPS* pcPPS ) bool pps_extension_present_flag=false; bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS]={false}; +#if JVET_O1136_TS_BDPCM_SIGNALLING + pps_extension_flags[PPS_EXT__REXT] = pcPPS->getPpsRangeExtension().settingsDifferFromDefaults(pcSPS->getTransformSkipEnabledFlag()); +#else pps_extension_flags[PPS_EXT__REXT] = pcPPS->getPpsRangeExtension().settingsDifferFromDefaults(pcPPS->getUseTransformSkip()); +#endif // Other PPS extension flags checked here. @@ -411,7 +421,11 @@ void HLSWriter::codePPS( const PPS* pcPPS ) case PPS_EXT__REXT: { const PPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); +#if JVET_O1136_TS_BDPCM_SIGNALLING + if (pcSPS->getTransformSkipEnabledFlag()) +#else if (pcPPS->getUseTransformSkip()) +#endif { WRITE_UVLC( ppsRangeExtension.getLog2MaxTransformSkipBlockSize()-2, "log2_max_transform_skip_block_size_minus2"); } @@ -792,6 +806,14 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) WRITE_FLAG( pcSPS->getPCMFilterDisableFlag()?1 : 0, "pcm_loop_filter_disable_flag"); } +#if JVET_O1136_TS_BDPCM_SIGNALLING + WRITE_FLAG(pcSPS->getTransformSkipEnabledFlag() ? 1 : 0, "sps_transform_skip_enabled_flag"); + if (pcSPS->getTransformSkipEnabledFlag()) + { + WRITE_FLAG(pcSPS->getBDPCMEnabledFlag() ? 1 : 0, "sps_bdpcm_enabled_flag"); + } +#endif + if( pcSPS->getCTUSize() + 2*(1 << pcSPS->getLog2MinCodingBlockSize()) <= pcSPS->getPicWidthInLumaSamples() ) { WRITE_FLAG( pcSPS->getWrapAroundEnabledFlag() ? 1 : 0, "sps_ref_wraparound_enabled_flag" ); @@ -1495,6 +1517,9 @@ void HLSWriter::codeConstraintInfo ( const ConstraintInfo* cinfo ) WRITE_FLAG(cinfo->getNoTriangleConstraintFlag() ? 1 : 0, "no_triangle_constraint_flag"); WRITE_FLAG(cinfo->getNoLadfConstraintFlag() ? 1 : 0, "no_ladf_constraint_flag"); WRITE_FLAG(cinfo->getNoTransformSkipConstraintFlag() ? 1 : 0, "no_transform_skip_constraint_flag"); +#if JVET_O1136_TS_BDPCM_SIGNALLING + WRITE_FLAG(cinfo->getNoBDPCMConstraintFlag() ? 1 : 0, "no_bdpcm_constraint_flag"); +#endif WRITE_FLAG(cinfo->getNoQpDeltaConstraintFlag() ? 1 : 0, "no_qp_delta_constraint_flag"); WRITE_FLAG(cinfo->getNoDepQuantConstraintFlag() ? 1 : 0, "no_dep_quant_constraint_flag"); WRITE_FLAG(cinfo->getNoSignDataHidingConstraintFlag() ? 1 : 0, "no_sign_data_hiding_constraint_flag"); diff --git a/source/Lib/EncoderLib/VLCWriter.h b/source/Lib/EncoderLib/VLCWriter.h index 6b80013c84f66511663f3f28dbda716d80410b86..2fd162f2391b0412f6077439c2808603d3ed5e63 100644 --- a/source/Lib/EncoderLib/VLCWriter.h +++ b/source/Lib/EncoderLib/VLCWriter.h @@ -120,7 +120,11 @@ public: uint32_t getNumberOfWrittenBits () { return m_pcBitIf->getNumberOfWrittenBits(); } void codeVUI ( const VUI *pcVUI, const SPS* pcSPS ); void codeSPS ( const SPS* pcSPS ); +#if JVET_O1136_TS_BDPCM_SIGNALLING + void codePPS ( const PPS* pcPPS, const SPS* pcSPS ); +#else void codePPS ( const PPS* pcPPS ); +#endif void codeAPS ( APS* pcAPS ); void codeAlfAps ( APS* pcAPS ); void codeLmcsAps ( APS* pcAPS );