From 8df6292c62346fa956ffad2d8d64337f6490a756 Mon Sep 17 00:00:00 2001
From: Franck Galpin <franck.galpin@interdigital.com>
Date: Mon, 6 Feb 2023 17:12:28 +0000
Subject: [PATCH] added intra pred models using git lfs

---
 .gitattributes                       | 16 ++++++++++++++--
 source/App/DecoderApp/DecAppCfg.cpp  |  4 ++--
 source/App/EncoderApp/EncAppCfg.cpp  |  4 ++--
 source/Lib/CommonLib/CMakeLists.txt  |  6 +++---
 source/Lib/CommonLib/NNInference.cpp |  3 ++-
 source/Lib/CommonLib/TypeDef.h       | 11 +++--------
 6 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index d0cbfddfd1..ddb69d4e2c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,9 +1,21 @@
 # Set the default behavior, in case people don't have core.autocrlf set.
 * text=auto
-
 # Explicitly declare text files you want to always be normalized and converted
 # to native line endings on checkout.
 *.c text
 *.cpp text
 *.h text
-
+models/intra/graph_output_4_4_float.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_16_float.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_16_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_32_float.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_32_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_4_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_8_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_8_16_float.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_16_16_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_8_8_float.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_4_8_float.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_8_16_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_8_8_int16.sadl filter=lfs diff=lfs merge=lfs -text
+models/intra/graph_output_16_16_float.sadl filter=lfs diff=lfs merge=lfs -text
diff --git a/source/App/DecoderApp/DecAppCfg.cpp b/source/App/DecoderApp/DecAppCfg.cpp
index 8202fbc76c..28f6b040c9 100644
--- a/source/App/DecoderApp/DecAppCfg.cpp
+++ b/source/App/DecoderApp/DecAppCfg.cpp
@@ -144,8 +144,8 @@ bool DecAppCfg::parseCfg( int argc, char* argv[] )
   ("targetSubPicIdx",          m_targetSubPicIdx,                     0,           "Specify which subpicture shall be written to output, using subpic index, 0: disabled, subpicIdx=m_targetSubPicIdx-1 \n" )
   ( "UpscaledOutput",          m_upscaledOutput,                          0,       "Upscaled output for RPR" )
 #if JVET_AB0149_INTRA_PRED
-  ("DescriptionPairHeightWidthPathToGraphOutput", m_descriptionPairHeightWidthPathToGraphOutput, string(""), "Description of each pair of block height and width being a map key and the path to the output graph of the prediction neural network being its string value.")
-  ("PrefixAbsolutePathsToGraphsOutput", m_prefixAbsolutePathsToGraphsOutput, string(""), "Prefix of the absolute path to the output graph of each prediction neural network.")
+  ("DescriptionPairHeightWidthPathToGraphOutput", m_descriptionPairHeightWidthPathToGraphOutput, string("4,4,graph_output_4_4_int16.sadl;4,8,graph_output_4_8_int16.sadl;4,16,graph_output_4_16_int16.sadl;4,32,graph_output_4_32_int16.sadl;8,8,graph_output_8_8_int16.sadl;8,16,graph_output_8_16_int16.sadl;16,16,graph_output_16_16_int16.sadl;"), "Description of each pair of block height and width being a map key and the path to the output graph of the prediction neural network being its string value.")
+  ("PrefixAbsolutePathsToGraphsOutput", m_prefixAbsolutePathsToGraphsOutput, string("models/intra"), "Prefix of the absolute path to the output graph of each prediction neural network.")
 #if JVET_AB0149_ACTIVATE_WRITER_BLOCK_STATS && JVET_AB0149_SEARCH_PNN
   ("AreCostsWritten", m_areCostsWritten, false, "Flag indicating whether the costs are written to file.")
 #endif
diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp
index 629b53b137..3829eeb278 100644
--- a/source/App/EncoderApp/EncAppCfg.cpp
+++ b/source/App/EncoderApp/EncAppCfg.cpp
@@ -1500,8 +1500,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
     ("TemporalFilterFutureReference",                 m_gopBasedTemporalFilterFutureReference,   true,            "Enable referencing of future frames in the GOP based temporal filter. This is typically disabled for Low Delay configurations.")
     ("TemporalFilterStrengthFrame*",                  m_gopBasedTemporalFilterStrengths, std::map<int, double>(), "Strength for every * frame in GOP based temporal filter, where * is an integer. E.g. --TemporalFilterStrengthFrame8 0.95 will enable GOP based temporal filter at every 8th frame with strength 0.95.")
 #if JVET_AB0149_INTRA_PRED
