Introduce simple_motion_search_prune_rect

Introduces simple_motion_search_prune_rect speed feature, which uses the
sse and var of prediction residue made by simple_motion_search in each
partition subblock to prune PARTITION_HORZ and PARTITION_VERT.

This replaces ml_prune_rect_partition on speed >= 1 with the
following advantages:

1) Increased Mode Modularity:
The pruning of PARTITION_HORZ and PARTITION_VERT now no longer depends
on actual partition result from PARTITION_SPLIT. This alleviates awkward
scenarios where pruning modes within the subblock in PARTITION_SPLIT
increase the quality but increase encoding time.

2) Better Quality and Lower Encoding Time:
Using OVR_PSNR as a metric, we observe a gain of 0.011% on midres and
0.044% on lowres. We have also observed an average speed up of 1.1% over
5 midres clips, 4 bitrates, 30 frames.

STATS_CHANGED

Change-Id: I62506609583112bd01e158b11d78bf9a5bd7a1ab
diff --git a/av1/encoder/context_tree.h b/av1/encoder/context_tree.h
index 3ced1f5..66f24f9 100644
--- a/av1/encoder/context_tree.h
+++ b/av1/encoder/context_tree.h
@@ -115,6 +115,7 @@
   PC_TREE_STATS pc_tree_stats;
   CB_TREE_SEARCH cb_search_range;
   int index;
+  MV mv_ref_fulls[REF_FRAMES];
 } PC_TREE;
 
 void av1_setup_pc_tree(struct AV1Common *cm, struct ThreadData *td);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index c7ca078..4afbd10 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -148,6 +148,15 @@
 };
 #endif  // CONFIG_FP_MB_STATS
 
+static const uint8_t ref_frame_flag_list[REF_FRAMES] = { 0,
+                                                         AOM_LAST_FLAG,
+                                                         AOM_LAST2_FLAG,
+                                                         AOM_LAST3_FLAG,
+                                                         AOM_GOLD_FLAG,
+                                                         AOM_BWD_FLAG,
+                                                         AOM_ALT2_FLAG,
+                                                         AOM_ALT_FLAG };
+
 unsigned int av1_get_sby_perpixel_variance(const AV1_COMP *cpi,
                                            const struct buf_2d *ref,
                                            BLOCK_SIZE bs) {
@@ -2104,10 +2113,10 @@
 // after calling this function.
 static void simple_motion_search(AV1_COMP *const cpi, MACROBLOCK *x, int mi_row,
                                  int mi_col, BLOCK_SIZE bsize, int ref,
-                                 int num_planes, int use_subpixel) {
+                                 MV ref_mv_full, int num_planes,
+                                 int use_subpixel) {
   assert(num_planes == 1 &&
          "Currently simple_motion_search only supports luma plane");
-
   AV1_COMMON *const cm = &cpi->common;
   MACROBLOCKD *xd = &x->e_mbd;
 
@@ -2123,9 +2132,9 @@
   const YV12_BUFFER_CONFIG *scaled_ref_frame =
       av1_get_scaled_ref_frame(cpi, ref);
   struct buf_2d backup_yv12;
-  // ref_mv is in units of 1/8-pel whereas ref_mv_full is in units of pel
+  // ref_mv is used to code the motion vector. ref_mv_full is the initial point.
+  // ref_mv is in units of 1/8 pel whereas ref_mv_full is in units of pel.
   MV ref_mv = { 0, 0 };
-  MV ref_mv_full = { 0, 0 };
   const int step_param = cpi->mv_step_param;
   const MvLimits tmp_mv_limits = x->mv_limits;
   const SEARCH_METHODS search_methods = NSTEP;
@@ -3490,8 +3499,9 @@
   const int use_subpixel = 0;
   const int num_planes = 1;
 
-  simple_motion_search(cpi, x, mi_row, mi_col, bsize, ref, num_planes,
-                       use_subpixel);
+  const MV ref_mv_full = { .row = 0, .col = 0 };
+  simple_motion_search(cpi, x, mi_row, mi_col, bsize, ref, ref_mv_full,
+                       num_planes, use_subpixel);
 
   // Start getting the features
   int f_idx = 0;
@@ -3529,7 +3539,251 @@
   }
 }
 
-// TODO(jingning,jimbankoski,rbultje): properly skip partition types that are
+// Given a list of ref frames in refs, performs simple_motion_search on each of
+// the refs and returns the ref with the smallest sse. Returns -1 if none of the
+// ref in the list is available. Also stores the best sse and var in best_sse,
+// best_var, respectively. If save_mv_code is -1, don't update mv_ref_fulls in
+// pc_tree. If save_mv_code is between 0 and 3, update mv_ref_fulls under
+// pc_tree->split[i]. If save_mv_code is 4, update mv_ref_fulls under pc_tree.
+static int simple_motion_search_get_best_ref(
+    AV1_COMP *const cpi, MACROBLOCK *x, PC_TREE *pc_tree, int mi_row,
+    int mi_col, BLOCK_SIZE bsize, const int *const refs, int num_refs,
+    int use_subpixel, int save_mv_code, unsigned int *best_sse,
+    unsigned int *best_var) {
+  // TODO(chiyotsai@google.com): The calculation of variance currently uses
+  // bsize, so we might take area outside of the image into account. We need to
+  // modify the SIMD functions to fix this later.
+  const AV1_COMMON *const cm = &cpi->common;
+  int best_ref = -1;
+
+  if (mi_col >= cm->mi_cols || mi_row >= cm->mi_rows) {
+    // If the whole block is outside of the image, set the var and sse to 0.
+    *best_var = 0;
+    *best_sse = 0;
+
+    return best_ref;
+  }
+
+  // Otherwise do loop through the reference frames and find the one with the
+  // minimum SSE
+  const MACROBLOCKD *xd = &x->e_mbd;
+  const MV *mv_ref_fulls = pc_tree->mv_ref_fulls;
+
+  const int num_planes = 1;
+
+  *best_sse = INT_MAX;
+
+  for (int ref_idx = 0; ref_idx < num_refs; ref_idx++) {
+    const int ref = refs[ref_idx];
+
+    if (cpi->ref_frame_flags & ref_frame_flag_list[ref]) {
+      unsigned int curr_sse = 0, curr_var = 0;
+      simple_motion_search(cpi, x, mi_row, mi_col, bsize, ref,
+                           mv_ref_fulls[ref], num_planes, use_subpixel);
+      curr_var = cpi->fn_ptr[bsize].vf(
+          x->plane[0].src.buf, x->plane[0].src.stride, xd->plane[0].dst.buf,
+          xd->plane[0].dst.stride, &curr_sse);
+      if (curr_sse < *best_sse) {
+        *best_sse = curr_sse;
+        *best_var = curr_var;
+        best_ref = ref;
+      }
+
+      if (save_mv_code == 4) {
+        pc_tree->mv_ref_fulls[ref].row = x->best_mv.as_mv.row / 8;
+        pc_tree->mv_ref_fulls[ref].col = x->best_mv.as_mv.col / 8;
+      } else if (save_mv_code >= 0 && save_mv_code < 4) {
+        // Propagate the new motion vectors to a lower level
+        pc_tree->split[save_mv_code]->mv_ref_fulls[ref].row =
+            x->best_mv.as_mv.row / 8;
+        pc_tree->split[save_mv_code]->mv_ref_fulls[ref].col =
+            x->best_mv.as_mv.col / 8;
+      }
+    }
+  }
+
+  return best_ref;
+}
+
+// Performs fullpixel simple_motion_search with LAST_FRAME and ALTREF_FRAME on
+// each subblocks and extract the variance and sse of residues. Then store the
+// var and sse from each partition subblock to features. The DC qindex is also
+// stored in features. The last two entries are whether the current block is
+// located on the right or bottom edge, but current they are not used for bsize
+// less than BLOCK_64X64.
+// Here features is assumed to be a length 21 array.
+// After this function is called, we will store the following to features:
+// features[0:17] = var and sse from subblocks
+// features[18] = DC q_index
+// features[19] = is_bottom
+// features[20] = is_right
+#define FEATURES 21
+static void simple_motion_search_prune_rect_features(
+    AV1_COMP *const cpi, MACROBLOCK *x, PC_TREE *pc_tree, int mi_row,
+    int mi_col, BLOCK_SIZE bsize, float *features) {
+  // TODO(chiyotsai@google.com): Cache the result of the motion search from the
+  // larger bbsize.
+  const AV1_COMMON *const cm = &cpi->common;
+  const int w_mi = mi_size_wide[bsize];
+  const int h_mi = mi_size_high[bsize];
+  int f_idx = 0;
+  assert(mi_size_wide[bsize] == mi_size_high[bsize]);
+  assert(!frame_is_intra_only(cm));
+  assert(cpi->ref_frame_flags & ref_frame_flag_list[LAST_FRAME] ||
+         cpi->ref_frame_flags & ref_frame_flag_list[ALTREF_FRAME]);
+
+  // Setting up motion search
+  const int ref_list[] = { LAST_FRAME, ALTREF_FRAME };
+  const int num_refs = 2;
+  const int use_subpixel = 0;
+
+  unsigned int best_sse = 0, best_var = 0;
+  unsigned int none_sse = 0, none_var = 0;
+
+  // Doing whole block first to update the mv
+  simple_motion_search_get_best_ref(cpi, x, pc_tree, mi_row, mi_col, bsize,
+                                    ref_list, num_refs, use_subpixel, 4,
+                                    &none_sse, &none_var);
+
+  // Split subblocks
+  BLOCK_SIZE subsize = get_partition_subsize(bsize, PARTITION_SPLIT);
+  int r_idx = 0;
+  for (r_idx = 0; r_idx < 4; r_idx++) {
+    const int sub_mi_col = mi_col + (r_idx & 1) * w_mi / 2;
+    const int sub_mi_row = mi_row + (r_idx >> 1) * h_mi / 2;
+
+    simple_motion_search_get_best_ref(cpi, x, pc_tree, sub_mi_row, sub_mi_col,
+                                      subsize, ref_list, num_refs, use_subpixel,
+                                      r_idx, &best_sse, &best_var);
+
+    features[f_idx++] = logf(1.0f + (float)best_var);
+    features[f_idx++] = logf(1.0f + (float)best_sse);
+  }
+
+  // Horz subblocks
+  subsize = get_partition_subsize(bsize, PARTITION_HORZ);
+  for (r_idx = 0; r_idx < 2; r_idx++) {
+    const int sub_mi_col = mi_col + 0;
+    const int sub_mi_row = mi_row + r_idx * h_mi / 2;
+
+    simple_motion_search_get_best_ref(cpi, x, pc_tree, sub_mi_row, sub_mi_col,
+                                      subsize, ref_list, num_refs, use_subpixel,
+                                      -1, &best_sse, &best_var);
+
+    features[f_idx++] = logf(1.0f + (float)best_var);
+    features[f_idx++] = logf(1.0f + (float)best_sse);
+  }
+
+  // Vert subblock
+  subsize = get_partition_subsize(bsize, PARTITION_VERT);
+  for (r_idx = 0; r_idx < 2; r_idx++) {
+    const int sub_mi_col = mi_col + r_idx * w_mi / 2;
+    const int sub_mi_row = mi_row + 0;
+
+    simple_motion_search_get_best_ref(cpi, x, pc_tree, sub_mi_row, sub_mi_col,
+                                      subsize, ref_list, num_refs, use_subpixel,
+                                      -1, &best_sse, &best_var);
+
+    features[f_idx++] = logf(1.0f + (float)best_var);
+    features[f_idx++] = logf(1.0f + (float)best_sse);
+  }
+
+  // Whole block
+  features[f_idx++] = logf(1.0f + (float)none_var);
+  features[f_idx++] = logf(1.0f + (float)none_sse);
+
+  const MACROBLOCKD *xd = &x->e_mbd;
+  set_offsets(cpi, &xd->tile, x, mi_row, mi_col, bsize);
+
+  // Q_INDEX
+  const int dc_q = av1_dc_quant_QTX(x->qindex, 0, xd->bd) >> (xd->bd - 8);
+  features[f_idx++] = logf(1.0f + (float)(dc_q * dc_q) / 256.0f);
+
+  // Decide whethe we are on the edges
+  features[f_idx++] = mi_row + h_mi / 2 >= cm->mi_rows;
+  features[f_idx++] = mi_col + w_mi / 2 >= cm->mi_cols;
+
+  assert(f_idx == FEATURES);
+}
+
+#define NUM_CLASSES 3
+static void simple_motion_search_prune_rect(AV1_COMP *const cpi, MACROBLOCK *x,
+                                            PC_TREE *pc_tree, int mi_row,
+                                            int mi_col, BLOCK_SIZE bsize,
+                                            int *prune_horz, int *prune_vert) {
+  const NN_CONFIG *nn_config = NULL;
+  float thresh = 0.0f;
+  const float *ml_mean, *ml_std;
+  if (bsize == BLOCK_128X128) {
+    nn_config = &simple_motion_search_prune_rect_nn_config_128;
+    ml_mean = simple_motion_search_prune_rect_mean_128;
+    ml_std = simple_motion_search_prune_rect_std_128;
+    thresh = simple_motion_search_prune_rect_thresh_128;
+  } else if (bsize == BLOCK_64X64) {
+    nn_config = &simple_motion_search_prune_rect_nn_config_64;
+    ml_mean = simple_motion_search_prune_rect_mean_64;
+    ml_std = simple_motion_search_prune_rect_std_64;
+    thresh = simple_motion_search_prune_rect_thresh_64;
+  } else if (bsize == BLOCK_32X32) {
+    nn_config = &simple_motion_search_prune_rect_nn_config_32;
+    ml_mean = simple_motion_search_prune_rect_mean_32;
+    ml_std = simple_motion_search_prune_rect_std_32;
+    thresh = simple_motion_search_prune_rect_thresh_32;
+  } else if (bsize == BLOCK_16X16) {
+    nn_config = &simple_motion_search_prune_rect_nn_config_16;
+    ml_mean = simple_motion_search_prune_rect_mean_16;
+    ml_std = simple_motion_search_prune_rect_std_16;
+    thresh = simple_motion_search_prune_rect_thresh_16;
+  } else if (bsize == BLOCK_8X8) {
+    nn_config = &simple_motion_search_prune_rect_nn_config_8;
+    ml_mean = simple_motion_search_prune_rect_mean_8;
+    ml_std = simple_motion_search_prune_rect_std_8;
+    thresh = simple_motion_search_prune_rect_thresh_8;
+  } else {
+    assert(0 && "Unexpected block size in simple_motion_prune_rect");
+  }
+
+  if (nn_config && thresh > 0.0f) {
+    // Get Features
+    float features[FEATURES] = { 0.0f };
+    simple_motion_search_prune_rect_features(cpi, x, pc_tree, mi_row, mi_col,
+                                             bsize, features);
+    for (int f_idx = 0; f_idx < FEATURES; f_idx++) {
+      features[f_idx] =
+          (features[f_idx] - ml_mean[f_idx]) / (0.0001f + ml_std[f_idx]);
+    }
+
+    // Some features are constant in the training data. In this case, disable
+    // these features.
+    if (bsize == BLOCK_128X128) {
+      features[6] = 0.0f;
+      features[7] = 0.0f;
+    }
+    if (bsize < BLOCK_64X64) {
+      features[FEATURES - 2] = 0.0f;
+      features[FEATURES - 1] = 0.0f;
+    }
+
+    const int HORZ = 0, VERT = 1;
+    float scores[NUM_CLASSES] = { 0.0f }, probs[NUM_CLASSES] = { 0.0f };
+
+    av1_nn_predict(features, nn_config, scores);
+    aom_clear_system_state();
+
+    av1_nn_softmax(scores, probs, NUM_CLASSES);
+
+    if (probs[HORZ] <= thresh) {
+      *prune_horz = 1;
+    }
+    if (probs[VERT] <= thresh) {
+      *prune_vert = 1;
+    }
+  }
+}
+#undef NUM_CLASSES
+#undef FEATURES
+
+// TODO(jinging,jimbankoski,rbultje): properly skip partition types that are
 // unlikely to be selected depending on previous rate-distortion optimization
 // results, for encoding speed-up.
 static void rd_pick_partition(AV1_COMP *const cpi, ThreadData *td,
@@ -3563,6 +3817,8 @@
   int64_t split_rd[4] = { 0, 0, 0, 0 };
   int64_t horz_rd[2] = { 0, 0 };
   int64_t vert_rd[2] = { 0, 0 };
+  int prune_horz = 0;
+  int prune_vert = 0;
 
   int split_ctx_is_ready[2] = { 0, 0 };
   int horz_ctx_is_ready = 0;
@@ -3809,7 +4065,7 @@
 
   // Perform a full_pixel_search and use the residue to estimate whether we
   // should split directly.
-  // TODO(chiyotsai@google.com): Try the algorithm on hbd and speed 0.
+  // TODO(chiyotsai@google.com): Try the algorithm on hdres and speed 0.
   // Also try pruning PARTITION_SPLIT
   if (cpi->sf.full_pixel_motion_search_based_split && bsize >= BLOCK_8X8 &&
       do_square_split && mi_row + mi_size_high[bsize] <= cm->mi_rows &&
@@ -3853,6 +4109,15 @@
     }
   }
 
