diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 8bfb07c0ff78e9a316fb7c64c0a80299fb3ee33f..74aad147872caf65e666d98677df6e124bee6ed4 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1048,19 +1048,13 @@ void EncApp::xInitLibCfg() m_cEncLib.setBs2ModPOCAndType ( m_bs2ModPOCAndType ); m_cEncLib.setDebugCTU ( m_debugCTU ); m_cEncLib.setUseALF ( m_alf ); -#if JVET_U0081 m_cEncLib.setALFStrengthLuma (m_alfStrengthLuma); -#else - m_cEncLib.setALFStrength (m_alfStrength); -#endif m_cEncLib.setCCALFStrength (m_ccalfStrength); m_cEncLib.setALFAllowPredefinedFilters (m_alfAllowPredefinedFilters); -#if JVET_U0081 m_cEncLib.setALFStrengthChroma (m_alfStrengthChroma); m_cEncLib.setALFStrengthTargetLuma (m_alfStrengthTargetLuma); m_cEncLib.setALFStrengthTargetChroma (m_alfStrengthTargetChroma); m_cEncLib.setCCALFStrengthTarget (m_ccalfStrengthTarget); -#endif m_cEncLib.setUseCCALF ( m_ccalf ); m_cEncLib.setCCALFQpThreshold ( m_ccalfQpThreshold ); m_cEncLib.setLmcs ( m_lmcsEnabled ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 6b98a8ada98555c2420f3176c0e44a488086d880..1fc3b526fee3a1f793afa6c1eca7ad11b3b15233 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1403,19 +1403,13 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("DebugCTU", m_debugCTU, -1, "If DebugBitstream is present, load frames up to this POC from this bitstream. Starting with DebugPOC-frame at CTUline containin debug CTU.") ( "ALF", m_alf, true, "Adaptive Loop Filter\n" ) -#if JVET_U0081 ("ALFStrengthLuma", m_alfStrengthLuma, 1.0, "Adaptive Loop Filter strength for luma. The parameter scales the magnitudes of the ALF filter coefficients for luma. Valid range is 0.0 <= ALFStrengthLuma <= 1.0") -#else - ("ALFStrength", m_alfStrength, 1.0, "Adaptive Loop Filter strength. The parameter scales the magnitudes of the ALF filter coefficients for both luma and chroma. Valid range is 0.0 <= ALFStrength <= 1.0") -#endif ("ALFAllowPredefinedFilters", m_alfAllowPredefinedFilters, true, "Allow use of predefined filters for ALF") ("CCALFStrength", m_ccalfStrength, 1.0, "Cross-component Adaptive Loop Filter strength. The parameter scales the magnitudes of the CCALF filter coefficients. Valid range is 0.0 <= CCALFStrength <= 1.0") -#if JVET_U0081 ("ALFStrengthChroma", m_alfStrengthChroma, 1.0, "Adaptive Loop Filter strength for chroma. The parameter scales the magnitudes of the ALF filter coefficients for chroma. Valid range is 0.0 <= ALFStrengthChroma <= 1.0") ("ALFStrengthTargetLuma", m_alfStrengthTargetLuma, 1.0, "Adaptive Loop Filter strength target for ALF luma filter optimization. The parameter scales the auto-correlation matrix E and the cross-correlation vector y for luma. Valid range is 0.0 <= ALFStrengthTargetLuma <= 1.0") ("ALFStrengthTargetChroma", m_alfStrengthTargetChroma, 1.0, "Adaptive Loop Filter strength target for ALF chroma filter optimization. The parameter scales the auto-correlation matrix E and the cross-correlation vector y for chroma. Valid range is 0.0 <= ALFStrengthTargetChroma <= 1.0") ("CCALFStrengthTarget", m_ccalfStrengthTarget, 1.0, "Cross-component Adaptive Loop Filter strength target for filter optimization. The parameter scales the auto-correlation matrix E and the cross-correlation vector y. Valid range is 0.0 <= CCALFStrengthTarget <= 1.0") -#endif ( "CCALF", m_ccalf, true, "Cross-component Adaptive Loop Filter" ) ( "CCALFQpTh", m_ccalfQpThreshold, 37, "QP threshold above which encoder reduces CCALF usage") ( "RPR", m_rprEnabledFlag, true, "Reference Sample Resolution" ) @@ -2855,20 +2849,14 @@ bool EncAppCfg::xCheckParameter() } if (m_alf) { -#if JVET_U0081 xConfirmPara(m_alfStrengthLuma < 0.0, "ALFStrengthLuma is less than 0. Valid range is 0.0 <= ALFStrengthLuma <= 1.0"); xConfirmPara(m_alfStrengthLuma > 1.0, "ALFStrengthLuma is greater than 1. Valid range is 0.0 <= ALFStrengthLuma <= 1.0"); -#else - xConfirmPara(m_alfStrength < 0.0, "ALFStrength is less than 0. Valid range is 0.0 <= ALFStrength <= 1.0" ); - xConfirmPara(m_alfStrength > 1.0, "ALFStrength is greater than 1. Valid range is 0.0 <= ALFStrength <= 1.0" ); -#endif } if (m_ccalf) { xConfirmPara(m_ccalfStrength < 0.0, "CCALFStrength is less than 0. Valid range is 0.0 <= CCALFStrength <= 1.0"); xConfirmPara(m_ccalfStrength > 1.0, "CCALFStrength is greater than 1. Valid range is 0.0 <= CCALFStrength <= 1.0"); } -#if JVET_U0081 if (m_alf) { xConfirmPara(m_alfStrengthChroma < 0.0, "ALFStrengthChroma is less than 0. Valid range is 0.0 <= ALFStrengthChroma <= 1.0"); @@ -2883,7 +2871,6 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_ccalfStrengthTarget < 0.0, "CCALFStrengthTarget is less than 0. Valid range is 0.0 <= CCALFStrengthTarget <= 1.0"); xConfirmPara(m_ccalfStrengthTarget > 1.0, "CCALFStrengthTarget is greater than 1. Valid range is 0.0 <= CCALFStrengthTarget <= 1.0"); } -#endif if (m_ccalf && (m_chromaFormatIDC == CHROMA_400)) { msg( WARNING, "****************************************************************************\n"); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 5751a39773393fccc012f665db4386da96e8013b..0e9af316f2959d6cdf81505016d128422b94e697 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -698,19 +698,13 @@ protected: bool m_forceDecodeBitstream1; bool m_alf; ///< Adaptive Loop Filter -#if JVET_U0081 double m_alfStrengthLuma; -#else - double m_alfStrength; -#endif bool m_alfAllowPredefinedFilters; double m_ccalfStrength; -#if JVET_U0081 double m_alfStrengthChroma; double m_alfStrengthTargetLuma; double m_alfStrengthTargetChroma; double m_ccalfStrengthTarget; -#endif bool m_ccalf; int m_ccalfQpThreshold; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 7572cd115f48fd8b34eb546e0f9865ed649695ce..521d37c57069e5a5a87678f75e103b7af74a4d5f 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -55,7 +55,6 @@ //########### place macros to be removed in next cycle below this line ############### -#define JVET_U0081 1 // ALF filter strength target #define JVET_U0103_HIGH_BIT_DEPTH_SIMD 1 // JVET-U0103: SIMD implementation for high bit depth coding diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index 111227334f76c29e14c291163370f9b4d3a5c457..087de689fcca0dfa00c9fc8ec3fe8f88f9286709 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -1836,12 +1836,8 @@ double EncAdaptiveLoopFilter::deriveCoeffQuant( int *filterClipp, int *filterCoe filterCoeffQuant[numCoeff - 1] = 0; int modified=1; -#if JVET_U0081 bool isLumaFilter = numCoeff > 7 ? 1 : 0; if ((isLumaFilter && m_encCfg->getALFStrengthLuma() != 1.0) || (!isLumaFilter && m_encCfg->getALFStrengthChroma() != 1.0)) -#else - if( m_encCfg->getALFStrength() != 1.0 ) -#endif { modified = 0; } @@ -1885,18 +1881,12 @@ double EncAdaptiveLoopFilter::deriveCoeffQuant( int *filterClipp, int *filterCoe void EncAdaptiveLoopFilter::roundFiltCoeff( int *filterCoeffQuant, double *filterCoeff, const int numCoeff, const int factor ) { -#if JVET_U0081 bool isLumaFilter = numCoeff > 7 ? 1 : 0; double alfStrength = isLumaFilter ? m_encCfg->getALFStrengthLuma() : m_encCfg->getALFStrengthChroma(); -#endif for( int i = 0; i < numCoeff; i++ ) { int sign = filterCoeff[i] > 0 ? 1 : -1; -#if JVET_U0081 filterCoeffQuant[i] = int((filterCoeff[i] * alfStrength) * sign * factor + 0.5) * sign; -#else - filterCoeffQuant[i] = int((filterCoeff[i] * m_encCfg->getALFStrength()) * sign * factor + 0.5) * sign; -#endif } } @@ -2278,7 +2268,6 @@ void EncAdaptiveLoopFilter::getBlkStats(AlfCovariance* alfCovariance, const AlfF const int numBins = AlfNumClippingValues[channel]; int transposeIdx = 0; int classIdx = 0; -#if JVET_U0081 bool isLumaFilter = shape.numCoeff > 7 ? 1 : 0; double filterStrengthTarget = isLumaFilter ? m_encCfg->getALFStrengthTargetLuma() : m_encCfg->getALFStrengthTargetChroma(); double filterStrengthTargetE = 1.0; @@ -2292,7 +2281,6 @@ void EncAdaptiveLoopFilter::getBlkStats(AlfCovariance* alfCovariance, const AlfF { filterStrengthTargetY = 0.0; } -#endif for( int i = 0; i < area.height; i++ ) { int vbDistance = ((areaDst.y + i) % vbCTUHeight) - vbPos; @@ -2327,19 +2315,11 @@ void EncAdaptiveLoopFilter::getBlkStats(AlfCovariance* alfCovariance, const AlfF { if (m_alfWSSD) { -#if JVET_U0081 alfCovariance[classIdx].E[b0][b1][k][l] += filterStrengthTargetE * weight * (ELocal[k][b0] * (double)ELocal[l][b1]); -#else - alfCovariance[classIdx].E[b0][b1][k][l] += weight * (ELocal[k][b0] * (double)ELocal[l][b1]); -#endif } else { -#if JVET_U0081 alfCovariance[classIdx].E[b0][b1][k][l] += filterStrengthTargetE * ELocal[k][b0] * (double)ELocal[l][b1]; -#else - alfCovariance[classIdx].E[b0][b1][k][l] += ELocal[k][b0] * (double)ELocal[l][b1]; -#endif } } } @@ -2348,19 +2328,11 @@ void EncAdaptiveLoopFilter::getBlkStats(AlfCovariance* alfCovariance, const AlfF { if (m_alfWSSD) { -#if JVET_U0081 alfCovariance[classIdx].y[b][k] += filterStrengthTargetY * weight * (ELocal[k][b] * (double)yLocal); -#else - alfCovariance[classIdx].y[b][k] += weight * (ELocal[k][b] * (double)yLocal); -#endif } else { -#if JVET_U0081 alfCovariance[classIdx].y[b][k] += filterStrengthTargetY * ELocal[k][b] * (double)yLocal; -#else - alfCovariance[classIdx].y[b][k] += ELocal[k][b] * (double)yLocal; -#endif } } } @@ -4105,7 +4077,6 @@ void EncAdaptiveLoopFilter::getBlkStatsCcAlf(AlfCovariance &alfCovariance, const } Pel ELocal[MAX_NUM_CC_ALF_CHROMA_COEFF][1]; -#if JVET_U0081 double filterStrengthTarget = m_encCfg->getCCALFStrengthTarget(); double filterStrengthTargetE = 1.0; double filterStrengthTargetY = 1.0; @@ -4118,7 +4089,6 @@ void EncAdaptiveLoopFilter::getBlkStatsCcAlf(AlfCovariance &alfCovariance, const { filterStrengthTargetY = 0.0; } -#endif for (int i = 0; i < compArea.height; i++) { int vbDistance = ((i << getComponentScaleY(compID, m_chromaFormat)) % vbCTUHeight) - vbPos; @@ -4147,19 +4117,11 @@ void EncAdaptiveLoopFilter::getBlkStatsCcAlf(AlfCovariance &alfCovariance, const { if (m_alfWSSD) { -#if JVET_U0081 alfCovariance.E[b0][b1][k][l] += filterStrengthTargetE * weight * (ELocal[k][b0] * (double)ELocal[l][b1]); -#else - alfCovariance.E[b0][b1][k][l] += weight * (ELocal[k][b0] * (double)ELocal[l][b1]); -#endif } else { -#if JVET_U0081 alfCovariance.E[b0][b1][k][l] += filterStrengthTargetE * ELocal[k][b0] * (double)ELocal[l][b1]; -#else - alfCovariance.E[b0][b1][k][l] += ELocal[k][b0] * (double)ELocal[l][b1]; -#endif } } } @@ -4168,19 +4130,11 @@ void EncAdaptiveLoopFilter::getBlkStatsCcAlf(AlfCovariance &alfCovariance, const { if (m_alfWSSD) { -#if JVET_U0081 alfCovariance.y[b][k] += filterStrengthTargetY * weight * (ELocal[k][b] * (double)yLocal); -#else - alfCovariance.y[b][k] += weight * (ELocal[k][b] * (double)yLocal); -#endif } else { -#if JVET_U0081 alfCovariance.y[b][k] += filterStrengthTargetY * ELocal[k][b] * (double)yLocal; -#else - alfCovariance.y[b][k] += ELocal[k][b] * (double)yLocal; -#endif } } } diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 0cc8eb4813e54080e581f698935251ff93112daf..d4380404858ceef3f820c5cde1b1ca82cd60984e 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -743,19 +743,13 @@ protected: CfgVPSParameters m_cfgVPSParameters; bool m_alf; ///< Adaptive Loop Filter -#if JVET_U0081 double m_alfStrengthLuma; -#else - double m_alfStrength; -#endif bool m_alfAllowPredefinedFilters; double m_ccalfStrength; -#if JVET_U0081 double m_alfStrengthChroma; double m_alfStrengthTargetLuma; double m_alfStrengthTargetChroma; double m_ccalfStrengthTarget; -#endif bool m_ccalf; int m_ccalfQpThreshold; #if JVET_O0756_CALCULATE_HDRMETRICS @@ -1955,18 +1949,12 @@ public: void setUseALF( bool b ) { m_alf = b; } bool getUseALF() const { return m_alf; } -#if JVET_U0081 void setALFStrengthLuma(double s) { m_alfStrengthLuma = s; } double getALFStrengthLuma() const { return m_alfStrengthLuma; } -#else - void setALFStrength( double s) { m_alfStrength = s; } - double getALFStrength() const { return m_alfStrength; } -#endif void setALFAllowPredefinedFilters(bool b) { m_alfAllowPredefinedFilters = b; } bool getALFAllowPredefinedFilters() const { return m_alfAllowPredefinedFilters; } void setCCALFStrength(double s) { m_ccalfStrength = s; } double getCCALFStrength() const { return m_ccalfStrength; } -#if JVET_U0081 void setALFStrengthChroma(double s) { m_alfStrengthChroma = s; } double getALFStrengthChroma() const { return m_alfStrengthChroma; } void setALFStrengthTargetLuma(double s) { m_alfStrengthTargetLuma = s; } @@ -1975,7 +1963,6 @@ public: double getALFStrengthTargetChroma() const { return m_alfStrengthTargetChroma; } void setCCALFStrengthTarget(double s) { m_ccalfStrengthTarget = s; } double getCCALFStrengthTarget() const { return m_ccalfStrengthTarget; } -#endif void setUseCCALF( bool b ) { m_ccalf = b; } bool getUseCCALF() const { return m_ccalf; } void setCCALFQpThreshold( int b ) { m_ccalfQpThreshold = b; }