Improving the model for pruning the TX type search

Introduces two new TX type pruning modes that provide better
speed-quality trade-off compared to the existing ones. A shallow
neural network with one hidden layer trained separately for each
block size is used as a prediction model. The new modes differ in
thresholds applied to the output of the neural net, so that they
prune different number of TX types on average.

Owing to relatively low quality loss PRUNE_2D_ACCURATE is used
by default, regardless of speed settings. Starting with speed
setting of 3 we switch to PRUNE_2D_FAST mode to get better
speed-up.

Evaluation results:
----------------------------------------------------------
Prune mode | Avg. speed-up | Quality loss | Quality loss
           |(high bitrates)|   (lowres)   |   (midres)
----------------------------------------------------------
PRUNE_ONE  |     18.7%     |    0.396%    |    0.308%
----------------------------------------------------------
PRUNE_TWO  |     27.2%     |    0.439%    |    0.389%
----------------------------------------------------------
PRUNE_2D_  |     18.8%     |    0.032%    |    0.063%
ACCURATE   |               |              |
----------------------------------------------------------
PRUNE_2D_  |     33.3%     |    0.504%    |     ---
FAST       |               |              |

Change-Id: Ibd59f52eef493a499e529d824edad267daa65f9d
diff --git a/av1/av1_cx.mk b/av1/av1_cx.mk
index 13f2974..f5d62c9 100644
--- a/av1/av1_cx.mk
+++ b/av1/av1_cx.mk
@@ -173,4 +173,8 @@
 AV1_CX_SRCS-$(HAVE_SSE4_1) += encoder/x86/corner_match_sse4.c
 endif
 
+ifeq ($(CONFIG_EXT_TX),yes)
+AV1_CX_SRCS-yes += encoder/tx_prune_model_weights.h
+endif
+
 AV1_CX_SRCS-yes := $(filter-out $(AV1_CX_SRCS_REMOVE-yes),$(AV1_CX_SRCS-yes))
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index ff4d204..6698244 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -62,6 +62,9 @@
 #include "av1/encoder/rd.h"
 #include "av1/encoder/rdopt.h"
 #include "av1/encoder/tokenize.h"
+#if CONFIG_EXT_TX
+#include "av1/encoder/tx_prune_model_weights.h"
+#endif  // CONFIG_EXT_TX
 #if CONFIG_PVQ
 #include "av1/encoder/pvq_encoder.h"
 #include "av1/common/pvq.h"
@@ -1146,50 +1149,315 @@
   { 1, 0, 0, 1 },
 #endif  // CONFIG_MRC_TX
 };
+
+static void get_energy_distribution_finer(const int16_t *diff, int stride,
+                                          int bw, int bh, float *hordist,
+                                          float *verdist) {
+  // First compute downscaled block energy values (esq); downscale factors
+  // are defined by w_shift and h_shift.
+  unsigned int esq[256];
+  const int w_shift = bw <= 8 ? 0 : 1;
+  const int h_shift = bh <= 8 ? 0 : 1;
+  const int esq_w = bw <= 8 ? bw : bw / 2;
+  const int esq_h = bh <= 8 ? bh : bh / 2;
+  const int esq_sz = esq_w * esq_h;
+  int i, j;
+  memset(esq, 0, esq_sz * sizeof(esq[0]));
+  for (i = 0; i < bh; i++) {
+    unsigned int *cur_esq_row = esq + (i >> h_shift) * esq_w;
+    const int16_t *cur_diff_row = diff + i * stride;
+    for (j = 0; j < bw; j++) {
+      cur_esq_row[j >> w_shift] += cur_diff_row[j] * cur_diff_row[j];
+    }
+  }
+
+  uint64_t total = 0;
+  for (i = 0; i < esq_sz; i++) total += esq[i];
+
+  // Output hordist and verdist arrays are normalized 1D projections of esq
+  if (total == 0) {
+    float hor_val = 1.0f / esq_w;
+    for (j = 0; j < esq_w - 1; j++) hordist[j] = hor_val;
+    float ver_val = 1.0f / esq_h;
+    for (i = 0; i < esq_h - 1; i++) verdist[i] = ver_val;
+    return;
+  }
+
+  const float e_recip = 1.0f / (float)total;
+  memset(hordist, 0, (esq_w - 1) * sizeof(hordist[0]));
+  memset(verdist, 0, (esq_h - 1) * sizeof(verdist[0]));
+  const unsigned int *cur_esq_row;
+  for (i = 0; i < esq_h - 1; i++) {
+    cur_esq_row = esq + i * esq_w;
+    for (j = 0; j < esq_w - 1; j++) {
+      hordist[j] += (float)cur_esq_row[j];
+      verdist[i] += (float)cur_esq_row[j];
+    }
+    verdist[i] += (float)cur_esq_row[j];
+  }
+  cur_esq_row = esq + i * esq_w;
+  for (j = 0; j < esq_w - 1; j++) hordist[j] += (float)cur_esq_row[j];
+
+  for (j = 0; j < esq_w - 1; j++) hordist[j] *= e_recip;
+  for (i = 0; i < esq_h - 1; i++) verdist[i] *= e_recip;
+}
+
+// Similar to get_horver_correlation, but also takes into account first
+// row/column, when computing horizontal/vertical correlation.
+static void get_horver_correlation_full(const int16_t *diff, int stride, int w,
+                                        int h, float *hcorr, float *vcorr) {
+  const float num_hor = h * (w - 1);
+  const float num_ver = (h - 1) * w;
+  int i, j;
+
+  // The following notation is used:
+  // x - current pixel
+  // y - left neighbor pixel
+  // z - top neighbor pixel
+  int64_t xy_sum = 0, xz_sum = 0;
+  int64_t xhor_sum = 0, xver_sum = 0, y_sum = 0, z_sum = 0;
+  int64_t x2hor_sum = 0, x2ver_sum = 0, y2_sum = 0, z2_sum = 0;
+
+  int16_t x, y, z;
+  for (j = 1; j < w; ++j) {
+    x = diff[j];
+    y = diff[j - 1];
+    xy_sum += x * y;
+    xhor_sum += x;
+    y_sum += y;
+    x2hor_sum += x * x;
+    y2_sum += y * y;
+  }
+  for (i = 1; i < h; ++i) {
+    x = diff[i * stride];
+    z = diff[(i - 1) * stride];
+    xz_sum += x * z;
+    xver_sum += x;
+    z_sum += z;
+    x2ver_sum += x * x;
+    z2_sum += z * z;
+    for (j = 1; j < w; ++j) {
+      x = diff[i * stride + j];
+      y = diff[i * stride + j - 1];
+      z = diff[(i - 1) * stride + j];
+      xy_sum += x * y;
+      xz_sum += x * z;
+      xhor_sum += x;
+      xver_sum += x;
+      y_sum += y;
+      z_sum += z;
+      x2hor_sum += x * x;
+      x2ver_sum += x * x;
+      y2_sum += y * y;
+      z2_sum += z * z;
+    }
+  }
+  const float xhor_var_n = x2hor_sum - (xhor_sum * xhor_sum) / num_hor;
+  const float y_var_n = y2_sum - (y_sum * y_sum) / num_hor;
+  const float xy_var_n = xy_sum - (xhor_sum * y_sum) / num_hor;
+  const float xver_var_n = x2ver_sum - (xver_sum * xver_sum) / num_ver;
+  const float z_var_n = z2_sum - (z_sum * z_sum) / num_ver;
+  const float xz_var_n = xz_sum - (xver_sum * z_sum) / num_ver;
+
+  *hcorr = *vcorr = 1;
+  if (xhor_var_n > 0 && y_var_n > 0) {
+    *hcorr = xy_var_n / sqrtf(xhor_var_n * y_var_n);
+    *hcorr = *hcorr < 0 ? 0 : *hcorr;
+  }
+  if (xver_var_n > 0 && z_var_n > 0) {
+    *vcorr = xz_var_n / sqrtf(xver_var_n * z_var_n);
+    *vcorr = *vcorr < 0 ? 0 : *vcorr;
+  }
+}
+
+// Performs a forward pass through a neural network with 2 fully-connected
+// layers, assuming ReLU as activation function. Number of output neurons
+// is always equal to 4.
+// fc1, fc2 - weight matrices of the respective layers.
+// b1, b2 - bias vectors of the respective layers.
+static void compute_1D_scores(float *features, int num_features,
+                              const float *fc1, const float *b1,
+                              const float *fc2, const float *b2,
+                              int num_hidden_units, float *dst_scores) {
+  assert(num_hidden_units <= 32);
+  float hidden_layer[32];
+  for (int i = 0; i < num_hidden_units; i++) {
+    const float *cur_coef = fc1 + i * num_features;
+    hidden_layer[i] = 0.0f;
+    for (int j = 0; j < num_features; j++)
+      hidden_layer[i] += cur_coef[j] * features[j];
+    hidden_layer[i] = AOMMAX(hidden_layer[i] + b1[i], 0.0f);
+  }
+  for (int i = 0; i < 4; i++) {
+    const float *cur_coef = fc2 + i * num_hidden_units;
+    dst_scores[i] = 0.0f;
+    for (int j = 0; j < num_hidden_units; j++)
+      dst_scores[i] += cur_coef[j] * hidden_layer[j];
+    dst_scores[i] += b2[i];
+  }
+}
+
+// Transforms raw scores into a probability distribution across 16 TX types
+static void score_2D_transform_pow8(float *scores_2D, float shift) {
+  float sum = 0.0f;
+  int i;
+
+  for (i = 0; i < 16; i++) {
+    float v, v2, v4;
+    v = AOMMAX(scores_2D[i] + shift, 0.0f);
+    v2 = v * v;
+    v4 = v2 * v2;
+    scores_2D[i] = v4 * v4;
+    sum += scores_2D[i];
+  }
+  for (i = 0; i < 16; i++) scores_2D[i] /= sum;
+}
+
+static int prune_tx_types_2D(BLOCK_SIZE bsize, const MACROBLOCK *x,
+                             int tx_set_type, int pruning_aggressiveness) {
+  if (bsize >= BLOCK_32X32) return 0;
+  const struct macroblock_plane *const p = &x->plane[0];
+  const int bidx = AOMMAX(bsize - BLOCK_4X4, 0);
+  const float score_thresh =
+      av1_prune_2D_adaptive_thresholds[bidx][pruning_aggressiveness - 1];
+
+  float hfeatures[16], vfeatures[16];
+  float hscores[4], vscores[4];
+  float scores_2D[16];
+  int tx_type_table_2D[16] = {
+    DCT_DCT,      DCT_ADST,      DCT_FLIPADST,      V_DCT,
+    ADST_DCT,     ADST_ADST,     ADST_FLIPADST,     V_ADST,
+    FLIPADST_DCT, FLIPADST_ADST, FLIPADST_FLIPADST, V_FLIPADST,
+    H_DCT,        H_ADST,        H_FLIPADST,        IDTX
+  };
+  const int bw = block_size_wide[bsize], bh = block_size_high[bsize];
+  const int hfeatures_num = bw <= 8 ? bw : bw / 2;
+  const int vfeatures_num = bh <= 8 ? bh : bh / 2;
+  assert(hfeatures_num <= 16);
+  assert(vfeatures_num <= 16);
+
+  get_energy_distribution_finer(p->src_diff, bw, bw, bh, hfeatures, vfeatures);
+  get_horver_correlation_full(p->src_diff, bw, bw, bh,
+                              &hfeatures[hfeatures_num - 1],
+                              &vfeatures[vfeatures_num - 1]);
+
+  const float *fc1_hor = av1_prune_2D_learned_weights_hor[bidx];
+  const float *b1_hor =
+      fc1_hor + av1_prune_2D_num_hidden_units_hor[bidx] * hfeatures_num;
+  const float *fc2_hor = b1_hor + av1_prune_2D_num_hidden_units_hor[bidx];
+  const float *b2_hor = fc2_hor + av1_prune_2D_num_hidden_units_hor[bidx] * 4;
+  compute_1D_scores(hfeatures, hfeatures_num, fc1_hor, b1_hor, fc2_hor, b2_hor,
+                    av1_prune_2D_num_hidden_units_hor[bidx], hscores);
+
+  const float *fc1_ver = av1_prune_2D_learned_weights_ver[bidx];
+  const float *b1_ver =
+      fc1_ver + av1_prune_2D_num_hidden_units_ver[bidx] * vfeatures_num;
+  const float *fc2_ver = b1_ver + av1_prune_2D_num_hidden_units_ver[bidx];
+  const float *b2_ver = fc2_ver + av1_prune_2D_num_hidden_units_ver[bidx] * 4;
+  compute_1D_scores(vfeatures, vfeatures_num, fc1_ver, b1_ver, fc2_ver, b2_ver,
+                    av1_prune_2D_num_hidden_units_ver[bidx], vscores);
+
+  float score_2D_average = 0.0f;
+  for (int i = 0; i < 4; i++) {
+    float *cur_scores_2D = scores_2D + i * 4;
+    cur_scores_2D[0] = vscores[i] * hscores[0];
+    cur_scores_2D[1] = vscores[i] * hscores[1];
+    cur_scores_2D[2] = vscores[i] * hscores[2];
+    cur_scores_2D[3] = vscores[i] * hscores[3];
+    score_2D_average += cur_scores_2D[0] + cur_scores_2D[1] + cur_scores_2D[2] +
+                        cur_scores_2D[3];
+  }
+  score_2D_average /= 16;
+  score_2D_transform_pow8(scores_2D, (20 - score_2D_average));
+
+  // Always keep the TX type with the highest score, prune all others with
+  // score below score_thresh.
+  int max_score_i = 0;
+  float max_score = 0.0f;
+  for (int i = 0; i < 16; i++) {
+    if (scores_2D[i] > max_score &&
+        av1_ext_tx_used[tx_set_type][tx_type_table_2D[i]]) {
+      max_score = scores_2D[i];
+      max_score_i = i;
+    }
+  }
+
+  int prune_bitmask = 0;
+  for (int i = 0; i < 16; i++) {
+    if (scores_2D[i] < score_thresh && i != max_score_i)
+      prune_bitmask |= (1 << tx_type_table_2D[i]);
+  }
+
+  return prune_bitmask;
+}
 #endif  // CONFIG_EXT_TX
 
 static int prune_tx_types(const AV1_COMP *cpi, BLOCK_SIZE bsize, MACROBLOCK *x,
-                          const MACROBLOCKD *const xd, int tx_set) {
+                          const MACROBLOCKD *const xd, int tx_set_type) {
 #if CONFIG_EXT_TX
-  const int *tx_set_1D = tx_set >= 0 ? ext_tx_used_inter_1D[tx_set] : NULL;
+  int tx_set = ext_tx_set_index[1][tx_set_type];
+  assert(tx_set >= 0);
+  const int *tx_set_1D = ext_tx_used_inter_1D[tx_set];
 #else
   const int tx_set_1D[TX_TYPES_1D] = { 0 };
+  (void)tx_set_type;
 #endif  // CONFIG_EXT_TX
 
   switch (cpi->sf.tx_type_search.prune_mode) {
     case NO_PRUNE: return 0; break;
     case PRUNE_ONE:
-      if ((tx_set >= 0) && !(tx_set_1D[FLIPADST_1D] & tx_set_1D[ADST_1D]))
-        return 0;
+      if (!(tx_set_1D[FLIPADST_1D] & tx_set_1D[ADST_1D])) return 0;
       return prune_one_for_sby(cpi, bsize, x, xd);
       break;
 #if CONFIG_EXT_TX
     case PRUNE_TWO:
-      if ((tx_set >= 0) && !(tx_set_1D[FLIPADST_1D] & tx_set_1D[ADST_1D])) {
+      if (!(tx_set_1D[FLIPADST_1D] & tx_set_1D[ADST_1D])) {
         if (!(tx_set_1D[DCT_1D] & tx_set_1D[IDTX_1D])) return 0;
         return prune_two_for_sby(cpi, bsize, x, xd, 0, 1);
       }
-      if ((tx_set >= 0) && !(tx_set_1D[DCT_1D] & tx_set_1D[IDTX_1D]))
+      if (!(tx_set_1D[DCT_1D] & tx_set_1D[IDTX_1D]))
         return prune_two_for_sby(cpi, bsize, x, xd, 1, 0);
       return prune_two_for_sby(cpi, bsize, x, xd, 1, 1);
       break;
+    case PRUNE_2D_ACCURATE:
+      if (tx_set_type == EXT_TX_SET_ALL16)
+        return prune_tx_types_2D(bsize, x, tx_set_type, 6);
+      else if (tx_set_type == EXT_TX_SET_DTT9_IDTX_1DDCT)
+        return prune_tx_types_2D(bsize, x, tx_set_type, 4);
+      else
+        return 0;
+      break;
+    case PRUNE_2D_FAST:
+      if (tx_set_type == EXT_TX_SET_ALL16)
+        return prune_tx_types_2D(bsize, x, tx_set_type, 10);
+      else if (tx_set_type == EXT_TX_SET_DTT9_IDTX_1DDCT)
+        return prune_tx_types_2D(bsize, x, tx_set_type, 7);
+      else
+        return 0;
+      break;
 #endif  // CONFIG_EXT_TX
   }
   assert(0);
   return 0;
 }
 
-static int do_tx_type_search(TX_TYPE tx_type, int prune) {
+static int do_tx_type_search(TX_TYPE tx_type, int prune,
+                             TX_TYPE_PRUNE_MODE mode) {
 // TODO(sarahparker) implement for non ext tx
 #if CONFIG_EXT_TX
-  return !(((prune >> vtx_tab[tx_type]) & 1) |
-           ((prune >> (htx_tab[tx_type] + 8)) & 1));
+  if (mode >= PRUNE_2D_ACCURATE) {
+    return !((prune >> tx_type) & 1);
+  } else {
+    return !(((prune >> vtx_tab[tx_type]) & 1) |
+             ((prune >> (htx_tab[tx_type] + 8)) & 1));
+  }
 #else
   // temporary to avoid compiler warnings
   (void)vtx_tab;
   (void)htx_tab;
   (void)tx_type;
   (void)prune;
+  (void)mode;
   return 1;
 #endif  // CONFIG_EXT_TX
 }
@@ -2290,16 +2558,11 @@
 }
 
 static int skip_txfm_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs,
-                            TX_TYPE tx_type, TX_SIZE tx_size) {
+                            TX_TYPE tx_type, TX_SIZE tx_size, int prune) {
   const MACROBLOCKD *const xd = &x->e_mbd;
   const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
   const TX_SIZE max_tx_size = max_txsize_lookup[bs];
   const int is_inter = is_inter_block(mbmi);
-  int prune = 0;
-  if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE)
-    // passing -1 in for tx_type indicates that all 1D
-    // transforms should be considered for pruning
-    prune = prune_tx_types(cpi, bs, x, xd, -1);
 
 #if CONFIG_MRC_TX
   // MRC_DCT only implemented for TX_32X32 so only include this tx in
