[CFL] Remove explicit dependency on EC_ADAPT

Change-Id: I3e3d458aec7e26abc366992ac20f9fa838fe35bb
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index 0bd757e..a6b67c1 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -1436,8 +1436,15 @@
   uint8_t *dst =
       &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
 #if CONFIG_CFL
-  av1_predict_intra_block_encoder_facade(x, plane, block, blk_col, blk_row,
-                                         tx_size, plane_bsize);
+
+#if CONFIG_EC_ADAPT
+  FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+  FRAME_CONTEXT *const ec_ctx = cm->fc;
+#endif  // CONFIG_EC_ADAPT
+
+  av1_predict_intra_block_encoder_facade(x, ec_ctx, plane, block, blk_col,
+                                         blk_row, tx_size, plane_bsize);
 #else
   av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
 #endif
@@ -1630,7 +1637,8 @@
   return ind;
 }
 
-void av1_predict_intra_block_encoder_facade(MACROBLOCK *x, int plane,
+void av1_predict_intra_block_encoder_facade(MACROBLOCK *x,
+                                            FRAME_CONTEXT *ec_ctx, int plane,
                                             int block_idx, int blk_col,
                                             int blk_row, TX_SIZE tx_size,
                                             BLOCK_SIZE plane_bsize) {
@@ -1638,10 +1646,6 @@
   MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
   if (plane != AOM_PLANE_Y && mbmi->uv_mode == DC_PRED) {
     if (blk_col == 0 && blk_row == 0 && plane == AOM_PLANE_U) {
-#if !CONFIG_EC_ADAPT
-#error "CfL rate estimation requires ec_adapt."
-#endif
-      FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
       assert(ec_ctx->cfl_alpha_cdf[CFL_ALPHABET_SIZE - 1] ==
              AOM_ICDF(CDF_PROB_TOP));
       const int prob_den = CDF_PROB_TOP;
diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h
index b067e00..df7afb6 100644
--- a/av1/encoder/encodemb.h
+++ b/av1/encoder/encodemb.h
@@ -86,7 +86,8 @@
 #endif
 
 #if CONFIG_CFL
-void av1_predict_intra_block_encoder_facade(MACROBLOCK *x, int plane,
+void av1_predict_intra_block_encoder_facade(MACROBLOCK *x,
+                                            FRAME_CONTEXT *ec_ctx, int plane,
                                             int block_idx, int blk_col,
                                             int blk_row, TX_SIZE tx_size,
                                             BLOCK_SIZE plane_bsize);
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 3a09495..7b7b882 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1538,8 +1538,15 @@
 
   if (!is_inter_block(mbmi)) {
 #if CONFIG_CFL
-    av1_predict_intra_block_encoder_facade(x, plane, block, blk_col, blk_row,
-                                           tx_size, plane_bsize);
+
+#if CONFIG_EC_ADAPT
+    FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+    FRAME_CONTEXT *const ec_ctx = cm->fc;
+#endif  // CONFIG_EC_ADAPT
+
+    av1_predict_intra_block_encoder_facade(x, ec_ctx, plane, block, blk_col,
+                                           blk_row, tx_size, plane_bsize);
 #else
     av1_predict_intra_block_facade(xd, plane, block, blk_col, blk_row, tx_size);
 #endif
@@ -2356,8 +2363,15 @@
 #if CONFIG_CFL
       const struct macroblockd_plane *const pd = &xd->plane[0];
       const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
-      av1_predict_intra_block_encoder_facade(x, 0, block, col, row, tx_size,
-                                             plane_bsize);
+
+#if CONFIG_EC_ADAPT
+      FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
+#else
+      FRAME_CONTEXT *const ec_ctx = cm->fc;
+#endif  // CONFIG_EC_ADAPT
+
+      av1_predict_intra_block_encoder_facade(x, ec_ctx, 0, block, col, row,
+                                             tx_size, plane_bsize);
 #else
       av1_predict_intra_block_facade(xd, 0, block, col, row, tx_size);
 #endif