+  // Prune PARTITION_HORZ and PARTITION_VERT. This must be done prior to
+  // PARTITION_SPLIT to propagate the initial mvs to a smaller blocksize.
+  if (cpi->sf.simple_motion_search_prune_rect && !frame_is_intra_only(cm) &&
+      (partition_horz_allowed || partition_vert_allowed) &&
+      bsize >= BLOCK_8X8) {
+    simple_motion_search_prune_rect(cpi, x, pc_tree, mi_row, mi_col, bsize,
+                                    &prune_horz, &prune_vert);
+  }
+
 BEGIN_PARTITION_SEARCH:
   if (x->must_find_valid_partition) {
     partition_none_allowed = has_rows && has_cols;
@@ -4181,8 +4446,6 @@
     }
   }
 
-  int prune_horz = 0;
-  int prune_vert = 0;
   if (cpi->sf.ml_prune_rect_partition && !frame_is_intra_only(cm) &&
       (partition_horz_allowed || partition_vert_allowed)) {
     av1_setup_src_planes(x, cpi->source, mi_row, mi_col, num_planes, bsize);
@@ -5042,6 +5305,19 @@
   }
 }
 
+static void init_simple_motion_search_mvs(PC_TREE *pc_tree) {
+  for (int idx = 0; idx < REF_FRAMES; idx++) {
+    pc_tree->mv_ref_fulls[idx].row = 0;
+    pc_tree->mv_ref_fulls[idx].col = 0;
+  }
+  if (pc_tree->block_size >= BLOCK_8X8) {
+    init_simple_motion_search_mvs(pc_tree->split[0]);
+    init_simple_motion_search_mvs(pc_tree->split[1]);
+    init_simple_motion_search_mvs(pc_tree->split[2]);
+    init_simple_motion_search_mvs(pc_tree->split[3]);
+  }
+}
+
 static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
                              TileDataEnc *tile_data, int mi_row,
                              TOKENEXTRA **tp) {
@@ -5104,6 +5380,10 @@
     PC_TREE *const pc_root = td->pc_root[mib_size_log2 - MIN_MIB_SIZE_LOG2];
     pc_root->index = 0;
 
+    if (sf->simple_motion_search_prune_rect) {
+      init_simple_motion_search_mvs(pc_root);
+    }
+
     const struct segmentation *const seg = &cm->seg;
     int seg_skip = 0;
     if (seg->enabled) {
@@ -5476,15 +5756,6 @@
   return 1;
 }
 
-static const uint8_t ref_frame_flag_list[REF_FRAMES] = { 0,
-                                                         AOM_LAST_FLAG,
-                                                         AOM_LAST2_FLAG,
-                                                         AOM_LAST3_FLAG,
-                                                         AOM_GOLD_FLAG,
-                                                         AOM_BWD_FLAG,
-                                                         AOM_ALT2_FLAG,
-                                                         AOM_ALT_FLAG };
-
 // Enforce the number of references for each arbitrary frame limited to
 // (INTER_REFS_PER_FRAME - 1)
 static void enforce_max_ref_frames(AV1_COMP *cpi) {
diff --git a/av1/encoder/partition_model_weights.h b/av1/encoder/partition_model_weights.h
index 271764a..ab3d71b 100644
--- a/av1/encoder/partition_model_weights.h
+++ b/av1/encoder/partition_model_weights.h
@@ -2900,6 +2900,856 @@
 #undef NUM_LOGITS_8
 #endif
 
+// simple_motion_search_prune_rect
+// Thresholds
+static float simple_motion_search_prune_rect_thresh_128 = 0.0110f;
+static float simple_motion_search_prune_rect_thresh_64 = 0.0474f;
+static float simple_motion_search_prune_rect_thresh_32 = 0.0293f;
+static float simple_motion_search_prune_rect_thresh_16 = 0.0180f;
+static float simple_motion_search_prune_rect_thresh_8 = 0.0f;
+
+// Fature Mean and STD
+static const float simple_motion_search_prune_rect_mean_128[21] = {
+  11.604144f, 11.682196f,  3.7685435f, 3.7804017f, 7.8815756f,  7.9477367f,
+  0.0f,       0.0f,        13.777283f, 13.947528f, 9.778015f,   9.928518f,
+  13.281822f, 13.399953f,  4.8135943f, 4.8724947f, 15.4357195f, 15.643948f,
+  5.396575f,  0.32303867f, 0.67696136f
+};
+
+static const float simple_motion_search_prune_rect_std_128[21] = {
+  2.37926165f, 2.39487077f, 5.55090993f, 5.56816496f, 5.86562017f, 5.91202901f,
+  0.f,         0.f,         3.023728f,   3.09614066f, 7.2767266f,  7.38752563f,
+  2.86607484f, 2.92342436f, 7.11769239f, 7.21289304f, 3.04497061f, 3.11716899f,
+  2.16907162f, 0.46764017f, 0.46764017f
+};
+
+static const float simple_motion_search_prune_rect_mean_64[21] = {
+  9.546619f,  9.643238f,   8.884359f,   8.972756f,  7.794842f,  7.8717923f,
+  7.1152596f, 7.1850014f,  10.407013f,  10.490796f, 8.493282f,  8.560566f,
+  10.409792f, 10.496752f,  9.690868f,   9.771279f,  11.277545f, 11.354459f,
+  5.4520044f, 0.18779919f, 0.069017194f
+};
+
+static const float simple_motion_search_prune_rect_std_64[21] = {
+  2.23464762f, 2.21863539f, 3.21971256f, 3.23065164f, 4.18375011f, 4.21000297f,
+  4.53527463f, 4.56834182f, 2.21565913f, 2.2037133f,  4.46751945f, 4.49201358f,
+  2.20418352f, 2.19160329f, 3.37069652f, 3.38308883f, 2.16617912f, 2.15762416f,
+  2.1803145f,  0.39055183f, 0.25348345f
+};
+
+static const float simple_motion_search_prune_rect_mean_32[21] = {
+  8.275947f,  8.388577f, 8.292438f, 8.407772f,  8.279809f,  8.392666f,
+  8.28561f,   8.401827f, 9.224074f, 9.3211355f, 9.226464f,  9.323693f,
+  9.212805f,  9.309509f, 9.233987f, 9.332952f,  10.133105f, 10.220646f,
+  4.6501865f, 0.0f,      0.0f
+};
+
+static const float simple_motion_search_prune_rect_std_32[21] = {
+  2.09335807f, 2.08341914f, 2.07920105f, 2.06925832f, 2.10582478f, 2.09748485f,
+  2.08927523f, 2.08082628f, 2.11305703f, 2.10245119f, 2.12675492f, 2.11696847f,
+  2.08239718f, 2.07103501f, 2.06091744f, 2.04943504f, 2.08402831f, 2.07140636f,
+  2.02292239f, 10000000.0f, 1000000.0f
+};
+
+static const float simple_motion_search_prune_rect_mean_16[21] = {
+  6.9436703f, 7.0858636f, 6.830941f, 6.9708f,   6.951976f,  7.09403f,
+  6.834843f,  6.974434f,  7.936405f, 8.054485f, 7.9468045f, 8.064759f,
+  7.933151f,  8.049844f,  7.806229f, 7.921054f, 8.88205f,   8.984465f,
+  3.982615f,  0.0f,       0.0f
+};
+
+static const float simple_motion_search_prune_rect_std_16[21] = {
+  1.98710805f, 1.98327083f, 2.16578f,    2.17021027f, 1.98690513f, 1.98316086f,
+  2.16677687f, 2.17170578f, 2.0234987f,  2.01648209f, 2.02484412f, 2.01804831f,
+  2.0183788f,  2.01223316f, 2.24933317f, 2.25114926f, 2.03808057f, 2.02950528f,
+  1.85362437f, 1000000.0f,  1000000.0f
+};
+
+static const float simple_motion_search_prune_rect_mean_8[21] = {
+  5.30744f,   5.5219445f, 5.307067f,  5.5238867f, 5.309048f, 5.52433f,
+  5.3082213f, 5.5255504f, 6.3853498f, 6.5441704f, 6.389904f, 6.549225f,
+  6.388841f,  6.5474386f, 6.39165f,   6.5517707f, 7.383806f, 7.512947f,
+  3.6749654f, 0.0f,       0.0f
+};
+
+static const float simple_motion_search_prune_rect_std_8[21] = {
+  1.84657375f, 1.83810653f, 1.84723929f, 1.83793395f, 1.83993859f, 1.83183525f,
+  1.84099489f, 1.83202961f, 1.89125934f, 1.87992053f, 1.88265554f, 1.87171106f,
+  1.88345242f, 1.87305873f, 1.88187027f, 1.87079384f, 1.91317406f, 1.90146775f,
+  1.71587616f, 1000000.0f,  1000000.0f
+};
+
+// Model Parameters
+// BLOCK_128X128
+#define NUM_HIDDEN_LAYERS_128 1
+#define NUM_FEATURES_128 21
+#define NUM_LAYER_0_UNITS_128 24
+#define NUM_LOGITS_128 3
+
+static const float simple_motion_search_prune_rect_layer_0_bias_128[] = {
+  -1.03082f,  -1.44423f,  -0.0663546f, -0.273647f, -0.0271498f, -0.84201f,
+  -0.45019f,  -0.581675f, -0.161953f,  0.583636f,  -1.48401f,   -1.61788f,
+  -0.828226f, -0.567531f, -0.888807f,  -0.688982f, -1.42025f,   -0.930348f,
+  -1.24374f,  -0.207484f, -1.30764f,   -0.753248f, -1.02665f,   0.230935f
+};
+
+static const float simple_motion_search_prune_rect_logits_bias_128[] = {
+  0.0329258f, 0.184642f, -0.149705f
+};
+
+static const float simple_motion_search_prune_rect_layer_0_kernel_128[] = {
+  1.21707f,     0.767617f,    0.998833f,   0.748885f,    0.730957f,
+  0.861834f,    -0.338539f,   0.013964f,   -0.0727181f,  0.37719f,
+  0.736542f,    0.970103f,    -1.53509f,   -1.79112f,    0.303347f,
+  -0.0237058f,  -0.468634f,   -0.314464f,  -0.0506157f,  0.205808f,
+  -0.566808f,   0.260802f,    -0.321415f,  1.08033f,     0.664636f,
+  1.14234f,     1.45592f,     0.105783f,   -0.319643f,   -0.969693f,
+  -0.128036f,   0.464112f,    0.214481f,   0.0348054f,   -0.795667f,
+  0.804816f,    0.766327f,    -0.661083f,  -0.320675f,   1.09434f,
+  0.426732f,    -0.515712f,   0.556748f,   1.02103f,     0.0789273f,
+  -0.212123f,   0.968215f,    1.24967f,    -0.170443f,   0.0887567f,
+  -0.236266f,   0.622019f,    -0.0482016f, 1.21882f,     -0.610779f,
+  0.207403f,    -0.298613f,   0.289028f,   -0.727855f,   -0.537925f,
+  -0.129818f,   -0.209714f,   -0.260345f,  0.977842f,    1.51966f,
+  -0.848417f,   -0.344469f,   -0.612265f,  -0.844221f,   -0.181775f,
+  -0.0752922f,  0.132546f,    1.39445f,    0.176311f,    0.0865965f,
+  0.0885483f,   1.18521f,     0.271723f,   -0.00613283f, 0.167888f,
+  -0.262459f,   -1.83077f,    0.0367826f,  -0.187464f,   -0.448555f,
+  0.402736f,    -0.41658f,    -0.772893f,  -0.573372f,   -0.270687f,
+  0.0525691f,   -0.0195788f,  0.906929f,   0.925847f,    -0.670372f,
+  -0.695974f,   -0.0617974f,  -0.127294f,  0.518828f,    0.331416f,
+  -1.08477f,    -0.828586f,   0.786335f,   0.121287f,    -0.287118f,
+  0.12047f,     0.0770493f,   -0.206039f,  -0.686495f,   -2.20468f,
+  -0.0053142f,  0.0421935f,   -0.228364f,  0.262388f,    -0.154042f,
+  0.56318f,     0.25525f,     0.797393f,   1.38502f,     -0.70006f,
+  -0.25912f,    0.115122f,    -0.425162f,  -0.82411f,    -0.465218f,
+  0.576937f,    0.340786f,    -0.494503f,  -1.68303f,    -1.89255f,
+  -0.734966f,   -1.50882f,    0.152946f,   0.0355278f,   0.429251f,
+  0.8991f,      -1.10166f,    -0.722933f,  0.544538f,    -1.01641f,
+  -0.159005f,   -0.0412827f,  0.392484f,   0.0540428f,   0.136978f,
+  0.333809f,    -0.595976f,   -0.639076f,  0.149363f,    -0.545998f,
+  -0.358742f,   -0.734408f,   -1.05771f,   0.304367f,    0.234233f,
+  1.4708f,      1.52837f,     0.498601f,   -0.155039f,   -0.749137f,
+  0.645608f,    -0.313543f,   -0.320999f,  0.356842f,    0.0702166f,
+  -1.02796f,    0.92566f,     -1.18203f,   -0.22097f,    1.37971f,
+  -0.296376f,   -0.0254071f,  0.0205492f,  1.19537f,     -0.286633f,
+  0.296902f,    -0.444691f,   0.976126f,   -0.0065986f,  1.20317f,
+  -1.10465f,    -0.295417f,   0.48273f,    0.48458f,     -0.406933f,
+  1.46102f,     -1.04861f,    1.01175f,    -0.946596f,   1.66844f,
+  -0.246026f,   -0.57829f,    -0.89914f,   0.289559f,    -0.188926f,
+  0.206735f,    -0.272003f,   -0.327669f,  -0.113352f,   -0.713005f,
+  -0.363715f,   1.25897f,     0.450371f,   -1.0458f,     -0.752533f,
+  -0.0799224f,  1.02614f,     -1.08083f,   -0.536049f,   0.504551f,
+  0.213136f,    0.115929f,    0.523182f,   0.714035f,    1.02583f,
+  1.6386f,      0.00803417f,  0.0973748f,  -0.217814f,   0.71939f,
+  -0.140389f,   -0.488582f,   -1.24631f,   0.803631f,    0.138188f,
+  0.0333013f,   -0.519193f,   -0.483745f,  -0.36371f,    0.1839f,
+  0.0352195f,   -0.591134f,   0.139432f,   -2.00368f,    -1.46711f,
+  -0.268942f,   0.150863f,    0.00577831f, -0.257733f,   0.454567f,
+  -0.046806f,   0.105841f,    -0.411153f,  -0.58749f,    0.328028f,
+  0.132938f,    0.454583f,    0.455181f,   -0.383746f,   0.786252f,
+  1.31958f,     -1.28544f,    -1.38559f,   -1.99272f,    1.35343f,
+  0.895747f,    0.27401f,     0.0801937f,  0.0635348f,   0.246139f,
+  1.97013f,     1.48526f,     0.0988332f,  -0.0769758f,  0.0800849f,
+  0.181255f,    -0.265881f,   -0.135451f,  0.0176318f,   -0.221732f,
+  -0.193488f,   0.158928f,    -0.0669842f, 0.202504f,    0.61163f,
+  -0.744555f,   -0.594422f,   -0.398642f,  -0.637939f,   -0.324602f,
+  0.148604f,    1.22074f,     1.31154f,    -1.01658f,    -1.28208f,
+  -0.129768f,   -0.206114f,   0.60629f,    0.366167f,    -0.134153f,
+  -0.0929645f,  -0.470631f,   0.518892f,   -0.733017f,   -0.111685f,
+  -0.204559f,   -0.267483f,   -0.265051f,  1.32226f,     1.13088f,
+  -0.00946599f, -0.272144f,   -0.362412f,  -0.672511f,   -0.652476f,
+  -0.546448f,   0.0253537f,   -0.153191f,  -0.824345f,   -0.714531f,
+  -0.0305819f,  0.230982f,    -1.10796f,   -0.288268f,   -0.0650801f,
+  1.1042f,      -0.245663f,   0.804774f,   0.986003f,    0.861027f,
+  -0.126863f,   -0.257142f,   0.160107f,   -0.725933f,   -1.33207f,
+  -0.0114378f,  0.182624f,    0.829975f,   0.00865911f,  0.206114f,
+  0.000599693f, -0.7338f,     -1.62608f,   0.411364f,    -0.703702f,
+  0.192228f,    0.960493f,    0.889854f,   0.561844f,    0.833141f,
+  0.445264f,    0.438172f,    0.269368f,   -0.174156f,   -1.11718f,
+  -0.690091f,   -0.119548f,   -0.430536f,  0.3507f,      0.804611f,
+  0.298009f,    -0.257488f,   -0.887408f,  -0.500912f,   -0.217641f,
+  -0.338373f,   0.20756f,     0.248316f,   -0.750743f,   0.310385f,
+  0.00491777f,  0.331145f,    -0.356869f,  0.356782f,    0.0577628f,
+  -0.0513289f,  0.325407f,    -0.12384f,   0.723623f,    -1.34327f,
+  -1.12374f,    0.183475f,    0.0640967f,  0.113537f,    -0.315936f,
+  1.61401f,     -0.294137f,   0.306785f,   0.605552f,    0.199964f,
+  0.526132f,    0.947164f,    0.685252f,   0.646895f,    -0.338617f,
+  -0.00734127f, 0.648188f,    -1.00204f,   0.00213791f,  0.679308f,
+  -0.202302f,   -0.46856f,    0.848246f,   0.597811f,    -0.0631533f,
+  -0.324955f,   1.33773f,     -0.0374205f, -0.454397f,   -0.397027f,
+  -0.228798f,   0.0115105f,   -0.392123f,  0.701074f,    0.442658f,
+  -0.174989f,   -0.156202f,   -0.186211f,  -1.02877f,    -0.1514f,
+  -0.886684f,   0.715379f,    0.868128f,   -0.203152f,   -0.359135f,
+  1.16497f,     0.602318f,    0.669703f,   -0.6824f,     1.20655f,
+  -0.170322f,   -0.110273f,   1.14943f,    1.07666f,     0.79441f,
+  0.817437f,    -0.103962f,   -0.235231f,  -0.228969f,   -1.00497f,
+  -0.219239f,   -0.318307f,   0.303288f,   1.58335f,     -0.424882f,
+  -0.537245f,   1.51033f,     0.323441f,   -0.159631f,   -0.074288f,
+  0.354562f,    1.4227f,      0.604905f,   -0.834905f,   -0.84153f,
+  -0.488386f,   -0.75274f,    0.167785f,   -0.237989f,   -0.55223f,
+  0.895587f,    -0.401557f,   -0.235388f,  0.673556f,    -1.4807f,
+  -1.18495f,    -1.03931f,    -0.719854f,  0.556845f,    -0.053345f,
+  0.72716f,     -1.11511f,    0.490595f,   0.283416f,    1.35235f,
+  0.549703f,    1.08873f,     0.360714f,   0.237269f,    -0.320985f,
+  0.251012f,    -0.88053f,    0.609055f,   0.0685435f,   -0.0673053f,
+  -0.145312f,   0.203616f,    0.0716763f,  0.781634f,    -0.624368f,
+  -2.14444f,    -0.00187426f, 0.179946f,   1.42648f,     1.27037f,
+  0.465913f,    0.820793f,    -1.60283f,   -0.699741f,   -0.314398f,
+  -0.309158f,   0.277909f,    -0.0981238f, 0.558628f,    0.862353f,
+  -1.26681f,    -1.18465f,    0.348659f,   0.272992f,    -0.36775f,
+  -0.342381f,   0.155123f,    -0.34212f,   0.436529f
+};
+
+static const float simple_motion_search_prune_rect_logits_kernel_128[] = {
+  -1.66602f,   0.424545f,   -45.8807f,  -0.0704016f, 0.149002f,   -1.41176f,
+  -0.984448f,  -0.903546f,  1.55762f,   -2.60542f,   -12.5839f,   1.55755f,
+  -1.99348f,   -0.0172324f, -10.8159f,  0.536906f,   0.0313958f,  -0.513672f,
+  0.0266578f,  -0.768594f,  0.826601f,  -3.59099f,   -1.54627f,   0.287491f,
+  0.870765f,   -0.304472f,  0.785962f,  -0.437929f,  -0.170165f,  1.02601f,
+  0.968915f,   -0.446069f,  0.635064f,  -0.0501538f, -1.07004f,   -1.43273f,
+  0.210884f,   -14.4229f,   0.159498f,  -0.0865989f, -1.28704f,   0.337704f,
+  1.80598f,    -0.157148f,  0.811136f,  1.36998f,    -0.437967f,  -1.94766f,
+  -0.506979f,  0.245296f,   0.164039f,  0.855018f,   0.410343f,   -0.795219f,
+  -0.0400102f, 0.353871f,   -0.622041f, 0.951203f,   0.806822f,   0.071401f,
+  0.490487f,   0.125621f,   0.634072f,  -0.464813f,  -0.0219197f, -0.254174f,
+  0.0230487f,  0.130726f,   -0.487066f, -0.536771f,  0.923402f,   -0.0148827f
+};
+
+static const NN_CONFIG simple_motion_search_prune_rect_nn_config_128 = {
+  NUM_FEATURES_128,
+  NUM_LOGITS_128,
+  NUM_HIDDEN_LAYERS_128,
+  {
+      NUM_LAYER_0_UNITS_128,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_kernel_128,
+      simple_motion_search_prune_rect_logits_kernel_128,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_bias_128,
+      simple_motion_search_prune_rect_logits_bias_128,
+  },
+};
+
+#undef NUM_HIDDEN_LAYERS_128
+#undef NUM_FEATURES_128
+#undef NUM_LAYER_0_UNITS_128
+#undef NUM_LOGITS_128
+
+// BLOCK_64X64
+#define NUM_HIDDEN_LAYERS_64 1
+#define NUM_FEATURES_64 21
+#define NUM_LAYER_0_UNITS_64 20
+#define NUM_LOGITS_64 3
+
+static const float simple_motion_search_prune_rect_layer_0_bias_64[] = {
+  -0.474538f,  0.182615f,  -0.116926f, -0.31614f,  0.458541f,
+  -0.462508f,  0.0110579f, -0.937514f, -0.776792f, -0.749243f,
+  -0.40515f,   0.453758f,  -0.181677f, -0.271274f, -0.634132f,
+  -0.0814499f, -0.363025f, -0.747829f, -0.598476f, 0.553188f
+};
+
+static const float simple_motion_search_prune_rect_logits_bias_64[] = {
+  0.126455f, -0.308021f, 0.133681f
+};
+
+static const float simple_motion_search_prune_rect_layer_0_kernel_64[] = {
+  -0.0955396f,   0.0114924f,   -0.0810431f,  -0.33444f,     -0.0463965f,
+  0.222538f,     0.41684f,     -0.00203436f, 0.173122f,     -0.146179f,
+  1.02976f,      0.64903f,     -0.27027f,    0.0609664f,    -0.869307f,
+  -0.536022f,    0.14875f,     -0.105693f,   0.272891f,     -0.847822f,
+  0.722511f,     0.175457f,    0.206427f,    -0.124699f,    0.0164477f,
+  0.331568f,     0.298744f,    -0.249587f,   -0.0546789f,   -0.165438f,
+  -0.201993f,    -0.47814f,    -0.284996f,   0.100211f,     0.439414f,
+  0.00431976f,   -0.607345f,   0.395876f,    0.432077f,     -0.201182f,
+  -1.1626f,      -0.915202f,   0.606548f,    -0.00805195f,  0.214499f,
+  0.573404f,     0.0129565f,   -0.139539f,   -0.195218f,    -0.0423162f,
+  0.529606f,     0.18719f,     0.775243f,    0.236413f,     -1.00591f,
+  0.00202726f,   -1.07701f,    -0.0113505f,  -0.248246f,    -0.218112f,
+  0.126451f,     -0.595388f,   -0.25106f,    0.468711f,     -0.322513f,
+  0.196981f,     -0.176692f,   -0.178078f,   -0.33736f,     0.00877613f,
+  -0.299936f,    0.29493f,     -0.483572f,   0.244207f,     -0.193008f,
+  0.582392f,     -0.156948f,   0.134005f,    0.227288f,     0.879863f,
+  0.196686f,     -0.300996f,   -0.95266f,    -0.0235455f,   -0.385976f,
+  -0.000688855f, -0.328365f,   -0.39592f,    0.177301f,     0.134001f,
+  -0.240523f,    0.137593f,    -0.707273f,   -0.407333f,    -0.544081f,
+  -0.184395f,    0.37896f,     0.313908f,    0.188172f,     -0.088467f,
+  0.123425f,     0.285585f,    0.664772f,    -0.107437f,    -0.530605f,
+  0.426075f,     -0.0956688f,  0.475769f,    -0.226957f,    0.497479f,
+  -0.0973361f,   0.646813f,    -0.248913f,   0.117196f,     0.188191f,
+  0.27117f,      -0.292378f,   0.0290377f,   -0.366001f,    -0.203164f,
+  -0.305397f,    -0.526796f,   -0.923496f,   0.834984f,     0.144627f,
+  0.0103899f,    0.534548f,    -0.141897f,   0.509968f,     0.450873f,
+  0.0828022f,    0.0413851f,   0.549486f,    -0.0542229f,   -0.64852f,
+  -0.781963f,    -0.423665f,   -0.216567f,   0.531318f,     0.167107f,
+  1.06594f,      0.183964f,    -0.405879f,   -0.599571f,    0.0253738f,
+  -0.0213327f,   -0.270245f,   0.636231f,    0.116171f,     0.466784f,
+  0.137297f,     0.280382f,    0.0981868f,   -0.238947f,    0.210817f,
+  0.673252f,     -0.0756914f,  0.302537f,    0.0108696f,    -0.0499553f,
+  -0.730525f,    -0.103359f,   -0.301728f,   -0.508398f,    -1.09406f,
+  0.600343f,     0.459265f,    0.514783f,    -0.124542f,    -0.282827f,
+  -0.405428f,    -0.150063f,   0.0314231f,   -0.500199f,    0.0359638f,
+  -0.160956f,    0.652848f,    0.414537f,    -0.550212f,    -0.526028f,
+  -0.0172567f,   0.0431145f,   -0.211108f,   -0.505671f,    0.118762f,
+  -0.0996169f,   1.37903f,     -0.372669f,   -0.214101f,    0.550215f,
+  -0.310568f,    0.0083277f,   -0.0692804f,  0.407818f,     0.313041f,
+  0.0600635f,    -0.545026f,   0.169041f,    -0.413315f,    -0.22927f,
+  -0.493042f,    0.462788f,    -0.141082f,   -0.207174f,    -0.145312f,
+  0.598829f,     -0.417438f,   -0.507561f,   1.54015f,      -0.177759f,
+  0.603537f,     -0.362839f,   0.752922f,    -0.42223f,     0.452005f,
+  -0.164136f,    0.663698f,    -0.293401f,   0.105774f,     -0.436602f,
+  0.0114064f,    -0.521943f,   0.402816f,    -0.325515f,    0.71272f,
+  -0.410154f,    0.166539f,    -0.861678f,   0.241501f,     0.00812334f,
+  -0.271946f,    0.29494f,     -0.336918f,   0.198301f,     -0.421108f,
+  0.276482f,     -0.471011f,   -0.0353971f,  -0.255519f,    0.747247f,
+  -0.208496f,    0.20575f,     -0.093769f,   0.371016f,     -0.462553f,
+  0.439527f,     -0.501947f,   0.678913f,    0.0592761f,    -0.707379f,
+  -0.487351f,    0.568444f,    -0.0136548f,  0.310498f,     -0.0174319f,
+  0.538175f,     -0.194489f,   0.115937f,    -0.278316f,    0.207121f,
+  -0.228797f,    0.921146f,    0.0199402f,   0.189315f,     -0.489682f,
+  -0.127664f,    -0.0551134f,  -0.242746f,   -0.675769f,    0.093105f,
+  -0.0351411f,   0.350513f,    0.133148f,    -0.0808761f,   -0.313078f,
+  0.189685f,     -0.272904f,   -0.49433f,    -0.308289f,    0.477897f,
+  -0.282002f,    -0.176614f,   -0.28103f,    -0.184417f,    -0.396787f,
+  -0.233235f,    -0.00850453f, -0.23164f,    0.042675f,     0.293457f,
+  0.0409628f,    0.00362038f,  -0.00953663f, 0.52735f,      0.315472f,
+  0.128795f,     -0.170787f,   -0.222383f,   0.200515f,     -0.257473f,
+  -0.695571f,    -0.332731f,   -0.189031f,   0.043103f,     -0.0762694f,
+  -0.11686f,     0.194413f,    0.596174f,    -0.0803632f,   -0.518048f,
+  -0.61079f,     -0.206706f,   0.855604f,    0.579438f,     -0.296687f,
+  0.343656f,     -0.112966f,   -0.183152f,   0.051364f,     0.583126f,
+  0.163844f,     0.000238682f, -0.37819f,    -0.116122f,    -0.0576168f,
+  -0.395958f,    -0.171348f,   0.73339f,     0.60445f,      -0.28147f,
+  -0.198162f,    -0.797905f,   -0.335843f,   0.460551f,     -0.87145f,
+  -0.666152f,    -0.411679f,   -0.0148538f,  -0.233716f,    0.1255f,
+  0.203786f,     0.407784f,    0.202491f,    0.0351974f,    -0.45079f,
+  -0.557643f,    0.711177f,    0.282461f,    -0.000344185f, 0.199394f,
+  0.354731f,     0.218657f,    -0.1121f,     0.154379f,     0.46884f,
+  -0.873247f,    -0.41062f,    0.162392f,    0.300664f,     0.338705f,
+  0.00701477f,   0.20115f,     0.0422753f,   0.0658235f,    0.193637f,
+  -0.286329f,    -0.284851f,   0.00751998f,  -0.0736767f,   0.281419f,
+  0.34741f,      0.182409f,    -0.209542f,   -0.357005f,    -0.183123f,
+  -0.983305f,    0.381148f,    1.01159f,     -0.421924f,    -0.0129082f,
+  -0.235917f,    0.404203f,    -0.32379f,    -0.416939f,    -0.000212733f,
+  -0.349122f,    -0.0866705f,  0.229621f,    0.311834f,     0.313783f,
+  -0.439797f,    -0.267139f,   0.609396f,    0.589986f,     0.169516f,
+  -0.342366f,    0.66604f,     0.724562f,    -0.225231f,    -0.180633f,
+  -0.469166f,    -0.353687f,   -0.474233f,   -0.360121f,    -0.465193f,
+  -0.20589f,     -0.47386f,    0.462577f,    0.105843f,     0.226433f,
+  0.30877f,      -0.0671077f,  -0.171733f,   -0.179051f,    -0.326866f,
+  0.217511f,     0.250185f,    1.10298f,     -0.0389183f,   -0.138711f
+};
+
+static const float simple_motion_search_prune_rect_logits_kernel_64[] = {
+  -0.936738f, 0.663296f,  -0.890015f, -0.179846f,  0.419942f,  -0.492271f,
+  0.798717f,  1.59471f,   -0.991652f, -0.0991069f, -1.67343f,  -0.763593f,
+  0.364504f,  -0.489659f, 0.71856f,   -0.139119f,  -0.411379f, -0.79228f,
+  0.389401f,  0.704645f,  0.608738f,  0.0178282f,  0.885372f,  -0.376533f,
+  -0.424384f, -0.229964f, -0.974063f, -0.150809f,  -0.189564f, -2.72888f,
+  -1.70892f,  -0.430297f, -0.258505f, -0.0379024f, -0.226415f, -0.430415f,
+  0.411709f,  0.083831f,  -0.925193f, 0.535882f,   0.209211f,  -0.244211f,
+  0.264178f,  0.167529f,  0.0457353f, 1.27182f,    -0.350646f, -1.64938f,
+  0.319059f,  0.428646f,  2.78301f,   0.647146f,   0.238655f,  -0.268889f,
+  -0.136987f, 0.300992f,  0.461351f,  0.477707f,   0.147197f,  -0.183917f
+};
+
+static const NN_CONFIG simple_motion_search_prune_rect_nn_config_64 = {
+  NUM_FEATURES_64,
+  NUM_LOGITS_64,
+  NUM_HIDDEN_LAYERS_64,
+  {
+      NUM_LAYER_0_UNITS_64,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_kernel_64,
+      simple_motion_search_prune_rect_logits_kernel_64,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_bias_64,
+      simple_motion_search_prune_rect_logits_bias_64,
+  },
+};
+
+#undef NUM_HIDDEN_LAYERS_64
+#undef NUM_FEATURES_64
+#undef NUM_LAYER_0_UNITS_64
+#undef NUM_LOGITS_64
+
+#define NUM_HIDDEN_LAYERS_32 1
+#define NUM_FEATURES_32 21
+#define NUM_LAYER_0_UNITS_32 24
+#define NUM_LOGITS_32 3
+
+static const float simple_motion_search_prune_rect_layer_0_bias_32[] = {
+  -0.150877f,  0.377067f,  -0.322903f, -0.253833f, -1.34836f,  -0.0407889f,
+  0.340694f,   -0.493511f, -0.106756f, 0.306534f,  -0.244238f, 0.274641f,
+  -0.251146f,  -0.340148f, -0.449601f, -0.99361f,  0.242116f,  -1.03158f,
+  -0.0317092f, -0.505396f, -0.286031f, 0.815326f,  0.105512f,  -0.733433f
+};
+
+static const float simple_motion_search_prune_rect_logits_bias_32[] = {
+  -0.0847271f, -0.140019f, 0.123488f
+};
+
+static const float simple_motion_search_prune_rect_layer_0_kernel_32[] = {
+  0.30266f,    -0.404167f,   0.184244f,    -0.204914f,   0.186292f,
+  -0.185721f,  0.2343f,      -0.309748f,   0.629703f,    -0.161018f,
+  0.586971f,   -0.122501f,   0.258395f,    -0.345766f,   0.425087f,
+  -0.288511f,  0.58389f,     -0.122772f,   -1.0191f,     -0.331509f,
+  -0.155374f,  -0.131892f,   -0.257301f,   -0.0936263f,  -0.173647f,
+  -0.25349f,   -0.297998f,   -0.165697f,   -0.259397f,   -0.308744f,
+  0.13609f,    -0.659645f,   -0.658289f,   0.691323f,    0.302487f,
+  0.503949f,   0.320062f,    0.798778f,    0.459502f,    0.0319676f,
+  -0.231042f,  0.216936f,    0.656985f,    -0.278082f,   0.522593f,
+  -0.120114f,  0.565497f,    -0.158329f,   0.599947f,    -0.222883f,
+  0.385044f,   -0.58876f,    0.363486f,    -0.672838f,   0.233821f,
+  -0.357066f,  0.290888f,    -0.420639f,   -0.376543f,   -0.748431f,
+  0.341052f,   0.305233f,    -0.273799f,   0.0572371f,   0.187165f,
+  0.31469f,    -0.0141874f,  0.172004f,    -0.0819225f,  0.252624f,
+  0.190534f,   -0.0790111f,  -0.309345f,   -0.256681f,   -0.145961f,
+  -0.0955447f, -0.324261f,   -0.227545f,   -0.291766f,   -0.176335f,
+  0.104228f,   1.31795f,     -0.122225f,   -0.00231043f, 0.00262551f,
+  0.0643949f,  0.302213f,    0.00923296f,  0.112109f,    0.0823432f,
+  -0.0480501f, 0.050152f,    -0.133536f,   -0.0943857f,  -0.0255181f,
+  -0.104284f,  0.072475f,    -0.116041f,   -0.103424f,   0.0894712f,
+  -0.0565939f, -0.0803143f,  -1.05708f,    0.0692672f,   0.27409f,
+  0.646258f,   0.0493468f,   0.316645f,    -0.520888f,   0.245417f,
+  -0.476851f,  0.571094f,    0.25759f,     0.111997f,    -0.382122f,
+  0.602901f,   -0.387416f,   0.17528f,     -0.536206f,   0.370157f,
+  -0.0598445f, 0.0351273f,   -0.888124f,   -0.0380012f,  0.0037939f,
+  -0.278387f,  -0.349207f,   -0.286866f,   -0.141381f,   0.0113867f,
+  -0.363429f,  -0.23672f,    -0.127249f,   -0.0618156f,  0.865495f,
+  0.285948f,   0.808533f,    0.165837f,    -0.589867f,   -0.396041f,
+  -0.30314f,   -0.186404f,   0.370238f,    0.520893f,    0.095395f,
+  0.0105089f,  0.214409f,    0.0380188f,   0.111472f,    0.06696f,
+  0.0996208f,  0.238311f,    0.00447955f,  0.0334197f,   0.24364f,
+  -0.159119f,  -0.105443f,   -0.4223f,     0.120655f,    -0.0656574f,
+  -0.0979482f, -0.112141f,   0.0832164f,   -0.982145f,   -0.577622f,
+  1.31481f,    -0.0729726f,  0.260851f,    -0.304419f,   0.05496f,
+  -0.101393f,  -0.136905f,   -0.113133f,   0.10068f,     -0.243494f,
+  -0.0521267f, -0.396234f,   0.248386f,    -0.498069f,   0.0660911f,
+  0.391867f,   0.30568f,     -0.141968f,   0.229426f,    -0.098988f,
+  0.0390286f,  1.05619f,     -0.358586f,   -0.220905f,   0.0801896f,
+  -0.235616f,  -0.191875f,   -0.195233f,   0.0236047f,   -0.12518f,
+  -0.11065f,   -0.201486f,   -0.618409f,   -0.613389f,   -0.321614f,
+  -0.324938f,  0.749192f,    0.537903f,    0.761206f,    0.503924f,
+  0.195202f,   -0.00838913f, 0.128977f,    0.18535f,     -0.19846f,
+  -0.222905f,  -0.0526954f,  -0.179f,      -0.315802f,   -0.028573f,
+  -0.704001f,  -0.255896f,   -0.292945f,   0.243154f,    -0.0101149f,
+  0.227509f,   -0.323767f,   0.827498f,    0.177415f,    0.217882f,
+  -0.320858f,  0.926904f,    0.14992f,     0.137888f,    -0.295178f,
+  -0.172849f,  0.111864f,    -0.0638878f,  -0.331824f,   -0.234096f,
+  0.0562124f,  -0.115936f,   0.165391f,    -0.357548f,   0.642385f,
+  0.205559f,   0.606645f,    0.402024f,    0.0671416f,   -0.341089f,
+  -0.550208f,  -0.627616f,   0.386765f,    -0.0826835f,  0.194135f,
+  -0.323129f,  -0.216731f,   -0.0473442f,  -0.230099f,   -0.223107f,
+  -0.157901f,  -0.196825f,   -0.137026f,   -0.0885836f,  -0.156467f,
+  -0.574477f,  -0.531131f,   -0.488885f,   -0.585363f,   0.909019f,
+  0.734626f,   0.662438f,    0.780993f,    0.358014f,    -0.0470738f,
+  -0.0196115f, -0.159158f,   -0.142333f,   0.272001f,    0.183535f,
+  0.258324f,   0.00783186f,  0.0370277f,   0.299222f,    0.148317f,
+  0.0255202f,  -0.289325f,   0.074542f,    -0.297216f,   -0.134052f,
+  -0.0724699f, 0.00723407f,  -0.393625f,   0.11831f,     -0.925339f,
+  -0.438459f,  1.00802f,     0.247505f,    0.195977f,    0.366527f,
+  0.129965f,   0.429437f,    0.202284f,    0.440758f,    0.200634f,
+  0.639987f,   0.207631f,    0.245741f,    -0.304722f,   0.0543015f,
+  -0.25859f,   0.0874036f,   -0.336049f,   0.263197f,    -0.204705f,
+  -0.552149f,  -1.05707f,    -0.38142f,    0.123726f,    -0.31445f,
+  0.33148f,    0.16558f,     0.470366f,    0.15454f,     0.356113f,
+  0.294223f,   0.132882f,    0.236889f,    -0.307471f,   -0.187956f,
+  -0.232843f,  -0.127055f,   -0.327118f,   -0.253123f,   -0.288136f,
+  0.293925f,   -0.757913f,   -0.695626f,   0.0674771f,   -0.0791973f,
+  -0.0663982f, 0.138042f,    0.0944698f,   -0.225499f,   -0.248548f,
+  0.25318f,    0.0517455f,   -0.486571f,   -0.504592f,   0.628462f,
+  0.492846f,   0.471343f,    0.231574f,    -0.592017f,   0.226039f,
+  -0.536864f,  -0.404826f,   0.382626f,    -0.11126f,    0.16268f,
+  -0.195043f,  -0.331804f,   -0.141593f,   -0.177255f,   0.0455108f,
+  0.14209f,    -0.144151f,   -0.159788f,   0.361794f,    0.13538f,
+  0.180654f,   0.154808f,    0.124516f,    0.142742f,    -0.480668f,
+  -0.773066f,  0.535723f,    -0.336229f,   0.201306f,    -0.343304f,
+  0.432312f,   0.121089f,    -0.211339f,   0.333237f,    -0.587896f,
+  0.504565f,   -0.101135f,   0.717786f,    -0.021451f,   0.219768f,
+  -0.0491637f, 0.351394f,    -0.771172f,   0.212839f,    -0.114615f,
+  0.648602f,   -0.506628f,   0.0682527f,   -0.186903f,   -0.17884f,
+  -0.539165f,  -0.0501128f,  0.363953f,    -0.0582328f,  -0.108791f,
+  0.028609f,   -0.432395f,   0.00869045f,  0.0718638f,   -0.0457797f,
+  0.0460659f,  -0.295409f,   0.679474f,    0.666139f,    0.586366f,
+  0.725428f,   -0.205199f,   -0.540827f,   -0.47579f,    -0.828132f,
+  0.174364f,   -0.300155f,   0.134658f,    -0.202005f,   -0.21941f,
+  -0.301165f,  -0.217839f,   -0.00468189f, 0.0196276f,   -0.273809f,
+  -0.0579939f, -0.291044f,   0.16528f,     0.117749f,    0.374272f,
+  0.21857f,    0.149568f,    -0.862803f,   -0.457729f,   0.260053f,
+  0.542802f,   0.20875f,     0.566169f,    0.0138947f,   -0.00926447f,
+  0.21053f,    -0.336753f,   -0.112768f,   -0.0418503f,  -0.120371f,
+  -0.0160341f, -0.144839f,   -0.189578f,   -0.188411f,   -0.0410867f,
+  0.185114f,   0.0929855f,   -0.0893646f,  -0.0443794f,  0.114525f,
+  -0.111265f,  -0.0555613f,  0.230279f,    0.368952f,    0.988605f,
+  -0.0727516f, -0.137696f,   0.643078f,    -0.283231f,   0.37273f,
+  0.393343f,   0.137257f,    -0.028331f,   0.0440161f,   0.032468f,
+  0.71373f,    0.124146f,    -0.388189f,   -0.669179f,   0.0837899f,
+  -0.381673f,  0.345236f,    -0.358017f,   -0.0583598f,  -0.736627f,
+  -0.0769623f, 0.156985f,    -0.288763f,   0.767518f,    0.166668f,
+  0.503661f,   0.179627f,    0.353413f,    -0.529735f,   0.231143f,
+  0.0659671f,  0.20884f,     -0.219304f,   -0.405746f,   -0.924161f,
+  0.0215154f,  -0.224603f,   0.0552142f,   0.0182611f,   -0.307353f,
+  -0.494348f,  0.394429f,    0.248368f,    0.054821f
+};
+
+static const float simple_motion_search_prune_rect_logits_kernel_32[] = {
+  -0.0331377f, 0.7848f,    -1.19164f,  0.157774f,    -0.784731f,  -0.424402f,
+  -0.821959f,  -1.22346f,  0.312851f,  1.0622f,      -0.154046f,  -0.364553f,
+  -1.21152f,   -0.296875f, 0.214748f,  0.945568f,    -0.378736f,  0.582235f,
+  0.0378807f,  0.933609f,  -0.181642f, -0.299656f,   -0.178872f,  -0.172049f,
+  -0.332916f,  -0.266806f, -1.67998f,  0.278216f,    -0.579313f,  -0.359449f,
+  0.465232f,   -0.857095f, 0.026849f,  -0.464277f,   -0.447601f,  0.417111f,
+  0.831748f,   -0.390425f, 0.416616f,  0.723334f,    0.306278f,   -0.890092f,
+  0.114596f,   -1.11322f,  -0.100165f, -0.246978f,   0.00824933f, 0.713278f,
+  0.809144f,   -0.142374f, 2.21987f,   -0.688482f,   1.1447f,     0.31233f,
+  -0.633595f,  0.541453f,  -0.365008f, 0.000583967f, 0.300029f,   0.0648236f,
+  0.191301f,   0.619809f,  -1.14674f,  -1.19871f,    -0.0516684f, -0.26913f,
+  0.7267f,     -0.213969f, 0.328374f,  0.373149f,    0.443977f,   0.0908275f
+};
+
+static const NN_CONFIG simple_motion_search_prune_rect_nn_config_32 = {
+  NUM_FEATURES_32,
+  NUM_LOGITS_32,
+  NUM_HIDDEN_LAYERS_32,
+  {
+      NUM_LAYER_0_UNITS_32,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_kernel_32,
+      simple_motion_search_prune_rect_logits_kernel_32,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_bias_32,
+      simple_motion_search_prune_rect_logits_bias_32,
+  },
+};
+
+#undef NUM_HIDDEN_LAYERS_32
+#undef NUM_FEATURES_32
+#undef NUM_LAYER_0_UNITS_32
+#undef NUM_LOGITS_32
+
+// BLOCK_16X16
+#define NUM_HIDDEN_LAYERS_16 1
+#define NUM_FEATURES_16 21
+#define NUM_LAYER_0_UNITS_16 24
+#define NUM_LOGITS_16 3
+
+static const float simple_motion_search_prune_rect_layer_0_bias_16[] = {
+  0.604848f,  0.905399f,  -0.519689f, 0.401153f,   0.281126f,  -1.27562f,
+  -0.337675f, -0.104628f, -0.156367f, -0.0754566f, 1.31977f,   0.564316f,
+  -0.716749f, 0.590499f,  0.480629f,  -0.581097f,  0.0266441f, -0.836869f,
+  -0.93972f,  -1.18115f,  -1.43279f,  -0.0912462f, 0.197468f,  0.0233385f
+};
+
+static const float simple_motion_search_prune_rect_logits_bias_16[] = {
+  0.382982f, 0.0828581f, -0.531509f
+};
+
+static const float simple_motion_search_prune_rect_layer_0_kernel_16[] = {
+  -0.0137765f, 0.104086f,   -0.44562f,    0.109335f,    -0.0995125f,
+  0.33779f,    -0.247983f,  -0.0269306f,  -0.12548f,    0.244954f,
+  -0.141774f,  0.245495f,   0.164542f,    -0.322561f,   0.278364f,
+  -0.388579f,  -0.109738f,  -0.00625609f, -0.619319f,   -0.131171f,
+  -0.730775f,  0.281942f,   0.100904f,    -0.00913587f, -0.283333f,
+  0.111223f,   0.19052f,    -0.121298f,   0.0927429f,   0.0169582f,
+  -0.113234f,  -0.125363f,  -0.113387f,   0.380221f,    0.249298f,
+  0.224214f,   -0.198153f,  0.294508f,    -0.0908771f,  -0.00896f,
+  -0.281519f,  -1.10096f,   0.21474f,     0.230463f,    0.24372f,
+  0.226703f,   0.169519f,   0.1931f,      0.276608f,    0.158364f,
+  0.436632f,   0.494405f,   0.494894f,    0.441254f,    -0.51685f,
+  -0.449008f,  -0.681206f,  -0.364304f,   -0.697746f,   -0.988111f,
+  0.0425659f,  -0.238608f,  -0.262493f,   -0.258514f,   0.214822f,
+  0.202649f,   0.231151f,   -0.112502f,   0.376416f,    0.0225609f,
+  0.133387f,   -0.11108f,   0.114849f,    -0.786054f,   -0.160745f,
+  -0.274457f,  0.298882f,   -0.0566582f,  0.0962105f,   -0.406176f,
+  -0.294602f,  -0.486952f,  0.268228f,    0.221875f,    0.341673f,
+  -0.102889f,  0.334006f,   -0.138139f,   -0.0657011f,  0.0410996f,
+  0.0249068f,  -0.472228f,  -0.563824f,   -0.28245f,    -0.271622f,
+  -0.642636f,  0.660948f,   0.166975f,    0.66627f,     0.580663f,
+  0.0380072f,  -0.222593f,  0.218306f,    0.234312f,    -0.449846f,
+  0.481742f,   0.0140617f,  0.459234f,    0.105462f,    0.43153f,
+  0.0604343f,  0.571201f,   0.100403f,    -0.198422f,   -0.172223f,
+  -0.196068f,  -0.14779f,   0.198848f,    -0.337978f,   -0.126215f,
+  -0.152699f,  -0.557159f,  -0.924557f,   -0.148909f,   0.342301f,
+  -0.0270579f, 0.0795163f,  0.246079f,    0.258882f,    0.22873f,
+  0.164371f,   0.214495f,   0.703272f,    0.190126f,    -0.45768f,
+  -0.0380901f, -0.696992f,  -0.208314f,   0.153809f,    -0.0104163f,
+  -0.213472f,  -0.0116897f, -0.765393f,   -0.726445f,   0.889219f,
+  0.181781f,   -0.317054f,  0.195929f,    -0.28841f,    0.0281734f,
+  -0.21678f,   -0.0403133f, -0.28103f,    0.23518f,     -0.078372f,
+  0.324097f,   0.197703f,   -0.0438831f,  0.293011f,    0.147023f,
+  -0.15583f,   0.602368f,   0.323747f,    -0.0696472f,  -0.138903f,
+  -0.235809f,  -0.214106f,  0.381436f,    -0.197114f,   -0.0760917f,
+  -0.693474f,  -0.125265f,  0.507725f,    0.1515f,      0.570555f,
+  0.39068f,    -0.177914f,  -0.427112f,   0.559952f,    0.426243f,
+  -0.115127f,  -0.238974f,  0.237318f,    -0.401725f,   -0.24896f,
+  0.054505f,   -0.15472f,   -0.240788f,   0.00553721f,  -0.0487255f,
+  -0.110616f,  -0.158394f,  -0.00527821f, -0.0843736f,  0.0498573f,
+  -0.223363f,  -0.0990239f, -0.328193f,   0.0838312f,   -0.34158f,
+  -0.053957f,  0.0707963f,  0.225876f,    -0.0677109f,  0.397276f,
+  -0.715533f,  -0.388504f,  1.37571f,     -0.130365f,   -0.906101f,
+  0.0155999f,  -0.0182067f, -0.0328974f,  -0.107512f,   -0.0808009f,
+  -0.0809275f, -0.177219f,  0.0284174f,   -0.10669f,    0.148234f,
+  0.0663233f,  0.0972058f,  0.0344283f,   -0.087383f,   0.0990781f,
+  -0.152435f,  -0.126361f,  0.220532f,    1.32584f,     -0.286357f,
+  -1.62617f,   0.0802221f,  -0.201848f,   -0.193333f,   -0.228532f,
+  -0.025903f,  -0.10709f,   -0.200741f,   -0.332323f,   0.644584f,
+  0.386651f,   0.621749f,   0.302185f,    -0.243676f,   -0.461595f,
+  -0.433389f,  -0.593147f,  0.418157f,    0.299837f,    0.50064f,
+  -0.124775f,  0.31177f,    0.061886f,    -0.0240068f,  -0.101382f,
+  -0.0639972f, -0.190383f,  -0.0549615f,  -0.0423341f,  0.0745784f,
+  0.149147f,   -0.271457f,  0.305835f,    -0.02771f,    0.416986f,
+  -0.0147757f, 0.262974f,   0.0109217f,   0.475815f,    0.13407f,
+  -1.67536f,   0.174608f,   0.112184f,    -0.0290066f,  -0.287501f,
+  0.352614f,   0.420432f,   -0.255287f,   -0.228031f,   0.437014f,
+  0.403499f,   -0.250898f,  -0.119217f,   -0.442683f,   0.365867f,
+  -0.209472f,  -0.426959f,  0.309496f,    0.105961f,    0.342443f,
+  0.543127f,   -0.693675f,  -0.250245f,   -0.74935f,    0.339296f,
+  0.0147475f,  0.0775698f,  0.235613f,    0.164551f,    0.351877f,
+  0.120343f,   -0.0549392f, 0.662616f,    0.118493f,    0.625549f,
+  0.296793f,   -0.693809f,  -0.318807f,   -0.658186f,   0.118517f,
+  -0.625897f,  -0.334193f,  -0.495502f,   -0.0580679f,  -0.502108f,
+  0.610184f,   -0.212568f,  0.65402f,     -0.205777f,   0.611087f,
+  -0.190758f,  0.469293f,   -0.0106184f,  0.162331f,    -0.23283f,
+  0.26207f,    -0.339728f,  0.225619f,    -0.356367f,   0.232606f,
+  -0.459364f,  -0.486175f,  -1.20263f,    0.530313f,    -0.189706f,
+  -0.459413f,  -0.442404f,  -0.468157f,   0.359397f,    0.508712f,
+  -0.465745f,  -0.509933f,  0.579796f,    0.290483f,    0.210952f,
+  0.0430353f,  0.126729f,   0.203994f,    -0.845814f,   -0.391114f,
+  0.469904f,   0.204385f,   0.222419f,    0.0260472f,   0.165553f,
+  -0.298396f,  -0.154579f,  0.184736f,    -0.448324f,   0.288347f,
+  -0.225289f,  0.18267f,    -0.157379f,   0.177178f,    -0.425429f,
+  0.567151f,   -0.189216f,  0.344062f,    -0.424986f,   0.309711f,
+  -0.0967332f, 0.417457f,   -0.176185f,   0.741058f,    0.115775f,
+  -0.526939f,  -0.0416508f, 0.29145f,     0.368292f,    -0.0320823f,
+  -0.174854f,  -0.147699f,  0.345198f,    -0.0989291f,  -0.108224f,
+  -0.0361128f, 0.569509f,   -0.0537022f,  0.386112f,    0.0218484f,
+  -0.0917452f, -0.326464f,  -0.707277f,   -0.92936f,    0.529203f,
+  -0.0414848f, 0.265231f,   -0.201359f,   -0.278621f,   -0.109272f,
+  -0.22415f,   -0.166414f,  0.300664f,    -0.363893f,   -0.114208f,
+  0.349553f,   -0.131075f,  0.469761f,    0.292534f,    0.700264f,
+  -0.0446578f, -0.636988f,  -0.592225f,   -0.00240535f, -0.390981f,
+  0.138289f,   -0.0259559f, 0.552166f,    0.0787941f,   -0.145882f,
+  0.119166f,   0.0342518f,  0.0238706f,   0.0467874f,   0.159073f,
+  0.273887f,   0.104308f,   0.0355133f,   -0.240499f,   0.00161169f,
+  -0.214345f,  -0.197885f,  -0.0937018f,  0.298671f,    -0.15795f,
+  0.226991f,   -0.648197f,  -0.541824f,   -0.54904f,    0.00723252f,
+  -0.0886648f, 0.249384f,   0.0171777f,   0.204561f,    0.244553f,
+  0.173363f,   0.125727f,   0.00160048f,  0.0877024f,   0.210767f,
+  0.294793f,   0.0564319f,  0.273757f,    -0.472057f,   -0.40342f,
+  -0.663498f,  -0.294652f,  -0.723821f,   -0.556186f,   1.01032f,
+  -0.341018f,  0.487445f,   0.154666f,    0.160475f,    0.0803587f,
+  0.122818f,   -0.256329f,  0.0187389f,   0.0534024f,   0.339258f,
+  0.449883f,   0.0913971f,  0.794922f,    0.149188f,    -0.754102f,
+  -0.332147f,  -1.11099f,   -0.51734f,    0.37661f,     0.0851593f,
+  0.0638272f,  -0.0391679f, -0.768516f,   -0.151253f,   0.0189179f,
+  -0.0957418f, 0.0703774f,  -0.0844274f,  0.0122935f,   -0.16257f,
+  0.052147f,   -0.125905f,  0.151829f,    0.060688f,    -0.120052f,
+  -0.0462407f, -0.214985f,  -0.166619f,   -0.0131363f,  0.0969969f,
+  -0.0109037f, 1.60049f,    -0.195615f,   -0.761682f
+};
+
+static const float simple_motion_search_prune_rect_logits_kernel_16[] = {
+  0.195953f,   0.266914f,   1.09626f,    -0.278587f,  0.315735f,   0.750366f,
+  -0.0773732f, -0.011841f,  -0.0652182f, -0.24263f,   -0.714462f,  -0.310441f,
+  -0.39794f,   0.560316f,   -0.67357f,   -1.25198f,   -0.2683f,    -0.163392f,
+  0.470548f,   0.504874f,   0.215693f,   -0.762583f,  -0.650757f,  0.651298f,
+  -0.0890686f, 0.141904f,   -0.367436f,  -0.0478515f, -0.154226f,  1.00121f,
+  -0.311319f,  -0.146908f,  -0.259843f,  -0.41941f,   -0.650639f,  0.667579f,
+  -0.143973f,  -0.076802f,  0.0112008f,  -1.03765f,   0.507756f,   -0.197687f,
+  -0.592847f,  -1.12017f,   0.143625f,   -0.139294f,  0.19386f,    0.198762f,
+  0.104138f,   -0.203013f,  -0.262737f,  0.154887f,   -0.0434276f, -1.03264f,
+  0.619039f,   -0.0234598f, -0.0827021f, 0.53719f,    0.478445f,   -0.0073367f,
+  0.55982f,    -0.0391153f, -0.222824f,  1.93238f,    0.193033f,   0.533387f,
+  0.142532f,   -0.179864f,  -0.802229f,  0.0993041f,  -0.179998f,  -0.837372f
+};
+
+static const NN_CONFIG simple_motion_search_prune_rect_nn_config_16 = {
+  NUM_FEATURES_16,
+  NUM_LOGITS_16,
+  NUM_HIDDEN_LAYERS_16,
+  {
+      NUM_LAYER_0_UNITS_16,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_kernel_16,
+      simple_motion_search_prune_rect_logits_kernel_16,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_bias_16,
+      simple_motion_search_prune_rect_logits_bias_16,
+  },
+};
+
+#undef NUM_HIDDEN_LAYERS_16
+#undef NUM_FEATURES_16
+#undef NUM_LAYER_0_UNITS_16
+#undef NUM_LOGITS_16
+
+// BLOCK_8X8
+#define NUM_HIDDEN_LAYERS_8 1
+#define NUM_FEATURES_8 21
+#define NUM_LAYER_0_UNITS_8 24
+#define NUM_LOGITS_8 3
+
+static const float simple_motion_search_prune_rect_layer_0_bias_8[] = {
+  0.0929719f,  -1.04451f,  0.436521f,  0.244658f, -0.211554f, 0.236841f,
+  0.351304f,   -0.335641f, -0.133174f, 0.3716f,   0.342397f,  0.00966127f,
+  0.110529f,   0.548292f,  0.318773f,  0.218123f, 0.14769f,   0.234058f,
+  -0.0831903f, 0.134574f,  0.371851f,  0.322827f, 0.376413f,  0.537242f
+};
+
+static const float simple_motion_search_prune_rect_logits_bias_8[] = {
+  0.00590608f, 0.0627245f, -0.131135f
+};
+
+static const float simple_motion_search_prune_rect_layer_0_kernel_8[] = {
+  0.236236f,    -0.197322f,   0.0388012f,   0.0886282f,   -0.294053f,
+  -0.155901f,   0.0896536f,   0.207173f,    -0.225464f,   0.245884f,
+  0.0924547f,   0.0988347f,   -0.146962f,   -0.236533f,   0.242752f,
+  0.276294f,    0.0918088f,   -0.121309f,   -0.265552f,   0.182409f,
+  0.0786249f,   0.115241f,    0.12636f,     0.286668f,    -0.000413442f,
+  0.077513f,    0.105336f,    0.048894f,    0.128857f,    -0.190525f,
+  -0.0230398f,  -0.0545946f,  -0.0740677f,  -0.217745f,   0.0473918f,
+  -0.236371f,   0.0358959f,   0.0798586f,   -0.273776f,   -0.791735f,
+  0.212685f,    0.013666f,    -0.1398f,     0.192162f,    -0.0564259f,
+  0.121955f,    0.136823f,    0.0543089f,   0.092825f,    0.0444147f,
+  -0.422158f,   -0.346276f,   0.00682844f,  -0.323295f,   0.159034f,
+  -0.028898f,   -0.0962342f,  0.191407f,    -0.0995829f,  0.110343f,
+  0.457121f,    0.128277f,    -0.189447f,   0.122764f,    -0.107316f,
+  0.258696f,    -0.137755f,   -0.192561f,   -0.275515f,   -0.0133461f,
+  -0.0209125f,  0.135886f,    0.0973947f,   0.431854f,    0.462813f,
+  -0.423939f,   0.090637f,    -0.158307f,   0.110351f,    -0.188819f,
+  -0.379815f,   0.297234f,    0.116816f,    0.14929f,     -0.05142f,
+  0.142802f,    -0.107308f,   0.0743166f,   -0.181902f,   0.112688f,
+  0.326051f,    -0.0466441f,  -0.0585087f,  0.319181f,    0.201889f,
+  -0.0519778f,  0.246045f,    0.129589f,    -0.222352f,   0.410679f,
+  -0.0468719f,  -0.224405f,   -0.378599f,   -0.0708272f,  0.291255f,
+  -0.275413f,   -0.286772f,   0.146303f,    0.00502366f,  0.273997f,
+  0.0615063f,   -0.128801f,   0.140438f,    0.00988162f,  -0.416282f,
+  -0.0501521f,  0.0601391f,   0.425444f,    0.204404f,    -0.161582f,
+  0.228264f,    -0.147466f,   -0.142093f,   0.155618f,    0.125181f,
+  -0.117226f,   -0.0940137f,  0.199695f,    0.122635f,    -0.0343566f,
+  0.25744f,     -0.170798f,   0.170312f,    -0.221076f,   0.210397f,
+  -0.344634f,   -0.42091f,    -0.00364981f, -0.0145637f,  0.321783f,
+  0.0783587f,   0.250987f,    -0.00987271f, -0.695387f,   0.484135f,
+  -0.189236f,   0.340221f,    -0.0261936f,  0.177004f,    -0.101495f,
+  0.0458288f,   0.00996208f,  -0.131282f,   0.239959f,    -0.0646483f,
+  0.259072f,    -0.294724f,   -0.0485913f,  0.120665f,    0.271345f,
+  -0.0236157f,  -0.186769f,   0.200163f,    -0.112428f,   -0.038864f,
+  -0.729764f,   0.320225f,    0.20533f,     -0.0731921f,  -0.0625873f,
+  -0.487145f,   0.0819456f,   -0.0344899f,  0.19262f,     0.324683f,
+  0.215074f,    -0.464162f,   -0.123737f,   -0.062616f,   0.402956f,
+  0.18635f,     -0.197769f,   0.100533f,    -0.293992f,   0.145554f,
+  0.212232f,    -0.297656f,   0.112656f,    -0.00207075f, -0.163881f,
+  -0.124628f,   -0.225694f,   0.268492f,    0.166006f,    0.298173f,
+  -0.122093f,   0.238944f,    -0.132759f,   0.387168f,    0.283462f,
+  0.0376998f,   -0.0527518f,  -0.131649f,   -0.187971f,   0.0433382f,
+  -0.182108f,   -0.0159221f,  -0.306503f,   -0.116393f,   -0.278279f,
+  0.194667f,    0.191931f,    -0.0155848f,  0.061354f,    -0.187866f,
+  -0.199614f,   0.27465f,     0.173959f,    -0.142243f,   -0.275063f,
+  -0.436406f,   -0.0414135f,  -0.0867722f,  0.144904f,    0.457838f,
+  0.396556f,    -0.234414f,   0.286493f,    0.182848f,    -0.0964301f,
+  0.0647563f,   0.330323f,    0.0106972f,   0.291926f,    0.249374f,
+  0.126498f,    0.131904f,    0.144133f,    0.290967f,    0.279663f,
+  -0.07275f,    0.298849f,    0.0509303f,   0.0835576f,   -0.36213f,
+  -0.215041f,   -0.431314f,   -0.363423f,   -0.68542f,    -0.311905f,
+  -0.0158718f,  -0.278136f,   0.22943f,     -0.065407f,   -0.180358f,
+  -0.190041f,   0.178827f,    -0.0956258f,  -0.361751f,   0.0555846f,
+  0.0391926f,   0.18493f,     0.349155f,    0.0620533f,   0.107822f,
+  -0.37479f,    -0.214229f,   0.0156212f,   0.12353f,     0.0838783f,
+  0.0516166f,   -0.297401f,   -0.324205f,   0.165416f,    -0.180237f,
+  0.000455288f, 0.0165856f,   0.269442f,    -0.0050627f,  -0.17379f,
+  -0.159357f,   -0.0197761f,  -0.442358f,   0.292338f,    -0.281192f,
+  -0.220797f,   -0.31968f,    -0.13081f,    -0.0714009f,  -0.241106f,
+  0.0445559f,   0.286437f,    0.174064f,    -0.0707783f,  0.179205f,
+  -0.0858393f,  -0.182413f,   0.0464337f,   0.273138f,    -0.0686158f,
+  -0.0846032f,  -0.00880094f, 0.500096f,    -0.157471f,   -0.141422f,
+  0.381825f,    -0.233019f,   -0.10411f,    -0.429038f,   -0.383961f,
+  -0.0143021f,  0.332843f,    0.319908f,    -0.200207f,   0.185621f,
+  -0.0827178f,  0.208406f,    0.249769f,    -0.0723191f,  -0.164118f,
+  0.2306f,      0.514743f,    -0.168576f,   0.162905f,    -0.0639156f,
+  -0.00377544f, -0.0357603f,  -0.366609f,   -0.439581f,   -0.390316f,
+  -0.0256173f,  0.184651f,    0.225793f,    0.277336f,    -0.271053f,
+  -0.039194f,   0.308709f,    -0.0823194f,  0.215845f,    -0.0305934f,
+  0.207156f,    0.0242133f,   0.178076f,    -0.0147258f,  -0.501016f,
+  0.0425183f,   -0.32334f,    -0.117133f,   0.211239f,    0.11304f,
+  0.224753f,    0.289255f,    -0.353953f,   -0.251153f,   -0.284117f,
+  0.0381016f,   -0.0220049f,  -0.146197f,   0.0198448f,   0.0830073f,
+  0.0769781f,   0.245701f,    0.0345686f,   -0.171671f,   -0.0749316f,
+  -0.156164f,   0.077471f,    0.171366f,    0.00549367f,  -0.0917314f,
+  -0.348183f,   0.186549f,    0.155758f,    0.12377f,     0.228549f,
+  -0.372118f,   0.224414f,    0.0303148f,   -0.00673295f, 0.0855743f,
+  0.109336f,    0.360171f,    -0.0578394f,  -0.34167f,    -0.0415367f,
+  -0.278975f,   0.283761f,    0.398667f,    -0.340301f,   -0.232094f,
+  0.126067f,    0.193787f,    -0.176406f,   0.0546539f,   -0.0549633f,
+  0.105809f,    -0.0926057f,  -0.0116372f,  -0.098266f,   0.116753f,
+  -0.0661511f,  0.439646f,    -0.0927268f,  0.0999881f,   -0.170887f,
+  0.221045f,    0.0309981f,   0.253644f,    0.327211f,    0.0822908f,
+  -0.206893f,   -0.0705511f,  -0.0183062f,  -0.062421f,   -0.26241f,
+  -0.0850025f,  0.215664f,    -0.445837f,   0.265127f,    -0.24374f,
+  0.0182374f,   0.199747f,    0.192634f,    -0.0547674f,  0.237479f,
+  -0.22589f,    0.0199568f,   -0.00226449f, -0.370026f,   -0.085982f,
+  0.120268f,    -0.201913f,   -0.0241852f,  -0.0902752f,  -0.125417f,
+  -0.138451f,   0.139834f,    0.035369f,    0.973304f,    -0.133185f,
+  -0.0372511f,  -0.0939797f,  0.0750327f,   0.131332f,    -0.0948143f,
+  -0.227437f,   0.0718025f,   -0.241555f,   0.0954081f,   -0.114389f,
+  0.144256f,    0.177365f,    0.025649f,    -0.224896f,   -0.0699606f,
+  -0.31351f,    0.0349252f,   -0.492566f,   0.00455435f,  0.94466f,
+  0.100314f,    0.294475f,    0.152531f,    -0.165193f,   -0.0367636f,
+  -0.153355f,   0.216961f,    0.0382139f,   -0.251386f,   0.0728174f,
+  -0.122198f,   0.178884f,    0.0375681f,   -0.215692f,   0.241714f,
+  0.293426f,    0.110962f,    -0.327579f,   0.113138f,    0.373479f,
+  -0.518696f,   0.253503f,    -0.0688753f,  -0.109652f,   0.0778219f,
+  0.110266f,    -0.0355493f,  0.289359f,    -0.137474f,   -0.0457507f,
+  -0.0755428f,  -0.134834f,   0.384724f,    0.167317f,    0.227267f,
+  -0.179717f,   -0.189428f,   -0.389926f,   -0.445401f,   -0.144119f,
+  0.0681414f,   0.5804f,      -0.271505f,   -0.0127296f
+};
+
+static const float simple_motion_search_prune_rect_logits_kernel_8[] = {
+  0.0534772f,   0.76338f,    0.00330479f, -0.418013f, 0.308282f,   0.126139f,
+  0.0381165f,   0.230419f,   0.267358f,   -0.265256f, 0.314815f,   -0.345259f,
+  -0.332239f,   -0.0974348f, -0.135406f,  -0.411826f, 0.469479f,   0.328913f,
+  -0.142056f,   0.0970277f,  0.408218f,   -0.266971f, 0.496125f,   -0.579164f,
+  -0.00991023f, 0.743371f,   -0.305708f,  0.235066f,  0.30313f,    -0.285641f,
+  -0.291385f,   0.449725f,   0.0123259f,  0.247515f,  -0.0168741f, -0.0156247f,
+  0.221771f,    -0.0213741f, 0.485301f,   0.291499f,  -0.423436f,  0.223715f,
+  -0.428009f,   0.563144f,   0.157696f,   -0.4129f,   0.0360898f,  -0.137376f,
+  -0.264407f,   -1.90753f,   0.543665f,   0.0238804f, 0.0785367f,  -0.315858f,
+  0.826249f,    -0.279287f,  -0.0639901f, 0.269955f,  0.221804f,   0.84004f,
+  -0.102974f,   -0.423812f,  0.21655f,    -0.301221f, 0.969496f,   -0.278917f,
+  -0.493561f,   0.34022f,    -0.765727f,  0.778922f,  -0.196643f,  0.120032f
+};
+
+static const NN_CONFIG simple_motion_search_prune_rect_nn_config_8 = {
+  NUM_FEATURES_8,
+  NUM_LOGITS_8,
+  NUM_HIDDEN_LAYERS_8,
+  {
+      NUM_LAYER_0_UNITS_8,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_kernel_8,
+      simple_motion_search_prune_rect_logits_kernel_8,
+  },
+  {
+      simple_motion_search_prune_rect_layer_0_bias_8,
+      simple_motion_search_prune_rect_logits_bias_8,
+  },
+};
+
+#undef NUM_HIDDEN_LAYERS_8
+#undef NUM_FEATURES_8
+#undef NUM_LAYER_0_UNITS_8
+#undef NUM_LOGITS_8
+
 #ifdef __cplusplus
 }  // extern "C"
 #endif
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 1fa7d82..d6f2d57 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -249,6 +249,11 @@
     sf->prune_single_motion_modes_by_simple_trans = 1;
 
     sf->full_pixel_motion_search_based_split = 1;
+    // TODO(chiyotsai@google.com): Try enabling both
+    // simple_motion_search_prune_rect and ml_prune_rect_partition.
+    sf->simple_motion_search_prune_rect = 1;
+    sf->ml_prune_rect_partition = 0;
+
     sf->disable_wedge_search_var_thresh = 0;
     sf->disable_wedge_search_edge_thresh = 0;
     sf->prune_comp_type_by_comp_avg = 1;
@@ -513,6 +518,7 @@
     sf->ml_partition_search_breakout_thresh[i] = -1;  // -1 means not enabled.
   }
   sf->full_pixel_motion_search_based_split = 0;
+  sf->simple_motion_search_prune_rect = 0;
 
   // Set this at the appropriate speed levels
   sf->use_transform_domain_distortion = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 916e260..40f858b 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -614,6 +614,10 @@
   // Gate warp evaluation for motions of type IDENTITY,
   // TRANSLATION and AFFINE(based on number of warp neighbors)
   int prune_warp_using_wmtype;
+
+  // Perform simple_motion_search on each possible subblock and use it to prune
+  // PARTITION_HORZ and PARTITION_VERT.
+  int simple_motion_search_prune_rect;
 } SPEED_FEATURES;
 
 struct AV1_COMP;