Clean up stray monochrome flags.

The monochrome flags have been removed
from both the encoder and decoder, as this
is now an option in the colour space.

Change-Id: Iccd0f051f35811174ba286c6ee454443fd5268be
diff --git a/aom/aom_decoder.h b/aom/aom_decoder.h
index c5c54c8..ceab934 100644
--- a/aom/aom_decoder.h
+++ b/aom/aom_decoder.h
@@ -104,8 +104,7 @@
   unsigned int w;       /**< Width */
   unsigned int h;       /**< Height */
   unsigned int allow_lowbitdepth; /**< Allow use of low-bitdepth coding path */
-  unsigned int monochrome; /**< Whether or not the stream is monochrome */
-} aom_codec_dec_cfg_t;     /**< alias for struct aom_codec_dec_cfg */
+} aom_codec_dec_cfg_t;            /**< alias for struct aom_codec_dec_cfg */
 
 /*!\brief Initialize a decoder instance
  *
diff --git a/aom/aom_encoder.h b/aom/aom_encoder.h
index 7a7f4e4..208ba01 100644
--- a/aom/aom_encoder.h
+++ b/aom/aom_encoder.h
@@ -620,13 +620,6 @@
    */
   unsigned int large_scale_tile;
 
-  /*!\brief Monochrome mode
-   *
-   * If this is nonzero, the encoder will generate a monochrome stream
-   * with no chroma planes.
-   */
-  unsigned int monochrome;
-
   /*!\brief Number of explicit tile widths specified
    *
    * This value indicates the number of tile widths specified
diff --git a/aomdec.c b/aomdec.c
index 8aaffd6..c1144e3 100644
--- a/aomdec.c
+++ b/aomdec.c
@@ -533,7 +533,7 @@
   int use_y4m = 1;
   int opt_yv12 = 0;
   int opt_i420 = 0;
-  aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH, 0 };
+  aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH };
 #if CONFIG_HIGHBITDEPTH
   unsigned int output_bit_depth = 0;
 #endif
diff --git a/aomenc.c b/aomenc.c
index 6202e05..6ecb055 100644
--- a/aomenc.c
+++ b/aomenc.c
@@ -1193,12 +1193,6 @@
       config->cfg.tile_height_count =
           arg_parse_list(&arg, config->cfg.tile_heights, MAX_TILE_HEIGHTS);
 #endif
-#if CONFIG_MONO_VIDEO
-    } else if (arg_match(&arg, &input_color_space, argi)) {
-      aom_color_space_t color_space = arg_parse_enum_or_int(&arg);
-      config->cfg.monochrome = (color_space == AOM_CS_MONOCHROME);
-      set_config_arg_ctrls(config, AV1E_SET_COLOR_SPACE, &arg);
-#endif
     } else {
       int i, match = 0;
       for (i = 0; ctrl_args[i]; i++) {
@@ -1506,7 +1500,7 @@
 #if CONFIG_AV1_DECODER
   if (global->test_decode != TEST_DECODE_OFF) {
     const AvxInterface *decoder = get_aom_decoder_by_name(global->codec->name);
-    aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH, 0 };
+    aom_codec_dec_cfg_t cfg = { 0, 0, 0, CONFIG_LOWBITDEPTH };
     aom_codec_dec_init(&stream->decoder, decoder->codec_interface(), &cfg, 0);
 
 #if CONFIG_EXT_TILE
@@ -1745,7 +1739,7 @@
 }
 
 static void test_decode(struct stream_state *stream,
-                        enum TestDecodeFatality fatal, int is_mono) {
+                        enum TestDecodeFatality fatal) {
   aom_image_t enc_img, dec_img;
 
   if (stream->mismatch_seen) return;
@@ -1777,7 +1771,7 @@
   ctx_exit_on_error(&stream->encoder, "Failed to get encoder reference frame");
   ctx_exit_on_error(&stream->decoder, "Failed to get decoder reference frame");
 
-  if (!aom_compare_img(&enc_img, &dec_img, is_mono ? 1 : 3)) {
+  if (!aom_compare_img(&enc_img, &dec_img)) {
     int y[4], u[4], v[4];
 #if CONFIG_HIGHBITDEPTH
     if (enc_img.fmt & AOM_IMG_FMT_HIGHBITDEPTH) {
@@ -2205,8 +2199,7 @@
 
         if (got_data && global.test_decode != TEST_DECODE_OFF) {
           FOREACH_STREAM(stream, streams) {
-            test_decode(stream, global.test_decode,
-                        stream->config.cfg.monochrome);
+            test_decode(stream, global.test_decode);
           }
         }
       }
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 992b70d..28b9e32 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -1515,9 +1515,6 @@
                                             va_list args) {
   struct av1_extracfg extra_cfg = ctx->extra_cfg;
   extra_cfg.color_space = CAST(AV1E_SET_COLOR_SPACE, args);
-#if CONFIG_MONO_VIDEO
-  ctx->cfg.monochrome = (extra_cfg.color_space == AOM_CS_MONOCHROME);
-#endif
   return update_extra_cfg(ctx, &extra_cfg);
 }
 
@@ -1702,7 +1699,6 @@
         0,            // kf_min_dist
         9999,         // kf_max_dist
         0,            // large_scale_tile
-        0,            // monochrome
         0,            // tile_width_count
         0,            // tile_height_count
         { 0 },        // tile_widths
diff --git a/examples/aom_cx_set_ref.c b/examples/aom_cx_set_ref.c
index e6ec4c5..456e813 100644
--- a/examples/aom_cx_set_ref.c
+++ b/examples/aom_cx_set_ref.c
@@ -69,8 +69,7 @@
 }
 
 static void testing_decode(aom_codec_ctx_t *encoder, aom_codec_ctx_t *decoder,
-                           unsigned int frame_out, int *mismatch_seen,
-                           int is_mono) {
+                           unsigned int frame_out, int *mismatch_seen) {
   aom_image_t enc_img, dec_img;
   struct av1_ref_frame ref_enc, ref_dec;
 
@@ -85,7 +84,7 @@
     die_codec(decoder, "Failed to get decoder reference frame");
   dec_img = ref_dec.img;
 
-  if (!aom_compare_img(&enc_img, &dec_img, is_mono ? 1 : 3)) {
+  if (!aom_compare_img(&enc_img, &dec_img)) {
     int y[4], u[4], v[4];
 
     *mismatch_seen = 1;
@@ -107,8 +106,7 @@
 static int encode_frame(aom_codec_ctx_t *ecodec, aom_image_t *img,
                         unsigned int frame_in, AvxVideoWriter *writer,
                         int test_decode, aom_codec_ctx_t *dcodec,
-                        unsigned int *frame_out, int *mismatch_seen,
-                        int is_mono) {
+                        unsigned int *frame_out, int *mismatch_seen) {
   int got_pkts = 0;
   aom_codec_iter_t iter = NULL;
   const aom_codec_cx_pkt_t *pkt = NULL;
@@ -149,7 +147,7 @@
 
   // Mismatch checking
   if (got_data && test_decode) {
-    testing_decode(ecodec, dcodec, *frame_out, mismatch_seen, is_mono);
+    testing_decode(ecodec, dcodec, *frame_out, mismatch_seen);
   }
 
   return got_pkts;
@@ -289,7 +287,7 @@
     }
 
     encode_frame(&ecodec, &raw, frame_in, writer, test_decode, &dcodec,
-                 &frame_out, &mismatch_seen, cfg.monochrome);
+                 &frame_out, &mismatch_seen);
     frame_in++;
     if (mismatch_seen) break;
   }
@@ -297,7 +295,7 @@
   // Flush encoder.
   if (!mismatch_seen)
     while (encode_frame(&ecodec, NULL, frame_in, writer, test_decode, &dcodec,
-                        &frame_out, &mismatch_seen, cfg.monochrome)) {
+                        &frame_out, &mismatch_seen)) {
     }
 
   printf("\n");
diff --git a/examples/encoder_util.c b/examples/encoder_util.c
index 474690d..32acf0a 100644
--- a/examples/encoder_util.c
+++ b/examples/encoder_util.c
@@ -102,7 +102,10 @@
 }
 
 int aom_compare_img(const aom_image_t *const img1,
-                    const aom_image_t *const img2, int num_planes) {
+                    const aom_image_t *const img2) {
+  assert(img1->cs == img2->cs);
+  int num_planes = img1->cs == AOM_CS_MONOCHROME ? 1 : 3;
+
   uint32_t l_w = img1->d_w;
   uint32_t c_w = (img1->d_w + img1->x_chroma_shift) >> img1->x_chroma_shift;
   const uint32_t c_h =
diff --git a/examples/encoder_util.h b/examples/encoder_util.h
index 72057a9..38deef0 100644
--- a/examples/encoder_util.h
+++ b/examples/encoder_util.h
@@ -31,6 +31,6 @@
 
 // Returns 1 if the two images match.
 int aom_compare_img(const aom_image_t *const img1,
-                    const aom_image_t *const img2, int num_planes);
+                    const aom_image_t *const img2);
 
 #endif  // EXAMPLES_ENCODER_UTIL_H_