-  ("DescriptionPairHeightWidthPathToGraphOutput", m_descriptionPairHeightWidthPathToGraphOutput, string(""), "Description of each pair of block height and width being a map key and the path to the output graph of the prediction neural network being its string value.")
-  ("PrefixAbsolutePathsToGraphsOutput", m_prefixAbsolutePathsToGraphsOutput, string(""), "Prefix of the absolute path to the output graph of each prediction neural network.")
+  ("DescriptionPairHeightWidthPathToGraphOutput", m_descriptionPairHeightWidthPathToGraphOutput, string("4,4,graph_output_4_4_int16.sadl;4,8,graph_output_4_8_int16.sadl;4,16,graph_output_4_16_int16.sadl;4,32,graph_output_4_32_int16.sadl;8,8,graph_output_8_8_int16.sadl;8,16,graph_output_8_16_int16.sadl;16,16,graph_output_16_16_int16.sadl;"), "Description of each pair of block height and width being a map key and the path to the output graph of the prediction neural network being its string value.")
+  ("PrefixAbsolutePathsToGraphsOutput", m_prefixAbsolutePathsToGraphsOutput, string("models/intra"), "Prefix of the absolute path to the output graph of each prediction neural network.")
 #if JVET_AB0149_SEARCH_PNN && JVET_AB0149_ACTIVATE_WRITER_BLOCK_STATS
   ("AreCostsWritten", m_areCostsWritten, false, "Flag indicating whether the costs are written to file.")
 #endif
diff --git a/source/Lib/CommonLib/CMakeLists.txt b/source/Lib/CommonLib/CMakeLists.txt
index 262398f0a6..d97b7b7f40 100644
--- a/source/Lib/CommonLib/CMakeLists.txt
+++ b/source/Lib/CommonLib/CMakeLists.txt
@@ -121,12 +121,12 @@ elseif( UNIX OR MINGW )
 endif()
 if(UNIX)
   if(NNLF_BUILD_WITH_AVX512 STREQUAL "1")
-    set_property( SOURCE intra_pred_sadl.cpp APPEND PROPERTY COMPILE_FLAGS "-ffast-math -Wall -fstrict-aliasing -mavx512f")
+    set_property( SOURCE intra_pred_sadl.cpp APPEND PROPERTY COMPILE_FLAGS "-ffast-math -Wall -fstrict-aliasing -mavx512f -mavx512bw -DNDEBUG=1 ")
   else()
-    set_property( SOURCE intra_pred_sadl.cpp APPEND PROPERTY COMPILE_FLAGS "-ffast-math -Wall -fstrict-aliasing -mavx2")
+    set_property( SOURCE intra_pred_sadl.cpp APPEND PROPERTY COMPILE_FLAGS "-ffast-math -Wall -fstrict-aliasing -mavx2 -DNDEBUG=1 ")
   endif()
 elseif(MSVC)
- set_property( SOURCE intra_pred_sadl.cpp APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2")
+ set_property( SOURCE intra_pred_sadl.cpp APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2 -DNDEBUG=1 ")
 endif()
 
 # example: place header files in different folders
diff --git a/source/Lib/CommonLib/NNInference.cpp b/source/Lib/CommonLib/NNInference.cpp
index 7f1f144534..bb606123f6 100644
--- a/source/Lib/CommonLib/NNInference.cpp
+++ b/source/Lib/CommonLib/NNInference.cpp
@@ -34,8 +34,9 @@
 /** \file     NNInference.h
     \brief    neural network-based inference class (header)
 */
-#include <sadl/model.h>
+
 #include "NNInference.h"
+#include <sadl/model.h>
 //! \ingroup CommonLib
 //! \{
 
diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h
index 1de614434f..e58f7f3436 100644
--- a/source/Lib/CommonLib/TypeDef.h
+++ b/source/Lib/CommonLib/TypeDef.h
@@ -50,20 +50,15 @@
 #include <assert.h>
 #include <cassert>
 
-#define JVET_AB0149_ACTIVATE_WRITER_BLOCK_STATS 1
+
+#define JVET_AB0149_ACTIVATE_WRITER_BLOCK_STATS 0
 
 // Below is the default set of macros for rate-distortion tests.
-#if !defined(JVET_AB0149_INTRA_PRED) && !defined(JVET_AB0149_SEARCH_PNN) && !defined(JVET_AB0149_TM_INF_PNN) && !defined(NN_FIXED_POINT_IMPLEMENTATION)
 #define JVET_AB0149_INTRA_PRED 1
 #define JVET_AB0149_SEARCH_PNN 0
 #define JVET_AB0149_TM_INF_PNN 1
 #define NN_FIXED_POINT_IMPLEMENTATION 1
-#define SPARSE_SUPPORT 1
-#else
-#if !defined(JVET_AB0149_INTRA_PRED) || !defined(JVET_AB0149_SEARCH_PNN) || !defined(JVET_AB0149_TM_INF_PNN) || !defined(NN_FIXED_POINT_IMPLEMENTATION)
-#error "The default set of macros is not used and `JVET_AB0149_INTRA_PRED` or `JVET_AB0149_SEARCH_PNN` or `JVET_AB0149_TM_INF_PNN` or `NN_FIXED_POINT_IMPLEMENTATION` is not defined."
-#endif
-#endif
+#define SPARSE_SUPPORT 1 
 
 #if JVET_AB0149_INTRA_PRED && JVET_AB0149_SEARCH_PNN && JVET_AB0149_TM_INF_PNN
 #error "`JVET_AB0149_SEARCH_PNN` is equal to 1 and `JVET_AB0149_TM_INF_PNN` is equal to 1."
-- 
GitLab