Remove experimental feature AOM_CODEC_USE_PRESET

The AOM_CODEC_USE_PRESET experimental feature is really usage-specific
default values for extra_config. It is overly restrictive for the preset
feature because each usage is allowed to have only one preset. So we are
removing AOM_CODEC_USE_PRESET and will redesign the preset feature to be
more flexible.

This CL is the minimum change to remove the experimental feature
AOM_CODEC_USE_PRESET from the public API. It is intended to be
cherry-picked to the minty branch for the libaom v3.11.0 release.
This CL essentially reverts commit f10e098.

The rest of the AOM_CODEC_USE_PRESET code will be removed later.

Bug: 359341194
Change-Id: I74fece5a66e3fc262a78e3edcf52bf0356ac2e9d
diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h
index 1f79c95..3b956bc 100644
--- a/aom/aom_encoder.h
+++ b/aom/aom_encoder.h
@@ -78,8 +78,8 @@
  */
 #define AOM_CODEC_USE_PSNR 0x10000         /**< Calculate PSNR on each frame */
 #define AOM_CODEC_USE_HIGHBITDEPTH 0x40000 /**< Use high bitdepth */
-// WARNING: Experimental feature. Not part of the stable API.
-#define AOM_CODEC_USE_PRESET 0x80000 /**< Use preset based on g_usage */
+// 0x80000 was used for the experimental feature AOM_CODEC_USE_PRESET during
+// libaom v3.11.0 development but was removed before the release.
 
 /*!\brief Generic fixed size buffer structure
  *
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index c715310..e3772e4 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -2843,19 +2843,6 @@
   return update_extra_cfg(ctx, &extra_cfg);
 }
 
-// Returns the index of the default_extra_cfg array element for the specified
-// usage. Returns index 0 if not found. This means default_extra_cfg[0] is used
-// for any usage that doesn't have a dedicated element in the default_extra_cfg
-// array.
-static int find_default_extra_cfg_for_usage(unsigned int usage) {
-  for (int i = 0; i < NELEMENTS(default_extra_cfg); ++i) {
-    if (default_extra_cfg[i].usage == usage) {
-      return i;
-    }
-  }
-  return 0;
-}
-
 static aom_codec_err_t encoder_init(aom_codec_ctx_t *ctx) {
   aom_codec_err_t res = AOM_CODEC_OK;
 
@@ -2871,11 +2858,7 @@
     priv->cfg = *ctx->config.enc;
     ctx->config.enc = &priv->cfg;
 
-    int extra_cfg_idx = 0;
-    if (ctx->init_flags & AOM_CODEC_USE_PRESET) {
-      extra_cfg_idx = find_default_extra_cfg_for_usage(priv->cfg.g_usage);
-    }
-    priv->extra_cfg = default_extra_cfg[extra_cfg_idx];
+    priv->extra_cfg = default_extra_cfg[0];
     // Special handling:
     // By default, if omitted: --enable-cdef=1, --qm-min=5, and --qm-max=9
     // Here we set its default values to 0, 4, and 10 respectively when
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc
index 24a936d..8d6803d 100644
--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -124,17 +124,6 @@
   ASSERT_EQ(aom_codec_destroy(&enc), AOM_CODEC_OK);
 }
 
-TEST(EncodeAPI, InitializeWithPreset) {
-  aom_codec_iface_t *iface = aom_codec_av1_cx();
-  aom_codec_ctx_t enc;
-  aom_codec_enc_cfg_t cfg;
-  EXPECT_EQ(AOM_CODEC_OK,
-            aom_codec_enc_config_default(iface, &cfg, AOM_USAGE_REALTIME));
-  EXPECT_EQ(AOM_CODEC_OK,
-            aom_codec_enc_init(&enc, iface, &cfg, AOM_CODEC_USE_PRESET));
-  EXPECT_EQ(AOM_CODEC_OK, aom_codec_destroy(&enc));
-}
-
 void EncodeSetSFrameOnFirstFrame(aom_img_fmt fmt, aom_codec_flags_t flag) {
   constexpr int kWidth = 2;
   constexpr int kHeight = 128;