Improve CONFIG_CWG_C013

BUG: aomedia:2871

Change-Id: Ib3106740cb93bed00c75d600f985000373150c9c
(cherry picked from commit 125ce9145a223e01819791f73d8ab937d92a1d77)
diff --git a/aom/aomcx.h b/aom/aomcx.h
index 9c21942..906cf2a 100644
--- a/aom/aomcx.h
+++ b/aom/aomcx.h
@@ -618,9 +618,10 @@
    *  - AB: OP index.
    *  - xy: Target level index for the OP. Possible values are:
    *    + 0~27: corresponding to level 2.0 ~ 8.3. Note:
-   *      > Levels 2.2, 2.3, 3.2, 3.3, 4.2 & 4.3 are undefined.
-   *      > Levels 7.x and 8.x are in draft status, available under the config
-   *        flag CONFIG_CWG_C013.
+   *      > Levels 2.2 (2), 2.3 (3), 3.2 (6), 3.3 (7), 4.2 (10) & 4.3 (11) are
+   *        undefined.
+   *      > Levels 7.x and 8.x (20~27) are in draft status, available under the
+   *        config flag CONFIG_CWG_C013.
    *    + 31: maximum parameters level, no level-based constraints.
    *    + 32: keep level stats only for level monitoring.
    *
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 0ba4405..0b12ff0 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -364,7 +364,7 @@
                                      int height, double init_framerate) {
   SequenceHeader *const seq_params = &ppi->seq_params;
 #if CONFIG_CWG_C013
-  AV1LevelParams *const level_params = &ppi->level_params;
+  const AV1LevelParams *const level_params = &ppi->level_params;
 #endif
   // TODO(any): This is a placeholder function that only addresses dimensions
   // and max display sample rates.
diff --git a/av1/encoder/level.c b/av1/encoder/level.c
index 8f8892f..5741659 100644
--- a/av1/encoder/level.c
+++ b/av1/encoder/level.c
@@ -314,7 +314,16 @@
     .high_cr = 4.0,
     .max_tiles = 512,
     .max_tile_cols = 64 },
-#endif
+#else   // !CONFIG_CWG_C013
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+  UNDEFINED_LEVEL,
+#endif  // CONFIG_CWG_C013
 };
 
 typedef enum {
diff --git a/test/level_test.cc b/test/level_test.cc
index 1156262..7ae1a75 100644
--- a/test/level_test.cc
+++ b/test/level_test.cc
@@ -87,8 +87,8 @@
   for (int operating_point = 0; operating_point <= 32; ++operating_point) {
     for (int level = 0; level <= 32; ++level) {
       const int target_level = operating_point * 100 + level;
-      if ((level < 28 && level != 2 && level != 3 && level != 6 && level != 7 &&
-           level != 10 && level != 11 && (CONFIG_CWG_C013 || level < 20)) ||
+      if ((level < (CONFIG_CWG_C013 ? 28 : 20) && level != 2 && level != 3 &&
+           level != 6 && level != 7 && level != 10 && level != 11) ||
           level == kLevelMax || level == kLevelKeepStats ||
           operating_point > 31) {
         EXPECT_EQ(AOM_CODEC_OK,