Account for cdf model update in lv-map coding

Make the lv-map rate-distortion optimization account for the
per symbol cdf update. This improves the level map coding
performance by 0.4%.

Change-Id: I1cbecafbad4e6642abc3782c9741636d92d87eb7
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 1a0716e..972c9bf 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4370,6 +4370,7 @@
     }
 
     // transform / motion compensation build reconstruction frame
+    save_coding_context(cpi);
     av1_encode_frame(cpi);
 
     // Update the skip mb flag probabilities based on the distribution
@@ -4382,8 +4383,7 @@
     // accurate estimate of output frame size to determine if we need
     // to recode.
     if (cpi->sf.recode_loop >= ALLOW_RECODE_KFARFGF) {
-      save_coding_context(cpi);
-
+      restore_coding_context(cpi);
       av1_pack_bitstream(cpi, dest, size);
 
       rc->projected_frame_size = (int)(*size) << 3;
@@ -4905,6 +4905,7 @@
     cpi->rc.is_last_bipred_frame = 0;
     cpi->rc.is_bipred_frame = 0;
 
+    restore_coding_context(cpi);
     // Build the bitstream
     av1_pack_bitstream(cpi, dest, size);