Set ext_delta_q default and bug fix

* Set ext_delta_q experiment as default
* Update test for ext_delta_q
* Fix a bug (BUG=aomedia:485) in encoder which
  cause decoder and encoder mismatch.

Change-Id: I28ece21c32ff8621f8837ed4807b02eef8c92e29
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index cac1aaf..6fb7485 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -2453,11 +2453,13 @@
 #endif
                      PICK_MODE_CONTEXT *ctx, int *rate) {
   MACROBLOCK *const x = &td->mb;
-#if CONFIG_MOTION_VAR && CONFIG_NCOBMC
+#if (CONFIG_MOTION_VAR && CONFIG_NCOBMC) | CONFIG_EXT_DELTA_Q
   MACROBLOCKD *xd = &x->e_mbd;
   MB_MODE_INFO *mbmi;
+#if CONFIG_MOTION_VAR && CONFIG_NCOBMC
   int check_ncobmc;
 #endif
+#endif
 
   set_offsets(cpi, tile, x, mi_row, mi_col, bsize);
 #if CONFIG_EXT_PARTITION_TYPES
@@ -2481,6 +2483,13 @@
   encode_superblock(cpi, td, tp, dry_run, mi_row, mi_col, bsize, ctx, rate);
 
   if (!dry_run) {
+#if CONFIG_EXT_DELTA_Q
+    mbmi = &xd->mi[0]->mbmi;
+    if (bsize == BLOCK_64X64 && mbmi->skip == 1 && is_inter_block(mbmi) &&
+        cpi->common.delta_lf_present_flag) {
+      mbmi->current_delta_lf_from_base = xd->prev_delta_lf_from_base;
+    }
+#endif
 #if CONFIG_SUPERTX
     update_stats(&cpi->common, td, mi_row, mi_col, 0);
 #else
diff --git a/configure b/configure
index 817085d..5bb32d3 100755
--- a/configure
+++ b/configure
@@ -494,6 +494,7 @@
     soft_enable dual_filter
     soft_enable motion_var
     soft_enable warped_motion
+    soft_enable ext_delta_q
 
     # Backwards/jenkins compatibility with --enable-aom-highbitdepth
     enabled aom_highbitdepth && enable_feature highbitdepth
diff --git a/test/aq_segment_test.cc b/test/aq_segment_test.cc
index a9bad82..5dc93ec 100644
--- a/test/aq_segment_test.cc
+++ b/test/aq_segment_test.cc
@@ -37,12 +37,18 @@
     if (video->frame() == 1) {
       encoder->Control(AOME_SET_CPUUSED, set_cpu_used_);
       encoder->Control(AV1E_SET_AQ_MODE, aq_mode_);
+#if CONFIG_EXT_DELTA_Q
+      encoder->Control(AV1E_SET_DELTAQ_MODE, deltaq_mode_);
+#endif
       encoder->Control(AOME_SET_MAX_INTRA_BITRATE_PCT, 100);
     }
   }
 
   void DoTest(int aq_mode) {
     aq_mode_ = aq_mode;
+#if CONFIG_EXT_DELTA_Q
+    deltaq_mode_ = 0;
+#endif
     cfg_.kf_max_dist = 12;
     cfg_.rc_min_quantizer = 8;
     cfg_.rc_max_quantizer = 56;
@@ -59,6 +65,9 @@
 
   int set_cpu_used_;
   int aq_mode_;
+#if CONFIG_EXT_DELTA_Q
+  int deltaq_mode_;
+#endif
 };
 
 // Validate that this AQ segmentation mode (AQ=1, variance_ap)
@@ -81,12 +90,11 @@
 
 TEST_P(AqSegmentTestLarge, TestNoMisMatchAQ3) { DoTest(3); }
 
-#if CONFIG_DELTA_Q
+#if CONFIG_DELTA_Q & !CONFIG_EXT_DELTA_Q
 // Validate that this AQ mode (AQ=4, delta q)
 // encodes and decodes without a mismatch.
 TEST_P(AqSegmentTest, TestNoMisMatchAQ4) {
   cfg_.rc_end_usage = AOM_CQ;
-
   aq_mode_ = 4;
 
   ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
@@ -96,6 +104,20 @@
 }
 #endif
 
+#if CONFIG_EXT_DELTA_Q
+// Validate that this delta q mode
+// encodes and decodes without a mismatch.
+TEST_P(AqSegmentTest, TestNoMisMatchExtDeltaQ) {
+  cfg_.rc_end_usage = AOM_CQ;
+  aq_mode_ = 0;
+  deltaq_mode_ = 2;
+  ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
+                                       30, 1, 0, 100);
+
+  ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
+}
+#endif
+
 AV1_INSTANTIATE_TEST_CASE(AqSegmentTest,
                           ::testing::Values(::libaom_test::kRealTime,
                                             ::libaom_test::kOnePassGood),