Skip intra mode evaluation for > 480p resolution
Skipping intra mode evaluation for <= 480p resolution was added. This CL
added a model to skip intra mode evaluation for > 480p resolution.
Ran hdres set borg test. Here are the results.
avg_psnr: ovr_psnr: ssim: avg_speedup over hdres set:
speed 2: 0.045 0.044 0.063 1.9%
speed 3: 0.038 0.048 0.057 1.5%
STATS_CHANGED
Change-Id: I3070965a09391fb196a7aa6f4194fe3c5e181035
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 7dac924..9f193a4 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -12595,8 +12595,10 @@
// Prepared stats used later to check if we could skip intra mode eval.
int64_t inter_cost = -1;
int64_t intra_cost = -1;
- // Now only use this for <=480p. Will try other resolutions.
- if (sf->skip_intra_in_interframe && AOMMIN(cm->width, cm->height) <= 480) {
+ // Need to tweak the threshold for hdres speed 0 & 1.
+ const int do_pruning =
+ (AOMMIN(cm->width, cm->height) > 480 && cpi->speed <= 1) ? 0 : 1;
+ if (do_pruning && sf->skip_intra_in_interframe) {
// Only consider full SB.
int len = tpl_blocks_in_sb(cm->seq_params.sb_size);
if (len == x->valid_cost_b) {
@@ -12934,7 +12936,9 @@
(x->source_variance > sf->src_var_thresh_intra_skip)) {
if (inter_cost >= 0 && intra_cost >= 0) {
aom_clear_system_state();
- const NN_CONFIG *nn_config = &av1_intrap_nn_config;
+ const NN_CONFIG *nn_config = (AOMMIN(cm->width, cm->height) <= 480)
+ ? &av1_intrap_nn_config
+ : &av1_intrap_hd_nn_config;
float features[6];
float scores[2] = { 0.0f };
float probs[2] = { 0.0f };
diff --git a/av1/encoder/tx_prune_model_weights.h b/av1/encoder/tx_prune_model_weights.h
index 7693507..4ae1f7b 100644
--- a/av1/encoder/tx_prune_model_weights.h
+++ b/av1/encoder/tx_prune_model_weights.h
@@ -3396,6 +3396,87 @@
#undef NUM_LAYER_0_UNITS_12
#undef NUM_LOGITS_12
+#define NUM_HIDDEN_LAYERS_15 1
+#define NUM_FEATURES_15 6
+#define NUM_LAYER_0_UNITS_15 24
+#define NUM_LOGITS_15 2
+
+static const float av1_intraph_hiddenlayer_0_kernel_15[] = {
+ -0.77480125f, 0.3219551f, -0.015702145f, -0.5310235f, 0.5254026f,
+ -1.1522819f, 2.682016f, 0.08001052f, -0.2539285f, 0.04711023f,
+ -0.81296307f, 0.2675382f, 0.1952474f, -0.0664705f, 1.2989824f,
+ -0.3150117f, -0.8022715f, 0.045423955f, -27.584324f, -2.5608704f,
+ -3.2280366f, 0.05272543f, -0.47141576f, -0.07644298f, -53.77942f,
+ -22.393923f, -23.027853f, -0.00015186476f, -0.010696465f, 2.7064638f,
+ -22.776028f, 11.514891f, 11.138167f, -0.001243723f, -0.4802433f,
+ -8.758646f, 0.26398206f, -0.23485385f, 0.27586034f, -0.004954741f,
+ -0.4935232f, -0.017607696f, 69.56049f, -1.1756641f, -0.052366666f,
+ -0.38052833f, 0.32474658f, 0.04634263f, 0.8583235f, -0.528438f,
+ -0.7868907f, -0.4757781f, 0.4620985f, -0.70621157f, 231.40195f,
+ 6.805205f, 9.420295f, 0.02585775f, -0.03480937f, 1.3577378f,
+ 0.1758226f, 15.056758f, 14.437874f, -0.1305005f, 0.115103304f,
+ 0.21297209f, 55.821743f, -6.611156f, -6.8552365f, -0.011928095f,
+ -0.2042175f, 1.2557873f, -1.0722278f, -0.2683614f, 0.48318478f,
+ -0.73739994f, 0.54055226f, -0.03224738f, -0.06767959f, -0.21015017f,
+ 0.29171246f, -0.6937296f, -1.2342545f, -0.41278538f, -37.9365f,
+ 17.68424f, 16.263042f, -0.074828684f, 0.06607806f, -0.16763286f,
+ 13.594707f, 0.6152676f, -0.4371223f, -0.8365592f, 0.8273623f,
+ -1.2126317f, 0.1216157f, -1.3002136f, -0.18856938f, -0.2589358f,
+ -0.76897144f, 0.21777137f, -122.25033f, -0.23490006f, -3.1238277f,
+ -0.13916978f, 0.08576391f, -1.7391548f, -116.24812f, 14.906071f,
+ 13.468357f, 0.02332889f, -0.034617376f, -18.506111f, 0.7500542f,
+ -1.1882535f, 0.40848416f, -0.28434393f, -0.71471655f, -0.29188696f,
+ -0.46588746f, -0.17324813f, -0.62460244f, -1.1801276f, 0.28993344f,
+ -0.22072886f, 129.2688f, -0.33782578f, -0.34836572f, -0.034112718f,
+ -0.023666814f, -0.5865087f, -33.484146f, 1.1431375f, 0.56056374f,
+ -0.0049730353f, -0.24347587f, -1.3003352f, 0.88973033f, 0.8499571f,
+ -0.5678484f, -0.39009875f, -0.062105156f, -0.13965102f
+};
+
+static const float av1_intraph_hiddenlayer_0_bias_15[] = {
+ 0.0f, -0.2926711f, 0.0f, -1.0303509f, -27.459345f, 12.412848f,
+ 0.0f, -2.5971522f, -0.02733541f, -19.881912f, 14.391992f, -8.249469f,
+ 0.0f, 0.0f, 13.676118f, -0.6472994f, -0.07189449f, 1.1986839f,
+ 52.479107f, 0.0f, 0.0f, -3.0187025f, 1.4435643f, 0.0f
+};
+
+static const float av1_intraph_logits_kernel_15[] = {
+ 0.05390722f, -0.06859513f, 0.036842898f, 0.190772f, 0.13623567f,
+ 0.09321194f, 0.2314745f, -0.13958375f, -0.3058229f, -0.0104543045f,
+ 0.11336068f, -0.276115f, 0.00470723f, -0.49123898f, -0.15988174f,
+ 0.087681435f, 0.022517204f, 0.073877744f, 0.2968856f, -0.1401399f,
+ -0.38788354f, -0.26005393f, -0.39564916f, -0.16195515f, 0.2680102f,
+ -0.032179773f, -0.35758728f, 0.25819537f, 0.11468631f, 0.13573235f,
+ -0.2672175f, 0.016490124f, 0.048118807f, 0.020319486f, 0.07892215f,
+ -0.21821865f, 0.08434734f, 0.3129456f, -0.18215221f, 0.08884877f,
+ -0.35621428f, 0.11405768f, 0.27370325f, 0.14956686f, 0.01604587f,
+ -0.18334487f, -0.42385718f, -0.08033409f
+};
+
+static const float av1_intraph_logits_bias_15[] = { 0.83619016f, -0.8340626f };
+
+static const NN_CONFIG av1_intrap_hd_nn_config = {
+ NUM_FEATURES_15,
+ NUM_LOGITS_15,
+ NUM_HIDDEN_LAYERS_15,
+ {
+ NUM_LAYER_0_UNITS_15,
+ },
+ {
+ av1_intraph_hiddenlayer_0_kernel_15,
+ av1_intraph_logits_kernel_15,
+ },
+ {
+ av1_intraph_hiddenlayer_0_bias_15,
+ av1_intraph_logits_bias_15,
+ },
+};
+
+#undef NUM_HIDDEN_LAYERS_15
+#undef NUM_FEATURES_15
+#undef NUM_LAYER_0_UNITS_15
+#undef NUM_LOGITS_15
+
#ifdef __cplusplus
} // extern "C"
#endif