@@ -2329,7 +2592,8 @@
   if (!av1_ext_tx_used[tx_set_type][tx_type]) return 1;
   if (is_inter) {
     if (cpi->sf.tx_type_search.prune_mode > NO_PRUNE) {
-      if (!do_tx_type_search(tx_type, prune)) return 1;
+      if (!do_tx_type_search(tx_type, prune, cpi->sf.tx_type_search.prune_mode))
+        return 1;
     }
   } else {
     if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
@@ -2339,7 +2603,7 @@
 #else   // CONFIG_EXT_TX
   if (tx_size >= TX_32X32 && tx_type != DCT_DCT) return 1;
   if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE &&
-      !do_tx_type_search(tx_type, prune))
+      !do_tx_type_search(tx_type, prune, cpi->sf.tx_type_search.prune_mode))
     return 1;
 #endif  // CONFIG_EXT_TX
   return 0;
@@ -2389,18 +2653,18 @@
   mbmi->min_tx_size = get_min_tx_size(mbmi->tx_size);
 #endif  // CONFIG_VAR_TX
 #if CONFIG_EXT_TX
-  int ext_tx_set =
-      get_ext_tx_set(mbmi->tx_size, bs, is_inter, cm->reduced_tx_set_used);
   const TxSetType tx_set_type =
       get_ext_tx_set_type(mbmi->tx_size, bs, is_inter, cm->reduced_tx_set_used);
 #endif  // CONFIG_EXT_TX
 
-  if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE)
+  if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE &&
+      !x->use_default_inter_tx_type) {
 #if CONFIG_EXT_TX
-    prune = prune_tx_types(cpi, bs, x, xd, ext_tx_set);
+    prune = prune_tx_types(cpi, bs, x, xd, tx_set_type);
 #else
     prune = prune_tx_types(cpi, bs, x, xd, 0);
 #endif  // CONFIG_EXT_TX
+  }
 #if CONFIG_EXT_TX
   if (get_ext_tx_types(mbmi->tx_size, bs, is_inter, cm->reduced_tx_set_used) >
           1 &&
@@ -2420,7 +2684,9 @@
             tx_type != get_default_tx_type(0, xd, 0, mbmi->tx_size))
           continue;
         if (cpi->sf.tx_type_search.prune_mode > NO_PRUNE) {
-          if (!do_tx_type_search(tx_type, prune)) continue;
+          if (!do_tx_type_search(tx_type, prune,
+                                 cpi->sf.tx_type_search.prune_mode))
+            continue;
         }
       } else {
         if (x->use_default_intra_tx_type &&
@@ -2512,7 +2778,8 @@
       av1_tx_type_cost(cm, x, xd, bs, plane, mbmi->tx_size, tx_type);
       if (is_inter) {
         if (cpi->sf.tx_type_search.prune_mode > NO_PRUNE &&
-            !do_tx_type_search(tx_type, prune))
+            !do_tx_type_search(tx_type, prune,
+                               cpi->sf.tx_type_search.prune_mode))
           continue;
       }
       if (this_rd_stats.skip)
@@ -2733,6 +3000,16 @@
     end_tx = chosen_tx_size;
   }
 
+  int prune = 0;
+  if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE &&
+      !x->use_default_inter_tx_type) {
+#if CONFIG_EXT_TX
+    prune = prune_tx_types(cpi, bs, x, xd, EXT_TX_SET_ALL16);
+#else
+    prune = prune_tx_types(cpi, bs, x, xd, 0);
+#endif  // CONFIG_EXT_TX
+  }
+
   last_rd = INT64_MAX;
   for (n = start_tx; n >= end_tx; --n) {
 #if CONFIG_EXT_TX && CONFIG_RECT_TX
@@ -2748,7 +3025,7 @@
     TX_TYPE tx_type;
     for (tx_type = tx_start; tx_type < tx_end; ++tx_type) {
       RD_STATS this_rd_stats;
-      if (skip_txfm_search(cpi, x, bs, tx_type, n)) continue;
+      if (skip_txfm_search(cpi, x, bs, tx_type, n, prune)) continue;
       rd = txfm_yrd(cpi, x, &this_rd_stats, ref_best_rd, bs, tx_type, n);
 #if CONFIG_PVQ
       od_encode_rollback(&x->daala_enc, &buf);
@@ -2785,8 +3062,8 @@
     }
 #if CONFIG_LGT_FROM_PRED
     mbmi->use_lgt = 1;
-    if (is_lgt_allowed(mbmi->mode, n) && !skip_txfm_search(cpi, x, bs, 0, n) &&
-        !breakout) {
+    if (is_lgt_allowed(mbmi->mode, n) &&
+        !skip_txfm_search(cpi, x, bs, 0, n, prune) && !breakout) {
       RD_STATS this_rd_stats;
       rd = txfm_yrd(cpi, x, &this_rd_stats, ref_best_rd, bs, 0, n);
       if (rd < best_rd) {
@@ -5310,8 +5587,6 @@
 #if CONFIG_EXT_TX
   const TxSetType tx_set_type = get_ext_tx_set_type(
       max_tx_size, bsize, is_inter, cm->reduced_tx_set_used);
-  const int ext_tx_set =
-      get_ext_tx_set(max_tx_size, bsize, is_inter, cm->reduced_tx_set_used);
 #endif  // CONFIG_EXT_TX
 
   av1_invalid_rd_stats(rd_stats);
@@ -5353,12 +5628,14 @@
     }
   }
 
-  if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE)
+  if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE &&
+      !x->use_default_inter_tx_type && !xd->lossless[mbmi->segment_id]) {
 #if CONFIG_EXT_TX
-    prune = prune_tx_types(cpi, bsize, x, xd, ext_tx_set);
+    prune = prune_tx_types(cpi, bsize, x, xd, tx_set_type);
 #else
     prune = prune_tx_types(cpi, bsize, x, xd, 0);
 #endif  // CONFIG_EXT_TX
+  }
 
   int found = 0;
 
@@ -5377,7 +5654,9 @@
     if (!av1_ext_tx_used[tx_set_type][tx_type]) continue;
     if (is_inter) {
       if (cpi->sf.tx_type_search.prune_mode > NO_PRUNE) {
-        if (!do_tx_type_search(tx_type, prune)) continue;
+        if (!do_tx_type_search(tx_type, prune,
+                               cpi->sf.tx_type_search.prune_mode))
+          continue;
       }
     } else {
       if (!ALLOW_INTRA_EXT_TX && bsize >= BLOCK_8X8) {
@@ -5386,7 +5665,7 @@
     }
 #else   // CONFIG_EXT_TX
     if (is_inter && cpi->sf.tx_type_search.prune_mode > NO_PRUNE &&
-        !do_tx_type_search(tx_type, prune))
+        !do_tx_type_search(tx_type, prune, cpi->sf.tx_type_search.prune_mode))
       continue;
 #endif  // CONFIG_EXT_TX
     if (is_inter && x->use_default_inter_tx_type &&
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 4e7c8df..5b4ee23 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -192,7 +192,7 @@
 
     sf->tx_size_search_breakout = 1;
     sf->partition_search_breakout_rate_thr = 80;
-    sf->tx_type_search.prune_mode = PRUNE_ONE;
+
     // Use transform domain distortion.
     // Note var-tx expt always uses pixel domain distortion.
     sf->use_transform_domain_distortion = 1;
@@ -215,7 +215,7 @@
     sf->use_upsampled_references = 0;
     sf->adaptive_rd_thresh = 2;
 #if CONFIG_EXT_TX
-    sf->tx_type_search.prune_mode = PRUNE_TWO;
+    sf->tx_type_search.prune_mode = PRUNE_2D_FAST;
 #endif
 #if CONFIG_GLOBAL_MOTION
     sf->gm_search_type = GM_DISABLE_SEARCH;
@@ -392,7 +392,11 @@
   sf->cb_partition_search = 0;
   sf->alt_ref_search_fp = 0;
   sf->partition_search_type = SEARCH_PARTITION;
+#if CONFIG_EXT_TX
+  sf->tx_type_search.prune_mode = PRUNE_2D_ACCURATE;
+#else
   sf->tx_type_search.prune_mode = NO_PRUNE;
+#endif  // CONFIG_EXT_TX
   sf->tx_type_search.use_skip_flag_prediction = 1;
   sf->tx_type_search.fast_intra_tx_type_search = 0;
   sf->tx_type_search.fast_inter_tx_type_search = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 907170e..d946cee 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -193,6 +193,11 @@
 #if CONFIG_EXT_TX
   // eliminates two tx types in each direction
   PRUNE_TWO = 2,
+  // adaptively prunes the least perspective tx types out of all 16
+  // (tuned to provide negligible quality loss)
+  PRUNE_2D_ACCURATE = 3,
+  // similar, but applies much more aggressive pruning to get better speed-up
+  PRUNE_2D_FAST = 4,
 #endif
 } TX_TYPE_PRUNE_MODE;
 
