diff --git a/cfg/lossless/lossless.cfg b/cfg/lossless/lossless.cfg index bca758fcf2403f0b3abdce66250aff0b8676be69..793b2bedbd16f9300826026cd8bb27cf2024e94a 100644 --- a/cfg/lossless/lossless.cfg +++ b/cfg/lossless/lossless.cfg @@ -20,3 +20,5 @@ BIO : 0 PROF : 0 Log2MaxTbSize : 5 InternalBitDepth : 0 +TSRCdisableLL : 1 + diff --git a/doc/software-manual.tex b/doc/software-manual.tex index 166663323f16ed86755fbb8c5638e20d37b2d602..a155272dda781520cf940e56cd43947252d8abdb 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -2660,6 +2660,12 @@ Specifies location of a chroma sample relatively to the luma sample in vertical \end{tabular} \\ +\Option{TSRCdisableLL} & +%\ShortOption{\None} & +\Default{1} & +Enables or disables the use of Transform Skip Residual Coding for lossless compression. +\\ + \end{OptionTableNoShorthand} %% diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 98d5290c82a57007f500ab410c1fd9b85da3fb2d..f0a203bb9feeedb330a503fac98a0cd5e2083e7c 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -748,6 +748,9 @@ void EncApp::xInitLibCfg() m_cEncLib.setInitialCpbFullness ( m_RCInitialCpbFullness ); #endif m_cEncLib.setCostMode ( m_costMode ); +#if JVET_R0143_TSRCdisableLL + m_cEncLib.setTSRCdisableLL ( m_TSRCdisableLL ); +#endif m_cEncLib.setUseRecalculateQPAccordingToLambda ( m_recalculateQPAccordingToLambda ); m_cEncLib.setDCIEnabled ( m_DCIEnabled ); m_cEncLib.setVuiParametersPresentFlag ( m_vuiParametersPresentFlag ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 727eb90c18b5f2d620ffbb54dec57e0af0b356b0..a5854c23bff1c6ab8d81e75c55da43b42b60d8ea 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1138,6 +1138,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ( "RCInitialCpbFullness", m_RCInitialCpbFullness, 0.9, "Rate control: initial CPB fullness" ) #endif ("CostMode", m_costMode, COST_STANDARD_LOSSY, "Use alternative cost functions: choose between 'lossy', 'sequence_level_lossless', 'lossless' (which forces QP to " MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP) ") and 'mixed_lossless_lossy' (which used QP'=" MACRO_TO_STRING(LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME) " for pre-estimates of transquant-bypass blocks).") +#if JVET_R0143_TSRCdisableLL + ("TSRCdisableLL", m_TSRCdisableLL, true, "Disable TSRC for lossless coding" ) +#endif ("RecalculateQPAccordingToLambda", m_recalculateQPAccordingToLambda, false, "Recalculate QP values according to lambda values. Do not suggest to be enabled in all intra case") ("HrdParametersPresent,-hrd", m_hrdParametersPresentFlag, false, "Enable generation of hrd_parameters()") ("VuiParametersPresent,-vui", m_vuiParametersPresentFlag, false, "Enable generation of vui_parameters()") diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 2dfb8315b59a0e73a8b552b968645d9f51e2a77e..ee76d6a84695523003fb8e8a2f8aaa4ec58b35c8 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -622,6 +622,9 @@ protected: std::string m_scalingListFileName; ///< quantization matrix file name bool m_disableScalingMatrixForLfnstBlks; CostMode m_costMode; ///< Cost mode to use +#if JVET_R0143_TSRCdisableLL + bool m_TSRCdisableLL; ///< disable TSRC for lossless +#endif bool m_recalculateQPAccordingToLambda; ///< recalculate QP value according to the lambda value diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 1a0471060ad3cad43a421461f68d099b661447d8..1977e0ebb081d5221b4afad6866730fbd3ac3a97 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -52,6 +52,8 @@ //########### place macros to be removed in next cycle below this line ############### +#define JVET_R0143_TSRCdisableLL 1 // JVET-R0143: disable TSRC for lossless coding + #define JVET_R0233_CCALF_LINE_BUFFER_REDUCTION 1 // JVET-R0233 method 2: Line buffer reduction for CCALF #define JVET_Q0471_CHROMA_QT_SPLIT 1 // JVET-Q0471: Chroma QT split diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 19ed66be49afe81ccf7a718bad9f7539531d29f1..146887dbdc3816ae7fb9265ab76edd178b9cf606 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -651,7 +651,9 @@ protected: double m_RCInitialCpbFullness; #endif CostMode m_costMode; ///< The cost function to use, primarily when considering lossless coding. - +#if JVET_R0143_TSRCdisableLL + bool m_TSRCdisableLL; ///< Disable TSRC for lossless +#endif DCI m_dci; bool m_DCIEnabled; ///< enable Decoding Capability Information (DCI) @@ -1687,8 +1689,10 @@ public: #endif CostMode getCostMode( ) const { return m_costMode; } void setCostMode(CostMode m ) { m_costMode = m; } - - +#if JVET_R0143_TSRCdisableLL + bool getTSRCdisableLL () { return m_TSRCdisableLL; } + void setTSRCdisableLL ( bool b ) { m_TSRCdisableLL = b; } +#endif void setDCI(DCI *p) { m_dci = *p; } DCI* getDCI() { return &m_dci; } diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index f10fee633a40b88011552edc101793fc3a901758..bf4e8eb481ad76e33ea4bcbcf0fd0b624b621879 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -339,7 +339,11 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr picHeader->setPicOutputFlag(true); } rpcSlice->setPOC( pocCurr ); +#if JVET_R0143_TSRCdisableLL + if( ( m_pcCfg->getCostMode() == COST_LOSSLESS_CODING ) && m_pcCfg->getTSRCdisableLL() ) +#else if( m_pcCfg->getCostMode() == COST_LOSSLESS_CODING ) +#endif { rpcSlice->setTSResidualCodingDisabledFlag(true); }