Enable CWG-E135, ML based partition pruning in compile time.

Enables CWG-E135 by default in compile time and fixes the following build issues:

- Fixed warnings in CWG-E135 implementation;
- TFlite is only compiled as part of the encoder;
- The experiment is disabled for ARM, PPC and Windows builds until compilation issues are resolved;
- Werror is disabled for anything but AVM authored code;
- Wcomment is disabled in the TFLite includes;
- Run static analyzer only on AVM code
- Disable saving of unncessary artifacts.
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e105588..41d76d4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -269,11 +269,6 @@
     - cmake --build aom_build --target dist
     - DESTDIR="${CI_PROJECT_DIR}/${INSTALLROOT_FOLDER}" cmake --build aom_build --target install/strip
   needs: []
-  artifacts:
-    expire_in: 1 day
-    paths:
-      - ${CI_PROJECT_DIR}/aom_build/dist/*
-      - ${CI_PROJECT_DIR}/installroot/*
 
 Build (generic-gnu):
   extends: .build-common
@@ -359,6 +354,7 @@
     CMAKE_FLAGS: >-
       -DENABLE_CCACHE=1
       -DENABLE_DOCS=0
+      -DCONFIG_ML_PART_SPLIT=0
       -DCMAKE_TOOLCHAIN_FILE=build/cmake/toolchains/arm64-linux-gcc.cmake
 
 Build (armv7-linux-gcc):
@@ -380,12 +376,14 @@
     CMAKE_FLAGS: >-
       -DENABLE_CCACHE=1
       -DENABLE_DOCS=0
+      -DCONFIG_ML_PART_SPLIT=0
       -DCMAKE_TOOLCHAIN_FILE=build/cmake/toolchains/armv7-linux-gcc.cmake
 
 Build (ppc-linux-gcc):
   extends: .build-common
   variables:
     EXTRA_CMAKE_FLAGS: >-
+      -DCONFIG_ML_PART_SPLIT=0
       -DCROSS=powerpc64le-linux-gnu-
       -DCMAKE_TOOLCHAIN_FILE=build/cmake/toolchains/ppc-linux-gcc.cmake
 
@@ -405,6 +403,7 @@
           - no-examples
   variables:
     EXTRA_CMAKE_FLAGS: >-
+      -DCONFIG_ML_PART_SPLIT=0
       -DCMAKE_TOOLCHAIN_FILE=build/cmake/toolchains/x86-mingw-gcc.cmake
 
 Build (x86_64-mingw-gcc):
@@ -423,6 +422,7 @@
           - no-examples
   variables:
     EXTRA_CMAKE_FLAGS: >-
+      -DCONFIG_ML_PART_SPLIT=0
       -DCMAKE_TOOLCHAIN_FILE=build/cmake/toolchains/x86_64-mingw-gcc.cmake
 
 Build Documentation:
@@ -459,7 +459,6 @@
   script:
     - git fetch --unshallow
     - cmake -B aom_example_build
-        -DCMAKE_BUILD_TYPE=RelWithDebInfo
         -DENABLE_ASSERTS=1
         -DENABLE_EXAMPLES=1
         -DBUILD_SHARED_LIBS=0
@@ -676,12 +675,12 @@
     AOMENC_LIMIT: 30
     AOMENC_QP: 210
     AOMENC_INPUT: Vertical_Bayshore_270x480_2997.y4m
-    AOMENC: installroot/usr/local/bin/aomenc
+    AOMENC: aom_example_build/aomenc
   before_script:
     - curl -s -S -f -O https://gitlab.com/AOMediaCodec/aom-testing/-/raw/master/test-files/${AOMENC_INPUT}.xz
     - unxz ${AOMENC_INPUT}.xz
   needs:
-    - 'Build (x86_64-linux-gcc): [encode-only]'
+    - 'Example Build (x86_64-gcc)'
   rules:
     - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
     - if: '$CI_PIPELINE_SOURCE == "schedule"'
@@ -816,7 +815,7 @@
   interruptible: true
   variables:
     AOMENC_LIMIT: 30  # Should match the same variable in `.enc-run-common`
-    AOMDEC: installroot/usr/local/bin/aomdec
+    AOMDEC: aom_example_build/aomdec
   script:
     - ${AOMDEC} ${AOMENC_OUTPUT}.obu -o ${AOMDEC_OUTPUT}.decoded.y4m --summary
        2>&1 | tee "${AOMDEC_OUTPUT}.summary.log"
@@ -848,7 +847,7 @@
     AOMDEC_OUTPUT: dec-all-intra
   needs:
     - 'Enc Run (All-intra)'
-    - 'Build (x86_64-linux-gcc): [decode-only]'
+    - 'Example Build (x86_64-gcc)'
 
 
 Dec Run (Random Access):
@@ -858,7 +857,7 @@
     AOMDEC_OUTPUT: dec-random-access
   needs:
     - 'Enc Run (Random Access)'
-    - 'Build (x86_64-linux-gcc): [decode-only]'
+    - 'Example Build (x86_64-gcc)'
 
 
 Dec Run (Low-delay):
@@ -868,7 +867,7 @@
     AOMDEC_OUTPUT: dec-low-delay
   needs:
     - 'Enc Run (Low-delay)'
-    - 'Build (x86_64-linux-gcc): [decode-only]'
+    - 'Example Build (x86_64-gcc)'
 
 
 Enc compare:
@@ -935,7 +934,7 @@
     - mkdir output-${ANALYZER_MODE}
     - |
       scan_build() {
-        scan-build --exclude third_party -o output-${ANALYZER_MODE} -analyzer-config mode=${ANALYZER_MODE} $*
+        scan-build --exclude third_party --exclude _deps --exclude xnnpack --exclude flatbuffers --exclude cpuinfo --exclude abseil-cpp --exclude eigen --exclude ruy --exclude pthreadpool-source -o output-${ANALYZER_MODE} -analyzer-config mode=${ANALYZER_MODE} $*
       }
     - scan_build cmake -B aom_build -GNinja -DCMAKE_BUILD_TYPE=Debug
     - scan_build --status-bugs cmake --build aom_build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 550600d..7a0a446 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -840,7 +840,7 @@
   endif()
 endif()
 
-if(CONFIG_TENSORFLOW_LITE)
+if(CONFIG_TENSORFLOW_LITE AND CONFIG_AV1_ENCODER)
   if(ENABLE_EXAMPLES)
     add_executable(tf_lite_model "${AOM_ROOT}/examples/tf_lite_model.cc")
     list(APPEND AOM_EXAMPLE_TARGETS tf_lite_model)
@@ -848,7 +848,9 @@
     add_executable(cnn_restore_y4m
                    "${AOM_ROOT}/examples/cnn_restore/cnn_restore_y4m.cc")
     list(APPEND AOM_APP_TARGETS cnn_restore_y4m)
+  endif()
 
+  if(ENABLE_EXAMPLES OR ENABLE_TOOLS)
     foreach(aom_app ${AOM_APP_TARGETS})
       add_dependencies(${aom_app} tensorflow-lite)
       target_link_libraries(${aom_app} PRIVATE tensorflow-lite)
@@ -1059,5 +1061,14 @@
   endif()
 endforeach()
 
+if(ENABLE_WERROR)
+  foreach(aom_app ${AOM_APP_TARGETS})
+    target_compile_options(${aom_app} PRIVATE "-Werror" "-Wno-error=comment")
+  endforeach()
+  foreach(aom_lib ${AOM_LIB_TARGETS})
+    target_compile_options(${aom_lib} PRIVATE "-Werror" "-Wno-error=comment")
+  endforeach()
+endif()
+
 # Generate aom.pc and setup install rule.
 setup_aom_install_targets()
diff --git a/av1/encoder/partition_strategy.c b/av1/encoder/partition_strategy.c
index 4fe7e38..5b493af 100644
--- a/av1/encoder/partition_strategy.c
+++ b/av1/encoder/partition_strategy.c
@@ -2428,20 +2428,20 @@
   }
 }
 
-static double log_mag(MV mv) {
+static float log_mag(MV mv) {
   double mag = sqrt(mv.col * mv.col + mv.row * mv.row);
-  return logf(1.0f + mag);
+  return (float)logl(1.0f + mag);
 }
 
-static double angle_rad(MV mv) {
+static float angle_rad(MV mv) {
   double mag = sqrt(mv.col * mv.col + mv.row * mv.row);
-  return mag == 0 ? 0 : asin(mv.row / mag);
+  return (float)(mag == 0 ? 0 : asin(mv.row / mag));
 }
 
 struct ResidualStats {
   int q_coeff_max;
   int q_coeff_nonz;
-  double psnr;
+  float psnr;
   int satdq;
   int satd;
 };
@@ -2515,7 +2515,7 @@
   }
   double mse =
       ((double)sse) / (block_size_high[bsize] * block_size_wide[bsize]);
-  ret.psnr = sse == 0 ? 70 : AOMMIN(70, 20 * log10(255 / sqrt(mse)));
+  ret.psnr = (float)(sse == 0 ? 70 : AOMMIN(70, 20 * log10(255 / sqrt(mse))));
 
   // TODO: figure out the way to do it w/o allocations
   p->coeff = NULL;
@@ -2532,7 +2532,6 @@
 }
 
 static struct ResidualStats compute_motion_data(AV1_COMP *const cpi,
-                                                const TileInfo *const tile,
                                                 ThreadData *td, MACROBLOCK *x,
                                                 SimpleMotionData *sms,
                                                 int mi_row, int mi_col,
@@ -2584,8 +2583,8 @@
 
   SimpleMotionData *blk_none =
       av1_get_sms_data(cpi, tile_info, x, mi_row, mi_col, bsize);
-  struct ResidualStats stats_none = compute_motion_data(
-      cpi, tile_info, td, x, blk_none, mi_row, mi_col, bsize);
+  struct ResidualStats stats_none =
+      compute_motion_data(cpi, td, x, blk_none, mi_row, mi_col, bsize);
 
   BLOCK_SIZE subsize_sq = get_partition_subsize(
       get_partition_subsize(bsize, PARTITION_HORZ), PARTITION_VERT);
@@ -2599,21 +2598,20 @@
     int h_sub_mi = mi_size_high[subsize_sq];
     SimpleMotionData *blk_sq_0 =
         av1_get_sms_data(cpi, tile_info, x, mi_row, mi_col, subsize_sq);
-    struct ResidualStats stats_sq_0 = compute_motion_data(
-        cpi, tile_info, td, x, blk_sq_0, mi_row, mi_col, subsize_sq);
+    struct ResidualStats stats_sq_0 =
+        compute_motion_data(cpi, td, x, blk_sq_0, mi_row, mi_col, subsize_sq);
     SimpleMotionData *blk_sq_1 = av1_get_sms_data(
         cpi, tile_info, x, mi_row, mi_col + w_sub_mi, subsize_sq);
     struct ResidualStats stats_sq_1 = compute_motion_data(
-        cpi, tile_info, td, x, blk_sq_1, mi_row, mi_col + w_sub_mi, subsize_sq);
+        cpi, td, x, blk_sq_1, mi_row, mi_col + w_sub_mi, subsize_sq);
     SimpleMotionData *blk_sq_2 = av1_get_sms_data(
         cpi, tile_info, x, mi_row + h_sub_mi, mi_col, subsize_sq);
     struct ResidualStats stats_sq_2 = compute_motion_data(
-        cpi, tile_info, td, x, blk_sq_2, mi_row + h_sub_mi, mi_col, subsize_sq);
+        cpi, td, x, blk_sq_2, mi_row + h_sub_mi, mi_col, subsize_sq);
     SimpleMotionData *blk_sq_3 = av1_get_sms_data(
         cpi, tile_info, x, mi_row + h_sub_mi, mi_col + w_sub_mi, subsize_sq);
-    struct ResidualStats stats_sq_3 =
-        compute_motion_data(cpi, tile_info, td, x, blk_sq_3, mi_row + h_sub_mi,
-                            mi_col + w_sub_mi, subsize_sq);
+    struct ResidualStats stats_sq_3 = compute_motion_data(
+        cpi, td, x, blk_sq_3, mi_row + h_sub_mi, mi_col + w_sub_mi, subsize_sq);
 
     if (out_features) {
       int blk_area = block_size_wide[bsize] * block_size_high[bsize];
diff --git a/av1/encoder/simple_intrapred_tflite_model_128x128.h b/av1/encoder/simple_intrapred_tflite_model_128x128.h
index a8a4e5f..1d5b883 100644
--- a/av1/encoder/simple_intrapred_tflite_model_128x128.h
+++ b/av1/encoder/simple_intrapred_tflite_model_128x128.h
@@ -11,10 +11,10 @@
 
 const struct ModelParams
     a3_qp96_128_160_luma_BLOCK_128X128_intra_tflite_params[] = {
-      { 0.3, 0.98, 60, 116 },
-      { 0.4, 0.97, 60, 116 },
-      { 0.5, 0.95, 60, 116 },
-      { 0.7, 0.95, 60, 116 }
+      { 0.3f, 0.98f, 60, 116 },
+      { 0.4f, 0.97f, 60, 116 },
+      { 0.5f, 0.95f, 60, 116 },
+      { 0.7f, 0.95f, 60, 116 }
     };
 
 unsigned char a3_qp96_128_160_luma_BLOCK_128X128_intra_tflite[] = {
diff --git a/av1/encoder/simple_intrapred_tflite_model_16x16.h b/av1/encoder/simple_intrapred_tflite_model_16x16.h
index 8bc0840..ddd1141 100644
--- a/av1/encoder/simple_intrapred_tflite_model_16x16.h
+++ b/av1/encoder/simple_intrapred_tflite_model_16x16.h
@@ -11,10 +11,10 @@
 
 const struct ModelParams
     a3_qp96_128_160_luma_BLOCK_16X16_intra_tflite_params[] = {
-      { 0.002, 0.35, 60, 116 },
-      { 0.005, 0.32, 60, 116 },
-      { 0.01, 0.3, 60, 116 },
-      { 0.01, 0.15, 60, 116 }
+      { 0.002f, 0.35f, 60, 116 },
+      { 0.005f, 0.32f, 60, 116 },
+      { 0.01f, 0.3f, 60, 116 },
+      { 0.01f, 0.15f, 60, 116 }
     };
 
 unsigned char a3_qp96_128_160_luma_BLOCK_16X16_intra_tflite[] = {
diff --git a/av1/encoder/simple_intrapred_tflite_model_32x32.h b/av1/encoder/simple_intrapred_tflite_model_32x32.h
index b1b11da..8cd791f 100644
--- a/av1/encoder/simple_intrapred_tflite_model_32x32.h
+++ b/av1/encoder/simple_intrapred_tflite_model_32x32.h
@@ -10,10 +10,10 @@
  */
 const struct ModelParams
     a3_qp96_128_160_luma_BLOCK_32X32_intra_tflite_params[] = {
-      { 0.052, 0.45, 60, 116 },
-      { 0.052, 0.45, 60, 116 },
-      { 0.07, 0.44, 60, 116 },
-      { 0.07, 0.25, 60, 116 }
+      { 0.052f, 0.45f, 60, 116 },
+      { 0.052f, 0.45f, 60, 116 },
+      { 0.07f, 0.44f, 60, 116 },
+      { 0.07f, 0.25f, 60, 116 }
     };
 
 unsigned char a3_qp96_128_160_luma_BLOCK_32X32_intra_tflite[] = {
diff --git a/av1/encoder/simple_intrapred_tflite_model_64x64.h b/av1/encoder/simple_intrapred_tflite_model_64x64.h
index 31b7740..8b3e7b4 100644
--- a/av1/encoder/simple_intrapred_tflite_model_64x64.h
+++ b/av1/encoder/simple_intrapred_tflite_model_64x64.h
@@ -10,10 +10,10 @@
  */
 const struct ModelParams
     a3_qp96_128_160_luma_BLOCK_64X64_intra_tflite_params[] = {
-      { 0.03, 0.7, 60, 116 },
-      { 0.1, 0.7, 60, 116 },
-      { 0.2, 0.66, 60, 116 },
-      { 0.25, 0.7, 60, 116 }
+      { 0.03f, 0.7f, 60, 116 },
+      { 0.1f, 0.7f, 60, 116 },
+      { 0.2f, 0.66f, 60, 116 },
+      { 0.25f, 0.7f, 60, 116 }
     };
 
 unsigned char a3_qp96_128_160_luma_BLOCK_64X64_intra_tflite[] = {
diff --git a/av1/encoder/sms_part_split_prune_tflite_model.h b/av1/encoder/sms_part_split_prune_tflite_model.h
index 25d5f4d..9b57204 100644
--- a/av1/encoder/sms_part_split_prune_tflite_model.h
+++ b/av1/encoder/sms_part_split_prune_tflite_model.h
@@ -9,31 +9,31 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 const struct ModelParams sms_part_split_prune_tflite_model_params_bs12[] = {
-  { 0.0001, 0.95, 75, 150 },
-  { 0.005, 0.9, 75, 150 },
-  { 0.01, 0.85, 75, 150 },
-  { 0.02, 0.8, 75, 150 }
+  { 0.0001f, 0.95f, 75, 150 },
+  { 0.005f, 0.9f, 75, 150 },
+  { 0.01f, 0.85f, 75, 150 },
+  { 0.02f, 0.8f, 75, 150 }
 };
 
 const struct ModelParams sms_part_split_prune_tflite_model_params_bs9[] = {
-  { 0.001, 0.99, 75, 150 },
-  { 0.005, 0.95, 75, 150 },
-  { 0.02, 0.9, 75, 150 },
-  { 0.04, 0.85, 75, 150 }
+  { 0.001f, 0.99f, 75, 150 },
+  { 0.005f, 0.95f, 75, 150 },
+  { 0.02f, 0.9f, 75, 150 },
+  { 0.04f, 0.85f, 75, 150 }
 };
 
 const struct ModelParams sms_part_split_prune_tflite_model_params_bs6[] = {
-  { 0.01, 1, 75, 150 },
-  { 0.02, 1, 75, 150 },
-  { 0.05, 1, 75, 150 },
-  { 0.1, 1, 75, 150 }
+  { 0.01f, 1.f, 75, 150 },
+  { 0.02f, 1.f, 75, 150 },
+  { 0.05f, 1.f, 75, 150 },
+  { 0.1f, 1.f, 75, 150 }
 };
 
 const struct ModelParams sms_part_split_prune_tflite_model_params_bs3[] = {
-  { 0.05, 1, 75, 150 },
-  { 0.1, 1, 75, 150 },
-  { 0.25, 1, 75, 150 },
-  { 0.35, 1, 75, 150 }
+  { 0.05f, 1.f, 75, 150 },
+  { 0.1f, 1.f, 75, 150 },
+  { 0.25f, 1.f, 75, 150 },
+  { 0.35f, 1.f, 75, 150 }
 };
 
 // git_part_prune_bs3_6_9_12_qp_110_135_160_nnz_psnr_vect_satdq_32_16_a2_a3_bs12_tflite_model.cc
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 8ce9dd4..425fec1 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1034,9 +1034,6 @@
   if (cpi->speed >= 2) {
     sf->part_sf.simple_motion_search_early_term_none = 1;
   }
-#if CONFIG_ML_PART_SPLIT
-  bool key_frame = cpi->common.current_frame.frame_type == KEY_FRAME;
-#endif  // CONFIG_ML_PART_SPLIT
 }
 #endif  // CONFIG_EXT_RECUR_PARTITIONS
 
diff --git a/av1/tflite_models/op_registrations.h b/av1/tflite_models/op_registrations.h
index c0133a9..7d4e0fa 100644
--- a/av1/tflite_models/op_registrations.h
+++ b/av1/tflite_models/op_registrations.h
@@ -20,15 +20,26 @@
 // Since TF Lite is external code, instruct the compiler to
 // ignore this warning when including it.
 // Note that Clang supports this GCC pragma.
+#if defined(__GNUC__) || defined(__GNUG__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wcomment"
+#elif defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic warning "-Wunused-parameter"
+#pragma clang diagnostic warning "-Wcomment"
+#endif
 
 #include "tensorflow/lite/kernels/builtin_op_kernels.h"
 #include "tensorflow/lite/interpreter.h"
 #include "tensorflow/lite/model.h"
 #include "tensorflow/lite/op_resolver.h"
 
+#if defined(__GNUC__) || defined(__GNUG__)
 #pragma GCC diagnostic pop
+#elif defined(__clang__)
+#pragma clang diagnostic pop
+#endif
 
 // Returns super-set of TF-lite ops required by CNN models for all QPs.
 void RegisterSelectedOpsAllQps(::tflite::MutableOpResolver *resolver);
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 17f9b9d..3db8455 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -445,9 +445,8 @@
 set_aom_config_var(CONFIG_SUBBLK_PAD 1
                    "Enable subblock padding for subblock mv refinement.")
 
-set_aom_config_var(
-  CONFIG_ML_PART_SPLIT 0 "Partition SPLIT pruning/forcing for intra frames as
-                   predicted by ML.")
+set_aom_config_var(CONFIG_ML_PART_SPLIT 1
+                   "Partition SPLIT pruning/forcing as predicted by ML.")
 set_aom_config_var(
   CONFIG_INTRA_TX_IST_PARSE 1
   "Parsing dependency removal for intra tx type and IST set signaling.")
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index de5d718..591e6a6 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -338,10 +338,6 @@
     add_cxx_flag_if_supported("-Wno-psabi")
   endif()
 
-  if(ENABLE_WERROR)
-    add_compiler_flag_if_supported("-Werror")
-  endif()
-
   if(ENABLE_ASSERTS)
     add_compiler_flag_if_supported("-UNDEBUG")
   endif()
diff --git a/common/tf_lite_includes.h b/common/tf_lite_includes.h
index debacdd..dcfdaad 100644
--- a/common/tf_lite_includes.h
+++ b/common/tf_lite_includes.h
@@ -21,8 +21,15 @@
 // Since TF Lite is external code, instruct the compiler to
 // ignore this warning when including it.
 // Note that Clang supports this GCC pragma.
+#if defined(__GNUC__) || defined(__GNUG__)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-parameter"
+#pragma GCC diagnostic ignored "-Wcomment"
+#elif defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic warning "-Wunused-parameter"
+#pragma clang diagnostic warning "-Wcomment"
+#endif
 
 #include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h"
 #include "tensorflow/lite/kernels/builtin_op_kernels.h"
@@ -30,6 +37,10 @@
 #include "tensorflow/lite/model.h"
 #include "tensorflow/lite/op_resolver.h"
 
+#if defined(__GNUC__) || defined(__GNUG__)
 #pragma GCC diagnostic pop
+#elif defined(__clang__)
+#pragma clang diagnostic pop
+#endif
 
 #endif  // AOM_COMMON_TF_LITE_INCLUDES_H_