diff --git a/cfg/encoder_intra_nnvc.cfg b/cfg/encoder_intra_nnvc.cfg index 3e9e9320b7c7974fa3b0bd4b5400b590caa9bc18..ba8f6335795802b8cd36c985c8abfe160832ce4a 100644 --- a/cfg/encoder_intra_nnvc.cfg +++ b/cfg/encoder_intra_nnvc.cfg @@ -109,7 +109,7 @@ FastMIP : 1 FastLFNST : 1 NnIntraPred : 1 -NnlfOption : 3 +NnlfOption : 1 # Encoder optimization tools AffineAmvrEncOpt : 0 diff --git a/cfg/encoder_lowdelay_P_nnvc.cfg b/cfg/encoder_lowdelay_P_nnvc.cfg index 678c1ff9fc3d477e41f526900cedeef9c83235b6..0fd2dc783f4188ce6037050a4b1e67ccd5606ed6 100644 --- a/cfg/encoder_lowdelay_P_nnvc.cfg +++ b/cfg/encoder_lowdelay_P_nnvc.cfg @@ -134,7 +134,7 @@ FastMIP : 0 FastLocalDualTreeMode : 2 NnIntraPred : 1 -NnlfOption : 3 +NnlfOption : 1 # Encoder optimization tools AffineAmvrEncOpt : 0 diff --git a/cfg/encoder_lowdelay_nnvc.cfg b/cfg/encoder_lowdelay_nnvc.cfg index 175bca6c9eca4a38d23906f70207bb7971fc9664..daaf84fc60c65527b8c3e74e7ec7be01aa84bec6 100644 --- a/cfg/encoder_lowdelay_nnvc.cfg +++ b/cfg/encoder_lowdelay_nnvc.cfg @@ -138,7 +138,7 @@ FastMIP : 0 FastLocalDualTreeMode : 2 NnIntraPred : 1 -NnlfOption : 3 +NnlfOption : 1 # Encoder optimization tools AffineAmvrEncOpt : 0 diff --git a/cfg/encoder_randomaccess_nnvc.cfg b/cfg/encoder_randomaccess_nnvc.cfg index da71efb8abbd83442f6548da29d84bcc5cf7d77f..8f6da93f407182b5efdbedd3d458993afa649b4f 100644 --- a/cfg/encoder_randomaccess_nnvc.cfg +++ b/cfg/encoder_randomaccess_nnvc.cfg @@ -164,7 +164,7 @@ FastLocalDualTreeMode : 1 ChromaTS : 1 NnIntraPred : 1 -NnlfOption : 3 +NnlfOption : 1 # Encoder optimization tools AffineAmvrEncOpt : 1 diff --git a/cfg/encoder_randomaccess_nnvc_gop16.cfg b/cfg/encoder_randomaccess_nnvc_gop16.cfg index d671b4935cd609531c405546cebcd6bf327d18ed..1f1a9c90ecd752772b32ffef1aa216ce5255a123 100644 --- a/cfg/encoder_randomaccess_nnvc_gop16.cfg +++ b/cfg/encoder_randomaccess_nnvc_gop16.cfg @@ -148,7 +148,7 @@ FastLocalDualTreeMode : 1 ChromaTS : 1 NnIntraPred : 1 -NnlfOption : 3 +NnlfOption : 1 # Encoder optimization tools AffineAmvrEncOpt : 1 diff --git a/cfg/nn-based/HOP.cfg b/cfg/nn-based/HOP.cfg index a5859efabdd4f03662fac6f98971ff5737ccf36f..6baef9689698f503ee3e3b69a04e818170941e45 100644 --- a/cfg/nn-based/HOP.cfg +++ b/cfg/nn-based/HOP.cfg @@ -1,4 +1,4 @@ -NnlfOption : 4 +NnlfOption : 1 NnlfModelName : models/nnlf_hop_model_int16.sadl CbQpOffset : 1 CrQpOffset : 1 diff --git a/cfg/nn-based/NnlfOption_1.cfg b/cfg/nn-based/NnlfOption_1.cfg index bf5d8fdd4d0fb53d8fd158a9268a773710d0132f..805ee6ea67d79663d6a394e989897efdbb1aa2d1 100644 --- a/cfg/nn-based/NnlfOption_1.cfg +++ b/cfg/nn-based/NnlfOption_1.cfg @@ -1 +1 @@ -NnlfOption : 1 # NN-based loop filter, 0: disable NN filter; 1: Use NN-based loop filter set 0; 2: Use NN-based loop filter set 1 +NnlfOption : 10 # NN-based loop filter, 0: disable NN filter; 1: Use NN-based loop filter set 0; 2: Use NN-based loop filter set 1 diff --git a/cfg/nn-based/NnlfOption_2.cfg b/cfg/nn-based/NnlfOption_2.cfg index 909b51fae020457c9c068343809caaa5ccc4ce21..70f41f3232fe64da936bccdc4496a29813bcc4e8 100644 --- a/cfg/nn-based/NnlfOption_2.cfg +++ b/cfg/nn-based/NnlfOption_2.cfg @@ -1,4 +1,4 @@ -NnlfOption : 2 # NN-based loop filter, 0: disable NN filter; 1: Use NN-based loop filter set 0; 2: Use NN-based loop filter set 1 +NnlfOption : 11 # NN-based loop filter, 0: disable NN filter; 1: Use NN-based loop filter set 0; 2: Use NN-based loop filter set 1 NnlfSet1InferSizeBase : 128 # Base inference size of NN-based loop filter set 1 NnlfSet1InferSizeExtension : 8 # Extension of inference size of NN-based loop filter set 1 -NnlfSet1MaxNumParams : 3 # Number of conditional parameters of NN-based loop filter set 1 \ No newline at end of file +NnlfSet1MaxNumParams : 3 # Number of conditional parameters of NN-based loop filter set 1 diff --git a/cfg/nn-based/NnlfOption_3.cfg b/cfg/nn-based/NnlfOption_3.cfg index 3972a8fad5e8f65811056bef5e20a49e372b7240..1ff72d594e8be177e6ef20c6cc8228cedc3052a3 100644 --- a/cfg/nn-based/NnlfOption_3.cfg +++ b/cfg/nn-based/NnlfOption_3.cfg @@ -1 +1 @@ -NnlfOption : 3 # NN-based loop filter, 0: disable NN filter; 1: Use NN-based loop filter set 0; 2: Use NN-based loop filter set 1; 3: Use LC NN-based loop filter set \ No newline at end of file +NnlfOption : 12 # NN-based loop filter, 0: disable NN filter; 1: Use NN-based loop filter set 0; 2: Use NN-based loop filter set 1; 3: Use LC NN-based loop filter set diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp index 1ac1a4f0220c7df3deb635622b4f1541b0280386..b042d6a2f08d495aa1a64024db69ad6f072d4493 100644 --- a/source/App/DecoderApp/DecAppCfg.cpp +++ b/source/App/DecoderApp/DecAppCfg.cpp @@ -81,7 +81,7 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] ) ("DumpBasename", m_dumpBasename, string(""), "basename for data dumping\n") #endif #if NN_LF_UNIFIED - ("NnlfModelName", m_nnlfModelName, string("models/nnlf_hop_model_int16.sadl"), "loop filter model name\n") + ("NnlfModelName", m_nnlfModelName, string("models/nnlf_lop2_model_int16.sadl"), "loop filter model name\n") #if NN_LF_FORCE_USE ( "NnlfUnifiedDebugOption", m_nnlfDebugOption, 0, "Option used to debug stage 1 model. 0: default, 1: apply only on I slice, 2: apply on all slices using I type as input" ) #endif diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index ad9499d7b8faa715454d71a80f73fabe37540fd2..2d374b6b20eb122752c4d217f604b65dbc502f57 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1169,8 +1169,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("GolombRiceParameterAdaptation", m_persistentRiceAdaptationEnabledFlag, false, "Enable the adaptation of the Golomb-Rice parameter over the course of each slice") ("AlignCABACBeforeBypass", m_cabacBypassAlignmentEnabledFlag, false, "Align the CABAC engine to a defined fraction of a bit prior to coding bypass data. Must be 1 in high bit rate profile, 0 otherwise") #if NN_COMMON_SPS - ("NnlfOption", m_nnlfOption, 0, "NN-based in-loop filter option (0:disable nnlf, 1: enable nnlf-0, 2: enable nnlf-1, 3: enable nnlf-LC, 4: enable nnlf HOP)") - ("NnlfModelName", m_nnlfModelName, string("models/nnlf_hop_model_int16.sadl"), "loop filter model name" ) + ("NnlfOption", m_nnlfOption, 1, "NN-based in-loop filter option (0:disable nnlf, 1: enable unified nnlf, [legacy: 10: enable nnlf-0, 11: enable nnlf-1, 12: enable nnlf-LC])") + ("NnlfModelName", m_nnlfModelName, string("models/nnlf_lop2_model_int16.sadl"), "unified nnlf model name." ) #endif #if NN_LF_UNIFIED ( "NnlfBlockSize", m_nnlfBlockSize, 128u, "Base inference size of NN-based in-loop filter") @@ -2662,9 +2662,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } #if NN_COMMON_SPS - CHECK(m_nnlfOption <0 || m_nnlfOption >4 , "Undefined NN-based in-loop filter option"); - if (m_nnlfOption == 0) - { m_nnlf = false; #if NN_FILTERING_SET_0 m_nnlfSet0 = false; @@ -2678,27 +2675,43 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if NN_LF_UNIFIED m_nnlfUnified = false; #endif - } - else - { + switch(m_nnlfOption) { + case 0: break; +#if NN_LF_UNIFIED + case 1: m_nnlf = true; - m_nnlfSet = m_nnlfOption - 1; + m_nnlfSet = 3; + m_nnlfUnified = true; + break; +#endif #if NN_FILTERING_SET_0 - m_nnlfSet0 = m_nnlfSet == 0 ? true : false; + case 10: + m_nnlf = true; + m_nnlfSet = 0; + m_nnlfSet0 = true; + break; #endif #if NN_FILTERING_SET_1 - m_nnlfSet1 = m_nnlfSet == 1 ? true : false; - m_encDbOpt = m_nnlfSet1 ? true : m_encDbOpt; -#endif -#if NN_FILTERING_SET_LC - m_nnlfSetLC = m_nnlfSet == 2 ? true : false; + case 11: + m_nnlf = true; + m_nnlfSet = 1; + m_nnlfSet1 = true; + m_encDbOpt = true; + break; #endif -#if NN_LF_UNIFIED - m_nnlfUnified = m_nnlfSet == 3 ? true : false; +#if NN_FILTERING_SET_0 + case 12: + m_nnlf = true; + m_nnlfSet = 2; + m_nnlfSetLC = true; + break; #endif + default: + std::cerr<<"[ERROR] unknown NNLF type"<<std::endl; + exit(-1); + break; } #endif - #if NN_HOP_RDO m_encNnlfHopOpt = m_nnlfUnified ? m_encNnlfHopOpt : false; #endif diff --git a/training/training_scripts/NN_Filtering/HOP/hop_config.json b/training/training_scripts/NN_Filtering/HOP/hop_config.json index 13e45b8508eaf0260aa3b20ad42c44a92cb241b9..e6f9a86ff04e566bac5132e27f1a589c47a88caa 100644 --- a/training/training_scripts/NN_Filtering/HOP/hop_config.json +++ b/training/training_scripts/NN_Filtering/HOP/hop_config.json @@ -25,19 +25,19 @@ "stage2": { "encdec_bvi": { - "vtm_option": "--NnlfUnifiedDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", + "vtm_option": "--NnlfHopDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage1/conversion]" }, "encdec_bvi_valid": { - "vtm_option": "--NnlfUnifiedDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", + "vtm_option": "--NnlfHopDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage1/conversion]" }, "encdec_tvd": { - "vtm_option": "--NnlfUnifiedDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", + "vtm_option": "--NnlfHopDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage1/conversion]" }, "encdec_tvd_valid": { - "vtm_option": "--NnlfUnifiedDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", + "vtm_option": "--NnlfHopDebugOption=1 --NnlfOption=4 --NnlfModelName=[stage1/conversion/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage1/conversion]" }, "training": { @@ -65,19 +65,19 @@ "stage3": { "encdec_bvi": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "encdec_bvi_valid": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "encdec_tvd": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "encdec_tvd_valid": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "training": { diff --git a/training/training_scripts/NN_Filtering/HOP/readme.md b/training/training_scripts/NN_Filtering/HOP/readme.md index 55c37c320848b423f6617fa39245afe7ba90a92d..b55b552a2234ab53f2c6ff75fcba266aa77bc1ed 100644 --- a/training/training_scripts/NN_Filtering/HOP/readme.md +++ b/training/training_scripts/NN_Filtering/HOP/readme.md @@ -1,6 +1,9 @@ # High Operating Point model training ## Overview +### Notes +The following training stages should be performed using specified NNVC version in order to reproduce current models. Note that some options or performance results might differ when using the latest NNVC version. + ### Preparation of the directory At minima, paths should first be set. The file ``training/training_scripts/NN_Filtering/HOP/paths.json`` should be copy and edited to match your environment. All keys with the name ``path`` should be edited to fit your particular environement. @@ -542,9 +545,10 @@ and the correct data macros should be set: The model is tested with the last NNVC version using the following parameters: ``` ---NnlfOption=4 --NnlfModelName=stage2/train/model_int16.sadl +--NnlfOption=1 --NnlfModelName=stage2/train/model_int16.sadl ``` The configuration file is ``encoder_xxx_nnvc.cfg`` and the anchor the last NNVC version. +Note: the NnlfOption has been changed to 1 from NNVC-7.0. ## IV-Advanced diff --git a/training/training_scripts/NN_Filtering/LOP/lop_config.json b/training/training_scripts/NN_Filtering/LOP/lop_config.json index 0355013474d613820f50bf2c86085ed1f9189be3..b1febe8d2f3d5c33c3ef75b86e3cb0b6fe4f1ca6 100644 --- a/training/training_scripts/NN_Filtering/LOP/lop_config.json +++ b/training/training_scripts/NN_Filtering/LOP/lop_config.json @@ -67,19 +67,19 @@ "stage3": { "encdec_bvi": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "encdec_bvi_valid": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "encdec_tvd": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "encdec_tvd_valid": { - "vtm_option": "--NnlfOption=4 --NnlfModelName=[stage2/quantize/full_path_filename]", + "vtm_option": "--NnlfOption=1 --NnlfModelName=[stage2/quantize/full_path_filename]", "vtm_dec_option": "--NnlfModelName=[stage2/conversion]" }, "training": { diff --git a/training/training_scripts/NN_Filtering/LOP/readme.md b/training/training_scripts/NN_Filtering/LOP/readme.md index dc3e7a12cf088614536614def8f8ffcc7c2dc666..c90894f6099c4bc8b23cf76ea5c71ef997f364c4 100644 --- a/training/training_scripts/NN_Filtering/LOP/readme.md +++ b/training/training_scripts/NN_Filtering/LOP/readme.md @@ -1,6 +1,9 @@ # Low Operating Point model training ## Overview +### Notes +The following training stages should be performed using specified NNVC version in order to reproduce current models. Note that some options or performance results might differ when using the latest NNVC version. + ### Preparation of the directory At minima, paths should first be set. The file ``training/training_scripts/NN_Filtering/LOP/paths.json`` should be copy and edited to match your environment. All keys with the name ``path`` should be edited to fit your particular environement. @@ -542,9 +545,10 @@ and the correct data macros should be set: The model is tested with the last NNVC version using the following parameters: ``` ---NnlfOption=4 --NnlfModelName=stage2/train/model_int16.sadl +--NnlfOption=1 --NnlfModelName=stage2/train/model_int16.sadl ``` The configuration file is ``encoder_xxx_nnvc.cfg`` and the anchor the last NNVC version. +Note: the NnlfOption has been changed to 1 from NNVC-7.0. ## IV-Advanced