Update profile/bitdepth/sampling in header

Designs the sequence header syntax to support various
profiles as decided in the AV1 codec WG:

Profile 0: 4:2:0 and 4:0:0 8/10-bit
Profile 1: 4:4:4 8/10-bit
Profile 2: 4:2:0/4:0:0/4:4:4 12-bit as well as 4:2:2 8/10/12-bit

Change-Id: Iea351698280e37d65847bf75a43c5bbeba8f7cf4
diff --git a/aomenc.c b/aomenc.c
index ae4fe91..c6186de 100644
--- a/aomenc.c
+++ b/aomenc.c
@@ -2028,12 +2028,23 @@
            was selected. */
         switch (stream->config.cfg.g_profile) {
           case 0:
-            stream->config.cfg.g_profile = 1;
-            profile_updated = 1;
+            if ((input.bit_depth == 8 || input.bit_depth == 10) &&
+                (input.fmt == AOM_IMG_FMT_I444 ||
+                 input.fmt == AOM_IMG_FMT_I44416)) {
+              stream->config.cfg.g_profile = 1;
+              profile_updated = 1;
+            } else if (input.bit_depth == 12 || input.fmt == AOM_IMG_FMT_I422 ||
+                       input.fmt == AOM_IMG_FMT_I42216) {
+              stream->config.cfg.g_profile = 2;
+              profile_updated = 1;
+            }
             break;
-          case 2:
-            stream->config.cfg.g_profile = 3;
-            profile_updated = 1;
+          case 1:
+            if (input.bit_depth == 12 || input.fmt == AOM_IMG_FMT_I422 ||
+                input.fmt == AOM_IMG_FMT_I42216) {
+              stream->config.cfg.g_profile = 2;
+              profile_updated = 1;
+            }
             break;
           default: break;
         }