diff --git a/av1/encoder/tx_prune_model_weights.h b/av1/encoder/tx_prune_model_weights.h
new file mode 100644
index 0000000..92a072d
--- /dev/null
+++ b/av1/encoder/tx_prune_model_weights.h
@@ -0,0 +1,799 @@
+/*
+ * Copyright (c) 2016, Alliance for Open Media. All rights reserved
+ *
+ * This source code is subject to the terms of the BSD 2 Clause License and
+ * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
+ * was not distributed with this source code in the LICENSE file, you can
+ * obtain it at www.aomedia.org/license/software. If the Alliance for Open
+ * Media Patent License 1.0 was not distributed with this source code in the
+ * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
+ */
+
+#ifndef AV1_ENCODER_TX_PRUNE_MODEL_WEIGHTS_H_
+#define AV1_ENCODER_TX_PRUNE_MODEL_WEIGHTS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static const int av1_prune_2D_num_hidden_units_hor[9] = { 8,  8,  16, 16, 16,
+                                                          16, 16, 16, 32 };
+static const float *av1_prune_2D_learned_weights_hor[9] = {
+  /* BLOCK_4X4 */
+  (float[]){ 0.72406f,  -0.40019f, 0.51795f,  -0.43881f, -0.49746f, -0.41780f,
+             -0.39409f, -0.16183f, -1.00135f, -0.41733f, -0.96534f, 0.93272f,
+             1.06229f,  0.04188f,  0.60919f,  0.92405f,  -0.39359f, 0.70570f,
+             0.75375f,  1.11966f,  -1.86360f, -0.35421f, 0.18743f,  0.13346f,
+             -0.21262f, 0.07050f,  0.10533f,  -0.47402f, 1.33417f,  1.72899f,
+             1.17983f,  0.10552f,  1.96273f,  -0.69845f, -0.10999f, -1.11311f,
+             1.35101f,  0.43842f,  -0.29264f, -1.15376f, 0.79770f,  0.08520f,
+             0.23298f,  0.05285f,  0.87506f,  -0.90784f, -0.06197f, -1.00580f,
+             0.68639f,  -0.34881f, 0.15366f,  -1.64658f, 0.80755f,  -0.26293f,
+             0.10253f,  -0.23915f, 1.14696f,  -0.10928f, -1.61377f, 0.00863f,
+             0.98599f,  -0.43872f, 0.61196f,  -0.03787f, 1.01060f,  0.17643f,
+             -0.00208f, -0.15738f, 0.06517f,  0.72885f,  0.24387f,  1.28535f,
+             1.23769f,  1.40308f,  0.09871f,  1.82070f },
+  /* BLOCK_4X8 */
+  (float[]){ 0.68355f,  -0.06887f, 0.68525f,  -0.86048f, -0.35906f, -0.28597f,
+             -0.21108f, 0.12591f,  -1.13025f, -0.65695f, -0.25658f, 0.39155f,
+             0.89011f,  0.19258f,  0.28316f,  0.61172f,  0.52587f,  0.99182f,
+             0.75704f,  0.66788f,  -1.61814f, -1.23483f, -0.62868f, -0.11902f,
+             0.33295f,  0.64796f,  0.92345f,  -0.71821f, 0.07575f,  0.34687f,
+             0.20518f,  -0.87850f, 1.14049f,  -0.18583f, 1.92114f,  -0.72057f,
+             1.32715f,  0.96713f,  1.09877f,  -0.64345f, 0.71978f,  0.06896f,
+             1.48617f,  0.97124f,  -0.02487f, -0.95359f, 0.68983f,  -0.16313f,
+             0.51324f,  -0.33770f, 0.45938f,  -1.08238f, 0.72938f,  0.42300f,
+             0.85691f,  -0.03783f, 1.12617f,  -0.04034f, 0.36923f,  0.25638f,
+             1.10167f,  0.41633f,  0.72602f,  -0.14797f, 0.66888f,  0.11437f,
+             -0.99797f, -0.20725f, 1.01163f,  2.06308f,  1.23331f,  -0.15481f,
+             2.14443f,  1.98356f,  0.74616f,  2.58795f },
+  /* BLOCK_8X4 */
+  (float[]){ 0.64828f,  0.61618f,  0.98975f,  -0.14562f, 0.26957f,  1.80872f,
+             0.58299f,  -0.06917f, 0.00937f,  -0.74073f, -0.66045f, -0.04576f,
+             -0.39802f, -0.76960f, -0.85166f, 0.88799f,  -0.70694f, -0.34366f,
+             -0.54906f, -0.39502f, -0.29465f, -0.49650f, -0.32171f, 1.37181f,
+             1.30432f,  0.71843f,  1.01916f,  1.01582f,  0.90999f,  0.86334f,
+             1.04603f,  0.40734f,  0.96187f,  0.53742f,  0.07510f,  0.44167f,
+             0.02049f,  -0.02874f, 0.97191f,  1.03647f,  -2.62751f, -0.01390f,
+             -0.09282f, -0.02522f, -0.30849f, -0.19386f, -0.51356f, 0.52778f,
+             0.77191f,  0.75416f,  0.69067f,  0.93561f,  1.35982f,  0.76193f,
+             0.57869f,  0.00251f,  -0.87244f, -0.26922f, -0.06682f, 0.07176f,
+             0.51142f,  0.58948f,  0.13914f,  0.71165f,  -0.40329f, -0.33201f,
+             0.35293f,  0.33437f,  -0.01812f, -0.24765f, 0.26810f,  -0.77088f,
+             1.35707f,  0.22243f,  0.78402f,  0.66191f,  0.79890f,  1.90669f,
+             0.73189f,  0.24222f,  -0.34682f, 0.66990f,  0.19554f,  0.58414f,
+             0.05060f,  -0.21271f, 0.11656f,  -0.74907f, 0.68837f,  -0.39147f,
+             -1.78263f, -0.69918f, -0.06838f, -0.26927f, 0.38502f,  0.08305f,
+             1.29848f,  0.67328f,  0.67269f,  0.65805f,  -0.47778f, -1.02617f,
+             0.16523f,  0.12223f,  -0.35294f, -0.15866f, -0.56224f, 1.25895f,
+             -0.21422f, -0.33518f, -0.33519f, -0.37414f, 0.55122f,  0.14806f,
+             0.44312f,  -0.07865f, 0.75295f,  0.10766f,  0.59922f,  0.48837f,
+             -0.19099f, -2.07991f, 0.35755f,  0.87813f,  0.07559f,  1.00724f,
+             0.25223f,  -0.06761f, -0.54227f, 0.08599f,  -0.77447f, -1.10920f,
+             0.89298f,  0.05454f,  -0.73681f, 0.21048f,  -0.41041f, 1.25690f,
+             -0.60918f, 0.14661f,  -0.65392f, -0.25881f, 1.67995f,  -0.03550f,
+             -0.22312f, 0.73552f,  0.48399f,  -0.66996f, 0.36527f,  -0.42228f,
+             -1.10793f, 0.31167f,  0.16177f,  1.69315f,  -0.06287f, -0.35804f,
+             -0.24889f, 0.80824f,  1.08952f,  -0.62838f, 0.30066f,  -0.19043f,
+             -0.00518f, -1.31005f, 0.65797f,  1.07714f,  -0.24253f, 0.49779f,
+             0.05848f,  1.08914f,  0.08015f,  -0.38853f, 0.35108f,  -0.11026f,
+             0.64528f,  -0.37615f, 0.39995f,  -0.58117f, -1.29627f, 1.74169f,
+             0.75558f,  -0.04910f, 0.35020f,  0.04556f,  0.12634f,  1.27223f,
+             0.02608f,  -0.19687f, -0.78649f, -0.22746f, 1.02589f,  -0.28411f,
+             1.42443f,  -0.42115f, -0.21153f, -0.01733f, 0.62001f,  0.87167f,
+             1.66008f,  -0.39179f, -0.06293f, 0.27012f,  0.16871f,  0.64597f,
+             0.67358f,  -0.20053f, 0.95830f,  0.44232f,  0.14889f,  1.74197f,
+             0.53696f,  2.87574f },
+  /* BLOCK_8X8 */
+  (float[]){ 0.98214f,  1.05643f,  0.91173f,  0.24165f,  0.39961f,  0.25736f,
+             0.68593f,  0.10553f,  0.13353f,  -0.49687f, -1.66413f, 1.16584f,
+             2.25147f,  -0.72247f, -2.65486f, -0.03628f, -1.47746f, -1.07644f,
+             -1.25551f, -0.91260f, -1.26199f, -1.06022f, -1.42138f, 1.10500f,
+             2.96552f,  -0.40638f, 0.02258f,  -0.23137f, 0.34922f,  -0.01454f,
+             0.41251f,  0.35944f,  -1.56742f, 0.01406f,  0.88114f,  1.42462f,
+             0.87243f,  0.02439f,  0.07035f,  0.34303f,  -3.16843f, 0.25798f,
+             0.07494f,  0.38926f,  -0.12267f, 0.09049f,  -0.36711f, 0.01551f,
+             1.41269f,  1.33505f,  1.43627f,  1.41909f,  1.44605f,  1.43008f,
+             1.36721f,  0.19443f,  -0.08606f, 0.17285f,  0.63692f,  0.92092f,
+             0.61007f,  0.87100f,  -0.33631f, 1.98025f,  -0.40686f, -0.33808f,
+             0.34919f,  0.33817f,  -0.01807f, -0.25259f, 0.26442f,  -0.76979f,
+             1.07788f,  -1.38747f, 1.34315f,  2.79947f,  2.02838f,  -0.25062f,
+             0.00174f,  1.25888f,  0.17344f,  0.20897f,  1.28765f,  1.95749f,
+             1.62351f,  1.04556f,  0.43858f,  0.12463f,  1.66399f,  0.03971f,
+             0.36614f,  0.56932f,  0.15982f,  0.11587f,  0.21402f,  1.89386f,
+             -0.91267f, -0.79781f, 1.79155f,  0.60147f,  -0.90118f, -4.32718f,
+             -0.58154f, -0.02181f, -0.40734f, -0.11409f, -0.79470f, 0.69697f,
+             -0.16588f, -0.16090f, -0.21236f, -0.52776f, -0.64455f, 0.09173f,
+             0.80766f,  0.76097f,  0.20295f,  -0.93467f, -0.43509f, 0.59659f,
+             0.07788f,  -3.79459f, 0.16268f,  0.47343f,  0.05106f,  -0.24880f,
+             1.18941f,  0.10346f,  0.75780f,  0.25628f,  0.19911f,  -0.41384f,
+             1.33909f,  0.31498f,  -1.37171f, -1.09561f, -0.44056f, 0.49001f,
+             -0.65804f, -1.96031f, 0.64806f,  -0.52520f, 1.38838f,  0.15519f,
+             -0.63856f, -2.02670f, -0.92947f, 0.00216f,  1.47710f,  -2.01099f,
+             -2.11289f, -0.92288f, 0.19296f,  1.37866f,  -0.85975f, -0.78624f,
+             -2.10392f, 0.13976f,  1.06968f,  -2.04120f, 0.57991f,  -1.84941f,
+             -0.81512f, -2.08254f, -0.47334f, 0.12256f,  -1.39594f, -1.02829f,
+             0.06134f,  2.25646f,  -1.25196f, -2.65317f, -1.94473f, 0.10989f,
+             0.55446f,  -1.76557f, 0.33455f,  -1.85556f, -3.01878f, -0.25100f,
+             1.65520f,  -1.61409f, 1.16336f,  -1.15560f, 0.13631f,  1.50733f,
+             -1.07538f, -0.91200f, -1.93132f, 0.09271f,  0.24425f,  -1.80655f,
+             -0.01138f, -1.36421f, -0.62970f, -0.84766f, -0.34714f, -0.50531f,
+             1.91005f,  -1.60316f, -0.02495f, 1.04938f,  0.28411f,  -0.79809f,
+             -1.48232f, 0.00766f,  0.94016f,  -1.11974f, 0.53574f,  1.57736f,
+             -0.13698f, 2.64613f },
+  /* BLOCK_8X16 */
+  (float[]){ 1.36274f,  1.37313f,  1.26859f,  1.26459f,  1.37979f,  1.47217f,
+             1.29710f,  0.15765f,  0.31552f,  -0.05727f, 0.25562f,  0.47925f,
+             -0.32913f, -0.55757f, -0.98010f, 0.08568f,  -0.62754f, 0.12834f,
+             -0.03717f, 0.06286f,  0.26159f,  0.26023f,  -0.62605f, 1.34500f,
+             1.47720f,  0.47937f,  0.84793f,  0.87866f,  0.81260f,  0.74761f,
+             0.84217f,  0.53321f,  -0.78232f, 0.35321f,  0.41240f,  0.45002f,
+             0.88973f,  0.51055f,  0.91115f,  -0.45512f, -2.37418f, -0.25205f,
+             0.05893f,  -0.15685f, -0.25156f, -0.17104f, -0.12230f, 0.17802f,
+             0.18796f,  -0.05797f, 0.26484f,  1.23515f,  1.70393f,  0.46022f,
+             -0.14354f, 0.08501f,  -0.84625f, -0.42578f, -0.29345f, -0.51797f,
+             -0.56515f, -0.47465f, 0.23970f,  1.59912f,  -0.40332f, -0.33209f,
+             0.37274f,  0.36831f,  -0.00248f, -0.24295f, 0.29539f,  -0.76136f,
+             -0.22531f, 0.12371f,  0.37889f,  1.02639f,  1.73330f,  1.09686f,
+             1.04111f,  0.69006f,  -1.27157f, 0.94013f,  0.61621f,  0.62274f,
+             0.48759f,  0.55672f,  0.62597f,  -0.38846f, 1.72124f,  0.08214f,
+             -0.06650f, 0.32617f,  0.10958f,  0.24650f,  0.10740f,  1.16861f,
+             0.50701f,  0.45383f,  0.90016f,  -0.00695f, -0.11986f, -0.07834f,
+             0.20346f,  0.25863f,  -0.40889f, -0.11344f, -0.79108f, 0.76259f,
+             -0.14562f, -0.15459f, -0.20954f, -0.51306f, 0.02743f,  -0.82456f,
+             -0.00861f, -0.27274f, 0.28762f,  0.07282f,  0.26410f,  0.53413f,
+             -0.22208f, -0.85031f, -1.39129f, -0.74519f, 0.09771f,  0.80313f,
+             1.07698f,  0.02531f,  -1.30434f, -1.19259f, -0.43467f, -0.85386f,
+             0.96584f,  0.29276f,  -0.41990f, -0.96924f, -0.30933f, 0.95264f,
+             -0.25330f, -1.19584f, 1.46564f,  -0.42959f, 1.55720f,  0.18479f,
+             -1.72959f, -0.21670f, 0.10616f,  -0.02006f, 0.15084f,  -0.85303f,
+             -0.27535f, 0.58704f,  0.23683f,  1.19743f,  0.77971f,  0.49874f,
+             0.19508f,  0.19641f,  1.47895f,  -0.52173f, -0.56746f, -0.50761f,
+             0.15864f,  -0.95168f, 0.48103f,  0.91904f,  -0.11700f, 0.62863f,
+             0.06526f,  1.63803f,  -0.72325f, -1.80449f, 0.66373f,  0.12831f,
+             0.27139f,  -0.26346f, 1.50852f,  0.25079f,  -0.54255f, 1.78815f,
+             1.39691f,  -0.44989f, -0.18511f, -1.52903f, 0.13983f,  1.06906f,
+             -0.30184f, 0.37566f,  0.46209f,  0.10440f,  0.64695f,  -0.34002f,
+             1.96990f,  0.21189f,  -0.91248f, -0.11263f, 0.26708f,  1.27405f,
+             1.89776f,  0.02081f,  -0.06977f, -0.02584f, 0.47733f,  0.27117f,
+             1.33315f,  -0.09175f, 0.48747f,  1.16772f,  1.25783f,  1.19452f,
+             0.69964f,  2.41982f },
+  /* BLOCK_16X8 */
+  (float[]){ 0.89821f,  0.90804f,  1.13052f,  0.74855f,  1.02053f,  0.91260f,
+             0.97102f,  0.16808f,  -0.19982f, -0.33296f, -0.22490f, -0.22481f,
+             -0.09332f, -2.44338f, -0.12236f, -0.03158f, -1.43561f, 0.07794f,
+             0.16586f,  0.09731f,  0.12967f,  0.09725f,  -0.16826f, 1.26640f,
+             0.88004f,  0.27312f,  -0.07993f, 0.33640f,  0.11732f,  0.33384f,
+             0.97066f,  -0.61744f, -0.48545f, 0.44622f,  0.73744f,  0.32262f,
+             -0.05713f, 0.42280f,  1.10378f,  0.18540f,  -2.07906f, 0.11443f,
+             0.37877f,  0.24136f,  -0.12524f, -0.12434f, 0.02116f,  0.11716f,
+             1.28267f,  1.01508f,  1.26184f,  1.22545f,  1.29582f,  1.18855f,
+             1.27564f,  0.42001f,  -0.41481f, 0.06725f,  -0.13133f, -0.24801f,
+             0.16515f,  0.16228f,  0.35197f,  0.53610f,  -0.39805f, -0.32584f,
+             0.40096f,  0.38621f,  -0.00030f, -0.23434f, 0.29149f,  -0.76542f,
+             0.04996f,  -0.30036f, 1.48687f,  0.90852f,  -0.03083f, -0.15953f,
+             1.19259f,  0.87690f,  -1.08977f, 0.78757f,  0.81149f,  0.54089f,
+             0.35400f,  0.37919f,  0.84997f,  -0.20449f, 0.39601f,  -0.37596f,
+             0.64748f,  0.26021f,  0.37354f,  0.23593f,  0.16335f,  1.70681f,
+             0.31800f,  -0.00964f, 0.82687f,  -0.78372f, -1.47438f, 0.32410f,
+             1.37436f,  0.07476f,  -0.40574f, -0.10353f, -0.79300f, 0.74381f,
+             -0.15601f, -0.14380f, -0.20961f, -0.52697f, 0.04669f,  -0.00870f,
+             0.05624f,  -0.09036f, 0.25701f,  0.30336f,  0.24199f,  0.45579f,
+             0.66330f,  -1.81834f, 0.74965f,  1.22747f,  0.25072f,  0.25100f,
+             0.43289f,  -0.00362f, -0.87643f, 0.36754f,  -0.86409f, 1.37761f,
+             1.22688f,  0.09074f,  -1.47139f, -1.06100f, -0.24087f, 1.10382f,
+             -0.32837f, -1.39592f, -0.14741f, -0.43954f, 1.72137f,  -0.21704f,
+             -0.81860f, -0.80745f, -0.43612f, 0.58656f,  0.37455f,  -0.56519f,
+             -1.71536f, 0.23278f,  0.23951f,  1.09610f,  0.49986f,  0.43375f,
+             -0.53182f, 0.17376f,  1.05626f,  -0.61743f, -0.71777f, -0.66943f,
+             1.40091f,  0.34426f,  1.14295f,  0.45571f,  -0.52504f, -0.00303f,
+             0.06044f,  0.66119f,  -0.60340f, -1.14344f, -0.28045f, 0.12742f,
+             0.61484f,  -0.41016f, 1.36102f,  -0.86969f, -0.52728f, 1.01725f,
+             0.67083f,  -0.10138f, 1.36406f,  0.34066f,  0.12498f,  0.86595f,
+             -0.39636f, -0.27888f, -0.40244f, 0.09847f,  0.81178f,  -0.45313f,
+             1.39127f,  0.99865f,  -0.57908f, 0.55072f,  0.49638f,  1.11524f,
+             1.85504f,  -0.28316f, -0.05195f, -0.23284f, 0.26461f,  -1.28120f,
+             0.60707f,  -0.06110f, 0.74085f,  0.63304f,  0.71765f,  1.40400f,
+             0.32221f,  3.07234f },
+  /* BLOCK_16X16 */
+  (float[]){ 1.26592f,  1.36313f,  1.30956f,  1.29926f,  1.48816f,  1.68851f,
+             1.32000f,  0.13321f,  -0.22477f, -0.88906f, -0.19622f, 1.69605f,
+             1.22180f,  -1.57771f, -1.15765f, 0.05710f,  -1.13355f, -0.85486f,
+             -0.99971f, -0.91571f, -1.06031f, -0.77952f, -1.15723f, 1.17809f,
+             1.35602f,  -0.05243f, -0.37596f, 0.26108f,  0.17611f,  -0.10323f,
+             0.77279f,  -0.48911f, -0.79308f, 0.55112f,  0.43918f,  0.27872f,
+             0.28714f,  0.45830f,  1.05689f,  0.03705f,  -2.49975f, -0.01940f,
+             0.05709f,  0.07942f,  -0.13290f, -0.10359f, 0.00143f,  0.37303f,
+             0.96470f,  0.53293f,  1.14459f,  0.89185f,  0.43378f,  0.47764f,
+             0.90924f,  0.15279f,  -0.15361f, 0.02949f,  0.42240f,  0.68143f,
+             0.89588f,  0.73754f,  0.10974f,  1.57755f,  -0.39870f, -0.32914f,
+             0.35638f,  0.34991f,  -0.00003f, -0.23373f, 0.29630f,  -0.76699f,
+             -0.01356f, 0.04234f,  0.84253f,  1.92078f,  0.93160f,  0.71993f,
+             0.71604f,  0.76455f,  -1.59782f, 0.32332f,  1.11628f,  0.33062f,
+             -0.03728f, -0.05710f, 0.80447f,  -0.14719f, 1.34658f,  -0.05718f,
+             0.64015f,  0.21926f,  0.41653f,  0.12720f,  0.54092f,  1.39411f,
+             1.81819f,  -0.24513f, 0.00955f,  0.38011f,  -0.57787f, -0.41759f,
+             0.68834f,  -0.31783f, -0.40607f, -0.10107f, -0.79374f, 0.75599f,
+             -0.16282f, -0.14490f, -0.20783f, -0.55019f, -0.13793f, -0.22293f,
+             0.18305f,  0.12445f,  0.56830f,  0.24567f,  0.09278f,  0.70803f,
+             0.35803f,  -1.52676f, -0.89624f, 0.77665f,  0.19877f,  0.77175f,
+             0.50355f,  0.08592f,  -1.31834f, 0.14346f,  -0.10062f, 0.84489f,
+             0.95617f,  -0.06720f, -0.68502f, -0.91442f, -0.31932f, 0.25276f,
+             -0.15138f, -1.57661f, -0.14062f, -0.42120f, 0.94573f,  -0.09287f,
+             -1.80333f, -1.06353f, 0.55139f,  0.74644f,  0.13747f,  -0.93018f,
+             -0.10286f, 0.67133f,  0.24460f,  1.44583f,  0.02173f,  0.26037f,
+             -0.73687f, 0.19566f,  0.61846f,  -0.58601f, -1.03196f, -0.74415f,
+             0.30041f,  -0.41967f, 1.08740f,  0.96224f,  -0.59139f, 0.03813f,
+             0.05403f,  1.33427f,  -0.54375f, -1.92181f, 0.54704f,  0.13608f,
+             0.22151f,  -0.38076f, 1.18390f,  -0.77508f, -1.84283f, 1.00894f,
+             0.62318f,  -0.15296f, 1.27600f,  0.22822f,  0.12751f,  0.93910f,
+             -0.28502f, 0.53912f,  -0.96889f, 0.10182f,  0.81508f,  -0.43028f,
+             2.67386f,  0.52204f,  0.49820f,  -0.41711f, 1.05038f,  1.12192f,
+             0.74349f,  -0.75417f, -0.03718f, -0.35769f, 0.89651f,  0.63236f,
+             0.54215f,  -0.07894f, 0.48274f,  1.08829f,  0.81986f,  1.26865f,
+             0.11118f,  2.48404f },
+  /* BLOCK_16X32 */
+  (float[]){ 0.30140f,  0.39406f,  -0.19744f, -0.10104f, 2.42411f,  0.89819f,
+             0.27560f,  0.08046f,  -0.30775f, -0.93515f, -0.13412f, 1.23948f,
+             0.15424f,  -1.29600f, -0.96712f, -0.00516f, -1.30380f, -1.12473f,
+             -1.19137f, -1.19748f, -1.15924f, -1.04546f, -1.59570f, 0.66358f,
+             0.39689f,  0.96537f,  0.88150f,  0.43628f,  -0.22878f, -0.34508f,
+             0.23692f,  0.24525f,  -0.11620f, 0.36959f,  -0.15445f, -0.17937f,
+             0.45886f,  0.90869f,  1.28246f,  1.25333f,  -2.06164f, 0.68766f,
+             0.36063f,  -0.14759f, -0.25263f, -0.40648f, -0.17043f, 0.08319f,
+             1.56421f,  1.54225f,  1.68978f,  1.65009f,  1.45687f,  1.66145f,
+             1.58078f,  0.02850f,  -0.24267f, 0.06681f,  -0.22073f, -0.29346f,
+             0.08393f,  0.08711f,  0.15048f,  0.55734f,  -0.07409f, 0.09503f,
+             -0.04849f, -0.20602f, 0.09664f,  -0.08754f, 0.11868f,  -1.40413f,
+             0.09535f,  0.45622f,  0.69816f,  1.37175f,  2.51363f,  0.97103f,
+             0.47842f,  1.42278f,  -0.24650f, 0.54641f,  0.16362f,  0.46940f,
+             0.05521f,  -0.14445f, 0.09255f,  -0.53930f, 2.41176f,  -0.61636f,
+             0.28043f,  0.00225f,  0.21527f,  -0.03092f, 0.25363f,  0.94178f,
+             2.45706f,  -0.16060f, 0.23327f,  -0.34139f, -0.08324f, -1.00550f,
+             -0.20040f, 0.47350f,  -0.28356f, -0.07268f, -0.55303f, 0.57731f,
+             -0.09676f, -0.09871f, -0.14537f, -0.38874f, -0.77735f, 0.03828f,
+             0.05054f,  -0.07838f, -0.09850f, 0.05051f,  -0.09136f, 1.31964f,
+             -0.42404f, -3.08627f, -0.02612f, 0.02422f,  -0.00648f, 0.29391f,
+             0.13165f,  -0.06021f, -0.46698f, 0.27562f,  0.59268f,  0.75571f,
+             1.37102f,  0.20589f,  -1.45271f, -1.35846f, 0.35810f,  0.35364f,
+             -0.24357f, -0.95703f, -0.48689f, -0.21970f, 1.70975f,  0.14430f,
+             -0.20381f, -0.79014f, 0.89649f,  0.61071f,  0.54543f,  -0.91716f,
+             -1.81600f, 0.80135f,  0.48895f,  1.20584f,  0.02937f,  1.18019f,
+             -0.52189f, 0.15721f,  1.56998f,  -0.79806f, -0.43664f, -0.52996f,
+             1.06188f,  -0.16927f, 1.02203f,  1.08992f,  -1.34226f, 0.49381f,
+             0.33171f,  1.47611f,  0.07077f,  -1.81458f, 1.03734f,  0.10983f,
+             0.73986f,  0.06257f,  -0.04044f, -0.58245f, -2.52539f, 1.01150f,
+             1.25570f,  -0.62696f, 1.39118f,  -0.03495f, 0.34744f,  1.33131f,
+             0.05457f,  1.00802f,  -0.42181f, 0.08927f,  0.44150f,  0.15936f,
+             1.66295f,  1.14283f,  0.66050f,  0.21840f,  1.19783f,  0.95851f,
+             2.93831f,  -0.17926f, -0.92622f, -0.53891f, 0.15700f,  -0.32312f,
+             1.01730f,  -0.11783f, 1.13293f,  2.38684f,  0.62542f,  1.60172f,
+             0.62130f,  3.11771f },
+  /* BLOCK_32X16 */
+  (float[]){ -0.07289f, 0.30798f,  0.41881f,  0.33434f,  -0.01599f, 0.85307f,
+             -0.16060f, -0.07922f, -0.04693f, 0.29186f,  0.44117f,  1.02417f,
+             0.12447f,  0.46321f,  0.40060f,  0.50140f,  0.48338f,  0.47298f,
+             0.36585f,  0.42821f,  0.41289f,  0.47534f,  0.42900f,  0.26061f,
+             0.45887f,  0.38163f,  0.17302f,  1.00888f,  1.79910f,  1.36140f,
+             0.24471f,  0.04557f,  1.10823f,  0.74325f,  0.91210f,  0.81387f,
+             0.98865f,  -0.09874f, 0.55146f,  0.19385f,  -0.50752f, -0.17249f,
+             0.27261f,  -0.02763f, -0.03286f, 0.09122f,  0.07015f,  0.20012f,
+             0.68983f,  -1.25345f, -0.00145f, 0.71567f,  0.54948f,  -0.56154f,
+             -0.28918f, 0.11997f,  -0.09907f, 0.09195f,  0.05768f,  0.15558f,
+             0.11284f,  -0.35195f, -0.08723f, -0.03571f, 0.94031f,  0.63737f,
+             0.98202f,  0.93826f,  0.87126f,  0.88530f,  0.97697f,  0.55283f,
+             0.58670f,  0.86502f,  0.97008f,  0.99709f,  0.66214f,  0.96660f,
+             0.99890f,  0.31945f,  -1.00301f, 0.13215f,  -0.03950f, 0.21148f,
+             0.05128f,  0.10955f,  0.44839f,  -0.33438f, -2.09773f, 0.13908f,
+             0.58669f,  0.25268f,  -0.24006f, 0.01286f,  -0.05732f, 0.03401f,
+             -0.06896f, 0.35397f,  0.05133f,  -0.21449f, -0.38437f, -0.32326f,
+             -0.38731f, -0.44419f, 0.25968f,  -0.29422f, -0.12553f, -0.08896f,
+             -0.16400f, -0.22309f, 0.21380f,  -0.26912f, 0.06866f,  -0.25694f,
+             0.17632f,  0.32032f,  -0.10666f, 0.26278f,  0.31877f,  -0.09338f,
+             -0.14289f, 0.54232f,  0.46070f,  0.00059f,  -0.27914f, 0.45177f,
+             0.16274f,  -0.08811f, -0.45791f, 0.53946f,  -0.16794f, 0.16229f,
+             0.11840f,  -0.24435f, 0.26894f,  -0.33180f, -0.47314f, 0.34061f,
+             -0.13939f, 0.13321f,  -0.05208f, -0.18139f, -0.35234f, 1.37298f,
+             -0.19360f, 0.21728f,  0.26088f,  0.04045f,  -0.10763f, -0.40470f,
+             0.50026f,  -0.06726f, -0.12871f, -0.20963f, -0.14583f, -0.04711f,
+             -0.35988f, 0.03091f,  0.06491f,  -0.31668f, -0.52190f, 0.23397f,
+             -0.13984f, -0.15207f, -0.49977f, 0.51205f,  0.12559f,  -0.03631f,
+             0.33447f,  -0.36684f, 0.17533f,  0.15671f,  -0.00096f, 0.06817f,
+             0.20922f,  0.34006f,  0.71260f,  0.45024f,  0.53033f,  0.15645f,
+             0.76019f,  0.56870f,  0.83066f,  0.63022f,  1.74436f,  -0.24798f,
+             0.06795f,  -0.00749f, 0.17795f,  0.10371f,  0.06527f,  0.41054f,
+             0.49003f,  0.34630f,  0.02615f,  0.30320f,  -0.47133f, -0.49584f,
+             0.21775f,  0.27530f,  -0.29977f, -0.64269f, 0.52627f,  -0.02492f,
+             0.08077f,  0.40786f,  -0.36015f, -0.70714f, -1.98185f, -0.28187f,
+             0.35018f,  -0.06105f, -0.12710f, 0.06606f,  -0.27805f, 0.44630f,
+             -0.84731f, -0.26699f, 0.25856f,  0.06194f,  -0.18674f, -0.11560f,
+             -0.43277f, 1.10579f,  0.95876f,  0.17415f,  0.56386f,  0.68426f,
+             0.50180f,  0.24844f,  0.12347f,  0.15281f,  -0.19089f, 0.52279f,
+             0.41860f,  -0.05270f, -0.17029f, -0.03542f, 0.10621f,  -0.25088f,
+             0.24070f,  -0.08951f, 0.29950f,  -0.36720f, 0.02151f,  0.20129f,
+             -0.70066f, -0.23144f, -0.20070f, -0.39262f, -0.01597f, -0.05591f,
+             0.23814f,  -0.25991f, 0.05812f,  0.60554f,  -0.06106f, -0.58326f,
+             0.28762f,  -0.18747f, 0.08232f,  -0.04243f, -0.03293f, 0.14722f,
+             -0.13017f, -0.67263f, 0.38698f,  -0.18207f, -0.11496f, -0.27976f,
+             -0.55345f, 1.42872f,  0.04684f,  0.04214f,  0.00030f,  0.02410f,
+             0.19966f,  -0.04246f, 0.00442f,  0.23121f,  0.13364f,  0.21548f,
+             -0.12748f, -0.14066f, -0.28354f, 0.59937f,  -0.27553f, 1.57503f,
+             -0.01050f, -0.17724f, 0.44110f,  -0.80334f, 0.72064f,  1.00501f,
+             -0.72638f, 0.02774f,  0.48540f,  -0.72016f, -0.27721f, 0.31559f,
+             0.07322f,  0.20279f,  -0.19647f, 0.02352f,  0.12662f,  0.19743f,
+             0.30543f,  0.25712f,  0.44702f,  0.16417f,  0.17888f,  -2.58469f,
+             0.20555f,  0.57782f,  -0.10892f, 0.14527f,  0.82251f,  0.04200f,
+             0.44626f,  0.10818f,  0.71204f,  0.62903f,  0.69178f,  0.73603f,
+             0.52717f,  0.83020f,  0.48824f,  1.03270f,  -0.00152f, 0.07958f,
+             0.24181f,  -0.78839f, -0.74214f, -0.72998f, -1.58694f, 0.17735f,
+             0.56318f,  0.32580f,  -0.58503f, -0.33673f, -0.00838f, 0.48924f,
+             0.43362f,  0.12750f,  0.00295f,  0.38624f,  0.17037f,  0.00729f,
+             -0.26256f, -0.41669f, 0.36847f,  0.22424f,  1.33334f,  0.18112f,
+             0.37682f,  0.49173f,  -0.45240f, -0.04857f, -0.35038f, -0.83099f,
+             -0.01988f, 0.03497f,  0.38033f,  0.13685f,  0.17597f,  0.28668f,
+             0.31193f,  -0.43281f, 0.43267f,  -0.50495f, 0.01969f,  0.14131f,
+             -0.09326f, -0.39425f, -0.62048f, -0.09119f, -0.28306f, -0.52671f,
+             -0.38584f, -0.10953f, 0.19669f,  0.34540f,  -0.49941f, 0.04605f,
+             -0.43535f, 0.27519f,  0.03659f,  -0.31961f, 0.13330f,  0.87009f,
+             0.20101f,  -0.70392f, -0.27883f, 0.33874f,  -0.34308f, 0.67760f,
+             0.88195f,  0.55752f,  -0.26563f, 0.17875f,  0.06964f,  0.87607f,
+             1.47616f,  0.46747f,  -0.56408f, -0.39352f, -0.16427f, -0.41185f,
+             0.14187f,  0.19265f,  -0.58613f, 0.56345f,  -0.17729f, -0.11320f,
+             0.08752f,  -0.01329f, 1.20981f,  0.45170f,  -0.20571f, -0.01150f,
+             0.26476f,  0.13508f,  0.22020f,  -0.42684f, -0.22499f, -1.51212f,
+             0.86648f,  0.21776f,  0.24666f,  0.71339f,  0.42742f,  -0.00952f,
+             0.14762f,  0.07693f,  -0.19599f, 0.03075f,  -0.09703f, -0.32483f,
+             -0.11616f, -0.40461f, -0.11693f, 0.10038f,  -0.30038f, 0.14686f,
+             0.00548f,  0.20350f,  0.00763f,  -0.43756f, -0.01997f, 0.00902f,
+             0.07470f,  -0.41441f, -0.20605f, 0.07626f,  -0.34973f, 0.47455f,
+             -0.15251f, -0.05325f, 0.04964f,  0.32477f,  -0.54604f, 0.25273f,
+             -0.18461f, -0.30841f, 0.64908f,  0.60752f,  0.64148f,  0.72788f,
+             0.71232f,  0.58597f,  0.73017f,  0.58857f,  0.71908f,  0.59860f,
+             0.61849f,  0.99398f,  0.39572f,  -0.36165f, -1.88646f, 0.14384f,
+             -0.60541f, -0.21380f, -0.55498f, -0.50960f, -0.08801f, 0.51892f,
+             0.19126f,  0.57879f,  1.19447f,  0.25673f,  -0.21631f, -0.43562f,
+             -0.27497f, -0.02206f, -0.56169f, 0.58952f,  -0.60983f, -0.64088f,
+             -0.69087f, -0.56261f, -0.74089f, -0.65063f, -0.66978f, -0.60836f,
+             -0.92770f, -0.77182f, -1.61031f, -0.70007f, -0.68402f, -0.42242f,
+             -0.66722f, -0.14533f, 1.53781f,  -0.49320f, -0.31646f, 0.02826f,
+             -1.05554f, 0.06559f,  -0.12399f, -0.61671f, -0.28956f, -0.15419f,
+             0.87189f,  -0.43375f, -1.08477f, -0.66006f, 0.36233f,  0.82678f,
+             -0.92342f, -1.47101f, -0.02937f, -0.16497f, -0.75457f, 0.50173f,
+             -0.07560f, 0.71598f,  1.50795f,  -0.04745f, -0.14008f, -0.18510f,
+             -0.14988f, -0.67044f, 0.79659f,  0.70610f,  0.84983f,  -0.62530f,
+             -0.82600f, -0.52563f, -0.11942f, -0.50279f, -0.13425f, -0.02850f,
+             0.50767f,  0.10252f,  0.24540f,  0.67748f,  -0.43483f, -0.22242f,
+             0.23431f,  0.57287f,  0.69560f,  1.13814f,  -0.47427f, -0.55858f,
+             -1.47072f, 0.26587f,  -0.36335f, 0.83060f,  1.01645f,  -0.52895f,
+             -0.11614f, 0.17390f,  -0.13664f, -0.83098f, -0.07985f, -1.36820f,
+             0.47759f,  -0.55612f, 0.46852f,  0.07406f,  -0.80467f, 0.23059f,
+             0.09992f,  -0.06164f, 0.13541f,  0.06135f,  0.83605f,  -0.53224f,
+             -0.13867f, 0.93838f,  -0.61290f, 0.27732f,  -0.46688f, -0.41810f,
+             0.12885f,  0.13619f,  -0.24612f, 0.07215f,  0.98866f,  0.10993f,
+             1.05799f,  -0.27146f, -0.00079f, -0.08585f, 0.08322f,  -0.33809f,
+             0.67598f,  -1.06515f, 1.28866f,  0.61028f,  -0.31704f, -0.59905f,
+             1.62151f,  0.10969f,  0.20671f,  -0.17818f, 0.14170f,  0.19322f,
+             0.30602f,  0.93111f,  0.19011f,  -0.45609f, 0.82506f,  0.32936f,
+             -0.07858f, -0.27106f, -0.31638f, 0.23299f,  0.81491f,  0.32584f,
+             -0.52093f, -0.32472f, 0.53643f,  -0.42605f, 0.01641f,  0.09002f,
+             0.15832f,  -0.08790f, 0.05511f,  1.00730f,  0.46309f,  0.68166f,
+             -0.18835f, 0.64512f,  -1.00540f, 0.86802f,  0.18981f,  -0.06982f,
+             -0.24514f, -0.08027f, 0.61199f,  -0.20830f, 0.72001f,  0.17477f,
+             0.06511f,  0.00801f,  -0.43590f, 0.37257f,  0.70323f,  0.60233f,
+             1.62541f,  0.74383f,  -0.22254f, -0.33892f, 0.22881f,  0.62817f,
+             0.68915f,  -0.06417f, 0.00969f,  1.65869f,  0.89060f,  0.75948f,
+             0.95359f,  1.56043f,  1.06017f,  2.54520f },
+};
+static const int av1_prune_2D_num_hidden_units_ver[9] = { 8,  16, 8,  16, 16,
+                                                          16, 16, 32, 16 };
+static const float *av1_prune_2D_learned_weights_ver[9] = {
+  /* BLOCK_4X4 */
+  (float[]){ 0.72406f,  -0.40019f, 0.51795f,  -0.43881f, -0.49746f, -0.41780f,
+             -0.39409f, -0.16183f, -1.00135f, -0.41733f, -0.96534f, 0.93272f,
+             1.06229f,  0.04188f,  0.60919f,  0.92405f,  -0.39359f, 0.70570f,
+             0.75375f,  1.11966f,  -1.86360f, -0.35421f, 0.18743f,  0.13346f,
+             -0.21262f, 0.07050f,  0.10533f,  -0.47402f, 1.33417f,  1.72899f,
+             1.17983f,  0.10552f,  1.96273f,  -0.69845f, -0.10999f, -1.11311f,
+             1.35101f,  0.43842f,  -0.29264f, -1.15376f, 0.79770f,  0.08520f,
+             0.23298f,  0.05285f,  0.87506f,  -0.90784f, -0.06197f, -1.00580f,
+             0.68639f,  -0.34881f, 0.15366f,  -1.64658f, 0.80755f,  -0.26293f,
+             0.10253f,  -0.23915f, 1.14696f,  -0.10928f, -1.61377f, 0.00863f,
+             0.98599f,  -0.43872f, 0.61196f,  -0.03787f, 1.01060f,  0.17643f,
+             -0.00208f, -0.15738f, 0.06517f,  0.72885f,  0.24387f,  1.28535f,
+             1.23769f,  1.40308f,  0.09871f,  1.82070f },
+  /* BLOCK_4X8 */
+  (float[]){ 0.88859f,  1.02796f,  1.15509f,  0.61719f,  0.85804f,  1.17581f,
+             0.93524f,  0.06546f,  0.08018f,  -0.78562f, -0.36614f, 0.14149f,
+             -0.30069f, -0.52647f, -0.82789f, 0.60527f,  -1.74026f, -0.20271f,
+             0.09875f,  0.03708f,  0.09430f,  -0.24043f, -0.38433f, 1.21014f,
+             1.42443f,  0.69586f,  1.07812f,  1.21748f,  1.10989f,  0.93122f,
+             1.04127f,  0.39424f,  0.95592f,  0.12904f,  0.46330f,  0.49722f,
+             0.46303f,  0.36979f,  0.60227f,  0.39345f,  -2.01632f, -0.05706f,
+             0.07766f,  -0.01271f, -0.16577f, -0.21957f, -0.14800f, 0.24898f,
+             0.27662f,  0.42028f,  0.44748f,  1.14585f,  1.38805f,  0.46182f,
+             -0.22982f, -0.07324f, 0.29886f,  -0.46959f, -0.04228f, -0.01064f,
+             0.24260f,  -0.32282f, -0.23804f, 1.44466f,  -0.42190f, -0.36385f,
+             0.39746f,  0.38557f,  -0.09624f, -0.21540f, 0.57385f,  -0.72878f,
+             -0.39677f, -0.00717f, 0.60499f,  1.33849f,  1.05337f,  1.11947f,
+             0.38487f,  0.86534f,  -0.33970f, 0.71140f,  0.20772f,  0.61132f,
+             0.06181f,  -0.20027f, 0.13736f,  -0.72321f, 0.64586f,  -0.56740f,
+             -0.90912f, -0.20452f, 0.15381f,  -0.84346f, 0.19550f,  0.63164f,
+             1.35441f,  0.63218f,  0.82883f,  0.38803f,  -0.23874f, -0.02962f,
+             0.23846f,  -0.06822f, -0.40159f, -0.17850f, -0.69524f, 1.12299f,
+             -0.08286f, -0.14150f, -0.28456f, -0.41519f, -0.12792f, -0.55286f,
+             0.51655f,  0.06636f,  0.73759f,  0.70072f,  0.12616f,  0.31282f,
+             0.17130f,  -1.34233f, 0.37221f,  0.95838f,  0.16286f,  1.04301f,
+             0.73600f,  -0.11233f, -0.89131f, 0.09124f,  -0.71678f, -1.19929f,
+             0.98963f,  0.16896f,  -0.44943f, -0.97532f, -0.13997f, 1.07136f,
+             -0.46362f, -0.45253f, -0.63015f, -0.20008f, 1.24048f,  -0.21265f,
+             -0.79795f, 0.45973f,  -0.54188f, -1.05095f, 0.64404f,  -0.56470f,
+             -0.57018f, 0.61644f,  0.50229f,  1.14006f,  0.13805f,  -0.42058f,
+             -0.07468f, 0.66203f,  0.93180f,  -0.59662f, -0.25152f, 0.00336f,
+             1.09769f,  -1.11921f, 0.15151f,  0.58750f,  -0.42480f, -0.95908f,
+             -0.10980f, 1.31715f,  0.06665f,  -0.52371f, 0.37228f,  -0.12364f,
+             0.54876f,  -0.32698f, 0.39863f,  -0.97669f, -1.06351f, 1.82755f,
+             1.02851f,  0.10322f,  -0.08322f, 0.08891f,  -0.05715f, 0.93503f,
+             0.02096f,  -0.39506f, -0.99330f, -0.09407f, 0.75108f,  -0.30104f,
+             1.78314f,  -0.01786f, -0.17392f, 0.00461f,  0.41394f,  0.92566f,
+             1.11251f,  -0.71380f, -0.04907f, 0.12736f,  0.00208f,  0.94451f,
+             -0.31783f, -0.19655f, 0.64619f,  0.50359f,  0.39274f,  1.27276f,
+             0.30322f,  2.55238f },
+  /* BLOCK_8X4 */
+  (float[]){ 0.81919f,  0.15527f,  0.60055f,  -0.54617f, -0.35510f, -0.28223f,
+             -0.20478f, 0.15001f,  -1.84806f, -0.30274f, -0.00865f, 0.33939f,
+             1.11970f,  0.44630f,  0.32074f,  0.39637f,  0.08149f,  1.28070f,
+             0.86703f,  0.76503f,  -1.83991f, -1.13575f, -0.68605f, -0.23690f,
+             0.07099f,  0.64960f,  0.82543f,  -0.72028f, 0.08220f,  0.34338f,
+             0.20245f,  -0.88920f, 1.14995f,  -0.16021f, 2.38325f,  -0.65179f,
+             1.09624f,  1.07662f,  0.63837f,  -0.64847f, 0.10278f,  0.06819f,
+             1.73885f,  1.29889f,  -0.18482f, -1.06132f, 0.67003f,  -0.23280f,
+             0.50181f,  -0.33890f, 0.43524f,  -1.03147f, 1.09640f,  0.66332f,
+             0.47652f,  -0.02251f, 0.94245f,  -0.03861f, 0.84776f,  0.28377f,
+             0.92044f,  0.23572f,  0.52082f,  -0.16266f, 0.45290f,  0.11342f,
+             -0.50310f, -0.92633f, 1.46345f,  1.84714f,  1.06804f,  -0.13610f,
+             2.41028f,  1.95675f,  0.82387f,  2.41923f },
+  /* BLOCK_8X8 */
+  (float[]){ 0.98214f,  1.05643f,  0.91173f,  0.24165f,  0.39961f,  0.25736f,
+             0.68593f,  0.10553f,  0.13353f,  -0.49687f, -1.66413f, 1.16584f,
+             2.25147f,  -0.72247f, -2.65486f, -0.03628f, -1.47746f, -1.07644f,
+             -1.25551f, -0.91260f, -1.26199f, -1.06022f, -1.42138f, 1.10500f,
+             2.96552f,  -0.40638f, 0.02258f,  -0.23137f, 0.34922f,  -0.01454f,
+             0.41251f,  0.35944f,  -1.56742f, 0.01406f,  0.88114f,  1.42462f,
+             0.87243f,  0.02439f,  0.07035f,  0.34303f,  -3.16843f, 0.25798f,
+             0.07494f,  0.38926f,  -0.12267f, 0.09049f,  -0.36711f, 0.01551f,
+             1.41269f,  1.33505f,  1.43627f,  1.41909f,  1.44605f,  1.43008f,
+             1.36721f,  0.19443f,  -0.08606f, 0.17285f,  0.63692f,  0.92092f,
+             0.61007f,  0.87100f,  -0.33631f, 1.98025f,  -0.40686f, -0.33808f,
+             0.34919f,  0.33817f,  -0.01807f, -0.25259f, 0.26442f,  -0.76979f,
+             1.07788f,  -1.38747f, 1.34315f,  2.79947f,  2.02838f,  -0.25062f,
+             0.00174f,  1.25888f,  0.17344f,  0.20897f,  1.28765f,  1.95749f,
+             1.62351f,  1.04556f,  0.43858f,  0.12463f,  1.66399f,  0.03971f,
+             0.36614f,  0.56932f,  0.15982f,  0.11587f,  0.21402f,  1.89386f,
+             -0.91267f, -0.79781f, 1.79155f,  0.60147f,  -0.90118f, -4.32718f,
+             -0.58154f, -0.02181f, -0.40734f, -0.11409f, -0.79470f, 0.69697f,
+             -0.16588f, -0.16090f, -0.21236f, -0.52776f, -0.64455f, 0.09173f,
+             0.80766f,  0.76097f,  0.20295f,  -0.93467f, -0.43509f, 0.59659f,
+             0.07788f,  -3.79459f, 0.16268f,  0.47343f,  0.05106f,  -0.24880f,
+             1.18941f,  0.10346f,  0.75780f,  0.25628f,  0.19911f,  -0.41384f,
+             1.33909f,  0.31498f,  -1.37171f, -1.09561f, -0.44056f, 0.49001f,
+             -0.65804f, -1.96031f, 0.64806f,  -0.52520f, 1.38838f,  0.15519f,
+             -0.63856f, -2.02670f, -0.92947f, 0.00216f,  1.47710f,  -2.01099f,
+             -2.11289f, -0.92288f, 0.19296f,  1.37866f,  -0.85975f, -0.78624f,
+             -2.10392f, 0.13976f,  1.06968f,  -2.04120f, 0.57991f,  -1.84941f,
+             -0.81512f, -2.08254f, -0.47334f, 0.12256f,  -1.39594f, -1.02829f,
+             0.06134f,  2.25646f,  -1.25196f, -2.65317f, -1.94473f, 0.10989f,
+             0.55446f,  -1.76557f, 0.33455f,  -1.85556f, -3.01878f, -0.25100f,
+             1.65520f,  -1.61409f, 1.16336f,  -1.15560f, 0.13631f,  1.50733f,
+             -1.07538f, -0.91200f, -1.93132f, 0.09271f,  0.24425f,  -1.80655f,
+             -0.01138f, -1.36421f, -0.62970f, -0.84766f, -0.34714f, -0.50531f,
+             1.91005f,  -1.60316f, -0.02495f, 1.04938f,  0.28411f,  -0.79809f,
+             -1.48232f, 0.00766f,  0.94016f,  -1.11974f, 0.53574f,  1.57736f,
+             -0.13698f, 2.64613f },
+  /* BLOCK_8X16 */
+  (float[]){ 0.90888f,  0.86305f,  0.81674f,  0.75352f,  1.07834f,  0.99048f,
+             0.96355f,  0.13836f,  -0.51334f, 0.19906f,  1.84608f,  0.67828f,
+             0.45876f,  0.08325f,  0.28190f,  -0.01958f, -1.96553f, 0.27837f,
+             -0.05929f, 0.13491f,  0.21036f,  0.05797f,  -0.01373f, 0.73765f,
+             1.39603f,  -0.53767f, 0.10362f,  0.03420f,  0.41909f,  0.09510f,
+             0.32284f,  0.83860f,  0.13954f,  0.48434f,  1.47762f,  0.45891f,
+             0.23613f,  0.13013f,  0.82097f,  -0.03251f, -1.89757f, 0.21589f,
+             -0.10370f, 0.02530f,  -0.25659f, 0.01466f,  -0.23661f, 0.22783f,
+             0.92100f,  1.02915f,  1.20358f,  1.17251f,  0.97749f,  1.04696f,
+             0.91333f,  0.54576f,  -0.52792f, 0.02217f,  0.25652f,  0.31405f,
+             -0.18398f, 0.04572f,  -0.81359f, 1.82883f,  -0.40047f, -0.33056f,
+             0.35255f,  0.34448f,  -0.00339f, -0.23857f, 0.28925f,  -0.77175f,
+             -0.24325f, -0.21420f, 1.11451f,  1.39553f,  0.51573f,  0.05476f,
+             1.13791f,  0.94959f,  -0.35710f, 0.67467f,  0.16722f,  0.61213f,
+             0.07683f,  -0.20613f, 0.13440f,  -0.72131f, -0.15418f, -0.17688f,
+             -0.16510f, -0.19226f, 0.09270f,  -2.43559f, -0.12669f, 0.05074f,
+             0.30414f,  0.00927f,  0.60630f,  0.00801f,  -1.07310f, -0.06227f,
+             2.10607f,  0.02382f,  -0.39891f, -0.09149f, -0.78596f, 0.83966f,
+             -0.14802f, -0.14083f, -0.20831f, -0.55136f, 0.08566f,  -0.00647f,
+             0.07044f,  0.53408f,  0.85720f,  -0.07393f, 0.24476f,  0.43767f,
+             0.30519f,  -1.89430f, 0.23252f,  1.63790f,  0.17316f,  -0.03903f,
+             0.25269f,  0.01562f,  -0.83370f, -0.20704f, -0.60437f, -0.81664f,
+             1.16998f,  0.16745f,  -1.34680f, -1.07083f, -0.34649f, 0.65598f,
+             -0.56278f, 0.22660f,  -0.25956f, -0.29608f, 1.24359f,  -0.09167f,
+             -0.71147f, -0.63964f, -0.69220f, 0.22326f,  0.67191f,  -0.58894f,
+             -0.98464f, 0.23583f,  0.22824f,  1.39838f,  0.09920f,  -0.59411f,
+             -0.67101f, 0.19088f,  0.83025f,  -0.66991f, -0.42889f, -0.49969f,
+             1.39532f,  -1.02000f, 0.62101f,  0.57175f,  -0.83226f, 0.01551f,
+             0.05604f,  1.23028f,  0.02030f,  -0.55995f, -0.42349f, 0.15375f,
+             0.52132f,  -0.52421f, 0.89586f,  -0.73778f, -0.10911f, 0.22447f,
+             1.16858f,  -0.48169f, 1.73890f,  -0.69860f, 0.12504f,  1.10492f,
+             0.04391f,  -0.85670f, -0.49257f, 0.09616f,  0.76518f,  -0.44854f,
+             1.50938f,  0.62246f,  -0.40366f, -0.11182f, -0.01680f, 0.59724f,
+             1.32170f,  -1.09061f, -0.04278f, -0.02449f, 0.25024f,  1.26239f,
+             0.42345f,  -0.10031f, 0.80871f,  0.44198f,  0.68329f,  1.33555f,
+             0.25943f,  3.23439f },
+  /* BLOCK_16X8 */
+  (float[]){ 1.20497f,  1.23691f,  1.23738f,  1.07773f,  1.15264f,  1.31959f,
+             1.15365f,  0.17179f,  0.68612f,  0.55636f,  0.57145f,  0.67022f,
+             0.19636f,  -1.27420f, -1.36428f, -0.16706f, -1.20934f, -0.87794f,
+             -0.97146f, -0.74722f, -1.14493f, -1.02689f, -0.88153f, 0.83857f,
+             1.53355f,  0.13601f,  0.35451f,  0.53750f,  0.62381f,  0.32438f,
+             0.59405f,  0.33090f,  -1.52948f, -0.46094f, 0.42634f,  0.48763f,
+             0.30707f,  0.52553f,  0.71427f,  -0.31287f, -2.37106f, -0.18756f,
+             0.16561f,  -0.00431f, -0.13747f, -0.09336f, -0.16511f, 0.13454f,
+             0.45010f,  -0.00317f, -0.06403f, 0.95442f,  1.59636f,  0.30602f,
+             -0.05515f, 0.05467f,  -0.21758f, -0.19192f, -0.17935f, -0.00545f,
+             0.35409f,  0.26141f,  -0.32174f, 1.78129f,  -0.40161f, -0.33158f,
+             0.38084f,  0.38081f,  0.01053f,  -0.23567f, 0.29239f,  -0.76159f,
+             -0.19373f, 0.13649f,  0.66949f,  1.19733f,  1.92557f,  1.16691f,
+             0.94955f,  0.62324f,  -0.85434f, -0.07699f, 0.87683f,  0.95911f,
+             0.86106f,  0.57959f,  0.40146f,  -0.35851f, 1.55427f,  0.15349f,
+             -0.01582f, 0.32517f,  0.03784f,  0.15916f,  0.09024f,  1.43187f,
+             0.56160f,  0.11521f,  0.52476f,  -0.26107f, -0.38167f, -0.31596f,
+             0.31304f,  -0.65366f, -0.40680f, -0.11082f, -0.78585f, 0.77906f,
+             -0.13322f, -0.13747f, -0.21001f, -0.53204f, -0.06752f, -0.84741f,
+             -0.53442f, -0.16284f, 0.54027f,  0.13586f,  -0.42001f, 0.85388f,
+             0.08300f,  -0.89325f, -1.73681f, -0.70473f, 0.23151f,  0.69549f,
+             0.72124f,  0.12769f,  -1.15644f, -0.31062f, 0.20697f,  -0.60304f,
+             -1.19498f, 0.21451f,  -0.42825f, -0.71800f, -0.25816f, 1.47408f,
+             -0.24423f, -1.45773f, -0.55834f, -0.36938f, 1.56759f,  0.07238f,
+             -1.45227f, -0.67141f, 0.75237f,  0.32681f,  -0.70528f, -0.76730f,
+             -0.49777f, 0.02418f,  0.25096f,  1.14840f,  0.23548f,  0.48755f,
+             0.33164f,  0.21050f,  1.41651f,  -0.28888f, -0.76668f, 0.04439f,
+             0.67538f,  -1.06438f, 0.68128f,  0.95824f,  0.08530f,  -0.03635f,
+             0.06820f,  1.38621f,  -0.50424f, -1.72992f, -0.20949f, 0.13400f,
+             0.93366f,  -0.05324f, 1.41593f,  -0.75119f, -1.80912f, 1.05440f,
+             0.62580f,  -0.30867f, -0.07025f, -0.34654f, 0.13621f,  1.74426f,
+             -0.22417f, 0.47031f,  -0.08142f, 0.10151f,  0.42498f,  0.06635f,
+             1.50623f,  1.04130f,  0.85107f,  0.23382f,  0.69800f,  1.10856f,
+             1.18767f,  -0.69395f, -0.07985f, 0.50412f,  0.46019f,  0.49214f,
+             0.44219f,  -0.09502f, 0.75745f,  0.99208f,  0.68774f,  0.88572f,
+             0.77462f,  3.05667f },
+  /* BLOCK_16X16 */
+  (float[]){ 1.26592f,  1.36313f,  1.30956f,  1.29926f,  1.48816f,  1.68851f,
+             1.32000f,  0.13321f,  -0.22477f, -0.88906f, -0.19622f, 1.69605f,
+             1.22180f,  -1.57771f, -1.15765f, 0.05710f,  -1.13355f, -0.85486f,
+             -0.99971f, -0.91571f, -1.06031f, -0.77952f, -1.15723f, 1.17809f,
+             1.35602f,  -0.05243f, -0.37596f, 0.26108f,  0.17611f,  -0.10323f,
+             0.77279f,  -0.48911f, -0.79308f, 0.55112f,  0.43918f,  0.27872f,
+             0.28714f,  0.45830f,  1.05689f,  0.03705f,  -2.49975f, -0.01940f,
+             0.05709f,  0.07942f,  -0.13290f, -0.10359f, 0.00143f,  0.37303f,
+             0.96470f,  0.53293f,  1.14459f,  0.89185f,  0.43378f,  0.47764f,
+             0.90924f,  0.15279f,  -0.15361f, 0.02949f,  0.42240f,  0.68143f,
+             0.89588f,  0.73754f,  0.10974f,  1.57755f,  -0.39870f, -0.32914f,
+             0.35638f,  0.34991f,  -0.00003f, -0.23373f, 0.29630f,  -0.76699f,
+             -0.01356f, 0.04234f,  0.84253f,  1.92078f,  0.93160f,  0.71993f,
+             0.71604f,  0.76455f,  -1.59782f, 0.32332f,  1.11628f,  0.33062f,
+             -0.03728f, -0.05710f, 0.80447f,  -0.14719f, 1.34658f,  -0.05718f,
+             0.64015f,  0.21926f,  0.41653f,  0.12720f,  0.54092f,  1.39411f,
+             1.81819f,  -0.24513f, 0.00955f,  0.38011f,  -0.57787f, -0.41759f,
+             0.68834f,  -0.31783f, -0.40607f, -0.10107f, -0.79374f, 0.75599f,
+             -0.16282f, -0.14490f, -0.20783f, -0.55019f, -0.13793f, -0.22293f,
+             0.18305f,  0.12445f,  0.56830f,  0.24567f,  0.09278f,  0.70803f,
+             0.35803f,  -1.52676f, -0.89624f, 0.77665f,  0.19877f,  0.77175f,
+             0.50355f,  0.08592f,  -1.31834f, 0.14346f,  -0.10062f, 0.84489f,
+             0.95617f,  -0.06720f, -0.68502f, -0.91442f, -0.31932f, 0.25276f,
+             -0.15138f, -1.57661f, -0.14062f, -0.42120f, 0.94573f,  -0.09287f,
+             -1.80333f, -1.06353f, 0.55139f,  0.74644f,  0.13747f,  -0.93018f,
+             -0.10286f, 0.67133f,  0.24460f,  1.44583f,  0.02173f,  0.26037f,
+             -0.73687f, 0.19566f,  0.61846f,  -0.58601f, -1.03196f, -0.74415f,
+             0.30041f,  -0.41967f, 1.08740f,  0.96224f,  -0.59139f, 0.03813f,
+             0.05403f,  1.33427f,  -0.54375f, -1.92181f, 0.54704f,  0.13608f,
+             0.22151f,  -0.38076f, 1.18390f,  -0.77508f, -1.84283f, 1.00894f,
+             0.62318f,  -0.15296f, 1.27600f,  0.22822f,  0.12751f,  0.93910f,
+             -0.28502f, 0.53912f,  -0.96889f, 0.10182f,  0.81508f,  -0.43028f,
+             2.67386f,  0.52204f,  0.49820f,  -0.41711f, 1.05038f,  1.12192f,
+             0.74349f,  -0.75417f, -0.03718f, -0.35769f, 0.89651f,  0.63236f,
+             0.54215f,  -0.07894f, 0.48274f,  1.08829f,  0.81986f,  1.26865f,
+             0.11118f,  2.48404f },
+  /* BLOCK_16X32 */
+  (float[]){ -0.01219f, 0.51494f,  0.25450f,  0.45788f,  -0.87277f, 0.32954f,
+             -0.04851f, -0.24321f, -0.40000f, 0.21915f,  0.14108f,  0.98268f,
+             0.18989f,  0.54298f,  0.36349f,  0.38931f,  1.08124f,  0.87199f,
+             1.03553f,  1.14777f,  1.04254f,  1.11336f,  0.92198f,  0.84715f,
+             1.89363f,  1.21587f,  0.72377f,  1.25097f,  0.84231f,  0.95529f,
+             1.12346f,  0.19113f,  -0.04559f, 0.56859f,  0.59747f,  0.60176f,
+             0.82465f,  0.59009f,  0.67240f,  1.58674f,  -0.92951f, -0.23449f,
+             0.11923f,  -0.19151f, -0.15914f, 0.03146f,  -0.16541f, 0.17181f,
+             -0.21834f, 0.21906f,  0.96708f,  0.36085f,  -0.42380f, -2.25681f,
+             -0.48812f, 0.72875f,  0.06585f,  0.18818f,  -0.02109f, -0.10996f,
+             0.00187f,  -0.02078f, 0.04484f,  -0.07171f, 0.94773f,  -0.33466f,
+             0.28484f,  0.14791f,  0.30274f,  0.13377f,  0.40970f,  0.45133f,
+             1.69265f,  -0.36422f, -0.15889f, 0.07670f,  0.44675f,  -0.28665f,
+             -0.07097f, 1.03803f,  -0.83274f, -0.24571f, 0.08039f,  -0.23790f,
+             -0.23276f, -0.28031f, 0.26451f,  -0.18513f, -2.23336f, -0.62073f,
+             0.32495f,  -0.67644f, -0.08559f, -0.36382f, -0.24515f, -0.01899f,
+             0.09012f,  0.19723f,  0.04017f,  0.31624f,  0.58369f,  0.30411f,
+             -0.81165f, -2.58541f, -0.20491f, 0.68089f,  -0.14799f, 0.13925f,
+             0.12867f,  0.15229f,  0.06887f,  -0.03784f, 0.02288f,  -0.28712f,
+             0.14107f,  0.29485f,  -0.11662f, 0.25239f,  0.30311f,  -0.07377f,
+             -0.10962f, 0.59856f,  0.47967f,  0.01847f,  -0.27889f, 0.46786f,
+             0.18118f,  0.09355f,  -2.10076f, 0.38823f,  0.28202f,  0.29104f,
+             0.86977f,  0.52377f,  0.21161f,  0.72888f,  -0.00952f, 0.15982f,
+             -0.14651f, 0.28763f,  -0.14155f, 0.00093f,  0.08351f,  0.34685f,
+             -0.22066f, 0.20378f,  0.25416f,  0.03423f,  -0.11068f, -0.41612f,
+             0.56913f,  -0.06697f, -0.12585f, -0.21033f, -0.14513f, -0.04477f,
+             -0.35778f, 0.03437f,  0.06956f,  -0.25356f, -1.46010f, -0.08142f,
+             0.11926f,  -0.63551f, -0.13882f, 0.34164f,  0.10821f,  1.07323f,
+             -0.62435f, -0.27116f, 0.25971f,  0.11952f,  -0.39480f, -0.05474f,
+             -0.12582f, 0.28289f,  0.13723f,  0.58369f,  0.41865f,  0.28574f,
+             1.01357f,  0.46661f,  0.61717f,  0.85708f,  -0.03930f, -0.38013f,
+             -0.33888f, -0.20561f, -0.19087f, -0.01041f, 0.12119f,  -0.20786f,
+             0.55915f,  0.67511f,  0.55554f,  0.56540f,  0.76647f,  0.54766f,
+             0.45166f,  0.61384f,  0.95407f,  -0.06811f, -0.62132f, 0.12713f,
+             0.63713f,  2.04090f,  1.17054f,  0.00469f,  -0.93692f, -0.24136f,
+             -0.04281f, -0.15787f, 0.37956f,  -0.09174f, -0.72494f, 0.55285f,
+             -1.40996f, -0.54077f, 0.38445f,  -0.08258f, 0.64259f,  -0.54058f,
+             -0.49865f, 1.41371f,  0.89014f,  0.78788f,  0.37919f,  0.87447f,
+             -0.00760f, -0.00947f, 0.16323f,  -0.36632f, -1.38115f, -0.24619f,
+             0.40490f,  -0.08871f, -0.25365f, -0.60842f, 0.11128f,  0.18658f,
+             -0.86001f, -0.28271f, 0.39572f,  -0.29930f, -0.10110f, 0.33706f,
+             0.21731f,  0.15383f,  -0.01707f, 0.02812f,  0.31192f,  0.39742f,
+             0.38260f,  -0.48263f, 0.57385f,  0.53239f,  -0.60013f, -0.63211f,
+             -0.45140f, -0.73520f, -0.95260f, -0.70633f, -0.96190f, 0.01747f,
+             -0.05195f, -0.07138f, -1.09535f, -0.63548f, -1.55700f, -0.35721f,
+             -0.18923f, 0.77568f,  0.09419f,  0.36919f,  -0.32761f, -0.06597f,
+             -0.38988f, -0.43674f, -0.24284f, 0.36906f,  0.28414f,  0.19273f,
+             -0.68516f, 0.09514f,  -0.45381f, 0.19917f,  -0.32377f, 1.32549f,
+             0.08244f,  -0.64405f, 0.13195f,  2.85307f,  0.47631f,  -0.33408f,
+             0.04168f,  0.18585f,  -0.18029f, 0.07986f,  -0.08816f, -0.00703f,
+             -0.01515f, -0.13164f, 0.00571f,  0.05676f,  1.51425f,  0.73360f,
+             0.43486f,  -0.08223f, -0.06183f, -0.57098f, -0.29948f, 0.05945f,
+             0.19238f,  -0.47980f, -0.35902f, -0.19931f, 0.43443f,  0.67436f,
+             0.78573f,  0.25703f,  1.01863f,  0.99047f,  0.95228f,  1.02429f,
+             1.19264f,  0.29935f,  -0.26583f, -0.98749f, -0.46167f, -0.29727f,
+             -0.10515f, -0.39790f, -0.59321f, -0.61925f, -0.95452f, 0.04292f,
+             -0.48273f, -0.91195f, -0.45971f, -0.46355f, -0.88319f, -0.51712f,
+             -0.47682f, -0.86110f, -0.59178f, -0.57163f, -0.94946f, 0.19627f,
+             -0.18699f, 0.11037f,  1.39110f,  0.05715f,  3.00762f,  1.52243f,
+             0.25028f,  0.12779f,  -0.12871f, 0.04764f,  0.08288f,  -0.16572f,
+             -0.06580f, 0.05845f,  -0.01474f, 0.04886f,  -0.10000f, 0.12911f,
+             -0.01416f, -0.12472f, 0.14358f,  0.16554f,  0.08853f,  0.13418f,
+             -0.05408f, -0.13871f, -0.00049f, 0.20725f,  -0.05603f, 0.27885f,
+             -0.14277f, 0.29653f,  -0.24739f, 0.10101f,  -0.17068f, -2.43802f,
+             0.41834f,  0.49784f,  0.34949f,  0.98487f,  0.16792f,  1.07355f,
+             0.32546f,  1.32377f,  -0.08584f, 0.85214f,  -0.05721f, 0.90307f,
+             0.20167f,  0.52664f,  -0.14478f, 0.64997f,  0.06846f,  0.32475f,
+             0.64453f,  0.70143f,  -0.03091f, -0.24958f, -0.39021f, -0.57693f,
+             -0.18319f, 0.11793f,  -0.05948f, 0.36670f,  -0.27932f, 0.14800f,
+             -0.55459f, -0.89673f, 0.65922f,  0.54308f,  -0.16731f, -0.59731f,
+             -0.20705f, -0.18183f, -0.05645f, -0.06829f, -0.40210f, -0.27955f,
+             0.28054f,  0.57665f,  0.14171f,  0.54693f,  -0.22144f, -0.59664f,
+             0.13295f,  0.07057f,  -0.19698f, 0.03328f,  -0.09687f, -0.32390f,
+             -0.11506f, -0.40406f, -0.11473f, 0.10399f,  -0.29824f, 0.16028f,
+             0.00053f,  0.22699f,  0.04203f,  -0.43880f, -0.12654f, 0.12172f,
+             0.21087f,  -0.46350f, -0.22081f, -0.06173f, -0.23287f, 0.90314f,
+             0.04466f,  -0.06149f, 0.32682f,  0.16609f,  -0.58991f, -0.03786f,
+             -0.41329f, 0.02632f,  0.23411f,  0.25344f,  0.16468f,  0.31007f,
+             0.21845f,  0.32462f,  0.33945f,  0.11527f,  -0.35926f, -0.18584f,
+             0.29340f,  0.78199f,  2.39287f,  0.53838f,  -1.55085f, 0.02238f,
+             -0.26153f, -0.42498f, -0.02460f, 0.19261f,  -0.10870f, -0.08453f,
+             -0.39561f, 0.08600f,  0.36310f,  0.58439f,  -0.59526f, 0.13104f,
+             -0.06703f, -0.17529f, -0.41431f, -0.23121f, -0.32394f, -0.33324f,
+             -0.21405f, -0.41702f, -0.29236f, -0.31766f, -0.33512f, -0.22679f,
+             -0.13680f, -0.00118f, -1.81744f, -2.34798f, -1.08048f, -0.29883f,
+             -0.29123f, -0.01752f, 1.02458f,  -1.02185f, -0.18978f, 0.05981f,
+             -0.94931f, 0.34544f,  0.04415f,  -0.60036f, -0.11368f, -0.14154f,
+             1.23438f,  0.51640f,  -0.57587f, -0.91380f, 0.95720f,  0.68298f,
+             -0.06353f, -2.14960f, -0.11080f, 0.79380f,  -0.94199f, 0.43040f,
+             0.01358f,  0.07201f,  -0.49689f, -0.14839f, -0.80132f, -0.13925f,
+             -0.11834f, -0.24998f, -0.33976f, 0.35497f,  0.87367f,  -1.06469f,
+             -0.50829f, -0.70540f, 1.14596f,  -1.12346f, -0.94467f, 0.01380f,
+             -0.18911f, 0.07961f,  -0.18626f, 0.61902f,  -0.64423f, 1.21545f,
+             1.01149f,  0.26309f,  1.50380f,  1.93940f,  -0.64064f, 1.03987f,
+             -1.88000f, -0.44574f, -1.53303f, 1.36307f,  1.00292f,  0.37031f,
+             0.21594f,  0.16758f,  0.02592f,  -0.77431f, -0.31797f, -1.53826f,
+             1.14013f,  -1.21957f, 0.04571f,  -0.22168f, 0.32299f,  0.25949f,
+             -0.13306f, 0.17850f,  0.92494f,  0.19999f,  0.07494f,  -0.03362f,
+             -0.53453f, 1.02970f,  -0.22947f, 0.73964f,  1.08445f,  0.16855f,
+             -0.02686f, 0.25254f,  0.05952f,  0.02194f,  0.05649f,  0.39195f,
+             0.14139f,  0.53843f,  -0.06959f, -0.06993f, -0.14151f, -0.53147f,
+             0.17481f,  -1.21977f, 0.62932f,  1.07173f,  0.24049f,  -0.51574f,
+             0.97492f,  -0.28169f, -0.15406f, -0.05441f, -0.25415f, 0.16583f,
+             0.43674f,  -0.00593f, -0.09277f, 0.61402f,  1.35562f,  -0.03926f,
+             0.18967f,  -0.29548f, -0.55509f, 0.23661f,  0.05023f,  0.36226f,
+             -0.83314f, 0.39357f,  0.19943f,  -0.63431f, -0.03847f, 0.12213f,
+             0.62024f,  -0.11704f, -0.22483f, 0.96624f,  0.18518f,  0.09181f,
+             -0.63068f, 0.66797f,  0.74107f,  0.40624f,  0.70636f,  -0.06921f,
+             0.34175f,  -0.15513f, 2.07844f,  0.22126f,  0.52919f,  0.26793f,
+             -0.50018f, 1.10549f,  0.10970f,  0.05831f,  0.82842f,  -1.22975f,
+             1.78377f,  0.92679f,  2.01480f,  -1.19011f, -0.53381f, 0.38533f,
+             0.45579f,  -0.10683f, -0.40828f, 0.31398f,  0.14978f,  0.91325f,
+             1.03659f,  1.80249f,  1.25710f,  1.32000f },
+  /* BLOCK_32X16 */
+  (float[]){ 1.30219f,  1.30548f,  1.33334f,  1.20560f,  1.01572f,  1.38100f,
+             1.37504f,  0.12599f,  -0.96957f, 0.19400f,  0.75734f,  0.11295f,
+             -0.40447f, -1.53062f, -0.82980f, 0.02168f,  -1.11289f, -0.66861f,
+             -0.83663f, -0.91455f, -0.78618f, -0.87176f, -1.10711f, 0.71207f,
+             1.49689f,  -0.12715f, 0.29357f,  0.35234f,  0.61016f,  0.80708f,
+             0.83564f,  1.05961f,  -0.99842f, 0.82004f,  0.02638f,  0.44606f,
+             0.32298f,  0.21321f,  0.47290f,  -0.71442f, -2.81050f, -0.02520f,
+             -0.08919f, 0.00369f,  -0.05257f, -0.07011f, -0.16394f, 0.06290f,
+             0.80086f,  0.32349f,  0.47411f,  1.36126f,  1.68162f,  0.91325f,
+             -0.27495f, 0.00262f,  0.06025f,  0.42832f,  0.36965f,  0.38063f,
+             0.32772f,  0.40914f,  0.44510f,  3.02239f,  -1.84077f, 0.49536f,
+             -0.27340f, -0.10437f, -0.34293f, -0.08047f, -0.29651f, -0.97111f,
+             -0.34187f, 0.52869f,  1.27240f,  1.20306f,  1.19121f,  1.28742f,
+             0.26393f,  -0.62319f, 0.92285f,  -0.08303f, -0.33118f, -0.13053f,
+             0.24875f,  -0.52089f, 0.44691f,  -1.08908f, 1.20921f,  0.36538f,
+             -0.46792f, -0.18855f, -0.13443f, -0.28472f, -0.10353f, 0.06911f,
+             0.68519f,  0.08228f,  -0.49027f, -0.34381f, 0.04719f,  -0.33298f,
+             0.72525f,  0.09538f,  -0.29216f, -0.07260f, -0.55827f, 0.54542f,
+             -0.10144f, -0.09292f, -0.14427f, -0.38361f, -0.41559f, 0.75338f,
+             -0.04530f, 0.27944f,  0.06932f,  -0.11537f, 0.29568f,  1.92155f,
+             -0.98996f, -0.08841f, 0.49386f,  0.15947f,  0.53290f,  1.46747f,
+             0.59360f,  0.25468f,  -1.19673f, 0.33043f,  0.24408f,  0.46221f,
+             2.00646f,  0.19031f,  -0.64944f, -0.43452f, 1.04400f,  1.47371f,
+             0.52460f,  -1.39577f, 0.83852f,  -0.25536f, 1.33200f,  -0.24444f,
+             -1.31447f, -0.86455f, 0.85217f,  1.00048f,  0.37395f,  -1.35713f,
+             -0.54032f, 0.82803f,  0.89606f,  1.57696f,  0.68067f,  0.42512f,
+             -0.26250f, 0.14621f,  0.93249f,  -0.77690f, -0.93652f, -0.44488f,
+             0.68360f,  -0.88178f, 1.89111f,  0.67700f,  -0.29310f, 0.91604f,
+             -1.21881f, 1.11188f,  0.45045f,  -0.86119f, -0.09294f, 0.09360f,
+             0.80794f,  0.41027f,  1.80399f,  -0.50362f, -1.44689f, 0.85148f,
+             0.90707f,  -0.18458f, 0.14165f,  1.17367f,  0.70869f,  1.57147f,
+             0.24692f,  0.16626f,  0.56794f,  0.07313f,  0.14728f,  -0.74296f,
+             1.74127f,  1.26560f,  0.17753f,  1.10194f,  0.56435f,  1.73779f,
+             1.42841f,  -1.16773f, 0.24584f,  0.10813f,  -0.60187f, 0.79802f,
+             0.75229f,  -0.06112f, 1.77282f,  1.01058f,  0.83082f,  2.03845f,
+             0.59627f,  2.31341f },
+};
+
+// These thresholds were calibrated to provide a certain number of TX types
+// pruned by the model on average, i.e. selecting a threshold with index i
+// will lead to pruning i+1 TX types on average
+static const float *av1_prune_2D_adaptive_thresholds[9] = {
+  /* BLOCK_4X4 */
+  (float[]){ 0.02014f, 0.02722f, 0.03430f, 0.04114f, 0.04724f, 0.05212f,
+             0.05627f, 0.06018f, 0.06409f, 0.06824f, 0.07312f, 0.07849f,
+             0.08606f, 0.09827f },
+  /* BLOCK_4X8 */
+  (float[]){ 0.01282f, 0.02087f, 0.02844f, 0.03601f, 0.04285f, 0.04871f,
+             0.05359f, 0.05823f, 0.06287f, 0.06799f, 0.07361f, 0.08093f,
+             0.09119f, 0.10828f },
+  /* BLOCK_8X4 */
+  (float[]){ 0.01184f, 0.01941f, 0.02722f, 0.03503f, 0.04187f, 0.04822f,
+             0.05359f, 0.05823f, 0.06287f, 0.06799f, 0.07361f, 0.08093f,
+             0.09167f, 0.10974f },
+  /* BLOCK_8X8 */
+  (float[]){ 0.00745f, 0.01355f, 0.02039f, 0.02795f, 0.03625f, 0.04407f,
+             0.05042f, 0.05579f, 0.06067f, 0.06604f, 0.07239f, 0.08093f,
+             0.09363f, 0.11682f },
+  /* BLOCK_8X16 */
+  (float[]){ 0.00525f, 0.01135f, 0.01819f, 0.02576f, 0.03357f, 0.04114f,
+             0.04773f, 0.05383f, 0.05920f, 0.06506f, 0.07190f, 0.08118f,
+             0.09509f, 0.12097f },
+  /* BLOCK_16X8 */
+  (float[]){ 0.00525f, 0.01160f, 0.01819f, 0.02527f, 0.03308f, 0.04065f,
+             0.04773f, 0.05383f, 0.05969f, 0.06531f, 0.07214f, 0.08118f,
+             0.09485f, 0.12048f },
+  /* BLOCK_16X16 */
+  (float[]){ 0.01404f, 0.02820f, 0.04211f, 0.05164f, 0.05798f, 0.06335f,
+             0.06897f, 0.07629f, 0.08875f, 0.11169f },
+  /* BLOCK_16X32 */
+  (float[]){ 0.01257f, 0.02576f, 0.03723f, 0.04578f, 0.05212f, 0.05798f,
+             0.06506f, 0.07385f, 0.08606f, 0.10925f },
+  /* BLOCK_32X16 */
+  (float[]){ 0.01233f, 0.02527f, 0.03699f, 0.04602f, 0.05286f, 0.05896f,
+             0.06531f, 0.07336f, 0.08582f, 0.11072f },
+};
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif  // AV1_ENCODER_TX_PRUNE_MODEL_WEIGHTS_H_