Group color related config in AV1EncoderConfig

This CL groups color related configuration parameters in
AV1EncoderConfig into a new struct ColorCfg, and adds the
relevant documentation.

BUG=aomedia:2701

Change-Id: Id4229c4d47e87008bea9c24d4c9eff740abf1752
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 69b861f..94500d7 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -728,6 +728,8 @@
 
   QuantizationCfg *const q_cfg = &oxcf->q_cfg;
 
+  ColorCfg *const color_cfg = &oxcf->color_cfg;
+
   const int is_vbr = cfg->rc_end_usage == AOM_VBR;
   oxcf->profile = cfg->g_profile;
   oxcf->max_threads = (int)cfg->g_threads;
@@ -887,12 +889,13 @@
   oxcf->noise_sensitivity = extra_cfg->noise_sensitivity;
   oxcf->sharpness = extra_cfg->sharpness;
 
-  oxcf->color_primaries = extra_cfg->color_primaries;
-  oxcf->transfer_characteristics = extra_cfg->transfer_characteristics;
-  oxcf->matrix_coefficients = extra_cfg->matrix_coefficients;
-  oxcf->chroma_sample_position = extra_cfg->chroma_sample_position;
+  // Set Color related configuration.
+  color_cfg->color_primaries = extra_cfg->color_primaries;
+  color_cfg->transfer_characteristics = extra_cfg->transfer_characteristics;
+  color_cfg->matrix_coefficients = extra_cfg->matrix_coefficients;
+  color_cfg->color_range = extra_cfg->color_range;
 
-  oxcf->color_range = extra_cfg->color_range;
+  oxcf->chroma_sample_position = extra_cfg->chroma_sample_position;
   oxcf->arnr_max_frames = extra_cfg->arnr_max_frames;
   oxcf->arnr_strength = extra_cfg->arnr_strength;
 
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 9c8fa1d..1c9170c 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -772,19 +772,19 @@
   SequenceHeader *const seq_params = &cm->seq_params;
   ResizePendingParams *resize_pending_params = &cpi->resize_pending_params;
   const DecoderModelCfg *const dec_model_cfg = &oxcf->dec_model_cfg;
-
+  const ColorCfg *const color_cfg = &oxcf->color_cfg;
   cpi->oxcf = *oxcf;
   cpi->framerate = oxcf->init_framerate;
 
   seq_params->profile = oxcf->profile;
   seq_params->bit_depth = oxcf->bit_depth;
   seq_params->use_highbitdepth = oxcf->use_highbitdepth;
-  seq_params->color_primaries = oxcf->color_primaries;
-  seq_params->transfer_characteristics = oxcf->transfer_characteristics;
-  seq_params->matrix_coefficients = oxcf->matrix_coefficients;
+  seq_params->color_primaries = color_cfg->color_primaries;
+  seq_params->transfer_characteristics = color_cfg->transfer_characteristics;
+  seq_params->matrix_coefficients = color_cfg->matrix_coefficients;
   seq_params->monochrome = oxcf->monochrome;
   seq_params->chroma_sample_position = oxcf->chroma_sample_position;
-  seq_params->color_range = oxcf->color_range;
+  seq_params->color_range = color_cfg->color_range;
   seq_params->timing_info_present = dec_model_cfg->timing_info_present;
   seq_params->timing_info.num_units_in_display_tick =
       dec_model_cfg->timing_info.num_units_in_display_tick;
@@ -885,6 +885,7 @@
   RefreshFrameFlagsInfo *const refresh_frame_flags = &cpi->refresh_frame;
   const FrameDimensionCfg *const frm_dim_cfg = &cpi->oxcf.frm_dim_cfg;
   const DecoderModelCfg *const dec_model_cfg = &oxcf->dec_model_cfg;
+  const ColorCfg *const color_cfg = &oxcf->color_cfg;
 
   // in case of LAP, lag in frames is set according to number of lap buffers
   // calculated at init time. This stores and restores LAP's lag in frames to
@@ -896,12 +897,12 @@
 
   if (seq_params->profile != oxcf->profile) seq_params->profile = oxcf->profile;
   seq_params->bit_depth = oxcf->bit_depth;
-  seq_params->color_primaries = oxcf->color_primaries;
-  seq_params->transfer_characteristics = oxcf->transfer_characteristics;
-  seq_params->matrix_coefficients = oxcf->matrix_coefficients;
+  seq_params->color_primaries = color_cfg->color_primaries;
+  seq_params->transfer_characteristics = color_cfg->transfer_characteristics;
+  seq_params->matrix_coefficients = color_cfg->matrix_coefficients;
   seq_params->monochrome = oxcf->monochrome;
   seq_params->chroma_sample_position = oxcf->chroma_sample_position;
-  seq_params->color_range = oxcf->color_range;
+  seq_params->color_range = color_cfg->color_range;
 
   assert(IMPLIES(seq_params->profile <= PROFILE_1,
                  seq_params->bit_depth <= AOM_BITS_10));
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 6b7fc2a..0c0d4a4 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -547,6 +547,17 @@
 } RefFrameCfg;
 
 typedef struct {
+  // Indicates the color space that should be used.
+  aom_color_primaries_t color_primaries;
+  // Indicates the characteristics of transfer function to be used.
+  aom_transfer_characteristics_t transfer_characteristics;
+  // Indicates the matrix coefficients to be used for the transfer function.
+  aom_matrix_coefficients_t matrix_coefficients;
+  // Indicates if a limited color range or full color range should be used.
+  aom_color_range_t color_range;
+} ColorCfg;
+
+typedef struct {
   // List of QP offsets for: keyframe, ALTREF, and 3 levels of internal ARFs.
   // If any of these values are negative, fixed offsets are disabled.
   // Uses internal q range.
@@ -660,14 +671,13 @@
   const char *vmaf_model_path;
   aom_tune_content content;
   int use_highbitdepth;
-  aom_color_primaries_t color_primaries;
-  aom_transfer_characteristics_t transfer_characteristics;
-  aom_matrix_coefficients_t matrix_coefficients;
   aom_chroma_sample_position_t chroma_sample_position;
-  int color_range;
   int film_grain_test_vector;
   const char *film_grain_table_filename;
 
+  // Configuration related to color.
+  ColorCfg color_cfg;
+
   // Configuration related to decoder model.
   DecoderModelCfg dec_model_cfg;