motion_var: computer motion_mode_cost from cdf

Initialize mode cost using frame-level cdf.
Also in rd selection stage, cdf is updated per 64x64.
Performance gain 0.20%

Still suboptimal since in real bitstream packing, cdf is updated
per symbol. Per symbol update in RDO is work in progress.

Change-Id: I5062af91d8b00e5bf4c08abd0a7bfb0e5b27a619
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index c8e5811..e846ae6 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -8544,7 +8544,7 @@
 #if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR
       if (last_motion_mode_allowed == WARPED_CAUSAL)
 #endif  // CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR
-        rd_stats->rate += cpi->motion_mode_cost[bsize][mbmi->motion_mode];
+        rd_stats->rate += x->motion_mode_cost[bsize][mbmi->motion_mode];
 #if CONFIG_WARPED_MOTION && CONFIG_MOTION_VAR
       else
         rd_stats->rate += cpi->motion_mode_cost1[bsize][mbmi->motion_mode];
@@ -10948,7 +10948,7 @@
         av1_init_rd_stats(&rd_stats);
 #if CONFIG_DIST_8X8 && CONFIG_CB4X4
         // While av1 master uses rd_stats_y.rate through out the codebase,
-        // which is set when handle_inter_moden is called, the daala-dist code
+        // which is set when handle_inter_mode is called, the daala-dist code
         // in rd_pick_partition() for cb4x4 and sub8x8 blocks need to know
         // .dist_y which comes from rd_stats_y.dist and rd_stats_y.sse.
         // The problem is rd_stats_y.dist and rd_stats_y.sse are sometimes not
@@ -11429,12 +11429,12 @@
 #endif
             mi);
         if (motion_allowed == WARPED_CAUSAL)
-          *returnrate_nocoef -= cpi->motion_mode_cost[bsize][mbmi->motion_mode];
+          *returnrate_nocoef -= x->motion_mode_cost[bsize][mbmi->motion_mode];
         else if (motion_allowed == OBMC_CAUSAL)
           *returnrate_nocoef -=
               cpi->motion_mode_cost1[bsize][mbmi->motion_mode];
 #else
-        *returnrate_nocoef -= cpi->motion_mode_cost[bsize][mbmi->motion_mode];
+        *returnrate_nocoef -= x->motion_mode_cost[bsize][mbmi->motion_mode];
 #endif  // CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
 #endif  // CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
 #endif  // CONFIG_SUPERTX