Change in datatype of cfl_alpha in mb_mode_info

Changed datatype of 'cfl_alpha_idx' and 'cfl_alpha_signs'
from int to uint8_t and int8_t respectively.

Observed memory footprint reduction with no impact on
encoder/decoder performance.

Stream                   cpu-used     Encoder   Decoder
BasketballDrill_832x480     1          ~0.2%     ~1.2%
parkrun_720p50              3          ~0.2%     ~1.4%

Change-Id: Ibcec85fb7d9cce41b4d9da43af91c0e917de4748
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index ad97d50..0bbeb94 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -227,11 +227,6 @@
   int mi_row;
   int mi_col;
 #endif
-  // Index of the alpha Cb and alpha Cr combination
-  int cfl_alpha_idx;
-  // Joint sign of alpha Cb and alpha Cr
-  int cfl_alpha_signs;
-
 #if CONFIG_INSPECTION
   int16_t tx_skip[TXK_TYPE_BUF_LEN];
 #endif
@@ -261,6 +256,10 @@
   int8_t angle_delta[PLANE_TYPES];
   /* deringing gain *per-superblock* */
   int8_t cdef_strength;
+  // Joint sign of alpha Cb and alpha Cr
+  int8_t cfl_alpha_signs;
+  // Index of the alpha Cb and alpha Cr combination
+  uint8_t cfl_alpha_idx;
   uint8_t ref_mv_idx;
   // Indicate if masked compound is used(1) or not(0).
   uint8_t comp_group_idx;
diff --git a/av1/common/cfl.c b/av1/common/cfl.c
index f65e002..5d449a3 100644
--- a/av1/common/cfl.c
+++ b/av1/common/cfl.c
@@ -136,7 +136,7 @@
 
 CFL_SUB_AVG_FN(c)
 
-static INLINE int cfl_idx_to_alpha(int alpha_idx, int joint_sign,
+static INLINE int cfl_idx_to_alpha(uint8_t alpha_idx, int8_t joint_sign,
                                    CFL_PRED_TYPE pred_type) {
   const int alpha_sign = (pred_type == CFL_PRED_U) ? CFL_SIGN_U(joint_sign)
                                                    : CFL_SIGN_V(joint_sign);
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index f8502fa..3880d54 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -129,20 +129,20 @@
   return uv_mode;
 }
 
-static int read_cfl_alphas(FRAME_CONTEXT *const ec_ctx, aom_reader *r,
-                           int *signs_out) {
-  const int joint_sign =
+static uint8_t read_cfl_alphas(FRAME_CONTEXT *const ec_ctx, aom_reader *r,
+                               int8_t *signs_out) {
+  const int8_t joint_sign =
       aom_read_symbol(r, ec_ctx->cfl_sign_cdf, CFL_JOINT_SIGNS, "cfl:signs");
-  int idx = 0;
+  uint8_t idx = 0;
   // Magnitudes are only coded for nonzero values
   if (CFL_SIGN_U(joint_sign) != CFL_SIGN_ZERO) {
     aom_cdf_prob *cdf_u = ec_ctx->cfl_alpha_cdf[CFL_CONTEXT_U(joint_sign)];
-    idx = aom_read_symbol(r, cdf_u, CFL_ALPHABET_SIZE, "cfl:alpha_u")
+    idx = (uint8_t)aom_read_symbol(r, cdf_u, CFL_ALPHABET_SIZE, "cfl:alpha_u")
           << CFL_ALPHABET_SIZE_LOG2;
   }
   if (CFL_SIGN_V(joint_sign) != CFL_SIGN_ZERO) {
     aom_cdf_prob *cdf_v = ec_ctx->cfl_alpha_cdf[CFL_CONTEXT_V(joint_sign)];
-    idx += aom_read_symbol(r, cdf_v, CFL_ALPHABET_SIZE, "cfl:alpha_v");
+    idx += (uint8_t)aom_read_symbol(r, cdf_v, CFL_ALPHABET_SIZE, "cfl:alpha_v");
   }
   *signs_out = joint_sign;
   return idx;
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 87bc72a..9c0567a 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -857,8 +857,8 @@
                    UV_INTRA_MODES - !cfl_allowed);
 }
 
-static void write_cfl_alphas(FRAME_CONTEXT *const ec_ctx, int idx,
-                             int joint_sign, aom_writer *w) {
+static void write_cfl_alphas(FRAME_CONTEXT *const ec_ctx, uint8_t idx,
+                             int8_t joint_sign, aom_writer *w) {
   aom_write_symbol(w, joint_sign, ec_ctx->cfl_sign_cdf, CFL_JOINT_SIGNS);
   // Magnitudes are only signaled for nonzero codes.
   if (CFL_SIGN_U(joint_sign) != CFL_SIGN_ZERO) {
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index b1ffe87..f840032 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -875,8 +875,8 @@
                UV_INTRA_MODES - !cfl_allowed);
   }
   if (uv_mode == UV_CFL_PRED) {
-    const int joint_sign = mbmi->cfl_alpha_signs;
-    const int idx = mbmi->cfl_alpha_idx;
+    const int8_t joint_sign = mbmi->cfl_alpha_signs;
+    const uint8_t idx = mbmi->cfl_alpha_idx;
 
 #if CONFIG_ENTROPY_STATS
     ++counts->cfl_sign[joint_sign];
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index dc21f40..be1ebb0 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -6229,7 +6229,8 @@
     // Collect RD stats for an alpha value of zero in this plane.
     // Skip i == CFL_SIGN_ZERO as (0, 0) is invalid.
     for (int i = CFL_SIGN_NEG; i < CFL_SIGNS; i++) {
-      const int joint_sign = PLANE_SIGN_TO_JOINT_SIGN(plane, CFL_SIGN_ZERO, i);
+      const int8_t joint_sign =
+          PLANE_SIGN_TO_JOINT_SIGN(plane, CFL_SIGN_ZERO, i);
       if (i == CFL_SIGN_NEG) {
         mbmi->cfl_alpha_idx = 0;
         mbmi->cfl_alpha_signs = joint_sign;
@@ -6246,7 +6247,7 @@
     }
   }
 
-  int best_joint_sign = -1;
+  int8_t best_joint_sign = -1;
 
   for (int plane = 0; plane < CFL_PRED_PLANES; plane++) {
     for (int pn_sign = CFL_SIGN_NEG; pn_sign < CFL_SIGNS; pn_sign++) {
@@ -6257,7 +6258,7 @@
         if (c > 2 && progress < c) break;
         av1_init_rd_stats(&rd_stats);
         for (int i = 0; i < CFL_SIGNS; i++) {
-          const int joint_sign = PLANE_SIGN_TO_JOINT_SIGN(plane, pn_sign, i);
+          const int8_t joint_sign = PLANE_SIGN_TO_JOINT_SIGN(plane, pn_sign, i);
           if (i == 0) {
             mbmi->cfl_alpha_idx = (c << CFL_ALPHABET_SIZE_LOG2) + c;
             mbmi->cfl_alpha_signs = joint_sign;
@@ -6288,7 +6289,7 @@
   }
 
   int best_rate_overhead = INT_MAX;
-  int ind = 0;
+  uint8_t ind = 0;
   if (best_joint_sign >= 0) {
     const int u = best_c[best_joint_sign][CFL_PRED_U];
     const int v = best_c[best_joint_sign][CFL_PRED_V];